@animalabs/agent-framework 0.22.4 → 0.23.1
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 +105 -3
- package/dist/src/agent.d.ts +36 -10
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +76 -32
- package/dist/src/agent.js.map +1 -1
- package/dist/src/code-execution/index.d.ts +1 -1
- package/dist/src/code-execution/index.d.ts.map +1 -1
- package/dist/src/code-execution/index.js.map +1 -1
- package/dist/src/code-execution/py-runner.d.ts +34 -2
- package/dist/src/code-execution/py-runner.d.ts.map +1 -1
- package/dist/src/code-execution/py-runner.js +72 -16
- package/dist/src/code-execution/py-runner.js.map +1 -1
- package/dist/src/code-execution/runtime-py.d.ts +3 -2
- package/dist/src/code-execution/runtime-py.d.ts.map +1 -1
- package/dist/src/code-execution/runtime-py.js +47 -7
- package/dist/src/code-execution/runtime-py.js.map +1 -1
- package/dist/src/code-execution/tool-definition.d.ts +12 -7
- package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
- package/dist/src/code-execution/tool-definition.js +59 -11
- package/dist/src/code-execution/tool-definition.js.map +1 -1
- package/dist/src/config-checks.d.ts +2 -2
- package/dist/src/config-checks.d.ts.map +1 -1
- package/dist/src/config-checks.js +6 -2
- package/dist/src/config-checks.js.map +1 -1
- package/dist/src/framework.d.ts +744 -120
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +3546 -906
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +13 -6
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/held-writes.d.ts +16 -0
- package/dist/src/held-writes.d.ts.map +1 -0
- package/dist/src/held-writes.js +56 -0
- package/dist/src/held-writes.js.map +1 -0
- package/dist/src/index.d.ts +7 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/capability-grant.d.ts +4 -0
- package/dist/src/mcpl/capability-grant.d.ts.map +1 -1
- package/dist/src/mcpl/capability-grant.js +1 -1
- package/dist/src/mcpl/capability-grant.js.map +1 -1
- package/dist/src/mcpl/channel-registry.d.ts +95 -18
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +578 -150
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/convert-block.d.ts +2 -2
- package/dist/src/mcpl/convert-block.d.ts.map +1 -1
- package/dist/src/mcpl/convert-block.js +6 -7
- package/dist/src/mcpl/convert-block.js.map +1 -1
- package/dist/src/mcpl/index.d.ts +5 -1
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js +3 -1
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/inference-router.d.ts +4 -2
- package/dist/src/mcpl/inference-router.d.ts.map +1 -1
- package/dist/src/mcpl/inference-router.js +6 -7
- package/dist/src/mcpl/inference-router.js.map +1 -1
- package/dist/src/mcpl/log-value.d.ts +7 -0
- package/dist/src/mcpl/log-value.d.ts.map +1 -1
- package/dist/src/mcpl/log-value.js +9 -0
- package/dist/src/mcpl/log-value.js.map +1 -1
- package/dist/src/mcpl/modern-connection.d.ts +227 -0
- package/dist/src/mcpl/modern-connection.d.ts.map +1 -0
- package/dist/src/mcpl/modern-connection.js +1088 -0
- package/dist/src/mcpl/modern-connection.js.map +1 -0
- package/dist/src/mcpl/prefix-rule.d.ts +18 -0
- package/dist/src/mcpl/prefix-rule.d.ts.map +1 -0
- package/dist/src/mcpl/prefix-rule.js +25 -0
- package/dist/src/mcpl/prefix-rule.js.map +1 -0
- package/dist/src/mcpl/protocol-family.d.ts +179 -0
- package/dist/src/mcpl/protocol-family.d.ts.map +1 -0
- package/dist/src/mcpl/protocol-family.js +697 -0
- package/dist/src/mcpl/protocol-family.js.map +1 -0
- package/dist/src/mcpl/push-coalescer.d.ts +38 -19
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +52 -23
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/reference-fetcher.d.ts +66 -15
- package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
- package/dist/src/mcpl/reference-fetcher.js +243 -76
- package/dist/src/mcpl/reference-fetcher.js.map +1 -1
- package/dist/src/mcpl/references.d.ts +63 -18
- package/dist/src/mcpl/references.d.ts.map +1 -1
- package/dist/src/mcpl/references.js +117 -32
- package/dist/src/mcpl/references.js.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +326 -30
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +995 -212
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/server-registry.d.ts +25 -5
- package/dist/src/mcpl/server-registry.d.ts.map +1 -1
- package/dist/src/mcpl/server-registry.js +51 -12
- package/dist/src/mcpl/server-registry.js.map +1 -1
- package/dist/src/mcpl/tool-result-normalize.d.ts +54 -0
- package/dist/src/mcpl/tool-result-normalize.d.ts.map +1 -0
- package/dist/src/mcpl/tool-result-normalize.js +232 -0
- package/dist/src/mcpl/tool-result-normalize.js.map +1 -0
- package/dist/src/mcpl/transport.d.ts +56 -13
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +206 -70
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +66 -20
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/mcpl/visible-content.d.ts +2 -1
- package/dist/src/mcpl/visible-content.d.ts.map +1 -1
- package/dist/src/mcpl/visible-content.js +2 -1
- package/dist/src/mcpl/visible-content.js.map +1 -1
- package/dist/src/module-registry.d.ts +16 -6
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +65 -6
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/api/index.d.ts +1 -1
- package/dist/src/modules/api/index.d.ts.map +1 -1
- package/dist/src/modules/api/index.js +3 -2
- package/dist/src/modules/api/index.js.map +1 -1
- package/dist/src/modules/discord/discord-js-client.d.ts +42 -2
- package/dist/src/modules/discord/discord-js-client.d.ts.map +1 -1
- package/dist/src/modules/discord/discord-js-client.js +268 -65
- package/dist/src/modules/discord/discord-js-client.js.map +1 -1
- package/dist/src/modules/discord/index.d.ts +27 -5
- package/dist/src/modules/discord/index.d.ts.map +1 -1
- package/dist/src/modules/discord/index.js +366 -76
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/discord/refusal.d.ts +14 -0
- package/dist/src/modules/discord/refusal.d.ts.map +1 -0
- package/dist/src/modules/discord/refusal.js +14 -0
- package/dist/src/modules/discord/refusal.js.map +1 -0
- package/dist/src/modules/discord/types.d.ts +17 -7
- package/dist/src/modules/discord/types.d.ts.map +1 -1
- package/dist/src/modules/health/index.d.ts.map +1 -1
- package/dist/src/modules/health/index.js +6 -2
- package/dist/src/modules/health/index.js.map +1 -1
- package/dist/src/modules/index.d.ts +1 -1
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +1 -1
- package/dist/src/modules/index.js.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.d.ts +25 -2
- package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.js +45 -5
- package/dist/src/modules/workspace/disk-agreement.js.map +1 -1
- package/dist/src/modules/workspace/effects.d.ts +2 -1
- package/dist/src/modules/workspace/effects.d.ts.map +1 -1
- package/dist/src/modules/workspace/effects.js +19 -9
- package/dist/src/modules/workspace/effects.js.map +1 -1
- package/dist/src/modules/workspace/index.d.ts +214 -42
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +667 -113
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/observe.d.ts +240 -8
- package/dist/src/modules/workspace/observe.d.ts.map +1 -1
- package/dist/src/modules/workspace/observe.js +554 -24
- package/dist/src/modules/workspace/observe.js.map +1 -1
- package/dist/src/modules/workspace/types.d.ts +10 -1
- package/dist/src/modules/workspace/types.d.ts.map +1 -1
- package/dist/src/modules/workspace/types.js.map +1 -1
- package/dist/src/modules/workspace/watcher.d.ts +42 -0
- package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
- package/dist/src/modules/workspace/watcher.js +130 -25
- package/dist/src/modules/workspace/watcher.js.map +1 -1
- package/dist/src/silent-heartbeat.d.ts +112 -39
- package/dist/src/silent-heartbeat.d.ts.map +1 -1
- package/dist/src/silent-heartbeat.js +100 -29
- package/dist/src/silent-heartbeat.js.map +1 -1
- package/dist/src/tool-args.d.ts +40 -0
- package/dist/src/tool-args.d.ts.map +1 -0
- package/dist/src/tool-args.js +207 -0
- package/dist/src/tool-args.js.map +1 -0
- package/dist/src/tool-presentation.d.ts.map +1 -1
- package/dist/src/tool-presentation.js +9 -2
- package/dist/src/tool-presentation.js.map +1 -1
- package/dist/src/types/agent.d.ts +27 -17
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +8 -0
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +17 -2
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +54 -10
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +2 -2
- package/dist/src/types/trace.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/agent.ts +99 -36
- package/src/code-execution/index.ts +1 -0
- package/src/code-execution/py-runner.ts +104 -17
- package/src/code-execution/runtime-py.ts +47 -7
- package/src/code-execution/tool-definition.ts +65 -11
- package/src/config-checks.ts +4 -2
- package/src/framework.ts +3633 -956
- package/src/gate/event-gate.ts +14 -6
- package/src/held-writes.ts +59 -0
- package/src/index.ts +19 -4
- package/src/mcpl/capability-grant.ts +1 -1
- package/src/mcpl/channel-registry.ts +613 -160
- package/src/mcpl/convert-block.ts +15 -7
- package/src/mcpl/index.ts +14 -1
- package/src/mcpl/inference-router.ts +8 -7
- package/src/mcpl/log-value.ts +10 -0
- package/src/mcpl/modern-connection.ts +1182 -0
- package/src/mcpl/prefix-rule.ts +32 -0
- package/src/mcpl/protocol-family.ts +691 -0
- package/src/mcpl/push-coalescer.ts +67 -29
- package/src/mcpl/reference-fetcher.ts +288 -82
- package/src/mcpl/references.ts +123 -33
- package/src/mcpl/server-connection.ts +1050 -221
- package/src/mcpl/server-registry.ts +50 -12
- package/src/mcpl/tool-result-normalize.ts +294 -0
- package/src/mcpl/transport.ts +204 -62
- package/src/mcpl/types.ts +67 -20
- package/src/mcpl/visible-content.ts +2 -1
- package/src/module-registry.ts +68 -13
- package/src/modules/api/index.ts +3 -2
- package/src/modules/discord/discord-js-client.ts +288 -72
- package/src/modules/discord/index.ts +380 -77
- package/src/modules/discord/refusal.ts +13 -0
- package/src/modules/discord/types.ts +17 -9
- package/src/modules/health/index.ts +6 -2
- package/src/modules/index.ts +1 -1
- package/src/modules/workspace/disk-agreement.ts +46 -5
- package/src/modules/workspace/effects.ts +18 -7
- package/src/modules/workspace/index.ts +722 -124
- package/src/modules/workspace/observe.ts +591 -22
- package/src/modules/workspace/types.ts +10 -1
- package/src/modules/workspace/watcher.ts +126 -25
- package/src/silent-heartbeat.ts +184 -59
- package/src/tool-args.ts +213 -0
- package/src/tool-presentation.ts +9 -2
- package/src/types/agent.ts +27 -17
- package/src/types/events.ts +8 -0
- package/src/types/framework.ts +17 -2
- package/src/types/module.ts +55 -10
- package/src/types/trace.ts +2 -2
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
* not fetch third-party origins at all (deferred with declared reference
|
|
9
9
|
* origins); the connection credential is applied as an Authorization
|
|
10
10
|
* header by this code alone and never surfaces to model, script, or URI.
|
|
11
|
-
* - **scheme allowlist (§7.1, vector 11):**
|
|
12
|
-
*
|
|
11
|
+
* - **scheme allowlist (§7.1, vector 11):** the uri's own scheme is http: or
|
|
12
|
+
* https:, and since origins compare with their schemes, http only from a
|
|
13
|
+
* server dialed in plaintext (ws://), https only from one dialed over TLS
|
|
14
|
+
* (wss://).
|
|
13
15
|
* - **no redirect traversal (§7.2, vector 12):** any 3xx refuses.
|
|
14
16
|
* - **actual-byte ceiling (§7.3 list, vector 10):** streamed with abort the
|
|
15
17
|
* moment real octets exceed the ceiling, regardless of claimed sizeBytes.
|
|
@@ -29,8 +31,10 @@
|
|
|
29
31
|
* that the bytes are wanted). Per-server budgets cap cumulative appetite.
|
|
30
32
|
*/
|
|
31
33
|
import { createHash } from 'node:crypto';
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
+
import { boundedForLog, describeCause } from './errors.js';
|
|
35
|
+
import { EXPIRY_REASON, noAddressReason, referenceExpiry, REFERENCE_LIMITS, sanitizeLabel, UNBOUND_REASON } from './references.js';
|
|
36
|
+
/** Per-fetch hard ceiling on actual bytes. A call can lower it for itself
|
|
37
|
+
* (fetch_reference's max_bytes, which it clamps to this); nothing raises it. */
|
|
34
38
|
export const DEFAULT_FETCH_MAX_BYTES = 256 * 1024 * 1024;
|
|
35
39
|
/** Eager (autofetch) threshold: at most what could have shipped inline. */
|
|
36
40
|
export const DEFAULT_EAGER_FETCH_MAX_BYTES = 256 * 1024;
|
|
@@ -39,12 +43,78 @@ export const DEFAULT_EAGER_FETCH_MAX_BYTES = 256 * 1024;
|
|
|
39
43
|
* kept. */
|
|
40
44
|
export const DEFAULT_MAX_TOTAL_BYTES = 1024 * 1024 * 1024;
|
|
41
45
|
const FETCH_TIMEOUT_MS = 60_000;
|
|
42
|
-
/** What a refusal by the per-server budget adds. The total lives as long as
|
|
43
|
-
* this fetcher, one per framework, so only someone running the host renews
|
|
44
|
-
* it, by starting a new one, or raises the budget (the server's config's
|
|
45
|
-
* autofetch.maxTotalBytes, which each fetch reads afresh). */
|
|
46
|
-
const BUDGET_LASTS = "the budget doesn't renew on its own, so calling again won't change that unless whoever runs this host raises or renews it";
|
|
47
46
|
const EAGER_FETCH_TIMEOUT_MS = 10_000;
|
|
47
|
+
// What calling again can do, as each failure's remedy says it. The fetcher
|
|
48
|
+
// doesn't know where a reference came from (a tool result, a push, a channel
|
|
49
|
+
// message), so none names a tool, and fetch_reference's max_bytes is named
|
|
50
|
+
// only where a larger one can fetch it.
|
|
51
|
+
const NOTHING_TO_DO = "Calling again won't change that.";
|
|
52
|
+
/** The registry keys a record by its uri, so a fresh reference to the same
|
|
53
|
+
* uri arrives as this very id and refreshes its record. */
|
|
54
|
+
const FRESH_REFERENCE = "Once a fresh reference to it arrives, fetching may work; until then, fetching it again won't.";
|
|
55
|
+
const TRY_LATER = 'Trying again later may work.';
|
|
56
|
+
/** A request that failed before an answer: a refused or reset connection
|
|
57
|
+
* can clear, and a cause that repeats on every try (a port fetch refuses, a
|
|
58
|
+
* name that doesn't resolve, a certificate this host doesn't trust) is
|
|
59
|
+
* whoever runs the host's to change, so the remedy names both. */
|
|
60
|
+
const REQUEST_FAILED = "Trying again later may work; if it fails the same way, whoever runs this host can check its connection to the server.";
|
|
61
|
+
const CREDENTIALS = "Calling again won't change that; whoever runs this host can check its credentials for the server.";
|
|
62
|
+
const FRESH_OR_CREDENTIALS = "Once a fresh reference to it arrives, fetching may work; if that's refused too, whoever runs this host can check its credentials for the server.";
|
|
63
|
+
/** The total lives as long as this fetcher, one per framework, so only
|
|
64
|
+
* someone running the host renews it, by starting a new one, or raises the
|
|
65
|
+
* budget (the server's config's autofetch.maxTotalBytes, which each fetch
|
|
66
|
+
* reads afresh). */
|
|
67
|
+
const BUDGET = "The budget doesn't renew on its own, so calling again won't change that unless whoever runs this host raises or renews it.";
|
|
68
|
+
/** The host's own ceiling: fetch_reference clamps max_bytes to it, and no
|
|
69
|
+
* config sets another. */
|
|
70
|
+
const HOST_CEILING = "No max_bytes or setting lifts that limit, so calling again won't change it.";
|
|
71
|
+
/** The resolver reads the host's server configs as they are at each fetch. */
|
|
72
|
+
const SERVER_BACK = "Calling again won't change that unless whoever runs this host adds that server back.";
|
|
73
|
+
const refused = (error, remedy) => ({ refusal: { error, remedy } });
|
|
74
|
+
const fail = (error, remedy) => ({ ok: false, error, remedy });
|
|
75
|
+
/** What calling again can do about a server's HTTP status. A later try can
|
|
76
|
+
* work after a timeout, a conflict or lock the server's state can clear, a
|
|
77
|
+
* request it calls too early, a rate limit or a server's passing trouble,
|
|
78
|
+
* though not after 501 or 505, which say the server doesn't support the
|
|
79
|
+
* request. A 401 is about this host's credentials for the server, which a
|
|
80
|
+
* fresh reference doesn't change, and a 403 can be either those or this
|
|
81
|
+
* reference. The rest of 4xx is about this reference, which a fresh one may
|
|
82
|
+
* not share. */
|
|
83
|
+
function statusRemedy(status) {
|
|
84
|
+
if (status === 501 || status === 505)
|
|
85
|
+
return NOTHING_TO_DO;
|
|
86
|
+
if (status === 408 || status === 409 || status === 423 || status === 425 || status === 429 || status >= 500)
|
|
87
|
+
return TRY_LATER;
|
|
88
|
+
if (status === 401)
|
|
89
|
+
return CREDENTIALS;
|
|
90
|
+
if (status === 403)
|
|
91
|
+
return FRESH_OR_CREDENTIALS;
|
|
92
|
+
return FRESH_REFERENCE;
|
|
93
|
+
}
|
|
94
|
+
/** What a download stopped at a call's own ceiling, below the host's, can do.
|
|
95
|
+
* Its whole size is unknown, only that it's past what arrived, and a fetch
|
|
96
|
+
* again reads it from the start, within the host's ceiling and what the
|
|
97
|
+
* server's budget has left after this one's bytes. The read loop stops a
|
|
98
|
+
* download past the host's ceiling before it asks, so what arrived is within
|
|
99
|
+
* it, and only the budget can be what binds. */
|
|
100
|
+
function largerMaxBytes(received, left, server) {
|
|
101
|
+
const most = Math.min(DEFAULT_FETCH_MAX_BYTES, left);
|
|
102
|
+
if (received <= most)
|
|
103
|
+
return `It's at least ${received} bytes; a larger max_bytes, up to ${most}, may fetch it.`;
|
|
104
|
+
return `It's at least ${received} bytes, more than the ${left} bytes left of this host's fetch budget for ${server}. ${BUDGET}`;
|
|
105
|
+
}
|
|
106
|
+
/** What a thrown fetch says went wrong. fetch's own "fetch failed" says only
|
|
107
|
+
* that, so its cause's words come first. A cause from trying each of a
|
|
108
|
+
* host's addresses (an AggregateError) has no words of its own, so its
|
|
109
|
+
* attempts' stand in. */
|
|
110
|
+
function whyFetchFailed(e) {
|
|
111
|
+
const source = e?.cause ?? e;
|
|
112
|
+
const own = describeCause(source);
|
|
113
|
+
if (own !== '')
|
|
114
|
+
return own;
|
|
115
|
+
const attempts = source?.errors;
|
|
116
|
+
return Array.isArray(attempts) && attempts.length > 0 ? attempts.map(describeCause).join('; ') : describeCause(e);
|
|
117
|
+
}
|
|
48
118
|
/** Magic-byte sniff for the formats this pipeline actually moves. The
|
|
49
119
|
* header is testimony too (vector 13): sniffed type wins for the storage
|
|
50
120
|
* extension and the record's verified type; header, then testimony, are
|
|
@@ -86,6 +156,14 @@ const EXT_BY_MIME = new Map(Object.entries({
|
|
|
86
156
|
'video/mp4': 'mp4', 'application/json': 'json', 'text/plain': 'txt',
|
|
87
157
|
'application/pdf': 'pdf', 'application/zip': 'zip',
|
|
88
158
|
}));
|
|
159
|
+
/** A server's address as it's configured, its scheme and host, for a
|
|
160
|
+
* clause: never its userinfo, path or query. URL's own origin is 'null' for
|
|
161
|
+
* a scheme that isn't special, which normalizedOrigin accepts. The caller
|
|
162
|
+
* has already parsed it. */
|
|
163
|
+
function configuredOrigin(url) {
|
|
164
|
+
const u = new URL(url);
|
|
165
|
+
return `${u.protocol}//${u.host}`;
|
|
166
|
+
}
|
|
89
167
|
/** ws→http / wss→https with default ports elided, for origin comparison. */
|
|
90
168
|
export function normalizedOrigin(url) {
|
|
91
169
|
try {
|
|
@@ -115,55 +193,138 @@ export class ReferenceFetcher {
|
|
|
115
193
|
this.resolveServer = resolveServer;
|
|
116
194
|
this.saveFile = saveFile;
|
|
117
195
|
}
|
|
118
|
-
/** Would the eager (autofetch) default fetch this record? Not one the
|
|
119
|
-
*
|
|
120
|
-
*
|
|
196
|
+
/** Would the eager (autofetch) default fetch this record? Not one the fetch
|
|
197
|
+
* would refuse before dialing, asked as the eager fetch asks it, with the
|
|
198
|
+
* default ceiling, so such a record takes no eager slot; and only one whose
|
|
199
|
+
* claimed size is within the eager limit of the server it dials. For one
|
|
200
|
+
* whose fetch is already under way, which the eager fetch would join as
|
|
201
|
+
* fetch() does, only the server and its eager limit enter: the expiry,
|
|
202
|
+
* the budget and the ceiling were checked when that fetch began. */
|
|
121
203
|
isEagerEligible(record) {
|
|
122
204
|
if (record.fetchedPath)
|
|
123
205
|
return false;
|
|
124
|
-
|
|
206
|
+
const check = this.inFlight.has(record.refId) ? this.serverFor(record) : this.beforeDial(record);
|
|
207
|
+
if ('refusal' in check)
|
|
125
208
|
return false;
|
|
126
|
-
const
|
|
127
|
-
if ('refusal' in server)
|
|
128
|
-
return false;
|
|
129
|
-
const cap = server.binding.autofetch?.maxBytes ?? DEFAULT_EAGER_FETCH_MAX_BYTES;
|
|
209
|
+
const cap = check.binding.autofetch?.maxBytes ?? DEFAULT_EAGER_FETCH_MAX_BYTES;
|
|
130
210
|
return record.testimony.sizeBytes !== undefined && record.testimony.sizeBytes <= cap;
|
|
131
211
|
}
|
|
132
212
|
/** The server to dial for a record (§6.2): the first, in the order they
|
|
133
213
|
* delivered it, whose address is on the uri's origin. When none is, the
|
|
134
|
-
* first server's refusal (unknown to this host,
|
|
135
|
-
* and for a record no server delivered, that it's
|
|
214
|
+
* first server's refusal (unknown to this host, with no address to dial,
|
|
215
|
+
* or the origin check's), and for a record no server delivered, that it's
|
|
216
|
+
* unbound. */
|
|
136
217
|
serverFor(record) {
|
|
137
218
|
let refusal;
|
|
138
219
|
for (const serverId of record.serverIds) {
|
|
139
220
|
const binding = this.resolveServer(serverId);
|
|
140
221
|
if (!binding) {
|
|
141
|
-
refusal ??= `
|
|
222
|
+
refusal ??= refused(`this host no longer has the "${serverId}" server it came from`, SERVER_BACK);
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
if (binding === 'no-address') {
|
|
226
|
+
refusal ??= refused(noAddressReason(serverId), NOTHING_TO_DO);
|
|
142
227
|
continue;
|
|
143
228
|
}
|
|
144
|
-
const offOrigin = this.originCheck(record, binding);
|
|
229
|
+
const offOrigin = this.originCheck(record, binding, serverId);
|
|
145
230
|
if (offOrigin === null)
|
|
146
231
|
return { serverId, binding };
|
|
147
232
|
refusal ??= offOrigin;
|
|
148
233
|
}
|
|
149
|
-
|
|
234
|
+
// A later delivery of the same uri by a server binds this record.
|
|
235
|
+
return refusal ?? refused(`it's ${UNBOUND_REASON}`, FRESH_REFERENCE);
|
|
236
|
+
}
|
|
237
|
+
/** Every check the fetch makes before it dials, in its order: the server
|
|
238
|
+
* (none, unknown, no address, an address of its own or the reference's
|
|
239
|
+
* that doesn't parse, a reference address carrying a user name or
|
|
240
|
+
* password, a scheme other than http: or https:, off the uri's origin),
|
|
241
|
+
* the expiry, a claimed size over the host's own ceiling, the server's
|
|
242
|
+
* spent budget, a claimed size over a call's ceiling. For a record with no
|
|
243
|
+
* saved copy and no fetch under way, the fetch, `refusal()` and the eager
|
|
244
|
+
* check all ask this, so what save_recent_image says is the reason the
|
|
245
|
+
* fetch would refuse with, and no eager slot goes to a fetch that would be
|
|
246
|
+
* refused. */
|
|
247
|
+
beforeDial(record, opts) {
|
|
248
|
+
const server = this.serverFor(record);
|
|
249
|
+
if ('refusal' in server)
|
|
250
|
+
return server;
|
|
251
|
+
const { serverId, binding } = server;
|
|
252
|
+
const t = record.testimony;
|
|
253
|
+
const expiry = referenceExpiry(t);
|
|
254
|
+
if (expiry)
|
|
255
|
+
return refused(`the reference is ${EXPIRY_REASON[expiry]}`, FRESH_REFERENCE);
|
|
256
|
+
const ceiling = opts?.maxBytes ?? DEFAULT_FETCH_MAX_BYTES;
|
|
257
|
+
// A claim past the host's own ceiling is refused first: nothing lifts
|
|
258
|
+
// it, not even a budget whoever runs the host raises.
|
|
259
|
+
if (t.sizeBytes !== undefined && t.sizeBytes > DEFAULT_FETCH_MAX_BYTES) {
|
|
260
|
+
return refused(`it claims ${t.sizeBytes} bytes, over the ${DEFAULT_FETCH_MAX_BYTES} bytes this host fetches at most`, HOST_CEILING);
|
|
261
|
+
}
|
|
262
|
+
// The budget is checked before a call's ceiling, here and while reading:
|
|
263
|
+
// a larger max_bytes lifts that ceiling, and nothing the caller does lifts
|
|
264
|
+
// the budget, so a fetch past both is told about the budget.
|
|
265
|
+
const budget = binding.autofetch?.maxTotalBytes ?? DEFAULT_MAX_TOTAL_BYTES;
|
|
266
|
+
const used = this.totals.get(serverId) ?? 0;
|
|
267
|
+
if (used >= budget) {
|
|
268
|
+
return refused(`this host's fetch budget for the "${serverId}" server is used up (${used} of ${budget} bytes)`, BUDGET);
|
|
269
|
+
}
|
|
270
|
+
// Vector 4: a claim already over the ceiling refuses without dialing. One
|
|
271
|
+
// that's also over what's left of the budget is told about the budget,
|
|
272
|
+
// which no max_bytes lifts. A claim over what's left but within the
|
|
273
|
+
// ceiling still dials, and the budget stops it at its first chunk past.
|
|
274
|
+
if (t.sizeBytes !== undefined && t.sizeBytes > ceiling) {
|
|
275
|
+
if (t.sizeBytes > budget - used) {
|
|
276
|
+
return refused(`it claims ${t.sizeBytes} bytes, more than the ${budget - used} bytes left of this host's fetch budget for the "${serverId}" server`, BUDGET);
|
|
277
|
+
}
|
|
278
|
+
// Within what's left of the budget and the host's ceiling, so a
|
|
279
|
+
// ceiling of the call's own is what a larger max_bytes lifts.
|
|
280
|
+
return refused(`it claims ${t.sizeBytes} bytes, over the ${ceiling} bytes this call allows`, `Pass max_bytes of at least ${t.sizeBytes} to fetch it.`);
|
|
281
|
+
}
|
|
282
|
+
return { serverId, binding, ceiling, budget };
|
|
283
|
+
}
|
|
284
|
+
/** Why a fetch of this record would be refused before dialing, with the
|
|
285
|
+
* default ceiling, which a fetch_reference call naming no max_bytes has.
|
|
286
|
+
* Null where the fetch would serve a saved copy, join a fetch of it
|
|
287
|
+
* already under way, or dial (where it can still fail), the same three
|
|
288
|
+
* steps fetch() takes. */
|
|
289
|
+
refusal(record) {
|
|
290
|
+
if (record.fetchedPath || this.inFlight.has(record.refId))
|
|
291
|
+
return null;
|
|
292
|
+
const check = this.beforeDial(record);
|
|
293
|
+
return 'refusal' in check ? check.refusal : null;
|
|
150
294
|
}
|
|
151
|
-
/** §6.1/§7.1 policy check; returns a refusal
|
|
152
|
-
originCheck(record, binding) {
|
|
295
|
+
/** §6.1/§7.1 policy check; returns a refusal or null. */
|
|
296
|
+
originCheck(record, binding, serverId) {
|
|
153
297
|
const refOrigin = normalizedOrigin(record.testimony.uri);
|
|
154
|
-
const dialedOrigin = normalizedOrigin(binding.url);
|
|
155
298
|
if (!refOrigin)
|
|
156
|
-
return '
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
299
|
+
return refused("its address doesn't parse as a URL", NOTHING_TO_DO);
|
|
300
|
+
// A server's address that doesn't parse leaves nothing to dial. The
|
|
301
|
+
// framework's resolver gives only an address its transport dials, so this
|
|
302
|
+
// guards other resolvers.
|
|
303
|
+
const dialedOrigin = normalizedOrigin(binding.url);
|
|
304
|
+
if (!dialedOrigin) {
|
|
305
|
+
return refused(`the "${serverId}" server's address doesn't parse as a URL, so there's nowhere to fetch it from`, "Calling again won't change that unless whoever runs this host corrects the server's address.");
|
|
306
|
+
}
|
|
307
|
+
const refUrl = new URL(record.testimony.uri);
|
|
308
|
+
// A user name or password in the uri is a credential embedded in it,
|
|
309
|
+
// which RFC-005 §6.1 forbids a server to mint and lets a host refuse
|
|
310
|
+
// (vector 6). This host neither sends nor repeats it: fetch refuses such
|
|
311
|
+
// a url with a message that holds it whole.
|
|
312
|
+
if (refUrl.username !== '' || refUrl.password !== '') {
|
|
313
|
+
return refused("its address carries a user name or password, which this host doesn't send", NOTHING_TO_DO);
|
|
164
314
|
}
|
|
165
|
-
|
|
166
|
-
|
|
315
|
+
// The uri's own scheme, not its origin's: an origin reads ws: as http:
|
|
316
|
+
// and wss: as https:, and fetch refuses a ws: or wss: uri ('unknown
|
|
317
|
+
// scheme') before connecting, which would read as a failed request a
|
|
318
|
+
// later try can mend.
|
|
319
|
+
const scheme = refUrl.protocol;
|
|
320
|
+
if (scheme !== 'https:' && scheme !== 'http:') {
|
|
321
|
+
return refused(`its address uses ${scheme}, and this host fetches only http: and https: addresses`, NOTHING_TO_DO);
|
|
322
|
+
}
|
|
323
|
+
// Origins compare with their schemes, so this also refuses an http:
|
|
324
|
+
// reference from a server dialed over TLS (wss://).
|
|
325
|
+
if (refOrigin !== dialedOrigin) {
|
|
326
|
+
return refused(`it points to ${refOrigin}, not to the "${serverId}" server's own address (${configuredOrigin(binding.url)}), ` +
|
|
327
|
+
'and this host fetches only from the server itself', NOTHING_TO_DO);
|
|
167
328
|
}
|
|
168
329
|
return null;
|
|
169
330
|
}
|
|
@@ -183,49 +344,26 @@ export class ReferenceFetcher {
|
|
|
183
344
|
}
|
|
184
345
|
async doFetch(record, opts) {
|
|
185
346
|
const t = record.testimony;
|
|
186
|
-
const
|
|
187
|
-
if ('refusal' in
|
|
188
|
-
return { ok: false,
|
|
189
|
-
const { serverId, binding } =
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
return { ok: false, error: `reference ${EXPIRY_REASON[expiry]}` };
|
|
193
|
-
const ceiling = opts?.maxBytes ?? DEFAULT_FETCH_MAX_BYTES;
|
|
194
|
-
// The budget is checked before the ceiling, here and while reading: a
|
|
195
|
-
// larger max_bytes lifts the ceiling, and nothing the caller does lifts
|
|
196
|
-
// the budget, so a fetch past both is told about the budget.
|
|
197
|
-
const budget = binding.autofetch?.maxTotalBytes ?? DEFAULT_MAX_TOTAL_BYTES;
|
|
198
|
-
const used = this.totals.get(serverId) ?? 0;
|
|
199
|
-
if (used >= budget) {
|
|
200
|
-
return { ok: false, error: `per-server fetch budget exhausted (${used}/${budget} bytes); ${BUDGET_LASTS}` };
|
|
201
|
-
}
|
|
202
|
-
// Vector 4: a claim already over the ceiling refuses without dialing. One
|
|
203
|
-
// that's also over what's left of the budget is told about the budget,
|
|
204
|
-
// which no max_bytes lifts. A claim over what's left but within the
|
|
205
|
-
// ceiling still dials, and the budget stops it at its first chunk past.
|
|
206
|
-
if (t.sizeBytes !== undefined && t.sizeBytes > ceiling) {
|
|
207
|
-
if (t.sizeBytes > budget - used) {
|
|
208
|
-
return {
|
|
209
|
-
ok: false,
|
|
210
|
-
error: `claimed ${t.sizeBytes} bytes exceeds what's left of the per-server fetch budget (${used}/${budget} bytes); ${BUDGET_LASTS}`,
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
return { ok: false, error: `claimed ${t.sizeBytes} bytes exceeds fetch ceiling ${ceiling}` };
|
|
214
|
-
}
|
|
347
|
+
const check = this.beforeDial(record, opts);
|
|
348
|
+
if ('refusal' in check)
|
|
349
|
+
return { ok: false, ...check.refusal };
|
|
350
|
+
const { serverId, binding, ceiling, budget } = check;
|
|
351
|
+
const server = `the "${serverId}" server`;
|
|
352
|
+
const timeoutMs = opts?.timeoutMs ?? FETCH_TIMEOUT_MS;
|
|
215
353
|
const controller = new AbortController();
|
|
216
|
-
const timer = setTimeout(() => controller.abort(),
|
|
354
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
217
355
|
try {
|
|
218
356
|
const headers = {};
|
|
219
357
|
if (binding.token)
|
|
220
358
|
headers.authorization = `Bearer ${binding.token}`;
|
|
221
359
|
const resp = await fetch(t.uri, { headers, redirect: 'manual', signal: controller.signal });
|
|
222
360
|
if (resp.status >= 300 && resp.status < 400) {
|
|
223
|
-
return {
|
|
361
|
+
return fail(`${server} answered HTTP ${resp.status}, a redirect, and this host doesn't follow redirects`, NOTHING_TO_DO);
|
|
224
362
|
}
|
|
225
363
|
if (!resp.ok)
|
|
226
|
-
return {
|
|
364
|
+
return fail(`${server} answered HTTP ${resp.status}`, statusRemedy(resp.status));
|
|
227
365
|
if (!resp.body)
|
|
228
|
-
return {
|
|
366
|
+
return fail(`${server} answered without any content`, FRESH_REFERENCE);
|
|
229
367
|
const hash = createHash('sha256');
|
|
230
368
|
const chunks = [];
|
|
231
369
|
let received = 0;
|
|
@@ -239,13 +377,24 @@ export class ReferenceFetcher {
|
|
|
239
377
|
// this server read the same total, so none spends what another took.
|
|
240
378
|
const total = (this.totals.get(serverId) ?? 0) + value.byteLength;
|
|
241
379
|
this.totals.set(serverId, total);
|
|
380
|
+
// The limit nothing lifts first, as before dialing: the host's
|
|
381
|
+
// ceiling, then the budget, then a call's own ceiling.
|
|
382
|
+
if (received > DEFAULT_FETCH_MAX_BYTES) {
|
|
383
|
+
controller.abort();
|
|
384
|
+
return fail(`the download had reached ${received} bytes, past the ${DEFAULT_FETCH_MAX_BYTES} bytes this host fetches at most, ` +
|
|
385
|
+
'so it was stopped and nothing was kept', HOST_CEILING);
|
|
386
|
+
}
|
|
242
387
|
if (total > budget) {
|
|
243
388
|
controller.abort();
|
|
244
|
-
|
|
389
|
+
// The server's running total, as the next fetch's refusal gives it:
|
|
390
|
+
// other fetches through the server may have spent part of it.
|
|
391
|
+
return fail(`this host's fetch budget for ${server} ran out during the download (${total} of ${budget} bytes), ` +
|
|
392
|
+
'so it was stopped and nothing was kept', BUDGET);
|
|
245
393
|
}
|
|
246
394
|
if (received > ceiling) {
|
|
247
395
|
controller.abort();
|
|
248
|
-
return {
|
|
396
|
+
return fail(`the download had reached ${received} bytes, past the ${ceiling} bytes this call allows, ` +
|
|
397
|
+
'so it was stopped and nothing was kept', largerMaxBytes(received, budget - total, server));
|
|
249
398
|
}
|
|
250
399
|
const buf = Buffer.from(value);
|
|
251
400
|
hash.update(buf);
|
|
@@ -257,7 +406,8 @@ export class ReferenceFetcher {
|
|
|
257
406
|
const got = 'sha256:' + hash.digest('base64url');
|
|
258
407
|
if (got !== t.digest) {
|
|
259
408
|
// Vector 5: never presented as the described content.
|
|
260
|
-
return
|
|
409
|
+
return fail(`the bytes that arrived don't match the reference's digest (${t.digest.slice(0, 20)}…, against ${got.slice(0, 20)}…), ` +
|
|
410
|
+
"so they weren't kept", "Trying again may work; if it fails the same way, fetching may work once a fresh reference to it arrives.");
|
|
261
411
|
}
|
|
262
412
|
digestVerified = true;
|
|
263
413
|
}
|
|
@@ -271,9 +421,21 @@ export class ReferenceFetcher {
|
|
|
271
421
|
const observedMime = sniffMime(data) ?? headerMime ?? claimedMime ?? 'application/octet-stream';
|
|
272
422
|
const ext = EXT_BY_MIME.get(observedMime) ?? EXT_BY_MIME.get(headerMime ?? '') ?? EXT_BY_MIME.get(claimedMime ?? '') ?? 'bin';
|
|
273
423
|
// §7.3: host-generated storage name; the server's `name` is display-only.
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
424
|
+
// A null from the save hook covers no workspace, no writable mount and
|
|
425
|
+
// a failed write, and the hook logs which. A throw is the save's failure
|
|
426
|
+
// too, not the fetch's, so it's logged here.
|
|
427
|
+
const fileName = `${record.refId}.${ext}`;
|
|
428
|
+
let path;
|
|
429
|
+
try {
|
|
430
|
+
path = await this.saveFile(fileName, data, observedMime);
|
|
431
|
+
}
|
|
432
|
+
catch (e) {
|
|
433
|
+
console.error(`[refs] couldn't store ${fileName}: ${boundedForLog(describeCause(e))}`);
|
|
434
|
+
path = null;
|
|
435
|
+
}
|
|
436
|
+
if (path === null) {
|
|
437
|
+
return fail("it was fetched, but this host couldn't store it in its workspace, so nothing was kept", 'Calling again is likely to fail the same way; whoever runs this host can see why in its log.');
|
|
438
|
+
}
|
|
277
439
|
record.fetchedPath = path;
|
|
278
440
|
record.verifiedBytes = data.length;
|
|
279
441
|
record.verifiedMimeType = observedMime;
|
|
@@ -281,8 +443,13 @@ export class ReferenceFetcher {
|
|
|
281
443
|
return { ok: true, path, bytes: data.length, mimeType: observedMime, digestVerified };
|
|
282
444
|
}
|
|
283
445
|
catch (e) {
|
|
284
|
-
|
|
285
|
-
|
|
446
|
+
// The timer is the only abort that throws: the budget and the ceiling
|
|
447
|
+
// abort the download and return at once.
|
|
448
|
+
if (e?.name === 'AbortError') {
|
|
449
|
+
const seconds = timeoutMs / 1000;
|
|
450
|
+
return fail(`it took longer than ${seconds} second${seconds === 1 ? '' : 's'}`, TRY_LATER);
|
|
451
|
+
}
|
|
452
|
+
return fail(`the request to ${server} failed: ${boundedForLog(whyFetchFailed(e))}`, REQUEST_FAILED);
|
|
286
453
|
}
|
|
287
454
|
finally {
|
|
288
455
|
clearTimeout(timer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference-fetcher.js","sourceRoot":"","sources":["../../../src/mcpl/reference-fetcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtI,8EAA8E;AAC9E,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AACzD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,GAAG,IAAI,CAAC;AACxD;;YAEY;AACZ,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC1D,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC;;;+DAG+D;AAC/D,MAAM,YAAY,GAAG,2HAA2H,CAAC;AACjJ,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAoBtC;;;yDAGyD;AACzD,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE;QAAE,OAAO,IAAI,CAAC;IAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC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,EAAE,CAAC"}
|
|
@@ -52,9 +52,11 @@ export type BlockClassification = {
|
|
|
52
52
|
} | {
|
|
53
53
|
kind: 'reference';
|
|
54
54
|
testimony: ReferenceTestimony;
|
|
55
|
-
}
|
|
55
|
+
}
|
|
56
|
+
/** `shown` is what the model-visible lanes put in the block's place. */
|
|
57
|
+
| {
|
|
56
58
|
kind: 'invalid';
|
|
57
|
-
|
|
59
|
+
shown: string;
|
|
58
60
|
};
|
|
59
61
|
export declare function classifyBlock(block: unknown): BlockClassification;
|
|
60
62
|
/** RFC-005 vector 2: an inline-data block claiming bulk disposition (or
|
|
@@ -62,7 +64,21 @@ export declare function classifyBlock(block: unknown): BlockClassification;
|
|
|
62
64
|
* fails closed by withholding the inline data from context. Every lane that
|
|
63
65
|
* handles inline media MUST consult this before its data branch. */
|
|
64
66
|
export declare function isInlineContradiction(block: unknown): boolean;
|
|
65
|
-
export declare const INLINE_WITHHELD_TEXT = "[
|
|
67
|
+
export declare const INLINE_WITHHELD_TEXT = "[Content not shown: its inline data arrived marked as a reference too, so this host withheld it.]";
|
|
68
|
+
export declare const IMAGE_NO_MEDIA_TYPE_TEXT = "[Image not shown: its data arrived without a media type.]";
|
|
69
|
+
export declare const IMAGE_NO_DATA_TEXT = "[Image not shown: it arrived with no usable data or link.]";
|
|
70
|
+
export declare const AUDIO_NO_MEDIA_TYPE_TEXT = "[Audio not shown: its data arrived without a media type.]";
|
|
71
|
+
/** On the push, channel and context-injection lanes, audio shows only as
|
|
72
|
+
* inline data, so a plain link isn't enough either. (A tool result's audio
|
|
73
|
+
* with a link is a reference, as any block with one is there.) */
|
|
74
|
+
export declare const AUDIO_NO_DATA_TEXT = "[Audio not shown: it arrived with no usable inline data.]";
|
|
75
|
+
export declare const REFERENCE_NO_LINK_TEXT = "[Reference not shown: it arrived without a link.]";
|
|
76
|
+
export declare const REFERENCE_LINK_TOO_LONG_TEXT = "[Reference not shown: its link is longer than this host accepts.]";
|
|
77
|
+
/** A block of a type the host doesn't show, of no type at all, or no block.
|
|
78
|
+
* The type is the sender's word, so it's shown as a label is: bounded, with
|
|
79
|
+
* its controls removed. One that isn't a string is no type, and is never
|
|
80
|
+
* converted to one. */
|
|
81
|
+
export declare function unknownBlockText(block: unknown): string;
|
|
66
82
|
/**
|
|
67
83
|
* Why a reference counts as expired, or null when it doesn't: its expiresAt
|
|
68
84
|
* has passed, doesn't parse, or was rejected as a field (§7.4, §8). A
|
|
@@ -74,16 +90,24 @@ export declare const INLINE_WITHHELD_TEXT = "[inline content withheld: inline da
|
|
|
74
90
|
*/
|
|
75
91
|
export declare function referenceExpiry(t: Pick<ReferenceTestimony, 'expiresAt' | 'rejectedFields'>, nowMs?: number): 'rejected' | 'unparseable' | 'passed' | null;
|
|
76
92
|
export declare function isReferenceExpired(t: Pick<ReferenceTestimony, 'expiresAt' | 'rejectedFields'>, nowMs?: number): boolean;
|
|
77
|
-
/** Each expiry case as the stub
|
|
93
|
+
/** Each expiry case in the agent's words, as the stub, the fetcher's refusal
|
|
94
|
+
* and save_recent_image's refusal all say it. */
|
|
78
95
|
export declare const EXPIRY_REASON: {
|
|
79
|
-
readonly passed: 'expired
|
|
80
|
-
readonly unparseable:
|
|
81
|
-
readonly rejected: "treated as expired
|
|
96
|
+
readonly passed: 'expired';
|
|
97
|
+
readonly unparseable: "treated as expired, since its expiry time can't be read";
|
|
98
|
+
readonly rejected: "treated as expired, since its expiry time isn't in a form this host accepts";
|
|
82
99
|
};
|
|
83
|
-
/** A reference registered with no server,
|
|
84
|
-
* and save_recent_image's all say it: the fetcher dials
|
|
85
|
-
* server that delivered the reference. */
|
|
86
|
-
export declare const UNBOUND_REASON = "
|
|
100
|
+
/** A reference registered with no server, in the agent's words, as the stub,
|
|
101
|
+
* the fetcher's refusal and save_recent_image's all say it: the fetcher dials
|
|
102
|
+
* only through a server that delivered the reference. */
|
|
103
|
+
export declare const UNBOUND_REASON = "not tied to any server, so there's nowhere to fetch it from";
|
|
104
|
+
/** The fetcher's refusal for a server it has no address to dial, one the
|
|
105
|
+
* host doesn't connect to over a network, such as a stdio server, as a
|
|
106
|
+
* clause that completes "couldn't fetch <ref>: " and says so of the server;
|
|
107
|
+
* the fetcher dials only through a server's address. save_recent_image gives
|
|
108
|
+
* it too. A stub can't know it, since only the framework holds its servers'
|
|
109
|
+
* configs. */
|
|
110
|
+
export declare function noAddressReason(serverId: string): string;
|
|
87
111
|
/** Strip control characters (C0, DEL, C1) and every bidi control (marks,
|
|
88
112
|
* embeddings, overrides, isolates, and the Arabic letter mark), trim the
|
|
89
113
|
* whitespace (a BOM included) left at either end, and bound the length.
|
|
@@ -165,13 +189,15 @@ export declare const REFERENCE_STUB_MAX_CHARS: number;
|
|
|
165
189
|
*/
|
|
166
190
|
export declare function buildReferenceStub(t: ReferenceTestimony, provenance?: string, serverId?: string): string;
|
|
167
191
|
/**
|
|
168
|
-
* Why the fetcher would refuse a reference, as far as its record shows
|
|
169
|
-
* server registered for it, which the fetcher checks first,
|
|
170
|
-
* Null for a saved copy, which the fetcher serves before any
|
|
171
|
-
* the record shows neither. The fetcher's other refusals rest
|
|
172
|
-
* doesn't hold: whether any of its servers is
|
|
173
|
-
* the uri's origin,
|
|
174
|
-
*
|
|
192
|
+
* Why the fetcher would refuse a reference, as far as its record alone shows,
|
|
193
|
+
* for its stub: no server registered for it, which the fetcher checks first,
|
|
194
|
+
* or its expiry. Null for a saved copy, which the fetcher serves before any
|
|
195
|
+
* check, and when the record shows neither. The fetcher's other refusals rest
|
|
196
|
+
* on what a record doesn't hold: whether any of its servers is known to the
|
|
197
|
+
* host, has an address and is on the uri's origin, the dialed server's fetch
|
|
198
|
+
* budget spent, or a claimed size over the ceiling a fetch is given. The
|
|
199
|
+
* fetcher gives those in its own words, and save_recent_image, in the
|
|
200
|
+
* framework where it can ask the fetcher, says them too.
|
|
175
201
|
*/
|
|
176
202
|
export declare function unfetchableReason(record: ReferenceRecord, nowMs?: number): string | null;
|
|
177
203
|
/**
|
|
@@ -180,4 +206,23 @@ export declare function unfetchableReason(record: ReferenceRecord, nowMs?: numbe
|
|
|
180
206
|
* its existing (inline/text) handling.
|
|
181
207
|
*/
|
|
182
208
|
export declare function referenceStubOrNull(block: unknown, provenance?: string, serverId?: string): string | null;
|
|
209
|
+
/**
|
|
210
|
+
* RFC-005 treatment for one MCPL wire block, for a script's structured
|
|
211
|
+
* result, which carries blocks rather than text. It makes the decision
|
|
212
|
+
* referenceStubOrNull makes for the model's lanes, since what a script prints
|
|
213
|
+
* comes back to the model. A reference becomes the stub's facts as data,
|
|
214
|
+
* without its URI: the host's reference id, what the server said about it in
|
|
215
|
+
* this block (its labels stripped and bounded as in the stub), and `savedTo`,
|
|
216
|
+
* the workspace path its payload was fetched to, or null when it wasn't
|
|
217
|
+
* (`fetch_reference` takes the id as `ref_id`). An unsaved reference that
|
|
218
|
+
* counts as expired also carries `expired`, the reason the stub gives in
|
|
219
|
+
* place of advising fetch_reference. The reference is registered bound to
|
|
220
|
+
* `serverId`, the server whose tool returned it, as the model's lanes bind
|
|
221
|
+
* a tool result's references, so the fetch its id offers can be made. A
|
|
222
|
+
* block the classifier
|
|
223
|
+
* rejects becomes the notice the model's lanes show, and inline data that
|
|
224
|
+
* also claims a bulk disposition the withheld notice, each as a text block.
|
|
225
|
+
* A text block, or inline data that claims nothing, is returned as sent.
|
|
226
|
+
*/
|
|
227
|
+
export declare function referenceBlockForScript(block: unknown, serverId: string): unknown;
|
|
183
228
|
//# sourceMappingURL=references.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/mcpl/references.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/mcpl/references.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,eAAO,MAAM,gBAAgB;aAAK,GAAG,EAAE,IAAI;aAA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