agentfootprint 14.2.1 → 14.3.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/AGENTS.md +2 -2
- package/CAPABILITIES.md +2 -0
- package/ai-instructions/claude-code/SKILL.md +2 -2
- package/dist/adapters/observability/auditShapes.js +8 -9
- package/dist/adapters/observability/auditShapes.js.map +1 -1
- package/dist/core/Agent.js +91 -158
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +29 -69
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/aroundTurn/errors.js +38 -0
- package/dist/core/agent/aroundTurn/errors.js.map +1 -0
- package/dist/core/agent/aroundTurn/funnel.js +164 -0
- package/dist/core/agent/aroundTurn/funnel.js.map +1 -0
- package/dist/core/agent/aroundTurn/guards.js +34 -0
- package/dist/core/agent/aroundTurn/guards.js.map +1 -0
- package/dist/core/agent/aroundTurn/index.js +13 -0
- package/dist/core/agent/aroundTurn/index.js.map +1 -0
- package/dist/core/agent/aroundTurn/readOnlyCopy.js +52 -0
- package/dist/core/agent/aroundTurn/readOnlyCopy.js.map +1 -0
- package/dist/core/agent/aroundTurn/types.js +6 -0
- package/dist/core/agent/aroundTurn/types.js.map +1 -0
- package/dist/core/agent/assessment/answerLayerOptions.js +72 -0
- package/dist/core/agent/assessment/answerLayerOptions.js.map +1 -0
- package/dist/core/agent/hostTurn.js +1 -0
- package/dist/core/agent/hostTurn.js.map +1 -1
- package/dist/core/agent/run/eventStageIds.js +6 -1
- package/dist/core/agent/run/eventStageIds.js.map +1 -1
- package/dist/core/agent/run/outputStrategySupport.js +62 -0
- package/dist/core/agent/run/outputStrategySupport.js.map +1 -0
- package/dist/core/agent/run/terminalRunError.js +44 -0
- package/dist/core/agent/run/terminalRunError.js.map +1 -0
- package/dist/core/runnerLive.js.map +1 -1
- package/dist/doors/time.js +11 -3
- package/dist/doors/time.js.map +1 -1
- package/dist/esm/adapters/observability/auditShapes.js +8 -9
- package/dist/esm/adapters/observability/auditShapes.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +13 -27
- package/dist/esm/core/Agent.js +86 -153
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +22 -0
- package/dist/esm/core/agent/AgentBuilder.js +27 -67
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/aroundTurn/errors.d.ts +15 -0
- package/dist/esm/core/agent/aroundTurn/errors.js +34 -0
- package/dist/esm/core/agent/aroundTurn/errors.js.map +1 -0
- package/dist/esm/core/agent/aroundTurn/funnel.d.ts +18 -0
- package/dist/esm/core/agent/aroundTurn/funnel.js +159 -0
- package/dist/esm/core/agent/aroundTurn/funnel.js.map +1 -0
- package/dist/esm/core/agent/aroundTurn/guards.d.ts +16 -0
- package/dist/esm/core/agent/aroundTurn/guards.js +28 -0
- package/dist/esm/core/agent/aroundTurn/guards.js.map +1 -0
- package/dist/esm/core/agent/aroundTurn/index.d.ts +4 -0
- package/dist/esm/core/agent/aroundTurn/index.js +4 -0
- package/dist/esm/core/agent/aroundTurn/index.js.map +1 -0
- package/dist/esm/core/agent/aroundTurn/readOnlyCopy.d.ts +12 -0
- package/dist/esm/core/agent/aroundTurn/readOnlyCopy.js +48 -0
- package/dist/esm/core/agent/aroundTurn/readOnlyCopy.js.map +1 -0
- package/dist/esm/core/agent/aroundTurn/types.d.ts +57 -0
- package/dist/esm/core/agent/aroundTurn/types.js +5 -0
- package/dist/esm/core/agent/aroundTurn/types.js.map +1 -0
- package/dist/esm/core/agent/assessment/answerLayerOptions.d.ts +21 -0
- package/dist/esm/core/agent/assessment/answerLayerOptions.js +67 -0
- package/dist/esm/core/agent/assessment/answerLayerOptions.js.map +1 -0
- package/dist/esm/core/agent/hostTurn.d.ts +2 -0
- package/dist/esm/core/agent/hostTurn.js +1 -0
- package/dist/esm/core/agent/hostTurn.js.map +1 -1
- package/dist/esm/core/agent/run/eventStageIds.d.ts +5 -0
- package/dist/esm/core/agent/run/eventStageIds.js +5 -0
- package/dist/esm/core/agent/run/eventStageIds.js.map +1 -1
- package/dist/esm/core/agent/run/outputStrategySupport.d.ts +26 -0
- package/dist/esm/core/agent/run/outputStrategySupport.js +58 -0
- package/dist/esm/core/agent/run/outputStrategySupport.js.map +1 -0
- package/dist/esm/core/agent/run/terminalRunError.d.ts +22 -0
- package/dist/esm/core/agent/run/terminalRunError.js +40 -0
- package/dist/esm/core/agent/run/terminalRunError.js.map +1 -0
- package/dist/esm/core/runnerLive.d.ts +3 -0
- package/dist/esm/core/runnerLive.js.map +1 -1
- package/dist/esm/doors/time.d.ts +9 -2
- package/dist/esm/doors/time.js +9 -2
- package/dist/esm/doors/time.js.map +1 -1
- package/dist/esm/events/dispatcher.d.ts +4 -4
- package/dist/esm/events/dispatcher.js +4 -4
- package/dist/esm/events/payloads/agent.d.ts +8 -0
- package/dist/esm/events/payloads.d.ts +1 -1
- package/dist/esm/events/registry.d.ts +4 -5
- package/dist/esm/events/registry.js +4 -7
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/esm/hosting/errors.d.ts +18 -15
- package/dist/esm/hosting/errors.js +23 -22
- package/dist/esm/hosting/errors.js.map +1 -1
- package/dist/esm/hosting/index.d.ts +2 -1
- package/dist/esm/hosting/index.js +2 -1
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting/requireCapability.d.ts +8 -0
- package/dist/esm/hosting/requireCapability.js +16 -0
- package/dist/esm/hosting/requireCapability.js.map +1 -0
- package/dist/esm/hosting/standingAgent.js +33 -34
- package/dist/esm/hosting/standingAgent.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +6 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/locales/timeAsk.js +1 -1
- package/dist/esm/locales/timeAsk.js.map +1 -1
- package/dist/esm/redaction/knownStrings.d.ts +3 -5
- package/dist/esm/redaction/knownStrings.js +2 -0
- package/dist/esm/redaction/knownStrings.js.map +1 -1
- package/dist/esm/time/replyForm/bindings.d.ts +20 -1
- package/dist/esm/time/replyForm/bindings.js +31 -12
- package/dist/esm/time/replyForm/bindings.js.map +1 -1
- package/dist/events/dispatcher.js +4 -4
- package/dist/events/registry.js +4 -7
- package/dist/events/registry.js.map +1 -1
- package/dist/hosting/errors.js +25 -24
- package/dist/hosting/errors.js.map +1 -1
- package/dist/hosting/index.js +6 -4
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/requireCapability.js +20 -0
- package/dist/hosting/requireCapability.js.map +1 -0
- package/dist/hosting/standingAgent.js +32 -33
- package/dist/hosting/standingAgent.js.map +1 -1
- package/dist/index.js +122 -131
- package/dist/index.js.map +1 -1
- package/dist/locales/timeAsk.js +1 -1
- package/dist/locales/timeAsk.js.map +1 -1
- package/dist/redaction/knownStrings.js +2 -0
- package/dist/redaction/knownStrings.js.map +1 -1
- package/dist/time/replyForm/bindings.js +31 -12
- package/dist/time/replyForm/bindings.js.map +1 -1
- package/dist/types/core/Agent.d.ts +13 -27
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +22 -0
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/aroundTurn/errors.d.ts +16 -0
- package/dist/types/core/agent/aroundTurn/errors.d.ts.map +1 -0
- package/dist/types/core/agent/aroundTurn/funnel.d.ts +19 -0
- package/dist/types/core/agent/aroundTurn/funnel.d.ts.map +1 -0
- package/dist/types/core/agent/aroundTurn/guards.d.ts +17 -0
- package/dist/types/core/agent/aroundTurn/guards.d.ts.map +1 -0
- package/dist/types/core/agent/aroundTurn/index.d.ts +5 -0
- package/dist/types/core/agent/aroundTurn/index.d.ts.map +1 -0
- package/dist/types/core/agent/aroundTurn/readOnlyCopy.d.ts +13 -0
- package/dist/types/core/agent/aroundTurn/readOnlyCopy.d.ts.map +1 -0
- package/dist/types/core/agent/aroundTurn/types.d.ts +58 -0
- package/dist/types/core/agent/aroundTurn/types.d.ts.map +1 -0
- package/dist/types/core/agent/assessment/answerLayerOptions.d.ts +22 -0
- package/dist/types/core/agent/assessment/answerLayerOptions.d.ts.map +1 -0
- package/dist/types/core/agent/hostTurn.d.ts +2 -0
- package/dist/types/core/agent/hostTurn.d.ts.map +1 -1
- package/dist/types/core/agent/run/eventStageIds.d.ts +5 -0
- package/dist/types/core/agent/run/eventStageIds.d.ts.map +1 -1
- package/dist/types/core/agent/run/outputStrategySupport.d.ts +27 -0
- package/dist/types/core/agent/run/outputStrategySupport.d.ts.map +1 -0
- package/dist/types/core/agent/run/terminalRunError.d.ts +23 -0
- package/dist/types/core/agent/run/terminalRunError.d.ts.map +1 -0
- package/dist/types/core/runnerLive.d.ts +3 -0
- package/dist/types/core/runnerLive.d.ts.map +1 -1
- package/dist/types/doors/time.d.ts +9 -2
- package/dist/types/doors/time.d.ts.map +1 -1
- package/dist/types/events/dispatcher.d.ts +4 -4
- package/dist/types/events/payloads/agent.d.ts +8 -0
- package/dist/types/events/payloads/agent.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +1 -1
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +4 -5
- package/dist/types/events/registry.d.ts.map +1 -1
- package/dist/types/hosting/errors.d.ts +18 -15
- package/dist/types/hosting/errors.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +2 -1
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting/requireCapability.d.ts +9 -0
- package/dist/types/hosting/requireCapability.d.ts.map +1 -0
- package/dist/types/hosting/standingAgent.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/redaction/knownStrings.d.ts +3 -5
- package/dist/types/redaction/knownStrings.d.ts.map +1 -1
- package/dist/types/time/replyForm/bindings.d.ts +20 -1
- package/dist/types/time/replyForm/bindings.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The one funnel every top-level turn of an Agent passes through.
|
|
4
|
+
*
|
|
5
|
+
* With no wrapper this hands straight to the leg, adding no await. With one,
|
|
6
|
+
* the wrapper may wrap the turn and ask for the named changes; it cannot
|
|
7
|
+
* change how the turn ended. See ./README.md for the table of what happens
|
|
8
|
+
* when a wrapper misbehaves.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.runInputWith = exports.throughAroundTurn = void 0;
|
|
12
|
+
const errors_js_1 = require("./errors.js");
|
|
13
|
+
const readOnlyCopy_js_1 = require("./readOnlyCopy.js");
|
|
14
|
+
const IDENTIFIER = /^[A-Za-z_$][\w$]{0,127}$/;
|
|
15
|
+
/** Nothing noted yet. Not `undefined`: a wrapper may throw `undefined`. */
|
|
16
|
+
const NOTHING_NOTED = Symbol('nothing noted');
|
|
17
|
+
/** The class of a thrown value, or a fixed word. Never its message, and never throws. */
|
|
18
|
+
function errorClassOf(thrown) {
|
|
19
|
+
try {
|
|
20
|
+
if (!(thrown instanceof Error))
|
|
21
|
+
return 'non-error';
|
|
22
|
+
const name = thrown.constructor?.name;
|
|
23
|
+
return typeof name === 'string' && IDENTIFIER.test(name) ? name : 'Error';
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return 'Error';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function changeProblem(kind, changes) {
|
|
30
|
+
if (changes === undefined)
|
|
31
|
+
return undefined;
|
|
32
|
+
if (typeof changes !== 'object' || changes === null || Array.isArray(changes))
|
|
33
|
+
return 'unknown-change';
|
|
34
|
+
const named = Object.keys(changes);
|
|
35
|
+
if (named.length === 0)
|
|
36
|
+
return undefined;
|
|
37
|
+
if (kind === 'resume')
|
|
38
|
+
return 'change-on-resume';
|
|
39
|
+
return named.every((key) => key === 'time') ? undefined : 'unknown-change';
|
|
40
|
+
}
|
|
41
|
+
function readOnlyTurn(turn) {
|
|
42
|
+
return turn.kind === 'run'
|
|
43
|
+
? Object.freeze({
|
|
44
|
+
...turn,
|
|
45
|
+
input: (0, readOnlyCopy_js_1.readOnlyCopy)(turn.input),
|
|
46
|
+
options: (0, readOnlyCopy_js_1.readOnlyCopy)(turn.options),
|
|
47
|
+
})
|
|
48
|
+
: Object.freeze({
|
|
49
|
+
...turn,
|
|
50
|
+
checkpoint: (0, readOnlyCopy_js_1.readOnlyCopy)(turn.checkpoint),
|
|
51
|
+
answer: (0, readOnlyCopy_js_1.readOnlyCopy)(turn.answer),
|
|
52
|
+
options: (0, readOnlyCopy_js_1.readOnlyCopy)(turn.options),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async function wrapped(port, turn, leg, report) {
|
|
56
|
+
const { name } = port;
|
|
57
|
+
let running;
|
|
58
|
+
// Taken before any code the wrapper can reach runs: a `time` getter may call `proceed`.
|
|
59
|
+
let claimed = false;
|
|
60
|
+
let settled;
|
|
61
|
+
let wrapperOpen = true;
|
|
62
|
+
let lastNoted = NOTHING_NOTED;
|
|
63
|
+
const note = (error) => {
|
|
64
|
+
if (error === lastNoted)
|
|
65
|
+
return;
|
|
66
|
+
lastNoted = error;
|
|
67
|
+
try {
|
|
68
|
+
report({ wrapper: name, errorClass: errorClassOf(error) });
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// A failure to report can never change the outcome.
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
// Handled here so a wrapper that never awaits cannot crash the process.
|
|
75
|
+
const handled = (promise) => {
|
|
76
|
+
promise.catch(() => undefined);
|
|
77
|
+
return promise;
|
|
78
|
+
};
|
|
79
|
+
const refused = (reason) => {
|
|
80
|
+
const error = new errors_js_1.AroundTurnError(reason, name);
|
|
81
|
+
if (claimed)
|
|
82
|
+
note(error);
|
|
83
|
+
return handled(Promise.reject(error));
|
|
84
|
+
};
|
|
85
|
+
const proceed = (changes) => {
|
|
86
|
+
if (!wrapperOpen)
|
|
87
|
+
return refused('late-proceed');
|
|
88
|
+
if (claimed)
|
|
89
|
+
return refused('second-proceed');
|
|
90
|
+
claimed = true;
|
|
91
|
+
let problem;
|
|
92
|
+
try {
|
|
93
|
+
problem = changeProblem(turn.kind, changes);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
// A Proxy's trap threw. No leg started, so the wrapper may still call again.
|
|
97
|
+
claimed = false;
|
|
98
|
+
return handled(Promise.reject(error));
|
|
99
|
+
}
|
|
100
|
+
if (problem !== undefined) {
|
|
101
|
+
claimed = false;
|
|
102
|
+
return refused(problem);
|
|
103
|
+
}
|
|
104
|
+
running = (async () => leg(changes))().then((value) => {
|
|
105
|
+
settled = { value };
|
|
106
|
+
}, (error) => {
|
|
107
|
+
settled = { error };
|
|
108
|
+
throw error;
|
|
109
|
+
});
|
|
110
|
+
return handled(running);
|
|
111
|
+
};
|
|
112
|
+
let thrown;
|
|
113
|
+
try {
|
|
114
|
+
await port.around(readOnlyTurn(turn), proceed);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
thrown = { error };
|
|
118
|
+
}
|
|
119
|
+
wrapperOpen = false;
|
|
120
|
+
const run = running;
|
|
121
|
+
if (run === undefined) {
|
|
122
|
+
throw thrown !== undefined ? thrown.error : new errors_js_1.AroundTurnError('not-proceeded', name);
|
|
123
|
+
}
|
|
124
|
+
// The turn holds its lease until the run itself is over, awaited or not.
|
|
125
|
+
await run.catch(() => undefined);
|
|
126
|
+
const outcome = settled;
|
|
127
|
+
const runError = 'error' in outcome ? outcome : undefined;
|
|
128
|
+
if (thrown !== undefined && (runError === undefined || thrown.error !== runError.error))
|
|
129
|
+
note(thrown.error);
|
|
130
|
+
if (runError !== undefined)
|
|
131
|
+
throw runError.error;
|
|
132
|
+
return outcome.value;
|
|
133
|
+
}
|
|
134
|
+
/** The funnel. `undefined` is an agent with no wrapper: the leg, with nothing added. */
|
|
135
|
+
function throughAroundTurn(port, turn, leg, report) {
|
|
136
|
+
return port === undefined ? leg(undefined) : wrapped(port, turn, leg, report);
|
|
137
|
+
}
|
|
138
|
+
exports.throughAroundTurn = throughAroundTurn;
|
|
139
|
+
function isFieldBag(value) {
|
|
140
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The input a run starts from once a wrapper's changes are applied. No `time`
|
|
144
|
+
* is the input itself. An input the run would refuse is left for it to refuse;
|
|
145
|
+
* a malformed `time` reaches the run's own reader, which refuses it by name.
|
|
146
|
+
*/
|
|
147
|
+
function runInputWith(input, options, changes) {
|
|
148
|
+
const time = changes?.time;
|
|
149
|
+
if (time === undefined)
|
|
150
|
+
return input;
|
|
151
|
+
const bag = typeof input === 'string' ? { message: input } : input;
|
|
152
|
+
if (!isFieldBag(bag))
|
|
153
|
+
return input;
|
|
154
|
+
const stated = bag.time ?? options?.time;
|
|
155
|
+
const merged = !isFieldBag(time)
|
|
156
|
+
? time
|
|
157
|
+
: {
|
|
158
|
+
...(isFieldBag(stated) && stated),
|
|
159
|
+
...Object.fromEntries(Object.entries(time).filter(([, field]) => field !== undefined)),
|
|
160
|
+
};
|
|
161
|
+
return { ...bag, time: merged };
|
|
162
|
+
}
|
|
163
|
+
exports.runInputWith = runInputWith;
|
|
164
|
+
//# sourceMappingURL=funnel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"funnel.js","sourceRoot":"","sources":["../../../../src/core/agent/aroundTurn/funnel.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAGH,2CAAsE;AACtE,uDAAiD;AAGjD,MAAM,UAAU,GAAG,0BAA0B,CAAC;AAC9C,2EAA2E;AAC3E,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAE9C,yFAAyF;AACzF,SAAS,YAAY,CAAC,MAAe;IACnC,IAAI,CAAC;QACH,IAAI,CAAC,CAAC,MAAM,YAAY,KAAK,CAAC;YAAE,OAAO,WAAW,CAA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I,GAAY,OAAO,EAAE,IAAI,CAAC;IACpC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACrC,MAAM,GAAG,GAAY,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAC5E,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,MAAM,MAAM,GAAY,GAAG,CAAC,IAAI,IAAI,OAAO,EAAE,IAAI,CAAC;IAClD,MAAM,MAAM,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;QAC9B,CAAC,CAAC,IAAI;QACN,CAAC,CAAC;YACE,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC;YACjC,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;SACvF,CAAC;IACN,OAAO,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAsB,CAAC;AACtD,CAAC;AAjBD,oCAiBC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The build-time and host-time rules around `.aroundTurn()`, as plain functions.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.replacedTurnMethods = exports.refuseMountedWrapper = exports.admitAroundTurn = void 0;
|
|
7
|
+
const errors_js_1 = require("./errors.js");
|
|
8
|
+
/** The builder's rule: one wrapper per agent, of the right shape. */
|
|
9
|
+
function admitAroundTurn(wrapper, declared) {
|
|
10
|
+
if (declared !== undefined)
|
|
11
|
+
throw new errors_js_1.AroundTurnError('second-wrapper', declared.name);
|
|
12
|
+
const { name, around } = (wrapper ?? {});
|
|
13
|
+
if (typeof name !== 'string' || name.length === 0 || typeof around !== 'function')
|
|
14
|
+
throw new errors_js_1.AroundTurnError('invalid-wrapper', typeof name === 'string' ? name : '');
|
|
15
|
+
return wrapper;
|
|
16
|
+
}
|
|
17
|
+
exports.admitAroundTurn = admitAroundTurn;
|
|
18
|
+
/** A mount has no turn to wrap, so a wrapper could not run there. Refused, never skipped. */
|
|
19
|
+
function refuseMountedWrapper(port) {
|
|
20
|
+
if (port !== undefined)
|
|
21
|
+
throw new errors_js_1.AroundTurnError('mounted', port.name);
|
|
22
|
+
}
|
|
23
|
+
exports.refuseMountedWrapper = refuseMountedWrapper;
|
|
24
|
+
const TURN_METHODS = ['run', 'resume'];
|
|
25
|
+
/**
|
|
26
|
+
* Which of `runner`'s turn doors are not the class's own — an own property or a
|
|
27
|
+
* subclass override alike. `own` is captured when the class loads, so a later
|
|
28
|
+
* patch of the prototype counts too.
|
|
29
|
+
*/
|
|
30
|
+
function replacedTurnMethods(runner, own) {
|
|
31
|
+
return TURN_METHODS.filter((method) => runner[method] !== own[method]);
|
|
32
|
+
}
|
|
33
|
+
exports.replacedTurnMethods = replacedTurnMethods;
|
|
34
|
+
//# sourceMappingURL=guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../../../src/core/agent/aroundTurn/guards.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,2CAA8C;AAG9C,qEAAqE;AACrE,SAAgB,eAAe,CAAC,OAAmB,EAAE,QAAgC;IACnF,IAAI,QAAQ,KAAK,SAAS;QAAE,MAAM,IAAI,2BAAe,CAAC,gBAAgB,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvF,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,CAAwB,CAAC;IAChE,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,MAAM,KAAK,UAAU;QAC/E,MAAM,IAAI,2BAAe,CAAC,iBAAiB,EAAE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACrF,OAAO,OAAO,CAAC;AACjB,CAAC;AAND,0CAMC;AAED,6FAA6F;AAC7F,SAAgB,oBAAoB,CAAC,IAA4B;IAC/D,IAAI,IAAI,KAAK,SAAS;QAAE,MAAM,IAAI,2BAAe,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1E,CAAC;AAFD,oDAEC;AAKD,MAAM,YAAY,GAA0B,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAE9D;;;;GAIG;AACH,SAAgB,mBAAmB,CACjC,MAAc,EACd,GAA0C;IAE1C,OAAO,YAAY,CAAC,MAAM,CACxB,CAAC,MAAM,EAAE,EAAE,CAAE,MAAkC,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,CACxE,CAAC;AACJ,CAAC;AAPD,kDAOC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replacedTurnMethods = exports.refuseMountedWrapper = exports.admitAroundTurn = exports.throughAroundTurn = exports.runInputWith = exports.AroundTurnError = void 0;
|
|
4
|
+
var errors_js_1 = require("./errors.js");
|
|
5
|
+
Object.defineProperty(exports, "AroundTurnError", { enumerable: true, get: function () { return errors_js_1.AroundTurnError; } });
|
|
6
|
+
var funnel_js_1 = require("./funnel.js");
|
|
7
|
+
Object.defineProperty(exports, "runInputWith", { enumerable: true, get: function () { return funnel_js_1.runInputWith; } });
|
|
8
|
+
Object.defineProperty(exports, "throughAroundTurn", { enumerable: true, get: function () { return funnel_js_1.throughAroundTurn; } });
|
|
9
|
+
var guards_js_1 = require("./guards.js");
|
|
10
|
+
Object.defineProperty(exports, "admitAroundTurn", { enumerable: true, get: function () { return guards_js_1.admitAroundTurn; } });
|
|
11
|
+
Object.defineProperty(exports, "refuseMountedWrapper", { enumerable: true, get: function () { return guards_js_1.refuseMountedWrapper; } });
|
|
12
|
+
Object.defineProperty(exports, "replacedTurnMethods", { enumerable: true, get: function () { return guards_js_1.replacedTurnMethods; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/agent/aroundTurn/index.ts"],"names":[],"mappings":";;;AAAA,yCAAsE;AAA7D,4GAAA,eAAe,OAAA;AACxB,yCAA8D;AAArD,yGAAA,YAAY,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AACxC,yCAKqB;AAJnB,4GAAA,eAAe,OAAA;AACf,iHAAA,oBAAoB,OAAA;AACpB,gHAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* A frozen copy of a turn's plain data, for the wrapper to read.
|
|
4
|
+
*
|
|
5
|
+
* The run keeps the originals, so nothing the wrapper does to its copy can
|
|
6
|
+
* reach the run, and the caller's own objects are never frozen. Anything that
|
|
7
|
+
* is not plain data — an `AbortSignal`, a sealed request handle, a `Date`, a
|
|
8
|
+
* function — keeps its identity and is passed as it is.
|
|
9
|
+
*
|
|
10
|
+
* Iterative, because a request body can nest deeper than the call stack. No
|
|
11
|
+
* getter runs: an accessor property is copied as an accessor.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.readOnlyCopy = void 0;
|
|
15
|
+
function isPlainData(value) {
|
|
16
|
+
if (value === null || typeof value !== 'object')
|
|
17
|
+
return false;
|
|
18
|
+
if (Array.isArray(value))
|
|
19
|
+
return true;
|
|
20
|
+
const prototype = Object.getPrototypeOf(value);
|
|
21
|
+
return prototype === Object.prototype || prototype === null;
|
|
22
|
+
}
|
|
23
|
+
function readOnlyCopy(value) {
|
|
24
|
+
const copies = new Map();
|
|
25
|
+
const pending = [];
|
|
26
|
+
const copyOf = (held) => {
|
|
27
|
+
if (!isPlainData(held))
|
|
28
|
+
return held;
|
|
29
|
+
const known = copies.get(held);
|
|
30
|
+
if (known !== undefined)
|
|
31
|
+
return known;
|
|
32
|
+
const copy = Array.isArray(held) ? [] : Object.create(Object.getPrototypeOf(held));
|
|
33
|
+
copies.set(held, copy);
|
|
34
|
+
pending.push(held);
|
|
35
|
+
return copy;
|
|
36
|
+
};
|
|
37
|
+
const root = copyOf(value);
|
|
38
|
+
for (let from = pending.pop(); from !== undefined; from = pending.pop()) {
|
|
39
|
+
const to = copies.get(from);
|
|
40
|
+
for (const key of Reflect.ownKeys(from)) {
|
|
41
|
+
const field = Object.getOwnPropertyDescriptor(from, key);
|
|
42
|
+
if ('value' in field)
|
|
43
|
+
field.value = copyOf(field.value);
|
|
44
|
+
Object.defineProperty(to, key, field);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
for (const copy of copies.values())
|
|
48
|
+
Object.freeze(copy);
|
|
49
|
+
return root;
|
|
50
|
+
}
|
|
51
|
+
exports.readOnlyCopy = readOnlyCopy;
|
|
52
|
+
//# sourceMappingURL=readOnlyCopy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readOnlyCopy.js","sourceRoot":"","sources":["../../../../src/core/agent/aroundTurn/readOnlyCopy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,SAAS,WAAW,CAAC,KAAc;IACjC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,SAAS,GAAY,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACxD,OAAO,SAAS,KAAK,MA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AC,KAAK,CAAC,CAAC;YACxD,MAAM,CAAC,cAAc,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC;AACd,CAAC;AAvBD,oCAuBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/agent/aroundTurn/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.answerLayerFromOptions = exports.answerLayerArm = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The line's modes, as the option doors check them — keyed by the type the
|
|
6
|
+
* layer's composer decides with (`assessment/compose.ts` · `StandingLineWhen`),
|
|
7
|
+
* so a mode added there does not compile until it is listed here. A type-only
|
|
8
|
+
* import: the composer stays off a plain agent's module graph.
|
|
9
|
+
*/
|
|
10
|
+
const STANDING_LINE_MODES = Object.freeze({
|
|
11
|
+
always: true,
|
|
12
|
+
'unless-consistent': true,
|
|
13
|
+
'not-sure-or-ask': true,
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* THE ANSWER LAYER'S ARM (honesty layer 4), checked by ONE rule for both of
|
|
17
|
+
* its doors — `.answerLayer(options)` and `AgentOptions.answerLayer` — so a
|
|
18
|
+
* value one door refuses, the other refuses too: an unknown key, a
|
|
19
|
+
* `standingLine` that is neither a boolean nor `{ when }`, or a `when` outside
|
|
20
|
+
* the three modes, is refused by name. Returns the arm normalised — the line's
|
|
21
|
+
* mode (`true` → `'always'`), or `{}` for no line.
|
|
22
|
+
*/
|
|
23
|
+
function answerLayerArm(options, door) {
|
|
24
|
+
const unknown = Object.keys(options).filter((k) => k !== 'standingLine');
|
|
25
|
+
if (unknown.length > 0) {
|
|
26
|
+
throw new Error(`${door}: unknown option(s) ${unknown.map((k) => `'${k}'`).join(', ')}. ` +
|
|
27
|
+
"The one option is standingLine (boolean, or { when: 'always' | 'unless-consistent' | " +
|
|
28
|
+
"'not-sure-or-ask' }).");
|
|
29
|
+
}
|
|
30
|
+
const line = options.standingLine;
|
|
31
|
+
if (line === undefined || line === false)
|
|
32
|
+
return {};
|
|
33
|
+
if (line === true)
|
|
34
|
+
return { standingLine: 'always' };
|
|
35
|
+
const modes = Object.keys(STANDING_LINE_MODES)
|
|
36
|
+
.map((w) => `'${w}'`)
|
|
37
|
+
.join(', ');
|
|
38
|
+
if (typeof line !== 'object' || line === null || Array.isArray(line)) {
|
|
39
|
+
throw new Error(`${door}: standingLine must be a boolean or { when } — when is one of ${modes}.`);
|
|
40
|
+
}
|
|
41
|
+
const extra = Object.keys(line).filter((k) => k !== 'when');
|
|
42
|
+
if (extra.length > 0) {
|
|
43
|
+
throw new Error(`${door}: standingLine has unknown option(s) ${extra.map((k) => `'${k}'`).join(', ')}. ` +
|
|
44
|
+
`The one option is when: ${modes}.`);
|
|
45
|
+
}
|
|
46
|
+
const when = line.when;
|
|
47
|
+
if (typeof when !== 'string' ||
|
|
48
|
+
!Object.prototype.hasOwnProperty.call(STANDING_LINE_MODES, when)) {
|
|
49
|
+
throw new Error(`${door}: standingLine.when must be one of ${modes} (got ${JSON.stringify(when) ?? 'nothing'}).`);
|
|
50
|
+
}
|
|
51
|
+
return { standingLine: when };
|
|
52
|
+
}
|
|
53
|
+
exports.answerLayerArm = answerLayerArm;
|
|
54
|
+
/**
|
|
55
|
+
* `AgentOptions.answerLayer` as the arm `build()` resolves: `undefined` when
|
|
56
|
+
* it is absent or `false`, `{}` for `true`, an object through
|
|
57
|
+
* `answerLayerArm` — so the options door meets every refusal the builder's
|
|
58
|
+
* door does. Anything else is refused by name.
|
|
59
|
+
*/
|
|
60
|
+
function answerLayerFromOptions(value) {
|
|
61
|
+
if (value === undefined || value === false)
|
|
62
|
+
return undefined;
|
|
63
|
+
if (value === true)
|
|
64
|
+
return {};
|
|
65
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
66
|
+
throw new Error('AgentOptions.answerLayer must be a boolean or an object — ' +
|
|
67
|
+
"{ standingLine?: boolean | { when: 'always' | 'unless-consistent' | 'not-sure-or-ask' } }.");
|
|
68
|
+
}
|
|
69
|
+
return answerLayerArm(value, 'AgentOptions.answerLayer');
|
|
70
|
+
}
|
|
71
|
+
exports.answerLayerFromOptions = answerLayerFromOptions;
|
|
72
|
+
//# sourceMappingURL=answerLayerOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"answerLayerOptions.js","sourceRoot":"","sources":["../../../../src/core/agent/assessment/answerLayerOptions.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,MAAM,mBAAmB,GAA+C,MAAM,CAAC,MAAM,CAAC;IACpF,MAAM,EAAE,IAAI;IACZ,mBAAmB,EAAE,IAAI;IACzB,iBAAiB,EAAE,IAAI;CACxB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,OAA0C,EAC1C,IAAY;IAEZ,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,cAAc,CAAC,CAAC;IACzE,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,uBAAuB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YACvE,uFAAuF;YACvF,uBAAuB,CAC1B,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC;I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,CACL,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,YAAY,EAAE,IAAwB,EAAE,CAAC;AACpD,CAAC;AA1CD,wCA0CC;AAED;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,KAAc;IAEd,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7D,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CACb,4DAA4D;YAC1D,4FAA4F,CAC/F,CAAC;IACJ,CAAC;IACD,OAAO,cAAc,CAAC,KAA0C,EAAE,0BAA0B,CAAC,CAAC;AAChG,CAAC;AAZD,wDAYC"}
|
|
@@ -29,6 +29,7 @@ function hostedTurns(execution, ports) {
|
|
|
29
29
|
};
|
|
30
30
|
});
|
|
31
31
|
return {
|
|
32
|
+
replaced: ports.replaced,
|
|
32
33
|
run: (input, options, bind) => capture((run) => ports.run(run, input, options), bind),
|
|
33
34
|
resume: (checkpoint, input, options, bind) => {
|
|
34
35
|
ports.prepareResume(checkpoint);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostTurn.js","sourceRoot":"","sources":["../../../src/core/agent/hostTurn.ts"],"names":[],"mappings":";;;AAIA,0CAAgE;AAGhE,2DAAqF;
|
|
1
|
+
{"version":3,"file":"hostTurn.js","sourceRoot":"","sources":["../../../src/core/agent/hostTurn.ts"],"names":[],"mappings":";;;AAIA,0CAAgE;AAGhE,2DAAqF;AAoBrF,mGAAmG;AACnG,SAAgB,WAAW,CACzB,SAA0C,EAC1C,KAAoB;IAEpB,MAAM,OAAO,GAAG,CACd,IAA0F,EAC1F,IAA2B,EACN,EAAE,CACvB,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,E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,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC;QACrF,MAAM,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YAC3C,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAChC,OAAO,OAAO,CACZ,CAAC,GAAG,EAAE,EAAE,CACN,IAAA,2CAAuB,EACrB,GAAG,CAAC,QAAQ,EAAE,KAAK,EACnB,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,KAAK,IAAI,EACnD,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CACpD,EACH,IAAI,CACL,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAtDD,kCAsDC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GRAPH_DECLARED_STAGE_ID = exports.INTEGRITY_DISPOSITION_STAGE_ID = exports.RUN_MANIFEST_STAGE_ID = exports.LATE_ARTIFACT_FACT_STAGE_ID = exports.TOOL_TEARDOWN_STAGE_ID = void 0;
|
|
3
|
+
exports.GRAPH_DECLARED_STAGE_ID = exports.INTEGRITY_DISPOSITION_STAGE_ID = exports.RUN_MANIFEST_STAGE_ID = exports.LATE_ARTIFACT_FACT_STAGE_ID = exports.AROUND_TURN_STAGE_ID = exports.TOOL_TEARDOWN_STAGE_ID = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* The pseudo-stage a tool-teardown event is stamped with.
|
|
6
6
|
*
|
|
@@ -12,6 +12,11 @@ exports.GRAPH_DECLARED_STAGE_ID = exports.INTEGRITY_DISPOSITION_STAGE_ID = expor
|
|
|
12
12
|
* `session_reused`, happen inside a real stage and carry its real id.
|
|
13
13
|
*/
|
|
14
14
|
exports.TOOL_TEARDOWN_STAGE_ID = 'tool-teardown#0';
|
|
15
|
+
/**
|
|
16
|
+
* The pseudo-stage `agentfootprint.agent.around_turn_failed` is stamped with: a
|
|
17
|
+
* wrapper fails around the run, where there is no stage to inherit.
|
|
18
|
+
*/
|
|
19
|
+
exports.AROUND_TURN_STAGE_ID = 'around-turn#0';
|
|
15
20
|
/**
|
|
16
21
|
* The pseudo-stage a LATE artifact fact is stamped with — one that lands after
|
|
17
22
|
* the run its binding was made in had ended (a tool's floating upload). Its
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventStageIds.js","sourceRoot":"","sources":["../../../../src/core/agent/run/eventStageIds.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACU,QAAA,sBAAsB,GAAG,iBAAiB,CAAC;AAExD;;;;;GAKG;AACU,QAAA,2BAA2B,GAAG,iBAAiB,CAAC;AAE7D;;;;;;;GAOG;AACU,QAAA,qBAAqB,GAAG,kBAAkB,CAAC;AAExD;;;;GAIG;AACU,QAAA,8BAA8B,GAAG,yBAAyB,CAAC;AAExE;;;;;GAKG;AACU,QAAA,uBAAuB,GAAG,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"eventStageIds.js","sourceRoot":"","sources":["../../../../src/core/agent/run/eventStageIds.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACU,QAAA,sBAAsB,GAAG,iBAAiB,CAAC;AAExD;;;GAGG;AACU,QAAA,oBAAoB,GAAG,eAAe,CAAC;AAEpD;;;;;GAKG;AACU,QAAA,2BAA2B,GAAG,iBAAiB,CAAC;AAE7D;;;;;;;GAOG;AACU,QAAA,qBAAqB,GAAG,kBAAkB,CAAC;AAExD;;;;GAIG;AACU,QAAA,8BAA8B,GAAG,yBAAyB,CAAC;AAExE;;;;;GAKG;AACU,QAAA,uBAAuB,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertOutputStrategySupported = void 0;
|
|
4
|
+
const forcedToolChoice_js_1 = require("../../../provider-contract/forcedToolChoice.js");
|
|
5
|
+
const nativeOutputSchema_js_1 = require("../../../provider-contract/nativeOutputSchema.js");
|
|
6
|
+
/**
|
|
7
|
+
* Refuse, at run start, an output strategy the provider cannot carry.
|
|
8
|
+
*
|
|
9
|
+
* Run start rather than build time: a decorated provider (`withFallback`,
|
|
10
|
+
* `withRetry`, a breaker) is only the thing it is once composed, and
|
|
11
|
+
* `withFallback` publishes the AND of its pair.
|
|
12
|
+
*
|
|
13
|
+
* A refusal rather than a quiet fall back to `'instruct'`, because the two are
|
|
14
|
+
* not interchangeable: `'tool-forced'` and `'native'` constrain the shape at
|
|
15
|
+
* generation and decoding, `'instruct'` asks for it in prose. An agent that
|
|
16
|
+
* silently got the second while its config said the first would be a promise
|
|
17
|
+
* the recording could not even show was broken.
|
|
18
|
+
*/
|
|
19
|
+
function assertOutputStrategySupported(target) {
|
|
20
|
+
assertForcedToolChoiceSupported(target);
|
|
21
|
+
assertNativeOutputSchemaSupported(target);
|
|
22
|
+
}
|
|
23
|
+
exports.assertOutputStrategySupported = assertOutputStrategySupported;
|
|
24
|
+
function assertForcedToolChoiceSupported(target) {
|
|
25
|
+
if (target.enforcement?.schemaTool === undefined)
|
|
26
|
+
return;
|
|
27
|
+
const first = target.providers?.[0];
|
|
28
|
+
const provider = first?.provider ?? target.provider;
|
|
29
|
+
const model = first?.model ?? target.model;
|
|
30
|
+
if (provider.carriesForcedToolChoice === true) {
|
|
31
|
+
if ((first === undefined && target.modelResolvedAtSeed) || (0, forcedToolChoice_js_1.forcedToolChoiceFor)(provider, model))
|
|
32
|
+
return;
|
|
33
|
+
throw new forcedToolChoice_js_1.UnsupportedToolChoiceError({ provider: provider.name, model });
|
|
34
|
+
}
|
|
35
|
+
throw new Error(`Agent: .outputSchema(parser, { strategy: 'tool-forced' }) needs a provider that puts ` +
|
|
36
|
+
`a forced tool choice on its wire, and '${provider.name}' does not declare one. ` +
|
|
37
|
+
`Anthropic, Bedrock, real OpenAI/Azure and the mock do; an OpenAI-COMPATIBLE endpoint ` +
|
|
38
|
+
`behind a custom baseURL (Ollama, vLLM, …) deliberately does not, because what that ` +
|
|
39
|
+
`server does with tool_choice is not this library's to promise. Use ` +
|
|
40
|
+
`{ strategy: 'instruct', retries: N } on this provider — it works on every wire — or ` +
|
|
41
|
+
`run the forced strategy on a provider that declares the capability.`);
|
|
42
|
+
}
|
|
43
|
+
function assertNativeOutputSchemaSupported(target) {
|
|
44
|
+
const { enforcement } = target;
|
|
45
|
+
if (enforcement?.outputFormat === undefined || enforcement.nativeOutputAuto === true)
|
|
46
|
+
return;
|
|
47
|
+
const first = target.providers?.[0];
|
|
48
|
+
const provider = first?.provider ?? target.provider;
|
|
49
|
+
const model = first?.model ?? target.model;
|
|
50
|
+
if (provider.carriesNativeOutputSchema === true) {
|
|
51
|
+
if ((first === undefined && target.modelResolvedAtSeed) ||
|
|
52
|
+
(0, nativeOutputSchema_js_1.nativeOutputSchemaFor)(provider, model))
|
|
53
|
+
return;
|
|
54
|
+
throw new nativeOutputSchema_js_1.UnsupportedNativeOutputError({ provider: provider.name, model });
|
|
55
|
+
}
|
|
56
|
+
throw new Error(`Agent: .outputSchema(parser, { strategy: 'native' }) needs a provider that puts a ` +
|
|
57
|
+
`structured-output format on its wire, and '${provider.name}' does not declare one. ` +
|
|
58
|
+
`anthropic(), browserAnthropic() and the mock do; the Bedrock and gateway adapters do ` +
|
|
59
|
+
`not in this release. Use { strategy: 'instruct', retries: N } on this provider — it ` +
|
|
60
|
+
`works on every wire — or run the native strategy on a provider that declares it.`);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=outputStrategySupport.js.map
|
|
@@ -0,0 +1 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W,CAAC,gBAAgB,KAAK,IAAI;QAAE,OAAO;IAC7F,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,KAAK,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC;IACpD,MAAM,KAAK,GAAG,KAAK,EAAE,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC;IAC3C,IAAI,QAAQ,CAAC,yBAAyB,KAAK,IAAI,EAAE,CAAC;QAChD,IACE,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,mBAAmB,CAAC;YACnD,IAAA,6CAAqB,EAAC,QAAQ,EAAE,KAAK,CAAC;YAEtC,OAAO;QACT,MAAM,IAAI,oDAA4B,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,MAAM,IAAI,KAAK,CACb,oFAAoF;QAClF,8CAA8C,QAAQ,CAAC,IAAI,0BAA0B;QACrF,uFAAuF;QACvF,sFAAsF;QACtF,kFAAkF,CACrF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTerminalRunError = void 0;
|
|
4
|
+
const CredentialConsentRequiredError_js_1 = require("../../../identity/CredentialConsentRequiredError.js");
|
|
5
|
+
const requestRefusal_js_1 = require("../../../provider-contract/requestRefusal.js");
|
|
6
|
+
const types_js_1 = require("../../../reliability/types.js");
|
|
7
|
+
const PolicyHaltError_js_1 = require("../../../security/PolicyHaltError.js");
|
|
8
|
+
const index_js_1 = require("../../../answer-validation/index.js");
|
|
9
|
+
const errors_js_1 = require("../evidence/errors.js");
|
|
10
|
+
const errors_js_2 = require("../window/errors.js");
|
|
11
|
+
/**
|
|
12
|
+
* An error a crash checkpoint must not wrap: an intentional terminal signal,
|
|
13
|
+
* which a caller catches by its typed shape, and which resuming could only
|
|
14
|
+
* re-trigger.
|
|
15
|
+
*
|
|
16
|
+
* • PauseSignal — an askHuman pause, not a failure.
|
|
17
|
+
* • PolicyHaltError — policy-driven termination; the synthetic tool_result is
|
|
18
|
+
* already in history.
|
|
19
|
+
* • ReliabilityFailFastError — thrown by finalizeResult AFTER the chart returns
|
|
20
|
+
* cleanly, so it never reaches the catch; listed for documentation.
|
|
21
|
+
* • CompactionUnmeasurableError — a provider that reports no usage will report
|
|
22
|
+
* none on resume either.
|
|
23
|
+
* • A request refusal — a forced-output capability refusal is terminal even
|
|
24
|
+
* after a correction turn: a checkpoint cannot repair this model contract.
|
|
25
|
+
* • CredentialConsentRequiredError — answered by a PERSON at the identity
|
|
26
|
+
* provider; wrapping it would bury `authorizationUrl` one `.cause` deep.
|
|
27
|
+
* • UnsupportedValuesError, AnswerValidationError — a VERDICT, not a crash: the
|
|
28
|
+
* loop spent its one revision, and the same model would meet the same evidence.
|
|
29
|
+
* • CheckerDeadError — a WIRING verdict on this build: resuming runs the same
|
|
30
|
+
* dead wiring.
|
|
31
|
+
*/
|
|
32
|
+
function isTerminalRunError(cause) {
|
|
33
|
+
return (cause.name === 'PauseSignal' ||
|
|
34
|
+
cause instanceof PolicyHaltError_js_1.PolicyHaltError ||
|
|
35
|
+
cause instanceof types_js_1.ReliabilityFailFastError ||
|
|
36
|
+
cause instanceof errors_js_2.CompactionUnmeasurableError ||
|
|
37
|
+
(0, requestRefusal_js_1.isRequestRefusal)(cause) ||
|
|
38
|
+
cause instanceof CredentialConsentRequiredError_js_1.CredentialConsentRequiredError ||
|
|
39
|
+
cause instanceof errors_js_1.UnsupportedValuesError ||
|
|
40
|
+
cause instanceof index_js_1.AnswerValidationError ||
|
|
41
|
+
cause.name === 'CheckerDeadError');
|
|
42
|
+
}
|
|
43
|
+
exports.isTerminalRunError = isTerminalRunError;
|
|
44
|
+
//# sourceMappingURL=terminalRunError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminalRunError.js","sourceRoot":"","sources":["../../../../src/core/agent/run/terminalRunError.ts"],"names":[],"mappings":";;;AAAA,2GAAqG;AACrG,oFAAgF;AAChF,4DAAyE;AACzE,6EAAuE;AACvE,kEAA4E;AAC5E,qDAA+D;AAC/D,mDAAkE;AAElE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,kBAAkB,CAAC,KAAY;IAC7C,OAAO,CACL,KAAK,CAAC,IAAI,KAAK,aAAa;QAC5B,KAAK,YAAY,oCAAe;QAChC,KAAK,YAAY,mCAAwB;QACzC,KAAK,YAAY,uCAA2B;QAC5C,IAAA,oCAAgB,EAAC,KAAK,CAAC;QACvB,KAAK,YAAY,kEAA8B;QAC/C,KAAK,YAAY,kCAAsB;QACvC,KAAK,YAAY,gCAAqB;QACtC,KAAK,CAAC,IAAI,KAAK,kBAAkB,CAClC,CAAC;AACJ,CAAC;AAZD,gDAYC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runnerLive.js","sourceRoot":"","sources":["../../src/core/runnerLive.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;
|
|
1
|
+
{"version":3,"file":"runnerLive.js","sourceRoot":"","sources":["../../src/core/runnerLive.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;AAgEH,MAAM,IAAI,GAAG,IAAI,OAAO,EAAsB,CAAC;AAE/C,wFAAwF;AACxF,SAAgB,kBAAkB,CAAC,MAAc,EAAE,IAAgB;IACjE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvB,OAAO,IAAI,CAAC;AACd,CAAC;AAHD,gDAGC;AAED,yFAAyF;AACzF,SAAgB,UAAU,CAAC,MAAc;IACvC,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC;AAFD,gCAEC"}
|
package/dist/doors/time.js
CHANGED
|
@@ -32,9 +32,15 @@
|
|
|
32
32
|
* run's zone check (an IANA name; `PST` and a bare offset are refused,
|
|
33
33
|
* although `Intl` takes them), for a session zone before it is passed as
|
|
34
34
|
* `time.zone`.
|
|
35
|
+
* - the time ask as a HOST draws it: `timeReplyPairs(request)` — which optional
|
|
36
|
+
* text field is the correction sibling of which time range, so a one-click
|
|
37
|
+
* confirm can treat the sibling as not asked. It reads the ask itself, in
|
|
38
|
+
* process or off a wire, and throws a `TypeError` when a stamped binding does
|
|
39
|
+
* not match its fields.
|
|
35
40
|
*
|
|
36
|
-
* Pure functions over
|
|
37
|
-
* `.time()
|
|
41
|
+
* Pure functions over the clock or the ask the caller passes: no run, no record,
|
|
42
|
+
* no `.time()`, nothing from Node, so a web front end can import this door. A
|
|
43
|
+
* door of its own because the conversions are the time layer's
|
|
38
44
|
* RUN-TIME half, which a plain agent never loads (`src/time/README.md` ·
|
|
39
45
|
* "What a plain agent carries"; pinned by
|
|
40
46
|
* `test/trace-toolpack/browserGraph.test.ts`): on the main barrel they
|
|
@@ -56,7 +62,7 @@
|
|
|
56
62
|
* ```
|
|
57
63
|
*/
|
|
58
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
-
exports.isZoneName = exports.presentRange = exports.sugarForms = exports.periodFactProblem = exports.widestMsOf = exports.granularityMsOf = exports.convertWidened = exports.convertForTool = exports.convertExact = void 0;
|
|
65
|
+
exports.isZoneName = exports.timeReplyPairs = exports.presentRange = exports.sugarForms = exports.periodFactProblem = exports.widestMsOf = exports.granularityMsOf = exports.convertWidened = exports.convertForTool = exports.convertExact = void 0;
|
|
60
66
|
var convert_js_1 = require("../time/convert.js");
|
|
61
67
|
Object.defineProperty(exports, "convertExact", { enumerable: true, get: function () { return convert_js_1.convertExact; } });
|
|
62
68
|
Object.defineProperty(exports, "convertForTool", { enumerable: true, get: function () { return convert_js_1.convertForTool; } });
|
|
@@ -68,6 +74,8 @@ Object.defineProperty(exports, "periodFactProblem", { enumerable: true, get: fun
|
|
|
68
74
|
Object.defineProperty(exports, "sugarForms", { enumerable: true, get: function () { return periodForm_js_1.sugarForms; } });
|
|
69
75
|
var present_js_1 = require("../time/present.js");
|
|
70
76
|
Object.defineProperty(exports, "presentRange", { enumerable: true, get: function () { return present_js_1.presentRange; } });
|
|
77
|
+
var replyForm_js_1 = require("../time/replyForm.js");
|
|
78
|
+
Object.defineProperty(exports, "timeReplyPairs", { enumerable: true, get: function () { return replyForm_js_1.timeReplyPairs; } });
|
|
71
79
|
var zone_js_1 = require("../time/zone.js");
|
|
72
80
|
Object.defineProperty(exports, "isZoneName", { enumerable: true, get: function () { return zone_js_1.isZoneName; } });
|
|
73
81
|
//# sourceMappingURL=time.js.map
|
package/dist/doors/time.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/doors/time.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/doors/time.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;;;AAEH,iDAW4B;AAV1B,0GAAA,YAAY,OAAA;AACZ,4GAAA,cAAc,OAAA;AACd,4GAAA,cAAc,OAAA;AACd,6GAAA,eAAe,OAAA;AACf,wGAAA,UAAU,OAAA;AAOZ,uDAM+B;AAL7B,kHAAA,iBAAiB,OAAA;AACjB,2GAAA,UAAU,OAAA;AAKZ,iDAAiF;AAAxE,0GAAA,YAAY,OAAA;AACrB,qDAAiG;AAAxF,8GAAA,cAAc,OAAA;AACvB,2CAA4D;AAAnD,qGAAA,UAAU,OAAA"}
|