@wowyuarm/dsh-agent-team 0.1.7 → 0.1.9
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/package.json +2 -1
- package/packages/agent-team/README.md +5 -3
- package/packages/agent-team/README.zh.md +5 -3
- package/packages/agent-team/core-skills/member-skill-manager/SKILL.md +2 -0
- package/packages/agent-team/lib/attachments.js +14 -4
- package/packages/agent-team/lib/context-management.js +379 -0
- package/packages/agent-team/lib/context-projection.js +574 -0
- package/packages/agent-team/lib/context-source.js +72 -0
- package/packages/agent-team/lib/index.js +1258 -54
- package/packages/agent-team/lib/ledger.js +357 -26
- package/packages/agent-team/lib/member-context.js +7 -3
- package/packages/agent-team/lib/member-runtime.js +159 -4
- package/packages/agent-team/lib/pressure-policy.js +200 -0
- package/packages/agent-team/lib/progress-nudge.js +320 -0
- package/packages/agent-team/lib/spec.js +18 -0
- package/packages/agent-team/lib/typert.host.js +124 -42
- package/packages/agent-team/lib/typert.remote-client.d.ts.map +1 -1
- package/packages/agent-team/lib/typert.remote-client.js +39 -25
- package/packages/agent-team/lib/types/attachments.d.ts +1 -1
- package/packages/agent-team/lib/types/attachments.d.ts.map +1 -1
- package/packages/agent-team/lib/types/context-management.d.ts +142 -0
- package/packages/agent-team/lib/types/context-management.d.ts.map +1 -0
- package/packages/agent-team/lib/types/context-projection.d.ts +219 -0
- package/packages/agent-team/lib/types/context-projection.d.ts.map +1 -0
- package/packages/agent-team/lib/types/context-source.d.ts +83 -0
- package/packages/agent-team/lib/types/context-source.d.ts.map +1 -0
- package/packages/agent-team/lib/types/index.d.ts +283 -2
- package/packages/agent-team/lib/types/index.d.ts.map +1 -1
- package/packages/agent-team/lib/types/ledger.d.ts +120 -7
- package/packages/agent-team/lib/types/ledger.d.ts.map +1 -1
- package/packages/agent-team/lib/types/member-context.d.ts.map +1 -1
- package/packages/agent-team/lib/types/member-runtime.d.ts +30 -2
- package/packages/agent-team/lib/types/member-runtime.d.ts.map +1 -1
- package/packages/agent-team/lib/types/pressure-policy.d.ts +106 -0
- package/packages/agent-team/lib/types/pressure-policy.d.ts.map +1 -0
- package/packages/agent-team/lib/types/progress-nudge.d.ts +136 -0
- package/packages/agent-team/lib/types/progress-nudge.d.ts.map +1 -0
- package/packages/agent-team/lib/types/spec.d.ts.map +1 -1
- package/packages/agent-team/lib/types/types/entities.d.ts +32 -1
- package/packages/agent-team/lib/types/types/entities.d.ts.map +1 -1
- package/packages/agent-team/lib/types/types/operations.d.ts +38 -3
- package/packages/agent-team/lib/types/types/operations.d.ts.map +1 -1
- package/packages/agent-team/lib/types/types/requests-results.d.ts +54 -1
- package/packages/agent-team/lib/types/types/requests-results.d.ts.map +1 -1
- package/packages/agent-team/preset/team-member/agent.cordis.yml +10 -2
- package/packages/client-agent-team/lib/client.js +283 -398
- package/packages/client-agent-team/lib/client.js.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.d.ts +1 -2
- package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.js +61 -41
- package/packages/client-agent-team/lib/types/client/TeamChannelPage.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamChannelPage.js +3 -7
- package/packages/client-agent-team/lib/types/client/TeamComposer.d.ts +3 -1
- package/packages/client-agent-team/lib/types/client/TeamComposer.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamComposer.js +37 -27
- package/packages/client-agent-team/lib/types/client/TeamConversation.d.ts +1 -1
- package/packages/client-agent-team/lib/types/client/TeamConversation.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamConversation.js +2 -2
- package/packages/client-agent-team/lib/types/client/TeamMemberAvatar.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamMemberAvatar.js +3 -2
- package/packages/client-agent-team/lib/types/client/TeamMessage.js +5 -0
- package/packages/client-agent-team/lib/types/client/TeamPresenceDot.d.ts +2 -2
- package/packages/client-agent-team/lib/types/client/TeamPresenceDot.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamPresenceDot.js +4 -6
- package/packages/client-agent-team/lib/types/client/TeamStateDot.d.ts +14 -0
- package/packages/client-agent-team/lib/types/client/TeamStateDot.d.ts.map +1 -0
- package/packages/client-agent-team/lib/types/client/TeamStateDot.js +15 -0
- package/packages/client-agent-team/lib/types/client/TeamThreadPage.d.ts +1 -0
- package/packages/client-agent-team/lib/types/client/TeamThreadPage.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamThreadPage.js +41 -16
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.d.ts +1 -1
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.js +2 -2
- package/packages/client-agent-team/lib/types/client/index.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/index.js +36 -78
- package/packages/client-agent-team/lib/types/client/locales.d.ts +0 -16
- package/packages/client-agent-team/lib/types/client/locales.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/locales.js +0 -16
- package/packages/client-agent-team/lib/types/client/sidebar-drag.d.ts +1 -2
- package/packages/client-agent-team/lib/types/client/sidebar-drag.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/slots.d.ts +8 -1
- package/packages/client-agent-team/lib/types/client/slots.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/task-refs.d.ts +7 -1
- package/packages/client-agent-team/lib/types/client/task-refs.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/task-refs.js +25 -3
- package/packages/client-agent-team/lib/types/client/team-formatters.d.ts +11 -10
- package/packages/client-agent-team/lib/types/client/team-formatters.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/team-formatters.js +14 -11
- package/packages/tool-agent-team/README.md +8 -5
- package/packages/tool-agent-team/README.zh.md +8 -5
- package/packages/tool-agent-team/lib/context-tools.js +179 -0
- package/packages/tool-agent-team/lib/index.js +144 -25
- package/packages/tool-agent-team/lib/types/context-tools.d.ts +16 -0
- package/packages/tool-agent-team/lib/types/context-tools.d.ts.map +1 -0
- package/packages/tool-agent-team/lib/types/index.d.ts.map +1 -1
- package/packages/agent-team/lib/auto-compaction.js +0 -201
- package/packages/agent-team/lib/types/auto-compaction.d.ts +0 -47
- package/packages/agent-team/lib/types/auto-compaction.d.ts.map +0 -1
- package/packages/client-agent-team/lib/types/client/TeamMemberDock.d.ts +0 -12
- package/packages/client-agent-team/lib/types/client/TeamMemberDock.d.ts.map +0 -1
- package/packages/client-agent-team/lib/types/client/TeamMemberDock.js +0 -13
- package/packages/client-agent-team/lib/types/client/member-session-input.d.ts +0 -20
- package/packages/client-agent-team/lib/types/client/member-session-input.d.ts.map +0 -1
- package/packages/client-agent-team/lib/types/client/member-session-input.js +0 -110
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-only Session projection for Agent Team context management.
|
|
3
|
+
*
|
|
4
|
+
* One pure synchronous fold over a Member Session log derives every
|
|
5
|
+
* context-management fact the Host needs: pending rollover intent (a
|
|
6
|
+
* successful `context_rollover` call/result pair — under the legacy
|
|
7
|
+
* `new_context` name for Sessions recorded before the rename), explicit
|
|
8
|
+
* checkpoints (a
|
|
9
|
+
* successful `context_checkpoint` pair resolved by its containing `turn/end`),
|
|
10
|
+
* handoff/compaction boundaries, and quiet-continuation delivery state. The
|
|
11
|
+
* fold is the single authority for these facts — no second store, and callers
|
|
12
|
+
* never re-derive intent from raw events.
|
|
13
|
+
*
|
|
14
|
+
* A seeded child Session folds with `inheritedEventCount` respected: events
|
|
15
|
+
* inherited from the fork prefix are already resolved history, never fresh
|
|
16
|
+
* intent. The cold fold and the registered unit both start past the inherited
|
|
17
|
+
* cut, so an inherited historical rollover call can never schedule
|
|
18
|
+
* another transition in the child.
|
|
19
|
+
* @module @wowyuarm/dsh-agent-team/context-projection
|
|
20
|
+
*/
|
|
21
|
+
import type { UserMessage } from '@deepseek-ai/dsh-llm';
|
|
22
|
+
import type { SessionEvent, SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
23
|
+
import type { ProjectionDefinition } from '@deepseek-ai/dsh-session-projection';
|
|
24
|
+
import type { AgentTeamContextCheckpointRef } from './types.ts';
|
|
25
|
+
import { isCheckpointContinuationMessage } from './context-source.ts';
|
|
26
|
+
/** Whether one notice summary is a pure reminder (never a semantic Team fact). */
|
|
27
|
+
export declare function isReminderNoticeSummary(summary: string): boolean;
|
|
28
|
+
/** Stable tool names the projection recognizes. */
|
|
29
|
+
export declare const CONTEXT_CHECKPOINT_TOOL_NAME = "context_checkpoint";
|
|
30
|
+
export declare const CONTEXT_ROLLOVER_TOOL_NAME = "context_rollover";
|
|
31
|
+
/**
|
|
32
|
+
* Legacy decoder name: the rollover tool was renamed `new_context` →
|
|
33
|
+
* `context_rollover`, and Sessions recorded before the rename still carry
|
|
34
|
+
* durable `new_context` call/result pairs. The projection keeps folding them
|
|
35
|
+
* — pending rollovers and crash recovery of existing Members depend on old
|
|
36
|
+
* events still resolving intent — but this is a log decoder, not a tool
|
|
37
|
+
* alias: no new call can carry the old name.
|
|
38
|
+
*/
|
|
39
|
+
export declare const NEW_CONTEXT_TOOL_NAME = "new_context";
|
|
40
|
+
/** One completed-turn checkpoint anchor in this Session lineage. */
|
|
41
|
+
export interface ContextCheckpointEntry {
|
|
42
|
+
/** Opaque stable ref; selection authority, never derived from the name. */
|
|
43
|
+
readonly checkpointRef: AgentTeamContextCheckpointRef;
|
|
44
|
+
/** Display label supplied by the model. */
|
|
45
|
+
readonly name: string;
|
|
46
|
+
/** Seq of the successful tool result that recorded the checkpoint. */
|
|
47
|
+
readonly resultSeq: number;
|
|
48
|
+
/** Turn the checkpoint concluded; the completed-turn boundary anchor. */
|
|
49
|
+
readonly turn: number;
|
|
50
|
+
/** Seq of the `turn/end` that resolved the checkpoint; -1 until resolved. */
|
|
51
|
+
readonly turnEndSeq: number;
|
|
52
|
+
}
|
|
53
|
+
/** Arguments the model passed to one successful rollover call. */
|
|
54
|
+
export interface RolloverToolArguments {
|
|
55
|
+
readonly handoff: string;
|
|
56
|
+
readonly checkpointRef?: AgentTeamContextCheckpointRef | undefined;
|
|
57
|
+
readonly relatedFiles: readonly {
|
|
58
|
+
readonly path: string;
|
|
59
|
+
readonly reason: string;
|
|
60
|
+
}[];
|
|
61
|
+
}
|
|
62
|
+
/** Rollover intent waiting for the containing turn to finish and the Agent to idle. */
|
|
63
|
+
export interface PendingRolloverIntent extends RolloverToolArguments {
|
|
64
|
+
/** The provider-issued call id of the successful rollover call. */
|
|
65
|
+
readonly toolCallId: string;
|
|
66
|
+
/** Seq of the successful rollover tool result. */
|
|
67
|
+
readonly resultSeq: number;
|
|
68
|
+
/** Turn containing the successful call; the swap waits for its end. */
|
|
69
|
+
readonly turn: number;
|
|
70
|
+
/** Seq of the `turn/end` that released the intent for the swap; -1 until observed. */
|
|
71
|
+
readonly turnEndSeq: number;
|
|
72
|
+
}
|
|
73
|
+
/** Quiet-continuation delivery state for one checkpoint, keyed by checkpointRef. */
|
|
74
|
+
export interface ContinuationDeliveryState {
|
|
75
|
+
/** The checkpoint the continuation follows. */
|
|
76
|
+
readonly checkpointRef: AgentTeamContextCheckpointRef;
|
|
77
|
+
/** Seq of the delivered continuation notice in this Session; -1 until delivered. */
|
|
78
|
+
readonly deliveredSeq: number;
|
|
79
|
+
}
|
|
80
|
+
/** One non-Team message queued after the pending intent; a carry candidate. */
|
|
81
|
+
export interface CarriedCandidate {
|
|
82
|
+
/** The queued message itself, verbatim. */
|
|
83
|
+
readonly message: UserMessage;
|
|
84
|
+
/** The turn that surfaced the message onto the model-visible input, if any. */
|
|
85
|
+
readonly surfacedTurn: number;
|
|
86
|
+
/** Whether a completed assistant answer proved the old generation handled it. */
|
|
87
|
+
readonly consumed: boolean;
|
|
88
|
+
}
|
|
89
|
+
/** State of the `agentTeamContext` projection for one Session. */
|
|
90
|
+
export interface AgentTeamContextProjectionState {
|
|
91
|
+
/** Checkpoints recorded by a successful call, resolved ones anchored to their turn end. */
|
|
92
|
+
readonly checkpoints: readonly ContextCheckpointEntry[];
|
|
93
|
+
/** Rollover intent awaiting its containing turn end, at most one. */
|
|
94
|
+
readonly pending: PendingRolloverIntent | null;
|
|
95
|
+
/** Quiet continuations recorded (with or without delivery), keyed by checkpoint ref. */
|
|
96
|
+
readonly continuations: readonly ContinuationDeliveryState[];
|
|
97
|
+
/**
|
|
98
|
+
* Non-Team messages queued into the inbox after the pending intent's tool
|
|
99
|
+
* result. The durable `agent/inbox/spliced` log is the truth: the
|
|
100
|
+
* transition delivers every candidate the old generation never answered
|
|
101
|
+
* (a claimed-but-rejected or canceled message stays a candidate), deduped
|
|
102
|
+
* by message id. Empty until an intent exists.
|
|
103
|
+
*/
|
|
104
|
+
readonly carriedCandidates: readonly CarriedCandidate[];
|
|
105
|
+
/** The most recently opened turn; user/message events carry no turn of their own. */
|
|
106
|
+
readonly lastTurn: number;
|
|
107
|
+
/**
|
|
108
|
+
* Context-tool calls whose results have not landed yet. Part of the state so
|
|
109
|
+
* the live unit folds one event at a time and still pairs call to result; a
|
|
110
|
+
* dangling call at any cut simply never becomes intent or a checkpoint.
|
|
111
|
+
*/
|
|
112
|
+
readonly openCalls: readonly {
|
|
113
|
+
readonly callId: string;
|
|
114
|
+
readonly name: string;
|
|
115
|
+
readonly arguments: string;
|
|
116
|
+
}[];
|
|
117
|
+
/**
|
|
118
|
+
* Timeline boundaries beyond explicit checkpoints, resolved to their
|
|
119
|
+
* containing completed turn: handoff deliveries (each generation begins
|
|
120
|
+
* with one), compaction notices, and Team semantic facts that entered
|
|
121
|
+
* model context (successful claim-state tool results or structured Team
|
|
122
|
+
* notification delivery). Each is a structural timeline candidate with the
|
|
123
|
+
* same completed-turn anchor contract as a checkpoint.
|
|
124
|
+
*/
|
|
125
|
+
readonly boundaries: readonly TimelineBoundary[];
|
|
126
|
+
/**
|
|
127
|
+
* Threads whose first delivery already anchored a boundary. The first
|
|
128
|
+
* arrival of a Thread's facts is the one preserved push-face anchor; every
|
|
129
|
+
* later re-delivery of the same Thread is noise and produces no boundary.
|
|
130
|
+
* Fold-internal by design: cold and live folds replay it identically from
|
|
131
|
+
* the event log, so no query-time rescan exists.
|
|
132
|
+
*/
|
|
133
|
+
readonly seenThreads: readonly string[];
|
|
134
|
+
/** Seq of the latest resolved `turn/end`; the head boundary of the timeline. */
|
|
135
|
+
readonly lastTurnEndSeq: number;
|
|
136
|
+
}
|
|
137
|
+
/** One non-checkpoint timeline candidate resolved at a completed turn. */
|
|
138
|
+
export interface TimelineBoundary {
|
|
139
|
+
/** Stable identity for the timeline: kind plus the anchoring event seq. */
|
|
140
|
+
readonly key: string;
|
|
141
|
+
/** Which structural source produced this boundary. */
|
|
142
|
+
readonly source: 'team-boundary' | 'handoff' | 'compaction';
|
|
143
|
+
/** Human-facing label derived from the boundary's own data. */
|
|
144
|
+
readonly label: string;
|
|
145
|
+
/** Seq of the boundary's own anchoring event (delivery or tool result). */
|
|
146
|
+
readonly seq: number;
|
|
147
|
+
/** Turn the boundary landed in. */
|
|
148
|
+
readonly turn: number;
|
|
149
|
+
/** Seq of the `turn/end` that resolved it; -1 until resolved. */
|
|
150
|
+
readonly turnEndSeq: number;
|
|
151
|
+
}
|
|
152
|
+
declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
153
|
+
interface SessionProjectionStateMap {
|
|
154
|
+
agentTeamContext: AgentTeamContextProjectionState;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Deterministic checkpoint ref from the recording session and tool call
|
|
159
|
+
* identity: a bounded, collision-resistant opaque token. Provider call ids
|
|
160
|
+
* are arbitrary-length free text that may repeat across generations and even
|
|
161
|
+
* collide between Sessions, so the ref derives from the SHA-256 of the exact
|
|
162
|
+
* `(sessionId, callId)` pair — same pair always reproduces the ref, any
|
|
163
|
+
* other pair is overwhelmingly unlikely to collide, and the token can never
|
|
164
|
+
* smuggle delimiters or unbounded content through a ref field.
|
|
165
|
+
*/
|
|
166
|
+
export declare function checkpointRefFor(sessionId: string, callId: string): AgentTeamContextCheckpointRef;
|
|
167
|
+
/**
|
|
168
|
+
* Deterministic default-boundary ref for one delivered Team boundary: the
|
|
169
|
+
* same session-scoped hash shape as checkpoint refs, keyed on the boundary's
|
|
170
|
+
* anchoring event seq. Consecutive generations routinely repeat event seqs,
|
|
171
|
+
* so the Session identity must be part of the key or two generations'
|
|
172
|
+
* boundaries at the same seq collide — the timeline would silently drop the
|
|
173
|
+
* ancestor item and a `context_rollover` return would resolve the wrong boundary.
|
|
174
|
+
*/
|
|
175
|
+
export declare function boundaryRefFor(sessionId: string, seq: number): AgentTeamContextCheckpointRef;
|
|
176
|
+
/**
|
|
177
|
+
* Cold-fold one immutable event log into the projection state. Events at or
|
|
178
|
+
* before `inheritedEventCount` belong to the fork prefix and are resolved
|
|
179
|
+
* history in this Session, so they never produce fresh intent. `sessionId` is
|
|
180
|
+
* the log's own Session identity — it keys checkpoint refs, so the same
|
|
181
|
+
* provider call id in two different Sessions produces two distinct refs.
|
|
182
|
+
*/
|
|
183
|
+
export declare function foldContextProjection(events: readonly SessionEvent[], inheritedEventCount?: SessionLogOffset, sessionId?: string): AgentTeamContextProjectionState;
|
|
184
|
+
/**
|
|
185
|
+
* The host-only projection unit; no wire view is published. The definition is
|
|
186
|
+
* a factory: each Session folds with its own identity so checkpoint refs
|
|
187
|
+
* derive from that Session's exact `(sessionId, callId)` pairs.
|
|
188
|
+
*/
|
|
189
|
+
export declare const agentTeamContextProjectionDefinition: (sessionId: string) => ProjectionDefinition<"agentTeamContext", AgentTeamContextProjectionState>;
|
|
190
|
+
/** The carried input one transition must deliver: unconsumed post-intent candidates, in queue order. */
|
|
191
|
+
export declare function carriedInputOf(state: AgentTeamContextProjectionState): readonly UserMessage[];
|
|
192
|
+
/** Whether a quiet continuation for one checkpoint was already delivered in this Session. */
|
|
193
|
+
export declare function continuationDelivered(state: AgentTeamContextProjectionState, checkpointRef: AgentTeamContextCheckpointRef): boolean;
|
|
194
|
+
/** Record that a continuation for one checkpoint is scheduled (delivery not yet seen). */
|
|
195
|
+
export declare function withScheduledContinuation(state: AgentTeamContextProjectionState, checkpointRef: AgentTeamContextCheckpointRef): AgentTeamContextProjectionState;
|
|
196
|
+
export { isCheckpointContinuationMessage };
|
|
197
|
+
/** One structural timeline candidate, projection view: anchor plus identity. */
|
|
198
|
+
export interface TimelineCandidate {
|
|
199
|
+
/** Stable selection ref (checkpoint refs for agent checkpoints; the boundary key otherwise). */
|
|
200
|
+
readonly ref: string;
|
|
201
|
+
/** Semantic label: the model-supplied checkpoint name or the boundary label. */
|
|
202
|
+
readonly label: string;
|
|
203
|
+
/** Which structural source produced this candidate. */
|
|
204
|
+
readonly source: 'agent' | 'team-boundary' | 'handoff' | 'compaction' | 'head';
|
|
205
|
+
/** Seq of the anchoring event (the tool result or delivery message). */
|
|
206
|
+
readonly seq: number;
|
|
207
|
+
/** Seq of the completed `turn/end` that resolved the candidate; -1 while unresolved. */
|
|
208
|
+
readonly turnEndSeq: number;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Bounded structural timeline candidates, newest first: explicit checkpoints
|
|
212
|
+
* (resolved only), structural boundaries, then the current head. The Host
|
|
213
|
+
* prices retained/discarded tokens and applies restorability guards on top;
|
|
214
|
+
* this view is the single source of candidate anchors and labels.
|
|
215
|
+
*/
|
|
216
|
+
export declare function timelineCandidates(state: AgentTeamContextProjectionState, limit: number): readonly TimelineCandidate[];
|
|
217
|
+
/** Find one resolved checkpoint entry by its stable ref, if it exists. */
|
|
218
|
+
export declare function checkpointByRef(state: AgentTeamContextProjectionState, checkpointRef: string): ContextCheckpointEntry | undefined;
|
|
219
|
+
//# sourceMappingURL=context-projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-projection.d.ts","sourceRoot":"","sources":["../../src/context-projection.ts"],"names":[],"mappings":"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B,EAAE,+BAA+B,CAY/I,CAAA;AAiRF,wGAAwG;AACxG,wBAAgB,cAAc,CAAC,KAAK,EAAE,+BAA+B,GAAG,SAAS,WAAW,EAAE,CAE7F;AAQD,6FAA6F;AAC7F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,+BAA+B,EAAE,aAAa,EAAE,6BAA6B,GAAG,OAAO,CAEnI;AAED,0FAA0F;AAC1F,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,+BAA+B,EAAE,aAAa,EAAE,6BAA6B,GAAG,+BAA+B,CAG/J;AAsDD,OAAO,EAAE,+BAA+B,EAAE,CAAA;AAE1C,gFAAgF;AAChF,MAAM,WAAW,iBAAiB;IAChC,gGAAgG;IAChG,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,CAAA;IAC9E,wEAAwE;IACxE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,wFAAwF;IACxF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,+BAA+B,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,iBAAiB,EAAE,CAgBtH;AAED,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,KAAK,EAAE,+BAA+B,EAAE,aAAa,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS,CAEjI"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge-extended message sources for Agent Team context management.
|
|
3
|
+
*
|
|
4
|
+
* The sources ride ordinary `UserMessage`s and never add a Harness
|
|
5
|
+
* `ContextForm`: the handoff snapshot reuses the shipped `snapshot` form, the
|
|
6
|
+
* quieter notices reuse `notice`. Predicates here are the single place that
|
|
7
|
+
* recognizes these notices, so callers never match on localized body text.
|
|
8
|
+
* @module @wowyuarm/dsh-agent-team/context-source
|
|
9
|
+
*/
|
|
10
|
+
import type { ContextSnapshotSection, UserMessage } from '@deepseek-ai/dsh-llm';
|
|
11
|
+
declare module '@deepseek-ai/dsh-llm' {
|
|
12
|
+
interface MessageSourceMap {
|
|
13
|
+
/** First model-facing context of one rollover generation: the model-authored handoff plus a verifiable Host envelope. */
|
|
14
|
+
'agent-team-context-handoff': AgentTeamContextHandoffSource;
|
|
15
|
+
/** Host-generated quiet continuation after an explicit checkpoint concluded a turn. */
|
|
16
|
+
'agent-team-context-continuation': AgentTeamContextContinuationSource;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** Envelope anchor fields the Host adds around the model's own handoff prose. */
|
|
20
|
+
export interface AgentTeamContextHandoffSource {
|
|
21
|
+
readonly kind: 'agent-team-context-handoff';
|
|
22
|
+
/** Existing semantic form: named contributions rendered by any snapshot-aware surface. */
|
|
23
|
+
readonly form: 'snapshot';
|
|
24
|
+
/** Envelope version; bumps when the envelope fields change meaning. */
|
|
25
|
+
readonly version: 1;
|
|
26
|
+
/** The Member's Session before this rollover. */
|
|
27
|
+
readonly previousSessionId: string;
|
|
28
|
+
/** The rollover generation this handoff opened. */
|
|
29
|
+
readonly newSessionId: string;
|
|
30
|
+
/** Why the rollover happened. */
|
|
31
|
+
readonly trigger: 'model' | 'pressure';
|
|
32
|
+
/** Seq of the successful `context_rollover` tool result in the previous Session log. */
|
|
33
|
+
readonly handoffEventSeq: number;
|
|
34
|
+
/** The checkpoint a return was seeded from; absent on a fresh rollover. */
|
|
35
|
+
readonly checkpointRef?: string;
|
|
36
|
+
/** Workspace paths the handoff called out as relevant. */
|
|
37
|
+
readonly relatedFiles?: readonly string[];
|
|
38
|
+
/** Named contributions, starting with the model-authored handoff prose. */
|
|
39
|
+
readonly sections: readonly ContextSnapshotSection[];
|
|
40
|
+
}
|
|
41
|
+
/** Quiet wake that continues work in the turn after an explicit checkpoint. */
|
|
42
|
+
export interface AgentTeamContextContinuationSource {
|
|
43
|
+
readonly kind: 'agent-team-context-continuation';
|
|
44
|
+
readonly form: 'notice';
|
|
45
|
+
/** Stable summary identifying this notice family. */
|
|
46
|
+
readonly summary: string;
|
|
47
|
+
/** The checkpoint this continuation follows; ties the wake to its anchor. */
|
|
48
|
+
readonly checkpointRef: string;
|
|
49
|
+
/** Envelope version. */
|
|
50
|
+
readonly version: 1;
|
|
51
|
+
}
|
|
52
|
+
/** Stable one-line account for checkpoint continuation notices. */
|
|
53
|
+
export declare const CONTEXT_CONTINUATION_NOTICE_SUMMARY = "Context checkpoint recorded; work continues in the next turn";
|
|
54
|
+
/** Handoff snapshot section name carrying the model-authored prose. */
|
|
55
|
+
export declare const HANDOFF_SECTION_NAME = "HANDOFF";
|
|
56
|
+
/**
|
|
57
|
+
* Build the first model-facing context of one rollover generation. The Host
|
|
58
|
+
* owns only the verifiable envelope; the prose is the Member's own handoff.
|
|
59
|
+
*/
|
|
60
|
+
export declare function createHandoffMessage(input: {
|
|
61
|
+
readonly handoff: string;
|
|
62
|
+
readonly previousSessionId: string;
|
|
63
|
+
readonly newSessionId: string;
|
|
64
|
+
readonly trigger: 'model' | 'pressure';
|
|
65
|
+
readonly handoffEventSeq: number;
|
|
66
|
+
readonly checkpointRef?: string;
|
|
67
|
+
readonly relatedFiles?: readonly {
|
|
68
|
+
readonly path: string;
|
|
69
|
+
readonly reason?: string;
|
|
70
|
+
}[];
|
|
71
|
+
}): UserMessage;
|
|
72
|
+
/**
|
|
73
|
+
* Build the quiet follow-up that continues work after an explicit checkpoint
|
|
74
|
+
* concluded its turn. Delivery is scheduled only after the checkpoint's
|
|
75
|
+
* successful tool result is durable, so a result-render failure can never
|
|
76
|
+
* leave a ghost continuation behind.
|
|
77
|
+
*/
|
|
78
|
+
export declare function createCheckpointContinuationMessage(checkpointRef: string): UserMessage;
|
|
79
|
+
/** Whether one user message is a rollover handoff snapshot. */
|
|
80
|
+
export declare function isHandoffMessage(message: UserMessage): boolean;
|
|
81
|
+
/** Whether one user message is a checkpoint continuation notice, optionally for one checkpoint. */
|
|
82
|
+
export declare function isCheckpointContinuationMessage(message: UserMessage, checkpointRef?: string): boolean;
|
|
83
|
+
//# sourceMappingURL=context-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-source.d.ts","sourceRoot":"","sources":["../../src/context-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAG/E,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,gBAAgB;QACxB,yHAAyH;QACzH,4BAA4B,EAAE,6BAA6B,CAAA;QAC3D,uFAAuF;QACvF,iCAAiC,EAAE,kCAAkC,CAAA;KACtE;CACF;AAED,iFAAiF;AACjF,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAA;IAC3C,0FAA0F;IAC1F,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,uEAAuE;IACvE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;IACnB,iDAAiD;IACjD,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;IAClC,mDAAmD;IACnD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,iCAAiC;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CAAA;IACtC,wFAAwF;IACxF,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,2EAA2E;IAC3E,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;IAC/B,0DAA0D;IAC1D,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACzC,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,SAAS,sBAAsB,EAAE,CAA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