@hassangameryt/freeflow 0.7.0 → 0.7.2

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.
Files changed (136) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +2 -1
  3. package/.codex-plugin/plugin.json +2 -2
  4. package/.cursor-plugin/plugin.json +25 -0
  5. package/README.md +57 -26
  6. package/capabilities/cognitive-routing/SKILL.md +94 -311
  7. package/com.github.copilot/hooks/hooks.json +11 -0
  8. package/command-surface.json +7 -1
  9. package/gemini-extension.json +5 -0
  10. package/hooks/adapters/claude-session-start.mjs +16 -0
  11. package/hooks/adapters/codex-session-start.mjs +16 -0
  12. package/hooks/adapters/copilot-session-start.mjs +13 -0
  13. package/hooks/adapters/cursor-session-start.mjs +13 -0
  14. package/hooks/adapters/gemini-session-start.mjs +15 -0
  15. package/hooks/claude/hooks.json +18 -0
  16. package/hooks/codex/hooks.json +18 -0
  17. package/hooks/cursor/hooks.json +9 -0
  18. package/hooks/freeflow-runtime-context.mjs +3 -215
  19. package/hooks/hooks.json +4 -5
  20. package/hooks/shared/runtime-context.mjs +210 -0
  21. package/hooks/tests/check-host-adapters.test.mjs +82 -0
  22. package/hooks/tests/check-runtime-context-hook.sh +34 -3
  23. package/package.json +20 -6
  24. package/pi-extension/dist/cognitive-routing-v2/budget.js +42 -0
  25. package/pi-extension/dist/cognitive-routing-v2/config.js +120 -0
  26. package/pi-extension/dist/cognitive-routing-v2/projection.js +321 -0
  27. package/pi-extension/dist/cognitive-routing-v2/render.js +231 -0
  28. package/pi-extension/dist/cognitive-routing-v2/runtime.js +1585 -0
  29. package/pi-extension/dist/cognitive-routing-v2/schemas.js +107 -0
  30. package/pi-extension/dist/cognitive-routing-v2/state.js +612 -0
  31. package/pi-extension/dist/cognitive-routing-v2/tools.js +91 -0
  32. package/pi-extension/dist/cognitive-routing-v2/types.js +44 -0
  33. package/pi-extension/dist/freeflow-context/tool.js +5 -0
  34. package/pi-extension/dist/index.js +279 -624
  35. package/pi-extension/dist/runtime/runtime-context.js +63 -13
  36. package/pi-extension/dist/session-sources/events.js +195 -0
  37. package/pi-extension/dist/session-sources/read-only-session.js +148 -0
  38. package/pi-extension/dist/session-sources/sources.js +233 -0
  39. package/pi-extension/dist/settings/settings-ui.js +44 -117
  40. package/pi-extension/src/cognitive-routing-v2/budget.ts +42 -0
  41. package/pi-extension/src/cognitive-routing-v2/config.ts +143 -0
  42. package/pi-extension/src/cognitive-routing-v2/projection.ts +365 -0
  43. package/pi-extension/src/cognitive-routing-v2/render.ts +256 -0
  44. package/pi-extension/src/cognitive-routing-v2/runtime.ts +1634 -0
  45. package/pi-extension/src/cognitive-routing-v2/schemas.ts +109 -0
  46. package/pi-extension/src/cognitive-routing-v2/state.ts +622 -0
  47. package/pi-extension/src/cognitive-routing-v2/tools.ts +93 -0
  48. package/pi-extension/src/cognitive-routing-v2/types.ts +222 -0
  49. package/pi-extension/src/freeflow-context/tool.ts +5 -0
  50. package/pi-extension/src/index.ts +285 -674
  51. package/pi-extension/src/runtime/runtime-context.ts +75 -14
  52. package/pi-extension/src/session-sources/events.ts +208 -0
  53. package/pi-extension/src/session-sources/read-only-session.ts +170 -0
  54. package/pi-extension/src/session-sources/sources.ts +263 -0
  55. package/pi-extension/src/settings/settings-ui.ts +54 -131
  56. package/pi-extension/tests/cognitive-routing-v2/communication.test.js +484 -0
  57. package/pi-extension/tests/cognitive-routing-v2/compaction-input.test.js +183 -0
  58. package/pi-extension/tests/cognitive-routing-v2/native.test.js +441 -0
  59. package/pi-extension/tests/cognitive-routing-v2/performance.test.js +87 -0
  60. package/pi-extension/tests/cognitive-routing-v2/persistence.test.js +245 -0
  61. package/pi-extension/tests/cognitive-routing-v2/projection.test.js +241 -0
  62. package/pi-extension/tests/cognitive-routing-v2/recovery.test.js +236 -0
  63. package/pi-extension/tests/cognitive-routing-v2/render.test.js +230 -0
  64. package/pi-extension/tests/cognitive-routing-v2/runtime.test.js +153 -0
  65. package/pi-extension/tests/cognitive-routing-v2/stabilization.test.js +521 -0
  66. package/pi-extension/tests/cognitive-routing-v2/state.test.js +275 -0
  67. package/pi-extension/tests/context-virtualization/extension.test.js +16 -0
  68. package/pi-extension/tests/fixtures/routing-native.js +188 -0
  69. package/pi-extension/tests/integration/mode-free-core.test.js +3 -2
  70. package/pi-extension/tests/integration/pi-extension.test.js +154 -37
  71. package/pi-extension/tests/integration/prompt-architecture.test.js +87 -6
  72. package/pi-extension/tests/integration/unaffected-regressions.test.js +77 -10
  73. package/plugin.json +33 -0
  74. package/runtime/prompts/cognitive-routing.md +4 -5
  75. package/runtime/prompts/core.md +51 -45
  76. package/runtime/prompts/interaction-contract.md +5 -5
  77. package/skills/action-selection/SKILL.md +57 -97
  78. package/skills/design-for-depth/SKILL.md +58 -193
  79. package/skills/design-for-depth/references/implementation-decisions.md +76 -0
  80. package/skills/diagnose-failure/SKILL.md +64 -196
  81. package/skills/discuss/SKILL.md +64 -123
  82. package/skills/discuss/references/discussion-continuity.md +7 -3
  83. package/skills/execute-work/SKILL.md +69 -88
  84. package/skills/execute-work/references/execute-work-edges.md +9 -3
  85. package/skills/handoff/SKILL.md +44 -54
  86. package/skills/handoff/references/handoff-templates.md +15 -6
  87. package/skills/review-artifact/SKILL.md +80 -127
  88. package/skills/review-artifact/references/independent-artifact-reviewer-contract.md +1 -1
  89. package/skills/review-work/SKILL.md +65 -115
  90. package/skills/review-work/references/independent-work-reviewer-contract.md +1 -1
  91. package/skills/simplify-code/SKILL.md +47 -100
  92. package/skills/track-work/SKILL.md +128 -119
  93. package/skills/track-work/references/working-record-format.md +14 -2
  94. package/skills/verify-work/SKILL.md +58 -62
  95. package/skills/verify-work/references/integration-evidence.md +4 -2
  96. package/skills/verify-work/references/test-design.md +89 -0
  97. package/skills/workflow/SKILL.md +73 -119
  98. package/skills/write-plan/SKILL.md +46 -77
  99. package/skills/write-plan/references/plan-shapes.md +5 -5
  100. package/skills/write-spec/SKILL.md +51 -63
  101. package/skills/write-spec/references/artifact-standards.md +2 -2
  102. package/skills/write-spec/references/decision-records.md +3 -2
  103. package/skills/write-spec/references/spec-shapes.md +15 -0
  104. package/pi-extension/dist/cognitive-routing/commands.js +0 -96
  105. package/pi-extension/dist/cognitive-routing/config.js +0 -232
  106. package/pi-extension/dist/cognitive-routing/controller.js +0 -1292
  107. package/pi-extension/dist/cognitive-routing/history.js +0 -451
  108. package/pi-extension/dist/cognitive-routing/host.js +0 -188
  109. package/pi-extension/dist/cognitive-routing/pi-routing-session.js +0 -414
  110. package/pi-extension/dist/cognitive-routing/pi-session-control.js +0 -320
  111. package/pi-extension/dist/cognitive-routing/runtime.js +0 -43
  112. package/pi-extension/dist/cognitive-routing/tool.js +0 -212
  113. package/pi-extension/dist/cognitive-routing/types.js +0 -6
  114. package/pi-extension/src/cognitive-routing/commands.ts +0 -129
  115. package/pi-extension/src/cognitive-routing/config.ts +0 -303
  116. package/pi-extension/src/cognitive-routing/controller.ts +0 -1628
  117. package/pi-extension/src/cognitive-routing/history.ts +0 -650
  118. package/pi-extension/src/cognitive-routing/host.ts +0 -266
  119. package/pi-extension/src/cognitive-routing/pi-routing-session.ts +0 -538
  120. package/pi-extension/src/cognitive-routing/pi-session-control.ts +0 -444
  121. package/pi-extension/src/cognitive-routing/runtime.ts +0 -57
  122. package/pi-extension/src/cognitive-routing/tool.ts +0 -273
  123. package/pi-extension/src/cognitive-routing/types.ts +0 -89
  124. package/pi-extension/tests/cognitive-routing/commands.test.js +0 -134
  125. package/pi-extension/tests/cognitive-routing/controller.test.js +0 -1128
  126. package/pi-extension/tests/cognitive-routing/extension-lifecycle.test.js +0 -1142
  127. package/pi-extension/tests/cognitive-routing/history.test.js +0 -274
  128. package/pi-extension/tests/cognitive-routing/host-identity.test.js +0 -63
  129. package/pi-extension/tests/cognitive-routing/pi-normal-lifecycle.test.js +0 -434
  130. package/pi-extension/tests/cognitive-routing/pi-session-control.test.js +0 -174
  131. package/pi-extension/tests/cognitive-routing/pi-session-history.test.js +0 -91
  132. package/pi-extension/tests/cognitive-routing/profile-resolution.test.js +0 -279
  133. package/pi-extension/tests/cognitive-routing/tool.test.js +0 -230
  134. package/skills/tdd/SKILL.md +0 -143
  135. package/skills/tdd/references/test-design.md +0 -96
  136. /package/pi-extension/tests/{cognitive-routing/host-fixture.js → fixtures/pi-host.js} +0 -0
