@aisac/cli 0.4.0-beta.2 → 0.4.0-beta.22
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 +146 -10
- package/dist/assets/claude/hooks/context-compaction.ts +17 -5
- package/dist/assets/claude/hooks/native-host-contract-runtime.ts +1 -1
- package/dist/assets/claude/hooks/native-host-contract.test.ts +8 -4
- package/dist/assets/claude/hooks/provider-window.d.ts +83 -0
- package/dist/assets/codex-context-compaction.mjs +846 -14
- package/dist/assets/jev-paid-pilot-terminal.mjs +12 -1
- package/dist/claude-compatibility.mjs +26 -25
- package/dist/claude-observation.mjs +2 -1
- package/dist/cli.mjs +641 -35
- package/dist/codex-compatibility.mjs +48 -2
- package/dist/codex-engineering.mjs +165 -0
- package/dist/codex-hooks.mjs +411 -0
- package/dist/codex-permissions.mjs +67 -34
- package/dist/codex-protocol-fingerprint.json +11 -11
- package/dist/engineering-init.mjs +615 -0
- package/dist/engineering-pack.mjs +276 -23
- package/dist/engineering-scan-pins.json +42 -0
- package/dist/engineering-scan-report.mjs +1274 -0
- package/dist/engineering-scan-tools.mjs +1418 -0
- package/dist/engineering-scan.mjs +1265 -0
- package/dist/extensions-catalog.mjs +390 -0
- package/dist/extensions-cli.mjs +492 -0
- package/dist/extensions-preferences.mjs +151 -0
- package/dist/guardrails/continuity.mjs +239 -0
- package/dist/guardrails/format.mjs +111 -0
- package/dist/guardrails/guards.mjs +1557 -0
- package/dist/guardrails/patch.mjs +33 -0
- package/dist/guardrails/run.mjs +286 -0
- package/dist/guardrails/shell-words.mjs +206 -0
- package/dist/guardrails-plugin.mjs +207 -0
- package/dist/launch.mjs +403 -47
- package/dist/managed-host.mjs +977 -0
- package/dist/manager/bus.mjs +1921 -0
- package/dist/manager/delegation.mjs +354 -0
- package/dist/manager/hooks.mjs +918 -0
- package/dist/manager/launch-role.mjs +476 -0
- package/dist/manager/mcp-stdio.mjs +463 -0
- package/dist/manager/messages.mjs +791 -0
- package/dist/manager/reserve.mjs +2166 -0
- package/dist/manager/room.mjs +106 -0
- package/dist/manager/server.mjs +1792 -0
- package/dist/manager/status.mjs +118 -0
- package/dist/manager/watch.mjs +87 -0
- package/dist/manager/worker.mjs +2793 -0
- package/dist/manager/workers-cli.mjs +1403 -0
- package/dist/mcp-servers.mjs +192 -0
- package/dist/mcp.mjs +10 -2
- package/dist/monitor.mjs +76 -1
- package/dist/package.json +1 -1
- package/dist/platform.mjs +78 -29
- package/dist/release-manifest-public-keys.json +10 -0
- package/dist/release-manifest.json +328 -0
- package/dist/release-manifest.mjs +817 -0
- package/dist/release-settings.mjs +210 -0
- package/dist/self-update.mjs +1036 -0
- package/dist/state.mjs +25 -1
- package/dist/token-guide.mjs +132 -0
- package/dist/update-actions.mjs +442 -0
- package/package.json +1 -1
|
@@ -20,6 +20,8 @@ const MAX_AUXILIARY_IN_FLIGHT = 32;
|
|
|
20
20
|
const MAX_AUXILIARY_NOTIFICATIONS = 256;
|
|
21
21
|
const DEFAULT_AUXILIARY_IDLE_TIMEOUT_MS = 120_000;
|
|
22
22
|
const NORMAL_DISCOVERY_CLOSE_CODES = new Set([1000, 1001, 1005]);
|
|
23
|
+
// Smallest sun_path among supported hosts: macOS 104 bytes, minus the terminator.
|
|
24
|
+
const UNIX_SOCKET_PATH_MAX_BYTES = 103;
|
|
23
25
|
|
|
24
26
|
function repoRoot() {
|
|
25
27
|
return fileURLToPath(new URL('..', import.meta.url)).replace(/\/$/u, '');
|
|
@@ -77,6 +79,11 @@ async function main() {
|
|
|
77
79
|
const childEnv = { ...process.env };
|
|
78
80
|
delete childEnv.JEV_API_KEY;
|
|
79
81
|
delete childEnv.TYPESAFE_API_KEY;
|
|
82
|
+
// The worker role's variables (ADR-0058) are for the adapter the monitor runs;
|
|
83
|
+
// the terminal, and every command its model runs, never carries them.
|
|
84
|
+
const terminalEnv = { ...childEnv };
|
|
85
|
+
for (const name of ['AISAC_WORKER_ROLE', 'AISAC_WORKER_MODULE', 'AISAC_MANAGER_ROLE'])
|
|
86
|
+
delete terminalEnv[name];
|
|
80
87
|
const bridgeRoot = await mkdtemp(join(tmpdir(), 'ai-brain-codex-terminal-'));
|
|
81
88
|
await chmod(bridgeRoot, 0o700);
|
|
82
89
|
const socketPath = join(bridgeRoot, 'codex.sock');
|
|
@@ -1022,6 +1029,10 @@ async function main() {
|
|
|
1022
1029
|
});
|
|
1023
1030
|
});
|
|
1024
1031
|
try {
|
|
1032
|
+
// macOS sun_path holds 104 bytes including the terminator (Linux 108); refuse a
|
|
1033
|
+
// path that the kernel would truncate or reject instead of binding elsewhere.
|
|
1034
|
+
if (Buffer.byteLength(socketPath) > UNIX_SOCKET_PATH_MAX_BYTES)
|
|
1035
|
+
throw new Error('terminal_bridge_socket_path_too_long');
|
|
1025
1036
|
await new Promise((resolve, reject) => {
|
|
1026
1037
|
server.once('error', reject);
|
|
1027
1038
|
server.listen(socketPath, async () => {
|
|
@@ -1042,7 +1053,7 @@ async function main() {
|
|
|
1042
1053
|
}
|
|
1043
1054
|
terminal = spawn(codexBinary, ['--remote', `unix://${socketPath}`, ...nativeArgs], {
|
|
1044
1055
|
cwd: process.cwd(),
|
|
1045
|
-
env:
|
|
1056
|
+
env: terminalEnv,
|
|
1046
1057
|
stdio: ['inherit', 'inherit', 'inherit'],
|
|
1047
1058
|
});
|
|
1048
1059
|
terminal.on('error', () => void cleanup().finally(() => process.exit(1)));
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import { dirname, join, resolve } from 'node:path';
|
|
15
15
|
import { tmpdir } from 'node:os';
|
|
16
16
|
import { spawn } from 'node:child_process';
|
|
17
|
+
import releaseManifest from './release-manifest.json' with { type: 'json' };
|
|
17
18
|
|
|
18
19
|
const MAX_OUTPUT_BYTES = 96 * 1024;
|
|
19
20
|
const PROBE_TIMEOUT_MS = 30_000;
|
|
@@ -21,16 +22,9 @@ const MAX_PLUGIN_ASSET_BYTES = 4 * 1024 * 1024;
|
|
|
21
22
|
const MAX_PLUGIN_TOTAL_BYTES = 16 * 1024 * 1024;
|
|
22
23
|
const HOST_MAJOR = 2;
|
|
23
24
|
const HOST_MINOR = 1;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
'2.1.296',
|
|
28
|
-
'2.1.299',
|
|
29
|
-
'2.1.300',
|
|
30
|
-
'2.1.301',
|
|
31
|
-
'2.1.302',
|
|
32
|
-
'2.1.303',
|
|
33
|
-
]);
|
|
25
|
+
// One source for the qualified releases: the manifest bundled with this client
|
|
26
|
+
// (ADR-0056 R2; spec aisac-release-manifest FR4).
|
|
27
|
+
const QUALIFIED_VERSIONS = new Set(releaseManifest.hosts.claude.qualified);
|
|
34
28
|
const REQUIRED_FLAGS = ['--settings', '--mcp-config', '--allowedTools', '--plugin-dir'];
|
|
35
29
|
const REQUIRED_INVENTORY = [
|
|
36
30
|
'prompt.submit',
|
|
@@ -57,6 +51,7 @@ const ALLOWED_PLUGIN_FILES = Object.freeze([
|
|
|
57
51
|
'hooks/hooks.json',
|
|
58
52
|
'hooks/context-compaction.ts',
|
|
59
53
|
'hooks/provider-window.js',
|
|
54
|
+
'hooks/provider-window.d.ts',
|
|
60
55
|
'hooks/state-fitting.mjs',
|
|
61
56
|
'hooks/state-fitting.d.mts',
|
|
62
57
|
'hooks/native-host-contract.test.ts',
|
|
@@ -329,24 +324,30 @@ async function runHostProbe(executable, pluginRoot, limits = {}) {
|
|
|
329
324
|
];
|
|
330
325
|
if (errors.length > 0) return { ok: false, reason: 'plugin_validation_failed' };
|
|
331
326
|
const notes = contents.flatMap((item) => item.notes);
|
|
332
|
-
|
|
333
|
-
|
|
327
|
+
// Claude 2.1.323 wraps a long inventory into several notes that repeat the
|
|
328
|
+
// "<module> hooks: " or "<module> calls: " prefix, so read every matching note.
|
|
329
|
+
/** @param {string} marker */
|
|
330
|
+
const inventoryNotes = (marker) =>
|
|
331
|
+
notes.filter(
|
|
332
|
+
/** @returns {note is string} */
|
|
333
|
+
(note) => typeof note === 'string' && note.includes(marker),
|
|
334
|
+
);
|
|
334
335
|
const hooks = new Set(
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
336
|
+
inventoryNotes(' hooks: ').flatMap((note) =>
|
|
337
|
+
note
|
|
338
|
+
.split(' hooks: ', 2)[1]
|
|
339
|
+
.split(', ')
|
|
340
|
+
.map((item) => item.trim()),
|
|
341
|
+
),
|
|
341
342
|
);
|
|
342
343
|
const calls = new Set(
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
344
|
+
inventoryNotes(' calls: ').flatMap((note) =>
|
|
345
|
+
note
|
|
346
|
+
.split(' calls: ', 2)[1]
|
|
347
|
+
.replace(/\s+\(via[^)]*\)/gu, '')
|
|
348
|
+
.split(', ')
|
|
349
|
+
.map((item) => item.trim()),
|
|
350
|
+
),
|
|
350
351
|
);
|
|
351
352
|
const inventory = new Set([...hooks, ...calls]);
|
|
352
353
|
if (inventory.size === 0 || REQUIRED_INVENTORY.some((item) => !inventory.has(item)))
|
|
@@ -16,7 +16,7 @@ export const MAX_LOG_FILES = 3;
|
|
|
16
16
|
const LOCK_WAIT_MS = 250;
|
|
17
17
|
const LOCK_STALE_MS = 30_000;
|
|
18
18
|
const ADMISSION_MS = 60 * 60 * 1000;
|
|
19
|
-
export const ADAPTER_VERSION = '0.4.0-beta.
|
|
19
|
+
export const ADAPTER_VERSION = '0.4.0-beta.22';
|
|
20
20
|
const MAX_DIAGNOSTIC_COUNT = 10_000_000;
|
|
21
21
|
const MAX_DIAGNOSTIC_BYTES = 128 * 1024 * 1024;
|
|
22
22
|
const CHECKPOINT_BACKENDS = new Set(['native_store', 'private_file']);
|
|
@@ -206,6 +206,7 @@ const SAFE_ERROR_CODES = new Set([
|
|
|
206
206
|
'mcp_tool_unavailable',
|
|
207
207
|
'mcp_feature_disabled',
|
|
208
208
|
'mcp_paid_plan_required',
|
|
209
|
+
'mcp_invalid_input',
|
|
209
210
|
'provider_error',
|
|
210
211
|
'helper_failed',
|
|
211
212
|
]);
|