@wowyuarm/dsh-agent-team 0.1.13 → 0.1.14-alpha.2
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 +1 -1
- package/README.zh.md +1 -1
- package/cordis.patch.yml +185 -2
- package/package.json +45 -49
- package/packages/agent-team/lib/context-management.js +2 -3
- package/packages/agent-team/lib/context-projection.js +7 -11
- package/packages/agent-team/lib/context-source.js +36 -17
- package/packages/agent-team/lib/index.js +26 -64
- package/packages/agent-team/lib/member-context.js +5 -3
- package/packages/agent-team/lib/member-time-context.js +5 -2
- package/packages/agent-team/lib/pressure-policy.js +5 -3
- package/packages/agent-team/lib/stored-session-reader.js +1 -2
- package/packages/agent-team/lib/typert.host.js +289 -211
- package/packages/agent-team/lib/typert.remote-client.d.ts +3 -2
- package/packages/agent-team/lib/typert.remote-client.d.ts.map +1 -1
- package/packages/agent-team/lib/typert.remote-client.js +243 -189
- package/packages/agent-team/lib/types/context-management.d.ts.map +1 -1
- package/packages/agent-team/lib/types/context-projection.d.ts.map +1 -1
- package/packages/agent-team/lib/types/context-source.d.ts +46 -13
- package/packages/agent-team/lib/types/context-source.d.ts.map +1 -1
- package/packages/agent-team/lib/types/index.d.ts +0 -8
- package/packages/agent-team/lib/types/index.d.ts.map +1 -1
- package/packages/agent-team/lib/types/member-context.d.ts +14 -0
- package/packages/agent-team/lib/types/member-context.d.ts.map +1 -1
- package/packages/agent-team/lib/types/member-time-context.d.ts +15 -0
- package/packages/agent-team/lib/types/member-time-context.d.ts.map +1 -1
- package/packages/agent-team/lib/types/pressure-policy.d.ts.map +1 -1
- package/packages/agent-team/lib/types/stored-session-reader.d.ts +1 -2
- package/packages/agent-team/lib/types/stored-session-reader.d.ts.map +1 -1
- package/packages/agent-team/lib/types/types/entities.d.ts +3 -3
- package/packages/client-agent-team/lib/client.js +467 -341
- package/packages/client-agent-team/lib/client.js.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.js +6 -6
- package/packages/client-agent-team/lib/types/client/TeamChannelPage.js +3 -3
- 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/TeamFooterAction.js +2 -2
- package/packages/client-agent-team/lib/types/client/TeamMemberEditor.js +3 -3
- package/packages/client-agent-team/lib/types/client/TeamMembersAction.js +2 -2
- 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.js +3 -3
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.js +5 -8
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceSelector.d.ts +37 -0
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceSelector.d.ts.map +1 -0
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceSelector.js +58 -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 +37 -18
- package/packages/client-agent-team/lib/types/client/locales.d.ts +2 -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 +2 -0
- package/packages/client-agent-team/lib/types/client/multi-menu-field.js +2 -2
- package/packages/client-agent-team/lib/types/client/sidebar-sections.d.ts +1 -1
- package/packages/client-agent-team/lib/types/client/sidebar-sections.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/sidebar-sections.js +4 -3
- package/packages/agent-team/lib/preset-roster.js +0 -15
- package/packages/agent-team/lib/session-remediation.js +0 -493
- package/packages/agent-team/lib/types/preset-roster.d.ts +0 -5
- package/packages/agent-team/lib/types/preset-roster.d.ts.map +0 -1
- package/packages/agent-team/lib/types/session-remediation.d.ts +0 -172
- package/packages/agent-team/lib/types/session-remediation.d.ts.map +0 -1
- package/packages/agent-team/preset/team-member/agent.cordis.yml +0 -164
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceRow.d.ts +0 -11
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceRow.d.ts.map +0 -1
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceRow.js +0 -6
|
@@ -52,13 +52,12 @@ import { Remote, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
|
52
52
|
import { ATTACHMENT_MAX_BYTES, attachmentPayloadPath, attachmentsRoot, copyPathAttachment, newAttachmentId, readAttachment, sanitizeMediaType, sweepAttachmentCache, validatePathAttachment, writeAttachment } from "./attachments.js";
|
|
53
53
|
import { PressurePolicyCoordinator } from "./pressure-policy.js";
|
|
54
54
|
import { ContextManagementCoordinator } from "./context-management.js";
|
|
55
|
-
import { AGENT_TEAM_PLUGIN_ID, createHandoffMessage } from "./context-source.js";
|
|
55
|
+
import { AGENT_TEAM_PLUGIN_ID, createHandoffMessage, isAgentTeamSource, isAgentTeamSourceKind } from "./context-source.js";
|
|
56
56
|
import { carriedInputOf, checkpointByRef, checkpointRefFor, contextProjectionFold, foldContextProjection, isReminderNoticeSummary, timelineCandidates } from "./context-projection.js";
|
|
57
57
|
import { advanceOwnedSessionEventCursor } from "./session-event-cursor.js";
|
|
58
58
|
import { AGENT_TEAM_HUMAN_MEMBER_ID, AgentTeamLedger, agentTeamHumanActor } from "./ledger.js";
|
|
59
59
|
import { AGENT_TEAM_TOOL_NAMES, deepCopyCapabilities, memberMemoryDirectoryName, MemberRuntime } from "./member-runtime.js";
|
|
60
60
|
import { classifyRecoverableError, RecoveryCoordinator, RECOVERY_MAX_CONSECUTIVE_ERRORS } from "./recovery.js";
|
|
61
|
-
import { SessionRemediation, handoffAlreadyInLog } from "./session-remediation.js";
|
|
62
61
|
import { StoredSessionReadError, StoredSessionReader, sessionFailureOf } from "./stored-session-reader.js";
|
|
63
62
|
import { agentTeamDomainSpec } from "./spec.js";
|
|
64
63
|
import { formatTeamTimestamp } from "./time-format.js";
|
|
@@ -351,12 +350,6 @@ let AgentTeam = (() => {
|
|
|
351
350
|
*/
|
|
352
351
|
presenceEpoch = 0;
|
|
353
352
|
changeWaiters = new Set();
|
|
354
|
-
/**
|
|
355
|
-
* The startup-opened remediation instance, held for the restart heal: the
|
|
356
|
-
* completion-cache domain may only be opened once per plugin lifecycle, so
|
|
357
|
-
* the restart path reuses this instance instead of opening its own.
|
|
358
|
-
*/
|
|
359
|
-
remediation;
|
|
360
353
|
constructor(ctx) {
|
|
361
354
|
super(ctx, 'agentTeam');
|
|
362
355
|
this.pressurePolicy = new PressurePolicyCoordinator({
|
|
@@ -445,7 +438,6 @@ let AgentTeam = (() => {
|
|
|
445
438
|
const domain = await this.ctx.storageDomain.open(agentTeamDomainSpec);
|
|
446
439
|
this.ctx.effect(() => async () => {
|
|
447
440
|
this.accepting = false;
|
|
448
|
-
this.remediation = undefined;
|
|
449
441
|
this.recovery.dispose();
|
|
450
442
|
this.contextManagement.dispose();
|
|
451
443
|
this.pressurePolicy.dispose();
|
|
@@ -468,18 +460,6 @@ let AgentTeam = (() => {
|
|
|
468
460
|
if (initialization.committed)
|
|
469
461
|
this.emitCommitted(initialization.value);
|
|
470
462
|
this.startAttachmentGc(ledger);
|
|
471
|
-
// Legacy-artifact remediation runs before any Member activation: no write
|
|
472
|
-
// lease exists yet, so publishing sibling generations for refused Session
|
|
473
|
-
// logs cannot race a live writer. Remediation failure never blocks
|
|
474
|
-
// startup — the next start retries exactly what the cache does not cover.
|
|
475
|
-
try {
|
|
476
|
-
const remediation = new SessionRemediation(this.ctx, this.ctx.sessionPersistence, await SessionRemediation.open(this.ctx));
|
|
477
|
-
this.remediation = remediation;
|
|
478
|
-
await remediation.remediateEnabledMembers(ledger.listMembers());
|
|
479
|
-
}
|
|
480
|
-
catch (error) {
|
|
481
|
-
this.ctx.logger.warn(`agent-team: legacy Session remediation did not run to completion (it will retry on the next start): ${error instanceof Error ? error.message : String(error)}`);
|
|
482
|
-
}
|
|
483
463
|
// One metadata listing serves every Member restore; per-member list calls
|
|
484
464
|
// would repeat the same I/O linearly during startup.
|
|
485
465
|
const persistedSessions = new Set((await this.persistedSessionHeaders()).map(snapshot => snapshot.header.id));
|
|
@@ -718,23 +698,10 @@ let AgentTeam = (() => {
|
|
|
718
698
|
if (member.state !== 'enabled')
|
|
719
699
|
throw new Error(`Agent Member '${member.handle}' is ${member.state}; only enabled Members can be restarted`);
|
|
720
700
|
this.ctx.logger.info(`agent-team: restarting member '${member.handle}' after a failed activation`);
|
|
721
|
-
//
|
|
722
|
-
//
|
|
723
|
-
//
|
|
724
|
-
|
|
725
|
-
if (activation !== undefined && activation.class === 'session-refused' && this.remediation !== undefined) {
|
|
726
|
-
const outcome = await this.remediation.remediateMember(member);
|
|
727
|
-
if (outcome.repaired > 0) {
|
|
728
|
-
this.ctx.logger.info(`agent-team: repaired ${outcome.repaired} refused Session artifact(s) for member '${member.handle}'; retrying activation`);
|
|
729
|
-
}
|
|
730
|
-
else if (outcome.completed) {
|
|
731
|
-
// The walk finished and nothing was provably this plugin's to fix:
|
|
732
|
-
// a retry would fail identically. Mark the refusal non-remediable
|
|
733
|
-
// so the surface stops offering restart and says why.
|
|
734
|
-
this.markRefusalNonRemediable(request.memberId);
|
|
735
|
-
return Object.freeze({ status: this.memberStatus(member) });
|
|
736
|
-
}
|
|
737
|
-
}
|
|
701
|
+
// There is no write-side repair pass anymore: dsh 0.1.7 converts the
|
|
702
|
+
// released V3 history at read time, and this bundle no longer authors
|
|
703
|
+
// the old wrapper shape, so a refusal stays a deterministic failure the
|
|
704
|
+
// retry reports again rather than something the restart heals.
|
|
738
705
|
await this.reactivateMember(request.memberId);
|
|
739
706
|
return Object.freeze({ status: this.memberStatus(member) });
|
|
740
707
|
}
|
|
@@ -946,7 +913,7 @@ let AgentTeam = (() => {
|
|
|
946
913
|
const body = notifications.length === 0 ? text : `${text}\n\n${this.notificationText(notifications, member.memberId)}`;
|
|
947
914
|
const hint = createUserMessage({
|
|
948
915
|
content: [{ type: 'text', text: body }],
|
|
949
|
-
source: { kind:
|
|
916
|
+
source: { kind: AGENT_TEAM_PLUGIN_ID, form: 'notice', summary: RECOVERY_NOTICE_SUMMARY },
|
|
950
917
|
});
|
|
951
918
|
for (const pending of [...handle.agent.inbox.nextStep, ...handle.agent.inbox.nextTurn]) {
|
|
952
919
|
if (this.isInboxNotice(pending))
|
|
@@ -1317,7 +1284,7 @@ let AgentTeam = (() => {
|
|
|
1317
1284
|
try {
|
|
1318
1285
|
const message = createUserMessage({
|
|
1319
1286
|
content: [{ type: 'text', text: this.dmRelayText(agent, recipient, request.body.trim(), result.value.receipt.occurredAt, result.value.receipt.operationId, request.workspaceId) }],
|
|
1320
|
-
source: { kind:
|
|
1287
|
+
source: { kind: AGENT_TEAM_PLUGIN_ID, form: 'relay' },
|
|
1321
1288
|
});
|
|
1322
1289
|
// An idle recipient gets one ordinary turn; a busy one is steered into
|
|
1323
1290
|
// its current turn — the same wake split subagent continuations use.
|
|
@@ -1866,11 +1833,11 @@ let AgentTeam = (() => {
|
|
|
1866
1833
|
openAttributions.set(event.data.callId, { name: event.data.name, arguments: event.data.arguments });
|
|
1867
1834
|
}
|
|
1868
1835
|
else if (event.type === 'tool/result') {
|
|
1869
|
-
const
|
|
1870
|
-
if (
|
|
1871
|
-
const recorded = openAttributions.get(
|
|
1872
|
-
if (recorded !== undefined
|
|
1873
|
-
openAttributions.delete(
|
|
1836
|
+
const result = event.data.message;
|
|
1837
|
+
if (result.isError !== true) {
|
|
1838
|
+
const recorded = openAttributions.get(result.toolCallId);
|
|
1839
|
+
if (recorded !== undefined) {
|
|
1840
|
+
openAttributions.delete(result.toolCallId);
|
|
1874
1841
|
try {
|
|
1875
1842
|
const args = JSON.parse(recorded.arguments);
|
|
1876
1843
|
// A claim mutation resolves its Task overlay through the ledger;
|
|
@@ -1900,7 +1867,11 @@ let AgentTeam = (() => {
|
|
|
1900
1867
|
}
|
|
1901
1868
|
else if (event.type === 'user/message') {
|
|
1902
1869
|
const source = event.data.source;
|
|
1903
|
-
|
|
1870
|
+
// Only this plugin's own delivered notices attribute Threads, by exact
|
|
1871
|
+
// kind identity — the shape written now and the read-time conversion's
|
|
1872
|
+
// rename of the released V3 history. A `plugin:` prefix test would
|
|
1873
|
+
// claim third-party producers' rows as Team facts.
|
|
1874
|
+
if (source === undefined || !isAgentTeamSourceKind(source.kind))
|
|
1904
1875
|
continue;
|
|
1905
1876
|
// Reminder notices never enter attribution — a recovery instruction
|
|
1906
1877
|
// (or a historical progress-nudge notice, kept decodable in session
|
|
@@ -2324,12 +2295,11 @@ let AgentTeam = (() => {
|
|
|
2324
2295
|
// delivered activates the new Session with no handoff in its own
|
|
2325
2296
|
// log — never treat that as an ordinary blank Member Session. The
|
|
2326
2297
|
// operation's recorded previous Session (the lineage parent) still
|
|
2327
|
-
// holds the intent; rebuild the handoff from it.
|
|
2328
|
-
//
|
|
2329
|
-
//
|
|
2330
|
-
//
|
|
2331
|
-
|
|
2332
|
-
if (!handoffAlreadyInLog(state.boundaries, created.agent.session.ownEvents())) {
|
|
2298
|
+
// holds the intent; rebuild the handoff from it. Presence is judged
|
|
2299
|
+
// by the projection boundary alone: every handoff this Host ever
|
|
2300
|
+
// published classifies under the context source's recognizer,
|
|
2301
|
+
// including the history the read-time conversion renamed.
|
|
2302
|
+
if (!state.boundaries.some(boundary => boundary.source === 'handoff')) {
|
|
2333
2303
|
await this.reconstructMissingHandoff(member, created.agent);
|
|
2334
2304
|
}
|
|
2335
2305
|
// Carried input redelivery binds to the committed transition target —
|
|
@@ -2503,14 +2473,6 @@ let AgentTeam = (() => {
|
|
|
2503
2473
|
}
|
|
2504
2474
|
return { class: 'activation', detail: error instanceof Error ? error.message : String(error) };
|
|
2505
2475
|
}
|
|
2506
|
-
/** Mark a session-refused activation diagnostic as proven non-remediable. */
|
|
2507
|
-
markRefusalNonRemediable(memberId) {
|
|
2508
|
-
const failures = this.memberFailures.get(memberId);
|
|
2509
|
-
const activation = failures?.activation;
|
|
2510
|
-
if (activation === undefined || activation.class !== 'session-refused')
|
|
2511
|
-
return;
|
|
2512
|
-
failures.activation = Object.freeze({ ...activation, remediable: false });
|
|
2513
|
-
}
|
|
2514
2476
|
clearMemberFailure(memberId, slot) {
|
|
2515
2477
|
const failures = this.memberFailures.get(memberId);
|
|
2516
2478
|
if (failures === undefined || failures[slot] === undefined)
|
|
@@ -2551,7 +2513,7 @@ let AgentTeam = (() => {
|
|
|
2551
2513
|
const path = this.ctx.workspaceRegistry.get(operation.data.workspaceId)?.path;
|
|
2552
2514
|
const text = `Team participation changed: you have ${operation.kind === 'team/member-workspace-joined' ? 'joined' : 'left'} Workspace ${operation.data.workspaceId}${path === undefined ? ' (path unavailable)' : ` (${JSON.stringify(path)})`}.\nCurrent Workspace ids: ${ledger.workspacesOf(operation.data.memberId).join(', ')}. This replaces earlier participation information. Your Session and cwd have not moved.`;
|
|
2553
2515
|
const notice = createUserMessage({ content: [{ type: 'text', text }],
|
|
2554
|
-
source: { kind:
|
|
2516
|
+
source: { kind: AGENT_TEAM_PLUGIN_ID, form: 'notice', summary: 'Team Workspace participation changed' } });
|
|
2555
2517
|
try {
|
|
2556
2518
|
if (agent.status === 'idle' || agent.inbox.nextTurn.some(message => message.source.kind === 'user'))
|
|
2557
2519
|
agent.followup(notice);
|
|
@@ -2648,7 +2610,7 @@ let AgentTeam = (() => {
|
|
|
2648
2610
|
agent.inbox.remove(existingInboxHint.id);
|
|
2649
2611
|
const hint = createUserMessage({
|
|
2650
2612
|
content: [{ type: 'text', text: this.notificationText(notifications, member.memberId) }],
|
|
2651
|
-
source: { kind:
|
|
2613
|
+
source: { kind: AGENT_TEAM_PLUGIN_ID, form: 'notice', summary: INBOX_NOTICE_SUMMARY },
|
|
2652
2614
|
});
|
|
2653
2615
|
this.notifiedInbox.set(member.memberId, signature);
|
|
2654
2616
|
try {
|
|
@@ -2669,12 +2631,12 @@ let AgentTeam = (() => {
|
|
|
2669
2631
|
}
|
|
2670
2632
|
isInboxNotice(message) {
|
|
2671
2633
|
const source = message.source;
|
|
2672
|
-
return source
|
|
2634
|
+
return isAgentTeamSource(source)
|
|
2673
2635
|
&& source.form === 'notice' && source.summary === INBOX_NOTICE_SUMMARY;
|
|
2674
2636
|
}
|
|
2675
2637
|
isRecoveryNotice(message) {
|
|
2676
2638
|
const source = message.source;
|
|
2677
|
-
return source
|
|
2639
|
+
return isAgentTeamSource(source)
|
|
2678
2640
|
&& source.form === 'notice' && source.summary === RECOVERY_NOTICE_SUMMARY;
|
|
2679
2641
|
}
|
|
2680
2642
|
notificationText(notifications, readerId) {
|
|
@@ -2,6 +2,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
4
4
|
import { SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
5
|
+
import { v3RenamedSourceKind } from "./context-source.js";
|
|
5
6
|
import { memberMemoryDirectoryPath } from "./member-runtime.js";
|
|
6
7
|
export const name = 'wowyuarm-agent-team-member-context';
|
|
7
8
|
const MAX_MEMORY_BYTES = 8 * 1024;
|
|
@@ -42,8 +43,9 @@ export function apply(ctx) {
|
|
|
42
43
|
// number domains explicit (the seq = log.length contiguity contract).
|
|
43
44
|
const event = agent.session.snapshotEvents(SessionLogOffset(sequence), SessionLogOffset(sequence + 1))[0];
|
|
44
45
|
return event?.type === 'user/message'
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
// Both identities are this producer's own: the kind written now and
|
|
47
|
+
// the read-time conversion's rename of this producer's V3 history.
|
|
48
|
+
&& (event.data.source.kind === name || event.data.source.kind === v3RenamedSourceKind(name))
|
|
47
49
|
&& event.data.content[0]?.type === 'text'
|
|
48
50
|
? [event.data.content[0].text]
|
|
49
51
|
: [];
|
|
@@ -53,7 +55,7 @@ export function apply(ctx) {
|
|
|
53
55
|
return decision;
|
|
54
56
|
const message = createUserMessage({
|
|
55
57
|
content: [{ type: 'text', text }],
|
|
56
|
-
source: { kind:
|
|
58
|
+
source: { kind: name, form: 'instructions' },
|
|
57
59
|
});
|
|
58
60
|
return { kind: 'enter', messages: [...decision.messages, message] };
|
|
59
61
|
}, { prepend: true });
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* @module @wowyuarm/dsh-agent-team/member-time-context
|
|
28
28
|
*/
|
|
29
29
|
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
30
|
+
import { v3RenamedSourceKind } from "./context-source.js";
|
|
30
31
|
import { formatTeamDuration, formatTeamTimestamp } from "./time-format.js";
|
|
31
32
|
import { advanceOwnedSessionEventCursor } from "./session-event-cursor.js";
|
|
32
33
|
export const name = 'wowyuarm-agent-team-member-time-context';
|
|
@@ -49,7 +50,9 @@ export function applyClockEvent(state, event) {
|
|
|
49
50
|
return state.openTurn === -1 ? state : { ...state, lastTurnInjectionTime: null, openTurn: -1 };
|
|
50
51
|
case 'user/message': {
|
|
51
52
|
const source = event.data.source;
|
|
52
|
-
|
|
53
|
+
// Both identities are this producer's own: the kind written now and the
|
|
54
|
+
// read-time conversion's rename of this producer's V3 history.
|
|
55
|
+
const injected = source.kind === name || source.kind === v3RenamedSourceKind(name);
|
|
53
56
|
const withMessage = state.lastMessageTime === event.time ? state : { ...state, lastMessageTime: event.time };
|
|
54
57
|
if (!injected)
|
|
55
58
|
return withMessage;
|
|
@@ -134,7 +137,7 @@ export function apply(ctx, config = {}) {
|
|
|
134
137
|
const text = renderClockSnapshot({ now, turn, step, previous });
|
|
135
138
|
const message = createUserMessage({
|
|
136
139
|
content: [{ type: 'text', text }],
|
|
137
|
-
source: { kind:
|
|
140
|
+
source: { kind: name, form: 'snapshot', sections: [{ name, text }] },
|
|
138
141
|
});
|
|
139
142
|
return { kind: 'enter', messages: [...decision.messages, message] };
|
|
140
143
|
}, { prepend: true });
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { CONTEXT_WINDOW_EXCEEDED_CODE } from '@deepseek-ai/dsh-llm';
|
|
18
18
|
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
19
19
|
import { CONTEXT_PRESSURE_NOTICE_SUMMARY } from "./context-management.js";
|
|
20
|
-
import { AGENT_TEAM_PLUGIN_ID } from "./context-source.js";
|
|
20
|
+
import { AGENT_TEAM_PLUGIN_ID, isAgentTeamSourceKind } from "./context-source.js";
|
|
21
21
|
import { advanceOwnedSessionEventCursor } from "./session-event-cursor.js";
|
|
22
22
|
/**
|
|
23
23
|
* Whether this Session's own span already carries the pressure notice: either
|
|
@@ -50,8 +50,10 @@ export function contextPressureNoticeText(input) {
|
|
|
50
50
|
}
|
|
51
51
|
/** Whether one user message is this policy's one-shot pressure notice. */
|
|
52
52
|
function isPressureNotice(message) {
|
|
53
|
+
// The source arrives untyped from the inbox; identity is matched by exact
|
|
54
|
+
// kind — the shape written now and the read-time conversion's V3 rename.
|
|
53
55
|
const source = message.source;
|
|
54
|
-
return source?.
|
|
56
|
+
return isAgentTeamSourceKind(source?.kind)
|
|
55
57
|
&& source?.summary === CONTEXT_PRESSURE_NOTICE_SUMMARY;
|
|
56
58
|
}
|
|
57
59
|
export class PressurePolicyCoordinator {
|
|
@@ -129,7 +131,7 @@ export class PressurePolicyCoordinator {
|
|
|
129
131
|
activeClaims: this.options.activeClaimLabels(member.memberId),
|
|
130
132
|
runningJobs: this.options.runningJobLabels(member.memberId),
|
|
131
133
|
}) }],
|
|
132
|
-
source: { kind:
|
|
134
|
+
source: { kind: AGENT_TEAM_PLUGIN_ID, form: 'notice', summary: CONTEXT_PRESSURE_NOTICE_SUMMARY },
|
|
133
135
|
});
|
|
134
136
|
try {
|
|
135
137
|
agent.steer(notice);
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
* format generation, or Harness error message text.
|
|
9
9
|
*
|
|
10
10
|
* The reader owns reading and classification only — not Member lifecycle,
|
|
11
|
-
* Agent create/resume, UI,
|
|
12
|
-
* bytes through its own repair path).
|
|
11
|
+
* Agent create/resume, UI, or ledger.
|
|
13
12
|
*
|
|
14
13
|
* Classification notes: the shipped JSONL backend throws its
|
|
15
14
|
* `corrupt session log` family as plain `Error`s, so corruption is detected by
|