@open-agent-toolkit/cli 0.1.46 → 0.1.48

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 (82) hide show
  1. package/assets/agents/oat-phase-implementer.md +202 -191
  2. package/assets/agents/oat-reviewer.md +11 -1
  3. package/assets/config/dispatch-matrix-recommendation.json +120 -13
  4. package/assets/docs/cli-utilities/configuration.md +172 -113
  5. package/assets/docs/cli-utilities/workflow-gates.md +161 -27
  6. package/assets/docs/contributing/skills.md +14 -8
  7. package/assets/docs/provider-sync/providers.md +41 -7
  8. package/assets/docs/provider-sync/scope-and-surface.md +2 -2
  9. package/assets/docs/reference/cli-reference.md +3 -1
  10. package/assets/docs/reference/oat-directory-structure.md +27 -26
  11. package/assets/docs/workflows/projects/artifacts.md +31 -1
  12. package/assets/docs/workflows/projects/dispatch-ceiling.md +235 -187
  13. package/assets/docs/workflows/projects/implementation-execution.md +283 -260
  14. package/assets/docs/workflows/projects/lifecycle.md +26 -5
  15. package/assets/docs/workflows/projects/reviews.md +27 -2
  16. package/assets/migration/pjm-restructure.md +1 -1
  17. package/assets/public-package-versions.json +4 -4
  18. package/assets/skills/oat-project-implement/SKILL.md +247 -133
  19. package/assets/skills/oat-project-import-plan/SKILL.md +173 -16
  20. package/assets/skills/oat-project-next/SKILL.md +2 -2
  21. package/assets/skills/oat-project-plan/SKILL.md +122 -92
  22. package/assets/skills/oat-project-plan-writing/SKILL.md +246 -15
  23. package/assets/skills/oat-project-quick-start/SKILL.md +157 -107
  24. package/assets/skills/oat-project-review-provide/SKILL.md +94 -22
  25. package/dist/commands/config/index.d.ts.map +1 -1
  26. package/dist/commands/config/index.js +64 -39
  27. package/dist/commands/doctor/index.d.ts.map +1 -1
  28. package/dist/commands/doctor/index.js +21 -6
  29. package/dist/commands/gate/index.d.ts +7 -1
  30. package/dist/commands/gate/index.d.ts.map +1 -1
  31. package/dist/commands/gate/index.js +544 -67
  32. package/dist/commands/gate/review-verdict.d.ts +16 -0
  33. package/dist/commands/gate/review-verdict.d.ts.map +1 -1
  34. package/dist/commands/gate/review-verdict.js +72 -9
  35. package/dist/commands/project/dispatch-ceiling/index.d.ts.map +1 -1
  36. package/dist/commands/project/dispatch-ceiling/index.js +452 -16
  37. package/dist/commands/providers/codex/materialize.d.ts.map +1 -1
  38. package/dist/commands/providers/codex/materialize.js +6 -1
  39. package/dist/commands/shared/frontmatter.d.ts +4 -0
  40. package/dist/commands/shared/frontmatter.d.ts.map +1 -1
  41. package/dist/commands/shared/frontmatter.js +23 -0
  42. package/dist/commands/status/index.d.ts +1 -0
  43. package/dist/commands/status/index.d.ts.map +1 -1
  44. package/dist/commands/status/index.js +10 -4
  45. package/dist/commands/sync/index.d.ts.map +1 -1
  46. package/dist/commands/sync/index.js +10 -3
  47. package/dist/commands/sync/sync.types.d.ts +1 -0
  48. package/dist/commands/sync/sync.types.d.ts.map +1 -1
  49. package/dist/config/oat-config.d.ts +19 -2
  50. package/dist/config/oat-config.d.ts.map +1 -1
  51. package/dist/config/oat-config.js +139 -24
  52. package/dist/config/resolve.d.ts +8 -0
  53. package/dist/config/resolve.d.ts.map +1 -1
  54. package/dist/config/resolve.js +66 -2
  55. package/dist/engine/index.d.ts +1 -1
  56. package/dist/engine/index.d.ts.map +1 -1
  57. package/dist/engine/index.js +1 -1
  58. package/dist/engine/scanner.d.ts +1 -0
  59. package/dist/engine/scanner.d.ts.map +1 -1
  60. package/dist/engine/scanner.js +17 -1
  61. package/dist/fs/paths.d.ts +4 -0
  62. package/dist/fs/paths.d.ts.map +1 -1
  63. package/dist/fs/paths.js +18 -1
  64. package/dist/providers/ceiling/registry.d.ts +1 -0
  65. package/dist/providers/ceiling/registry.d.ts.map +1 -1
  66. package/dist/providers/ceiling/registry.js +12 -5
  67. package/dist/providers/codex/codec/catalog.d.ts +14 -0
  68. package/dist/providers/codex/codec/catalog.d.ts.map +1 -0
  69. package/dist/providers/codex/codec/catalog.js +21 -0
  70. package/dist/providers/codex/codec/materialize.d.ts.map +1 -1
  71. package/dist/providers/codex/codec/materialize.js +6 -5
  72. package/dist/providers/codex/codec/shared.d.ts +19 -0
  73. package/dist/providers/codex/codec/shared.d.ts.map +1 -1
  74. package/dist/providers/codex/codec/shared.js +98 -5
  75. package/dist/providers/codex/codec/sync-extension.d.ts.map +1 -1
  76. package/dist/providers/codex/codec/sync-extension.js +142 -32
  77. package/dist/providers/identity/stamp.d.ts.map +1 -1
  78. package/dist/providers/identity/stamp.js +4 -0
  79. package/dist/shared/types.d.ts +1 -0
  80. package/dist/shared/types.d.ts.map +1 -1
  81. package/dist/shared/types.js +4 -0
  82. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import { BUILTIN_EXEC_TARGETS, readOatConfig, readOatLocalConfig, readUserConfig, } from './oat-config.js';
