@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
|
@@ -10,16 +10,104 @@ import * as Skill from '@dxos/compute/Skill';
|
|
|
10
10
|
import { Database, Registry, Type } from '@dxos/echo';
|
|
11
11
|
import { DXN } from '@dxos/keys';
|
|
12
12
|
|
|
13
|
+
/** An operation of a skill, as the lookups below describe it. */
|
|
14
|
+
const ListedOperation = Schema.Struct({
|
|
15
|
+
key: Schema.String.annotate({ description: 'The operation key.' }),
|
|
16
|
+
tool: Schema.String.annotate({ description: 'Its tool name.' }),
|
|
17
|
+
name: Schema.optional(Schema.String),
|
|
18
|
+
description: Schema.optional(Schema.String),
|
|
19
|
+
skill: Schema.String.annotate({ description: 'Key of the skill that provides it.' }),
|
|
20
|
+
enabled: Schema.Boolean.annotate({
|
|
21
|
+
description: 'Whether its skill is enabled in this conversation, so it can be used now.',
|
|
22
|
+
}),
|
|
23
|
+
input: Schema.optional(Schema.String).annotate({
|
|
24
|
+
description: 'Its input, e.g. `{ title: string, owner?: Ref<org.dxos.type.person> }`; given when looked up by key.',
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export interface ListedOperation extends Schema.Schema.Type<typeof ListedOperation> {}
|
|
29
|
+
|
|
30
|
+
/** A skill, as `query-skills` describes it. */
|
|
31
|
+
const ListedSkill = Schema.Struct({
|
|
32
|
+
key: Schema.String,
|
|
33
|
+
name: Schema.String,
|
|
34
|
+
description: Schema.optional(Schema.String),
|
|
35
|
+
enabled: Schema.Boolean.annotate({ description: 'Whether the skill is enabled in this conversation.' }),
|
|
36
|
+
agentCanEnable: Schema.Boolean.annotate({ description: 'Whether `enable-skills` may enable it.' }),
|
|
37
|
+
instructions: Schema.optional(Schema.String).annotate({
|
|
38
|
+
description: "The skill's instructions; given when looked up by key.",
|
|
39
|
+
}),
|
|
40
|
+
operations: Schema.optional(Schema.Array(ListedOperation)).annotate({
|
|
41
|
+
description: 'Its operations; given when looked up by key.',
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export interface ListedSkill extends Schema.Schema.Type<typeof ListedSkill> {}
|
|
46
|
+
|
|
47
|
+
/** A registered type, as `query-types` describes it. */
|
|
48
|
+
const ListedType = Schema.Struct({
|
|
49
|
+
typename: Schema.String,
|
|
50
|
+
dxn: Schema.String.annotate({ description: 'The versioned DXN the type resolves by.' }),
|
|
51
|
+
kind: Schema.Literals(['object', 'relation']),
|
|
52
|
+
fields: Schema.optional(Schema.String).annotate({ description: 'Its fields; given when looked up by typename.' }),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export interface ListedType extends Schema.Schema.Type<typeof ListedType> {}
|
|
56
|
+
|
|
13
57
|
export const QuerySkills = Operation.make({
|
|
14
58
|
meta: {
|
|
15
59
|
key: DXN.make('org.dxos.operation.assistantToolkit.querySkills'),
|
|
16
60
|
name: 'Query skills',
|
|
17
|
-
description:
|
|
61
|
+
description:
|
|
62
|
+
'Queries available skills, each saying whether it is enabled here and whether you may enable it. ' +
|
|
63
|
+
'Pass `query` to find the skill that provides a tool you lack: the words are matched against skill names, ' +
|
|
64
|
+
'descriptions and tool names, best match first. Pass `keys` to get those skills in full: their instructions ' +
|
|
65
|
+
'and operations.',
|
|
18
66
|
icon: 'ph--student--regular',
|
|
19
67
|
},
|
|
20
|
-
input: Schema.Struct({
|
|
21
|
-
|
|
22
|
-
|
|
68
|
+
input: Schema.Struct({
|
|
69
|
+
query: Schema.optional(Schema.String).annotate({
|
|
70
|
+
description: 'Words describing the tool or capability you need, e.g. "link task to feature".',
|
|
71
|
+
}),
|
|
72
|
+
keys: Schema.optional(Schema.Array(Schema.String)).annotate({ description: 'Skills to return in full.' }),
|
|
73
|
+
}),
|
|
74
|
+
output: Schema.Array(ListedSkill),
|
|
75
|
+
services: [Registry.Service, Harness.HarnessService],
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export const QueryOperations = Operation.make({
|
|
79
|
+
meta: {
|
|
80
|
+
key: DXN.make('org.dxos.operation.assistantToolkit.queryOperations'),
|
|
81
|
+
name: 'Query operations',
|
|
82
|
+
description:
|
|
83
|
+
'Searches the operations of the skills you can use (enabled here, or ones you may enable) by what they do; ' +
|
|
84
|
+
"`skill` narrows to one skill's. Pass `keys` to get each in full, with its input.",
|
|
85
|
+
icon: 'ph--magnifying-glass--regular',
|
|
86
|
+
},
|
|
87
|
+
input: Schema.Struct({
|
|
88
|
+
query: Schema.optional(Schema.String).annotate({ description: 'Words describing what the operation does.' }),
|
|
89
|
+
skill: Schema.optional(Schema.String).annotate({ description: "Only this skill's operations." }),
|
|
90
|
+
keys: Schema.optional(Schema.Array(Schema.String)).annotate({ description: 'Operations to return in full.' }),
|
|
91
|
+
}),
|
|
92
|
+
output: Schema.Array(ListedOperation),
|
|
93
|
+
services: [Registry.Service, Harness.HarnessService],
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export const QueryTypes = Operation.make({
|
|
97
|
+
meta: {
|
|
98
|
+
key: DXN.make('org.dxos.operation.assistantToolkit.queryTypes'),
|
|
99
|
+
name: 'Query types',
|
|
100
|
+
description: 'Searches the registered object and relation types. Pass `typenames` to get their fields.',
|
|
101
|
+
icon: 'ph--shapes--regular',
|
|
102
|
+
},
|
|
103
|
+
input: Schema.Struct({
|
|
104
|
+
query: Schema.optional(Schema.String).annotate({ description: 'Words in the type or field names.' }),
|
|
105
|
+
typenames: Schema.optional(Schema.Array(Schema.String)).annotate({
|
|
106
|
+
description: 'Types to return with their fields, by typename or DXN.',
|
|
107
|
+
}),
|
|
108
|
+
}),
|
|
109
|
+
output: Schema.Array(ListedType),
|
|
110
|
+
services: [Database.Service],
|
|
23
111
|
});
|
|
24
112
|
|
|
25
113
|
export const EnableSkills = Operation.make({
|
|
@@ -27,13 +115,14 @@ export const EnableSkills = Operation.make({
|
|
|
27
115
|
key: DXN.make('org.dxos.operation.assistantToolkit.enableSkills'),
|
|
28
116
|
name: 'Enable skills',
|
|
29
117
|
description:
|
|
30
|
-
'Enables skills in the current conversation by their keys
|
|
118
|
+
'Enables skills in the current conversation by their keys, as query-skills lists them. Only skills with ' +
|
|
119
|
+
'agentCanEnable=true can be enabled.',
|
|
31
120
|
icon: 'ph--plugs-connected--regular',
|
|
32
121
|
},
|
|
33
122
|
input: Schema.Struct({
|
|
34
123
|
keys: Schema.Array(Schema.String).annotate({
|
|
35
124
|
description: 'The keys of the skills to enable.',
|
|
36
|
-
examples: [['org.dxos.skill.
|
|
125
|
+
examples: [['org.dxos.skill.planning', 'org.dxos.skill.database']],
|
|
37
126
|
}),
|
|
38
127
|
}),
|
|
39
128
|
output: Schema.Struct({
|
|
@@ -47,3 +136,76 @@ export const EnableSkills = Operation.make({
|
|
|
47
136
|
}),
|
|
48
137
|
services: [Registry.Service, Database.Service, Harness.HarnessService],
|
|
49
138
|
});
|
|
139
|
+
|
|
140
|
+
const McpConnection = Schema.Struct({
|
|
141
|
+
id: Schema.String.annotate({ description: "The connection's id, or a built-in server's key." }),
|
|
142
|
+
name: Schema.optional(Schema.String),
|
|
143
|
+
connectorId: Schema.optional(Schema.String),
|
|
144
|
+
enabled: Schema.Boolean.annotate({ description: 'Whether this conversation connects its MCP server.' }),
|
|
145
|
+
builtin: Schema.optional(Schema.Boolean).annotate({
|
|
146
|
+
description: 'A server Composer ships rather than a connection the space holds; off until turned on.',
|
|
147
|
+
}),
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
export const QueryMcpConnections = Operation.make({
|
|
151
|
+
meta: {
|
|
152
|
+
key: DXN.make('org.dxos.operation.assistantToolkit.queryMcpConnections'),
|
|
153
|
+
name: 'Query MCP connections',
|
|
154
|
+
description:
|
|
155
|
+
"Lists the MCP servers this conversation can connect and whether each is on: the space's connections, on unless the conversation turned them off, and the built-in servers Composer ships (such as Browser), off until turned on. A connection is not a skill: a skill whose tools come from one needs both.",
|
|
156
|
+
icon: 'ph--plugs-connected--regular',
|
|
157
|
+
},
|
|
158
|
+
input: Schema.Struct({}),
|
|
159
|
+
output: Schema.Array(McpConnection),
|
|
160
|
+
services: [Database.Service, Registry.Service, Harness.HarnessService],
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
export const SetMcpConnection = Operation.make({
|
|
164
|
+
meta: {
|
|
165
|
+
key: DXN.make('org.dxos.operation.assistantToolkit.setMcpConnection'),
|
|
166
|
+
name: 'Set MCP connection',
|
|
167
|
+
description:
|
|
168
|
+
"Turns a connection's MCP server on or off for this conversation; enabling a skill does not do this. Its tools appear or disappear from your next step, so keep going in this response.",
|
|
169
|
+
icon: 'ph--plugs-connected--regular',
|
|
170
|
+
},
|
|
171
|
+
input: Schema.Struct({
|
|
172
|
+
id: Schema.String.annotate({
|
|
173
|
+
description: "The connection's id or the built-in server's key, as the query lists it.",
|
|
174
|
+
}),
|
|
175
|
+
enabled: Schema.Boolean,
|
|
176
|
+
}),
|
|
177
|
+
output: McpConnection,
|
|
178
|
+
services: [Database.Service, Registry.Service, Harness.HarnessService],
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
export const AddMcpConnection = Operation.make({
|
|
182
|
+
meta: {
|
|
183
|
+
key: DXN.make('org.dxos.operation.assistantToolkit.addMcpConnection'),
|
|
184
|
+
name: 'Add MCP connection',
|
|
185
|
+
description:
|
|
186
|
+
"Adds an MCP server to the space as a connection, with no credential or with an API key, or updates the connection the space already has for it. It is on in this conversation, so its tools are available from your next step. A server that needs sign-in can't be added this way: ask the user to connect it.",
|
|
187
|
+
icon: 'ph--plugs-connected--regular',
|
|
188
|
+
},
|
|
189
|
+
input: Schema.Struct({
|
|
190
|
+
url: Schema.String.annotate({
|
|
191
|
+
description: "The server's MCP endpoint.",
|
|
192
|
+
examples: ['https://mcp.example.com/mcp'],
|
|
193
|
+
}),
|
|
194
|
+
name: Schema.optional(Schema.String).annotate({ description: 'Defaults to the URL host.' }),
|
|
195
|
+
protocol: Schema.optional(Schema.Literals(['http', 'sse'])).annotate({
|
|
196
|
+
description: 'Streamable HTTP unless the server only speaks the deprecated SSE transport.',
|
|
197
|
+
}),
|
|
198
|
+
key: Schema.optional(Schema.String).annotate({
|
|
199
|
+
description:
|
|
200
|
+
'An API key the server takes as a Bearer token. It is stored in the space, readable by every member.',
|
|
201
|
+
}),
|
|
202
|
+
}),
|
|
203
|
+
output: Schema.Struct({
|
|
204
|
+
...McpConnection.fields,
|
|
205
|
+
tools: Schema.optional(Schema.Array(Schema.String)).annotate({ description: 'The tools the server listed.' }),
|
|
206
|
+
problem: Schema.optional(Schema.String).annotate({
|
|
207
|
+
description: 'Why the server could not be reached just now; the connection is still added.',
|
|
208
|
+
}),
|
|
209
|
+
}),
|
|
210
|
+
services: [Database.Service, Harness.HarnessService],
|
|
211
|
+
});
|
|
@@ -5,11 +5,24 @@
|
|
|
5
5
|
import * as Operation from '@dxos/compute/Operation';
|
|
6
6
|
import * as OperationHandlerSet from '@dxos/compute/OperationHandlerSet';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
AddMcpConnection,
|
|
10
|
+
EnableSkills,
|
|
11
|
+
QueryMcpConnections,
|
|
12
|
+
QueryOperations,
|
|
13
|
+
QuerySkills,
|
|
14
|
+
QueryTypes,
|
|
15
|
+
SetMcpConnection,
|
|
16
|
+
} from './definitions.ts';
|
|
9
17
|
|
|
10
18
|
export * as SkillManagerOperations from './definitions.ts';
|
|
11
19
|
|
|
12
20
|
export const SkillManagerHandlers = OperationHandlerSet.lazy([
|
|
13
21
|
QuerySkills.pipe(Operation.lazyHandler(() => import('./query-skills.ts'))),
|
|
22
|
+
QueryOperations.pipe(Operation.lazyHandler(() => import('./query-operations.ts'))),
|
|
23
|
+
QueryTypes.pipe(Operation.lazyHandler(() => import('./query-types.ts'))),
|
|
14
24
|
EnableSkills.pipe(Operation.lazyHandler(() => import('./enable-skills.ts'))),
|
|
25
|
+
AddMcpConnection.pipe(Operation.lazyHandler(() => import('./add-mcp-connection.ts'))),
|
|
26
|
+
QueryMcpConnections.pipe(Operation.lazyHandler(() => import('./query-mcp-connections.ts'))),
|
|
27
|
+
SetMcpConnection.pipe(Operation.lazyHandler(() => import('./set-mcp-connection.ts'))),
|
|
15
28
|
]);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { AiContext } from '@dxos/assistant';
|
|
8
|
+
import { Database, Filter, Obj, Registry } from '@dxos/echo';
|
|
9
|
+
import { type URI } from '@dxos/keys';
|
|
10
|
+
import { Connection } from '@dxos/link';
|
|
11
|
+
|
|
12
|
+
/** The MCP servers a conversation can connect: the space's connections, then the registry's built-ins. */
|
|
13
|
+
export const mcpConnections = Effect.gen(function* () {
|
|
14
|
+
const space = yield* Database.query(Filter.type(Connection.Connection)).run;
|
|
15
|
+
const builtin = (yield* Registry.runQuery(Filter.type(Connection.Connection))).filter(Connection.isBuiltin);
|
|
16
|
+
return [...space, ...builtin];
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
/** How the Skill Manager lists a connection: a built-in server by its key, which is what the agent passes back. */
|
|
20
|
+
export const describe = (connection: Connection.Connection, states: ReadonlyMap<URI.URI, boolean>) => {
|
|
21
|
+
const builtin = Connection.isBuiltin(connection);
|
|
22
|
+
return {
|
|
23
|
+
id: builtin ? (Obj.getMeta(connection).key ?? connection.id) : connection.id,
|
|
24
|
+
name: connection.name,
|
|
25
|
+
connectorId: connection.connectorId,
|
|
26
|
+
enabled: AiContext.isConnectionOn(states, connection),
|
|
27
|
+
...(builtin ? { builtin } : {}),
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Harness } from '@dxos/assistant';
|
|
8
|
+
import * as Operation from '@dxos/compute/Operation';
|
|
9
|
+
|
|
10
|
+
import { QueryMcpConnections } from './definitions.ts';
|
|
11
|
+
import { describe, mcpConnections } from './mcp-connections.ts';
|
|
12
|
+
|
|
13
|
+
export default QueryMcpConnections.pipe(
|
|
14
|
+
Operation.withHandler(
|
|
15
|
+
Effect.fnUntraced(function* () {
|
|
16
|
+
const binder = yield* Harness.binder.pipe(Effect.orDie);
|
|
17
|
+
yield* Effect.promise(() => binder.sync());
|
|
18
|
+
const states = binder.getConnections();
|
|
19
|
+
return (yield* mcpConnections).map((connection) => describe(connection, states));
|
|
20
|
+
}),
|
|
21
|
+
),
|
|
22
|
+
);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import * as Operation from '@dxos/compute/Operation';
|
|
8
|
+
import * as Skill from '@dxos/compute/Skill';
|
|
9
|
+
import { Filter, Registry } from '@dxos/echo';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
brief,
|
|
13
|
+
enabledSkills,
|
|
14
|
+
isEnabled,
|
|
15
|
+
knownSkills,
|
|
16
|
+
operationCandidates,
|
|
17
|
+
ranked,
|
|
18
|
+
sameKey,
|
|
19
|
+
skillKey,
|
|
20
|
+
withInput,
|
|
21
|
+
} from './catalog.ts';
|
|
22
|
+
import { QueryOperations } from './definitions.ts';
|
|
23
|
+
|
|
24
|
+
export default QueryOperations.pipe(
|
|
25
|
+
Operation.withHandler(
|
|
26
|
+
Effect.fnUntraced(function* ({ query, skill, keys } = {}) {
|
|
27
|
+
const enabled = yield* enabledSkills;
|
|
28
|
+
// The skills the agent can use: enabled here, or ones it may enable.
|
|
29
|
+
const skills = knownSkills(yield* Registry.runQuery(Filter.type(Skill.Skill)), enabled).filter(
|
|
30
|
+
(candidate) =>
|
|
31
|
+
(isEnabled(enabled, candidate) || candidate.agentCanEnable === true) &&
|
|
32
|
+
(skill === undefined || sameKey(skill, skillKey(candidate))),
|
|
33
|
+
);
|
|
34
|
+
const candidates = operationCandidates(
|
|
35
|
+
skills,
|
|
36
|
+
enabled,
|
|
37
|
+
yield* Registry.runQuery(Filter.type(Operation.PersistentOperation)),
|
|
38
|
+
);
|
|
39
|
+
if (keys !== undefined) {
|
|
40
|
+
return yield* Effect.forEach(
|
|
41
|
+
candidates.filter(({ listed }) => keys.some((key) => sameKey(key, listed.key) || key === listed.tool)),
|
|
42
|
+
withInput,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
return ranked(candidates, query, ({ listed }) => [listed.key, listed.name, listed.description, listed.skill]).map(
|
|
46
|
+
({ listed }) => brief(listed),
|
|
47
|
+
);
|
|
48
|
+
}),
|
|
49
|
+
),
|
|
50
|
+
);
|
|
@@ -2,19 +2,59 @@
|
|
|
2
2
|
// Copyright 2026 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Cause from 'effect/Cause';
|
|
5
6
|
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
6
8
|
|
|
7
9
|
import * as Operation from '@dxos/compute/Operation';
|
|
8
10
|
import * as Skill from '@dxos/compute/Skill';
|
|
11
|
+
import * as Template from '@dxos/compute/Template';
|
|
9
12
|
import { Filter, Registry } from '@dxos/echo';
|
|
10
13
|
|
|
14
|
+
import {
|
|
15
|
+
brief,
|
|
16
|
+
enabledSkills,
|
|
17
|
+
isEnabled,
|
|
18
|
+
knownSkills,
|
|
19
|
+
listedSkill,
|
|
20
|
+
operationCandidates,
|
|
21
|
+
ranked,
|
|
22
|
+
sameKey,
|
|
23
|
+
skillKey,
|
|
24
|
+
} from './catalog.ts';
|
|
11
25
|
import { QuerySkills } from './definitions.ts';
|
|
12
26
|
|
|
13
27
|
export default QuerySkills.pipe(
|
|
14
28
|
Operation.withHandler(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
29
|
+
// The skill's own prompt template invokes this with no input at all.
|
|
30
|
+
Effect.fnUntraced(function* ({ query, keys } = {}) {
|
|
31
|
+
const enabled = yield* enabledSkills;
|
|
32
|
+
const skills = knownSkills(yield* Registry.runQuery(Filter.type(Skill.Skill)), enabled);
|
|
33
|
+
if (keys === undefined) {
|
|
34
|
+
// Tool names count: a model that lacks an operation knows what it wants to do, not which skill carries it.
|
|
35
|
+
return ranked(skills, query, (skill) => [skillKey(skill), skill.name, skill.description, ...skill.tools]).map(
|
|
36
|
+
(skill) => listedSkill(skill, isEnabled(enabled, skill)),
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
const records = yield* Registry.runQuery(Filter.type(Operation.PersistentOperation));
|
|
40
|
+
return yield* Effect.forEach(
|
|
41
|
+
skills.filter((skill) => keys.some((key) => sameKey(key, skillKey(skill)))),
|
|
42
|
+
Effect.fnUntraced(function* (skill) {
|
|
43
|
+
// A template that fails to render, by an error or a defect, costs the skill its instructions rather than the
|
|
44
|
+
// whole lookup; an interruption still interrupts.
|
|
45
|
+
const instructions = yield* Template.processTemplate(skill.instructions).pipe(
|
|
46
|
+
Effect.map(Option.some),
|
|
47
|
+
Effect.catchCause((cause) =>
|
|
48
|
+
Cause.hasInterrupts(cause) ? Effect.interrupt : Effect.succeed(Option.none<string>()),
|
|
49
|
+
),
|
|
50
|
+
);
|
|
51
|
+
return {
|
|
52
|
+
...listedSkill(skill, isEnabled(enabled, skill)),
|
|
53
|
+
...(Option.isSome(instructions) ? { instructions: instructions.value } : {}),
|
|
54
|
+
operations: operationCandidates([skill], enabled, records).map(({ listed }) => brief(listed)),
|
|
55
|
+
};
|
|
56
|
+
}),
|
|
57
|
+
);
|
|
18
58
|
}),
|
|
19
59
|
),
|
|
20
60
|
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { type TypeDescription, describeTypes, renderFields } from '@dxos/assistant/Describe';
|
|
8
|
+
import * as Operation from '@dxos/compute/Operation';
|
|
9
|
+
import { Database } from '@dxos/echo';
|
|
10
|
+
|
|
11
|
+
import { ranked } from './catalog.ts';
|
|
12
|
+
import { QueryTypes } from './definitions.ts';
|
|
13
|
+
|
|
14
|
+
const listedType = ({ typename, dxn, kind }: TypeDescription) => ({ typename, dxn, kind });
|
|
15
|
+
|
|
16
|
+
export default QueryTypes.pipe(
|
|
17
|
+
Operation.withHandler(
|
|
18
|
+
Effect.fnUntraced(function* ({ query, typenames } = {}) {
|
|
19
|
+
const { db } = yield* Database.Service;
|
|
20
|
+
if (typenames !== undefined) {
|
|
21
|
+
// A lookup spells out every variant of a union, since this is how a model finds the fields it must write.
|
|
22
|
+
return describeTypes(db, { abridge: false })
|
|
23
|
+
.filter(({ typename, dxn }) => typenames.includes(typename) || typenames.includes(dxn))
|
|
24
|
+
.map((type) => ({ ...listedType(type), fields: renderFields(type.fields) }));
|
|
25
|
+
}
|
|
26
|
+
return ranked(describeTypes(db), query, ({ typename, fields }) => [
|
|
27
|
+
typename,
|
|
28
|
+
...fields.map(({ name }) => name),
|
|
29
|
+
]).map(listedType);
|
|
30
|
+
}),
|
|
31
|
+
),
|
|
32
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { AiContext, Harness } from '@dxos/assistant';
|
|
8
|
+
import * as Operation from '@dxos/compute/Operation';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
|
|
11
|
+
import { SetMcpConnection } from './definitions.ts';
|
|
12
|
+
import { describe, mcpConnections } from './mcp-connections.ts';
|
|
13
|
+
|
|
14
|
+
export default SetMcpConnection.pipe(
|
|
15
|
+
Operation.withHandler(
|
|
16
|
+
Effect.fnUntraced(function* ({ id, enabled }) {
|
|
17
|
+
const connection = (yield* mcpConnections).find(
|
|
18
|
+
(connection) => connection.id === id || Obj.getMeta(connection).key === id,
|
|
19
|
+
);
|
|
20
|
+
if (!connection) {
|
|
21
|
+
return yield* Effect.die(new Error(`No connection or built-in MCP server ${id}.`));
|
|
22
|
+
}
|
|
23
|
+
const binder = yield* Harness.binder.pipe(Effect.orDie);
|
|
24
|
+
yield* Effect.promise(() => binder.setConnection(AiContext.connectionRef(connection), enabled));
|
|
25
|
+
return describe(connection, binder.getConnections());
|
|
26
|
+
}),
|
|
27
|
+
),
|
|
28
|
+
);
|