@agent-teams/docs-protocol-agent-teams 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE +201 -0
- package/README.md +24 -0
- package/assets/catalog.json +1 -0
- package/assets/docs-protocol.yml +14 -0
- package/assets/history/sha256-097df9fe1b90ab45f73389c8b69736f8a54d4199b09536d586222b5a7f0fbb09/caller.yml +13 -0
- package/assets/history/sha256-3e53262efc8a530b532380dac21d876456473d3b88aba20889a1d24823bf3a1b/caller.yml +14 -0
- package/assets/history/sha256-51d3f02a352ce2c3b0a4068a86b6899a57ab54b0a876c468e3fb3e536519caca/caller.yml +14 -0
- package/assets/history/sha256-641265ef9ecff59c16482fdae1bc8fc56002b5a4a1ee34b102438d0ca08a86a3/skill.md +29 -0
- package/assets/history/sha256-7907195753506e4b0f0e89eb3f6e495bacbd79e9b9913c9f60fc4a07dffb22e5/caller.yml +14 -0
- package/assets/history/sha256-7b31cd257532247f64c55a014dc926c601e4d742176cfb8513b6b0d8ab48213e/skill.md +28 -0
- package/assets/history/sha256-d697c5c7c9bcfccfc006fcf7e4d4cc8e7c629f9689781b9b0b50f30d82bc019e/caller.yml +14 -0
- package/assets/history/sha256-f21dc19277a4ba24bcef90a7071c9cf50adf144769f42d6f74ff4eac9ef117cf/caller.yml +14 -0
- package/assets/history/sha256-fd633c3c6337e5cfe51a9f36989bb654381634c5ab4add9e4da71fe40ab4e0dd/caller.yml +14 -0
- package/assets/transition-catalog.json +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -0
- package/dist/composition/managed-cli-input.d.ts +11 -0
- package/dist/composition/managed-cli-input.d.ts.map +1 -0
- package/dist/composition/managed-cli-input.js +52 -0
- package/dist/composition/managed-cli-input.js.map +1 -0
- package/dist/composition/managed-cli.d.ts +2 -0
- package/dist/composition/managed-cli.d.ts.map +1 -0
- package/dist/composition/managed-cli.js +17 -0
- package/dist/composition/managed-cli.js.map +1 -0
- package/dist/composition/qualification-cli.d.ts +2 -0
- package/dist/composition/qualification-cli.d.ts.map +1 -0
- package/dist/composition/qualification-cli.js +119 -0
- package/dist/composition/qualification-cli.js.map +1 -0
- package/dist/consumer-integration/adapters/agents-route-adapter-v1.d.ts +10 -0
- package/dist/consumer-integration/adapters/agents-route-adapter-v1.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/agents-route-adapter-v1.js +99 -0
- package/dist/consumer-integration/adapters/agents-route-adapter-v1.js.map +1 -0
- package/dist/consumer-integration/adapters/bounded-repository-topology.d.ts +8 -0
- package/dist/consumer-integration/adapters/bounded-repository-topology.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/bounded-repository-topology.js +80 -0
- package/dist/consumer-integration/adapters/bounded-repository-topology.js.map +1 -0
- package/dist/consumer-integration/adapters/consumer-integration-node-error.d.ts +5 -0
- package/dist/consumer-integration/adapters/consumer-integration-node-error.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/consumer-integration-node-error.js +9 -0
- package/dist/consumer-integration/adapters/consumer-integration-node-error.js.map +1 -0
- package/dist/consumer-integration/adapters/consumer-integration-schema-validator.d.ts +4 -0
- package/dist/consumer-integration/adapters/consumer-integration-schema-validator.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/consumer-integration-schema-validator.js +51 -0
- package/dist/consumer-integration/adapters/consumer-integration-schema-validator.js.map +1 -0
- package/dist/consumer-integration/adapters/consumer-upgrade-file-projectors.d.ts +21 -0
- package/dist/consumer-integration/adapters/consumer-upgrade-file-projectors.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/consumer-upgrade-file-projectors.js +145 -0
- package/dist/consumer-integration/adapters/consumer-upgrade-file-projectors.js.map +1 -0
- package/dist/consumer-integration/adapters/foundation-known-file-transaction.d.ts +3 -0
- package/dist/consumer-integration/adapters/foundation-known-file-transaction.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/foundation-known-file-transaction.js +7 -0
- package/dist/consumer-integration/adapters/foundation-known-file-transaction.js.map +1 -0
- package/dist/consumer-integration/adapters/github-cohort-authority-reader.d.ts +21 -0
- package/dist/consumer-integration/adapters/github-cohort-authority-reader.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/github-cohort-authority-reader.js +215 -0
- package/dist/consumer-integration/adapters/github-cohort-authority-reader.js.map +1 -0
- package/dist/consumer-integration/adapters/node-consumer-integration-repository.d.ts +13 -0
- package/dist/consumer-integration/adapters/node-consumer-integration-repository.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/node-consumer-integration-repository.js +213 -0
- package/dist/consumer-integration/adapters/node-consumer-integration-repository.js.map +1 -0
- package/dist/consumer-integration/adapters/node-consumer-repository-files.d.ts +11 -0
- package/dist/consumer-integration/adapters/node-consumer-repository-files.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/node-consumer-repository-files.js +81 -0
- package/dist/consumer-integration/adapters/node-consumer-repository-files.js.map +1 -0
- package/dist/consumer-integration/adapters/node-consumer-upgrade-sandbox.d.ts +19 -0
- package/dist/consumer-integration/adapters/node-consumer-upgrade-sandbox.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/node-consumer-upgrade-sandbox.js +307 -0
- package/dist/consumer-integration/adapters/node-consumer-upgrade-sandbox.js.map +1 -0
- package/dist/consumer-integration/adapters/package-consumer-asset-catalog.d.ts +5 -0
- package/dist/consumer-integration/adapters/package-consumer-asset-catalog.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/package-consumer-asset-catalog.js +150 -0
- package/dist/consumer-integration/adapters/package-consumer-asset-catalog.js.map +1 -0
- package/dist/consumer-integration/adapters/pnpm-lockfile-policy-v1.d.ts +3 -0
- package/dist/consumer-integration/adapters/pnpm-lockfile-policy-v1.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/pnpm-lockfile-policy-v1.js +37 -0
- package/dist/consumer-integration/adapters/pnpm-lockfile-policy-v1.js.map +1 -0
- package/dist/consumer-integration/adapters/pnpm-lockfile-validator-v1.d.ts +3 -0
- package/dist/consumer-integration/adapters/pnpm-lockfile-validator-v1.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/pnpm-lockfile-validator-v1.js +120 -0
- package/dist/consumer-integration/adapters/pnpm-lockfile-validator-v1.js.map +1 -0
- package/dist/consumer-integration/adapters/pnpm-manifest-adapter-v1.d.ts +15 -0
- package/dist/consumer-integration/adapters/pnpm-manifest-adapter-v1.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/pnpm-manifest-adapter-v1.js +189 -0
- package/dist/consumer-integration/adapters/pnpm-manifest-adapter-v1.js.map +1 -0
- package/dist/consumer-integration/adapters/pnpm-runtime-closure-v1.d.ts +8 -0
- package/dist/consumer-integration/adapters/pnpm-runtime-closure-v1.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/pnpm-runtime-closure-v1.js +245 -0
- package/dist/consumer-integration/adapters/pnpm-runtime-closure-v1.js.map +1 -0
- package/dist/consumer-integration/adapters/strict-json-record.d.ts +3 -0
- package/dist/consumer-integration/adapters/strict-json-record.d.ts.map +1 -0
- package/dist/consumer-integration/adapters/strict-json-record.js +27 -0
- package/dist/consumer-integration/adapters/strict-json-record.js.map +1 -0
- package/dist/consumer-integration/application/model/consumer-integration-execution.d.ts +11 -0
- package/dist/consumer-integration/application/model/consumer-integration-execution.d.ts.map +1 -0
- package/dist/consumer-integration/application/model/consumer-integration-execution.js +2 -0
- package/dist/consumer-integration/application/model/consumer-integration-execution.js.map +1 -0
- package/dist/consumer-integration/application/model/consumer-upgrade-execution.d.ts +18 -0
- package/dist/consumer-integration/application/model/consumer-upgrade-execution.d.ts.map +1 -0
- package/dist/consumer-integration/application/model/consumer-upgrade-execution.js +2 -0
- package/dist/consumer-integration/application/model/consumer-upgrade-execution.js.map +1 -0
- package/dist/consumer-integration/application/policies/consumer-integration-assets.d.ts +58 -0
- package/dist/consumer-integration/application/policies/consumer-integration-assets.d.ts.map +1 -0
- package/dist/consumer-integration/application/policies/consumer-integration-assets.js +154 -0
- package/dist/consumer-integration/application/policies/consumer-integration-assets.js.map +1 -0
- package/dist/consumer-integration/application/policies/consumer-integration-authority-guards.d.ts +4 -0
- package/dist/consumer-integration/application/policies/consumer-integration-authority-guards.d.ts.map +1 -0
- package/dist/consumer-integration/application/policies/consumer-integration-authority-guards.js +23 -0
- package/dist/consumer-integration/application/policies/consumer-integration-authority-guards.js.map +1 -0
- package/dist/consumer-integration/application/policies/consumer-integration-desired-state.d.ts +4 -0
- package/dist/consumer-integration/application/policies/consumer-integration-desired-state.d.ts.map +1 -0
- package/dist/consumer-integration/application/policies/consumer-integration-desired-state.js +153 -0
- package/dist/consumer-integration/application/policies/consumer-integration-desired-state.js.map +1 -0
- package/dist/consumer-integration/application/policies/consumer-integration-prior-cohort.d.ts +14 -0
- package/dist/consumer-integration/application/policies/consumer-integration-prior-cohort.d.ts.map +1 -0
- package/dist/consumer-integration/application/policies/consumer-integration-prior-cohort.js +186 -0
- package/dist/consumer-integration/application/policies/consumer-integration-prior-cohort.js.map +1 -0
- package/dist/consumer-integration/application/ports/consumer-integration-lifecycle.d.ts +31 -0
- package/dist/consumer-integration/application/ports/consumer-integration-lifecycle.d.ts.map +1 -0
- package/dist/consumer-integration/application/ports/consumer-integration-lifecycle.js +2 -0
- package/dist/consumer-integration/application/ports/consumer-integration-lifecycle.js.map +1 -0
- package/dist/consumer-integration/application/ports/consumer-integration-planners.d.ts +35 -0
- package/dist/consumer-integration/application/ports/consumer-integration-planners.d.ts.map +1 -0
- package/dist/consumer-integration/application/ports/consumer-integration-planners.js +2 -0
- package/dist/consumer-integration/application/ports/consumer-integration-planners.js.map +1 -0
- package/dist/consumer-integration/application/ports/consumer-upgrade.d.ts +28 -0
- package/dist/consumer-integration/application/ports/consumer-upgrade.d.ts.map +1 -0
- package/dist/consumer-integration/application/ports/consumer-upgrade.js +2 -0
- package/dist/consumer-integration/application/ports/consumer-upgrade.js.map +1 -0
- package/dist/consumer-integration/application/use-cases/plan-consumer-integration.d.ts +15 -0
- package/dist/consumer-integration/application/use-cases/plan-consumer-integration.d.ts.map +1 -0
- package/dist/consumer-integration/application/use-cases/plan-consumer-integration.js +350 -0
- package/dist/consumer-integration/application/use-cases/plan-consumer-integration.js.map +1 -0
- package/dist/consumer-integration/application/use-cases/run-consumer-integration.d.ts +29 -0
- package/dist/consumer-integration/application/use-cases/run-consumer-integration.d.ts.map +1 -0
- package/dist/consumer-integration/application/use-cases/run-consumer-integration.js +139 -0
- package/dist/consumer-integration/application/use-cases/run-consumer-integration.js.map +1 -0
- package/dist/consumer-integration/application/use-cases/upgrade-consumer-integration.d.ts +13 -0
- package/dist/consumer-integration/application/use-cases/upgrade-consumer-integration.d.ts.map +1 -0
- package/dist/consumer-integration/application/use-cases/upgrade-consumer-integration.js +134 -0
- package/dist/consumer-integration/application/use-cases/upgrade-consumer-integration.js.map +1 -0
- package/dist/consumer-integration/composition/consumer-integration-cli.d.ts +3 -0
- package/dist/consumer-integration/composition/consumer-integration-cli.d.ts.map +1 -0
- package/dist/consumer-integration/composition/consumer-integration-cli.js +241 -0
- package/dist/consumer-integration/composition/consumer-integration-cli.js.map +1 -0
- package/dist/consumer-integration/composition/consumer-integration-planner.d.ts +19 -0
- package/dist/consumer-integration/composition/consumer-integration-planner.d.ts.map +1 -0
- package/dist/consumer-integration/composition/consumer-integration-planner.js +14 -0
- package/dist/consumer-integration/composition/consumer-integration-planner.js.map +1 -0
- package/dist/consumer-integration/composition/node-consumer-integration.d.ts +26 -0
- package/dist/consumer-integration/composition/node-consumer-integration.d.ts.map +1 -0
- package/dist/consumer-integration/composition/node-consumer-integration.js +38 -0
- package/dist/consumer-integration/composition/node-consumer-integration.js.map +1 -0
- package/dist/consumer-integration/domain/model.d.ts +111 -0
- package/dist/consumer-integration/domain/model.d.ts.map +1 -0
- package/dist/consumer-integration/domain/model.js +2 -0
- package/dist/consumer-integration/domain/model.js.map +1 -0
- package/dist/consumer-integration/generated/canonical-assets.d.ts +5 -0
- package/dist/consumer-integration/generated/canonical-assets.d.ts.map +1 -0
- package/dist/consumer-integration/generated/canonical-assets.js +6 -0
- package/dist/consumer-integration/generated/canonical-assets.js.map +1 -0
- package/dist/consumer-integration/index.d.ts +12 -0
- package/dist/consumer-integration/index.d.ts.map +1 -0
- package/dist/consumer-integration/index.js +7 -0
- package/dist/consumer-integration/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/qualification/index.d.ts +3 -0
- package/dist/qualification/index.d.ts.map +1 -0
- package/dist/qualification/index.js +2 -0
- package/dist/qualification/index.js.map +1 -0
- package/dist/qualification/managed-command-envelope-validator.d.ts +14 -0
- package/dist/qualification/managed-command-envelope-validator.d.ts.map +1 -0
- package/dist/qualification/managed-command-envelope-validator.js +33 -0
- package/dist/qualification/managed-command-envelope-validator.js.map +1 -0
- package/dist/qualification/qualification-v2-runner.d.ts +4 -0
- package/dist/qualification/qualification-v2-runner.d.ts.map +1 -0
- package/dist/qualification/qualification-v2-runner.js +344 -0
- package/dist/qualification/qualification-v2-runner.js.map +1 -0
- package/dist/qualification/v2-contract.d.ts +91 -0
- package/dist/qualification/v2-contract.d.ts.map +1 -0
- package/dist/qualification/v2-contract.js +2 -0
- package/dist/qualification/v2-contract.js.map +1 -0
- package/package.json +66 -0
- package/schemas/docs-consumer-integration-execution/v1.schema.json +29 -0
- package/schemas/docs-consumer-integration-plan/v1.schema.json +63 -0
- package/schemas/docs-consumer-integration-profile/v1.schema.json +110 -0
- package/schemas/docs-consumer-integration-profile/v2.schema.json +283 -0
- package/schemas/docs-consumer-managed-state/v1.schema.json +99 -0
- package/schemas/docs-consumer-upgrade-execution/v1.schema.json +44 -0
- package/schemas/docs-protocol-command-envelope/v1.schema.json +239 -0
- package/schemas/docs-protocol-command-envelope/v2.schema.json +285 -0
- package/schemas/docs-protocol-command-envelope/v3.schema.json +529 -0
- package/schemas/docs-protocol-profile/v1.schema.json +46 -0
- package/schemas/docs-protocol-profile/v2.schema.json +46 -0
- package/schemas/docs-protocol-qualification/v2.schema.json +78 -0
- package/schemas/docs-protocol-qualification-receipt/v2.schema.json +113 -0
- package/schemas/qualified-docs-cohort/v1.schema.json +96 -0
- package/skills/docs/SKILL.md +29 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { compileKnownFileTransactionPlan } from "@agent-teams/repository-mutation";
|
|
2
|
+
import { compileConsumerIntegration } from "./plan-consumer-integration.js";
|
|
3
|
+
import { canonicalConsumerIntegrationJson } from "../policies/consumer-integration-assets.js";
|
|
4
|
+
function issue(code, subject, message) {
|
|
5
|
+
return Object.freeze({ code, severity: "error", subject, message });
|
|
6
|
+
}
|
|
7
|
+
function blocked(problem, authority) {
|
|
8
|
+
return Object.freeze({
|
|
9
|
+
schemaVersion: 1,
|
|
10
|
+
command: "consumer.upgrade",
|
|
11
|
+
outcome: "blocked",
|
|
12
|
+
issues: Object.freeze([problem]),
|
|
13
|
+
...(authority === undefined ? {} : { authority: authorityEvidence(authority) })
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function authorityEvidence(authority) {
|
|
17
|
+
return Object.freeze({
|
|
18
|
+
repository: authority.repository,
|
|
19
|
+
path: authority.path,
|
|
20
|
+
revision: authority.revision,
|
|
21
|
+
cohortId: authority.cohort.cohortId,
|
|
22
|
+
recordDigest: authority.cohort.recordDigest,
|
|
23
|
+
qualificationEventDigest: authority.cohort.qualificationEventDigest
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function reverseOperations(operations) {
|
|
27
|
+
return operations.map((operation) => {
|
|
28
|
+
if (operation.precondition.state !== "known-file" ||
|
|
29
|
+
operation.precondition.acceptedPreimages.length !== 1) {
|
|
30
|
+
throw new TypeError("A Cohort-to-Cohort upgrade may replace only one exact existing preimage.");
|
|
31
|
+
}
|
|
32
|
+
const preimage = operation.precondition.acceptedPreimages[0];
|
|
33
|
+
const postimageMode = operation.postimage.mode;
|
|
34
|
+
if (postimageMode === undefined) {
|
|
35
|
+
throw new TypeError("A Cohort-to-Cohort upgrade postimage must retain an exact file mode.");
|
|
36
|
+
}
|
|
37
|
+
return Object.freeze({
|
|
38
|
+
path: operation.path,
|
|
39
|
+
precondition: {
|
|
40
|
+
state: "known-file",
|
|
41
|
+
acceptedPreimages: [{ bytes: operation.postimage.bytes, mode: postimageMode }]
|
|
42
|
+
},
|
|
43
|
+
postimage: { bytes: preimage.bytes, mode: preimage.mode }
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export function createConsumerUpgradeUseCase(ports) {
|
|
48
|
+
return async function upgrade(options) {
|
|
49
|
+
const inspection = await ports.transaction.inspect({ consumerRoot: options.consumerRoot });
|
|
50
|
+
if (inspection.state !== "idle") {
|
|
51
|
+
return blocked(issue(inspection.code, "foundation-transaction", inspection.message));
|
|
52
|
+
}
|
|
53
|
+
const [input, assetCatalog] = await Promise.all([
|
|
54
|
+
ports.input.read({ consumerRoot: options.consumerRoot }),
|
|
55
|
+
ports.assets.read()
|
|
56
|
+
]);
|
|
57
|
+
const source = compileConsumerIntegration({
|
|
58
|
+
desired: input.desired,
|
|
59
|
+
snapshot: input.snapshot,
|
|
60
|
+
assetCatalog
|
|
61
|
+
}, ports.planning).plan;
|
|
62
|
+
if (source.outcome !== "current") {
|
|
63
|
+
return blocked(issue("DOCS_CONSUMER_UPGRADE_SOURCE_NOT_CURRENT", input.desired.cohort.cohortId, "The installed source Cohort must pass consumer check before a successor is staged."));
|
|
64
|
+
}
|
|
65
|
+
if (input.desired.cohort.cohortId === options.to) {
|
|
66
|
+
return Object.freeze({
|
|
67
|
+
schemaVersion: 1,
|
|
68
|
+
command: "consumer.upgrade",
|
|
69
|
+
outcome: "current",
|
|
70
|
+
issues: Object.freeze([])
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
const authority = await ports.authority.read({
|
|
74
|
+
cohortId: options.to,
|
|
75
|
+
repository: input.desired.repository,
|
|
76
|
+
...(options.authorityRevision === undefined
|
|
77
|
+
? {}
|
|
78
|
+
: { revision: options.authorityRevision })
|
|
79
|
+
});
|
|
80
|
+
if (!authority.cohort.upgradeFrom.includes(input.desired.cohort.cohortId)) {
|
|
81
|
+
return blocked(issue("DOCS_CONSUMER_COHORT_TRANSITION_FORBIDDEN", options.to, `Central authority does not permit an upgrade from ${input.desired.cohort.cohortId}.`), authority);
|
|
82
|
+
}
|
|
83
|
+
const prepared = await ports.sandbox.prepare({
|
|
84
|
+
authority,
|
|
85
|
+
consumerRoot: input.root,
|
|
86
|
+
current: input.desired
|
|
87
|
+
});
|
|
88
|
+
if (prepared.operations.length === 0) {
|
|
89
|
+
throw new TypeError("The staged successor produced no repository changes.");
|
|
90
|
+
}
|
|
91
|
+
const confirmedAuthority = await ports.authority.read({
|
|
92
|
+
cohortId: options.to,
|
|
93
|
+
repository: input.desired.repository,
|
|
94
|
+
revision: authority.revision
|
|
95
|
+
});
|
|
96
|
+
if (canonicalConsumerIntegrationJson(confirmedAuthority) !==
|
|
97
|
+
canonicalConsumerIntegrationJson(authority)) {
|
|
98
|
+
return blocked(issue("DOCS_CONSUMER_AUTHORITY_CHANGED", options.to, "Central Cohort authority changed while the successor was staged."), confirmedAuthority);
|
|
99
|
+
}
|
|
100
|
+
const mutationPlan = compileKnownFileTransactionPlan({
|
|
101
|
+
operations: prepared.operations
|
|
102
|
+
});
|
|
103
|
+
const receipt = await ports.transaction.apply({
|
|
104
|
+
consumerRoot: input.root,
|
|
105
|
+
plan: mutationPlan
|
|
106
|
+
});
|
|
107
|
+
try {
|
|
108
|
+
await ports.sandbox.activateAndVerify({
|
|
109
|
+
authority,
|
|
110
|
+
consumerRoot: input.root
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
catch (activationError) {
|
|
114
|
+
const rollbackPlan = compileKnownFileTransactionPlan({
|
|
115
|
+
operations: reverseOperations(prepared.operations)
|
|
116
|
+
});
|
|
117
|
+
await ports.transaction.apply({ consumerRoot: input.root, plan: rollbackPlan });
|
|
118
|
+
await ports.sandbox.restoreAndVerify({
|
|
119
|
+
consumerRoot: input.root,
|
|
120
|
+
current: input.desired
|
|
121
|
+
});
|
|
122
|
+
throw activationError;
|
|
123
|
+
}
|
|
124
|
+
return Object.freeze({
|
|
125
|
+
schemaVersion: 1,
|
|
126
|
+
command: "consumer.upgrade",
|
|
127
|
+
outcome: receipt.outcome === "applied" ? "upgraded" : "current",
|
|
128
|
+
issues: Object.freeze([]),
|
|
129
|
+
authority: authorityEvidence(authority),
|
|
130
|
+
receipt
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=upgrade-consumer-integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade-consumer-integration.js","sourceRoot":"","sources":["../../../../src/consumer-integration/application/use-cases/upgrade-consumer-integration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,+BAA+B,EAEhC,MAAM,kCAAkC,CAAC;AAS1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAQ5E,OAAO,EACL,gCAAgC,EACjC,MAAM,4CAA4C,CAAC;AAOpD,SAAS,KAAK,CAAC,IAAY,EAAE,OAAe,EAAE,OAAe;IAC3D,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,OAAO,CACd,OAAiC,EACjC,SAAsC;IAEtC,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE,kBAAkB;QAC3B,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;QAChC,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAA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AAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;YAC/D,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACzB,SAAS,EAAE,iBAAiB,CAAC,SAAS,CAAC;YACvC,OAAO;SACR,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumer-integration-cli.d.ts","sourceRoot":"","sources":["../../../src/consumer-integration/composition/consumer-integration-cli.ts"],"names":[],"mappings":"AA8JA,wBAAgB,eAAe,IAAI,MAAM,CAgBxC;AAGD,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA+DxF"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { applyConsumerIntegration, checkConsumerIntegration, planNodeConsumerIntegration, recoverConsumerIntegration, upgradeConsumerIntegration } from "./node-consumer-integration.js";
|
|
2
|
+
import { assertConsumerIntegrationExecutionSchema, assertConsumerUpgradeExecutionSchema } from "../adapters/consumer-integration-schema-validator.js";
|
|
3
|
+
class ConsumerCliInputError extends Error {
|
|
4
|
+
code = "DOCS_CONSUMER_CLI_INVALID";
|
|
5
|
+
}
|
|
6
|
+
const COHORT_ID = /^[a-z0-9]+(?:[._-][a-z0-9]+)*$/u;
|
|
7
|
+
const SHA256 = /^sha256:[0-9a-f]{64}$/u;
|
|
8
|
+
const GIT_SHA = /^(?!0{40}$)[0-9a-f]{40}$/u;
|
|
9
|
+
const MAXIMUM_ARGUMENT_LENGTH = 4096;
|
|
10
|
+
const MAXIMUM_ARGUMENTS = 32;
|
|
11
|
+
class Arguments {
|
|
12
|
+
#values;
|
|
13
|
+
#used = new Set();
|
|
14
|
+
constructor(values) {
|
|
15
|
+
this.#values = [...values];
|
|
16
|
+
}
|
|
17
|
+
flag(name) {
|
|
18
|
+
const indexes = this.#values.flatMap((value, index) => value === name ? [index] : []);
|
|
19
|
+
if (indexes.length > 1) {
|
|
20
|
+
throw new ConsumerCliInputError(`${name} may be supplied only once.`);
|
|
21
|
+
}
|
|
22
|
+
if (indexes[0] !== undefined) {
|
|
23
|
+
this.#used.add(indexes[0]);
|
|
24
|
+
}
|
|
25
|
+
return indexes.length === 1;
|
|
26
|
+
}
|
|
27
|
+
one(name, required = false) {
|
|
28
|
+
const indexes = this.#values.flatMap((value, index) => value === name ? [index] : []);
|
|
29
|
+
if (indexes.length > 1) {
|
|
30
|
+
throw new ConsumerCliInputError(`${name} may be supplied only once.`);
|
|
31
|
+
}
|
|
32
|
+
const index = indexes[0];
|
|
33
|
+
if (index === undefined) {
|
|
34
|
+
if (required) {
|
|
35
|
+
throw new ConsumerCliInputError(`${name} is required.`);
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
const value = this.#values[index + 1];
|
|
40
|
+
if (value === undefined || value.startsWith("--")) {
|
|
41
|
+
throw new ConsumerCliInputError(`${name} requires a value.`);
|
|
42
|
+
}
|
|
43
|
+
if (value.length > MAXIMUM_ARGUMENT_LENGTH || value.includes("\u0000")) {
|
|
44
|
+
throw new ConsumerCliInputError(`${name} contains an invalid or overlong value.`);
|
|
45
|
+
}
|
|
46
|
+
this.#used.add(index);
|
|
47
|
+
this.#used.add(index + 1);
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
assertConsumed() {
|
|
51
|
+
const unknown = this.#values.filter((_value, index) => !this.#used.has(index));
|
|
52
|
+
if (unknown.length > 0) {
|
|
53
|
+
throw new ConsumerCliInputError(`Unknown consumer arguments: ${unknown.join(" ")}.`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function failure(command, error) {
|
|
58
|
+
const candidateCode = typeof error === "object" && error !== null && "code" in error &&
|
|
59
|
+
typeof error.code === "string" ? error.code : "DOCS_CONSUMER_EXECUTION_FAILURE";
|
|
60
|
+
const code = /^(?:DOCS_|KNOWN_)[A-Z0-9_]{1,122}$/u.test(candidateCode)
|
|
61
|
+
? candidateCode
|
|
62
|
+
: "DOCS_CONSUMER_EXECUTION_FAILURE";
|
|
63
|
+
const rawMessage = error instanceof Error ? error.message : "Consumer integration failed.";
|
|
64
|
+
let safeMessage = "";
|
|
65
|
+
for (const character of rawMessage
|
|
66
|
+
.replace(/(?:[A-Za-z]:\\|\/(?:Users|home|tmp|private|var|Volumes)\/)[^\s'"`]+/gu, "<local-path>")) {
|
|
67
|
+
const codePoint = character.codePointAt(0) ?? 0;
|
|
68
|
+
safeMessage += (codePoint < 32 && ![9, 10, 13].includes(codePoint)) || codePoint === 127
|
|
69
|
+
? "?"
|
|
70
|
+
: character;
|
|
71
|
+
}
|
|
72
|
+
safeMessage = safeMessage.slice(0, 4096);
|
|
73
|
+
if (command === "upgrade") {
|
|
74
|
+
return {
|
|
75
|
+
schemaVersion: 1,
|
|
76
|
+
command: "consumer.upgrade",
|
|
77
|
+
outcome: "blocked",
|
|
78
|
+
issues: [{ code, severity: "error", subject: command, message: safeMessage }]
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const commandId = ["apply", "check", "plan", "recover"].includes(command)
|
|
82
|
+
? `consumer.${command}`
|
|
83
|
+
: "consumer.check";
|
|
84
|
+
return {
|
|
85
|
+
schemaVersion: 1,
|
|
86
|
+
command: commandId,
|
|
87
|
+
outcome: "blocked",
|
|
88
|
+
issues: [{
|
|
89
|
+
code,
|
|
90
|
+
severity: "error",
|
|
91
|
+
subject: command.slice(0, 2048),
|
|
92
|
+
message: safeMessage
|
|
93
|
+
}]
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function human(execution) {
|
|
97
|
+
const lines = [`${execution.command}: ${execution.outcome}`];
|
|
98
|
+
if (execution.command !== "consumer.upgrade" && execution.plan !== undefined) {
|
|
99
|
+
lines.push(`Cohort: ${execution.plan.cohortId}`);
|
|
100
|
+
lines.push(`Plan: ${execution.plan.planDigest}`);
|
|
101
|
+
for (const asset of execution.plan.assets) {
|
|
102
|
+
const current = asset.currentDigest === undefined ? "absent" : asset.currentDigest;
|
|
103
|
+
lines.push(`${asset.action.padEnd(7)} ${asset.path} (${asset.ownership}, ${asset.state})`);
|
|
104
|
+
if (asset.action !== "none") {
|
|
105
|
+
lines.push(` ${current} -> ${asset.expectedDigest}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (execution.receipt !== undefined) {
|
|
110
|
+
lines.push(`Receipt: ${execution.receipt.receiptDigest}`);
|
|
111
|
+
}
|
|
112
|
+
for (const issue of execution.issues) {
|
|
113
|
+
lines.push(`${issue.severity.toUpperCase()} ${issue.code} [${issue.subject}]: ${issue.message}`);
|
|
114
|
+
lines.push(issue.code === "DOCS_CONSUMER_STALE_PLAN"
|
|
115
|
+
? "Next: run agent-teams-docs-managed plan again and review the new digest."
|
|
116
|
+
: issue.code.includes("RECOVERY") || issue.code.startsWith("KNOWN_FILE")
|
|
117
|
+
? "Next: run agent-teams-docs-managed recover, then repeat check and plan."
|
|
118
|
+
: "Next: fix the reported authority or conflict, then repeat check and plan.");
|
|
119
|
+
}
|
|
120
|
+
return `${lines.join("\n")}\n`;
|
|
121
|
+
}
|
|
122
|
+
function exitCode(execution) {
|
|
123
|
+
if (["applied", "current", "recovered", "upgraded"].includes(execution.outcome)) {
|
|
124
|
+
return 0;
|
|
125
|
+
}
|
|
126
|
+
if (execution.outcome === "change-required") {
|
|
127
|
+
return 1;
|
|
128
|
+
}
|
|
129
|
+
const codes = new Set(execution.issues.map(({ code }) => code));
|
|
130
|
+
if (codes.has("DOCS_CONSUMER_CLI_INVALID")) {
|
|
131
|
+
return 2;
|
|
132
|
+
}
|
|
133
|
+
return codes.has("DOCS_CONSUMER_EXECUTION_FAILURE") ? 3 : 1;
|
|
134
|
+
}
|
|
135
|
+
function assertBoundedArgv(argv) {
|
|
136
|
+
if (argv.length > MAXIMUM_ARGUMENTS || argv.some((value) => typeof value !== "string" || value.length > MAXIMUM_ARGUMENT_LENGTH || value.includes("\u0000"))) {
|
|
137
|
+
throw new ConsumerCliInputError("Consumer arguments are invalid or exceed the bounded CLI contract.");
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function requestsJsonOutput(argv) {
|
|
141
|
+
return argv.some((value) => value === "--json");
|
|
142
|
+
}
|
|
143
|
+
export function managedDocsHelp() {
|
|
144
|
+
return `Usage: agent-teams-docs-managed <command> [options]
|
|
145
|
+
|
|
146
|
+
Commands:
|
|
147
|
+
check Verify the selected Cohort without writing
|
|
148
|
+
plan --to COHORT Print a deterministic, write-free semantic plan
|
|
149
|
+
apply --expect SHA256 Rebuild and apply the reviewed plan through Foundation
|
|
150
|
+
upgrade --to COHORT Project authority, pins, lockfile, and assets in one command
|
|
151
|
+
recover Recover the Foundation transaction (profile not read)
|
|
152
|
+
|
|
153
|
+
Options:
|
|
154
|
+
--consumer PATH Git repository root (default: .)
|
|
155
|
+
--authority-revision SHA Optional exact protected .github revision
|
|
156
|
+
--json Emit one bounded versioned JSON envelope
|
|
157
|
+
--help Show this help
|
|
158
|
+
`;
|
|
159
|
+
}
|
|
160
|
+
// oxlint-disable-next-line complexity
|
|
161
|
+
export async function runManagedConsumerCommand(argv) {
|
|
162
|
+
let command = "";
|
|
163
|
+
const jsonRequested = requestsJsonOutput(argv);
|
|
164
|
+
let execution;
|
|
165
|
+
try {
|
|
166
|
+
assertBoundedArgv(argv);
|
|
167
|
+
command = argv[0] ?? "";
|
|
168
|
+
if (command === "help" || command === "--help" || argv[1] === "--help") {
|
|
169
|
+
const helpArgs = new Arguments(argv.slice(1));
|
|
170
|
+
if (argv[1] === "--help") {
|
|
171
|
+
helpArgs.flag("--help");
|
|
172
|
+
}
|
|
173
|
+
helpArgs.assertConsumed();
|
|
174
|
+
process.stdout.write(managedDocsHelp());
|
|
175
|
+
return 0;
|
|
176
|
+
}
|
|
177
|
+
const args = new Arguments(argv.slice(1));
|
|
178
|
+
args.flag("--json");
|
|
179
|
+
const consumerRoot = args.one("--consumer") ?? ".";
|
|
180
|
+
if (command === "check") {
|
|
181
|
+
args.assertConsumed();
|
|
182
|
+
execution = await checkConsumerIntegration({ consumerRoot });
|
|
183
|
+
}
|
|
184
|
+
else if (command === "plan") {
|
|
185
|
+
const to = args.one("--to", true);
|
|
186
|
+
if (!COHORT_ID.test(to)) {
|
|
187
|
+
throw new ConsumerCliInputError("--to must be one exact Cohort ID.");
|
|
188
|
+
}
|
|
189
|
+
args.assertConsumed();
|
|
190
|
+
execution = await planNodeConsumerIntegration({ consumerRoot, to });
|
|
191
|
+
}
|
|
192
|
+
else if (command === "apply") {
|
|
193
|
+
const expect = args.one("--expect", true);
|
|
194
|
+
if (!SHA256.test(expect)) {
|
|
195
|
+
throw new ConsumerCliInputError("--expect must be one sha256 Plan digest.");
|
|
196
|
+
}
|
|
197
|
+
args.assertConsumed();
|
|
198
|
+
execution = await applyConsumerIntegration({ consumerRoot, expect });
|
|
199
|
+
}
|
|
200
|
+
else if (command === "upgrade") {
|
|
201
|
+
const to = args.one("--to", true);
|
|
202
|
+
if (!COHORT_ID.test(to)) {
|
|
203
|
+
throw new ConsumerCliInputError("--to must be one exact Cohort ID.");
|
|
204
|
+
}
|
|
205
|
+
const authorityRevision = args.one("--authority-revision");
|
|
206
|
+
if (authorityRevision !== undefined && !GIT_SHA.test(authorityRevision)) {
|
|
207
|
+
throw new ConsumerCliInputError("--authority-revision must be one nonzero lowercase Git SHA.");
|
|
208
|
+
}
|
|
209
|
+
args.assertConsumed();
|
|
210
|
+
execution = await upgradeConsumerIntegration({
|
|
211
|
+
consumerRoot,
|
|
212
|
+
to,
|
|
213
|
+
...(authorityRevision === undefined ? {} : { authorityRevision })
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
else if (command === "recover") {
|
|
217
|
+
args.assertConsumed();
|
|
218
|
+
execution = await recoverConsumerIntegration({ consumerRoot });
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
throw new ConsumerCliInputError("Expected consumer command: check, plan, apply, upgrade, or recover.");
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
execution = failure(command || "check", error);
|
|
226
|
+
}
|
|
227
|
+
try {
|
|
228
|
+
if (execution.command === "consumer.upgrade") {
|
|
229
|
+
await assertConsumerUpgradeExecutionSchema(execution);
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
await assertConsumerIntegrationExecutionSchema(execution);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
execution = failure(command || "check", error);
|
|
237
|
+
}
|
|
238
|
+
process.stdout.write(jsonRequested ? `${JSON.stringify(execution)}\n` : human(execution));
|
|
239
|
+
return exitCode(execution);
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=consumer-integration-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumer-integration-cli.js","sourceRoot":"","sources":["../../../src/consumer-integration/composition/consumer-integration-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAE3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,wCAAwC,EACxC,oCAAoC,EACrC,MAAM,sDAAsD,CAAC;AAK9D,MAAM,qBAAsB,SAAQ,KAAK;IAC9B,IAAI,GAAG,2BAA2B,CAAC;CAC7C;AAED,MAAM,SAAS,GAAG,iCAAiC,CAAC;AACpD,MAAM,MAAM,GAAG,wBAAwB,CAAC;AACxC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AAC5C,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,SAAS;IACJ,OAAO,CAAW;IAClB,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAEnC,YAAmB,MAAyB;QAC1C,IAAI,CAAC,OAAO,GAAG,C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AC;QACxD,CAAC;aAAM,CAAC;YACN,MAAM,wCAAwC,CAAC,SAAS,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,SAAS,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1F,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ConsumerAssetCatalogV1, KnownPriorCohortCatalogEntryV1 } from "../application/policies/consumer-integration-assets.js";
|
|
2
|
+
import type { ConsumerIntegrationPlanningPorts } from "../application/ports/consumer-integration-planners.js";
|
|
3
|
+
import type { ConsumerIntegrationDesiredStateV1, ConsumerIntegrationPlanV1, ConsumerIntegrationSnapshot } from "../domain/model.js";
|
|
4
|
+
export declare const consumerIntegrationPlanningPorts: ConsumerIntegrationPlanningPorts;
|
|
5
|
+
export declare function compileConsumerIntegration(input: {
|
|
6
|
+
readonly desired: ConsumerIntegrationDesiredStateV1;
|
|
7
|
+
readonly snapshot: ConsumerIntegrationSnapshot;
|
|
8
|
+
readonly assetCatalog?: ConsumerAssetCatalogV1;
|
|
9
|
+
/** Unit-level compatibility input; production composition loads package assets. */
|
|
10
|
+
readonly knownPriorCohorts?: readonly KnownPriorCohortCatalogEntryV1[];
|
|
11
|
+
}): {
|
|
12
|
+
readonly plan: ConsumerIntegrationPlanV1;
|
|
13
|
+
readonly mutationPlan?: ReturnType<typeof import("@agent-teams/repository-mutation").compileKnownFileTransactionPlan>;
|
|
14
|
+
};
|
|
15
|
+
export declare function planConsumerIntegration(input: {
|
|
16
|
+
readonly desired: ConsumerIntegrationDesiredStateV1;
|
|
17
|
+
readonly snapshot: ConsumerIntegrationSnapshot;
|
|
18
|
+
}): ConsumerIntegrationPlanV1;
|
|
19
|
+
//# sourceMappingURL=consumer-integration-planner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumer-integration-planner.d.ts","sourceRoot":"","sources":["../../../src/consumer-integration/composition/consumer-integration-planner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,sBAAsB,EACtB,8BAA8B,EAC/B,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EACV,gCAAgC,EACjC,MAAM,uDAAuD,CAAC;AAI/D,OAAO,KAAK,EACV,iCAAiC,EACjC,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,gCAAgC,EAAE,gCAI3C,CAAC;AAEL,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,OAAO,EAAE,iCAAiC,CAAC;IACpD,QAAQ,CAAC,QAAQ,EAAE,2BAA2B,CAAC;IAC/C,QAAQ,CAAC,YAAY,CAAC,EAAE,sBAAsB,CAAC;IAC/C,mFAAmF;IACnF,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,8BAA8B,EAAE,CAAC;CACxE;;;EAEA;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,QAAQ,CAAC,OAAO,EAAE,iCAAiC,CAAC;IACpD,QAAQ,CAAC,QAAQ,EAAE,2BAA2B,CAAC;CAChD,GAAG,yBAAyB,CAE5B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { agentsRoutePlannerV1 } from "../adapters/agents-route-adapter-v1.js";
|
|
2
|
+
import { pnpmManifestPlannerV1 } from "../adapters/pnpm-manifest-adapter-v1.js";
|
|
3
|
+
import { compileConsumerIntegration as compileWithPorts } from "../application/use-cases/plan-consumer-integration.js";
|
|
4
|
+
export const consumerIntegrationPlanningPorts = Object.freeze({
|
|
5
|
+
agentsRoute: agentsRoutePlannerV1,
|
|
6
|
+
packageManifest: pnpmManifestPlannerV1
|
|
7
|
+
});
|
|
8
|
+
export function compileConsumerIntegration(input) {
|
|
9
|
+
return compileWithPorts(input, consumerIntegrationPlanningPorts);
|
|
10
|
+
}
|
|
11
|
+
export function planConsumerIntegration(input) {
|
|
12
|
+
return compileConsumerIntegration(input).plan;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=consumer-integration-planner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumer-integration-planner.js","sourceRoot":"","sources":["../../../src/consumer-integration/composition/consumer-integration-planner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAQhF,OAAO,EACL,0BAA0B,IAAI,gBAAgB,EAC/C,MAAM,uDAAuD,CAAC;AAO/D,MAAM,CAAC,MAAM,gCAAgC,GAC3C,MAAM,CAAC,MAAM,CAAC;IACZ,WAAW,EAAE,oBAAoB;IACjC,eAAe,EAAE,qBAAqB;CACvC,CAAC,CAAC;AAEL,MAAM,UAAU,0BAA0B,CAAC,KAM1C;IACC,OAAO,gBAAgB,CAAC,KAAK,EAAE,gCAAgC,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,KAGvC;IACC,OAAO,0BAA0B,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ConsumerIntegrationExecutionV1 } from "../application/model/consumer-integration-execution.js";
|
|
2
|
+
import type { ConsumerUpgradeExecutionV1 } from "../application/model/consumer-upgrade-execution.js";
|
|
3
|
+
export type { ConsumerIntegrationExecutionV1 } from "../application/model/consumer-integration-execution.js";
|
|
4
|
+
export declare function checkConsumerIntegration(options: {
|
|
5
|
+
readonly consumerRoot: string;
|
|
6
|
+
readonly integrationProfilePath?: string;
|
|
7
|
+
}): Promise<ConsumerIntegrationExecutionV1>;
|
|
8
|
+
export declare function planNodeConsumerIntegration(options: {
|
|
9
|
+
readonly consumerRoot: string;
|
|
10
|
+
readonly integrationProfilePath?: string;
|
|
11
|
+
readonly to: string;
|
|
12
|
+
}): Promise<ConsumerIntegrationExecutionV1>;
|
|
13
|
+
export declare function applyConsumerIntegration(options: {
|
|
14
|
+
readonly consumerRoot: string;
|
|
15
|
+
readonly expect: string;
|
|
16
|
+
readonly integrationProfilePath?: string;
|
|
17
|
+
}): Promise<ConsumerIntegrationExecutionV1>;
|
|
18
|
+
export declare function recoverConsumerIntegration(options: {
|
|
19
|
+
readonly consumerRoot: string;
|
|
20
|
+
}): Promise<ConsumerIntegrationExecutionV1>;
|
|
21
|
+
export declare function upgradeConsumerIntegration(options: {
|
|
22
|
+
readonly consumerRoot: string;
|
|
23
|
+
readonly authorityRevision?: string;
|
|
24
|
+
readonly to: string;
|
|
25
|
+
}): Promise<ConsumerUpgradeExecutionV1>;
|
|
26
|
+
//# sourceMappingURL=node-consumer-integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-consumer-integration.d.ts","sourceRoot":"","sources":["../../../src/consumer-integration/composition/node-consumer-integration.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,8BAA8B,EAC/B,MAAM,wDAAwD,CAAC;AAOhE,OAAO,KAAK,EACV,0BAA0B,EAC3B,MAAM,oDAAoD,CAAC;AAG5D,YAAY,EACV,8BAA8B,EAC/B,MAAM,wDAAwD,CAAC;AAkBhE,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IAChD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CAC1C,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAE1C;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE;IACnD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAE1C;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IAChD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CAC1C,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAE1C;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE;IAClD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAE1C;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE;IAClD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAEtC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { foundationKnownFileTransaction } from "../adapters/foundation-known-file-transaction.js";
|
|
2
|
+
import { githubCohortAuthorityReader } from "../adapters/github-cohort-authority-reader.js";
|
|
3
|
+
import { nodeConsumerIntegrationInputReader } from "../adapters/node-consumer-integration-repository.js";
|
|
4
|
+
import { packageConsumerAssetCatalogReader } from "../adapters/package-consumer-asset-catalog.js";
|
|
5
|
+
import { nodeConsumerUpgradeSandbox } from "../adapters/node-consumer-upgrade-sandbox.js";
|
|
6
|
+
import { createConsumerIntegrationUseCases } from "../application/use-cases/run-consumer-integration.js";
|
|
7
|
+
import { createConsumerUpgradeUseCase } from "../application/use-cases/upgrade-consumer-integration.js";
|
|
8
|
+
import { consumerIntegrationPlanningPorts } from "./consumer-integration-planner.js";
|
|
9
|
+
const useCases = createConsumerIntegrationUseCases({
|
|
10
|
+
assets: packageConsumerAssetCatalogReader,
|
|
11
|
+
input: nodeConsumerIntegrationInputReader,
|
|
12
|
+
planning: consumerIntegrationPlanningPorts,
|
|
13
|
+
transaction: foundationKnownFileTransaction
|
|
14
|
+
});
|
|
15
|
+
const upgrade = createConsumerUpgradeUseCase({
|
|
16
|
+
assets: packageConsumerAssetCatalogReader,
|
|
17
|
+
authority: githubCohortAuthorityReader,
|
|
18
|
+
input: nodeConsumerIntegrationInputReader,
|
|
19
|
+
planning: consumerIntegrationPlanningPorts,
|
|
20
|
+
sandbox: nodeConsumerUpgradeSandbox,
|
|
21
|
+
transaction: foundationKnownFileTransaction
|
|
22
|
+
});
|
|
23
|
+
export function checkConsumerIntegration(options) {
|
|
24
|
+
return useCases.check(options);
|
|
25
|
+
}
|
|
26
|
+
export function planNodeConsumerIntegration(options) {
|
|
27
|
+
return useCases.plan(options);
|
|
28
|
+
}
|
|
29
|
+
export function applyConsumerIntegration(options) {
|
|
30
|
+
return useCases.apply(options);
|
|
31
|
+
}
|
|
32
|
+
export function recoverConsumerIntegration(options) {
|
|
33
|
+
return useCases.recover(options);
|
|
34
|
+
}
|
|
35
|
+
export function upgradeConsumerIntegration(options) {
|
|
36
|
+
return upgrade(options);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=node-consumer-integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-consumer-integration.js","sourceRoot":"","sources":["../../../src/consumer-integration/composition/node-consumer-integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,kDAAkD,CAAC;AAClG,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EACL,kCAAkC,EACnC,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EACL,iCAAiC,EAClC,MAAM,+CAA+C,C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
3
|
+
readonly schemaVersion: 1;
|
|
4
|
+
readonly cohortId: string;
|
|
5
|
+
readonly channel: "rc" | "stable";
|
|
6
|
+
readonly recordDigest: ConsumerIntegrationDigest;
|
|
7
|
+
readonly qualificationEventDigest: ConsumerIntegrationDigest;
|
|
8
|
+
readonly lifecycleState: "QUALIFIED" | "CANARY" | "RECOMMENDED";
|
|
9
|
+
readonly eligibleAfter: string;
|
|
10
|
+
readonly upgradeFrom: readonly string[];
|
|
11
|
+
readonly rollbackTo: readonly string[];
|
|
12
|
+
readonly canaryRepositoryIds: readonly string[];
|
|
13
|
+
readonly packages: {
|
|
14
|
+
readonly docsProtocol: {
|
|
15
|
+
readonly version: string;
|
|
16
|
+
readonly integrity: `sha512-${string}`;
|
|
17
|
+
};
|
|
18
|
+
readonly engineeringFoundation: {
|
|
19
|
+
readonly version: string;
|
|
20
|
+
readonly integrity: `sha512-${string}`;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
readonly workflow: {
|
|
24
|
+
readonly repository: string;
|
|
25
|
+
readonly path: string;
|
|
26
|
+
readonly revision: string;
|
|
27
|
+
readonly blobSha: string;
|
|
28
|
+
};
|
|
29
|
+
readonly assets: {
|
|
30
|
+
readonly skillDigest: ConsumerIntegrationDigest;
|
|
31
|
+
readonly callerWorkflowDigest: ConsumerIntegrationDigest;
|
|
32
|
+
readonly assetCatalogDigest: ConsumerIntegrationDigest;
|
|
33
|
+
readonly transitionCatalogDigest: ConsumerIntegrationDigest;
|
|
34
|
+
};
|
|
35
|
+
readonly schemas: {
|
|
36
|
+
readonly consumerIntegration: 1;
|
|
37
|
+
readonly managedState: 1;
|
|
38
|
+
readonly docsProtocol: 1;
|
|
39
|
+
};
|
|
40
|
+
readonly runtime: {
|
|
41
|
+
readonly node: ">=24.18.0 <25";
|
|
42
|
+
readonly pnpm: ">=11.17.0 <12";
|
|
43
|
+
readonly runtimeClosureDigest: ConsumerIntegrationDigest;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** Immutable Cohort evidence that may be committed in a consumer repository. */
|
|
47
|
+
export type QualifiedDocsCohortBindingV1 = Omit<QualifiedDocsCohortV1, "canaryRepositoryIds" | "lifecycleState">;
|
|
48
|
+
export interface ConsumerIntegrationDesiredStateV1 {
|
|
49
|
+
readonly schemaVersion: 1;
|
|
50
|
+
readonly repository: {
|
|
51
|
+
readonly provider: "github";
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly nameWithOwner: string;
|
|
54
|
+
};
|
|
55
|
+
readonly integrationRoot: ".";
|
|
56
|
+
readonly packageManager: "pnpm";
|
|
57
|
+
readonly profilePath: string;
|
|
58
|
+
readonly skillPath: string;
|
|
59
|
+
readonly callerWorkflowPath: string;
|
|
60
|
+
readonly managedStatePath: string;
|
|
61
|
+
readonly governedDocsRoots?: readonly string[];
|
|
62
|
+
readonly cohort: QualifiedDocsCohortBindingV1;
|
|
63
|
+
}
|
|
64
|
+
export type ConsumerIntegrationFileObservation = {
|
|
65
|
+
readonly state: "absent";
|
|
66
|
+
} | {
|
|
67
|
+
readonly state: "file";
|
|
68
|
+
readonly bytes: Uint8Array;
|
|
69
|
+
readonly mode: number;
|
|
70
|
+
};
|
|
71
|
+
export interface ConsumerIntegrationSnapshot {
|
|
72
|
+
readonly integrationProfile: ConsumerIntegrationFileObservation;
|
|
73
|
+
readonly lockfile: ConsumerIntegrationFileObservation;
|
|
74
|
+
readonly packageManifest: ConsumerIntegrationFileObservation;
|
|
75
|
+
readonly agents: ConsumerIntegrationFileObservation;
|
|
76
|
+
readonly skill: ConsumerIntegrationFileObservation;
|
|
77
|
+
readonly callerWorkflow: ConsumerIntegrationFileObservation;
|
|
78
|
+
readonly managedState: ConsumerIntegrationFileObservation;
|
|
79
|
+
}
|
|
80
|
+
export type ConsumerIntegrationAssetState = "absent" | "exact-current" | "known-prior" | "partial-adoption" | "outdated-cohort" | "unknown-modified" | "conflict" | "unsupported";
|
|
81
|
+
export interface ConsumerIntegrationIssue {
|
|
82
|
+
readonly code: string;
|
|
83
|
+
readonly severity: "error" | "warning";
|
|
84
|
+
readonly subject: string;
|
|
85
|
+
readonly message: string;
|
|
86
|
+
}
|
|
87
|
+
export interface ConsumerIntegrationAssetPlan {
|
|
88
|
+
readonly id: "agents-route" | "caller-workflow" | "managed-state" | "package-manifest" | "skill";
|
|
89
|
+
readonly path: string;
|
|
90
|
+
readonly ownership: "full-bytes" | "partial-fields" | "managed-block";
|
|
91
|
+
readonly state: ConsumerIntegrationAssetState;
|
|
92
|
+
readonly currentDigest?: ConsumerIntegrationDigest;
|
|
93
|
+
readonly expectedDigest: ConsumerIntegrationDigest;
|
|
94
|
+
readonly action: "create" | "none" | "replace" | "blocked";
|
|
95
|
+
}
|
|
96
|
+
export interface ConsumerIntegrationPlanV1 {
|
|
97
|
+
readonly schemaVersion: 1;
|
|
98
|
+
readonly cohortId: string;
|
|
99
|
+
readonly repository: ConsumerIntegrationDesiredStateV1["repository"];
|
|
100
|
+
readonly planDigest: ConsumerIntegrationDigest;
|
|
101
|
+
readonly outcome: "blocked" | "change-required" | "current";
|
|
102
|
+
readonly assets: readonly ConsumerIntegrationAssetPlan[];
|
|
103
|
+
readonly issues: readonly ConsumerIntegrationIssue[];
|
|
104
|
+
}
|
|
105
|
+
export interface ConsumerUpgradeAuthorityV1 {
|
|
106
|
+
readonly repository: "agent-teams-ai/.github";
|
|
107
|
+
readonly path: "governance/docs-qualified-cohorts.json";
|
|
108
|
+
readonly revision: string;
|
|
109
|
+
readonly cohort: QualifiedDocsCohortBindingV1;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=model.d.ts.map
|