@jini-ai/agent-runtime 0.7.3-next.1 → 0.7.3-next.3
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/CHANGELOG.md +10 -0
- package/README.md +38 -0
- package/dist/agent-protocol/acp/constants.d.ts +3 -0
- package/dist/agent-protocol/acp/constants.js +5 -0
- package/dist/agent-protocol/acp/models.d.ts +0 -10
- package/dist/agent-protocol/acp/models.js +6 -11
- package/dist/agent-protocol/acp/rpc.d.ts +5 -1
- package/dist/agent-protocol/acp/rpc.js +2 -1
- package/dist/agent-protocol/acp/session-permission.js +4 -3
- package/dist/agent-protocol/acp/session-results.d.ts +3 -3
- package/dist/agent-protocol/acp/session-results.js +22 -17
- package/dist/agent-protocol/acp/session-run.js +0 -8
- package/dist/agent-protocol/acp/session-types.d.ts +0 -1
- package/dist/agent-protocol/acp/session.js +3 -2
- package/dist/agent-protocol/acp/text-suppression.js +75 -71
- package/dist/agent-protocol/pi-rpc/events.d.ts +21 -4
- package/dist/agent-protocol/pi-rpc/events.js +8 -8
- package/dist/agent-protocol/pi-rpc/internal.d.ts +6 -2
- package/dist/agent-protocol/pi-rpc/internal.js +6 -4
- package/dist/agent-protocol/pi-rpc/session.js +4 -3
- package/dist/anthropic-live-models.js +0 -0
- package/dist/claude-code-models.d.ts +3 -1
- package/dist/claude-code-models.js +4 -4
- package/dist/cli-probe-cache.d.ts +33 -0
- package/dist/cli-probe-cache.js +59 -0
- package/dist/custom-instructions.d.ts +107 -0
- package/dist/custom-instructions.js +80 -0
- package/dist/defs/{aider.d.ts → aider/index.d.ts} +2 -1
- package/dist/defs/{aider.js → aider/index.js} +6 -3
- package/dist/defs/amr/executable-env.d.ts +2 -0
- package/dist/defs/amr/executable-env.js +2 -0
- package/dist/defs/amr/executable-resolution.d.ts +5 -1
- package/dist/defs/amr/executable-resolution.js +1 -1
- package/dist/defs/antigravity/index.d.ts +1 -0
- package/dist/defs/antigravity/index.js +3 -0
- package/dist/defs/antigravity/permissions.d.ts +26 -0
- package/dist/defs/antigravity/permissions.js +66 -0
- package/dist/defs/{auggie.d.ts → auggie/index.d.ts} +1 -1
- package/dist/defs/{auggie.js → auggie/index.js} +3 -3
- package/dist/defs/claude/config-dir.d.ts +62 -0
- package/dist/defs/claude/config-dir.js +133 -0
- package/dist/defs/claude/filesystem.d.ts +33 -0
- package/dist/defs/claude/filesystem.js +30 -0
- package/dist/defs/{claude.d.ts → claude/index.d.ts} +1 -1
- package/dist/defs/{claude.js → claude/index.js} +9 -9
- package/dist/defs/claude/mcp-config.d.ts +22 -0
- package/dist/defs/claude/mcp-config.js +29 -0
- package/dist/defs/claude/mcp-delivery.d.ts +57 -0
- package/dist/defs/claude/mcp-delivery.js +75 -0
- package/dist/defs/claude/mcp-json.d.ts +34 -0
- package/dist/defs/claude/mcp-json.js +38 -0
- package/dist/defs/claude/subagent-start.d.ts +12 -0
- package/dist/defs/claude/subagent-start.js +35 -0
- package/dist/defs/{cline.d.ts → cline/index.d.ts} +1 -1
- package/dist/defs/{cline.js → cline/index.js} +3 -3
- package/dist/defs/codex/contracts.d.ts +47 -0
- package/dist/defs/codex/contracts.js +6 -0
- package/dist/defs/codex/event-stream.d.ts +5 -1
- package/dist/defs/codex/event-stream.js +29 -24
- package/dist/defs/codex/home-config.d.ts +55 -0
- package/dist/defs/codex/home-config.js +224 -0
- package/dist/defs/codex/home-staging.d.ts +57 -0
- package/dist/defs/codex/home-staging.js +184 -0
- package/dist/defs/{codex.d.ts → codex/index.d.ts} +2 -2
- package/dist/defs/{codex.js → codex/index.js} +3 -3
- package/dist/defs/codex/isolation.d.ts +29 -0
- package/dist/defs/codex/isolation.js +69 -0
- package/dist/defs/codex/launch.d.ts +4 -1
- package/dist/defs/codex/launch.js +1 -1
- package/dist/defs/codex/mcp-delivery.d.ts +8 -0
- package/dist/defs/codex/mcp-delivery.js +5 -0
- package/dist/defs/{crush.d.ts → crush/index.d.ts} +1 -1
- package/dist/defs/{crush.js → crush/index.js} +3 -3
- package/dist/defs/cursor-agent/event-stream.d.ts +5 -1
- package/dist/defs/cursor-agent/event-stream.js +14 -7
- package/dist/defs/{cursor-agent.d.ts → cursor-agent/index.d.ts} +1 -1
- package/dist/defs/{cursor-agent.js → cursor-agent/index.js} +4 -4
- package/dist/defs/{deepseek.d.ts → deepseek/index.d.ts} +2 -1
- package/dist/defs/{deepseek.js → deepseek/index.js} +6 -3
- package/dist/defs/{devin.d.ts → devin/index.d.ts} +1 -1
- package/dist/defs/{devin.js → devin/index.js} +3 -3
- package/dist/defs/{droid.d.ts → droid/index.d.ts} +1 -1
- package/dist/defs/{droid.js → droid/index.js} +3 -3
- package/dist/defs/gemini/event-stream.d.ts +5 -1
- package/dist/defs/gemini/event-stream.js +15 -12
- package/dist/defs/gemini/tool-calls.d.ts +7 -0
- package/dist/defs/gemini/tool-calls.js +9 -0
- package/dist/defs/{goose.d.ts → goose/index.d.ts} +1 -1
- package/dist/defs/{goose.js → goose/index.js} +3 -3
- package/dist/defs/{grok-build.d.ts → grok-build/index.d.ts} +1 -1
- package/dist/defs/{grok-build.js → grok-build/index.js} +3 -3
- package/dist/defs/index.d.ts +28 -28
- package/dist/defs/index.js +28 -28
- package/dist/defs/{kilo.d.ts → kilo/index.d.ts} +1 -1
- package/dist/defs/{kilo.js → kilo/index.js} +3 -3
- package/dist/defs/kimi/event-stream.d.ts +4 -1
- package/dist/defs/kimi/event-stream.js +6 -5
- package/dist/defs/{kimi.d.ts → kimi/index.d.ts} +1 -1
- package/dist/defs/{kimi.js → kimi/index.js} +3 -3
- package/dist/defs/{kiro.d.ts → kiro/index.d.ts} +1 -1
- package/dist/defs/{kiro.js → kiro/index.js} +3 -3
- package/dist/defs/mimo/constants.d.ts +2 -0
- package/dist/defs/mimo/constants.js +2 -0
- package/dist/defs/{mimo.d.ts → mimo/index.d.ts} +1 -1
- package/dist/defs/{mimo.js → mimo/index.js} +3 -3
- package/dist/defs/opencode/constants.d.ts +2 -0
- package/dist/defs/opencode/constants.js +2 -0
- package/dist/defs/opencode/event-stream.d.ts +5 -1
- package/dist/defs/opencode/event-stream.js +13 -11
- package/dist/defs/{opencode.d.ts → opencode/index.d.ts} +2 -2
- package/dist/defs/{opencode.js → opencode/index.js} +5 -5
- package/dist/defs/opencode/mcp-config.d.ts +108 -0
- package/dist/defs/opencode/mcp-config.js +119 -0
- package/dist/defs/opencode/model-discovery.d.ts +3 -1
- package/dist/defs/opencode/model-discovery.js +1 -1
- package/dist/defs/opencode/tool-calls.d.ts +7 -0
- package/dist/defs/opencode/tool-calls.js +12 -0
- package/dist/defs/{opencode-acp.d.ts → opencode-acp/index.d.ts} +2 -2
- package/dist/defs/{opencode-acp.js → opencode-acp/index.js} +4 -4
- package/dist/defs/{pi.d.ts → pi/index.d.ts} +1 -1
- package/dist/defs/{pi.js → pi/index.js} +3 -3
- package/dist/defs/pi/model-discovery.d.ts +4 -1
- package/dist/defs/pi/model-discovery.js +1 -1
- package/dist/defs/{qoder.d.ts → qoder/index.d.ts} +1 -1
- package/dist/defs/{qoder.js → qoder/index.js} +3 -3
- package/dist/defs/{qwen.d.ts → qwen/index.d.ts} +1 -1
- package/dist/defs/{qwen.js → qwen/index.js} +3 -3
- package/dist/defs/{reasonix.d.ts → reasonix/index.d.ts} +1 -1
- package/dist/defs/{reasonix.js → reasonix/index.js} +3 -3
- package/dist/defs/{trae-cli.d.ts → trae-cli/index.d.ts} +1 -1
- package/dist/defs/{trae-cli.js → trae-cli/index.js} +3 -3
- package/dist/defs/{vibe.d.ts → vibe/index.d.ts} +1 -1
- package/dist/defs/{vibe.js → vibe/index.js} +3 -3
- package/dist/executables.js +1 -1
- package/dist/inventory/index.d.ts +61 -0
- package/dist/inventory/index.js +45 -0
- package/dist/json-event-stream-shared.d.ts +10 -2
- package/dist/json-event-stream-shared.js +21 -13
- package/dist/json-event-stream.js +6 -5
- package/dist/launch.js +1 -1
- package/dist/model-catalog-live-discovery.d.ts +103 -0
- package/dist/model-catalog-live-discovery.js +111 -0
- package/dist/model-discovery-adapters.d.ts +6 -1
- package/dist/model-discovery-adapters.js +4 -3
- package/dist/model-discovery-config.js +1 -1
- package/dist/native-permissions.d.ts +19 -0
- package/dist/native-permissions.js +22 -0
- package/dist/providers/connection-guard.js +98 -83
- package/dist/providers/connection-test.js +0 -5
- package/dist/providers/oauth-provider.d.ts +1 -23
- package/dist/providers/oauth-provider.js +1 -35
- package/dist/providers/tool-turn-types.d.ts +12 -9
- package/dist/providers/tool-turn.d.ts +63 -1
- package/dist/providers/tool-turn.js +66 -0
- package/dist/qoder-stream.js +66 -66
- package/dist/role-marker-guard.js +49 -30
- package/dist/runtime-def-binding.js +1 -1
- package/dist/runtime-port-bindings.d.ts +82 -0
- package/dist/runtime-port-bindings.js +4 -1
- package/dist/runtime-strategies.d.ts +100 -0
- package/dist/runtime-strategies.js +129 -0
- package/package.json +45 -11
- package/dist/defs/amp.d.ts +0 -2
- package/dist/defs/amp.js +0 -2
- package/dist/defs/amr.d.ts +0 -2
- package/dist/defs/amr.js +0 -2
- package/dist/defs/codebuddy.d.ts +0 -2
- package/dist/defs/codebuddy.js +0 -2
- package/dist/defs/hermes.d.ts +0 -2
- package/dist/defs/hermes.js +0 -2
|
@@ -8,7 +8,7 @@ import fs from 'node:fs';
|
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import { createJsonLineStream } from '../core/index.js';
|
|
10
10
|
import { mapPiRpcEvent } from './events.js';
|
|
11
|
-
import {
|
|
11
|
+
import { errorMessage, errorCode, getRecord } from './internal.js';
|
|
12
12
|
// Image forwarding budgets to prevent large synchronous base64 work.
|
|
13
13
|
/** Maximum number of images forwarded per prompt turn. */
|
|
14
14
|
export const MAX_IMAGE_COUNT = 10;
|
|
@@ -352,8 +352,9 @@ function handlePiAgentEnd(run) {
|
|
|
352
352
|
child.kill('SIGTERM');
|
|
353
353
|
}, gracefulShutdownMs);
|
|
354
354
|
}
|
|
355
|
-
function handlePiMessage({ run, raw }) {
|
|
356
|
-
|
|
355
|
+
function handlePiMessage({ run, raw: value }) {
|
|
356
|
+
const raw = getRecord({ value });
|
|
357
|
+
if (!raw)
|
|
357
358
|
return;
|
|
358
359
|
// Once finished (agent_end or abort), stop processing — the run is
|
|
359
360
|
// over, so no more agent events should be emitted. We still drain
|
|
Binary file
|
|
@@ -13,7 +13,9 @@ export declare const CLAUDE_CODE_INITIALIZE_REQUEST = "{\"type\":\"control_reque
|
|
|
13
13
|
export declare const CLAUDE_CODE_INITIALIZE_ARGS: readonly string[];
|
|
14
14
|
/** Strips the bracketed context-window variant marker (`claude-fable-5-1[1m]`) —
|
|
15
15
|
* `models.ts#sanitizeCustomModel` rejects brackets, and `--model` accepts the bare name. */
|
|
16
|
-
export declare function normalizeClaudePickerModelId(raw
|
|
16
|
+
export declare function normalizeClaudePickerModelId({ raw }: {
|
|
17
|
+
raw: string;
|
|
18
|
+
}, _optional?: Record<string, never>): string;
|
|
17
19
|
/** Outcome of parsing `~/.claude.json`. The failure reasons are distinct so the freshness guard can
|
|
18
20
|
* say WHY it skipped; the runtime treats every failure as "nothing to add". */
|
|
19
21
|
export type ClaudeCodePickerCacheParse = {
|
|
@@ -6,7 +6,7 @@ import { defaultRuntimeState } from './runtime-state.js';
|
|
|
6
6
|
* `codex debug models`.
|
|
7
7
|
*
|
|
8
8
|
* **Why this exists.** `claude` has no list-models subcommand, so without an `ANTHROPIC_API_KEY` the
|
|
9
|
-
* picker used to render `defs/claude.ts`'s hand-written `CLAUDE_FALLBACK_MODELS` and nothing else. A
|
|
9
|
+
* picker used to render `defs/claude/index.ts`'s hand-written `CLAUDE_FALLBACK_MODELS` and nothing else. A
|
|
10
10
|
* subscription-only install therefore never saw a new model (e.g. `claude-opus-5-5`) until someone
|
|
11
11
|
* edited that array and republished.
|
|
12
12
|
*
|
|
@@ -69,7 +69,7 @@ export const CLAUDE_CODE_INITIALIZE_ARGS = [
|
|
|
69
69
|
];
|
|
70
70
|
/** Strips the bracketed context-window variant marker (`claude-fable-5-1[1m]`) —
|
|
71
71
|
* `models.ts#sanitizeCustomModel` rejects brackets, and `--model` accepts the bare name. */
|
|
72
|
-
export function normalizeClaudePickerModelId(raw) {
|
|
72
|
+
export function normalizeClaudePickerModelId({ raw }, _optional = {}) {
|
|
73
73
|
return stripTrailingBracketGroup(raw).trim();
|
|
74
74
|
}
|
|
75
75
|
/** `x[1m]` -> `x`: drops a final `[...]` group (one containing no `]`); leaves `raw` alone otherwise.
|
|
@@ -103,7 +103,7 @@ export function parseClaudeCodePickerCache({ raw }, _optional = {}) {
|
|
|
103
103
|
const ids = cached
|
|
104
104
|
.map((entry) => (entry && typeof entry === 'object' ? entry.value : null))
|
|
105
105
|
.filter((value) => typeof value === 'string')
|
|
106
|
-
.map(normalizeClaudePickerModelId)
|
|
106
|
+
.map(raw => normalizeClaudePickerModelId({ raw }))
|
|
107
107
|
.filter((id) => id.length > 0);
|
|
108
108
|
return ids.length > 0 ? { ok: true, ids } : { ok: false, reason: 'no-usable-values' };
|
|
109
109
|
}
|
|
@@ -137,7 +137,7 @@ function initializeEntryRows(entry) {
|
|
|
137
137
|
const rows = [];
|
|
138
138
|
const displayName = typeof entry.displayName === 'string' ? entry.displayName : '';
|
|
139
139
|
for (const raw of [entry.value, entry.resolvedModel]) {
|
|
140
|
-
const id = typeof raw === 'string' ? normalizeClaudePickerModelId(raw) : 'default';
|
|
140
|
+
const id = typeof raw === 'string' ? normalizeClaudePickerModelId({ raw }) : 'default';
|
|
141
141
|
// A non-string value contributes nothing, same as the `default` sentinel.
|
|
142
142
|
if (id === 'default' || sanitizeCustomModel({ id: id }) !== id)
|
|
143
143
|
continue;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Background inventory caching for detected CLIs; the host injects the probe (its inventory port).
|
|
2
|
+
* Discovery stays behind the existing runtime port; requests only read settled snapshots. */
|
|
3
|
+
/** The shared probe tail: caches given the same queue never launch overlapping CLI sweeps.
|
|
4
|
+
* Host-owned (one per process is typical) so this module keeps no state of its own. */
|
|
5
|
+
export interface CliProbeQueue {
|
|
6
|
+
tail: Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
/** A fresh, idle probe queue for {@link createCliProbeCache}'s `probeQueue`. */
|
|
9
|
+
export declare function createCliProbeQueue(_required?: Record<string, never>, _optional?: Record<string, never>): CliProbeQueue;
|
|
10
|
+
/** One inventory per host port. Catalog expiry schedules a lazy background refresh.
|
|
11
|
+
* Failed scans keep the snapshot until the optional retry cooldown; explicit Rescan always retries.
|
|
12
|
+
* A rescan during a scan coalesces into one forced follow-up, never a second concurrent sweep.
|
|
13
|
+
* @complexity O(1) bookkeeping; snapshot/probe cost belongs to the injected inventory port. */
|
|
14
|
+
export declare function createCliProbeCache<T>({ initial, probe, probeQueue }: {
|
|
15
|
+
initial: () => T;
|
|
16
|
+
probe: (input: {
|
|
17
|
+
force: boolean;
|
|
18
|
+
}, options: Record<string, never>) => Promise<T>;
|
|
19
|
+
probeQueue: CliProbeQueue;
|
|
20
|
+
}, { expiresAt, retryAfterMs }?: {
|
|
21
|
+
expiresAt?: (input: {
|
|
22
|
+
snapshot: T;
|
|
23
|
+
}, options: Record<string, never>) => number;
|
|
24
|
+
retryAfterMs?: number;
|
|
25
|
+
}): {
|
|
26
|
+
isPending(_input: Record<string, never>, _options?: Record<string, never>): boolean;
|
|
27
|
+
read({ force }: {
|
|
28
|
+
force?: boolean;
|
|
29
|
+
}, _options?: Record<string, never>): Promise<T>;
|
|
30
|
+
/** Explicit completion port for diagnostics/tests; HTTP readers never call it. */
|
|
31
|
+
settled(_input: Record<string, never>, _options?: Record<string, never>): Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=cli-probe-cache.d.ts.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Background inventory caching for detected CLIs; the host injects the probe (its inventory port).
|
|
2
|
+
* Discovery stays behind the existing runtime port; requests only read settled snapshots. */
|
|
3
|
+
/** A fresh, idle probe queue for {@link createCliProbeCache}'s `probeQueue`. */
|
|
4
|
+
export function createCliProbeQueue(_required = {}, _optional = {}) {
|
|
5
|
+
return { tail: Promise.resolve() };
|
|
6
|
+
}
|
|
7
|
+
/** One inventory per host port. Catalog expiry schedules a lazy background refresh.
|
|
8
|
+
* Failed scans keep the snapshot until the optional retry cooldown; explicit Rescan always retries.
|
|
9
|
+
* A rescan during a scan coalesces into one forced follow-up, never a second concurrent sweep.
|
|
10
|
+
* @complexity O(1) bookkeeping; snapshot/probe cost belongs to the injected inventory port. */
|
|
11
|
+
export function createCliProbeCache({ initial, probe, probeQueue }, { expiresAt, retryAfterMs } = {}) {
|
|
12
|
+
let snapshot;
|
|
13
|
+
let pending;
|
|
14
|
+
let started = false;
|
|
15
|
+
let rescanQueued = false;
|
|
16
|
+
let snapshotExpiresAt = Infinity;
|
|
17
|
+
function refresh({ force }, _options = {}) {
|
|
18
|
+
if (pending) {
|
|
19
|
+
rescanQueued ||= force;
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
started = true;
|
|
23
|
+
// Let the request serialize its cached response before even launching the first CLI.
|
|
24
|
+
const turn = new Promise(resolve => { setImmediate(resolve); });
|
|
25
|
+
pending = probeQueue.tail.then(() => turn).then(async () => {
|
|
26
|
+
try {
|
|
27
|
+
const result = await probe({ force }, {});
|
|
28
|
+
snapshotExpiresAt = expiresAt?.({ snapshot: result }, {}) ?? Infinity;
|
|
29
|
+
snapshot = Promise.resolve(result);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Keep last-good data without hammering a failing host or caching an initial failure forever.
|
|
33
|
+
snapshotExpiresAt = retryAfterMs === undefined ? Infinity : Date.now() + retryAfterMs;
|
|
34
|
+
}
|
|
35
|
+
}).finally(() => {
|
|
36
|
+
pending = undefined;
|
|
37
|
+
if (rescanQueued) {
|
|
38
|
+
rescanQueued = false;
|
|
39
|
+
refresh({ force: true });
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
probeQueue.tail = pending;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
isPending(_input, _options = {}) { return pending !== undefined; },
|
|
46
|
+
read({ force = false }, _options = {}) {
|
|
47
|
+
snapshot ??= Promise.resolve(initial());
|
|
48
|
+
if (!started || force || snapshotExpiresAt <= Date.now())
|
|
49
|
+
refresh({ force });
|
|
50
|
+
return snapshot;
|
|
51
|
+
},
|
|
52
|
+
/** Explicit completion port for diagnostics/tests; HTTP readers never call it. */
|
|
53
|
+
async settled(_input, _options = {}) {
|
|
54
|
+
while (pending)
|
|
55
|
+
await pending;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=cli-probe-cache.js.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { UUID } from "@jini-ai/core/primitives";
|
|
2
|
+
import type { SettingsRepoPort } from "@jini-ai/core/settings";
|
|
3
|
+
/**
|
|
4
|
+
* Structural signature matching `@jini-ai/core/settings`'s real `getEffective` export (a host may
|
|
5
|
+
* re-export it from its own settings feature). Redeclared locally rather than imported as a value:
|
|
6
|
+
* importing the FUNCTION here is the edge that would close an `[assistant, settings]` module cycle in
|
|
7
|
+
* a host whose settings feature registers assistant tool contributors; see `ResolveCustomInstructionsDeps.getEffective`'s own doc for
|
|
8
|
+
* how the real function still reaches this file despite the type living here instead of being
|
|
9
|
+
* imported. `.value` is typed `unknown` (not `JsonValue`) because this file only ever narrows it with
|
|
10
|
+
* `typeof ... === "string"` below — no caller here needs the full settings-value union.
|
|
11
|
+
*/
|
|
12
|
+
type GetEffective = (required: {
|
|
13
|
+
deps: {
|
|
14
|
+
repo: SettingsRepoPort;
|
|
15
|
+
};
|
|
16
|
+
namespace: string;
|
|
17
|
+
key: string;
|
|
18
|
+
scopeContext: {
|
|
19
|
+
workspaceId: UUID;
|
|
20
|
+
};
|
|
21
|
+
}) => Promise<{
|
|
22
|
+
value: unknown;
|
|
23
|
+
} | null>;
|
|
24
|
+
export interface ResolveCustomInstructionsDeps {
|
|
25
|
+
settingsRepo: SettingsRepoPort;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves once boot-time definition registration for `core.instructions.*`
|
|
28
|
+
* (the host's settings-tabs-ready promise) completes. Awaited before every read so a read that races
|
|
29
|
+
* boot reads as "not yet registered" (falls through to `""`) rather than being misinterpreted —
|
|
30
|
+
* the same discipline the host's settings-ready promise requires of every settings consumer.
|
|
31
|
+
* Optional so a test that registers definitions itself before calling in doesn't need to thread a
|
|
32
|
+
* dummy resolved promise through.
|
|
33
|
+
* @default Promise.resolve()
|
|
34
|
+
*/
|
|
35
|
+
settingsReady?: Promise<void>;
|
|
36
|
+
/** The real `@jini-ai/core/settings` `getEffective` — injected rather than statically imported;
|
|
37
|
+
* see the `GetEffective` type's own doc. Wired to the real implementation at the host's
|
|
38
|
+
* composition root. */
|
|
39
|
+
getEffective: GetEffective;
|
|
40
|
+
/** The host settings feature's `INSTRUCTIONS_NAMESPACE` constant (e.g. `"core.instructions"`) —
|
|
41
|
+
* injected for uniformity with `getEffective` above rather than relocated to a new shared module,
|
|
42
|
+
* so this module never takes a runtime edge on the host's settings barrel. */
|
|
43
|
+
instructionsNamespace: string;
|
|
44
|
+
/**
|
|
45
|
+
* Receives the fail-open read's message and error (see `resolveCustomInstructions`). Injected so
|
|
46
|
+
* the host owns its log sink and any log-line prefix; the engine never writes to the console.
|
|
47
|
+
*/
|
|
48
|
+
warn: (message: string, error: unknown) => void;
|
|
49
|
+
}
|
|
50
|
+
export interface ResolveCustomInstructionsInput {
|
|
51
|
+
workspaceId: UUID;
|
|
52
|
+
}
|
|
53
|
+
/** The single object argument both entry points take: the injected deps plus the per-call input. */
|
|
54
|
+
export type ResolveCustomInstructionsArgs = ResolveCustomInstructionsDeps & ResolveCustomInstructionsInput;
|
|
55
|
+
/**
|
|
56
|
+
* Reads `core.instructions.custom` fresh from the ledger for one workspace. getEffective owns
|
|
57
|
+
* fresh reads; see the header for why independent processes cannot rely on cache invalidation.
|
|
58
|
+
*
|
|
59
|
+
* FAILS OPEN: any error (a repo I/O failure, `settingsReady` rejecting, a malformed stored value) is
|
|
60
|
+
* logged and reads as `""` — a broken settings read must degrade the assistant to "no custom
|
|
61
|
+
* instructions", never block a run from starting at all. This restates, at the one call site here
|
|
62
|
+
* that cannot assume it, `getEffective`'s own documented "total, never throws" contract — the
|
|
63
|
+
* evaluator logic above the repo is exempt from throwing; the repo's actual I/O underneath it is not.
|
|
64
|
+
*
|
|
65
|
+
* @complexity O(1) — one `getEffective` resolution.
|
|
66
|
+
* @overallScore 100
|
|
67
|
+
*/
|
|
68
|
+
export declare function resolveCustomInstructions(args: ResolveCustomInstructionsArgs, _optional?: {}): Promise<string>;
|
|
69
|
+
/**
|
|
70
|
+
* Formats a raw `core.instructions.custom` value as a `PromptAugmenter.systemOverlay()` block, or
|
|
71
|
+
* `null` for empty/whitespace-only text — matching that seam's own "if non-null" contract
|
|
72
|
+
* (`@jini-ai/agent-runtime`'s `prompt-augmenter.ts`) so an operator who has never set instructions
|
|
73
|
+
* (or has cleared them back to the tab's empty-textarea default) gets byte-identical behavior to
|
|
74
|
+
* before this file existed.
|
|
75
|
+
*
|
|
76
|
+
* @complexity O(n) in the length of `customInstructions` — one trim, one length check.
|
|
77
|
+
* @overallScore 100
|
|
78
|
+
*/
|
|
79
|
+
export declare function formatCustomInstructionsOverlay({ customInstructions }: {
|
|
80
|
+
customInstructions: string;
|
|
81
|
+
}, _optional?: {}): string | null;
|
|
82
|
+
export interface CustomInstructionsCache {
|
|
83
|
+
/**
|
|
84
|
+
* Re-resolves `core.instructions.custom` and updates what `readOverlay()` returns next. Never
|
|
85
|
+
* rejects — inherits `resolveCustomInstructions`'s fail-open contract.
|
|
86
|
+
*/
|
|
87
|
+
refresh(): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Synchronous read of the last successfully refreshed value, formatted per
|
|
90
|
+
* `formatCustomInstructionsOverlay`. `null` before the first `refresh()` ever resolves, which is
|
|
91
|
+
* indistinguishable from "no custom instructions set" — the only value `systemOverlay()`'s
|
|
92
|
+
* synchronous contract allows before any async read has had a chance to complete.
|
|
93
|
+
*/
|
|
94
|
+
readOverlay(): string | null;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The synchronous-read bridge this file's header describes. The host daemon constructs one
|
|
98
|
+
* instance for its single workspace, calls `refresh()` once per run start (before starting the
|
|
99
|
+
* agent, so the read is never older than "as of this conversation turn"), and wires `readOverlay`
|
|
100
|
+
* into `PromptAugmenter.systemOverlay()`.
|
|
101
|
+
*
|
|
102
|
+
* @complexity O(1) to construct; `refresh()` is `resolveCustomInstructions`'s O(1).
|
|
103
|
+
* @overallScore 100
|
|
104
|
+
*/
|
|
105
|
+
export declare function createCustomInstructionsCache(args: ResolveCustomInstructionsArgs, _optional?: {}): CustomInstructionsCache;
|
|
106
|
+
export {};
|
|
107
|
+
//# sourceMappingURL=custom-instructions.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The read half of the admin Instructions tab's system-prompt seam: turns the stored
|
|
3
|
+
* `core.instructions.custom` value into text the host daemon's `PromptAugmenter.
|
|
4
|
+
* systemOverlay()` hands the spawned agent CLI. Prompt assembly belongs to the daemon process.
|
|
5
|
+
*
|
|
6
|
+
* `getEffective` must read fresh values: main-server writes cannot invalidate a cache keyed by
|
|
7
|
+
* this daemon's independent repository instance. An indexed local row read is cheaper than
|
|
8
|
+
* cross-process cache incoherence; see the owning settings module's cache rationale.
|
|
9
|
+
*
|
|
10
|
+
* `PromptAugmenter.systemOverlay()` returns synchronously, while the settings read is async.
|
|
11
|
+
* `createCustomInstructionsCache` holds the last successfully resolved value; the caller refreshes
|
|
12
|
+
* it before each run so the synchronous overlay can read it without I/O.
|
|
13
|
+
*/
|
|
14
|
+
const CUSTOM_INSTRUCTIONS_KEY = "custom";
|
|
15
|
+
/**
|
|
16
|
+
* Reads `core.instructions.custom` fresh from the ledger for one workspace. getEffective owns
|
|
17
|
+
* fresh reads; see the header for why independent processes cannot rely on cache invalidation.
|
|
18
|
+
*
|
|
19
|
+
* FAILS OPEN: any error (a repo I/O failure, `settingsReady` rejecting, a malformed stored value) is
|
|
20
|
+
* logged and reads as `""` — a broken settings read must degrade the assistant to "no custom
|
|
21
|
+
* instructions", never block a run from starting at all. This restates, at the one call site here
|
|
22
|
+
* that cannot assume it, `getEffective`'s own documented "total, never throws" contract — the
|
|
23
|
+
* evaluator logic above the repo is exempt from throwing; the repo's actual I/O underneath it is not.
|
|
24
|
+
*
|
|
25
|
+
* @complexity O(1) — one `getEffective` resolution.
|
|
26
|
+
* @overallScore 100
|
|
27
|
+
*/
|
|
28
|
+
export async function resolveCustomInstructions(args, _optional = {}) {
|
|
29
|
+
try {
|
|
30
|
+
await (args.settingsReady ?? Promise.resolve());
|
|
31
|
+
const resolved = await args.getEffective({
|
|
32
|
+
deps: { repo: args.settingsRepo },
|
|
33
|
+
namespace: args.instructionsNamespace,
|
|
34
|
+
key: CUSTOM_INSTRUCTIONS_KEY,
|
|
35
|
+
scopeContext: { workspaceId: args.workspaceId },
|
|
36
|
+
});
|
|
37
|
+
return typeof resolved?.value === "string" ? resolved.value : "";
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
args.warn("resolveCustomInstructions failed; treating as unset", error);
|
|
41
|
+
return "";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const CUSTOM_INSTRUCTIONS_OVERLAY_HEADER = "The site operator has configured the following custom instructions for this assistant. Follow " +
|
|
45
|
+
"them in addition to your default behavior, and defer to them if they conflict with it:";
|
|
46
|
+
/**
|
|
47
|
+
* Formats a raw `core.instructions.custom` value as a `PromptAugmenter.systemOverlay()` block, or
|
|
48
|
+
* `null` for empty/whitespace-only text — matching that seam's own "if non-null" contract
|
|
49
|
+
* (`@jini-ai/agent-runtime`'s `prompt-augmenter.ts`) so an operator who has never set instructions
|
|
50
|
+
* (or has cleared them back to the tab's empty-textarea default) gets byte-identical behavior to
|
|
51
|
+
* before this file existed.
|
|
52
|
+
*
|
|
53
|
+
* @complexity O(n) in the length of `customInstructions` — one trim, one length check.
|
|
54
|
+
* @overallScore 100
|
|
55
|
+
*/
|
|
56
|
+
export function formatCustomInstructionsOverlay({ customInstructions }, _optional = {}) {
|
|
57
|
+
const trimmed = customInstructions.trim();
|
|
58
|
+
return trimmed.length === 0 ? null : `${CUSTOM_INSTRUCTIONS_OVERLAY_HEADER}\n\n${trimmed}`;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The synchronous-read bridge this file's header describes. The host daemon constructs one
|
|
62
|
+
* instance for its single workspace, calls `refresh()` once per run start (before starting the
|
|
63
|
+
* agent, so the read is never older than "as of this conversation turn"), and wires `readOverlay`
|
|
64
|
+
* into `PromptAugmenter.systemOverlay()`.
|
|
65
|
+
*
|
|
66
|
+
* @complexity O(1) to construct; `refresh()` is `resolveCustomInstructions`'s O(1).
|
|
67
|
+
* @overallScore 100
|
|
68
|
+
*/
|
|
69
|
+
export function createCustomInstructionsCache(args, _optional = {}) {
|
|
70
|
+
let latest = "";
|
|
71
|
+
return {
|
|
72
|
+
async refresh() {
|
|
73
|
+
latest = await resolveCustomInstructions(args);
|
|
74
|
+
},
|
|
75
|
+
readOverlay() {
|
|
76
|
+
return formatCustomInstructionsOverlay({ customInstructions: latest });
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=custom-instructions.js.map
|
|
@@ -15,6 +15,7 @@ export declare const aiderAgentDef: {
|
|
|
15
15
|
runtimeContext?: import("@jini-ai/core/contracts/agents").RuntimeContext;
|
|
16
16
|
} | undefined) => string[];
|
|
17
17
|
maxPromptArgBytes: number;
|
|
18
|
+
argvPromptPosition: "last";
|
|
18
19
|
streamFormat: string;
|
|
19
20
|
installUrl: string;
|
|
20
21
|
docsUrl: string;
|
|
@@ -34,4 +35,4 @@ export declare const aiderAgentDef: {
|
|
|
34
35
|
deps?: import("@jini-ai/core/contracts/agents").ModelDiscoveryDeps;
|
|
35
36
|
}): Promise<import("@jini-ai/core/contracts/agents").DefaultModelResolution>;
|
|
36
37
|
};
|
|
37
|
-
//# sourceMappingURL=
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '
|
|
2
|
-
import { DEFAULT_MODEL_OPTION } from '
|
|
1
|
+
import { createAgentModelDiscovery } from '../../model-discovery-native.js';
|
|
2
|
+
import { DEFAULT_MODEL_OPTION } from '../shared.js';
|
|
3
3
|
export const aiderAgentDef = {
|
|
4
4
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
|
5
5
|
...createAgentModelDiscovery('aider', { fallbackModels: () => aiderAgentDef.fallbackModels }),
|
|
@@ -72,6 +72,9 @@ export const aiderAgentDef = {
|
|
|
72
72
|
return args;
|
|
73
73
|
},
|
|
74
74
|
maxPromptArgBytes: 30_000,
|
|
75
|
+
// `buildArgs` pushes the prompt verbatim as the final argv element (pinned by
|
|
76
|
+
// `defs/__tests__/argv-prompt-position.test.ts`), so prompt variants may fit that slot.
|
|
77
|
+
argvPromptPosition: 'last',
|
|
75
78
|
streamFormat: 'plain',
|
|
76
79
|
installUrl: 'https://aider.chat/docs/install.html',
|
|
77
80
|
docsUrl: 'https://aider.chat',
|
|
@@ -83,4 +86,4 @@ export const aiderAgentDef = {
|
|
|
83
86
|
// is nowhere for a bridged tool call to land. Revisit if upstream ships a
|
|
84
87
|
// client.
|
|
85
88
|
};
|
|
86
|
-
//# sourceMappingURL=
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -3,5 +3,9 @@ export declare function resolveAmrCompanion({ options, services }: {
|
|
|
3
3
|
options: ResolvedExecutableOptions;
|
|
4
4
|
services: ExecutableResolutionHelpers;
|
|
5
5
|
}, _optional?: Record<string, never>): string | null;
|
|
6
|
-
export declare function packagedAmrExecutable(configuredEnv
|
|
6
|
+
export declare function packagedAmrExecutable({ configuredEnv, options, services }: {
|
|
7
|
+
configuredEnv: Record<string, string>;
|
|
8
|
+
options: ResolvedExecutableOptions;
|
|
9
|
+
services: ExecutableResolutionHelpers;
|
|
10
|
+
}, _optional?: Record<string, never>): string | null;
|
|
7
11
|
//# sourceMappingURL=executable-resolution.d.ts.map
|
|
@@ -36,7 +36,7 @@ function packagedVelaOpenCodeCompanionTree(resourceRoot, options, services) {
|
|
|
36
36
|
}
|
|
37
37
|
return services.isRunnableFile(path.join(candidate, services.platformExecutableName({ name: 'opencode' })), options) ? candidate : null;
|
|
38
38
|
}
|
|
39
|
-
export function packagedAmrExecutable(configuredEnv, options, services) {
|
|
39
|
+
export function packagedAmrExecutable({ configuredEnv, options, services }, _optional = {}) {
|
|
40
40
|
const resourceRoot = services.resourceRootOf(options);
|
|
41
41
|
if (!resourceRoot)
|
|
42
42
|
return null;
|
|
@@ -258,6 +258,9 @@ export const antigravityAgentDef = {
|
|
|
258
258
|
// deepseek) rather than `promptViaStdin`. Without one of these three
|
|
259
259
|
// fields `assessAgentExecutorCompatibility` rejects the def outright.
|
|
260
260
|
maxPromptArgBytes: 30_000,
|
|
261
|
+
// `buildArgs` pushes the prompt verbatim as the final argv element (pinned by
|
|
262
|
+
// `defs/__tests__/argv-prompt-position.test.ts`), so prompt variants may fit that slot.
|
|
263
|
+
argvPromptPosition: 'last',
|
|
261
264
|
// Structured receipts enable native-tool auditing; they do not enforce an OFF switch.
|
|
262
265
|
// agy's CLI reference exposes no run-scoped settings/permission/MCP override. Global settings
|
|
263
266
|
// writes race other runs, and relocating HOME breaks auth, so audited output alone cannot grant this.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AtomicFileWriterPort, FileLockPort } from '@jini-ai/core/contracts/runtime';
|
|
2
|
+
/**
|
|
3
|
+
* Persist one server's MCP grant for agy, which has no run-scoped settings override.
|
|
4
|
+
* Holds the host's lock and writes through the host's atomic writer, which also keeps the first
|
|
5
|
+
* existing file as a backup (lock, then backup, then write; the lock is released on every path).
|
|
6
|
+
* Invalid settings and I/O failures reject before spawn rather than widening permissions.
|
|
7
|
+
* @complexity O(settings bytes), including the allow-list scan; bounded by the settings file.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ensureAntigravityMcpPermission({ settingsPath, serverName, fileLock, writer }: {
|
|
10
|
+
settingsPath: string;
|
|
11
|
+
serverName: string;
|
|
12
|
+
fileLock: FileLockPort;
|
|
13
|
+
writer: AtomicFileWriterPort;
|
|
14
|
+
}, _options?: Record<string, never>): Promise<void>;
|
|
15
|
+
/** Prepare this CLI's persistent MCP permission before an env-passthrough launch. */
|
|
16
|
+
export declare function prepareAntigravityBridge({ delivery, serverName, fileLock, writer }: {
|
|
17
|
+
delivery: {
|
|
18
|
+
readonly kind: string;
|
|
19
|
+
} | null;
|
|
20
|
+
serverName: string;
|
|
21
|
+
fileLock: FileLockPort;
|
|
22
|
+
writer: AtomicFileWriterPort;
|
|
23
|
+
}, { ensurePermission }: {
|
|
24
|
+
ensurePermission: typeof ensureAntigravityMcpPermission;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { homedir } from 'node:os';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { promises as fs } from 'node:fs';
|
|
4
|
+
import { getRecord } from '../../json-event-stream-shared.js';
|
|
5
|
+
/** Read the current settings text; a missing file is undefined, every other failure rejects. */
|
|
6
|
+
async function readSettingsText(settingsPath) {
|
|
7
|
+
try {
|
|
8
|
+
return await fs.readFile(settingsPath, 'utf8');
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
if (error.code !== 'ENOENT')
|
|
12
|
+
throw error;
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/** Parse and validate the settings shape; anything unexpected rejects rather than widening permissions. */
|
|
17
|
+
function parseSettings(raw) {
|
|
18
|
+
const settings = getRecord({ value: raw === undefined ? {} : JSON.parse(raw) });
|
|
19
|
+
if (!settings)
|
|
20
|
+
throw new Error('Antigravity settings must be an object');
|
|
21
|
+
const permissions = getRecord({ value: settings.permissions === undefined ? {} : settings.permissions });
|
|
22
|
+
if (!permissions || (permissions.allow !== undefined && !Array.isArray(permissions.allow))) {
|
|
23
|
+
throw new Error('Antigravity permissions.allow must be an array');
|
|
24
|
+
}
|
|
25
|
+
return { settings, permissions, allow: permissions.allow ?? [] };
|
|
26
|
+
}
|
|
27
|
+
/** The allow list holding exactly one copy of rule (first occurrence kept, order otherwise
|
|
28
|
+
* unchanged), or null when it already holds exactly one and nothing needs writing. */
|
|
29
|
+
function grantedAllowList(allow, rule) {
|
|
30
|
+
const first = allow.indexOf(rule);
|
|
31
|
+
if (first < 0)
|
|
32
|
+
return [...allow, rule];
|
|
33
|
+
const deduped = allow.filter((entry, index) => entry !== rule || index === first);
|
|
34
|
+
return deduped.length === allow.length ? null : deduped;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Persist one server's MCP grant for agy, which has no run-scoped settings override.
|
|
38
|
+
* Holds the host's lock and writes through the host's atomic writer, which also keeps the first
|
|
39
|
+
* existing file as a backup (lock, then backup, then write; the lock is released on every path).
|
|
40
|
+
* Invalid settings and I/O failures reject before spawn rather than widening permissions.
|
|
41
|
+
* @complexity O(settings bytes), including the allow-list scan; bounded by the settings file.
|
|
42
|
+
*/
|
|
43
|
+
export async function ensureAntigravityMcpPermission({ settingsPath, serverName, fileLock, writer }, _options = {}) {
|
|
44
|
+
if (!/^[\w.-]+$/.test(serverName))
|
|
45
|
+
throw new Error('Invalid MCP server name');
|
|
46
|
+
const rule = `mcp(${serverName}/*)`;
|
|
47
|
+
await fileLock.withFileLock({ lockPath: `${settingsPath}.jini-lock`, run: async () => {
|
|
48
|
+
const raw = await readSettingsText(settingsPath);
|
|
49
|
+
const { settings, permissions, allow } = parseSettings(raw);
|
|
50
|
+
const nextAllow = grantedAllowList(allow, rule);
|
|
51
|
+
if (nextAllow === null)
|
|
52
|
+
return;
|
|
53
|
+
if (raw !== undefined)
|
|
54
|
+
await writer.backupOriginalOnce({ filePath: settingsPath });
|
|
55
|
+
await writer.writeText({ filePath: settingsPath, content: `${JSON.stringify({
|
|
56
|
+
...settings, permissions: { ...permissions, allow: nextAllow },
|
|
57
|
+
}, null, 2)}\n` }, { refuseSymlink: true });
|
|
58
|
+
} }, { createParent: true, timeoutMs: 5000 });
|
|
59
|
+
}
|
|
60
|
+
/** Prepare this CLI's persistent MCP permission before an env-passthrough launch. */
|
|
61
|
+
export async function prepareAntigravityBridge({ delivery, serverName, fileLock, writer }, { ensurePermission }) {
|
|
62
|
+
if (delivery?.kind !== 'env-passthrough')
|
|
63
|
+
return;
|
|
64
|
+
await ensurePermission({ settingsPath: join(homedir(), '.gemini', 'antigravity-cli', 'settings.json'), serverName, fileLock, writer });
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=permissions.js.map
|
|
@@ -30,4 +30,4 @@ export declare const auggieAgentDef: {
|
|
|
30
30
|
deps?: import("@jini-ai/core/contracts/agents").ModelDiscoveryDeps;
|
|
31
31
|
}): Promise<import("@jini-ai/core/contracts/agents").DefaultModelResolution>;
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAgentModelDiscovery } from '
|
|
1
|
+
import { createAgentModelDiscovery } from '../../model-discovery-native.js';
|
|
2
2
|
/**
|
|
3
3
|
* @module defs/auggie
|
|
4
4
|
*
|
|
@@ -7,7 +7,7 @@ import { createAgentModelDiscovery } from '../model-discovery-native.js';
|
|
|
7
7
|
* (<https://github.com/agentclientprotocol/registry>, `auggie/agent.json`). Sign-in is
|
|
8
8
|
* `auggie login` in a terminal.
|
|
9
9
|
*/
|
|
10
|
-
import { acpModelFetcher, DEFAULT_MODEL_OPTION } from '
|
|
10
|
+
import { acpModelFetcher, DEFAULT_MODEL_OPTION } from '../shared.js';
|
|
11
11
|
export const auggieAgentDef = {
|
|
12
12
|
// UNVERIFIED live integration locally; source/category and limits are documented in model-discovery-adapters.ts.
|
|
13
13
|
...createAgentModelDiscovery('auggie', { fallbackModels: () => auggieAgentDef.fallbackModels }),
|
|
@@ -24,4 +24,4 @@ export const auggieAgentDef = {
|
|
|
24
24
|
// `acp-json-rpc` def — see `types.ts#RuntimeAgentDef.imageDelivery`'s doc.
|
|
25
25
|
imageDelivery: 'native',
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export declare const CLAUDE_CONFIG_DIR_ENV = "CLAUDE_CONFIG_DIR";
|
|
2
|
+
/** A staged, run-scoped `claude` CLI config directory and the release of everything it holds. */
|
|
3
|
+
export type PreparedClaudeConfigDir = {
|
|
4
|
+
/** Absolute path to hand to the spawned child as its `CLAUDE_CONFIG_DIR` env var. */
|
|
5
|
+
readonly path: string;
|
|
6
|
+
/** Recursively removes the staged directory — it may hold a copied login credential (see {@link prepareClaudeConfigDirForRun}'s doc). Safe to call more than once. */
|
|
7
|
+
readonly cleanup: () => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
/** The staging mechanism's filesystem seams, all required once resolved. */
|
|
10
|
+
export interface ClaudeConfigDirSeams {
|
|
11
|
+
readonly mkdtemp: ({ prefix }: {
|
|
12
|
+
readonly prefix: string;
|
|
13
|
+
}) => Promise<string>;
|
|
14
|
+
readonly readFile: ({ path }: {
|
|
15
|
+
readonly path: string;
|
|
16
|
+
}) => Promise<string>;
|
|
17
|
+
readonly writeFile: ({ path, content }: {
|
|
18
|
+
readonly path: string;
|
|
19
|
+
readonly content: string;
|
|
20
|
+
}) => Promise<void>;
|
|
21
|
+
readonly removeDir: ({ path }: {
|
|
22
|
+
readonly path: string;
|
|
23
|
+
}) => Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Where `claude`'s own config resolution reads the operator's REAL config from, to seed a run's
|
|
27
|
+
* scratch copy — never where it writes. Mirrors `resolveSourceCodexHomeDir`'s exact reasoning
|
|
28
|
+
* and resolution order: `CLAUDE_CONFIG_DIR` is not in `BASELINE_AGENT_ENV_KEYS`, so a spawned child
|
|
29
|
+
* never inherits it anyway — the whole point is finding wherever the *operator's actual* Claude Code
|
|
30
|
+
* install lives, a host-machine fact resolved against the daemon HOST process's own environment.
|
|
31
|
+
* @param hostEnv - The daemon process's own environment.
|
|
32
|
+
* @returns `hostEnv.CLAUDE_CONFIG_DIR` when set to a non-blank value (matching Claude Code's own
|
|
33
|
+
* resolution order, confirmed against installed Claude Code 2.1.263), else the CLI's documented
|
|
34
|
+
* default, `~/.claude`.
|
|
35
|
+
* @complexity O(1).
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveSourceClaudeConfigDir({ hostEnv }: {
|
|
38
|
+
readonly hostEnv: NodeJS.ProcessEnv;
|
|
39
|
+
}): string;
|
|
40
|
+
/**
|
|
41
|
+
* Finding 1 of SEC-assistant-env-isolation-2026-09-07's one effect — stages this run's scratch
|
|
42
|
+
* `CLAUDE_CONFIG_DIR` directory, returning the prepared handle the launcher's `cleanupStagedFiles` should later
|
|
43
|
+
* release (see {@link prepareClaudeConfigDirForRun}'s own doc for why this is unconditional for `claude` runs, unlike
|
|
44
|
+
* the Codex home's gate on a host-configured MCP bridge strategy).
|
|
45
|
+
*
|
|
46
|
+
* Bound only to the real `claude` CLI's own definition id (`runtime-strategies.ts`) rather than to
|
|
47
|
+
* `externalMcpInjection === 'claude-mcp-json'` (which `codebuddy` also declares): isolating the operator's personal
|
|
48
|
+
* `~/.claude` is specific to the real `claude` CLI's own config resolution, not to every def that happens to share its
|
|
49
|
+
* `.mcp.json` delivery shape. Matches the existing `USER`-for-claude-login special case already singled
|
|
50
|
+
* out by id in `BASELINE_AGENT_ENV_KEYS`'s own doc in `launch.ts`.
|
|
51
|
+
* @param required.hostEnv - The daemon's own environment, threaded through to {@link resolveSourceClaudeConfigDir} rather than read from a module-level `process.env`, matching the Codex home staging's identical testability reasoning.
|
|
52
|
+
* @param optional.seams - Injectable mkdtemp/readFile/writeFile/removeDir, real filesystem by default.
|
|
53
|
+
* @throws Whatever staging rejects with; the caller turns that into a pre-spawn `AGENT_SPAWN_FAILED` failure.
|
|
54
|
+
* @complexity O(1) plus {@link prepareClaudeConfigDirForRun}'s own cost.
|
|
55
|
+
*/
|
|
56
|
+
export declare function stageClaudeConfigDir({ runId, hostEnv }: {
|
|
57
|
+
readonly runId: string;
|
|
58
|
+
readonly hostEnv: NodeJS.ProcessEnv;
|
|
59
|
+
}, { seams }?: {
|
|
60
|
+
readonly seams?: Partial<ClaudeConfigDirSeams> | undefined;
|
|
61
|
+
}): Promise<PreparedClaudeConfigDir>;
|
|
62
|
+
//# sourceMappingURL=config-dir.d.ts.map
|