@wowyuarm/dsh-agent-team 0.1.9 → 0.1.11
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 +17 -11
- package/README.zh.md +17 -11
- package/package.json +61 -47
- package/packages/agent-team/README.md +6 -4
- package/packages/agent-team/README.zh.md +6 -3
- package/packages/agent-team/lib/context-management.js +48 -55
- package/packages/agent-team/lib/context-projection.js +22 -8
- package/packages/agent-team/lib/context-source.js +163 -23
- package/packages/agent-team/lib/index.js +349 -176
- package/packages/agent-team/lib/invariant.js +38 -4
- package/packages/agent-team/lib/ledger.js +658 -294
- package/packages/agent-team/lib/member-context.js +6 -2
- package/packages/agent-team/lib/member-time-context.js +141 -0
- package/packages/agent-team/lib/pressure-policy.js +34 -11
- package/packages/agent-team/lib/progress-nudge.js +12 -4
- package/packages/agent-team/lib/session-event-cursor.js +116 -0
- package/packages/agent-team/lib/session-remediation.js +493 -0
- package/packages/agent-team/lib/spec.js +49 -36
- package/packages/agent-team/lib/stored-session-reader.js +138 -0
- package/packages/agent-team/lib/time-format.js +56 -0
- package/packages/agent-team/lib/typert.host.js +163 -63
- package/packages/agent-team/lib/typert.remote-client.d.ts.map +1 -1
- package/packages/agent-team/lib/typert.remote-client.js +105 -32
- package/packages/agent-team/lib/types/context-management.d.ts +13 -1
- package/packages/agent-team/lib/types/context-management.d.ts.map +1 -1
- package/packages/agent-team/lib/types/context-projection.d.ts +8 -0
- package/packages/agent-team/lib/types/context-projection.d.ts.map +1 -1
- package/packages/agent-team/lib/types/context-source.d.ts +70 -36
- package/packages/agent-team/lib/types/context-source.d.ts.map +1 -1
- package/packages/agent-team/lib/types/index.d.ts +110 -9
- package/packages/agent-team/lib/types/index.d.ts.map +1 -1
- package/packages/agent-team/lib/types/invariant.d.ts.map +1 -1
- package/packages/agent-team/lib/types/ledger.d.ts +205 -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-time-context.d.ts +83 -0
- package/packages/agent-team/lib/types/member-time-context.d.ts.map +1 -0
- package/packages/agent-team/lib/types/pressure-policy.d.ts +18 -0
- package/packages/agent-team/lib/types/pressure-policy.d.ts.map +1 -1
- package/packages/agent-team/lib/types/progress-nudge.d.ts.map +1 -1
- package/packages/agent-team/lib/types/session-event-cursor.d.ts +119 -0
- package/packages/agent-team/lib/types/session-event-cursor.d.ts.map +1 -0
- 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/spec.d.ts.map +1 -1
- package/packages/agent-team/lib/types/stored-session-reader.d.ts +92 -0
- package/packages/agent-team/lib/types/stored-session-reader.d.ts.map +1 -0
- package/packages/agent-team/lib/types/time-format.d.ts +28 -0
- package/packages/agent-team/lib/types/time-format.d.ts.map +1 -0
- package/packages/agent-team/lib/types/types/entities.d.ts +36 -2
- package/packages/agent-team/lib/types/types/entities.d.ts.map +1 -1
- package/packages/agent-team/lib/types/types/operations.d.ts +45 -19
- package/packages/agent-team/lib/types/types/operations.d.ts.map +1 -1
- package/packages/agent-team/lib/types/types/requests-results.d.ts +50 -3
- package/packages/agent-team/lib/types/types/requests-results.d.ts.map +1 -1
- package/packages/agent-team/preset/team-member/agent.cordis.yml +21 -4
- package/packages/client-agent-team/README.md +1 -1
- package/packages/client-agent-team/README.zh.md +1 -1
- package/packages/client-agent-team/lib/client.js +1121 -402
- package/packages/client-agent-team/lib/client.js.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.js +24 -4
- package/packages/client-agent-team/lib/types/client/TeamChannelPage.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamChannelPage.js +42 -22
- package/packages/client-agent-team/lib/types/client/TeamChannelsPanel.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamChannelsPanel.js +13 -24
- package/packages/client-agent-team/lib/types/client/TeamComposer.d.ts +11 -5
- package/packages/client-agent-team/lib/types/client/TeamComposer.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamComposer.js +15 -9
- 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 +8 -1
- package/packages/client-agent-team/lib/types/client/TeamInboxPage.d.ts +21 -0
- package/packages/client-agent-team/lib/types/client/TeamInboxPage.d.ts.map +1 -0
- package/packages/client-agent-team/lib/types/client/TeamInboxPage.js +71 -0
- package/packages/client-agent-team/lib/types/client/TeamMemberEditor.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamMemberEditor.js +8 -24
- package/packages/client-agent-team/lib/types/client/TeamMessage.d.ts +9 -2
- package/packages/client-agent-team/lib/types/client/TeamMessage.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamMessage.js +13 -6
- package/packages/client-agent-team/lib/types/client/TeamPresenceDot.d.ts +8 -0
- package/packages/client-agent-team/lib/types/client/TeamPresenceDot.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamPresenceDot.js +21 -1
- package/packages/client-agent-team/lib/types/client/TeamThreadPage.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamThreadPage.js +106 -32
- 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 +50 -7
- package/packages/client-agent-team/lib/types/client/index.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/index.js +25 -9
- package/packages/client-agent-team/lib/types/client/locales.d.ts +18 -0
- package/packages/client-agent-team/lib/types/client/locales.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/locales.js +18 -0
- package/packages/client-agent-team/lib/types/client/navigation.d.ts +10 -0
- package/packages/client-agent-team/lib/types/client/navigation.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/navigation.js +18 -7
- package/packages/client-agent-team/lib/types/client/scope-coverage.d.ts +41 -0
- package/packages/client-agent-team/lib/types/client/scope-coverage.d.ts.map +1 -0
- package/packages/client-agent-team/lib/types/client/scope-coverage.js +64 -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-changes.d.ts +26 -1
- package/packages/client-agent-team/lib/types/client/team-changes.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/team-changes.js +66 -15
- package/packages/client-agent-team/lib/types/client/team-dialog-save.d.ts +20 -0
- package/packages/client-agent-team/lib/types/client/team-dialog-save.d.ts.map +1 -0
- package/packages/client-agent-team/lib/types/client/team-dialog-save.js +36 -0
- package/packages/client-agent-team/lib/types/client/team-formatters.d.ts +9 -0
- 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 +34 -6
- package/packages/tool-agent-team/README.md +8 -6
- package/packages/tool-agent-team/README.zh.md +8 -6
- package/packages/tool-agent-team/lib/context-tools.js +18 -14
- package/packages/tool-agent-team/lib/host-access.js +20 -0
- package/packages/tool-agent-team/lib/index.js +314 -123
- package/packages/tool-agent-team/lib/types/context-tools.d.ts.map +1 -1
- package/packages/tool-agent-team/lib/types/host-access.d.ts +14 -0
- package/packages/tool-agent-team/lib/types/host-access.d.ts.map +1 -0
- package/packages/tool-agent-team/lib/types/index.d.ts.map +1 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Incremental Session-log fold with an identity guard.
|
|
3
|
+
*
|
|
4
|
+
* Several Host projections are pure left folds over one Member Session's own
|
|
5
|
+
* events: context intent, the clock baseline, and the one-shot pressure
|
|
6
|
+
* notice. Folding the whole log on every event makes each of them cost
|
|
7
|
+
* O(session length) per step, so a long Session gets steadily slower. This
|
|
8
|
+
* module keeps the fold value together with how far it has consumed the log,
|
|
9
|
+
* so a step folds only the tail that arrived since — the same idiom the
|
|
10
|
+
* Harness Session itself uses for its own derived folds.
|
|
11
|
+
*
|
|
12
|
+
* The module is deliberately Session-agnostic: it takes a plain event array
|
|
13
|
+
* plus the log offset that array starts at, so a caller (including a
|
|
14
|
+
* measurement harness) can drive it without constructing a Session.
|
|
15
|
+
*
|
|
16
|
+
* Correctness rests on the log being append-only, which it is: Session logs
|
|
17
|
+
* have no truncation API, `seq` is the log index, and `seq === log.length` is
|
|
18
|
+
* a documented contiguity contract. A Session adopts a different log only by
|
|
19
|
+
* being constructed from another seed, which replaces the whole slice rather
|
|
20
|
+
* than editing one position.
|
|
21
|
+
*
|
|
22
|
+
* The guard covers the observable ways that contract can break: a changed
|
|
23
|
+
* `logFrom`, a shorter log, a different event type at the anchor. Each
|
|
24
|
+
* re-folds from `logFrom`, so a fork, resume, or rollover degrades to the cost
|
|
25
|
+
* of a cold fold and never to a wrong picture.
|
|
26
|
+
*
|
|
27
|
+
* Named residual: the guard anchors on `(seq, type)`, so an event replaced in
|
|
28
|
+
* place by another of the SAME type at the SAME seq is not detected, and the
|
|
29
|
+
* cursor would keep its old value and fold only the tail. Reaching that state
|
|
30
|
+
* requires a caller to violate the append-only contract above — reading one
|
|
31
|
+
* Session's cursor against a log someone rewrote in place. A content-sensitive
|
|
32
|
+
* anchor would not close it either: only the anchor position is re-read, so a
|
|
33
|
+
* swap at any earlier folded position passes a boundary digest just as
|
|
34
|
+
* silently, while costing a payload digest on every advance. Closing it
|
|
35
|
+
* properly means fingerprinting every folded event, which is the full refold
|
|
36
|
+
* this module exists to avoid; if the contract ever changes, that is the fix.
|
|
37
|
+
* @module @wowyuarm/dsh-agent-team/session-event-cursor
|
|
38
|
+
*/
|
|
39
|
+
/** The minimum event shape the cursor reads: identity and position, never payload. */
|
|
40
|
+
export interface SessionCursorEvent {
|
|
41
|
+
readonly seq: number;
|
|
42
|
+
readonly type: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* One fold expressed as the two pure functions the cursor needs. `start` is
|
|
46
|
+
* the value of an empty log; `step` returns the same reference when the event
|
|
47
|
+
* is not this fold's business, so uninterested events cost nothing.
|
|
48
|
+
*/
|
|
49
|
+
export interface SessionEventFold<S, E extends SessionCursorEvent = SessionCursorEvent> {
|
|
50
|
+
readonly start: S;
|
|
51
|
+
readonly step: (state: S, event: E) => S;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A fold value plus the position that produced it.
|
|
55
|
+
*
|
|
56
|
+
* `foldedThrough` is a log offset: the number of events consumed, so the next
|
|
57
|
+
* event to fold sits at that index. `anchor` identifies the last consumed
|
|
58
|
+
* event by position and type, which is what lets a rebuilt log be detected.
|
|
59
|
+
*/
|
|
60
|
+
export interface SessionEventCursor<S> {
|
|
61
|
+
readonly value: S;
|
|
62
|
+
readonly foldedThrough: number;
|
|
63
|
+
readonly logFrom: number;
|
|
64
|
+
readonly anchor: {
|
|
65
|
+
readonly seq: number;
|
|
66
|
+
readonly type: string;
|
|
67
|
+
} | null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Open a cursor for a log slice that starts at `logFrom` (a Session's
|
|
71
|
+
* `inheritedEventCount` for its own events, or 0 for a full log). Nothing is
|
|
72
|
+
* consumed yet, so the first {@link advanceSessionEventCursor} folds the whole
|
|
73
|
+
* slice.
|
|
74
|
+
*/
|
|
75
|
+
export declare function initSessionEventCursor<S, E extends SessionCursorEvent>(fold: SessionEventFold<S, E>, logFrom?: number): SessionEventCursor<S>;
|
|
76
|
+
/**
|
|
77
|
+
* Fold the log tail that arrived since the cursor stopped and return the
|
|
78
|
+
* advanced cursor; the same reference comes back when there is nothing new.
|
|
79
|
+
*
|
|
80
|
+
* `events` is the slice starting at `logFrom`, and `logEnd` is the EXCLUSIVE
|
|
81
|
+
* end offset of that slice in the owning log — the same coordinate space as
|
|
82
|
+
* `logFrom`, not `events.length`. An inherited Session's own events start at
|
|
83
|
+
* its `inheritedEventCount`, so for a 14-event log with 10 inherited events
|
|
84
|
+
* the slice is `events[0..4]` spanning `logFrom = 10` to `logEnd = 14`. This
|
|
85
|
+
* mirrors the Session's own `snapshotEvents(fromSeq, toSeqExclusive)`.
|
|
86
|
+
*
|
|
87
|
+
* Both offsets are passed explicitly rather than read from the cursor so the
|
|
88
|
+
* caller states the log it is folding, which is also what makes the fallback
|
|
89
|
+
* below decidable.
|
|
90
|
+
*/
|
|
91
|
+
export declare function advanceSessionEventCursor<S, E extends SessionCursorEvent>(cursor: SessionEventCursor<S>, events: readonly E[], logFrom: number, logEnd: number, fold: SessionEventFold<S, E>): SessionEventCursor<S>;
|
|
92
|
+
/**
|
|
93
|
+
* A cursor together with the Session it was folded from: the unit a cache
|
|
94
|
+
* keyed by owner stores.
|
|
95
|
+
*
|
|
96
|
+
* Keying by owner (a Member) rather than by Session id keeps the entry count
|
|
97
|
+
* bounded by the roster instead of by the number of generations, because a new
|
|
98
|
+
* Session replaces its predecessor's entry rather than adding another. The
|
|
99
|
+
* Session id kept beside the cursor is what stops that replacement from being
|
|
100
|
+
* read as a hit: a cursor is only ever resumed for the log it folded, and the
|
|
101
|
+
* id lives here rather than inside the cursor because the cursor is
|
|
102
|
+
* Session-agnostic by design.
|
|
103
|
+
*/
|
|
104
|
+
export interface OwnedSessionEventCursor<S> {
|
|
105
|
+
readonly sessionId: string;
|
|
106
|
+
readonly cursor: SessionEventCursor<S>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Advance one owner's fold and answer with the entry to store back, so every
|
|
110
|
+
* caller keeps the same one-entry-per-owner invariant.
|
|
111
|
+
*
|
|
112
|
+
* `events` is that Session's whole own-events slice starting at `logFrom` (its
|
|
113
|
+
* `inheritedEventCount`), so the slice's end is the log's end. The cursor is
|
|
114
|
+
* resumed only while `owned` still belongs to `sessionId`; every other case
|
|
115
|
+
* starts cold at `logFrom`, which is the same degradation the cursor's own
|
|
116
|
+
* guard performs for a rewritten log.
|
|
117
|
+
*/
|
|
118
|
+
export declare function advanceOwnedSessionEventCursor<S, E extends SessionCursorEvent>(owned: OwnedSessionEventCursor<S> | undefined, sessionId: string, fold: SessionEventFold<S, E>, events: readonly E[], logFrom: number): OwnedSessionEventCursor<S>;
|
|
119
|
+
//# sourceMappingURL=session-event-cursor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-event-cursor.d.ts","sourceRoot":"","sources":["../../src/session-event-cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,sFAAsF;AACtF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,kBAAkB,GAAG,kBAAkB;IACpF,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;IACjB,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,CAAA;CACzC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;IACjB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CACxE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,CAAC,SAAS,kBAAkB,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,SAAI,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAExI;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,CAAC,SAAS,kBAAkB,EACvE,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAC7B,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC3B,kBAAkB,CAAC,CAAC,CAAC,CAmBvB;AAoBD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAA;CACvC;AAED;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,EAAE,CAAC,SAAS,kBAAkB,EAC5E,KAAK,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,SAAS,EAC7C,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAC5B,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,OAAO,EAAE,MAAM,GACd,uBAAuB,CAAC,CAAC,CAAC,CAG5B"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startup remediation of legacy Member Session artifacts.
|
|
3
|
+
*
|
|
4
|
+
* Released dsh-agent-team 0.1.9 wrote its rollover handoff and checkpoint
|
|
5
|
+
* continuation into Member Session logs under bespoke message source kinds.
|
|
6
|
+
* dsh 0.1.5's session-format migration chain admits a closed source-kind
|
|
7
|
+
* vocabulary and refuses those artifacts fail-closed — the bytes are intact,
|
|
8
|
+
* but no reader (activation, session search, lineage timeline) can open them,
|
|
9
|
+
* which surfaces as Members going `unavailable`.
|
|
10
|
+
*
|
|
11
|
+
* This module restores readability without touching a byte of the refused
|
|
12
|
+
* artifact: it decodes the stored v0 log physically (frame-walking the
|
|
13
|
+
* concatenated zstd container), rewrites only this plugin's legacy source
|
|
14
|
+
* kinds into the admitted `plugin` shape the current writer already uses,
|
|
15
|
+
* re-validates the whole stream through the format catalog's own migration
|
|
16
|
+
* chain in memory, and publishes the migrated log as a sibling current-format
|
|
17
|
+
* artifact (`session.v3.jsonl.zstd`) — the storage layer's designated slot for
|
|
18
|
+
* a published current generation, atomically created and never overwritten.
|
|
19
|
+
* The v0 original remains the rollback path: delete the sibling.
|
|
20
|
+
*
|
|
21
|
+
* Scope is deliberately narrow: artifacts refused for any other reason
|
|
22
|
+
* (structural turn defects, foreign legacy fields) are left untouched with a
|
|
23
|
+
* diagnostic log — rewriting history a plugin did not author is out of
|
|
24
|
+
* bounds. Member availability for those rests on the activation recovery
|
|
25
|
+
* path's bounded fail-open, not on this migration.
|
|
26
|
+
*
|
|
27
|
+
* The walk runs once per plugin start, before any Member activation (no
|
|
28
|
+
* write lease exists yet) and records completion per Member in a separate
|
|
29
|
+
* durable domain — never in the `agent_team` ledger domain, whose version is
|
|
30
|
+
* the operation schema's compatibility contract, not a cache stamp.
|
|
31
|
+
* @module @wowyuarm/dsh-agent-team/session-remediation
|
|
32
|
+
*/
|
|
33
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
34
|
+
import { type Domain } from '@deepseek-ai/dsh-storage-domain';
|
|
35
|
+
import { type SessionPersistence } from '@deepseek-ai/dsh-session-persistence';
|
|
36
|
+
import type { AgentTeamAgentMember } from './types.ts';
|
|
37
|
+
/** The rollover-handoff kind released 0.1.9 wrote; it is also handoff evidence in a log. */
|
|
38
|
+
export declare const LEGACY_HANDOFF_SOURCE_KIND = "agent-team-context-handoff";
|
|
39
|
+
/**
|
|
40
|
+
* Durable completion cache. A separate domain on purpose: the `agent_team`
|
|
41
|
+
* domain's version gates the ledger schema, and stamping migration bookkeeping
|
|
42
|
+
* there would turn a cache refresh into a ledger-format break. Records are
|
|
43
|
+
* disposable derived state — losing them only re-runs the (idempotent) walk.
|
|
44
|
+
*/
|
|
45
|
+
declare const sessionRemediationDomainSpec: {
|
|
46
|
+
name: string;
|
|
47
|
+
version: number;
|
|
48
|
+
tables: {
|
|
49
|
+
lineages: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, AgentTeamSessionRemediationRecord>;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
/** One Member's completed remediation walk; the cache key is the Member id. */
|
|
53
|
+
export interface AgentTeamSessionRemediationRecord {
|
|
54
|
+
readonly memberId: string;
|
|
55
|
+
readonly formatVersion: number;
|
|
56
|
+
readonly currentSessionId: string;
|
|
57
|
+
readonly verifiedAt: number;
|
|
58
|
+
}
|
|
59
|
+
/** JSON object discipline for physical row handling; rows are never typed by the domain. */
|
|
60
|
+
interface PhysicalRow {
|
|
61
|
+
readonly [key: string]: unknown;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Deep-rewrite every legacy Team source in one physical row tree. The kinds
|
|
65
|
+
* are globally unique to this plugin, so a structural match anywhere in the
|
|
66
|
+
* row (message sources ride several payload positions) is exactly the set to
|
|
67
|
+
* rewrite; everything else passes through untouched.
|
|
68
|
+
*/
|
|
69
|
+
export declare function admitLegacyRow(value: unknown): unknown;
|
|
70
|
+
/** Whether one value tree still contains a legacy Team source kind. */
|
|
71
|
+
export declare function containsLegacySource(value: unknown): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Whether one value tree carries the retired rollover-handoff kind. A
|
|
74
|
+
* continuation is deliberately excluded: it never carried a handoff, so it is
|
|
75
|
+
* not evidence that one already arrived.
|
|
76
|
+
*/
|
|
77
|
+
export declare function carriesLegacyHandoffSource(value: unknown): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether a generation's log already holds a rollover handoff, in either
|
|
80
|
+
* shape. The admitted shape surfaces as a projection boundary; a generation
|
|
81
|
+
* rescued from the retired kinds carries the very same handoff as a source the
|
|
82
|
+
* projection does not classify, so recovery that keys on the boundary alone
|
|
83
|
+
* would deliver that handoff a second time.
|
|
84
|
+
*/
|
|
85
|
+
export declare function handoffAlreadyInLog(boundaries: readonly {
|
|
86
|
+
readonly source: string;
|
|
87
|
+
}[], ownEvents: readonly unknown[]): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Byte ranges of every complete zstd frame in a concatenated container, plus
|
|
90
|
+
* the offset of a torn final frame. Node's zstd bindings decode only the
|
|
91
|
+
* first frame of their input, so multi-frame containers must be walked
|
|
92
|
+
* structurally; scanning for the magic alone is unsound because the magic
|
|
93
|
+
* sequence can occur inside compressed payloads.
|
|
94
|
+
*/
|
|
95
|
+
export declare function scanZstdFrames(buffer: Buffer): {
|
|
96
|
+
readonly frames: readonly {
|
|
97
|
+
readonly start: number;
|
|
98
|
+
readonly end: number;
|
|
99
|
+
readonly skippable: boolean;
|
|
100
|
+
}[];
|
|
101
|
+
readonly tornStart: number | undefined;
|
|
102
|
+
};
|
|
103
|
+
/** Decode one stored zstd container to its physical JSONL rows. */
|
|
104
|
+
export declare function readPhysicalRows(buffer: Buffer): readonly PhysicalRow[];
|
|
105
|
+
/**
|
|
106
|
+
* The startup remediation pass. Never throws to its caller: a failed or
|
|
107
|
+
* partial walk logs and leaves the completion cache unrecorded, so the next
|
|
108
|
+
* start retries exactly the Members that need it.
|
|
109
|
+
*/
|
|
110
|
+
export interface SessionRemediationOutcome {
|
|
111
|
+
/** How many lineage artifacts were repaired. */
|
|
112
|
+
readonly repaired: number;
|
|
113
|
+
/** How many lineage artifacts were examined and deliberately left untouched. */
|
|
114
|
+
readonly untouched: number;
|
|
115
|
+
/**
|
|
116
|
+
* False when the walk failed outright or did not complete a repair it
|
|
117
|
+
* identified as its own; the cache stays unrecorded so a later pass retries
|
|
118
|
+
* exactly this Member.
|
|
119
|
+
*/
|
|
120
|
+
readonly completed: boolean;
|
|
121
|
+
/** True when nothing was walked: the Member is not enabled, or its completion cache still covers it. */
|
|
122
|
+
readonly cacheHit: boolean;
|
|
123
|
+
}
|
|
124
|
+
export declare class SessionRemediation {
|
|
125
|
+
private readonly ctx;
|
|
126
|
+
private readonly persistence;
|
|
127
|
+
private readonly table;
|
|
128
|
+
constructor(ctx: Context, persistence: SessionPersistence, domain: Domain<typeof sessionRemediationDomainSpec> | undefined);
|
|
129
|
+
/** Open the completion-cache domain; a failure only costs re-walking. */
|
|
130
|
+
static open(ctx: Context): Promise<Domain<typeof sessionRemediationDomainSpec> | undefined>;
|
|
131
|
+
/**
|
|
132
|
+
* Remediate every enabled Member's lineage once, before activation. A
|
|
133
|
+
* Member is skipped when its cache record still matches the current format
|
|
134
|
+
* version and Session binding — a rollover or a dsh format change is what
|
|
135
|
+
* re-opens the walk.
|
|
136
|
+
*/
|
|
137
|
+
remediateEnabledMembers(members: readonly AgentTeamAgentMember[]): Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* Remediate one Member's lineage; the bounded in-place heal a restart
|
|
140
|
+
* performs after an activation refused on a session. `completed` with zero
|
|
141
|
+
* repairs is the deterministic nothing-to-do answer (a finished walk found
|
|
142
|
+
* nothing provably this plugin's, or the cache already covered the Member);
|
|
143
|
+
* `completed: false` means the walk itself failed and a later attempt
|
|
144
|
+
* should retry. Never throws.
|
|
145
|
+
*/
|
|
146
|
+
remediateMember(member: AgentTeamAgentMember): Promise<SessionRemediationOutcome>;
|
|
147
|
+
/** Whether the cached walk still covers this Member under the current format. */
|
|
148
|
+
private cacheStillValid;
|
|
149
|
+
private recordCompletion;
|
|
150
|
+
/**
|
|
151
|
+
* Walk one Member's lineage from its bound Session up through recorded
|
|
152
|
+
* parent Sessions, remediating refused artifacts in place. Readable
|
|
153
|
+
* artifacts still carrying legacy kinds inside a current-format generation
|
|
154
|
+
* (an artifact of the one-off 2026-09-10 manual rescue) are counted and
|
|
155
|
+
* logged but not rewritten: they are readable, and rewriting a generation
|
|
156
|
+
* the storage layer may still append to is a write-path risk this pass
|
|
157
|
+
* does not take.
|
|
158
|
+
*/
|
|
159
|
+
private remediateLineage;
|
|
160
|
+
/** Remediate one lineage Session: verify readability, and repair when the refusal is this plugin's legacy source shape. */
|
|
161
|
+
private remediateOne;
|
|
162
|
+
/** Transform, prove, and publish the sibling current-format artifact for one refused Session. */
|
|
163
|
+
private repairArtifact;
|
|
164
|
+
/**
|
|
165
|
+
* Atomically place the sibling file: stage in the same directory, hardlink
|
|
166
|
+
* into place (an existing target refuses, never overwrites), remove the
|
|
167
|
+
* stage. The link dance matches the storage layer's own exclusive publish.
|
|
168
|
+
*/
|
|
169
|
+
private publishSibling;
|
|
170
|
+
}
|
|
171
|
+
export {};
|
|
172
|
+
//# sourceMappingURL=session-remediation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-remediation.d.ts","sourceRoot":"","sources":["../../src/session-remediation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAOH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAA6B,KAAK,MAAM,EAAgB,MAAM,iCAAiC,CAAA;AAItG,OAAO,EAAiC,KAAK,kBAAkB,EAAE,MAAM,sCAAsC,CAAA;AAW7G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD,4FAA4F;AAC5F,eAAO,MAAM,0BAA0B,+BAA+B,CAAA;AActE;;;;;GAKG;AACH,QAAA,MAAM,4BAA4B;;;;;;CAWhC,CAAA;AAEF,+EAA+E;AAC/E,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,UAAU,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AED,qBAAa,kBAAkB;IAI3B,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAJ9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgE;gBAGnE,GAAG,EAAE,OAAO,EACZ,WAAW,EAAE,kBAAkB,EAChD,MAAM,EAAE,MAAM,CAAC,OAAO,4BAA4B,CAAC,GAAG,SAAS;IAKjE,yEAAyE;WAC5D,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,4BAA4B,CAAC,GAAG,SAAS,CAAC;IASjG;;;;;OAKG;IACG,uBAAuB,CAAC,OAAO,EAAE,SAAS,oBAAoB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBtF;;;;;;;OAOG;IACG,eAAe,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAgBvF,iFAAiF;IACjF,OAAO,CAAC,eAAe;YAOT,gBAAgB;IAc9B;;;;;;;;OAQG;YACW,gBAAgB;IAiB9B,2HAA2H;YAC7G,YAAY;IA0B1B,iGAAiG;YACnF,cAAc;IA+C5B;;;;OAIG;YACW,cAAc;CAgB7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../src/spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,OAAO,KAAK,EAQV,kBAAkB,EAClB,oBAAoB,EAIrB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../src/spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,OAAO,KAAK,EAQV,kBAAkB,EAClB,oBAAoB,EAIrB,MAAM,YAAY,CAAA;AA0fnB,wIAAwI;AACxI,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAoE,CAAA;AAEvI,2HAA2H;AAC3H,eAAO,MAAM,mBAAmB;;;;;;CAM9B,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Team's single seam for reading stored Sessions.
|
|
3
|
+
*
|
|
4
|
+
* Every per-Session read the Host performs goes through here: one
|
|
5
|
+
* `open → read → close` cycle whose handle lifecycle is guaranteed closed,
|
|
6
|
+
* and whose failures are normalized into the five categories consumers choose
|
|
7
|
+
* policy by. Callers never touch a `SessionHandle`, an artifact path, a
|
|
8
|
+
* format generation, or Harness error message text.
|
|
9
|
+
*
|
|
10
|
+
* The reader owns reading and classification only — not Member lifecycle,
|
|
11
|
+
* Agent create/resume, UI, ledger, or remediation (which reads raw artifact
|
|
12
|
+
* bytes through its own repair path).
|
|
13
|
+
*
|
|
14
|
+
* Classification notes: the shipped JSONL backend throws its
|
|
15
|
+
* `corrupt session log` family as plain `Error`s, so corruption is detected by
|
|
16
|
+
* that stable message prefix (an upstream gap; if the text ever changes the
|
|
17
|
+
* failure degrades to `unknown`, which consumers treat conservatively —
|
|
18
|
+
* blocking rather than silently skipping). Typed refusals are also matched
|
|
19
|
+
* through `error.cause` chains because the Harness agent layer wraps
|
|
20
|
+
* persistence failures during resume.
|
|
21
|
+
* @module @wowyuarm/dsh-agent-team/stored-session-reader
|
|
22
|
+
*/
|
|
23
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
24
|
+
import type { SessionEvent, SessionHeader, SessionId, SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
25
|
+
import { type SessionLocation } from '@deepseek-ai/dsh-session-persistence';
|
|
26
|
+
/** Why one stored Session could not be read; the policy axis for consumers. */
|
|
27
|
+
export type StoredSessionFailureKind = 'missing' | 'refused' | 'corrupt' | 'io' | 'unknown';
|
|
28
|
+
/** One normalized stored-Session read failure. */
|
|
29
|
+
export interface StoredSessionFailure {
|
|
30
|
+
readonly kind: StoredSessionFailureKind;
|
|
31
|
+
readonly sessionId: SessionId;
|
|
32
|
+
/** The underlying reason, from the matched error's own message. */
|
|
33
|
+
readonly detail: string;
|
|
34
|
+
/** The refused artifact's location, when the backend reported one. */
|
|
35
|
+
readonly location?: SessionLocation;
|
|
36
|
+
}
|
|
37
|
+
/** A complete, validated stored-Session read: storage metadata plus the whole event log. */
|
|
38
|
+
export interface StoredSessionInspection {
|
|
39
|
+
readonly header: SessionHeader;
|
|
40
|
+
readonly inheritedEventCount: SessionLogOffset;
|
|
41
|
+
readonly events: readonly SessionEvent[];
|
|
42
|
+
}
|
|
43
|
+
/** The result of one read: the inspection, or its normalized failure. */
|
|
44
|
+
export type StoredSessionReadResult = {
|
|
45
|
+
readonly ok: true;
|
|
46
|
+
readonly inspection: StoredSessionInspection;
|
|
47
|
+
} | {
|
|
48
|
+
readonly ok: false;
|
|
49
|
+
readonly failure: StoredSessionFailure;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* A call site's session-read failure, carrying the typed classification so
|
|
53
|
+
* activation can route the diagnostic without re-matching error text.
|
|
54
|
+
*/
|
|
55
|
+
export declare class StoredSessionReadError extends Error {
|
|
56
|
+
readonly failure: StoredSessionFailure;
|
|
57
|
+
constructor(message: string, failure: StoredSessionFailure);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Classify any failure as a stored-Session read failure. Total: unmatched
|
|
61
|
+
* errors become `unknown`, and a direct system error code becomes `io` —
|
|
62
|
+
* call this only where the failed operation is known to be a session read.
|
|
63
|
+
*/
|
|
64
|
+
export declare function classifyStoredSessionFailure(error: unknown, sessionId: SessionId): StoredSessionFailure;
|
|
65
|
+
/**
|
|
66
|
+
* The session-shaped failure carried by an arbitrary error, when it carries
|
|
67
|
+
* one at all: deterministic markers (typed classes, the corruption message
|
|
68
|
+
* family) are matched through the cause chain; transient fs errors are not —
|
|
69
|
+
* outside the reader they are not provably session-related. Activation uses
|
|
70
|
+
* this to route diagnostics; `undefined` means the failure is not
|
|
71
|
+
* session-shaped.
|
|
72
|
+
*/
|
|
73
|
+
export declare function sessionFailureOf(error: unknown, sessionId: SessionId): StoredSessionFailure | undefined;
|
|
74
|
+
/** Read stored Sessions through one seam: full validated reads with normalized failures. */
|
|
75
|
+
export declare class StoredSessionReader {
|
|
76
|
+
private readonly ctx;
|
|
77
|
+
constructor(ctx: Context);
|
|
78
|
+
/**
|
|
79
|
+
* Read one stored Session completely. The handle is closed on every path;
|
|
80
|
+
* any failure of open, read, or close is returned as its normalized
|
|
81
|
+
* category, never thrown.
|
|
82
|
+
*/
|
|
83
|
+
read(sessionId: SessionId): Promise<StoredSessionReadResult>;
|
|
84
|
+
/**
|
|
85
|
+
* Whether one stored Session has durable persisted content, decided through
|
|
86
|
+
* `stat`: the backend reports a still-draining session through its pending
|
|
87
|
+
* header, so this is the existence probe activation relies on. Only the
|
|
88
|
+
* missing case returns `false`; unexpected errors propagate as before.
|
|
89
|
+
*/
|
|
90
|
+
exists(sessionId: SessionId): Promise<boolean>;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=stored-session-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stored-session-reader.d.ts","sourceRoot":"","sources":["../../src/stored-session-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AACxG,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,sCAAsC,CAAA;AAE7C,+EAA+E;AAC/E,MAAM,MAAM,wBAAwB,GAChC,SAAS,GACT,SAAS,GACT,SAAS,GACT,IAAI,GACJ,SAAS,CAAA;AAEb,kDAAkD;AAClD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAA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AAG,OAAO,CAAC,OAAO,CAAC;CAGrD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one agent-facing Team timestamp formatter.
|
|
3
|
+
*
|
|
4
|
+
* Ledger storage keeps UTC ISO instants (`occurredAt` on every operation);
|
|
5
|
+
* rendering converts them into the fixed Team coordination zone UTC+8 with
|
|
6
|
+
* an explicit offset (`2026-09-08T17:00:00+08:00`). The conversion is a
|
|
7
|
+
* fixed offset with no daylight-saving component, so the same stored instant
|
|
8
|
+
* renders byte-identically on every reread path — the context-cache
|
|
9
|
+
* invariant. The Web Client keeps its own browser-local rendering and never
|
|
10
|
+
* passes through this module; a future configuration layer may make the
|
|
11
|
+
* zone configurable, but the render must stay a single deterministic
|
|
12
|
+
* formatter per stored instant.
|
|
13
|
+
* @module @wowyuarm/dsh-agent-team/time-format
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Format one stored UTC ISO instant as the agent-facing Team timestamp.
|
|
17
|
+
* @param occurredAt - stored UTC ISO 8601 instant (ledger `occurredAt`).
|
|
18
|
+
* @returns the fixed-offset UTC+8 rendering, or the input unchanged when it
|
|
19
|
+
* cannot be parsed (never a fabricated time).
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatTeamTimestamp(occurredAt: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Format a non-negative elapsed millisecond count as compact whole-second
|
|
24
|
+
* units (`2d 3h 12m 8s`), mirroring the shipped harness time-context
|
|
25
|
+
* vocabulary so both clock families read the same way.
|
|
26
|
+
*/
|
|
27
|
+
export declare function formatTeamDuration(elapsedMs: number): string;
|
|
28
|
+
//# sourceMappingURL=time-format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-format.d.ts","sourceRoot":"","sources":["../../src/time-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAO9D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAc5D"}
|
|
@@ -113,18 +113,44 @@ export interface AgentTeamCapabilityWarning {
|
|
|
113
113
|
/** Digest of the names that were known when the entry was dropped. */
|
|
114
114
|
readonly knownNames: readonly string[];
|
|
115
115
|
}
|
|
116
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Host projection combining durable intent with process-local availability.
|
|
118
|
+
* The optional diagnostic is structured: `class` routes which action actually
|
|
119
|
+
* helps (restart heals, restart is useless, transient), `detail` is the
|
|
120
|
+
* human-readable reason, and a refused session carries its artifact location
|
|
121
|
+
* plus whether a repair attempt proved anything remediable.
|
|
122
|
+
*/
|
|
117
123
|
export interface AgentTeamAgentMemberStatus {
|
|
118
124
|
readonly member: AgentTeamAgentMember;
|
|
119
125
|
readonly availability: 'active' | 'suspended' | 'inactive' | 'archived' | 'unavailable';
|
|
120
126
|
readonly presence: 'available' | 'working' | 'error' | 'unavailable';
|
|
121
|
-
readonly diagnostic?:
|
|
127
|
+
readonly diagnostic?: AgentTeamMemberDiagnostic;
|
|
122
128
|
/**
|
|
123
129
|
* Runtime-derived, activation-scoped capability warnings (see
|
|
124
130
|
* AgentTeamCapabilityWarning); empty while capabilities resolve cleanly.
|
|
125
131
|
*/
|
|
126
132
|
readonly capabilityWarnings?: readonly AgentTeamCapabilityWarning[] | undefined;
|
|
127
133
|
}
|
|
134
|
+
/** Which action actually helps an unavailable or erroring Member; the diagnostic's policy axis. */
|
|
135
|
+
export type AgentTeamMemberDiagnosticClass = 'session-refused' | 'session-unreadable' | 'preset-composition' | 'rollover' | 'runtime' | 'activation';
|
|
136
|
+
/** One Member failure's structured reason; rendered, never persisted. */
|
|
137
|
+
export interface AgentTeamMemberDiagnostic {
|
|
138
|
+
readonly class: AgentTeamMemberDiagnosticClass;
|
|
139
|
+
readonly detail: string;
|
|
140
|
+
/** The refused artifact's location, when a format refusal reported one. */
|
|
141
|
+
readonly location?: {
|
|
142
|
+
readonly kind: string;
|
|
143
|
+
readonly path: string;
|
|
144
|
+
};
|
|
145
|
+
/** The Session the failure is about, when it is about one. */
|
|
146
|
+
readonly sessionId?: SessionId;
|
|
147
|
+
/**
|
|
148
|
+
* `session-refused` only: `false` once a repair attempt ran to completion
|
|
149
|
+
* and proved nothing remediable — restarting cannot help and the surface
|
|
150
|
+
* must stop offering it.
|
|
151
|
+
*/
|
|
152
|
+
readonly remediable?: boolean;
|
|
153
|
+
}
|
|
128
154
|
/** Browser-safe Member identity with Host-only paths removed. */
|
|
129
155
|
export type AgentTeamClientMember = Omit<AgentTeamAgentMember, 'privateMemoryPath'>;
|
|
130
156
|
/** Browser-safe lifecycle projection. */
|
|
@@ -332,10 +358,14 @@ export type AgentTeamThreadFact = {
|
|
|
332
358
|
readonly message: AgentTeamMessage;
|
|
333
359
|
/** Structured Member refs from the originating send operation; empty when the Message mentions nobody. */
|
|
334
360
|
readonly mentions: readonly AgentTeamMemberId[];
|
|
361
|
+
/** Wall-clock instant of the committing ledger operation; message facts read through to their Message. */
|
|
362
|
+
readonly occurredAt: string;
|
|
335
363
|
} | {
|
|
336
364
|
readonly kind: 'activity';
|
|
337
365
|
readonly sequence: number;
|
|
338
366
|
readonly activity: AgentTeamActivity;
|
|
367
|
+
/** Wall-clock instant of the committing ledger operation; activities have no instant of their own. */
|
|
368
|
+
readonly occurredAt: string;
|
|
339
369
|
};
|
|
340
370
|
/** One fact returned by a durable Thread read. */
|
|
341
371
|
export interface AgentTeamThreadReadFact {
|
|
@@ -355,10 +385,14 @@ export type AgentTeamStoredThreadFact = {
|
|
|
355
385
|
readonly sequence: number;
|
|
356
386
|
readonly message: AgentTeamStoredMessage;
|
|
357
387
|
readonly mentions: readonly AgentTeamMemberId[];
|
|
388
|
+
/** Ledger-operation instant; pre-envelope ledgers omit it and normalize on load. */
|
|
389
|
+
readonly occurredAt?: string | undefined;
|
|
358
390
|
} | {
|
|
359
391
|
readonly kind: 'activity';
|
|
360
392
|
readonly sequence: number;
|
|
361
393
|
readonly activity: AgentTeamActivity;
|
|
394
|
+
/** Ledger-operation instant; pre-envelope ledgers omit it and normalize on load. */
|
|
395
|
+
readonly occurredAt?: string | undefined;
|
|
362
396
|
};
|
|
363
397
|
/** Stored form of one durable Thread read fact. */
|
|
364
398
|
export interface AgentTeamStoredThreadReadFact {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/types/entities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAE7D,qDAAqD;AACrD,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAA;AAElE,yEAAyE;AACzE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA;AAE9D,kFAAkF;AAClF,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AAEpE,4CAA4C;AAC5C,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;AAE5D,yDAAyD;AACzD,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAEhE,kDAAkD;AAClD,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAEhE,qCAAqC;AACrC,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;AAE1D,uCAAuC;AACvC,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA;AAE9D,sC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;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IAC5F,oFAAoF;IACpF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAE9C,mDAAmD;AACnD,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAA;IACxC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CACzB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SessionId, SessionLogOffset, SessionSeq } from "@deepseek-ai/dsh-session";
|
|
2
2
|
import type { WorkspaceId } from "@deepseek-ai/dsh-workspace";
|
|
3
|
-
import type { AgentTeamAgentMember, AgentTeamChannel, AgentTeamChannelRef, AgentTeamContextCheckpointRef, AgentTeamOperationBase, AgentTeamClaim, AgentTeamClaimActivity, AgentTeamClaimsReleasedActivity, AgentTeamInboxDelta, AgentTeamMemberId, AgentTeamMessage, AgentTeamStoredMessage, AgentTeamStoredThreadReadFact, AgentTeamTask, AgentTeamTaskActivity, AgentTeamThread, AgentTeamThreadAttention } from "./entities.ts";
|
|
3
|
+
import type { AgentTeamAgentMember, AgentTeamChannel, AgentTeamChannelRef, AgentTeamContextCheckpointRef, AgentTeamOperationBase, AgentTeamClaim, AgentTeamClaimActivity, AgentTeamClaimsReleasedActivity, AgentTeamInboxDelta, AgentTeamMemberId, AgentTeamMessage, AgentTeamStoredMessage, AgentTeamStoredThreadReadFact, AgentTeamTask, AgentTeamTaskActivity, AgentTeamTaskRef, AgentTeamThread, AgentTeamThreadAttention, AgentTeamThreadRef } from "./entities.ts";
|
|
4
4
|
/** The first durable operation in every Agent Team ledger. */
|
|
5
5
|
export interface AgentTeamInitializedOperation extends AgentTeamOperationBase {
|
|
6
6
|
readonly previousOperationId: null;
|
|
@@ -282,27 +282,53 @@ export interface AgentTeamThreadAttentionChangedOperation extends AgentTeamOpera
|
|
|
282
282
|
readonly inbox: AgentTeamInboxDelta;
|
|
283
283
|
};
|
|
284
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* Durable content of one Thread read: the watermark it advanced to and the
|
|
287
|
+
* Inbox delta it consumed. Everything else the read answered with — the Thread,
|
|
288
|
+
* its facts, the anchor, the reader's Attention, the unread count it left — is
|
|
289
|
+
* derived from the projection at read time and re-derived on every replay.
|
|
290
|
+
*/
|
|
291
|
+
export interface AgentTeamThreadReadReceipt {
|
|
292
|
+
readonly workspaceId: WorkspaceId;
|
|
293
|
+
readonly memberId: AgentTeamMemberId;
|
|
294
|
+
readonly threadRef: AgentTeamThreadRef;
|
|
295
|
+
readonly taskRef?: AgentTeamTaskRef | undefined;
|
|
296
|
+
readonly readThroughSequence: number;
|
|
297
|
+
readonly inbox: AgentTeamInboxDelta;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* The pre-receipt form: the whole Thread picture the read answered with, frozen
|
|
301
|
+
* into the record. Ledgers written before the receipt form still hold these and
|
|
302
|
+
* keep loading unchanged — normalized and validated in place, never rewritten.
|
|
303
|
+
*
|
|
304
|
+
* The picture is no longer read back to answer anything: a repeated read reports
|
|
305
|
+
* the original receipt with a picture derived from the current projection, so
|
|
306
|
+
* these fields keep old records validating rather than serving responses.
|
|
307
|
+
*/
|
|
308
|
+
export interface AgentTeamThreadReadSnapshot {
|
|
309
|
+
readonly workspaceId: WorkspaceId;
|
|
310
|
+
readonly memberId: AgentTeamMemberId;
|
|
311
|
+
/** The Task this legacy read targeted. */
|
|
312
|
+
readonly task?: AgentTeamTask | undefined;
|
|
313
|
+
readonly thread: AgentTeamThread;
|
|
314
|
+
readonly claims: readonly AgentTeamClaim[];
|
|
315
|
+
readonly anchor: AgentTeamStoredMessage;
|
|
316
|
+
/** Structured Member refs of the anchor Message, from its originating send operation. */
|
|
317
|
+
readonly anchorMentions: readonly AgentTeamMemberId[];
|
|
318
|
+
readonly facts: readonly AgentTeamStoredThreadReadFact[];
|
|
319
|
+
readonly readThroughSequence: number;
|
|
320
|
+
/** Number of unread facts left after this bounded read. */
|
|
321
|
+
readonly remainingUnreadCount: number;
|
|
322
|
+
/** The reader's post-read Attention snapshot, when the reader follows. */
|
|
323
|
+
readonly attention?: AgentTeamThreadAttention | undefined;
|
|
324
|
+
readonly inbox: AgentTeamInboxDelta;
|
|
325
|
+
}
|
|
326
|
+
/** Both durable Thread-read forms: the receipt every new read writes, and the legacy snapshot. */
|
|
327
|
+
export type AgentTeamThreadReadData = AgentTeamThreadReadReceipt | AgentTeamThreadReadSnapshot;
|
|
285
328
|
/** Durable one-batch read and direct-marker consumption. It does not revise the Thread. */
|
|
286
329
|
export interface AgentTeamThreadReadOperation extends AgentTeamOperationBase {
|
|
287
330
|
readonly kind: 'team/thread-read';
|
|
288
|
-
readonly data:
|
|
289
|
-
readonly workspaceId: WorkspaceId;
|
|
290
|
-
readonly memberId: AgentTeamMemberId;
|
|
291
|
-
/** Current public state captured for a stable idempotent read response. */
|
|
292
|
-
readonly task?: AgentTeamTask;
|
|
293
|
-
readonly thread: AgentTeamThread;
|
|
294
|
-
readonly claims: readonly AgentTeamClaim[];
|
|
295
|
-
readonly anchor: AgentTeamStoredMessage;
|
|
296
|
-
/** Structured Member refs of the anchor Message, from its originating send operation. */
|
|
297
|
-
readonly anchorMentions: readonly AgentTeamMemberId[];
|
|
298
|
-
readonly facts: readonly AgentTeamStoredThreadReadFact[];
|
|
299
|
-
readonly readThroughSequence: number;
|
|
300
|
-
/** Number of unread facts left after this bounded read. */
|
|
301
|
-
readonly remainingUnreadCount: number;
|
|
302
|
-
/** The reader's post-read Attention snapshot, when the reader follows. */
|
|
303
|
-
readonly attention?: AgentTeamThreadAttention | undefined;
|
|
304
|
-
readonly inbox: AgentTeamInboxDelta;
|
|
305
|
-
};
|
|
331
|
+
readonly data: AgentTeamThreadReadData;
|
|
306
332
|
}
|
|
307
333
|
/** Durable irreversible Member removal and global inbox cleanup. */
|
|
308
334
|
export interface AgentTeamMemberRemovedOperation extends AgentTeamOperationBase {
|