@spexcode/spec-cli 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -0
- package/bin/spex.mjs +76 -0
- package/dist/attach.d.ts +2 -0
- package/dist/attach.js +48 -0
- package/dist/claude-headless.d.ts +33 -0
- package/dist/claude-headless.js +307 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1859 -0
- package/dist/client.d.ts +111 -0
- package/dist/client.js +476 -0
- package/dist/cockpit.d.ts +7 -0
- package/dist/cockpit.js +26 -0
- package/dist/codex-headless.d.ts +1 -0
- package/dist/codex-headless.js +7 -0
- package/dist/codex-runtime-generations.d.ts +53 -0
- package/dist/codex-runtime-generations.js +686 -0
- package/dist/commit-surgery.d.ts +1 -0
- package/dist/commit-surgery.js +90 -0
- package/dist/contract-filter.d.ts +14 -0
- package/dist/contract-filter.js +219 -0
- package/dist/dashboard-assets.d.ts +6 -0
- package/dist/dashboard-assets.js +50 -0
- package/dist/delivery-queue.d.ts +23 -0
- package/dist/delivery-queue.js +179 -0
- package/dist/doctor.d.ts +9 -0
- package/dist/doctor.js +547 -0
- package/dist/eval-host.d.ts +1 -0
- package/dist/eval-host.js +19 -0
- package/dist/execution-trace.d.ts +26 -0
- package/dist/execution-trace.js +475 -0
- package/dist/file-write.d.ts +2 -0
- package/dist/file-write.js +26 -0
- package/dist/flat.d.ts +89 -0
- package/dist/flat.js +1076 -0
- package/dist/gateway-auth.d.ts +56 -0
- package/dist/gateway-auth.js +168 -0
- package/dist/gateway-hub.d.ts +28 -0
- package/dist/gateway-hub.js +361 -0
- package/dist/gateway.d.ts +37 -0
- package/dist/gateway.js +503 -0
- package/dist/graphCache.d.ts +27 -0
- package/dist/graphCache.js +716 -0
- package/dist/graphSnapshot.d.ts +14 -0
- package/dist/graphSnapshot.js +35 -0
- package/dist/graphStream.d.ts +85 -0
- package/dist/graphStream.js +1195 -0
- package/dist/guidance-catalog.d.ts +64 -0
- package/dist/guidance-catalog.js +166 -0
- package/dist/guide.d.ts +8 -0
- package/dist/guide.js +684 -0
- package/dist/harness-select.d.ts +18 -0
- package/dist/harness-select.js +62 -0
- package/dist/harness.d.ts +325 -0
- package/dist/harness.js +3026 -0
- package/dist/headless-controller.d.ts +9 -0
- package/dist/headless-controller.js +47 -0
- package/dist/help.d.ts +10 -0
- package/dist/help.js +574 -0
- package/dist/hook-prompts.d.ts +18 -0
- package/dist/hook-prompts.js +122 -0
- package/dist/hooks.d.ts +1 -0
- package/dist/hooks.js +27 -0
- package/dist/host-resources.d.ts +97 -0
- package/dist/host-resources.js +795 -0
- package/dist/host.d.ts +88 -0
- package/dist/host.js +663 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +899 -0
- package/dist/init.d.ts +1 -0
- package/dist/init.js +284 -0
- package/dist/issues-cli.d.ts +6 -0
- package/dist/issues-cli.js +334 -0
- package/dist/issues.d.ts +69 -0
- package/dist/issues.js +189 -0
- package/dist/lint.d.ts +34 -0
- package/dist/lint.js +476 -0
- package/dist/listen.d.ts +7 -0
- package/dist/listen.js +24 -0
- package/dist/localIssues.d.ts +65 -0
- package/dist/localIssues.js +582 -0
- package/dist/login-page.d.ts +5 -0
- package/dist/login-page.js +86 -0
- package/dist/loop-in.d.ts +23 -0
- package/dist/loop-in.js +68 -0
- package/dist/machine-peer.d.ts +69 -0
- package/dist/machine-peer.js +603 -0
- package/dist/materialize.d.ts +18 -0
- package/dist/materialize.js +468 -0
- package/dist/mentions.d.ts +50 -0
- package/dist/mentions.js +117 -0
- package/dist/opencode-headless.d.ts +4 -0
- package/dist/opencode-headless.js +208 -0
- package/dist/opencode.d.ts +3 -0
- package/dist/opencode.js +142 -0
- package/dist/pi-harness.d.ts +3 -0
- package/dist/pi-harness.js +129 -0
- package/dist/pi-headless.d.ts +25 -0
- package/dist/pi-headless.js +196 -0
- package/dist/plugin-harness.d.ts +21 -0
- package/dist/plugin-harness.js +146 -0
- package/dist/pty-bridge.d.ts +10 -0
- package/dist/pty-bridge.js +404 -0
- package/dist/pty-helper.d.mts +1 -0
- package/dist/pty-helper.mjs +101 -0
- package/dist/pty-native-helper.d.mts +2 -0
- package/dist/pty-native-helper.mjs +23 -0
- package/dist/public-graph.d.ts +46 -0
- package/dist/public-graph.js +56 -0
- package/dist/ranker.d.ts +15 -0
- package/dist/ranker.js +188 -0
- package/dist/reaper.d.ts +6 -0
- package/dist/reaper.js +81 -0
- package/dist/reviews.d.ts +189 -0
- package/dist/reviews.js +350 -0
- package/dist/runtime-guard.d.ts +6 -0
- package/dist/runtime-guard.js +37 -0
- package/dist/runtime-ownership.d.ts +21 -0
- package/dist/runtime-ownership.js +84 -0
- package/dist/search.bench.d.mts +1 -0
- package/dist/search.bench.mjs +75 -0
- package/dist/search.d.ts +20 -0
- package/dist/search.js +61 -0
- package/dist/session-cursors.d.ts +14 -0
- package/dist/session-cursors.js +82 -0
- package/dist/session-declarations.d.ts +13 -0
- package/dist/session-declarations.js +126 -0
- package/dist/session-execution.d.ts +10 -0
- package/dist/session-execution.js +70 -0
- package/dist/session-files.d.ts +28 -0
- package/dist/session-files.js +130 -0
- package/dist/session-follow.d.ts +31 -0
- package/dist/session-follow.js +179 -0
- package/dist/session-reparent.d.ts +10 -0
- package/dist/session-reparent.js +33 -0
- package/dist/session-timeline.d.ts +51 -0
- package/dist/session-timeline.js +233 -0
- package/dist/session-web.d.ts +24 -0
- package/dist/session-web.js +141 -0
- package/dist/sessions.d.ts +412 -0
- package/dist/sessions.js +4239 -0
- package/dist/sh.d.ts +1 -0
- package/dist/sh.js +3 -0
- package/dist/shim-runtime.d.ts +1 -0
- package/dist/shim-runtime.js +161 -0
- package/dist/slash-commands.d.ts +9 -0
- package/dist/slash-commands.js +307 -0
- package/dist/source-files.d.ts +9 -0
- package/dist/source-files.js +113 -0
- package/dist/supervise.d.ts +1 -0
- package/dist/supervise.js +308 -0
- package/dist/tree.d.ts +25 -0
- package/dist/tree.js +98 -0
- package/dist/tsx-bin.d.ts +3 -0
- package/dist/tsx-bin.js +41 -0
- package/dist/uninstall.d.ts +3 -0
- package/dist/uninstall.js +177 -0
- package/dist/uploads.d.ts +36 -0
- package/dist/uploads.js +243 -0
- package/dist/worktree-sources.d.ts +1 -0
- package/dist/worktree-sources.js +47 -0
- package/hooks/compat/mark-active-0.5.2-eef1.fixture +53 -0
- package/hooks/compat/mark-active-sed-v0.fixture +46 -0
- package/hooks/dispatch.sh +105 -0
- package/hooks/harness.sh +272 -0
- package/package.json +47 -0
- package/templates/hooks/commit-msg +14 -0
- package/templates/hooks/post-checkout +25 -0
- package/templates/hooks/post-merge +34 -0
- package/templates/hooks/pre-commit +120 -0
- package/templates/hooks/prepare-commit-msg +35 -0
- package/templates/hooks/reference-transaction +105 -0
- package/templates/spec/project/.plugins/commands/extract/spec.md +66 -0
- package/templates/spec/project/.plugins/commands/regroup/spec.md +25 -0
- package/templates/spec/project/.plugins/commands/rename/spec.md +11 -0
- package/templates/spec/project/.plugins/commands/spec.md +30 -0
- package/templates/spec/project/.plugins/commands/supervisor/spec.md +8 -0
- package/templates/spec/project/.plugins/commands/tidy/spec.md +43 -0
- package/templates/spec/project/.plugins/core/comment-altitude/spec.md +9 -0
- package/templates/spec/project/.plugins/core/idle/idle.sh +15 -0
- package/templates/spec/project/.plugins/core/idle/spec.md +13 -0
- package/templates/spec/project/.plugins/core/mark-active/mark-active.sh +59 -0
- package/templates/spec/project/.plugins/core/mark-active/spec.md +22 -0
- package/templates/spec/project/.plugins/core/session-fail/fail.sh +12 -0
- package/templates/spec/project/.plugins/core/session-fail/spec.md +15 -0
- package/templates/spec/project/.plugins/core/spec-first/spec-first.sh +43 -0
- package/templates/spec/project/.plugins/core/spec-first/spec.md +17 -0
- package/templates/spec/project/.plugins/core/spec-of-file/spec-of-file.sh +66 -0
- package/templates/spec/project/.plugins/core/spec-of-file/spec.md +15 -0
- package/templates/spec/project/.plugins/core/spec.md +22 -0
- package/templates/spec/project/.plugins/core/stop-gate/spec.md +23 -0
- package/templates/spec/project/.plugins/core/stop-gate/stop-gate.sh +149 -0
- package/templates/spec/project/.plugins/prompts/atomic-landing/spec.md +15 -0
- package/templates/spec/project/.plugins/prompts/forge-link/spec.md +10 -0
- package/templates/spec/project/.plugins/prompts/memory-hygiene/spec.md +13 -0
- package/templates/spec/project/.plugins/prompts/reproduce-before-fix/spec.md +12 -0
- package/templates/spec/project/.plugins/prompts/spec.md +24 -0
- package/templates/spec/project/.plugins/skills/distill/digest.mjs +136 -0
- package/templates/spec/project/.plugins/skills/distill/spec.md +67 -0
- package/templates/spec/project/.plugins/skills/spec.md +19 -0
- package/templates/spec/project/.plugins/spec.md +23 -0
- package/templates/spec/project/spec.md +20 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Harness, type HarnessId } from './harness.js';
|
|
2
|
+
export type HarnessTarget = {
|
|
3
|
+
kind: 'native';
|
|
4
|
+
id: HarnessId;
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'plugin';
|
|
7
|
+
folder: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const NATIVE_HARNESS_IDS: readonly HarnessId[];
|
|
10
|
+
export declare function parseHarnessFlag(spec: string): unknown[];
|
|
11
|
+
export declare function resolveHarnessTargets(raw: unknown): HarnessTarget[];
|
|
12
|
+
export declare function partitionHarnesses(targets: HarnessTarget[]): {
|
|
13
|
+
selected: Harness[];
|
|
14
|
+
unselected: Harness[];
|
|
15
|
+
plugins: {
|
|
16
|
+
folder: string;
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { HARNESSES } from './harness.js';
|
|
2
|
+
// the native vocabulary (for messages and init's flag parsing). There is NO default set: the delivery
|
|
3
|
+
// targets are an explicit adopter choice, stamped by `spex init --harness` and read back from config forever.
|
|
4
|
+
export const NATIVE_HARNESS_IDS = HARNESSES.map((h) => h.id);
|
|
5
|
+
const KNOWN = HARNESSES.map((h) => h.id);
|
|
6
|
+
// the one-line repair every missing-selection error carries — the field is REQUIRED, never defaulted,
|
|
7
|
+
// because with many harnesses a silent "deliver everywhere" would litter the adopter's tree with artifacts
|
|
8
|
+
// for tools they never installed.
|
|
9
|
+
const MISSING = `spexcode.json has no "harnesses" field — the delivery targets are an EXPLICIT choice, never a default. Declare it, e.g. "harnesses": ["claude"] — members are native ids (${KNOWN.join(', ')}) or {"plugin":"<folder>"}. Fresh adoption: \`spex init --harness <ids>\` stamps it.`;
|
|
10
|
+
// parse `spex init --harness <spec>` into the raw JSON members the `harnesses` field carries: a comma-
|
|
11
|
+
// separated list where `plugin:<folder>` means a plugin target and anything else is a native id. Pure
|
|
12
|
+
// spelling translation — legality (unknown ids, plugin exclusivity) stays with resolveHarnessTargets.
|
|
13
|
+
export function parseHarnessFlag(spec) {
|
|
14
|
+
return spec.split(',').map((s) => s.trim()).filter(Boolean)
|
|
15
|
+
.map((s) => (s.startsWith('plugin:') ? { plugin: s.slice('plugin:'.length) } : s));
|
|
16
|
+
}
|
|
17
|
+
// parse + validate the spexcode.json `harnesses` field into resolved targets. FAIL LOUD on an illegal set —
|
|
18
|
+
// materialize and init both gate on this so a bad config never silently delivers the wrong thing. `raw` is the
|
|
19
|
+
// JSON value as written; a MISSING field is itself illegal (the choice must exist, stamped by init).
|
|
20
|
+
export function resolveHarnessTargets(raw) {
|
|
21
|
+
if (raw === undefined || raw === null)
|
|
22
|
+
throw new Error(MISSING);
|
|
23
|
+
if (!Array.isArray(raw))
|
|
24
|
+
throw new Error(`spexcode.json "harnesses" must be an ARRAY of targets (got ${typeof raw}). Members are native ids (${KNOWN.join(', ')}) or {"plugin":"<folder>"}.`);
|
|
25
|
+
if (raw.length === 0)
|
|
26
|
+
throw new Error(`spexcode.json "harnesses" is EMPTY — list at least one target: native ids (${KNOWN.join(', ')}) or {"plugin":"<folder>"}.`);
|
|
27
|
+
const targets = [];
|
|
28
|
+
for (const m of raw) {
|
|
29
|
+
if (typeof m === 'string') {
|
|
30
|
+
if (m === 'plugin')
|
|
31
|
+
throw new Error(`spexcode.json "harnesses": a plugin target needs an EXPLICIT landing folder — write {"plugin":"<folder>"} (e.g. {"plugin":".adopter-a"}), not the bare string "plugin", because each host agent reads a different plugins dir.`);
|
|
32
|
+
if (!KNOWN.includes(m))
|
|
33
|
+
throw new Error(`spexcode.json "harnesses": unknown harness id "${m}" — known native ids are ${KNOWN.join(', ')}, or use {"plugin":"<folder>"}.`);
|
|
34
|
+
targets.push({ kind: 'native', id: m });
|
|
35
|
+
}
|
|
36
|
+
else if (m && typeof m === 'object' && !Array.isArray(m) && 'plugin' in m) {
|
|
37
|
+
const folder = m.plugin;
|
|
38
|
+
if (typeof folder !== 'string' || !folder.trim())
|
|
39
|
+
throw new Error(`spexcode.json "harnesses": a {"plugin":…} target needs a NON-EMPTY folder string (e.g. {"plugin":".adopter-a"}) — each host agent reads a different plugins dir, so the folder must be explicit.`);
|
|
40
|
+
targets.push({ kind: 'plugin', folder: folder.trim() });
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
throw new Error(`spexcode.json "harnesses": each member must be a native id string (${KNOWN.join(', ')}) or a {"plugin":"<folder>"} object — got ${JSON.stringify(m)}.`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// PLUGIN EXCLUSIVITY: a plugin bundle is a SUPERSET delivery to its host agent, so pairing it with any
|
|
47
|
+
// native harness double-delivers. So a set with a plugin may carry NO native harness.
|
|
48
|
+
const natives = targets.filter((t) => t.kind === 'native');
|
|
49
|
+
if (targets.some((t) => t.kind === 'plugin') && natives.length)
|
|
50
|
+
throw new Error(`spexcode.json "harnesses": a plugin target is EXCLUSIVE — it cannot coexist with native harnesses (${natives.map((t) => t.id).join(', ')}). A plugin bundle already delivers the whole system to its host agent, so pairing it with a native harness double-delivers. Choose EITHER native harnesses OR plugin target(s).`);
|
|
51
|
+
return targets;
|
|
52
|
+
}
|
|
53
|
+
// split the live HARNESSES adapters by whether the resolved targets SELECT them: selected get write()n,
|
|
54
|
+
// unselected get clean()ed (pruned). `plugins` carries the plugin targets (no emitter yet — a later node).
|
|
55
|
+
export function partitionHarnesses(targets) {
|
|
56
|
+
const selectedIds = new Set(targets.filter((t) => t.kind === 'native').map((t) => t.id));
|
|
57
|
+
return {
|
|
58
|
+
selected: HARNESSES.filter((h) => selectedIds.has(h.id)),
|
|
59
|
+
unselected: HARNESSES.filter((h) => !selectedIds.has(h.id)),
|
|
60
|
+
plugins: targets.filter((t) => t.kind === 'plugin').map((t) => ({ folder: t.folder })),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { type SlashCommand } from './slash-commands.js';
|
|
2
|
+
import { type ExecutionTrace, type ExecutionTurn } from './execution-trace.js';
|
|
3
|
+
import { type HarnessId } from '@spexcode/spec-core';
|
|
4
|
+
export type { HarnessId } from '@spexcode/spec-core';
|
|
5
|
+
export type HarnessLivenessRecord = {
|
|
6
|
+
session: string;
|
|
7
|
+
harnessSessionId?: string | null;
|
|
8
|
+
stopped?: boolean;
|
|
9
|
+
archived?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type HarnessLaunchReadyRecord = HarnessLivenessRecord & {
|
|
12
|
+
governed?: boolean;
|
|
13
|
+
runtimeDir: string;
|
|
14
|
+
};
|
|
15
|
+
export type HarnessLaunchReadinessFence = {
|
|
16
|
+
readonly proof: Readonly<Record<string, unknown>>;
|
|
17
|
+
validate(current: () => HarnessLaunchReadyRecord | null): Promise<boolean>;
|
|
18
|
+
};
|
|
19
|
+
export type TurnFailure = {
|
|
20
|
+
message: string;
|
|
21
|
+
completedAt: number | null;
|
|
22
|
+
};
|
|
23
|
+
export type FailureSubscription = {
|
|
24
|
+
close(): void;
|
|
25
|
+
readonly closed: Promise<string | null>;
|
|
26
|
+
};
|
|
27
|
+
export type ProcTable = Map<number, {
|
|
28
|
+
ppid: number;
|
|
29
|
+
comm: string;
|
|
30
|
+
}>;
|
|
31
|
+
export type PaneProbe = {
|
|
32
|
+
panePid?: number;
|
|
33
|
+
procs?: ProcTable;
|
|
34
|
+
pidAlive?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export type SharedRuntimeDescriptor = {
|
|
37
|
+
key: string;
|
|
38
|
+
label: string;
|
|
39
|
+
pidFile: string;
|
|
40
|
+
receiptFile: string;
|
|
41
|
+
targetDescriptorKey?: (rec: HarnessLivenessRecord & {
|
|
42
|
+
harnessSessionId?: string | null;
|
|
43
|
+
}) => string | null;
|
|
44
|
+
residency?: () => Promise<{
|
|
45
|
+
healthy: boolean;
|
|
46
|
+
referenceIds: string[];
|
|
47
|
+
error?: string;
|
|
48
|
+
rootAbsent?: boolean;
|
|
49
|
+
}>;
|
|
50
|
+
mutationGuard?: (targetReferenceId: string, opts?: {
|
|
51
|
+
coldReceipt?: unknown;
|
|
52
|
+
}) => Promise<SharedRuntimeMutationGuard>;
|
|
53
|
+
probe(): Promise<SharedRuntimeProbe>;
|
|
54
|
+
};
|
|
55
|
+
export type SharedRuntimeMutationGuard = {
|
|
56
|
+
healthy: boolean;
|
|
57
|
+
referenceIds: string[];
|
|
58
|
+
targetTurnPresence: 'none' | 'idle' | 'active' | 'unknown';
|
|
59
|
+
descendantIds: string[];
|
|
60
|
+
coldTeardownAuthorized?: boolean;
|
|
61
|
+
error?: string;
|
|
62
|
+
};
|
|
63
|
+
export type SharedRuntimeProbe = {
|
|
64
|
+
healthy: boolean;
|
|
65
|
+
references: Array<{
|
|
66
|
+
referenceId: string;
|
|
67
|
+
turnPresence: 'idle' | 'active' | 'unknown';
|
|
68
|
+
turnId?: string;
|
|
69
|
+
}>;
|
|
70
|
+
error?: string;
|
|
71
|
+
};
|
|
72
|
+
export type HarnessColdPreflight = {
|
|
73
|
+
ok: true;
|
|
74
|
+
alreadyCold?: boolean;
|
|
75
|
+
receipt?: unknown;
|
|
76
|
+
} | {
|
|
77
|
+
ok: false;
|
|
78
|
+
reason: string;
|
|
79
|
+
};
|
|
80
|
+
export type HarnessOrphanThreadQuarantine = {
|
|
81
|
+
ok: true;
|
|
82
|
+
audit: {
|
|
83
|
+
adapter: string;
|
|
84
|
+
threadId: string;
|
|
85
|
+
action: 'archived' | 'already-unloaded';
|
|
86
|
+
};
|
|
87
|
+
compensate(): Promise<{
|
|
88
|
+
ok: true;
|
|
89
|
+
} | {
|
|
90
|
+
ok: false;
|
|
91
|
+
reason: string;
|
|
92
|
+
}>;
|
|
93
|
+
} | {
|
|
94
|
+
ok: false;
|
|
95
|
+
reason: string;
|
|
96
|
+
};
|
|
97
|
+
export type AdapterLoadedReferenceState = {
|
|
98
|
+
healthy: boolean;
|
|
99
|
+
loaded: boolean;
|
|
100
|
+
error?: string;
|
|
101
|
+
};
|
|
102
|
+
export declare function adapterLoadedReferenceState(records: readonly (HarnessLivenessRecord & {
|
|
103
|
+
harness?: string;
|
|
104
|
+
})[], runtimeDir?: string): Promise<Map<string, AdapterLoadedReferenceState>>;
|
|
105
|
+
export interface Harness {
|
|
106
|
+
readonly id: HarnessId;
|
|
107
|
+
readonly dispatchId: 'claude' | 'codex' | 'opencode' | 'pi' | 'zcode';
|
|
108
|
+
readonly headless: boolean;
|
|
109
|
+
readonly launchOneShot?: boolean;
|
|
110
|
+
readonly runtimeOwnership?: 'leaf' | 'adapter';
|
|
111
|
+
readonly sharedRuntimeSpawn?: boolean;
|
|
112
|
+
readonly fatalLaunchOutput?: readonly string[];
|
|
113
|
+
readonly events: readonly string[];
|
|
114
|
+
readonly ownsRendezvous: boolean;
|
|
115
|
+
readonly paneTitleIsSelfSummary: boolean;
|
|
116
|
+
executionTrace(threadId: string, turn: ExecutionTurn | null): ExecutionTrace | null;
|
|
117
|
+
launchCmd(id: string, runtimeDir?: string, cmd?: string): string;
|
|
118
|
+
baseCmd(cmd?: string): string;
|
|
119
|
+
oneShotTurn?(prompt: string, cmd?: string): {
|
|
120
|
+
command: string;
|
|
121
|
+
stdin: string;
|
|
122
|
+
};
|
|
123
|
+
sessionIdArg(id: string): string;
|
|
124
|
+
readonly sessionEnvVar: string;
|
|
125
|
+
launchEnv(id: string): string[];
|
|
126
|
+
shimFile(proj: string): string;
|
|
127
|
+
shimScope: 'tree' | 'project';
|
|
128
|
+
worktreeHookAnchor(proj: string): string | null;
|
|
129
|
+
contractFiles(proj: string): string[];
|
|
130
|
+
skillDir(proj: string): string | null;
|
|
131
|
+
agentDir(proj: string): string | null;
|
|
132
|
+
shim(dispatch: string, spex: string): {
|
|
133
|
+
content: string;
|
|
134
|
+
cmd: (e: string) => string;
|
|
135
|
+
};
|
|
136
|
+
writeTrust(proj: string, cmdFor: (e: string) => string): readonly string[];
|
|
137
|
+
slashCommands(): SlashCommand[];
|
|
138
|
+
liveness(rec: HarnessLivenessRecord, tmuxAlive: boolean, runtimeDir?: string, pane?: PaneProbe, socketLive?: boolean): 'online' | 'offline';
|
|
139
|
+
launchReady?(current: () => HarnessLaunchReadyRecord | null, deadline: number): Promise<HarnessLaunchReadinessFence | null>;
|
|
140
|
+
leafOwnerNeedle?(rec: HarnessLivenessRecord & {
|
|
141
|
+
harnessSessionId?: string | null;
|
|
142
|
+
}): string | null;
|
|
143
|
+
deliver(rec: HarnessDeliveryRecord, text: string): Promise<DispatchResult>;
|
|
144
|
+
observeTurnFailures?(rec: HarnessDeliveryRecord, onFailure: (failure: TurnFailure) => void): FailureSubscription;
|
|
145
|
+
interrupt?(rec: HarnessDeliveryRecord): Promise<DispatchResult>;
|
|
146
|
+
cleanupRuntime(rec: HarnessLivenessRecord): Promise<void>;
|
|
147
|
+
coldPreflight?(rec: HarnessLivenessRecord & {
|
|
148
|
+
harnessSessionId?: string | null;
|
|
149
|
+
}): Promise<HarnessColdPreflight>;
|
|
150
|
+
coldRetirementPreflight?(rec: HarnessLivenessRecord & {
|
|
151
|
+
harnessSessionId?: string | null;
|
|
152
|
+
}): Promise<{
|
|
153
|
+
ok: true;
|
|
154
|
+
alreadyCold: true;
|
|
155
|
+
} | {
|
|
156
|
+
ok: false;
|
|
157
|
+
reason: string;
|
|
158
|
+
}>;
|
|
159
|
+
coldRuntime?(rec: HarnessLivenessRecord & {
|
|
160
|
+
harnessSessionId?: string | null;
|
|
161
|
+
}, receipt?: unknown): Promise<{
|
|
162
|
+
ok: true;
|
|
163
|
+
} | {
|
|
164
|
+
ok: false;
|
|
165
|
+
reason: string;
|
|
166
|
+
}>;
|
|
167
|
+
restoreRuntime?(rec: HarnessLivenessRecord & {
|
|
168
|
+
harnessSessionId?: string | null;
|
|
169
|
+
}, receipt?: unknown): Promise<{
|
|
170
|
+
ok: true;
|
|
171
|
+
} | {
|
|
172
|
+
ok: false;
|
|
173
|
+
reason: string;
|
|
174
|
+
}>;
|
|
175
|
+
quarantineOrphanThread?(threadId: string, opts: {
|
|
176
|
+
excludingSessionId: string;
|
|
177
|
+
}): Promise<HarnessOrphanThreadQuarantine>;
|
|
178
|
+
sharedRuntimes?(runtimeDir: string): readonly SharedRuntimeDescriptor[];
|
|
179
|
+
targetDescriptorKey?(rec: HarnessLivenessRecord & {
|
|
180
|
+
harnessSessionId?: string | null;
|
|
181
|
+
}): string | null;
|
|
182
|
+
deliveryBlockedBy?(paneText: string): string | null;
|
|
183
|
+
clean(proj: string, arts: HarnessArtifacts, preserveProject?: boolean): void;
|
|
184
|
+
removeTrust(proj: string): void;
|
|
185
|
+
resumeArg(rec: {
|
|
186
|
+
session: string;
|
|
187
|
+
harnessSessionId?: string | null;
|
|
188
|
+
}): string;
|
|
189
|
+
}
|
|
190
|
+
export type DispatchResult = {
|
|
191
|
+
ok: boolean;
|
|
192
|
+
error?: string;
|
|
193
|
+
};
|
|
194
|
+
export type HarnessDeliveryRecord = {
|
|
195
|
+
session: string;
|
|
196
|
+
worktreePath?: string;
|
|
197
|
+
harnessSessionId?: string | null;
|
|
198
|
+
runtimeDir?: string;
|
|
199
|
+
launchCmd?: string | null;
|
|
200
|
+
mid?: string;
|
|
201
|
+
};
|
|
202
|
+
export type HarnessArtifacts = {
|
|
203
|
+
skills: readonly string[];
|
|
204
|
+
agents: readonly string[];
|
|
205
|
+
};
|
|
206
|
+
export declare const legacyRvSock: (id: string) => string;
|
|
207
|
+
export declare const scopedRvSock: (id: string, dir?: string) => string;
|
|
208
|
+
export declare const rvSock: (id: string) => string;
|
|
209
|
+
export declare function stampRvSock(id: string, dir?: string): string;
|
|
210
|
+
export type ListenerProbe = 'live' | 'dead' | 'unproven';
|
|
211
|
+
export declare function listenerAt(path: string, timeoutMs?: number): Promise<ListenerProbe>;
|
|
212
|
+
export declare const rendezvousListening: (id: string, timeoutMs?: number) => Promise<ListenerProbe>;
|
|
213
|
+
export declare const codexAppServerSock: (dir?: string) => string;
|
|
214
|
+
export declare const codexAppServerPid: (dir?: string) => string;
|
|
215
|
+
export declare const codexAppServerReceipt: (dir?: string) => string;
|
|
216
|
+
export declare function deliverViaRendezvous(id: string, text: string, mid?: string): Promise<DispatchResult>;
|
|
217
|
+
export declare function deliverViaClaudeRendezvous(id: string, text: string, mid?: string, runtimeDir?: string): Promise<DispatchResult>;
|
|
218
|
+
export declare function deliverViaSocketOrWake(id: string, text: string, mid: string | undefined, coldWake: () => Promise<DispatchResult>, unprovenError: string): Promise<DispatchResult>;
|
|
219
|
+
type JsonRpc = {
|
|
220
|
+
id?: number;
|
|
221
|
+
method?: string;
|
|
222
|
+
params?: unknown;
|
|
223
|
+
result?: unknown;
|
|
224
|
+
error?: {
|
|
225
|
+
code?: number;
|
|
226
|
+
message?: string;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
export declare function codexHandshakeMessages(threadId: string): JsonRpc[];
|
|
230
|
+
export declare function codexInjectMessage(threadId: string, text: string, cwd: string | undefined, activeTurnId: string | null, id?: number, clientUserMessageId?: string): JsonRpc;
|
|
231
|
+
export declare function activeTurnIdFromThread(readResult: unknown): string | null;
|
|
232
|
+
export declare function codexBinary(codexCmd: string): string;
|
|
233
|
+
export type CodexThreadPolicy = {
|
|
234
|
+
approvalPolicy?: 'untrusted' | 'on-request' | 'never';
|
|
235
|
+
sandbox?: 'read-only' | 'workspace-write' | 'danger-full-access';
|
|
236
|
+
};
|
|
237
|
+
export declare function codexLauncherThreadPolicy(command: string): CodexThreadPolicy;
|
|
238
|
+
export declare function codexSupportsBypassHookTrust(binary: string): boolean;
|
|
239
|
+
export declare function reportHeadlessTurnExit(id: string, harness: string, code: number | null, cwd?: string): Promise<void>;
|
|
240
|
+
export declare function headlessTurnFailureShell(harness: string, swallow?: boolean): string;
|
|
241
|
+
export declare function sessionIdentityEnvVars(): string[];
|
|
242
|
+
export declare function codexLaunchCommand(id: string, codexCmd?: string, serverCmd?: string, dir?: string, attachTui?: boolean): string;
|
|
243
|
+
export declare function codexTurnFailureObserver(rec: HarnessDeliveryRecord, onFailure: (failure: TurnFailure) => void): FailureSubscription;
|
|
244
|
+
export declare const CODEX_THREAD_SOURCE_KINDS: readonly ["cli", "vscode", "exec", "appServer", "subAgent", "subAgentReview", "subAgentCompact", "subAgentThreadSpawn", "subAgentOther", "unknown"];
|
|
245
|
+
export declare function codexLoadedReferenceIds(sock: string): Promise<{
|
|
246
|
+
ok: true;
|
|
247
|
+
referenceIds: string[];
|
|
248
|
+
} | {
|
|
249
|
+
ok: false;
|
|
250
|
+
error: string;
|
|
251
|
+
}>;
|
|
252
|
+
export declare function codexThreadList(sock: string, params: Record<string, unknown>): Promise<{
|
|
253
|
+
ok: true;
|
|
254
|
+
ids: string[];
|
|
255
|
+
} | {
|
|
256
|
+
ok: false;
|
|
257
|
+
error: string;
|
|
258
|
+
}>;
|
|
259
|
+
export declare function codexThreadId(sock: string): Promise<{
|
|
260
|
+
ok: true;
|
|
261
|
+
threadId: string;
|
|
262
|
+
} | {
|
|
263
|
+
ok: false;
|
|
264
|
+
error: string;
|
|
265
|
+
}>;
|
|
266
|
+
export declare function codexSharedRuntimeProbe(dir?: string, endpoint?: Readonly<{
|
|
267
|
+
id: string;
|
|
268
|
+
pidFile: string;
|
|
269
|
+
receiptFile: string;
|
|
270
|
+
logFile: string;
|
|
271
|
+
socketPath: string;
|
|
272
|
+
}>): Promise<SharedRuntimeProbe>;
|
|
273
|
+
export declare function codexStartThreadParams(cwd?: string, bypassHookTrust?: boolean, shellEnv?: Record<string, string>, policy?: CodexThreadPolicy): Record<string, unknown>;
|
|
274
|
+
export declare function codexStartThread(sock: string, cwd?: string, bypassHookTrust?: boolean, shellEnv?: Record<string, string>, policy?: CodexThreadPolicy): Promise<{
|
|
275
|
+
ok: true;
|
|
276
|
+
threadId: string;
|
|
277
|
+
} | {
|
|
278
|
+
ok: false;
|
|
279
|
+
error: string;
|
|
280
|
+
}>;
|
|
281
|
+
export declare function codexTurn(sock: string, threadId: string, text: string, cwd?: string, clientUserMessageId?: string): Promise<DispatchResult>;
|
|
282
|
+
export declare function codexRolloutExists(threadId: string, root?: string): boolean;
|
|
283
|
+
export declare function codexRolloutBytes(threadId: string, root?: string): {
|
|
284
|
+
bytes: number;
|
|
285
|
+
} | {
|
|
286
|
+
unreadable: true;
|
|
287
|
+
};
|
|
288
|
+
export declare function waitForCodexRollout(threadId: string, timeoutMs?: number): Promise<boolean>;
|
|
289
|
+
export declare function writeManagedBlock(file: string, body: string, comment?: readonly [string, string]): boolean;
|
|
290
|
+
export declare function removeManagedBlock(file: string, comment?: readonly [string, string], deleteIfEmpty?: boolean): void;
|
|
291
|
+
export declare function codexHookHash(snakeEvent: string, command: string, timeout?: number, asyncFlag?: boolean): string;
|
|
292
|
+
export declare function writeCodexTrust(proj: string, events: readonly string[], cmdFor: (e: string) => string): string;
|
|
293
|
+
export declare function paneTreeRunsCodex(pane?: PaneProbe): boolean;
|
|
294
|
+
export declare function procSnapshot(timeoutMs?: number): Promise<ProcTable>;
|
|
295
|
+
export declare function opencodeLaunchCommand(opencodeCmd?: string): string;
|
|
296
|
+
export declare const unlinkSocks: (...paths: string[]) => Promise<void>;
|
|
297
|
+
export declare const claudeHarness: Harness;
|
|
298
|
+
export declare const claudeHeadlessHarness: Harness;
|
|
299
|
+
export declare const codexHarness: Harness;
|
|
300
|
+
export declare const codexHeadlessHarness: Harness;
|
|
301
|
+
export declare const piHarness: Harness;
|
|
302
|
+
export declare const piHeadlessHarness: Harness;
|
|
303
|
+
export declare const zcodeHarness: Harness;
|
|
304
|
+
export declare const opencodeHarness: Harness;
|
|
305
|
+
export declare const opencodeHeadlessHarness: Harness;
|
|
306
|
+
export declare const HARNESSES: readonly Harness[];
|
|
307
|
+
export declare const defaultHarness: Harness;
|
|
308
|
+
export declare function harnessByIdOrNull(id: string): Harness | null;
|
|
309
|
+
export declare function harnessById(id: string): Harness;
|
|
310
|
+
export type Launcher = {
|
|
311
|
+
name: string;
|
|
312
|
+
harness: string;
|
|
313
|
+
cmd: string;
|
|
314
|
+
headless: boolean;
|
|
315
|
+
};
|
|
316
|
+
export type LauncherDefault = {
|
|
317
|
+
default: string | null;
|
|
318
|
+
error: string | null;
|
|
319
|
+
};
|
|
320
|
+
export declare function launcherList(root?: string): Launcher[];
|
|
321
|
+
export declare function dashboardLauncherList(root?: string): Launcher[];
|
|
322
|
+
export declare const MISSING_DEFAULT_LAUNCHER_ERROR = "sessions.defaultLauncher is required for a launch without --launcher; set it in spexcode.json or spexcode.local.json (for example {\"sessions\":{\"defaultLauncher\":\"claude\"}})";
|
|
323
|
+
export declare function defaultLauncher(root?: string): string;
|
|
324
|
+
export declare function launcherDefault(root?: string): LauncherDefault;
|
|
325
|
+
export declare function resolveLauncher(name: string, root?: string): Launcher;
|