1
+ import { BUILTIN_EXEC_TARGETS, isWorkflowDispatchCandidateLadder, readOatConfig, readOatLocalConfig, readUserConfig, } from './oat-config.js';
2
2
  const DEFAULT_DEPENDENCIES = {
3
3
  readOatConfig,
4
4
  readOatLocalConfig,
@@ -167,6 +167,53 @@ export function resolveExecTargets(effective) {
167
167
  }
168
168
  return targets;
169
169
  }
170
+ export function resolveExecTargetViews(effective) {
171
+ const targets = cloneExecTargetRegistry(BUILTIN_EXEC_TARGETS);
172
+ const views = Object.fromEntries(Object.entries(targets).map(([id, target]) => [
173
+ id,
174
+ {
175
+ target: cloneExecTarget(target),
176
+ origin: 'builtin',
177
+ explicitlyConfigured: false,
178
+ enabled: true,
179
+ },
180
+ ]));
181
+ for (const [origin, layer] of [
182
+ ['user', effective.user.workflow?.gates?.execTargets],
183
+ ['shared', effective.shared.workflow?.gates?.execTargets],
184
+ ['local', effective.local.workflow?.gates?.execTargets],
185
+ ]) {
186
+ if (!layer) {
187
+ continue;
188
+ }
189
+ for (const [id, override] of Object.entries(layer)) {
190
+ if (override === null) {
191
+ const target = targets[id] ?? views[id]?.target;
192
+ delete targets[id];
193
+ if (target) {
194
+ views[id] = {
195
+ target: cloneExecTarget(target),
196
+ origin,
197
+ explicitlyConfigured: true,
198
+ enabled: false,
199
+ };
200
+ }
201
+ continue;
202
+ }
203
+ mergeExecTargetLayer(targets, { [id]: override });
204
+ const target = targets[id];
205
+ if (target) {
206
+ views[id] = {
207
+ target: cloneExecTarget(target),
208
+ origin,
209
+ explicitlyConfigured: true,
210
+ enabled: true,
211
+ };
212
+ }
213
+ }
214
+ }
215
+ return views;
216
+ }
170
217
  function mergeExecTargetLayer(targets, layer) {
171
218
  if (!layer) {
172
219
  return;
@@ -181,6 +228,7 @@ function mergeExecTargetLayer(targets, layer) {
181
228
  targets[id] = cloneExecTarget({
182
229
  runtime: override.runtime ?? existing.runtime,
183
230
  baseCommand: override.baseCommand ?? existing.baseCommand,
231
+ invocation: mergeExecTargetInvocation(existing.invocation, override.invocation),
184
232
  models: override.models ?? existing.models,
185
233
  hostDetectionCommand: override.hostDetectionCommand ?? existing.hostDetectionCommand,
186
234
  availabilityCommand: override.availabilityCommand ?? existing.availabilityCommand,
@@ -209,6 +257,9 @@ function cloneExecTarget(target) {
209
257
  if (target.hostDetectionCommand) {
210
258
  next.hostDetectionCommand = [...target.hostDetectionCommand];
211
259
  }
260
+ if (target.invocation) {
261
+ next.invocation = { ...target.invocation };
262
+ }
212
263
  if (target.availabilityCommand) {
213
264
  next.availabilityCommand = [...target.availabilityCommand];
214
265
  }
@@ -229,6 +280,9 @@ function toCompleteExecTarget(target) {
229
280
  ? target.priority
230
281
  : 0,
231
282
  };
283
+ if (target.invocation) {
284
+ completeTarget.invocation = { ...target.invocation };
285
+ }
232
286
  if (isValidArgv(target.hostDetectionCommand)) {
233
287
  completeTarget.hostDetectionCommand = [...target.hostDetectionCommand];
234
288
  }
@@ -240,6 +294,15 @@ function toCompleteExecTarget(target) {
240
294
  }
241
295
  return completeTarget;
242
296
  }
297
+ function mergeExecTargetInvocation(existing, override) {
298
+ if (!existing && !override) {
299
+ return undefined;
300
+ }
301
+ return {
302
+ ...existing,
303
+ ...override,
304
+ };
305
+ }
243
306
  function isValidStringList(value) {
244
307
  return (Array.isArray(value) &&
245
308
  value.length > 0 &&
@@ -264,7 +327,8 @@ function flattenConfig(value, prefix = '') {
264
327
  continue;
265
328
  }
266
329
  const nextKey = prefix ? `${prefix}.${key}` : key;
267
- if (isRecord(nestedValue)) {
330
+ if (isRecord(nestedValue) &&
331
+ !isWorkflowDispatchCandidateLadder(nestedValue)) {
268
332
  Object.assign(flattened, flattenConfig(nestedValue, nextKey));
269
333
  continue;
270
334
  }
@@ -5,5 +5,5 @@ export { configureLocalHooksPath, getHookInstallInfo, HOOK_DRIFT_WARNING, HOOK_M
5
5
  export type { HookInstallInfo, HookStatus } from './hook.js';
6
6
  export { hasMarker, insertMarker, OAT_DIRECTORY_SENTINEL, OAT_MARKER_PREFIX, writeDirectorySentinel, } from './markers.js';
7
7
  export type { CanonicalEntry } from './scanner.js';
8
- export { scanCanonical } from './scanner.js';
8
+ export { scanBundledManagedCodexAgents, scanCanonical } from './scanner.js';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,UAAU,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,aAAa,GACd,MAAM,QAAQ,CAAC;AAChB,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EACL,SAAS,EACT,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,UAAU,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,aAAa,GACd,MAAM,QAAQ,CAAC;AAChB,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EACL,SAAS,EACT,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,6BAA6B,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
@@ -3,4 +3,4 @@ export { SYNC_OPERATION_TYPES, } from './engine.types.js';
3
3
  export { executeSyncPlan } from './execute-plan.js';
4
4
  export { configureLocalHooksPath, getHookInstallInfo, HOOK_DRIFT_WARNING, HOOK_MARKER_END, HOOK_MARKER_START, HOOK_STRAY_INFO, installHook, isHookInstalled, REPO_GITHOOKS_PATH, runHookCheck, uninstallHook, } from './hook.js';
5
5
  export { hasMarker, insertMarker, OAT_DIRECTORY_SENTINEL, OAT_MARKER_PREFIX, writeDirectorySentinel, } from './markers.js';
6
- export { scanCanonical } from './scanner.js';
6
+ export { scanBundledManagedCodexAgents, scanCanonical } from './scanner.js';
@@ -6,6 +6,7 @@ export interface CanonicalEntry {
6
6
  canonicalPath: string;
7
7
  isFile: boolean;
8
8
  }
9
+ export declare function scanBundledManagedCodexAgents(): Promise<CanonicalEntry[]>;
9
10
  export declare function scanCanonical(basePath: string, scope: ConcreteScope): Promise<CanonicalEntry[]>;
10
11
  export {};
11
12
  //# sourceMappingURL=scanner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../src/engine/scanner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAEhE,KAAK,aAAa,GAAG,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;CACjB;AA0DD,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,cAAc,EAAE,CAAC,CA2B3B"}
1
+ {"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../src/engine/scanner.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AAEvB,KAAK,aAAa,GAAG,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;CACjB;AA0DD,wBAAsB,6BAA6B,IAAI,OAAO,CAC5D,cAAc,EAAE,CACjB,CAsBA;AAED,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,cAAc,EAAE,CAAC,CA2B3B"}
@@ -1,7 +1,8 @@
1
1
  import { readdir } from 'node:fs/promises';
2
2
  import { join, resolve } from 'node:path';
3
3
  import { CliError } from '../errors/index.js';
4
- import { SCOPE_CONTENT_TYPES } from '../shared/types.js';
4
+ import { resolveAssetsRoot } from '../fs/assets.js';
5
+ import { SCOPE_CONTENT_TYPES, USER_SCOPE_MANAGED_AGENT_FILES, } from '../shared/types.js';
5
6
  function canonicalDirectoryName(contentType) {
6
7
  if (contentType === 'skill') {
7
8
  return 'skills';
@@ -42,6 +43,21 @@ async function readEntries(dirPath) {
42
43
  throw error;
43
44
  }
44
45
  }
46
+ export async function scanBundledManagedCodexAgents() {
47
+ const agentsDir = join(await resolveAssetsRoot(), 'agents');
48
+ const entries = await readEntries(agentsDir);
49
+ const available = new Set(entries.filter((entry) => entry.isFile).map((entry) => entry.name));
50
+ const missing = USER_SCOPE_MANAGED_AGENT_FILES.filter((name) => !available.has(name));
51
+ if (missing.length > 0) {
52
+ throw new CliError(`Bundled managed Codex role definitions are unavailable: ${missing.join(', ')}. Reinstall or rebuild OAT before running user sync.`);
53
+ }
54
+ return USER_SCOPE_MANAGED_AGENT_FILES.map((name) => ({
55
+ name,
56
+ type: 'agent',
57
+ canonicalPath: join(agentsDir, name),
58
+ isFile: true,
59
+ }));
60
+ }
45
61
  export async function scanCanonical(basePath, scope) {
46
62
  const scopeRoot = resolve(basePath);
47
63
  const entries = [];
@@ -5,5 +5,9 @@ export declare function resolveScopeRoot(scope: ConcreteScope, cwd: string, home
5
5
  export declare function toPosixPath(pathValue: string): string;
6
6
  export declare function normalizeToPosixPath(pathValue: string): string;
7
7
  export declare function validatePathWithinScope(candidatePath: string, scopeRoot: string): string;
8
+ export declare function validateRealPathWithinScope(candidatePath: string, scopeRoot: string): Promise<{
9
+ realScopeRoot: string;
10
+ realPath: string;
11
+ }>;
8
12
  export {};
9
13
  //# sourceMappingURL=paths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/fs/paths.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,KAAK,aAAa,GAAG,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE3C,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBrE;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,MAAM,CAMR;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAcR"}
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/fs/paths.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,KAAK,aAAa,GAAG,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE3C,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBrE;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,MAAM,CAMR;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAcR;AAED,wBAAsB,2BAA2B,CAC/C,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAsBtD"}
package/dist/fs/paths.js CHANGED
@@ -1,4 +1,4 @@
1
- import { access } from 'node:fs/promises';
1
+ import { access, realpath } from 'node:fs/promises';
2
2
  import { dirname, posix, resolve, sep } from 'node:path';
3
3
  import { CliError } from '../errors/index.js';
4
4
  export async function resolveProjectRoot(cwd) {
@@ -40,3 +40,20 @@ export function validatePathWithinScope(candidatePath, scopeRoot) {
40
40
  }
41
41
  return resolvedCandidatePath;
42
42
  }
43
+ export async function validateRealPathWithinScope(candidatePath, scopeRoot) {
44
+ const resolvedCandidatePath = validatePathWithinScope(candidatePath, scopeRoot);
45
+ let realScopeRoot;
46
+ let realCandidatePath;
47
+ try {
48
+ [realScopeRoot, realCandidatePath] = await Promise.all([
49
+ realpath(resolve(scopeRoot)),
50
+ realpath(resolvedCandidatePath),
51
+ ]);
52
+ }
53
+ catch (error) {
54
+ const detail = error instanceof Error ? `: ${error.message}` : '';
55
+ throw new CliError(`Unable to resolve real path for ${candidatePath} within scope root ${scopeRoot}${detail}`);
56
+ }
57
+ validatePathWithinScope(realCandidatePath, realScopeRoot);
58
+ return { realScopeRoot, realPath: realCandidatePath };
59
+ }
@@ -27,6 +27,7 @@ export type CeilingDispatchArgs = {
27
27
  } | {
28
28
  model: string;
29
29
  } | null;
30
+ export declare function isDirectDispatchRoleName(value: string): boolean;
30
31
  export interface ProviderCeilingAdapter {
31
32
  provider: string;
32
33
  supportsCeiling: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/providers/ceiling/registry.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG,WAAW,GAAG,MAAM,CAAC;AAE3E,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,UAAU,CAAC;AAErD,MAAM,WAAW,qBAAqB;IACpC,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,IAAI,CAAC;CACV;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GACnB;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACjB,IAAI,CAAC;AAET,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,oBAAoB,CAAC;IAChC;;;OAGG;IACH,qBAAqB,CACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,qBAAqB,GACzB,mBAAmB,CAAC;IACvB;;;;OAIG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC;CACtE;AAMD,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAK9C,CAAC;AAqGF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,sBAAsB,CAE1E"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/providers/ceiling/registry.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG,WAAW,GAAG,MAAM,CAAC;AAE3E,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,UAAU,CAAC;AAErD,MAAM,WAAW,qBAAqB;IACpC,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,IAAI,CAAC;CACV;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GACnB;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACjB,IAAI,CAAC;AAKT,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,oBAAoB,CAAC;IAChC;;;OAGG;IACH,qBAAqB,CACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,qBAAqB,GACzB,mBAAmB,CAAC;IACvB;;;;OAIG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC;CACtE;AAMD,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAK9C,CAAC;AA4GF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,sBAAsB,CAE1E"}
@@ -1,5 +1,9 @@
1
1
  import { VALID_CLAUDE_DISPATCH_CEILINGS, VALID_CODEX_DISPATCH_CEILINGS, } from '../../config/oat-config.js';
2
- import { buildCodexMaterializedRoleName } from '../codex/codec/materialize.js';
2
+ import { buildCodexMaterializedTargetRoleName } from '../codex/codec/shared.js';
3
+ const DIRECT_DISPATCH_ROLE_PATTERN = /^oat-(?:phase-implementer|reviewer)(?:-|$)/;
4
+ export function isDirectDispatchRoleName(value) {
5
+ return DIRECT_DISPATCH_ROLE_PATTERN.test(value.trim());
6
+ }
3
7
  /** Codex materialized-role base names (must match sync-extension output). */
4
8
  const CODEX_IMPLEMENTER_ROLE = 'oat-phase-implementer';
5
9
  const CODEX_REVIEWER_ROLE = 'oat-reviewer';
@@ -20,12 +24,14 @@ const codexAdapter = {
20
24
  return null;
21
25
  }
22
26
  const target = ctx.target;
23
- if (!target?.model || !target.effort) {
27
+ if (!target?.model ||
28
+ !target.effort ||
29
+ isDirectDispatchRoleName(target.model)) {
24
30
  return null;
25
31
  }
26
32
  const baseRole = role === 'reviewer' ? CODEX_REVIEWER_ROLE : CODEX_IMPLEMENTER_ROLE;
27
33
  return {
28
- variant: buildCodexMaterializedRoleName({
34
+ variant: buildCodexMaterializedTargetRoleName({
29
35
  agentName: baseRole,
30
36
  model: target.model,
31
37
  effort: target.effort,
@@ -55,7 +61,8 @@ const claudeAdapter = {
55
61
  validValues: [...VALID_CLAUDE_DISPATCH_CEILINGS],
56
62
  mechanism: 'model-arg',
57
63
  compileToDispatchArgs(value) {
58
- if (!VALID_CLAUDE_DISPATCH_CEILINGS.includes(value)) {
64
+ if (isDirectDispatchRoleName(value) ||
65
+ !VALID_CLAUDE_DISPATCH_CEILINGS.includes(value)) {
59
66
  return null;
60
67
  }
61
68
  return { model: value };
@@ -72,7 +79,7 @@ const cursorAdapter = {
72
79
  mechanism: 'model-arg',
73
80
  compileToDispatchArgs(value) {
74
81
  const model = value.trim();
75
- return model ? { model } : null;
82
+ return model && !isDirectDispatchRoleName(model) ? { model } : null;
76
83
  },
77
84
  // Cursor model slugs do not share a total order, so upgrade verification is
78
85
  // not meaningful here; availability is checked by the identity oracle layer.
@@ -0,0 +1,14 @@
1
+ export { SUPPORTED_CODEX_ROLE_TARGETS } from './shared.js';
2
+ export declare const SUPPORTED_CODEX_BASE_ROLES: readonly ["oat-phase-implementer", "oat-reviewer"];
3
+ export interface SupportedCodexRoleCatalogueEntry {
4
+ baseRole: (typeof SUPPORTED_CODEX_BASE_ROLES)[number];
5
+ model: string;
6
+ effort: string;
7
+ roleName: string;
8
+ }
9
+ export declare function isSupportedCodexRoleTarget(target: {
10
+ model: string;
11
+ effort: string;
12
+ }): boolean;
13
+ export declare function expandSupportedCodexRoleCatalogue(): SupportedCodexRoleCatalogueEntry[];
14
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../../src/providers/codex/codec/catalog.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,eAAO,MAAM,0BAA0B,oDAG7B,CAAC;AAEX,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,EAAE,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAKV;AAED,wBAAgB,iCAAiC,IAAI,gCAAgC,EAAE,CAYtF"}
@@ -0,0 +1,21 @@
1
+ import { buildCodexMaterializedRoleName } from './materialize.js';
2
+ import { SUPPORTED_CODEX_ROLE_TARGETS } from './shared.js';
3
+ export { SUPPORTED_CODEX_ROLE_TARGETS } from './shared.js';
4
+ export const SUPPORTED_CODEX_BASE_ROLES = [
5
+ 'oat-phase-implementer',
6
+ 'oat-reviewer',
7
+ ];
8
+ export function isSupportedCodexRoleTarget(target) {
9
+ return SUPPORTED_CODEX_ROLE_TARGETS.some((supported) => supported.model === target.model && supported.effort === target.effort);
10
+ }
11
+ export function expandSupportedCodexRoleCatalogue() {
12
+ return SUPPORTED_CODEX_BASE_ROLES.flatMap((baseRole) => SUPPORTED_CODEX_ROLE_TARGETS.map((target) => ({
13
+ baseRole,
14
+ ...target,
15
+ roleName: buildCodexMaterializedRoleName({
16
+ agentName: baseRole,
17
+ model: target.model,
18
+ effort: target.effort,
19
+ }),
20
+ }))).sort((left, right) => left.roleName.localeCompare(right.roleName));
21
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"materialize.d.ts","sourceRoot":"","sources":["../../../../src/providers/codex/codec/materialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAGhE,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,sBAAsB,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gCAAgC;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAUD,wBAAgB,8BAA8B,CAAC,EAC7C,SAAS,EACT,KAAK,EACL,MAAM,GACP,EAAE,gCAAgC,GAAG,MAAM,CAa3C;AAWD,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAQ,GACT,EAAE,2BAA2B,GAAG,eAAe,CA+B/C"}
1
+ {"version":3,"file":"materialize.d.ts","sourceRoot":"","sources":["../../../../src/providers/codex/codec/materialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAGhE,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,mBAAmB,CAAC;AAM3B,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,sBAAsB,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gCAAgC;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAUD,wBAAgB,8BAA8B,CAAC,EAC7C,SAAS,EACT,KAAK,EACL,MAAM,GACP,EAAE,gCAAgC,GAAG,MAAM,CAY3C;AAWD,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAQ,GACT,EAAE,2BAA2B,GAAG,eAAe,CA+B/C"}
@@ -1,6 +1,6 @@
1
1
  import { CliError } from '../../../errors/index.js';
2
2
  import { exportCanonicalAgentToCodexRole, } from './export-to-codex.js';
3
- import { normalizeCodexRoleName, sanitizeCodexRoleName } from './shared.js';
3
+ import { buildCodexMaterializedTargetRoleName, sanitizeCodexRoleName, } from './shared.js';
4
4
  function requireNonEmpty(value, label) {
5
5
  const normalized = value.trim();
6
6
  if (!normalized) {
@@ -9,10 +9,11 @@ function requireNonEmpty(value, label) {
9
9
  return normalized;
10
10
  }
11
11
  export function buildCodexMaterializedRoleName({ agentName, model, effort, }) {
12
- const normalizedAgentName = sanitizeCodexRoleName(agentName);
13
- const normalizedModel = normalizeCodexRoleName(model);
14
- const normalizedEffort = normalizeCodexRoleName(effort);
15
- const roleName = normalizeCodexRoleName(`${normalizedAgentName}-${normalizedModel}-${normalizedEffort}`);
12
+ const roleName = buildCodexMaterializedTargetRoleName({
13
+ agentName,
14
+ model,
15
+ effort,
16
+ });
16
17
  if (!roleName) {
17
18
  throw new CliError('Cannot materialize Codex role: missing role name.');
18
19
  }
@@ -1,8 +1,27 @@
1
1
  export declare const OAT_MANAGED_ROLE_HEADER = "# oat-managed: true";
2
2
  export declare const OAT_MANAGED_ROLE_NAME_PREFIX = "# oat-role: ";
3
+ export declare const OAT_MANAGED_ROLE_OWNER_PREFIX = "# oat-owner: ";
4
+ export type CodexRoleOwner = 'supported-catalogue' | 'user-config' | 'project-config';
5
+ export declare const SUPPORTED_CODEX_ROLE_TARGETS: readonly ({
6
+ model: string;
7
+ effort: "high" | "medium" | "low" | "xhigh";
8
+ } | {
9
+ model: string;
10
+ effort: "high" | "medium" | "low" | "xhigh";
11
+ } | {
12
+ model: string;
13
+ effort: string;
14
+ })[];
3
15
  export declare function sanitizeCodexRoleName(input: string): string;
4
16
  export declare function normalizeCodexRoleName(input: string): string;
17
+ export declare function buildCodexMaterializedTargetRoleName(options: {
18
+ agentName: string;
19
+ model: string;
20
+ effort: string;
21
+ }): string;
5
22
  export declare function isOatManagedCodexRoleFile(content: string, roleName?: string): boolean;
6
23
  export declare function withOatManagedCodexHeader(roleName: string, tomlBody: string): string;
24
+ export declare function readOatManagedCodexRoleOwner(content: string): CodexRoleOwner | null;
25
+ export declare function withOatManagedCodexRoleOwner(content: string, owner: CodexRoleOwner): string;
7
26
  export declare function stringifyToml(object: Record<string, unknown>): string;
8
27
  //# sourceMappingURL=shared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/providers/codex/codec/shared.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAC7D,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAE3D,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO5D;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAUT;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAErE"}
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/providers/codex/codec/shared.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAC7D,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAC3D,eAAO,MAAM,6BAA6B,kBAAkB,CAAC;AAE7D,MAAM,MAAM,cAAc,GACtB,qBAAqB,GACrB,aAAa,GACb,gBAAgB,CAAC;AAoBrB,eAAO,MAAM,4BAA4B;;;;;;;;;IAa/B,CAAC;AAEX,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO5D;AAQD,wBAAgB,oCAAoC,CAAC,OAAO,EAAE;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,MAAM,CAiBT;AAgDD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAOT;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,GACd,cAAc,GAAG,IAAI,CAEvB;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,cAAc,GACpB,MAAM,CAkBR;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAErE"}
@@ -1,6 +1,30 @@
1
+ import { createHash } from 'node:crypto';
1
2
  import TOML from '@iarna/toml';
2
3
  export const OAT_MANAGED_ROLE_HEADER = '# oat-managed: true';
3
4
  export const OAT_MANAGED_ROLE_NAME_PREFIX = '# oat-role: ';
5
+ export const OAT_MANAGED_ROLE_OWNER_PREFIX = '# oat-owner: ';
6
+ const CODEX_ROLE_MARKER_PATTERN = /^# oat-role: ([a-zA-Z0-9_-]+)$/;
7
+ const CODEX_OWNER_MARKER_PATTERN = /^# oat-owner: (supported-catalogue|user-config|project-config)$/;
8
+ const STANDARD_SUPPORTED_CODEX_EFFORTS = [
9
+ 'low',
10
+ 'medium',
11
+ 'high',
12
+ 'xhigh',
13
+ ];
14
+ export const SUPPORTED_CODEX_ROLE_TARGETS = [
15
+ ...STANDARD_SUPPORTED_CODEX_EFFORTS.map((effort) => ({
16
+ model: 'gpt-5.6-luna',
17
+ effort,
18
+ })),
19
+ ...STANDARD_SUPPORTED_CODEX_EFFORTS.map((effort) => ({
20
+ model: 'gpt-5.6-terra',
21
+ effort,
22
+ })),
23
+ ...[...STANDARD_SUPPORTED_CODEX_EFFORTS, 'max'].map((effort) => ({
24
+ model: 'gpt-5.6-sol',
25
+ effort,
26
+ })),
27
+ ];
4
28
  export function sanitizeCodexRoleName(input) {
5
29
  return normalizeCodexRoleName(input.replace(/\.md$/i, ''));
6
30
  }
@@ -12,18 +36,87 @@ export function normalizeCodexRoleName(input) {
12
36
  .replace(/-{2,}/g, '-')
13
37
  .replace(/^-+|-+$/g, '');
14
38
  }
39
+ function isSupportedCodexRoleTarget(model, effort) {
40
+ return SUPPORTED_CODEX_ROLE_TARGETS.some((supported) => supported.model === model && supported.effort === effort);
41
+ }
42
+ export function buildCodexMaterializedTargetRoleName(options) {
43
+ const normalizedAgentName = sanitizeCodexRoleName(options.agentName);
44
+ const normalizedModel = normalizeCodexRoleName(options.model);
45
+ const normalizedEffort = normalizeCodexRoleName(options.effort);
46
+ const customTargetSuffix = isSupportedCodexRoleTarget(options.model, options.effort)
47
+ ? ''
48
+ : `-${createHash('sha256')
49
+ .update(`${options.model}\0${options.effort}`)
50
+ .digest('hex')
51
+ .slice(0, 10)}`;
52
+ return normalizeCodexRoleName(`${normalizedAgentName}-${normalizedModel}-${normalizedEffort}${customTargetSuffix}`);
53
+ }
54
+ function parseOatManagedCodexRoleHeader(content) {
55
+ const lines = content
56
+ .split('\n')
57
+ .map((line) => (line.endsWith('\r') ? line.slice(0, -1) : line));
58
+ const headerLines = [];
59
+ for (const line of lines) {
60
+ if (!line.startsWith('# oat-')) {
61
+ break;
62
+ }
63
+ headerLines.push(line);
64
+ }
65
+ if (headerLines.length < 2 ||
66
+ headerLines.length > 3 ||
67
+ headerLines[0] !== OAT_MANAGED_ROLE_HEADER) {
68
+ return null;
69
+ }
70
+ const roleMatch = CODEX_ROLE_MARKER_PATTERN.exec(headerLines[1]);
71
+ if (!roleMatch) {
72
+ return null;
73
+ }
74
+ let owner = null;
75
+ let ownerLineIndex = null;
76
+ if (headerLines.length === 3) {
77
+ const ownerMatch = CODEX_OWNER_MARKER_PATTERN.exec(headerLines[2]);
78
+ if (!ownerMatch) {
79
+ return null;
80
+ }
81
+ owner = ownerMatch[1];
82
+ ownerLineIndex = 2;
83
+ }
84
+ return {
85
+ roleName: roleMatch[1],
86
+ roleLineIndex: 1,
87
+ owner,
88
+ ownerLineIndex,
89
+ };
90
+ }
15
91
  export function isOatManagedCodexRoleFile(content, roleName) {
16
- if (!content.includes(OAT_MANAGED_ROLE_HEADER)) {
92
+ const header = parseOatManagedCodexRoleHeader(content);
93
+ if (!header) {
17
94
  return false;
18
95
  }
19
- if (!roleName) {
20
- return true;
21
- }
22
- return content.includes(`${OAT_MANAGED_ROLE_NAME_PREFIX}${roleName}`);
96
+ return roleName === undefined || header.roleName === roleName;
23
97
  }
24
98
  export function withOatManagedCodexHeader(roleName, tomlBody) {
25
99
  return `${OAT_MANAGED_ROLE_HEADER}\n${OAT_MANAGED_ROLE_NAME_PREFIX}${roleName}\n${tomlBody}`;
26
100
  }
101
+ export function readOatManagedCodexRoleOwner(content) {
102
+ return parseOatManagedCodexRoleHeader(content)?.owner ?? null;
103
+ }
104
+ export function withOatManagedCodexRoleOwner(content, owner) {
105
+ const header = parseOatManagedCodexRoleHeader(content);
106
+ if (!header) {
107
+ return content;
108
+ }
109
+ const lines = content.split('\n');
110
+ const ownerLine = `${OAT_MANAGED_ROLE_OWNER_PREFIX}${owner}`;
111
+ const usesCarriageReturn = lines[header.roleLineIndex]?.endsWith('\r') ?? false;
112
+ const encodedOwnerLine = `${ownerLine}${usesCarriageReturn ? '\r' : ''}`;
113
+ if (header.ownerLineIndex !== null) {
114
+ lines[header.ownerLineIndex] = encodedOwnerLine;
115
+ return lines.join('\n');
116
+ }
117
+ lines.splice(header.roleLineIndex + 1, 0, encodedOwnerLine);
118
+ return lines.join('\n');
119
+ }
27
120
  export function stringifyToml(object) {
28
121
  return TOML.stringify(object);
29
122
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sync-extension.d.ts","sourceRoot":"","sources":["../../../../src/providers/codex/codec/sync-extension.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAUpD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAC3E,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAErD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,MAAM,EAAE,oBAAoB,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,4BAA6B,SAAQ,uBAAuB;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,4BAA4B,EAAE,CAAC;IAC3C,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAeD,UAAU,iCAAiC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAmYD,wBAAsB,gCAAgC,CACpD,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,cAAc,EAAE,EAClC,qBAAqB,CAAC,EAAE,MAAM,EAAE,EAChC,OAAO,GAAE,iCAAsC,GAC9C,OAAO,CAAC,kBAAkB,CAAC,CA0H7B;AAED,wBAAsB,8BAA8B,CAClD,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,yBAAyB,CAAC,CA6BpC;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAE1E;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,kBAAkB,GAAG;IACjE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB,CAaA;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,kBAAkB,GACvB,uBAAuB,EAAE,CAQ3B"}
1
+ {"version":3,"file":"sync-extension.d.ts","sourceRoot":"","sources":["../../../../src/providers/codex/codec/sync-extension.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAqBpD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAC3E,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAErD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,MAAM,EAAE,oBAAoB,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,4BAA6B,SAAQ,uBAAuB;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,4BAA4B,EAAE,CAAC;IAC3C,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAgBD,UAAU,iCAAiC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAwhBD,wBAAsB,gCAAgC,CACpD,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,cAAc,EAAE,EAClC,qBAAqB,CAAC,EAAE,MAAM,EAAE,EAChC,OAAO,GAAE,iCAAsC,GAC9C,OAAO,CAAC,kBAAkB,CAAC,CA+I7B;AAED,wBAAsB,8BAA8B,CAClD,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,yBAAyB,CAAC,CA6BpC;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAE1E;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,kBAAkB,GAAG;IACjE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB,CAaA;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,kBAAkB,GACvB,uBAAuB,EAAE,CAQ3B"}