@open-agent-toolkit/cli 0.2.64 → 0.2.66

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 (217) hide show
  1. package/assets/bundle-metadata.json +1 -1
  2. package/assets/docs/cli-utilities/configuration.md +19 -1
  3. package/assets/docs/cli-utilities/index.md +3 -0
  4. package/assets/docs/cli-utilities/remote-project-management.md +191 -0
  5. package/assets/docs/contributing/skills.md +15 -5
  6. package/assets/docs/reference/cli-reference.md +12 -1
  7. package/assets/docs/reference/file-locations.md +22 -0
  8. package/assets/docs/reference/oat-directory-structure.md +30 -17
  9. package/assets/docs/reference/troubleshooting.md +44 -0
  10. package/assets/docs/workflows/skills/index.md +33 -0
  11. package/assets/public-package-versions.json +4 -4
  12. package/assets/skills/analyze/SKILL.md +2 -1
  13. package/assets/skills/authoring-docs/SKILL.md +2 -1
  14. package/assets/skills/compare/SKILL.md +2 -1
  15. package/assets/skills/create-agnostic-skill/SKILL.md +2 -1
  16. package/assets/skills/deep-research/SKILL.md +2 -1
  17. package/assets/skills/explainer-kit/SKILL.md +2 -1
  18. package/assets/skills/oat-agent-instructions-analyze/SKILL.md +2 -1
  19. package/assets/skills/oat-agent-instructions-apply/SKILL.md +2 -1
  20. package/assets/skills/oat-brainstorm/SKILL.md +2 -1
  21. package/assets/skills/oat-cursor-cloud-projects/SKILL.md +2 -1
  22. package/assets/skills/oat-dispatch-subagents/SKILL.md +2 -1
  23. package/assets/skills/oat-docs/SKILL.md +2 -1
  24. package/assets/skills/oat-docs-analyze/SKILL.md +2 -1
  25. package/assets/skills/oat-docs-apply/SKILL.md +2 -1
  26. package/assets/skills/oat-docs-authoring/SKILL.md +2 -1
  27. package/assets/skills/oat-docs-bootstrap/SKILL.md +2 -1
  28. package/assets/skills/oat-doctor/SKILL.md +5 -4
  29. package/assets/skills/oat-explainer-kit/SKILL.md +2 -1
  30. package/assets/skills/oat-explainer-kit/scripts/check-core.mjs +322 -2
  31. package/assets/skills/oat-idea-ideate/SKILL.md +2 -1
  32. package/assets/skills/oat-idea-new/SKILL.md +2 -1
  33. package/assets/skills/oat-idea-scratchpad/SKILL.md +2 -1
  34. package/assets/skills/oat-idea-summarize/SKILL.md +2 -1
  35. package/assets/skills/oat-pjm-add-backlog-item/SKILL.md +2 -1
  36. package/assets/skills/oat-pjm-decision/SKILL.md +2 -1
  37. package/assets/skills/oat-pjm-remote/SKILL.md +101 -0
  38. package/assets/skills/oat-pjm-remote/references/external-action-protocol.md +43 -0
  39. package/assets/skills/oat-pjm-review-backlog/SKILL.md +2 -1
  40. package/assets/skills/oat-pjm-update-repo-reference/SKILL.md +2 -1
  41. package/assets/skills/oat-project-autonomous/SKILL.md +2 -1
  42. package/assets/skills/oat-project-capture/SKILL.md +2 -1
  43. package/assets/skills/oat-project-clear-active/SKILL.md +2 -1
  44. package/assets/skills/oat-project-complete/SKILL.md +2 -1
  45. package/assets/skills/oat-project-design/SKILL.md +2 -1
  46. package/assets/skills/oat-project-discover/SKILL.md +2 -1
  47. package/assets/skills/oat-project-dispatch-subagents/SKILL.md +2 -1
  48. package/assets/skills/oat-project-document/SKILL.md +2 -1
  49. package/assets/skills/oat-project-implement/SKILL.md +2 -1
  50. package/assets/skills/oat-project-import-plan/SKILL.md +2 -1
  51. package/assets/skills/oat-project-lite/SKILL.md +2 -1
  52. package/assets/skills/oat-project-new/SKILL.md +2 -1
  53. package/assets/skills/oat-project-next/SKILL.md +2 -1
  54. package/assets/skills/oat-project-open/SKILL.md +2 -1
  55. package/assets/skills/oat-project-plan/SKILL.md +2 -1
  56. package/assets/skills/oat-project-plan-writing/SKILL.md +2 -1
  57. package/assets/skills/oat-project-pr-final/SKILL.md +2 -1
  58. package/assets/skills/oat-project-pr-progress/SKILL.md +2 -1
  59. package/assets/skills/oat-project-progress/SKILL.md +2 -1
  60. package/assets/skills/oat-project-promote-spec-driven/SKILL.md +2 -1
  61. package/assets/skills/oat-project-quick-start/SKILL.md +2 -1
  62. package/assets/skills/oat-project-reconcile/SKILL.md +2 -1
  63. package/assets/skills/oat-project-retro/SKILL.md +2 -1
  64. package/assets/skills/oat-project-retro-file/SKILL.md +2 -1
  65. package/assets/skills/oat-project-review-provide/SKILL.md +2 -1
  66. package/assets/skills/oat-project-review-provide-remote/SKILL.md +2 -1
  67. package/assets/skills/oat-project-review-receive/SKILL.md +2 -1
  68. package/assets/skills/oat-project-review-receive-remote/SKILL.md +2 -1
  69. package/assets/skills/oat-project-revise/SKILL.md +2 -1
  70. package/assets/skills/oat-project-spec/SKILL.md +2 -1
  71. package/assets/skills/oat-project-split/SKILL.md +2 -1
  72. package/assets/skills/oat-project-summary/SKILL.md +2 -1
  73. package/assets/skills/oat-repo-improve/SKILL.md +1 -1
  74. package/assets/skills/oat-repo-knowledge-index/SKILL.md +2 -1
  75. package/assets/skills/oat-repo-maintainability-review/SKILL.md +2 -1
  76. package/assets/skills/oat-review-provide/SKILL.md +2 -1
  77. package/assets/skills/oat-review-provide-remote/SKILL.md +2 -1
  78. package/assets/skills/oat-review-receive/SKILL.md +2 -1
  79. package/assets/skills/oat-review-receive-remote/SKILL.md +2 -1
  80. package/assets/skills/oat-wave-execute/SKILL.md +2 -1
  81. package/assets/skills/oat-wave-program/SKILL.md +2 -1
  82. package/assets/skills/oat-worktree-bootstrap/SKILL.md +2 -1
  83. package/assets/skills/oat-worktree-bootstrap-auto/SKILL.md +2 -1
  84. package/assets/skills/oat-wrap-up/SKILL.md +2 -1
  85. package/assets/skills/recon/SKILL.md +2 -1
  86. package/assets/skills/skeptic/SKILL.md +2 -1
  87. package/assets/skills/subagent-orchestration/SKILL.md +2 -1
  88. package/assets/skills/synthesize/SKILL.md +2 -1
  89. package/dist/commands/backlog/new.d.ts +1 -0
  90. package/dist/commands/backlog/new.d.ts.map +1 -1
  91. package/dist/commands/backlog/new.js +3 -1
  92. package/dist/commands/config/index.d.ts +1 -0
  93. package/dist/commands/config/index.d.ts.map +1 -1
  94. package/dist/commands/config/index.js +232 -1
  95. package/dist/commands/pjm/doctor.d.ts +2 -0
  96. package/dist/commands/pjm/doctor.d.ts.map +1 -1
  97. package/dist/commands/pjm/doctor.js +71 -1
  98. package/dist/commands/pjm/index.d.ts +2 -0
  99. package/dist/commands/pjm/index.d.ts.map +1 -1
  100. package/dist/commands/pjm/index.js +3 -0
  101. package/dist/commands/pjm/remote/__integration__/lifecycle-harness.d.ts +60 -0
  102. package/dist/commands/pjm/remote/__integration__/lifecycle-harness.d.ts.map +1 -0
  103. package/dist/commands/pjm/remote/__integration__/lifecycle-harness.js +151 -0
  104. package/dist/commands/pjm/remote/association.d.ts +27 -0
  105. package/dist/commands/pjm/remote/association.d.ts.map +1 -0
  106. package/dist/commands/pjm/remote/association.js +68 -0
  107. package/dist/commands/pjm/remote/authority.d.ts +210 -0
  108. package/dist/commands/pjm/remote/authority.d.ts.map +1 -0
  109. package/dist/commands/pjm/remote/authority.js +341 -0
  110. package/dist/commands/pjm/remote/batch.d.ts +15 -0
  111. package/dist/commands/pjm/remote/batch.d.ts.map +1 -0
  112. package/dist/commands/pjm/remote/batch.js +126 -0
  113. package/dist/commands/pjm/remote/closeout.d.ts +69 -0
  114. package/dist/commands/pjm/remote/closeout.d.ts.map +1 -0
  115. package/dist/commands/pjm/remote/closeout.js +208 -0
  116. package/dist/commands/pjm/remote/create-binding.d.ts +62 -0
  117. package/dist/commands/pjm/remote/create-binding.d.ts.map +1 -0
  118. package/dist/commands/pjm/remote/create-binding.js +126 -0
  119. package/dist/commands/pjm/remote/credential-safety.d.ts +7 -0
  120. package/dist/commands/pjm/remote/credential-safety.d.ts.map +1 -0
  121. package/dist/commands/pjm/remote/credential-safety.js +21 -0
  122. package/dist/commands/pjm/remote/discussion.d.ts +49 -0
  123. package/dist/commands/pjm/remote/discussion.d.ts.map +1 -0
  124. package/dist/commands/pjm/remote/discussion.js +124 -0
  125. package/dist/commands/pjm/remote/doctor.d.ts +22 -0
  126. package/dist/commands/pjm/remote/doctor.d.ts.map +1 -0
  127. package/dist/commands/pjm/remote/doctor.js +380 -0
  128. package/dist/commands/pjm/remote/external-action.d.ts +208 -0
  129. package/dist/commands/pjm/remote/external-action.d.ts.map +1 -0
  130. package/dist/commands/pjm/remote/external-action.js +367 -0
  131. package/dist/commands/pjm/remote/host-execution.d.ts +28 -0
  132. package/dist/commands/pjm/remote/host-execution.d.ts.map +1 -0
  133. package/dist/commands/pjm/remote/host-execution.js +63 -0
  134. package/dist/commands/pjm/remote/index.d.ts +41 -0
  135. package/dist/commands/pjm/remote/index.d.ts.map +1 -0
  136. package/dist/commands/pjm/remote/index.js +280 -0
  137. package/dist/commands/pjm/remote/jira-adf.d.ts +35 -0
  138. package/dist/commands/pjm/remote/jira-adf.d.ts.map +1 -0
  139. package/dist/commands/pjm/remote/jira-adf.js +169 -0
  140. package/dist/commands/pjm/remote/lifecycle.d.ts +163 -0
  141. package/dist/commands/pjm/remote/lifecycle.d.ts.map +1 -0
  142. package/dist/commands/pjm/remote/lifecycle.js +224 -0
  143. package/dist/commands/pjm/remote/local-projection.d.ts +30 -0
  144. package/dist/commands/pjm/remote/local-projection.d.ts.map +1 -0
  145. package/dist/commands/pjm/remote/local-projection.js +95 -0
  146. package/dist/commands/pjm/remote/managed-markdown.d.ts +30 -0
  147. package/dist/commands/pjm/remote/managed-markdown.d.ts.map +1 -0
  148. package/dist/commands/pjm/remote/managed-markdown.js +128 -0
  149. package/dist/commands/pjm/remote/migrate.d.ts +14 -0
  150. package/dist/commands/pjm/remote/migrate.d.ts.map +1 -0
  151. package/dist/commands/pjm/remote/migrate.js +32 -0
  152. package/dist/commands/pjm/remote/operation-state.d.ts +15 -0
  153. package/dist/commands/pjm/remote/operation-state.d.ts.map +1 -0
  154. package/dist/commands/pjm/remote/operation-state.js +143 -0
  155. package/dist/commands/pjm/remote/outbound-projection-safety.d.ts +25 -0
  156. package/dist/commands/pjm/remote/outbound-projection-safety.d.ts.map +1 -0
  157. package/dist/commands/pjm/remote/outbound-projection-safety.js +99 -0
  158. package/dist/commands/pjm/remote/output.d.ts +60 -0
  159. package/dist/commands/pjm/remote/output.d.ts.map +1 -0
  160. package/dist/commands/pjm/remote/output.js +48 -0
  161. package/dist/commands/pjm/remote/preview.d.ts +88 -0
  162. package/dist/commands/pjm/remote/preview.d.ts.map +1 -0
  163. package/dist/commands/pjm/remote/preview.js +154 -0
  164. package/dist/commands/pjm/remote/provider-conformance.d.ts +13 -0
  165. package/dist/commands/pjm/remote/provider-conformance.d.ts.map +1 -0
  166. package/dist/commands/pjm/remote/provider-conformance.js +37 -0
  167. package/dist/commands/pjm/remote/provider.d.ts +57 -0
  168. package/dist/commands/pjm/remote/provider.d.ts.map +1 -0
  169. package/dist/commands/pjm/remote/provider.js +28 -0
  170. package/dist/commands/pjm/remote/providers/github-publication-safety.d.ts +46 -0
  171. package/dist/commands/pjm/remote/providers/github-publication-safety.d.ts.map +1 -0
  172. package/dist/commands/pjm/remote/providers/github-publication-safety.js +126 -0
  173. package/dist/commands/pjm/remote/providers/github.d.ts +207 -0
  174. package/dist/commands/pjm/remote/providers/github.d.ts.map +1 -0
  175. package/dist/commands/pjm/remote/providers/github.js +1456 -0
  176. package/dist/commands/pjm/remote/providers/jira.d.ts +245 -0
  177. package/dist/commands/pjm/remote/providers/jira.d.ts.map +1 -0
  178. package/dist/commands/pjm/remote/providers/jira.js +1650 -0
  179. package/dist/commands/pjm/remote/providers/linear.d.ts +182 -0
  180. package/dist/commands/pjm/remote/providers/linear.d.ts.map +1 -0
  181. package/dist/commands/pjm/remote/providers/linear.js +1289 -0
  182. package/dist/commands/pjm/remote/purpose-policy.d.ts +29 -0
  183. package/dist/commands/pjm/remote/purpose-policy.d.ts.map +1 -0
  184. package/dist/commands/pjm/remote/purpose-policy.js +118 -0
  185. package/dist/commands/pjm/remote/reconcile.d.ts +42 -0
  186. package/dist/commands/pjm/remote/reconcile.d.ts.map +1 -0
  187. package/dist/commands/pjm/remote/reconcile.js +101 -0
  188. package/dist/commands/pjm/remote/resolution.d.ts +122 -0
  189. package/dist/commands/pjm/remote/resolution.d.ts.map +1 -0
  190. package/dist/commands/pjm/remote/resolution.js +243 -0
  191. package/dist/commands/pjm/remote/schema.d.ts +9309 -0
  192. package/dist/commands/pjm/remote/schema.d.ts.map +1 -0
  193. package/dist/commands/pjm/remote/schema.js +1503 -0
  194. package/dist/commands/pjm/remote/service.d.ts +20 -0
  195. package/dist/commands/pjm/remote/service.d.ts.map +1 -0
  196. package/dist/commands/pjm/remote/service.js +5121 -0
  197. package/dist/commands/pjm/remote/shared-storage.d.ts +36 -0
  198. package/dist/commands/pjm/remote/shared-storage.d.ts.map +1 -0
  199. package/dist/commands/pjm/remote/shared-storage.js +110 -0
  200. package/dist/commands/pjm/remote/snapshot.d.ts +32 -0
  201. package/dist/commands/pjm/remote/snapshot.d.ts.map +1 -0
  202. package/dist/commands/pjm/remote/snapshot.js +140 -0
  203. package/dist/commands/pjm/remote/storage-locator.d.ts +29 -0
  204. package/dist/commands/pjm/remote/storage-locator.d.ts.map +1 -0
  205. package/dist/commands/pjm/remote/storage-locator.js +62 -0
  206. package/dist/commands/pjm/remote/store.d.ts +85 -0
  207. package/dist/commands/pjm/remote/store.d.ts.map +1 -0
  208. package/dist/commands/pjm/remote/store.js +553 -0
  209. package/dist/commands/pjm/remote/verification.d.ts +40 -0
  210. package/dist/commands/pjm/remote/verification.d.ts.map +1 -0
  211. package/dist/commands/pjm/remote/verification.js +100 -0
  212. package/dist/commands/tools/shared/pack-manifest.d.ts.map +1 -1
  213. package/dist/commands/tools/shared/pack-manifest.js +1 -0
  214. package/dist/config/oat-config.d.ts +26 -0
  215. package/dist/config/oat-config.d.ts.map +1 -1
  216. package/dist/config/oat-config.js +186 -2
  217. package/package.json +2 -2
