@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/assistant-toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Assistant toolkit, definitions, and utilities.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -63,16 +63,6 @@
|
|
|
63
63
|
"types": "./dist/types/src/DelegationStrategy.d.ts",
|
|
64
64
|
"import": "./dist/lib/ns/DelegationStrategy.mjs"
|
|
65
65
|
},
|
|
66
|
-
"./Memory": {
|
|
67
|
-
"source": "./src/types/Memory.ts",
|
|
68
|
-
"types": "./dist/types/src/types/Memory.d.ts",
|
|
69
|
-
"import": "./dist/lib/Memory.mjs"
|
|
70
|
-
},
|
|
71
|
-
"./MemorySkill": {
|
|
72
|
-
"source": "./src/skills/memory/MemorySkill.ts",
|
|
73
|
-
"types": "./dist/types/src/skills/memory/MemorySkill.d.ts",
|
|
74
|
-
"import": "./dist/lib/ns/MemorySkill.mjs"
|
|
75
|
-
},
|
|
76
66
|
"./PlanningSkill": {
|
|
77
67
|
"source": "./src/skills/planning/PlanningSkill.ts",
|
|
78
68
|
"types": "./dist/types/src/skills/planning/PlanningSkill.d.ts",
|
|
@@ -104,41 +94,43 @@
|
|
|
104
94
|
"src"
|
|
105
95
|
],
|
|
106
96
|
"dependencies": {
|
|
107
|
-
"@dxos/agent-runtime": "0.
|
|
108
|
-
"@dxos/ai": "0.
|
|
109
|
-
"@dxos/app-toolkit": "0.
|
|
110
|
-
"@dxos/assistant": "0.
|
|
111
|
-
"@dxos/client-protocol": "0.
|
|
112
|
-
"@dxos/compute": "0.
|
|
113
|
-
"@dxos/compute-runtime": "0.
|
|
114
|
-
"@dxos/echo": "0.
|
|
115
|
-
"@dxos/edge-client": "0.
|
|
116
|
-
"@dxos/effect": "0.
|
|
117
|
-
"@dxos/errors": "0.
|
|
118
|
-
"@dxos/invariant": "0.
|
|
119
|
-
"@dxos/keys": "0.
|
|
120
|
-
"@dxos/
|
|
121
|
-
"@dxos/
|
|
122
|
-
"@dxos/
|
|
123
|
-
"@dxos/
|
|
124
|
-
"@dxos/
|
|
125
|
-
"@dxos/
|
|
97
|
+
"@dxos/agent-runtime": "0.17.0",
|
|
98
|
+
"@dxos/ai": "0.17.0",
|
|
99
|
+
"@dxos/app-toolkit": "0.17.0",
|
|
100
|
+
"@dxos/assistant": "0.17.0",
|
|
101
|
+
"@dxos/client-protocol": "0.17.0",
|
|
102
|
+
"@dxos/compute": "0.17.0",
|
|
103
|
+
"@dxos/compute-runtime": "0.17.0",
|
|
104
|
+
"@dxos/echo": "0.17.0",
|
|
105
|
+
"@dxos/edge-client": "0.17.0",
|
|
106
|
+
"@dxos/effect": "0.17.0",
|
|
107
|
+
"@dxos/errors": "0.17.0",
|
|
108
|
+
"@dxos/invariant": "0.17.0",
|
|
109
|
+
"@dxos/keys": "0.17.0",
|
|
110
|
+
"@dxos/link": "0.17.0",
|
|
111
|
+
"@dxos/log": "0.17.0",
|
|
112
|
+
"@dxos/mcp-client": "0.17.0",
|
|
113
|
+
"@dxos/protocols": "0.17.0",
|
|
114
|
+
"@dxos/react-ui": "0.17.0",
|
|
115
|
+
"@dxos/schema": "0.17.0",
|
|
116
|
+
"@dxos/types": "0.17.0",
|
|
117
|
+
"@dxos/util": "0.17.0"
|
|
126
118
|
},
|
|
127
119
|
"devDependencies": {
|
|
120
|
+
"@dxos/app-framework": "0.17.0",
|
|
121
|
+
"@dxos/client-protocol": "0.17.0",
|
|
122
|
+
"@dxos/plugin-markdown": "0.17.0",
|
|
123
|
+
"@dxos/react-ui-syntax-highlighter": "0.17.0",
|
|
124
|
+
"@dxos/ui-theme": "0.17.0",
|
|
128
125
|
"effect": "4.0.4",
|
|
129
|
-
"react": "~19.
|
|
130
|
-
"react-dom": "~19.
|
|
131
|
-
"@dxos/app-framework": "0.16.0",
|
|
132
|
-
"@dxos/client-protocol": "0.16.0",
|
|
133
|
-
"@dxos/plugin-markdown": "0.16.0",
|
|
134
|
-
"@dxos/react-ui-syntax-highlighter": "0.16.0",
|
|
135
|
-
"@dxos/ui-theme": "0.16.0"
|
|
126
|
+
"react": "~19.3.1",
|
|
127
|
+
"react-dom": "~19.3.1"
|
|
136
128
|
},
|
|
137
129
|
"peerDependencies": {
|
|
130
|
+
"@dxos/ui-theme": "^0.17.0",
|
|
138
131
|
"effect": "4.0.4",
|
|
139
|
-
"react": "~19.
|
|
140
|
-
"react-dom": "~19.
|
|
141
|
-
"@dxos/ui-theme": "^0.16.0"
|
|
132
|
+
"react": "~19.3.1",
|
|
133
|
+
"react-dom": "~19.3.1"
|
|
142
134
|
},
|
|
143
135
|
"publishConfig": {
|
|
144
136
|
"access": "public"
|
package/src/commands.test.ts
CHANGED
|
@@ -60,4 +60,8 @@ describe('resolveSlashCommand', () => {
|
|
|
60
60
|
test('a command with no arguments resolves with empty args', ({ expect }) => {
|
|
61
61
|
expect(resolveSlashCommand('/task:create', commands)?.args).to.eq('');
|
|
62
62
|
});
|
|
63
|
+
|
|
64
|
+
test('args keep their line breaks and inner spacing', ({ expect }) => {
|
|
65
|
+
expect(resolveSlashCommand('/task:create first line\n\n - item', commands)?.args).to.eq('first line\n\n - item');
|
|
66
|
+
});
|
|
63
67
|
});
|
package/src/commands.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Copyright 2026 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type AiContext } from '@dxos/assistant';
|
|
5
6
|
import * as Chat from '@dxos/assistant/Chat';
|
|
6
7
|
import * as Operation from '@dxos/compute/Operation';
|
|
7
8
|
import { type Database } from '@dxos/echo';
|
|
@@ -16,6 +17,8 @@ export type SlashCommand = {
|
|
|
16
17
|
command: string;
|
|
17
18
|
/** Description surfaced in the prompt's completion list. */
|
|
18
19
|
description: string;
|
|
20
|
+
/** Changes only the chat object itself, so it runs on a chat not yet stored (a companion's) and leaves it unstored. */
|
|
21
|
+
chatOnly?: boolean;
|
|
19
22
|
/** Runs the command; an Error describes correct usage, and is shown rather than thrown. */
|
|
20
23
|
execute: (args: string, context: SlashCommandContext) => Promise<SlashCommandResult | Error>;
|
|
21
24
|
};
|
|
@@ -25,6 +28,8 @@ export type SlashCommandContext = {
|
|
|
25
28
|
db: Database.Database;
|
|
26
29
|
chat: Chat.Chat;
|
|
27
30
|
invoke: OperationInvoke;
|
|
31
|
+
/** The conversation's bindings, for a command that changes what is in context (e.g. loading a skill). */
|
|
32
|
+
binder?: AiContext.Binder;
|
|
28
33
|
};
|
|
29
34
|
|
|
30
35
|
/** `OperationService['invokePromise']`, so the operation's input and output types survive the call. */
|
|
@@ -39,6 +44,11 @@ export type SlashCommandResult = {
|
|
|
39
44
|
* conversation; omitted when the result is already visible.
|
|
40
45
|
*/
|
|
41
46
|
followUp?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The reader's own message, sent after the command the way a typed prompt is: queued behind a
|
|
49
|
+
* running turn, its mentions bound (e.g. the text after a skill command).
|
|
50
|
+
*/
|
|
51
|
+
prompt?: string;
|
|
42
52
|
};
|
|
43
53
|
|
|
44
54
|
/** A task named by its 1-based position in the set, or by its exact title. */
|
|
@@ -77,7 +87,7 @@ export const resolveSlashCommand = (
|
|
|
77
87
|
if (!text.startsWith('/')) {
|
|
78
88
|
return undefined;
|
|
79
89
|
}
|
|
80
|
-
const [name
|
|
90
|
+
const [name] = text.split(/\s/, 1);
|
|
81
91
|
const command = commands.find((candidate) => candidate.command === name);
|
|
82
|
-
return command ? { command, args:
|
|
92
|
+
return command ? { command, args: text.slice(name.length).trim() } : undefined;
|
|
83
93
|
};
|
|
@@ -8,14 +8,16 @@ import * as Effect from 'effect/Effect';
|
|
|
8
8
|
import * as Exit from 'effect/Exit';
|
|
9
9
|
import * as Schema from 'effect/Schema';
|
|
10
10
|
|
|
11
|
+
import { mcpServerTypes } from '@dxos/agent-runtime';
|
|
11
12
|
import { AssistantTestLayer } from '@dxos/agent-runtime/testing';
|
|
12
13
|
import { ScriptedLanguageModel } from '@dxos/ai/testing';
|
|
13
|
-
import { AiContext } from '@dxos/assistant';
|
|
14
|
+
import { AiContext, TrajectoryStore } from '@dxos/assistant';
|
|
14
15
|
import * as Chat from '@dxos/assistant/Chat';
|
|
16
|
+
import * as Credential from '@dxos/compute/Credential';
|
|
15
17
|
import * as Instructions from '@dxos/compute/Instructions';
|
|
16
18
|
import * as Operation from '@dxos/compute/Operation';
|
|
17
19
|
import * as OperationHandlerSet from '@dxos/compute/OperationHandlerSet';
|
|
18
|
-
import { Database, Feed,
|
|
20
|
+
import { Database, Feed, JsonSchema, Ref } from '@dxos/echo';
|
|
19
21
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
20
22
|
import { EntityId } from '@dxos/keys';
|
|
21
23
|
import { Text } from '@dxos/schema';
|
|
@@ -155,6 +157,13 @@ describe('RunInstructions', () => {
|
|
|
155
157
|
TestHelpers.provideTestContext,
|
|
156
158
|
),
|
|
157
159
|
);
|
|
160
|
+
|
|
161
|
+
// The runtime registers declared types and provides declared services, so a run that reads the space's
|
|
162
|
+
// MCP connections without them finds none, or connects a keyed server without its key.
|
|
163
|
+
it('declares what reading the MCP connections needs', () => {
|
|
164
|
+
expect(AgentOperation.RunInstructions.types).toEqual(expect.arrayContaining([...mcpServerTypes]));
|
|
165
|
+
expect(AgentOperation.RunInstructions.services).toContain(Credential.CredentialsService);
|
|
166
|
+
});
|
|
158
167
|
});
|
|
159
168
|
|
|
160
169
|
// Scripting the `completeJob` call drives the whole operation without a live model, so what is
|
|
@@ -176,7 +185,4 @@ function layerWithResult(success: unknown) {
|
|
|
176
185
|
}
|
|
177
186
|
|
|
178
187
|
const countFeedMessages = (feed: Feed.Feed) =>
|
|
179
|
-
Effect.
|
|
180
|
-
const items = yield* Feed.query(feed, Filter.everything()).run;
|
|
181
|
-
return items.filter(Obj.instanceOf(Message.Message)).length;
|
|
182
|
-
});
|
|
188
|
+
TrajectoryStore.messages(feed).pipe(Effect.map((messages) => messages.length));
|
|
@@ -9,18 +9,21 @@ import * as Layer from 'effect/Layer';
|
|
|
9
9
|
import * as Option from 'effect/Option';
|
|
10
10
|
import * as Schema from 'effect/Schema';
|
|
11
11
|
|
|
12
|
+
import { loadMcpServers } from '@dxos/agent-runtime';
|
|
12
13
|
import { AiService, OpaqueToolkit } from '@dxos/ai';
|
|
13
14
|
import {
|
|
14
15
|
AiSession,
|
|
16
|
+
TrajectoryStore,
|
|
15
17
|
getOperationFromTool,
|
|
16
18
|
makeToolExecutionService,
|
|
17
19
|
makeToolResolverFromOperations,
|
|
18
20
|
} from '@dxos/assistant';
|
|
19
21
|
import * as Chat from '@dxos/assistant/Chat';
|
|
22
|
+
import * as Credential from '@dxos/compute/Credential';
|
|
20
23
|
import * as Operation from '@dxos/compute/Operation';
|
|
21
24
|
import * as Template from '@dxos/compute/Template';
|
|
22
25
|
import * as Trace from '@dxos/compute/Trace';
|
|
23
|
-
import { Database, Feed, Obj, Ref } from '@dxos/echo';
|
|
26
|
+
import { Database, Feed, Obj, Ref, Registry } from '@dxos/echo';
|
|
24
27
|
import * as EffectEx from '@dxos/effect/EffectEx';
|
|
25
28
|
import { invariant } from '@dxos/invariant';
|
|
26
29
|
import { DXN } from '@dxos/keys';
|
|
@@ -101,7 +104,7 @@ export default AgentOperation.RunInstructions.pipe(
|
|
|
101
104
|
invariant(Obj.instanceOf(Chat.Chat, chat), 'Expected Chat object.');
|
|
102
105
|
feed = yield* Database.load(chat.feed);
|
|
103
106
|
} else {
|
|
104
|
-
feed = yield* Database.add(
|
|
107
|
+
feed = yield* Database.add(TrajectoryStore.makeFeed());
|
|
105
108
|
}
|
|
106
109
|
|
|
107
110
|
const resultSink = yield* Deferred.make<unknown, PromptError>();
|
|
@@ -121,11 +124,17 @@ export default AgentOperation.RunInstructions.pipe(
|
|
|
121
124
|
}),
|
|
122
125
|
);
|
|
123
126
|
|
|
127
|
+
// The space's MCP connections, re-read each iteration so one the run adds connects on its next turn.
|
|
128
|
+
const mcpServers = loadMcpServers({ feed }).pipe(
|
|
129
|
+
Effect.provide(yield* Effect.context<Database.Service | Registry.Service | Credential.CredentialsService>()),
|
|
130
|
+
);
|
|
131
|
+
|
|
124
132
|
yield* session
|
|
125
133
|
.createRequest({
|
|
126
134
|
prompt: promptText,
|
|
127
135
|
system: systemText,
|
|
128
136
|
toolkit: promptToolkit,
|
|
137
|
+
mcpServers,
|
|
129
138
|
})
|
|
130
139
|
.pipe(
|
|
131
140
|
Effect.provide(
|
|
@@ -143,6 +152,7 @@ export default AgentOperation.RunInstructions.pipe(
|
|
|
143
152
|
prompt: 'You must signal task completion by calling [completeJob] with the output or failure reason.',
|
|
144
153
|
system: systemText,
|
|
145
154
|
toolkit: promptToolkit,
|
|
155
|
+
mcpServers,
|
|
146
156
|
})
|
|
147
157
|
.pipe(
|
|
148
158
|
Effect.provide(
|
|
@@ -13,7 +13,9 @@ export const key = 'org.dxos.skill.browser';
|
|
|
13
13
|
|
|
14
14
|
const instructions = trim`
|
|
15
15
|
You are able to connect and use a virtual browser with persistent session.
|
|
16
|
-
Browser tools
|
|
16
|
+
Browser tools come from the built-in Browser MCP server (\`org.dxos.mcp.browser\`), not from this
|
|
17
|
+
skill, and it is off until turned on. When you need them, turn it on with the Skill Manager's
|
|
18
|
+
set-mcp-connection; they are available from your next step.
|
|
17
19
|
`;
|
|
18
20
|
|
|
19
21
|
export const make = () =>
|
|
@@ -25,11 +27,4 @@ export const make = () =>
|
|
|
25
27
|
instructions: {
|
|
26
28
|
source: Ref.make(Text.make({ content: instructions })),
|
|
27
29
|
},
|
|
28
|
-
mcpServers: [
|
|
29
|
-
{
|
|
30
|
-
// https://dash.cloudflare.com/950816f3f59b079880a1ae33fb0ec320/workers/services/view/playwright-mcp-example/production
|
|
31
|
-
url: 'https://playwright-mcp-example.dxos.workers.dev/sse',
|
|
32
|
-
protocol: 'sse',
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
30
|
});
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import { describe, expect, it } from '@effect/vitest';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { TrajectoryStore } from '@dxos/assistant';
|
|
9
9
|
import * as Operation from '@dxos/compute/Operation';
|
|
10
|
-
import { Database, Feed, Obj,
|
|
10
|
+
import { Database, Feed, Obj, Ref } from '@dxos/echo';
|
|
11
11
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
12
12
|
import { EID, EntityId } from '@dxos/keys';
|
|
13
13
|
import { Organization } from '@dxos/types';
|
|
@@ -30,8 +30,10 @@ describe('ContextAdd', () => {
|
|
|
30
30
|
Effect.provide(Operation.withInvocationOptions({ conversation: Obj.getURI(feed) })),
|
|
31
31
|
);
|
|
32
32
|
|
|
33
|
-
const
|
|
34
|
-
const added =
|
|
33
|
+
const events = yield* TrajectoryStore.read(feed);
|
|
34
|
+
const added = events.flatMap((event) =>
|
|
35
|
+
event.payload._tag === 'contextBind' ? entityIds(event.payload.objects) : [],
|
|
36
|
+
);
|
|
35
37
|
expect(added).toContain(organization.id);
|
|
36
38
|
},
|
|
37
39
|
Effect.provide(OperationTestLayer),
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import { describe, expect, it } from '@effect/vitest';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { TrajectoryStore } from '@dxos/assistant';
|
|
9
9
|
import * as Operation from '@dxos/compute/Operation';
|
|
10
|
-
import { Database, Feed, Obj,
|
|
10
|
+
import { Database, Feed, Obj, Ref } from '@dxos/echo';
|
|
11
11
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
12
12
|
import { EID, EntityId } from '@dxos/keys';
|
|
13
13
|
import { Organization } from '@dxos/types';
|
|
@@ -30,8 +30,10 @@ describe('ContextRemove', () => {
|
|
|
30
30
|
yield* Operation.invoke(ContextAdd, { obj: Ref.make(organization) }).pipe(Effect.provide(conversation));
|
|
31
31
|
yield* Operation.invoke(ContextRemove, { obj: Ref.make(organization) }).pipe(Effect.provide(conversation));
|
|
32
32
|
|
|
33
|
-
const
|
|
34
|
-
const removed =
|
|
33
|
+
const events = yield* TrajectoryStore.read(feed);
|
|
34
|
+
const removed = events.flatMap((event) =>
|
|
35
|
+
event.payload._tag === 'contextUnbind' ? entityIds(event.payload.objects) : [],
|
|
36
|
+
);
|
|
35
37
|
expect(removed).toContain(organization.id);
|
|
36
38
|
},
|
|
37
39
|
Effect.provide(OperationTestLayer),
|
|
@@ -25,8 +25,8 @@ export const make = () =>
|
|
|
25
25
|
Delegate existing checklist tasks with the delegate-tasks tool, selecting by 1-based
|
|
26
26
|
ordinal or exact title; delegate-task creates a NEW task from a title. When unsure what
|
|
27
27
|
the checklist holds, read it first (get-agent-context when available). Delegated tasks
|
|
28
|
-
run in the background once their dependencies are done, and each result is
|
|
29
|
-
to the conversation.
|
|
28
|
+
run in the background once their dependencies are done or in review, and each result is
|
|
29
|
+
reported back to the conversation.
|
|
30
30
|
`,
|
|
31
31
|
}),
|
|
32
32
|
});
|
|
@@ -38,8 +38,8 @@ export const DelegateTasks = Operation.make({
|
|
|
38
38
|
description: trim`
|
|
39
39
|
Delegate one or more EXISTING tasks from the conversation's checklist to background
|
|
40
40
|
sub-agents. Select tasks by their checklist ordinal (1-based number) or exact title.
|
|
41
|
-
Each selected task is
|
|
42
|
-
once the task's dependencies are done, and reports each result back to the conversation.
|
|
41
|
+
Each selected task is handed to an agent; the supervisor spawns one sub-agent per task
|
|
42
|
+
once the task's dependencies are done or in review, and reports each result back to the conversation.
|
|
43
43
|
`,
|
|
44
44
|
icon: 'ph--share-network--regular',
|
|
45
45
|
},
|
|
@@ -63,7 +63,6 @@ describe('DelegateTask', () => {
|
|
|
63
63
|
|
|
64
64
|
yield* invokeDelegateTask({ title: 'Research widgets' }, chatFeed);
|
|
65
65
|
|
|
66
|
-
// The durable task lands on the chat's checklist with an agent assignee.
|
|
67
66
|
const chat = yield* Agent.loadChat(agent);
|
|
68
67
|
invariant(chat, 'Agent chat not found.');
|
|
69
68
|
const tasks = yield* Chat.loadTasks(chat);
|
|
@@ -71,7 +70,7 @@ describe('DelegateTask', () => {
|
|
|
71
70
|
expect(tasks[0]).toMatchObject({
|
|
72
71
|
title: 'Research widgets',
|
|
73
72
|
status: 'todo',
|
|
74
|
-
|
|
73
|
+
delegate: { role: 'assistant' },
|
|
75
74
|
});
|
|
76
75
|
// The project's own ledger is untouched: a conversation's checklist is its own.
|
|
77
76
|
invariant(project.taskSet, 'Project task set not materialized.');
|
|
@@ -15,7 +15,7 @@ import { DelegateTask } from './definitions.ts';
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Delegation is the promotion moment: the unit of work becomes a durable `Task` on the
|
|
18
|
-
* conversation's checklist
|
|
18
|
+
* conversation's checklist delegated to an agent (`role: 'assistant'`), which the supervisor's
|
|
19
19
|
* reconcile loop picks up and marks done/failed on completion (see the delegation strategy).
|
|
20
20
|
*/
|
|
21
21
|
const handler: Operation.WithHandler<typeof DelegateTask> = DelegateTask.pipe(
|
|
@@ -32,7 +32,7 @@ const handler: Operation.WithHandler<typeof DelegateTask> = DelegateTask.pipe(
|
|
|
32
32
|
// the task started at spawn, so `started` always means a live process.
|
|
33
33
|
const task = Chat.addTask(db, chat, title, {
|
|
34
34
|
status: 'todo',
|
|
35
|
-
|
|
35
|
+
delegate: { role: 'assistant' },
|
|
36
36
|
});
|
|
37
37
|
yield* Database.flush();
|
|
38
38
|
|
|
@@ -14,12 +14,6 @@ import { trim } from '@dxos/util';
|
|
|
14
14
|
import { ToolkitError } from '../../../errors.ts';
|
|
15
15
|
import { DelegateTasks } from './definitions.ts';
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* Delegates existing checklist tasks: each selected task is assigned to an agent and queued, and
|
|
19
|
-
* the supervisor's reconcile loop spawns one sub-agent per task once its dependencies are done
|
|
20
|
-
* (marking it started at spawn; done/failed on exit). Selectors are 1-based checklist ordinals or
|
|
21
|
-
* exact titles, so the model can act on "task 2" as easily as on a name.
|
|
22
|
-
*/
|
|
23
17
|
const handler: Operation.WithHandler<typeof DelegateTasks> = DelegateTasks.pipe(
|
|
24
18
|
Operation.withHandler(
|
|
25
19
|
Effect.fn(function* ({ tasks: selectors }) {
|
|
@@ -63,7 +57,7 @@ const handler: Operation.WithHandler<typeof DelegateTasks> = DelegateTasks.pipe(
|
|
|
63
57
|
continue;
|
|
64
58
|
}
|
|
65
59
|
Obj.update(task, (task) => {
|
|
66
|
-
task.
|
|
60
|
+
task.delegate = { role: 'assistant' };
|
|
67
61
|
task.status = 'todo';
|
|
68
62
|
});
|
|
69
63
|
delegated += 1;
|
|
@@ -71,7 +65,7 @@ const handler: Operation.WithHandler<typeof DelegateTasks> = DelegateTasks.pipe(
|
|
|
71
65
|
yield* Database.flush();
|
|
72
66
|
|
|
73
67
|
return trim`
|
|
74
|
-
Delegated ${delegated} task(s) to sub-agents (each starts once its dependencies are done);
|
|
68
|
+
Delegated ${delegated} task(s) to sub-agents (each starts once its dependencies are done or in review);
|
|
75
69
|
${skipped.length > 0 ? `skipped: ${skipped.join(', ')}.` : ''}
|
|
76
70
|
|
|
77
71
|
<checklist>
|
package/src/skills/index.ts
CHANGED
|
@@ -9,6 +9,5 @@ export * from './skill-manager/index.ts';
|
|
|
9
9
|
export * from './browser/index.ts';
|
|
10
10
|
export * from './chat-context/index.ts';
|
|
11
11
|
export * from './delegation/index.ts';
|
|
12
|
-
export * from './memory/index.ts';
|
|
13
12
|
export * from './planning/index.ts';
|
|
14
13
|
export * from './websearch/index.ts';
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
// @import-as-namespace
|
|
6
6
|
|
|
7
|
-
import * as
|
|
7
|
+
import type * as Hook from '@dxos/compute/Hook';
|
|
8
8
|
import * as Skill from '@dxos/compute/Skill';
|
|
9
9
|
import * as Template from '@dxos/compute/Template';
|
|
10
|
-
import { Ref } from '@dxos/echo';
|
|
11
10
|
import { trim } from '@dxos/util';
|
|
12
11
|
|
|
13
12
|
import { AskQuestion, PlanReminder, UpdateTasks } from './operations/definitions.ts';
|
|
@@ -32,23 +31,20 @@ export const make = () =>
|
|
|
32
31
|
numbered list, and each line carries the task's ref.
|
|
33
32
|
Track your work with update-tasks: address an existing task by its ref, set create only to
|
|
34
33
|
make a new one, keep exactly one task started at a time, and mark a task done as soon as it
|
|
35
|
-
completes. Starting a task
|
|
34
|
+
completes. Starting a task makes you the agent working it.
|
|
36
35
|
Do only what the user asked: if they name a specific task or subset, complete exactly
|
|
37
36
|
that and stop — never start unrequested tasks on your own.
|
|
38
37
|
A task that already exists elsewhere (a project's task, a sub-task of one you were given) is
|
|
39
38
|
worked through its own ref — never recreate it with create. assign puts it on this checklist
|
|
40
|
-
|
|
39
|
+
with you working it; unassign takes it off, never deleting it.
|
|
41
40
|
`,
|
|
42
41
|
}),
|
|
43
|
-
// At the end of every request, remind the agent to keep working while its plan has open tasks.
|
|
44
|
-
// The reminder enqueues onto the owning host (Tier B), which keeps the process alive.
|
|
45
|
-
hooks: [
|
|
46
|
-
{
|
|
47
|
-
spec: { _tag: 'end-request' },
|
|
48
|
-
function: Ref.make(Operation.serialize(PlanReminder)),
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
42
|
});
|
|
52
43
|
|
|
44
|
+
/** At the end of every request, reminds the agent to keep working while its plan has open tasks. */
|
|
45
|
+
export const hooks: Hook.Declaration[] = [
|
|
46
|
+
{ key: 'org.dxos.hook.planning.planReminder', event: 'end-request', skill: key, operation: PlanReminder },
|
|
47
|
+
];
|
|
48
|
+
|
|
53
49
|
export { PlanningHandlers as Handlers } from './operations/index.ts';
|
|
54
50
|
export * as Operations from './operations/definitions.ts';
|
|
@@ -6,6 +6,7 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
|
|
7
7
|
import { AiService } from '@dxos/ai';
|
|
8
8
|
import { Harness } from '@dxos/assistant';
|
|
9
|
+
import * as Hook from '@dxos/compute/Hook';
|
|
9
10
|
import * as Operation from '@dxos/compute/Operation';
|
|
10
11
|
import * as Trace from '@dxos/compute/Trace';
|
|
11
12
|
import { Database, Ref } from '@dxos/echo';
|
|
@@ -30,16 +31,16 @@ const TaskChange = Schema.Struct({
|
|
|
30
31
|
description: 'Create a new task on this checklist, assigned to you. Requires `title`; omit `task`.',
|
|
31
32
|
}).pipe(Schema.optional),
|
|
32
33
|
assign: Schema.Boolean.annotate({
|
|
33
|
-
description: 'Put the task on this checklist
|
|
34
|
+
description: 'Put the task on this checklist with you working it. A person who answers for it stays its assignee.',
|
|
34
35
|
}).pipe(Schema.optional),
|
|
35
36
|
unassign: Schema.Boolean.annotate({
|
|
36
|
-
description: 'Take the task off this checklist and
|
|
37
|
+
description: 'Take the task off this checklist and stop working it. Never deletes the task.',
|
|
37
38
|
}).pipe(Schema.optional),
|
|
38
39
|
title: Schema.String.annotate({ description: 'The new task title, or a rename of an existing task.' }).pipe(
|
|
39
40
|
Schema.optional,
|
|
40
41
|
),
|
|
41
42
|
status: Schema.Literals(['todo', 'started', 'done'])
|
|
42
|
-
.annotate({ description: '`started` also
|
|
43
|
+
.annotate({ description: '`started` also makes you the agent working it.' })
|
|
43
44
|
.pipe(Schema.optional),
|
|
44
45
|
});
|
|
45
46
|
|
|
@@ -106,6 +107,6 @@ export const PlanReminder = Operation.make({
|
|
|
106
107
|
description: 'Reminds the agent to continue when its plan still has incomplete tasks.',
|
|
107
108
|
},
|
|
108
109
|
input: Schema.Struct({}),
|
|
109
|
-
output:
|
|
110
|
+
output: Hook.Output,
|
|
110
111
|
services: [Harness.HarnessService, Database.Service, AiService.AiService],
|
|
111
112
|
});
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import { describe, expect, it } from '@effect/vitest';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Exit from 'effect/Exit';
|
|
8
7
|
|
|
9
8
|
import { AssistantTestLayerWithTriggers } from '@dxos/agent-runtime/testing';
|
|
10
9
|
import { ScriptedLanguageModel } from '@dxos/ai/testing';
|
|
@@ -27,13 +26,13 @@ EntityId.dangerouslyDisableRandomness();
|
|
|
27
26
|
|
|
28
27
|
describe('PlanReminder', () => {
|
|
29
28
|
it.effect(
|
|
30
|
-
'
|
|
29
|
+
'returns a continuation reminder when the model says continue',
|
|
31
30
|
Effect.fnUntraced(
|
|
32
31
|
function* (_) {
|
|
33
32
|
const conversation = yield* setupChatWithChecklist([false]);
|
|
34
|
-
const
|
|
33
|
+
const { followUp } = yield* Operation.invoke(PlanReminder, {}).pipe(Effect.provide(conversation));
|
|
35
34
|
|
|
36
|
-
expect(
|
|
35
|
+
expect(followUp).toContain('Task 0');
|
|
37
36
|
},
|
|
38
37
|
Effect.provide(layerDeciding('continue')),
|
|
39
38
|
TestHelpers.provideTestContext,
|
|
@@ -41,13 +40,13 @@ describe('PlanReminder', () => {
|
|
|
41
40
|
);
|
|
42
41
|
|
|
43
42
|
it.effect(
|
|
44
|
-
'
|
|
43
|
+
'returns no follow-up when the model says stop',
|
|
45
44
|
Effect.fnUntraced(
|
|
46
45
|
function* (_) {
|
|
47
46
|
const conversation = yield* setupChatWithChecklist([false]);
|
|
48
|
-
const
|
|
47
|
+
const output = yield* Operation.invoke(PlanReminder, {}).pipe(Effect.provide(conversation));
|
|
49
48
|
|
|
50
|
-
expect(
|
|
49
|
+
expect(output).toEqual({});
|
|
51
50
|
},
|
|
52
51
|
Effect.provide(layerDeciding('stop')),
|
|
53
52
|
TestHelpers.provideTestContext,
|
|
@@ -59,10 +58,10 @@ describe('PlanReminder', () => {
|
|
|
59
58
|
Effect.fnUntraced(
|
|
60
59
|
function* (_) {
|
|
61
60
|
const conversation = yield* setupChatWithChecklist([true]);
|
|
62
|
-
const exit = yield* Effect.exit(Operation.invoke(PlanReminder, {}).pipe(Effect.provide(conversation)));
|
|
63
|
-
|
|
64
61
|
// The script is empty, so reaching the model at all would fail as exhausted.
|
|
65
|
-
|
|
62
|
+
const output = yield* Operation.invoke(PlanReminder, {}).pipe(Effect.provide(conversation));
|
|
63
|
+
|
|
64
|
+
expect(output).toEqual({});
|
|
66
65
|
},
|
|
67
66
|
Effect.provide(
|
|
68
67
|
AssistantTestLayerWithTriggers({
|
|
@@ -107,11 +106,6 @@ const types = [
|
|
|
107
106
|
|
|
108
107
|
// The hook asks the model whether to keep working; scripting that reply covers both branches, which
|
|
109
108
|
// a single frozen conversation could not.
|
|
110
|
-
//
|
|
111
|
-
// No host process is spawned, so the Tier B enqueue on the continue branch fails with
|
|
112
|
-
// NotSupportedError. That failure is the assertion: it fires exactly when the hook decided to
|
|
113
|
-
// enqueue, and its absence proves it decided not to — observable without reaching into the host's
|
|
114
|
-
// queue, which is where the reminder would otherwise land.
|
|
115
109
|
const layerDeciding = (decision: string) =>
|
|
116
110
|
AssistantTestLayerWithTriggers({
|
|
117
111
|
operationHandlers: OperationHandlerSet.merge(PlanningHandlers),
|
|
@@ -10,7 +10,6 @@ import { AiPreprocessor, AiService } from '@dxos/ai';
|
|
|
10
10
|
import { Harness } from '@dxos/assistant';
|
|
11
11
|
import * as Chat from '@dxos/assistant/Chat';
|
|
12
12
|
import * as Operation from '@dxos/compute/Operation';
|
|
13
|
-
import { ContentBlock } from '@dxos/types';
|
|
14
13
|
import { concat, trim } from '@dxos/util';
|
|
15
14
|
|
|
16
15
|
import { PlanReminder } from './definitions.ts';
|
|
@@ -19,10 +18,9 @@ import { PlanReminder } from './definitions.ts';
|
|
|
19
18
|
* End-request hook for the planning skill. When the conversation's checklist still has
|
|
20
19
|
* open tasks, an ephemeral check asks the model — given the full conversation — whether the
|
|
21
20
|
* agent should keep working: a deterministic reminder alone would trap an agent that legitimately
|
|
22
|
-
* finishes with open items in an unbreakable re-prompt loop. On "continue" it
|
|
23
|
-
* continuation reminder
|
|
24
|
-
*
|
|
25
|
-
* open.
|
|
21
|
+
* finishes with open items in an unbreakable re-prompt loop. On "continue" it returns a
|
|
22
|
+
* continuation reminder as its follow-up; on "stop" it returns none so the agent may complete with
|
|
23
|
+
* items deliberately left open.
|
|
26
24
|
*/
|
|
27
25
|
export default PlanReminder.pipe(
|
|
28
26
|
Operation.withHandler(
|
|
@@ -30,12 +28,12 @@ export default PlanReminder.pipe(
|
|
|
30
28
|
function* () {
|
|
31
29
|
const chat = yield* Harness.getChat.pipe(Effect.orElseSucceed(() => undefined));
|
|
32
30
|
if (!chat) {
|
|
33
|
-
return;
|
|
31
|
+
return {};
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
const tasks = yield* Chat.loadTasks(chat);
|
|
37
35
|
if (!tasks.some(Chat.isOpenTask)) {
|
|
38
|
-
return;
|
|
36
|
+
return {};
|
|
39
37
|
}
|
|
40
38
|
const checklist = yield* Chat.formatChecklist(chat);
|
|
41
39
|
|
|
@@ -46,14 +44,10 @@ export default PlanReminder.pipe(
|
|
|
46
44
|
);
|
|
47
45
|
const { text: reply } = yield* Effect.scoped(LanguageModel.generateText({ prompt }));
|
|
48
46
|
if (!parseContinueDecision(reply)) {
|
|
49
|
-
return;
|
|
47
|
+
return {};
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
content: [
|
|
54
|
-
ContentBlock.Text.make({ text: checklistContinueReminderPrompt(checklist), disposition: 'synthetic' }),
|
|
55
|
-
],
|
|
56
|
-
});
|
|
50
|
+
return { followUp: checklistContinueReminderPrompt(checklist) };
|
|
57
51
|
},
|
|
58
52
|
Effect.provide(AiService.languageModel('com.anthropic.model.claude-sonnet-5.default')),
|
|
59
53
|
),
|