agency-lang 0.2.0 → 0.3.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/dist/lib/agents/agency-agent/agent.agency +3 -2
- package/dist/lib/agents/judge.js +67 -70
- package/dist/lib/agents/policy/agent.agency +153 -53
- package/dist/lib/agents/policy/prompts/system.md +7 -0
- package/dist/lib/agents/review/agent.agency +2 -1
- package/dist/lib/agents/review/agent.js +394 -446
- package/dist/lib/backends/agencyGenerator.d.ts +45 -2
- package/dist/lib/backends/agencyGenerator.js +249 -62
- package/dist/lib/backends/agencyGenerator.test.js +106 -76
- package/dist/lib/backends/docstringInterpolationRuntime.test.js +59 -0
- package/dist/lib/backends/typescriptBuilder/assignmentEmitter.d.ts +64 -0
- package/dist/lib/backends/typescriptBuilder/assignmentEmitter.js +104 -0
- package/dist/lib/backends/typescriptBuilder/nameClassifier.d.ts +51 -0
- package/dist/lib/backends/typescriptBuilder/nameClassifier.js +130 -0
- package/dist/lib/backends/typescriptBuilder/namedArgsResolver.d.ts +28 -0
- package/dist/lib/backends/typescriptBuilder/namedArgsResolver.js +92 -0
- package/dist/lib/backends/typescriptBuilder/namedArgsResolver.test.d.ts +1 -0
- package/dist/lib/backends/typescriptBuilder/namedArgsResolver.test.js +75 -0
- package/dist/lib/backends/typescriptBuilder/pipeChainEmitter.d.ts +94 -0
- package/dist/lib/backends/typescriptBuilder/pipeChainEmitter.js +227 -0
- package/dist/lib/backends/typescriptBuilder/pipeReceiverCodegen.test.d.ts +1 -0
- package/dist/lib/backends/typescriptBuilder/pipeReceiverCodegen.test.js +58 -0
- package/dist/lib/backends/typescriptBuilder/scopeManager.d.ts +62 -0
- package/dist/lib/backends/typescriptBuilder/scopeManager.js +131 -0
- package/dist/lib/backends/typescriptBuilder/sectionAssembler.d.ts +108 -0
- package/dist/lib/backends/typescriptBuilder/sectionAssembler.js +249 -0
- package/dist/lib/backends/typescriptBuilder/stepPathTracker.d.ts +45 -0
- package/dist/lib/backends/typescriptBuilder/stepPathTracker.js +76 -0
- package/dist/lib/backends/typescriptBuilder.d.ts +37 -114
- package/dist/lib/backends/typescriptBuilder.integration.test.js +0 -26
- package/dist/lib/backends/typescriptBuilder.js +603 -974
- package/dist/lib/backends/typescriptGenerator/jsonSchemaAnnotation.test.d.ts +1 -0
- package/dist/lib/backends/typescriptGenerator/jsonSchemaAnnotation.test.js +104 -0
- package/dist/lib/backends/typescriptGenerator/tagArgToTs.d.ts +19 -0
- package/dist/lib/backends/typescriptGenerator/tagArgToTs.js +171 -0
- package/dist/lib/backends/typescriptGenerator/tagArgToTs.test.d.ts +1 -0
- package/dist/lib/backends/typescriptGenerator/tagArgToTs.test.js +44 -0
- package/dist/lib/backends/typescriptGenerator/typeToString.js +96 -1
- package/dist/lib/backends/typescriptGenerator/typeToString.test.d.ts +1 -0
- package/dist/lib/backends/typescriptGenerator/typeToString.test.js +52 -0
- package/dist/lib/backends/typescriptGenerator/typeToZodSchema.d.ts +12 -3
- package/dist/lib/backends/typescriptGenerator/typeToZodSchema.js +105 -9
- package/dist/lib/backends/typescriptGenerator/typeToZodSchema.test.js +122 -1
- package/dist/lib/backends/typescriptGenerator/validationDescriptor.d.ts +31 -0
- package/dist/lib/backends/typescriptGenerator/validationDescriptor.js +257 -0
- package/dist/lib/cli/commands.js +9 -4
- package/dist/lib/cli/debug.js +2 -0
- package/dist/lib/cli/doc.js +74 -3
- package/dist/lib/cli/doc.test.js +39 -0
- package/dist/lib/cli/evaluate.js +3 -3
- package/dist/lib/cli/optimize.js +23 -2
- package/dist/lib/cli/optimize.test.js +6 -1
- package/dist/lib/cli/schedule/index.js +1 -0
- package/dist/lib/cli/serve.js +1 -0
- package/dist/lib/cli/test.js +19 -6
- package/dist/lib/cli/util.d.ts +2 -1
- package/dist/lib/cli/util.js +14 -6
- package/dist/lib/compilationUnit.d.ts +6 -7
- package/dist/lib/compilationUnit.js +35 -16
- package/dist/lib/compilationUnit.test.js +3 -35
- package/dist/lib/compiler/compile.d.ts +9 -6
- package/dist/lib/compiler/compile.js +36 -42
- package/dist/lib/compiler/compile.test.js +71 -21
- package/dist/lib/compiler/typecheck.d.ts +18 -0
- package/dist/lib/compiler/typecheck.js +79 -0
- package/dist/lib/config.js +1 -1
- package/dist/lib/debugger/debuggerState.js +0 -3
- package/dist/lib/debugger/driver.js +12 -3
- package/dist/lib/debugger/testHelpers.js +1 -0
- package/dist/lib/debugger/uiState.js +1 -0
- package/dist/lib/formatter.test.js +8 -0
- package/dist/lib/importPaths.d.ts +33 -0
- package/dist/lib/importPaths.js +37 -0
- package/dist/lib/importPaths.test.js +70 -0
- package/dist/lib/ir/builders.d.ts +115 -15
- package/dist/lib/ir/builders.js +166 -54
- package/dist/lib/ir/prettyPrint.js +43 -5
- package/dist/lib/ir/prettyPrint.test.js +35 -1
- package/dist/lib/ir/tsIR.d.ts +25 -1
- package/dist/lib/logsViewer/render.d.ts +2 -1
- package/dist/lib/logsViewer/render.js +57 -13
- package/dist/lib/logsViewer/render.test.js +63 -1
- package/dist/lib/logsViewer/run.js +5 -1
- package/dist/lib/logsViewer/search.d.ts +1 -1
- package/dist/lib/logsViewer/search.js +9 -5
- package/dist/lib/logsViewer/search.test.js +1 -1
- package/dist/lib/logsViewer/summary.js +1 -1
- package/dist/lib/logsViewer/types.d.ts +1 -0
- package/dist/lib/lowering/patternLowering.js +27 -1
- package/dist/lib/lowering/patternLowering.test.js +165 -0
- package/dist/lib/lsp/builtinHover.d.ts +5 -1
- package/dist/lib/lsp/builtinHover.js +41 -2
- package/dist/lib/lsp/completion.js +10 -6
- package/dist/lib/lsp/diagnostics.js +2 -2
- package/dist/lib/lsp/documentSymbol.js +0 -8
- package/dist/lib/lsp/foldingRange.js +0 -1
- package/dist/lib/lsp/semantics.js +1 -14
- package/dist/lib/lsp/server.js +1 -0
- package/dist/lib/lsp/workspaceSymbol.js +0 -1
- package/dist/lib/parser.js +2 -2
- package/dist/lib/parsers/function.test.js +175 -140
- package/dist/lib/parsers/objectTypeTags.test.d.ts +1 -0
- package/dist/lib/parsers/objectTypeTags.test.js +69 -0
- package/dist/lib/parsers/parsers.d.ts +50 -7
- package/dist/lib/parsers/parsers.js +302 -121
- package/dist/lib/parsers/pattern.test.js +146 -0
- package/dist/lib/parsers/tag.test.js +141 -13
- package/dist/lib/parsers/tagIntegration.test.js +11 -8
- package/dist/lib/parsers/typeHints.test.js +330 -1
- package/dist/lib/preprocessors/importResolver.js +10 -2
- package/dist/lib/preprocessors/injectSchemaArgs.d.ts +36 -0
- package/dist/lib/preprocessors/injectSchemaArgs.js +209 -0
- package/dist/lib/preprocessors/injectSchemaArgs.test.d.ts +1 -0
- package/dist/lib/preprocessors/injectSchemaArgs.test.js +383 -0
- package/dist/lib/preprocessors/liftCallbacks.d.ts +2 -0
- package/dist/lib/preprocessors/liftCallbacks.js +242 -0
- package/dist/lib/preprocessors/liftCallbacks.test.d.ts +1 -0
- package/dist/lib/preprocessors/liftCallbacks.test.js +146 -0
- package/dist/lib/preprocessors/parallelDesugar.js +4 -5
- package/dist/lib/preprocessors/resolveReExports.js +1 -3
- package/dist/lib/preprocessors/typeAliasTags.test.d.ts +1 -0
- package/dist/lib/preprocessors/typeAliasTags.test.js +57 -0
- package/dist/lib/preprocessors/typescriptPreprocessor.core.test.js +3 -3
- package/dist/lib/preprocessors/typescriptPreprocessor.d.ts +9 -1
- package/dist/lib/preprocessors/typescriptPreprocessor.js +66 -30
- package/dist/lib/runtime/__tests__/node.test.js +8 -3
- package/dist/lib/runtime/__tests__/testHelpers.js +31 -0
- package/dist/lib/runtime/agency.d.ts +49 -0
- package/dist/lib/runtime/agency.js +204 -0
- package/dist/lib/runtime/agency.test.d.ts +1 -0
- package/dist/lib/runtime/agency.test.js +277 -0
- package/dist/lib/runtime/agencyFunction.d.ts +15 -3
- package/dist/lib/runtime/agencyFunction.js +37 -24
- package/dist/lib/runtime/agencyFunction.test.js +76 -12
- package/dist/lib/runtime/agencyInterrupt.d.ts +18 -0
- package/dist/lib/runtime/agencyInterrupt.js +159 -0
- package/dist/lib/runtime/agencyInterrupt.test.d.ts +1 -0
- package/dist/lib/runtime/agencyInterrupt.test.js +231 -0
- package/dist/lib/runtime/agencyLlm.checkpointInfo.test.d.ts +1 -0
- package/dist/lib/runtime/agencyLlm.checkpointInfo.test.js +63 -0
- package/dist/lib/runtime/agencyLlm.d.ts +59 -0
- package/dist/lib/runtime/agencyLlm.js +20 -0
- package/dist/lib/runtime/agencyLlm.test.d.ts +1 -0
- package/dist/lib/runtime/agencyLlm.test.js +199 -0
- package/dist/lib/runtime/asyncContext.d.ts +208 -0
- package/dist/lib/runtime/asyncContext.js +196 -0
- package/dist/lib/runtime/asyncContext.test.d.ts +1 -0
- package/dist/lib/runtime/asyncContext.test.js +221 -0
- package/dist/lib/runtime/call.d.ts +15 -2
- package/dist/lib/runtime/call.js +17 -4
- package/dist/lib/runtime/call.test.js +20 -7
- package/dist/lib/runtime/checkpoint.d.ts +11 -4
- package/dist/lib/runtime/checkpoint.js +19 -11
- package/dist/lib/runtime/checkpoint.test.js +54 -39
- package/dist/lib/runtime/debugger.d.ts +1 -2
- package/dist/lib/runtime/debugger.js +1 -1
- package/dist/lib/runtime/debugger.test.js +13 -16
- package/dist/lib/runtime/deterministicClient.d.ts +9 -1
- package/dist/lib/runtime/deterministicClient.js +19 -5
- package/dist/lib/runtime/deterministicClient.test.js +10 -2
- package/dist/lib/runtime/guard.d.ts +243 -0
- package/dist/lib/runtime/guard.js +314 -0
- package/dist/lib/runtime/guard.test.d.ts +1 -0
- package/dist/lib/runtime/guard.test.js +289 -0
- package/dist/lib/runtime/haltSignal.d.ts +21 -0
- package/dist/lib/runtime/haltSignal.js +24 -0
- package/dist/lib/runtime/hooks.d.ts +49 -4
- package/dist/lib/runtime/hooks.js +148 -35
- package/dist/lib/runtime/hooks.test.d.ts +1 -0
- package/dist/lib/runtime/hooks.test.js +143 -0
- package/dist/lib/runtime/index.d.ts +18 -1
- package/dist/lib/runtime/index.js +12 -0
- package/dist/lib/runtime/interrupts.d.ts +2 -1
- package/dist/lib/runtime/interrupts.js +34 -6
- package/dist/lib/runtime/ipc.d.ts +1 -2
- package/dist/lib/runtime/ipc.js +6 -3
- package/dist/lib/runtime/memory/manager.js +51 -0
- package/dist/lib/runtime/memory/manager.test.js +173 -0
- package/dist/lib/runtime/node.d.ts +5 -5
- package/dist/lib/runtime/node.js +92 -36
- package/dist/lib/runtime/policy.d.ts +19 -5
- package/dist/lib/runtime/policy.js +9 -12
- package/dist/lib/runtime/prompt.d.ts +8 -5
- package/dist/lib/runtime/prompt.js +436 -309
- package/dist/lib/runtime/promptRunner.d.ts +128 -0
- package/dist/lib/runtime/promptRunner.js +222 -0
- package/dist/lib/runtime/promptRunner.test.d.ts +1 -0
- package/dist/lib/runtime/promptRunner.test.js +398 -0
- package/dist/lib/runtime/result.js +36 -0
- package/dist/lib/runtime/resumableScope.d.ts +45 -0
- package/dist/lib/runtime/resumableScope.js +124 -0
- package/dist/lib/runtime/resumableScope.test.d.ts +1 -0
- package/dist/lib/runtime/resumableScope.test.js +239 -0
- package/dist/lib/runtime/rewind.d.ts +2 -0
- package/dist/lib/runtime/rewind.js +21 -3
- package/dist/lib/runtime/runBatch.d.ts +93 -0
- package/dist/lib/runtime/runBatch.js +443 -0
- package/dist/lib/runtime/runBatch.test.d.ts +1 -0
- package/dist/lib/runtime/runBatch.test.js +574 -0
- package/dist/lib/runtime/runner.d.ts +106 -21
- package/dist/lib/runtime/runner.js +361 -304
- package/dist/lib/runtime/runner.test.js +120 -5
- package/dist/lib/runtime/schema.d.ts +8 -0
- package/dist/lib/runtime/schema.js +11 -0
- package/dist/lib/runtime/state/bootstrapThreadStore.d.ts +38 -0
- package/dist/lib/runtime/state/bootstrapThreadStore.js +72 -0
- package/dist/lib/runtime/state/bootstrapThreadStore.test.d.ts +1 -0
- package/dist/lib/runtime/state/bootstrapThreadStore.test.js +34 -0
- package/dist/lib/runtime/state/context.d.ts +7 -10
- package/dist/lib/runtime/state/context.js +16 -36
- package/dist/lib/runtime/state/stateStack.d.ts +93 -0
- package/dist/lib/runtime/state/stateStack.js +219 -0
- package/dist/lib/runtime/state/stateStack.test.js +386 -0
- package/dist/lib/runtime/subprocess-bootstrap.js +8 -0
- package/dist/lib/runtime/types.d.ts +1 -9
- package/dist/lib/runtime/validateChain.d.ts +71 -0
- package/dist/lib/runtime/validateChain.js +138 -0
- package/dist/lib/runtime/validateChain.test.d.ts +1 -0
- package/dist/lib/runtime/validateChain.test.js +131 -0
- package/dist/lib/simplemachine/graph.js +1 -1
- package/dist/lib/simplemachine/util.d.ts +1 -1
- package/dist/lib/stdlib/abortable.d.ts +58 -0
- package/dist/lib/stdlib/abortable.js +175 -0
- package/dist/lib/stdlib/agency.d.ts +44 -0
- package/dist/lib/stdlib/agency.js +218 -12
- package/dist/lib/stdlib/assertContained.d.ts +24 -0
- package/dist/lib/stdlib/assertContained.js +110 -0
- package/dist/lib/stdlib/browserUse.d.ts +7 -0
- package/dist/lib/stdlib/browserUse.js +58 -27
- package/dist/lib/stdlib/builtins.d.ts +16 -2
- package/dist/lib/stdlib/builtins.js +75 -8
- package/dist/lib/stdlib/fs.d.ts +2 -2
- package/dist/lib/stdlib/fs.js +14 -26
- package/dist/lib/stdlib/http.d.ts +32 -1
- package/dist/lib/stdlib/http.js +105 -23
- package/dist/lib/stdlib/memory.d.ts +27 -13
- package/dist/lib/stdlib/memory.js +71 -13
- package/dist/lib/stdlib/oauth.d.ts +37 -0
- package/dist/lib/stdlib/oauth.js +113 -34
- package/dist/lib/stdlib/policy.d.ts +2 -1
- package/dist/lib/stdlib/policy.js +7 -2
- package/dist/lib/stdlib/resolvePath.d.ts +11 -0
- package/dist/lib/stdlib/resolvePath.js +13 -2
- package/dist/lib/stdlib/shell.d.ts +47 -16
- package/dist/lib/stdlib/shell.js +62 -58
- package/dist/lib/stdlib/skills.d.ts +9 -0
- package/dist/lib/stdlib/skills.js +16 -0
- package/dist/lib/stdlib/speech.d.ts +18 -3
- package/dist/lib/stdlib/speech.js +102 -22
- package/dist/lib/stdlib/system.d.ts +19 -5
- package/dist/lib/stdlib/system.js +51 -12
- package/dist/lib/stdlib/thread.d.ts +45 -0
- package/dist/lib/stdlib/thread.js +120 -0
- package/dist/lib/stdlib/ui.d.ts +7 -0
- package/dist/lib/stdlib/ui.js +45 -6
- package/dist/lib/stdlib/validators.d.ts +12 -0
- package/dist/lib/stdlib/validators.js +77 -0
- package/dist/lib/symbolTable.d.ts +24 -8
- package/dist/lib/symbolTable.js +43 -25
- package/dist/lib/symbolTable.test.js +53 -0
- package/dist/lib/templates/backends/agency/template.d.ts +1 -1
- package/dist/lib/templates/backends/agency/template.js +1 -1
- package/dist/lib/templates/backends/typescriptGenerator/blockSetup.d.ts +1 -1
- package/dist/lib/templates/backends/typescriptGenerator/blockSetup.js +1 -1
- package/dist/lib/templates/backends/typescriptGenerator/builtinFunctions/system.d.ts +1 -1
- package/dist/lib/templates/backends/typescriptGenerator/builtinFunctions/system.js +4 -2
- package/dist/lib/templates/backends/typescriptGenerator/debugger.d.ts +1 -1
- package/dist/lib/templates/backends/typescriptGenerator/debugger.js +2 -2
- package/dist/lib/templates/backends/typescriptGenerator/forkBlockSetup.d.ts +1 -1
- package/dist/lib/templates/backends/typescriptGenerator/forkBlockSetup.js +10 -2
- package/dist/lib/templates/backends/typescriptGenerator/functionCatchFailure.d.ts +1 -1
- package/dist/lib/templates/backends/typescriptGenerator/functionCatchFailure.js +9 -1
- package/dist/lib/templates/backends/typescriptGenerator/imports.d.ts +1 -2
- package/dist/lib/templates/backends/typescriptGenerator/imports.js +6 -14
- package/dist/lib/templates/backends/typescriptGenerator/interruptAssignment.d.ts +1 -1
- package/dist/lib/templates/backends/typescriptGenerator/interruptAssignment.js +9 -9
- package/dist/lib/templates/backends/typescriptGenerator/interruptReturn.d.ts +1 -1
- package/dist/lib/templates/backends/typescriptGenerator/interruptReturn.js +9 -9
- package/dist/lib/templates/backends/typescriptGenerator/resultCheckpointSetup.d.ts +1 -1
- package/dist/lib/templates/backends/typescriptGenerator/resultCheckpointSetup.js +1 -1
- package/dist/lib/tui/styleParser.js +1 -0
- package/dist/lib/typeChecker/assignability.d.ts +46 -3
- package/dist/lib/typeChecker/assignability.js +313 -8
- package/dist/lib/typeChecker/builtins.js +83 -26
- package/dist/lib/typeChecker/callbackBodyInterrupts.test.d.ts +1 -0
- package/dist/lib/typeChecker/callbackBodyInterrupts.test.js +168 -0
- package/dist/lib/typeChecker/checker.js +25 -18
- package/dist/lib/typeChecker/docstringParamInterpolation.test.d.ts +1 -0
- package/dist/lib/typeChecker/docstringParamInterpolation.test.js +70 -0
- package/dist/lib/typeChecker/genericAliasDeclaration.test.d.ts +1 -0
- package/dist/lib/typeChecker/genericAliasDeclaration.test.js +71 -0
- package/dist/lib/typeChecker/genericValidation.test.d.ts +1 -0
- package/dist/lib/typeChecker/genericValidation.test.js +212 -0
- package/dist/lib/typeChecker/index.js +58 -4
- package/dist/lib/typeChecker/interruptAnalysis.d.ts +14 -0
- package/dist/lib/typeChecker/interruptAnalysis.js +74 -0
- package/dist/lib/typeChecker/jsGlobalsSig.test.js +0 -4
- package/dist/lib/typeChecker/jsonSchemaArgValidator.d.ts +60 -0
- package/dist/lib/typeChecker/jsonSchemaArgValidator.js +266 -0
- package/dist/lib/typeChecker/jsonSchemaArgValidator.test.d.ts +1 -0
- package/dist/lib/typeChecker/jsonSchemaArgValidator.test.js +179 -0
- package/dist/lib/typeChecker/mergeTags.d.ts +28 -0
- package/dist/lib/typeChecker/mergeTags.js +182 -0
- package/dist/lib/typeChecker/mergeTags.test.d.ts +1 -0
- package/dist/lib/typeChecker/mergeTags.test.js +144 -0
- package/dist/lib/typeChecker/namedArgStructure.test.d.ts +1 -0
- package/dist/lib/typeChecker/namedArgStructure.test.js +66 -0
- package/dist/lib/typeChecker/recordAssignability.test.d.ts +1 -0
- package/dist/lib/typeChecker/recordAssignability.test.js +72 -0
- package/dist/lib/typeChecker/recordSynth.test.d.ts +1 -0
- package/dist/lib/typeChecker/recordSynth.test.js +80 -0
- package/dist/lib/typeChecker/reservedNameDeclaration.test.js +15 -0
- package/dist/lib/typeChecker/resolveCall.d.ts +4 -5
- package/dist/lib/typeChecker/resolveCall.js +7 -3
- package/dist/lib/typeChecker/resolveType.test.d.ts +1 -0
- package/dist/lib/typeChecker/resolveType.test.js +478 -0
- package/dist/lib/typeChecker/resolveTypeTags.test.d.ts +1 -0
- package/dist/lib/typeChecker/resolveTypeTags.test.js +154 -0
- package/dist/lib/typeChecker/resolveVariable.d.ts +5 -15
- package/dist/lib/typeChecker/resolveVariable.js +3 -7
- package/dist/lib/typeChecker/scopes.js +53 -2
- package/dist/lib/typeChecker/shadowing.d.ts +0 -1
- package/dist/lib/typeChecker/shadowing.js +1 -5
- package/dist/lib/typeChecker/substitute.d.ts +25 -0
- package/dist/lib/typeChecker/substitute.js +33 -0
- package/dist/lib/typeChecker/substitute.test.d.ts +1 -0
- package/dist/lib/typeChecker/substitute.test.js +165 -0
- package/dist/lib/typeChecker/synthesizer.js +46 -18
- package/dist/lib/typeChecker/typeWalker.d.ts +14 -0
- package/dist/lib/typeChecker/typeWalker.js +62 -0
- package/dist/lib/typeChecker/typeWalker.test.d.ts +1 -0
- package/dist/lib/typeChecker/typeWalker.test.js +212 -0
- package/dist/lib/typeChecker/types.d.ts +7 -2
- package/dist/lib/typeChecker/undefinedFunctionDiagnostic.js +1 -4
- package/dist/lib/typeChecker/undefinedVariableDiagnostic.js +3 -4
- package/dist/lib/typeChecker/undefinedVariableDiagnostic.test.js +33 -6
- package/dist/lib/typeChecker/utils.js +4 -2
- package/dist/lib/typeChecker/validate.d.ts +2 -2
- package/dist/lib/typeChecker/validate.js +123 -5
- package/dist/lib/typeChecker/valueParamSubstitution.d.ts +92 -0
- package/dist/lib/typeChecker/valueParamSubstitution.js +645 -0
- package/dist/lib/typeChecker/valueParamSubstitution.test.d.ts +1 -0
- package/dist/lib/typeChecker/valueParamSubstitution.test.js +214 -0
- package/dist/lib/types/dataStructures.d.ts +6 -0
- package/dist/lib/types/function.d.ts +2 -6
- package/dist/lib/types/graphNode.d.ts +3 -3
- package/dist/lib/types/literals.d.ts +1 -1
- package/dist/lib/types/newExpression.d.ts +14 -0
- package/dist/lib/types/newExpression.js +1 -0
- package/dist/lib/types/pattern.d.ts +8 -3
- package/dist/lib/types/tag.d.ts +2 -1
- package/dist/lib/types/typeHints.d.ts +108 -1
- package/dist/lib/types.d.ts +4 -4
- package/dist/lib/types.js +1 -1
- package/dist/lib/utils/docStringText.d.ts +22 -0
- package/dist/lib/utils/docStringText.js +47 -0
- package/dist/lib/utils/formatType.js +2 -0
- package/dist/lib/utils/node.js +19 -14
- package/dist/lib/utils/schemaParam.d.ts +34 -0
- package/dist/lib/utils/schemaParam.js +48 -0
- package/dist/lib/utils/schemaParam.test.d.ts +1 -0
- package/dist/lib/utils/schemaParam.test.js +69 -0
- package/dist/lib/utils.d.ts +13 -0
- package/dist/lib/utils.js +97 -0
- package/dist/lib/utils.test.d.ts +1 -0
- package/dist/lib/utils.test.js +101 -0
- package/dist/scripts/agency.js +1 -0
- package/package.json +1 -1
- package/stdlib/agency.agency +217 -3
- package/stdlib/agency.js +1864 -222
- package/stdlib/agent.js +147 -146
- package/stdlib/array.js +737 -784
- package/stdlib/browser.agency +2 -2
- package/stdlib/browser.js +92 -103
- package/stdlib/calendar.js +425 -436
- package/stdlib/clipboard.js +132 -143
- package/stdlib/date.js +580 -591
- package/stdlib/email.js +289 -300
- package/stdlib/fs.agency +12 -6
- package/stdlib/fs.js +525 -508
- package/stdlib/http.agency +61 -4
- package/stdlib/http.js +451 -98
- package/stdlib/imessage.js +84 -95
- package/stdlib/index.agency +66 -40
- package/stdlib/index.js +944 -1119
- package/stdlib/keyring.js +252 -263
- package/stdlib/math.js +167 -162
- package/stdlib/memory.agency +21 -13
- package/stdlib/memory.js +267 -216
- package/stdlib/oauth.agency +4 -1
- package/stdlib/oauth.js +270 -277
- package/stdlib/object.js +276 -307
- package/stdlib/path.js +273 -284
- package/stdlib/policy.agency +30 -6
- package/stdlib/policy.js +160 -141
- package/stdlib/schemas.agency +37 -0
- package/stdlib/schemas.js +202 -0
- package/stdlib/shell.agency +39 -22
- package/stdlib/shell.js +597 -518
- package/stdlib/skills.agency +18 -0
- package/stdlib/skills.js +276 -0
- package/stdlib/sms.js +90 -101
- package/stdlib/speech.agency +31 -9
- package/stdlib/speech.js +256 -223
- package/stdlib/strategy.js +336 -369
- package/stdlib/syntax.agency +20 -0
- package/stdlib/syntax.js +296 -0
- package/stdlib/system.agency +27 -4
- package/stdlib/system.js +512 -398
- package/stdlib/thread.agency +148 -0
- package/stdlib/thread.js +937 -0
- package/stdlib/types.agency +58 -0
- package/stdlib/types.js +180 -0
- package/stdlib/ui.agency +3 -1
- package/stdlib/ui.js +541 -558
- package/stdlib/validators.agency +150 -0
- package/stdlib/validators.js +1471 -0
- package/stdlib/weather.js +127 -130
- package/stdlib/wikipedia.js +124 -135
- package/dist/lib/codegenBuiltins/contextInjected.d.ts +0 -56
- package/dist/lib/codegenBuiltins/contextInjected.js +0 -78
- package/dist/lib/codegenBuiltins/contextInjected.test.js +0 -57
- package/dist/lib/runtime/classReviver.d.ts +0 -15
- package/dist/lib/runtime/classReviver.js +0 -32
- package/dist/lib/templates/backends/typescriptGenerator/classDefinition.d.ts +0 -19
- package/dist/lib/templates/backends/typescriptGenerator/classDefinition.js +0 -48
- package/dist/lib/templates/backends/typescriptGenerator/classMethod.d.ts +0 -14
- package/dist/lib/templates/backends/typescriptGenerator/classMethod.js +0 -37
- package/dist/lib/types/classDefinition.d.ts +0 -30
- package/dist/lib/types/classDefinition.js +0 -4
- /package/dist/lib/{codegenBuiltins/contextInjected.test.d.ts → backends/docstringInterpolationRuntime.test.d.ts} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { print, printJSON, parseJSON, input, sleep, round,
|
|
1
|
+
import { print, printJSON, parseJSON, input, sleep, round, read, write, readImage, notify, range, mostCommon, keys, values, entries, emit, callback } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { exec } from "agency-lang/stdlib/shell.js";
|
|
3
3
|
import { args } from "agency-lang/stdlib/system.js";
|
|
4
|
+
import { systemMessage } from "agency-lang/stdlib/thread.js";
|
|
4
5
|
import { fileURLToPath } from "url";
|
|
5
6
|
import __process from "process";
|
|
6
7
|
import { z } from "agency-lang/zod";
|
|
7
8
|
import { goToNode, nanoid } from "agency-lang";
|
|
8
|
-
import { smoltalk } from "agency-lang";
|
|
9
9
|
import path from "path";
|
|
10
10
|
import {
|
|
11
11
|
RuntimeContext,
|
|
@@ -26,12 +26,14 @@ import {
|
|
|
26
26
|
respondToInterrupts as _respondToInterrupts,
|
|
27
27
|
rewindFrom as _rewindFrom,
|
|
28
28
|
RestoreSignal,
|
|
29
|
+
GuardExceededError,
|
|
29
30
|
failure,
|
|
30
|
-
readSkill as _readSkillRaw,
|
|
31
|
-
readSkillTool as __readSkillTool,
|
|
32
|
-
readSkillToolParams as __readSkillToolParams,
|
|
33
31
|
AgencyFunction as __AgencyFunction,
|
|
34
32
|
__call,
|
|
33
|
+
__threads,
|
|
34
|
+
__stateStack,
|
|
35
|
+
getRuntimeContext,
|
|
36
|
+
agencyStore,
|
|
35
37
|
functionRefReviver as __functionRefReviver,
|
|
36
38
|
DeterministicClient as __DeterministicClient
|
|
37
39
|
} from "agency-lang/runtime";
|
|
@@ -65,15 +67,9 @@ const __globalCtx = new RuntimeContext({
|
|
|
65
67
|
traceConfig: {
|
|
66
68
|
program: "dist/lib/agents/review/agent.agency",
|
|
67
69
|
traceDir: "traces"
|
|
68
|
-
},
|
|
69
|
-
memory: {
|
|
70
|
-
dir: ".agency-memory"
|
|
71
70
|
}
|
|
72
71
|
});
|
|
73
72
|
const graph = __globalCtx.graph;
|
|
74
|
-
function readSkill({ filepath }) {
|
|
75
|
-
return _readSkillRaw({ filepath, dirname: __dirname });
|
|
76
|
-
}
|
|
77
73
|
function approve(value) {
|
|
78
74
|
return { type: "approve", value };
|
|
79
75
|
}
|
|
@@ -83,8 +79,8 @@ function reject(value) {
|
|
|
83
79
|
function propagate() {
|
|
84
80
|
return { type: "propagate" };
|
|
85
81
|
}
|
|
86
|
-
const respondToInterrupts = (interrupts, responses, opts) => _respondToInterrupts({ ctx: __globalCtx, interrupts, responses, overrides: opts?.overrides, metadata: opts?.metadata });
|
|
87
|
-
const rewindFrom = (checkpoint2, overrides, opts) => _rewindFrom({ ctx: __globalCtx, checkpoint: checkpoint2, overrides, metadata: opts?.metadata });
|
|
82
|
+
const respondToInterrupts = (interrupts, responses, opts) => _respondToInterrupts({ ctx: __globalCtx, interrupts, responses, overrides: opts?.overrides, metadata: opts?.metadata, registerTopLevelCallbacks: __registerTopLevelCallbacks, moduleDir: __dirname });
|
|
83
|
+
const rewindFrom = (checkpoint2, overrides, opts) => _rewindFrom({ ctx: __globalCtx, checkpoint: checkpoint2, overrides, metadata: opts?.metadata, registerTopLevelCallbacks: __registerTopLevelCallbacks, moduleDir: __dirname });
|
|
88
84
|
const __setDebugger = (dbg) => {
|
|
89
85
|
__globalCtx.debuggerState = dbg;
|
|
90
86
|
};
|
|
@@ -126,8 +122,6 @@ __registerTool(parseJSON);
|
|
|
126
122
|
__registerTool(input);
|
|
127
123
|
__registerTool(sleep);
|
|
128
124
|
__registerTool(round);
|
|
129
|
-
__registerTool(fetch);
|
|
130
|
-
__registerTool(fetchJSON);
|
|
131
125
|
__registerTool(read);
|
|
132
126
|
__registerTool(write);
|
|
133
127
|
__registerTool(readImage);
|
|
@@ -138,24 +132,20 @@ __registerTool(keys);
|
|
|
138
132
|
__registerTool(values);
|
|
139
133
|
__registerTool(entries);
|
|
140
134
|
__registerTool(emit);
|
|
135
|
+
__registerTool(callback);
|
|
141
136
|
__registerTool(exec);
|
|
142
137
|
__registerTool(args);
|
|
138
|
+
__registerTool(systemMessage);
|
|
143
139
|
async function __initializeGlobals(__ctx) {
|
|
144
140
|
__ctx.globals.markInitialized("dist/lib/agents/review/agent.agency");
|
|
145
141
|
__ctx.globals.set("dist/lib/agents/review/agent.agency", "systemPrompt", await __call(read, {
|
|
146
142
|
type: "positional",
|
|
147
143
|
args: [`./prompts/system.md`]
|
|
148
|
-
}, {
|
|
149
|
-
ctx: __ctx
|
|
150
144
|
}));
|
|
151
145
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
fn: readSkill,
|
|
156
|
-
params: __readSkillToolParams.map((p) => ({ name: p, hasDefault: false, defaultValue: void 0, variadic: false })),
|
|
157
|
-
toolDefinition: __readSkillTool
|
|
158
|
-
}, __toolRegistry);
|
|
146
|
+
async function __registerTopLevelCallbacks(__ctx) {
|
|
147
|
+
__ctx.topLevelCallbacks = [];
|
|
148
|
+
}
|
|
159
149
|
__functionRefReviver.registry = __toolRegistry;
|
|
160
150
|
const Severity = z.union([z.literal("critical"), z.literal("warning"), z.literal("suggestion")]);
|
|
161
151
|
const Issue = z.object({ "severity": Severity, "line": z.union([z.number(), z.null()]), "message": z.string(), "suggestion": z.union([z.string(), z.null()]) });
|
|
@@ -164,242 +154,217 @@ graph.node("main", async (__state) => {
|
|
|
164
154
|
const __setupData = setupNode({
|
|
165
155
|
state: __state
|
|
166
156
|
});
|
|
167
|
-
const __stateStack = __state.ctx.stateStack;
|
|
168
157
|
const __stack = __setupData.stack;
|
|
169
158
|
const __step = __setupData.step;
|
|
170
159
|
const __self = __setupData.self;
|
|
171
|
-
const
|
|
172
|
-
const __ctx = __state.ctx;
|
|
173
|
-
const statelogClient = __ctx.statelogClient;
|
|
174
|
-
const __graph = __ctx.graph;
|
|
160
|
+
const __ctx = getRuntimeContext().ctx;
|
|
175
161
|
let __forked;
|
|
176
162
|
let __functionCompleted = false;
|
|
177
|
-
|
|
178
|
-
callbacks: __ctx.callbacks,
|
|
179
|
-
name: "onNodeStart",
|
|
180
|
-
data: {
|
|
181
|
-
nodeName: "main"
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
const runner = new Runner(__ctx, __stack, { nodeContext: true, state: __stack, moduleId: "dist/lib/agents/review/agent.agency", scopeName: "main" });
|
|
163
|
+
const runner = new Runner(__ctx, __stack, { nodeContext: true, state: __stack, moduleId: "dist/lib/agents/review/agent.agency", scopeName: "main", threads: __setupData.threads });
|
|
185
164
|
try {
|
|
186
|
-
await
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
165
|
+
await agencyStore.run({
|
|
166
|
+
...getRuntimeContext(),
|
|
167
|
+
ctx: __ctx,
|
|
168
|
+
stack: __ctx.stateStack,
|
|
169
|
+
threads: __setupData.threads
|
|
170
|
+
}, async () => {
|
|
171
|
+
await runner.hook(0, async () => {
|
|
172
|
+
await callHook({
|
|
173
|
+
name: "onNodeStart",
|
|
174
|
+
data: {
|
|
175
|
+
nodeName: "main"
|
|
176
|
+
}
|
|
177
|
+
});
|
|
194
178
|
});
|
|
195
|
-
|
|
196
|
-
await
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
data: __stack.locals.cliArgs
|
|
179
|
+
await runner.step(1, async (runner2) => {
|
|
180
|
+
__stack.locals.cliArgs = await __call(args, {
|
|
181
|
+
type: "positional",
|
|
182
|
+
args: []
|
|
200
183
|
});
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
condition: async () => __stack.locals.cliArgs.length < 2,
|
|
207
|
-
body: async (runner2) => {
|
|
208
|
-
await runner2.step(0, async (runner3) => {
|
|
209
|
-
const __funcResult = await __call(print, {
|
|
210
|
-
type: "positional",
|
|
211
|
-
args: [`Usage: agency review <file.agency>`]
|
|
212
|
-
}, {
|
|
213
|
-
ctx: __ctx,
|
|
214
|
-
threads: __threads,
|
|
215
|
-
stateStack: __stateStack
|
|
216
|
-
});
|
|
217
|
-
if (hasInterrupts(__funcResult)) {
|
|
218
|
-
await __ctx.pendingPromises.awaitAll();
|
|
219
|
-
runner3.halt({
|
|
220
|
-
...__state,
|
|
221
|
-
data: __funcResult
|
|
222
|
-
});
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
await runner2.step(1, async (runner3) => {
|
|
227
|
-
__stateStack.pop();
|
|
228
|
-
__functionCompleted = true;
|
|
229
|
-
runner3.halt(goToNode("end", {
|
|
230
|
-
messages: __threads,
|
|
231
|
-
ctx: __ctx,
|
|
232
|
-
data: {}
|
|
233
|
-
}));
|
|
234
|
-
return;
|
|
184
|
+
if (hasInterrupts(__stack.locals.cliArgs)) {
|
|
185
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
186
|
+
runner2.halt({
|
|
187
|
+
...__state,
|
|
188
|
+
data: __stack.locals.cliArgs
|
|
235
189
|
});
|
|
190
|
+
return;
|
|
236
191
|
}
|
|
237
|
-
}
|
|
238
|
-
]);
|
|
239
|
-
await runner.step(2, async (runner2) => {
|
|
240
|
-
__stack.locals.agencyScript = __stack.locals.cliArgs[0];
|
|
241
|
-
});
|
|
242
|
-
await runner.step(3, async (runner2) => {
|
|
243
|
-
__stack.locals.filePath = __stack.locals.cliArgs[1];
|
|
244
|
-
});
|
|
245
|
-
await runner.step(4, async (runner2) => {
|
|
246
|
-
__self.__retryable = false;
|
|
247
|
-
__stack.locals.code = await __call(read, {
|
|
248
|
-
type: "positional",
|
|
249
|
-
args: [__stack.locals.filePath]
|
|
250
|
-
}, {
|
|
251
|
-
ctx: __ctx,
|
|
252
|
-
threads: __threads,
|
|
253
|
-
stateStack: __stateStack
|
|
254
192
|
});
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
ctx: __ctx,
|
|
289
|
-
threads: __threads,
|
|
290
|
-
stateStack: __stateStack
|
|
193
|
+
await runner.ifElse(2, [
|
|
194
|
+
{
|
|
195
|
+
condition: async () => __stack.locals.cliArgs.length < 2,
|
|
196
|
+
body: async (runner2) => {
|
|
197
|
+
await runner2.step(0, async (runner3) => {
|
|
198
|
+
const __funcResult = await __call(print, {
|
|
199
|
+
type: "positional",
|
|
200
|
+
args: [`Usage: agency review <file.agency>`]
|
|
201
|
+
});
|
|
202
|
+
if (hasInterrupts(__funcResult)) {
|
|
203
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
204
|
+
runner3.halt({
|
|
205
|
+
...__state,
|
|
206
|
+
data: __funcResult
|
|
207
|
+
});
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
await runner2.step(1, async (runner3) => {
|
|
212
|
+
__stateStack()?.pop();
|
|
213
|
+
__functionCompleted = true;
|
|
214
|
+
runner3.halt(goToNode("end", {
|
|
215
|
+
messages: __threads(),
|
|
216
|
+
ctx: getRuntimeContext().ctx,
|
|
217
|
+
data: {}
|
|
218
|
+
}));
|
|
219
|
+
return;
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
]);
|
|
224
|
+
await runner.step(3, async (runner2) => {
|
|
225
|
+
__stack.locals.agencyScript = __stack.locals.cliArgs[0];
|
|
291
226
|
});
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
runner2.halt({
|
|
295
|
-
...__state,
|
|
296
|
-
data: __funcResult
|
|
297
|
-
});
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
await runner.step(7, async (runner2) => {
|
|
302
|
-
__self.__retryable = false;
|
|
303
|
-
__stack.locals.typeCheckResult = await __call(exec, {
|
|
304
|
-
type: "positional",
|
|
305
|
-
args: [`node`, [__stack.locals.agencyScript, `typecheck`, __stack.locals.filePath]]
|
|
306
|
-
}, {
|
|
307
|
-
ctx: __ctx,
|
|
308
|
-
threads: __threads,
|
|
309
|
-
stateStack: __stateStack
|
|
227
|
+
await runner.step(4, async (runner2) => {
|
|
228
|
+
__stack.locals.filePath = __stack.locals.cliArgs[1];
|
|
310
229
|
});
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
230
|
+
await runner.step(5, async (runner2) => {
|
|
231
|
+
__self.__retryable = false;
|
|
232
|
+
__stack.locals.code = await __call(read, {
|
|
233
|
+
type: "positional",
|
|
234
|
+
args: [__stack.locals.filePath]
|
|
316
235
|
});
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
});
|
|
323
|
-
await runner.ifElse(9, [
|
|
324
|
-
{
|
|
325
|
-
condition: async () => __stack.locals.typeCheckResult.exitCode !== 0,
|
|
326
|
-
body: async (runner2) => {
|
|
327
|
-
await runner2.step(0, async (runner3) => {
|
|
328
|
-
__stack.locals.typeErrors = __stack.locals.typeCheckResult.stderr + __stack.locals.typeCheckResult.stdout;
|
|
329
|
-
});
|
|
330
|
-
await runner2.step(1, async (runner3) => {
|
|
331
|
-
const __funcResult = await __call(print, {
|
|
332
|
-
type: "positional",
|
|
333
|
-
args: [`Type checker found issues:
|
|
334
|
-
${__stack.locals.typeErrors}
|
|
335
|
-
`]
|
|
336
|
-
}, {
|
|
337
|
-
ctx: __ctx,
|
|
338
|
-
threads: __threads,
|
|
339
|
-
stateStack: __stateStack
|
|
340
|
-
});
|
|
341
|
-
if (hasInterrupts(__funcResult)) {
|
|
342
|
-
await __ctx.pendingPromises.awaitAll();
|
|
343
|
-
runner3.halt({
|
|
344
|
-
...__state,
|
|
345
|
-
data: __funcResult
|
|
346
|
-
});
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
236
|
+
if (hasInterrupts(__stack.locals.code)) {
|
|
237
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
238
|
+
runner2.halt({
|
|
239
|
+
...__state,
|
|
240
|
+
data: __stack.locals.code
|
|
349
241
|
});
|
|
242
|
+
return;
|
|
350
243
|
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
await runner2.step(2, async (runner3) => {
|
|
244
|
+
});
|
|
245
|
+
await runner.step(6, async (runner2) => {
|
|
354
246
|
const __funcResult = await __call(print, {
|
|
355
247
|
type: "positional",
|
|
356
|
-
args: [`
|
|
248
|
+
args: [`Reviewing: ${__stack.locals.filePath}
|
|
357
249
|
`]
|
|
358
|
-
}, {
|
|
359
|
-
ctx: __ctx,
|
|
360
|
-
threads: __threads,
|
|
361
|
-
stateStack: __stateStack
|
|
362
250
|
});
|
|
363
251
|
if (hasInterrupts(__funcResult)) {
|
|
364
|
-
await
|
|
365
|
-
|
|
252
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
253
|
+
runner2.halt({
|
|
366
254
|
...__state,
|
|
367
255
|
data: __funcResult
|
|
368
256
|
});
|
|
369
257
|
return;
|
|
370
258
|
}
|
|
371
259
|
});
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
const __funcResult = __threads.active().push(smoltalk.systemMessage(__ctx.globals.get("dist/lib/agents/review/agent.agency", "systemPrompt")));
|
|
260
|
+
await runner.step(7, async (runner2) => {
|
|
261
|
+
const __funcResult = await __call(print, {
|
|
262
|
+
type: "positional",
|
|
263
|
+
args: [`Running type checker...`]
|
|
264
|
+
});
|
|
378
265
|
if (hasInterrupts(__funcResult)) {
|
|
379
|
-
await
|
|
380
|
-
|
|
266
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
267
|
+
runner2.halt({
|
|
381
268
|
...__state,
|
|
382
269
|
data: __funcResult
|
|
383
270
|
});
|
|
384
271
|
return;
|
|
385
272
|
}
|
|
386
273
|
});
|
|
387
|
-
await
|
|
388
|
-
|
|
274
|
+
await runner.step(8, async (runner2) => {
|
|
275
|
+
__self.__retryable = false;
|
|
276
|
+
__stack.locals.typeCheckResult = await __call(exec, {
|
|
277
|
+
type: "positional",
|
|
278
|
+
args: [`node`, [__stack.locals.agencyScript, `typecheck`, __stack.locals.filePath]]
|
|
279
|
+
});
|
|
280
|
+
if (hasInterrupts(__stack.locals.typeCheckResult)) {
|
|
281
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
282
|
+
runner2.halt({
|
|
283
|
+
...__state,
|
|
284
|
+
data: __stack.locals.typeCheckResult
|
|
285
|
+
});
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
389
288
|
});
|
|
390
|
-
await
|
|
289
|
+
await runner.step(9, async (runner2) => {
|
|
290
|
+
__stack.locals.typeErrors = ``;
|
|
291
|
+
});
|
|
292
|
+
await runner.ifElse(10, [
|
|
391
293
|
{
|
|
392
|
-
condition: async () => __stack.locals.
|
|
393
|
-
body: async (
|
|
394
|
-
await
|
|
395
|
-
__stack.locals.
|
|
396
|
-
|
|
294
|
+
condition: async () => __stack.locals.typeCheckResult.exitCode !== 0,
|
|
295
|
+
body: async (runner2) => {
|
|
296
|
+
await runner2.step(0, async (runner3) => {
|
|
297
|
+
__stack.locals.typeErrors = __stack.locals.typeCheckResult.stderr + __stack.locals.typeCheckResult.stdout;
|
|
298
|
+
});
|
|
299
|
+
await runner2.step(1, async (runner3) => {
|
|
300
|
+
const __funcResult = await __call(print, {
|
|
301
|
+
type: "positional",
|
|
302
|
+
args: [`Type checker found issues:
|
|
303
|
+
${__stack.locals.typeErrors}
|
|
304
|
+
`]
|
|
305
|
+
});
|
|
306
|
+
if (hasInterrupts(__funcResult)) {
|
|
307
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
308
|
+
runner3.halt({
|
|
309
|
+
...__state,
|
|
310
|
+
data: __funcResult
|
|
311
|
+
});
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
397
314
|
});
|
|
398
315
|
}
|
|
399
316
|
}
|
|
400
|
-
])
|
|
401
|
-
|
|
402
|
-
|
|
317
|
+
], async (runner2) => {
|
|
318
|
+
await runner2.step(2, async (runner3) => {
|
|
319
|
+
const __funcResult = await __call(print, {
|
|
320
|
+
type: "positional",
|
|
321
|
+
args: [`Type checker passed.
|
|
322
|
+
`]
|
|
323
|
+
});
|
|
324
|
+
if (hasInterrupts(__funcResult)) {
|
|
325
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
326
|
+
runner3.halt({
|
|
327
|
+
...__state,
|
|
328
|
+
data: __funcResult
|
|
329
|
+
});
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
await runner.step(11, async (runner2) => {
|
|
335
|
+
});
|
|
336
|
+
await runner.thread(12, "create", async (runner2) => {
|
|
337
|
+
await runner2.step(0, async (runner3) => {
|
|
338
|
+
__self.__retryable = false;
|
|
339
|
+
const __funcResult = await __call(systemMessage, {
|
|
340
|
+
type: "positional",
|
|
341
|
+
args: [getRuntimeContext().ctx.globals.get("dist/lib/agents/review/agent.agency", "systemPrompt")]
|
|
342
|
+
});
|
|
343
|
+
if (hasInterrupts(__funcResult)) {
|
|
344
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
345
|
+
runner3.halt({
|
|
346
|
+
...__state,
|
|
347
|
+
data: __funcResult
|
|
348
|
+
});
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
await runner2.step(1, async (runner3) => {
|
|
353
|
+
__stack.locals.typeErrorMessage = `The type checker found no errors.`;
|
|
354
|
+
});
|
|
355
|
+
await runner2.ifElse(2, [
|
|
356
|
+
{
|
|
357
|
+
condition: async () => __stack.locals.typeErrors !== ``,
|
|
358
|
+
body: async (runner3) => {
|
|
359
|
+
await runner3.step(0, async (runner4) => {
|
|
360
|
+
__stack.locals.typeErrorMessage = `The type checker reported the following errors:
|
|
361
|
+
${__stack.locals.typeErrors}`;
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
]);
|
|
366
|
+
await runner2.step(3, async (runner3) => {
|
|
367
|
+
__stack.locals.reviewPrompt = `
|
|
403
368
|
Please review the following Agency code.
|
|
404
369
|
|
|
405
370
|
File: ${__stack.locals.filePath}
|
|
@@ -412,256 +377,228 @@ ${__stack.locals.typeErrors}`;
|
|
|
412
377
|
|
|
413
378
|
Provide a structured review with a summary, list of issues (with severity, line number if applicable, message, and suggested fix), and a list of strengths.
|
|
414
379
|
`;
|
|
415
|
-
});
|
|
416
|
-
await runner2.step(4, async (runner3) => {
|
|
417
|
-
__self.__removedTools = __self.__removedTools || [];
|
|
418
|
-
__stack.locals.review = await runPrompt({
|
|
419
|
-
ctx: __ctx,
|
|
420
|
-
prompt: __stack.locals.reviewPrompt,
|
|
421
|
-
messages: __threads.getOrCreateActive(),
|
|
422
|
-
responseFormat: z.object({
|
|
423
|
-
response: ReviewResult
|
|
424
|
-
}),
|
|
425
|
-
clientConfig: {},
|
|
426
|
-
maxToolCallRounds: 10,
|
|
427
|
-
stateStack: __stateStack,
|
|
428
|
-
removedTools: __self.__removedTools,
|
|
429
|
-
checkpointInfo: runner3.getCheckpointInfo()
|
|
430
380
|
});
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
381
|
+
await runner2.step(4, async (runner3) => {
|
|
382
|
+
__self.__removedTools = __self.__removedTools || [];
|
|
383
|
+
__stack.locals.review = await runPrompt({
|
|
384
|
+
prompt: __stack.locals.reviewPrompt,
|
|
385
|
+
messages: __threads().getOrCreateActive(),
|
|
386
|
+
responseFormat: z.object({
|
|
387
|
+
response: ReviewResult
|
|
388
|
+
}),
|
|
389
|
+
clientConfig: {},
|
|
390
|
+
maxToolCallRounds: 10,
|
|
391
|
+
removedTools: __self.__removedTools,
|
|
392
|
+
checkpointInfo: runner3.getCheckpointInfo()
|
|
436
393
|
});
|
|
437
|
-
|
|
438
|
-
|
|
394
|
+
if (hasInterrupts(__stack.locals.review)) {
|
|
395
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
396
|
+
runner3.halt({
|
|
397
|
+
messages: __threads(),
|
|
398
|
+
data: __stack.locals.review
|
|
399
|
+
});
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
});
|
|
439
403
|
});
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
});
|
|
443
|
-
await runner.step(13, async (runner2) => {
|
|
444
|
-
const __funcResult = await __call(print, {
|
|
445
|
-
type: "positional",
|
|
446
|
-
args: [`
|
|
447
|
-
--- Review Summary ---`]
|
|
448
|
-
}, {
|
|
449
|
-
ctx: __ctx,
|
|
450
|
-
threads: __threads,
|
|
451
|
-
stateStack: __stateStack
|
|
404
|
+
await runner.step(13, async (runner2) => {
|
|
405
|
+
__self.__retryable = false;
|
|
452
406
|
});
|
|
453
|
-
|
|
454
|
-
await
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
407
|
+
await runner.step(14, async (runner2) => {
|
|
408
|
+
const __funcResult = await __call(print, {
|
|
409
|
+
type: "positional",
|
|
410
|
+
args: [`
|
|
411
|
+
--- Review Summary ---`]
|
|
458
412
|
});
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
ctx: __ctx,
|
|
468
|
-
threads: __threads,
|
|
469
|
-
stateStack: __stateStack
|
|
413
|
+
if (hasInterrupts(__funcResult)) {
|
|
414
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
415
|
+
runner2.halt({
|
|
416
|
+
...__state,
|
|
417
|
+
data: __funcResult
|
|
418
|
+
});
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
470
421
|
});
|
|
471
|
-
|
|
472
|
-
await
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
data: __funcResult
|
|
422
|
+
await runner.step(15, async (runner2) => {
|
|
423
|
+
const __funcResult = await __call(print, {
|
|
424
|
+
type: "positional",
|
|
425
|
+
args: [__stack.locals.review.summary]
|
|
476
426
|
});
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
condition: async () => __stack.locals.review.strengths.length > 0,
|
|
483
|
-
body: async (runner2) => {
|
|
484
|
-
await runner2.step(0, async (runner3) => {
|
|
485
|
-
const __funcResult = await __call(print, {
|
|
486
|
-
type: "positional",
|
|
487
|
-
args: [`
|
|
488
|
-
--- Strengths ---`]
|
|
489
|
-
}, {
|
|
490
|
-
ctx: __ctx,
|
|
491
|
-
threads: __threads,
|
|
492
|
-
stateStack: __stateStack
|
|
493
|
-
});
|
|
494
|
-
if (hasInterrupts(__funcResult)) {
|
|
495
|
-
await __ctx.pendingPromises.awaitAll();
|
|
496
|
-
runner3.halt({
|
|
497
|
-
...__state,
|
|
498
|
-
data: __funcResult
|
|
499
|
-
});
|
|
500
|
-
return;
|
|
501
|
-
}
|
|
427
|
+
if (hasInterrupts(__funcResult)) {
|
|
428
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
429
|
+
runner2.halt({
|
|
430
|
+
...__state,
|
|
431
|
+
data: __funcResult
|
|
502
432
|
});
|
|
503
|
-
|
|
504
|
-
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
await runner.ifElse(16, [
|
|
437
|
+
{
|
|
438
|
+
condition: async () => __stack.locals.review.strengths.length > 0,
|
|
439
|
+
body: async (runner2) => {
|
|
440
|
+
await runner2.step(0, async (runner3) => {
|
|
505
441
|
const __funcResult = await __call(print, {
|
|
506
442
|
type: "positional",
|
|
507
|
-
args: [`
|
|
508
|
-
|
|
509
|
-
ctx: __ctx,
|
|
510
|
-
threads: __threads,
|
|
511
|
-
stateStack: __stateStack
|
|
443
|
+
args: [`
|
|
444
|
+
--- Strengths ---`]
|
|
512
445
|
});
|
|
513
446
|
if (hasInterrupts(__funcResult)) {
|
|
514
|
-
await
|
|
515
|
-
|
|
447
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
448
|
+
runner3.halt({
|
|
516
449
|
...__state,
|
|
517
450
|
data: __funcResult
|
|
518
451
|
});
|
|
519
452
|
return;
|
|
520
453
|
}
|
|
521
454
|
});
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
args: [`
|
|
534
|
-
--- Issues ---`]
|
|
535
|
-
}, {
|
|
536
|
-
ctx: __ctx,
|
|
537
|
-
threads: __threads,
|
|
538
|
-
stateStack: __stateStack
|
|
539
|
-
});
|
|
540
|
-
if (hasInterrupts(__funcResult)) {
|
|
541
|
-
await __ctx.pendingPromises.awaitAll();
|
|
542
|
-
runner3.halt({
|
|
543
|
-
...__state,
|
|
544
|
-
data: __funcResult
|
|
545
|
-
});
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
await runner2.loop(1, __stack.locals.review.issues, async (issue, _, runner3) => {
|
|
550
|
-
await runner3.step(0, async (runner4) => {
|
|
551
|
-
__stack.locals.prefix = `[${issue.severity}]`;
|
|
552
|
-
});
|
|
553
|
-
await runner3.step(1, async (runner4) => {
|
|
554
|
-
__stack.locals.lineInfo = ``;
|
|
555
|
-
});
|
|
556
|
-
await runner3.ifElse(2, [
|
|
557
|
-
{
|
|
558
|
-
condition: async () => issue.line !== null,
|
|
559
|
-
body: async (runner4) => {
|
|
560
|
-
await runner4.step(0, async (runner5) => {
|
|
561
|
-
__stack.locals.lineInfo = ` (line ${issue.line})`;
|
|
455
|
+
await runner2.loop(1, __stack.locals.review.strengths, async (strength, _, runner3) => {
|
|
456
|
+
await runner3.step(0, async (runner4) => {
|
|
457
|
+
const __funcResult = await __call(print, {
|
|
458
|
+
type: "positional",
|
|
459
|
+
args: [` + ${strength}`]
|
|
460
|
+
});
|
|
461
|
+
if (hasInterrupts(__funcResult)) {
|
|
462
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
463
|
+
runner4.halt({
|
|
464
|
+
...__state,
|
|
465
|
+
data: __funcResult
|
|
562
466
|
});
|
|
467
|
+
return;
|
|
563
468
|
}
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
|
|
469
|
+
});
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
]);
|
|
474
|
+
await runner.ifElse(17, [
|
|
475
|
+
{
|
|
476
|
+
condition: async () => __stack.locals.review.issues.length > 0,
|
|
477
|
+
body: async (runner2) => {
|
|
478
|
+
await runner2.step(0, async (runner3) => {
|
|
567
479
|
const __funcResult = await __call(print, {
|
|
568
480
|
type: "positional",
|
|
569
|
-
args: [`
|
|
570
|
-
|
|
571
|
-
ctx: __ctx,
|
|
572
|
-
threads: __threads,
|
|
573
|
-
stateStack: __stateStack
|
|
481
|
+
args: [`
|
|
482
|
+
--- Issues ---`]
|
|
574
483
|
});
|
|
575
484
|
if (hasInterrupts(__funcResult)) {
|
|
576
|
-
await
|
|
577
|
-
|
|
485
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
486
|
+
runner3.halt({
|
|
578
487
|
...__state,
|
|
579
488
|
data: __funcResult
|
|
580
489
|
});
|
|
581
490
|
return;
|
|
582
491
|
}
|
|
583
492
|
});
|
|
584
|
-
await
|
|
585
|
-
{
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
493
|
+
await runner2.loop(1, __stack.locals.review.issues, async (issue, _, runner3) => {
|
|
494
|
+
await runner3.step(0, async (runner4) => {
|
|
495
|
+
__stack.locals.prefix = `[${issue.severity}]`;
|
|
496
|
+
});
|
|
497
|
+
await runner3.step(1, async (runner4) => {
|
|
498
|
+
__stack.locals.lineInfo = ``;
|
|
499
|
+
});
|
|
500
|
+
await runner3.ifElse(2, [
|
|
501
|
+
{
|
|
502
|
+
condition: async () => issue.line !== null,
|
|
503
|
+
body: async (runner4) => {
|
|
504
|
+
await runner4.step(0, async (runner5) => {
|
|
505
|
+
__stack.locals.lineInfo = ` (line ${issue.line})`;
|
|
596
506
|
});
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
]);
|
|
510
|
+
await runner3.step(3, async (runner4) => {
|
|
511
|
+
const __funcResult = await __call(print, {
|
|
512
|
+
type: "positional",
|
|
513
|
+
args: [` ${__stack.locals.prefix}${__stack.locals.lineInfo} ${issue.message}`]
|
|
514
|
+
});
|
|
515
|
+
if (hasInterrupts(__funcResult)) {
|
|
516
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
517
|
+
runner4.halt({
|
|
518
|
+
...__state,
|
|
519
|
+
data: __funcResult
|
|
605
520
|
});
|
|
521
|
+
return;
|
|
606
522
|
}
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
|
|
523
|
+
});
|
|
524
|
+
await runner3.ifElse(4, [
|
|
525
|
+
{
|
|
526
|
+
condition: async () => issue.suggestion !== null,
|
|
527
|
+
body: async (runner4) => {
|
|
528
|
+
await runner4.step(0, async (runner5) => {
|
|
529
|
+
const __funcResult = await __call(print, {
|
|
530
|
+
type: "positional",
|
|
531
|
+
args: [` Fix: ${issue.suggestion}`]
|
|
532
|
+
});
|
|
533
|
+
if (hasInterrupts(__funcResult)) {
|
|
534
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
535
|
+
runner5.halt({
|
|
536
|
+
...__state,
|
|
537
|
+
data: __funcResult
|
|
538
|
+
});
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
]);
|
|
545
|
+
});
|
|
546
|
+
}
|
|
610
547
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
args: [`
|
|
548
|
+
], async (runner2) => {
|
|
549
|
+
await runner2.step(2, async (runner3) => {
|
|
550
|
+
const __funcResult = await __call(print, {
|
|
551
|
+
type: "positional",
|
|
552
|
+
args: [`
|
|
617
553
|
No issues found. Code looks good!`]
|
|
618
|
-
}, {
|
|
619
|
-
ctx: __ctx,
|
|
620
|
-
threads: __threads,
|
|
621
|
-
stateStack: __stateStack
|
|
622
|
-
});
|
|
623
|
-
if (hasInterrupts(__funcResult)) {
|
|
624
|
-
await __ctx.pendingPromises.awaitAll();
|
|
625
|
-
runner3.halt({
|
|
626
|
-
...__state,
|
|
627
|
-
data: __funcResult
|
|
628
554
|
});
|
|
629
|
-
|
|
630
|
-
|
|
555
|
+
if (hasInterrupts(__funcResult)) {
|
|
556
|
+
await getRuntimeContext().ctx.pendingPromises.awaitAll();
|
|
557
|
+
runner3.halt({
|
|
558
|
+
...__state,
|
|
559
|
+
data: __funcResult
|
|
560
|
+
});
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
await runner.step(18, async (runner2) => {
|
|
566
|
+
__stateStack()?.pop();
|
|
567
|
+
__functionCompleted = true;
|
|
568
|
+
runner2.halt(goToNode("end", {
|
|
569
|
+
messages: __threads(),
|
|
570
|
+
ctx: getRuntimeContext().ctx,
|
|
571
|
+
data: {}
|
|
572
|
+
}));
|
|
573
|
+
return;
|
|
631
574
|
});
|
|
632
|
-
});
|
|
633
|
-
await runner.step(17, async (runner2) => {
|
|
634
|
-
__stateStack.pop();
|
|
635
|
-
__functionCompleted = true;
|
|
636
|
-
runner2.halt(goToNode("end", {
|
|
637
|
-
messages: __threads,
|
|
638
|
-
ctx: __ctx,
|
|
639
|
-
data: {}
|
|
640
|
-
}));
|
|
641
|
-
return;
|
|
642
575
|
});
|
|
643
576
|
if (runner.halted) return runner.haltResult;
|
|
644
|
-
await
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
577
|
+
await runner.hook(19, async () => {
|
|
578
|
+
await callHook({
|
|
579
|
+
name: "onNodeEnd",
|
|
580
|
+
data: {
|
|
581
|
+
nodeName: "main",
|
|
582
|
+
data: void 0
|
|
583
|
+
}
|
|
584
|
+
});
|
|
651
585
|
});
|
|
652
586
|
return {
|
|
653
|
-
messages: __threads,
|
|
587
|
+
messages: __threads(),
|
|
654
588
|
data: void 0
|
|
655
589
|
};
|
|
656
590
|
} catch (__error) {
|
|
657
591
|
if (__error instanceof RestoreSignal) {
|
|
658
592
|
throw __error;
|
|
659
593
|
}
|
|
594
|
+
if (__error instanceof GuardExceededError) {
|
|
595
|
+
throw __error;
|
|
596
|
+
}
|
|
660
597
|
console.error(`
|
|
661
598
|
Agent crashed: ${__error.message}`);
|
|
662
599
|
console.error(__error.stack);
|
|
663
600
|
return {
|
|
664
|
-
messages: __threads,
|
|
601
|
+
messages: __threads(),
|
|
665
602
|
data: failure(__error instanceof Error ? __error.message : String(__error), { functionName: "main" })
|
|
666
603
|
};
|
|
667
604
|
}
|
|
@@ -670,47 +607,55 @@ graph.node("end", async (__state) => {
|
|
|
670
607
|
const __setupData = setupNode({
|
|
671
608
|
state: __state
|
|
672
609
|
});
|
|
673
|
-
const __stateStack = __state.ctx.stateStack;
|
|
674
610
|
const __stack = __setupData.stack;
|
|
675
611
|
const __step = __setupData.step;
|
|
676
612
|
const __self = __setupData.self;
|
|
677
|
-
const
|
|
678
|
-
const __ctx = __state.ctx;
|
|
679
|
-
const statelogClient = __ctx.statelogClient;
|
|
680
|
-
const __graph = __ctx.graph;
|
|
613
|
+
const __ctx = getRuntimeContext().ctx;
|
|
681
614
|
let __forked;
|
|
682
615
|
let __functionCompleted = false;
|
|
683
|
-
|
|
684
|
-
callbacks: __ctx.callbacks,
|
|
685
|
-
name: "onNodeStart",
|
|
686
|
-
data: {
|
|
687
|
-
nodeName: "end"
|
|
688
|
-
}
|
|
689
|
-
});
|
|
690
|
-
const runner = new Runner(__ctx, __stack, { nodeContext: true, state: __stack, moduleId: "dist/lib/agents/review/agent.agency", scopeName: "end" });
|
|
616
|
+
const runner = new Runner(__ctx, __stack, { nodeContext: true, state: __stack, moduleId: "dist/lib/agents/review/agent.agency", scopeName: "end", threads: __setupData.threads });
|
|
691
617
|
try {
|
|
618
|
+
await agencyStore.run({
|
|
619
|
+
...getRuntimeContext(),
|
|
620
|
+
ctx: __ctx,
|
|
621
|
+
stack: __ctx.stateStack,
|
|
622
|
+
threads: __setupData.threads
|
|
623
|
+
}, async () => {
|
|
624
|
+
await runner.hook(0, async () => {
|
|
625
|
+
await callHook({
|
|
626
|
+
name: "onNodeStart",
|
|
627
|
+
data: {
|
|
628
|
+
nodeName: "end"
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
});
|
|
632
|
+
});
|
|
692
633
|
if (runner.halted) return runner.haltResult;
|
|
693
|
-
await
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
634
|
+
await runner.hook(1, async () => {
|
|
635
|
+
await callHook({
|
|
636
|
+
name: "onNodeEnd",
|
|
637
|
+
data: {
|
|
638
|
+
nodeName: "end",
|
|
639
|
+
data: void 0
|
|
640
|
+
}
|
|
641
|
+
});
|
|
700
642
|
});
|
|
701
643
|
return {
|
|
702
|
-
messages: __threads,
|
|
644
|
+
messages: __threads(),
|
|
703
645
|
data: void 0
|
|
704
646
|
};
|
|
705
647
|
} catch (__error) {
|
|
706
648
|
if (__error instanceof RestoreSignal) {
|
|
707
649
|
throw __error;
|
|
708
650
|
}
|
|
651
|
+
if (__error instanceof GuardExceededError) {
|
|
652
|
+
throw __error;
|
|
653
|
+
}
|
|
709
654
|
console.error(`
|
|
710
655
|
Agent crashed: ${__error.message}`);
|
|
711
656
|
console.error(__error.stack);
|
|
712
657
|
return {
|
|
713
|
-
messages: __threads,
|
|
658
|
+
messages: __threads(),
|
|
714
659
|
data: failure(__error instanceof Error ? __error.message : String(__error), { functionName: "end" })
|
|
715
660
|
};
|
|
716
661
|
}
|
|
@@ -723,7 +668,9 @@ async function main({ messages, callbacks } = {}) {
|
|
|
723
668
|
data: {},
|
|
724
669
|
messages,
|
|
725
670
|
callbacks,
|
|
726
|
-
initializeGlobals: __initializeGlobals
|
|
671
|
+
initializeGlobals: __initializeGlobals,
|
|
672
|
+
registerTopLevelCallbacks: __registerTopLevelCallbacks,
|
|
673
|
+
moduleDir: __dirname
|
|
727
674
|
});
|
|
728
675
|
}
|
|
729
676
|
const __mainNodeParams = [];
|
|
@@ -734,7 +681,9 @@ async function end({ messages, callbacks } = {}) {
|
|
|
734
681
|
data: {},
|
|
735
682
|
messages,
|
|
736
683
|
callbacks,
|
|
737
|
-
initializeGlobals: __initializeGlobals
|
|
684
|
+
initializeGlobals: __initializeGlobals,
|
|
685
|
+
registerTopLevelCallbacks: __registerTopLevelCallbacks,
|
|
686
|
+
moduleDir: __dirname
|
|
738
687
|
});
|
|
739
688
|
}
|
|
740
689
|
const __endNodeParams = [];
|
|
@@ -752,7 +701,7 @@ Agent crashed: ${__error.message}`);
|
|
|
752
701
|
}
|
|
753
702
|
}
|
|
754
703
|
var stdin_default = graph;
|
|
755
|
-
const __sourceMap = { "dist/lib/agents/review/agent.agency:main": { "
|
|
704
|
+
const __sourceMap = { "dist/lib/agents/review/agent.agency:main": { "1": { "line": 21, "col": 2 }, "2": { "line": 22, "col": 2 }, "3": { "line": 26, "col": 2 }, "4": { "line": 27, "col": 2 }, "5": { "line": 28, "col": 2 }, "6": { "line": 29, "col": 2 }, "7": { "line": 30, "col": 2 }, "8": { "line": 31, "col": 2 }, "9": { "line": 32, "col": 2 }, "10": { "line": 33, "col": 2 }, "12": { "line": 40, "col": 2 }, "14": { "line": 62, "col": 2 }, "15": { "line": 63, "col": 2 }, "16": { "line": 64, "col": 2 }, "17": { "line": 70, "col": 2 }, "18": { "line": 86, "col": 2 }, "2.0": { "line": 23, "col": 4 }, "2.1": { "line": 24, "col": 4 }, "10.0": { "line": 34, "col": 4 }, "10.1": { "line": 35, "col": 4 }, "10.2": { "line": 37, "col": 4 }, "12.0": { "line": 41, "col": 4 }, "12.1": { "line": 42, "col": 4 }, "12.2.0": { "line": 44, "col": 6 }, "12.2": { "line": 43, "col": 4 }, "12.3": { "line": 46, "col": 4 }, "12.4": { "line": 59, "col": 4 }, "16.0": { "line": 65, "col": 4 }, "16.1.0": { "line": 67, "col": 6 }, "16.1": { "line": 66, "col": 4 }, "17.0": { "line": 71, "col": 4 }, "17.1.0": { "line": 73, "col": 6 }, "17.1.1": { "line": 74, "col": 6 }, "17.1.2.0": { "line": 76, "col": 8 }, "17.1.2": { "line": 75, "col": 6 }, "17.1.3": { "line": 78, "col": 6 }, "17.1.4.0": { "line": 80, "col": 8 }, "17.1.4": { "line": 79, "col": 6 }, "17.1": { "line": 72, "col": 4 }, "17.2": { "line": 84, "col": 4 } }, "dist/lib/agents/review/agent.agency:end": {} };
|
|
756
705
|
export {
|
|
757
706
|
__endNodeParams,
|
|
758
707
|
__getCheckpoints,
|
|
@@ -770,7 +719,6 @@ export {
|
|
|
770
719
|
isDebugger,
|
|
771
720
|
isInterrupt,
|
|
772
721
|
main,
|
|
773
|
-
readSkill,
|
|
774
722
|
reject,
|
|
775
723
|
respondToInterrupts,
|
|
776
724
|
rewindFrom
|