@@ -1,9 +1,15 @@
1
+ import { execFile as execFileCallback } from 'node:child_process';
1
2
  import { access, readdir, readFile } from 'node:fs/promises';
2
- import { basename, dirname, join } from 'node:path';
3
+ import { basename, dirname, isAbsolute, join, resolve } from 'node:path';
4
+ import { promisify } from 'node:util';
3
5
  import { BACKLOG_ITEM_STATUSES, extractBacklogStatus, isTerminalBacklogStatus, isValidBacklogStatus, } from '../backlog/shared/item-status.js';
4
6
  import { getFrontmatterBlock } from '../shared/frontmatter.js';
7
+ import { parseJsonConfig } from '../../config/json.js';
5
8
  import { resolvePjmAdoption } from './adoption.js';
6
9
  import { CANONICAL_REPO_REFERENCE_PATHS } from './init.js';
10
+ import { runRemoteDoctorChecks } from './remote/doctor.js';
11
+ import { resolveRemoteStorageLocations } from './remote/storage-locator.js';
12
+ const execFileAsync = promisify(execFileCallback);
7
13
  const ALLOWED_TOP_LEVEL_DIRECTORIES = new Set([
8
14
  'pjm',
9
15
  'reference',
@@ -435,5 +441,69 @@ export async function runPjmDoctorChecks(repoRoot, options = {}) {
435
441
  ? undefined
436
442
  : 'Run `oat backlog archive <id>` to archive each completed item still under items/.',
437
443
  });
444
+ const defaultRemote = await resolveDefaultRemoteDoctorInput(projectRoot, repoRoot);
445
+ checks.push(...(await runRemoteDoctorChecks(options.remote ?? defaultRemote)));
438
446
  return checks;
439
447
  }
