@adonis-agora/agent 0.31.0 → 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 +752 -0
- package/dist/providers/agent_provider.d.ts.map +1 -1
- package/dist/providers/agent_provider.js +140 -2
- 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 +9 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -2
- 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/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/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 +5 -0
- 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.map +1 -1
- package/dist/src/stores/lucid-governance-queries.js +3 -0
- 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/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 +1 -0
- 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 +18 -8
- package/skills/agent-personas-agents/SKILL.md +16 -12
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skills: an authored procedure the model pulls in when a task calls for it, instead of every
|
|
3
|
+
* instruction living in the system prompt.
|
|
4
|
+
*
|
|
5
|
+
* WHAT A SKILL IS NOT: an agent. An agent is WHO is answering — its persona, its tools, its history
|
|
6
|
+
* window, its output schema. A skill is HOW one particular task is done, and any agent may pull one
|
|
7
|
+
* in. That is why a skill carries no model, no tool list and no schema: the moment it did, the two
|
|
8
|
+
* would be the same thing wearing different names, and a consumer would have to choose between them
|
|
9
|
+
* for reasons nobody could state.
|
|
10
|
+
*
|
|
11
|
+
* WHAT IT COSTS THE PROMPT: one line per skill. The catalog block below carries names, scopes and
|
|
12
|
+
* descriptions only; a BODY reaches the model as a tool result, on the transcript, where the
|
|
13
|
+
* `HistoryWindow` ceiling already governs it. So skills are not a fourth thing competing for the
|
|
14
|
+
* system block with the agent's own prompt, its persona and injected retrieval — see
|
|
15
|
+
* `AgentLoopDeps.skills` for how they compose.
|
|
16
|
+
*/
|
|
17
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
18
|
+
import type { Actor, PageContext, ToolDefinition } from './types.js';
|
|
19
|
+
/** How a skill is identified in the catalog, to the model and to a `/`-autocomplete alike. */
|
|
20
|
+
export interface SkillSummary {
|
|
21
|
+
/** Unique within a scope. The handle the model passes to the `skill` tool. */
|
|
22
|
+
name: string;
|
|
23
|
+
/** One line: what task this covers, and therefore when to load it. Read by the MODEL to choose. */
|
|
24
|
+
description: string;
|
|
25
|
+
/** The opaque scope token this skill is published at — see {@link ScopeResolver}. */
|
|
26
|
+
scope: string;
|
|
27
|
+
}
|
|
28
|
+
/** A skill with the instructions themselves. Only ever materialized when something loads it. */
|
|
29
|
+
export interface Skill extends SkillSummary {
|
|
30
|
+
body: string;
|
|
31
|
+
}
|
|
32
|
+
/** Whose turn is asking, and therefore which scopes apply. */
|
|
33
|
+
export interface ScopeContext {
|
|
34
|
+
actor: Actor;
|
|
35
|
+
threadId: string;
|
|
36
|
+
/** The agent running this turn. Undefined → the default agent. */
|
|
37
|
+
agentName?: string;
|
|
38
|
+
pageContext?: PageContext;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The skills-facing name for {@link ScopeContext}, so a `SkillProvider`'s signature reads in its own
|
|
42
|
+
* vocabulary. Deliberately the SAME type rather than a parallel one: skills and memory resolve
|
|
43
|
+
* scopes through one {@link ScopeResolver}, and a deployment that could answer "which scopes does
|
|
44
|
+
* this actor have" twice would eventually answer it differently.
|
|
45
|
+
*/
|
|
46
|
+
export type SkillContext = ScopeContext;
|
|
47
|
+
/** The scope token every deployment has: skills nobody narrowed. */
|
|
48
|
+
export declare const GLOBAL_SCOPE = "global";
|
|
49
|
+
/** The token for one actor's own skills. */
|
|
50
|
+
export declare function actorScope(actor: Actor): string;
|
|
51
|
+
/** The token for a tenant's skills — `Actor.tenantRef` is the only tenant key this library knows. */
|
|
52
|
+
export declare function tenantScope(tenantRef: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Which scopes a turn may draw from, MOST SPECIFIC FIRST. Precedence is the order: an entry from an
|
|
55
|
+
* earlier token outranks a same-named one from a later token, and the model is shown which won.
|
|
56
|
+
*
|
|
57
|
+
* A HOST-SUPPLIED FUNCTION rather than an enum this library owns, because the axes a deployment
|
|
58
|
+
* scopes by are the deployment's own. `Actor` gives an id and a tenant; it does not give a sector, a
|
|
59
|
+
* squadron, a base, a shift — and every one of those is a real axis in some consumer. An enum here
|
|
60
|
+
* would make each of them a schema change in a library that has no business knowing they exist,
|
|
61
|
+
* while a token is a string a host mints for itself. Return `['sector:logistics', 'tenant:base-7',
|
|
62
|
+
* 'global']` and precedence follows, with nothing in this package edited.
|
|
63
|
+
*
|
|
64
|
+
* MUST be a pure function of its context. It runs inside the `skills:catalog` / `memory:digest`
|
|
65
|
+
* checkpoint and its result is journaled, so a resumed run reads back the scopes the first attempt
|
|
66
|
+
* resolved rather than asking a membership table that may have changed since — which would let a
|
|
67
|
+
* run's prompt differ from the one its journal records. Read a database here at your peril; read it
|
|
68
|
+
* in the provider, whose answer is journaled at the same position.
|
|
69
|
+
*/
|
|
70
|
+
export interface ScopeResolver {
|
|
71
|
+
resolve(ctx: ScopeContext): string[] | Promise<string[]>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The scopes derivable from an {@link Actor} alone — the common case, so a consumer wiring skills
|
|
75
|
+
* for the first time supplies no resolver at all: the actor's own, their tenant's (when they have
|
|
76
|
+
* one), and the deployment's. A host adding an axis of its own replaces this rather than extending
|
|
77
|
+
* it, since the ORDER is the precedence and only the host knows where its axis belongs.
|
|
78
|
+
*/
|
|
79
|
+
export declare const defaultScopeResolver: ScopeResolver;
|
|
80
|
+
/** Arguments to {@link SkillProvider.list}. */
|
|
81
|
+
export interface ListSkillsInput {
|
|
82
|
+
scopes: readonly string[];
|
|
83
|
+
ctx: SkillContext;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Arguments to {@link SkillProvider.load}. An object rather than positional arguments because `name`
|
|
87
|
+
* and `scope` are both strings: transposed, a positional call compiles clean, returns `null`, and
|
|
88
|
+
* the skill silently fails to load.
|
|
89
|
+
*/
|
|
90
|
+
export interface LoadSkillInput {
|
|
91
|
+
name: string;
|
|
92
|
+
scope: string;
|
|
93
|
+
ctx: SkillContext;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Where skills come from. Deliberately two calls rather than one: `list` is asked on EVERY turn and
|
|
97
|
+
* must stay cheap, while a body is read only when the model decides it needs that procedure — the
|
|
98
|
+
* whole point of the surface. A provider over a table selects name/description/scope for the first
|
|
99
|
+
* and one row for the second.
|
|
100
|
+
*
|
|
101
|
+
* This library owns no skill table. A skill's real scoping axes, its authoring UI and its audit
|
|
102
|
+
* trail are all the host's, and a host that related its own entity into a table this package created
|
|
103
|
+
* at boot would be writing migrations against a schema the boot-time heal also edits. Tokens split
|
|
104
|
+
* it the other way round: the library owns the contract (what a scope means, how precedence works,
|
|
105
|
+
* what is journaled), the host owns the rows.
|
|
106
|
+
*/
|
|
107
|
+
export interface SkillProvider {
|
|
108
|
+
/**
|
|
109
|
+
* Every skill visible at `scopes`, in any order — this library sorts and resolves precedence. A
|
|
110
|
+
* provider MAY return skills outside `scopes`; they are dropped rather than trusted, so a filter
|
|
111
|
+
* bug in a host cannot widen what an actor is offered.
|
|
112
|
+
*/
|
|
113
|
+
list(input: ListSkillsInput): SkillSummary[] | Promise<SkillSummary[]>;
|
|
114
|
+
/**
|
|
115
|
+
* The instructions for one skill, or `null` when it is gone. Called only from inside the loading
|
|
116
|
+
* checkpoint, so the body it returns is journaled and every replay reads THAT text back — an
|
|
117
|
+
* edited skill never rewrites the prompt of a run already in flight.
|
|
118
|
+
*/
|
|
119
|
+
load(input: LoadSkillInput): string | null | Promise<string | null>;
|
|
120
|
+
}
|
|
121
|
+
/** A source of skills that is a fixed list — module config, or a host's own constant. */
|
|
122
|
+
export declare function staticSkillProvider(skills: readonly Skill[]): SkillProvider;
|
|
123
|
+
/**
|
|
124
|
+
* Read several sources as one. The order is the tie-break and nothing else: precedence between
|
|
125
|
+
* skills is by SCOPE, so two sources only ever compete when they publish the same name at the same
|
|
126
|
+
* scope, and then the earlier source wins. Wire the host's own provider first — a row it can edit is
|
|
127
|
+
* a better answer than a body that needs a deploy to change.
|
|
128
|
+
*/
|
|
129
|
+
export declare function compositeSkillProvider(providers: readonly SkillProvider[]): SkillProvider;
|
|
130
|
+
/**
|
|
131
|
+
* One skill as it is offered — to the model in the catalog block, and to a client listing what a
|
|
132
|
+
* user may type after a `/`. Both read the same list, built by the same call, so what a user can
|
|
133
|
+
* reach and what the model can reach cannot drift apart.
|
|
134
|
+
*/
|
|
135
|
+
export interface SkillCatalogEntry {
|
|
136
|
+
name: string;
|
|
137
|
+
description: string;
|
|
138
|
+
/** The scope token it resolved from — the provenance a user is entitled to see. */
|
|
139
|
+
scope: string;
|
|
140
|
+
/**
|
|
141
|
+
* Scope tokens of same-named skills this one outranks, widest last. Present ONLY when something
|
|
142
|
+
* was shadowed, so a reader can tell "there is no org default" from "there is one and yours wins".
|
|
143
|
+
* The model is shown it for the same reason: a silent override is indistinguishable from an
|
|
144
|
+
* instruction nobody wrote, and the user can only be told "your setting differs from the org
|
|
145
|
+
* default" by something that knows both existed.
|
|
146
|
+
*/
|
|
147
|
+
shadows?: string[];
|
|
148
|
+
}
|
|
149
|
+
/** What a turn resolved — journaled whole, so the prompt is reconstructible from the journal alone. */
|
|
150
|
+
export interface SkillOffer {
|
|
151
|
+
/** The scope tokens this turn drew from, most specific first. */
|
|
152
|
+
scopes: string[];
|
|
153
|
+
/** The skills offered, most specific first then by name. */
|
|
154
|
+
entries: SkillCatalogEntry[];
|
|
155
|
+
/** Applicable skills `maxSkills` left out. Non-zero means the catalog is not the whole truth. */
|
|
156
|
+
omitted: number;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* How many skills a catalog offers before it starts leaving some out. A ceiling on the SYSTEM
|
|
160
|
+
* PROMPT's share, not on how many a deployment may have: the block costs one line each, and a
|
|
161
|
+
* hundred lines of "here is something you could load" crowds out the agent's own instructions while
|
|
162
|
+
* making the choice harder rather than easier.
|
|
163
|
+
*/
|
|
164
|
+
export declare const DEFAULT_MAX_SKILLS = 20;
|
|
165
|
+
/** How a turn reaches its skills. See `AgentLoopDeps.skills`. */
|
|
166
|
+
export interface SkillsConfig {
|
|
167
|
+
provider: SkillProvider;
|
|
168
|
+
/** Undefined → {@link defaultScopeResolver}: the actor's own, their tenant's, the deployment's. */
|
|
169
|
+
scopes?: ScopeResolver;
|
|
170
|
+
/** Undefined → {@link DEFAULT_MAX_SKILLS}. */
|
|
171
|
+
maxSkills?: number;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Resolve a provider's skills against an ordered scope list: most specific wins, and the loser's
|
|
175
|
+
* scope is recorded rather than discarded.
|
|
176
|
+
*
|
|
177
|
+
* Pure, and separately exported, because two callers must reach the identical answer — the loop, so
|
|
178
|
+
* the model is offered it, and the listing endpoint, so a user is. A second implementation of "which
|
|
179
|
+
* skills apply" is a second answer, and the two diverge the first time either is edited.
|
|
180
|
+
*/
|
|
181
|
+
export declare function resolveSkillCatalog(summaries: readonly SkillSummary[], scopes: readonly string[], maxSkills?: number): Omit<SkillOffer, 'scopes'>;
|
|
182
|
+
/** Resolve the scopes and the catalog for one turn. Called INSIDE the loop's `skills:catalog` step. */
|
|
183
|
+
export declare function offerSkills(config: SkillsConfig, ctx: SkillContext): Promise<SkillOffer>;
|
|
184
|
+
/** The reserved name of the built-in skill-loading tool. */
|
|
185
|
+
export declare const SKILL_TOOL_NAME = "skill";
|
|
186
|
+
/**
|
|
187
|
+
* The catalog as the model reads it. One line per skill — name, scope, description, and what it
|
|
188
|
+
* overrides — because the entire claim of progressive disclosure is that choosing what to read costs
|
|
189
|
+
* far less than reading everything.
|
|
190
|
+
*/
|
|
191
|
+
export declare function buildSkillsBlock(entries: readonly SkillCatalogEntry[]): string;
|
|
192
|
+
/** What the model passes to the `skill` tool. */
|
|
193
|
+
export interface SkillToolInput {
|
|
194
|
+
name: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* The `skill` tool's input schema. Hand-written for the same reason `askInputSchema` is: this
|
|
198
|
+
* package depends on no validator, and the schema has to publish a JSON Schema a provider can
|
|
199
|
+
* constrain generation against.
|
|
200
|
+
*
|
|
201
|
+
* The available names are deliberately NOT an enum here. A per-turn enum would make the tool's
|
|
202
|
+
* definition depend on the catalog, and a tool list re-derived by whichever process serves a turn is
|
|
203
|
+
* exactly the process-local lookup this design keeps off a turn's decisions. The names live in the
|
|
204
|
+
* prompt, where the journal holds them; a name that is not in the catalog comes back as an ordinary
|
|
205
|
+
* tool failure listing the ones that are.
|
|
206
|
+
*/
|
|
207
|
+
export declare const skillInputSchema: StandardSchemaV1<unknown, SkillToolInput>;
|
|
208
|
+
export declare const SKILL_TOOL_DESCRIPTION = "Read one of the procedures listed in <skills>. Call it before doing a task a listed skill covers, and follow what it returns. It performs nothing and changes nothing \u2014 it only gives you instructions you do not yet have.";
|
|
209
|
+
/**
|
|
210
|
+
* The `skill` tool as the model sees it. NOT a `ToolSpec` and never registered, exactly like `ask`:
|
|
211
|
+
* it has no handler, because the loop serves it from the catalog the journal holds. Keeping it out
|
|
212
|
+
* of the `ToolRegistry` is also what keeps its kind off a process-local lookup — see
|
|
213
|
+
* `claimToolCall`.
|
|
214
|
+
*/
|
|
215
|
+
export declare function skillToolDefinition(): ToolDefinition;
|
|
216
|
+
/** What a `skill` call resolved to — the body, or why it did not. */
|
|
217
|
+
export type SkillLoadOutcome = {
|
|
218
|
+
ok: true;
|
|
219
|
+
skill: Skill;
|
|
220
|
+
shadows?: string[];
|
|
221
|
+
} | {
|
|
222
|
+
ok: false;
|
|
223
|
+
error: string;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Serve one `skill` call against the catalog THIS TURN was offered.
|
|
227
|
+
*
|
|
228
|
+
* The catalog is the authorization boundary, not just a menu: a name the turn was never offered is
|
|
229
|
+
* refused here, so a model that invents one (or repeats one it saw in another actor's thread) cannot
|
|
230
|
+
* reach a body through a provider that would happily serve it. Because the catalog came out of the
|
|
231
|
+
* `skills:catalog` checkpoint, that boundary is the one the journal records rather than the one this
|
|
232
|
+
* process's provider currently believes in.
|
|
233
|
+
*/
|
|
234
|
+
export declare function loadSkill(args: {
|
|
235
|
+
config: SkillsConfig;
|
|
236
|
+
offer: SkillOffer;
|
|
237
|
+
name: string;
|
|
238
|
+
ctx: SkillContext;
|
|
239
|
+
}): Promise<SkillLoadOutcome>;
|
|
240
|
+
/** Who is trying to write a skill. */
|
|
241
|
+
export interface SkillAuthor {
|
|
242
|
+
/**
|
|
243
|
+
* `'human'` is a person acting through a UI; `'agent'` is anything else — a tool, a turn, a batch
|
|
244
|
+
* job. The distinction is the whole of the rule below, so it is not inferable and has to be stated
|
|
245
|
+
* by the caller.
|
|
246
|
+
*/
|
|
247
|
+
kind: 'human' | 'agent';
|
|
248
|
+
actorRef?: string;
|
|
249
|
+
}
|
|
250
|
+
/** A request to author a skill at a scope. */
|
|
251
|
+
export interface SkillWriteRequest {
|
|
252
|
+
/** The scope token the skill would be published at. */
|
|
253
|
+
scope: string;
|
|
254
|
+
actor: Actor;
|
|
255
|
+
/** The actor's resolved scopes, most specific first — the same list a turn draws from. */
|
|
256
|
+
scopes: readonly string[];
|
|
257
|
+
author: SkillAuthor;
|
|
258
|
+
/**
|
|
259
|
+
* The host's own answer to "may this person administer that scope" — a sector lead editing their
|
|
260
|
+
* sector's skills, an operator editing the deployment's. This library cannot know it: it has no
|
|
261
|
+
* notion of who administers `sector:logistics`, and inventing one would be a second, weaker
|
|
262
|
+
* authorization model next to the host's real one. Undefined/false → a wider scope is refused.
|
|
263
|
+
*/
|
|
264
|
+
elevated?: boolean;
|
|
265
|
+
}
|
|
266
|
+
export type SkillWriteVerdict = {
|
|
267
|
+
allowed: true;
|
|
268
|
+
} | {
|
|
269
|
+
allowed: false;
|
|
270
|
+
reason: string;
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* May this author publish a skill at this scope?
|
|
274
|
+
*
|
|
275
|
+
* A skill's body is instructions the model follows, which makes writing one at a scope an edit to
|
|
276
|
+
* everyone in that scope's system prompt. The rules follow from that, and only the third is
|
|
277
|
+
* interesting:
|
|
278
|
+
*
|
|
279
|
+
* 1. You may only write into a scope you are yourself in. Writing into a scope you are not in is
|
|
280
|
+
* authoring for people you have no relationship with.
|
|
281
|
+
* 2. Your OWN scope is yours. A per-actor skill affects exactly one prompt — the author's.
|
|
282
|
+
* 3. NOTHING BUT A HUMAN MAY WRITE ABOVE ITS OWN SCOPE, whatever `elevated` says. An agent that can
|
|
283
|
+
* write a `tenant:` skill is an agent whose prompt anyone in the tenant can edit by talking to
|
|
284
|
+
* it: the user asks for something, the turn writes the instruction, and every later turn for
|
|
285
|
+
* every other user follows it. That is prompt injection with persistence, and no elevation a host
|
|
286
|
+
* could grant makes it a different shape. An agent that has genuinely learned something worth
|
|
287
|
+
* sharing proposes it; a person publishes it.
|
|
288
|
+
* 4. A human writing above their own scope needs the host to say so (`elevated`).
|
|
289
|
+
*/
|
|
290
|
+
export declare function skillWriteVerdict(request: SkillWriteRequest): SkillWriteVerdict;
|
|
291
|
+
//# sourceMappingURL=skills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAErE,8FAA8F;AAC9F,MAAM,WAAW,YAAY;IAC3B,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,mGAAmG;IACnG,WAAW,EAAE,MAAM,CAAC;IACpB,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gGAAgG;AAChG,MAAM,WAAW,KAAM,SAAQ,YAAY;IACzC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC;AAExC,oEAAoE;AACpE,eAAO,MAAM,YAAY,WAAW,CAAC;AAErC,4CAA4C;AAC5C,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAE/C;AAED,qGAAqG;AACrG,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC1D;AAED;;;;;GAKG;AACH,e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EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,uCAAuC,KAAK,kCAAkC,GAAG,GAAG;SAC7F,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC,QAAQ,KAAK,IAAI;QAC9B,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;QACnB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,KAAK,qCAAqC,EAAE,CAAC;AAC9F,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HumanReply } from '../elicitation.js';
|
|
2
|
+
import type { AgentRunInput } from '../types.js';
|
|
2
3
|
/**
|
|
3
4
|
* Runs an agent turn. Two impls exist:
|
|
4
5
|
* - InlineAgentRunner (default): the loop runs in-process — no extra dependencies. This is what
|
|
5
|
-
*
|
|
6
|
-
* - DurableAgentRunner (opt-in via `durable: true`): the turn is
|
|
7
|
-
*
|
|
6
|
+
* the provider builds unless `durable: true` is set.
|
|
7
|
+
* - DurableAgentRunner (opt-in via `durable: true`): the turn is an `@adonis-agora/durable`
|
|
8
|
+
* {@link import('../durable/agent-run-workflow.js').AgentRunWorkflow}, so each model/tool call is
|
|
9
|
+
* a checkpointed step and HITL is `ctx.waitForSignal`.
|
|
8
10
|
*
|
|
9
11
|
* `start` ENQUEUES and returns immediately with the runId — the live tokens flow on the
|
|
10
12
|
* TokenStreamSink, not through this call.
|
|
@@ -13,8 +15,20 @@ export interface AgentRunner {
|
|
|
13
15
|
start(input: AgentRunInput): Promise<{
|
|
14
16
|
runId: string;
|
|
15
17
|
}>;
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Deliver a human's reply to a parked tool call — an approve/reject {@link import('../types.js').Decision}
|
|
20
|
+
* for an `action`, or an {@link import('../elicitation.js').ElicitationReply} for a question set.
|
|
21
|
+
* One channel for both, because a question set parks as a `pending_approval` action and therefore
|
|
22
|
+
* reaches a run through the inbox a deployment already has.
|
|
23
|
+
*
|
|
24
|
+
* A `Decision` reaching a question set is the documented reduction ("confirmed the pre-picked
|
|
25
|
+
* answers"). The reverse is not: answers carry no `approved`, so an implementation that can tell
|
|
26
|
+
* which wait it is settling MUST refuse them with
|
|
27
|
+
* {@link import('../elicitation.js').HumanReplyMismatchError} rather than deliver them. An
|
|
28
|
+
* implementation that cannot tell delivers, and the loop discards the reply and stays parked —
|
|
29
|
+
* either way, no rejection is recorded against a human who only submitted a form.
|
|
30
|
+
*/
|
|
31
|
+
signal(runId: string, toolCallId: string, reply: HumanReply): Promise<void>;
|
|
18
32
|
cancel(runId: string): Promise<void>;
|
|
19
33
|
}
|
|
20
34
|
//# sourceMappingURL=agent-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-runner.d.ts","sourceRoot":"","sources":["../../../src/spi/agent-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"agent-runner.d.ts","sourceRoot":"","sources":["../../../src/spi/agent-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5E,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC"}
|
|
@@ -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,YAAY,CAAC;IACrB,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B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F,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"}
|
|
@@ -95,6 +95,11 @@ export interface RunSummaryRow {
|
|
|
95
95
|
actorLabel?: string;
|
|
96
96
|
tenantRef: string | null;
|
|
97
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;
|
|
98
103
|
status: string;
|
|
99
104
|
/** ISO timestamp. */
|
|
100
105
|
startedAt: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governance-queries.d.ts","sourceRoot":"","sources":["../../../src/spi/governance-queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEjE,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,CAAC;CACjB;AAED,0EAA0E;AAC1E,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,yHAAyH;IACzH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAA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AsB;IACrC,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAC/D,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAC/D,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAC/D,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAC/D,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAI3D;;;;OAIG;IACH,QAAQ,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"}
|