@@ -0,0 +1,93 @@
1
+ import { RoutingRuntime, ROUTING_TOOLS } from "./runtime.js";
2
+ import { ROUTING_SCHEMAS, matches, schemaForProfile } from "./schemas.js";
3
+ export { ROUTING_SCHEMAS } from "./schemas.js";
4
+ import { renderRoutingCall, renderRoutingResult } from "./render.js";
5
+
6
+ const descriptions: Record<string, string> = {
7
+ freeflow_delegate:
8
+ "Save a supported assignment contract and request Executor execution. Explicit replace supersedes a quiescent outstanding assignment in the same unit.",
9
+ freeflow_return:
10
+ "Save or revise the actual assignment report, or retry its saved handoff without resubmitting text. Returning does not accept or close the unit.",
11
+ freeflow_unit:
12
+ "Inspect current responsibility, paginated work history, or exact saved contract/report details. Coordinator can also restore a suspended assessment or close a unit without clearing its history.",
13
+ freeflow_project:
14
+ "Inspect current selection and scoped candidates, then add or remove completed exposed Executor sources. #text refs select exact visible assistant text; plain refs retain whole-native meaning. Eligibility and target readiness are distinct.",
15
+ };
16
+ const guidance: Record<string, string[]> = {
17
+ freeflow_delegate: [
18
+ "freeflow_delegate is Coordinator-only under Automatic control. Put the contract in the input. Use replace only for explicit same-unit replacement; do not supply IDs.",
19
+ ],
20
+ freeflow_return: [
21
+ "freeflow_return submit saves/revises the actual report; retry completes the saved return without text. Stop ordinary task work after reportSaved. Keep the handoff last; do not batch it with new task tools.",
22
+ ],
23
+ freeflow_unit: [
24
+ "freeflow_unit inspect defaults to current state; view history returns work refs and view detail with ref reads saved contracts/reports. Coordinator assess restores a suspended evidence obligation; close changes work status without clearing communication or completing a Working Record task.",
25
+ ],
26
+ freeflow_project: [
27
+ "freeflow_project inspect shows selection and scoped candidates. Use history scope for earlier exposed evidence. #text refs select exact visible assistant text; plain refs retain whole-native meaning. Select actual result bodies for execution claims, not merely calls. Correct or explicitly withdraw unresolved items with a limitation. Known previously exposed bodies resolve automatically; target-representation gaps are not successful delivery.",
28
+ ],
29
+ };
30
+ const unitDefinitions = new WeakMap<object, { definition: any; signature?: string }>();
31
+ export function registerRoutingTools(pi: any, runtime: RoutingRuntime): void {
32
+ for (const name of ROUTING_TOOLS) {
33
+ const definition = {
34
+ name,
35
+ label: name.replace("freeflow_", "Routing "),
36
+ description: descriptions[name],
37
+ parameters: ROUTING_SCHEMAS[name],
38
+ executionMode: "sequential",
39
+ promptGuidelines: guidance[name],
40
+ renderCall: (args: any, _theme: any, context: any) => renderRoutingCall(name, args, context),
41
+ renderResult: (result: any, options: any, _theme: any, context: any) =>
42
+ renderRoutingResult(result, options, name, context),
43
+ async execute(id: string, input: unknown, signal: AbortSignal, _update: unknown, ctx: any) {
44
+ if (!matches(input, ROUTING_SCHEMAS[name]))
45
+ throw new Error("Invalid routing arguments; no operation accepted.");
46
+ return runtime.invoke(name, id, input, signal, ctx);
47
+ },
48
+ };
49
+ pi.registerTool(definition);
50
+ if (name === "freeflow_unit") unitDefinitions.set(pi, { definition });
51
+ }
52
+ }
53
+ export function applyRoutingToolVisibility(pi: any, runtime: RoutingRuntime, available: boolean): void {
54
+ if (!pi.getActiveTools || !pi.setActiveTools) return;
55
+ const current = new Set<string>(pi.getActiveTools());
56
+ const state = runtime.state();
57
+ const unit = unitDefinitions.get(pi);
58
+ const coordinator = state.effective && state.controlMode === "automatic" && state.activeProfile === "coordinator";
59
+ const signature = coordinator ? "coordinator" : "inspection";
60
+ if (unit && unit.signature !== signature) {
61
+ pi.registerTool({
62
+ ...unit.definition,
63
+ description: coordinator
64
+ ? unit.definition.description
65
+ : "Inspect current routing responsibility, work history, or exact saved contract/report detail. This profile cannot assess or close units.",
66
+ promptGuidelines: coordinator
67
+ ? unit.definition.promptGuidelines
68
+ : [
69
+ "freeflow_unit inspect reads current state, view history lists work refs, and view detail with ref reads historical communication. Historical content is not current permission.",
70
+ ],
71
+ parameters: schemaForProfile("freeflow_unit", coordinator),
72
+ });
73
+ unit.signature = signature;
74
+ }
75
+ for (const name of ROUTING_TOOLS) {
76
+ const enabled =
77
+ available &&
78
+ (name === "freeflow_unit" ||
79
+ (state.effective &&
80
+ state.controlMode === "automatic" &&
81
+ (name === "freeflow_delegate"
82
+ ? state.activeProfile === "coordinator"
83
+ : state.activeProfile === "executor"))) &&
84
+ (name !== "freeflow_project" || runtime.projectionEnabled);
85
+ if (enabled) current.add(name);
86
+ else current.delete(name);
87
+ }
88
+ // Retired experimental tools must never remain available beside the replacement.
89
+ current.delete("freeflow_switch_profile");
90
+ current.delete("freeflow_cognitive_routing_history");
91
+ const next = [...current];
92
+ if (JSON.stringify(next) !== JSON.stringify(pi.getActiveTools())) pi.setActiveTools(next);
93
+ }
@@ -0,0 +1,222 @@
1
+ export const ROUTING_ENTRY = "freeflow-routing-v2";
2
+ export const ROUTING_MESSAGE = "freeflow-routing-v2-state";
3
+ export const PROFILES = ["coordinator", "executor"] as const;
4
+ export const EFFORTS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"] as const;
5
+ export type Profile = (typeof PROFILES)[number];
6
+ export type Effort = (typeof EFFORTS)[number];
7
+ export type View = Profile | "solo";
8
+ export type Control = "automatic" | "manual" | "inactive";
9
+ export type Delivery = "pending" | "blocked" | "configured" | "superseded";
10
+ export interface Pair {
11
+ provider: string;
12
+ modelId: string;
13
+ thinking: Effort;
14
+ }
15
+ export interface Unit {
16
+ id: string;
17
+ objective: string;
18
+ state: "open" | "closed";
19
+ assignmentIds: string[];
20
+ disposition?: string;
21
+ assessment?: string;
22
+ }
23
+ export interface Assignment {
24
+ id: string;
25
+ unitId: string;
26
+ contract: string;
27
+ basisUserEntryId: string | null;
28
+ state: "outstanding" | "returned" | "superseded";
29
+ delegateHandoffId: string;
30
+ returnHandoffId?: string;
31
+ }
32
+ export interface Handoff {
33
+ id: string;
34
+ kind: "delegate" | "return";
35
+ assignmentId: string;
36
+ text: string;
37
+ from: Profile;
38
+ to: Profile;
39
+ executionId: string;
40
+ toolCallId: string;
41
+ basisUserEntryId: string | null;
42
+ state: Delivery;
43
+ reportRevision: number;
44
+ outcome?: "completed" | "partial" | "blocked";
45
+ limitations: string[];
46
+ reason?: string;
47
+ }
48
+ export interface Problem {
49
+ ref: string;
50
+ code: string;
51
+ detail: string;
52
+ }
53
+ export interface Selection {
54
+ revision: number;
55
+ selected: string[];
56
+ unresolved: Problem[];
57
+ withdrawals: { ref: string; reason: string }[];
58
+ }
59
+ export interface Reservation {
60
+ id: string;
61
+ selectionRevision: number;
62
+ receiver: Profile;
63
+ target: Pair;
64
+ qualification: string;
65
+ sources: { ref: string; bodyHash: string }[];
66
+ maximumInputTokens: number;
67
+ outputReserve: number;
68
+ estimateMethod: string;
69
+ }
70
+ export interface Execution {
71
+ id: string;
72
+ profile: View;
73
+ assignmentId?: string;
74
+ basisUserEntryId: string | null;
75
+ pair: Pair;
76
+ assistantEntryId?: string;
77
+ resultEntryIds: string[];
78
+ outcome?: "completed" | "failed" | "aborted";
79
+ interrupted?: string;
80
+ }
81
+ export interface Assessment {
82
+ handoffId: string;
83
+ assignmentId: string;
84
+ view: "active" | "suspended";
85
+ basisUserEntryId: string | null;
86
+ problems: Problem[];
87
+ reservation?: Reservation;
88
+ }
89
+ export type EventData =
90
+ | { type: "execution-interrupted"; executionId: string; reason: string }
91
+ | { type: "assignment-resumed"; assignmentId: string; basisUserEntryId: string | null }
92
+ | { type: "control"; control: Control; profile?: Profile; reason: string }
93
+ | { type: "execution-opened"; execution: Execution }
94
+ | {
95
+ type: "execution-bound";
96
+ executionId: string;
97
+ assistantEntryId: string;
98
+ resultEntryIds: string[];
99
+ outcome: "completed" | "failed" | "aborted";
100
+ }
101
+ | {
102
+ type: "delegate-accepted";
103
+ unit: Unit;
104
+ assignment: Assignment;
105
+ handoff: Handoff;
106
+ replacement?: { assignmentId: string; supersededHandoffId?: string; reason: string };
107
+ }
108
+ | { type: "return-accepted"; handoff: Handoff }
109
+ | {
110
+ type: "handoff-retry-requested";
111
+ handoffId: string;
112
+ attemptId: string;
113
+ executionId: string;
114
+ toolCallId: string;
115
+ reportRevision: number;
116
+ selectionRevision: number;
117
+ }
118
+ | { type: "handoff-prepared"; handoffId: string; reservation: Reservation }
119
+ | { type: "handoff-state"; handoffId: string; state: Delivery; reason?: string; observedPair?: Pair }
120
+ | { type: "selection-changed"; assignmentId: string; selection: Selection }
121
+ | {
122
+ type: "assessment-suspended";
123
+ handoffId: string;
124
+ reason: "user-attention" | "delivery-gap";
125
+ basisUserEntryId: string | null;
126
+ problems: Problem[];
127
+ }
128
+ | { type: "assessment-resumed"; handoffId: string; basisUserEntryId: string | null; reservation: Reservation }
129
+ | {
130
+ type: "unit-closed";
131
+ unitId: string;
132
+ outcome: "accepted" | "cancelled" | "deferred";
133
+ assessment: string;
134
+ supersededAssignmentId?: string;
135
+ }
136
+ | { type: "sources-exposed"; executionId: string; view: View; sources: { ref: string; bodyHash: string }[] }
137
+ | {
138
+ type: "request-observed";
139
+ executionId: string;
140
+ profile: View;
141
+ boundary: "assembled" | "payload-hook";
142
+ manifestHash: string;
143
+ handoffId?: string;
144
+ selectionRevision?: number;
145
+ };
146
+ export interface RoutingEvent {
147
+ version: 2;
148
+ eventId: string;
149
+ operationId: string;
150
+ stepId: string;
151
+ recordedSessionId: string;
152
+ data: EventData;
153
+ }
154
+ export interface NativeEntry {
155
+ id: string;
156
+ parentId: string | null;
157
+ type: string;
158
+ customType?: string;
159
+ data?: unknown;
160
+ message?: any;
161
+ [key: string]: any;
162
+ }
163
+ export interface State {
164
+ control: Control;
165
+ profile?: Profile;
166
+ unitId?: string;
167
+ assignmentId?: string;
168
+ pendingId?: string;
169
+ units: Map<string, Unit>;
170
+ assignments: Map<string, Assignment>;
171
+ handoffs: Map<string, Handoff>;
172
+ executions: Map<string, Execution>;
173
+ selections: Map<string, Selection>;
174
+ reservations: Map<string, Reservation>;
175
+ attempts: Map<string, { executionId: string; reportRevision: number; selectionRevision: number }>;
176
+ exposure: Map<string, string>;
177
+ authors: Map<string, { profile: View; executionId: string; assignmentId?: string }>;
178
+ resumeBasis: Map<string, string | null>;
179
+ assessment?: Assessment;
180
+ events: Map<string, RoutingEvent>;
181
+ eventIds: Map<string, string>;
182
+ }
183
+ export class RoutingError extends Error {
184
+ constructor(
185
+ readonly code: string,
186
+ message: string,
187
+ readonly problems: Problem[] = [],
188
+ ) {
189
+ super(message);
190
+ this.name = "RoutingError";
191
+ }
192
+ }
193
+ export function fail(code: string, message: string): never {
194
+ throw new RoutingError(code, message);
195
+ }
196
+ export function requireCondition(condition: unknown, code: string, message = code): asserts condition {
197
+ if (!condition) fail(code, message);
198
+ }
199
+ export function isObject(value: unknown): value is Record<string, any> {
200
+ return !!value && typeof value === "object" && !Array.isArray(value);
201
+ }
202
+ export function canonical(value: unknown): string {
203
+ if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
204
+ if (isObject(value))
205
+ return `{${Object.keys(value)
206
+ .filter((k) => value[k] !== undefined)
207
+ .sort()
208
+ .map((k) => `${JSON.stringify(k)}:${canonical(value[k])}`)
209
+ .join(",")}}`;
210
+ return JSON.stringify(value) ?? "null";
211
+ }
212
+ export function samePair(left: Pair | undefined, right: Pair | undefined): boolean {
213
+ return !!left && !!right && canonical(left) === canonical(right);
214
+ }
215
+ export const eventKey = (event: RoutingEvent) => JSON.stringify([event.operationId, event.data.type, event.stepId]);
216
+ export const eventValue = (event: RoutingEvent) =>
217
+ canonical({ version: event.version, operationId: event.operationId, stepId: event.stepId, data: event.data });
218
+ export const emptySelection = (): Selection => ({ revision: 0, selected: [], unresolved: [], withdrawals: [] });
219
+ export const refFor = (id: string) => `ctx:${id}`;
220
+ export function idFor(ref: string): string | undefined {
221
+ return /^ctx:([^\s:#]+)(?:#text)?$/.exec(ref)?.[1];
222
+ }
@@ -105,6 +105,11 @@ function contextParameters(features: ContextFeatureFlags) {
105
105
  operationSchema(CONVERSATION_HISTORY_RETRIEVE_PROPERTIES, ["operation", "refs"]),
106
106
  );
107
107
  }
108
+ if (oneOf.length === 0) {
109
+ // Codex rejects an empty oneOf even when the tool is inactive. Keep the
110
+ // placeholder schema valid until capability-specific operations are enabled.
111
+ return { type: "object", additionalProperties: false, properties: {} };
112
+ }
108
113
  return { type: "object", oneOf };
109
114
  }
110
115