@wowyuarm/dsh-agent-team 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/package.json +2 -1
  2. package/packages/agent-team/README.md +5 -3
  3. package/packages/agent-team/README.zh.md +5 -3
  4. package/packages/agent-team/core-skills/member-skill-manager/SKILL.md +2 -0
  5. package/packages/agent-team/lib/attachments.js +14 -4
  6. package/packages/agent-team/lib/context-management.js +379 -0
  7. package/packages/agent-team/lib/context-projection.js +574 -0
  8. package/packages/agent-team/lib/context-source.js +72 -0
  9. package/packages/agent-team/lib/index.js +1258 -54
  10. package/packages/agent-team/lib/ledger.js +357 -26
  11. package/packages/agent-team/lib/member-context.js +7 -3
  12. package/packages/agent-team/lib/member-runtime.js +159 -4
  13. package/packages/agent-team/lib/pressure-policy.js +200 -0
  14. package/packages/agent-team/lib/progress-nudge.js +320 -0
  15. package/packages/agent-team/lib/spec.js +18 -0
  16. package/packages/agent-team/lib/typert.host.js +124 -42
  17. package/packages/agent-team/lib/typert.remote-client.d.ts.map +1 -1
  18. package/packages/agent-team/lib/typert.remote-client.js +39 -25
  19. package/packages/agent-team/lib/types/attachments.d.ts +1 -1
  20. package/packages/agent-team/lib/types/attachments.d.ts.map +1 -1
  21. package/packages/agent-team/lib/types/context-management.d.ts +142 -0
  22. package/packages/agent-team/lib/types/context-management.d.ts.map +1 -0
  23. package/packages/agent-team/lib/types/context-projection.d.ts +219 -0
  24. package/packages/agent-team/lib/types/context-projection.d.ts.map +1 -0
  25. package/packages/agent-team/lib/types/context-source.d.ts +83 -0
  26. package/packages/agent-team/lib/types/context-source.d.ts.map +1 -0
  27. package/packages/agent-team/lib/types/index.d.ts +283 -2
  28. package/packages/agent-team/lib/types/index.d.ts.map +1 -1
  29. package/packages/agent-team/lib/types/ledger.d.ts +120 -7
  30. package/packages/agent-team/lib/types/ledger.d.ts.map +1 -1
  31. package/packages/agent-team/lib/types/member-context.d.ts.map +1 -1
  32. package/packages/agent-team/lib/types/member-runtime.d.ts +30 -2
  33. package/packages/agent-team/lib/types/member-runtime.d.ts.map +1 -1
  34. package/packages/agent-team/lib/types/pressure-policy.d.ts +106 -0
  35. package/packages/agent-team/lib/types/pressure-policy.d.ts.map +1 -0
  36. package/packages/agent-team/lib/types/progress-nudge.d.ts +136 -0
  37. package/packages/agent-team/lib/types/progress-nudge.d.ts.map +1 -0
  38. package/packages/agent-team/lib/types/spec.d.ts.map +1 -1
  39. package/packages/agent-team/lib/types/types/entities.d.ts +32 -1
  40. package/packages/agent-team/lib/types/types/entities.d.ts.map +1 -1
  41. package/packages/agent-team/lib/types/types/operations.d.ts +38 -3
  42. package/packages/agent-team/lib/types/types/operations.d.ts.map +1 -1
  43. package/packages/agent-team/lib/types/types/requests-results.d.ts +54 -1
  44. package/packages/agent-team/lib/types/types/requests-results.d.ts.map +1 -1
  45. package/packages/agent-team/preset/team-member/agent.cordis.yml +10 -2
  46. package/packages/client-agent-team/lib/client.js +283 -398
  47. package/packages/client-agent-team/lib/client.js.map +1 -1
  48. package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.d.ts +1 -2
  49. package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.d.ts.map +1 -1
  50. package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.js +61 -41
  51. package/packages/client-agent-team/lib/types/client/TeamChannelPage.d.ts.map +1 -1
  52. package/packages/client-agent-team/lib/types/client/TeamChannelPage.js +3 -7
  53. package/packages/client-agent-team/lib/types/client/TeamComposer.d.ts +3 -1
  54. package/packages/client-agent-team/lib/types/client/TeamComposer.d.ts.map +1 -1
  55. package/packages/client-agent-team/lib/types/client/TeamComposer.js +37 -27
  56. package/packages/client-agent-team/lib/types/client/TeamConversation.d.ts +1 -1
  57. package/packages/client-agent-team/lib/types/client/TeamConversation.d.ts.map +1 -1
  58. package/packages/client-agent-team/lib/types/client/TeamConversation.js +2 -2
  59. package/packages/client-agent-team/lib/types/client/TeamMemberAvatar.d.ts.map +1 -1
  60. package/packages/client-agent-team/lib/types/client/TeamMemberAvatar.js +3 -2
  61. package/packages/client-agent-team/lib/types/client/TeamMessage.js +5 -0
  62. package/packages/client-agent-team/lib/types/client/TeamPresenceDot.d.ts +2 -2
  63. package/packages/client-agent-team/lib/types/client/TeamPresenceDot.d.ts.map +1 -1
  64. package/packages/client-agent-team/lib/types/client/TeamPresenceDot.js +4 -6
  65. package/packages/client-agent-team/lib/types/client/TeamStateDot.d.ts +14 -0
  66. package/packages/client-agent-team/lib/types/client/TeamStateDot.d.ts.map +1 -0
  67. package/packages/client-agent-team/lib/types/client/TeamStateDot.js +15 -0
  68. package/packages/client-agent-team/lib/types/client/TeamThreadPage.d.ts +1 -0
  69. package/packages/client-agent-team/lib/types/client/TeamThreadPage.d.ts.map +1 -1
  70. package/packages/client-agent-team/lib/types/client/TeamThreadPage.js +41 -16
  71. package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.d.ts +1 -1
  72. package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.d.ts.map +1 -1
  73. package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.js +2 -2
  74. package/packages/client-agent-team/lib/types/client/index.d.ts.map +1 -1
  75. package/packages/client-agent-team/lib/types/client/index.js +36 -78
  76. package/packages/client-agent-team/lib/types/client/locales.d.ts +0 -16
  77. package/packages/client-agent-team/lib/types/client/locales.d.ts.map +1 -1
  78. package/packages/client-agent-team/lib/types/client/locales.js +0 -16
  79. package/packages/client-agent-team/lib/types/client/sidebar-drag.d.ts +1 -2
  80. package/packages/client-agent-team/lib/types/client/sidebar-drag.d.ts.map +1 -1
  81. package/packages/client-agent-team/lib/types/client/slots.d.ts +8 -1
  82. package/packages/client-agent-team/lib/types/client/slots.d.ts.map +1 -1
  83. package/packages/client-agent-team/lib/types/client/task-refs.d.ts +7 -1
  84. package/packages/client-agent-team/lib/types/client/task-refs.d.ts.map +1 -1
  85. package/packages/client-agent-team/lib/types/client/task-refs.js +25 -3
  86. package/packages/client-agent-team/lib/types/client/team-formatters.d.ts +11 -10
  87. package/packages/client-agent-team/lib/types/client/team-formatters.d.ts.map +1 -1
  88. package/packages/client-agent-team/lib/types/client/team-formatters.js +14 -11
  89. package/packages/tool-agent-team/README.md +8 -5
  90. package/packages/tool-agent-team/README.zh.md +8 -5
  91. package/packages/tool-agent-team/lib/context-tools.js +179 -0
  92. package/packages/tool-agent-team/lib/index.js +144 -25
  93. package/packages/tool-agent-team/lib/types/context-tools.d.ts +16 -0
  94. package/packages/tool-agent-team/lib/types/context-tools.d.ts.map +1 -0
  95. package/packages/tool-agent-team/lib/types/index.d.ts.map +1 -1
  96. package/packages/agent-team/lib/auto-compaction.js +0 -201
  97. package/packages/agent-team/lib/types/auto-compaction.d.ts +0 -47
  98. package/packages/agent-team/lib/types/auto-compaction.d.ts.map +0 -1
  99. package/packages/client-agent-team/lib/types/client/TeamMemberDock.d.ts +0 -12
  100. package/packages/client-agent-team/lib/types/client/TeamMemberDock.d.ts.map +0 -1
  101. package/packages/client-agent-team/lib/types/client/TeamMemberDock.js +0 -13
  102. package/packages/client-agent-team/lib/types/client/member-session-input.d.ts +0 -20
  103. package/packages/client-agent-team/lib/types/client/member-session-input.d.ts.map +0 -1
  104. package/packages/client-agent-team/lib/types/client/member-session-input.js +0 -110
