@deepseek-harness-tui/dsh-tui 0.19.0 → 0.20.1
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 +67 -57
- package/bin/dsh-tui.js +26 -8
- package/cordis.patch.yml +5 -3
- package/cordis.yml +3 -2
- package/guide/dsh-tui-guide/claude-backend.en.md +6 -5
- package/guide/dsh-tui-guide/claude-backend.md +5 -5
- package/guide/dsh-tui-guide/configuration.en.md +1 -1
- package/guide/dsh-tui-guide/configuration.md +1 -1
- package/guide/dsh-tui-guide/getting-started.en.md +2 -2
- package/guide/dsh-tui-guide/getting-started.md +2 -2
- package/guide/dsh-tui-guide/migrate.en.md +5 -0
- package/guide/dsh-tui-guide/migrate.md +4 -0
- package/guide/dsh-tui-guide/plugins.en.md +17 -1
- package/guide/dsh-tui-guide/plugins.md +12 -1
- package/guide/dsh-tui-guide/user-guide.en.md +7 -2
- package/guide/dsh-tui-guide/user-guide.md +7 -2
- package/lib/settings.json +24 -8
- package/lib/types/adapter/kernel/host-facade.d.ts +3 -1
- package/lib/types/adapter/kernel/host-facade.d.ts.map +1 -1
- package/lib/types/adapter/kernel/host-facade.js +6 -0
- package/lib/types/adapter/kernel/runtime.d.ts.map +1 -1
- package/lib/types/adapter/kernel/runtime.js +5 -0
- package/lib/types/adapter/kernel/slices/extensions.d.ts +1 -0
- package/lib/types/adapter/kernel/slices/extensions.d.ts.map +1 -1
- package/lib/types/adapter/kernel/slices/extensions.js +6 -1
- package/lib/types/adapter/kernel/slices/index.d.ts +1 -1
- package/lib/types/adapter/kernel/slices/index.d.ts.map +1 -1
- package/lib/types/adapter/kernel/slices/index.js +3 -2
- package/lib/types/adapter/ports/channel-catalog.d.ts +19 -0
- package/lib/types/adapter/ports/channel-catalog.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +39 -3
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/adapter/ports/extensions.d.ts +9 -0
- package/lib/types/adapter/ports/extensions.d.ts.map +1 -1
- package/lib/types/adapter/ports/index.d.ts +1 -1
- package/lib/types/adapter/ports/index.d.ts.map +1 -1
- package/lib/types/adapter/upstream/extensions-driver.d.ts +4 -1
- package/lib/types/adapter/upstream/extensions-driver.d.ts.map +1 -1
- package/lib/types/adapter/upstream/extensions-driver.js +111 -1
- package/lib/types/adapter/upstream/index.d.ts +1 -1
- package/lib/types/adapter/upstream/index.d.ts.map +1 -1
- package/lib/types/adapter/upstream/index.js +1 -1
- package/lib/types/agent/events.d.ts +3 -1
- package/lib/types/agent/events.d.ts.map +1 -1
- package/lib/types/api.d.ts +1 -1
- package/lib/types/api.d.ts.map +1 -1
- package/lib/types/backends/claude/backend.d.ts.map +1 -1
- package/lib/types/backends/claude/backend.js +7 -2
- package/lib/types/backends/claude/tools.d.ts.map +1 -1
- package/lib/types/backends/claude/tools.js +8 -3
- package/lib/types/backends/codex/translate/presentation.d.ts.map +1 -1
- package/lib/types/backends/codex/translate/presentation.js +5 -2
- package/lib/types/channel/interaction.d.ts.map +1 -1
- package/lib/types/channel/interaction.js +1 -0
- package/lib/types/channel/permissions.d.ts +15 -0
- package/lib/types/channel/permissions.d.ts.map +1 -1
- package/lib/types/channel/permissions.js +28 -0
- package/lib/types/channel/projection.d.ts.map +1 -1
- package/lib/types/channel/projection.js +11 -1
- package/lib/types/channel/questions.d.ts +26 -0
- package/lib/types/channel/questions.d.ts.map +1 -1
- package/lib/types/channel/questions.js +43 -0
- package/lib/types/commands.js +1 -1
- package/lib/types/components/FileSuggestions.d.ts +2 -2
- package/lib/types/components/FileSuggestions.d.ts.map +1 -1
- package/lib/types/components/FileSuggestions.js +25 -5
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +3 -3
- package/lib/types/components/PromptInput.d.ts +7 -1
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +81 -23
- package/lib/types/components/SplitDiffView.d.ts.map +1 -1
- package/lib/types/components/SplitDiffView.js +3 -2
- package/lib/types/components/StarPrompt.d.ts +5 -3
- package/lib/types/components/StarPrompt.d.ts.map +1 -1
- package/lib/types/components/StarPrompt.js +56 -6
- package/lib/types/components/SubagentCard.d.ts.map +1 -1
- package/lib/types/components/SubagentCard.js +1 -1
- package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
- package/lib/types/components/SubagentDashboard.js +3 -2
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +121 -23
- package/lib/types/components/teamRoster.d.ts +6 -3
- package/lib/types/components/teamRoster.d.ts.map +1 -1
- package/lib/types/dsh-adapter/approvals.d.ts +19 -0
- package/lib/types/dsh-adapter/approvals.d.ts.map +1 -1
- package/lib/types/dsh-adapter/approvals.js +17 -1
- package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/translate.js +15 -3
- package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/extensions.js +7 -4
- package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/local-actions.js +7 -3
- package/lib/types/dsh-adapter/channel/projection-helpers.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/projection-helpers.js +4 -2
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +179 -33
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts +55 -4
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/subagent-projection.js +80 -16
- package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/subagent-transcript.js +6 -5
- package/lib/types/dsh-adapter/channel/task-completion.js +2 -10
- package/lib/types/dsh-adapter/childStderr.d.ts +1 -1
- package/lib/types/dsh-adapter/childStderr.d.ts.map +1 -1
- package/lib/types/dsh-adapter/childStderr.js +5 -0
- package/lib/types/dsh-adapter/compat/compaction-previews.d.ts +11 -0
- package/lib/types/dsh-adapter/compat/compaction-previews.d.ts.map +1 -0
- package/lib/types/dsh-adapter/compat/compaction-previews.js +38 -0
- package/lib/types/dsh-adapter/compat/messages.d.ts +1 -1
- package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/messages.js +2 -2
- package/lib/types/dsh-adapter/contract.d.ts +12 -5
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +15 -4
- package/lib/types/dsh-adapter/experimental-bundles.d.ts +5 -0
- package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -1
- package/lib/types/dsh-adapter/experimental-bundles.js +0 -2
- package/lib/types/dsh-adapter/extensions.d.ts +3 -2
- package/lib/types/dsh-adapter/extensions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/extensions.js +5 -2
- package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
- package/lib/types/dsh-adapter/host-contract.js +2 -2
- package/lib/types/dsh-adapter/host-dsh.d.ts +6 -0
- package/lib/types/dsh-adapter/host-dsh.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-dsh.js +29 -0
- package/lib/types/dsh-adapter/index.d.ts +9 -1
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +5 -0
- package/lib/types/dsh-adapter/mention-providers.d.ts +91 -0
- package/lib/types/dsh-adapter/mention-providers.d.ts.map +1 -0
- package/lib/types/dsh-adapter/mention-providers.js +214 -0
- package/lib/types/dsh-adapter/migrate/entry.d.ts +2 -0
- package/lib/types/dsh-adapter/migrate/entry.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/entry.js +46 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.d.ts +73 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.d.ts.map +1 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.js +250 -0
- package/lib/types/dsh-adapter/oauth/bonus.d.ts +34 -9
- package/lib/types/dsh-adapter/oauth/bonus.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/bonus.js +47 -5
- package/lib/types/dsh-adapter/oauth/deepseek.d.ts +7 -2
- package/lib/types/dsh-adapter/oauth/deepseek.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/deepseek.js +6 -1
- package/lib/types/dsh-adapter/oauth/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/index.js +44 -0
- package/lib/types/dsh-adapter/oauth/service.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/service.js +5 -6
- package/lib/types/dsh-adapter/plugin-manage.d.ts +6 -4
- package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-manage.js +3 -2
- package/lib/types/dsh-adapter/plugin.d.ts +237 -6
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +611 -23
- package/lib/types/dsh-adapter/session-projection-store.d.ts +1 -1
- package/lib/types/dsh-adapter/session-projection-store.d.ts.map +1 -1
- package/lib/types/dsh-adapter/session-projection-store.js +30 -23
- package/lib/types/dsh-adapter/sessionTree.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessionTree.js +4 -1
- package/lib/types/dsh-adapter/subagents.d.ts +1 -0
- package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
- package/lib/types/dsh-adapter/subagents.js +10 -2
- package/lib/types/dsh-adapter/team-mode.d.ts +29 -17
- package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-mode.js +138 -17
- package/lib/types/dsh-adapter/team-roster.d.ts +53 -18
- package/lib/types/dsh-adapter/team-roster.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-roster.js +206 -39
- package/lib/types/dsh-adapter/team-tools.d.ts +25 -12
- package/lib/types/dsh-adapter/team-tools.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-tools.js +81 -26
- package/lib/types/extensions.d.ts +2 -0
- package/lib/types/extensions.d.ts.map +1 -1
- package/lib/types/extensions.js +4 -1
- package/lib/types/i18n.d.ts +71 -11
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +32 -9
- package/lib/types/ink/dom.d.ts.map +1 -1
- package/lib/types/ink/dom.js +13 -3
- package/lib/types/ink/flush-tick.d.ts +6 -0
- package/lib/types/ink/flush-tick.d.ts.map +1 -1
- package/lib/types/ink/flush-tick.js +31 -0
- package/lib/types/ink/hooks/use-terminal-title.d.ts +15 -0
- package/lib/types/ink/hooks/use-terminal-title.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-terminal-title.js +23 -3
- package/lib/types/ink/ink.js +2 -2
- package/lib/types/ink/jumpback-state.d.ts +33 -0
- package/lib/types/ink/jumpback-state.d.ts.map +1 -0
- package/lib/types/ink/jumpback-state.js +51 -0
- package/lib/types/ink/jumpback.d.ts +78 -0
- package/lib/types/ink/jumpback.d.ts.map +1 -0
- package/lib/types/ink/jumpback.js +515 -0
- package/lib/types/ink/log-update.js +37 -14
- package/lib/types/ink/notify-helper/activate.cs +836 -0
- package/lib/types/ink/notify-helper/compile.d.ts +30 -0
- package/lib/types/ink/notify-helper/compile.d.ts.map +1 -0
- package/lib/types/ink/notify-helper/compile.js +235 -0
- package/lib/types/ink/terminal-notification-windows.d.ts +8 -4
- package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification-windows.js +14 -21
- package/lib/types/ink/terminal-notification.d.ts +31 -2
- package/lib/types/ink/terminal-notification.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification.js +51 -0
- package/lib/types/ink/terminal.d.ts +2 -1
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +9 -4
- package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
- package/lib/types/screens/AgentTranscriptScene.js +1 -1
- package/lib/types/screens/Chat.d.ts +8 -4
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +40 -11
- package/lib/types/settings/definitions.d.ts +12 -0
- package/lib/types/settings/definitions.d.ts.map +1 -1
- package/lib/types/settings/definitions.js +15 -7
- package/lib/types/utils/fileSuggestions.d.ts +14 -3
- package/lib/types/utils/fileSuggestions.d.ts.map +1 -1
- package/lib/types/utils/fileSuggestions.js +33 -0
- package/package.json +117 -112
- package/presets/liangshen/agent.cordis.yml +4 -0
- package/tui-profile/feed/README.md +1 -1
- package/tui-profile/feed/first-party.json +1 -1
|
@@ -1,21 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Read side of DSH
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* teammate
|
|
2
|
+
* Read side of DSH Agent Teams: the Lead session's `agentTeam` projection
|
|
3
|
+
* (saved selection + non-deleted task board, and — on older hosts — the
|
|
4
|
+
* durable member roster), folded for the session on screen. Inside a
|
|
5
|
+
* teammate it reads the Lead's value, found through the teammate header's
|
|
6
|
+
* `parentSession` (another child of the Lead reads none on a roster host).
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Two upstream wire shapes are told apart by shape, never by version:
|
|
9
|
+
*
|
|
10
|
+
* - `roster` — DSH `0.2.2-rc.1` and earlier: `agentTeam` carries
|
|
11
|
+
* `{members, tasks, failure?}`. The team exists only while the bundle that
|
|
12
|
+
* mounts the service is on, so an implicit one-member team is no team.
|
|
13
|
+
* - `switch` — DSH `0.2.2-rc.2` and later: `agentTeam` carries
|
|
14
|
+
* `{enabled, tasks, failure?}` and no members; the service ships in
|
|
15
|
+
* `dsh-base` and each root session saves its own selection. Members are the
|
|
16
|
+
* Lead's current subagents, supplied by the parent `subagentCatalog`
|
|
17
|
+
* projection and joined here.
|
|
18
|
+
*
|
|
19
|
+
* Neither package is imported: both wire values are narrowed locally.
|
|
10
20
|
*
|
|
11
21
|
* @module
|
|
12
22
|
*/
|
|
13
23
|
import { attachSessionProjection, createSessionProjectionStore } from './session-projection-store.js';
|
|
14
24
|
export const TEAM_PROJECTION_KEY = 'agentTeam';
|
|
15
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* The parent Session's direct-child catalog, and on `switch` hosts the only
|
|
27
|
+
* member source. Payload version 3 rows carry the child's model-facing `name`.
|
|
28
|
+
*/
|
|
29
|
+
export const SUBAGENT_CATALOG_KEY = 'subagentCatalog';
|
|
30
|
+
/**
|
|
31
|
+
* The upstream bundle that mounts the team service on `0.2.2-rc.1` and
|
|
32
|
+
* earlier hosts: the legacy switch. `0.2.2-rc.2` retires it (the service and
|
|
33
|
+
* task tools ship in `dsh-base`, switched per root session), so the name only
|
|
34
|
+
* serves the old-host flows and their migration hints.
|
|
35
|
+
*/
|
|
16
36
|
export const TEAM_BUNDLE = '@deepseek-ai/dsh-experimental-agent-team-profile';
|
|
17
37
|
const PHASES = new Set(['provisioning', 'active', 'failed']);
|
|
18
38
|
const TASK_STATUSES = new Set(['pending', 'in_progress', 'completed']);
|
|
39
|
+
const LEAD_NAME = 'lead';
|
|
19
40
|
function isRecord(value) {
|
|
20
41
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
21
42
|
}
|
|
@@ -25,74 +46,165 @@ function isStringArray(value) {
|
|
|
25
46
|
function asMember(value) {
|
|
26
47
|
if (!isRecord(value))
|
|
27
48
|
return undefined;
|
|
28
|
-
const { id, name, role, phase, error } = value;
|
|
49
|
+
const { id, name, role, phase, error, description } = value;
|
|
29
50
|
if (typeof id !== 'string' || typeof name !== 'string')
|
|
30
51
|
return undefined;
|
|
31
52
|
if (role !== 'lead' && role !== 'teammate')
|
|
32
53
|
return undefined;
|
|
33
54
|
if (typeof phase !== 'string' || !PHASES.has(phase))
|
|
34
55
|
return undefined;
|
|
35
|
-
return {
|
|
56
|
+
return {
|
|
57
|
+
id, name, role, phase: phase,
|
|
58
|
+
...typeof description === 'string' && description !== '' ? { description } : {},
|
|
59
|
+
...typeof error === 'string' ? { error } : {},
|
|
60
|
+
};
|
|
36
61
|
}
|
|
37
62
|
function asTask(value) {
|
|
38
63
|
if (!isRecord(value))
|
|
39
64
|
return undefined;
|
|
40
|
-
const { id, revision, subject, description, status, blockedBy, writeScopes, ownerName, ready, writeScopeWarnings } = value;
|
|
65
|
+
const { id, revision, subject, description, status, blockedBy, writeScopes, ownerName, owner, ready, writeScopeWarnings } = value;
|
|
41
66
|
if (typeof id !== 'string' || typeof revision !== 'number' || typeof subject !== 'string' || typeof description !== 'string')
|
|
42
67
|
return undefined;
|
|
43
68
|
if (typeof status !== 'string' || !TASK_STATUSES.has(status))
|
|
44
69
|
return undefined;
|
|
45
70
|
if (!isStringArray(blockedBy) || !isStringArray(writeScopes) || !isStringArray(writeScopeWarnings) || typeof ready !== 'boolean')
|
|
46
71
|
return undefined;
|
|
72
|
+
const ownerLabel = typeof ownerName === 'string' ? ownerName : typeof owner === 'string' ? owner : undefined;
|
|
47
73
|
return {
|
|
48
74
|
id, revision, subject, description, status: status, blockedBy, writeScopes, ready, writeScopeWarnings,
|
|
49
|
-
...
|
|
75
|
+
...ownerLabel === undefined ? {} : { ownerName: ownerLabel },
|
|
50
76
|
};
|
|
51
77
|
}
|
|
78
|
+
/** Narrow one parent catalog wire value; absent/malformed rows are skipped. */
|
|
79
|
+
function asCatalog(value) {
|
|
80
|
+
if (!Array.isArray(value))
|
|
81
|
+
return undefined;
|
|
82
|
+
const children = [];
|
|
83
|
+
for (const row of value) {
|
|
84
|
+
if (!isRecord(row) || typeof row.id !== 'string' || row.id === '')
|
|
85
|
+
continue;
|
|
86
|
+
const name = typeof row.name === 'string' && row.name !== '' ? row.name : undefined;
|
|
87
|
+
const label = typeof row.label === 'string' && row.label !== '' ? row.label : undefined;
|
|
88
|
+
children.push({ id: row.id, ...name === undefined ? {} : { name }, ...label === undefined ? {} : { label } });
|
|
89
|
+
}
|
|
90
|
+
return children;
|
|
91
|
+
}
|
|
52
92
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @param leadSessionId -
|
|
58
|
-
* @
|
|
93
|
+
* The Lead plus its named current subagents: what a `switch` host means by
|
|
94
|
+
* "team". The root is always `lead`; unnamed historical children cannot be
|
|
95
|
+
* addressed by name, so they stay out of the roster (the agents surface still
|
|
96
|
+
* lists their subagent rows under the remaining children).
|
|
97
|
+
* @param leadSessionId - Root Session id the `agentTeam` value belongs to.
|
|
98
|
+
* @param catalog - The root's direct-child catalog rows, if read yet.
|
|
59
99
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
100
|
+
function membersFromCatalog(leadSessionId, catalog) {
|
|
101
|
+
const members = [{ id: leadSessionId, name: LEAD_NAME, role: 'lead', phase: 'active' }];
|
|
102
|
+
const seen = new Set([leadSessionId]);
|
|
103
|
+
for (const child of catalog ?? []) {
|
|
104
|
+
if (child.name === undefined || child.name === LEAD_NAME || seen.has(child.id))
|
|
105
|
+
continue;
|
|
106
|
+
seen.add(child.id);
|
|
107
|
+
members.push({
|
|
108
|
+
id: child.id, name: child.name, role: 'teammate', phase: 'active',
|
|
109
|
+
...child.label === undefined ? {} : { description: child.label },
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return members;
|
|
113
|
+
}
|
|
114
|
+
/** The durable-roster wire (`0.2.2-rc.1` and earlier). */
|
|
115
|
+
function asRosterTeamView(value, leadSessionId) {
|
|
116
|
+
if (!Array.isArray(value.tasks))
|
|
62
117
|
return undefined;
|
|
63
|
-
const members = value.members
|
|
118
|
+
const members = value.members;
|
|
119
|
+
const roster = members.map(asMember);
|
|
64
120
|
const tasks = value.tasks.map(asTask);
|
|
65
|
-
if (
|
|
121
|
+
if (roster.includes(undefined) || tasks.includes(undefined))
|
|
66
122
|
return undefined;
|
|
67
123
|
const failure = typeof value.failure === 'string' ? value.failure : undefined;
|
|
68
|
-
const
|
|
124
|
+
const rows = roster;
|
|
69
125
|
const board = tasks;
|
|
70
|
-
if (!
|
|
126
|
+
if (!rows.some(member => member.role === 'teammate') && board.length === 0 && failure === undefined)
|
|
71
127
|
return undefined;
|
|
72
|
-
return { leadSessionId,
|
|
128
|
+
return { leadSessionId, mode: 'roster', enabled: true, members: rows, tasks: board, ...failure === undefined ? {} : { failure } };
|
|
129
|
+
}
|
|
130
|
+
/** The per-session selection wire (`0.2.2-rc.2` and later). */
|
|
131
|
+
function asSwitchTeamView(value, leadSessionId, catalog) {
|
|
132
|
+
if (typeof value.enabled !== 'boolean' || !Array.isArray(value.tasks))
|
|
133
|
+
return undefined;
|
|
134
|
+
const tasks = value.tasks.map(asTask);
|
|
135
|
+
if (tasks.includes(undefined))
|
|
136
|
+
return undefined;
|
|
137
|
+
const failure = typeof value.failure === 'string' ? value.failure : undefined;
|
|
138
|
+
const board = tasks;
|
|
139
|
+
// A root that never selected the team and has no record reads as none; a
|
|
140
|
+
// disabled root that still keeps its board is shown read-only.
|
|
141
|
+
if (!value.enabled && board.length === 0 && failure === undefined)
|
|
142
|
+
return undefined;
|
|
143
|
+
return {
|
|
144
|
+
leadSessionId, mode: 'switch', enabled: value.enabled,
|
|
145
|
+
members: membersFromCatalog(leadSessionId, catalog), tasks: board,
|
|
146
|
+
...failure === undefined ? {} : { failure },
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Narrow one `agentTeam` value into the view the UI renders. Both upstream
|
|
151
|
+
* shapes are told apart by the value itself; a session's implicit team (the
|
|
152
|
+
* Lead alone, no task, no failure) is no team on a roster host, while a
|
|
153
|
+
* `switch` host publishes the saved selection.
|
|
154
|
+
* @param value - Raw projection value.
|
|
155
|
+
* @param leadSessionId - The session the value was published for.
|
|
156
|
+
* @param catalog - The Lead's direct-child catalog (a `switch` host's member source).
|
|
157
|
+
* @returns the team view, or `undefined` when there is nothing to show.
|
|
158
|
+
*/
|
|
159
|
+
export function asTeamView(value, leadSessionId, catalog) {
|
|
160
|
+
if (!isRecord(value))
|
|
161
|
+
return undefined;
|
|
162
|
+
if (Array.isArray(value.members))
|
|
163
|
+
return asRosterTeamView(value, leadSessionId);
|
|
164
|
+
return asSwitchTeamView(value, leadSessionId, catalog);
|
|
73
165
|
}
|
|
74
166
|
/**
|
|
75
|
-
* The team a bound session belongs to is rooted at
|
|
76
|
-
*
|
|
167
|
+
* The team a bound session belongs to is rooted at its top-level ancestor:
|
|
168
|
+
* the Lead itself, or — for a delegated child — the root its creator chain
|
|
169
|
+
* reaches. On a roster host teammates are direct children of the Lead; a
|
|
170
|
+
* `switch` host can nest deeper. Loaded ancestors are followed by identity;
|
|
171
|
+
* one that is gone stops the walk at its recorded parent id (the value there
|
|
172
|
+
* is likely absent, which reads as no team rather than a stale one).
|
|
77
173
|
* @param session - The bound session.
|
|
78
|
-
* @param agents - Live agents, to find
|
|
174
|
+
* @param agents - Live agents, used to find loaded ancestors for traversal and baseline snapshots.
|
|
79
175
|
* @returns the session whose `agentTeam` value to read.
|
|
80
176
|
*/
|
|
81
177
|
export function teamRootOf(session, agents) {
|
|
82
178
|
const own = session;
|
|
83
|
-
|
|
84
|
-
if (typeof parent !== 'string')
|
|
179
|
+
if (own.header?.origin !== 'subagent')
|
|
85
180
|
return { id: String(own.id), session };
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
181
|
+
const loaded = new Map();
|
|
182
|
+
for (const agent of agents?.list() ?? [])
|
|
183
|
+
loaded.set(String(agent.session.id), agent.session);
|
|
184
|
+
const seen = new Set();
|
|
185
|
+
let current = own;
|
|
186
|
+
let currentSession = session;
|
|
187
|
+
for (;;) {
|
|
188
|
+
const parent = current.header?.parentSession;
|
|
189
|
+
if (typeof parent !== 'string' || parent === '' || seen.has(parent))
|
|
190
|
+
break;
|
|
191
|
+
seen.add(parent);
|
|
192
|
+
const ancestor = loaded.get(parent);
|
|
193
|
+
if (ancestor === undefined)
|
|
194
|
+
return { id: parent };
|
|
195
|
+
const next = ancestor;
|
|
196
|
+
if (next.header?.origin !== 'subagent')
|
|
197
|
+
return { id: parent, session: ancestor };
|
|
198
|
+
current = next;
|
|
199
|
+
currentSession = ancestor;
|
|
89
200
|
}
|
|
90
|
-
return { id:
|
|
201
|
+
return { id: String(current.id), session: currentSession };
|
|
91
202
|
}
|
|
92
203
|
/**
|
|
93
|
-
* The watched team as seen from `sessionId`: the Lead's own, or a
|
|
94
|
-
* teammate's.
|
|
95
|
-
*
|
|
204
|
+
* The watched team as seen from `sessionId`: the Lead's own, or — on a
|
|
205
|
+
* roster host — a listed teammate's. A `switch` host's tree is the team, so
|
|
206
|
+
* any session watched at that Lead reads it. Any other child of a roster
|
|
207
|
+
* host's Lead (a plain subagent, a workflow spawn) belongs to no team.
|
|
96
208
|
* @param team - The watched session's team.
|
|
97
209
|
* @param sessionId - The bound session.
|
|
98
210
|
* @returns the team, or `undefined` when the session is not on it.
|
|
@@ -100,6 +212,8 @@ export function teamRootOf(session, agents) {
|
|
|
100
212
|
export function teamFor(team, sessionId) {
|
|
101
213
|
if (team === undefined || team.leadSessionId === sessionId)
|
|
102
214
|
return team;
|
|
215
|
+
if (team.mode === 'switch')
|
|
216
|
+
return team;
|
|
103
217
|
return team.members.some(member => member.role === 'teammate' && member.id === sessionId) ? team : undefined;
|
|
104
218
|
}
|
|
105
219
|
/**
|
|
@@ -108,14 +222,52 @@ export function teamFor(team, sessionId) {
|
|
|
108
222
|
* @returns the store the channel reads from.
|
|
109
223
|
*/
|
|
110
224
|
export function createTeamRosterStore(ctx) {
|
|
225
|
+
const agents = () => ctx.get('agents');
|
|
226
|
+
const watch = (session) => {
|
|
227
|
+
const subagents = ctx.get('subagents');
|
|
228
|
+
if (subagents?.rootOf === undefined)
|
|
229
|
+
return teamRootOf(session, agents());
|
|
230
|
+
const agent = [...(agents()?.list() ?? [])].find(agent => agent.session === session);
|
|
231
|
+
if (agent === undefined)
|
|
232
|
+
return undefined;
|
|
233
|
+
try {
|
|
234
|
+
const root = subagents.rootOf(agent);
|
|
235
|
+
return { id: String(root.session.id), session: root.session };
|
|
236
|
+
}
|
|
237
|
+
catch {
|
|
238
|
+
// A separately restored delegated Session has no resident runtime owner.
|
|
239
|
+
return undefined;
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
// The member source of a `switch` host, watched at the same root as the team.
|
|
243
|
+
const catalogStore = createSessionProjectionStore({
|
|
244
|
+
key: SUBAGENT_CATALOG_KEY,
|
|
245
|
+
narrow: asCatalog,
|
|
246
|
+
watch,
|
|
247
|
+
warn: message => { ctx.logger.warn(message); },
|
|
248
|
+
});
|
|
111
249
|
const store = createSessionProjectionStore({
|
|
112
250
|
key: TEAM_PROJECTION_KEY,
|
|
113
251
|
// A team bundle switched off at run time takes the service down before
|
|
114
252
|
// (or while) its projection definition leaves: no service, no team.
|
|
115
|
-
narrow: (value, leadSessionId) => (ctx.get('agentTeams', false) === undefined
|
|
116
|
-
|
|
253
|
+
narrow: (value, leadSessionId) => (ctx.get('agentTeams', false) === undefined
|
|
254
|
+
? undefined
|
|
255
|
+
: asTeamView(value, leadSessionId, catalogStore.read())),
|
|
256
|
+
watch,
|
|
117
257
|
warn: message => { ctx.logger.warn(message); },
|
|
118
258
|
});
|
|
259
|
+
// The catalog arrives after (or before) the team wire, and either change
|
|
260
|
+
// recomposes the members a `switch` host renders: re-narrow on every move.
|
|
261
|
+
// The composite seed below rebinds both watches; a catalog change it causes
|
|
262
|
+
// must not reseed the team store while the team still points at the previous
|
|
263
|
+
// session (that reseed would narrow the old team against the new catalog and,
|
|
264
|
+
// through the overridden seed, bind the catalog back to the old root).
|
|
265
|
+
let seeding = false;
|
|
266
|
+
catalogStore.subscribe(() => { if (!seeding)
|
|
267
|
+
store.reseed(); });
|
|
268
|
+
// Attached in this order so the team feed stays the last listener on a
|
|
269
|
+
// single-listener registry (the order the pre-switch store wired itself in).
|
|
270
|
+
attachSessionProjection(ctx, SUBAGENT_CATALOG_KEY, catalogStore);
|
|
119
271
|
attachSessionProjection(ctx, TEAM_PROJECTION_KEY, store);
|
|
120
272
|
// The plugin manager announces every profile write it applied (`/team`,
|
|
121
273
|
// `/plugin`, the Web UI). Unregistering a projection emits nothing on the
|
|
@@ -130,7 +282,22 @@ export function createTeamRosterStore(ctx) {
|
|
|
130
282
|
if (name === 'agentTeams')
|
|
131
283
|
store.reseed();
|
|
132
284
|
}));
|
|
285
|
+
// Seeding the bound session fills both watches at once: the channel binds
|
|
286
|
+
// the team, and the catalog that supplies its members follows the same root.
|
|
287
|
+
const seedTeam = store.seed;
|
|
133
288
|
return Object.assign(store, {
|
|
289
|
+
seed(session) {
|
|
290
|
+
if (seeding)
|
|
291
|
+
return;
|
|
292
|
+
seeding = true;
|
|
293
|
+
try {
|
|
294
|
+
catalogStore.seed(session);
|
|
295
|
+
seedTeam(session);
|
|
296
|
+
}
|
|
297
|
+
finally {
|
|
298
|
+
seeding = false;
|
|
299
|
+
}
|
|
300
|
+
},
|
|
134
301
|
teamOf: (sessionId) => (store.boundId === sessionId ? teamFor(store.read(), sessionId) : undefined),
|
|
135
302
|
});
|
|
136
303
|
}
|
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Compact cards for DSH's
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `spawn_teammate` is not here — it renders as the subagent row, and as a
|
|
9
|
-
* plain card only when it fails before the teammate exists (translate.ts).
|
|
2
|
+
* Compact cards for DSH's Agent Teams tool results. The tools ship no
|
|
3
|
+
* presenters, so the plain card would show a capitalised tool id and a raw
|
|
4
|
+
* `⎿ {"messageId":…}` line. These views fold known shapes into one line;
|
|
5
|
+
* anything else (an error text, a changed upstream shape) falls back to the
|
|
6
|
+
* plain card. A presenter the tool itself registers always wins: these run
|
|
7
|
+
* only when it has none.
|
|
10
8
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* Two upstream generations of the same tools are read by shape:
|
|
10
|
+
*
|
|
11
|
+
* - **Team copies** (`0.2.2-rc.1` and earlier): `send_message` takes `target`,
|
|
12
|
+
* `list_agents` rows carry `target`, `interrupt_agent` answers
|
|
13
|
+
* `{previousStatus}`, and `spawn_teammate` is the delegation tool (it renders
|
|
14
|
+
* as the subagent row and as a plain card only when it fails before the
|
|
15
|
+
* teammate exists — translate.ts).
|
|
16
|
+
* - **Standard controls** (`0.2.2-rc.2` and later): the same tools take
|
|
17
|
+
* `agent` (a name or a Session id), `list_agents` rows are
|
|
18
|
+
* `{name, status, description?}`, `send_message` answers `{messageId}`,
|
|
19
|
+
* `interrupt_agent` `{accepted}`, and `wait_agent` no longer reports
|
|
20
|
+
* `noProgress`. `spawn_teammate` is gone; `subagent` / `subagent_fork` are
|
|
21
|
+
* the delegation tools.
|
|
22
|
+
*
|
|
23
|
+
* Older logs keep rendering: a team call is still recognised by its `target`
|
|
24
|
+
* argument, and a legacy control call (`agent_id`) keeps the plain card.
|
|
25
|
+
* Task results carry `owner` (the owner's name) on `0.2.2-rc.2` and
|
|
26
|
+
* `ownerName` before it; both are read.
|
|
14
27
|
*
|
|
15
28
|
* {@link teamMessageOf} reads a delivered team message for the transcript
|
|
16
29
|
* translator.
|
|
@@ -18,7 +31,7 @@
|
|
|
18
31
|
* @module
|
|
19
32
|
*/
|
|
20
33
|
import type { ToolCallView, ToolResultView } from './channel/types.js';
|
|
21
|
-
/** The
|
|
34
|
+
/** The bundle-host delegation tool; its presence is what "team on" means there. */
|
|
22
35
|
export declare const TEAM_SPAWN_TOOL = "spawn_teammate";
|
|
23
36
|
/** Whether `name` is a team tool with a compact card here (not `spawn_teammate`). */
|
|
24
37
|
export declare function isTeamToolName(name: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team-tools.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/team-tools.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"team-tools.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/team-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAgBtE,mFAAmF;AACnF,eAAO,MAAM,eAAe,mBAAmB,CAAA;AAE/C,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAuDD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAKxF;AA4ED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAa1G;AAMD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAgB7K"}
|
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Compact cards for DSH's
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `spawn_teammate` is not here — it renders as the subagent row, and as a
|
|
9
|
-
* plain card only when it fails before the teammate exists (translate.ts).
|
|
2
|
+
* Compact cards for DSH's Agent Teams tool results. The tools ship no
|
|
3
|
+
* presenters, so the plain card would show a capitalised tool id and a raw
|
|
4
|
+
* `⎿ {"messageId":…}` line. These views fold known shapes into one line;
|
|
5
|
+
* anything else (an error text, a changed upstream shape) falls back to the
|
|
6
|
+
* plain card. A presenter the tool itself registers always wins: these run
|
|
7
|
+
* only when it has none.
|
|
10
8
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* Two upstream generations of the same tools are read by shape:
|
|
10
|
+
*
|
|
11
|
+
* - **Team copies** (`0.2.2-rc.1` and earlier): `send_message` takes `target`,
|
|
12
|
+
* `list_agents` rows carry `target`, `interrupt_agent` answers
|
|
13
|
+
* `{previousStatus}`, and `spawn_teammate` is the delegation tool (it renders
|
|
14
|
+
* as the subagent row and as a plain card only when it fails before the
|
|
15
|
+
* teammate exists — translate.ts).
|
|
16
|
+
* - **Standard controls** (`0.2.2-rc.2` and later): the same tools take
|
|
17
|
+
* `agent` (a name or a Session id), `list_agents` rows are
|
|
18
|
+
* `{name, status, description?}`, `send_message` answers `{messageId}`,
|
|
19
|
+
* `interrupt_agent` `{accepted}`, and `wait_agent` no longer reports
|
|
20
|
+
* `noProgress`. `spawn_teammate` is gone; `subagent` / `subagent_fork` are
|
|
21
|
+
* the delegation tools.
|
|
22
|
+
*
|
|
23
|
+
* Older logs keep rendering: a team call is still recognised by its `target`
|
|
24
|
+
* argument, and a legacy control call (`agent_id`) keeps the plain card.
|
|
25
|
+
* Task results carry `owner` (the owner's name) on `0.2.2-rc.2` and
|
|
26
|
+
* `ownerName` before it; both are read.
|
|
14
27
|
*
|
|
15
28
|
* {@link teamMessageOf} reads a delivered team message for the transcript
|
|
16
29
|
* translator.
|
|
@@ -29,7 +42,7 @@ const DISPLAY_KEYS = {
|
|
|
29
42
|
team_task_get: 'tool-name-team-task',
|
|
30
43
|
team_task_update: 'tool-name-team-task',
|
|
31
44
|
};
|
|
32
|
-
/** The
|
|
45
|
+
/** The bundle-host delegation tool; its presence is what "team on" means there. */
|
|
33
46
|
export const TEAM_SPAWN_TOOL = 'spawn_teammate';
|
|
34
47
|
/** Whether `name` is a team tool with a compact card here (not `spawn_teammate`). */
|
|
35
48
|
export function isTeamToolName(name) {
|
|
@@ -44,10 +57,22 @@ function str(value) {
|
|
|
44
57
|
function firstLine(text) {
|
|
45
58
|
return text.split('\n', 1)[0].trim();
|
|
46
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Which generation of a shared-name control tool this call belongs to.
|
|
62
|
+
* `agent` is the `0.2.2-rc.2` argument name; `target` is the team copy's; a
|
|
63
|
+
* call with `agent_id` (or neither) is a legacy control and stays a plain card.
|
|
64
|
+
*/
|
|
65
|
+
function controlFlavor(args) {
|
|
66
|
+
if (str(args.agent) !== undefined)
|
|
67
|
+
return 'switch';
|
|
68
|
+
if (str(args.target) !== undefined)
|
|
69
|
+
return 'team';
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
47
72
|
function callTitle(name, args) {
|
|
48
73
|
switch (name) {
|
|
49
74
|
case 'send_message': {
|
|
50
|
-
const target = str(args.target);
|
|
75
|
+
const target = str(args.agent) ?? str(args.target);
|
|
51
76
|
if (target === undefined)
|
|
52
77
|
return undefined;
|
|
53
78
|
const message = str(args.message);
|
|
@@ -56,11 +81,11 @@ function callTitle(name, args) {
|
|
|
56
81
|
// `list_agents` / `wait_agent` calls carry nothing that tells them from the
|
|
57
82
|
// legacy subagent controls of the same names; only their results do.
|
|
58
83
|
case 'interrupt_agent':
|
|
59
|
-
return str(args.target);
|
|
84
|
+
return str(args.agent) ?? str(args.target);
|
|
60
85
|
case 'team_task_create':
|
|
61
86
|
return str(args.subject);
|
|
62
87
|
case 'team_task_list':
|
|
63
|
-
return ['status', 'owner', 'ready'].flatMap(key => (args[key] === undefined ? [] : [`${key}=${String(args[key])}`])).join(' ') || undefined;
|
|
88
|
+
return ['status', 'owner', 'ready', 'unowned'].flatMap(key => (args[key] === undefined ? [] : [`${key}=${String(args[key])}`])).join(' ') || undefined;
|
|
64
89
|
case 'team_task_get':
|
|
65
90
|
return str(args.task_id);
|
|
66
91
|
case 'team_task_update': {
|
|
@@ -98,39 +123,68 @@ function titleOf(name, rawArgs) {
|
|
|
98
123
|
}
|
|
99
124
|
return isRecord(args) ? callTitle(name, args) : undefined;
|
|
100
125
|
}
|
|
126
|
+
function argsOf(rawArgs) {
|
|
127
|
+
try {
|
|
128
|
+
const args = JSON.parse(rawArgs);
|
|
129
|
+
return isRecord(args) ? args : undefined;
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
101
135
|
function taskLine(task) {
|
|
102
136
|
const id = str(task.id);
|
|
103
137
|
const status = str(task.status);
|
|
104
138
|
if (id === undefined || status === undefined || typeof task.revision !== 'number')
|
|
105
139
|
return undefined;
|
|
106
|
-
|
|
140
|
+
// `owner` is the owner's name on 0.2.2-rc.2; earlier views publish `ownerName`.
|
|
141
|
+
const owner = str(task.owner) ?? str(task.ownerName);
|
|
107
142
|
return `${id} r${task.revision} · ${status}${owner === undefined ? '' : ` · ${owner}`}`;
|
|
108
143
|
}
|
|
109
|
-
function resultLine(name, value) {
|
|
144
|
+
function resultLine(name, value, args) {
|
|
110
145
|
switch (name) {
|
|
111
|
-
case 'send_message':
|
|
146
|
+
case 'send_message': {
|
|
112
147
|
if (!isRecord(value))
|
|
113
148
|
return undefined;
|
|
114
149
|
if (value.sent === true)
|
|
115
150
|
return 'sent';
|
|
116
151
|
// compat(dsh 0.2.0, log): the mailbox status a 0.2.0 send answered.
|
|
117
|
-
|
|
152
|
+
const legacyStatus = legacySendMessageStatus(value);
|
|
153
|
+
if (legacyStatus !== undefined)
|
|
154
|
+
return legacyStatus;
|
|
155
|
+
// The rc.2 control answers `{messageId}`; the legacy control's identical
|
|
156
|
+
// record stays raw (its call carries `agent_id`, not `agent`).
|
|
157
|
+
return args !== undefined && controlFlavor(args) === 'switch' && str(value.messageId) !== undefined ? 'sent' : undefined;
|
|
158
|
+
}
|
|
118
159
|
case 'list_agents': {
|
|
119
160
|
if (!Array.isArray(value))
|
|
120
161
|
return undefined;
|
|
121
|
-
const members = value.flatMap(member =>
|
|
122
|
-
|
|
123
|
-
|
|
162
|
+
const members = value.flatMap(member => {
|
|
163
|
+
if (!isRecord(member) || str(member.status) === undefined)
|
|
164
|
+
return [];
|
|
165
|
+
// `target` is the team copy's row; `name` is the standard control's.
|
|
166
|
+
const label = str(member.target) ?? str(member.name);
|
|
167
|
+
return label === undefined ? [] : [`${label} ${String(member.status)}`];
|
|
168
|
+
});
|
|
124
169
|
return members.length === value.length ? members.join(' · ') : undefined;
|
|
125
170
|
}
|
|
126
171
|
case 'wait_agent':
|
|
127
172
|
if (!isRecord(value) || typeof value.timedOut !== 'boolean')
|
|
128
173
|
return undefined;
|
|
174
|
+
// compat(team, log): the team copy's 0.2.2-rc.1 wait reported noProgress.
|
|
129
175
|
if (value.noProgress)
|
|
130
176
|
return 'noProgress';
|
|
131
177
|
return value.timedOut ? 'timedOut' : 'changed';
|
|
132
|
-
case 'interrupt_agent':
|
|
133
|
-
|
|
178
|
+
case 'interrupt_agent': {
|
|
179
|
+
if (!isRecord(value))
|
|
180
|
+
return undefined;
|
|
181
|
+
const previous = str(value.previousStatus);
|
|
182
|
+
if (previous !== undefined)
|
|
183
|
+
return previous;
|
|
184
|
+
// The standard control's `{accepted}` only means something for a call
|
|
185
|
+
// this card understands; a legacy control call keeps the raw result.
|
|
186
|
+
return controlFlavor(args ?? {}) === undefined ? undefined : typeof value.accepted === 'boolean' ? 'accepted' : undefined;
|
|
187
|
+
}
|
|
134
188
|
case 'team_task_list': {
|
|
135
189
|
if (!isRecord(value) || !Array.isArray(value.tasks))
|
|
136
190
|
return undefined;
|
|
@@ -166,7 +220,7 @@ export function teamToolResultView(name, rawArgs, text) {
|
|
|
166
220
|
catch {
|
|
167
221
|
return undefined;
|
|
168
222
|
}
|
|
169
|
-
const line = resultLine(name, value);
|
|
223
|
+
const line = resultLine(name, value, argsOf(rawArgs));
|
|
170
224
|
if (line === undefined)
|
|
171
225
|
return undefined;
|
|
172
226
|
const title = titleOf(name, rawArgs);
|
|
@@ -178,6 +232,7 @@ export function teamToolResultView(name, rawArgs, text) {
|
|
|
178
232
|
}
|
|
179
233
|
/** Relay framing: one whole leading block, `Team message from <name>:`. */
|
|
180
234
|
const RELAY_FRAMING = /^Team message from ([^\n]+):$/;
|
|
235
|
+
const AGENT_RELAY_FRAMING = /^Agent ([^\n]+) sent a message: $/;
|
|
181
236
|
/**
|
|
182
237
|
* An Agent Teams message delivered to a session (`user/message`): the
|
|
183
238
|
* generic relay (`agent-message` / `relay`) whose first block is exactly
|
|
@@ -191,7 +246,7 @@ const RELAY_FRAMING = /^Team message from ([^\n]+):$/;
|
|
|
191
246
|
export function teamMessageOf(source, content) {
|
|
192
247
|
const first = content[0];
|
|
193
248
|
const framing = agentRelaySourceOf(source) !== undefined && first?.type === 'text' && typeof first.text === 'string'
|
|
194
|
-
? RELAY_FRAMING.exec(first.text)
|
|
249
|
+
? (RELAY_FRAMING.exec(first.text) ?? AGENT_RELAY_FRAMING.exec(first.text))
|
|
195
250
|
: null;
|
|
196
251
|
if (framing === null)
|
|
197
252
|
return undefined;
|
|
@@ -12,6 +12,8 @@ export { TuiRendererRuntime } from './dsh-adapter/renderers.js';
|
|
|
12
12
|
export type { TuiEntryRenderer, TuiEntryRenderResult } from './dsh-adapter/renderers.js';
|
|
13
13
|
export { TuiToastRuntime } from './dsh-adapter/toast.js';
|
|
14
14
|
export type { TuiToastDelivery, TuiToastOptions, TuiToastSink } from './dsh-adapter/toast.js';
|
|
15
|
+
export { MENTION_PROVIDER_LIMITS, TuiMentionRuntime } from './dsh-adapter/mention-providers.js';
|
|
16
|
+
export type { TuiMentionItem, TuiMentionProvider } from './dsh-adapter/mention-providers.js';
|
|
15
17
|
export { TuiThemeRuntime } from './dsh-adapter/themes.js';
|
|
16
18
|
export type { TuiThemeBase, TuiThemeDescriptor, TuiThemeRegistration, } from './dsh-adapter/themes.js';
|
|
17
19
|
export { DECISION_EVENT_PERMISSIONS } from './dsh-adapter/decision-guard.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/extensions.ts"],"names":[],"mappings":"AAQA,cAAc,6BAA6B,CAAA;AAI3C,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,mCAAmC,CAAA;AAC1C,YAAY,EACV,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EACf,kBAAkB,GACnB,MAAM,mCAAmC,CAAA;AAI1C,OAAO,EACL,yBAAyB,EACzB,WAAW,EACX,gBAAgB,EAChB,cAAc,GACf,MAAM,0BAA0B,CAAA;AACjC,YAAY,EACV,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC1E,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,GAChB,MAAM,yBAAyB,CAAA;AAChC,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAClG,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAG7F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA"}
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/extensions.ts"],"names":[],"mappings":"AAQA,cAAc,6BAA6B,CAAA;AAI3C,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,mCAAmC,CAAA;AAC1C,YAAY,EACV,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EACf,kBAAkB,GACnB,MAAM,mCAAmC,CAAA;AAI1C,OAAO,EACL,yBAAyB,EACzB,WAAW,EACX,gBAAgB,EAChB,cAAc,GACf,MAAM,0BAA0B,CAAA;AACjC,YAAY,EACV,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC1E,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,GAChB,MAAM,yBAAyB,CAAA;AAChC,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAClG,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAG7F,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AAC/F,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAG5F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA"}
|
package/lib/types/extensions.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Plugin authors import the seam types from here
|
|
4
4
|
// (`@deepseek-harness-tui/dsh-tui/extensions`); importing the module also
|
|
5
5
|
// applies the `declare module '@deepseek-ai/cordis'` augmentation for the
|
|
6
|
-
// decision events and the
|
|
6
|
+
// decision events and the seven service properties on Context. In particular,
|
|
7
7
|
// `tuiStatus.registerView()` returns `undefined` when the host refuses a rich
|
|
8
8
|
// registration, or a cleanup-aware disposer when it admits one.
|
|
9
9
|
export * from './dsh-adapter/extensions.js';
|
|
@@ -19,6 +19,9 @@ export { TuiStatusRuntime, TuiStatusStore } from './dsh-adapter/status.js';
|
|
|
19
19
|
export { matchShortcut, parseShortcutCombo, TuiShortcutRuntime } from './dsh-adapter/shortcuts.js';
|
|
20
20
|
export { TuiRendererRuntime } from './dsh-adapter/renderers.js';
|
|
21
21
|
export { TuiToastRuntime } from './dsh-adapter/toast.js';
|
|
22
|
+
// Plugin `@` completion: registration only. The composer's query facade
|
|
23
|
+
// (`getHostMentions`) stays behind the adapter boundary.
|
|
24
|
+
export { MENTION_PROVIDER_LIMITS, TuiMentionRuntime } from './dsh-adapter/mention-providers.js';
|
|
22
25
|
// Runtime themes expose only the registration capability. The host snapshot,
|
|
23
26
|
// resolver and subscription accessor stay behind the adapter boundary.
|
|
24
27
|
export { TuiThemeRuntime } from './dsh-adapter/themes.js';
|