sneakoscope 2.0.4 → 2.0.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 +12 -8
- package/crates/sks-core/Cargo.lock +1 -1
- package/crates/sks-core/Cargo.toml +1 -1
- package/crates/sks-core/src/main.rs +1 -1
- package/dist/.sks-build-stamp.json +4 -4
- package/dist/bin/sks.js +1 -1
- package/dist/build-manifest.json +73 -8
- package/dist/commands/doctor.js +14 -0
- package/dist/core/agents/agent-proof-evidence.js +35 -0
- package/dist/core/agents/agent-roster.js +35 -6
- package/dist/core/agents/agent-schema.js +1 -1
- package/dist/core/agents/native-worker-backend-router.js +31 -9
- package/dist/core/agents/ollama-worker-config.js +164 -15
- package/dist/core/codex/codex-0-137-compat.js +119 -0
- package/dist/core/codex-control/codex-control-proof.js +4 -1
- package/dist/core/codex-control/codex-sdk-capability.js +1 -1
- package/dist/core/codex-control/codex-task-runner.js +329 -5
- package/dist/core/codex-control/python-codex-sdk-adapter.js +197 -0
- package/dist/core/codex-control/python-codex-sdk-event-translator.js +14 -0
- package/dist/core/commands/local-model-command.js +65 -19
- package/dist/core/commands/naruto-command.js +118 -7
- package/dist/core/commands/run-command.js +1 -1
- package/dist/core/doctor/doctor-readiness-matrix.js +21 -2
- package/dist/core/fsx.js +1 -1
- package/dist/core/local-llm/local-llm-backpressure.js +20 -0
- package/dist/core/local-llm/local-llm-capability.js +29 -0
- package/dist/core/local-llm/local-llm-client.js +100 -0
- package/dist/core/local-llm/local-llm-config.js +6 -1
- package/dist/core/local-llm/local-llm-context-cache.js +21 -0
- package/dist/core/local-llm/local-llm-control-adapter.js +101 -0
- package/dist/core/local-llm/local-llm-json-repair.js +52 -0
- package/dist/core/local-llm/local-llm-metrics.js +42 -0
- package/dist/core/local-llm/local-llm-ollama-client.js +67 -0
- package/dist/core/local-llm/local-llm-openai-compatible-client.js +30 -0
- package/dist/core/local-llm/local-llm-prompt-cache.js +12 -0
- package/dist/core/local-llm/local-llm-scheduler.js +29 -0
- package/dist/core/local-llm/local-llm-schema-enforcer.js +15 -0
- package/dist/core/local-llm/local-llm-smoke.js +83 -0
- package/dist/core/local-llm/local-llm-warmup.js +20 -0
- package/dist/core/local-llm/local-worker-eligibility.js +27 -0
- package/dist/core/naruto/hardware-capacity-probe.js +36 -0
- package/dist/core/naruto/naruto-active-pool.js +118 -0
- package/dist/core/naruto/naruto-backpressure.js +13 -0
- package/dist/core/naruto/naruto-concurrency-governor.js +65 -0
- package/dist/core/naruto/naruto-finalizer.js +18 -0
- package/dist/core/naruto/naruto-generation-scheduler.js +18 -0
- package/dist/core/naruto/naruto-gpt-final-pack.js +49 -0
- package/dist/core/naruto/naruto-parallel-patch-apply.js +95 -0
- package/dist/core/naruto/naruto-patch-transaction-batch.js +42 -0
- package/dist/core/naruto/naruto-role-policy.js +107 -0
- package/dist/core/naruto/naruto-verification-dag.js +42 -0
- package/dist/core/naruto/naruto-verification-pool.js +18 -0
- package/dist/core/naruto/naruto-work-graph.js +198 -0
- package/dist/core/naruto/naruto-work-item.js +40 -0
- package/dist/core/naruto/naruto-work-stealing.js +11 -0
- package/dist/core/naruto/resource-pressure-monitor.js +32 -0
- package/dist/core/pipeline/finalize-pipeline-result.js +58 -0
- package/dist/core/pipeline/gpt-final-required.js +12 -0
- package/dist/core/prompt/prompt-placeholder-guard.js +30 -0
- package/dist/core/router/capability-card.js +13 -0
- package/dist/core/router/route-cache.js +3 -0
- package/dist/core/router/ultra-router.js +2 -1
- package/dist/core/routes.js +4 -4
- package/dist/core/version.js +1 -1
- package/dist/core/zellij/zellij-lane-runtime.js +2 -2
- package/dist/core/zellij/zellij-naruto-dashboard.js +36 -0
- package/dist/core/zellij/zellij-worker-pane-manager.js +4 -4
- package/dist/scripts/blackbox-command-import-smoke.js +10 -1
- package/dist/scripts/check-package-boundary.js +12 -3
- package/dist/scripts/codex-0-137-compat-check.js +27 -0
- package/dist/scripts/codex-environment-scoped-approvals-check.js +10 -0
- package/dist/scripts/codex-plugin-list-json-check.js +8 -0
- package/dist/scripts/codex-thread-runtime-choice-check.js +10 -0
- package/dist/scripts/local-collab-all-pipelines-final-gpt-check.js +21 -0
- package/dist/scripts/local-llm-all-pipelines-check.js +11 -0
- package/dist/scripts/local-llm-cache-performance-check.js +10 -0
- package/dist/scripts/local-llm-capability-check.js +14 -0
- package/dist/scripts/local-llm-smoke-check.js +23 -0
- package/dist/scripts/local-llm-structured-output-check.js +11 -0
- package/dist/scripts/local-llm-throughput-check.js +10 -0
- package/dist/scripts/local-llm-tool-call-repair-check.js +10 -0
- package/dist/scripts/local-llm-warmup-check.js +11 -0
- package/dist/scripts/naruto-active-pool-check.js +27 -0
- package/dist/scripts/naruto-concurrency-governor-check.js +52 -0
- package/dist/scripts/naruto-gpt-final-pack-check.js +34 -0
- package/dist/scripts/naruto-parallel-patch-apply-check.js +41 -0
- package/dist/scripts/naruto-real-local-gpt-final-smoke.js +16 -0
- package/dist/scripts/naruto-role-distribution-check.js +23 -0
- package/dist/scripts/naruto-shadow-clone-swarm-check.js +6 -0
- package/dist/scripts/naruto-verification-pool-check.js +36 -0
- package/dist/scripts/naruto-work-graph-check.js +24 -0
- package/dist/scripts/naruto-zellij-massive-ui-check.js +23 -0
- package/dist/scripts/prompt-placeholder-guard-check.js +33 -0
- package/dist/scripts/python-codex-sdk-all-pipelines-check.js +47 -0
- package/dist/scripts/python-codex-sdk-capability-check.js +75 -0
- package/dist/scripts/python-codex-sdk-sandbox-policy-check.js +10 -0
- package/dist/scripts/python-codex-sdk-stream-bridge-check.js +12 -0
- package/dist/scripts/release-parallel-check.js +1 -1
- package/dist/scripts/release-real-check.js +5 -0
- package/dist/scripts/zellij-worker-pane-manager-check.js +1 -1
- package/package.json +33 -4
- package/schemas/local-llm/local-model-config.schema.json +74 -0
- package/schemas/naruto/naruto-concurrency-governor.schema.json +21 -0
- package/schemas/naruto/naruto-work-graph.schema.json +22 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const NARUTO_WORK_KINDS = [
|
|
2
|
+
'implementation',
|
|
3
|
+
'code_modification',
|
|
4
|
+
'refactor',
|
|
5
|
+
'test_generation',
|
|
6
|
+
'test_execution',
|
|
7
|
+
'verification',
|
|
8
|
+
'research',
|
|
9
|
+
'documentation',
|
|
10
|
+
'ux_review',
|
|
11
|
+
'ppt_review',
|
|
12
|
+
'image_review',
|
|
13
|
+
'conflict_resolution',
|
|
14
|
+
'patch_rebase',
|
|
15
|
+
'rollback_preparation',
|
|
16
|
+
'integration_support',
|
|
17
|
+
'final_review_input_pack'
|
|
18
|
+
];
|
|
19
|
+
export const NARUTO_WRITE_WORK_KINDS = new Set([
|
|
20
|
+
'implementation',
|
|
21
|
+
'code_modification',
|
|
22
|
+
'refactor',
|
|
23
|
+
'test_generation',
|
|
24
|
+
'documentation',
|
|
25
|
+
'conflict_resolution',
|
|
26
|
+
'patch_rebase',
|
|
27
|
+
'rollback_preparation',
|
|
28
|
+
'integration_support'
|
|
29
|
+
]);
|
|
30
|
+
export function isNarutoWriteKind(kind) {
|
|
31
|
+
return NARUTO_WRITE_WORK_KINDS.has(kind);
|
|
32
|
+
}
|
|
33
|
+
export function normalizeNarutoWorkKind(value, fallback = 'verification') {
|
|
34
|
+
const text = String(value || '');
|
|
35
|
+
return NARUTO_WORK_KINDS.includes(text) ? text : fallback;
|
|
36
|
+
}
|
|
37
|
+
export function normalizeNarutoPath(value) {
|
|
38
|
+
return String(value || '').replace(/\\/g, '/').replace(/^\.\/+/, '').split('/').filter((part) => part && part !== '.').join('/');
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=naruto-work-item.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function stealNarutoWork(queue, input = {}) {
|
|
2
|
+
const item = queue.shift() || null;
|
|
3
|
+
return {
|
|
4
|
+
schema: 'sks.naruto-work-stealing.v1',
|
|
5
|
+
stolen: Boolean(item),
|
|
6
|
+
work_item_id: item?.id || null,
|
|
7
|
+
from_queue: input.fromQueue || 'pending',
|
|
8
|
+
to_slot: input.toSlot || 'idle-slot'
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=naruto-work-stealing.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function monitorNarutoResourcePressure(probe, input = {}) {
|
|
2
|
+
const activeWorkers = Math.max(1, Math.floor(Number(input.activeWorkers || 1)));
|
|
3
|
+
const zellijCap = Math.max(1, Math.floor(Number(input.zellijVisiblePaneCap || 12)));
|
|
4
|
+
const memoryPressure = 1 - (probe.free_memory_bytes / Math.max(1, probe.total_memory_bytes));
|
|
5
|
+
const cpuPressure = Math.min(1, (probe.current_load_average[0] || 0) / Math.max(1, probe.cpu_core_count));
|
|
6
|
+
const fdPressure = Math.min(1, (activeWorkers * 6 + probe.process_count) / Math.max(1, probe.file_descriptor_limit));
|
|
7
|
+
const zellijPressure = Math.min(1, probe.zellij_pane_count / zellijCap);
|
|
8
|
+
const diskIoPressure = probe.disk_io_pressure;
|
|
9
|
+
const reasons = [
|
|
10
|
+
...(memoryPressure > 0.8 ? ['memory_cap'] : []),
|
|
11
|
+
...(cpuPressure > 0.9 ? ['cpu_load_cap'] : []),
|
|
12
|
+
...(fdPressure > 0.75 ? ['file_descriptor_budget'] : []),
|
|
13
|
+
...(zellijPressure > 0.9 ? ['zellij_ui_pane_budget'] : []),
|
|
14
|
+
...(diskIoPressure > 0.75 ? ['disk_io_pressure'] : [])
|
|
15
|
+
];
|
|
16
|
+
const maxPressure = Math.max(memoryPressure, cpuPressure, fdPressure, zellijPressure, diskIoPressure);
|
|
17
|
+
const state = maxPressure >= 0.92 ? 'saturated' : maxPressure >= 0.72 ? 'throttled' : 'normal';
|
|
18
|
+
return {
|
|
19
|
+
schema: 'sks.naruto-resource-pressure.v1',
|
|
20
|
+
state,
|
|
21
|
+
memory_pressure: round(memoryPressure),
|
|
22
|
+
cpu_pressure: round(cpuPressure),
|
|
23
|
+
fd_pressure: round(fdPressure),
|
|
24
|
+
zellij_pressure: round(zellijPressure),
|
|
25
|
+
disk_io_pressure: round(diskIoPressure),
|
|
26
|
+
reasons
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function round(value) {
|
|
30
|
+
return Math.round(Math.max(0, Math.min(1, value)) * 1000) / 1000;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=resource-pressure-monitor.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { nowIso, writeJsonAtomic } from '../fsx.js';
|
|
3
|
+
import { runGptFinalArbiter } from '../codex-control/gpt-final-arbiter.js';
|
|
4
|
+
import { gptFinalRequiredForPipeline } from './gpt-final-required.js';
|
|
5
|
+
export async function finalizePipelineResult(input) {
|
|
6
|
+
const cwd = path.resolve(input.cwd || process.cwd());
|
|
7
|
+
const root = path.resolve(input.mutationLedgerRoot || path.join(cwd, '.sneakoscope', 'tmp', 'pipeline-finalize', safeName(input.missionId)));
|
|
8
|
+
const requirement = gptFinalRequiredForPipeline({
|
|
9
|
+
localParticipated: input.localParticipated,
|
|
10
|
+
candidateResults: input.candidateResults
|
|
11
|
+
});
|
|
12
|
+
let arbiter = null;
|
|
13
|
+
let blockers = [];
|
|
14
|
+
if (requirement.gpt_final_required) {
|
|
15
|
+
arbiter = await runGptFinalArbiter({
|
|
16
|
+
schema: 'sks.gpt-final-arbiter-input.v1',
|
|
17
|
+
route: input.route,
|
|
18
|
+
mission_id: input.missionId,
|
|
19
|
+
local_mode: 'local-parallel-gpt-final',
|
|
20
|
+
local_outputs: input.candidateResults,
|
|
21
|
+
candidate_patch_envelopes: input.candidatePatchEnvelopes
|
|
22
|
+
}, {
|
|
23
|
+
cwd,
|
|
24
|
+
mutationLedgerRoot: path.join(root, 'gpt-final-arbiter'),
|
|
25
|
+
...(typeof input.forceGptFinalUnavailable === 'boolean' ? { forceUnavailable: input.forceGptFinalUnavailable } : {})
|
|
26
|
+
});
|
|
27
|
+
blockers = [
|
|
28
|
+
...(arbiter.ok ? [] : ['gpt_final_arbiter_required_not_passed']),
|
|
29
|
+
...(Array.isArray(arbiter.blockers) ? arbiter.blockers.map(String) : [])
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
const result = {
|
|
33
|
+
schema: 'sks.pipeline-finalize-result.v1',
|
|
34
|
+
generated_at: nowIso(),
|
|
35
|
+
ok: blockers.length === 0,
|
|
36
|
+
route: input.route,
|
|
37
|
+
mission_id: input.missionId,
|
|
38
|
+
local_participated: requirement.local_participated,
|
|
39
|
+
gpt_final_required: requirement.gpt_final_required,
|
|
40
|
+
gpt_final_arbiter: arbiter,
|
|
41
|
+
final_status: blockers.length ? 'blocked' : 'accepted',
|
|
42
|
+
apply_allowed: blockers.length === 0 && input.applyPatches === true,
|
|
43
|
+
final_patch_source: requirement.gpt_final_required ? 'gpt_final_arbiter' : 'deterministic_finalize',
|
|
44
|
+
candidate_results_count: input.candidateResults.length,
|
|
45
|
+
candidate_patch_envelope_count: input.candidatePatchEnvelopes.length,
|
|
46
|
+
verification_results_count: input.verificationResults.length,
|
|
47
|
+
side_effect_report: input.sideEffectReport,
|
|
48
|
+
mutation_ledger: input.mutationLedger,
|
|
49
|
+
rollback_plan: input.rollbackPlan,
|
|
50
|
+
blockers
|
|
51
|
+
};
|
|
52
|
+
await writeJsonAtomic(path.join(root, 'pipeline-finalize-result.json'), result);
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
function safeName(value) {
|
|
56
|
+
return String(value || 'unknown').replace(/[^a-zA-Z0-9_.-]+/g, '-').slice(0, 80);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=finalize-pipeline-result.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { localCollaborationParticipated } from '../local-llm/local-collaboration-policy.js';
|
|
2
|
+
export function gptFinalRequiredForPipeline(input) {
|
|
3
|
+
const localParticipated = input.localParticipated === true
|
|
4
|
+
|| localCollaborationParticipated(Array.isArray(input.candidateResults) ? input.candidateResults : []);
|
|
5
|
+
return {
|
|
6
|
+
schema: 'sks.gpt-final-required.v1',
|
|
7
|
+
local_participated: localParticipated,
|
|
8
|
+
gpt_final_required: localParticipated,
|
|
9
|
+
reason: localParticipated ? 'local_llm_outputs_are_drafts' : 'no_local_participation'
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=gpt-final-required.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const PLACEHOLDER_PATTERNS = [
|
|
2
|
+
/@filename\b/i,
|
|
3
|
+
/<file>/i,
|
|
4
|
+
/\bTODO_PATH\b/i,
|
|
5
|
+
/\bINSERT_PATH_HERE\b/i,
|
|
6
|
+
/\/path\/to\/file\b/i
|
|
7
|
+
];
|
|
8
|
+
export function checkPromptPlaceholders(input = {}) {
|
|
9
|
+
const prompt = String(input.prompt || '');
|
|
10
|
+
const writeCapable = input.writeCapable === true;
|
|
11
|
+
const placeholders = PLACEHOLDER_PATTERNS
|
|
12
|
+
.filter((pattern) => pattern.test(prompt))
|
|
13
|
+
.map((pattern) => pattern.source);
|
|
14
|
+
const emptyTargetPaths = writeCapable && (!Array.isArray(input.targetPaths) || input.targetPaths.length === 0);
|
|
15
|
+
const blockers = writeCapable ? [
|
|
16
|
+
...placeholders.map((placeholder) => `unresolved_prompt_placeholder:${placeholder}`),
|
|
17
|
+
...(emptyTargetPaths ? ['write_capable_prompt_target_paths_empty'] : [])
|
|
18
|
+
] : [];
|
|
19
|
+
const warnings = writeCapable ? [] : placeholders.map((placeholder) => `readonly_prompt_placeholder_warning:${placeholder}`);
|
|
20
|
+
return {
|
|
21
|
+
schema: 'sks.prompt-placeholder-guard.v1',
|
|
22
|
+
ok: blockers.length === 0,
|
|
23
|
+
write_capable: writeCapable,
|
|
24
|
+
placeholders,
|
|
25
|
+
empty_target_paths: emptyTargetPaths,
|
|
26
|
+
blockers,
|
|
27
|
+
warnings
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=prompt-placeholder-guard.js.map
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
export const DEFAULT_CAPABILITY_CARDS = [
|
|
2
|
+
{
|
|
3
|
+
id: 'local-llm-worker',
|
|
4
|
+
tier: 'worker',
|
|
5
|
+
supports_images: false,
|
|
6
|
+
supports_write: true,
|
|
7
|
+
supports_research: false,
|
|
8
|
+
reliability: 0.78,
|
|
9
|
+
latency_cost: 1,
|
|
10
|
+
token_cost: 0,
|
|
11
|
+
mutation_risk_cost: 2,
|
|
12
|
+
model_price_cost: 0,
|
|
13
|
+
queue_pressure_cost: 2
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
id: 'fast-worker',
|
|
4
17
|
tier: 'worker',
|
|
@@ -8,6 +8,9 @@ export function codexRouteCacheKey(input) {
|
|
|
8
8
|
files: input.inputFiles || [],
|
|
9
9
|
images: (input.inputImages || []).length,
|
|
10
10
|
sandbox: input.sandboxPolicy,
|
|
11
|
+
allow_local_llm: input.allowLocalLlm === true,
|
|
12
|
+
backend_preference: input.backendPreference || [],
|
|
13
|
+
local_llm_policy: input.localLlmPolicy || null,
|
|
11
14
|
write_paths: input.requestedScopeContract?.write_paths || [],
|
|
12
15
|
allowed_paths: input.requestedScopeContract?.allowed_paths || []
|
|
13
16
|
}));
|
|
@@ -8,7 +8,8 @@ export function routeCodexTask(input, cards = DEFAULT_CAPABILITY_CARDS) {
|
|
|
8
8
|
return { ...cached, cache_hit: true };
|
|
9
9
|
const classification = classifyCodexTask(input);
|
|
10
10
|
const hardFilters = [];
|
|
11
|
-
const
|
|
11
|
+
const availableCards = input.allowLocalLlm === true ? cards : cards.filter((card) => card.id !== 'local-llm-worker');
|
|
12
|
+
const scored = availableCards.map((card) => {
|
|
12
13
|
const score = scoreCapabilityCard(card, classification);
|
|
13
14
|
if (score === 0)
|
|
14
15
|
hardFilters.push(card.id);
|
package/dist/core/routes.js
CHANGED
|
@@ -371,16 +371,16 @@ export const ROUTES = [
|
|
|
371
371
|
id: 'Naruto',
|
|
372
372
|
command: '$Naruto',
|
|
373
373
|
mode: 'NARUTO',
|
|
374
|
-
route: '
|
|
375
|
-
description: '
|
|
374
|
+
route: 'hardware-safe massive parallel work swarm',
|
|
375
|
+
description: '$Naruto mode launches a hardware-safe massive parallel work swarm. Clones may implement, modify, verify, test, research, document, and resolve conflicts according to role and lease policy; write-capable output is accepted only through patch envelopes, verification DAG, mutation guard, and GPT final arbiter.',
|
|
376
376
|
requiredSkills: ['team', 'pipeline-runner', 'prompt-pipeline', 'honest-mode'],
|
|
377
377
|
dollarAliases: ['$ShadowClone', '$Kagebunshin'],
|
|
378
378
|
appSkillAliases: ['shadow-clone', 'kage-bunshin'],
|
|
379
|
-
lifecycle: ['clone_roster_build', '
|
|
379
|
+
lifecycle: ['clone_roster_build', 'massive_work_graph', 'hardware_safe_governor', 'dynamic_active_pool', 'lease_based_write_swarm', 'parallel_verification_dag', 'gpt_final_arbiter_pack', 'per_clone_proof', 'session_cleanup', 'honest_mode'],
|
|
380
380
|
context7Policy: 'optional',
|
|
381
381
|
reasoningPolicy: 'high',
|
|
382
382
|
stopGate: 'team-gate.json',
|
|
383
|
-
cliEntrypoint: 'sks naruto run "task" [--clones N] [--backend codex-
|
|
383
|
+
cliEntrypoint: 'sks naruto run "task" [--clones N] [--backend codex-sdk|fake|ollama] [--parallel-write] | sks naruto status',
|
|
384
384
|
examples: ['$Naruto run sweep the codebase for TODO comments with 50 clones', '$ShadowClone --clones 100 fan out and draft tests for every module']
|
|
385
385
|
},
|
|
386
386
|
{
|
package/dist/core/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = '2.0.
|
|
1
|
+
export const PACKAGE_VERSION = '2.0.5';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -176,10 +176,10 @@ export function extractZellijPaneIdFromOutput(text) {
|
|
|
176
176
|
}
|
|
177
177
|
const lines = raw.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
178
178
|
for (const line of lines.slice().reverse()) {
|
|
179
|
-
const direct = line.match(/^(?:pane[_ -]?id[:=]\s*)?([0-9]+)$/i);
|
|
179
|
+
const direct = line.match(/^(?:pane[_ -]?id[:=]\s*)?([0-9]+|terminal_[0-9]+)$/i);
|
|
180
180
|
if (direct?.[1])
|
|
181
181
|
return direct[1];
|
|
182
|
-
const embedded = line.match(/\bpane[_ -]?id[:=]\s*([0-9]+)\b/i);
|
|
182
|
+
const embedded = line.match(/\bpane[_ -]?id[:=]\s*([0-9]+|terminal_[0-9]+)\b/i);
|
|
183
183
|
if (embedded?.[1])
|
|
184
184
|
return embedded[1];
|
|
185
185
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function planNarutoZellijDashboard(input) {
|
|
2
|
+
const targetActiveWorkers = Math.max(1, Math.floor(Number(input.targetActiveWorkers || 1)));
|
|
3
|
+
const visiblePaneCap = Math.max(1, Math.floor(Number(input.visiblePaneCap || 12)));
|
|
4
|
+
const visibleWorkerPanes = Math.min(targetActiveWorkers, visiblePaneCap);
|
|
5
|
+
const headlessWorkers = Math.max(0, targetActiveWorkers - visibleWorkerPanes);
|
|
6
|
+
const backend = input.backend || 'codex-sdk';
|
|
7
|
+
const roles = input.roles && input.roles.length ? input.roles : ['implementer', 'modifier', 'verifier', 'test_writer'];
|
|
8
|
+
const paneTitles = Array.from({ length: visibleWorkerPanes }, (_, index) => {
|
|
9
|
+
const slot = `slot-${String(index + 1).padStart(3, '0')}`;
|
|
10
|
+
const role = roles[index % roles.length] || 'worker';
|
|
11
|
+
return `${slot}/gen-1 · ${role} · ${backend} · active`;
|
|
12
|
+
});
|
|
13
|
+
const blockers = [
|
|
14
|
+
...(visibleWorkerPanes > visiblePaneCap ? ['naruto_zellij_visible_panes_exceed_cap'] : []),
|
|
15
|
+
...(headlessWorkers < 0 ? ['naruto_zellij_headless_negative'] : [])
|
|
16
|
+
];
|
|
17
|
+
return {
|
|
18
|
+
schema: 'sks.zellij-naruto-dashboard.v1',
|
|
19
|
+
target_active_workers: targetActiveWorkers,
|
|
20
|
+
visible_pane_cap: visiblePaneCap,
|
|
21
|
+
visible_worker_panes: visibleWorkerPanes,
|
|
22
|
+
headless_workers: headlessWorkers,
|
|
23
|
+
dashboard: {
|
|
24
|
+
active: targetActiveWorkers,
|
|
25
|
+
visible: visibleWorkerPanes,
|
|
26
|
+
headless: headlessWorkers,
|
|
27
|
+
completed: Math.max(0, Math.floor(Number(input.completed || 0))),
|
|
28
|
+
failed: Math.max(0, Math.floor(Number(input.failed || 0))),
|
|
29
|
+
backpressure: input.backpressure || 'normal'
|
|
30
|
+
},
|
|
31
|
+
pane_titles: paneTitles,
|
|
32
|
+
ok: blockers.length === 0,
|
|
33
|
+
blockers
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=zellij-naruto-dashboard.js.map
|
|
@@ -9,10 +9,10 @@ export const ZELLIJ_WORKER_PANE_EVENT_SCHEMA = 'sks.zellij-worker-pane-event.v1'
|
|
|
9
9
|
export function buildWorkerPaneName(slotId, generationIndex) {
|
|
10
10
|
return `${slotId}/gen-${Math.max(1, Math.floor(Number(generationIndex) || 1))}`;
|
|
11
11
|
}
|
|
12
|
-
export function buildWorkerPaneTitle(slotId, generationIndex, context, serviceTier) {
|
|
12
|
+
export function buildWorkerPaneTitle(slotId, generationIndex, context, serviceTier, backend, status) {
|
|
13
13
|
const base = buildWorkerPaneName(slotId, generationIndex);
|
|
14
14
|
const normalized = normalizePaneProviderContext(context, serviceTier);
|
|
15
|
-
return `${base} · codex-sdk · ${providerPaneLabel(normalized)}`;
|
|
15
|
+
return `${base} · ${backend || 'codex-sdk'} · ${providerPaneLabel(normalized)} · ${status || 'launching'}`;
|
|
16
16
|
}
|
|
17
17
|
export function isRealZellijWorkerPaneIdSource(value) {
|
|
18
18
|
return value === 'zellij_worker_new_pane_stdout' || value === 'zellij_worker_list_panes';
|
|
@@ -22,7 +22,7 @@ export function buildWorkerPaneArtifact(input) {
|
|
|
22
22
|
const paneIdSource = input.paneIdSource || 'zellij_worker_pane_launch_failed';
|
|
23
23
|
const blockers = input.blockers || [];
|
|
24
24
|
const providerContext = normalizePaneProviderContext(input.providerContext, input.serviceTier);
|
|
25
|
-
const paneTitle = buildWorkerPaneTitle(input.slotId, input.generationIndex, providerContext, input.serviceTier);
|
|
25
|
+
const paneTitle = buildWorkerPaneTitle(input.slotId, input.generationIndex, providerContext, input.serviceTier, input.backend, input.status || input.statusLabel);
|
|
26
26
|
return {
|
|
27
27
|
schema: ZELLIJ_WORKER_PANE_SCHEMA,
|
|
28
28
|
generated_at: now,
|
|
@@ -82,7 +82,7 @@ export async function openWorkerPane(input) {
|
|
|
82
82
|
timeoutMs: 5000,
|
|
83
83
|
optional: false
|
|
84
84
|
});
|
|
85
|
-
const paneName = buildWorkerPaneTitle(input.slotId, input.generationIndex, providerContext, input.serviceTier);
|
|
85
|
+
const paneName = buildWorkerPaneTitle(input.slotId, input.generationIndex, providerContext, input.serviceTier, input.backend, input.statusLabel || 'running');
|
|
86
86
|
let launch = createSession.ok
|
|
87
87
|
? await runZellij(['--session', input.sessionName, 'action', 'new-pane', '--direction', 'right', '--name', paneName, '--', 'sh', '-lc', input.workerCommand], {
|
|
88
88
|
cwd,
|
|
@@ -5,6 +5,7 @@ import os from 'node:os';
|
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { spawnSync } from 'node:child_process';
|
|
7
7
|
import { pathToFileURL } from 'node:url';
|
|
8
|
+
import { currentDistFreshness } from './lib/ensure-dist-fresh.js';
|
|
8
9
|
const root = process.cwd();
|
|
9
10
|
const npmBin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
10
11
|
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'sks-command-import-smoke-'));
|
|
@@ -16,7 +17,15 @@ const rows = [];
|
|
|
16
17
|
fs.mkdirSync(consumer, { recursive: true });
|
|
17
18
|
fs.writeFileSync(path.join(consumer, 'package.json'), `${JSON.stringify({ name: 'sks-command-smoke-consumer', private: true }, null, 2)}\n`);
|
|
18
19
|
try {
|
|
19
|
-
|
|
20
|
+
if (process.env.SKS_ENSURE_DIST_NO_REBUILD === '1' || process.env.SKS_RELEASE_DIST_FRESHNESS_NO_REBUILD === '1') {
|
|
21
|
+
const freshness = currentDistFreshness();
|
|
22
|
+
rows.push({ label: 'dist_freshness', ok: freshness.ok, status: freshness.ok ? 0 : 1, issues: freshness.issues });
|
|
23
|
+
if (!freshness.ok)
|
|
24
|
+
failures.push(`dist_not_fresh:${freshness.issues.join(',')}`);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
run('build', npmBin, ['run', 'build'], { cwd: root });
|
|
28
|
+
}
|
|
20
29
|
const pack = run('npm_pack', npmBin, ['pack', '--json', '--ignore-scripts', '--pack-destination', tmp, '--registry', 'https://registry.npmjs.org/'], { cwd: root });
|
|
21
30
|
const info = pack.ok ? JSON.parse(pack.stdout || '[]')[0] : null;
|
|
22
31
|
const tarball = info ? path.join(tmp, info.filename) : null;
|
|
@@ -5,12 +5,21 @@ import os from 'node:os';
|
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { spawnSync } from 'node:child_process';
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import { currentDistFreshness } from './lib/ensure-dist-fresh.js';
|
|
8
9
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
9
10
|
const npmBin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
10
11
|
const issues = [];
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
|
|
12
|
+
const noRebuild = process.env.SKS_ENSURE_DIST_NO_REBUILD === '1' || process.env.SKS_RELEASE_DIST_FRESHNESS_NO_REBUILD === '1';
|
|
13
|
+
if (noRebuild) {
|
|
14
|
+
const freshness = currentDistFreshness();
|
|
15
|
+
if (!freshness.ok)
|
|
16
|
+
issues.push(`dist_not_fresh:${freshness.issues.join(',')}`);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
const build = spawnSync(npmBin, ['run', 'build'], { cwd: root, encoding: 'utf8', stdio: 'pipe' });
|
|
20
|
+
if (build.status !== 0)
|
|
21
|
+
issues.push(`build_failed:${tail(build.stderr || build.stdout)}`);
|
|
22
|
+
}
|
|
14
23
|
const pack = spawnSync(npmBin, ['pack', '--dry-run', '--json', '--ignore-scripts'], {
|
|
15
24
|
cwd: root,
|
|
16
25
|
encoding: 'utf8',
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import fs from 'node:fs/promises';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { pathToFileURL } from 'node:url';
|
|
6
|
+
import { ensureDistFresh, root } from './lib/ensure-dist-fresh.js';
|
|
7
|
+
const freshness = ensureDistFresh({ rebuild: true });
|
|
8
|
+
if (!freshness.ok)
|
|
9
|
+
fail('dist_not_fresh', { freshness });
|
|
10
|
+
const mod = await import(pathToFileURL(path.join(root, 'dist', 'core', 'codex', 'codex-0-137-compat.js')).href);
|
|
11
|
+
const evidence = await mod.collectCodex0137LocalEvidence();
|
|
12
|
+
const matrix = mod.codex0137Matrix({
|
|
13
|
+
version: evidence.versionText,
|
|
14
|
+
available: evidence.available,
|
|
15
|
+
pluginListText: evidence.pluginListText,
|
|
16
|
+
debugModelsText: evidence.debugModelsText,
|
|
17
|
+
doctorText: evidence.doctorText,
|
|
18
|
+
requireReal: process.argv.includes('--require-real') || process.env.SKS_REQUIRE_CODEX_0137 === '1'
|
|
19
|
+
});
|
|
20
|
+
const report = { ...matrix, local_evidence: evidence };
|
|
21
|
+
await fs.mkdir(path.join(root, '.sneakoscope', 'reports'), { recursive: true });
|
|
22
|
+
await fs.writeFile(path.join(root, '.sneakoscope', 'reports', 'codex-0.137-compat.json'), `${JSON.stringify(report, null, 2)}\n`);
|
|
23
|
+
emit(report);
|
|
24
|
+
function emit(report) { console.log(JSON.stringify(report, null, 2)); if (!report.ok)
|
|
25
|
+
process.exitCode = 1; }
|
|
26
|
+
function fail(blocker, detail) { emit({ schema: 'sks.codex-0.137-compat-check.v1', ok: false, blockers: [blocker], detail }); process.exit(1); }
|
|
27
|
+
//# sourceMappingURL=codex-0-137-compat-check.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { assertGate, emitGate, readText } from './lib/codex-sdk-gate-lib.js';
|
|
4
|
+
const proof = readText('src/core/codex-control/codex-control-proof.ts');
|
|
5
|
+
const sandbox = readText('src/core/codex-control/codex-sdk-sandbox-policy.ts');
|
|
6
|
+
assertGate(proof.includes('sandbox:'), 'Codex control proof must include sandbox scope');
|
|
7
|
+
assertGate(proof.includes('env:'), 'Codex control proof must include environment proof');
|
|
8
|
+
assertGate(sandbox.includes('mad_sks_authorized') || sandbox.includes('user_confirmed_full_access'), 'Sandbox policy must include scoped authorization signals');
|
|
9
|
+
emitGate('codex:environment-scoped-approvals', { proof: ['sandbox', 'env', 'scoped_authorization'] });
|
|
10
|
+
//# sourceMappingURL=codex-environment-scoped-approvals-check.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { assertGate, emitGate, readText } from './lib/codex-sdk-gate-lib.js';
|
|
4
|
+
const source = readText('src/core/codex/codex-0-137-compat.ts');
|
|
5
|
+
assertGate(source.includes("run(['plugin', 'list', '--json'])"), '0.137 evidence must run codex plugin list --json');
|
|
6
|
+
assertGate(source.includes('looksLikeJson'), '0.137 plugin list JSON parser missing');
|
|
7
|
+
emitGate('codex:plugin-list-json', { detector: 'codex plugin list --json' });
|
|
8
|
+
//# sourceMappingURL=codex-plugin-list-json-check.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { assertGate, emitGate, readText } from './lib/codex-sdk-gate-lib.js';
|
|
4
|
+
const runner = readText('src/core/codex-control/codex-task-runner.ts');
|
|
5
|
+
const registry = readText('src/core/codex-control/codex-thread-registry.ts');
|
|
6
|
+
assertGate(runner.includes('backendPreference'), 'Codex task runner must carry backend/runtime preference');
|
|
7
|
+
assertGate(runner.includes('backend_family'), 'Codex task runner must persist backend family');
|
|
8
|
+
assertGate(registry.includes('recordCodexThread'), 'Codex thread registry missing');
|
|
9
|
+
emitGate('codex:thread-runtime-choice', { runtime_choice: 'backendPreference/backend_family' });
|
|
10
|
+
//# sourceMappingURL=codex-thread-runtime-choice-check.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { assertGate, emitGate, importDist } from './lib/codex-sdk-gate-lib.js';
|
|
4
|
+
const finalizer = await importDist('core/pipeline/finalize-pipeline-result.js');
|
|
5
|
+
const blocked = await finalizer.finalizePipelineResult({
|
|
6
|
+
route: '$Team',
|
|
7
|
+
missionId: 'M-local-final-gpt',
|
|
8
|
+
localParticipated: true,
|
|
9
|
+
candidateResults: [{ backend: 'local-llm', summary: 'draft' }],
|
|
10
|
+
candidatePatchEnvelopes: [],
|
|
11
|
+
verificationResults: [],
|
|
12
|
+
sideEffectReport: {},
|
|
13
|
+
mutationLedger: {},
|
|
14
|
+
rollbackPlan: {},
|
|
15
|
+
applyPatches: true,
|
|
16
|
+
forceGptFinalUnavailable: true
|
|
17
|
+
});
|
|
18
|
+
assertGate(blocked.ok === false, 'local participation without GPT final must block finalization');
|
|
19
|
+
assertGate(blocked.blockers.includes('gpt_final_arbiter_required_not_passed'), 'missing GPT final blocker required');
|
|
20
|
+
emitGate('local-collab:all-pipelines-final-gpt', { final_status: blocked.final_status, blockers: blocked.blockers.length });
|
|
21
|
+
//# sourceMappingURL=local-collab-all-pipelines-final-gpt-check.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { assertGate, emitGate, readText } from './lib/codex-sdk-gate-lib.js';
|
|
4
|
+
const router = readText('src/core/agents/native-worker-backend-router.ts');
|
|
5
|
+
const control = readText('src/core/codex-control/codex-task-runner.ts');
|
|
6
|
+
const policy = readText('src/core/local-llm/local-worker-eligibility.ts');
|
|
7
|
+
assertGate(router.includes("backend === 'local-llm'"), 'native worker router must support local-llm backend');
|
|
8
|
+
assertGate(control.includes('runLocalLlmTask'), 'Codex Control Plane must call local LLM task adapter');
|
|
9
|
+
assertGate(policy.includes('requires_gpt_final'), 'local worker eligibility must require GPT final');
|
|
10
|
+
emitGate('local-llm:all-pipelines', { local_backend: 'local-llm', requires_gpt_final: true });
|
|
11
|
+
//# sourceMappingURL=local-llm-all-pipelines-check.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { assertGate, emitGate, importDist } from './lib/codex-sdk-gate-lib.js';
|
|
4
|
+
const cache = await importDist('core/local-llm/local-llm-prompt-cache.js');
|
|
5
|
+
const a = cache.buildLocalLlmPromptCacheRecord({ routeSystemEnvelopeHash: 'a', localWorkerPolicyHash: 'b', coreSkillSnapshotHash: 'c', triwikiContextPackHash: 'd', repoSummaryHash: 'e', capabilityCardHash: 'f' });
|
|
6
|
+
const b = cache.buildLocalLlmPromptCacheRecord({ routeSystemEnvelopeHash: 'a', localWorkerPolicyHash: 'b', coreSkillSnapshotHash: 'c', triwikiContextPackHash: 'd2', repoSummaryHash: 'e', capabilityCardHash: 'f' });
|
|
7
|
+
assertGate(a.cacheable === true, 'prompt cache record should be cacheable when hashes exist');
|
|
8
|
+
assertGate(a.cache_key !== b.cache_key, 'source hash change must invalidate cache');
|
|
9
|
+
emitGate('local-llm:cache-performance', { cacheable: a.cacheable, invalidates_on_hash_change: true });
|
|
10
|
+
//# sourceMappingURL=local-llm-cache-performance-check.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { assertGate, emitGate, importDist, readText } from './lib/codex-sdk-gate-lib.js';
|
|
4
|
+
const mod = await importDist('core/agents/ollama-worker-config.js');
|
|
5
|
+
const schemaText = readText('schemas/local-llm/local-model-config.schema.json');
|
|
6
|
+
const config = mod.normalizeLocalModelConfig({ enabled: true, status: 'enabled_unverified' });
|
|
7
|
+
const mlx = mod.normalizeLocalModelConfig({ enabled: true, provider: 'mlx-lm', model: 'mlx-community/Qwen3.6-35B-A3B-4bit', base_url: 'http://127.0.0.1:8080' });
|
|
8
|
+
assertGate(config.schema === 'sks.local-model-config.v2', 'local model config must use v2 schema');
|
|
9
|
+
assertGate(config.status === 'enabled_unverified', 'enabled without smoke must be enabled_unverified');
|
|
10
|
+
assertGate(mlx.provider === 'mlx-lm' && mlx.base_url === 'http://127.0.0.1:8080', 'local model config must preserve MLX LM provider settings');
|
|
11
|
+
assertGate(schemaText.includes('verified'), 'local model schema must include verified status');
|
|
12
|
+
assertGate(schemaText.includes('mlx-lm'), 'local model schema must allow MLX LM provider');
|
|
13
|
+
emitGate('local-llm:capability', { status: config.status, schema: config.schema, mlx_provider: mlx.provider });
|
|
14
|
+
//# sourceMappingURL=local-llm-capability-check.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { assertGate, emitGate, importDist, root } from './lib/codex-sdk-gate-lib.js';
|
|
4
|
+
const cfg = await importDist('core/agents/ollama-worker-config.js');
|
|
5
|
+
const smokeMod = await importDist('core/local-llm/local-llm-smoke.js');
|
|
6
|
+
const config = cfg.normalizeLocalModelConfig({ enabled: true, status: 'enabled_unverified' });
|
|
7
|
+
if (process.env.SKS_REQUIRE_LOCAL_LLM !== '1' && !process.argv.includes('--require-real')) {
|
|
8
|
+
const skipped = cfg.applyLocalLlmSmokeResult(config, { ok: false, skipped: true, status: 'enabled_unverified', reason: 'release_check_no_real_smoke', schema_valid: false });
|
|
9
|
+
assertGate(skipped.status === 'enabled_unverified', '--skip-smoke or hermetic mode must not verify local LLM');
|
|
10
|
+
emitGate('local-llm:smoke', { status: 'hermetic_skip', config_status: skipped.status });
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
const reportPath = `${root}/.sneakoscope/reports/local-llm-smoke-real.json`;
|
|
14
|
+
const realConfig = await cfg.readLocalModelConfig();
|
|
15
|
+
const first = await smokeMod.runLocalLlmGenerationSmoke(realConfig, { reportPath, timeoutMs: 60_000 });
|
|
16
|
+
const shouldRetry = first.ok !== true && String(first.blockers || []).match(/aborted|timeout|local_llm_generate_failed/i);
|
|
17
|
+
const smoke = shouldRetry
|
|
18
|
+
? await smokeMod.runLocalLlmGenerationSmoke(realConfig, { reportPath, timeoutMs: 90_000 })
|
|
19
|
+
: first;
|
|
20
|
+
assertGate(smoke.ok === true && smoke.schema_valid === true, 'real local LLM smoke failed', { smoke, retry_count: shouldRetry ? 1 : 0, first_failure_blockers: first.blockers || [] });
|
|
21
|
+
emitGate('local-llm:smoke', { status: 'real_verified', latency_ms: smoke.latency_ms, tokens_per_second: smoke.tokens_per_second, retry_count: shouldRetry ? 1 : 0 });
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=local-llm-smoke-check.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { assertGate, emitGate, importDist } from './lib/codex-sdk-gate-lib.js';
|
|
4
|
+
const mod = await importDist('core/local-llm/local-llm-schema-enforcer.js');
|
|
5
|
+
const schema = { type: 'object', required: ['status'], properties: { status: { type: 'string' } }, additionalProperties: false };
|
|
6
|
+
const good = mod.enforceLocalLlmJsonSchema('{"status":"ok"}', schema);
|
|
7
|
+
const bad = mod.enforceLocalLlmJsonSchema('plain words', schema);
|
|
8
|
+
assertGate(good.ok === true && good.schema_valid === true, 'valid local JSON should pass');
|
|
9
|
+
assertGate(bad.ok === false, 'natural language local output must not pass');
|
|
10
|
+
emitGate('local-llm:structured-output', { good: good.ok, bad: bad.ok });
|
|
11
|
+
//# sourceMappingURL=local-llm-structured-output-check.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { assertGate, emitGate, importDist } from './lib/codex-sdk-gate-lib.js';
|
|
4
|
+
const scheduler = await importDist('core/local-llm/local-llm-scheduler.js');
|
|
5
|
+
const plan = scheduler.planLocalLlmSchedule({ workItems: Array.from({ length: 20 }, (_, i) => ({ id: i })), maxParallelRequests: 4 });
|
|
6
|
+
assertGate(plan.ok === true, 'local scheduler must not exceed max parallel requests');
|
|
7
|
+
assertGate(plan.active_requests <= plan.max_parallel_requests, 'active requests exceeded max_parallel_requests');
|
|
8
|
+
assertGate(plan.queued_count === 16, '20 worker fixture should queue work beyond max parallel requests');
|
|
9
|
+
emitGate('local-llm:throughput', { active_requests: plan.active_requests, queued_count: plan.queued_count, backpressure: plan.backpressure });
|
|
10
|
+
//# sourceMappingURL=local-llm-throughput-check.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { assertGate, emitGate, importDist } from './lib/codex-sdk-gate-lib.js';
|
|
4
|
+
const mod = await importDist('core/local-llm/local-llm-json-repair.js');
|
|
5
|
+
const repaired = mod.parseOrRepairLocalLlmJson('Here is JSON: {"status":"ok","summary":"done"} thanks');
|
|
6
|
+
const failed = mod.parseOrRepairLocalLlmJson('not json at all');
|
|
7
|
+
assertGate(repaired.ok === true && repaired.repaired === true && repaired.attempts === 1, 'bounded JSON repair should recover one object');
|
|
8
|
+
assertGate(failed.ok === false && failed.attempts === 1, 'invalid local JSON must fail after one repair attempt');
|
|
9
|
+
emitGate('local-llm:tool-call-repair', { repaired: repaired.ok, failed: failed.ok });
|
|
10
|
+
//# sourceMappingURL=local-llm-tool-call-repair-check.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { assertGate, emitGate, importDist } from './lib/codex-sdk-gate-lib.js';
|
|
4
|
+
const cfg = await importDist('core/agents/ollama-worker-config.js');
|
|
5
|
+
const warmup = await importDist('core/local-llm/local-llm-warmup.js');
|
|
6
|
+
const state = warmup.buildLocalLlmWarmupState(cfg.normalizeLocalModelConfig({ enabled: true, status: 'enabled_unverified' }), { ok: true, ttlMs: 1000 });
|
|
7
|
+
assertGate(state.explicit_only === true, 'local warmup must be explicit only');
|
|
8
|
+
assertGate(state.postinstall_allowed === false, 'postinstall must not run local warmup');
|
|
9
|
+
assertGate(state.release_check_real_warmup_allowed === false, 'release:check must not run real warmup');
|
|
10
|
+
emitGate('local-llm:warmup', { explicit_only: state.explicit_only, expires_at: state.expires_at });
|
|
11
|
+
//# sourceMappingURL=local-llm-warmup-check.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { assertGate, emitGate, importDist } from './sks-1-18-gate-lib.js';
|
|
4
|
+
const workGraph = await importDist('core/naruto/naruto-work-graph.js');
|
|
5
|
+
const governorMod = await importDist('core/naruto/naruto-concurrency-governor.js');
|
|
6
|
+
const activePool = await importDist('core/naruto/naruto-active-pool.js');
|
|
7
|
+
const graph = workGraph.buildNarutoWorkGraph({ requestedClones: 20, totalWorkItems: 20, writeCapable: true, maxActiveWorkers: 5 });
|
|
8
|
+
const governor = governorMod.decideNarutoConcurrency({
|
|
9
|
+
requestedClones: 20,
|
|
10
|
+
totalWorkItems: 20,
|
|
11
|
+
pendingWorkQueueSize: 20,
|
|
12
|
+
backend: 'fake',
|
|
13
|
+
hardware: { remoteApiRateLimitBudget: 5, fileDescriptorLimit: 4096, freeMemoryBytes: 8 * 1024 * 1024 * 1024, totalMemoryBytes: 16 * 1024 * 1024 * 1024 }
|
|
14
|
+
});
|
|
15
|
+
const report = activePool.simulateNarutoActivePool({ graph, governor: { ...governor, safe_active_workers: 5 } });
|
|
16
|
+
assertGate(report.ok === true, 'active pool must drain cleanly', report);
|
|
17
|
+
assertGate(report.max_observed_active_workers <= 5, 'active pool must never exceed safe cap', report);
|
|
18
|
+
assertGate(report.completed_count >= graph.total_work_items, 'active pool must complete all base work items', report);
|
|
19
|
+
assertGate(report.refill_events >= 5, 'active pool must refill slots as work drains', report);
|
|
20
|
+
assertGate(report.duplicate_execution_count === 0, 'active pool must not duplicate work without retry', report);
|
|
21
|
+
emitGate('naruto:active-pool', {
|
|
22
|
+
safe_active_workers: report.safe_active_workers,
|
|
23
|
+
completed_count: report.completed_count,
|
|
24
|
+
refill_events: report.refill_events,
|
|
25
|
+
max_observed_active_workers: report.max_observed_active_workers
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=naruto-active-pool-check.js.map
|