@dxos/assistant-toolkit 0.16.0 → 0.17.0
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/dist/lib/chunk-AgentOperation.mjs +5 -1
- package/dist/lib/chunk-AgentOperation.mjs.map +1 -1
- package/dist/lib/chunk-AgentOperationHandlerSet.mjs +1 -1
- package/dist/lib/chunk-AgentSkill.mjs +1 -1
- package/dist/lib/chunk-AlarmSkill.mjs +1 -1
- package/dist/lib/chunk-BrowserSkill.mjs +4 -6
- package/dist/lib/chunk-BrowserSkill.mjs.map +1 -1
- package/dist/lib/chunk-ChatContextSkill.mjs +1 -1
- package/dist/lib/chunk-DelegationSkill.mjs +2 -2
- package/dist/lib/chunk-DelegationSkill.mjs.map +1 -1
- package/dist/lib/chunk-DelegationStrategy.mjs +16 -30
- package/dist/lib/chunk-DelegationStrategy.mjs.map +1 -1
- package/dist/lib/chunk-PlanningSkill.mjs +12 -10
- package/dist/lib/chunk-PlanningSkill.mjs.map +1 -1
- package/dist/lib/chunk-SkillManagerSkill.mjs +62 -7
- package/dist/lib/chunk-SkillManagerSkill.mjs.map +1 -1
- package/dist/lib/chunk-SlashCommand.mjs +2 -2
- package/dist/lib/chunk-SlashCommand.mjs.map +1 -1
- package/dist/lib/chunk-add-mcp-connection.mjs +58 -0
- package/dist/lib/chunk-add-mcp-connection.mjs.map +1 -0
- package/dist/lib/chunk-ask-question.mjs.map +1 -1
- package/dist/lib/chunk-catalog.mjs +86 -0
- package/dist/lib/chunk-catalog.mjs.map +1 -0
- package/dist/lib/chunk-context-add.mjs +1 -1
- package/dist/lib/chunk-context-remove.mjs +1 -1
- package/dist/lib/chunk-delegate-task.mjs +2 -2
- package/dist/lib/chunk-delegate-task.mjs.map +1 -1
- package/dist/lib/chunk-delegate-tasks.mjs +2 -8
- package/dist/lib/chunk-delegate-tasks.mjs.map +1 -1
- package/dist/lib/chunk-enable-skills.mjs +1 -1
- package/dist/lib/chunk-get-context.mjs +1 -1
- package/dist/lib/chunk-get-current-date.mjs +1 -1
- package/dist/lib/chunk-mcp-connections.mjs +26 -0
- package/dist/lib/chunk-mcp-connections.mjs.map +1 -0
- package/dist/lib/chunk-operations.mjs +2 -2
- package/dist/lib/chunk-operations.mjs.map +1 -1
- package/dist/lib/chunk-operations2.mjs +144 -9
- package/dist/lib/chunk-operations2.mjs.map +1 -1
- package/dist/lib/chunk-operations3.mjs +6 -5
- package/dist/lib/chunk-operations3.mjs.map +1 -1
- package/dist/lib/chunk-operations4.mjs +30 -55
- package/dist/lib/chunk-operations4.mjs.map +1 -1
- package/dist/lib/chunk-operations5.mjs +28 -27
- package/dist/lib/chunk-operations5.mjs.map +1 -1
- package/dist/lib/chunk-operations6.mjs +64 -29
- package/dist/lib/chunk-operations6.mjs.map +1 -1
- package/dist/lib/chunk-operations7.mjs +4 -79
- package/dist/lib/chunk-operations7.mjs.map +1 -1
- package/dist/lib/chunk-plan-reminder.mjs +7 -12
- package/dist/lib/chunk-plan-reminder.mjs.map +1 -1
- package/dist/lib/chunk-query-mcp-connections.mjs +16 -0
- package/dist/lib/chunk-query-mcp-connections.mjs.map +1 -0
- package/dist/lib/chunk-query-operations.mjs +23 -0
- package/dist/lib/chunk-query-operations.mjs.map +1 -0
- package/dist/lib/chunk-query-skills.mjs +23 -3
- package/dist/lib/chunk-query-skills.mjs.map +1 -1
- package/dist/lib/chunk-query-types.mjs +24 -0
- package/dist/lib/chunk-query-types.mjs.map +1 -0
- package/dist/lib/chunk-relay.mjs +1 -1
- package/dist/lib/chunk-run-instructions.mjs +14 -10
- package/dist/lib/chunk-run-instructions.mjs.map +1 -1
- package/dist/lib/chunk-set-alarm.mjs +1 -1
- package/dist/lib/chunk-set-mcp-connection.mjs +18 -0
- package/dist/lib/chunk-set-mcp-connection.mjs.map +1 -0
- package/dist/lib/chunk-sync-automation.mjs +1 -1
- package/dist/lib/chunk-update-tasks.mjs +20 -3
- package/dist/lib/chunk-update-tasks.mjs.map +1 -1
- package/dist/lib/index.mjs +1 -3
- package/dist/lib/ns/AgentOperationHandlerSet.mjs +1 -1
- package/dist/lib/ns/AgentSkill.mjs +1 -1
- package/dist/lib/ns/AlarmSkill.mjs +1 -1
- package/dist/lib/ns/ChatContextSkill.mjs +1 -1
- package/dist/lib/ns/PlanningSkill.mjs +2 -2
- package/dist/lib/ns/SkillManagerSkill.mjs +3 -3
- package/dist/lib/testing.mjs +7 -10
- package/dist/lib/testing.mjs.map +1 -1
- package/dist/types/src/commands.d.ts +10 -0
- package/dist/types/src/commands.d.ts.map +1 -1
- package/dist/types/src/operations/run-instructions.d.ts.map +1 -1
- package/dist/types/src/skills/browser/BrowserSkill.d.ts.map +1 -1
- package/dist/types/src/skills/delegation/operations/delegate-task.d.ts +1 -1
- package/dist/types/src/skills/delegation/operations/delegate-tasks.d.ts +0 -6
- package/dist/types/src/skills/delegation/operations/delegate-tasks.d.ts.map +1 -1
- package/dist/types/src/skills/index.d.ts +0 -1
- package/dist/types/src/skills/index.d.ts.map +1 -1
- package/dist/types/src/skills/planning/PlanningSkill.d.ts +3 -0
- package/dist/types/src/skills/planning/PlanningSkill.d.ts.map +1 -1
- package/dist/types/src/skills/planning/operations/definitions.d.ts +3 -1
- package/dist/types/src/skills/planning/operations/definitions.d.ts.map +1 -1
- package/dist/types/src/skills/planning/operations/plan-reminder.d.ts +6 -5
- package/dist/types/src/skills/planning/operations/plan-reminder.d.ts.map +1 -1
- package/dist/types/src/skills/planning/operations/update-tasks.d.ts +1 -1
- package/dist/types/src/skills/planning/operations/update-tasks.d.ts.map +1 -1
- package/dist/types/src/skills/skill-manager/SkillManagerSkill.d.ts +7 -0
- package/dist/types/src/skills/skill-manager/SkillManagerSkill.d.ts.map +1 -1
- package/dist/types/src/skills/skill-manager/lookup.test.d.ts +2 -0
- package/dist/types/src/skills/skill-manager/lookup.test.d.ts.map +1 -0
- package/dist/types/src/skills/skill-manager/operations/add-mcp-connection.d.ts +19 -0
- package/dist/types/src/skills/skill-manager/operations/add-mcp-connection.d.ts.map +1 -0
- package/dist/types/src/skills/skill-manager/operations/catalog.d.ts +36 -0
- package/dist/types/src/skills/skill-manager/operations/catalog.d.ts.map +1 -0
- package/dist/types/src/skills/skill-manager/operations/definitions.d.ts +116 -1
- package/dist/types/src/skills/skill-manager/operations/definitions.d.ts.map +1 -1
- package/dist/types/src/skills/skill-manager/operations/index.d.ts.map +1 -1
- package/dist/types/src/skills/skill-manager/operations/mcp-connections.d.ts +15 -0
- package/dist/types/src/skills/skill-manager/operations/mcp-connections.d.ts.map +1 -0
- package/dist/types/src/skills/skill-manager/operations/query-mcp-connections.d.ts +11 -0
- package/dist/types/src/skills/skill-manager/operations/query-mcp-connections.d.ts.map +1 -0
- package/dist/types/src/skills/skill-manager/operations/query-operations.d.ts +17 -0
- package/dist/types/src/skills/skill-manager/operations/query-operations.d.ts.map +1 -0
- package/dist/types/src/skills/skill-manager/operations/query-skills.d.ts +20 -2
- package/dist/types/src/skills/skill-manager/operations/query-skills.d.ts.map +1 -1
- package/dist/types/src/skills/skill-manager/operations/query-types.d.ts +13 -0
- package/dist/types/src/skills/skill-manager/operations/query-types.d.ts.map +1 -0
- package/dist/types/src/skills/skill-manager/operations/set-mcp-connection.d.ts +14 -0
- package/dist/types/src/skills/skill-manager/operations/set-mcp-connection.d.ts.map +1 -0
- package/dist/types/src/supervisor/delegation-strategy.d.ts +2 -7
- package/dist/types/src/supervisor/delegation-strategy.d.ts.map +1 -1
- package/dist/types/src/testing/operations.d.ts.map +1 -1
- package/dist/types/src/types/AgentOperation.d.ts +2 -1
- package/dist/types/src/types/AgentOperation.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -40
- package/src/commands.test.ts +4 -0
- package/src/commands.ts +12 -2
- package/src/operations/run-instructions.test.ts +12 -6
- package/src/operations/run-instructions.ts +12 -2
- package/src/skills/browser/BrowserSkill.ts +3 -8
- package/src/skills/chat-context/operations/context-add.test.ts +6 -4
- package/src/skills/chat-context/operations/context-remove.test.ts +6 -4
- package/src/skills/delegation/DelegationSkill.ts +2 -2
- package/src/skills/delegation/operations/definitions.ts +2 -2
- package/src/skills/delegation/operations/delegate-task.test.ts +1 -2
- package/src/skills/delegation/operations/delegate-task.ts +2 -2
- package/src/skills/delegation/operations/delegate-tasks.ts +2 -8
- package/src/skills/index.ts +0 -1
- package/src/skills/planning/PlanningSkill.ts +8 -12
- package/src/skills/planning/operations/definitions.ts +5 -4
- package/src/skills/planning/operations/plan-reminder.test.ts +9 -15
- package/src/skills/planning/operations/plan-reminder.ts +7 -13
- package/src/skills/planning/operations/update-tasks.md +7 -5
- package/src/skills/planning/operations/update-tasks.model.test.ts +2 -2
- package/src/skills/planning/operations/update-tasks.test.ts +110 -10
- package/src/skills/planning/operations/update-tasks.ts +22 -10
- package/src/skills/planning/skill.test.ts +9 -7
- package/src/skills/skill-manager/SkillManagerSkill.ts +71 -5
- package/src/skills/skill-manager/lookup.test.ts +308 -0
- package/src/skills/skill-manager/operations/add-mcp-connection.ts +83 -0
- package/src/skills/skill-manager/operations/catalog.ts +140 -0
- package/src/skills/skill-manager/operations/definitions.ts +168 -6
- package/src/skills/skill-manager/operations/index.ts +14 -1
- package/src/skills/skill-manager/operations/mcp-connections.ts +29 -0
- package/src/skills/skill-manager/operations/query-mcp-connections.ts +22 -0
- package/src/skills/skill-manager/operations/query-operations.ts +50 -0
- package/src/skills/skill-manager/operations/query-skills.ts +43 -3
- package/src/skills/skill-manager/operations/query-types.ts +32 -0
- package/src/skills/skill-manager/operations/set-mcp-connection.ts +28 -0
- package/src/skills/skill-manager/skill.test.ts +172 -9
- package/src/supervisor/delegation-strategy.test.ts +55 -4
- package/src/supervisor/delegation-strategy.ts +13 -28
- package/src/testing/operations.ts +2 -6
- package/src/types/AgentOperation.ts +6 -1
- package/src/types/index.ts +0 -1
- package/dist/lib/Memory.mjs +0 -1
- package/dist/lib/chunk-Memory.mjs +0 -19
- package/dist/lib/chunk-Memory.mjs.map +0 -1
- package/dist/lib/chunk-MemorySkill.mjs +0 -39
- package/dist/lib/chunk-MemorySkill.mjs.map +0 -1
- package/dist/lib/chunk-delete.mjs +0 -14
- package/dist/lib/chunk-delete.mjs.map +0 -1
- package/dist/lib/chunk-operations8.mjs +0 -9
- package/dist/lib/chunk-operations8.mjs.map +0 -1
- package/dist/lib/chunk-query.mjs +0 -18
- package/dist/lib/chunk-query.mjs.map +0 -1
- package/dist/lib/chunk-save.mjs +0 -17
- package/dist/lib/chunk-save.mjs.map +0 -1
- package/dist/lib/ns/MemorySkill.mjs +0 -3
- package/dist/types/src/skills/memory/MemorySkill.d.ts +0 -6
- package/dist/types/src/skills/memory/MemorySkill.d.ts.map +0 -1
- package/dist/types/src/skills/memory/index.d.ts +0 -2
- package/dist/types/src/skills/memory/index.d.ts.map +0 -1
- package/dist/types/src/skills/memory/operations/definitions.d.ts +0 -15
- package/dist/types/src/skills/memory/operations/definitions.d.ts.map +0 -1
- package/dist/types/src/skills/memory/operations/delete.d.ts +0 -7
- package/dist/types/src/skills/memory/operations/delete.d.ts.map +0 -1
- package/dist/types/src/skills/memory/operations/delete.test.d.ts +0 -2
- package/dist/types/src/skills/memory/operations/delete.test.d.ts.map +0 -1
- package/dist/types/src/skills/memory/operations/index.d.ts +0 -4
- package/dist/types/src/skills/memory/operations/index.d.ts.map +0 -1
- package/dist/types/src/skills/memory/operations/query.d.ts +0 -8
- package/dist/types/src/skills/memory/operations/query.d.ts.map +0 -1
- package/dist/types/src/skills/memory/operations/query.test.d.ts +0 -2
- package/dist/types/src/skills/memory/operations/query.test.d.ts.map +0 -1
- package/dist/types/src/skills/memory/operations/save.d.ts +0 -8
- package/dist/types/src/skills/memory/operations/save.d.ts.map +0 -1
- package/dist/types/src/skills/memory/operations/save.test.d.ts +0 -2
- package/dist/types/src/skills/memory/operations/save.test.d.ts.map +0 -1
- package/dist/types/src/skills/memory/skill.test.d.ts +0 -2
- package/dist/types/src/skills/memory/skill.test.d.ts.map +0 -1
- package/dist/types/src/types/Memory.d.ts +0 -12
- package/dist/types/src/types/Memory.d.ts.map +0 -1
- package/src/skills/memory/MemorySkill.ts +0 -39
- package/src/skills/memory/index.ts +0 -5
- package/src/skills/memory/operations/definitions.ts +0 -72
- package/src/skills/memory/operations/delete.test.ts +0 -37
- package/src/skills/memory/operations/delete.ts +0 -20
- package/src/skills/memory/operations/index.ts +0 -16
- package/src/skills/memory/operations/query.test.ts +0 -76
- package/src/skills/memory/operations/query.ts +0 -32
- package/src/skills/memory/operations/save.test.ts +0 -43
- package/src/skills/memory/operations/save.ts +0 -20
- package/src/skills/memory/skill.test.ts +0 -147
- package/src/types/Memory.ts +0 -22
|
@@ -30,11 +30,13 @@ Each change contains:
|
|
|
30
30
|
- task (ref, optional): the existing task to change. Required unless `create` is set.
|
|
31
31
|
- create (boolean, optional): make a new task on this checklist, assigned to you. Requires `title`.
|
|
32
32
|
- title (string, optional): the new task's title, or a rename of an existing task.
|
|
33
|
-
- status (string, optional): `todo` | `started` | `done`. `started` also
|
|
34
|
-
- assign (boolean, optional): put an existing task on this checklist
|
|
35
|
-
- unassign (boolean, optional): take a task off this checklist and
|
|
33
|
+
- status (string, optional): `todo` | `started` | `done`. `started` also makes you the agent working the task.
|
|
34
|
+
- assign (boolean, optional): put an existing task on this checklist with you working it.
|
|
35
|
+
- unassign (boolean, optional): take a task off this checklist and stop working it. It is never deleted.
|
|
36
36
|
|
|
37
37
|
Status meanings: `todo` means not yet started, `started` means currently being worked on, `done` means completed successfully (rendered as a checked item).
|
|
38
|
+
A person who answers for a task stays its assignee while you work it. When you mark it `done` it goes to
|
|
39
|
+
them for review, and they close it.
|
|
38
40
|
|
|
39
41
|
If any change is malformed or names something that is not a task, nothing is applied and the error
|
|
40
42
|
lists what to fix; resend the whole batch.
|
|
@@ -72,7 +74,7 @@ Finishes the research and moves on:
|
|
|
72
74
|
1. {task: "echo://.../01AAA", status: "done"}
|
|
73
75
|
2. {task: "echo://.../01BBB", status: "started"}
|
|
74
76
|
</assistant_action>
|
|
75
|
-
<reasoning>Existing tasks are addressed by ref; starting the next one
|
|
77
|
+
<reasoning>Existing tasks are addressed by ref; starting the next one makes you the agent working it.</reasoning>
|
|
76
78
|
</example>
|
|
77
79
|
|
|
78
80
|
<example type="delegated_task">
|
|
@@ -81,7 +83,7 @@ Finishes the research and moves on:
|
|
|
81
83
|
Starts the existing sub-task rather than creating a copy of it:
|
|
82
84
|
1. {task: "echo://.../01CCC", status: "started"}
|
|
83
85
|
</assistant_action>
|
|
84
|
-
<reasoning>Starting an existing task puts it on this checklist
|
|
86
|
+
<reasoning>Starting an existing task puts it on this checklist with you working it; `create` would duplicate it.</reasoning>
|
|
85
87
|
</example>
|
|
86
88
|
|
|
87
89
|
<example type="multiple_deliverables">
|
|
@@ -67,7 +67,7 @@ describe('UpdateTasks skill', { tags: ['model-fixture'] }, () => {
|
|
|
67
67
|
const tasks = yield* Chat.loadTasks(chat);
|
|
68
68
|
expect(tasks.map((task) => task.id)).toEqual([existing.id]);
|
|
69
69
|
expect(existing.status).toEqual('started');
|
|
70
|
-
expect(existing.
|
|
70
|
+
expect(existing.delegate?.subject?.target?.id).toEqual(chat.id);
|
|
71
71
|
// No copy was made alongside it.
|
|
72
72
|
const titled = yield* Database.query(Filter.type(Task.Task, { title: 'Renew the domain' })).run;
|
|
73
73
|
expect(titled).toHaveLength(1);
|
|
@@ -95,7 +95,7 @@ describe('UpdateTasks skill', { tags: ['model-fixture'] }, () => {
|
|
|
95
95
|
|
|
96
96
|
const tasks = yield* Chat.loadTasks(chat);
|
|
97
97
|
expect(tasks.map((task) => task.title)).toEqual([kept.title]);
|
|
98
|
-
expect(dropped.
|
|
98
|
+
expect(dropped.delegate).toBeUndefined();
|
|
99
99
|
// Unassigning leaves the task for whoever else holds it.
|
|
100
100
|
expect(Obj.isDeleted(dropped)).toBe(false);
|
|
101
101
|
},
|
|
@@ -86,7 +86,7 @@ describe('UpdateTasks', () => {
|
|
|
86
86
|
);
|
|
87
87
|
|
|
88
88
|
it.effect(
|
|
89
|
-
'starting a task from elsewhere
|
|
89
|
+
'starting a task from elsewhere delegates it: onto the checklist and to the agent together',
|
|
90
90
|
Effect.fnUntraced(
|
|
91
91
|
function* ({ expect }) {
|
|
92
92
|
const { chat, invoke } = yield* setupChat();
|
|
@@ -98,12 +98,11 @@ describe('UpdateTasks', () => {
|
|
|
98
98
|
|
|
99
99
|
expect((yield* Chat.loadTasks(chat)).map((task) => task.id)).toEqual([subTask.id]);
|
|
100
100
|
expect(subTask.status).toEqual('started');
|
|
101
|
-
expect(subTask.
|
|
101
|
+
expect(subTask.delegate?.role).toEqual('assistant');
|
|
102
102
|
// A plain chat is its own session object.
|
|
103
|
-
expect(subTask.
|
|
104
|
-
// One log line per edit: the assignment rides the status change rather than adding an entry.
|
|
103
|
+
expect(subTask.delegate?.subject?.target?.id).toEqual(chat.id);
|
|
105
104
|
expect((subTask.history ?? []).filter(Task.isChangeEntry).map(({ description }) => description)).toEqual([
|
|
106
|
-
'Status changed from todo to started.
|
|
105
|
+
'Status changed from todo to started. Delegated to an agent.',
|
|
107
106
|
]);
|
|
108
107
|
},
|
|
109
108
|
Effect.provide(TestLayer),
|
|
@@ -112,7 +111,60 @@ describe('UpdateTasks', () => {
|
|
|
112
111
|
);
|
|
113
112
|
|
|
114
113
|
it.effect(
|
|
115
|
-
|
|
114
|
+
"claiming an unowned step of a person's tree answers to them, so the agent's finish waits on review",
|
|
115
|
+
Effect.fnUntraced(
|
|
116
|
+
function* ({ expect }) {
|
|
117
|
+
const { chat, invoke } = yield* setupChat();
|
|
118
|
+
const step = yield* Database.add(Task.make({ title: 'Name the two tools', status: 'todo' }));
|
|
119
|
+
const root = yield* Database.add(
|
|
120
|
+
Task.make({
|
|
121
|
+
title: 'Ship the tools',
|
|
122
|
+
assignee: { name: 'Riley', identityDid: 'did:key:riley' },
|
|
123
|
+
subtasks: [Ref.make(step)],
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
126
|
+
Obj.setParent(step, root);
|
|
127
|
+
yield* Database.flush();
|
|
128
|
+
|
|
129
|
+
yield* invoke([{ task: Ref.make(step), status: 'started' }]);
|
|
130
|
+
expect(step.assignee?.name).toEqual('Riley');
|
|
131
|
+
|
|
132
|
+
yield* invoke([{ task: Ref.make(step), status: 'done' }]);
|
|
133
|
+
expect(step.status).toEqual('review');
|
|
134
|
+
|
|
135
|
+
const legacy = yield* Database.add(
|
|
136
|
+
Task.make({ title: 'Test the tools', status: 'todo', assignee: { role: 'assistant', name: 'Old session' } }),
|
|
137
|
+
);
|
|
138
|
+
Obj.update(root, (root) => {
|
|
139
|
+
root.subtasks?.push(Ref.make(legacy));
|
|
140
|
+
});
|
|
141
|
+
Obj.setParent(legacy, root);
|
|
142
|
+
yield* Database.flush();
|
|
143
|
+
yield* invoke([{ task: Ref.make(legacy), status: 'started' }]);
|
|
144
|
+
expect(legacy.assignee?.name).toEqual('Riley');
|
|
145
|
+
|
|
146
|
+
const own = yield* Database.add(
|
|
147
|
+
Task.make({
|
|
148
|
+
title: 'Note the versions',
|
|
149
|
+
status: 'todo',
|
|
150
|
+
assignee: { role: 'assistant', subject: Ref.make(chat) },
|
|
151
|
+
}),
|
|
152
|
+
);
|
|
153
|
+
Obj.update(root, (root) => {
|
|
154
|
+
root.subtasks = [...(root.subtasks ?? []), Ref.make(own)];
|
|
155
|
+
});
|
|
156
|
+
Obj.setParent(own, root);
|
|
157
|
+
yield* Database.flush();
|
|
158
|
+
yield* invoke([{ task: Ref.make(own), status: 'started' }]);
|
|
159
|
+
expect(Task.refEntityId(own.assignee?.subject)).toEqual(chat.id);
|
|
160
|
+
},
|
|
161
|
+
Effect.provide(TestLayer),
|
|
162
|
+
TestHelpers.provideTestContext,
|
|
163
|
+
),
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
it.effect(
|
|
167
|
+
'assign and unassign move the checklist and the delegate together, keeping the assignee and the task',
|
|
116
168
|
Effect.fnUntraced(
|
|
117
169
|
function* ({ expect }) {
|
|
118
170
|
const { chat, invoke } = yield* setupChat();
|
|
@@ -123,7 +175,8 @@ describe('UpdateTasks', () => {
|
|
|
123
175
|
|
|
124
176
|
yield* invoke([{ task: Ref.make(task), assign: true }]);
|
|
125
177
|
expect(chat.tasks).toHaveLength(1);
|
|
126
|
-
expect(task.
|
|
178
|
+
expect(task.delegate?.subject?.target?.id).toEqual(chat.id);
|
|
179
|
+
expect(task.assignee?.name).toEqual('Alice');
|
|
127
180
|
expect(task.status).toEqual('todo');
|
|
128
181
|
|
|
129
182
|
// Assigning twice must not duplicate the checklist entry.
|
|
@@ -132,7 +185,8 @@ describe('UpdateTasks', () => {
|
|
|
132
185
|
|
|
133
186
|
yield* invoke([{ task: Ref.make(task), unassign: true }]);
|
|
134
187
|
expect(chat.tasks).toEqual([]);
|
|
135
|
-
expect(task.
|
|
188
|
+
expect(task.delegate).toBeUndefined();
|
|
189
|
+
expect(task.assignee?.name).toEqual('Alice');
|
|
136
190
|
expect(Obj.isDeleted(task)).toBe(false);
|
|
137
191
|
},
|
|
138
192
|
Effect.provide(TestLayer),
|
|
@@ -140,6 +194,53 @@ describe('UpdateTasks', () => {
|
|
|
140
194
|
),
|
|
141
195
|
);
|
|
142
196
|
|
|
197
|
+
it.effect(
|
|
198
|
+
'unassign lets go of only what this agent holds, never the person who answers for the task',
|
|
199
|
+
Effect.fnUntraced(
|
|
200
|
+
function* ({ expect }) {
|
|
201
|
+
const { chat, invoke } = yield* setupChat();
|
|
202
|
+
const task = yield* Database.add(
|
|
203
|
+
Task.make({ title: 'Renew the domain', status: 'todo', assignee: { name: 'Alice' } }),
|
|
204
|
+
);
|
|
205
|
+
yield* Database.flush();
|
|
206
|
+
yield* invoke([{ task: Ref.make(task), assign: true }]);
|
|
207
|
+
Task.setDelegate(task, null);
|
|
208
|
+
|
|
209
|
+
yield* invoke([{ task: Ref.make(task), unassign: true }]);
|
|
210
|
+
expect(chat.tasks).toEqual([]);
|
|
211
|
+
expect(task.assignee?.name).toEqual('Alice');
|
|
212
|
+
|
|
213
|
+
const queued = yield* Database.add(
|
|
214
|
+
Task.make({
|
|
215
|
+
title: 'Draft the notice',
|
|
216
|
+
status: 'todo',
|
|
217
|
+
assignee: { role: 'assistant', subject: Ref.make(chat) },
|
|
218
|
+
delegate: { role: 'assistant' },
|
|
219
|
+
}),
|
|
220
|
+
);
|
|
221
|
+
Chat.assignTasks(chat, [Ref.make(queued)]);
|
|
222
|
+
yield* invoke([{ task: Ref.make(queued), unassign: true }]);
|
|
223
|
+
expect(chat.tasks).toEqual([]);
|
|
224
|
+
expect(queued.delegate).toBeUndefined();
|
|
225
|
+
expect(queued.assignee).toBeUndefined();
|
|
226
|
+
|
|
227
|
+
const elsewhere = yield* Database.add(
|
|
228
|
+
Task.make({
|
|
229
|
+
title: 'Book the venue',
|
|
230
|
+
status: 'todo',
|
|
231
|
+
delegate: { role: 'assistant', name: 'Claude', identityDid: 'did:key:claude' },
|
|
232
|
+
}),
|
|
233
|
+
);
|
|
234
|
+
Chat.assignTasks(chat, [Ref.make(elsewhere)]);
|
|
235
|
+
yield* invoke([{ task: Ref.make(elsewhere), unassign: true }]);
|
|
236
|
+
expect(chat.tasks).toEqual([]);
|
|
237
|
+
expect(elsewhere.delegate?.name).toEqual('Claude');
|
|
238
|
+
},
|
|
239
|
+
Effect.provide(TestLayer),
|
|
240
|
+
TestHelpers.provideTestContext,
|
|
241
|
+
),
|
|
242
|
+
);
|
|
243
|
+
|
|
143
244
|
it.effect(
|
|
144
245
|
'applies nothing when any change in the batch is malformed',
|
|
145
246
|
Effect.fnUntraced(
|
|
@@ -206,9 +307,8 @@ describe('UpdateTasks', () => {
|
|
|
206
307
|
Effect.fnUntraced(
|
|
207
308
|
function* ({ expect }) {
|
|
208
309
|
const { invoke } = yield* setupChat();
|
|
209
|
-
// A task with reviewers does not close on the model's word: `done` lands it in `review`.
|
|
210
310
|
const task = yield* Database.add(
|
|
211
|
-
Task.make({ title: 'Reviewed', status: 'started',
|
|
311
|
+
Task.make({ title: 'Reviewed', status: 'started', assignee: { name: 'Alice', role: 'user' } }),
|
|
212
312
|
);
|
|
213
313
|
yield* Database.flush();
|
|
214
314
|
|
|
@@ -40,18 +40,37 @@ const shapeError = ({ task, create, assign, unassign, title, status }: TaskChang
|
|
|
40
40
|
return '`assign` and `unassign` contradict each other';
|
|
41
41
|
}
|
|
42
42
|
if (unassign && (create || status === 'started')) {
|
|
43
|
-
return 'a task you create or start is
|
|
43
|
+
return 'a task you create or start is yours to work, so it cannot also be unassigned';
|
|
44
44
|
}
|
|
45
45
|
return undefined;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
type Resolved = { change: TaskChange; task?: Task.Task };
|
|
49
49
|
|
|
50
|
+
const claim = (
|
|
51
|
+
task: Task.Task,
|
|
52
|
+
self: Actor.Actor,
|
|
53
|
+
{ assigning, unassign }: { assigning: boolean; unassign?: boolean },
|
|
54
|
+
): Pick<Task.Edit, 'assignee' | 'delegate'> => {
|
|
55
|
+
if (assigning) {
|
|
56
|
+
const answering =
|
|
57
|
+
Task.owner(task) || Task.sameActor(task.assignee, self) ? undefined : Task.owner(Task.getParentTask(task));
|
|
58
|
+
return { delegate: self, ...(answering ? { assignee: { ...answering } } : {}) };
|
|
59
|
+
}
|
|
60
|
+
if (unassign) {
|
|
61
|
+
return {
|
|
62
|
+
...(Task.sameActor(task.delegate, self) || Task.isSubAgentRequest(task.delegate) ? { delegate: null } : {}),
|
|
63
|
+
...(Task.sameActor(task.assignee, self) ? { assignee: null } : {}),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return {};
|
|
67
|
+
};
|
|
68
|
+
|
|
50
69
|
/**
|
|
51
70
|
* Creates, edits, assigns and unassigns the conversation's tasks. Every change is checked before any
|
|
52
71
|
* is applied, so a malformed batch writes nothing and the model can resend it whole.
|
|
53
72
|
*
|
|
54
|
-
* Assignment always moves both halves together — the chat's checklist and the task's
|
|
73
|
+
* Assignment always moves both halves together — the chat's checklist and the task's worker — so
|
|
55
74
|
* the checklist a conversation shows is the work its agent holds. Starting a task assigns it.
|
|
56
75
|
*/
|
|
57
76
|
export default UpdateTasks.pipe(
|
|
@@ -111,20 +130,13 @@ export default UpdateTasks.pipe(
|
|
|
111
130
|
|
|
112
131
|
const assigning = assign || status === 'started';
|
|
113
132
|
const previousStatus = task.status;
|
|
114
|
-
|
|
115
|
-
// was named to review lands in `review` rather than closing on the model's `done`.
|
|
116
|
-
Task.update(task, {
|
|
117
|
-
title: title?.trim(),
|
|
118
|
-
status,
|
|
119
|
-
...(assigning ? { assignee: self } : unassign ? { assignee: null } : {}),
|
|
120
|
-
});
|
|
133
|
+
Task.update(task, { title: title?.trim(), status, ...claim(task, self, { assigning, unassign }) });
|
|
121
134
|
if (assigning) {
|
|
122
135
|
Chat.assignTasks(chat, [Ref.make(task)]);
|
|
123
136
|
} else if (unassign) {
|
|
124
137
|
Chat.unassignTasks(chat, [Ref.make(task)]);
|
|
125
138
|
}
|
|
126
139
|
|
|
127
|
-
// The resolved status, not the requested one: a reviewed task lands in `review`.
|
|
128
140
|
if (task.status !== undefined && task.status !== previousStatus) {
|
|
129
141
|
yield* Trace.write(Trace.TaskStatusChanged, {
|
|
130
142
|
taskId: task.id,
|
|
@@ -8,11 +8,12 @@ import * as Effect from 'effect/Effect';
|
|
|
8
8
|
import { AgentService } from '@dxos/agent-runtime';
|
|
9
9
|
import { AssistantTestLayer } from '@dxos/agent-runtime/testing';
|
|
10
10
|
import { LanguageModelFixture } from '@dxos/ai/testing';
|
|
11
|
-
import { AiContext } from '@dxos/assistant';
|
|
11
|
+
import { AiContext, TrajectoryStore } from '@dxos/assistant';
|
|
12
12
|
import * as Agent from '@dxos/assistant/Agent';
|
|
13
13
|
import * as Chat from '@dxos/assistant/Chat';
|
|
14
|
+
import * as Hook from '@dxos/compute/Hook';
|
|
14
15
|
import * as Skill from '@dxos/compute/Skill';
|
|
15
|
-
import { Database, Feed,
|
|
16
|
+
import { Database, Feed, Obj, Ref } from '@dxos/echo';
|
|
16
17
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
17
18
|
import { DXN, EntityId } from '@dxos/keys';
|
|
18
19
|
import { Text } from '@dxos/schema';
|
|
@@ -27,6 +28,7 @@ const TestLayer = AssistantTestLayer({
|
|
|
27
28
|
model: DXN.make('com.anthropic.model.claude-sonnet-5.default'),
|
|
28
29
|
operationHandlers: PlanningHandlers,
|
|
29
30
|
skills: [PlanningSkill.make()],
|
|
31
|
+
agent: { hooks: () => Hook.forPlugin('com.example.plugin.planning', PlanningSkill.hooks) },
|
|
30
32
|
types: [
|
|
31
33
|
Agent.Agent,
|
|
32
34
|
Outline.Outline,
|
|
@@ -41,7 +43,7 @@ const TestLayer = AssistantTestLayer({
|
|
|
41
43
|
tracing: 'pretty',
|
|
42
44
|
});
|
|
43
45
|
|
|
44
|
-
/** Text the end-request hook
|
|
46
|
+
/** Text of the end-request hook's follow-up; matching it proves the reminder reached the queue. */
|
|
45
47
|
const REMINDER = 'Your checklist still has unchecked items';
|
|
46
48
|
|
|
47
49
|
const TASKS = ['Write a haiku about rain', 'Write a haiku about snow', 'Write a haiku about fog'];
|
|
@@ -64,11 +66,11 @@ describe('Planning skill', { tags: ['model-fixture'] }, () => {
|
|
|
64
66
|
// "One task per turn" makes the first turn end with items still open, which is the state the
|
|
65
67
|
// hook exists for. Without the reminder the process would simply succeed here.
|
|
66
68
|
yield* agent.submitPrompt('Work through the checklist, completing one task per turn.');
|
|
67
|
-
// One call spans the continuation: the
|
|
68
|
-
// the next alarm before it returns, so the process is never idle between turns.
|
|
69
|
+
// One call spans the continuation: the follow-up is queued from inside the turn handler, which
|
|
70
|
+
// arms the next alarm before it returns, so the process is never idle between turns.
|
|
69
71
|
yield* agent.waitForCompletion();
|
|
70
72
|
|
|
71
|
-
const messages = yield*
|
|
73
|
+
const messages = yield* TrajectoryStore.messages(agent.feed);
|
|
72
74
|
expect(messages.some((message) => Message.extractText(message).includes(REMINDER))).toBe(true);
|
|
73
75
|
|
|
74
76
|
// The reminder is only worth firing if it actually drives the plan to completion.
|
|
@@ -96,7 +98,7 @@ describe('Planning skill', { tags: ['model-fixture'] }, () => {
|
|
|
96
98
|
// no settle window — the hook decides inside the turn handler, so completion is past it, and
|
|
97
99
|
// the sibling case above is the control that proves completion does not precede the hook.
|
|
98
100
|
|
|
99
|
-
const messages = yield*
|
|
101
|
+
const messages = yield* TrajectoryStore.messages(agent.feed);
|
|
100
102
|
expect(messages.some((message) => Message.extractText(message).includes(REMINDER))).toBe(false);
|
|
101
103
|
|
|
102
104
|
const tasks = yield* Chat.loadTasks(chat);
|
|
@@ -9,15 +9,39 @@ import * as Template from '@dxos/compute/Template';
|
|
|
9
9
|
import { DXN } from '@dxos/keys';
|
|
10
10
|
import { trim } from '@dxos/util';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
AddMcpConnection,
|
|
14
|
+
EnableSkills,
|
|
15
|
+
QueryMcpConnections,
|
|
16
|
+
QueryOperations,
|
|
17
|
+
QuerySkills,
|
|
18
|
+
QueryTypes,
|
|
19
|
+
SetMcpConnection,
|
|
20
|
+
} from './operations/definitions.ts';
|
|
13
21
|
|
|
14
22
|
export const key = 'org.dxos.skill.skillManager';
|
|
15
23
|
|
|
24
|
+
const name = 'Skill Manager';
|
|
25
|
+
|
|
26
|
+
const description = 'Query and enable skills, their operations, types and MCP servers in the current conversation.';
|
|
27
|
+
|
|
28
|
+
const tools = Skill.toolDefinitions({
|
|
29
|
+
operations: [
|
|
30
|
+
QuerySkills,
|
|
31
|
+
EnableSkills,
|
|
32
|
+
QueryOperations,
|
|
33
|
+
QueryTypes,
|
|
34
|
+
AddMcpConnection,
|
|
35
|
+
QueryMcpConnections,
|
|
36
|
+
SetMcpConnection,
|
|
37
|
+
],
|
|
38
|
+
});
|
|
39
|
+
|
|
16
40
|
export const make = () =>
|
|
17
41
|
Skill.make({
|
|
18
42
|
key,
|
|
19
|
-
name
|
|
20
|
-
description
|
|
43
|
+
name,
|
|
44
|
+
description,
|
|
21
45
|
instructions: Template.make({
|
|
22
46
|
source: trim`
|
|
23
47
|
The list below is the current set of available skills — it is rendered fresh into this prompt,
|
|
@@ -27,13 +51,25 @@ export const make = () =>
|
|
|
27
51
|
|
|
28
52
|
<available_skills>
|
|
29
53
|
{{#each skills}}
|
|
30
|
-
- {{key}} "{{name}}"{{#if description}} -- {{description}}{{/if}}{{#if agentCanEnable}} [agent-can-enable]{{/if}}
|
|
54
|
+
- {{key}} "{{name}}"{{#if description}} -- {{description}}{{/if}}{{#if enabled}} [enabled]{{/if}}{{#if agentCanEnable}} [agent-can-enable]{{/if}}
|
|
31
55
|
{{/each}}
|
|
32
56
|
</available_skills>
|
|
33
57
|
|
|
34
58
|
NOTE: A skill's tools only appear once it is enabled. Skills already enabled in this
|
|
35
59
|
conversation expose their tools to you directly — do not re-enable a skill whose tools you
|
|
36
60
|
can already see.
|
|
61
|
+
|
|
62
|
+
When the task needs a tool you do not have, do not work around it with other tools: call
|
|
63
|
+
[query-operations] with a \`query\` describing what it does (e.g. "link task to feature"). Each
|
|
64
|
+
operation it returns names the skill that provides it; enable that skill. [query-types] lists
|
|
65
|
+
the registered types, and with \`typenames\` their fields.
|
|
66
|
+
|
|
67
|
+
Connections to services can also give you their MCP servers' tools. A space's connections are
|
|
68
|
+
on unless this conversation turned them off; the built-in servers Composer ships are off until
|
|
69
|
+
turned on. Use [query-mcp-connections] to see which are off, and [set-mcp-connection] to turn
|
|
70
|
+
one on when you need its tools; they are available from your next step. A connection is not a
|
|
71
|
+
skill, and enabling a skill does not turn its server on.
|
|
72
|
+
To use an MCP server the space has no connection for, add it with [add-mcp-connection].
|
|
37
73
|
`,
|
|
38
74
|
inputs: [
|
|
39
75
|
{
|
|
@@ -43,7 +79,37 @@ export const make = () =>
|
|
|
43
79
|
},
|
|
44
80
|
],
|
|
45
81
|
}),
|
|
46
|
-
tools
|
|
82
|
+
tools,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The skill as code mode states it: the lookups and `enableSkills`, called from code, and instructions that list
|
|
87
|
+
* nothing. Code mode states the conversation's enabled skills beside it; these are how the model finds every other
|
|
88
|
+
* skill, operation and type. Its MCP connection operations are left out: they are an enabled skill's to give, as under
|
|
89
|
+
* tool calling, so a conversation that does not bind the Skill Manager cannot add or turn on an MCP server.
|
|
90
|
+
*/
|
|
91
|
+
export const makeForCodeMode = () =>
|
|
92
|
+
Skill.make({
|
|
93
|
+
key,
|
|
94
|
+
name,
|
|
95
|
+
description,
|
|
96
|
+
instructions: Template.make({
|
|
97
|
+
source: trim`
|
|
98
|
+
The skills enabled in this conversation are stated in this prompt, with their operations. Every other skill,
|
|
99
|
+
its operations and the workspace's types are found with the Skill Manager's operations, which the Operations
|
|
100
|
+
section lists with the code that calls each.
|
|
101
|
+
|
|
102
|
+
- Query skills lists the skills, each saying whether it is enabled here and whether you may enable it;
|
|
103
|
+
passing keys in \`keys\` gives a skill's instructions and operations.
|
|
104
|
+
- Query operations searches the operations of the skills you can use by what they do (\`query\`), or lists
|
|
105
|
+
one skill's (\`skill\`). Look an operation up by passing its key in \`keys\` before calling it: that gives
|
|
106
|
+
its input. Call it the way the Operations section calls the stated ones, by its \`key\` or its \`tool\` name.
|
|
107
|
+
- An operation whose skill is not enabled cannot be called yet. Enable the skill with Enable skills (only one
|
|
108
|
+
you may enable); its instructions and operations are stated from your next eval call.
|
|
109
|
+
- Query types searches the registered types (\`query\`); pass \`typenames\` to get their fields.
|
|
110
|
+
`,
|
|
111
|
+
}),
|
|
112
|
+
tools: Skill.toolDefinitions({ operations: [QuerySkills, EnableSkills, QueryOperations, QueryTypes] }),
|
|
47
113
|
});
|
|
48
114
|
|
|
49
115
|
export { SkillManagerHandlers as Handlers } from './operations/index.ts';
|