@@ -0,0 +1,320 @@
1
+ /**
2
+ * Progress-visibility nudges: advisory Session notices that keep Member agents
3
+ * reporting progress into their Threads. Two regimes over one shared
4
+ * per-Member silent-tool-call counter:
5
+ *
6
+ * - Thread progress (A): a Member holding an active Claim, or following a
7
+ * taskless Thread, that has run many tool calls since its last committed
8
+ * public communication is reminded to post a brief update. The reminder
9
+ * ladder advances 20 → 40 → 60… per Member.
10
+ * - Claim suggestion (B): a Member following a still-`todo` Task it has never
11
+ * claimed is reminded — once per (Member, Thread) within the current Member
12
+ * Session — that team_claim exists.
13
+ *
14
+ * The Coordinator owns counting, thresholds, notice formatting, dedupe,
15
+ * in-flight revocation, and the deferred steer. It consumes only facts the
16
+ * Host already holds: live `tool/call`/`user/message` session events in their
17
+ * real `{type, seq, time, data}` envelope, the Session log for one-time
18
+ * recovery, committed ledger operations, and a ledger-owned eligibility
19
+ * projection (`progressNudgeTargets`). It never writes Team facts and never
20
+ * wakes idle agents on its own — a nudge rides the member's next tool call.
21
+ *
22
+ * @module @wowyuarm/dsh-agent-team/progress-nudge
23
+ */
24
+ import { createUserMessage } from '@deepseek-ai/dsh-llm';
25
+ const PROGRESS_NUDGE_PLUGIN_ID = '@wowyuarm/dsh-agent-team';
26
+ /** Notice summary for every nudge this Coordinator injects. */
27
+ export const PROGRESS_NUDGE_NOTICE_SUMMARY = 'Progress visibility reminder';
28
+ export const PROGRESS_NUDGE_TOOL_CALLS_START = 20;
29
+ export const PROGRESS_NUDGE_TOOL_CALLS_STEP = 20;
30
+ export const CLAIM_SUGGESTION_TOOL_CALLS = 5;
31
+ /** Stable line prefix marking Claim-suggestion targets inside a nudge notice; the only text this module ever parses back. */
32
+ const CLAIM_TARGET_LINE_PREFIX = '- Claim target: Task ';
33
+ const CLAIM_TARGET_LINE = /^- Claim target: Task (task:[0-9a-f-]+) — Thread (thread:[0-9a-f-]+)$/;
34
+ /** Ledger operation kinds that count as committed public communication and reset silence. */
35
+ export function isPublicCommunicationOperationKind(kind) {
36
+ return kind === 'team/message-sent' || kind === 'team/thread-replied'
37
+ || kind === 'team/claim-created' || kind === 'team/claim-done' || kind === 'team/claim-released';
38
+ }
39
+ /** Whether one message is a nudge notice this module injected. */
40
+ export function isProgressNudgeNotice(message) {
41
+ const source = message.source;
42
+ return source.kind === 'plugin' && source.plugin === PROGRESS_NUDGE_PLUGIN_ID
43
+ && source.form === 'notice' && source.summary === PROGRESS_NUDGE_NOTICE_SUMMARY;
44
+ }
45
+ /**
46
+ * Event-driven per-Member nudge state machine. All state is in-process and
47
+ * scoped to one Member Session; nothing is persisted. The Host feeds it live
48
+ * session events in their real envelope, committed operations, and lifecycle
49
+ * stop points.
50
+ */
51
+ export class ProgressNudgeCoordinator {
52
+ members = new Map();
53
+ agentForMember;
54
+ targetsForMember;
55
+ sessionLogForMember;
56
+ log;
57
+ scheduleSteer;
58
+ progressThresholdStart;
59
+ progressThresholdStep;
60
+ claimSuggestionThreshold;
61
+ constructor(options) {
62
+ this.agentForMember = options.agentForMember;
63
+ this.targetsForMember = options.targetsForMember;
64
+ this.sessionLogForMember = options.sessionLogForMember;
65
+ this.log = options.log;
66
+ this.scheduleSteer = options.scheduleSteer ?? (run => { queueMicrotask(run); });
67
+ this.progressThresholdStart = options.progressThresholdStart ?? PROGRESS_NUDGE_TOOL_CALLS_START;
68
+ this.progressThresholdStep = options.progressThresholdStep ?? PROGRESS_NUDGE_TOOL_CALLS_STEP;
69
+ this.claimSuggestionThreshold = options.claimSuggestionThreshold ?? CLAIM_SUGGESTION_TOOL_CALLS;
70
+ }
71
+ /**
72
+ * One live session event for a Member, in its real `{type, seq, time, data}`
73
+ * envelope. Only `tool/call` counts toward silence; a `user/message` whose
74
+ * source is exactly this module's own notice records that the model consumed
75
+ * the nudge (a Claim suggestion becomes final only then). The live `agent`
76
+ * is passed in by the caller because it exists at event time even before
77
+ * the Host finishes publishing the handle.
78
+ */
79
+ onSessionEvent(memberId, sessionId, agent, event) {
80
+ if (event.type === 'user/message') {
81
+ if (!isProgressNudgeNotice(event.data))
82
+ return;
83
+ const state = this.members.get(memberId);
84
+ if (state === undefined)
85
+ return;
86
+ const notice = state.pending;
87
+ if (notice !== undefined && notice.messageId === event.data.id)
88
+ state.pending = undefined;
89
+ for (const threadRef of claimTargetThreadRefs(event.data))
90
+ state.claimSuggested.add(threadRef);
91
+ return;
92
+ }
93
+ if (event.type !== 'tool/call')
94
+ return;
95
+ let state = this.members.get(memberId);
96
+ if (state === undefined || state.sessionId !== sessionId) {
97
+ // First event of this Member Session (or a generation the Host did not
98
+ // stop explicitly): fresh tracking replaces whatever was there, and
99
+ // consumed one-time suggestions are recovered from the durable log so a
100
+ // Host restart or suspend/resume within the same Session cannot repeat
101
+ // them. A Human-initiated new Session has a different id and starts
102
+ // empty, exactly as specified.
103
+ this.dropState(memberId, state);
104
+ state = { sessionId, silentToolCalls: 0, nextProgressThreshold: this.progressThresholdStart,
105
+ claimSuggested: this.recoverClaimSuggestions(memberId, sessionId), };
106
+ this.members.set(memberId, state);
107
+ }
108
+ state.silentToolCalls += 1;
109
+ if (state.lastNudgeTurn === event.data.turn)
110
+ return;
111
+ this.maybeNudge(memberId, state, agent, event.data.turn);
112
+ }
113
+ /**
114
+ * One ledger operation committed. A Member actor's public communication
115
+ * resets its silence; every commit also reconciles pending notices whose
116
+ * targets may have just disappeared (Task accepted, Channel archived, the
117
+ * Claim taken by someone else).
118
+ */
119
+ onCommitted(operation) {
120
+ if (operation.actor.kind === 'member' && operation.actor.memberId !== undefined
121
+ && isPublicCommunicationOperationKind(operation.kind)) {
122
+ const state = this.members.get(operation.actor.memberId);
123
+ if (state !== undefined) {
124
+ state.silentToolCalls = 0;
125
+ state.nextProgressThreshold = this.progressThresholdStart;
126
+ this.revokePending(operation.actor.memberId, state);
127
+ }
128
+ }
129
+ this.reconcileAll();
130
+ }
131
+ /** Revoke one Member's queued-but-unconsumed nudge, e.g. when a higher-priority Team notice is injected. */
132
+ revokePendingNotice(memberId) {
133
+ const state = this.members.get(memberId);
134
+ if (state !== undefined)
135
+ this.revokePending(memberId, state);
136
+ }
137
+ /** Drop all tracking for one Member (suspend/archive/remove/renew/context-clear/steer failure). */
138
+ stopTracking(memberId) {
139
+ this.dropState(memberId, this.members.get(memberId));
140
+ this.members.delete(memberId);
141
+ }
142
+ /** Stop tracking every Member. */
143
+ dispose() {
144
+ for (const memberId of this.members.keys())
145
+ this.stopTracking(memberId);
146
+ }
147
+ /** Rebuild the consumed one-time suggestion set from this Session's durable log. */
148
+ recoverClaimSuggestions(memberId, sessionId) {
149
+ const suggested = new Set();
150
+ const log = this.sessionLogForMember(memberId, sessionId);
151
+ if (log === undefined)
152
+ return suggested;
153
+ for (const event of log.events) {
154
+ if (event.type !== 'user/message')
155
+ continue;
156
+ if (!isProgressNudgeNotice(event.data))
157
+ continue;
158
+ for (const threadRef of claimTargetThreadRefs(event.data))
159
+ suggested.add(threadRef);
160
+ }
161
+ return suggested;
162
+ }
163
+ dropState(memberId, state) {
164
+ if (state === undefined)
165
+ return;
166
+ this.revokePending(memberId, state);
167
+ this.members.delete(memberId);
168
+ }
169
+ revokePending(memberId, state) {
170
+ const notice = state.pending;
171
+ if (notice !== undefined) {
172
+ notice.canceled = true;
173
+ if (notice.steered) {
174
+ const agent = this.agentForMember(memberId);
175
+ const pending = agent === undefined ? undefined
176
+ : [...agent.inbox.nextStep, ...agent.inbox.nextTurn].find(message => message.id === notice.messageId);
177
+ // A just-consumed notice is simply gone; remove() returning false is expected.
178
+ if (pending !== undefined)
179
+ agent.inbox.remove(pending.id);
180
+ }
181
+ }
182
+ state.pending = undefined;
183
+ }
184
+ /** Re-check every live Member's pending notice against the targets it actually listed. */
185
+ reconcileAll() {
186
+ for (const [memberId, state] of this.members) {
187
+ const notice = state.pending;
188
+ if (notice === undefined)
189
+ continue;
190
+ const agent = this.agentForMember(memberId);
191
+ if (agent === undefined) {
192
+ this.dropState(memberId, state);
193
+ continue;
194
+ }
195
+ const targets = this.targetsForMember(memberId);
196
+ // The notice is stale when ANY target it listed is no longer eligible:
197
+ // the body names threads whose work may be finished, so a partial
198
+ // survival must not keep the whole stale notice alive.
199
+ const progressAlive = notice.progressThreadRefs.length === 0
200
+ || notice.progressThreadRefs.every(threadRef => targets.progress.some(target => target.threadRef === threadRef));
201
+ const claimAlive = notice.claimThreadRefs.length === 0
202
+ || notice.claimThreadRefs.every(threadRef => targets.claim.some(target => target.threadRef === threadRef));
203
+ if (!progressAlive || !claimAlive)
204
+ this.revokePending(memberId, state);
205
+ }
206
+ }
207
+ maybeNudge(memberId, state, agent, turn) {
208
+ const targets = this.targetsForMember(memberId);
209
+ const progressDue = state.silentToolCalls >= state.nextProgressThreshold && targets.progress.length > 0;
210
+ const freshClaimTargets = targets.claim
211
+ .filter(target => !state.claimSuggested.has(target.threadRef) && state.pending?.claimThreadRefs.includes(target.threadRef) !== true);
212
+ const claimDue = state.silentToolCalls >= this.claimSuggestionThreshold && freshClaimTargets.length > 0;
213
+ if (!progressDue && !claimDue)
214
+ return;
215
+ if (this.hasBlockingNotice(agent))
216
+ return;
217
+ const progressTargets = progressDue ? targets.progress : [];
218
+ const claimTargets = claimDue ? freshClaimTargets : [];
219
+ const notice = createUserMessage({
220
+ content: [{ type: 'text', text: nudgeNoticeText(state.silentToolCalls, progressTargets, claimTargets) }],
221
+ source: { kind: 'plugin', plugin: PROGRESS_NUDGE_PLUGIN_ID, form: 'notice', summary: PROGRESS_NUDGE_NOTICE_SUMMARY },
222
+ });
223
+ const pending = {
224
+ messageId: notice.id,
225
+ progressThreadRefs: progressTargets.map(target => target.threadRef),
226
+ claimThreadRefs: claimTargets.map(target => target.threadRef),
227
+ steered: false,
228
+ canceled: false,
229
+ };
230
+ // Record intent first: the scheduled steer, its cancellation check, and
231
+ // its failure handling all live on this single PendingNotice object, so a
232
+ // revoke between queueing and the microtask leaves no orphan injection.
233
+ // lastNudgeTurn stays as the same-turn intent guard, but the A threshold
234
+ // only commits after the real steer succeeds — a canceled or failed
235
+ // schedule leaves the rung due so the next tool call retries it.
236
+ state.pending = pending;
237
+ state.lastNudgeTurn = turn;
238
+ this.scheduleSteer(() => {
239
+ if (pending.canceled)
240
+ return;
241
+ try {
242
+ agent.steer(notice);
243
+ }
244
+ catch (error) {
245
+ this.log?.(`progress nudge steer failed for member '${memberId}': ${error instanceof Error ? error.message : String(error)}`);
246
+ pending.canceled = true;
247
+ if (state.pending === pending)
248
+ state.pending = undefined;
249
+ this.stopTracking(memberId);
250
+ return;
251
+ }
252
+ pending.steered = true;
253
+ if (pending.progressThreadRefs.length > 0) {
254
+ // Advance the ladder past the count at real success in one move: a
255
+ // long silence held back by higher-priority notices must not replay
256
+ // every skipped rung on successive tool calls after the blocker
257
+ // clears.
258
+ while (state.nextProgressThreshold <= state.silentToolCalls)
259
+ state.nextProgressThreshold += this.progressThresholdStep;
260
+ }
261
+ });
262
+ }
263
+ /**
264
+ * Recovery, Inbox, and pre-compaction notices outrank a progress nudge. If
265
+ * one is already pending, this nudge stays due and retries on the next tool
266
+ * call; a DM relay is not a notice and never blocks.
267
+ */
268
+ hasBlockingNotice(agent) {
269
+ for (const message of [...agent.inbox.nextStep, ...agent.inbox.nextTurn]) {
270
+ const source = message.source;
271
+ if (source.kind !== 'plugin' || source.plugin !== PROGRESS_NUDGE_PLUGIN_ID || source.form !== 'notice')
272
+ continue;
273
+ if (source.summary !== PROGRESS_NUDGE_NOTICE_SUMMARY)
274
+ return true;
275
+ }
276
+ return false;
277
+ }
278
+ }
279
+ /** Extract the threadRefs this module itself wrote as Claim targets in one notice. */
280
+ function claimTargetThreadRefs(message) {
281
+ const refs = [];
282
+ for (const block of message.content) {
283
+ if (block.type !== 'text')
284
+ continue;
285
+ for (const line of block.text.split('\n')) {
286
+ const match = CLAIM_TARGET_LINE.exec(line);
287
+ if (match !== null)
288
+ refs.push(match[2]);
289
+ }
290
+ }
291
+ return refs;
292
+ }
293
+ function nudgeNoticeText(silentToolCalls, progress, claim) {
294
+ const sections = [];
295
+ if (progress.length > 0) {
296
+ sections.push([
297
+ 'Progress visibility reminder',
298
+ '',
299
+ `You have made ${silentToolCalls} tool calls since your last visible Team update. Please briefly update the relevant Thread(s): what you confirmed, what remains, and any blocker. Read the Thread first if needed, then continue working.`,
300
+ '',
301
+ ...progress.map(target => target.reason === 'active-claim'
302
+ ? `- Task ${target.taskRef} — Thread ${target.threadRef}`
303
+ : `- Taskless Thread ${target.threadRef} (reply only if your current work relates to it)`),
304
+ ].join('\n'));
305
+ }
306
+ if (claim.length > 0) {
307
+ sections.push([
308
+ 'Claim visibility reminder',
309
+ '',
310
+ 'You have been working while following the Task(s) below, but you have never claimed a direction there.',
311
+ '',
312
+ ...claim.map(target => `${CLAIM_TARGET_LINE_PREFIX}${target.taskRef} — Thread ${target.threadRef}`),
313
+ '',
314
+ 'If your current work belongs to one of these Tasks, briefly state your direction in its Thread and consider team_claim. If it does not, no action is required. This is advisory, not a claim requirement.',
315
+ ].join('\n'));
316
+ }
317
+ if (progress.length > 0)
318
+ sections.push('This is advisory; do not stop useful work merely to produce a long status report.');
319
+ return sections.join('\n\n');
320
+ }
@@ -5,6 +5,8 @@ const requestIdSchema = z.string().min(1).transform(value => value);
5
5
  const memberIdSchema = z.string().regex(/^member:[^:]+$/).transform(value => value);
