@fungi.computer/knapsack 0.3.1 → 0.4.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/ui/browser.js +3 -3
- package/dist/ui/effect.d.ts +8 -2
- package/dist/ui/wire.d.ts +56 -14
- package/dist/ui/wire.js +7 -2
- package/package.json +4 -4
package/dist/ui/browser.js
CHANGED
|
@@ -24,7 +24,7 @@ function projectCommands(whistle) {
|
|
|
24
24
|
const sourceAction = row.action;
|
|
25
25
|
// Focus scope belongs to the local command graph, not the browser wire.
|
|
26
26
|
const projected = {
|
|
27
|
-
|
|
27
|
+
command: { namespace: row.command.namespace, id: row.command.id },
|
|
28
28
|
sourceId: row.sourceId,
|
|
29
29
|
title: row.title,
|
|
30
30
|
category: row.category,
|
|
@@ -74,10 +74,10 @@ export function handleBrowserRequest(options, envelope) {
|
|
|
74
74
|
requestId: envelope.requestId,
|
|
75
75
|
result: { type: "discover", commands },
|
|
76
76
|
})));
|
|
77
|
-
const
|
|
77
|
+
const command = envelope.request.command;
|
|
78
78
|
const argumentsValue = "arguments" in envelope.request ? envelope.request.arguments : undefined;
|
|
79
79
|
return Effect.tryPromise({
|
|
80
|
-
try: () => options.whistle.execute(
|
|
80
|
+
try: () => options.whistle.execute(command, argumentsValue === undefined
|
|
81
81
|
? { origin: "agent" }
|
|
82
82
|
: { origin: "agent", arguments: argumentsValue }),
|
|
83
83
|
catch: () => new UiBrowserError("Whistle execution rejected"),
|
package/dist/ui/effect.d.ts
CHANGED
|
@@ -15,7 +15,10 @@ declare const decodeResultEnvelope: (input: BrowserWireObject) => Effect.Effect<
|
|
|
15
15
|
} | {
|
|
16
16
|
outputSchema: Record<string, import("zod").JSONType>;
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
command: {
|
|
19
|
+
namespace: string;
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
19
22
|
sourceId: string;
|
|
20
23
|
title: string;
|
|
21
24
|
category: string;
|
|
@@ -29,7 +32,10 @@ declare const decodeResultEnvelope: (input: BrowserWireObject) => Effect.Effect<
|
|
|
29
32
|
reason: string;
|
|
30
33
|
};
|
|
31
34
|
} | {
|
|
32
|
-
|
|
35
|
+
command: {
|
|
36
|
+
namespace: string;
|
|
37
|
+
id: string;
|
|
38
|
+
};
|
|
33
39
|
sourceId: string;
|
|
34
40
|
title: string;
|
|
35
41
|
category: string;
|
package/dist/ui/wire.d.ts
CHANGED
|
@@ -16,7 +16,10 @@ export declare const BrowserCommandRowSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
16
16
|
}, z.core.$strict>, z.ZodObject<{
|
|
17
17
|
outputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
18
18
|
}, z.core.$strict>]>;
|
|
19
|
-
|
|
19
|
+
command: z.ZodObject<{
|
|
20
|
+
namespace: z.ZodString;
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
}, z.core.$strict>;
|
|
20
23
|
sourceId: z.ZodString;
|
|
21
24
|
title: z.ZodString;
|
|
22
25
|
category: z.ZodString;
|
|
@@ -30,7 +33,10 @@ export declare const BrowserCommandRowSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
30
33
|
reason: z.ZodString;
|
|
31
34
|
}, z.core.$strip>], "status">;
|
|
32
35
|
}, z.core.$strict>, z.ZodObject<{
|
|
33
|
-
|
|
36
|
+
command: z.ZodObject<{
|
|
37
|
+
namespace: z.ZodString;
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
}, z.core.$strict>;
|
|
34
40
|
sourceId: z.ZodString;
|
|
35
41
|
title: z.ZodString;
|
|
36
42
|
category: z.ZodString;
|
|
@@ -45,19 +51,31 @@ export declare const BrowserCommandRowSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
45
51
|
}, z.core.$strip>], "status">;
|
|
46
52
|
}, z.core.$strict>]>;
|
|
47
53
|
export declare const BrowserExecuteInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
48
|
-
|
|
54
|
+
command: z.ZodObject<{
|
|
55
|
+
namespace: z.ZodString;
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
}, z.core.$strict>;
|
|
49
58
|
arguments: z.ZodJSONSchema;
|
|
50
59
|
}, z.core.$strict>, z.ZodObject<{
|
|
51
|
-
|
|
60
|
+
command: z.ZodObject<{
|
|
61
|
+
namespace: z.ZodString;
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
}, z.core.$strict>;
|
|
52
64
|
}, z.core.$strict>]>;
|
|
53
65
|
declare const BrowserRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
54
66
|
type: z.ZodLiteral<"discover">;
|
|
55
67
|
}, z.core.$strict>, z.ZodObject<{
|
|
56
|
-
|
|
68
|
+
command: z.ZodObject<{
|
|
69
|
+
namespace: z.ZodString;
|
|
70
|
+
id: z.ZodString;
|
|
71
|
+
}, z.core.$strict>;
|
|
57
72
|
arguments: z.ZodJSONSchema;
|
|
58
73
|
type: z.ZodLiteral<"execute">;
|
|
59
74
|
}, z.core.$strict>, z.ZodObject<{
|
|
60
|
-
|
|
75
|
+
command: z.ZodObject<{
|
|
76
|
+
namespace: z.ZodString;
|
|
77
|
+
id: z.ZodString;
|
|
78
|
+
}, z.core.$strict>;
|
|
61
79
|
type: z.ZodLiteral<"execute">;
|
|
62
80
|
}, z.core.$strict>]>;
|
|
63
81
|
declare const BrowserRequestEnvelopeSchema: z.ZodObject<{
|
|
@@ -65,11 +83,17 @@ declare const BrowserRequestEnvelopeSchema: z.ZodObject<{
|
|
|
65
83
|
request: z.ZodUnion<readonly [z.ZodObject<{
|
|
66
84
|
type: z.ZodLiteral<"discover">;
|
|
67
85
|
}, z.core.$strict>, z.ZodObject<{
|
|
68
|
-
|
|
86
|
+
command: z.ZodObject<{
|
|
87
|
+
namespace: z.ZodString;
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
}, z.core.$strict>;
|
|
69
90
|
arguments: z.ZodJSONSchema;
|
|
70
91
|
type: z.ZodLiteral<"execute">;
|
|
71
92
|
}, z.core.$strict>, z.ZodObject<{
|
|
72
|
-
|
|
93
|
+
command: z.ZodObject<{
|
|
94
|
+
namespace: z.ZodString;
|
|
95
|
+
id: z.ZodString;
|
|
96
|
+
}, z.core.$strict>;
|
|
73
97
|
type: z.ZodLiteral<"execute">;
|
|
74
98
|
}, z.core.$strict>]>;
|
|
75
99
|
}, z.core.$strip>;
|
|
@@ -78,11 +102,17 @@ export declare const BrowserRequestDeliverySchema: z.ZodObject<{
|
|
|
78
102
|
request: z.ZodUnion<readonly [z.ZodObject<{
|
|
79
103
|
type: z.ZodLiteral<"discover">;
|
|
80
104
|
}, z.core.$strict>, z.ZodObject<{
|
|
81
|
-
|
|
105
|
+
command: z.ZodObject<{
|
|
106
|
+
namespace: z.ZodString;
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
}, z.core.$strict>;
|
|
82
109
|
arguments: z.ZodJSONSchema;
|
|
83
110
|
type: z.ZodLiteral<"execute">;
|
|
84
111
|
}, z.core.$strict>, z.ZodObject<{
|
|
85
|
-
|
|
112
|
+
command: z.ZodObject<{
|
|
113
|
+
namespace: z.ZodString;
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
}, z.core.$strict>;
|
|
86
116
|
type: z.ZodLiteral<"execute">;
|
|
87
117
|
}, z.core.$strict>]>;
|
|
88
118
|
connectionId: z.ZodString;
|
|
@@ -140,7 +170,10 @@ declare const BrowserWireResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
140
170
|
}, z.core.$strict>, z.ZodObject<{
|
|
141
171
|
outputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
142
172
|
}, z.core.$strict>]>;
|
|
143
|
-
|
|
173
|
+
command: z.ZodObject<{
|
|
174
|
+
namespace: z.ZodString;
|
|
175
|
+
id: z.ZodString;
|
|
176
|
+
}, z.core.$strict>;
|
|
144
177
|
sourceId: z.ZodString;
|
|
145
178
|
title: z.ZodString;
|
|
146
179
|
category: z.ZodString;
|
|
@@ -154,7 +187,10 @@ declare const BrowserWireResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
154
187
|
reason: z.ZodString;
|
|
155
188
|
}, z.core.$strip>], "status">;
|
|
156
189
|
}, z.core.$strict>, z.ZodObject<{
|
|
157
|
-
|
|
190
|
+
command: z.ZodObject<{
|
|
191
|
+
namespace: z.ZodString;
|
|
192
|
+
id: z.ZodString;
|
|
193
|
+
}, z.core.$strict>;
|
|
158
194
|
sourceId: z.ZodString;
|
|
159
195
|
title: z.ZodString;
|
|
160
196
|
category: z.ZodString;
|
|
@@ -213,7 +249,10 @@ export declare const BrowserResultEnvelopeSchema: z.ZodObject<{
|
|
|
213
249
|
}, z.core.$strict>, z.ZodObject<{
|
|
214
250
|
outputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
215
251
|
}, z.core.$strict>]>;
|
|
216
|
-
|
|
252
|
+
command: z.ZodObject<{
|
|
253
|
+
namespace: z.ZodString;
|
|
254
|
+
id: z.ZodString;
|
|
255
|
+
}, z.core.$strict>;
|
|
217
256
|
sourceId: z.ZodString;
|
|
218
257
|
title: z.ZodString;
|
|
219
258
|
category: z.ZodString;
|
|
@@ -227,7 +266,10 @@ export declare const BrowserResultEnvelopeSchema: z.ZodObject<{
|
|
|
227
266
|
reason: z.ZodString;
|
|
228
267
|
}, z.core.$strip>], "status">;
|
|
229
268
|
}, z.core.$strict>, z.ZodObject<{
|
|
230
|
-
|
|
269
|
+
command: z.ZodObject<{
|
|
270
|
+
namespace: z.ZodString;
|
|
271
|
+
id: z.ZodString;
|
|
272
|
+
}, z.core.$strict>;
|
|
231
273
|
sourceId: z.ZodString;
|
|
232
274
|
title: z.ZodString;
|
|
233
275
|
category: z.ZodString;
|
package/dist/ui/wire.js
CHANGED
|
@@ -22,8 +22,9 @@ const WhistleAvailabilitySchema = z.discriminatedUnion("status", [
|
|
|
22
22
|
z.object({ status: z.literal("unavailable"), reason: z.string() }),
|
|
23
23
|
]);
|
|
24
24
|
/** The same descriptor is decoded at browser ingress and in model tool results. */
|
|
25
|
+
const commandKey = z.strictObject({ namespace: identifier, id: identifier });
|
|
25
26
|
const browserCommandRowFields = {
|
|
26
|
-
|
|
27
|
+
command: commandKey,
|
|
27
28
|
sourceId: identifier,
|
|
28
29
|
title: z.string(),
|
|
29
30
|
category: z.string(),
|
|
@@ -49,8 +50,12 @@ export const BrowserCommandRowSchema = z.union([
|
|
|
49
50
|
browserCommandRowWithActionSchema,
|
|
50
51
|
browserCommandRowWithoutActionSchema,
|
|
51
52
|
]);
|
|
53
|
+
// Whistle answers an empty or unknown key itself, as `invalid` or `missing`.
|
|
52
54
|
const browserExecuteCommandSchema = z.object({
|
|
53
|
-
|
|
55
|
+
command: z.strictObject({
|
|
56
|
+
namespace: z.string().max(256),
|
|
57
|
+
id: z.string().max(256),
|
|
58
|
+
}),
|
|
54
59
|
});
|
|
55
60
|
const browserExecuteInputWireSchema = browserExecuteCommandSchema
|
|
56
61
|
.extend({ arguments: json })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/knapsack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Agent tool connections projected into Mycelium capability sources",
|
|
6
6
|
"type": "module",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@fungi.computer/cairn": "0.1.0",
|
|
49
49
|
"@fungi.computer/forage": "0.2.0",
|
|
50
|
-
"@fungi.computer/mule": "0.2.
|
|
51
|
-
"@fungi.computer/mycelium": "0.2.
|
|
52
|
-
"@fungi.computer/whistle": "0.
|
|
50
|
+
"@fungi.computer/mule": "0.2.1",
|
|
51
|
+
"@fungi.computer/mycelium": "0.2.3",
|
|
52
|
+
"@fungi.computer/whistle": "0.3.0",
|
|
53
53
|
"@modelcontextprotocol/client": "2.0.0",
|
|
54
54
|
"diff": "8.0.4",
|
|
55
55
|
"effect": "4.0.2",
|