448
+ async function resolveDefaultRemoteDoctorInput(projectRoot, pjmRepoRoot) {
449
+ const rawConfig = await readRawRemoteConfig(projectRoot);
450
+ const stateStorage = isRecord(rawConfig) &&
451
+ isRecord(rawConfig.storage) &&
452
+ rawConfig.storage.state === 'shared'
453
+ ? 'shared'
454
+ : 'local';
455
+ try {
456
+ const [{ stdout: commonDirOutput }, { stdout: originOutput }] = await Promise.all([
457
+ execFileAsync('git', ['rev-parse', '--git-common-dir'], {
458
+ cwd: projectRoot,
459
+ }),
460
+ execFileAsync('git', ['config', '--get', 'remote.origin.url'], {
461
+ cwd: projectRoot,
462
+ }).catch(() => ({ stdout: '' })),
463
+ ]);
464
+ const commonDir = commonDirOutput.trim();
465
+ const gitCommonDir = isAbsolute(commonDir)
466
+ ? commonDir
467
+ : resolve(projectRoot, commonDir);
468
+ const repositoryIdentity = originOutput.trim() || `local-repository:${resolve(projectRoot)}`;
469
+ const locations = resolveRemoteStorageLocations({
470
+ repoRoot: projectRoot,
471
+ gitCommonDir,
472
+ repositoryIdentity,
473
+ stateStorage,
474
+ target: { kind: 'backlog', scope: 'shared', path: null },
475
+ });
476
+ return {
477
+ portableBindingsDir: locations.portable.bindingsDir,
478
+ operationalBindingsDir: locations.operational.bindingsDir,
479
+ operationsDir: locations.operational.operationsDir,
480
+ policy: rawConfig,
481
+ };
482
+ }
483
+ catch {
484
+ const fallbackRoot = join(pjmRepoRoot, 'pjm', 'remote');
485
+ return {
486
+ portableBindingsDir: join(fallbackRoot, 'bindings'),
487
+ operationalBindingsDir: join(fallbackRoot, 'state', 'bindings'),
488
+ operationsDir: join(fallbackRoot, 'state', 'operations'),
489
+ policy: rawConfig,
490
+ };
491
+ }
492
+ }
493
+ async function readRawRemoteConfig(projectRoot) {
494
+ const content = await readIfExists(join(projectRoot, '.oat', 'config.json'));
495
+ if (!content)
496
+ return undefined;
497
+ try {
498
+ const config = parseJsonConfig(content, join(projectRoot, '.oat', 'config.json'));
499
+ if (!isRecord(config) || !isRecord(config.pjm))
500
+ return undefined;
501
+ return config.pjm.remote;
502
+ }
503
+ catch {
504
+ return undefined;
505
+ }
506
+ }
507
+ function isRecord(value) {
508
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
509
+ }
@@ -6,6 +6,7 @@ import { resolvePjmAdoption } from './adoption.js';
6
6
  import { runPjmDoctorChecks } from './doctor.js';
