@yanlinglabs/winter-agent-runtime 0.0.27
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/LICENSE +21 -0
- package/NOTICE +41 -0
- package/README.md +64 -0
- package/dist/checkpoint/file-history.d.ts +81 -0
- package/dist/checkpoint/rewind.d.ts +55 -0
- package/dist/checkpoint/seam.d.ts +47 -0
- package/dist/checkpoint/sink.d.ts +66 -0
- package/dist/commands/builtins-listing.d.ts +40 -0
- package/dist/commands/resolver.d.ts +103 -0
- package/dist/commands/seam.d.ts +53 -0
- package/dist/compaction/controller.d.ts +23 -0
- package/dist/compaction/retention.d.ts +35 -0
- package/dist/compaction/seam.d.ts +115 -0
- package/dist/compaction/summarizer.d.ts +79 -0
- package/dist/context/agent-listing.d.ts +39 -0
- package/dist/context/assembler.d.ts +46 -0
- package/dist/context/attachments.d.ts +104 -0
- package/dist/context/dynamic-sections.d.ts +31 -0
- package/dist/context/git-fixture.d.ts +18 -0
- package/dist/context/git-status.d.ts +16 -0
- package/dist/context/imports.d.ts +22 -0
- package/dist/context/injection.d.ts +53 -0
- package/dist/context/memory-key.d.ts +46 -0
- package/dist/context/memory.d.ts +28 -0
- package/dist/context/minimal-prompt.d.ts +5 -0
- package/dist/context/output-styles.d.ts +68 -0
- package/dist/context/plan-mode.d.ts +29 -0
- package/dist/context/request-layout.d.ts +138 -0
- package/dist/context/rules.d.ts +63 -0
- package/dist/context/seam.d.ts +136 -0
- package/dist/context/tool-epoch.d.ts +118 -0
- package/dist/context/winter-code-preset.d.ts +39 -0
- package/dist/context/winter-md.d.ts +81 -0
- package/dist/embedded-host.d.ts +48 -0
- package/dist/embedded-host.js +155 -0
- package/dist/embedded-protocol.d.ts +44 -0
- package/dist/embedded-worker.d.ts +1 -0
- package/dist/embedded-worker.js +74 -0
- package/dist/embedded.d.ts +34 -0
- package/dist/embedded.js +9 -0
- package/dist/engine.d.ts +1298 -0
- package/dist/hooks/additional-context.d.ts +21 -0
- package/dist/hooks/bounds.d.ts +6 -0
- package/dist/hooks/bridge-invoker.d.ts +3 -0
- package/dist/hooks/command-invoker.d.ts +52 -0
- package/dist/hooks/from-config.d.ts +31 -0
- package/dist/hooks/hook-stage.d.ts +25 -0
- package/dist/hooks/input-validator.d.ts +6 -0
- package/dist/hooks/reducer.d.ts +74 -0
- package/dist/hooks/registry.d.ts +33 -0
- package/dist/hooks/runner.d.ts +105 -0
- package/dist/index-584yahed.js +6037 -0
- package/dist/index-97t2rmtf.js +42 -0
- package/dist/index-9qgkpv56.js +27183 -0
- package/dist/index-bef62z3r.js +437 -0
- package/dist/index-rkhh0457.js +187 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +353 -0
- package/dist/main.d.ts +1 -0
- package/dist/mcp/client.d.ts +105 -0
- package/dist/mcp/control-seam.d.ts +25 -0
- package/dist/mcp/control.d.ts +5 -0
- package/dist/mcp/elicitation.d.ts +35 -0
- package/dist/mcp/env.d.ts +12 -0
- package/dist/mcp/lifecycle.d.ts +142 -0
- package/dist/mcp/output-cap.d.ts +15 -0
- package/dist/mcp/state.d.ts +24 -0
- package/dist/mcp/test-fixtures.d.ts +88 -0
- package/dist/mcp/transports/__fixtures__/stdio-server.d.ts +1 -0
- package/dist/mcp/transports/http.d.ts +5 -0
- package/dist/mcp/transports/sdk.d.ts +5 -0
- package/dist/mcp/transports/sse.d.ts +3 -0
- package/dist/mcp/transports/stdio.d.ts +35 -0
- package/dist/mcp/winter-server.d.ts +2 -0
- package/dist/messaging/reference-adapter.d.ts +88 -0
- package/dist/messaging/router.d.ts +8 -0
- package/dist/paths/project-dir-name.d.ts +2 -0
- package/dist/paths/temp.d.ts +25 -0
- package/dist/permissions/approvals.d.ts +107 -0
- package/dist/permissions/auto/caches.d.ts +53 -0
- package/dist/permissions/auto/config.d.ts +37 -0
- package/dist/permissions/auto/engine.d.ts +74 -0
- package/dist/permissions/auto/envelope.d.ts +45 -0
- package/dist/permissions/auto/inheritance.d.ts +27 -0
- package/dist/permissions/edit-recognition.d.ts +30 -0
- package/dist/permissions/evaluator.d.ts +284 -0
- package/dist/permissions/file-rules.d.ts +384 -0
- package/dist/permissions/grammar.d.ts +113 -0
- package/dist/permissions/paths.d.ts +32 -0
- package/dist/permissions/policy-state.d.ts +64 -0
- package/dist/permissions/prompt-stage.d.ts +3 -0
- package/dist/permissions/protected.d.ts +54 -0
- package/dist/permissions/ruleset.d.ts +134 -0
- package/dist/permissions/shell-structure.d.ts +41 -0
- package/dist/plugins/bundle.d.ts +100 -0
- package/dist/plugins/installed.d.ts +30 -0
- package/dist/plugins/loader.d.ts +56 -0
- package/dist/plugins/manifest.d.ts +115 -0
- package/dist/production-wiring.d.ts +340 -0
- package/dist/protocol/channel.d.ts +22 -0
- package/dist/provider/advisor-route.d.ts +47 -0
- package/dist/provider/bridge.d.ts +124 -0
- package/dist/provider/classifier/model-classifier.d.ts +82 -0
- package/dist/provider/classifier/prompt.d.ts +62 -0
- package/dist/provider/classifier/verdict-schema.d.ts +83 -0
- package/dist/provider/credential-api.d.ts +160 -0
- package/dist/provider/family-listing.d.ts +27 -0
- package/dist/provider/first-party.d.ts +4 -0
- package/dist/provider/keychain-store.d.ts +59 -0
- package/dist/provider/lean-prompt.d.ts +7 -0
- package/dist/provider/mock.d.ts +55 -0
- package/dist/provider/scenario-fake.d.ts +96 -0
- package/dist/provider/selection.d.ts +115 -0
- package/dist/provider/session-provider.d.ts +426 -0
- package/dist/provider/slots.d.ts +120 -0
- package/dist/provider/stream-frames.d.ts +25 -0
- package/dist/provider/tool-secret.d.ts +57 -0
- package/dist/rpc/bridge.d.ts +14 -0
- package/dist/rpc/mcp-control.d.ts +26 -0
- package/dist/runtime.d.ts +14 -0
- package/dist/sandbox/profile.d.ts +249 -0
- package/dist/sandbox/spawn.d.ts +139 -0
- package/dist/settings/env-filter.d.ts +52 -0
- package/dist/settings/loaders/hooks.d.ts +44 -0
- package/dist/settings/loaders/mcp-config.d.ts +83 -0
- package/dist/settings/loaders/plugin-mcp.d.ts +3 -0
- package/dist/settings/loaders/strict-plugin-only.d.ts +13 -0
- package/dist/settings/resolve.d.ts +2 -0
- package/dist/settings/sources.d.ts +2 -0
- package/dist/settings/trust.d.ts +36 -0
- package/dist/skills/attachment.d.ts +25 -0
- package/dist/skills/frontmatter.d.ts +64 -0
- package/dist/skills/index.d.ts +16 -0
- package/dist/skills/listing.d.ts +89 -0
- package/dist/skills/loader.d.ts +104 -0
- package/dist/skills/option.d.ts +68 -0
- package/dist/skills/permission-rules.d.ts +21 -0
- package/dist/skills/runtime.d.ts +21 -0
- package/dist/skills/store.d.ts +163 -0
- package/dist/store/continuation-attach.d.ts +44 -0
- package/dist/store/dialect.d.ts +526 -0
- package/dist/store/provider-state.d.ts +188 -0
- package/dist/store/resume.d.ts +92 -0
- package/dist/structured/ajv-seam.d.ts +7 -0
- package/dist/structured/descriptor.d.ts +9 -0
- package/dist/structured/seam.d.ts +51 -0
- package/dist/structured/validator.d.ts +22 -0
- package/dist/subagents/activity.d.ts +13 -0
- package/dist/subagents/availability.d.ts +30 -0
- package/dist/subagents/builtin-agents.d.ts +37 -0
- package/dist/subagents/child-engine.d.ts +198 -0
- package/dist/subagents/child-handle.d.ts +344 -0
- package/dist/subagents/definitions.d.ts +189 -0
- package/dist/subagents/fork.d.ts +55 -0
- package/dist/subagents/git-root.d.ts +1 -0
- package/dist/subagents/limits.d.ts +28 -0
- package/dist/subagents/notification-queue.d.ts +233 -0
- package/dist/subagents/plugin-agents.d.ts +5 -0
- package/dist/subagents/policy.d.ts +46 -0
- package/dist/subagents/register-default-factory.d.ts +66 -0
- package/dist/subagents/resolution.d.ts +56 -0
- package/dist/subagents/restore.d.ts +9 -0
- package/dist/subagents/roster.d.ts +17 -0
- package/dist/subagents/test-fakes.d.ts +12 -0
- package/dist/subagents/tool-pools.d.ts +69 -0
- package/dist/subagents/watchdog.d.ts +13 -0
- package/dist/subagents/workspace.d.ts +27 -0
- package/dist/testing.d.ts +5 -0
- package/dist/testing.js +194 -0
- package/dist/tools/background-tasks.d.ts +10 -0
- package/dist/tools/descriptors/_shared.d.ts +34 -0
- package/dist/tools/descriptors/advisor.d.ts +1 -0
- package/dist/tools/descriptors/agent.d.ts +47 -0
- package/dist/tools/descriptors/artifact.d.ts +1 -0
- package/dist/tools/descriptors/ask-user-question.d.ts +1 -0
- package/dist/tools/descriptors/bash.d.ts +20 -0
- package/dist/tools/descriptors/claude-design.d.ts +1 -0
- package/dist/tools/descriptors/cron-create.d.ts +1 -0
- package/dist/tools/descriptors/cron-delete.d.ts +1 -0
- package/dist/tools/descriptors/cron-list.d.ts +1 -0
- package/dist/tools/descriptors/edit.d.ts +1 -0
- package/dist/tools/descriptors/end-conversation.d.ts +1 -0
- package/dist/tools/descriptors/enter-plan-mode.d.ts +1 -0
- package/dist/tools/descriptors/enter-worktree.d.ts +1 -0
- package/dist/tools/descriptors/exit-plan-mode.d.ts +1 -0
- package/dist/tools/descriptors/exit-worktree.d.ts +1 -0
- package/dist/tools/descriptors/glob.d.ts +1 -0
- package/dist/tools/descriptors/grep.d.ts +1 -0
- package/dist/tools/descriptors/index.d.ts +59 -0
- package/dist/tools/descriptors/list-agents.d.ts +1 -0
- package/dist/tools/descriptors/list-mcp-resources-tool.d.ts +1 -0
- package/dist/tools/descriptors/lsp.d.ts +1 -0
- package/dist/tools/descriptors/monitor.d.ts +1 -0
- package/dist/tools/descriptors/notebook-edit.d.ts +1 -0
- package/dist/tools/descriptors/powershell.d.ts +1 -0
- package/dist/tools/descriptors/projects.d.ts +1 -0
- package/dist/tools/descriptors/propose-goal.d.ts +1 -0
- package/dist/tools/descriptors/propose-skills.d.ts +1 -0
- package/dist/tools/descriptors/push-notification.d.ts +1 -0
- package/dist/tools/descriptors/read-mcp-resource-dir-tool.d.ts +1 -0
- package/dist/tools/descriptors/read-mcp-resource-tool.d.ts +1 -0
- package/dist/tools/descriptors/read-notifications.d.ts +1 -0
- package/dist/tools/descriptors/read.d.ts +1 -0
- package/dist/tools/descriptors/refresh-mcp-tools.d.ts +1 -0
- package/dist/tools/descriptors/remote-trigger.d.ts +1 -0
- package/dist/tools/descriptors/repl.d.ts +1 -0
- package/dist/tools/descriptors/report-findings.d.ts +1 -0
- package/dist/tools/descriptors/schedule-wakeup.d.ts +1 -0
- package/dist/tools/descriptors/send-feedback.d.ts +1 -0
- package/dist/tools/descriptors/send-message.d.ts +1 -0
- package/dist/tools/descriptors/send-user-file.d.ts +1 -0
- package/dist/tools/descriptors/share-onboarding-guide.d.ts +1 -0
- package/dist/tools/descriptors/show-onboarding-role-picker.d.ts +1 -0
- package/dist/tools/descriptors/skill.d.ts +1 -0
- package/dist/tools/descriptors/structured-output.d.ts +1 -0
- package/dist/tools/descriptors/task-create.d.ts +1 -0
- package/dist/tools/descriptors/task-get.d.ts +1 -0
- package/dist/tools/descriptors/task-list.d.ts +1 -0
- package/dist/tools/descriptors/task-output.d.ts +1 -0
- package/dist/tools/descriptors/task-stop.d.ts +1 -0
- package/dist/tools/descriptors/task-update.d.ts +1 -0
- package/dist/tools/descriptors/todo-write.d.ts +1 -0
- package/dist/tools/descriptors/tool-search.d.ts +1 -0
- package/dist/tools/descriptors/wait-for-mcp-servers.d.ts +1 -0
- package/dist/tools/descriptors/web-fetch.d.ts +8 -0
- package/dist/tools/descriptors/web-search.d.ts +15 -0
- package/dist/tools/descriptors/winter-list-agents.d.ts +1 -0
- package/dist/tools/descriptors/winter-send-message.d.ts +1 -0
- package/dist/tools/descriptors/workflow.d.ts +1 -0
- package/dist/tools/descriptors/write.d.ts +1 -0
- package/dist/tools/impl/_caller.d.ts +14 -0
- package/dist/tools/impl/_domains.d.ts +25 -0
- package/dist/tools/impl/_exa-client.d.ts +122 -0
- package/dist/tools/impl/_exa-session-client.d.ts +23 -0
- package/dist/tools/impl/_inner-model.d.ts +135 -0
- package/dist/tools/impl/_search-budget.d.ts +36 -0
- package/dist/tools/impl/_web-fetch-cache.d.ts +37 -0
- package/dist/tools/impl/_web-fetch-html.d.ts +26 -0
- package/dist/tools/impl/_web-fetch-net.d.ts +99 -0
- package/dist/tools/impl/_web-search-assembler.d.ts +57 -0
- package/dist/tools/impl/advisor.d.ts +37 -0
- package/dist/tools/impl/agent.d.ts +10 -0
- package/dist/tools/impl/ask-user-question.d.ts +5 -0
- package/dist/tools/impl/background-task-runtime.d.ts +272 -0
- package/dist/tools/impl/bash.d.ts +78 -0
- package/dist/tools/impl/cron.d.ts +11 -0
- package/dist/tools/impl/edit.d.ts +1 -0
- package/dist/tools/impl/enter-plan-mode.d.ts +4 -0
- package/dist/tools/impl/enter-worktree.d.ts +25 -0
- package/dist/tools/impl/exit-plan-mode.d.ts +4 -0
- package/dist/tools/impl/exit-worktree.d.ts +4 -0
- package/dist/tools/impl/glob.d.ts +1 -0
- package/dist/tools/impl/grep.d.ts +19 -0
- package/dist/tools/impl/index.d.ts +37 -0
- package/dist/tools/impl/list-agents.d.ts +7 -0
- package/dist/tools/impl/list-mcp-resources-tool.d.ts +9 -0
- package/dist/tools/impl/monitor.d.ts +66 -0
- package/dist/tools/impl/notebook-edit.d.ts +1 -0
- package/dist/tools/impl/push-notification.d.ts +4 -0
- package/dist/tools/impl/read-ladder.d.ts +25 -0
- package/dist/tools/impl/read-mcp-resource-dir-tool.d.ts +9 -0
- package/dist/tools/impl/read-mcp-resource-tool.d.ts +9 -0
- package/dist/tools/impl/read-notifications.d.ts +5 -0
- package/dist/tools/impl/read.d.ts +44 -0
- package/dist/tools/impl/refresh-mcp-tools.d.ts +8 -0
- package/dist/tools/impl/report-findings.d.ts +1 -0
- package/dist/tools/impl/schedule-wakeup.d.ts +2 -0
- package/dist/tools/impl/send-message.d.ts +7 -0
- package/dist/tools/impl/skill.d.ts +5 -0
- package/dist/tools/impl/task-graph.d.ts +1 -0
- package/dist/tools/impl/task-output.d.ts +16 -0
- package/dist/tools/impl/task-stop.d.ts +11 -0
- package/dist/tools/impl/todo-write.d.ts +8 -0
- package/dist/tools/impl/tool-search.d.ts +4 -0
- package/dist/tools/impl/wait-for-mcp-servers.d.ts +29 -0
- package/dist/tools/impl/web-fetch.d.ts +36 -0
- package/dist/tools/impl/web-search.d.ts +30 -0
- package/dist/tools/impl/workflow.d.ts +5 -0
- package/dist/tools/impl/write.d.ts +8 -0
- package/dist/tools/paths-seam.d.ts +6 -0
- package/dist/tools/read-state.d.ts +12 -0
- package/dist/tools/registry.d.ts +423 -0
- package/dist/tools/task-graph-store.d.ts +61 -0
- package/dist/toolsearch/aliases.d.ts +26 -0
- package/dist/toolsearch/exposure.d.ts +30 -0
- package/dist/toolsearch/ranking.d.ts +6 -0
- package/dist/toolsearch/search.d.ts +45 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +5 -0
- package/dist/web/fetchable-url.d.ts +28 -0
- package/dist/web/preapproved-hosts.d.ts +52 -0
- package/dist/web/private-address.d.ts +55 -0
- package/dist/web/session-runtime.d.ts +86 -0
- package/dist/workflows/bridge.d.ts +87 -0
- package/dist/workflows/budget.d.ts +24 -0
- package/dist/workflows/host-registry.d.ts +142 -0
- package/dist/workflows/journal.d.ts +29 -0
- package/dist/workflows/meta.d.ts +45 -0
- package/dist/workflows/registry.d.ts +24 -0
- package/dist/workflows/runtime.d.ts +254 -0
- package/dist/workflows/sandbox.d.ts +49 -0
- package/dist/workflows/script-api.d.ts +58 -0
- package/dist/workflows/seam.d.ts +92 -0
- package/dist/workflows/semaphore.d.ts +16 -0
- package/dist/workflows/store.d.ts +177 -0
- package/dist/workflows/subprocess-entry.d.ts +38 -0
- package/dist/workflows/subprocess-entry.js +14 -0
- package/dist/workflows/transcript.d.ts +56 -0
- package/dist/workflows/types.d.ts +84 -0
- package/dist/workflows/worker-harness.d.ts +45 -0
- package/package.json +76 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** The argv marker that selects the worker role. */
|
|
2
|
+
export declare const WORKFLOW_WORKER_ARGV_FLAG = "__workflow-worker";
|
|
3
|
+
/**
|
|
4
|
+
* The DISCRIMINATOR. `__workflow-worker` alone means "the worker role was selected"; this flag means
|
|
5
|
+
* "and a real parent is on the other end of stdio, driving the NDJSON bridge."
|
|
6
|
+
*
|
|
7
|
+
* The split exists because R5-15's contract test (frozen) invokes `workflowWorkerMain` with
|
|
8
|
+
* `["winter", "__workflow-worker", "--run-id", "wf_1"]` and requires the not-implemented exit code
|
|
9
|
+
* back PROMPTLY. A worker that treated the role flag alone as "start reading init from stdin" would
|
|
10
|
+
* block that test forever on a stream nothing will ever write to. It also keeps `verify:workflow`'s
|
|
11
|
+
* RED/GREEN meaningful: a bare role invocation answers 78 in every build, while a bridged one
|
|
12
|
+
* answers 78 only while the body is a stub.
|
|
13
|
+
*/
|
|
14
|
+
export declare const WORKFLOW_WORKER_BRIDGE_FLAG = "--bridge";
|
|
15
|
+
/**
|
|
16
|
+
* Returned when the worker role was selected but no parent is driving it (no
|
|
17
|
+
* `--bridge` flag on argv). Distinct from a plain `1` so `verify:workflow` can report "the dispatch
|
|
18
|
+
* works, the worker is not being driven" rather than an indistinguishable generic failure.
|
|
19
|
+
*
|
|
20
|
+
* PRESERVED NAME AND VALUE (the spine's contract test asserts both, and asserts this exact code for
|
|
21
|
+
* a bare `__workflow-worker` argv). Its MEANING widened when the body landed: before, every
|
|
22
|
+
* invocation returned it; now only an undriven one does. That is precisely what makes
|
|
23
|
+
* `verify:workflow` a real RED/GREEN gate -- it drives the worker WITH the bridge flag, so it saw 78
|
|
24
|
+
* against the stub and sees a real run against this body.
|
|
25
|
+
*/
|
|
26
|
+
export declare const WORKFLOW_WORKER_NOT_IMPLEMENTED_EXIT_CODE = 78;
|
|
27
|
+
/**
|
|
28
|
+
* The worker itself broke -- an unreadable init line, an I/O failure. NOT the code for "the workflow
|
|
29
|
+
* failed": a failed workflow reports through the terminal `error` bridge op and still exits 0,
|
|
30
|
+
* because the parent already knows what happened and a non-zero code there would make a script bug
|
|
31
|
+
* indistinguishable from a runtime bug (R5-15's own stated reason for returning a code at all).
|
|
32
|
+
*/
|
|
33
|
+
export declare const WORKFLOW_WORKER_BROKEN_EXIT_CODE = 70;
|
|
34
|
+
export declare function workflowWorkerMain(argv: string[], io: {
|
|
35
|
+
stdin: NodeJS.ReadableStream;
|
|
36
|
+
stdout: NodeJS.WritableStream;
|
|
37
|
+
stderr: NodeJS.WritableStream;
|
|
38
|
+
}): Promise<number>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WORKFLOW_WORKER_ARGV_FLAG2,
|
|
3
|
+
WORKFLOW_WORKER_BRIDGE_FLAG2,
|
|
4
|
+
WORKFLOW_WORKER_NOT_IMPLEMENTED_EXIT_CODE2,
|
|
5
|
+
WORKFLOW_WORKER_BROKEN_EXIT_CODE2,
|
|
6
|
+
workflowWorkerMain2
|
|
7
|
+
} from "../index-bef62z3r.js";
|
|
8
|
+
export {
|
|
9
|
+
WORKFLOW_WORKER_ARGV_FLAG2 as WORKFLOW_WORKER_ARGV_FLAG,
|
|
10
|
+
WORKFLOW_WORKER_BRIDGE_FLAG2 as WORKFLOW_WORKER_BRIDGE_FLAG,
|
|
11
|
+
WORKFLOW_WORKER_BROKEN_EXIT_CODE2 as WORKFLOW_WORKER_BROKEN_EXIT_CODE,
|
|
12
|
+
WORKFLOW_WORKER_NOT_IMPLEMENTED_EXIT_CODE2 as WORKFLOW_WORKER_NOT_IMPLEMENTED_EXIT_CODE,
|
|
13
|
+
workflowWorkerMain2 as workflowWorkerMain
|
|
14
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-field byte cap. The full values live elsewhere -- an agent's result in the journal and in the
|
|
3
|
+
* child's own transcript, the run's result in the task output file -- so this file bounds what a
|
|
4
|
+
* long-running workflow can write into the durable projects area. 2 KB keeps a prompt and a result
|
|
5
|
+
* legible at a glance, which is what a diagnostic surface is for.
|
|
6
|
+
*/
|
|
7
|
+
export declare const TRANSCRIPT_FIELD_MAX_BYTES = 2048;
|
|
8
|
+
/** UTF-8 byte cap on a byte boundary -- `skills/frontmatter.ts`'s `capBytes`, same rule, same reason. */
|
|
9
|
+
declare function capField(value: string): string;
|
|
10
|
+
/** A string passes through; anything else is JSON. Then capped. Mirrors `renderResult`'s rule so the two surfaces agree. */
|
|
11
|
+
declare function renderCapped(value: unknown): string;
|
|
12
|
+
export type WorkflowTranscriptEntry = {
|
|
13
|
+
kind: "launch";
|
|
14
|
+
runId: string;
|
|
15
|
+
name: string;
|
|
16
|
+
scriptPath: string;
|
|
17
|
+
args?: string;
|
|
18
|
+
resumedFrom?: string;
|
|
19
|
+
replayed?: number;
|
|
20
|
+
} | {
|
|
21
|
+
kind: "agent";
|
|
22
|
+
prompt: string;
|
|
23
|
+
outcome: "value" | "null" | "refused";
|
|
24
|
+
value?: string;
|
|
25
|
+
phase?: string;
|
|
26
|
+
label?: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "phase";
|
|
29
|
+
title: string;
|
|
30
|
+
declared: boolean;
|
|
31
|
+
} | {
|
|
32
|
+
kind: "finish";
|
|
33
|
+
status: "completed" | "failed" | "stopped";
|
|
34
|
+
detail?: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* One run's transcript: append-only NDJSON at `<transcriptDir>/transcript.jsonl`.
|
|
38
|
+
*
|
|
39
|
+
* The directory is created by the caller (`runtime.ts` creates and reports it in the same breath),
|
|
40
|
+
* so this class only appends -- and swallows every error, per this module's header.
|
|
41
|
+
*/
|
|
42
|
+
export declare class RunTranscript {
|
|
43
|
+
private readonly path;
|
|
44
|
+
constructor(transcriptDir: string);
|
|
45
|
+
append(entry: WorkflowTranscriptEntry): void;
|
|
46
|
+
/** The `agent()` record, with the value rendered and capped here so callers never do it twice. */
|
|
47
|
+
agent(input: {
|
|
48
|
+
prompt: string;
|
|
49
|
+
value: unknown;
|
|
50
|
+
resolvedNull: boolean;
|
|
51
|
+
phase?: string;
|
|
52
|
+
label?: string;
|
|
53
|
+
}): void;
|
|
54
|
+
finish(status: "completed" | "failed" | "stopped", detail?: string): void;
|
|
55
|
+
}
|
|
56
|
+
export { capField as capTranscriptField, renderCapped as renderTranscriptValue };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/** WS-11 §1.8: `running -> completed | failed | stopped`, a ONE-WAY lifecycle. */
|
|
2
|
+
export type WorkflowStatus = "running" | "completed" | "failed" | "stopped";
|
|
3
|
+
export interface WorkflowCounts {
|
|
4
|
+
running: number;
|
|
5
|
+
completed: number;
|
|
6
|
+
total: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* WS-11 §1.6's `agent()` options table, in full. Norma's original carried `{label, model, schema}`;
|
|
10
|
+
* `phase`, `effort`, `isolation` and `agentType` are the CC-contract widening.
|
|
11
|
+
*
|
|
12
|
+
* SERIALIZED ACROSS THE BRIDGE and used verbatim inside `promptKey`, so every field must be plain
|
|
13
|
+
* JSON data -- a function or class instance here would break both the wire and the resume cache.
|
|
14
|
+
*/
|
|
15
|
+
export interface AgentOpts {
|
|
16
|
+
/** Display-label override for the progress tree. */
|
|
17
|
+
label?: string;
|
|
18
|
+
/** Explicit progress-group assignment -- avoids racing the global `phase()` state inside `pipeline`/`parallel` stages. */
|
|
19
|
+
phase?: string;
|
|
20
|
+
/** JSON Schema. Forces the child onto the StructuredOutput mechanism (WS-11 §8) via `SpawnChildRequest.outputFormat`. */
|
|
21
|
+
schema?: unknown;
|
|
22
|
+
/** Per-child model override; omitted -> the child inherits the resolved session model (WS-10). */
|
|
23
|
+
model?: string;
|
|
24
|
+
effort?: "low" | "medium" | "high" | "xhigh" | "max";
|
|
25
|
+
/** WS-10 §8: a fresh git worktree per agent, auto-removed when unchanged. */
|
|
26
|
+
isolation?: "worktree";
|
|
27
|
+
/** A custom subagent type resolved from the same registry the Agent tool uses; composes with `schema`. */
|
|
28
|
+
agentType?: string;
|
|
29
|
+
}
|
|
30
|
+
/** A read-only projection of a run -- plain-cloneable, no AbortController, safe to hand to a caller. */
|
|
31
|
+
export interface WorkflowRunView {
|
|
32
|
+
runId: string;
|
|
33
|
+
sessionId: string;
|
|
34
|
+
taskId: string;
|
|
35
|
+
name: string;
|
|
36
|
+
status: WorkflowStatus;
|
|
37
|
+
counts: WorkflowCounts;
|
|
38
|
+
phase?: string;
|
|
39
|
+
result?: string;
|
|
40
|
+
error?: string;
|
|
41
|
+
startedAt: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* `WorkflowInput`, `sdk-tools.d.ts:2758-2789`. Seven fields, ALL optional at the declaration; the
|
|
45
|
+
* "at least one of `script`/`name`/`scriptPath`" rule is a runtime validation, not a type one,
|
|
46
|
+
* exactly as the pin has it.
|
|
47
|
+
*/
|
|
48
|
+
export interface WorkflowInput {
|
|
49
|
+
script?: string;
|
|
50
|
+
name?: string;
|
|
51
|
+
/** Accepted and IGNORED -- the meta block owns metadata (`sdk-tools.d.ts:2768`). */
|
|
52
|
+
description?: string;
|
|
53
|
+
/** Accepted and IGNORED (`sdk-tools.d.ts:2772`). */
|
|
54
|
+
title?: string;
|
|
55
|
+
args?: {
|
|
56
|
+
[k: string]: unknown;
|
|
57
|
+
};
|
|
58
|
+
/** Takes PRECEDENCE over `script` and `name` (`sdk-tools.d.ts:2782`). */
|
|
59
|
+
scriptPath?: string;
|
|
60
|
+
/** Same-session only, and only after the prior run has stopped (`sdk-tools.d.ts:2786`). */
|
|
61
|
+
resumeFromRunId?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* `WorkflowOutput`, `sdk-tools.d.ts:4053-4089` -- declared in full, so this is a MIRROR, not a
|
|
65
|
+
* Winter invention. `status` and `taskId` are the only required fields.
|
|
66
|
+
*
|
|
67
|
+
* Winter implements the LOCAL half only: `remote_launched`/`sessionUrl` are declared here for
|
|
68
|
+
* fidelity to the pinned union but are never produced (`WorkflowInput` declares no `remote` field --
|
|
69
|
+
* item (g)'s own asymmetry note).
|
|
70
|
+
*/
|
|
71
|
+
export interface WorkflowOutput {
|
|
72
|
+
status: "async_launched" | "remote_launched";
|
|
73
|
+
taskId: string;
|
|
74
|
+
taskType?: "local_workflow" | "remote_agent";
|
|
75
|
+
workflowName?: string;
|
|
76
|
+
runId?: string;
|
|
77
|
+
summary?: string;
|
|
78
|
+
transcriptDir?: string;
|
|
79
|
+
scriptPath?: string;
|
|
80
|
+
sessionUrl?: string;
|
|
81
|
+
warning?: string;
|
|
82
|
+
/** Doc-asserted (`4086`) to be set when the SYNTAX CHECK fails -- a script that fails validation still returns a WorkflowOutput. */
|
|
83
|
+
error?: string;
|
|
84
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type BridgeRequest, type WorkflowRef } from "./bridge.js";
|
|
2
|
+
import type { JournalEntry } from "./journal.js";
|
|
3
|
+
import type { BudgetSnapshot } from "./budget.js";
|
|
4
|
+
import type { WorkerSpawner } from "./runtime.js";
|
|
5
|
+
export interface InProcessWorkerOptions {
|
|
6
|
+
source?: string;
|
|
7
|
+
args?: unknown;
|
|
8
|
+
argv?: string[];
|
|
9
|
+
concurrency?: number;
|
|
10
|
+
totalAgentCap?: number;
|
|
11
|
+
maxItemsPerCall?: number;
|
|
12
|
+
budget?: BudgetSnapshot;
|
|
13
|
+
resumeJournal?: JournalEntry[];
|
|
14
|
+
/** Skip writing an init line at all -- for the undriven-argv cases. */
|
|
15
|
+
skipInit?: boolean;
|
|
16
|
+
/** Write this instead of a well-formed init line (the malformed-init case). */
|
|
17
|
+
rawInit?: string;
|
|
18
|
+
answerAgent?: (req: {
|
|
19
|
+
prompt: string;
|
|
20
|
+
opts?: unknown;
|
|
21
|
+
callId: number;
|
|
22
|
+
}) => Promise<{
|
|
23
|
+
value?: unknown;
|
|
24
|
+
error?: string;
|
|
25
|
+
budget?: BudgetSnapshot;
|
|
26
|
+
delayMs?: number;
|
|
27
|
+
}>;
|
|
28
|
+
answerWorkflow?: (ref: WorkflowRef, args: unknown) => Promise<{
|
|
29
|
+
ok: true;
|
|
30
|
+
source: string;
|
|
31
|
+
} | {
|
|
32
|
+
ok: false;
|
|
33
|
+
error: string;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
export interface InProcessWorkerResult {
|
|
37
|
+
exitCode: number;
|
|
38
|
+
requests: BridgeRequest[];
|
|
39
|
+
/** The `done` or `error` frame, when one was produced. */
|
|
40
|
+
terminal: BridgeRequest | undefined;
|
|
41
|
+
stdoutLines: string[];
|
|
42
|
+
stderr: string;
|
|
43
|
+
}
|
|
44
|
+
export declare function runWorkerInProcess(opts: InProcessWorkerOptions): Promise<InProcessWorkerResult>;
|
|
45
|
+
export declare function inProcessWorkerSpawner(): WorkerSpawner;
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yanlinglabs/winter-agent-runtime",
|
|
3
|
+
"version": "0.0.27",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"bun": ">=1.3"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/yanlingLabs/winter-agent-sdk.git",
|
|
12
|
+
"directory": "packages/runtime"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/yanlingLabs/winter-agent-sdk",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/yanlingLabs/winter-agent-sdk/issues"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./testing": {
|
|
26
|
+
"types": "./dist/testing.d.ts",
|
|
27
|
+
"default": "./dist/testing.js"
|
|
28
|
+
},
|
|
29
|
+
"./embedded": {
|
|
30
|
+
"types": "./dist/embedded.d.ts",
|
|
31
|
+
"default": "./dist/embedded.js"
|
|
32
|
+
},
|
|
33
|
+
"./embedded-host": {
|
|
34
|
+
"types": "./dist/embedded-host.d.ts",
|
|
35
|
+
"default": "./dist/embedded-host.js"
|
|
36
|
+
},
|
|
37
|
+
"./embedded-worker": {
|
|
38
|
+
"types": "./dist/embedded-worker.d.ts",
|
|
39
|
+
"default": "./dist/embedded-worker.js"
|
|
40
|
+
},
|
|
41
|
+
"./workflow-worker": {
|
|
42
|
+
"types": "./dist/workflows/subprocess-entry.d.ts",
|
|
43
|
+
"default": "./dist/workflows/subprocess-entry.js"
|
|
44
|
+
},
|
|
45
|
+
"./version": {
|
|
46
|
+
"types": "./dist/version.d.ts",
|
|
47
|
+
"default": "./dist/version.js"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"dist",
|
|
52
|
+
"NOTICE",
|
|
53
|
+
"README.md",
|
|
54
|
+
"LICENSE"
|
|
55
|
+
],
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "restricted"
|
|
58
|
+
},
|
|
59
|
+
"winter": {
|
|
60
|
+
"publish": {
|
|
61
|
+
"npm": true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"@modelcontextprotocol/client": "^2.1.0",
|
|
66
|
+
"ajv": "^8.20.0",
|
|
67
|
+
"ignore": "7.0.5",
|
|
68
|
+
"@yanlinglabs/winter-provider-runtime": "0.0.27",
|
|
69
|
+
"@yanlinglabs/winter-agent-sdk": "0.0.27",
|
|
70
|
+
"@yanlinglabs/winter-provider-catalog": "0.0.27"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@modelcontextprotocol/server": "^2.1.0"
|
|
74
|
+
},
|
|
75
|
+
"scripts": {}
|
|
76
|
+
}
|