@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,24 @@
|
|
|
1
|
+
import type { LabAutomationPolicyV1, LabAutomationStateV1 } from "./types";
|
|
2
|
+
import { transitionRun } from "./queue";
|
|
3
|
+
import { setCooldown } from "./cooldown";
|
|
4
|
+
import { LAB_AUTOMATION_HARD_MAX } from "./constants";
|
|
5
|
+
|
|
6
|
+
/** Reconcile runs left running after process restart. */
|
|
7
|
+
export function recoverLabAutomationState(
|
|
8
|
+
policy: LabAutomationPolicyV1,
|
|
9
|
+
state: LabAutomationStateV1,
|
|
10
|
+
now: number,
|
|
11
|
+
): LabAutomationStateV1 {
|
|
12
|
+
let next = { ...state };
|
|
13
|
+
for (const run of state.runs) {
|
|
14
|
+
if (run.state !== "running") continue;
|
|
15
|
+
next = transitionRun(next, run.runId, "abandoned", now, "process_restart");
|
|
16
|
+
next = setCooldown(
|
|
17
|
+
next,
|
|
18
|
+
run.runKey,
|
|
19
|
+
now + Math.min(policy.failureCooldownMs, LAB_AUTOMATION_HARD_MAX.failureCooldownMs),
|
|
20
|
+
now,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
return next;
|
|
24
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LabRouteContext } from "../live/types";
|
|
2
|
+
import type { ResolvedPolicyRouteSubject } from "../../routing/compatibility/subject";
|
|
3
|
+
|
|
4
|
+
/** Harness features the production trusted-route automation contract actually provides. */
|
|
5
|
+
export const CL08_TRUSTED_LIVE_HARNESS_FEATURES = Object.freeze([
|
|
6
|
+
"live_transport",
|
|
7
|
+
]);
|
|
8
|
+
|
|
9
|
+
/** Build the CL-03 route context automation dispatch and planning share. */
|
|
10
|
+
export function buildAutomationLiveRouteContext(
|
|
11
|
+
resolved: ResolvedPolicyRouteSubject,
|
|
12
|
+
allowPrivateNetwork = false,
|
|
13
|
+
): LabRouteContext {
|
|
14
|
+
return {
|
|
15
|
+
...resolved.routeContext,
|
|
16
|
+
labRunApproval: true,
|
|
17
|
+
allowPrivateNetwork,
|
|
18
|
+
requiredClaims: resolved.routeContext.requiredClaims ?? [],
|
|
19
|
+
availableHarnessFeatures: [...CL08_TRUSTED_LIVE_HARNESS_FEATURES],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { jcsStringify } from "../digest";
|
|
3
|
+
import type { LabAutomationLayer } from "./types";
|
|
4
|
+
|
|
5
|
+
export interface RunKeyInput {
|
|
6
|
+
evidenceLayer: LabAutomationLayer;
|
|
7
|
+
subjectId: string;
|
|
8
|
+
suiteId: string;
|
|
9
|
+
suiteVersion: string;
|
|
10
|
+
suiteManifestDigest: string;
|
|
11
|
+
scenarioId: string;
|
|
12
|
+
scenarioVersion: string;
|
|
13
|
+
scenarioManifestDigest: string;
|
|
14
|
+
executionContractDigest: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Deterministic deduplication key for orchestration runs. */
|
|
18
|
+
export function buildLabAutomationRunKey(input: RunKeyInput): string {
|
|
19
|
+
const payload = {
|
|
20
|
+
evidenceLayer: input.evidenceLayer,
|
|
21
|
+
subjectId: input.subjectId,
|
|
22
|
+
suiteId: input.suiteId,
|
|
23
|
+
suiteVersion: input.suiteVersion,
|
|
24
|
+
suiteManifestDigest: input.suiteManifestDigest,
|
|
25
|
+
scenarioId: input.scenarioId,
|
|
26
|
+
scenarioVersion: input.scenarioVersion,
|
|
27
|
+
scenarioManifestDigest: input.scenarioManifestDigest,
|
|
28
|
+
executionContractDigest: input.executionContractDigest,
|
|
29
|
+
};
|
|
30
|
+
return createHash("sha256").update(jcsStringify(payload)).digest("hex");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Contract identity digest for protocol/live/fabric execution boundaries. */
|
|
34
|
+
export function protocolExecutionContractDigest(): string {
|
|
35
|
+
return createHash("sha256").update(jcsStringify({ contract: "cl-01-protocol-harness-v1" })).digest("hex");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function liveExecutionContractDigest(): string {
|
|
39
|
+
return createHash("sha256").update(jcsStringify({ contract: "cl-03-live-trusted-route-v1" })).digest("hex");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function fabricExecutionContractDigest(): string {
|
|
43
|
+
return createHash("sha256").update(jcsStringify({ contract: "cl-07-fabric-trusted-route-v1" })).digest("hex");
|
|
44
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { LabAutomationRunRecordV1, LabAutomationStateV1 } from "./types";
|
|
2
|
+
import { LAB_AUTOMATION_HARD_MAX } from "./constants";
|
|
3
|
+
import { LabAutomationError } from "./types";
|
|
4
|
+
|
|
5
|
+
export interface LabAutomationRunsPage {
|
|
6
|
+
items: LabAutomationRunRecordV1[];
|
|
7
|
+
hasMore: boolean;
|
|
8
|
+
nextCursor?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function listLabAutomationRuns(
|
|
12
|
+
state: LabAutomationStateV1,
|
|
13
|
+
limit = 50,
|
|
14
|
+
cursor?: string,
|
|
15
|
+
): LabAutomationRunsPage {
|
|
16
|
+
const capped = Math.min(Math.max(1, limit), LAB_AUTOMATION_HARD_MAX.maxPersistedRuns);
|
|
17
|
+
const sorted = [...state.runs].sort((a, b) => {
|
|
18
|
+
if (a.createdAt !== b.createdAt) return b.createdAt - a.createdAt;
|
|
19
|
+
return a.runId < b.runId ? -1 : 1;
|
|
20
|
+
});
|
|
21
|
+
let start = 0;
|
|
22
|
+
if (cursor) {
|
|
23
|
+
const index = sorted.findIndex((row) => row.runId === cursor);
|
|
24
|
+
if (index < 0) throw new LabAutomationError("invalid or expired run cursor", "invalid_cursor");
|
|
25
|
+
start = index + 1;
|
|
26
|
+
}
|
|
27
|
+
const slice = sorted.slice(start, start + capped);
|
|
28
|
+
const hasMore = start + capped < sorted.length;
|
|
29
|
+
return {
|
|
30
|
+
items: slice,
|
|
31
|
+
hasMore,
|
|
32
|
+
...(hasMore && slice.length > 0 ? { nextCursor: slice[slice.length - 1]!.runId } : {}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import type { EvidenceLayer } from "../constants";
|
|
2
|
+
|
|
3
|
+
export type LabAutomationLayer =
|
|
4
|
+
| "protocol_conformance"
|
|
5
|
+
| "live_route_compatibility"
|
|
6
|
+
| "task_effectiveness";
|
|
7
|
+
|
|
8
|
+
export interface LabAutomationPolicyV1 {
|
|
9
|
+
schemaVersion: 1;
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
layers: {
|
|
12
|
+
protocolConformance: boolean;
|
|
13
|
+
liveRouteCompatibility: boolean;
|
|
14
|
+
taskEffectiveness: boolean;
|
|
15
|
+
};
|
|
16
|
+
refreshBeforeStaleMs: number;
|
|
17
|
+
maxConcurrentRuns: number;
|
|
18
|
+
maxConcurrentLiveRuns: number;
|
|
19
|
+
maxConcurrentRunsPerRoute: number;
|
|
20
|
+
maxRunsPerHour: number;
|
|
21
|
+
maxLiveRequestsPerHour: number;
|
|
22
|
+
failureCooldownMs: number;
|
|
23
|
+
blockedCooldownMs: number;
|
|
24
|
+
taskEffectivenessBackgroundEnabled: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type LabAutomationPlanReason =
|
|
28
|
+
| "automation_disabled"
|
|
29
|
+
| "layer_disabled"
|
|
30
|
+
| "fresh"
|
|
31
|
+
| "refresh_due"
|
|
32
|
+
| "missing"
|
|
33
|
+
| "cooldown"
|
|
34
|
+
| "budget_blocked"
|
|
35
|
+
| "already_queued"
|
|
36
|
+
| "already_running"
|
|
37
|
+
| "route_ineligible"
|
|
38
|
+
| "scenario_inapplicable"
|
|
39
|
+
| "task_background_disabled";
|
|
40
|
+
|
|
41
|
+
export interface PlannedLabRunV1 {
|
|
42
|
+
runKey: string;
|
|
43
|
+
evidenceLayer: LabAutomationLayer;
|
|
44
|
+
suiteId: string;
|
|
45
|
+
suiteVersion: string;
|
|
46
|
+
suiteManifestDigest: string;
|
|
47
|
+
scenarioId: string;
|
|
48
|
+
scenarioVersion: string;
|
|
49
|
+
scenarioManifestDigest: string;
|
|
50
|
+
subjectId: string;
|
|
51
|
+
reason: LabAutomationPlanReason;
|
|
52
|
+
priority: number;
|
|
53
|
+
eligibleAt: number;
|
|
54
|
+
providerName?: string;
|
|
55
|
+
modelId?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type LabAutomationRunState =
|
|
59
|
+
| "queued"
|
|
60
|
+
| "running"
|
|
61
|
+
| "completed"
|
|
62
|
+
| "blocked"
|
|
63
|
+
| "failed"
|
|
64
|
+
| "cancelled"
|
|
65
|
+
| "abandoned";
|
|
66
|
+
|
|
67
|
+
export type LabAutomationRunTrigger = "scheduled" | "manual";
|
|
68
|
+
|
|
69
|
+
export interface LabAutomationRunRecordV1 {
|
|
70
|
+
runId: string;
|
|
71
|
+
runKey: string;
|
|
72
|
+
state: LabAutomationRunState;
|
|
73
|
+
evidenceLayer: LabAutomationLayer;
|
|
74
|
+
suiteId: string;
|
|
75
|
+
suiteVersion: string;
|
|
76
|
+
suiteManifestDigest: string;
|
|
77
|
+
scenarioId: string;
|
|
78
|
+
scenarioVersion: string;
|
|
79
|
+
scenarioManifestDigest: string;
|
|
80
|
+
subjectId: string;
|
|
81
|
+
reason: LabAutomationPlanReason;
|
|
82
|
+
priority: number;
|
|
83
|
+
eligibleAt: number;
|
|
84
|
+
trigger: LabAutomationRunTrigger;
|
|
85
|
+
createdAt: number;
|
|
86
|
+
updatedAt: number;
|
|
87
|
+
startedAt?: number;
|
|
88
|
+
completedAt?: number;
|
|
89
|
+
terminalCode?: string;
|
|
90
|
+
providerName?: string;
|
|
91
|
+
modelId?: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface LabAutomationRouteRefV1 {
|
|
95
|
+
providerName: string;
|
|
96
|
+
modelId: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface LabAutomationRoutesV1 {
|
|
100
|
+
schemaVersion: 1;
|
|
101
|
+
routes: readonly LabAutomationRouteRefV1[];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface LabAutomationStateV1 {
|
|
105
|
+
schemaVersion: 1;
|
|
106
|
+
runs: LabAutomationRunRecordV1[];
|
|
107
|
+
budgetWindowStartedAt: number;
|
|
108
|
+
runsThisHour: number;
|
|
109
|
+
liveRequestsThisHour: number;
|
|
110
|
+
cooldownUntilByKey: Record<string, number>;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface LabAutomationStatusV1 {
|
|
114
|
+
policy: LabAutomationPolicyV1;
|
|
115
|
+
routes: LabAutomationRoutesV1;
|
|
116
|
+
counters: {
|
|
117
|
+
queued: number;
|
|
118
|
+
running: number;
|
|
119
|
+
completedLastHour: number;
|
|
120
|
+
blockedLastHour: number;
|
|
121
|
+
remainingRunBudget: number;
|
|
122
|
+
remainingLiveRequestBudget: number;
|
|
123
|
+
};
|
|
124
|
+
schedulerRunning: boolean;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface AutomationDispatchDeps {
|
|
128
|
+
configDir?: string;
|
|
129
|
+
routeExecutor?: import("../live/types").TrustedLabRouteExecutor;
|
|
130
|
+
patchExecutor?: import("../fabric/types").TrustedFabricPatchExecutor;
|
|
131
|
+
loadConfig?: () => import("../../types").OcxConfig;
|
|
132
|
+
abortSignal?: AbortSignal;
|
|
133
|
+
/** Orchestrator-set guard that requires the queued identity to match current frozen contracts. */
|
|
134
|
+
enforceRunIdentity?: boolean;
|
|
135
|
+
/** Test-only DNS seam; production uses destination policy resolution when unset. */
|
|
136
|
+
resolve?: import("../live/types").DnsResolver;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export class LabAutomationError extends Error {
|
|
140
|
+
override readonly name = "LabAutomationError";
|
|
141
|
+
constructor(
|
|
142
|
+
message: string,
|
|
143
|
+
readonly code: string,
|
|
144
|
+
) {
|
|
145
|
+
super(message);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function evidenceLayerToAutomationLayer(layer: EvidenceLayer): LabAutomationLayer | null {
|
|
150
|
+
switch (layer) {
|
|
151
|
+
case "protocol_conformance":
|
|
152
|
+
return "protocol_conformance";
|
|
153
|
+
case "live_route_compatibility":
|
|
154
|
+
return "live_route_compatibility";
|
|
155
|
+
case "task_effectiveness":
|
|
156
|
+
return "task_effectiveness";
|
|
157
|
+
default:
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -9,7 +9,11 @@ export type VerificationRole = "required" | "supplemental" | "negative_control";
|
|
|
9
9
|
export type FailureClassification =
|
|
10
10
|
| "harness_failure"
|
|
11
11
|
| "timeout"
|
|
12
|
+
| "inactivity_timeout"
|
|
12
13
|
| "budget_exhausted"
|
|
14
|
+
| "sandbox_violation"
|
|
15
|
+
| "malformed_producer_outcome"
|
|
16
|
+
| "layer_subject_mismatch"
|
|
13
17
|
| "protocol_failure"
|
|
14
18
|
| "capability_failure"
|
|
15
19
|
| "behavioral_failure"
|
|
@@ -20,6 +24,25 @@ export type FailureClassification =
|
|
|
20
24
|
| "provider_transient"
|
|
21
25
|
| "inconclusive";
|
|
22
26
|
|
|
27
|
+
export const FAILURE_CLASSIFICATIONS = [
|
|
28
|
+
"harness_failure",
|
|
29
|
+
"timeout",
|
|
30
|
+
"inactivity_timeout",
|
|
31
|
+
"budget_exhausted",
|
|
32
|
+
"sandbox_violation",
|
|
33
|
+
"malformed_producer_outcome",
|
|
34
|
+
"layer_subject_mismatch",
|
|
35
|
+
"protocol_failure",
|
|
36
|
+
"capability_failure",
|
|
37
|
+
"behavioral_failure",
|
|
38
|
+
"authentication_blocked",
|
|
39
|
+
"quota_blocked",
|
|
40
|
+
"region_blocked",
|
|
41
|
+
"network_failure",
|
|
42
|
+
"provider_transient",
|
|
43
|
+
"inconclusive",
|
|
44
|
+
] as const satisfies readonly FailureClassification[];
|
|
45
|
+
|
|
23
46
|
export interface FixtureRecord {
|
|
24
47
|
id: string;
|
|
25
48
|
role: "client_request" | "upstream_response" | "adapter_vector" | "synthetic_tool";
|
package/src/lab/events/types.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
ObservationOutcome,
|
|
10
10
|
PurgeAction,
|
|
11
11
|
} from "../constants";
|
|
12
|
+
import type { FailureClassification } from "../conformance/types";
|
|
12
13
|
|
|
13
14
|
export interface LabProducer {
|
|
14
15
|
name: string;
|
|
@@ -90,7 +91,7 @@ export interface AssertionRecordV1 {
|
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
export interface FailureRecordV1 {
|
|
93
|
-
class:
|
|
94
|
+
class: FailureClassification;
|
|
94
95
|
code: string;
|
|
95
96
|
retryable: boolean;
|
|
96
97
|
attribution: "opencodex" | "route" | "environment" | "harness";
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
jcsStringify,
|
|
30
30
|
subjectIdForSubject,
|
|
31
31
|
} from "../digest";
|
|
32
|
+
import { FAILURE_CLASSIFICATIONS } from "../conformance/types";
|
|
32
33
|
import type {
|
|
33
34
|
ArtifactRefV1,
|
|
34
35
|
ClaimCapabilityFactsV1,
|
|
@@ -408,7 +409,7 @@ function validateObservation(raw: Record<string, unknown>): ObservationEvent {
|
|
|
408
409
|
if (raw.failure !== undefined) {
|
|
409
410
|
if (!isPlainObject(raw.failure)) throw new LabValidationError("invalid_failure", "failure");
|
|
410
411
|
event.failure = {
|
|
411
|
-
class:
|
|
412
|
+
class: assertClosed(raw.failure.class, "failure.class", FAILURE_CLASSIFICATIONS),
|
|
412
413
|
code: assertString(raw.failure.code, "failure.code"),
|
|
413
414
|
retryable: raw.failure.retryable === true,
|
|
414
415
|
attribution: assertClosed(raw.failure.attribution, "failure.attribution", [
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** CL-07 frozen fabric-core / synthetic-patch constants. */
|
|
2
|
+
|
|
3
|
+
export const FABRIC_SUITE_ID = "fabric-core";
|
|
4
|
+
export const FABRIC_SUITE_VERSION = "1.0.0";
|
|
5
|
+
export const FABRIC_SCENARIO_ID = "fabric-core.task.synthetic-patch";
|
|
6
|
+
export const FABRIC_SCENARIO_VERSION = "1.0.0";
|
|
7
|
+
export const FABRIC_TASK_CLASS_ID = "fabric-core.task.synthetic-patch";
|
|
8
|
+
export const FABRIC_TASK_CLASS_VERSION = "1.0.0";
|
|
9
|
+
export const FABRIC_COMPATIBILITY_VERSION = "ocx-fabric-producer-v1";
|
|
10
|
+
export const FABRIC_VERIFIER_ID = "exact-tree-diff-v1";
|
|
11
|
+
export const FABRIC_EVIDENCE_LAYER = "task_effectiveness" as const;
|
|
12
|
+
|
|
13
|
+
export const SYNTHETIC_VALUE_PATH = "src/value.txt";
|
|
14
|
+
export const SYNTHETIC_BEFORE_UTF8 = "before\n";
|
|
15
|
+
export const SYNTHETIC_AFTER_UTF8 = "after\n";
|
|
16
|
+
|
|
17
|
+
export const FABRIC_LIMITS = Object.freeze({
|
|
18
|
+
maxFiles: 1,
|
|
19
|
+
/** Upper bound for scratch-tree walks (verifier may see unexpected extras). */
|
|
20
|
+
maxScratchFiles: 8,
|
|
21
|
+
maxAggregateIoBytes: 64 * 1024,
|
|
22
|
+
maxPatchOperations: 1,
|
|
23
|
+
totalTimeoutMs: 30_000,
|
|
24
|
+
inactivityTimeoutMs: 5_000,
|
|
25
|
+
aggregateArtifactBytes: 1024 * 1024,
|
|
26
|
+
maxArtifacts: 8,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const SANDBOX_PROFILE_V1 = Object.freeze({
|
|
30
|
+
schemaVersion: 1,
|
|
31
|
+
profileId: "lab-fabric-scratch-v1",
|
|
32
|
+
allowNetwork: false,
|
|
33
|
+
allowUserMcp: false,
|
|
34
|
+
allowShell: false,
|
|
35
|
+
allowUserRepository: false,
|
|
36
|
+
followSymlinks: false,
|
|
37
|
+
allowSpecialFiles: false,
|
|
38
|
+
scratchOnly: true,
|
|
39
|
+
limits: FABRIC_LIMITS,
|
|
40
|
+
});
|