@nac3/forge-cli 1.24.1 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/agent_session.d.ts.map +1 -1
- package/dist/chat/agent_session.js +132 -12
- package/dist/chat/agent_session.js.map +1 -1
- package/dist/chat/cache_ttl.d.ts +143 -0
- package/dist/chat/cache_ttl.d.ts.map +1 -0
- package/dist/chat/cache_ttl.js +165 -0
- package/dist/chat/cache_ttl.js.map +1 -0
- package/dist/chat/claude.d.ts +1 -0
- package/dist/chat/claude.d.ts.map +1 -1
- package/dist/chat/claude.js +47 -5
- package/dist/chat/claude.js.map +1 -1
- package/dist/chat/claude_cli.d.ts +24 -0
- package/dist/chat/claude_cli.d.ts.map +1 -1
- package/dist/chat/claude_cli.js +76 -10
- package/dist/chat/claude_cli.js.map +1 -1
- package/dist/chat/panel.d.ts.map +1 -1
- package/dist/chat/panel.js +133 -21
- package/dist/chat/panel.js.map +1 -1
- package/dist/chat/server.d.ts.map +1 -1
- package/dist/chat/server.js +32 -3
- package/dist/chat/server.js.map +1 -1
- package/dist/chat/tools/evidence.d.ts +15 -0
- package/dist/chat/tools/evidence.d.ts.map +1 -1
- package/dist/chat/tools/evidence.js +16 -0
- package/dist/chat/tools/evidence.js.map +1 -1
- package/dist/chat/tools/keys.d.ts.map +1 -1
- package/dist/chat/tools/keys.js +22 -2
- package/dist/chat/tools/keys.js.map +1 -1
- package/dist/chat/tools/pending.d.ts +3 -0
- package/dist/chat/tools/pending.d.ts.map +1 -1
- package/dist/chat/tools/pending.js +40 -3
- package/dist/chat/tools/pending.js.map +1 -1
- package/dist/chat/tools/session_verbs.d.ts +83 -0
- package/dist/chat/tools/session_verbs.d.ts.map +1 -1
- package/dist/chat/tools/session_verbs.js +251 -18
- package/dist/chat/tools/session_verbs.js.map +1 -1
- package/dist/chat/tools/shell.d.ts +11 -0
- package/dist/chat/tools/shell.d.ts.map +1 -1
- package/dist/chat/tools/shell.js +68 -1
- package/dist/chat/tools/shell.js.map +1 -1
- package/dist/commands/chat.d.ts +6 -0
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +25 -0
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/limits.d.ts.map +1 -1
- package/dist/commands/limits.js +85 -6
- package/dist/commands/limits.js.map +1 -1
- package/dist/commands/pending.d.ts.map +1 -1
- package/dist/commands/pending.js +26 -1
- package/dist/commands/pending.js.map +1 -1
- package/dist/commands/urazuke.d.ts.map +1 -1
- package/dist/commands/urazuke.js +82 -0
- package/dist/commands/urazuke.js.map +1 -1
- package/dist/core/brain_pin.d.ts +74 -0
- package/dist/core/brain_pin.d.ts.map +1 -0
- package/dist/core/brain_pin.js +113 -0
- package/dist/core/brain_pin.js.map +1 -0
- package/dist/core/cost_router.d.ts.map +1 -1
- package/dist/core/cost_router.js +56 -0
- package/dist/core/cost_router.js.map +1 -1
- package/dist/core/limits_config.d.ts +61 -0
- package/dist/core/limits_config.d.ts.map +1 -1
- package/dist/core/limits_config.js +78 -0
- package/dist/core/limits_config.js.map +1 -1
- package/dist/core/provider_keys.d.ts +33 -0
- package/dist/core/provider_keys.d.ts.map +1 -1
- package/dist/core/provider_keys.js +40 -3
- package/dist/core/provider_keys.js.map +1 -1
- package/dist/docs/doctrine/session-orchestration.md +109 -86
- package/dist/llm/sse_stream.d.ts +5 -0
- package/dist/llm/sse_stream.d.ts.map +1 -1
- package/dist/llm/sse_stream.js +26 -3
- package/dist/llm/sse_stream.js.map +1 -1
- package/dist/mcp/bridge_registry.d.ts +1 -1
- package/dist/nac3/internal_manifest.d.ts.map +1 -1
- package/dist/nac3/internal_manifest.js +2 -0
- package/dist/nac3/internal_manifest.js.map +1 -1
- package/dist/pending/store.d.ts +12 -0
- package/dist/pending/store.d.ts.map +1 -1
- package/dist/pending/store.js +20 -0
- package/dist/pending/store.js.map +1 -1
- package/dist/pending/types.d.ts +11 -0
- package/dist/pending/types.d.ts.map +1 -1
- package/dist/pending/types.js.map +1 -1
- package/dist/tasks/supervisor.d.ts +31 -0
- package/dist/tasks/supervisor.d.ts.map +1 -1
- package/dist/tasks/supervisor.js +61 -5
- package/dist/tasks/supervisor.js.map +1 -1
- package/dist/telemetry/usage.d.ts +107 -0
- package/dist/telemetry/usage.d.ts.map +1 -1
- package/dist/telemetry/usage.js +186 -13
- package/dist/telemetry/usage.js.map +1 -1
- package/dist/urazuke/close_gate.d.ts +47 -3
- package/dist/urazuke/close_gate.d.ts.map +1 -1
- package/dist/urazuke/close_gate.js +57 -3
- package/dist/urazuke/close_gate.js.map +1 -1
- package/dist/urazuke/evidence.d.ts +10 -0
- package/dist/urazuke/evidence.d.ts.map +1 -1
- package/dist/urazuke/evidence.js +63 -3
- package/dist/urazuke/evidence.js.map +1 -1
- package/dist/urazuke/external_audit.d.ts +89 -0
- package/dist/urazuke/external_audit.d.ts.map +1 -0
- package/dist/urazuke/external_audit.js +309 -0
- package/dist/urazuke/external_audit.js.map +1 -0
- package/dist/urazuke/receipts.d.ts +28 -1
- package/dist/urazuke/receipts.d.ts.map +1 -1
- package/dist/urazuke/receipts.js +59 -6
- package/dist/urazuke/receipts.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/doctrine/session-orchestration.md +109 -86
- package/package.json +1 -1
- package/src/i18n/catalogs/ar.json +570 -568
- package/src/i18n/catalogs/de.json +570 -568
- package/src/i18n/catalogs/en.json +570 -568
- package/src/i18n/catalogs/es.json +570 -568
- package/src/i18n/catalogs/fr.json +570 -568
- package/src/i18n/catalogs/hi.json +570 -568
- package/src/i18n/catalogs/it.json +570 -568
- package/src/i18n/catalogs/ja.json +570 -568
- package/src/i18n/catalogs/pt.json +570 -568
- package/src/i18n/catalogs/zh.json +570 -568
|
@@ -1,86 +1,109 @@
|
|
|
1
|
-
# Doctrine: session orchestration (yujin.session.*)
|
|
2
|
-
|
|
3
|
-
When it is optimal, you may launch other `yf chat` instances as
|
|
4
|
-
HEADLESS AGENT sub-sessions to do orthogonal, well-scoped work in
|
|
5
|
-
parallel with this conversation, and collect their results over the
|
|
6
|
-
coordination bridge. This is the `yujin.session.*` verb family.
|
|
7
|
-
|
|
8
|
-
This doctrine is about WHEN to spawn and how to keep it safe and
|
|
9
|
-
cheap. It is distinct from `agent-orchestrator` (product-side agents
|
|
10
|
-
the generated software dispatches on the user's machine).
|
|
11
|
-
|
|
12
|
-
## Off by default
|
|
13
|
-
|
|
14
|
-
The whole capability is gated by `multiagent.enabled` in the limits
|
|
15
|
-
config (Ajustes > Limites), DEFAULT OFF. While off, the
|
|
16
|
-
`yujin.session.*` verbs are hidden from the manifest, this doctrine is
|
|
17
|
-
not injected, the system prompt tells you it is OFF, and the handlers
|
|
18
|
-
refuse. So you only see + use these verbs when the user has explicitly
|
|
19
|
-
turned multi-agent on. If the user asks for parallel sub-sessions while
|
|
20
|
-
it is off, tell them to enable it in Ajustes > Limites.
|
|
21
|
-
|
|
22
|
-
## The verbs
|
|
23
|
-
|
|
24
|
-
- `yujin.session.spawn { task, project_root?, budget_tokens?, label? }`
|
|
25
|
-
-- launch a sub-session for one self-contained task. Returns a
|
|
26
|
-
handle immediately (NON-blocking). The user approves each spawn
|
|
27
|
-
(it spends BYOK tokens autonomously).
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
1
|
+
# Doctrine: session orchestration (yujin.session.*)
|
|
2
|
+
|
|
3
|
+
When it is optimal, you may launch other `yf chat` instances as
|
|
4
|
+
HEADLESS AGENT sub-sessions to do orthogonal, well-scoped work in
|
|
5
|
+
parallel with this conversation, and collect their results over the
|
|
6
|
+
coordination bridge. This is the `yujin.session.*` verb family.
|
|
7
|
+
|
|
8
|
+
This doctrine is about WHEN to spawn and how to keep it safe and
|
|
9
|
+
cheap. It is distinct from `agent-orchestrator` (product-side agents
|
|
10
|
+
the generated software dispatches on the user's machine).
|
|
11
|
+
|
|
12
|
+
## Off by default
|
|
13
|
+
|
|
14
|
+
The whole capability is gated by `multiagent.enabled` in the limits
|
|
15
|
+
config (Ajustes > Limites), DEFAULT OFF. While off, the
|
|
16
|
+
`yujin.session.*` verbs are hidden from the manifest, this doctrine is
|
|
17
|
+
not injected, the system prompt tells you it is OFF, and the handlers
|
|
18
|
+
refuse. So you only see + use these verbs when the user has explicitly
|
|
19
|
+
turned multi-agent on. If the user asks for parallel sub-sessions while
|
|
20
|
+
it is off, tell them to enable it in Ajustes > Limites.
|
|
21
|
+
|
|
22
|
+
## The verbs
|
|
23
|
+
|
|
24
|
+
- `yujin.session.spawn { task, project_root?, budget_tokens?, label?, model? }`
|
|
25
|
+
-- launch a sub-session for one self-contained task. Returns a
|
|
26
|
+
handle immediately (NON-blocking). The user approves each spawn
|
|
27
|
+
(it spends BYOK tokens autonomously).
|
|
28
|
+
`model` PINS the child brain as "provider/model" (PND-263). Without
|
|
29
|
+
it the child inherits the global `brain_config`, so its brain comes
|
|
30
|
+
out by OMISSION -- which is wrong whenever the brain is part of the
|
|
31
|
+
point. Measured in the Urazuke A/B experiment: the step-13 audit done
|
|
32
|
+
by the inherited non-frontier brain wrote FOUR of the nine findings it
|
|
33
|
+
announced, with a false P0; the same audit over the same commit with a
|
|
34
|
+
frontier brain wrote SEVENTEEN, all seventeen verified. The step asks
|
|
35
|
+
for a second opinion, and an inherited brain turns it into a
|
|
36
|
+
formality. Two rules on the pin, both deliberate: the slash is
|
|
37
|
+
REQUIRED (Forge never guesses the provider from the model name), and
|
|
38
|
+
an unknown provider -- or one whose key is not in the vault -- is
|
|
39
|
+
REFUSED at the door instead of silently falling back to another. A pin
|
|
40
|
+
also overrides the eco/frontier classifier and the escalation: it is a
|
|
41
|
+
request, not a preference.
|
|
42
|
+
- `yujin.session.collect { handle?, wait_ms? }` -- read the results
|
|
43
|
+
sub-sessions have published. `wait_ms` blocks up to that long for
|
|
44
|
+
at least one result; default 0 = return whatever has arrived.
|
|
45
|
+
- `yujin.session.list` -- what you have spawned, with TWO facts that are
|
|
46
|
+
not the same one (PND-256): `alive` is whether the process exists
|
|
47
|
+
(asked of the OS), and `registered` is whether the child already
|
|
48
|
+
published itself on the coordination bridge. A child can be alive and
|
|
49
|
+
not yet registered (booting), and a dead child can linger in the
|
|
50
|
+
roster. Reading one as the other costs either a needless relaunch or
|
|
51
|
+
an endless wait.
|
|
52
|
+
- `yujin.session.stop { handle }` -- terminate one.
|
|
53
|
+
|
|
54
|
+
## Spawn ONLY when it pays off
|
|
55
|
+
|
|
56
|
+
A sub-session boots a whole headless server and spends tokens, so the
|
|
57
|
+
overhead must be justified. Spawn when ALL of these hold:
|
|
58
|
+
|
|
59
|
+
1. **Orthogonal** -- the subtask is independent of the work you are
|
|
60
|
+
doing right now; it does not need the live conversation context.
|
|
61
|
+
(The child gets ONLY the `task` string you write -- be specific.)
|
|
62
|
+
2. **Parallelizable** -- it can run while you keep working, and you
|
|
63
|
+
genuinely benefit from not blocking on it (e.g. a wide read /
|
|
64
|
+
research / analysis sweep over a different subsystem).
|
|
65
|
+
3. **No write collision** -- it will not edit the same files you are
|
|
66
|
+
editing. If both might write, scope them to different paths or do
|
|
67
|
+
it yourself.
|
|
68
|
+
4. **Fits a budget** -- set `budget_tokens` to bound the spend.
|
|
69
|
+
5. **Brain chosen, not inherited** -- when the brain matters (an AUDIT
|
|
70
|
+
by another session, a review, a second opinion), pass `model`. An
|
|
71
|
+
auditor that comes out by omission satisfies the form of the step and
|
|
72
|
+
loses its point.
|
|
73
|
+
|
|
74
|
+
Do NOT spawn for:
|
|
75
|
+
|
|
76
|
+
- Trivial tasks (a single read, a one-line answer) -- the overhead
|
|
77
|
+
costs more than doing it inline.
|
|
78
|
+
- Anything that needs the user's live judgement or the chat history.
|
|
79
|
+
- Work you could do with one of your own verbs in this turn.
|
|
80
|
+
|
|
81
|
+
Typical good uses: "map how subsystem X wires together and report the
|
|
82
|
+
key files + entry points", "search the whole repo for every place
|
|
83
|
+
pattern Y appears and summarise", "read these 8 docs and extract the
|
|
84
|
+
constraints". Launch one per independent angle, then `collect`.
|
|
85
|
+
|
|
86
|
+
## The child's scope (enforced, not advisory)
|
|
87
|
+
|
|
88
|
+
A sub-session runs with a RESTRICTED verb scope (enforced in
|
|
89
|
+
`nac3_invoke` via `YF_AGENT_MODE`):
|
|
90
|
+
|
|
91
|
+
- CAN: read / search / write files in its project root, run SAFE
|
|
92
|
+
shell, query the graph / pendings / reader.
|
|
93
|
+
- CANNOT: `git push` / `git commit`, destructive actions, `fs.move`,
|
|
94
|
+
re-anchor the project, mutate the workflow / pending / keys, run
|
|
95
|
+
lifecycle servers, or spawn its OWN sub-sessions (no grandchildren).
|
|
96
|
+
|
|
97
|
+
So the child is a safe builder/analyst. Anything outward or
|
|
98
|
+
irreversible stays with YOU, the parent, where the user can approve
|
|
99
|
+
it. Have the child RETURN its deliverable; you surface it (pizarron,
|
|
100
|
+
etc.) and you do the push/commit.
|
|
101
|
+
|
|
102
|
+
## Lifecycle
|
|
103
|
+
|
|
104
|
+
Sub-sessions are one-shot: a child runs its task to completion (a
|
|
105
|
+
`[SESSION_DONE]` marker), publishes its result, and exits. The full
|
|
106
|
+
result is written to disk; the bridge signal carries a summary + the
|
|
107
|
+
path. Always `collect` what you spawn -- do not leave results
|
|
108
|
+
unread. If a child is no longer useful or is burning budget, `stop`
|
|
109
|
+
it.
|
package/dist/llm/sse_stream.d.ts
CHANGED
|
@@ -32,10 +32,15 @@ export interface AnthropicStreamResult {
|
|
|
32
32
|
usage: {
|
|
33
33
|
input_tokens: number;
|
|
34
34
|
output_tokens: number;
|
|
35
|
+
cache_creation_input_tokens: number;
|
|
36
|
+
cache_read_input_tokens: number;
|
|
35
37
|
};
|
|
36
38
|
model?: string;
|
|
37
39
|
stop_reason?: string;
|
|
38
40
|
}
|
|
41
|
+
/** Read one SSE-framed Response body, invoking `onFrame` per `data:` JSON
|
|
42
|
+
* object. Tolerant of multi-line data fields and keep-alive `:` comments. */
|
|
43
|
+
export declare function forEachSseEvent(body: ReadableStream<Uint8Array>, onEvent: (event: string, obj: Record<string, unknown>) => void): Promise<void>;
|
|
39
44
|
/**
|
|
40
45
|
* Parse an Anthropic streaming /v1/messages body into the buffered shape,
|
|
41
46
|
* emitting each text delta via onText. Mirrors the SSE event sequence:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse_stream.d.ts","sourceRoot":"","sources":["../../src/llm/sse_stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,8DAA8D;AAC9D,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,KAAK,CACV;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAC9B;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KA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,EAChC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAC9B,OAAO,CAAC,kBAAkB,CAAC,CA2C7B"}
|
package/dist/llm/sse_stream.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
/** Read one SSE-framed Response body, invoking `onFrame` per `data:` JSON
|
|
22
22
|
* object. Tolerant of multi-line data fields and keep-alive `:` comments. */
|
|
23
|
-
async function
|
|
23
|
+
export async function forEachSseEvent(body, onEvent) {
|
|
24
24
|
const reader = body.getReader();
|
|
25
25
|
const decoder = new TextDecoder('utf-8');
|
|
26
26
|
let buf = '';
|
|
@@ -29,9 +29,17 @@ async function forEachSseFrame(body, onFrame) {
|
|
|
29
29
|
* trailing \r). */
|
|
30
30
|
const emitFrame = (frame) => {
|
|
31
31
|
let dataStr = '';
|
|
32
|
+
/* El NOMBRE del evento se conserva. Lo pedia el lazo local de las
|
|
33
|
+
* sub-sesiones (PND-257), que necesita distinguir `turn_complete` de
|
|
34
|
+
* `error`: sin el nombre hay que adivinar por la forma del payload, que
|
|
35
|
+
* es la clase de suposicion que despues falla en silencio. Los tres
|
|
36
|
+
* consumidores que no lo necesitan siguen llamando a forEachSseFrame. */
|
|
37
|
+
let evName = '';
|
|
32
38
|
for (const line of frame.split(/\r?\n/)) {
|
|
33
39
|
if (line.startsWith('data:'))
|
|
34
40
|
dataStr += line.slice(5).trim();
|
|
41
|
+
else if (line.startsWith('event:'))
|
|
42
|
+
evName = line.slice(6).trim();
|
|
35
43
|
}
|
|
36
44
|
if (!dataStr || dataStr === '[DONE]')
|
|
37
45
|
return;
|
|
@@ -42,7 +50,7 @@ async function forEachSseFrame(body, onFrame) {
|
|
|
42
50
|
catch {
|
|
43
51
|
return;
|
|
44
52
|
}
|
|
45
|
-
|
|
53
|
+
onEvent(evName, obj);
|
|
46
54
|
};
|
|
47
55
|
for (;;) {
|
|
48
56
|
const { done, value } = await reader.read();
|
|
@@ -67,6 +75,12 @@ async function forEachSseFrame(body, onFrame) {
|
|
|
67
75
|
if (buf.trim())
|
|
68
76
|
emitFrame(buf);
|
|
69
77
|
}
|
|
78
|
+
/** Read one SSE-framed Response body, invoking `onFrame` per `data:` JSON
|
|
79
|
+
* object, ignoring the event name. Un solo parser: esta es la vista sin
|
|
80
|
+
* nombre de forEachSseEvent, no una segunda implementacion. */
|
|
81
|
+
async function forEachSseFrame(body, onFrame) {
|
|
82
|
+
await forEachSseEvent(body, (_event, obj) => onFrame(obj));
|
|
83
|
+
}
|
|
70
84
|
/**
|
|
71
85
|
* Parse an Anthropic streaming /v1/messages body into the buffered shape,
|
|
72
86
|
* emitting each text delta via onText. Mirrors the SSE event sequence:
|
|
@@ -80,11 +94,15 @@ export async function readAnthropicStream(body, onText) {
|
|
|
80
94
|
let stopReason;
|
|
81
95
|
let inputTokens = 0;
|
|
82
96
|
let outputTokens = 0;
|
|
97
|
+
let cacheWriteTokens = 0;
|
|
98
|
+
let cacheReadTokens = 0;
|
|
83
99
|
await forEachSseFrame(body, (evt) => {
|
|
84
100
|
const t = evt['type'];
|
|
85
101
|
if (t === 'message_start') {
|
|
86
102
|
const msg = evt['message'];
|
|
87
103
|
inputTokens = msg?.usage?.input_tokens ?? 0;
|
|
104
|
+
cacheWriteTokens = msg?.usage?.cache_creation_input_tokens ?? 0;
|
|
105
|
+
cacheReadTokens = msg?.usage?.cache_read_input_tokens ?? 0;
|
|
88
106
|
model = msg?.model;
|
|
89
107
|
}
|
|
90
108
|
else if (t === 'content_block_start') {
|
|
@@ -142,7 +160,12 @@ export async function readAnthropicStream(body, onText) {
|
|
|
142
160
|
});
|
|
143
161
|
return {
|
|
144
162
|
content: blocks.filter(Boolean),
|
|
145
|
-
usage: {
|
|
163
|
+
usage: {
|
|
164
|
+
input_tokens: inputTokens,
|
|
165
|
+
output_tokens: outputTokens,
|
|
166
|
+
cache_creation_input_tokens: cacheWriteTokens,
|
|
167
|
+
cache_read_input_tokens: cacheReadTokens,
|
|
168
|
+
},
|
|
146
169
|
model,
|
|
147
170
|
stop_reason: stopReason,
|
|
148
171
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse_stream.js","sourceRoot":"","sources":["../../src/llm/sse_stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"sse_stream.js","sourceRoot":"","sources":["../../src/llm/sse_stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAqBH;8EAC8E;AAC9E,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,IAAgC,EAChC,OAA8D;IAE9D,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb;;uBAEmB;IACnB,MAAM,SAAS,GAAG,CAAC,KAAa,EAAQ,EAAE;QACxC,IAAI,OAAO,GAAG,EAAE,CAAC;QACjB;;;;iFAIyE;QACzE,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;YACxC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;gBAAE,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;iBACzD,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;gBAAE,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACpE,CAAC;QACD,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,QAAQ;YAAE,OAAO;QAC7C,IAAI,GAA4B,CAAC;QACjC,IAAI,CAAC;YAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAA4B,CAAC;QAAC,CAAC;QAAC,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KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;gBACtB,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;oBACzC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC;oBAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;oBAC/B,IAAI,CAAC,CAAC,gBAAgB;wBAAE,cAAc,GAAG,CAAC,CAAC,gBAAgB,CAAC;gBAC9D,CAAC;gBACD,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;oBACnB,OAAO,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,YAAY,EAAE,gBAAgB,EAAE,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC;gBACvF,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAuB,EAAE,CAAC;IACrC,IAAI,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7F,KAAK,MAAM,EAAE,IAAI,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEzC,OAAO;QACL,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,YAAY,EAAE,CAAC;QACjE,aAAa,EAAE,EAAE,gBAAgB,EAAE,YAAY,EAAE,oBAAoB,EAAE,UAAU,EAAE;KACpF,CAAC;AACJ,CAAC"}
|
|
@@ -71,7 +71,7 @@ export declare function getActiveBridges(opts?: DiscoveryOptions & {
|
|
|
71
71
|
export declare function resetBridgeCache(): void;
|
|
72
72
|
export declare const _internal: {
|
|
73
73
|
dedupePreservePrecedence: typeof dedupePreservePrecedence;
|
|
74
|
-
SOURCE_RANK: Record<"
|
|
74
|
+
SOURCE_RANK: Record<"env" | "manifest" | "file" | "loopback", number>;
|
|
75
75
|
};
|
|
76
76
|
export {};
|
|
77
77
|
//# sourceMappingURL=bridge_registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal_manifest.d.ts","sourceRoot":"","sources":["../../src/nac3/internal_manifest.ts"],"names":[],"mappings":"AAsBA,MAAM,MAAM,UAAU,GAClB,cAAc,GACd,SAAS,GACT,mBAAmB,GACnB,aAAa,GACb,eAAe,GACf,oBAAoB,CAAC;AAEzB,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,KAAK,GACL,YAAY,GACZ,SAAS,GACT,SAAS,GACT,cAAc,GACd,KAAK,CAAC;AAEV,MAAM,MAAM,QAAQ,GAChB,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,YAAY,GACZ,SAAS,GACT,QAAQ,GACR,YAAY,CAAC;AAEjB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;QACzB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;QAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QACzB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QAKnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;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,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CA2CzF;AAED;;sEAEsE;AACtE,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAI,GAAG,MAAM,EAAE,CAO/D"}
|
|
@@ -1777,6 +1777,7 @@ const VERBS = [
|
|
|
1777
1777
|
project_root: { type: 'string', description: 'Optional absolute path the sub-session works in. Default: the active project root.', maxLength: 500 },
|
|
1778
1778
|
budget_tokens: { type: 'number', description: 'Optional soft token budget across the sub-session turns (default 120000).' },
|
|
1779
1779
|
label: { type: 'string', description: 'Optional short label for the handle / listing.', maxLength: 80 },
|
|
1780
|
+
model: { type: 'string', description: 'Optional. PIN the sub-session brain as "provider/model" (e.g. "anthropic/claude-opus-5"). WITHOUT it the child inherits the global brain_config, so the brain comes out by OMISSION -- which is wrong whenever the brain is part of the point (an AUDIT by another session, a review, a second opinion: measured, a non-frontier auditor wrote 4 of the 9 findings it announced, with a false P0, where the frontier one wrote 17 verified). The slash is REQUIRED: Forge does not guess the provider from the model name, and an unknown provider is REFUSED instead of silently falling back to another.', maxLength: 200 },
|
|
1780
1781
|
},
|
|
1781
1782
|
required: ['task'],
|
|
1782
1783
|
},
|
|
@@ -2891,6 +2892,7 @@ const VERBS = [
|
|
|
2891
2892
|
test_files: { type: 'array', description: 'red_proof: the new test files, project-relative, carried into the base worktree.' },
|
|
2892
2893
|
timeout_ms: { type: 'number', maximum: 1800000, description: 'Max 1800000 (30 min). Over the blocking window (10 min) the run goes to the BACKGROUND and the verb returns a handle instead of the receipt.' },
|
|
2893
2894
|
background: { type: 'boolean', description: 'Launch the run DETACHED and return a handle instead of blocking the turn. Automatic when timeout_ms is over the blocking window. The receipt is written by the run itself: read it with yujin.evidence.list when it finishes.' },
|
|
2895
|
+
evidence: { type: 'string', enum: ['tests', 'exit_code'], description: 'Optional. WHAT THE EVIDENCE OF THIS COMMAND IS MADE OF. Default "tests": the command is a test runner and its printed counts are the evidence. Declare "exit_code" when the command is NOT a runner -- a security scan, a verifier, a check script -- and its exit code is the whole of its evidence: without it, a scan that exits 1 because it FOUND something was recorded not_ok, even though that failure is exactly what a red proof has to exhibit. It is a DECLARATION on purpose: from the data, "no counts because there is nothing to count" and "no counts because the parser does not know this format" look identical, and the second is NOT evidence (an unrecognised runner left three real red proofs counted as zero once). Does not apply to a MUTATION red: D-037 asks for a parsed test failure there.' },
|
|
2894
2896
|
note: { type: 'string', maxLength: 300 },
|
|
2895
2897
|
},
|
|
2896
2898
|
required: ['kind', 'command'],
|