mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-20 07:04:38 +00:00
repo: push all current workspace changes
This commit is contained in:
parent
252fbdc93b
commit
e7dfff5836
29 changed files with 577 additions and 98 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { createErrorContext, createFoundryLogger } from "@sandbox-agent/foundry-shared";
|
||||
|
||||
type Journal = {
|
||||
entries?: Array<{
|
||||
|
|
@ -11,6 +12,10 @@ type Journal = {
|
|||
}>;
|
||||
};
|
||||
|
||||
const logger = createFoundryLogger({
|
||||
service: "foundry-backend-migrations",
|
||||
});
|
||||
|
||||
function padMigrationKey(idx: number): string {
|
||||
return `m${String(idx).padStart(4, "0")}`;
|
||||
}
|
||||
|
|
@ -128,8 +133,6 @@ async function main(): Promise<void> {
|
|||
}
|
||||
|
||||
main().catch((error: unknown) => {
|
||||
const message = error instanceof Error ? (error.stack ?? error.message) : String(error);
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(message);
|
||||
logger.error(createErrorContext(error), "generate_actor_migrations_failed");
|
||||
process.exitCode = 1;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,11 +1,5 @@
|
|||
import { pino } from "pino";
|
||||
import { createFoundryLogger } from "@sandbox-agent/foundry-shared";
|
||||
|
||||
const level = process.env.FOUNDRY_LOG_LEVEL ?? process.env.LOG_LEVEL ?? process.env.RIVET_LOG_LEVEL ?? "info";
|
||||
|
||||
export const logger = pino({
|
||||
level,
|
||||
base: {
|
||||
service: "foundry-backend",
|
||||
},
|
||||
timestamp: pino.stdTimeFunctions.isoTime,
|
||||
export const logger = createFoundryLogger({
|
||||
service: "foundry-backend",
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { createHmac, createPrivateKey, createSign, timingSafeEqual } from "node:crypto";
|
||||
import { logger } from "../logging.js";
|
||||
|
||||
export class GitHubAppError extends Error {
|
||||
readonly status: number;
|
||||
|
|
@ -51,6 +52,10 @@ interface GitHubPageResponse<T> {
|
|||
nextUrl: string | null;
|
||||
}
|
||||
|
||||
const githubOAuthLogger = logger.child({
|
||||
scope: "github-oauth",
|
||||
});
|
||||
|
||||
export interface GitHubWebhookEvent {
|
||||
action?: string;
|
||||
installation?: { id: number; account?: { login?: string; type?: string; id?: number } | null };
|
||||
|
|
@ -167,13 +172,16 @@ export class GitHubAppClient {
|
|||
code,
|
||||
redirect_uri: this.redirectUri,
|
||||
};
|
||||
console.log("[github-oauth] exchangeCode request", {
|
||||
url: `${this.authBaseUrl}/login/oauth/access_token`,
|
||||
client_id: this.clientId,
|
||||
redirect_uri: this.redirectUri,
|
||||
code_length: code.length,
|
||||
code_prefix: code.slice(0, 6),
|
||||
});
|
||||
githubOAuthLogger.debug(
|
||||
{
|
||||
url: `${this.authBaseUrl}/login/oauth/access_token`,
|
||||
clientId: this.clientId,
|
||||
redirectUri: this.redirectUri,
|
||||
codeLength: code.length,
|
||||
codePrefix: code.slice(0, 6),
|
||||
},
|
||||
"exchange_code_request",
|
||||
);
|
||||
|
||||
const response = await fetch(`${this.authBaseUrl}/login/oauth/access_token`, {
|
||||
method: "POST",
|
||||
|
|
@ -185,10 +193,13 @@ export class GitHubAppClient {
|
|||
});
|
||||
|
||||
const responseText = await response.text();
|
||||
console.log("[github-oauth] exchangeCode response", {
|
||||
status: response.status,
|
||||
body: responseText.slice(0, 300),
|
||||
});
|
||||
githubOAuthLogger.debug(
|
||||
{
|
||||
status: response.status,
|
||||
bodyPreview: responseText.slice(0, 300),
|
||||
},
|
||||
"exchange_code_response",
|
||||
);
|
||||
let payload: GitHubTokenResponse;
|
||||
try {
|
||||
payload = JSON.parse(responseText) as GitHubTokenResponse;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue