@openclaw/codex 2026.9.7 → 2026.10.1-beta.1
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 +8 -0
- package/dist/.setup/{account-usage-runtime-DFhbh1zz.mjs → account-usage-runtime-C4GFoef_.mjs} +5 -5
- package/dist/.setup/app-server-policy-Bg4FZw1f.mjs +23 -0
- package/dist/.setup/{apply-D3GcSoSa.mjs → apply-D02fLpgN.mjs} +48 -39
- package/dist/.setup/attempt-client-cleanup-yLjGwbwT.mjs +155 -0
- package/dist/.setup/{attempt-workspace-context-C5HigshI.mjs → attempt-workspace-context-CbSzT6V2.mjs} +11 -15
- package/dist/.setup/{auth-binding-BLWz7stm.mjs → auth-binding-BoMwpuPN.mjs} +17 -25
- package/dist/.setup/{auth-cache-key-Dbvq-QgB.mjs → auth-cache-key-CEd9QlIs.mjs} +244 -82
- package/dist/.setup/{auth-profile-B0okYl2D.mjs → auth-profile-CgHQ8Vot.mjs} +2 -1
- package/dist/.setup/{auth-profile-selection-DFu9e167.mjs → auth-profile-selection-hr8ocLtz.mjs} +5 -7
- package/dist/.setup/{binding-connection-DTtN1KrX.mjs → binding-connection-C-08ez1w.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-6TpgD1M6.mjs → binding-connection.runtime-Dn2p-fdy.mjs} +3 -3
- package/dist/.setup/{bounded-turn-CbjoN2OW.mjs → bounded-turn-DlHlNTyS.mjs} +14 -13
- package/dist/.setup/{bounded-turn-isolation-B8K_ylqk.mjs → bounded-turn-isolation-DklXNk3k.mjs} +4 -4
- package/dist/.setup/{build-state-Da1_z0kd.mjs → build-state-CIi3Ckqu.mjs} +1 -1
- package/dist/.setup/{capabilities-B3WEZl4e.mjs → capabilities-kQntafj_.mjs} +1 -1
- package/dist/.setup/{client-N0JpgSzF.mjs → client-CBzEVDyb.mjs} +438 -160
- package/dist/.setup/{client-catalog-response-5HHLdcde.mjs → client-catalog-response-CmvIiDdj.mjs} +57 -25
- package/dist/.setup/command-authorization-AikPDtcc.mjs +15 -0
- package/dist/.setup/{command-dispatch-BeAoaovI.mjs → command-dispatch-BE_RdMou.mjs} +3 -3
- package/dist/.setup/{command-formatters-R3ckE3Co.mjs → command-formatters-DV3DHhdr.mjs} +7 -5
- package/dist/.setup/{command-handlers-ylTMS00z.mjs → command-handlers-DNoRq5Ps.mjs} +82 -144
- package/dist/.setup/{command-rpc-CGJGUQ6Y.mjs → command-rpc-B6xsq2dB.mjs} +23 -31
- package/dist/.setup/{compact-C2WamavS.mjs → compact-BLSAd-ru.mjs} +117 -65
- package/dist/.setup/{plugin-metadata-cache-DsjsL1dr.mjs → computer-use-DpolvQHw.mjs} +66 -203
- package/dist/.setup/{config-DKhXquav.mjs → config-0Gxk3_eq.mjs} +5 -6
- package/dist/.setup/{config-options-CzyWLTJt.mjs → config-options-HG_Rr3W_.mjs} +13 -23
- package/dist/.setup/{config-parsing-b088LyhT.mjs → config-parsing-BQq-CHTF.mjs} +41 -4
- package/dist/.setup/{config-runtime-C0NbLms1.mjs → config-runtime-cUYrqu_a.mjs} +2 -2
- package/dist/.setup/{config-security-CE-FcGw9.mjs → config-security-KAPScztc.mjs} +20 -36
- package/dist/.setup/{context-engine-projection-PezSESth.mjs → context-engine-projection-CsgYSQhW.mjs} +11 -14
- package/dist/.setup/{conversation-binding-3Min8qvP.mjs → conversation-binding-CgSSD1Qz.mjs} +36 -48
- package/dist/.setup/{conversation-binding-data-C746z5Pn.mjs → conversation-binding-data-DJ4ix-W5.mjs} +1 -1
- package/dist/.setup/{conversation-control-CEP8X5JC.mjs → conversation-control-tCg763cI.mjs} +19 -21
- package/dist/.setup/{cyber-failover-XV0nNRZu.mjs → cyber-failover-Bb1J6hS1.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-RNpGpTyP.mjs → cyber-failover-notice-XR03ef31.mjs} +1 -1
- package/dist/.setup/doctor-start-options-DPW9JxIE.mjs +63 -0
- package/dist/.setup/dynamic-tool-build-CVrx02cH.mjs +463 -0
- package/dist/.setup/{dynamic-tools-DzlsLUuS.mjs → dynamic-tools-DdsymYGQ.mjs} +238 -878
- package/dist/.setup/{effective-mcp-catalog-CxUtC-xG.mjs → effective-mcp-catalog-BysTBZCW.mjs} +83 -11
- package/dist/.setup/{elicitation-input-DPoK8F7w.mjs → elicitation-input-r9axtppm.mjs} +4 -2
- package/dist/.setup/{ephemeral-turn-CDsPJOa2.mjs → ephemeral-turn-oPKxs3ia.mjs} +2 -2
- package/dist/.setup/{event-projector-assistant-message-CigreO4K.mjs → event-projector-assistant-message-YCL2wspu.mjs} +2 -2
- package/dist/.setup/{event-projector-values-DJSz8BTk.mjs → event-projector-values-DTqZHizf.mjs} +2 -12
- package/dist/.setup/{inference-dispatch-CMZtjQyz.mjs → inference-dispatch-B5UKEUyC.mjs} +12 -21
- package/dist/.setup/{inference-proxy-DhcXOgUE.mjs → inference-proxy-DUO5E2QQ.mjs} +6 -5
- package/dist/.setup/{isolated-completion-Dm3PzxJk.mjs → isolated-completion-D5gbKm6k.mjs} +8 -8
- package/dist/.setup/{managed-binary-kiWRhNRE.mjs → managed-binary-C1VFoVPf.mjs} +31 -38
- package/dist/.setup/mcp-app-session-preparation-CdqsXwZX.mjs +223 -0
- package/dist/.setup/mcp-tool-metadata-j10HhfTC.mjs +43 -0
- package/dist/.setup/{model-catalog-PAuZgJC6.mjs → model-catalog-Dj_uvusa.mjs} +7 -7
- package/dist/.setup/{models-DHXZtVVk.mjs → models-Du_i5G_t.mjs} +10 -7
- package/dist/.setup/{native-auth-CuG53tu4.mjs → native-auth-Cjb9y7IZ.mjs} +5 -6
- package/dist/.setup/{native-execution-policy-BxZJy5mP.mjs → native-execution-policy-ClzpdG3D.mjs} +1 -12
- package/dist/.setup/native-mcp-app-DV7VbfzF.mjs +310 -0
- package/dist/.setup/{native-subagent-monitor-Dpsmf2wz.mjs → native-subagent-monitor-CCEFO6qK.mjs} +235 -318
- package/dist/.setup/{native-subagent-pending-assignments-DwkCzLvD.mjs → native-subagent-pending-assignments-BDqhOdJp.mjs} +0 -4
- package/dist/.setup/{native-task-assignments-DMQ0g3hu.mjs → native-task-assignments-C6KVqiN1.mjs} +9 -8
- package/dist/.setup/{node-cli-sessions-HC4W6FLI.mjs → node-cli-sessions-B5oNDkUS.mjs} +11 -17
- package/dist/.setup/{node-exec-server.runtime-BgBfWQqo.mjs → node-exec-server.runtime-0xSEjKYt.mjs} +2 -2
- package/dist/.setup/{plan-Y-QIvrKB.mjs → plan-CUHSIOep.mjs} +67 -89
- package/dist/.setup/{plugin-activation-cNHRfaxU.mjs → plugin-activation-BcyBv8PG.mjs} +4 -4
- package/dist/.setup/{plugin-app-cache-key-BL9B5H0L.mjs → plugin-app-cache-key-BW8rd98k.mjs} +11 -15
- package/dist/.setup/plugin-approval-roundtrip-uAR-oQfr.mjs +109 -0
- package/dist/.setup/{plugin-inventory-Cky2XJUw.mjs → plugin-inventory-Bf0_piTw.mjs} +29 -51
- package/dist/.setup/{plugin-marketplace-discovery-D_dV9FXa.mjs → plugin-marketplace-discovery-SQPhSuic.mjs} +2 -16
- package/dist/.setup/plugin-metadata-cache-DWnB7VMj.mjs +84 -0
- package/dist/.setup/plugin-thread-config-deadline-CdRzGJt4.mjs +124 -0
- package/dist/.setup/{provider-DH8NSzGt.mjs → provider-BP8ZaZqn.mjs} +4 -4
- package/dist/.setup/provider-capabilities-Z5ZbBxqP.mjs +50 -0
- package/dist/.setup/{rate-limits-B7-X2TgG.mjs → rate-limits-CMPy24F5.mjs} +1 -5
- package/dist/.setup/{request-BHZ1nz8d.mjs → request-BH3FvYUE.mjs} +189 -49
- package/dist/.setup/rpc-error-hmWM21RB.mjs +57 -0
- package/dist/.setup/{run-attempt-D8RZUOzY.mjs → run-attempt-CgvFoW7R.mjs} +553 -727
- package/dist/.setup/{run-attempt-lifecycle-C-6O3Exn.mjs → run-attempt-lifecycle-BuZgVbDA.mjs} +19 -3
- package/dist/.setup/{runtime-artifact-DDQ-HGXf.mjs → runtime-artifact-CUTOOnKw.mjs} +5 -6
- package/dist/.setup/{runtime-artifact-connection-D68qQn1m.mjs → runtime-artifact-connection-CADz3_BY.mjs} +5 -4
- package/dist/.setup/{sandbox-guard-DjCz2eOw.mjs → sandbox-guard-WqE8yPge.mjs} +3 -3
- package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +15 -0
- package/dist/.setup/{session-binding-DGCYAfvD.mjs → session-binding-Ce7BqiPN.mjs} +92 -102
- package/dist/.setup/session-binding-meta-Lkm5Lpf4.mjs +15 -0
- package/dist/.setup/session-binding-record-BZB8RgcF.mjs +179 -0
- package/dist/.setup/session-binding-record-codec-z4ZpDn6E.mjs +216 -0
- package/dist/.setup/{session-binding-sidecars-jo6H8dFr.mjs → session-binding-sidecars-BrdV95Fg.mjs} +8 -2
- package/dist/.setup/{session-catalog-adoption-BU_pHWG7.mjs → session-catalog-adoption-CPIP4S_y.mjs} +34 -18
- package/dist/.setup/{session-catalog-archive-spHfihri.mjs → session-catalog-archive-DcgwvSbF.mjs} +24 -29
- package/dist/.setup/{session-catalog-events-DePDzzjc.mjs → session-catalog-events-KIXOoSnQ.mjs} +5 -5
- package/dist/.setup/{session-catalog-index-CZvDzC6z.mjs → session-catalog-index-DPICGlxr.mjs} +361 -72
- package/dist/.setup/{session-catalog-index-order-BcQpHks3.mjs → session-catalog-index-order-nhyO0wdW.mjs} +1 -1
- package/dist/.setup/{session-catalog-limits-DDxOsQeC.mjs → session-catalog-limits-DEU36Qlo.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-state-TeO7EyO-.mjs → session-catalog-list-request-tXephOB4.mjs} +180 -6
- package/dist/.setup/{session-catalog-native-projection-DjhwGL6x.mjs → session-catalog-native-projection-CTBd4EUm.mjs} +7 -6
- package/dist/.setup/{session-catalog-node-adoption-DgXvSGu0.mjs → session-catalog-node-adoption-7-WEQTB1.mjs} +12 -2
- package/dist/.setup/{session-catalog-node-continue-DjKXHBbi.mjs → session-catalog-node-continue-DLWBwAAO.mjs} +11 -15
- package/dist/.setup/{session-catalog-node-lookup-CtAXI5W5.mjs → session-catalog-node-lookup-Uufckwcm.mjs} +2 -2
- package/dist/.setup/{session-catalog-parsing-CPGaPYr-.mjs → session-catalog-parsing-B-qWJh2x.mjs} +70 -28
- package/dist/.setup/{session-catalog-projection-Cr5qP5Dj.mjs → session-catalog-projection-CE0_Hffi.mjs} +6 -122
- package/dist/.setup/{session-catalog-provenance-DoAvktcj.mjs → session-catalog-provenance-CmsOE5mh.mjs} +6 -1
- package/dist/.setup/{session-cli-Cn_nCqfq.mjs → session-cli-kH4vuGod.mjs} +1 -2
- package/dist/.setup/{session-history-D83lJWHG.mjs → session-history-BogBHKLk.mjs} +1 -1
- package/dist/.setup/{session-history-import-WhX-X33a.mjs → session-history-import-NWKPa4ZO.mjs} +4 -4
- package/dist/.setup/{session-history-read-Ov3StuL4.mjs → session-history-read-CNN8zwbD.mjs} +8 -19
- package/dist/.setup/{session-history.worker-MnPKncqP.mjs → session-history.worker-Cq_4DYgN.mjs} +3 -3
- package/dist/.setup/{session-initialization-6aveB9qb.mjs → session-initialization-D6dtFQkE.mjs} +2 -2
- package/dist/.setup/{session-permission-policy-Ci_fVX6y.mjs → session-permission-policy-BxIUJ0Zd.mjs} +8 -37
- package/dist/.setup/{session-retirement-qMTxkNx2.mjs → session-retirement-aC60o6P3.mjs} +14 -15
- package/dist/.setup/{settled-turn-context-D4yj4rxf.mjs → settled-turn-context-BZsMjkIO.mjs} +13 -6
- package/dist/.setup/{settled-turn-finalizer-BsvEabkw.mjs → settled-turn-finalizer-CDxCejjC.mjs} +8 -8
- package/dist/.setup/{shared-client-DqyTMYug.mjs → shared-client-DJJ3ljH2.mjs} +291 -272
- package/dist/.setup/{provider-capabilities-CAxoF-X1.mjs → shell-dynamic-tools-Do9lIAT1.mjs} +16 -55
- package/dist/.setup/{side-question-C4kCmQy1.mjs → side-question-B7T0_GEC.mjs} +99 -91
- package/dist/.setup/{source-CS_7GFJZ.mjs → source-DH70LqN0.mjs} +24 -40
- package/dist/.setup/{thread-lifecycle-DPflntEJ.mjs → thread-lifecycle-DkcoX9q-.mjs} +262 -305
- package/dist/.setup/{thread-ownership-roNP0l1c.mjs → thread-ownership-0aRHD9iK.mjs} +10 -8
- package/dist/.setup/{thread-policy-DTd-DtkX.mjs → thread-policy-CXZV97TS.mjs} +22 -21
- package/dist/.setup/{thread-requests-B_bRnMGN.mjs → thread-requests-COrRJcZb.mjs} +107 -98
- package/dist/.setup/{thread-resume-CdDaoc7T.mjs → thread-resume-rx7J68Rx.mjs} +10 -18
- package/dist/.setup/{transcript-history-projection-DRSifI-1.mjs → transcript-history-projection-B9a7HwUV.mjs} +11 -16
- package/dist/.setup/{transcript-mirror-kxmCYsuF.mjs → transcript-mirror-BfLRARNL.mjs} +64 -67
- package/dist/.setup/{transport-stdio-Bdegpn2V.mjs → transport-stdio-a0HDa2Mj.mjs} +27 -8
- package/dist/.setup/{transport-websocket-BTBE-LD9.mjs → transport-websocket-zqJ0Cmtn.mjs} +3 -8
- package/dist/.setup/{attempt-client-cleanup-DOP-cW5j.mjs → turn-router-CX1-EoCp.mjs} +75 -170
- package/dist/.setup/{upstream-session-fork-CBeVjBpT.mjs → upstream-session-fork-LYlaQnbt.mjs} +35 -46
- package/dist/.setup/{usage-BMzNxeR_.mjs → usage-Dmx7B0W2.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-QXerDo3i.mjs → usage-limit-error-M8jVnITZ.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-P77OUeoo.mjs → web-search-provider.runtime-CsVmqbFm.mjs} +4 -20
- package/dist/.setup/websocket-data-XlRvt8Ys.mjs +6 -0
- package/dist/.setup/workspace-write-sandbox-probe-DmUHLrrl.mjs +118 -0
- package/dist/api.js +34 -54
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +15 -27
- package/dist/harness.js +37 -22
- package/dist/index.js +2880 -276
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-session-binding-api.js +2 -0
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +33 -4
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +3 -3
- package/package.json +6 -6
- package/dist/.setup/config-utils-D0CXecki.mjs +0 -57
- package/dist/.setup/incognito-session-DWYapfwf.mjs +0 -2
- package/dist/.setup/managed-thread-store-BMqgThVL.mjs +0 -100
- package/dist/.setup/rpc-error-BlD2vuzn.mjs +0 -31
- package/dist/.setup/session-binding-meta-B7aEMU7g.mjs +0 -6
- package/dist/.setup/session-binding-record-Oe9L-CNY.mjs +0 -375
- package/dist/.setup/session-catalog-4sCdv5qx.mjs +0 -2610
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +0 -170
- package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +0 -153
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
import { d as CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN, r as normalizeCodexServiceTier } from "./config-utils-D0CXecki.mjs";
|
|
2
|
-
import { a as matchesCodexNativeSubagentSubmissionOwner, h as codexNativeSubagentHistoryConnectionFingerprint, r as readNativePendingAssignments, s as readCodexNativeSubagentSubmissions, t as matchesNativeAssignmentLifecycle } from "./native-subagent-pending-assignments-DwkCzLvD.mjs";
|
|
3
|
-
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
-
import { createHash } from "node:crypto";
|
|
5
|
-
import { isDeepStrictEqual } from "node:util";
|
|
6
|
-
import { AgentHarnessPreflightError } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
7
|
-
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
8
|
-
import { z } from "zod";
|
|
9
|
-
//#region extensions/codex/src/app-server/session-binding-record.ts
|
|
10
|
-
/** Canonical binding codec and synchronous generation-aware reads; no lifecycle or auth loading. */
|
|
11
|
-
/** Resolves the same agent scope OpenClaw uses for transcript/session ownership. */
|
|
12
|
-
function sessionBindingIdentity(params) {
|
|
13
|
-
const { sessionAgentId } = resolveSessionAgentIdsStrict(params);
|
|
14
|
-
const sessionKey = params.sessionKey?.trim();
|
|
15
|
-
return {
|
|
16
|
-
kind: "session",
|
|
17
|
-
agentId: sessionAgentId,
|
|
18
|
-
sessionId: params.sessionId,
|
|
19
|
-
...sessionKey ? { sessionKey } : {}
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
const optionalStringSchema = z.string().optional().catch(void 0);
|
|
23
|
-
const optionalBooleanSchema = z.boolean().optional().catch(void 0);
|
|
24
|
-
const optionalNonBlankStringSchema = z.string().refine((value) => Boolean(value.trim())).optional().catch(void 0);
|
|
25
|
-
const optionalTimestampSchema = z.string().refine((value) => Number.isFinite(Date.parse(value))).optional().catch(void 0);
|
|
26
|
-
const pendingSupervisionBranchSchema = z.object({
|
|
27
|
-
sourceThreadId: z.string().trim().min(1),
|
|
28
|
-
connectionFingerprint: z.string().trim().min(1).optional(),
|
|
29
|
-
lastTurnId: z.string().trim().min(1).optional(),
|
|
30
|
-
cleanupThreadIds: z.array(z.string().trim().min(1)).max(2).optional()
|
|
31
|
-
}).strict().superRefine((pending, context) => {
|
|
32
|
-
const cleanupThreadIds = pending.cleanupThreadIds ?? [];
|
|
33
|
-
if (new Set(cleanupThreadIds).size !== cleanupThreadIds.length) context.addIssue({
|
|
34
|
-
code: "custom",
|
|
35
|
-
message: "pending supervision cleanup thread ids must be unique"
|
|
36
|
-
});
|
|
37
|
-
if (cleanupThreadIds.includes(pending.sourceThreadId)) context.addIssue({
|
|
38
|
-
code: "custom",
|
|
39
|
-
message: "pending supervision cleanup cannot target its source"
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
const contextEngineProjectionSchema = z.object({
|
|
43
|
-
schemaVersion: z.literal(1),
|
|
44
|
-
mode: z.literal("thread_bootstrap"),
|
|
45
|
-
epoch: z.string().refine((value) => Boolean(value.trim())),
|
|
46
|
-
fingerprint: optionalStringSchema
|
|
47
|
-
}).strict();
|
|
48
|
-
const contextEngineSchema = z.object({
|
|
49
|
-
schemaVersion: z.literal(1),
|
|
50
|
-
engineId: z.string(),
|
|
51
|
-
policyFingerprint: z.string(),
|
|
52
|
-
projection: contextEngineProjectionSchema.optional().catch(void 0)
|
|
53
|
-
}).strict();
|
|
54
|
-
const destructiveApprovalModeSchema = z.enum([
|
|
55
|
-
"allow",
|
|
56
|
-
"deny",
|
|
57
|
-
"auto",
|
|
58
|
-
"ask"
|
|
59
|
-
]).optional().catch(void 0);
|
|
60
|
-
const accountAppPolicyEntrySchema = z.object({
|
|
61
|
-
source: z.literal("account"),
|
|
62
|
-
appName: z.string(),
|
|
63
|
-
allowDestructiveActions: z.boolean(),
|
|
64
|
-
allowOpenWorld: z.boolean().optional(),
|
|
65
|
-
destructiveApprovalMode: destructiveApprovalModeSchema,
|
|
66
|
-
mcpServerNames: z.array(z.string())
|
|
67
|
-
}).strict();
|
|
68
|
-
const pluginAppPolicyEntrySchema = z.object({
|
|
69
|
-
source: z.literal("plugin").optional(),
|
|
70
|
-
configKey: z.string(),
|
|
71
|
-
marketplaceName: z.string().regex(CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN),
|
|
72
|
-
pluginName: z.string(),
|
|
73
|
-
allowDestructiveActions: z.boolean(),
|
|
74
|
-
allowOpenWorld: z.boolean().optional(),
|
|
75
|
-
destructiveApprovalMode: destructiveApprovalModeSchema,
|
|
76
|
-
mcpServerNames: z.array(z.string())
|
|
77
|
-
}).strict();
|
|
78
|
-
const pluginAppPolicyContextSchema = z.object({
|
|
79
|
-
fingerprint: z.string(),
|
|
80
|
-
apps: z.record(z.string(), z.union([accountAppPolicyEntrySchema, pluginAppPolicyEntrySchema])),
|
|
81
|
-
pluginAppIds: z.record(z.string(), z.array(z.string())).default({})
|
|
82
|
-
}).strict();
|
|
83
|
-
const legacyAppPolicyEntrySchema = z.union([accountAppPolicyEntrySchema.strip(), pluginAppPolicyEntrySchema.strip()]);
|
|
84
|
-
const threadBindingSchema = z.object({
|
|
85
|
-
threadId: z.string().refine((value) => Boolean(value.trim())),
|
|
86
|
-
clientId: optionalStringSchema,
|
|
87
|
-
cwd: z.string(),
|
|
88
|
-
rolloutPath: optionalNonBlankStringSchema,
|
|
89
|
-
connectionScope: z.literal("supervision").optional(),
|
|
90
|
-
supervisionSourceThreadId: z.string().trim().min(1).optional(),
|
|
91
|
-
authProfileId: optionalStringSchema,
|
|
92
|
-
agentWorkspaceDeveloperInstructions: optionalStringSchema,
|
|
93
|
-
model: optionalStringSchema,
|
|
94
|
-
preserveNativeModel: z.literal(true).optional().catch(void 0),
|
|
95
|
-
pendingSupervisionBranch: pendingSupervisionBranchSchema.optional(),
|
|
96
|
-
pendingResumeConfiguration: z.literal(true).optional(),
|
|
97
|
-
modelProvider: z.string().transform((value) => value.trim()).pipe(z.string().min(1)).optional().catch(void 0),
|
|
98
|
-
approvalPolicy: z.preprocess((value) => value === "on-failure" ? "on-request" : value, z.enum([
|
|
99
|
-
"never",
|
|
100
|
-
"on-request",
|
|
101
|
-
"untrusted"
|
|
102
|
-
]).optional()).catch(void 0),
|
|
103
|
-
sandbox: z.enum([
|
|
104
|
-
"read-only",
|
|
105
|
-
"workspace-write",
|
|
106
|
-
"danger-full-access"
|
|
107
|
-
]).optional().catch(void 0),
|
|
108
|
-
serviceTier: z.preprocess(normalizeCodexServiceTier, z.custom((value) => typeof value === "string").optional()).optional().catch(void 0),
|
|
109
|
-
networkProxyProfileName: optionalStringSchema,
|
|
110
|
-
networkProxyConfigFingerprint: optionalStringSchema,
|
|
111
|
-
dynamicToolsFingerprint: optionalStringSchema,
|
|
112
|
-
dynamicToolsContainDeferred: optionalBooleanSchema,
|
|
113
|
-
webSearchThreadConfigFingerprint: optionalStringSchema,
|
|
114
|
-
nativeSkillIsolationFingerprint: optionalStringSchema,
|
|
115
|
-
userMcpServersFingerprint: optionalStringSchema,
|
|
116
|
-
mcpServersFingerprint: optionalStringSchema,
|
|
117
|
-
configuredMcpOwnershipVersion: z.literal(1).optional().catch(void 0),
|
|
118
|
-
ringZeroConfigFingerprint: optionalStringSchema,
|
|
119
|
-
ringZeroClientInstanceId: optionalStringSchema,
|
|
120
|
-
/** Durable fact preventing a later unrestricted turn from widening this thread. */
|
|
121
|
-
nativeToolPolicyRestricted: z.literal(true).optional().catch(void 0),
|
|
122
|
-
nativeHookRelayGeneration: optionalNonBlankStringSchema,
|
|
123
|
-
appServerRuntimeFingerprint: optionalStringSchema,
|
|
124
|
-
pluginAppsFingerprint: optionalStringSchema,
|
|
125
|
-
pluginAppsInputFingerprint: optionalStringSchema,
|
|
126
|
-
pluginAppPolicyContext: pluginAppPolicyContextSchema.optional().catch(void 0),
|
|
127
|
-
contextEngine: contextEngineSchema.optional().catch(void 0),
|
|
128
|
-
environmentSelectionFingerprint: optionalStringSchema,
|
|
129
|
-
conversationStartId: optionalStringSchema,
|
|
130
|
-
conversationSourceTransferComplete: z.literal(true).optional().catch(void 0),
|
|
131
|
-
historyCoveredThrough: optionalTimestampSchema,
|
|
132
|
-
continuityCalibration: z.object({
|
|
133
|
-
promptChars: z.number().int().positive(),
|
|
134
|
-
inputTokens: z.number().int().positive()
|
|
135
|
-
}).optional().catch(void 0)
|
|
136
|
-
}).superRefine((binding, context) => {
|
|
137
|
-
if (binding.connectionScope === "supervision") {
|
|
138
|
-
if (!binding.supervisionSourceThreadId) context.addIssue({
|
|
139
|
-
code: "custom",
|
|
140
|
-
message: "supervision connection ownership requires its native source thread id"
|
|
141
|
-
});
|
|
142
|
-
if (binding.preserveNativeModel !== true) context.addIssue({
|
|
143
|
-
code: "custom",
|
|
144
|
-
message: "supervision connection ownership requires native model ownership"
|
|
145
|
-
});
|
|
146
|
-
if (binding.conversationSourceTransferComplete !== true) context.addIssue({
|
|
147
|
-
code: "custom",
|
|
148
|
-
message: "supervision connection ownership requires a completed source transfer"
|
|
149
|
-
});
|
|
150
|
-
if (!binding.pendingSupervisionBranch && (!binding.model?.trim() || !binding.modelProvider)) context.addIssue({
|
|
151
|
-
code: "custom",
|
|
152
|
-
message: "materialized supervision bindings require a native model and provider"
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
if (binding.supervisionSourceThreadId && binding.connectionScope !== "supervision") context.addIssue({
|
|
156
|
-
code: "custom",
|
|
157
|
-
message: "a supervision source thread id requires supervision connection ownership"
|
|
158
|
-
});
|
|
159
|
-
if (!binding.pendingSupervisionBranch) return;
|
|
160
|
-
if (binding.threadId !== binding.pendingSupervisionBranch.sourceThreadId) context.addIssue({
|
|
161
|
-
code: "custom",
|
|
162
|
-
message: "pending supervision source must match the provisional thread binding"
|
|
163
|
-
});
|
|
164
|
-
if (binding.supervisionSourceThreadId !== binding.pendingSupervisionBranch.sourceThreadId) context.addIssue({
|
|
165
|
-
code: "custom",
|
|
166
|
-
message: "pending supervision source must match its durable source identity"
|
|
167
|
-
});
|
|
168
|
-
if (binding.preserveNativeModel !== true) context.addIssue({
|
|
169
|
-
code: "custom",
|
|
170
|
-
message: "pending supervision bindings must defer model selection to Codex App Server"
|
|
171
|
-
});
|
|
172
|
-
if (binding.connectionScope !== "supervision") context.addIssue({
|
|
173
|
-
code: "custom",
|
|
174
|
-
message: "pending supervision bindings require supervision connection ownership"
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
function matchesPendingSupervisionBranch(binding, expected) {
|
|
178
|
-
const pending = binding?.pendingSupervisionBranch;
|
|
179
|
-
const cleanup = pending?.cleanupThreadIds ?? [];
|
|
180
|
-
const expectedCleanup = expected.cleanupThreadIds ?? [];
|
|
181
|
-
return binding?.threadId === expected.sourceThreadId && pending?.sourceThreadId === expected.sourceThreadId && pending.connectionFingerprint === expected.connectionFingerprint && pending.lastTurnId === expected.lastTurnId && cleanup.length === expectedCleanup.length && cleanup.every((threadId, index) => threadId === expectedCleanup[index]);
|
|
182
|
-
}
|
|
183
|
-
const bindingLeaseSchema = z.object({
|
|
184
|
-
token: z.string().refine((value) => Boolean(value.trim())),
|
|
185
|
-
expiresAt: z.number().finite()
|
|
186
|
-
});
|
|
187
|
-
const storedSessionIdSchema = z.string().transform((value) => value.trim()).pipe(z.string().min(1)).optional().catch(void 0);
|
|
188
|
-
const storedBindingSchema = z.discriminatedUnion("state", [z.object({
|
|
189
|
-
version: z.literal(1),
|
|
190
|
-
state: z.literal("active"),
|
|
191
|
-
binding: threadBindingSchema,
|
|
192
|
-
sessionId: storedSessionIdSchema,
|
|
193
|
-
lease: bindingLeaseSchema.optional().catch(void 0),
|
|
194
|
-
nativeSubagentSubmissions: z.unknown().optional(),
|
|
195
|
-
nativeSubagentAssignments: z.unknown().optional(),
|
|
196
|
-
nativeSubagentTaskImport: z.unknown().optional()
|
|
197
|
-
}), z.object({
|
|
198
|
-
version: z.literal(1),
|
|
199
|
-
state: z.literal("cleared"),
|
|
200
|
-
sessionId: storedSessionIdSchema,
|
|
201
|
-
lease: bindingLeaseSchema.optional().catch(void 0),
|
|
202
|
-
retired: z.literal(true).optional().catch(void 0),
|
|
203
|
-
nativeSubagentTaskImport: z.unknown().optional()
|
|
204
|
-
})]);
|
|
205
|
-
/** Stable plugin-state key for one current binding owner. */
|
|
206
|
-
function bindingStoreKey(identity) {
|
|
207
|
-
if (identity.kind === "session") {
|
|
208
|
-
const rawAgentId = identity.agentId.trim();
|
|
209
|
-
const sessionId = identity.sessionId.trim();
|
|
210
|
-
if (!rawAgentId) throw new Error("Codex app-server binding requires an agent id");
|
|
211
|
-
if (!sessionId) throw new Error("Codex app-server binding requires a session id");
|
|
212
|
-
const agentId = resolveSessionAgentIdsStrict({ agentId: rawAgentId }).sessionAgentId;
|
|
213
|
-
const sessionKey = identity.sessionKey?.trim();
|
|
214
|
-
if (sessionKey) return `session-key:${agentId}:${createHash("sha256").update(sessionKey).digest("base64url")}`;
|
|
215
|
-
return `session:${agentId}:${sessionId}`;
|
|
216
|
-
}
|
|
217
|
-
const bindingId = identity.bindingId.trim();
|
|
218
|
-
if (!bindingId) throw new Error("Codex app-server conversation binding requires a binding id");
|
|
219
|
-
return `conversation:${bindingId}`;
|
|
220
|
-
}
|
|
221
|
-
function readStoredCodexAppServerBinding(value) {
|
|
222
|
-
const result = storedBindingSchema.safeParse(value);
|
|
223
|
-
if (!result.success) return;
|
|
224
|
-
return stripUndefinedValue(result.data);
|
|
225
|
-
}
|
|
226
|
-
function ownsStoredSessionGeneration(identity, current) {
|
|
227
|
-
return identity.kind !== "session" || !current?.sessionId || current.sessionId === identity.sessionId;
|
|
228
|
-
}
|
|
229
|
-
function validateBindingForWrite(binding) {
|
|
230
|
-
const validated = readCodexAppServerThreadBinding(binding);
|
|
231
|
-
if (!validated) throw new Error("Invalid Codex app-server thread binding");
|
|
232
|
-
return stripUndefinedBinding(validated);
|
|
233
|
-
}
|
|
234
|
-
/** Parses stored or shipped sidecar data into the current domain value. */
|
|
235
|
-
function readCodexAppServerThreadBinding(value) {
|
|
236
|
-
const result = threadBindingSchema.safeParse(value);
|
|
237
|
-
if (!result.success) return;
|
|
238
|
-
return result.data;
|
|
239
|
-
}
|
|
240
|
-
function stripUndefinedBinding(binding) {
|
|
241
|
-
return stripUndefinedValue(binding);
|
|
242
|
-
}
|
|
243
|
-
function stripUndefinedValue(value) {
|
|
244
|
-
if (Array.isArray(value)) return value.map(stripUndefinedValue);
|
|
245
|
-
if (!value || typeof value !== "object") return value;
|
|
246
|
-
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0).map(([key, entry]) => [key, stripUndefinedValue(entry)]));
|
|
247
|
-
}
|
|
248
|
-
function readCodexBindingTimestamp(value) {
|
|
249
|
-
return optionalTimestampSchema.parse(value);
|
|
250
|
-
}
|
|
251
|
-
/** The same physical-generation check serves execution and read-only projections. */
|
|
252
|
-
function readCurrentCodexAppServerBinding(state, identity) {
|
|
253
|
-
const key = bindingStoreKey(identity);
|
|
254
|
-
return decodeCurrentCodexAppServerBinding(key, state.lookup(key), identity);
|
|
255
|
-
}
|
|
256
|
-
function decodeCurrentCodexAppServerBinding(key, raw, identity) {
|
|
257
|
-
const stored = readStoredCodexAppServerBinding(raw);
|
|
258
|
-
if (raw !== void 0 && !stored) throw new Error(`Invalid Codex app-server binding row: ${key}`);
|
|
259
|
-
return stored?.state === "active" && ownsStoredSessionGeneration(identity, stored) ? stored.binding : void 0;
|
|
260
|
-
}
|
|
261
|
-
/** Consume synchronously so each list phase acquires fresh binding authority. */
|
|
262
|
-
function* readCurrentCodexAppServerBindings(state, identities) {
|
|
263
|
-
let keys;
|
|
264
|
-
if (state.lookupMany && identities.length > 1 && identities.length <= 1e4) try {
|
|
265
|
-
keys = identities.map(bindingStoreKey);
|
|
266
|
-
} catch {}
|
|
267
|
-
if (!keys || !state.lookupMany) {
|
|
268
|
-
for (const identity of identities) yield readCurrentCodexAppServerBinding(state, identity);
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
const values = state.lookupMany(keys);
|
|
272
|
-
for (let index = 0; index < identities.length; index++) {
|
|
273
|
-
const value = values[index];
|
|
274
|
-
if (!value.ok) throw value.error;
|
|
275
|
-
yield decodeCurrentCodexAppServerBinding(keys[index], value.value, identities[index]);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
function matchesCodexNativeSubagentSubmissionBinding(binding, owner) {
|
|
279
|
-
return binding.threadId === owner.parentThreadId && !binding.pendingSupervisionBranch && codexNativeSubagentHistoryConnectionFingerprint(binding) === owner.connectionFingerprint;
|
|
280
|
-
}
|
|
281
|
-
/** Unknown metadata stays opaque through ordinary binding writes. */
|
|
282
|
-
function preserveCodexNativeSubagentSubmissions(currentBinding, nextBinding, value) {
|
|
283
|
-
return currentBinding.threadId === nextBinding.threadId && codexNativeSubagentHistoryConnectionFingerprint(currentBinding) === codexNativeSubagentHistoryConnectionFingerprint(nextBinding) && isDeepStrictEqual(currentBinding.pendingSupervisionBranch, nextBinding.pendingSupervisionBranch) ? value : void 0;
|
|
284
|
-
}
|
|
285
|
-
function readCurrentCodexNativeSubagentSubmissions(state, identity, owner) {
|
|
286
|
-
const key = bindingStoreKey(identity);
|
|
287
|
-
const raw = state.lookup(key);
|
|
288
|
-
const stored = readStoredCodexAppServerBinding(raw);
|
|
289
|
-
if (raw !== void 0 && !stored) throw new Error(`Invalid Codex app-server binding row: ${key}`);
|
|
290
|
-
if (stored?.state !== "active" || !ownsStoredSessionGeneration(identity, stored) || identity.kind === "session" && owner.sessionId !== identity.sessionId || !matchesCodexNativeSubagentSubmissionBinding(stored.binding, owner)) return [];
|
|
291
|
-
const submissions = readCodexNativeSubagentSubmissions(stored.nativeSubagentSubmissions);
|
|
292
|
-
return submissions && matchesCodexNativeSubagentSubmissionOwner(submissions.owner, owner) ? submissions.receipts : [];
|
|
293
|
-
}
|
|
294
|
-
function readCurrentNativePendingAssignments(state, identity, owner) {
|
|
295
|
-
const key = bindingStoreKey(identity);
|
|
296
|
-
const raw = state.lookup(key);
|
|
297
|
-
const stored = readStoredCodexAppServerBinding(raw);
|
|
298
|
-
if (raw !== void 0 && !stored) throw new Error(`Invalid Codex app-server binding row: ${key}`);
|
|
299
|
-
if (stored?.state !== "active" || !ownsStoredSessionGeneration(identity, stored) || identity.kind === "session" && owner.sessionId !== identity.sessionId || !matchesCodexNativeSubagentSubmissionBinding(stored.binding, owner)) return [];
|
|
300
|
-
return (readNativePendingAssignments(stored.nativeSubagentAssignments)?.assignments ?? []).filter((entry) => matchesNativeAssignmentLifecycle(entry.owner, owner));
|
|
301
|
-
}
|
|
302
|
-
function preserveNativeTaskImport(current) {
|
|
303
|
-
return current?.nativeSubagentTaskImport !== void 0 ? { nativeSubagentTaskImport: current.nativeSubagentTaskImport } : {};
|
|
304
|
-
}
|
|
305
|
-
/** Preserve inventory through native rotation, never across a connection-policy change. */
|
|
306
|
-
function preserveNativePendingAssignments(current, next, value) {
|
|
307
|
-
return codexNativeSubagentHistoryConnectionFingerprint(current) === codexNativeSubagentHistoryConnectionFingerprint(next) && isDeepStrictEqual(current.pendingSupervisionBranch, next.pendingSupervisionBranch) ? value : void 0;
|
|
308
|
-
}
|
|
309
|
-
var CodexSupervisionBindingReplacementError = class extends Error {
|
|
310
|
-
constructor(threadId, operation) {
|
|
311
|
-
super(`Refusing to replace supervised Codex thread ${threadId} while ${operation}; its native user-home connection and model ownership must be preserved`);
|
|
312
|
-
this.name = "CodexSupervisionBindingReplacementError";
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
function assertCodexBindingMayBeReplaced(binding, operation, expected) {
|
|
316
|
-
if (expected) throw new AgentHarnessPreflightError(`Codex native model ownership prevents ${operation}. Continue or compact the original session in its native runtime, or create a new chat with a concrete model; the original binding was preserved.`);
|
|
317
|
-
if (binding?.connectionScope === "supervision") throw new CodexSupervisionBindingReplacementError(binding.threadId, operation);
|
|
318
|
-
}
|
|
319
|
-
function readPluginAppPolicyContext(value, bindingSchemaVersion) {
|
|
320
|
-
const record = asOptionalRecord(value);
|
|
321
|
-
if (!record || typeof record.fingerprint !== "string") return;
|
|
322
|
-
const apps = asOptionalRecord(record.apps);
|
|
323
|
-
if (!apps) return;
|
|
324
|
-
const parsedApps = {};
|
|
325
|
-
for (const [appId, rawEntry] of Object.entries(apps)) {
|
|
326
|
-
const entry = asOptionalRecord(rawEntry);
|
|
327
|
-
if (!entry) return;
|
|
328
|
-
const destructiveApprovalMode = readDestructiveApprovalMode(entry.destructiveApprovalMode, bindingSchemaVersion);
|
|
329
|
-
if ("appId" in entry || destructiveApprovalMode === "invalid") return;
|
|
330
|
-
const parsed = legacyAppPolicyEntrySchema.safeParse({
|
|
331
|
-
...entry,
|
|
332
|
-
destructiveApprovalMode
|
|
333
|
-
});
|
|
334
|
-
if (!parsed.success) return;
|
|
335
|
-
const validated = parsed.data;
|
|
336
|
-
const policy = {
|
|
337
|
-
allowDestructiveActions: validated.allowDestructiveActions,
|
|
338
|
-
...validated.allowOpenWorld !== void 0 ? { allowOpenWorld: validated.allowOpenWorld } : {},
|
|
339
|
-
...destructiveApprovalMode ? { destructiveApprovalMode } : {},
|
|
340
|
-
mcpServerNames: validated.mcpServerNames
|
|
341
|
-
};
|
|
342
|
-
if (validated.source === "account") parsedApps[appId] = {
|
|
343
|
-
source: "account",
|
|
344
|
-
appName: validated.appName,
|
|
345
|
-
...policy
|
|
346
|
-
};
|
|
347
|
-
else parsedApps[appId] = {
|
|
348
|
-
configKey: validated.configKey,
|
|
349
|
-
marketplaceName: validated.marketplaceName,
|
|
350
|
-
pluginName: validated.pluginName,
|
|
351
|
-
...policy
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
const parsedPluginAppIds = {};
|
|
355
|
-
if (record.pluginAppIds !== void 0 && (!record.pluginAppIds || typeof record.pluginAppIds !== "object" || Array.isArray(record.pluginAppIds))) return;
|
|
356
|
-
if (record.pluginAppIds && typeof record.pluginAppIds === "object") for (const [configKey, appIds] of Object.entries(record.pluginAppIds)) {
|
|
357
|
-
if (!Array.isArray(appIds) || appIds.some((appId) => typeof appId !== "string")) return;
|
|
358
|
-
parsedPluginAppIds[configKey] = appIds;
|
|
359
|
-
}
|
|
360
|
-
return {
|
|
361
|
-
fingerprint: record.fingerprint,
|
|
362
|
-
apps: parsedApps,
|
|
363
|
-
pluginAppIds: parsedPluginAppIds
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
function readDestructiveApprovalMode(value, bindingSchemaVersion) {
|
|
367
|
-
if (value === void 0) return;
|
|
368
|
-
if (value === "allow" || value === "deny") return value;
|
|
369
|
-
if (value === "auto") return bindingSchemaVersion === 1 ? "allow" : "auto";
|
|
370
|
-
if (value === "ask" && bindingSchemaVersion === 2) return "ask";
|
|
371
|
-
if (value === "on-request" && bindingSchemaVersion === 1) return "auto";
|
|
372
|
-
return "invalid";
|
|
373
|
-
}
|
|
374
|
-
//#endregion
|
|
375
|
-
export { readStoredCodexAppServerBinding as _, matchesPendingSupervisionBranch as a, validateBindingForWrite as b, preserveNativePendingAssignments as c, readCodexBindingTimestamp as d, readCurrentCodexAppServerBinding as f, readPluginAppPolicyContext as g, readCurrentNativePendingAssignments as h, matchesCodexNativeSubagentSubmissionBinding as i, preserveNativeTaskImport as l, readCurrentCodexNativeSubagentSubmissions as m, assertCodexBindingMayBeReplaced as n, ownsStoredSessionGeneration as o, readCurrentCodexAppServerBindings as p, bindingStoreKey as r, preserveCodexNativeSubagentSubmissions as s, CodexSupervisionBindingReplacementError as t, readCodexAppServerThreadBinding as u, sessionBindingIdentity as v, stripUndefinedBinding as y };
|