@dailephd/my-centcom 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -5
- package/apps/daemon/dist/artifacts/returnSnapshots.d.ts +12 -0
- package/apps/daemon/dist/artifacts/returnSnapshots.js +41 -0
- package/apps/daemon/dist/bootstrap/app.d.ts +21 -0
- package/apps/daemon/dist/bootstrap/app.js +27 -0
- package/apps/daemon/dist/bootstrap/installLayout.d.ts +81 -0
- package/apps/daemon/dist/bootstrap/installLayout.js +164 -0
- package/apps/daemon/dist/bootstrap/main.d.ts +14 -0
- package/apps/daemon/dist/bootstrap/main.js +141 -0
- package/apps/daemon/dist/bootstrap/operatorConsole.d.ts +75 -0
- package/apps/daemon/dist/bootstrap/operatorConsole.js +293 -0
- package/apps/daemon/dist/bootstrap/privateDataRoot.d.ts +38 -0
- package/apps/daemon/dist/bootstrap/privateDataRoot.js +204 -0
- package/apps/daemon/dist/bootstrap/secureMain.d.ts +118 -0
- package/apps/daemon/dist/bootstrap/secureMain.js +403 -0
- package/apps/daemon/dist/bootstrap/setup.d.ts +93 -0
- package/apps/daemon/dist/bootstrap/setup.js +738 -0
- package/apps/daemon/dist/context/changeProposal.d.ts +97 -0
- package/apps/daemon/dist/context/changeProposal.js +259 -0
- package/apps/daemon/dist/context/gitEvidence.d.ts +88 -0
- package/apps/daemon/dist/context/gitEvidence.js +332 -0
- package/apps/daemon/dist/context/gitObservation.d.ts +30 -0
- package/apps/daemon/dist/context/gitObservation.js +113 -0
- package/apps/daemon/dist/context/projectReadIssuer.d.ts +68 -0
- package/apps/daemon/dist/context/projectReadIssuer.js +158 -0
- package/apps/daemon/dist/context/projectReadService.d.ts +153 -0
- package/apps/daemon/dist/context/projectReadService.js +652 -0
- package/apps/daemon/dist/context/projectViewService.d.ts +85 -0
- package/apps/daemon/dist/context/projectViewService.js +332 -0
- package/apps/daemon/dist/context/proposalRecorder.d.ts +11 -0
- package/apps/daemon/dist/context/proposalRecorder.js +19 -0
- package/apps/daemon/dist/plugins/drivers/codexMcpConfig.d.ts +40 -0
- package/apps/daemon/dist/plugins/drivers/codexMcpConfig.js +73 -0
- package/apps/daemon/dist/plugins/drivers/codexModelCompatibility.d.ts +49 -0
- package/apps/daemon/dist/plugins/drivers/codexModelCompatibility.js +70 -0
- package/apps/daemon/dist/plugins/drivers/fakePluginDriver.d.ts +16 -0
- package/apps/daemon/dist/plugins/drivers/fakePluginDriver.js +115 -0
- package/apps/daemon/dist/plugins/drivers/finiteCliDriver.d.ts +153 -0
- package/apps/daemon/dist/plugins/drivers/finiteCliDriver.js +505 -0
- package/apps/daemon/dist/plugins/registry/operationCatalog.d.ts +23 -0
- package/apps/daemon/dist/plugins/registry/operationCatalog.js +41 -0
- package/apps/daemon/dist/plugins/registry/registryOperationCatalog.d.ts +14 -0
- package/apps/daemon/dist/plugins/registry/registryOperationCatalog.js +29 -0
- package/apps/daemon/dist/plugins/registry/verifiedCapabilityRegistry.d.ts +151 -0
- package/apps/daemon/dist/plugins/registry/verifiedCapabilityRegistry.js +579 -0
- package/apps/daemon/dist/projects/codingAuthority.d.ts +102 -0
- package/apps/daemon/dist/projects/codingAuthority.js +244 -0
- package/apps/daemon/dist/projects/fixtureAuthorization.d.ts +54 -0
- package/apps/daemon/dist/projects/fixtureAuthorization.js +172 -0
- package/apps/daemon/dist/projects/pairedAuthority.d.ts +158 -0
- package/apps/daemon/dist/projects/pairedAuthority.js +273 -0
- package/apps/daemon/dist/projects/trustedCliConsent.d.ts +47 -0
- package/apps/daemon/dist/projects/trustedCliConsent.js +84 -0
- package/apps/daemon/dist/runs/changeApplier.d.ts +59 -0
- package/apps/daemon/dist/runs/changeApplier.js +319 -0
- package/apps/daemon/dist/runs/codingWorkflowService.d.ts +283 -0
- package/apps/daemon/dist/runs/codingWorkflowService.js +785 -0
- package/apps/daemon/dist/runs/durableIntentCoordinator.d.ts +72 -0
- package/apps/daemon/dist/runs/durableIntentCoordinator.js +160 -0
- package/apps/daemon/dist/runs/inMemoryCoordinator.d.ts +55 -0
- package/apps/daemon/dist/runs/inMemoryCoordinator.js +375 -0
- package/apps/daemon/dist/runs/runExecutor.d.ts +154 -0
- package/apps/daemon/dist/runs/runExecutor.js +295 -0
- package/apps/daemon/dist/runs/workflowService.d.ts +185 -0
- package/apps/daemon/dist/runs/workflowService.js +300 -0
- package/apps/daemon/dist/runtime/boundedProcessHost.d.ts +111 -0
- package/apps/daemon/dist/runtime/boundedProcessHost.js +752 -0
- package/apps/daemon/dist/runtime/evidenceRedaction.d.ts +30 -0
- package/apps/daemon/dist/runtime/evidenceRedaction.js +79 -0
- package/apps/daemon/dist/runtime/executionDiagnostics.d.ts +134 -0
- package/apps/daemon/dist/runtime/executionDiagnostics.js +213 -0
- package/apps/daemon/dist/runtime/modelExecutionPolicy.d.ts +22 -0
- package/apps/daemon/dist/runtime/modelExecutionPolicy.js +19 -0
- package/apps/daemon/dist/runtime/mxcExecution.d.ts +12 -0
- package/apps/daemon/dist/runtime/mxcExecution.js +163 -0
- package/apps/daemon/dist/runtime/mxcIntegrity.d.ts +24 -0
- package/apps/daemon/dist/runtime/mxcIntegrity.js +81 -0
- package/apps/daemon/dist/runtime/mxcWorker.d.ts +2 -0
- package/apps/daemon/dist/runtime/mxcWorker.js +45 -0
- package/apps/daemon/dist/runtime/provisionedExecution.d.ts +150 -0
- package/apps/daemon/dist/runtime/provisionedExecution.js +653 -0
- package/apps/daemon/dist/runtime/testExecution.d.ts +76 -0
- package/apps/daemon/dist/runtime/testExecution.js +106 -0
- package/apps/daemon/dist/runtime/testProfiles.d.ts +10 -0
- package/apps/daemon/dist/runtime/testProfiles.js +4 -0
- package/apps/daemon/dist/runtime/trustedAgentStaging.d.ts +89 -0
- package/apps/daemon/dist/runtime/trustedAgentStaging.js +262 -0
- package/apps/daemon/dist/runtime/trustedCaBundle.d.ts +77 -0
- package/apps/daemon/dist/runtime/trustedCaBundle.js +125 -0
- package/apps/daemon/dist/runtime/windows/windowsJobSupervisor.d.ts +166 -0
- package/apps/daemon/dist/runtime/windows/windowsJobSupervisor.js +521 -0
- package/apps/daemon/dist/storage/diagnosticLog.d.ts +63 -0
- package/apps/daemon/dist/storage/diagnosticLog.js +136 -0
- package/apps/daemon/dist/storage/executionTelemetry.d.ts +63 -0
- package/apps/daemon/dist/storage/executionTelemetry.js +247 -0
- package/apps/daemon/dist/storage/protectedSecrets.d.ts +39 -0
- package/apps/daemon/dist/storage/protectedSecrets.js +106 -0
- package/apps/daemon/dist/storage/sqliteLedger.d.ts +786 -0
- package/apps/daemon/dist/storage/sqliteLedger.js +1303 -0
- package/apps/daemon/dist/transports/http/dispatch.d.ts +43 -0
- package/apps/daemon/dist/transports/http/dispatch.js +405 -0
- package/apps/daemon/dist/transports/http/secureRoutes.d.ts +40 -0
- package/apps/daemon/dist/transports/http/secureRoutes.js +332 -0
- package/apps/daemon/dist/transports/http/workflowRoutes.d.ts +41 -0
- package/apps/daemon/dist/transports/http/workflowRoutes.js +473 -0
- package/apps/daemon/dist/transports/mcp/localProjectReadServer.d.ts +182 -0
- package/apps/daemon/dist/transports/mcp/localProjectReadServer.js +221 -0
- package/apps/daemon/dist/transports/native/nativeHost.d.ts +24 -0
- package/apps/daemon/dist/transports/native/nativeHost.js +344 -0
- package/apps/daemon/package.json +24 -0
- package/apps/daemon/src/runtime/benign/referenceEcho.mjs +27 -0
- package/apps/daemon/src/runtime/windows/buildSupervisor.mjs +87 -0
- package/apps/daemon/src/runtime/windows/supervisorMain.cs +676 -0
- package/apps/extension/manifest.secure.json +25 -0
- package/apps/extension/scripts/build.mjs +173 -0
- package/apps/extension/src/background/secureWorker.ts +1595 -0
- package/apps/extension/src/background/serviceWorker.ts +892 -0
- package/apps/extension/src/content/captureSelection.ts +64 -0
- package/apps/extension/src/content/secureInsert.ts +207 -0
- package/apps/extension/src/probe/index.html +41 -0
- package/apps/extension/src/probe/main.ts +201 -0
- package/apps/extension/src/sidepanel/index.html +203 -0
- package/apps/extension/src/sidepanel/main.ts +903 -0
- package/package.json +19 -3
- package/packages/contracts/dist/artifacts.d.ts +66 -0
- package/packages/contracts/dist/artifacts.js +64 -0
- package/packages/contracts/dist/automation.d.ts +540 -0
- package/packages/contracts/dist/automation.js +191 -0
- package/packages/contracts/dist/browser.d.ts +251 -0
- package/packages/contracts/dist/browser.js +131 -0
- package/packages/contracts/dist/context.d.ts +71 -0
- package/packages/contracts/dist/context.js +73 -0
- package/packages/contracts/dist/diagnostics.d.ts +99 -0
- package/packages/contracts/dist/diagnostics.js +284 -0
- package/packages/contracts/dist/effects.d.ts +42 -0
- package/packages/contracts/dist/effects.js +42 -0
- package/packages/contracts/dist/errors.d.ts +75 -0
- package/packages/contracts/dist/errors.js +70 -0
- package/packages/contracts/dist/events.d.ts +50 -0
- package/packages/contracts/dist/events.js +34 -0
- package/packages/contracts/dist/executionDiagnostics.d.ts +212 -0
- package/packages/contracts/dist/executionDiagnostics.js +101 -0
- package/packages/contracts/dist/identity.d.ts +54 -0
- package/packages/contracts/dist/identity.js +40 -0
- package/packages/contracts/dist/index.d.ts +20 -0
- package/packages/contracts/dist/index.js +20 -0
- package/packages/contracts/dist/invocation.d.ts +90 -0
- package/packages/contracts/dist/invocation.js +77 -0
- package/packages/contracts/dist/lifecycle.d.ts +130 -0
- package/packages/contracts/dist/lifecycle.js +135 -0
- package/packages/contracts/dist/plugin.d.ts +214 -0
- package/packages/contracts/dist/plugin.js +117 -0
- package/packages/contracts/dist/projectRead.d.ts +205 -0
- package/packages/contracts/dist/projectRead.js +162 -0
- package/packages/contracts/dist/secure.d.ts +128 -0
- package/packages/contracts/dist/secure.js +99 -0
- package/packages/contracts/package.json +32 -0
- package/packages/contracts/src/artifacts.ts +83 -0
- package/packages/contracts/src/automation.ts +238 -0
- package/packages/contracts/src/browser.ts +164 -0
- package/packages/contracts/src/context.ts +91 -0
- package/packages/contracts/src/diagnostics.ts +318 -0
- package/packages/contracts/src/effects.ts +49 -0
- package/packages/contracts/src/errors.ts +83 -0
- package/packages/contracts/src/events.ts +46 -0
- package/packages/contracts/src/executionDiagnostics.ts +116 -0
- package/packages/contracts/src/identity.ts +68 -0
- package/packages/contracts/src/index.ts +20 -0
- package/packages/contracts/src/invocation.ts +96 -0
- package/packages/contracts/src/lifecycle.ts +169 -0
- package/packages/contracts/src/plugin.ts +174 -0
- package/packages/contracts/src/projectRead.ts +179 -0
- package/packages/contracts/src/secure.ts +136 -0
- package/provenance.json +179 -9
- package/source.zip +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C06 PROVIDER-SPECIFIC (Codex) MODEL COMPATIBILITY REGISTRY (SW-077). The ONLY place a Codex model slug is chosen for the MCP-only profile.
|
|
3
|
+
*
|
|
4
|
+
* Five different facts must never be conflated (a listing is not an entitlement):
|
|
5
|
+
* RECOGNIZED ...... the installed binary's bundled catalogue (`codex debug models`) contains the slug.
|
|
6
|
+
* ADVERTISED ...... a catalogue / backend list shows it (here: the account-scoped list the backend returned to `model/list` for the isolated sign-in).
|
|
7
|
+
* OFFICIAL ........ OpenAI documentation says the authentication method supports it.
|
|
8
|
+
* ENTITLED ........ this account may actually run inference with it. Provable ONLY by a successful inference request; a provider refusal proves the opposite.
|
|
9
|
+
* COMPATIBLE ...... its tool surface can be reduced to the reviewed MCP-only surface (verified offline against the pinned binary with a scripted endpoint).
|
|
10
|
+
* `entitlement` below is therefore REFUSED_BY_PROVIDER or ACCEPTED_BY_PROVIDER ONLY when a real inference request was observed to be refused / accepted (SW-076, SW-078); everything else is UNVERIFIED.
|
|
11
|
+
*
|
|
12
|
+
* No automatic fallback: selection returns exactly the one SELECTED record. A model that the provider refused is marked UNSUPPORTED and can never be selected again;
|
|
13
|
+
* choosing another model is a reviewed code change (a new SELECTED record plus a reviewed catalogue derivation), never a runtime decision.
|
|
14
|
+
*/
|
|
15
|
+
/** Facts recorded about the environment in which the evidence was gathered. */
|
|
16
|
+
export const CODEX_COMPATIBILITY_CONTEXT = Object.freeze({
|
|
17
|
+
codexVersion: '0.167.0', authMethod: 'ChatGPT sign-in (isolated CODEX_HOME)', recordedAt: '2026-11-09',
|
|
18
|
+
discovery: 'codex app-server `model/list` (includeHidden) against the isolated sign-in: a NON-inference request answered by the backend; bundled catalogue via `codex debug models`',
|
|
19
|
+
});
|
|
20
|
+
const ADVERTISED = (slug) => ({ source: 'codex app-server model/list (backend, isolated sign-in)', observation: `${slug} is returned for this sign-in` });
|
|
21
|
+
export const CODEX_MODEL_COMPATIBILITY = Object.freeze([
|
|
22
|
+
{
|
|
23
|
+
slug: 'gpt-5.5', status: 'UNSUPPORTED', entitlement: 'REFUSED_BY_PROVIDER', vendorToolMode: 'classic', recognizedByBinary: true, advertisedByBackendListForThisSignIn: false,
|
|
24
|
+
evidence: [
|
|
25
|
+
{ source: 'SW-076 real invocation (consumed)', observation: "provider error: The 'gpt-5.5' model is not supported when using Codex with a ChatGPT account." },
|
|
26
|
+
{ source: 'OpenAI Codex models documentation', observation: 'GPT-5.5 stopped working in Codex with ChatGPT sign-in on 2026-10-14; API-key sessions are unaffected' },
|
|
27
|
+
{ source: 'codex app-server model/list (backend, isolated sign-in)', observation: 'gpt-5.5 is NOT in the account-scoped list although the bundled catalogue still lists it' },
|
|
28
|
+
],
|
|
29
|
+
constraints: ['never selectable for ChatGPT authentication'],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
slug: 'gpt-6.1-sol', status: 'SELECTED', entitlement: 'ACCEPTED_BY_PROVIDER', vendorToolMode: 'code_mode_only', recognizedByBinary: true, advertisedByBackendListForThisSignIn: true,
|
|
33
|
+
evidence: [
|
|
34
|
+
ADVERTISED('gpt-6.1-sol'),
|
|
35
|
+
{ source: 'codex app-server model/list', observation: 'isDefault=true for this sign-in (the backend recommends it)' },
|
|
36
|
+
{ source: 'OpenAI Codex models documentation', observation: 'GPT-6.1 Sol is the documented replacement for GPT-5.5 on Plus/Pro/Business/Enterprise/Edu plans "where available"' },
|
|
37
|
+
{ source: 'openai/codex issue 49396', observation: 'some users get HTTP 400 "not supported with a ChatGPT account" for gpt-6.1-sol with an older CLI or without rollout access: entitlement is NOT proven by a listing' },
|
|
38
|
+
{ source: 'offline, pinned Codex 0.167.0 + scripted endpoint', observation: 'vendor entry exposes JavaScript exec + 6 collaboration tools (no flag removes them); the reviewed catalogue override reduces it to request_user_input + the MCP tools offered directly' },
|
|
39
|
+
{ source: 'SW-078 real invocation (consumed)', observation: 'PROVIDER ACCEPTED gpt-6.1-sol for this ChatGPT sign-in (entitlement observed: one successful inference, 16661 input / 121 output tokens). With search enabled the model called tool_search in the lite wire format and Codex 0.167.0 refused it (unsupported call: tool_searchtool_search_tool); the override therefore also disables supports_search_tool' },
|
|
40
|
+
],
|
|
41
|
+
constraints: ['requires the reviewed MCP-only catalogue override (tool_mode, multi_agent_version, apply_patch_tool_type, experimental_supported_tools, supports_search_tool)', 'pinned to Codex 0.167.0: a Codex upgrade needs a new surface review', 'entitlement was proven for this sign-in by one accepted inference (SW-078); it can still change with plan or rollout'],
|
|
42
|
+
},
|
|
43
|
+
...['gpt-6.1-terra', 'gpt-6-astra', 'gpt-6-sol', 'gpt-6-luna', 'gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna'].map((slug) => ({
|
|
44
|
+
slug, status: 'CANDIDATE_NOT_REVIEWED', entitlement: 'UNVERIFIED', vendorToolMode: 'code_mode_only', recognizedByBinary: true, advertisedByBackendListForThisSignIn: true,
|
|
45
|
+
evidence: [ADVERTISED(slug)], constraints: ['no reviewed catalogue override: not selectable', 'listing is not entitlement'],
|
|
46
|
+
})),
|
|
47
|
+
]);
|
|
48
|
+
export class ModelSelectionError extends Error {
|
|
49
|
+
code;
|
|
50
|
+
constructor(code, message) {
|
|
51
|
+
super(`${code}: ${message}`);
|
|
52
|
+
this.code = code;
|
|
53
|
+
this.name = 'ModelSelectionError';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Exactly one reviewed SELECTED record, and never one the provider refused. Deterministic: no environment, no account state, no fallback. */
|
|
57
|
+
export function selectCodexModelForMcp(records = CODEX_MODEL_COMPATIBILITY) {
|
|
58
|
+
const chosen = records.filter((r) => r.status === 'SELECTED');
|
|
59
|
+
if (chosen.length === 0)
|
|
60
|
+
throw new ModelSelectionError('NO_SELECTED_MODEL', 'no reviewed model is selected');
|
|
61
|
+
if (chosen.length > 1)
|
|
62
|
+
throw new ModelSelectionError('MULTIPLE_SELECTED_MODELS', 'selection must be unambiguous');
|
|
63
|
+
if (chosen[0].entitlement === 'REFUSED_BY_PROVIDER')
|
|
64
|
+
throw new ModelSelectionError('SELECTED_MODEL_UNSUPPORTED', `${chosen[0].slug} was refused by the provider`);
|
|
65
|
+
return chosen[0];
|
|
66
|
+
}
|
|
67
|
+
export const CODEX_MCP_ONLY_MODEL = selectCodexModelForMcp().slug;
|
|
68
|
+
/** True when `slug` is known to be refused for this authentication method (used by classifiers and the gate to avoid re-trying a refused model). */
|
|
69
|
+
export const isRefusedModel = (slug) => CODEX_MODEL_COMPATIBILITY.some((r) => r.slug === slug && r.entitlement === 'REFUSED_BY_PROVIDER');
|
|
70
|
+
//# sourceMappingURL=codexModelCompatibility.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PluginDriver, AuthorizedInvocation, CapabilityReport, RunReceipt, NormalizedEvent, CancelReceipt, NormalizedResult, RunId } from '../../../../../packages/contracts/dist/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Deterministic fake plugin driver for M03 walking skeleton.
|
|
4
|
+
* Implements the PluginDriver interface strictly from @my-centcom/contracts.
|
|
5
|
+
* Invariant: Never executes shell, filesystem, or real coding agents.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FakePluginDriver implements PluginDriver {
|
|
8
|
+
invocationCount: number;
|
|
9
|
+
private readonly runs;
|
|
10
|
+
probe(): Promise<CapabilityReport>;
|
|
11
|
+
invoke(request: AuthorizedInvocation): Promise<RunReceipt>;
|
|
12
|
+
observe(runId: RunId): AsyncIterable<NormalizedEvent>;
|
|
13
|
+
cancel(runId: RunId, reason: string): Promise<CancelReceipt>;
|
|
14
|
+
collect(runId: RunId): Promise<NormalizedResult>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=fakePluginDriver.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { CapabilityReportSchema, RunReceiptSchema, NormalizedEventV1Schema, CancelReceiptSchema, NormalizedResultSchema, createPluginId, createEventId, ContractError, } from '../../../../../packages/contracts/dist/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Deterministic fake plugin driver for M03 walking skeleton.
|
|
5
|
+
* Implements the PluginDriver interface strictly from @my-centcom/contracts.
|
|
6
|
+
* Invariant: Never executes shell, filesystem, or real coding agents.
|
|
7
|
+
*/
|
|
8
|
+
export class FakePluginDriver {
|
|
9
|
+
invocationCount = 0;
|
|
10
|
+
runs = new Map();
|
|
11
|
+
async probe() {
|
|
12
|
+
return CapabilityReportSchema.parse({
|
|
13
|
+
pluginId: createPluginId('plugin.m03-fake'),
|
|
14
|
+
installed: true,
|
|
15
|
+
installedVersion: '0.2.0-fake',
|
|
16
|
+
capabilities: {
|
|
17
|
+
supportsSession: false,
|
|
18
|
+
supportsApproval: false,
|
|
19
|
+
supportsResume: false,
|
|
20
|
+
supportsStreaming: true,
|
|
21
|
+
},
|
|
22
|
+
details: {
|
|
23
|
+
driverType: 'FAKE_PLUGIN_DRIVER',
|
|
24
|
+
securityTier: 'PATH_CHECKS_ONLY',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async invoke(request) {
|
|
29
|
+
this.invocationCount++;
|
|
30
|
+
const prompt = request.params.prompt ?? '';
|
|
31
|
+
this.runs.set(request.runId, { invocation: request, prompt });
|
|
32
|
+
return RunReceiptSchema.parse({
|
|
33
|
+
runId: request.runId,
|
|
34
|
+
pluginId: request.pluginId,
|
|
35
|
+
operationId: request.operationId,
|
|
36
|
+
startedAt: new Date().toISOString(),
|
|
37
|
+
processId: 10001,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async *observe(runId) {
|
|
41
|
+
const run = this.runs.get(runId);
|
|
42
|
+
if (!run) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const output = `FAKE_OK:${run.prompt}`;
|
|
46
|
+
yield NormalizedEventV1Schema.parse({
|
|
47
|
+
schemaVersion: 1,
|
|
48
|
+
eventId: createEventId(`evt.${randomUUID()}`),
|
|
49
|
+
runId,
|
|
50
|
+
projectId: run.invocation.projectId,
|
|
51
|
+
pluginId: run.invocation.pluginId,
|
|
52
|
+
timestamp: new Date().toISOString(),
|
|
53
|
+
eventKind: 'run_started',
|
|
54
|
+
payload: {
|
|
55
|
+
operationId: run.invocation.operationId,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
yield NormalizedEventV1Schema.parse({
|
|
59
|
+
schemaVersion: 1,
|
|
60
|
+
eventId: createEventId(`evt.${randomUUID()}`),
|
|
61
|
+
runId,
|
|
62
|
+
projectId: run.invocation.projectId,
|
|
63
|
+
pluginId: run.invocation.pluginId,
|
|
64
|
+
timestamp: new Date().toISOString(),
|
|
65
|
+
eventKind: 'stdout_chunk',
|
|
66
|
+
payload: {
|
|
67
|
+
text: output,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
yield NormalizedEventV1Schema.parse({
|
|
71
|
+
schemaVersion: 1,
|
|
72
|
+
eventId: createEventId(`evt.${randomUUID()}`),
|
|
73
|
+
runId,
|
|
74
|
+
projectId: run.invocation.projectId,
|
|
75
|
+
pluginId: run.invocation.pluginId,
|
|
76
|
+
timestamp: new Date().toISOString(),
|
|
77
|
+
eventKind: 'run_completed',
|
|
78
|
+
payload: {
|
|
79
|
+
exitCode: 0,
|
|
80
|
+
output,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
async cancel(runId, reason) {
|
|
85
|
+
// The fake never runs a real process; only a run it actually knows can be reported terminated.
|
|
86
|
+
const known = this.runs.has(runId);
|
|
87
|
+
return CancelReceiptSchema.parse({
|
|
88
|
+
runId,
|
|
89
|
+
cancelledAt: new Date().toISOString(),
|
|
90
|
+
acknowledged: known,
|
|
91
|
+
processTerminated: known,
|
|
92
|
+
reason,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async collect(runId) {
|
|
96
|
+
const run = this.runs.get(runId);
|
|
97
|
+
if (!run) {
|
|
98
|
+
// Never manufacture a successful result for a run this driver did not start.
|
|
99
|
+
throw new ContractError({
|
|
100
|
+
errorCode: 'NATIVE_CLI_FAILURE',
|
|
101
|
+
message: 'Fake driver has no record of the requested run',
|
|
102
|
+
correlationId: String(runId),
|
|
103
|
+
runId,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return NormalizedResultSchema.parse({
|
|
107
|
+
runId,
|
|
108
|
+
exitCode: 0,
|
|
109
|
+
durationMs: 15,
|
|
110
|
+
outputSummary: `FAKE_OK:${run.prompt}`,
|
|
111
|
+
completedAt: new Date().toISOString(),
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=fakePluginDriver.js.map
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { type AuthorizedInvocation, type NormalizedEvent, type PluginDriver } from '../../../../../packages/contracts/dist/index.js';
|
|
2
|
+
import { type ProcessHostResult, type ProcessObserver } from '../../runtime/boundedProcessHost.js';
|
|
3
|
+
import type { ExecutionIdentity, StdinStatus, WindowsJobSupervisor } from '../../runtime/windows/windowsJobSupervisor.js';
|
|
4
|
+
import type { VerifiedCapabilityRegistry } from '../registry/verifiedCapabilityRegistry.js';
|
|
5
|
+
/**
|
|
6
|
+
* C06 generic finite-CLI driver (SW-051): the single selected driver, conforming to PluginDriver (probe, invoke, observe, cancel,
|
|
7
|
+
* collect). It runs ONE operation of ONE pinned plugin through the shared bounded process host and the Windows Job supervisor.
|
|
8
|
+
*
|
|
9
|
+
* Fixed security posture (not configurable by any invocation):
|
|
10
|
+
* - There is no plain-spawn path. The trusted constructor must pass a supervisor whose fixed identity is RESTRICTED_LOW_INTEGRITY;
|
|
11
|
+
* anything else is refused at construction, so a failed or absent restricted identity can never fall back to the caller token.
|
|
12
|
+
* - The executable, its SHA-256 and the argument vector come ONLY from the C04 pinned record, re-inspected at invoke time and
|
|
13
|
+
* required to equal the fingerprint and digest the coordinator durably recorded at prepare time. The host re-hashes the file
|
|
14
|
+
* immediately before creation. A template containing a known permission-bypass flag is refused.
|
|
15
|
+
* - The prompt is substituted into exactly one whole template element equal to PROMPT_PLACEHOLDER. A prompt the host cannot carry
|
|
16
|
+
* as one argument (control characters such as newlines, oversize) or that could be parsed as an option is refused before any
|
|
17
|
+
* process exists (PROMPT_UNREPRESENTABLE). This is a recorded limitation, not a silent rewrite.
|
|
18
|
+
* - SW-052 stdin transport: an operation whose PINNED manifest declares inputTransport {kind:'stdin_utf8'} (and only when this driver was
|
|
19
|
+
* constructed with enableStdinTransport=true) receives the approved prompt as UTF-8 bytes on a private pipe, written once and closed. Its
|
|
20
|
+
* argv template must NOT contain the prompt placeholder, so the prompt can never also reach argv. The prompt's SHA-256 must equal the digest
|
|
21
|
+
* the coordinator took from the immutable acceptance-time snapshot. Operations without the field are exactly the SW-051 argv operations.
|
|
22
|
+
* - SW-052 script identity: an interpreter (node, python, powershell, cmd, ...) executes code the interpreter's own digest does not describe.
|
|
23
|
+
* Such an operation is DISABLED (SCRIPT_UNPINNED) unless trusted composition pinned every code-bearing file, and every pinned file must be
|
|
24
|
+
* an exact element of the argv template. Pinning is by content digest, size and file id (revalidated at prepare and at invoke); the OS
|
|
25
|
+
* does not give an atomic launch identity, so a residual race between the check and the interpreter opening the file stays NOT_VERIFIED.
|
|
26
|
+
* - SW-052 timeout: the pinned operation's timeoutMs is honoured up to MAX_PROCESS_HOST_TIMEOUT_MS (120 s); above that the operation is
|
|
27
|
+
* refused (TIMEOUT_EXCEEDS_LIMIT), never silently clamped. A request cannot supply a timeout.
|
|
28
|
+
* - securityTier must be PATH_CHECKS_ONLY. This driver never claims OS enforcement or filesystem confinement.
|
|
29
|
+
*
|
|
30
|
+
* Output: stdout is buffered by the host and parsed after exit (supportsStreaming=false). The provider-specific parser lives here
|
|
31
|
+
* only: 'codex-exec-jsonl-v1' maps the frame shapes recorded by SW-024/SW-025 (thread.started, turn.started, item.started /
|
|
32
|
+
* item.completed with agent_message or command_execution, turn.completed). Any other line is kept as a bounded stdout_chunk.
|
|
33
|
+
* Agent prose is untrusted data; a final message is reported, never treated as validation.
|
|
34
|
+
*/
|
|
35
|
+
export declare const PROMPT_PLACEHOLDER = "{{prompt}}";
|
|
36
|
+
export type OutputProfile = 'codex-exec-jsonl-v1';
|
|
37
|
+
export type DriverErrorCode = 'DRIVER_CONFIG_INVALID' | 'INVOCATION_INVALID' | 'PLUGIN_MISMATCH' | 'SECURITY_TIER_UNSUPPORTED' | 'NOT_PREPARED' | 'DUPLICATE_RUN' | 'UNKNOWN_RUN' | 'EXECUTABLE_CHANGED' | 'OPERATION_UNKNOWN' | 'TEMPLATE_UNSAFE' | 'PROMPT_UNREPRESENTABLE' | 'INPUT_INVALID' | 'PROMPT_DIGEST_MISMATCH';
|
|
38
|
+
export declare class DriverError extends Error {
|
|
39
|
+
readonly code: DriverErrorCode;
|
|
40
|
+
constructor(code: DriverErrorCode);
|
|
41
|
+
}
|
|
42
|
+
export type PrepareResult = {
|
|
43
|
+
readonly ok: true;
|
|
44
|
+
readonly plan: LaunchPlan;
|
|
45
|
+
} | {
|
|
46
|
+
readonly ok: false;
|
|
47
|
+
readonly code: 'TRUSTED_CLI_CONFIG_UNREVIEWED' | 'TRUSTED_CLI_CONSENT_REQUIRED' | 'MODEL_BOUNDARY_UNVERIFIED' | 'EXECUTABLE_CHANGED' | 'OPERATION_UNKNOWN' | 'TEMPLATE_UNSAFE' | 'PLUGIN_MISMATCH' | 'DUPLICATE_RUN' | 'TRANSPORT_NOT_ENABLED' | 'TIMEOUT_EXCEEDS_LIMIT' | 'SCRIPT_UNPINNED' | 'CODE_INPUT_NOT_IN_TEMPLATE';
|
|
48
|
+
};
|
|
49
|
+
export type LaunchPlan = Readonly<{
|
|
50
|
+
runId: string;
|
|
51
|
+
pluginId: string;
|
|
52
|
+
operationId: string;
|
|
53
|
+
manifestFingerprint: string;
|
|
54
|
+
executableSha256: string;
|
|
55
|
+
effectClass: string;
|
|
56
|
+
timeoutMs: number;
|
|
57
|
+
maxOutputBytes: number;
|
|
58
|
+
executionIdentity: ExecutionIdentity;
|
|
59
|
+
/** SW-052: how the prompt reaches the CLI for this operation (from the pinned manifest). */
|
|
60
|
+
inputTransport: 'ARGV' | 'STDIN' | 'NONE';
|
|
61
|
+
stdinMaxBytes: number | null;
|
|
62
|
+
/** SW-068: the pinned argv TEMPLATE (never a prompt: stdin/fixed operations contain no placeholder), recorded as launch configuration evidence. */
|
|
63
|
+
argvTemplate: readonly string[];
|
|
64
|
+
/** SW-052: digest over the pinned code-bearing inputs, or null when none are pinned. */
|
|
65
|
+
codeInputsSha256: string | null;
|
|
66
|
+
}>;
|
|
67
|
+
export type DriverRunOutcome = Readonly<{
|
|
68
|
+
kind: 'NOT_LAUNCHED';
|
|
69
|
+
code: string;
|
|
70
|
+
}> | Readonly<{
|
|
71
|
+
kind: 'FINISHED';
|
|
72
|
+
processOutcome: ProcessHostResult['outcome'];
|
|
73
|
+
processLaunched: boolean;
|
|
74
|
+
exitCode: number | null;
|
|
75
|
+
treeTerminated: boolean | null;
|
|
76
|
+
executionIdentity: ExecutionIdentity | null;
|
|
77
|
+
childTokenVerified: boolean;
|
|
78
|
+
jobAssignedBeforeResume: boolean;
|
|
79
|
+
supervisionProtocol: string | null;
|
|
80
|
+
stdoutSha256: string;
|
|
81
|
+
stdoutBytes: number;
|
|
82
|
+
stdoutTruncated: boolean;
|
|
83
|
+
stderrBytes: number;
|
|
84
|
+
stderrTruncated: boolean;
|
|
85
|
+
stdinStatus: StdinStatus;
|
|
86
|
+
stdinBytesWritten: number | null;
|
|
87
|
+
stdinBytesExpected: number | null;
|
|
88
|
+
durationMs: number;
|
|
89
|
+
finalMessage: string | null;
|
|
90
|
+
unparsedLines: number;
|
|
91
|
+
events: readonly NormalizedEvent[];
|
|
92
|
+
}>;
|
|
93
|
+
export interface FiniteCliDriver extends PluginDriver {
|
|
94
|
+
readonly pluginId: string;
|
|
95
|
+
readonly executionIdentity: ExecutionIdentity;
|
|
96
|
+
/** No process. Re-inspects the pinned operation and returns the identity the coordinator must durably record before invoke. */
|
|
97
|
+
prepare(runId: string, operationId: string): Promise<PrepareResult>;
|
|
98
|
+
/** Settles once the run is over (or was never launched). */
|
|
99
|
+
outcome(runId: string): Promise<DriverRunOutcome>;
|
|
100
|
+
/** SW-068: the provider output profile (selects provider diagnostic rules and the parser). */
|
|
101
|
+
readonly outputProfile: OutputProfile;
|
|
102
|
+
/** SW-068: attaches the incremental evidence sink for a PREPARED run; honoured by the next invoke of that run. */
|
|
103
|
+
attachObserver(runId: string, observer: ProcessObserver): void;
|
|
104
|
+
}
|
|
105
|
+
export declare function createFiniteCliDriver(config: {
|
|
106
|
+
pluginId: string;
|
|
107
|
+
registry: VerifiedCapabilityRegistry;
|
|
108
|
+
supervisor: WindowsJobSupervisor;
|
|
109
|
+
/** TRUSTED canonical directory for the child's TEMP/TMP (must be usable by the restricted identity). */
|
|
110
|
+
childTempDirectory: string;
|
|
111
|
+
/** TRUSTED extra environment (see the host's trustedEnvironment). */
|
|
112
|
+
trustedEnvironment?: {
|
|
113
|
+
containmentRoot: string;
|
|
114
|
+
entries: Readonly<Record<string, string>>;
|
|
115
|
+
files?: Readonly<Record<string, {
|
|
116
|
+
path: string;
|
|
117
|
+
sha256: string;
|
|
118
|
+
}>>;
|
|
119
|
+
};
|
|
120
|
+
outputProfile: OutputProfile;
|
|
121
|
+
/** TRUSTED (SW-052): allow operations that declare the stdin_utf8 input transport. Default false = such operations are refused at prepare. */
|
|
122
|
+
enableStdinTransport?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* TRUSTED (SW-053): operation ids that are FIXED, prompt-less commands (e.g. --version / --help). Their pinned argv template must contain no
|
|
125
|
+
* prompt placeholder; the approved prompt is still snapshotted by the coordinator but is delivered nowhere (transport 'NONE'). Default: none,
|
|
126
|
+
* so a template without a placeholder stays TEMPLATE_UNSAFE (an agent operation can never silently drop its prompt).
|
|
127
|
+
*/
|
|
128
|
+
fixedNoPromptOperations?: readonly string[];
|
|
129
|
+
/**
|
|
130
|
+
* TRUSTED (SW-074): per-run trusted environment additions (a run-scoped capability file pinned by digest, and an audit directory), computed from the AUTHORIZED invocation only.
|
|
131
|
+
* Returning undefined means "no capability could be issued": the run is NOT launched (fail closed). release() is called exactly once after the run settles or fails to launch.
|
|
132
|
+
* The values pass through the host's trustedEnvironment validation (containment, pinned-file digest) like every other trusted value; the driver adds no new environment path.
|
|
133
|
+
*/
|
|
134
|
+
runEnvironment?: {
|
|
135
|
+
resolve(inv: AuthorizedInvocation): {
|
|
136
|
+
entries?: Readonly<Record<string, string>>;
|
|
137
|
+
files?: Readonly<Record<string, {
|
|
138
|
+
path: string;
|
|
139
|
+
sha256: string;
|
|
140
|
+
}>>; /** SW-077: the agent process runs in THIS directory (a run-scoped project view) instead of the approved project root. */
|
|
141
|
+
workingDirectory?: string;
|
|
142
|
+
} | undefined;
|
|
143
|
+
release(runId: string): void;
|
|
144
|
+
};
|
|
145
|
+
now?: () => number;
|
|
146
|
+
}): FiniteCliDriver;
|
|
147
|
+
/** Provider-specific parser (codex-exec-jsonl-v1). Bounded; every unrecognized line is kept as data, never executed or trusted. Exported for the pure fidelity tests. */
|
|
148
|
+
export declare function parseCodexExecJsonl(inv: AuthorizedInvocation, r: ProcessHostResult, now: () => number): {
|
|
149
|
+
events: NormalizedEvent[];
|
|
150
|
+
finalMessage: string | null;
|
|
151
|
+
unparsedLines: number;
|
|
152
|
+
};
|
|
153
|
+
//# sourceMappingURL=finiteCliDriver.d.ts.map
|