@frockbot/plugin-web 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +3 -3
- package/src/agent.test.ts +6 -12
- package/src/agent.ts +9 -11
package/README.md
CHANGED
|
@@ -22,8 +22,8 @@ from first principles. No schema parity is claimed.
|
|
|
22
22
|
| Turn types | all four (manifest v4 `admission`) |
|
|
23
23
|
|
|
24
24
|
`web_fetch` needs no Connection: reading a public page needs no credential. The
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
Account-wide Package enablement is the fence — the Contribution mounts nothing
|
|
26
|
+
unless `web-fetch` is in the User's enabled capability set.
|
|
27
27
|
|
|
28
28
|
It is a plain outbound request, so it works while the User's Computer is
|
|
29
29
|
hibernated and never wakes it. A page that needs a real browser is the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frockbot/plugin-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@frockbot/kernel-contracts": "0.1.
|
|
23
|
+
"@frockbot/kernel-contracts": "0.1.4",
|
|
24
24
|
"cordis": "4.0.0-rc.8"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@frockbot/plugin-tools": "0.1.
|
|
27
|
+
"@frockbot/plugin-tools": "0.1.4",
|
|
28
28
|
"@types/bun": "1.4.0",
|
|
29
29
|
"typescript": "^7.0.2"
|
|
30
30
|
},
|
package/src/agent.test.ts
CHANGED
|
@@ -12,10 +12,9 @@ import {
|
|
|
12
12
|
type WebFetchResultV1,
|
|
13
13
|
} from "./agent.ts";
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const ENABLED_CAPABILITY = {
|
|
16
16
|
packageId: "web",
|
|
17
17
|
capabilityId: "web-fetch",
|
|
18
|
-
state: "enabled",
|
|
19
18
|
} as const;
|
|
20
19
|
|
|
21
20
|
function toolContext(): ToolExecutionContext {
|
|
@@ -226,21 +225,16 @@ describe("web_fetch", () => {
|
|
|
226
225
|
});
|
|
227
226
|
});
|
|
228
227
|
|
|
229
|
-
describe("the web-fetch Capability
|
|
230
|
-
test("mounts
|
|
228
|
+
describe("the web-fetch Capability enablement", () => {
|
|
229
|
+
test("mounts only for the enabled Capability", () => {
|
|
231
230
|
expect(
|
|
232
231
|
createConfiguredWebFetchRuntimeContribution({
|
|
233
|
-
|
|
232
|
+
capability: { ...ENABLED_CAPABILITY, capabilityId: "something-else" },
|
|
234
233
|
}),
|
|
235
234
|
).toBeUndefined();
|
|
236
235
|
expect(
|
|
237
236
|
createConfiguredWebFetchRuntimeContribution({
|
|
238
|
-
|
|
239
|
-
}),
|
|
240
|
-
).toBeUndefined();
|
|
241
|
-
expect(
|
|
242
|
-
createConfiguredWebFetchRuntimeContribution({
|
|
243
|
-
assignment: ENABLED_ASSIGNMENT,
|
|
237
|
+
capability: ENABLED_CAPABILITY,
|
|
244
238
|
}),
|
|
245
239
|
).toBeDefined();
|
|
246
240
|
});
|
|
@@ -249,7 +243,7 @@ describe("the web-fetch Capability Assignment", () => {
|
|
|
249
243
|
const root = new Context();
|
|
250
244
|
await root.plugin(ToolRegistry);
|
|
251
245
|
const plugin = createConfiguredWebFetchRuntimeContribution({
|
|
252
|
-
|
|
246
|
+
capability: ENABLED_CAPABILITY,
|
|
253
247
|
});
|
|
254
248
|
expect(plugin).toBeDefined();
|
|
255
249
|
await root.plugin(plugin!);
|
package/src/agent.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// The Web Package's runtime Contribution: `web_fetch`.
|
|
2
2
|
//
|
|
3
3
|
// AUTHORITY. `web-fetch` is a Capability with no Connection: fetching a public
|
|
4
|
-
// page needs no credential, so a Bot holds the tool
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
4
|
+
// page needs no credential, so a Bot holds the tool while its User keeps the
|
|
5
|
+
// Package enabled. The Capability is still the fence —
|
|
6
|
+
// {@link createConfiguredWebFetchRuntimeContribution} mounts nothing without
|
|
7
|
+
// the enabled Capability naming it.
|
|
8
8
|
//
|
|
9
9
|
// TRUST BOUNDARY. The Bot's Durable Object is the only thing between a model's
|
|
10
10
|
// URL and the platform's network, so every hop is classified by `./ssrf.ts`
|
|
@@ -478,23 +478,21 @@ export function createWebRuntimePlugin(
|
|
|
478
478
|
}
|
|
479
479
|
|
|
480
480
|
/**
|
|
481
|
-
* The
|
|
482
|
-
*
|
|
481
|
+
* The enablement fence. A Bot holds `web_fetch` only through this Package's
|
|
482
|
+
* enabled `web-fetch` Capability; without one this
|
|
483
483
|
* returns `undefined` and nothing is mounted.
|
|
484
484
|
*/
|
|
485
485
|
export function createConfiguredWebFetchRuntimeContribution(config: {
|
|
486
|
-
|
|
486
|
+
capability: {
|
|
487
487
|
packageId: string;
|
|
488
488
|
capabilityId: string;
|
|
489
489
|
connectionId?: string;
|
|
490
|
-
state: string;
|
|
491
490
|
};
|
|
492
491
|
fetch?: WebFetchFn;
|
|
493
492
|
}): Plugin.Function | undefined {
|
|
494
493
|
if (
|
|
495
|
-
config.
|
|
496
|
-
config.
|
|
497
|
-
config.assignment.state !== "enabled"
|
|
494
|
+
config.capability.packageId !== "web" ||
|
|
495
|
+
config.capability.capabilityId !== "web-fetch"
|
|
498
496
|
) {
|
|
499
497
|
return undefined;
|
|
500
498
|
}
|