7
7
  import { initializeRepoReference } from './init.js';
8
8
  import { migratePjmRepo, readPjmMigrationPrompt } from './migrate.js';
9
+ import { createPjmRemoteCommand } from './remote/index.js';
9
10
  interface PjmCommandDependencies {
10
11
  buildCommandContext: typeof buildCommandContext;
11
12
  resolveProjectRoot: typeof resolveProjectRoot;
@@ -15,6 +16,7 @@ interface PjmCommandDependencies {
15
16
  runPjmDoctorChecks: typeof runPjmDoctorChecks;
16
17
  migratePjmRepo: typeof migratePjmRepo;
17
18
  readPjmMigrationPrompt: typeof readPjmMigrationPrompt;
19
+ createPjmRemoteCommand: typeof createPjmRemoteCommand;
18
20
  }
19
21
  export declare function createPjmCommand(overrides?: Partial<PjmCommandDependencies>): Command;
20
22
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/pjm/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAuB,MAAM,sBAAsB,CAAC;AAGhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAA0B,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAiBnE,UAAU,sBAAsB;IAC9B,mBAAmB,EAAE,OAAO,mBAAmB,CAAC;IAChD,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;IAC5C,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,uBAAuB,EAAE,OAAO,uBAAuB,CAAC;IACxD,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,sBAAsB,EAAE,OAAO,sBAAsB,CAAC;CACvD;AA6FD,wBAAgB,gBAAgB,CAC9B,SAAS,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC9C,OAAO,CAyLT"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/pjm/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAuB,MAAM,sBAAsB,CAAC;AAGhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAA0B,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAiBxD,UAAU,sBAAsB;IAC9B,mBAAmB,EAAE,OAAO,mBAAmB,CAAC;IAChD,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;IAC5C,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,uBAAuB,EAAE,OAAO,uBAAuB,CAAC;IACxD,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,sBAAsB,EAAE,OAAO,sBAAsB,CAAC;IACtD,sBAAsB,EAAE,OAAO,sBAAsB,CAAC;CACvD;AA8FD,wBAAgB,gBAAgB,CAC9B,SAAS,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC9C,OAAO,CA0LT"}
@@ -10,6 +10,7 @@ import { resolvePjmAdoption } from './adoption.js';
10
10
  import { runPjmDoctorChecks } from './doctor.js';
11
11
  import { initializeRepoReference, INSTRUCTIONS_SYNC_HINT } from './init.js';
12
12
  import { migratePjmRepo, readPjmMigrationPrompt } from './migrate.js';
