@wowyuarm/dsh-agent-team 0.1.3 → 0.1.4
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 +7 -1
- package/README.zh.md +7 -1
- package/package.json +1 -1
- package/packages/agent-team/README.md +3 -3
- package/packages/agent-team/README.zh.md +3 -3
- package/packages/agent-team/lib/index.js +38 -9
- package/packages/agent-team/lib/ledger.js +275 -108
- package/packages/agent-team/lib/spec.js +27 -11
- package/packages/agent-team/lib/typert.host.js +185 -86
- package/packages/agent-team/lib/typert.remote-client.d.ts +3 -1
- package/packages/agent-team/lib/typert.remote-client.d.ts.map +1 -1
- package/packages/agent-team/lib/typert.remote-client.js +139 -59
- package/packages/agent-team/lib/types/index.d.ts +12 -7
- package/packages/agent-team/lib/types/index.d.ts.map +1 -1
- package/packages/agent-team/lib/types/ledger.d.ts +16 -2
- package/packages/agent-team/lib/types/ledger.d.ts.map +1 -1
- package/packages/agent-team/lib/types/spec.d.ts.map +1 -1
- package/packages/agent-team/lib/types/types.d.ts +69 -30
- package/packages/agent-team/lib/types/types.d.ts.map +1 -1
- package/packages/agent-team/preset/team-member/agent.cordis.yml +1 -1
- package/packages/client-agent-team/README.md +2 -1
- package/packages/client-agent-team/README.zh.md +2 -1
- package/packages/client-agent-team/lib/client.js +625 -319
- package/packages/client-agent-team/lib/client.js.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.js +34 -12
- package/packages/client-agent-team/lib/types/client/TeamChannelPage.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamChannelPage.js +14 -10
- package/packages/client-agent-team/lib/types/client/TeamComposer.d.ts +6 -1
- package/packages/client-agent-team/lib/types/client/TeamComposer.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamComposer.js +4 -4
- package/packages/client-agent-team/lib/types/client/TeamConversation.d.ts +1 -1
- package/packages/client-agent-team/lib/types/client/TeamConversation.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamConversation.js +3 -3
- package/packages/client-agent-team/lib/types/client/TeamMessage.d.ts +4 -1
- package/packages/client-agent-team/lib/types/client/TeamMessage.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamMessage.js +16 -9
- package/packages/client-agent-team/lib/types/client/TeamThreadPage.d.ts +2 -1
- package/packages/client-agent-team/lib/types/client/TeamThreadPage.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamThreadPage.js +71 -16
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.js +2 -1
- package/packages/client-agent-team/lib/types/client/index.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/index.js +1 -0
- package/packages/client-agent-team/lib/types/client/locales.d.ts +24 -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 +24 -0
- package/packages/client-agent-team/lib/types/client/navigation.d.ts +1 -1
- package/packages/client-agent-team/lib/types/client/navigation.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/navigation.js +12 -6
- package/packages/client-agent-team/lib/types/client/slots.d.ts +2 -1
- package/packages/client-agent-team/lib/types/client/slots.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/task-refs.d.ts +1 -1
- package/packages/client-agent-team/lib/types/client/task-refs.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/task-refs.js +1 -1
- package/packages/client-agent-team/lib/types/client/team-formatters.d.ts +9 -0
- package/packages/client-agent-team/lib/types/client/team-formatters.d.ts.map +1 -1
- package/packages/client-agent-team/lib/types/client/team-formatters.js +13 -0
- package/packages/tool-agent-team/README.md +7 -7
- package/packages/tool-agent-team/README.zh.md +7 -7
- package/packages/tool-agent-team/lib/index.js +38 -28
- package/packages/tool-agent-team/lib/types/index.d.ts.map +1 -1
|
@@ -25,13 +25,13 @@ const teamInbox = defineTool({
|
|
|
25
25
|
schema: { type: 'object', additionalProperties: false, properties: {
|
|
26
26
|
totalUnreadCount: { type: 'number', required: true }, totalDirectCount: { type: 'number', required: true },
|
|
27
27
|
items: { type: 'array', required: true, items: { type: 'object', additionalProperties: false, properties: {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
threadRef: { type: 'string', required: true }, channelRef: { type: 'string', required: true },
|
|
29
|
+
taskRef: { type: 'string' }, status: { type: 'string' }, revision: { type: 'number', required: true }, unreadCount: { type: 'number', required: true }, directCount: { type: 'number', required: true },
|
|
30
30
|
taskNumber: { type: 'number' },
|
|
31
31
|
} } },
|
|
32
32
|
} },
|
|
33
33
|
render: (_args, value) => [{ type: 'text', text: value.items.length === 0 ? 'No unread Team work.'
|
|
34
|
-
: value.items.map(item => `${item.taskRef}${item.taskNumber === undefined ? '' : ` (#${item.taskNumber})`} · ${item.directCount > 0 ? 'direct' : 'unread'}, ${item.unreadCount} update(s), revision ${item.revision}`).join('\n') }],
|
|
34
|
+
: value.items.map(item => `${item.threadRef}${item.taskRef === undefined ? '' : ` · ${item.taskRef}`}${item.taskNumber === undefined ? '' : ` (#${item.taskNumber})`} · ${item.directCount > 0 ? 'direct' : 'unread'}, ${item.unreadCount} update(s), revision ${item.revision}`).join('\n') }],
|
|
35
35
|
},
|
|
36
36
|
async execute(args, exec) {
|
|
37
37
|
const agent = exec.agent;
|
|
@@ -45,9 +45,10 @@ const teamInbox = defineTool({
|
|
|
45
45
|
return {
|
|
46
46
|
totalUnreadCount: inbox.totalUnreadCount, totalDirectCount: inbox.totalDirectCount,
|
|
47
47
|
items: inbox.items.map(item => {
|
|
48
|
-
const taskNumber = taskNumbers.get(item.task.taskRef);
|
|
49
|
-
return {
|
|
50
|
-
|
|
48
|
+
const taskNumber = item.task === undefined ? undefined : taskNumbers.get(item.task.taskRef);
|
|
49
|
+
return { threadRef: item.thread.threadRef, channelRef: item.channelRef,
|
|
50
|
+
...(item.task === undefined ? {} : { taskRef: item.task.taskRef, status: item.task.status }),
|
|
51
|
+
revision: item.thread.revision, unreadCount: item.unreadCount, directCount: item.directCount,
|
|
51
52
|
...(taskNumber === undefined ? {} : { taskNumber }) };
|
|
52
53
|
}),
|
|
53
54
|
};
|
|
@@ -55,16 +56,17 @@ const teamInbox = defineTool({
|
|
|
55
56
|
});
|
|
56
57
|
const teamThread = defineTool({
|
|
57
58
|
name: 'team_thread',
|
|
58
|
-
description: 'Read or manage your Attention on one
|
|
59
|
+
description: 'Read or manage your Attention on one Thread. read acknowledges one chronological batch; history does not change read state. Prefer threadRef; taskRef is a compatibility alias when the Thread has a Task.',
|
|
59
60
|
parameters: {
|
|
60
61
|
action: { type: 'string', required: true, enum: ['status', 'follow', 'unfollow', 'read', 'history'] },
|
|
61
|
-
|
|
62
|
+
threadRef: { type: 'string', description: "Full branded Thread ref exactly as returned by Team tools, including the 'thread:' prefix." },
|
|
63
|
+
taskRef: { type: 'string', description: "Optional Task ref alias for released clients. Prefer threadRef; if both are given they must identify the same Thread." },
|
|
62
64
|
beforeSequence: { type: 'number' }, limit: { type: 'number' },
|
|
63
65
|
},
|
|
64
66
|
output: {
|
|
65
67
|
schema: { type: 'object', additionalProperties: false, properties: {
|
|
66
|
-
kind: { type: 'string', required: true },
|
|
67
|
-
revision: { type: 'number', required: true }, status: { type: 'string'
|
|
68
|
+
kind: { type: 'string', required: true }, threadRef: { type: 'string', required: true }, taskRef: { type: 'string' },
|
|
69
|
+
revision: { type: 'number', required: true }, status: { type: 'string' }, resolution: { type: 'string' },
|
|
68
70
|
following: { type: 'boolean', required: true }, readThroughSequence: { type: 'number' }, remainingUnreadCount: { type: 'number' }, cursor: { type: 'number' }, hasMore: { type: 'boolean' },
|
|
69
71
|
anchor: { type: 'object', required: true, additionalProperties: false, properties: {
|
|
70
72
|
messageRef: { type: 'string', required: true }, sender: { type: 'string', required: true }, body: { type: 'string', required: true }, sequence: { type: 'number', required: true },
|
|
@@ -88,7 +90,9 @@ const teamThread = defineTool({
|
|
|
88
90
|
throw new Error('team_thread requires an Agent session');
|
|
89
91
|
const current = member(agent);
|
|
90
92
|
const host = service(agent);
|
|
91
|
-
|
|
93
|
+
if (args.threadRef === undefined && args.taskRef === undefined)
|
|
94
|
+
throw new Error('team_thread requires threadRef');
|
|
95
|
+
const base = { workspaceId: current.workspaceId, ...(args.threadRef === undefined ? {} : { threadRef: args.threadRef }), ...(args.taskRef === undefined ? {} : { taskRef: args.taskRef }) };
|
|
92
96
|
if (args.action === 'status') {
|
|
93
97
|
if (args.beforeSequence !== undefined || args.limit !== undefined)
|
|
94
98
|
throw new Error('status does not accept history arguments');
|
|
@@ -120,8 +124,9 @@ const teamThread = defineTool({
|
|
|
120
124
|
});
|
|
121
125
|
function threadResult(kind, snapshot, attention, facts, extra = {}) {
|
|
122
126
|
return {
|
|
123
|
-
kind,
|
|
124
|
-
status: snapshot.task.status, resolution: snapshot.task.resolution
|
|
127
|
+
kind, threadRef: snapshot.thread.threadRef, revision: snapshot.thread.revision,
|
|
128
|
+
...(snapshot.task === undefined ? {} : { taskRef: snapshot.task.taskRef, status: snapshot.task.status, resolution: snapshot.task.resolution }),
|
|
129
|
+
following: attention !== undefined,
|
|
125
130
|
...extra,
|
|
126
131
|
...(attention === undefined || extra.readThroughSequence !== undefined ? {} : { readThroughSequence: attention.readThroughSequence }),
|
|
127
132
|
anchor: { messageRef: snapshot.anchor.messageRef, sender: snapshot.anchor.sender, body: snapshot.anchor.body, sequence: snapshot.anchor.sequence },
|
|
@@ -131,12 +136,14 @@ function threadResult(kind, snapshot, attention, facts, extra = {}) {
|
|
|
131
136
|
}
|
|
132
137
|
const teamMessage = markAgentTeamPreset(defineTool({
|
|
133
138
|
name: 'team_message',
|
|
134
|
-
description: '
|
|
139
|
+
description: 'Start a top-level Thread or reply to an existing Thread. start defaults to a taskless Thread; pass asTask true to create a Task in the same send. Read the Thread first; replies require its current revision (an internal concurrency token carried by baseRevision, never quoted in bodies). A top-level start may mention related Agents directly; in replies, only a Human can invite an unfollowed Agent. Pass Member refs in mentions and spell their handles inside the body; only mentioned Members render as mention chips.',
|
|
135
140
|
parameters: {
|
|
136
141
|
action: { type: 'string', required: true, enum: ['start', 'reply'] },
|
|
137
142
|
channelRef: { type: 'string', description: "Full branded Channel ref exactly as returned by Team tools, including the 'channel:' prefix." },
|
|
138
|
-
|
|
139
|
-
|
|
143
|
+
threadRef: { type: 'string', description: "Full branded Thread ref exactly as returned by Team tools, including the 'thread:' prefix." },
|
|
144
|
+
taskRef: { type: 'string', description: "Optional Task ref alias for reply on a Taskful Thread. Prefer threadRef." },
|
|
145
|
+
asTask: { type: 'boolean', description: 'When true, start creates a Task with the Thread. Default false creates a taskless Thread.' },
|
|
146
|
+
body: { type: 'string', required: true, description: "Markdown body. Cite Team refs exactly as returned, as bare text with one colon (e.g. task:0f0a…) — never a double colon, never inside backticks or quotes. Spell each mentioned Member's handle in the prose so the mention renders inline." }, baseRevision: { type: 'number', description: "Positive integer; use the current Thread revision as shown by the latest team_inbox or team_thread result for this Thread. The revision is an internal concurrency token, not a citable fact." },
|
|
140
147
|
mentions: { type: 'array', items: { type: 'string' }, description: 'Member refs to mention. Mentioned Agents receive the Message directly; write their handles in the body (any casing, optional @) so the mention renders inline.' },
|
|
141
148
|
attachments: { type: 'array', items: { type: 'string' }, description: 'Absolute file paths to share, e.g. screenshots or generated artifacts; images render as thumbnails for recipients. The Host validates each path and copies the file into the attachment cache, and members also receive one cached path per attachment; if any path fails validation the whole send is rejected.' },
|
|
142
149
|
},
|
|
@@ -146,7 +153,7 @@ const teamMessage = markAgentTeamPreset(defineTool({
|
|
|
146
153
|
expectedRevision: { type: 'number' }, messageRef: { type: 'string' }, memberIds: { type: 'array', items: { type: 'string' } }, unreadCount: { type: 'number' }, directCount: { type: 'number' },
|
|
147
154
|
} },
|
|
148
155
|
render: (_args, value) => [{ type: 'text', text: value.kind === 'committed' ? `Message ${value.messageRef} committed at revision ${value.revision}.`
|
|
149
|
-
: `${value.kind}: ${value.memberIds?.join(', ') ??
|
|
156
|
+
: `${value.kind}: ${value.memberIds?.join(', ') ?? `${value.threadRef ?? ''}${value.taskRef === undefined ? '' : ` · Task ${value.taskRef}`} revision ${value.revision ?? ''}`}` }],
|
|
150
157
|
},
|
|
151
158
|
async execute(args, exec) {
|
|
152
159
|
const agent = exec.agent;
|
|
@@ -159,34 +166,37 @@ const teamMessage = markAgentTeamPreset(defineTool({
|
|
|
159
166
|
const attachmentPaths = Array.isArray(rawPaths) ? rawPaths.filter((entry) => typeof entry === 'string' && entry.trim() !== '') : undefined;
|
|
160
167
|
const paths = attachmentPaths !== undefined && attachmentPaths.length > 0 ? { attachmentPaths } : {};
|
|
161
168
|
if (args.action === 'start') {
|
|
162
|
-
if (args.channelRef === undefined || args.taskRef !== undefined || args.baseRevision !== undefined)
|
|
163
|
-
throw new Error('start requires channelRef and does not accept taskRef or baseRevision');
|
|
169
|
+
if (args.channelRef === undefined || args.taskRef !== undefined || args.threadRef !== undefined || args.baseRevision !== undefined)
|
|
170
|
+
throw new Error('start requires channelRef and does not accept threadRef, taskRef, or baseRevision');
|
|
164
171
|
const result = await host.sendMessageForAgent(agent, { requestId: requestId(agent.id, exec.callId), workspaceId: current.workspaceId,
|
|
165
|
-
channelRef: args.channelRef, body: args.body, ...(mentions === undefined ? {} : { recipients: mentions }), ...paths });
|
|
172
|
+
channelRef: args.channelRef, body: args.body, asTask: args.asTask === true, ...(mentions === undefined ? {} : { recipients: mentions }), ...paths });
|
|
166
173
|
return messageOutcome(result);
|
|
167
174
|
}
|
|
168
175
|
const baseRevision = args.baseRevision;
|
|
169
|
-
if (args.taskRef === undefined || args.channelRef !== undefined || typeof baseRevision !== 'number' || !Number.isSafeInteger(baseRevision) || baseRevision < 1) {
|
|
170
|
-
throw new Error("reply requires
|
|
176
|
+
if ((args.threadRef === undefined && args.taskRef === undefined) || args.channelRef !== undefined || args.asTask !== undefined || typeof baseRevision !== 'number' || !Number.isSafeInteger(baseRevision) || baseRevision < 1) {
|
|
177
|
+
throw new Error("reply requires threadRef and a positive baseRevision, and does not accept channelRef; use the current Thread 'revision' returned by team_inbox or team_thread");
|
|
171
178
|
}
|
|
172
179
|
const result = await host.replyForAgent(agent, { requestId: requestId(agent.id, exec.callId), workspaceId: current.workspaceId,
|
|
173
|
-
|
|
180
|
+
...(args.threadRef === undefined ? {} : { threadRef: args.threadRef }),
|
|
181
|
+
...(args.taskRef === undefined ? {} : { taskRef: args.taskRef }),
|
|
182
|
+
body: args.body, baseRevision,
|
|
174
183
|
...(mentions === undefined ? {} : { recipients: mentions }), ...paths });
|
|
175
184
|
return messageOutcome(result);
|
|
176
185
|
},
|
|
177
186
|
}));
|
|
178
187
|
function messageOutcome(result) {
|
|
179
188
|
if (result.kind === 'committed')
|
|
180
|
-
return { kind: result.kind,
|
|
189
|
+
return { kind: result.kind, threadRef: result.thread.threadRef,
|
|
190
|
+
...(result.task === undefined ? {} : { taskRef: result.task.taskRef }),
|
|
181
191
|
revision: result.thread.revision, messageRef: result.message.messageRef };
|
|
182
192
|
if (result.kind === 'member_not_following')
|
|
183
193
|
return { kind: result.kind, memberIds: [...result.memberIds],
|
|
184
194
|
...(result.taskRef === undefined ? {} : { taskRef: result.taskRef }), ...(result.threadRef === undefined ? {} : { threadRef: result.threadRef, revision: result.revision }) };
|
|
185
195
|
if (result.kind === 'unread_required')
|
|
186
|
-
return { kind: result.kind, taskRef: result.taskRef, threadRef: result.threadRef,
|
|
196
|
+
return { kind: result.kind, ...(result.taskRef === undefined ? {} : { taskRef: result.taskRef }), threadRef: result.threadRef,
|
|
187
197
|
revision: result.revision, unreadCount: result.unreadCount, directCount: result.directCount };
|
|
188
198
|
if (result.kind === 'stale_revision')
|
|
189
|
-
return { kind: result.kind, taskRef: result.taskRef, threadRef: result.threadRef,
|
|
199
|
+
return { kind: result.kind, ...(result.taskRef === undefined ? {} : { taskRef: result.taskRef }), threadRef: result.threadRef,
|
|
190
200
|
expectedRevision: result.expectedRevision, revision: result.revision };
|
|
191
201
|
throw new Error('Agents cannot receive invitation confirmations');
|
|
192
202
|
}
|
|
@@ -238,9 +248,9 @@ const teamClaim = defineTool({
|
|
|
238
248
|
return { kind: result.kind, taskRef: result.task.taskRef, threadRef: result.thread.threadRef,
|
|
239
249
|
revision: result.thread.revision, status: result.task.status, claims };
|
|
240
250
|
if (result.kind === 'unread_required')
|
|
241
|
-
return { kind: result.kind, taskRef:
|
|
251
|
+
return { kind: result.kind, taskRef: listed.task.taskRef, threadRef: result.threadRef,
|
|
242
252
|
revision: result.revision, status: listed.task.status, unreadCount: result.unreadCount, directCount: result.directCount, claims };
|
|
243
|
-
return { kind: result.kind, taskRef:
|
|
253
|
+
return { kind: result.kind, taskRef: listed.task.taskRef, threadRef: result.threadRef, expectedRevision: result.expectedRevision,
|
|
244
254
|
revision: result.revision, status: listed.task.status, claims };
|
|
245
255
|
},
|
|
246
256
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAWlD,eAAO,MAAM,IAAI,8BAA8B,CAAA;AAC/C,eAAO,MAAM,MAAM,UAAY,CAAA;AAqS/B,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAMxC"}
|