@bitkyc08/opencodex 2.12.0 → 2.13.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 +1 -1
- package/gui/dist/assets/index-BHldBl6_.js +76 -0
- package/gui/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/adapters/anthropic-output-schema.ts +137 -0
- package/src/adapters/anthropic.ts +15 -0
- package/src/adapters/google-antigravity-replay.ts +269 -5
- package/src/adapters/openai-chat.ts +25 -18
- package/src/adapters/openai-responses.ts +63 -17
- package/src/bridge.ts +11 -5
- package/src/claude/inbound.ts +24 -3
- package/src/cli/account-api.ts +2 -0
- package/src/cli/account-extended.ts +262 -1
- package/src/cli/account.ts +3 -1
- package/src/cli/dispatch.ts +532 -0
- package/src/cli/doctor.ts +26 -21
- package/src/cli/help.ts +9 -278
- package/src/cli/index.ts +45 -506
- package/src/cli/lab.ts +171 -65
- package/src/cli/registry.ts +384 -0
- package/src/cli/root.ts +86 -0
- package/src/cli/status.ts +9 -2
- package/src/cli/v2.ts +37 -2
- package/src/codex/account-label.ts +14 -1
- package/src/codex/account-store.ts +12 -1
- package/src/codex/admission.ts +2 -1
- package/src/codex/auth-api.ts +3 -2
- package/src/codex/catalog/metadata.ts +6 -4
- package/src/codex/catalog/parsing.ts +31 -7
- package/src/codex/catalog/provider-fetch.ts +2 -1
- package/src/codex/catalog/sync.ts +65 -11
- package/src/codex/features.ts +437 -31
- package/src/codex/history-job.ts +6 -11
- package/src/codex/history-provider.ts +10 -9
- package/src/codex/inject.ts +14 -1
- package/src/codex/native-profile-startup.ts +49 -3
- package/src/codex/native-residue.ts +14 -2
- package/src/codex/paths.ts +75 -1
- package/src/codex/reset-credit-recovery.ts +1044 -0
- package/src/codex/shim.ts +876 -16
- package/src/codex/sync.ts +27 -2
- package/src/config.ts +148 -10
- package/src/generated/compatibility-version.json +2572 -0
- package/src/images/loop.ts +1 -1
- package/src/lab/artifacts/sanitize.ts +3 -3
- package/src/lab/automation/budgets.ts +78 -0
- package/src/lab/automation/config-persistence.ts +256 -0
- package/src/lab/automation/constants.ts +39 -0
- package/src/lab/automation/cooldown.ts +103 -0
- package/src/lab/automation/dispatch.ts +211 -0
- package/src/lab/automation/index.ts +13 -0
- package/src/lab/automation/orchestrator.ts +480 -0
- package/src/lab/automation/persistence.ts +512 -0
- package/src/lab/automation/planner.ts +371 -0
- package/src/lab/automation/policy.ts +136 -0
- package/src/lab/automation/queue.ts +191 -0
- package/src/lab/automation/recovery.ts +24 -0
- package/src/lab/automation/route-context.ts +21 -0
- package/src/lab/automation/run-key.ts +44 -0
- package/src/lab/automation/runs-query.ts +34 -0
- package/src/lab/automation/types.ts +160 -0
- package/src/lab/conformance/types.ts +23 -0
- package/src/lab/events/types.ts +2 -1
- package/src/lab/events/validate.ts +2 -1
- package/src/lab/fabric/constants.ts +40 -0
- package/src/lab/fabric/executor.ts +492 -0
- package/src/lab/fabric/index.ts +80 -0
- package/src/lab/fabric/manifest.ts +222 -0
- package/src/lab/fabric/observe.ts +454 -0
- package/src/lab/fabric/patch.ts +79 -0
- package/src/lab/fabric/producer-child.ts +139 -0
- package/src/lab/fabric/producer-isolate.ts +276 -0
- package/src/lab/fabric/producer-protocol.ts +61 -0
- package/src/lab/fabric/scratch.ts +439 -0
- package/src/lab/fabric/subject.ts +106 -0
- package/src/lab/fabric/types.ts +134 -0
- package/src/lab/fabric/verifier.ts +98 -0
- package/src/lab/index.ts +2 -0
- package/src/lab/ledger/store.ts +173 -0
- package/src/lab/live/executor.ts +29 -4
- package/src/lab/live/transport.ts +3 -1
- package/src/lab/observe/from-conformance.ts +12 -57
- package/src/lab/observe/from-live.ts +9 -1
- package/src/lab/paths.ts +74 -9
- package/src/lab/projection/schema.ts +14 -1
- package/src/lab/projection/verdicts.ts +89 -53
- package/src/lab/projection/verification.ts +83 -3
- package/src/lab/query/catalog.ts +34 -5
- package/src/lab/query/freshness.ts +53 -0
- package/src/lab/query/index.ts +11 -0
- package/src/lab/query/latest-observation.ts +59 -0
- package/src/lab/query/passive-production.ts +159 -0
- package/src/lab/subject/installation-salt.ts +24 -4
- package/src/lab/subject/protocol-subject.ts +80 -0
- package/src/lab/subject/route-subject.ts +2 -1
- package/src/lib/fabric-task-execution-authority.ts +7 -0
- package/src/lib/fabric-task-host.ts +29 -0
- package/src/lib/lab-live-route-production.ts +130 -0
- package/src/lib/local-management-capability.ts +100 -0
- package/src/lib/server-resource-ownership.ts +71 -0
- package/src/lib/windows-elevation.ts +8 -1
- package/src/lib/windows-user-principal.ts +62 -2
- package/src/lib/winsw.ts +8 -2
- package/src/oauth/account-import/google-antigravity-adapter.ts +74 -0
- package/src/oauth/account-import/index.ts +15 -0
- package/src/oauth/account-import/parser.ts +83 -0
- package/src/oauth/account-import/registry.ts +18 -0
- package/src/oauth/account-import/service.ts +75 -0
- package/src/oauth/account-import/types.ts +91 -0
- package/src/oauth/anthropic.ts +12 -1
- package/src/oauth/callback-server.ts +8 -2
- package/src/oauth/chatgpt.ts +12 -1
- package/src/oauth/google-antigravity.ts +27 -0
- package/src/oauth/health.ts +12 -48
- package/src/oauth/index.ts +122 -0
- package/src/oauth/kimi.ts +16 -2
- package/src/oauth/nous.ts +749 -0
- package/src/oauth/store.ts +56 -3
- package/src/providers/codex-capacity.ts +1 -0
- package/src/providers/registry.ts +161 -16
- package/src/responses/custom-tool-compat.ts +182 -0
- package/src/responses/parser.ts +22 -0
- package/src/responses/reasoning-replay-cache.ts +168 -11
- package/src/responses/schema.ts +1 -1
- package/src/router.ts +5 -20
- package/src/routing/capability.ts +9 -3
- package/src/routing/compatibility/assemble.ts +159 -0
- package/src/routing/compatibility/behavior.ts +224 -0
- package/src/routing/compatibility/catalog.ts +99 -0
- package/src/routing/compatibility/endpoint.ts +52 -0
- package/src/routing/compatibility/policy.ts +181 -0
- package/src/routing/compatibility/reader.ts +110 -0
- package/src/routing/compatibility/subject.ts +191 -0
- package/src/routing/compatibility/types.ts +64 -0
- package/src/routing/compatibility/version.ts +104 -0
- package/src/routing/evaluator.ts +27 -32
- package/src/routing/profile.ts +118 -4
- package/src/routing/trace.ts +82 -28
- package/src/server/auth-cors.ts +7 -0
- package/src/server/background-lifecycle.ts +20 -7
- package/src/server/chat-completions.ts +2 -2
- package/src/server/claude-messages.ts +6 -3
- package/src/server/direct-local-http.ts +343 -0
- package/src/server/index.ts +80 -18
- package/src/server/lifecycle.ts +12 -4
- package/src/server/local-management-read-client.ts +90 -0
- package/src/server/management/agent-settings-routes.ts +27 -3
- package/src/server/management/lab-automation-routes.ts +206 -0
- package/src/server/management/lab-routes.ts +13 -0
- package/src/server/management/logs-usage-routes.ts +1 -0
- package/src/server/management/oauth-account-routes.ts +57 -1
- package/src/server/management/provider-routes.ts +16 -0
- package/src/server/management/routing-profile-routes.ts +12 -24
- package/src/server/management-api.ts +2 -0
- package/src/server/management-auth.ts +68 -3
- package/src/server/proxy-liveness.ts +3 -2
- package/src/server/request-decompress.ts +9 -3
- package/src/server/request-log.ts +53 -4
- package/src/server/responses/collaboration.ts +93 -17
- package/src/server/responses/compact.ts +3 -0
- package/src/server/responses/core.ts +202 -15
- package/src/server/responses/policy-fallback.ts +1 -0
- package/src/server/responses-custom-tool-repair.ts +280 -0
- package/src/server/responses-terminal-repair.ts +342 -0
- package/src/server/startup-action-control.ts +8 -1
- package/src/service.ts +278 -12
- package/src/types.ts +49 -3
- package/src/usage/expected-prices.ts +30 -0
- package/src/usage/log.ts +30 -4
- package/src/usage/summary.ts +153 -2
- package/src/web-search/loop.ts +1 -1
- package/gui/dist/assets/index-Cw1_mxO8.js +0 -70
- package/src/cli/internal-dispatch.ts +0 -20
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { subjectIdForSubject, scenarioManifestDigest } from "../digest";
|
|
2
|
+
import { expandScenario, loadCaseAuthority } from "../conformance/manifest";
|
|
3
|
+
import { resolveProtocolExecutionContext, runScenario } from "../conformance/executor";
|
|
4
|
+
import { buildProtocolSubjectV1 } from "../subject/protocol-subject";
|
|
5
|
+
import { suiteManifestDigestForCase } from "../conformance/suite-manifest";
|
|
6
|
+
import { persistConformanceResult } from "../observe/from-conformance";
|
|
7
|
+
import { expandLiveScenario, loadLiveCaseAuthority } from "../live/manifest";
|
|
8
|
+
import { runLiveScenario } from "../live/executor";
|
|
9
|
+
import { liveSuiteManifestDigestForCase } from "../live/suite-manifest";
|
|
10
|
+
import { persistLiveResult } from "../observe/from-live";
|
|
11
|
+
import { rebuildLabProjection } from "../projection/rebuild";
|
|
12
|
+
import { resolvePolicyCompatibilitySubjects } from "../../routing/compatibility/subject";
|
|
13
|
+
import type { AutomationDispatchDeps, LabAutomationRunRecordV1 } from "./types";
|
|
14
|
+
import { LabAutomationError } from "./types";
|
|
15
|
+
import { buildAutomationLiveRouteContext } from "./route-context";
|
|
16
|
+
import {
|
|
17
|
+
buildLabAutomationRunKey,
|
|
18
|
+
liveExecutionContractDigest,
|
|
19
|
+
protocolExecutionContractDigest,
|
|
20
|
+
} from "./run-key";
|
|
21
|
+
|
|
22
|
+
export interface DispatchResult {
|
|
23
|
+
terminalState: "completed" | "blocked" | "failed";
|
|
24
|
+
terminalCode: string;
|
|
25
|
+
cooldownCode: string;
|
|
26
|
+
liveRequest: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface ExpectedRunIdentity {
|
|
30
|
+
runKey: string;
|
|
31
|
+
subjectId: string;
|
|
32
|
+
suiteId: string;
|
|
33
|
+
suiteVersion: string;
|
|
34
|
+
suiteManifestDigest: string;
|
|
35
|
+
scenarioId: string;
|
|
36
|
+
scenarioVersion: string;
|
|
37
|
+
scenarioManifestDigest: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function runIdentityMatches(run: LabAutomationRunRecordV1, expected: ExpectedRunIdentity): boolean {
|
|
41
|
+
return run.runKey === expected.runKey
|
|
42
|
+
&& run.subjectId === expected.subjectId
|
|
43
|
+
&& run.suiteId === expected.suiteId
|
|
44
|
+
&& run.suiteVersion === expected.suiteVersion
|
|
45
|
+
&& run.suiteManifestDigest === expected.suiteManifestDigest
|
|
46
|
+
&& run.scenarioId === expected.scenarioId
|
|
47
|
+
&& run.scenarioVersion === expected.scenarioVersion
|
|
48
|
+
&& run.scenarioManifestDigest === expected.scenarioManifestDigest;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function shouldEnforceRunIdentity(run: LabAutomationRunRecordV1, deps: AutomationDispatchDeps): boolean {
|
|
52
|
+
// Production orchestration always sets the explicit guard. Canonical planned run keys also
|
|
53
|
+
// self-identify here so direct internal callers cannot accidentally bypass revalidation.
|
|
54
|
+
return deps.enforceRunIdentity === true || /^[0-9a-f]{64}$/i.test(run.runKey);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function contractChanged(): DispatchResult {
|
|
58
|
+
return {
|
|
59
|
+
terminalState: "blocked",
|
|
60
|
+
terminalCode: "run_contract_changed",
|
|
61
|
+
cooldownCode: "run_contract_changed",
|
|
62
|
+
liveRequest: false,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function routeIneligible(): DispatchResult {
|
|
67
|
+
return {
|
|
68
|
+
terminalState: "blocked",
|
|
69
|
+
terminalCode: "route_ineligible",
|
|
70
|
+
cooldownCode: "route_ineligible",
|
|
71
|
+
liveRequest: false,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function assertNotCancelled(signal?: AbortSignal): void {
|
|
76
|
+
if (signal?.aborted) throw new LabAutomationError("cancelled", "cancelled");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Closed dispatcher to existing CL-01 / CL-03 / CL-07 producers. */
|
|
80
|
+
export async function dispatchLabAutomationRun(
|
|
81
|
+
run: LabAutomationRunRecordV1,
|
|
82
|
+
deps: AutomationDispatchDeps,
|
|
83
|
+
): Promise<DispatchResult> {
|
|
84
|
+
const configDir = deps.configDir;
|
|
85
|
+
switch (run.evidenceLayer) {
|
|
86
|
+
case "protocol_conformance": {
|
|
87
|
+
assertNotCancelled(deps.abortSignal);
|
|
88
|
+
const authority = loadCaseAuthority();
|
|
89
|
+
const caseRecord = authority.cases.find((row) => row.id === run.scenarioId);
|
|
90
|
+
if (!caseRecord) {
|
|
91
|
+
throw new LabAutomationError("missing protocol scenario", "dispatch_failure");
|
|
92
|
+
}
|
|
93
|
+
const executionContext = resolveProtocolExecutionContext(caseRecord);
|
|
94
|
+
const subject = buildProtocolSubjectV1(executionContext);
|
|
95
|
+
const subjectId = subjectIdForSubject(subject);
|
|
96
|
+
const scenarioDigest = scenarioManifestDigest(expandScenario(caseRecord, authority));
|
|
97
|
+
const suiteDigest = suiteManifestDigestForCase(caseRecord, authority);
|
|
98
|
+
const suiteVersion = authority.manifestDefaults.suiteVersion;
|
|
99
|
+
const scenarioVersion = authority.manifestDefaults.version;
|
|
100
|
+
const expected: ExpectedRunIdentity = {
|
|
101
|
+
runKey: buildLabAutomationRunKey({
|
|
102
|
+
evidenceLayer: "protocol_conformance",
|
|
103
|
+
subjectId,
|
|
104
|
+
suiteId: caseRecord.suite,
|
|
105
|
+
suiteVersion,
|
|
106
|
+
suiteManifestDigest: suiteDigest,
|
|
107
|
+
scenarioId: caseRecord.id,
|
|
108
|
+
scenarioVersion,
|
|
109
|
+
scenarioManifestDigest: scenarioDigest,
|
|
110
|
+
executionContractDigest: protocolExecutionContractDigest(),
|
|
111
|
+
}),
|
|
112
|
+
subjectId,
|
|
113
|
+
suiteId: caseRecord.suite,
|
|
114
|
+
suiteVersion,
|
|
115
|
+
suiteManifestDigest: suiteDigest,
|
|
116
|
+
scenarioId: caseRecord.id,
|
|
117
|
+
scenarioVersion,
|
|
118
|
+
scenarioManifestDigest: scenarioDigest,
|
|
119
|
+
};
|
|
120
|
+
if (shouldEnforceRunIdentity(run, deps) && !runIdentityMatches(run, expected)) return contractChanged();
|
|
121
|
+
const result = await runScenario(caseRecord);
|
|
122
|
+
assertNotCancelled(deps.abortSignal);
|
|
123
|
+
persistConformanceResult(result, caseRecord, authority, { configDir });
|
|
124
|
+
rebuildLabProjection(configDir);
|
|
125
|
+
return {
|
|
126
|
+
terminalState: result.passed ? "completed" : "failed",
|
|
127
|
+
terminalCode: result.passed ? "pass" : "protocol_fail",
|
|
128
|
+
cooldownCode: result.passed ? "pass" : "protocol_failure",
|
|
129
|
+
liveRequest: false,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
case "live_route_compatibility": {
|
|
133
|
+
assertNotCancelled(deps.abortSignal);
|
|
134
|
+
if (!deps.routeExecutor) return routeIneligible();
|
|
135
|
+
if (!deps.loadConfig || !run.providerName || !run.modelId) {
|
|
136
|
+
throw new LabAutomationError("live dispatch requires route configuration", "dispatch_failure");
|
|
137
|
+
}
|
|
138
|
+
const config = deps.loadConfig();
|
|
139
|
+
const routed = config.providers?.[run.providerName];
|
|
140
|
+
if (!routed) return routeIneligible();
|
|
141
|
+
const resolved = resolvePolicyCompatibilitySubjects(
|
|
142
|
+
config,
|
|
143
|
+
run.providerName,
|
|
144
|
+
run.modelId,
|
|
145
|
+
routed,
|
|
146
|
+
configDir,
|
|
147
|
+
);
|
|
148
|
+
if (!resolved.route) return routeIneligible();
|
|
149
|
+
const authority = loadLiveCaseAuthority();
|
|
150
|
+
const caseRecord = authority.cases.find((row) => row.id === run.scenarioId);
|
|
151
|
+
if (!caseRecord) {
|
|
152
|
+
throw new LabAutomationError("missing live scenario", "dispatch_failure");
|
|
153
|
+
}
|
|
154
|
+
const scenarioDigest = scenarioManifestDigest(expandLiveScenario(caseRecord, authority));
|
|
155
|
+
const suiteDigest = liveSuiteManifestDigestForCase(caseRecord, authority);
|
|
156
|
+
const suiteVersion = authority.manifestDefaults.suiteVersion;
|
|
157
|
+
const scenarioVersion = authority.manifestDefaults.version;
|
|
158
|
+
const subjectId = resolved.route.subjectId;
|
|
159
|
+
const expected: ExpectedRunIdentity = {
|
|
160
|
+
runKey: buildLabAutomationRunKey({
|
|
161
|
+
evidenceLayer: "live_route_compatibility",
|
|
162
|
+
subjectId,
|
|
163
|
+
suiteId: caseRecord.suite,
|
|
164
|
+
suiteVersion,
|
|
165
|
+
suiteManifestDigest: suiteDigest,
|
|
166
|
+
scenarioId: caseRecord.id,
|
|
167
|
+
scenarioVersion,
|
|
168
|
+
scenarioManifestDigest: scenarioDigest,
|
|
169
|
+
executionContractDigest: liveExecutionContractDigest(),
|
|
170
|
+
}),
|
|
171
|
+
subjectId,
|
|
172
|
+
suiteId: caseRecord.suite,
|
|
173
|
+
suiteVersion,
|
|
174
|
+
suiteManifestDigest: suiteDigest,
|
|
175
|
+
scenarioId: caseRecord.id,
|
|
176
|
+
scenarioVersion,
|
|
177
|
+
scenarioManifestDigest: scenarioDigest,
|
|
178
|
+
};
|
|
179
|
+
if (shouldEnforceRunIdentity(run, deps) && !runIdentityMatches(run, expected)) return contractChanged();
|
|
180
|
+
const routeContext = buildAutomationLiveRouteContext(
|
|
181
|
+
resolved.route,
|
|
182
|
+
routed.allowPrivateNetwork === true,
|
|
183
|
+
);
|
|
184
|
+
const result = await runLiveScenario(caseRecord, routeContext, {
|
|
185
|
+
configDir,
|
|
186
|
+
routeExecutor: deps.routeExecutor,
|
|
187
|
+
cancelSignal: deps.abortSignal,
|
|
188
|
+
resolve: deps.resolve,
|
|
189
|
+
});
|
|
190
|
+
// Cancellation is orchestration state. Never mint canonical evidence after an abort.
|
|
191
|
+
assertNotCancelled(deps.abortSignal);
|
|
192
|
+
if (result.executionAuthority === "trusted_route") {
|
|
193
|
+
persistLiveResult(result, caseRecord, authority, { configDir });
|
|
194
|
+
rebuildLabProjection(configDir);
|
|
195
|
+
}
|
|
196
|
+
const blocked = result.classification === "authentication_blocked"
|
|
197
|
+
|| result.classification === "quota_blocked"
|
|
198
|
+
|| result.classification === "region_blocked";
|
|
199
|
+
return {
|
|
200
|
+
terminalState: result.passed ? "completed" : blocked ? "blocked" : "failed",
|
|
201
|
+
terminalCode: result.secondaryCode ?? result.classification,
|
|
202
|
+
cooldownCode: result.classification,
|
|
203
|
+
liveRequest: true,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
case "task_effectiveness":
|
|
207
|
+
throw new LabAutomationError("task_effectiveness background execution is not enabled", "task_background_disabled");
|
|
208
|
+
default:
|
|
209
|
+
throw new LabAutomationError(`unsupported evidence layer ${run.evidenceLayer as string}`, "dispatch_failure");
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export * from "./constants";
|
|
3
|
+
export * from "./policy";
|
|
4
|
+
export * from "./run-key";
|
|
5
|
+
export * from "./persistence";
|
|
6
|
+
export * from "./planner";
|
|
7
|
+
export * from "./queue";
|
|
8
|
+
export * from "./budgets";
|
|
9
|
+
export * from "./cooldown";
|
|
10
|
+
export * from "./dispatch";
|
|
11
|
+
export * from "./recovery";
|
|
12
|
+
export * from "./runs-query";
|
|
13
|
+
export * from "./orchestrator";
|