13
+ import { createPjmRemoteCommand } from './remote/index.js';
13
14
  const DEFAULT_DEPENDENCIES = {
14
15
  buildCommandContext,
15
16
  resolveProjectRoot,
@@ -19,6 +20,7 @@ const DEFAULT_DEPENDENCIES = {
19
20
  runPjmDoctorChecks,
20
21
  migratePjmRepo,
21
22
  readPjmMigrationPrompt,
23
+ createPjmRemoteCommand,
22
24
  };
23
25
  async function resolveRepoRoot(context, projectRoot, configuredRoot) {
24
26
  if (configuredRoot) {
@@ -86,6 +88,7 @@ export function createPjmCommand(overrides = {}) {
86
88
  ...overrides,
87
89
  };
88
90
  const cmd = new Command('pjm').description('Manage project-management repo reference docs');
91
+ cmd.addCommand(dependencies.createPjmRemoteCommand());
89
92
  cmd
90
93
  .command('init')
91
94
  .description('Scaffold the canonical PJM repo reference surface')
@@ -0,0 +1,60 @@
1
+ import { type ExternalActionEnvelope } from '../external-action.js';
2
+ import { type OutboundProjection } from '../outbound-projection-safety.js';
3
+ export type CrashPoint = 'after-planned' | 'after-attempt-started' | 'after-observation' | 'after-metadata' | 'after-state' | 'after-snapshot' | 'after-baseline' | 'after-association' | 'after-terminal' | null;
4
+ export interface HarnessOperation {
5
+ operationId: string;
6
+ bindingId: string;
7
+ state: 'planned' | 'attempt-started' | 'verification-pending' | 'materializing' | 'verified' | 'uncertain' | 'blocked';
8
+ previewDigest: string;
9
+ approvalDigest: string;
10
+ capabilityEvidenceDigest: string;
11
+ action: ExternalActionEnvelope | null;
12
+ observationDigest: string | null;
13
+ materializationSteps: string[];
14
+ }
15
+ export declare class FakeLifecycleStore {
16
+ readonly operations: Map<string, HarnessOperation>;
17
+ }
18
+ export declare class GenericHostExecutor {
19
+ readonly result: {
20
+ classification: 'committed' | 'unknown';
21
+ observationDigest: string;
22
+ };
23
+ calls: number;
24
+ constructor(result?: {
25
+ classification: 'committed' | 'unknown';
26
+ observationDigest: string;
27
+ });
28
+ execute(_action: ExternalActionEnvelope): Promise<{
29
+ classification: 'committed' | 'unknown';
30
+ observationDigest: string;
31
+ }>;
32
+ }
33
+ export interface LifecycleHarnessOptions {
34
+ store?: FakeLifecycleStore;
35
+ executor?: GenericHostExecutor;
36
+ now?: () => string;
37
+ id?: () => string;
38
+ readback?: () => Promise<OutboundProjection>;
39
+ }
40
+ export declare class LifecycleHarness {
41
+ readonly store: FakeLifecycleStore;
42
+ readonly executor: GenericHostExecutor;
43
+ readonly now: () => string;
44
+ readonly id: () => string;
45
+ readonly readback: () => Promise<OutboundProjection>;
46
+ constructor(options?: LifecycleHarnessOptions);
47
+ publish(input: {
48
+ operationId?: string;
49
+ bindingId: string;
50
+ provider: 'github' | 'linear' | 'jira';
51
+ context: Record<string, string>;
52
+ projection: OutboundProjection;
53
+ previewDigest: string;
54
+ approvalDigest: string;
55
+ capabilityEvidenceDigest: string;
56
+ crashAt?: CrashPoint;
57
+ }): Promise<HarnessOperation>;
58
+ private crash;
59
+ }
60
+ //# sourceMappingURL=lifecycle-harness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-harness.d.ts","sourceRoot":"","sources":["../../../../../src/commands/pjm/remote/__integration__/lifecycle-harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,MAAM,UAAU,GAClB,eAAe,GACf,uBAAuB,GACvB,mBAAmB,GACnB,gBAAgB,GAChB,aAAa,GACb,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,IAAI,CAAC;AAET,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EACD,SAAS,GACT,iBAAiB,GACjB,sBAAsB,GACtB,eAAe,GACf,UAAU,GACV,WAAW,GACX,SAAS,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,wBAAwB,EAAE,MAAM,CAAC;IACjC,MAAM,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACtC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;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AkB,CAAC;QAC/B,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;QACvB,wBAAwB,EAAE,MAAM,CAAC;QACjC,OAAO,CAAC,EAAE,UAAU,CAAC;KACtB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuH5B;IAED,OAAO,CAAC,KAAK;CAGd"}
@@ -0,0 +1,151 @@
1
+ import { buildExternalAction, } from '../external-action.js';
2
+ import { assessOutboundProjectionSafety, } from '../outbound-projection-safety.js';
3
+ export class FakeLifecycleStore {
4
+ operations = new Map();
5
+ }
6
+ export class GenericHostExecutor {
7
+ result;
8
+ calls = 0;
9
+ constructor(result = {
10
+ classification: 'committed',
11
+ observationDigest: 'sha256:observation',
12
+ }) {
13
+ this.result = result;
14
+ }
15
+ async execute(_action) {
16
+ this.calls += 1;
17
+ return this.result;
18
+ }
19
+ }
20
+ export class LifecycleHarness {
21
+ store;
22
+ executor;
23
+ now;
24
+ id;
25
+ readback;
26
+ constructor(options = {}) {
27
+ this.store = options.store ?? new FakeLifecycleStore();
28
+ this.executor = options.executor ?? new GenericHostExecutor();
29
+ this.now = options.now ?? (() => '2026-08-31T12:00:00.000Z');
30
+ this.id = options.id ?? (() => 'op_harness_001');
31
+ this.readback =
32
+ options.readback ?? (async () => ({ title: 'Published title' }));
33
+ }
34
+ async publish(input) {
35
+ const operationId = input.operationId ?? this.id();
36
+ let operation = this.store.operations.get(operationId);
37
+ if (operation?.state === 'verified' ||
38
+ operation?.state === 'blocked' ||
39
+ operation?.state === 'uncertain') {
40
+ return operation;
41
+ }
42
+ if (!operation) {
43
+ if (input.approvalDigest !== input.previewDigest) {
44
+ operation = {
45
+ operationId,
46
+ bindingId: input.bindingId,
47
+ state: 'blocked',
48
+ previewDigest: input.previewDigest,
49
+ approvalDigest: input.approvalDigest,
50
+ capabilityEvidenceDigest: input.capabilityEvidenceDigest,
51
+ action: null,
52
+ observationDigest: null,
53
+ materializationSteps: [],
54
+ };
55
+ this.store.operations.set(operationId, operation);
56
+ return operation;
57
+ }
58
+ operation = {
59
+ operationId,
60
+ bindingId: input.bindingId,
61
+ state: 'planned',
62
+ previewDigest: input.previewDigest,
63
+ approvalDigest: input.approvalDigest,
64
+ capabilityEvidenceDigest: input.capabilityEvidenceDigest,
65
+ action: null,
66
+ observationDigest: null,
67
+ materializationSteps: [],
68
+ };
69
+ this.store.operations.set(operationId, operation);
70
+ this.crash(input.crashAt, 'after-planned');
71
+ }
72
+ if (operation.capabilityEvidenceDigest !== input.capabilityEvidenceDigest) {
73
+ operation.state = 'blocked';
74
+ return operation;
75
+ }
76
+ if (operation.state === 'attempt-started') {
77
+ operation.state = 'uncertain';
78
+ return operation;
79
+ }
80
+ if (operation.state === 'planned') {
81
+ const safety = assessOutboundProjectionSafety(input.projection, {
82
+ assessedAt: this.now(),
83
+ });
84
+ operation.action = buildExternalAction({
85
+ operationId,
86
+ stepId: 'step_harness_001',
87
+ provider: input.provider,
88
+ semanticOperation: 'update',
89
+ context: input.context,
90
+ intent: { fields: input.projection },
91
+ expectedObservation: {
92
+ fields: Object.keys(input.projection),
93
+ requireIdentity: true,
94
+ stableId: null,
95
+ capabilityEvidenceDigest: input.capabilityEvidenceDigest,
96
+ },
97
+ persistedPreview: {
98
+ projectionDigest: safety.projectionDigest,
99
+ safetyResultDigest: safety.resultDigest,
100
+ },
101
+ projection: input.projection,
102
+ outboundSafety: safety,
103
+ });
104
+ operation.state = 'attempt-started';
105
+ this.crash(input.crashAt, 'after-attempt-started');
106
+ const observation = await this.executor.execute(operation.action);
107
+ operation.observationDigest = observation.observationDigest;
108
+ if (observation.classification === 'unknown') {
109
+ operation.state = 'uncertain';
110
+ return operation;
111
+ }
112
+ operation.state = 'verification-pending';
113
+ this.crash(input.crashAt, 'after-observation');
114
+ }
115
+ if (operation.state === 'verification-pending') {
116
+ try {
117
+ const observed = await this.readback();
118
+ if (!Object.entries(input.projection).every(([field, value]) => observed[field] === value)) {
119
+ operation.state = 'uncertain';
120
+ return operation;
121
+ }
122
+ operation.state = 'materializing';
123
+ }
124
+ catch {
125
+ operation.state = 'uncertain';
126
+ return operation;
127
+ }
128
+ }
129
+ if (operation.state === 'materializing') {
130
+ for (const step of [
131
+ 'metadata',
132
+ 'state',
133
+ 'snapshot',
134
+ 'baseline',
135
+ 'association',
136
+ ]) {
137
+ if (operation.materializationSteps.includes(step))
138
+ continue;
139
+ operation.materializationSteps.push(step);
140
+ this.crash(input.crashAt, `after-${step}`);
141
+ }
142
+ operation.state = 'verified';
143
+ this.crash(input.crashAt, 'after-terminal');
144
+ }
145
+ return operation;
146
+ }
147
+ crash(configured, actual) {
148
+ if (configured === actual)
149
+ throw new Error(`crash:${actual}`);
150
+ }
151
+ }
@@ -0,0 +1,27 @@
1
+ export type AssociatedIssueRef = {
2
+ kind: 'legacy-scalar';
3
+ ref: string;
4
+ } | {
5
+ kind: 'reference';
6
+ type: string;
7
+ ref: string;
8
+ bindingId?: string;
9
+ } | {
10
+ kind: 'preserved';
11
+ value: unknown;
12
+ };
13
+ export type SerializedAssociatedIssue = string | {
14
+ type: string;
15
+ ref: string;
16
+ binding?: string;
17
+ } | unknown;
18
+ export declare function parseAssociatedIssues(value: unknown): AssociatedIssueRef[];
19
+ export declare function serializeAssociatedIssues(refs: readonly AssociatedIssueRef[]): SerializedAssociatedIssue[];
20
+ export declare function findDanglingAssociatedIssueBindings(refs: readonly AssociatedIssueRef[], knownBindingIds: ReadonlySet<string>): string[];
21
+ export declare function isAssociationAuthorizing(_ref: AssociatedIssueRef): false;
22
+ export declare function materializeBoundAssociation(existing: readonly AssociatedIssueRef[], input: {
23
+ type: string;
24
+ ref: string;
25
+ bindingId: string;
26
+ }): AssociatedIssueRef[];
27
+ //# sourceMappingURL=association.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"association.d.ts","sourceRoot":"","sources":["../../../../src/commands/pjm/remote/association.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACtC;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1C,MAAM,MAAM,yBAAyB,GACjC,MAAM,GACN;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/C,OAAO,CAAC;AAEZ,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,EAAE,CA0B1E;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,SAAS,kBAAkB,EAAE,GAClC,yBAAyB,EAAE,CAU7B;AAED,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,SAAS,kBAAkB,EAAE,EACnC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,GACnC,MAAM,EAAE,CAYV;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,kBAAkB,GAAG,KAAK,CAExE;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,EACvC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACtD,kBAAkB,EAAE,CAoBtB"}
@@ -0,0 +1,68 @@
1
+ export function parseAssociatedIssues(value) {
2
+ if (!Array.isArray(value))
3
+ return [];
4
+ return value.map((entry) => {
5
+ if (typeof entry === 'string') {
6
+ return { kind: 'legacy-scalar', ref: entry };
7
+ }
8
+ if (isRecord(entry) &&
9
+ typeof entry.type === 'string' &&
10
+ entry.type.length > 0 &&
11
+ typeof entry.ref === 'string' &&
12
+ entry.ref.length > 0 &&
13
+ (entry.binding === undefined ||
14
+ (typeof entry.binding === 'string' && entry.binding.length > 0))) {
15
+ return {
16
+ kind: 'reference',
17
+ type: entry.type,
18
+ ref: entry.ref,
19
+ ...(typeof entry.binding === 'string'
20
+ ? { bindingId: entry.binding }
21
+ : {}),
22
+ };
23
+ }
24
+ return { kind: 'preserved', value: entry };
25
+ });
26
+ }
27
+ export function serializeAssociatedIssues(refs) {
28
+ return refs.map((ref) => {
29
+ if (ref.kind === 'legacy-scalar')
30
+ return ref.ref;
31
+ if (ref.kind === 'preserved')
32
+ return ref.value;
33
+ return {
34
+ type: ref.type,
35
+ ref: ref.ref,
36
+ ...(ref.bindingId ? { binding: ref.bindingId } : {}),
37
+ };
38
+ });
39
+ }
40
+ export function findDanglingAssociatedIssueBindings(refs, knownBindingIds) {
41
+ return [
42
+ ...new Set(refs.flatMap((ref) => ref.kind === 'reference' &&
43
+ ref.bindingId &&
44
+ !knownBindingIds.has(ref.bindingId)
45
+ ? [ref.bindingId]
46
+ : [])),
47
+ ];
48
+ }
49
+ export function isAssociationAuthorizing(_ref) {
50
+ return false;
51
+ }
52
+ export function materializeBoundAssociation(existing, input) {
53
+ if (existing.some((entry) => entry.kind === 'reference' && entry.bindingId === input.bindingId)) {
54
+ throw new Error(`Association for binding '${input.bindingId}' already exists.`);
55
+ }
56
+ return [
57
+ ...existing,
58
+ {
59
+ kind: 'reference',
60
+ type: input.type,
61
+ ref: input.ref,
62
+ bindingId: input.bindingId,
63
+ },
64
+ ];
65
+ }
66
+ function isRecord(value) {
67
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
68
+ }
@@ -0,0 +1,210 @@
1
+ import type { OatPjmRemoteDescriptionMode, OatPjmRemoteMutationAuthority, OatPjmRemoteOperationClass } from '../../../config/oat-config.js';
2
+ import { z } from 'zod';
3
+ import { type BindingPreview, type PreviewApproval } from './preview.js';
4
+ interface AuthorityLayerInput {
5
+ default?: unknown;
6
+ operations?: Partial<Record<OatPjmRemoteOperationClass, unknown>>;
7
+ }
8
+ interface PolicyLayerInput {
9
+ description?: unknown;
10
+ authority?: AuthorityLayerInput;
11
+ }
12
+ export interface ResolveEffectiveRemotePolicyInput {
13
+ repository: PolicyLayerInput;
14
+ provider?: PolicyLayerInput;
15
+ binding?: PolicyLayerInput;
16
+ completeDescriptionReplacement?: boolean;
17
+ }
18
+ export interface AuthorityResolutionTrace {
19
+ builtIn: 'read-only';
20
+ repository: {
21
+ value: OatPjmRemoteMutationAuthority;
22
+ source: 'built-in' | 'default' | 'operation';
23
+ };
24
+ provider: {
25
+ value: OatPjmRemoteMutationAuthority | null;
26
+ source: 'inherit' | 'default' | 'operation';
27
+ };
28
+ bindingDefault: OatPjmRemoteMutationAuthority | null;
29
+ bindingOperation: OatPjmRemoteMutationAuthority | null;
30
+ hardFloor: 'user-approved' | null;
31
+ final: OatPjmRemoteMutationAuthority;
32
+ }
33
+ export interface EffectiveRemotePolicy {
34
+ description: OatPjmRemoteDescriptionMode;
35
+ descriptionTrace: {
36
+ builtIn: 'none';
37
+ repository: OatPjmRemoteDescriptionMode;
38
+ provider: OatPjmRemoteDescriptionMode | null;
39
+ binding: OatPjmRemoteDescriptionMode | null;
40
+ final: OatPjmRemoteDescriptionMode;
41
+ };
42
+ authority: Record<OatPjmRemoteOperationClass, OatPjmRemoteMutationAuthority>;
43
+ authorityTrace: Record<OatPjmRemoteOperationClass, AuthorityResolutionTrace>;
44
+ hardFloors: Array<'replace-description' | 'destructive' | 'identity-resolution'>;
45
+ findings: string[];
46
+ }
47
+ export declare const ProductionMutationInvocationSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
48
+ schemaVersion: z.ZodLiteral<1>;
49
+ kind: z.ZodLiteral<"interactive">;
50
+ sourceId: z.ZodString;
51
+ invocationId: z.ZodString;
52
+ issuedAt: z.ZodString;
53
+ expiresAt: z.ZodString;
54
+ instruction: z.ZodObject<{
55
+ operationClass: z.ZodEnum<["create", "update-fields", "transition", "annotate", "delete", "relink", "detach", "recreate"]>;
56
+ targetId: z.ZodString;
57
+ } & {
58
+ evidenceDigest: z.ZodString;
59
+ }, "strict", z.ZodTypeAny, {
60
+ operationClass: "annotate" | "create" | "delete" | "detach" | "recreate" | "relink" | "transition" | "update-fields";
61
+ targetId: string;
62
+ evidenceDigest: string;
63
+ }, {
64
+ operationClass: "annotate" | "create" | "delete" | "detach" | "recreate" | "relink" | "transition" | "update-fields";
65
+ targetId: string;
66
+ evidenceDigest: string;
67
+ }>;
68
+ approval: z.ZodNullable<z.ZodObject<{
69
+ previewDigest: z.ZodString;
70
+ operationClass: z.ZodEnum<["create", "update-fields", "transition", "annotate", "delete", "relink", "detach", "recreate"]>;
71
+ approvedAt: z.ZodString;
72
+ actor: z.ZodString;
73
+ source: z.ZodString;
74
+ }, "strict", z.ZodTypeAny, {
75
+ previewDigest: string;
76
+ operationClass: "annotate" | "create" | "delete" | "detach" | "recreate" | "relink" | "transition" | "update-fields";
77
+ approvedAt: string;
78
+ actor: string;
79
+ source: string;
80
+ }, {
81
+ previewDigest: string;
82
+ operationClass: "annotate" | "create" | "delete" | "detach" | "recreate" | "relink" | "transition" | "update-fields";
83
+ approvedAt: string;
84
+ actor: string;
85
+ source: string;
86
+ }>>;
87
+ }, "strict", z.ZodTypeAny, {
88
+ schemaVersion: 1;
89
+ kind: "interactive";
90
+ sourceId: string;
91
+ invocationId: string;
92
+ issuedAt: string;
93
+ expiresAt: string;
94
+ instruction: {
95
+ operationClass: "annotate" | "create" | "delete" | "detach" | "recreate" | "relink" | "transition" | "update-fields";
96
+ targetId: string;
97
+ evidenceDigest: string;
98
+ };
99
+ approval: {
100
+ previewDigest: string;
101
+ operationClass: "annotate" | "create" | "delete" | "detach" | "recreate" | "relink" | "transition" | "update-fields";
102
+ approvedAt: string;
103
+ actor: string;
104
+ source: string;
105
+ } | null;
106
+ }, {
107
+ schemaVersion: 1;
108
+ kind: "interactive";
109
+ sourceId: string;
110
+ invocationId: string;
111
+ issuedAt: string;
112
+ expiresAt: string;
113
+ instruction: {
114
+ operationClass: "annotate" | "create" | "delete" | "detach" | "recreate" | "relink" | "transition" | "update-fields";
115
+ targetId: string;
116
+ evidenceDigest: string;
117
+ };
118
+ approval: {
119
+ previewDigest: string;
120
+ operationClass: "annotate" | "create" | "delete" | "detach" | "recreate" | "relink" | "transition" | "update-fields";
121
+ approvedAt: string;
122
+ actor: string;
123
+ source: string;
124
+ } | null;
125
+ }>, z.ZodObject<{
126
+ schemaVersion: z.ZodLiteral<1>;
127
+ kind: z.ZodLiteral<"workflow">;
128
+ sourceId: z.ZodString;
129
+ invocationId: z.ZodString;
130
+ issuedAt: z.ZodString;
131
+ expiresAt: z.ZodString;
132
+ operationClass: z.ZodEnum<["create", "update-fields", "transition", "annotate", "delete", "relink", "detach", "recreate"]>;
133
+ targetId: z.ZodString;
134
+ workflowId: z.ZodString;
135
+ revision: z.ZodString;
136
+ }, "strict", z.ZodTypeAny, {
137
+ schemaVersion: 1;
138
+ kind: "workflow";
139
+ sourceId: string;
140
+ invocationId: string;
141
+ issuedAt: string;
142
+ expiresAt: string;
143
+ operationClass: "annotate" | "create" | "delete" | "detach" | "recreate" | "relink" | "transition" | "update-fields";
144
+ targetId: string;
145
+ workflowId: string;
146
+ revision: string;
147
+ }, {
148
+ schemaVersion: 1;
149
+ kind: "workflow";
150
+ sourceId: string;
151
+ invocationId: string;
152
+ issuedAt: string;
153
+ expiresAt: string;
154
+ operationClass: "annotate" | "create" | "delete" | "detach" | "recreate" | "relink" | "transition" | "update-fields";
155
+ targetId: string;
156
+ workflowId: string;
157
+ revision: string;
158
+ }>]>;
159
+ export type ProductionMutationInvocation = z.infer<typeof ProductionMutationInvocationSchema>;
160
+ export declare function parseProductionMutationInvocation(value: unknown): ProductionMutationInvocation;
161
+ export declare function validateProductionMutationAuthority(input: {
162
+ effective: OatPjmRemoteMutationAuthority;
163
+ invocation: ProductionMutationInvocation | null;
164
+ preview: BindingPreview;
165
+ expected: {
166
+ operationClass: OatPjmRemoteOperationClass;
167
+ targetId: string;
168
+ workflowId: string;
169
+ workflowRevision: string;
170
+ };
171
+ now: string;
172
+ approvalMaxAgeMs: number;
173
+ }): {
174
+ authority: {
175
+ effective: OatPjmRemoteMutationAuthority;
176
+ sourceDigest: string;
177
+ };
178
+ approval: PreviewApproval | null;
179
+ };
180
+ export declare function assessProductionMutationAuthority(input: {
181
+ effective: OatPjmRemoteMutationAuthority;
182
+ invocation: ProductionMutationInvocation | null;
183
+ preview: BindingPreview;
184
+ expected: {
185
+ operationClass: OatPjmRemoteOperationClass;
186
+ targetId: string;
187
+ workflowId: string;
188
+ workflowRevision: string;
189
+ };
190
+ now: string;
191
+ approvalMaxAgeMs: number;
192
+ }): {
193
+ status: 'ready';
194
+ authority: {
195
+ effective: OatPjmRemoteMutationAuthority;
196
+ sourceDigest: string;
197
+ };
198
+ approval: PreviewApproval | null;
199
+ } | {
200
+ status: 'needs-review';
201
+ authority: {
202
+ effective: 'user-approved';
203
+ sourceDigest: string;
204
+ };
205
+ approval: null;
206
+ previewDigest: string;
207
+ };
208
+ export declare function resolveEffectiveRemotePolicy(input: ResolveEffectiveRemotePolicyInput): EffectiveRemotePolicy;
209
+ export {};
210
+ //# sourceMappingURL=authority.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authority.d.ts","sourceRoot":"","sources":["../../../../src/commands/pjm/remote/authority.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,EAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,WAAW,CAAC;AAGnB,UAAU,mBAAmB;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC,CAAC;CACnE;AAED,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