@open-agent-toolkit/cli 0.2.65 → 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 (142) 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/reference/cli-reference.md +12 -1
  6. package/assets/docs/reference/file-locations.md +22 -0
  7. package/assets/docs/reference/oat-directory-structure.md +30 -17
  8. package/assets/docs/reference/troubleshooting.md +44 -0
  9. package/assets/docs/workflows/skills/index.md +33 -0
  10. package/assets/public-package-versions.json +4 -4
  11. package/assets/skills/oat-doctor/SKILL.md +4 -4
  12. package/assets/skills/oat-pjm-remote/SKILL.md +101 -0
  13. package/assets/skills/oat-pjm-remote/references/external-action-protocol.md +43 -0
  14. package/dist/commands/backlog/new.d.ts +1 -0
  15. package/dist/commands/backlog/new.d.ts.map +1 -1
  16. package/dist/commands/backlog/new.js +3 -1
  17. package/dist/commands/config/index.d.ts +1 -0
  18. package/dist/commands/config/index.d.ts.map +1 -1
  19. package/dist/commands/config/index.js +232 -1
  20. package/dist/commands/pjm/doctor.d.ts +2 -0
  21. package/dist/commands/pjm/doctor.d.ts.map +1 -1
  22. package/dist/commands/pjm/doctor.js +71 -1
  23. package/dist/commands/pjm/index.d.ts +2 -0
  24. package/dist/commands/pjm/index.d.ts.map +1 -1
  25. package/dist/commands/pjm/index.js +3 -0
  26. package/dist/commands/pjm/remote/__integration__/lifecycle-harness.d.ts +60 -0
  27. package/dist/commands/pjm/remote/__integration__/lifecycle-harness.d.ts.map +1 -0
  28. package/dist/commands/pjm/remote/__integration__/lifecycle-harness.js +151 -0
  29. package/dist/commands/pjm/remote/association.d.ts +27 -0
  30. package/dist/commands/pjm/remote/association.d.ts.map +1 -0
  31. package/dist/commands/pjm/remote/association.js +68 -0
  32. package/dist/commands/pjm/remote/authority.d.ts +210 -0
  33. package/dist/commands/pjm/remote/authority.d.ts.map +1 -0
  34. package/dist/commands/pjm/remote/authority.js +341 -0
  35. package/dist/commands/pjm/remote/batch.d.ts +15 -0
  36. package/dist/commands/pjm/remote/batch.d.ts.map +1 -0
  37. package/dist/commands/pjm/remote/batch.js +126 -0
  38. package/dist/commands/pjm/remote/closeout.d.ts +69 -0
  39. package/dist/commands/pjm/remote/closeout.d.ts.map +1 -0
  40. package/dist/commands/pjm/remote/closeout.js +208 -0
  41. package/dist/commands/pjm/remote/create-binding.d.ts +62 -0
  42. package/dist/commands/pjm/remote/create-binding.d.ts.map +1 -0
  43. package/dist/commands/pjm/remote/create-binding.js +126 -0
  44. package/dist/commands/pjm/remote/credential-safety.d.ts +7 -0
  45. package/dist/commands/pjm/remote/credential-safety.d.ts.map +1 -0
  46. package/dist/commands/pjm/remote/credential-safety.js +21 -0
  47. package/dist/commands/pjm/remote/discussion.d.ts +49 -0
  48. package/dist/commands/pjm/remote/discussion.d.ts.map +1 -0
  49. package/dist/commands/pjm/remote/discussion.js +124 -0
  50. package/dist/commands/pjm/remote/doctor.d.ts +22 -0
  51. package/dist/commands/pjm/remote/doctor.d.ts.map +1 -0
  52. package/dist/commands/pjm/remote/doctor.js +380 -0
  53. package/dist/commands/pjm/remote/external-action.d.ts +208 -0
  54. package/dist/commands/pjm/remote/external-action.d.ts.map +1 -0
  55. package/dist/commands/pjm/remote/external-action.js +367 -0
  56. package/dist/commands/pjm/remote/host-execution.d.ts +28 -0
  57. package/dist/commands/pjm/remote/host-execution.d.ts.map +1 -0
  58. package/dist/commands/pjm/remote/host-execution.js +63 -0
  59. package/dist/commands/pjm/remote/index.d.ts +41 -0
  60. package/dist/commands/pjm/remote/index.d.ts.map +1 -0
  61. package/dist/commands/pjm/remote/index.js +280 -0
  62. package/dist/commands/pjm/remote/jira-adf.d.ts +35 -0
  63. package/dist/commands/pjm/remote/jira-adf.d.ts.map +1 -0
  64. package/dist/commands/pjm/remote/jira-adf.js +169 -0
  65. package/dist/commands/pjm/remote/lifecycle.d.ts +163 -0
  66. package/dist/commands/pjm/remote/lifecycle.d.ts.map +1 -0
  67. package/dist/commands/pjm/remote/lifecycle.js +224 -0
  68. package/dist/commands/pjm/remote/local-projection.d.ts +30 -0
  69. package/dist/commands/pjm/remote/local-projection.d.ts.map +1 -0
  70. package/dist/commands/pjm/remote/local-projection.js +95 -0
  71. package/dist/commands/pjm/remote/managed-markdown.d.ts +30 -0
  72. package/dist/commands/pjm/remote/managed-markdown.d.ts.map +1 -0
  73. package/dist/commands/pjm/remote/managed-markdown.js +128 -0
  74. package/dist/commands/pjm/remote/migrate.d.ts +14 -0
  75. package/dist/commands/pjm/remote/migrate.d.ts.map +1 -0
  76. package/dist/commands/pjm/remote/migrate.js +32 -0
  77. package/dist/commands/pjm/remote/operation-state.d.ts +15 -0
  78. package/dist/commands/pjm/remote/operation-state.d.ts.map +1 -0
  79. package/dist/commands/pjm/remote/operation-state.js +143 -0
  80. package/dist/commands/pjm/remote/outbound-projection-safety.d.ts +25 -0
  81. package/dist/commands/pjm/remote/outbound-projection-safety.d.ts.map +1 -0
  82. package/dist/commands/pjm/remote/outbound-projection-safety.js +99 -0
  83. package/dist/commands/pjm/remote/output.d.ts +60 -0
  84. package/dist/commands/pjm/remote/output.d.ts.map +1 -0
  85. package/dist/commands/pjm/remote/output.js +48 -0
  86. package/dist/commands/pjm/remote/preview.d.ts +88 -0
  87. package/dist/commands/pjm/remote/preview.d.ts.map +1 -0
  88. package/dist/commands/pjm/remote/preview.js +154 -0
  89. package/dist/commands/pjm/remote/provider-conformance.d.ts +13 -0
  90. package/dist/commands/pjm/remote/provider-conformance.d.ts.map +1 -0
  91. package/dist/commands/pjm/remote/provider-conformance.js +37 -0
  92. package/dist/commands/pjm/remote/provider.d.ts +57 -0
  93. package/dist/commands/pjm/remote/provider.d.ts.map +1 -0
  94. package/dist/commands/pjm/remote/provider.js +28 -0
  95. package/dist/commands/pjm/remote/providers/github-publication-safety.d.ts +46 -0
  96. package/dist/commands/pjm/remote/providers/github-publication-safety.d.ts.map +1 -0
  97. package/dist/commands/pjm/remote/providers/github-publication-safety.js +126 -0
  98. package/dist/commands/pjm/remote/providers/github.d.ts +207 -0
  99. package/dist/commands/pjm/remote/providers/github.d.ts.map +1 -0
  100. package/dist/commands/pjm/remote/providers/github.js +1456 -0
  101. package/dist/commands/pjm/remote/providers/jira.d.ts +245 -0
  102. package/dist/commands/pjm/remote/providers/jira.d.ts.map +1 -0
  103. package/dist/commands/pjm/remote/providers/jira.js +1650 -0
  104. package/dist/commands/pjm/remote/providers/linear.d.ts +182 -0
  105. package/dist/commands/pjm/remote/providers/linear.d.ts.map +1 -0
  106. package/dist/commands/pjm/remote/providers/linear.js +1289 -0
  107. package/dist/commands/pjm/remote/purpose-policy.d.ts +29 -0
  108. package/dist/commands/pjm/remote/purpose-policy.d.ts.map +1 -0
  109. package/dist/commands/pjm/remote/purpose-policy.js +118 -0
  110. package/dist/commands/pjm/remote/reconcile.d.ts +42 -0
  111. package/dist/commands/pjm/remote/reconcile.d.ts.map +1 -0
  112. package/dist/commands/pjm/remote/reconcile.js +101 -0
  113. package/dist/commands/pjm/remote/resolution.d.ts +122 -0
  114. package/dist/commands/pjm/remote/resolution.d.ts.map +1 -0
  115. package/dist/commands/pjm/remote/resolution.js +243 -0
  116. package/dist/commands/pjm/remote/schema.d.ts +9309 -0
  117. package/dist/commands/pjm/remote/schema.d.ts.map +1 -0
  118. package/dist/commands/pjm/remote/schema.js +1503 -0
  119. package/dist/commands/pjm/remote/service.d.ts +20 -0
  120. package/dist/commands/pjm/remote/service.d.ts.map +1 -0
  121. package/dist/commands/pjm/remote/service.js +5121 -0
  122. package/dist/commands/pjm/remote/shared-storage.d.ts +36 -0
  123. package/dist/commands/pjm/remote/shared-storage.d.ts.map +1 -0
  124. package/dist/commands/pjm/remote/shared-storage.js +110 -0
  125. package/dist/commands/pjm/remote/snapshot.d.ts +32 -0
  126. package/dist/commands/pjm/remote/snapshot.d.ts.map +1 -0
  127. package/dist/commands/pjm/remote/snapshot.js +140 -0
  128. package/dist/commands/pjm/remote/storage-locator.d.ts +29 -0
  129. package/dist/commands/pjm/remote/storage-locator.d.ts.map +1 -0
  130. package/dist/commands/pjm/remote/storage-locator.js +62 -0
  131. package/dist/commands/pjm/remote/store.d.ts +85 -0
  132. package/dist/commands/pjm/remote/store.d.ts.map +1 -0
  133. package/dist/commands/pjm/remote/store.js +553 -0
  134. package/dist/commands/pjm/remote/verification.d.ts +40 -0
  135. package/dist/commands/pjm/remote/verification.d.ts.map +1 -0
  136. package/dist/commands/pjm/remote/verification.js +100 -0
  137. package/dist/commands/tools/shared/pack-manifest.d.ts.map +1 -1
  138. package/dist/commands/tools/shared/pack-manifest.js +1 -0
  139. package/dist/config/oat-config.d.ts +26 -0
  140. package/dist/config/oat-config.d.ts.map +1 -1
  141. package/dist/config/oat-config.js +186 -2
  142. package/package.json +2 -2
@@ -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;AAED,qBAAa,kBAAkB;IAC7B,QAAQ,CAAC,UAAU,gCAAuC;CAC3D;AAED,qBAAa,mBAAmB;IAG5B,QAAQ,CAAC,MAAM,EAAE;QACf,cAAc,EAAE,WAAW,GAAG,SAAS,CAAC;QACxC,iBAAiB,EAAE,MAAM,CAAC;KAC3B;IALH,KAAK,SAAK;IACV,YACW,MAAM,GAAE;QACf,cAAc,EAAE,WAAW,GAAG,SAAS,CAAC;QACxC,iBAAi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Safety, } 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,UAAU,gBAAgB;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,mBAAmB,CAAC;CACjC;AAED,MAAM,WAAW,iCAAiC;IAChD,UAAU,EAAE,gBAAgB,CAAC;IAC7B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,8BAA8B,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED,MA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