@shipfox/api-workflows 13.0.0 → 13.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +15 -0
- package/dist/core/errors.d.ts +9 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +5 -1
- package/dist/core/errors.js.map +1 -1
- package/dist/core/job-execution.d.ts.map +1 -1
- package/dist/core/job-execution.js +12 -2
- package/dist/core/job-execution.js.map +1 -1
- package/dist/core/step-config/agent.d.ts.map +1 -1
- package/dist/core/step-config/agent.js +9 -1
- package/dist/core/step-config/agent.js.map +1 -1
- package/dist/presentation/dto/step.d.ts.map +1 -1
- package/dist/presentation/dto/step.js +14 -0
- package/dist/presentation/dto/step.js.map +1 -1
- package/dist/presentation/routes/agent-runtime-config.d.ts.map +1 -1
- package/dist/presentation/routes/agent-runtime-config.js +22 -0
- package/dist/presentation/routes/agent-runtime-config.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/core/errors.ts +17 -2
- package/src/core/job-execution.test.ts +54 -0
- package/src/core/job-execution.ts +6 -1
- package/src/core/step-config/agent.ts +8 -1
- package/src/core/step-config/complete-step-dispatch-config.test.ts +37 -0
- package/src/presentation/dto/step.test.ts +8 -0
- package/src/presentation/dto/step.ts +9 -0
- package/src/presentation/routes/agent-runtime-config.test.ts +84 -2
- package/src/presentation/routes/agent-runtime-config.ts +24 -0
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/presentation/dto/step.ts"],"sourcesContent":["import {\n agentConfigIssueSchema,\n type StepAttemptDetailResponseDto,\n type StepAttemptDto,\n type StepDto,\n type StepErrorCategoryDto,\n type StepErrorDto,\n type StepGateResultDto,\n stepErrorReasonSchema,\n} from '@shipfox/api-workflows-dto';\nimport type {Step, StepAttempt} from '#core/entities/step.js';\nimport {GATE_EVALUATION_ERROR_REASON} from '#core/step-transition/evaluate-gate.js';\nimport {toEvaluationTraceDto} from './evaluation-trace.js';\n\n// Domain `error` is loosely typed (jsonb), so narrow it to the fixed runner\n// contract rather than trusting whatever shape the row happens to hold. `category`\n// is not stored on the row; the caller derives it from the step type and passes it\n// in (server-authoritative, never trusted from the runner).\nfunction toStepErrorDto(\n error: Record<string, unknown> | null,\n category: StepErrorCategoryDto,\n): StepErrorDto {\n if (error === null) return null;\n const message = typeof error.message === 'string' ? error.message : '';\n const exitCode = error.exitCode;\n const signal = typeof error.signal === 'string' ? error.signal : undefined;\n const field = typeof error.field === 'string' ? error.field : undefined;\n const source = typeof error.source === 'string' ? error.source : undefined;\n const reason = stepErrorReasonSchema.safeParse(error.reason);\n const agentConfigIssue = agentConfigIssueSchema.safeParse(error.agentConfigIssue);\n return {\n message,\n ...(exitCode === null || typeof exitCode === 'number' ? {exit_code: exitCode} : {}),\n ...(signal === undefined ? {} : {signal}),\n ...(reason.success ? {reason: reason.data} : {}),\n ...(field === undefined ? {} : {field}),\n ...(source === undefined ? {} : {source}),\n ...(agentConfigIssue.success ? {agent_config_issue: agentConfigIssue.data} : {}),\n category,\n };\n}\n\n// Inverse of toStepErrorDto: reported wire errors land on the domain row in\n// camelCase so the read path renders them back without a special case. `category`\n// is intentionally NOT persisted: the server derives it from the step type on\n// read, so a runner-supplied category is ignored here.\nexport function fromStepErrorDto(error: StepErrorDto | undefined): Record<string, unknown> | null {\n if (!error) return null;\n return {\n message: error.message,\n ...(error.exit_code === null || typeof error.exit_code === 'number'\n ? {exitCode: error.exit_code}\n : {}),\n ...(typeof error.signal === 'string' ? {signal: error.signal} : {}),\n ...(error.reason === undefined ? {} : {reason: error.reason}),\n ...(error.field === undefined ? {} : {field: error.field}),\n ...(error.source === undefined ? {} : {source: error.source}),\n ...(error.agent_config_issue === undefined ? {} : {agentConfigIssue: error.agent_config_issue}),\n };\n}\n\nfunction isIntOrNull(value: unknown): value is number | null {\n return value === null || (typeof value === 'number' && Number.isInteger(value));\n}\n\nfunction toStepGateResultDto(\n gateResult: Record<string, unknown> | null,\n status: string,\n): StepGateResultDto {\n if (gateResult === null) {\n return status === 'running' || status === 'pending' ? {kind: 'not_evaluated'} : {kind: 'none'};\n }\n\n const exitCode = gateResult.exit_code;\n const passed = gateResult.passed;\n const source = gateResult.source;\n const reason = gateResult.reason;\n\n if (passed === true && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'passed', passed, source, exit_code: exitCode};\n }\n\n if (\n passed === false &&\n gateResult.uncheckable === true &&\n typeof reason === 'string' &&\n isIntOrNull(exitCode)\n ) {\n if (reason === GATE_EVALUATION_ERROR_REASON) {\n return {kind: 'evaluation_error', reason, exit_code: exitCode};\n }\n return {kind: 'uncheckable', passed, uncheckable: true, reason, exit_code: exitCode};\n }\n\n if (passed === false && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'failed', passed, source, exit_code: exitCode};\n }\n\n return {kind: 'unknown', data: gateResult};\n}\n\nexport function toStepDto(step: Step): StepDto {\n return {\n id: step.id,\n job_execution_id: step.jobExecutionId,\n key: step.key,\n name: step.name,\n source_location: toStepSourceLocationDto(step.sourceLocation),\n status: step.status,\n status_reason: step.statusReason,\n type: step.type,\n config: step.config,\n evaluation_trace: toEvaluationTraceDto(step.evaluationTrace),\n error: toStepErrorDto(\n step.error,\n step.type === 'setup' || step.type === 'checkout' ? 'setup' : 'user',\n ),\n position: step.position,\n current_attempt: step.currentAttempt,\n created_at: step.createdAt.toISOString(),\n updated_at: step.updatedAt.toISOString(),\n };\n}\n\nfunction toStepSourceLocationDto(\n sourceLocation: Step['sourceLocation'],\n): StepDto['source_location'] {\n if (sourceLocation === null) return null;\n return {\n start_line: sourceLocation.startLine,\n end_line: sourceLocation.endLine,\n };\n}\n\nexport function toStepAttemptDto(attempt: StepAttempt): StepAttemptDto {\n return {\n id: attempt.id,\n step_id: attempt.stepId,\n attempt: attempt.attempt,\n execution_order: attempt.executionOrder,\n status: attempt.status,\n exit_code: attempt.exitCode,\n output: attempt.output,\n outputs: attempt.output,\n response: attempt.response,\n error: attempt.error,\n gate_result: toStepGateResultDto(attempt.gateResult, attempt.status),\n restart_feedback: attempt.restartFeedback,\n started_at: attempt.startedAt.toISOString(),\n finished_at: attempt.finishedAt ? attempt.finishedAt.toISOString() : null,\n };\n}\n\nexport function toStepAttemptDetailResponseDto(\n step: Step,\n attempt: StepAttempt,\n): StepAttemptDetailResponseDto {\n return {\n step_id: step.id,\n attempt: attempt.attempt,\n authored_config: step.authoredConfig,\n config: attempt.config,\n evaluation_trace: toEvaluationTraceDto(attempt.evaluationTrace),\n };\n}\n"],"names":["agentConfigIssueSchema","stepErrorReasonSchema","GATE_EVALUATION_ERROR_REASON","toEvaluationTraceDto","toStepErrorDto","error","category","message","exitCode","signal","undefined","field","source","reason","safeParse","agentConfigIssue","exit_code","success","data","agent_config_issue","fromStepErrorDto","isIntOrNull","value","Number","isInteger","toStepGateResultDto","gateResult","status","kind","passed","uncheckable","toStepDto","step","id","job_execution_id","jobExecutionId","key","name","source_location","toStepSourceLocationDto","sourceLocation","status_reason","statusReason","type","config","evaluation_trace","evaluationTrace","position","current_attempt","currentAttempt","created_at","createdAt","toISOString","updated_at","updatedAt","start_line","startLine","end_line","endLine","toStepAttemptDto","attempt","step_id","stepId","execution_order","executionOrder","output","outputs","response","gate_result","restart_feedback","restartFeedback","started_at","startedAt","finished_at","finishedAt","toStepAttemptDetailResponseDto","authored_config","authoredConfig"],"mappings":"AAAA,SACEA,sBAAsB,EAOtBC,qBAAqB,QAChB,6BAA6B;AAEpC,SAAQC,4BAA4B,QAAO,yCAAyC;AACpF,SAAQC,oBAAoB,QAAO,wBAAwB;AAE3D,4EAA4E;AAC5E,mFAAmF;AACnF,mFAAmF;AACnF,4DAA4D;AAC5D,SAASC,eACPC,KAAqC,EACrCC,QAA8B;IAE9B,IAAID,UAAU,MAAM,OAAO;IAC3B,MAAME,UAAU,OAAOF,MAAME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D,KAAK;QACpB+D,aAAa3C,oBAAoBmC,QAAQlC,UAAU,EAAEkC,QAAQjC,MAAM;QACnE0C,kBAAkBT,QAAQU,eAAe;QACzCC,YAAYX,QAAQY,SAAS,CAACpB,WAAW;QACzCqB,aAAab,QAAQc,UAAU,GAAGd,QAAQc,UAAU,CAACtB,WAAW,KAAK;IACvE;AACF;AAEA,OAAO,SAASuB,+BACd3C,IAAU,EACV4B,OAAoB;IAEpB,OAAO;QACLC,SAAS7B,KAAKC,EAAE;QAChB2B,SAASA,QAAQA,OAAO;QACxBgB,iBAAiB5C,KAAK6C,cAAc;QACpCjC,QAAQgB,QAAQhB,MAAM;QACtBC,kBAAkB1C,qBAAqByD,QAAQd,eAAe;IAChE;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/dto/step.ts"],"sourcesContent":["import {\n agentConfigIssueSchema,\n type StepAttemptDetailResponseDto,\n type StepAttemptDto,\n type StepDto,\n type StepErrorCategoryDto,\n type StepErrorDto,\n type StepGateResultDto,\n stepErrorReasonSchema,\n} from '@shipfox/api-workflows-dto';\nimport type {Step, StepAttempt} from '#core/entities/step.js';\nimport {GATE_EVALUATION_ERROR_REASON} from '#core/step-transition/evaluate-gate.js';\nimport {toEvaluationTraceDto} from './evaluation-trace.js';\n\n// Domain `error` is loosely typed (jsonb), so narrow it to the fixed runner\n// contract rather than trusting whatever shape the row happens to hold. `category`\n// is not stored on the row; the caller derives it from the step type and passes it\n// in (server-authoritative, never trusted from the runner).\nfunction toStepErrorDto(\n error: Record<string, unknown> | null,\n category: StepErrorCategoryDto,\n): StepErrorDto {\n if (error === null) return null;\n const message = typeof error.message === 'string' ? error.message : '';\n const code = typeof error.code === 'string' ? error.code : undefined;\n const managedProviderId =\n typeof error.managedProviderId === 'string' ? error.managedProviderId : undefined;\n const exitCode = error.exitCode;\n const signal = typeof error.signal === 'string' ? error.signal : undefined;\n const field = typeof error.field === 'string' ? error.field : undefined;\n const source = typeof error.source === 'string' ? error.source : undefined;\n const reason = stepErrorReasonSchema.safeParse(error.reason);\n const agentConfigIssue = agentConfigIssueSchema.safeParse(error.agentConfigIssue);\n return {\n message,\n ...(code === undefined ? {} : {code}),\n ...(managedProviderId === undefined ? {} : {managed_provider_id: managedProviderId}),\n ...(exitCode === null || typeof exitCode === 'number' ? {exit_code: exitCode} : {}),\n ...(signal === undefined ? {} : {signal}),\n ...(reason.success ? {reason: reason.data} : {}),\n ...(field === undefined ? {} : {field}),\n ...(source === undefined ? {} : {source}),\n ...(agentConfigIssue.success ? {agent_config_issue: agentConfigIssue.data} : {}),\n category,\n };\n}\n\n// Inverse of toStepErrorDto: reported wire errors land on the domain row in\n// camelCase so the read path renders them back without a special case. `category`\n// is intentionally NOT persisted: the server derives it from the step type on\n// read, so a runner-supplied category is ignored here.\nexport function fromStepErrorDto(error: StepErrorDto | undefined): Record<string, unknown> | null {\n if (!error) return null;\n return {\n message: error.message,\n ...(error.code === undefined ? {} : {code: error.code}),\n ...(error.managed_provider_id === undefined\n ? {}\n : {managedProviderId: error.managed_provider_id}),\n ...(error.exit_code === null || typeof error.exit_code === 'number'\n ? {exitCode: error.exit_code}\n : {}),\n ...(typeof error.signal === 'string' ? {signal: error.signal} : {}),\n ...(error.reason === undefined ? {} : {reason: error.reason}),\n ...(error.field === undefined ? {} : {field: error.field}),\n ...(error.source === undefined ? {} : {source: error.source}),\n ...(error.agent_config_issue === undefined ? {} : {agentConfigIssue: error.agent_config_issue}),\n };\n}\n\nfunction isIntOrNull(value: unknown): value is number | null {\n return value === null || (typeof value === 'number' && Number.isInteger(value));\n}\n\nfunction toStepGateResultDto(\n gateResult: Record<string, unknown> | null,\n status: string,\n): StepGateResultDto {\n if (gateResult === null) {\n return status === 'running' || status === 'pending' ? {kind: 'not_evaluated'} : {kind: 'none'};\n }\n\n const exitCode = gateResult.exit_code;\n const passed = gateResult.passed;\n const source = gateResult.source;\n const reason = gateResult.reason;\n\n if (passed === true && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'passed', passed, source, exit_code: exitCode};\n }\n\n if (\n passed === false &&\n gateResult.uncheckable === true &&\n typeof reason === 'string' &&\n isIntOrNull(exitCode)\n ) {\n if (reason === GATE_EVALUATION_ERROR_REASON) {\n return {kind: 'evaluation_error', reason, exit_code: exitCode};\n }\n return {kind: 'uncheckable', passed, uncheckable: true, reason, exit_code: exitCode};\n }\n\n if (passed === false && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'failed', passed, source, exit_code: exitCode};\n }\n\n return {kind: 'unknown', data: gateResult};\n}\n\nexport function toStepDto(step: Step): StepDto {\n return {\n id: step.id,\n job_execution_id: step.jobExecutionId,\n key: step.key,\n name: step.name,\n source_location: toStepSourceLocationDto(step.sourceLocation),\n status: step.status,\n status_reason: step.statusReason,\n type: step.type,\n config: step.config,\n evaluation_trace: toEvaluationTraceDto(step.evaluationTrace),\n error: toStepErrorDto(\n step.error,\n step.type === 'setup' || step.type === 'checkout' ? 'setup' : 'user',\n ),\n position: step.position,\n current_attempt: step.currentAttempt,\n created_at: step.createdAt.toISOString(),\n updated_at: step.updatedAt.toISOString(),\n };\n}\n\nfunction toStepSourceLocationDto(\n sourceLocation: Step['sourceLocation'],\n): StepDto['source_location'] {\n if (sourceLocation === null) return null;\n return {\n start_line: sourceLocation.startLine,\n end_line: sourceLocation.endLine,\n };\n}\n\nexport function toStepAttemptDto(attempt: StepAttempt): StepAttemptDto {\n return {\n id: attempt.id,\n step_id: attempt.stepId,\n attempt: attempt.attempt,\n execution_order: attempt.executionOrder,\n status: attempt.status,\n exit_code: attempt.exitCode,\n output: attempt.output,\n outputs: attempt.output,\n response: attempt.response,\n error: attempt.error,\n gate_result: toStepGateResultDto(attempt.gateResult, attempt.status),\n restart_feedback: attempt.restartFeedback,\n started_at: attempt.startedAt.toISOString(),\n finished_at: attempt.finishedAt ? attempt.finishedAt.toISOString() : null,\n };\n}\n\nexport function toStepAttemptDetailResponseDto(\n step: Step,\n attempt: StepAttempt,\n): StepAttemptDetailResponseDto {\n return {\n step_id: step.id,\n attempt: attempt.attempt,\n authored_config: step.authoredConfig,\n config: attempt.config,\n evaluation_trace: toEvaluationTraceDto(attempt.evaluationTrace),\n };\n}\n"],"names":["agentConfigIssueSchema","stepErrorReasonSchema","GATE_EVALUATION_ERROR_REASON","toEvaluationTraceDto","toStepErrorDto","error","category","message","code","undefined","managedProviderId","exitCode","signal","field","source","reason","safeParse","agentConfigIssue","managed_provider_id","exit_code","success","data","agent_config_issue","fromStepErrorDto","isIntOrNull","value","Number","isInteger","toStepGateResultDto","gateResult","status","kind","passed","uncheckable","toStepDto","step","id","job_execution_id","jobExecutionId","key","name","source_location","toStepSourceLocationDto","sourceLocation","status_reason","statusReason","type","config","evaluation_trace","evaluationTrace","position","current_attempt","currentAttempt","created_at","createdAt","toISOString","updated_at","updatedAt","start_line","startLine","end_line","endLine","toStepAttemptDto","attempt","step_id","stepId","execution_order","executionOrder","output","outputs","response","gate_result","restart_feedback","restartFeedback","started_at","startedAt","finished_at","finishedAt","toStepAttemptDetailResponseDto","authored_config","authoredConfig"],"mappings":"AAAA,SACEA,sBAAsB,EAOtBC,qBAAqB,QAChB,6BAA6B;AAEpC,SAAQC,4BAA4B,QAAO,yCAAyC;AACpF,SAAQC,oBAAoB,QAAO,wBAAwB;AAE3D,4EAA4E;AAC5E,mFAAmF;AACnF,mFAAmF;AACnF,4DAA4D;AAC5D,SAASC,eACPC,KAAqC,EACrCC,QAA8B;IAE9B,IAAID,UAAU,MAAM,OAAO;IAC3B,MAAME,UAAU,OAAOF,MAAME,OAAO,KAAK,WAAWF,MAAME,OAAO,GAAG;IACpE,MAAMC,OAAO,OAAOH,MAAMG,IAAI,KAAK,WAAWH,MAAMG,IAAI,GAAGC;IAC3D,MAAMC,oBACJ,OAAOL,MAAMK,iBAAiB,KAAK,WAAWL,MAAMK,iBAAiB,GAAGD;IAC1E,MAAME,WAAWN,MAAMM,QAAQ;IAC/B,MAAMC,SAAS,OAAOP,MAAMO,MAAM,KAAK,WA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xBG,iBAAiBH,QAAQI,cAAc;QACvCrC,QAAQiC,QAAQjC,MAAM;QACtBX,WAAW4C,QAAQpD,QAAQ;QAC3ByD,QAAQL,QAAQK,MAAM;QACtBC,SAASN,QAAQK,MAAM;QACvBE,UAAUP,QAAQO,QAAQ;QAC1BjE,OAAO0D,QAAQ1D,KAAK;QACpBkE,aAAa3C,oBAAoBmC,QAAQlC,UAAU,EAAEkC,QAAQjC,MAAM;QACnE0C,kBAAkBT,QAAQU,eAAe;QACzCC,YAAYX,QAAQY,SAAS,CAACpB,WAAW;QACzCqB,aAAab,QAAQc,UAAU,GAAGd,QAAQc,UAAU,CAACtB,WAAW,KAAK;IACvE;AACF;AAEA,OAAO,SAASuB,+BACd3C,IAAU,EACV4B,OAAoB;IAEpB,OAAO;QACLC,SAAS7B,KAAKC,EAAE;QAChB2B,SAASA,QAAQA,OAAO;QACxBgB,iBAAiB5C,KAAK6C,cAAc;QACpCjC,QAAQgB,QAAQhB,MAAM;QACtBC,kBAAkB7C,qBAAqB4D,QAAQd,eAAe;IAChE;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-runtime-config.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/agent-runtime-config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-runtime-config.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/agent-runtime-config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AASpF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE;IACpD,KAAK,EAAE,sBAAsB,CAAC;IAC9B,OAAO,EAAE,wBAAwB,CAAC;CACnC,mDA4GA"}
|
|
@@ -5,6 +5,7 @@ import { isInterModuleKnownError } from '@shipfox/inter-module';
|
|
|
5
5
|
import { captureException } from '@shipfox/node-error-monitoring';
|
|
6
6
|
import { ClientError, defineRoute } from '@shipfox/node-fastify';
|
|
7
7
|
import { ZodError } from 'zod';
|
|
8
|
+
import { getStepAttemptDetail } from '#db/index.js';
|
|
8
9
|
import { loadRunningLeasedStep } from './leased-step.js';
|
|
9
10
|
export function createAgentRuntimeConfigRoute(params) {
|
|
10
11
|
return defineRoute({
|
|
@@ -30,6 +31,16 @@ export function createAgentRuntimeConfigRoute(params) {
|
|
|
30
31
|
status: 409
|
|
31
32
|
});
|
|
32
33
|
}
|
|
34
|
+
if (isInterModuleKnownError(agentInterModuleContract.methods.resolveRuntimeCredentials, error) && error.code === 'workspace-providers-disabled') {
|
|
35
|
+
const message = error.details.message ?? 'Workspace provider configuration is disabled';
|
|
36
|
+
throw new ClientError(message, 'workspace-providers-disabled', {
|
|
37
|
+
status: 422,
|
|
38
|
+
details: {
|
|
39
|
+
managed_provider_id: error.details.managed_provider_id,
|
|
40
|
+
message
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
33
44
|
throw error;
|
|
34
45
|
},
|
|
35
46
|
handler: async (request, reply)=>{
|
|
@@ -57,8 +68,19 @@ export function createAgentRuntimeConfigRoute(params) {
|
|
|
57
68
|
}
|
|
58
69
|
throw error;
|
|
59
70
|
}
|
|
71
|
+
const stepAttempt = await getStepAttemptDetail({
|
|
72
|
+
stepId,
|
|
73
|
+
attempt
|
|
74
|
+
});
|
|
75
|
+
if (!stepAttempt) {
|
|
76
|
+
throw new ClientError('Step attempt not found', 'step-attempt-not-found', {
|
|
77
|
+
status: 409
|
|
78
|
+
});
|
|
79
|
+
}
|
|
60
80
|
const runtimeConfig = await params.agent.resolveRuntimeCredentials({
|
|
61
81
|
workspaceId,
|
|
82
|
+
runId: stepAttempt.workflowRunId,
|
|
83
|
+
stepAttemptId: stepAttempt.attempt.id,
|
|
62
84
|
harness: agentConfig.harness,
|
|
63
85
|
provider: agentConfig.provider,
|
|
64
86
|
model: agentConfig.model,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/presentation/routes/agent-runtime-config.ts"],"sourcesContent":["import {\n agentRuntimeCredentialsResponseSchema,\n type MaterializedAgentStepConfigDto,\n materializedAgentStepConfigSchema,\n} from '@shipfox/api-agent-dto';\nimport {\n type AgentInterModuleClient,\n agentInterModuleContract,\n} from '@shipfox/api-agent-dto/inter-module';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport {agentRuntimeConfigQuerySchema} from '@shipfox/api-workflows-dto';\nimport {isInterModuleKnownError} from '@shipfox/inter-module';\nimport {captureException} from '@shipfox/node-error-monitoring';\nimport {ClientError, defineRoute} from '@shipfox/node-fastify';\nimport {ZodError} from 'zod';\nimport {loadRunningLeasedStep} from './leased-step.js';\n\nexport function createAgentRuntimeConfigRoute(params: {\n agent: AgentInterModuleClient;\n runners: RunnersInterModuleClient;\n}) {\n return defineRoute({\n method: 'GET',\n path: '/agent-runtime-config',\n description:\n \"Returns the resolved harness, provider, model, thinking effort, and decrypted provider credential bundle for the runner's currently leased running agent step. The job is identified by the lease token and the step is bound to that job before credentials are returned.\",\n schema: {\n querystring: agentRuntimeConfigQuerySchema,\n response: {\n 200: agentRuntimeCredentialsResponseSchema,\n },\n },\n errorHandler: (error) => {\n if (\n isInterModuleKnownError(\n agentInterModuleContract.methods.resolveRuntimeCredentials,\n error,\n ) &&\n error.code === 'model-provider-credentials-invalid'\n ) {\n captureException(error);\n throw new ClientError(\n 'Model provider credentials could not be decrypted',\n 'model-provider-credentials-invalid',\n {\n status: 409,\n cause: error,\n },\n );\n }\n if (\n isInterModuleKnownError(\n agentInterModuleContract.methods.resolveRuntimeCredentials,\n error,\n ) &&\n error.code === 'model-provider-not-configured'\n ) {\n throw new ClientError(\n 'Model provider credentials are not configured',\n 'model-provider-not-configured',\n {\n status: 409,\n },\n );\n }\n throw error;\n },\n handler: async (request, reply) => {\n const {step_id: stepId, attempt} = request.query;\n const {step, workspaceId} = await loadRunningLeasedStep({\n runners: params.runners,\n request,\n stepId,\n attempt,\n });\n\n if (step.type !== 'agent') {\n throw new ClientError('Step is not an agent step', 'step-not-agent', {status: 409});\n }\n\n let agentConfig: MaterializedAgentStepConfigDto;\n try {\n agentConfig = materializedAgentStepConfigSchema.parse(step.config);\n } catch (error) {\n if (error instanceof ZodError) {\n throw new ClientError('Agent step config is invalid', 'agent-step-config-invalid', {\n status: 409,\n cause: error,\n });\n }\n throw error;\n }\n\n const runtimeConfig = await params.agent.resolveRuntimeCredentials({\n workspaceId,\n harness: agentConfig.harness,\n provider: agentConfig.provider,\n model: agentConfig.model,\n thinking: agentConfig.thinking,\n });\n\n reply.header('cache-control', 'no-store');\n return runtimeConfig;\n },\n });\n}\n"],"names":["agentRuntimeCredentialsResponseSchema","materializedAgentStepConfigSchema","agentInterModuleContract","agentRuntimeConfigQuerySchema","isInterModuleKnownError","captureException","ClientError","defineRoute","ZodError","loadRunningLeasedStep","createAgentRuntimeConfigRoute","params","method","path","description","schema","querystring","response","errorHandler","error","methods","resolveRuntimeCredentials","code","status","cause","handler","request","reply","step_id","stepId","attempt","query","step","workspaceId","runners","type","agentConfig","parse","config","runtimeConfig","agent","harness","provider","model","thinking","header"],"mappings":"AAAA,SACEA,qCAAqC,EAErCC,iCAAiC,QAC5B,yBAAyB;AAChC,SAEEC,wBAAwB,QACnB,sCAAsC;AAE7C,SAAQC,6BAA6B,QAAO,6BAA6B;AACzE,SAAQC,uBAAuB,QAAO,wBAAwB;AAC9D,SAAQC,gBAAgB,QAAO,iCAAiC;AAChE,SAAQC,WAAW,EAAEC,WAAW,QAAO,wBAAwB;AAC/D,SAAQC,QAAQ,QAAO,MAAM;AAC7B,SAAQC,qBAAqB,QAAO,mBAAmB;AAEvD,OAAO,SAASC,8BAA8BC,MAG7C;IACC,
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/routes/agent-runtime-config.ts"],"sourcesContent":["import {\n agentRuntimeCredentialsResponseSchema,\n type MaterializedAgentStepConfigDto,\n materializedAgentStepConfigSchema,\n} from '@shipfox/api-agent-dto';\nimport {\n type AgentInterModuleClient,\n agentInterModuleContract,\n} from '@shipfox/api-agent-dto/inter-module';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport {agentRuntimeConfigQuerySchema} from '@shipfox/api-workflows-dto';\nimport {isInterModuleKnownError} from '@shipfox/inter-module';\nimport {captureException} from '@shipfox/node-error-monitoring';\nimport {ClientError, defineRoute} from '@shipfox/node-fastify';\nimport {ZodError} from 'zod';\nimport {getStepAttemptDetail} from '#db/index.js';\nimport {loadRunningLeasedStep} from './leased-step.js';\n\nexport function createAgentRuntimeConfigRoute(params: {\n agent: AgentInterModuleClient;\n runners: RunnersInterModuleClient;\n}) {\n return defineRoute({\n method: 'GET',\n path: '/agent-runtime-config',\n description:\n \"Returns the resolved harness, provider, model, thinking effort, and decrypted provider credential bundle for the runner's currently leased running agent step. The job is identified by the lease token and the step is bound to that job before credentials are returned.\",\n schema: {\n querystring: agentRuntimeConfigQuerySchema,\n response: {\n 200: agentRuntimeCredentialsResponseSchema,\n },\n },\n errorHandler: (error) => {\n if (\n isInterModuleKnownError(\n agentInterModuleContract.methods.resolveRuntimeCredentials,\n error,\n ) &&\n error.code === 'model-provider-credentials-invalid'\n ) {\n captureException(error);\n throw new ClientError(\n 'Model provider credentials could not be decrypted',\n 'model-provider-credentials-invalid',\n {\n status: 409,\n cause: error,\n },\n );\n }\n if (\n isInterModuleKnownError(\n agentInterModuleContract.methods.resolveRuntimeCredentials,\n error,\n ) &&\n error.code === 'model-provider-not-configured'\n ) {\n throw new ClientError(\n 'Model provider credentials are not configured',\n 'model-provider-not-configured',\n {\n status: 409,\n },\n );\n }\n if (\n isInterModuleKnownError(\n agentInterModuleContract.methods.resolveRuntimeCredentials,\n error,\n ) &&\n error.code === 'workspace-providers-disabled'\n ) {\n const message = error.details.message ?? 'Workspace provider configuration is disabled';\n throw new ClientError(message, 'workspace-providers-disabled', {\n status: 422,\n details: {\n managed_provider_id: error.details.managed_provider_id,\n message,\n },\n });\n }\n throw error;\n },\n handler: async (request, reply) => {\n const {step_id: stepId, attempt} = request.query;\n const {step, workspaceId} = await loadRunningLeasedStep({\n runners: params.runners,\n request,\n stepId,\n attempt,\n });\n\n if (step.type !== 'agent') {\n throw new ClientError('Step is not an agent step', 'step-not-agent', {status: 409});\n }\n\n let agentConfig: MaterializedAgentStepConfigDto;\n try {\n agentConfig = materializedAgentStepConfigSchema.parse(step.config);\n } catch (error) {\n if (error instanceof ZodError) {\n throw new ClientError('Agent step config is invalid', 'agent-step-config-invalid', {\n status: 409,\n cause: error,\n });\n }\n throw error;\n }\n\n const stepAttempt = await getStepAttemptDetail({stepId, attempt});\n if (!stepAttempt) {\n throw new ClientError('Step attempt not found', 'step-attempt-not-found', {status: 409});\n }\n\n const runtimeConfig = await params.agent.resolveRuntimeCredentials({\n workspaceId,\n runId: stepAttempt.workflowRunId,\n stepAttemptId: stepAttempt.attempt.id,\n harness: agentConfig.harness,\n provider: agentConfig.provider,\n model: agentConfig.model,\n thinking: agentConfig.thinking,\n });\n\n reply.header('cache-control', 'no-store');\n return runtimeConfig;\n },\n });\n}\n"],"names":["agentRuntimeCredentialsResponseSchema","materializedAgentStepConfigSchema","agentInterModuleContract","agentRuntimeConfigQuerySchema","isInterModuleKnownError","captureException","ClientError","defineRoute","ZodError","getStepAttemptDetail","loadRunningLeasedStep","createAgentRuntimeConfigRoute","params","method","path","description","schema","querystring","response","errorHandler","error","methods","resolveRuntimeCredentials","code","status","cause","message","details","managed_provider_id","handler","request","reply","step_id","stepId","attempt","query","step","workspaceId","runners","type","agentConfig","parse","config","stepAttempt","runtimeConfig","agent","runId","workflowRunId","stepAttemptId","id","harness","provider","model","thinking","header"],"mappings":"AAAA,SACEA,qCAAqC,EAErCC,iCAAiC,QAC5B,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