6
6
  const workspaceIdSchema = z.string().min(1).transform(value => value);
7
7
  const sessionIdSchema = z.string().min(1).transform(value => value);
8
+ const sessionSeqSchema = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).transform(value => value);
9
+ const contextCheckpointRefSchema = z.string().regex(/^(context-checkpoint-[0-9a-f]{64}|team-boundary-[0-9a-f]{64})$/).transform(value => value);
8
10
  const channelRefSchema = z.string().regex(/^channel:[^:]+$/).transform(value => value);
9
11
  const messageRefSchema = z.string().regex(/^message:[^:]+$/).transform(value => value);
10
12
  const taskRefSchema = z.string().regex(/^task:[^:]+$/).transform(value => value);
@@ -181,6 +183,7 @@ const taskActivitySchema = z.object({
181
183
  kind: z.union([z.literal('promote'), z.literal('accept'), z.literal('close'), z.literal('reopen')]),
182
184
  releasedClaimRefs: z.array(claimRefSchema).min(1).optional(),
183
185
  completedClaimRefs: z.array(claimRefSchema).min(1).optional(),
186
+ acceptedClaimRefs: z.array(claimRefSchema).optional(),
184
187
  }).strict();
185
188
  const claimsReleasedActivitySchema = z.object({
186
189
  ...activityBase,
@@ -279,6 +282,21 @@ const storedAgentTeamOperationSchema = z.discriminatedUnion('kind', [
279
282
  kind: z.literal('team/member-session-renewed'),
280
283
  data: z.object({ member: memberSchema, previousSessionId: sessionIdSchema }).strict(),
281
284
  }).strict(),
285
+ z.object({
286
+ ...operationBase,
287
+ previousOperationId: operationIdSchema.nullable(),
288
+ kind: z.literal('team/member-session-rolled-over'),
289
+ data: z.object({
290
+ member: memberSchema,
291
+ previousSessionId: sessionIdSchema,
292
+ newSessionId: sessionIdSchema,
293
+ sourceSessionId: sessionIdSchema.optional(),
294
+ sourceThroughSeq: sessionSeqSchema.optional(),
295
+ handoffEventSeq: sessionSeqSchema,
296
+ checkpointRef: contextCheckpointRefSchema.optional(),
297
+ trigger: z.enum(['model', 'pressure']),
298
+ }).strict(),
299
+ }).strict(),
282
300
  z.object({
283
301
  ...operationBase,
284
302
  previousOperationId: operationIdSchema.nullable(),