@adonis-agora/agent 0.30.2 → 0.33.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/CHANGELOG.md +866 -0
- package/dist/assets/spa/assets/{index-Cfi3g3b2.js → index-3Q2m5_Ax.js} +1 -1
- package/dist/assets/spa/index.html +1 -1
- package/dist/providers/agent_provider.d.ts.map +1 -1
- package/dist/providers/agent_provider.js +157 -9
- package/dist/providers/agent_provider.js.map +1 -1
- package/dist/src/agent-deps-factory.d.ts +16 -2
- package/dist/src/agent-deps-factory.d.ts.map +1 -1
- package/dist/src/agent-deps-factory.js +8 -0
- package/dist/src/agent-deps-factory.js.map +1 -1
- package/dist/src/agent-deps.d.ts +21 -1
- package/dist/src/agent-deps.d.ts.map +1 -1
- package/dist/src/agent-deps.js.map +1 -1
- package/dist/src/agent-loop.d.ts +226 -9
- package/dist/src/agent-loop.d.ts.map +1 -1
- package/dist/src/agent-loop.js +1311 -208
- package/dist/src/agent-loop.js.map +1 -1
- package/dist/src/agent-service.d.ts +27 -0
- package/dist/src/agent-service.d.ts.map +1 -1
- package/dist/src/agent-service.js +29 -0
- package/dist/src/agent-service.js.map +1 -1
- package/dist/src/ai-sdk/ai-sdk-model.d.ts.map +1 -1
- package/dist/src/ai-sdk/ai-sdk-model.js +21 -1
- package/dist/src/ai-sdk/ai-sdk-model.js.map +1 -1
- package/dist/src/client/sse.d.ts +32 -2
- package/dist/src/client/sse.d.ts.map +1 -1
- package/dist/src/client/sse.js +45 -2
- package/dist/src/client/sse.js.map +1 -1
- package/dist/src/define_config.d.ts +41 -7
- package/dist/src/define_config.d.ts.map +1 -1
- package/dist/src/define_config.js.map +1 -1
- package/dist/src/durable/agent-run-workflow.d.ts +10 -11
- package/dist/src/durable/agent-run-workflow.d.ts.map +1 -1
- package/dist/src/durable/agent-run-workflow.js +49 -21
- package/dist/src/durable/agent-run-workflow.js.map +1 -1
- package/dist/src/durable/durable-agent-runner.d.ts +3 -2
- package/dist/src/durable/durable-agent-runner.d.ts.map +1 -1
- package/dist/src/durable/durable-agent-runner.js +2 -2
- package/dist/src/durable/durable-agent-runner.js.map +1 -1
- package/dist/src/elicitation.d.ts +207 -0
- package/dist/src/elicitation.d.ts.map +1 -0
- package/dist/src/elicitation.js +315 -0
- package/dist/src/elicitation.js.map +1 -0
- package/dist/src/evals/approval-prior.d.ts +58 -0
- package/dist/src/evals/approval-prior.d.ts.map +1 -0
- package/dist/src/evals/approval-prior.js +82 -0
- package/dist/src/evals/approval-prior.js.map +1 -0
- package/dist/src/evals/evaluate.d.ts +51 -0
- package/dist/src/evals/evaluate.d.ts.map +1 -0
- package/dist/src/evals/evaluate.js +76 -0
- package/dist/src/evals/evaluate.js.map +1 -0
- package/dist/src/evals/governance-sample-source.d.ts +23 -0
- package/dist/src/evals/governance-sample-source.d.ts.map +1 -0
- package/dist/src/evals/governance-sample-source.js +93 -0
- package/dist/src/evals/governance-sample-source.js.map +1 -0
- package/dist/src/evals/in-memory-score-store.d.ts +16 -0
- package/dist/src/evals/in-memory-score-store.d.ts.map +1 -0
- package/dist/src/evals/in-memory-score-store.js +57 -0
- package/dist/src/evals/in-memory-score-store.js.map +1 -0
- package/dist/src/evals/index.d.ts +15 -0
- package/dist/src/evals/index.d.ts.map +1 -0
- package/dist/src/evals/index.js +14 -0
- package/dist/src/evals/index.js.map +1 -0
- package/dist/src/evals/judge.d.ts +30 -0
- package/dist/src/evals/judge.d.ts.map +1 -0
- package/dist/src/evals/judge.js +53 -0
- package/dist/src/evals/judge.js.map +1 -0
- package/dist/src/evals/live-scoring.d.ts +42 -0
- package/dist/src/evals/live-scoring.d.ts.map +1 -0
- package/dist/src/evals/live-scoring.js +103 -0
- package/dist/src/evals/live-scoring.js.map +1 -0
- package/dist/src/evals/sample-source.d.ts +40 -0
- package/dist/src/evals/sample-source.d.ts.map +1 -0
- package/dist/src/evals/sample-source.js +33 -0
- package/dist/src/evals/sample-source.js.map +1 -0
- package/dist/src/evals/score-store.d.ts +54 -0
- package/dist/src/evals/score-store.d.ts.map +1 -0
- package/dist/src/evals/score-store.js +2 -0
- package/dist/src/evals/score-store.js.map +1 -0
- package/dist/src/evals/scorers/answer-relevancy.scorer.d.ts +28 -0
- package/dist/src/evals/scorers/answer-relevancy.scorer.d.ts.map +1 -0
- package/dist/src/evals/scorers/answer-relevancy.scorer.js +42 -0
- package/dist/src/evals/scorers/answer-relevancy.scorer.js.map +1 -0
- package/dist/src/evals/scorers/approval-outcome.scorer.d.ts +22 -0
- package/dist/src/evals/scorers/approval-outcome.scorer.d.ts.map +1 -0
- package/dist/src/evals/scorers/approval-outcome.scorer.js +60 -0
- package/dist/src/evals/scorers/approval-outcome.scorer.js.map +1 -0
- package/dist/src/evals/scorers/approval-risk.scorer.d.ts +28 -0
- package/dist/src/evals/scorers/approval-risk.scorer.d.ts.map +1 -0
- package/dist/src/evals/scorers/approval-risk.scorer.js +54 -0
- package/dist/src/evals/scorers/approval-risk.scorer.js.map +1 -0
- package/dist/src/evals/scorers/run-completion.scorer.d.ts +18 -0
- package/dist/src/evals/scorers/run-completion.scorer.d.ts.map +1 -0
- package/dist/src/evals/scorers/run-completion.scorer.js +55 -0
- package/dist/src/evals/scorers/run-completion.scorer.js.map +1 -0
- package/dist/src/evals/summarize.d.ts +44 -0
- package/dist/src/evals/summarize.d.ts.map +1 -0
- package/dist/src/evals/summarize.js +87 -0
- package/dist/src/evals/summarize.js.map +1 -0
- package/dist/src/evals/types.d.ts +81 -0
- package/dist/src/evals/types.d.ts.map +1 -0
- package/dist/src/evals/types.js +15 -0
- package/dist/src/evals/types.js.map +1 -0
- package/dist/src/history-window.d.ts +50 -11
- package/dist/src/history-window.d.ts.map +1 -1
- package/dist/src/history-window.js +84 -12
- package/dist/src/history-window.js.map +1 -1
- package/dist/src/index.d.ts +11 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +10 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/server.d.ts +8 -0
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +27 -1
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/mcp-client/importer.d.ts +75 -0
- package/dist/src/mcp-client/importer.d.ts.map +1 -0
- package/dist/src/mcp-client/importer.js +161 -0
- package/dist/src/mcp-client/importer.js.map +1 -0
- package/dist/src/mcp-client/index.d.ts +9 -0
- package/dist/src/mcp-client/index.d.ts.map +1 -0
- package/dist/src/mcp-client/index.js +8 -0
- package/dist/src/mcp-client/index.js.map +1 -0
- package/dist/src/mcp-client/options.d.ts +99 -0
- package/dist/src/mcp-client/options.d.ts.map +1 -0
- package/dist/src/mcp-client/options.js +2 -0
- package/dist/src/mcp-client/options.js.map +1 -0
- package/dist/src/mcp-client/tool-input.d.ts +39 -0
- package/dist/src/mcp-client/tool-input.d.ts.map +1 -0
- package/dist/src/mcp-client/tool-input.js +61 -0
- package/dist/src/mcp-client/tool-input.js.map +1 -0
- package/dist/src/mcp-client/tool-kind.d.ts +37 -0
- package/dist/src/mcp-client/tool-kind.d.ts.map +1 -0
- package/dist/src/mcp-client/tool-kind.js +20 -0
- package/dist/src/mcp-client/tool-kind.js.map +1 -0
- package/dist/src/mcp-client/tool-name.d.ts +22 -0
- package/dist/src/mcp-client/tool-name.d.ts.map +1 -0
- package/dist/src/mcp-client/tool-name.js +35 -0
- package/dist/src/mcp-client/tool-name.js.map +1 -0
- package/dist/src/mcp-client/tool-source.d.ts +75 -0
- package/dist/src/mcp-client/tool-source.d.ts.map +1 -0
- package/dist/src/mcp-client/tool-source.js +244 -0
- package/dist/src/mcp-client/tool-source.js.map +1 -0
- package/dist/src/mcp-client/transient.d.ts +28 -0
- package/dist/src/mcp-client/transient.d.ts.map +1 -0
- package/dist/src/mcp-client/transient.js +126 -0
- package/dist/src/mcp-client/transient.js.map +1 -0
- package/dist/src/mcp-client/unsafe-regex.d.ts +23 -0
- package/dist/src/mcp-client/unsafe-regex.d.ts.map +1 -0
- package/dist/src/mcp-client/unsafe-regex.js +194 -0
- package/dist/src/mcp-client/unsafe-regex.js.map +1 -0
- package/dist/src/memory.d.ts +448 -0
- package/dist/src/memory.d.ts.map +1 -0
- package/dist/src/memory.js +330 -0
- package/dist/src/memory.js.map +1 -0
- package/dist/src/pagination.d.ts +63 -0
- package/dist/src/pagination.d.ts.map +1 -0
- package/dist/src/pagination.js +16 -0
- package/dist/src/pagination.js.map +1 -0
- package/dist/src/processors.d.ts +134 -0
- package/dist/src/processors.d.ts.map +1 -0
- package/dist/src/processors.js +215 -0
- package/dist/src/processors.js.map +1 -0
- package/dist/src/rag/qdrant-store.d.ts +48 -6
- package/dist/src/rag/qdrant-store.d.ts.map +1 -1
- package/dist/src/rag/qdrant-store.js +77 -24
- package/dist/src/rag/qdrant-store.js.map +1 -1
- package/dist/src/replay-integrity.d.ts +17 -0
- package/dist/src/replay-integrity.d.ts.map +1 -0
- package/dist/src/replay-integrity.js +19 -0
- package/dist/src/replay-integrity.js.map +1 -0
- package/dist/src/runners/inline-agent-runner.d.ts +33 -7
- package/dist/src/runners/inline-agent-runner.d.ts.map +1 -1
- package/dist/src/runners/inline-agent-runner.js +113 -27
- package/dist/src/runners/inline-agent-runner.js.map +1 -1
- package/dist/src/skills.d.ts +291 -0
- package/dist/src/skills.d.ts.map +1 -0
- package/dist/src/skills.js +0 -0
- package/dist/src/skills.js.map +1 -0
- package/dist/src/spi/agent-runner.d.ts +20 -6
- package/dist/src/spi/agent-runner.d.ts.map +1 -1
- package/dist/src/spi/agent-store.d.ts +53 -0
- package/dist/src/spi/agent-store.d.ts.map +1 -1
- package/dist/src/spi/governance-queries.d.ts +33 -13
- package/dist/src/spi/governance-queries.d.ts.map +1 -1
- package/dist/src/spi/history-window.d.ts +64 -10
- package/dist/src/spi/history-window.d.ts.map +1 -1
- package/dist/src/spi/model-provider.d.ts +18 -0
- package/dist/src/spi/model-provider.d.ts.map +1 -1
- package/dist/src/spi/processors.d.ts +161 -0
- package/dist/src/spi/processors.d.ts.map +1 -0
- package/dist/src/spi/processors.js +57 -0
- package/dist/src/spi/processors.js.map +1 -0
- package/dist/src/spi/token-stream-sink.d.ts +43 -0
- package/dist/src/spi/token-stream-sink.d.ts.map +1 -1
- package/dist/src/spi/token-stream-sink.js +17 -1
- package/dist/src/spi/token-stream-sink.js.map +1 -1
- package/dist/src/sse.d.ts +5 -2
- package/dist/src/sse.d.ts.map +1 -1
- package/dist/src/sse.js +11 -2
- package/dist/src/sse.js.map +1 -1
- package/dist/src/stores/lucid-governance-queries.d.ts +5 -2
- package/dist/src/stores/lucid-governance-queries.d.ts.map +1 -1
- package/dist/src/stores/lucid-governance-queries.js +14 -5
- package/dist/src/stores/lucid-governance-queries.js.map +1 -1
- package/dist/src/stores/lucid-schema.d.ts.map +1 -1
- package/dist/src/stores/lucid-schema.js +15 -0
- package/dist/src/stores/lucid-schema.js.map +1 -1
- package/dist/src/stores/lucid.d.ts +11 -3
- package/dist/src/stores/lucid.d.ts.map +1 -1
- package/dist/src/stores/lucid.js +65 -0
- package/dist/src/stores/lucid.js.map +1 -1
- package/dist/src/structured-output.d.ts +57 -0
- package/dist/src/structured-output.d.ts.map +1 -0
- package/dist/src/structured-output.js +80 -0
- package/dist/src/structured-output.js.map +1 -0
- package/dist/src/telescope/agent-governance-providers.js +2 -2
- package/dist/src/telescope/agent-governance-providers.js.map +1 -1
- package/dist/src/testing/fake-model-provider.d.ts +8 -4
- package/dist/src/testing/fake-model-provider.d.ts.map +1 -1
- package/dist/src/testing/fake-model-provider.js +6 -9
- package/dist/src/testing/fake-model-provider.js.map +1 -1
- package/dist/src/testing/in-memory-governance-queries.d.ts.map +1 -1
- package/dist/src/testing/in-memory-governance-queries.js +8 -3
- package/dist/src/testing/in-memory-governance-queries.js.map +1 -1
- package/dist/src/testing/in-memory-store.d.ts +4 -3
- package/dist/src/testing/in-memory-store.d.ts.map +1 -1
- package/dist/src/testing/in-memory-store.js +13 -7
- package/dist/src/testing/in-memory-store.js.map +1 -1
- package/dist/src/testing/index.d.ts +1 -1
- package/dist/src/testing/index.d.ts.map +1 -1
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/tool-registry.d.ts +9 -0
- package/dist/src/tool-registry.d.ts.map +1 -1
- package/dist/src/tool-registry.js +11 -0
- package/dist/src/tool-registry.js.map +1 -1
- package/dist/src/types.d.ts +55 -2
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +20 -10
- package/skills/agent-personas-agents/SKILL.md +16 -12
|
@@ -59,6 +59,14 @@ export interface RecordRunStartInput {
|
|
|
59
59
|
actor: Actor;
|
|
60
60
|
/** The agent that handled the run; `null`/omitted for the default agent. */
|
|
61
61
|
agentName?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The run that started this one, for a delegation's child run. The parent->child edge exists in
|
|
64
|
+
* the durable runtime's own journal, but only there: a governance surface reading run rows alone
|
|
65
|
+
* cannot roll a delegation's cost up to the turn that asked for it.
|
|
66
|
+
*
|
|
67
|
+
* Optional, and a store that persists nothing for it still works — it loses the tree, not the run.
|
|
68
|
+
*/
|
|
69
|
+
parentRunId?: string;
|
|
62
70
|
/** True when the run executes as a replay-safe durable workflow, false for the inline runner. */
|
|
63
71
|
durable?: boolean;
|
|
64
72
|
}
|
|
@@ -79,6 +87,40 @@ export interface RecordRunEndInput {
|
|
|
79
87
|
costUsd?: number;
|
|
80
88
|
error?: string;
|
|
81
89
|
}
|
|
90
|
+
/** Which thread, and how many of its newest messages, {@link ThreadTurnReader.loadThreadForTurn} reads. */
|
|
91
|
+
export interface ThreadTurnQuery {
|
|
92
|
+
threadId: string;
|
|
93
|
+
/** Omitted reads every message; `0` reads none. */
|
|
94
|
+
messageLimit?: number;
|
|
95
|
+
}
|
|
96
|
+
/** What a turn reads off a thread — a bounded window, not the transcript. */
|
|
97
|
+
export interface ThreadTurnPage {
|
|
98
|
+
title: string;
|
|
99
|
+
/** Whether the THREAD has ever been answered, not whether {@link messages} holds an answer. */
|
|
100
|
+
hasAssistantMessage: boolean;
|
|
101
|
+
/** Oldest first, carrying only the fields a model turn reads. */
|
|
102
|
+
messages: StoredMessage[];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A store that can hand a turn the WINDOW it is about to send, instead of the thread's transcript.
|
|
106
|
+
*
|
|
107
|
+
* {@link AgentStore.getThread} materializes every message row, every attachment and every tool
|
|
108
|
+
* output a thread ever recorded, and `load:thread` then journals what it loaded — so a long thread
|
|
109
|
+
* pays for its whole history on every turn and again on every replay, to send a prompt bounded to
|
|
110
|
+
* its last few messages. This read is bounded by the database (`order by created_at desc limit ?`),
|
|
111
|
+
* projected to the columns a model turn actually reads.
|
|
112
|
+
*
|
|
113
|
+
* `hasAssistantMessage` is answered over the WHOLE thread, never the page: it answers "has this
|
|
114
|
+
* conversation been answered before?" — what a `thread-start` intake asks — and a thread whose
|
|
115
|
+
* window happens to hold only the user's last questions has still been answered. `null` for a thread
|
|
116
|
+
* that is unknown or soft-deleted, matching `getThread`.
|
|
117
|
+
*
|
|
118
|
+
* Probed STRUCTURALLY rather than declared on {@link AgentStore}: it is an optimization a store
|
|
119
|
+
* either offers or does not, and one that offers none still answers correctly through the full read.
|
|
120
|
+
*/
|
|
121
|
+
export interface ThreadTurnReader {
|
|
122
|
+
loadThreadForTurn(query: ThreadTurnQuery): Promise<ThreadTurnPage | null>;
|
|
123
|
+
}
|
|
82
124
|
/** ORM-agnostic persistence. Refs are string ids; adapters may add real relations. */
|
|
83
125
|
export interface AgentStore {
|
|
84
126
|
createThread(input: CreateThreadInput): Promise<ThreadSummary>;
|
|
@@ -95,6 +137,17 @@ export interface AgentStore {
|
|
|
95
137
|
setTitle(threadId: string, title: string): Promise<void>;
|
|
96
138
|
setActiveStream(threadId: string, runId: string | null): Promise<void>;
|
|
97
139
|
appendMessage(input: AppendMessageInput): Promise<StoredMessage>;
|
|
140
|
+
/**
|
|
141
|
+
* Attach a turn's settled tool RESULTS to a message already appended, replacing whatever it held.
|
|
142
|
+
* A message's tool calls are known when it is written and their outputs are not, but a thread
|
|
143
|
+
* reader pairs the two off THAT MESSAGE — so an output that only ever reaches the tool-call table
|
|
144
|
+
* leaves every call on a reopened thread looking like a tool still running.
|
|
145
|
+
*
|
|
146
|
+
* Required rather than optional: a store that silently declines this renders a finished turn as a
|
|
147
|
+
* permanently in-flight one, with nothing logged and nothing to notice. A missing method should
|
|
148
|
+
* fail to compile instead.
|
|
149
|
+
*/
|
|
150
|
+
setMessageToolResults(messageId: string, results: ToolResult[]): Promise<void>;
|
|
98
151
|
truncateFrom(threadId: string, messageId: string): Promise<void>;
|
|
99
152
|
recordToolCall(input: RecordToolCallInput): Promise<void>;
|
|
100
153
|
updateToolCall(input: UpdateToolCallInput): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-store.d.ts","sourceRoot":"","sources":["../../../src/spi/agent-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,cAAc,EACd,UAAU,EACV,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;IAC9B,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,wGAAwG;IACxG,WAAW,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,YA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AAC,CAAC;IAE1D,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAE3E,2FAA2F;IAC3F,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtD,yGAAyG;IACzG,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* — that comes off the `aviary:agent:*` diagnostics channel. This interface is the durable, restart-
|
|
12
12
|
* surviving history.
|
|
13
13
|
*/
|
|
14
|
+
import type { CursorPage, CursorParams } from '../pagination.js';
|
|
14
15
|
/** Inclusive UTC day range, each `YYYY-MM-DD`. */
|
|
15
16
|
export interface GovernanceRange {
|
|
16
17
|
fromDay: string;
|
|
@@ -61,8 +62,13 @@ export interface ThreadActivityRow {
|
|
|
61
62
|
}
|
|
62
63
|
/** A run's lifecycle status as the read-model surfaces it. */
|
|
63
64
|
export type RunStatus = 'running' | 'completed' | 'failed' | 'cancelled';
|
|
64
|
-
/**
|
|
65
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Filters + cursor for {@link AgentGovernanceQueries.listRuns}. All optional; absent = no constraint.
|
|
67
|
+
*
|
|
68
|
+
* The pagination half is {@link CursorParams} — the ecosystem-wide `{ after, first }` shape mirroring
|
|
69
|
+
* `@adonis-agora/filter`'s `CursorParams`. Forward-only: no `before`/`last`.
|
|
70
|
+
*/
|
|
71
|
+
export interface ListRunsFilter extends CursorParams {
|
|
66
72
|
/** Exact `actor_ref`. */
|
|
67
73
|
actor?: string;
|
|
68
74
|
/** Exact `agent_name`. */
|
|
@@ -72,10 +78,13 @@ export interface ListRunsFilter {
|
|
|
72
78
|
from?: string;
|
|
73
79
|
/** Inclusive UTC-day upper bound on `started_at`, `YYYY-MM-DD`. */
|
|
74
80
|
to?: string;
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Opaque cursor from a prior page's {@link ListRunsResult.nextCursor}; omit for the first page.
|
|
83
|
+
* (Inherited from {@link CursorParams}, restated for the doc site.)
|
|
84
|
+
*/
|
|
85
|
+
after?: string;
|
|
86
|
+
/** Page size; defaults to 50, clamped to 200 by the adapter. (Inherited from {@link CursorParams}.) */
|
|
87
|
+
first?: number;
|
|
79
88
|
}
|
|
80
89
|
/** A run row for the governance list + detail. Newest-first in {@link ListRunsResult}. */
|
|
81
90
|
export interface RunSummaryRow {
|
|
@@ -86,6 +95,11 @@ export interface RunSummaryRow {
|
|
|
86
95
|
actorLabel?: string;
|
|
87
96
|
tenantRef: string | null;
|
|
88
97
|
agentName: string | null;
|
|
98
|
+
/**
|
|
99
|
+
* The run that delegated this one, or `null` for a turn a person started. Without it a delegation's
|
|
100
|
+
* spend reads as an orphan turn on every surface built over these rows.
|
|
101
|
+
*/
|
|
102
|
+
parentRunId: string | null;
|
|
89
103
|
status: string;
|
|
90
104
|
/** ISO timestamp. */
|
|
91
105
|
startedAt: string;
|
|
@@ -100,12 +114,14 @@ export interface RunSummaryRow {
|
|
|
100
114
|
error: string | null;
|
|
101
115
|
durable: boolean;
|
|
102
116
|
}
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
117
|
+
/**
|
|
118
|
+
* One page of {@link AgentGovernanceQueries.listRuns}, newest-first, with an opaque forward cursor.
|
|
119
|
+
*
|
|
120
|
+
* This is exactly {@link CursorPage} of {@link RunSummaryRow}: the rows are under `items` (not
|
|
121
|
+
* `runs`), `nextCursor` goes back as {@link ListRunsFilter.after}, and — the read-model being
|
|
122
|
+
* forward-only — `prevCursor` is always `null` and `hasPrev` always `false`.
|
|
123
|
+
*/
|
|
124
|
+
export type ListRunsResult = CursorPage<RunSummaryRow>;
|
|
109
125
|
/** A message belonging to a run, for {@link RunDetail}. */
|
|
110
126
|
export interface RunMessageRow {
|
|
111
127
|
id: string;
|
|
@@ -266,7 +282,11 @@ export interface AgentGovernanceQueries {
|
|
|
266
282
|
usageTrend(range: GovernanceRange): Promise<UsageTrendPoint[]>;
|
|
267
283
|
recentToolCalls(limit: number): Promise<ToolCallActivityRow[]>;
|
|
268
284
|
recentThreads(limit: number): Promise<ThreadActivityRow[]>;
|
|
269
|
-
/**
|
|
285
|
+
/**
|
|
286
|
+
* Filterable, cursor-paginated run list, newest-first. Pagination is the ecosystem's forward-only
|
|
287
|
+
* cursor interface: `{ after, first }` in, {@link CursorPage} out (`items` / `nextCursor`, with
|
|
288
|
+
* `prevCursor: null` and `hasPrev: false`).
|
|
289
|
+
*/
|
|
270
290
|
listRuns(filter?: ListRunsFilter): Promise<ListRunsResult>;
|
|
271
291
|
/** The full trace of one run (run + messages + tool calls + approvals + usage), or `null` if unknown. */
|
|
272
292
|
runDetail(runId: string): Promise<RunDetail | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governance-queries.d.ts","sourceRoot":"","sources":["../../../src/spi/governance-queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CA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,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3D,yGAAyG;IACzG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IACpD,2FAA2F;IAC3F,gBAAgB,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACjF,+FAA+F;IAC/F,YAAY,CAAC,KAAK,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAChE,2EAA2E;IAC3E,cAAc,CAAC,KAAK,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAChE;;;;OAIG;IACH,YAAY,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;CACzE"}
|
|
@@ -1,24 +1,78 @@
|
|
|
1
|
-
import type { Actor, ModelMessage } from '../types.js';
|
|
1
|
+
import type { Actor, MessageUsage, ModelMessage } from '../types.js';
|
|
2
2
|
/** What a {@link HistoryWindow} needs to know about the run it's compacting history for. */
|
|
3
3
|
export interface HistoryWindowContext {
|
|
4
4
|
actor: Actor;
|
|
5
5
|
threadId: string;
|
|
6
6
|
}
|
|
7
|
+
/** How a window split the thread: what rides into the turn, and what the ceiling left out. */
|
|
8
|
+
export interface HistorySelection {
|
|
9
|
+
/** Sent to the model, oldest-first. */
|
|
10
|
+
keep: ModelMessage[];
|
|
11
|
+
/** Left out, oldest-first. Folded into a leading summary when the window implements `summarize`. */
|
|
12
|
+
drop: ModelMessage[];
|
|
13
|
+
}
|
|
14
|
+
/** A stand-in for the messages a window left out, plus what producing it cost. */
|
|
15
|
+
export interface HistorySummary {
|
|
16
|
+
/** Prose the loop folds into the window as a leading `system` message. */
|
|
17
|
+
text: string;
|
|
18
|
+
/**
|
|
19
|
+
* What the summarizer spent, when it called a model. Recorded as a `summary` usage row, so a
|
|
20
|
+
* ceiling on context cost cannot itself become spend nothing accounts for — the quota sums the
|
|
21
|
+
* whole ledger without filtering purpose, so this also counts against the daily cap. Omit for a
|
|
22
|
+
* summarizer that calls no model (a rollup of tool names, a digest the app already stored).
|
|
23
|
+
*/
|
|
24
|
+
usage?: MessageUsage;
|
|
25
|
+
/** Accounting label for the model that produced it; falls back to `AgentLoopDeps.modelId`. */
|
|
26
|
+
modelId?: string;
|
|
27
|
+
}
|
|
7
28
|
/**
|
|
8
29
|
* Compaction seam for long-lived threads. The loop maps the ENTIRE persisted thread into
|
|
9
30
|
* `ModelMessage[]` before every turn (see `runAgentLoop` in `agent-loop.ts`); with no window
|
|
10
31
|
* configured that whole history rides every turn, so input tokens (cost + latency, and eventually
|
|
11
|
-
* the model's context limit) grow without bound as a thread accumulates messages.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* ships {@link import('../history-window.js').SlidingWindowHistory}) or a summarizing impl that
|
|
15
|
-
* calls a model to fold dropped messages into a synthetic recap message.
|
|
32
|
+
* the model's context limit) grow without bound as a thread accumulates messages. This package
|
|
33
|
+
* ships {@link import('../history-window.js').SlidingWindowHistory}; anything satisfying the seam
|
|
34
|
+
* works.
|
|
16
35
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* harmless for a pure truncator.
|
|
36
|
+
* The two halves run in deliberately different places, and that split is what lets a window exist
|
|
37
|
+
* without moving a single one of the loop's checkpoint positions — see each method.
|
|
20
38
|
*/
|
|
21
39
|
export interface HistoryWindow {
|
|
22
|
-
|
|
40
|
+
/**
|
|
41
|
+
* The most messages {@link select} can ever keep, where the ceiling can be stated as a row count.
|
|
42
|
+
*
|
|
43
|
+
* A hint the loop hands to the store, which then reads that many of the thread's newest rows
|
|
44
|
+
* rather than its whole transcript (see {@link import('./agent-store.js').ThreadTurnReader}).
|
|
45
|
+
* Declaring it is a PROMISE about `select`: that it keeps at most this many messages, and that
|
|
46
|
+
* they are the NEWEST ones — so a window of this size is indistinguishable, to `select`, from the
|
|
47
|
+
* full transcript. A window that can keep more than this, or something older than the newest
|
|
48
|
+
* `maxMessages`, must omit it rather than select over rows the store was never asked for.
|
|
49
|
+
*
|
|
50
|
+
* Omit where the ceiling is not a row count at all. Omitting costs only the bound on the READ; the
|
|
51
|
+
* prompt is identical either way.
|
|
52
|
+
*/
|
|
53
|
+
readonly maxMessages?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Decide what the model sees.
|
|
56
|
+
*
|
|
57
|
+
* MUST be a pure function of `messages`. The loop calls it OUTSIDE any checkpoint, which is safe
|
|
58
|
+
* only because its input already IS one (`load:thread`'s cached result), so a replay re-runs it
|
|
59
|
+
* over the same messages and reaches the same split. Read a clock, a feature flag or a database
|
|
60
|
+
* here and the resumed run windows differently from the one that suspended: the model gets a
|
|
61
|
+
* different prompt, and any step whose existence depends on the split lands at a position the
|
|
62
|
+
* history has no room for. Anything non-deterministic belongs in {@link summarize}.
|
|
63
|
+
*
|
|
64
|
+
* The newest message must always be in `keep` — dropping it leaves the turn with nothing to answer.
|
|
65
|
+
*/
|
|
66
|
+
select(messages: ModelMessage[], ctx: HistoryWindowContext): HistorySelection;
|
|
67
|
+
/**
|
|
68
|
+
* Fold the dropped messages into prose the model reads in their place, prepended to the window as
|
|
69
|
+
* a `system` message. Optional — without it, dropped messages are simply gone.
|
|
70
|
+
*
|
|
71
|
+
* Runs inside the loop's `history:summarize` checkpoint, so it may call a model or hit the
|
|
72
|
+
* network: the first attempt's result is journaled and every replay reads it back instead of
|
|
73
|
+
* re-summarizing (and instead of paying for it twice). It runs once per RUN, not per model step,
|
|
74
|
+
* and only when `select` actually dropped something.
|
|
75
|
+
*/
|
|
76
|
+
summarize?(dropped: ModelMessage[], ctx: HistoryWindowContext): Promise<HistorySummary>;
|
|
23
77
|
}
|
|
24
78
|
//# sourceMappingURL=history-window.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history-window.d.ts","sourceRoot":"","sources":["../../../src/spi/history-window.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"history-window.d.ts","sourceRoot":"","sources":["../../../src/spi/history-window.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAErE,4FAA4F;AAC5F,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,8FAA8F;AAC9F,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,oGAAoG;IACpG,IAAI,EAAE,YAAY,EAAE,CAAC;CACtB;AAED,kFAAkF;AAClF,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,GAAG,EAAE,oBAAoB,GAAG,gBAAgB,CAAC;IAC9E;;;;;;;;OAQG;IACH,SAAS,CAAC,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACzF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
1
2
|
import type { MessageUsage, ModelMessage, ToolCallRequest, ToolDefinition } from '../types.js';
|
|
2
3
|
import type { SinkWriter } from './token-stream-sink.js';
|
|
3
4
|
export interface ModelTurnArgs {
|
|
@@ -7,6 +8,16 @@ export interface ModelTurnArgs {
|
|
|
7
8
|
/** The model writes streamed text deltas here as it generates them. */
|
|
8
9
|
sink: SinkWriter;
|
|
9
10
|
abortSignal?: AbortSignal;
|
|
11
|
+
/**
|
|
12
|
+
* Constrain this call's reply to a schema. Set only by the loop's structured-output formatting
|
|
13
|
+
* pass, which is non-streamed and carries `tools: []` — most providers cannot serve a response
|
|
14
|
+
* format and a tool set in the same request.
|
|
15
|
+
*
|
|
16
|
+
* An adapter that can constrain generation should, and report what it parsed as
|
|
17
|
+
* {@link ModelTurnResult.object}. One that cannot may ignore it entirely: the loop validates the
|
|
18
|
+
* reply either way, reading the JSON out of the text when no `object` comes back.
|
|
19
|
+
*/
|
|
20
|
+
outputSchema?: StandardSchemaV1;
|
|
10
21
|
}
|
|
11
22
|
/** The outcome of ONE assistant turn. The loop — not the model — drives tool execution. */
|
|
12
23
|
export interface ModelTurnResult {
|
|
@@ -26,6 +37,13 @@ export interface ModelTurnResult {
|
|
|
26
37
|
* governance read-model uses it verbatim; otherwise it estimates from tokens × the pricing table.
|
|
27
38
|
*/
|
|
28
39
|
costUsd?: number;
|
|
40
|
+
/**
|
|
41
|
+
* What the provider parsed out of a reply it constrained to {@link ModelTurnArgs.outputSchema}.
|
|
42
|
+
* The loop VALIDATES it regardless — "the provider says it matched" is not the same claim as "it
|
|
43
|
+
* matches", and a provider that ignored the schema has to fail where the failure is repairable.
|
|
44
|
+
* Omit when the adapter did not constrain generation.
|
|
45
|
+
*/
|
|
46
|
+
object?: unknown;
|
|
29
47
|
}
|
|
30
48
|
/**
|
|
31
49
|
* Thin wrapper over the actual LLM. The concrete impl (e.g. Vercel AI SDK `streamText`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-provider.d.ts","sourceRoot":"","sources":["../../../src/spi/model-provider.ts"],"names":[],"mappings":"A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;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACxD"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two seams that see a turn's traffic to and from the model: an {@link InputProcessor} rewrites
|
|
3
|
+
* the prompt on its way out, an {@link OutputProcessor} inspects the answer on its way back and may
|
|
4
|
+
* redact, replace or refuse it. Wire them as `AgentLoopDeps.inputProcessors` / `outputProcessors`.
|
|
5
|
+
*
|
|
6
|
+
* WHAT THESE ARE NOT: a second way to decide what enters the context. {@link
|
|
7
|
+
* import('./history-window.js').HistoryWindow} owns SELECTION — which of the thread's messages ride
|
|
8
|
+
* into the turn, and what stands in for the rest. Processors run on whatever selection produced and
|
|
9
|
+
* own TRANSFORMATION — what those messages say. The distinction is load-bearing rather than
|
|
10
|
+
* stylistic: `select` is contractually pure and runs outside any checkpoint, while a processor is
|
|
11
|
+
* allowed to call a model, runs in a checkpoint of its own per step, and rewrites a DERIVED prompt
|
|
12
|
+
* that never becomes the thread's own memory of what was said.
|
|
13
|
+
*/
|
|
14
|
+
import type { Actor, ModelMessage, ToolCallRequest } from '../types.js';
|
|
15
|
+
/** Which turn, and which model step of it, a processor is looking at. */
|
|
16
|
+
export interface ProcessorContext {
|
|
17
|
+
threadId: string;
|
|
18
|
+
actor: Actor;
|
|
19
|
+
/** The agent running this turn. Undefined → the default/single agent. */
|
|
20
|
+
agentName?: string;
|
|
21
|
+
/** The persona the request selected, when it selected one. */
|
|
22
|
+
persona?: string;
|
|
23
|
+
/** 0-based model step within the run — the same index the `llm:<step>` checkpoint carries. */
|
|
24
|
+
step: number;
|
|
25
|
+
}
|
|
26
|
+
/** Everything the model is about to be sent, as the previous processor in the chain left it. */
|
|
27
|
+
export interface ProcessedPrompt {
|
|
28
|
+
/** The composed system prompt (agent base + persona + any injected retrieval block). */
|
|
29
|
+
system: string;
|
|
30
|
+
/** The turn's messages, oldest-first, already through the history ceiling. */
|
|
31
|
+
messages: ModelMessage[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Rewrites the prompt before each model call of a turn — masking identifiers, stamping a policy
|
|
35
|
+
* preamble, collapsing an oversized tool result. Runs on EVERY step, not once per run, because the
|
|
36
|
+
* transcript grows between steps: a redactor that only saw the opening prompt would wave through
|
|
37
|
+
* whatever a tool result carried back.
|
|
38
|
+
*
|
|
39
|
+
* Runs inside the loop's `process:input:<step>` checkpoint and its result is journaled, so a
|
|
40
|
+
* processor may call a model or hit the network — a resumed run reads back the prompt the suspended
|
|
41
|
+
* attempt built rather than composing a different one.
|
|
42
|
+
*/
|
|
43
|
+
export interface InputProcessor {
|
|
44
|
+
/** Identifies this processor in a failure. Keep it stable — it is user-visible on an error. */
|
|
45
|
+
readonly name: string;
|
|
46
|
+
process(prompt: ProcessedPrompt, ctx: ProcessorContext): ProcessedPrompt | Promise<ProcessedPrompt>;
|
|
47
|
+
}
|
|
48
|
+
/** One model step's answer, as the previous processor in the chain left it. */
|
|
49
|
+
export interface ModelAnswer {
|
|
50
|
+
/** The assembled assistant text for this step. */
|
|
51
|
+
text: string;
|
|
52
|
+
/**
|
|
53
|
+
* The tool calls the same step asked for. Read-only context — a processor cannot change them.
|
|
54
|
+
* A provider reports its calls when `runTurn` RETURNS, so on the incremental path (where the chain
|
|
55
|
+
* rules on a prefix while the call is still streaming) this is empty until the authoritative
|
|
56
|
+
* whole-answer pass, which always sees them.
|
|
57
|
+
*/
|
|
58
|
+
toolCalls: readonly ToolCallRequest[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* What an {@link OutputProcessor} decided. `pass` hands the text to the next processor unchanged;
|
|
62
|
+
* `replace` hands it on rewritten (a redaction is a replacement); `reject` ends the chain AND the
|
|
63
|
+
* run — the text is never streamed, never persisted, and the caller gets an
|
|
64
|
+
* {@link OutputRejectedError} rather than an answer.
|
|
65
|
+
*/
|
|
66
|
+
export type OutputVerdict = {
|
|
67
|
+
action: 'pass';
|
|
68
|
+
} | {
|
|
69
|
+
action: 'replace';
|
|
70
|
+
text: string;
|
|
71
|
+
} | {
|
|
72
|
+
action: 'reject';
|
|
73
|
+
reason: string;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Characters an incremental gate keeps holding at the end of the transformed answer, when a
|
|
77
|
+
* processor declares {@link IncrementalGating} without naming its own window. Wide enough for the
|
|
78
|
+
* patterns a redactor is usually written against — an SSN, an email address, a card number — and
|
|
79
|
+
* deliberately not wider: the window IS the answer's minimum latency tail, since those characters
|
|
80
|
+
* are only released once the whole-answer pass runs.
|
|
81
|
+
*/
|
|
82
|
+
export declare const DEFAULT_INCREMENTAL_LOOKBACK_CHARS = 64;
|
|
83
|
+
/**
|
|
84
|
+
* A processor's statement that its verdict on a PREFIX of an answer is worth acting on, which is
|
|
85
|
+
* what lets the loop release that prefix to the reader instead of holding the whole answer.
|
|
86
|
+
*
|
|
87
|
+
* Declaring it is a promise about every prefix `P` of the final answer, and the loop takes it at
|
|
88
|
+
* face value on the streaming path:
|
|
89
|
+
*
|
|
90
|
+
* 1. REJECTION IS PREFIX-DECIDABLE. The refusal this processor would return for the whole answer is
|
|
91
|
+
* already returned for the first prefix that contains the reason. A refusal that only emerges
|
|
92
|
+
* from the complete answer still fails the run, but by then the reader has seen a prefix — there
|
|
93
|
+
* is no un-sending frames, and that is the cost of opting in.
|
|
94
|
+
* 2. REPLACEMENT IS PREFIX-STABLE UP TO THE WINDOW. Once a character of `process(P)`'s output is
|
|
95
|
+
* more than {@link IncrementalGating.lookbackChars} from the end of that output, it never changes
|
|
96
|
+
* as `P` grows.
|
|
97
|
+
*
|
|
98
|
+
* A broken second promise is caught, not tolerated: the whole-answer pass stays authoritative, and
|
|
99
|
+
* the loop raises a {@link ProcessorFailedError} when its result is not an extension of what the
|
|
100
|
+
* chain already released. So a window too short for a pattern fails loudly rather than streaming the
|
|
101
|
+
* text it was supposed to redact.
|
|
102
|
+
*/
|
|
103
|
+
export interface IncrementalGating {
|
|
104
|
+
/**
|
|
105
|
+
* How many characters of this processor's own output stay held back. Undefined →
|
|
106
|
+
* {@link DEFAULT_INCREMENTAL_LOOKBACK_CHARS}. Set it to the length of the longest pattern the
|
|
107
|
+
* processor can act on — anything shorter is a run that fails on the pattern it was written for.
|
|
108
|
+
*/
|
|
109
|
+
readonly lookbackChars?: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Inspects each model step's answer before anything downstream sees it — before it reaches the live
|
|
113
|
+
* stream, before it is persisted, before it becomes the next step's context.
|
|
114
|
+
*
|
|
115
|
+
* Gating an answer and streaming it as it is generated are mutually exclusive, so registering ANY
|
|
116
|
+
* output processor switches the turn's model call off the run's sink: nothing reaches the subscriber
|
|
117
|
+
* until this chain has ruled on it. How much of that costs the reader is what
|
|
118
|
+
* {@link OutputProcessor.incremental} decides.
|
|
119
|
+
*
|
|
120
|
+
* Runs inside the loop's `process:output:<step>` checkpoint (which also performs the release), so a
|
|
121
|
+
* processor may call a model — a moderation pass is the motivating case — and a replay reads the
|
|
122
|
+
* verdict back instead of re-deciding it.
|
|
123
|
+
*/
|
|
124
|
+
export interface OutputProcessor {
|
|
125
|
+
/** Identifies this processor in a rejection or a failure. User-visible; keep it stable. */
|
|
126
|
+
readonly name: string;
|
|
127
|
+
/**
|
|
128
|
+
* Opt this processor into gating a PREFIX, so the turn keeps streaming — see
|
|
129
|
+
* {@link IncrementalGating} for what declaring it promises. Undefined means the whole answer,
|
|
130
|
+
* which is what a processor written against the complete text needs and therefore the only safe
|
|
131
|
+
* default; a chain is incremental only when EVERY member of it declares this, so a neighbour can
|
|
132
|
+
* never downgrade what another author was given.
|
|
133
|
+
*/
|
|
134
|
+
readonly incremental?: IncrementalGating;
|
|
135
|
+
process(answer: ModelAnswer, ctx: ProcessorContext): OutputVerdict | Promise<OutputVerdict>;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The run ended because an output processor refused the answer — NOT because the model failed. The
|
|
139
|
+
* two must stay distinguishable: a model failure is worth retrying and worth paging someone about, a
|
|
140
|
+
* refusal is the control doing its job.
|
|
141
|
+
*/
|
|
142
|
+
export declare class OutputRejectedError extends Error {
|
|
143
|
+
/** {@link OutputProcessor.name} of the processor that refused. */
|
|
144
|
+
readonly processor: string;
|
|
145
|
+
/** The reason it gave, verbatim. */
|
|
146
|
+
readonly reason: string;
|
|
147
|
+
constructor(processor: string, reason: string);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* A processor threw. Wrapped so it can never be mistaken for the model call failing — the loop's
|
|
151
|
+
* only other source of failure at that point in the turn — and so the failure names the processor
|
|
152
|
+
* that produced it instead of surfacing a bare `TypeError` from someone else's code.
|
|
153
|
+
*/
|
|
154
|
+
export declare class ProcessorFailedError extends Error {
|
|
155
|
+
/** Which seam it was on, so a reader knows whether the prompt or the answer was in flight. */
|
|
156
|
+
readonly phase: 'input' | 'output';
|
|
157
|
+
/** The processor's `name`. */
|
|
158
|
+
readonly processor: string;
|
|
159
|
+
constructor(phase: 'input' | 'output', processor: string, cause: unknown);
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=processors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processors.d.ts","sourceRoot":"","sources":["../../../src/spi/processors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAExE,yEAAyE;AACzE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8FAA8F;IAC9F,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gGAAgG;AAChG,MAAM,WAAW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KAAK;IAC5C,kEAAkE;IAClE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oCAAoC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,YAAY,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAK5C;CACF;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,8FAA8F;IAC9F,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC;IACnC,8BAA8B;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,YAAY,KAAK,EAAE,OAAO,GAAG,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAQvE;CACF"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two seams that see a turn's traffic to and from the model: an {@link InputProcessor} rewrites
|
|
3
|
+
* the prompt on its way out, an {@link OutputProcessor} inspects the answer on its way back and may
|
|
4
|
+
* redact, replace or refuse it. Wire them as `AgentLoopDeps.inputProcessors` / `outputProcessors`.
|
|
5
|
+
*
|
|
6
|
+
* WHAT THESE ARE NOT: a second way to decide what enters the context. {@link
|
|
7
|
+
* import('./history-window.js').HistoryWindow} owns SELECTION — which of the thread's messages ride
|
|
8
|
+
* into the turn, and what stands in for the rest. Processors run on whatever selection produced and
|
|
9
|
+
* own TRANSFORMATION — what those messages say. The distinction is load-bearing rather than
|
|
10
|
+
* stylistic: `select` is contractually pure and runs outside any checkpoint, while a processor is
|
|
11
|
+
* allowed to call a model, runs in a checkpoint of its own per step, and rewrites a DERIVED prompt
|
|
12
|
+
* that never becomes the thread's own memory of what was said.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Characters an incremental gate keeps holding at the end of the transformed answer, when a
|
|
16
|
+
* processor declares {@link IncrementalGating} without naming its own window. Wide enough for the
|
|
17
|
+
* patterns a redactor is usually written against — an SSN, an email address, a card number — and
|
|
18
|
+
* deliberately not wider: the window IS the answer's minimum latency tail, since those characters
|
|
19
|
+
* are only released once the whole-answer pass runs.
|
|
20
|
+
*/
|
|
21
|
+
export const DEFAULT_INCREMENTAL_LOOKBACK_CHARS = 64;
|
|
22
|
+
/**
|
|
23
|
+
* The run ended because an output processor refused the answer — NOT because the model failed. The
|
|
24
|
+
* two must stay distinguishable: a model failure is worth retrying and worth paging someone about, a
|
|
25
|
+
* refusal is the control doing its job.
|
|
26
|
+
*/
|
|
27
|
+
export class OutputRejectedError extends Error {
|
|
28
|
+
/** {@link OutputProcessor.name} of the processor that refused. */
|
|
29
|
+
processor;
|
|
30
|
+
/** The reason it gave, verbatim. */
|
|
31
|
+
reason;
|
|
32
|
+
constructor(processor, reason) {
|
|
33
|
+
super(`Output rejected by "${processor}": ${reason}`);
|
|
34
|
+
this.name = 'OutputRejectedError';
|
|
35
|
+
this.processor = processor;
|
|
36
|
+
this.reason = reason;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A processor threw. Wrapped so it can never be mistaken for the model call failing — the loop's
|
|
41
|
+
* only other source of failure at that point in the turn — and so the failure names the processor
|
|
42
|
+
* that produced it instead of surfacing a bare `TypeError` from someone else's code.
|
|
43
|
+
*/
|
|
44
|
+
export class ProcessorFailedError extends Error {
|
|
45
|
+
/** Which seam it was on, so a reader knows whether the prompt or the answer was in flight. */
|
|
46
|
+
phase;
|
|
47
|
+
/** The processor's `name`. */
|
|
48
|
+
processor;
|
|
49
|
+
constructor(phase, processor, cause) {
|
|
50
|
+
super(`${phase} processor "${processor}" failed: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
51
|
+
this.name = 'ProcessorFailedError';
|
|
52
|
+
this.phase = phase;
|
|
53
|
+
this.processor = processor;
|
|
54
|
+
this.cause = cause;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=processors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processors.js","sourceRoot":"","sources":["../../../src/spi/processors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAmEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,CAAC;AA0DrD;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,kEAAkE;IACzD,SAAS,CAAS;IAC3B,oCAAoC;IAC3B,MAAM,CAAS;IAExB,YAAY,SAAiB,EAAE,MAAc;QAC3C,KAAK,CAAC,uBAAuB,SAAS,MAAM,MAAM,EAAE,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,8FAA8F;IACrF,KAAK,CAAqB;IACnC,8BAA8B;IACrB,SAAS,CAAS;IAE3B,YAAY,KAAyB,EAAE,SAAiB,EAAE,KAAc;QACtE,KAAK,CACH,GAAG,KAAK,eAAe,SAAS,aAAa,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACtG,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ElicitationRequest } from '../elicitation.js';
|
|
1
2
|
/**
|
|
2
3
|
* The "data plane": live token transport, decoupled from the durable control plane.
|
|
3
4
|
*
|
|
@@ -13,6 +14,38 @@ export type StreamFrame = {
|
|
|
13
14
|
t: 'component';
|
|
14
15
|
name: string;
|
|
15
16
|
data: unknown;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A question set the run is now parked on. Carries the whole request, so a client renders the form
|
|
20
|
+
* — and knows the total ("Question 1 of 3") — without a second fetch. Identical whether a
|
|
21
|
+
* configured intake or the model's `ask` authored it.
|
|
22
|
+
*
|
|
23
|
+
* `runId` is the run that is PARKED, which is not always the stream this frame arrived on: a
|
|
24
|
+
* delegated sub-agent forwards its frames into its top-level ancestor's stream so the human can
|
|
25
|
+
* see them, and answering it means addressing the CHILD's run. Without the id on the frame a
|
|
26
|
+
* watcher has the form and no way to reply to it.
|
|
27
|
+
*/
|
|
28
|
+
| {
|
|
29
|
+
t: 'elicitation';
|
|
30
|
+
runId: string;
|
|
31
|
+
id: string;
|
|
32
|
+
request: ElicitationRequest;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* An `action` tool call the run is now parked on, waiting for an approve/reject. Carries the tool
|
|
36
|
+
* and the arguments it was asked to run with, so a watcher can decide without a second fetch.
|
|
37
|
+
*
|
|
38
|
+
* `runId`, like the elicitation frame's, is the run that is PARKED rather than the stream this
|
|
39
|
+
* arrived on: a delegated sub-agent's action suspends its OWN run, and forwarding the frame into
|
|
40
|
+
* the ancestor's stream is the only way a human sees it — so the id has to ride along, or the
|
|
41
|
+
* watcher can see the approval and not make it.
|
|
42
|
+
*/
|
|
43
|
+
| {
|
|
44
|
+
t: 'approval';
|
|
45
|
+
runId: string;
|
|
46
|
+
id: string;
|
|
47
|
+
toolName: string;
|
|
48
|
+
input: unknown;
|
|
16
49
|
};
|
|
17
50
|
export interface SinkWriter {
|
|
18
51
|
write(frame: StreamFrame): void | Promise<void>;
|
|
@@ -27,4 +60,14 @@ export interface TokenStreamSink {
|
|
|
27
60
|
/** Drop any buffer/resources for the run. */
|
|
28
61
|
close(runId: string): void | Promise<void>;
|
|
29
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Wrap a {@link SinkWriter} so a DELEGATED run forwards its frames into its top-level ancestor's
|
|
65
|
+
* stream but never closes it.
|
|
66
|
+
*
|
|
67
|
+
* Forwarding is what makes a sub-agent visible at all: its own runId is not a stream anyone
|
|
68
|
+
* subscribed to, so a question set it parks on would otherwise be written where nobody reads it.
|
|
69
|
+
* The ancestor owns the stream's lifecycle across however many delegations it spans, so the child's
|
|
70
|
+
* `end()` is a no-op — ending the shared stream mid-parent-run would cut the human off.
|
|
71
|
+
*/
|
|
72
|
+
export declare function childSinkWriter(inner: SinkWriter): SinkWriter;
|
|
30
73
|
//# sourceMappingURL=token-stream-sink.d.ts.map
|