@wowyuarm/dsh-agent-team 0.1.14-alpha.2 → 0.1.14
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/README.md +5 -3
- package/README.zh.md +5 -3
- package/cordis.patch.yml +2 -185
- package/package.json +52 -46
- package/packages/agent-team/README.md +1 -1
- package/packages/agent-team/README.zh.md +1 -1
- package/packages/agent-team/core-skills/member-memory-manager/SKILL.md +30 -0
- package/packages/agent-team/lib/context-continuity-host.js +91 -0
- package/packages/agent-team/lib/context-projection.js +266 -489
- package/packages/agent-team/lib/context-source.js +17 -106
- package/packages/agent-team/lib/human-avatar.js +61 -0
- package/packages/agent-team/lib/human-profile.js +46 -0
- package/packages/agent-team/lib/human-update-check.js +119 -0
- package/packages/agent-team/lib/index.js +408 -264
- package/packages/agent-team/lib/ledger.js +120 -15
- package/packages/agent-team/lib/member-context.js +9 -8
- package/packages/agent-team/lib/member-runtime.js +1 -1
- package/packages/agent-team/lib/member-time-context.js +2 -5
- package/packages/agent-team/lib/preset-roster.js +15 -0
- package/packages/agent-team/lib/pressure-policy.js +9 -6
- package/packages/agent-team/lib/session-remediation.js +493 -0
- package/packages/agent-team/lib/stored-session-reader.js +2 -1
- package/packages/agent-team/lib/typert.host.js +605 -291
- package/packages/agent-team/lib/typert.remote-client.d.ts +15 -6
- package/packages/agent-team/lib/typert.remote-client.d.ts.map +1 -1
- package/packages/agent-team/lib/typert.remote-client.js +367 -244
- package/packages/agent-team/lib/types/context-continuity-host.d.ts +84 -0
- package/packages/agent-team/lib/types/context-continuity-host.d.ts.map +1 -0
- package/packages/agent-team/lib/types/context-projection.d.ts +130 -185
- package/packages/agent-team/lib/types/context-projection.d.ts.map +1 -1
- package/packages/agent-team/lib/types/context-source.d.ts +17 -81
- package/packages/agent-team/lib/types/context-source.d.ts.map +1 -1
- package/packages/agent-team/lib/types/human-avatar.d.ts +29 -0
- package/packages/agent-team/lib/types/human-avatar.d.ts.map +1 -0
- package/packages/agent-team/lib/types/human-profile.d.ts +44 -0
- package/packages/agent-team/lib/types/human-profile.d.ts.map +1 -0
- package/packages/agent-team/lib/types/human-update-check.d.ts +73 -0
- package/packages/agent-team/lib/types/human-update-check.d.ts.map +1 -0
- package/packages/agent-team/lib/types/index.d.ts +112 -38
- package/packages/agent-team/lib/types/index.d.ts.map +1 -1
- package/packages/agent-team/lib/types/ledger.d.ts +31 -2
- package/packages/agent-team/lib/types/ledger.d.ts.map +1 -1
- package/packages/agent-team/lib/types/member-context.d.ts +0 -14
- package/packages/agent-team/lib/types/member-context.d.ts.map +1 -1
- package/packages/agent-team/lib/types/member-time-context.d.ts +0 -15
- package/packages/agent-team/lib/types/member-time-context.d.ts.map +1 -1
- package/packages/agent-team/lib/types/preset-roster.d.ts +5 -0
- package/packages/agent-team/lib/types/preset-roster.d.ts.map +1 -0
- package/packages/agent-team/lib/types/pressure-policy.d.ts +6 -0
- package/packages/agent-team/lib/types/pressure-policy.d.ts.map +1 -1
- package/packages/agent-team/lib/types/session-remediation.d.ts +172 -0
- package/packages/agent-team/lib/types/session-remediation.d.ts.map +1 -0
- package/packages/agent-team/lib/types/stored-session-reader.d.ts +2 -1
- package/packages/agent-team/lib/types/stored-session-reader.d.ts.map +1 -1
- package/packages/agent-team/lib/types/types/entities.d.ts +20 -3
- package/packages/agent-team/lib/types/types/entities.d.ts.map +1 -1
- package/packages/agent-team/lib/types/types/requests-results.d.ts +63 -0
- package/packages/agent-team/lib/types/types/requests-results.d.ts.map +1 -1
- package/packages/agent-team/preset/team-member/agent.cordis.yml +166 -0
- package/packages/client-agent-team/lib/client.js +1667 -516
- package/packages/client-agent-team/lib/client.js.map +1 -1
- package/packages/client-agent-team/lib/types/client/HumanSettingsSection.d.ts +15 -0
- package/packages/client-agent-team/lib/types/client/HumanSettingsSection.d.ts.map +1 -0
- package/packages/client-agent-team/lib/types/client/HumanSettingsSection.js +115 -0
- package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.js +12 -8
- package/packages/client-agent-team/lib/types/client/TeamAvatarStack.d.ts +22 -1
- package/packages/client-agent-team/lib/types/client/TeamAvatarStack.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamAvatarStack.js +25 -2
- package/packages/client-agent-team/lib/types/client/TeamChannelPage.d.ts +6 -1
- package/packages/client-agent-team/lib/types/client/TeamChannelPage.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamChannelPage.js +69 -31
- package/packages/client-agent-team/lib/types/client/TeamChannelsPanel.js +4 -4
- package/packages/client-agent-team/lib/types/client/TeamComposer.js +3 -3
- 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 +12 -5
- package/packages/client-agent-team/lib/types/client/TeamFooterAction.js +2 -2
- package/packages/client-agent-team/lib/types/client/TeamInboxPage.d.ts +4 -1
- package/packages/client-agent-team/lib/types/client/TeamInboxPage.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamInboxPage.js +22 -7
- package/packages/client-agent-team/lib/types/client/TeamMemberEditor.d.ts +11 -1
- package/packages/client-agent-team/lib/types/client/TeamMemberEditor.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamMemberEditor.js +69 -8
- package/packages/client-agent-team/lib/types/client/TeamMembersAction.js +2 -2
- package/packages/client-agent-team/lib/types/client/TeamMessage.d.ts +18 -3
- package/packages/client-agent-team/lib/types/client/TeamMessage.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamMessage.js +213 -67
- package/packages/client-agent-team/lib/types/client/TeamRowMenu.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamRowMenu.js +2 -2
- package/packages/client-agent-team/lib/types/client/TeamSidebarSection.js +2 -2
- package/packages/client-agent-team/lib/types/client/TeamThreadPage.d.ts +5 -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 +55 -29
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.js +3 -3
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceSelector.js +2 -2
- package/packages/client-agent-team/lib/types/client/avatar-image.d.ts +21 -0
- package/packages/client-agent-team/lib/types/client/avatar-image.d.ts.map +1 -0
- package/packages/client-agent-team/lib/types/client/avatar-image.js +9 -0
- package/packages/client-agent-team/lib/types/client/human-identity.d.ts +94 -0
- package/packages/client-agent-team/lib/types/client/human-identity.d.ts.map +1 -0
- package/packages/client-agent-team/lib/types/client/human-identity.js +117 -0
- package/packages/client-agent-team/lib/types/client/index.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/index.js +112 -41
- package/packages/client-agent-team/lib/types/client/locales.d.ts +72 -2
- package/packages/client-agent-team/lib/types/client/locales.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/locales.js +78 -2
- package/packages/client-agent-team/lib/types/client/multi-menu-field.js +2 -2
- package/packages/client-agent-team/lib/types/client/refs.d.ts +71 -0
- package/packages/client-agent-team/lib/types/client/refs.d.ts.map +1 -0
- package/packages/client-agent-team/lib/types/client/refs.js +181 -0
- package/packages/client-agent-team/lib/types/client/slots.d.ts +8 -2
- package/packages/client-agent-team/lib/types/client/slots.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/team-formatters.d.ts +57 -9
- 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 +85 -17
- package/packages/tool-agent-team/README.md +1 -1
- package/packages/tool-agent-team/README.zh.md +1 -1
- package/packages/tool-agent-team/lib/context-tools.js +20 -6
- package/packages/tool-agent-team/lib/index.js +2 -2
- package/packages/tool-agent-team/lib/types/context-tools.d.ts.map +1 -1
- package/packages/agent-team/lib/context-management.js +0 -371
- package/packages/agent-team/lib/types/context-management.d.ts +0 -154
- package/packages/agent-team/lib/types/context-management.d.ts.map +0 -1
- package/packages/client-agent-team/lib/types/client/task-refs.d.ts +0 -31
- package/packages/client-agent-team/lib/types/client/task-refs.d.ts.map +0 -1
- package/packages/client-agent-team/lib/types/client/task-refs.js +0 -99
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Agent Team's binding of the context-continuity engine: how one Member
|
|
3
|
+
* resolves to its live Agent and back, how a Member Session's fold state is
|
|
4
|
+
* read, how a prepared generation swap runs in the Member lifecycle, and the
|
|
5
|
+
* two domain dimensions the engine refuses to own (which queued messages are
|
|
6
|
+
* Team notices, and how a rollover's durable identity is named).
|
|
7
|
+
*
|
|
8
|
+
* The engine owns every mechanic this module does not state: the idle-boundary
|
|
9
|
+
* swap, carried input, checkpoint continuations, crash repair. Team owns the
|
|
10
|
+
* Member vocabulary and the ledger-backed lifecycle behind
|
|
11
|
+
* {@link TeamContextContinuityOptions.executeTransition}.
|
|
12
|
+
*
|
|
13
|
+
* The projection state this host hands the coordinator is the engine's own
|
|
14
|
+
* (`ContextProjectionState`), read from the unit `context-projection.ts`
|
|
15
|
+
* registers once per Host — one state shape, one fold, no translation.
|
|
16
|
+
* @module @wowyuarm/dsh-agent-team/context-continuity-host
|
|
17
|
+
*/
|
|
18
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
19
|
+
import type { SessionId } from '@deepseek-ai/dsh-session';
|
|
20
|
+
import type { UserMessage } from '@deepseek-ai/dsh-llm';
|
|
21
|
+
import { ContextContinuityCoordinator, ContextMessageCodec, type ContextContinuityHost, type ContextProjectionState, type ContextSubject, type RolloverIdentity, type TransitionPlan } from '@wowyuarm/dsh-context-continuity';
|
|
22
|
+
import type { AgentTeamAgentMember, AgentTeamMemberId } from './types.ts';
|
|
23
|
+
/**
|
|
24
|
+
* The one writer of context-continuity messages for Team. Section names are
|
|
25
|
+
* the engine's fixed vocabulary; only the plugin identity and the two
|
|
26
|
+
* subject-facing prose lines are Team's, and both are frozen by history —
|
|
27
|
+
* durable logs written by earlier generations are read back through this same
|
|
28
|
+
* identity, so `handoffIntro` and `handoffVerifyNote` reproduce them byte for
|
|
29
|
+
* byte.
|
|
30
|
+
*/
|
|
31
|
+
export declare const TEAM_CONTEXT_CODEC: ContextMessageCodec;
|
|
32
|
+
export interface TeamContextContinuityOptions {
|
|
33
|
+
/** Resolve the live Agent of one Member; undefined leaves intent parked. */
|
|
34
|
+
readonly agentForMember: (memberId: AgentTeamMemberId) => Agent | undefined;
|
|
35
|
+
/** Resolve the durable Member of one live Agent. */
|
|
36
|
+
readonly memberForAgent: (agent: Agent) => AgentTeamAgentMember | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Read one Member Session's engine-folded continuity state: the unit
|
|
39
|
+
* registered by `context-projection.ts`, or undefined when the Member has no
|
|
40
|
+
* live Session with that id (the coordinator leaves intent parked).
|
|
41
|
+
*/
|
|
42
|
+
readonly projectionForMember: (memberId: AgentTeamMemberId, sessionId: SessionId) => ContextProjectionState | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Execute one prepared Member generation swap at a true idle boundary:
|
|
45
|
+
* commit, dispose, archive, create/activate, deliver the handoff first,
|
|
46
|
+
* then carried input and the rederived Inbox. Returns once the Member runs
|
|
47
|
+
* its new generation.
|
|
48
|
+
*/
|
|
49
|
+
readonly executeTransition: (memberId: AgentTeamMemberId, plan: TransitionPlan) => Promise<void>;
|
|
50
|
+
/** Log one coordinator diagnostic. */
|
|
51
|
+
readonly log: (message: string) => void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Team's `ContextContinuityHost`. Every method is a straight delegation except
|
|
55
|
+
* the three that decide domain meaning: the durable rollover identity, which
|
|
56
|
+
* queued messages are rederived Team notices, and the projection bridge.
|
|
57
|
+
*/
|
|
58
|
+
export declare class TeamContextContinuityHost implements ContextContinuityHost<AgentTeamMemberId> {
|
|
59
|
+
private readonly options;
|
|
60
|
+
constructor(options: TeamContextContinuityOptions);
|
|
61
|
+
agentForSubject(memberId: AgentTeamMemberId): Agent | undefined;
|
|
62
|
+
subjectForAgent(agent: Agent): ContextSubject<AgentTeamMemberId> | undefined;
|
|
63
|
+
projectionForSubject(memberId: AgentTeamMemberId, sessionId: SessionId): ContextProjectionState | undefined;
|
|
64
|
+
executeTransition(memberId: AgentTeamMemberId, plan: TransitionPlan): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Rollover identity, unchanged from the in-repo coordinator: stable key over
|
|
67
|
+
* the previous Session and the successful tool call, JSON-encoded so no
|
|
68
|
+
* delimiter can alias across the two unconstrained fields, then hashed to a
|
|
69
|
+
* fixed-length digest. Both names are durable — in-flight recovery converges
|
|
70
|
+
* on `agent-team-rollover-<digest>`, and the ledger records the request id.
|
|
71
|
+
*/
|
|
72
|
+
rolloverIdentity(previousSessionId: SessionId, toolCallId: string): RolloverIdentity;
|
|
73
|
+
/**
|
|
74
|
+
* A queued message the successor generation rederives from ledger facts: any
|
|
75
|
+
* Team-attributed message. The engine excludes the handoff and continuation
|
|
76
|
+
* envelopes before consulting this, so the two are ordinary delivered
|
|
77
|
+
* context the next generation keeps.
|
|
78
|
+
*/
|
|
79
|
+
isEphemeralNotice(message: UserMessage): boolean;
|
|
80
|
+
log(message: string): void;
|
|
81
|
+
}
|
|
82
|
+
/** Build the engine coordinator over Team's Member lifecycle. */
|
|
83
|
+
export declare function createTeamContextManagement(options: TeamContextContinuityOptions): ContextContinuityCoordinator<AgentTeamMemberId>;
|
|
84
|
+
//# sourceMappingURL=context-continuity-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-continuity-host.d.ts","sourceRoot":"","sources":["../../src/context-continuity-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD,OAAO,EACL,4BAA4B,EAC5B,mBAAmB,EACnB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACpB,MAAM,kCAAkC,CAAA;AAGzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAmC,MAAM,YAAY,CAAA;AAE1G;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,qBAI7B,CAAA;AAEF,MAAM,WAAW,4BAA4B;IAC3C,4EAA4E;IAC5E,QAAQ,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,KAAK,GAAG,SAAS,CAAA;IAC3E,oDAAoD;IACpD,QAAQ,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,oBAAoB,GAAG,SAAS,CAAA;IAC3E;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,EAAE,CAAC,QAAQ,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,KAAK,sBAAsB,GAAG,SAAS,CAAA;IACvH;;;;;OAKG;IACH,QAAQ,CAAC,iBAAiB,EAAE,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAChG,sCAAsC;IACtC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,qBAAqB,CAAC,iBAAiB,CAAC;IAC5E,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,4BAA4B;IAElE,eAAe,CAAC,QAAQ,EAAE,iBAAiB,GAAG,KAAK,GAAG,SAAS;IAI/D,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,CAAC,iBAAiB,CAAC,GAAG,SAAS;IAM5E,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,GAAG,sBAAsB,GAAG,SAAS;IAI3G,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAInF;;;;;;OAMG;IACH,gBAAgB,CAAC,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,gBAAgB;IAQpF;;;;;OAKG;IACH,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO;IAKhD,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG3B;AAED,iEAAiE;AACjE,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,4BAA4B,GAAG,4BAA4B,CAAC,iBAAiB,CAAC,CAElI"}
|
|
@@ -1,160 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Team's projection contribution to the context-continuity engine: the durable
|
|
3
|
+
* ref naming, the Team-notice rule, and the domain judgement that decides which
|
|
4
|
+
* events anchor a timeline boundary and what each boundary is attributable to.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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.
|
|
6
|
+
* The fold itself is the engine's (`createContextProjectionDefinition`): one
|
|
7
|
+
* registered unit per Host folds every Session's durable log and owns the
|
|
8
|
+
* universal structure — checkpoints, the pending rollover intent, quiet
|
|
9
|
+
* continuation delivery, carry candidates, open calls, turn cursors. This
|
|
10
|
+
* module supplies only what the engine deliberately refuses to know:
|
|
13
11
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
12
|
+
* - the durable refs Team's existing logs already carry
|
|
13
|
+
* (`context-checkpoint-<sha256>`, `team-boundary-<sha256>`), frozen because
|
|
14
|
+
* recorded history is read back through them;
|
|
15
|
+
* - which queued messages are Team-owned notices the successor rederives;
|
|
16
|
+
* - which successful Team calls anchor a boundary, and which Threads each
|
|
17
|
+
* boundary is attributable to. A claim mutation resolves its Task's Thread
|
|
18
|
+
* through the ledger; that binding is written once at Task creation, so a
|
|
19
|
+
* re-fold reproduces the same attribution, and a missing ledger or mapping
|
|
20
|
+
* yields no attribution instead of failing the fold.
|
|
21
|
+
*
|
|
22
|
+
* The remaining exports are read views over the engine's state that Team still
|
|
23
|
+
* owns: the anchor lookups the rollover guard revalidates a cited ref through,
|
|
24
|
+
* the accumulated Thread attribution that guard and the timeline both judge a
|
|
25
|
+
* boundary by, and carried-message resolution — the engine keys carry
|
|
26
|
+
* candidates by message id, and the durable log is where the message body
|
|
27
|
+
* lives.
|
|
19
28
|
* @module @wowyuarm/dsh-agent-team/context-projection
|
|
20
29
|
*/
|
|
21
30
|
import type { UserMessage } from '@deepseek-ai/dsh-llm';
|
|
22
|
-
import type { SessionEvent
|
|
23
|
-
import type
|
|
24
|
-
import type { AgentTeamContextCheckpointRef } from './types.ts';
|
|
25
|
-
import { isCheckpointContinuationMessage } from './context-source.ts';
|
|
26
|
-
import type { SessionEventFold } from './session-event-cursor.ts';
|
|
31
|
+
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
32
|
+
import { CONTEXT_CHECKPOINT_TOOL_NAME, CONTEXT_ROLLOVER_TOOL_NAME, createContextProjectionDefinition, type ContextCheckpointEntry, type ContextFoldTarget, type ContextProjectionConfig, type ContextProjectionHost, type ContextProjectionState, type DomainBoundary, type DomainBoundaryContribution, type DomainBoundaryInput } from '@wowyuarm/dsh-context-continuity';
|
|
33
|
+
import type { AgentTeamContextCheckpointRef, AgentTeamTaskRef, AgentTeamThreadRef } from './types/entities.ts';
|
|
27
34
|
/** Whether one notice summary is a pure reminder (never a semantic Team fact). */
|
|
28
35
|
export declare function isReminderNoticeSummary(summary: string): boolean;
|
|
29
|
-
/** Stable tool names the
|
|
30
|
-
export
|
|
31
|
-
export declare const CONTEXT_ROLLOVER_TOOL_NAME = "context_rollover";
|
|
36
|
+
/** Stable tool names the fold recognizes under their current names. */
|
|
37
|
+
export { CONTEXT_CHECKPOINT_TOOL_NAME, CONTEXT_ROLLOVER_TOOL_NAME };
|
|
32
38
|
/**
|
|
33
39
|
* Legacy decoder name: the rollover tool was renamed `new_context` →
|
|
34
40
|
* `context_rollover`, and Sessions recorded before the rename still carry
|
|
35
|
-
* durable `new_context` call/result pairs. The
|
|
36
|
-
*
|
|
41
|
+
* durable `new_context` call/result pairs. The fold keeps decoding them —
|
|
42
|
+
* pending rollovers and crash recovery of existing Members depend on old
|
|
37
43
|
* events still resolving intent — but this is a log decoder, not a tool
|
|
38
44
|
* alias: no new call can carry the old name.
|
|
39
45
|
*/
|
|
40
46
|
export declare const NEW_CONTEXT_TOOL_NAME = "new_context";
|
|
41
|
-
/**
|
|
42
|
-
export
|
|
43
|
-
/** Opaque stable ref; selection authority, never derived from the name. */
|
|
44
|
-
readonly checkpointRef: AgentTeamContextCheckpointRef;
|
|
45
|
-
/** Display label supplied by the model. */
|
|
46
|
-
readonly name: string;
|
|
47
|
-
/** Seq of the successful tool result that recorded the checkpoint. */
|
|
48
|
-
readonly resultSeq: number;
|
|
49
|
-
/** Turn the checkpoint concluded; the completed-turn boundary anchor. */
|
|
50
|
-
readonly turn: number;
|
|
51
|
-
/** Seq of the `turn/end` that resolved the checkpoint; -1 until resolved. */
|
|
52
|
-
readonly turnEndSeq: number;
|
|
53
|
-
}
|
|
54
|
-
/** Arguments the model passed to one successful rollover call. */
|
|
55
|
-
export interface RolloverToolArguments {
|
|
56
|
-
readonly handoff: string;
|
|
57
|
-
readonly checkpointRef?: AgentTeamContextCheckpointRef | undefined;
|
|
58
|
-
readonly relatedFiles: readonly {
|
|
59
|
-
readonly path: string;
|
|
60
|
-
readonly reason: string;
|
|
61
|
-
}[];
|
|
62
|
-
}
|
|
63
|
-
/** Rollover intent waiting for the containing turn to finish and the Agent to idle. */
|
|
64
|
-
export interface PendingRolloverIntent extends RolloverToolArguments {
|
|
65
|
-
/** The provider-issued call id of the successful rollover call. */
|
|
66
|
-
readonly toolCallId: string;
|
|
67
|
-
/** Seq of the successful rollover tool result. */
|
|
68
|
-
readonly resultSeq: number;
|
|
69
|
-
/** Turn containing the successful call; the swap waits for its end. */
|
|
70
|
-
readonly turn: number;
|
|
71
|
-
/** Seq of the `turn/end` that released the intent for the swap; -1 until observed. */
|
|
72
|
-
readonly turnEndSeq: number;
|
|
73
|
-
}
|
|
74
|
-
/** Quiet-continuation delivery state for one checkpoint, keyed by checkpointRef. */
|
|
75
|
-
export interface ContinuationDeliveryState {
|
|
76
|
-
/** The checkpoint the continuation follows. */
|
|
77
|
-
readonly checkpointRef: AgentTeamContextCheckpointRef;
|
|
78
|
-
/** Seq of the delivered continuation notice in this Session; -1 until delivered. */
|
|
79
|
-
readonly deliveredSeq: number;
|
|
80
|
-
}
|
|
81
|
-
/** One non-Team message queued after the pending intent; a carry candidate. */
|
|
82
|
-
export interface CarriedCandidate {
|
|
83
|
-
/** The queued message itself, verbatim. */
|
|
84
|
-
readonly message: UserMessage;
|
|
85
|
-
/** The turn that surfaced the message onto the model-visible input, if any. */
|
|
86
|
-
readonly surfacedTurn: number;
|
|
87
|
-
/** Whether a completed assistant answer proved the old generation handled it. */
|
|
88
|
-
readonly consumed: boolean;
|
|
89
|
-
}
|
|
90
|
-
/** State of the `agentTeamContext` projection for one Session. */
|
|
91
|
-
export interface AgentTeamContextProjectionState {
|
|
92
|
-
/** Checkpoints recorded by a successful call, resolved ones anchored to their turn end. */
|
|
93
|
-
readonly checkpoints: readonly ContextCheckpointEntry[];
|
|
94
|
-
/** Rollover intent awaiting its containing turn end, at most one. */
|
|
95
|
-
readonly pending: PendingRolloverIntent | null;
|
|
96
|
-
/** Quiet continuations recorded (with or without delivery), keyed by checkpoint ref. */
|
|
97
|
-
readonly continuations: readonly ContinuationDeliveryState[];
|
|
98
|
-
/**
|
|
99
|
-
* Non-Team messages queued into the inbox after the pending intent's tool
|
|
100
|
-
* result. The durable `agent/inbox/spliced` log is the truth: the
|
|
101
|
-
* transition delivers every candidate the old generation never answered
|
|
102
|
-
* (a claimed-but-rejected or canceled message stays a candidate), deduped
|
|
103
|
-
* by message id. Empty until an intent exists.
|
|
104
|
-
*/
|
|
105
|
-
readonly carriedCandidates: readonly CarriedCandidate[];
|
|
106
|
-
/** The most recently opened turn; user/message events carry no turn of their own. */
|
|
107
|
-
readonly lastTurn: number;
|
|
108
|
-
/**
|
|
109
|
-
* Context-tool calls whose results have not landed yet. Part of the state so
|
|
110
|
-
* the live unit folds one event at a time and still pairs call to result; a
|
|
111
|
-
* dangling call at any cut simply never becomes intent or a checkpoint.
|
|
112
|
-
*/
|
|
113
|
-
readonly openCalls: readonly {
|
|
114
|
-
readonly callId: string;
|
|
115
|
-
readonly name: string;
|
|
116
|
-
readonly arguments: string;
|
|
117
|
-
}[];
|
|
118
|
-
/**
|
|
119
|
-
* Timeline boundaries beyond explicit checkpoints, resolved to their
|
|
120
|
-
* containing completed turn: handoff deliveries (each generation begins
|
|
121
|
-
* with one), compaction notices, and Team semantic facts that entered
|
|
122
|
-
* model context (successful claim-state tool results or structured Team
|
|
123
|
-
* notification delivery). Each is a structural timeline candidate with the
|
|
124
|
-
* same completed-turn anchor contract as a checkpoint.
|
|
125
|
-
*/
|
|
126
|
-
readonly boundaries: readonly TimelineBoundary[];
|
|
127
|
-
/**
|
|
128
|
-
* Threads whose first delivery already anchored a boundary. The first
|
|
129
|
-
* arrival of a Thread's facts is the one preserved push-face anchor; every
|
|
130
|
-
* later re-delivery of the same Thread is noise and produces no boundary.
|
|
131
|
-
* Fold-internal by design: cold and live folds replay it identically from
|
|
132
|
-
* the event log, so no query-time rescan exists.
|
|
133
|
-
*/
|
|
134
|
-
readonly seenThreads: readonly string[];
|
|
135
|
-
/** Seq of the latest resolved `turn/end`; the head boundary of the timeline. */
|
|
136
|
-
readonly lastTurnEndSeq: number;
|
|
137
|
-
}
|
|
138
|
-
/** One non-checkpoint timeline candidate resolved at a completed turn. */
|
|
139
|
-
export interface TimelineBoundary {
|
|
140
|
-
/** Stable identity for the timeline: kind plus the anchoring event seq. */
|
|
141
|
-
readonly key: string;
|
|
142
|
-
/** Which structural source produced this boundary. */
|
|
143
|
-
readonly source: 'team-boundary' | 'handoff' | 'compaction';
|
|
144
|
-
/** Human-facing label derived from the boundary's own data. */
|
|
145
|
-
readonly label: string;
|
|
146
|
-
/** Seq of the boundary's own anchoring event (delivery or tool result). */
|
|
147
|
-
readonly seq: number;
|
|
148
|
-
/** Turn the boundary landed in. */
|
|
149
|
-
readonly turn: number;
|
|
150
|
-
/** Seq of the `turn/end` that resolved it; -1 until resolved. */
|
|
151
|
-
readonly turnEndSeq: number;
|
|
152
|
-
}
|
|
153
|
-
declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
154
|
-
interface SessionProjectionStateMap {
|
|
155
|
-
agentTeamContext: AgentTeamContextProjectionState;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
47
|
+
/** Every recorded tool name a rollover call may carry, current name first. */
|
|
48
|
+
export declare const TEAM_ROLLOVER_TOOL_NAMES: readonly string[];
|
|
158
49
|
/**
|
|
159
50
|
* Deterministic checkpoint ref from the recording session and tool call
|
|
160
51
|
* identity: a bounded, collision-resistant opaque token. Provider call ids
|
|
@@ -166,8 +57,8 @@ declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
|
166
57
|
*/
|
|
167
58
|
export declare function checkpointRefFor(sessionId: string, callId: string): AgentTeamContextCheckpointRef;
|
|
168
59
|
/**
|
|
169
|
-
* Deterministic
|
|
170
|
-
*
|
|
60
|
+
* Deterministic boundary ref for one delivered Team boundary: the same
|
|
61
|
+
* session-scoped hash shape as checkpoint refs, keyed on the boundary's
|
|
171
62
|
* anchoring event seq. Consecutive generations routinely repeat event seqs,
|
|
172
63
|
* so the Session identity must be part of the key or two generations'
|
|
173
64
|
* boundaries at the same seq collide — the timeline would silently drop the
|
|
@@ -175,53 +66,107 @@ export declare function checkpointRefFor(sessionId: string, callId: string): Age
|
|
|
175
66
|
*/
|
|
176
67
|
export declare function boundaryRefFor(sessionId: string, seq: number): AgentTeamContextCheckpointRef;
|
|
177
68
|
/**
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* provider call id in two different Sessions produces two distinct refs.
|
|
69
|
+
* Whether one queued message is a Team-owned notice the rederived Inbox
|
|
70
|
+
* replaces. Handoff and continuation envelopes carry the same plugin
|
|
71
|
+
* attribution but are ordinary delivered context the new generation keeps, so
|
|
72
|
+
* they are excluded rather than dropped.
|
|
183
73
|
*/
|
|
184
|
-
export declare function
|
|
74
|
+
export declare function isTeamNotice(message: UserMessage): boolean;
|
|
75
|
+
/** What Team's fold needs from the rest of the Host. */
|
|
76
|
+
export interface TeamContextProjectionOptions {
|
|
77
|
+
/**
|
|
78
|
+
* Resolve the Thread one Task's facts belong to, for claim-boundary
|
|
79
|
+
* attribution. Absent (or returning undefined) leaves the boundary
|
|
80
|
+
* unattributed: it still anchors the timeline, it is simply not selectable
|
|
81
|
+
* as a single-Thread return target.
|
|
82
|
+
*/
|
|
83
|
+
readonly threadForTask?: (taskRef: AgentTeamTaskRef) => AgentTeamThreadRef | undefined;
|
|
84
|
+
}
|
|
185
85
|
/**
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* depend on which of the two read it.
|
|
86
|
+
* Team's domain half of the context-continuity projection. Every method is a
|
|
87
|
+
* pure judgement over the event the engine hands it plus Team's own durable
|
|
88
|
+
* vocabulary; the engine keeps the state machine.
|
|
190
89
|
*/
|
|
191
|
-
export declare
|
|
90
|
+
export declare class TeamContextProjectionHost implements ContextProjectionHost {
|
|
91
|
+
private readonly options;
|
|
92
|
+
constructor(options?: TeamContextProjectionOptions);
|
|
93
|
+
/** Durable checkpoint ref: Team's existing log vocabulary, unchanged. */
|
|
94
|
+
checkpointRefFor(sessionId: string, toolCallId: string): AgentTeamContextCheckpointRef;
|
|
95
|
+
/** Durable boundary ref: the same session-scoped hash shape. */
|
|
96
|
+
boundaryRefFor(sessionId: string, seq: number): AgentTeamContextCheckpointRef;
|
|
97
|
+
/** A Team-owned notice the successor generation rederives from ledger facts. */
|
|
98
|
+
isEphemeralNotice(message: UserMessage): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Only a Team-effect call that can produce a boundary is tracked at all:
|
|
101
|
+
* `list` on a claim, `read` on a Thread, and `dm` are not semantic timeline
|
|
102
|
+
* candidates, so their results must never open an anchor.
|
|
103
|
+
*/
|
|
104
|
+
tracksCall(name: string, raw: string): boolean;
|
|
105
|
+
/** Team's boundary for one event, or undefined when the event anchors nothing. */
|
|
106
|
+
domainBoundaryOf(input: DomainBoundaryInput): DomainBoundaryContribution | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Structural boundary from one delivered user message: a rollover handoff
|
|
109
|
+
* starts a generation; a compaction notice rewrites the visible surface. A
|
|
110
|
+
* structured Team notification is a boundary ONLY on the first arrival of
|
|
111
|
+
* each Thread's facts into this Session — the preserved "work just arrived"
|
|
112
|
+
* anchor; every later re-delivery of the same Thread is noise. Reminder
|
|
113
|
+
* notices (progress nudges, recovery instructions) never anchor. Plain
|
|
114
|
+
* Human/agent prose and quiet checkpoint continuations are not boundaries.
|
|
115
|
+
*/
|
|
116
|
+
private boundaryFromUserMessage;
|
|
117
|
+
/**
|
|
118
|
+
* Effect boundary from one successful Team-effect call — the attribution
|
|
119
|
+
* matrix: claim mutation → the Thread its Task was created in (resolved
|
|
120
|
+
* through the ledger, whose binding is immutable); team_message committed →
|
|
121
|
+
* the Thread from the call arguments or, for a start, from the structured
|
|
122
|
+
* presentation meta (`kind === 'committed'` guards every typed rejection; no
|
|
123
|
+
* meta means no boundary — old logs refold without start anchors by design,
|
|
124
|
+
* never by parsing render text); team_thread follow/unfollow → the threadRef
|
|
125
|
+
* from its call arguments. An unresolvable attribution leaves the boundary
|
|
126
|
+
* anchored but not single-Thread selectable.
|
|
127
|
+
*/
|
|
128
|
+
private boundaryFromToolResult;
|
|
129
|
+
}
|
|
192
130
|
/**
|
|
193
|
-
* The
|
|
194
|
-
*
|
|
195
|
-
*
|
|
131
|
+
* The engine fold configured for Team: the codec Team's durable envelopes are
|
|
132
|
+
* written with, Team's projection host, and every recorded rollover name
|
|
133
|
+
* (current and legacy). One config drives both the registered unit and every
|
|
134
|
+
* cold fold, so a replayed log and the live unit converge on one state.
|
|
196
135
|
*/
|
|
197
|
-
export declare
|
|
198
|
-
/**
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
/** Semantic label: the model-supplied checkpoint name or the boundary label. */
|
|
210
|
-
readonly label: string;
|
|
211
|
-
/** Which structural source produced this candidate. */
|
|
212
|
-
readonly source: 'agent' | 'team-boundary' | 'handoff' | 'compaction' | 'head';
|
|
213
|
-
/** Seq of the anchoring event (the tool result or delivery message). */
|
|
214
|
-
readonly seq: number;
|
|
215
|
-
/** Seq of the completed `turn/end` that resolved the candidate; -1 while unresolved. */
|
|
216
|
-
readonly turnEndSeq: number;
|
|
217
|
-
}
|
|
136
|
+
export declare function createTeamContextProjectionConfig(host: ContextProjectionHost): ContextProjectionConfig;
|
|
137
|
+
/**
|
|
138
|
+
* Cold-fold one immutable Team Session log through the engine's fold with
|
|
139
|
+
* Team's config. The registered unit uses the same config, so the two agree.
|
|
140
|
+
*/
|
|
141
|
+
export declare function foldTeamContextProjection(events: readonly SessionEvent[], target: ContextFoldTarget, host?: ContextProjectionHost): ContextProjectionState;
|
|
142
|
+
/**
|
|
143
|
+
* The host-only projection unit for Team Members. Register it **once per
|
|
144
|
+
* Host**: the framework keeps one unit per projection key and drives it for
|
|
145
|
+
* every Session, so the definition closes over no Session identity.
|
|
146
|
+
*/
|
|
147
|
+
export declare function createTeamContextProjectionDefinition(host: ContextProjectionHost): ReturnType<typeof createContextProjectionDefinition>;
|
|
218
148
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
149
|
+
* The Threads Team's own fold attributed to boundaries resolved by one
|
|
150
|
+
* completed turn, order-stable and deduplicated: a delivered notice's first
|
|
151
|
+
* arrival, a claim mutation's Task→Thread binding, a committed Thread effect.
|
|
152
|
+
*
|
|
153
|
+
* This is the accumulated attribution of the RETAINED PREFIX through that
|
|
154
|
+
* turn, and it is one set with two readers — the timeline publishes it as the
|
|
155
|
+
* item's affected Threads, and the rollover guard refuses a boundary whose
|
|
156
|
+
* prefix spans more than one Thread, so a ref the timeline offers is a ref
|
|
157
|
+
* `context_rollover` accepts.
|
|
223
158
|
*/
|
|
224
|
-
export declare function
|
|
159
|
+
export declare function retainedTopicsThrough(state: ContextProjectionState, turnEndSeq: number): readonly string[];
|
|
225
160
|
/** Find one resolved checkpoint entry by its stable ref, if it exists. */
|
|
226
|
-
export declare function checkpointByRef(state:
|
|
161
|
+
export declare function checkpointByRef(state: ContextProjectionState, checkpointRef: string): ContextCheckpointEntry | undefined;
|
|
162
|
+
/** Whether one engine-held boundary is the recorded anchor of `ref` in this state's Session. */
|
|
163
|
+
export declare function boundaryByRef(state: ContextProjectionState, ref: string): DomainBoundary | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* The carried input one transition must deliver: unconsumed post-intent
|
|
166
|
+
* candidates in queue order, resolved to their durable message bodies. The
|
|
167
|
+
* engine keys carry candidates by message id (that is what the transition
|
|
168
|
+
* dedupes on); the `agent/inbox/spliced` events that recorded them are where
|
|
169
|
+
* the message itself lives, so the log stays the only authority.
|
|
170
|
+
*/
|
|
171
|
+
export declare function carriedInputOf(state: ContextProjectionState, events: readonly SessionEvent[]): readonly UserMessage[];
|
|
227
172
|
//# sourceMappingURL=context-projection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-projection.d.ts","sourceRoot":"","sources":["../../src/context-projection.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"context-projection.d.ts","sourceRoot":"","sources":["../../src/context-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,iCAAiC,EAEjC,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACzB,MAAM,kCAAkC,CAAA;AAGzC,OAAO,KAAK,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AA8C9G,kFAAkF;AAClF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED,uEAAuE;AACvE,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,CAAA;AAEnE;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,gBAAgB,CAAA;AAElD,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAAwD,CAAA;AAE9G;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,6BAA6B,CAEjG;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,6BAA6B,CAE5F;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAG1D;AAyDD,wDAAwD;AACxD,MAAM,WAAW,4BAA4B;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,kBAAkB,GAAG,SAAS,CAAA;CACvF;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,qBAAqB;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,GAAE,4BAAiC;IAEvE,yEAAyE;IACzE,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,6BAA6B;IAItF,gEAAgE;IAChE,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,6BAA6B;IAI7E,gFAAgF;IAChF,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO;IAIhD;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAO9C,kFAAkF;IAClF,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,GAAG,0BAA0B,GAAG,SAAS;IAMpF;;;;;;;;OAQG;IACH,OAAO,CAAC,uBAAuB;IAwB/B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,sBAAsB;CAyB/B;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,qBAAqB,GAAG,uBAAuB,CAOtG;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,MAAM,EAAE,iBAAiB,EACzB,IAAI,GAAE,qBAAuD,GAC5D,sBAAsB,CAExB;AAED;;;;GAIG;AACH,wBAAgB,qCAAqC,CAAC,IAAI,EAAE,qBAAqB,GAAG,UAAU,CAAC,OAAO,iCAAiC,CAAC,CAEvI;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAS1G;AAED,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS,CAExH;AAED,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,KAAK,EAAE,sBAAsB,EAAE,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAEpG;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,sBAAsB,EAAE,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,WAAW,EAAE,CAcrH"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Plugin-attributed message sources for Agent Team context management.
|
|
3
3
|
*
|
|
4
|
-
* Both sources ride ordinary `UserMessage`s under
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Both sources ride ordinary `UserMessage`s under the shipped `plugin` kind
|
|
5
|
+
* with the `snapshot` context form — the same shape the Harness's own
|
|
6
|
+
* system-prompt producer writes. This module declares no `MessageSourceMap`
|
|
7
|
+
* member of its own, and carries no bespoke source members: Session format
|
|
8
|
+
* migration validates a `plugin` source against a closed member list
|
|
9
|
+
* (`kind`, `plugin`, `form`, `sections`, `summary`), and refuses every logged
|
|
10
|
+
* Session that carries anything else. A plugin-declared kind is type-legal yet
|
|
11
|
+
* refused the same way. See `docs/dsh-release-compatibility.md`
|
|
8
12
|
* § "Session message sources".
|
|
9
13
|
*
|
|
10
14
|
* Everything the Host needs to read back therefore rides the admitted payload
|
|
@@ -15,55 +19,19 @@
|
|
|
15
19
|
* snapshot-aware surface.
|
|
16
20
|
*
|
|
17
21
|
* The validators below are the single place that recognizes these messages, so
|
|
18
|
-
* callers never match on localized body text.
|
|
22
|
+
* callers never match on localized body text. Writing them belongs to the
|
|
23
|
+
* context-continuity engine's codec, which Team constructs with its own plugin
|
|
24
|
+
* identity and prose (`context-continuity-host.ts`): one writer, so the
|
|
25
|
+
* envelope Team reads back can never drift from the one it wrote.
|
|
19
26
|
* @module @wowyuarm/dsh-agent-team/context-source
|
|
20
27
|
*/
|
|
21
|
-
import type {
|
|
22
|
-
/**
|
|
28
|
+
import type { ContextSnapshotSection, UserMessage } from '@deepseek-ai/dsh-llm';
|
|
29
|
+
/** Plugin identity attributing every Agent Team message source. */
|
|
23
30
|
export declare const AGENT_TEAM_PLUGIN_ID = "@wowyuarm/dsh-agent-team";
|
|
24
|
-
/**
|
|
25
|
-
* The kind the Harness's V4 read-time conversion renames this plugin's
|
|
26
|
-
* released V3 `plugin` sources into: `plugin:` + the producer id, with the
|
|
27
|
-
* `plugin` key dropped and every payload field (`form`, `sections`,
|
|
28
|
-
* `summary`) preserved. History read through the new line carries exactly
|
|
29
|
-
* this shape, so the read side recognizes both identities below.
|
|
30
|
-
*/
|
|
31
|
-
export declare const AGENT_TEAM_V3_RENAMED_KIND = "plugin:@wowyuarm/dsh-agent-team";
|
|
32
|
-
declare module '@deepseek-ai/dsh-llm' {
|
|
33
|
-
interface MessageSourceMap {
|
|
34
|
-
/** The kind this plugin writes now; V4 admission requires a producer-owned kind. */
|
|
35
|
-
[AGENT_TEAM_PLUGIN_ID]: {
|
|
36
|
-
kind: typeof AGENT_TEAM_PLUGIN_ID;
|
|
37
|
-
} & ContextFormed;
|
|
38
|
-
/** The converted shape of this plugin's released V3 history; read-side only. */
|
|
39
|
-
[AGENT_TEAM_V3_RENAMED_KIND]: {
|
|
40
|
-
kind: typeof AGENT_TEAM_V3_RENAMED_KIND;
|
|
41
|
-
} & ContextFormed;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/** The source shapes carrying this plugin's attribution: its current kind and the read-time conversion of its V3 history. */
|
|
45
|
-
export type AgentTeamMessageSource = Extract<MessageSource, {
|
|
46
|
-
kind: typeof AGENT_TEAM_PLUGIN_ID | typeof AGENT_TEAM_V3_RENAMED_KIND;
|
|
47
|
-
}>;
|
|
48
|
-
/** The kind the read-time conversion renames one producer's released V3 sources into. */
|
|
49
|
-
export declare const v3RenamedSourceKind: <const P extends string>(producer: P) => `plugin:${P}`;
|
|
50
|
-
/**
|
|
51
|
-
* Whether one message source carries this plugin's own attribution. Both
|
|
52
|
-
* identities are matched by exact kind equality — never by a `plugin:`
|
|
53
|
-
* prefix test, which would claim third-party producers' rows as Team facts.
|
|
54
|
-
*/
|
|
55
|
-
export declare function isAgentTeamSource(source: MessageSource): source is AgentTeamMessageSource;
|
|
56
|
-
/**
|
|
57
|
-
* Whether one source kind carries this plugin's attribution, for call sites
|
|
58
|
-
* whose sources arrive untyped. Exact identities only, never a prefix test.
|
|
59
|
-
*/
|
|
60
|
-
export declare function isAgentTeamSourceKind(kind: string | undefined): boolean;
|
|
61
31
|
/** Handoff snapshot section name carrying the model-authored prose. */
|
|
62
32
|
export declare const HANDOFF_SECTION_NAME = "HANDOFF";
|
|
63
33
|
/** Stable section name marking a checkpoint continuation and carrying its ref. */
|
|
64
34
|
export declare const CHECKPOINT_SECTION_NAME = "Checkpoint";
|
|
65
|
-
/** Fixed text of the quiet checkpoint continuation delivered on the next turn. */
|
|
66
|
-
export declare const CHECKPOINT_CONTINUATION_TEXT = "A context checkpoint was recorded at the end of the previous turn. Continue the work you were doing.";
|
|
67
35
|
/**
|
|
68
36
|
* The rollover handoff envelope: the model-authored prose plus the verifiable
|
|
69
37
|
* Host facts, all as named snapshot contributions.
|
|
@@ -84,38 +52,6 @@ export interface AgentTeamContextHandoff {
|
|
|
84
52
|
/** Named contributions, starting with the model-authored handoff prose. */
|
|
85
53
|
readonly sections: readonly ContextSnapshotSection[];
|
|
86
54
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Build the first model-facing context of one rollover generation. The Host
|
|
89
|
-
* owns only the verifiable envelope; the prose is the Member's own handoff.
|
|
90
|
-
*
|
|
91
|
-
* The envelope sections are additive structure, not the only carrier of these
|
|
92
|
-
* facts: {@link handoffBody} already states them in the model-facing text, so a
|
|
93
|
-
* surface that renders only the body loses nothing.
|
|
94
|
-
*/
|
|
95
|
-
export declare function createHandoffMessage(input: {
|
|
96
|
-
readonly handoff: string;
|
|
97
|
-
readonly previousSessionId: string;
|
|
98
|
-
readonly newSessionId: string;
|
|
99
|
-
readonly trigger: 'model' | 'pressure';
|
|
100
|
-
readonly handoffEventSeq: number;
|
|
101
|
-
readonly checkpointRef?: string;
|
|
102
|
-
readonly relatedFiles?: readonly {
|
|
103
|
-
readonly path: string;
|
|
104
|
-
readonly reason?: string;
|
|
105
|
-
}[];
|
|
106
|
-
}): UserMessage;
|
|
107
|
-
/**
|
|
108
|
-
* Build the quiet follow-up that continues work after an explicit checkpoint
|
|
109
|
-
* concluded its turn. Delivery is scheduled only after the checkpoint's
|
|
110
|
-
* successful tool result is durable, so a result-render failure can never
|
|
111
|
-
* leave a ghost continuation behind.
|
|
112
|
-
*
|
|
113
|
-
* This is a `snapshot` rather than a `notice` for one reason: the projection
|
|
114
|
-
* must read the checkpoint ref back out of the durable log to record delivery,
|
|
115
|
-
* and `sections` is the only admitted payload slot that carries structure. A
|
|
116
|
-
* notice would have forced the ref into its human-readable one-line summary.
|
|
117
|
-
*/
|
|
118
|
-
export declare function createCheckpointContinuationMessage(checkpointRef: string): UserMessage;
|
|
119
55
|
/**
|
|
120
56
|
* The rollover handoff one message carries, when it is one.
|
|
121
57
|
* @param message - candidate user message.
|
|
@@ -139,8 +75,8 @@ export declare function isCheckpointContinuationMessage(message: UserMessage, ch
|
|
|
139
75
|
*/
|
|
140
76
|
export declare function isAgentTeamContextSource(message: UserMessage): boolean;
|
|
141
77
|
/** Envelope section names; stable, because they are read back from the log.
|
|
142
|
-
*
|
|
143
|
-
*
|
|
78
|
+
* Exported for the legacy-artifact remediation, which rewrites pre-0.1.10
|
|
79
|
+
* envelopes into exactly these names — one shared vocabulary, no drift. */
|
|
144
80
|
export declare const HANDOFF_PREVIOUS_SESSION = "Previous session";
|
|
145
81
|
export declare const HANDOFF_NEW_SESSION = "New session";
|
|
146
82
|
export declare const HANDOFF_TRIGGER = "Trigger";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-source.d.ts","sourceRoot":"","sources":["../../src/context-source.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"context-source.d.ts","sourceRoot":"","sources":["../../src/context-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAE/E,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,6BAA6B,CAAA;AAE9D,uEAAuE;AACvE,eAAO,MAAM,oBAAoB,YAAY,CAAA;AAE7C,kFAAkF;AAClF,eAAO,MAAM,uBAAuB,eAAe,CAAA;AAEnD;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,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,CAAA;CACrD;AAsCD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,uBAAuB,GAAG,SAAS,CAwBnF;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAKpF;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAE9D;AAED,4FAA4F;AAC5F,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,WAAW,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAGrG;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAEtE;AAED;;2EAE2E;AAC3E,eAAO,MAAM,wBAAwB,qBAAqB,CAAA;AAC1D,eAAO,MAAM,mBAAmB,gBAAgB,CAAA;AAChD,eAAO,MAAM,eAAe,YAAY,CAAA;AACxC,eAAO,MAAM,iBAAiB,sBAAsB,CAAA;AACpD,eAAO,MAAM,kBAAkB,8BAA8B,CAAA;AAC7D,eAAO,MAAM,qBAAqB,kBAAkB,CAAA"}
|