@agent-teams/docs-protocol 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.
Files changed (83) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +201 -0
  3. package/README.md +92 -0
  4. package/dist/adapters/adoption-input.d.ts +9 -0
  5. package/dist/adapters/adoption-input.d.ts.map +1 -0
  6. package/dist/adapters/adoption-input.js +72 -0
  7. package/dist/adapters/adoption-input.js.map +1 -0
  8. package/dist/adapters/adoption-package-identity.d.ts +7 -0
  9. package/dist/adapters/adoption-package-identity.d.ts.map +1 -0
  10. package/dist/adapters/adoption-package-identity.js +69 -0
  11. package/dist/adapters/adoption-package-identity.js.map +1 -0
  12. package/dist/adapters/docs-command-envelope-schema-validator.d.ts +2 -0
  13. package/dist/adapters/docs-command-envelope-schema-validator.d.ts.map +1 -0
  14. package/dist/adapters/docs-command-envelope-schema-validator.js +24 -0
  15. package/dist/adapters/docs-command-envelope-schema-validator.js.map +1 -0
  16. package/dist/adapters/docs-profile-schema-validator.d.ts +2 -0
  17. package/dist/adapters/docs-profile-schema-validator.d.ts.map +1 -0
  18. package/dist/adapters/docs-profile-schema-validator.js +28 -0
  19. package/dist/adapters/docs-profile-schema-validator.js.map +1 -0
  20. package/dist/adapters/foundation-docs-port.d.ts +12 -0
  21. package/dist/adapters/foundation-docs-port.d.ts.map +1 -0
  22. package/dist/adapters/foundation-docs-port.js +108 -0
  23. package/dist/adapters/foundation-docs-port.js.map +1 -0
  24. package/dist/adapters/node-adoption-inspector.d.ts +5 -0
  25. package/dist/adapters/node-adoption-inspector.d.ts.map +1 -0
  26. package/dist/adapters/node-adoption-inspector.js +102 -0
  27. package/dist/adapters/node-adoption-inspector.js.map +1 -0
  28. package/dist/adapters/node-code-anchor-matcher.d.ts +5 -0
  29. package/dist/adapters/node-code-anchor-matcher.d.ts.map +1 -0
  30. package/dist/adapters/node-code-anchor-matcher.js +65 -0
  31. package/dist/adapters/node-code-anchor-matcher.js.map +1 -0
  32. package/dist/adapters/node-profile-reader.d.ts +9 -0
  33. package/dist/adapters/node-profile-reader.d.ts.map +1 -0
  34. package/dist/adapters/node-profile-reader.js +118 -0
  35. package/dist/adapters/node-profile-reader.js.map +1 -0
  36. package/dist/application/authority-handshake.d.ts +14 -0
  37. package/dist/application/authority-handshake.d.ts.map +1 -0
  38. package/dist/application/authority-handshake.js +15 -0
  39. package/dist/application/authority-handshake.js.map +1 -0
  40. package/dist/application/docs-new-completion.d.ts +33 -0
  41. package/dist/application/docs-new-completion.d.ts.map +1 -0
  42. package/dist/application/docs-new-completion.js +226 -0
  43. package/dist/application/docs-new-completion.js.map +1 -0
  44. package/dist/application/docs-protocol.d.ts +168 -0
  45. package/dist/application/docs-protocol.d.ts.map +1 -0
  46. package/dist/application/docs-protocol.js +450 -0
  47. package/dist/application/docs-protocol.js.map +1 -0
  48. package/dist/cli.d.ts +3 -0
  49. package/dist/cli.d.ts.map +1 -0
  50. package/dist/cli.js +4 -0
  51. package/dist/cli.js.map +1 -0
  52. package/dist/composition/cli.d.ts +4 -0
  53. package/dist/composition/cli.d.ts.map +1 -0
  54. package/dist/composition/cli.js +436 -0
  55. package/dist/composition/cli.js.map +1 -0
  56. package/dist/composition/node-docs-api.d.ts +148 -0
  57. package/dist/composition/node-docs-api.d.ts.map +1 -0
  58. package/dist/composition/node-docs-api.js +38 -0
  59. package/dist/composition/node-docs-api.js.map +1 -0
  60. package/dist/domain/document-semantics.d.ts +7 -0
  61. package/dist/domain/document-semantics.d.ts.map +1 -0
  62. package/dist/domain/document-semantics.js +146 -0
  63. package/dist/domain/document-semantics.js.map +1 -0
  64. package/dist/domain/model.d.ts +285 -0
  65. package/dist/domain/model.d.ts.map +1 -0
  66. package/dist/domain/model.js +3 -0
  67. package/dist/domain/model.js.map +1 -0
  68. package/dist/domain/profile-policy.d.ts +7 -0
  69. package/dist/domain/profile-policy.d.ts.map +1 -0
  70. package/dist/domain/profile-policy.js +109 -0
  71. package/dist/domain/profile-policy.js.map +1 -0
  72. package/dist/index.d.ts +6 -0
  73. package/dist/index.d.ts.map +1 -0
  74. package/dist/index.js +4 -0
  75. package/dist/index.js.map +1 -0
  76. package/dist/qualification/index.d.ts +23 -0
  77. package/dist/qualification/index.d.ts.map +1 -0
  78. package/dist/qualification/index.js +462 -0
  79. package/dist/qualification/index.js.map +1 -0
  80. package/package.json +64 -0
  81. package/schemas/docs-protocol/v1.schema.json +12 -0
  82. package/schemas/docs-protocol-command-envelope/v1.schema.json +239 -0
  83. package/schemas/docs-protocol-profile/v1.schema.json +46 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-docs-api.js","sourceRoot":"","sources":["../../src/composition/node-docs-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,+BAA+B,EAAE,MAAM,uDAAuD,CAAC;AAGxG,SAAS,YAAY;IACnB,OAAO,IAAI,YAAY,CAAC;QACtB,QAAQ,EAAE,IAAI,yBAAyB,EAAE;QACzC,OAAO,EAAE,IAAI,qBAAqB,EAAE;QACpC,UAAU,EAAE,IAAI,sBAAsB,EAAE;QACxC,QAAQ,EAAE,IAAI,qBAAqB,EAAE;KACtC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,QAAQ,CAAgD,SAA0B;IAC/F,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC;IACjC,MAAM,+BAA+B,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACzD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAQD,MAAM,UAAU,QAAQ,CAAC,KAA0B;IACjD,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAGxB;IACC,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,KAAqB;IAC3C,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAA0B;IACnD,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAA8D;IACxF,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAA0B;IAClD,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { DocumentJsonValue, DocumentMetadataValue } from "@agent-teams/engineering-foundation/document-authoring";
2
+ import type { DocsCodeAnchor } from "./model.js";
3
+ export declare function normalizeCodeAnchors(values: readonly (DocumentJsonValue | DocumentMetadataValue)[]): readonly DocsCodeAnchor[];
4
+ export declare function normalizeDocumentIds(values: readonly string[], subject: string): readonly string[];
5
+ export declare function normalizeDocumentId(value: string, subject: string): string;
6
+ export declare function assertDocumentMetadata(value: unknown): asserts value is Readonly<Record<string, DocumentJsonValue>>;
7
+ //# sourceMappingURL=document-semantics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-semantics.d.ts","sourceRoot":"","sources":["../../src/domain/document-semantics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAEvH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAuBjD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,EAAE,GAAG,SAAS,cAAc,EAAE,CA+B9H;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAgBlG;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1E;AA2CD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAKnH"}
@@ -0,0 +1,146 @@
1
+ import { DocsProfileError } from "./profile-policy.js";
2
+ const PATTERN = /^[A-Za-z0-9._@*?/[\]-]+$/u;
3
+ const DOCUMENT_ID = /^[A-Za-z0-9@][A-Za-z0-9@._/-]*$/u;
4
+ const MAX_ITEMS = 256;
5
+ const RESERVED_KEYS = new Set(["__proto__", "constructor", "prototype"]);
6
+ function hasControlCharacter(value) {
7
+ for (let index = 0; index < value.length; index += 1) {
8
+ const code = value.charCodeAt(index);
9
+ if (code <= 0x1f || code === 0x7f) {
10
+ return true;
11
+ }
12
+ }
13
+ return false;
14
+ }
15
+ function object(value) {
16
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
17
+ throw new DocsProfileError("Each code anchor must be an object.");
18
+ }
19
+ return value;
20
+ }
21
+ export function normalizeCodeAnchors(values) {
22
+ if (values.length > MAX_ITEMS) {
23
+ throw new DocsProfileError(`code_anchors exceeds ${MAX_ITEMS} items.`);
24
+ }
25
+ const anchors = values.map((value, index) => {
26
+ const candidate = object(value);
27
+ const keys = Object.keys(candidate).toSorted();
28
+ if (keys.length !== 2 || keys[0] !== "enforcement" || keys[1] !== "pattern") {
29
+ throw new DocsProfileError(`code_anchors[${index}] must contain exactly enforcement and pattern.`);
30
+ }
31
+ const enforcement = candidate["enforcement"];
32
+ const pattern = candidate["pattern"];
33
+ if (enforcement !== "advisory" && enforcement !== "required") {
34
+ throw new DocsProfileError(`code_anchors[${index}].enforcement must be advisory or required.`);
35
+ }
36
+ if (typeof pattern !== "string" || pattern.length === 0 || Buffer.byteLength(pattern, "utf8") > 512 || pattern !== pattern.normalize("NFC") || hasControlCharacter(pattern) || !PATTERN.test(pattern)) {
37
+ throw new DocsProfileError(`code_anchors[${index}].pattern is invalid.`);
38
+ }
39
+ const segments = pattern.split("/");
40
+ if (pattern.startsWith("/") ||
41
+ pattern.includes("\\") ||
42
+ segments.some((segment) => segment === "" || segment === "." || segment === "..") ||
43
+ segments[0] === "docs" ||
44
+ segments[0] === ".agents") {
45
+ throw new DocsProfileError(`code_anchors[${index}].pattern must be a safe source-relative pattern outside docs and .agents.`);
46
+ }
47
+ return Object.freeze({ enforcement, pattern });
48
+ });
49
+ const identities = anchors.map(({ enforcement, pattern }) => `${enforcement}\0${pattern}`);
50
+ if (new Set(identities).size !== identities.length) {
51
+ throw new DocsProfileError("code_anchors must be unique.");
52
+ }
53
+ return Object.freeze(anchors);
54
+ }
55
+ export function normalizeDocumentIds(values, subject) {
56
+ if (values.length > MAX_ITEMS) {
57
+ throw new DocsProfileError(`${subject} exceeds ${MAX_ITEMS} items.`);
58
+ }
59
+ const normalized = values.map((value, index) => {
60
+ if (value.length === 0 ||
61
+ Buffer.byteLength(value, "utf8") > 214 ||
62
+ value !== value.normalize("NFC") ||
63
+ hasControlCharacter(value) ||
64
+ !DOCUMENT_ID.test(value)) {
65
+ throw new DocsProfileError(`${subject}[${index}] is not a canonical document ID.`);
66
+ }
67
+ return value;
68
+ });
69
+ if (new Set(normalized).size !== normalized.length) {
70
+ throw new DocsProfileError(`${subject} contains duplicates.`);
71
+ }
72
+ return Object.freeze(normalized.toSorted((left, right) => Buffer.compare(Buffer.from(left), Buffer.from(right))));
73
+ }
74
+ export function normalizeDocumentId(value, subject) {
75
+ return normalizeDocumentIds([value], subject)[0];
76
+ }
77
+ function assertMetadataScalar(value) {
78
+ if (value === null || typeof value === "boolean") {
79
+ return true;
80
+ }
81
+ if (typeof value === "string") {
82
+ if (value !== value.normalize("NFC")) {
83
+ throw new DocsProfileError("Additional metadata strings must use Unicode NFC.");
84
+ }
85
+ return true;
86
+ }
87
+ if (typeof value === "number") {
88
+ if (!Number.isSafeInteger(value) || Object.is(value, -0)) {
89
+ throw new DocsProfileError("Additional metadata numbers must be safe integers other than negative zero.");
90
+ }
91
+ return true;
92
+ }
93
+ if (typeof value !== "object") {
94
+ throw new DocsProfileError("Additional metadata must use the closed JSON data model.");
95
+ }
96
+ return false;
97
+ }
98
+ function assertMetadataValue(value, depth, budget, seen) {
99
+ budget.values += 1;
100
+ if (budget.values > 100_000) {
101
+ throw new DocsProfileError("Additional metadata exceeds the value budget.");
102
+ }
103
+ if (assertMetadataScalar(value)) {
104
+ return;
105
+ }
106
+ const container = value;
107
+ if (depth > 64 || seen.has(container)) {
108
+ throw new DocsProfileError("Additional metadata must be an unshared tree of at most 64 levels.");
109
+ }
110
+ seen.add(container);
111
+ if (Array.isArray(value)) {
112
+ const keys = Reflect.ownKeys(value);
113
+ const dense = keys.length === value.length + 1 && keys.every((key) => key === "length" || (typeof key === "string" && Number.isSafeInteger(Number(key)) && String(Number(key)) === key && Number(key) >= 0 && Number(key) < value.length));
114
+ if (Object.getPrototypeOf(value) !== Array.prototype || value.length > 10_000 || !dense) {
115
+ throw new DocsProfileError("Additional metadata array is sparse, extended, invalid, or exceeds 10000 items.");
116
+ }
117
+ value.forEach((entry) => { assertMetadataValue(entry, depth + 1, budget, seen); });
118
+ return;
119
+ }
120
+ const prototype = Object.getPrototypeOf(container);
121
+ const keys = Reflect.ownKeys(container);
122
+ if ((prototype !== Object.prototype && prototype !== null) || keys.length > 10_000 || keys.some((key) => typeof key !== "string")) {
123
+ throw new DocsProfileError("Additional metadata mapping is invalid or exceeds 10000 properties.");
124
+ }
125
+ for (const key of keys) {
126
+ if (key !== key.normalize("NFC") || RESERVED_KEYS.has(key)) {
127
+ throw new DocsProfileError(`Additional metadata key ${key} is not canonical.`);
128
+ }
129
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
130
+ if (descriptor === undefined || !("value" in descriptor)) {
131
+ throw new DocsProfileError(`Additional metadata key ${key} must be a data property.`);
132
+ }
133
+ assertMetadataValue(descriptor.value, depth + 1, budget, seen);
134
+ }
135
+ }
136
+ export function assertDocumentMetadata(value) {
137
+ assertMetadataValue(value, 0, { values: 0 }, new WeakSet());
138
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
139
+ throw new DocsProfileError("Additional metadata root must be an object.");
140
+ }
141
+ const encoded = JSON.stringify(value);
142
+ if (Buffer.byteLength(encoded, "utf8") > 1_048_576) {
143
+ throw new DocsProfileError("Additional metadata exceeds the 1 MiB JSON budget.");
144
+ }
145
+ }
146
+ //# sourceMappingURL=document-semantics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-semantics.js","sourceRoot":"","sources":["../../src/domain/document-semantics.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,OAAO,GAAG,2BAA2B,CAAC;AAC5C,MAAM,WAAW,GAAG,kCAAkC,CAAC;AACvD,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;AAEzE,SAAS,mBAAmB,CAAC,KAAa;IACxC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,GAAG,KAAK,CAAC,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,MAAM,IAAI,gBAAgB,CAAC,6CAA6C,CAAC,CAAC;IAAA,CAAC;IACrJ,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,SAAS,EAAE,CAAC;QAAA,MAAM,IAAI,gBAAgB,CAAC,oDAAoD,CAAC,CAAC;IAAA,CAAC;AACzI,CAAC"}
@@ -0,0 +1,285 @@
1
+ import type { DocumentDescriptor, DocumentIntent, DocumentJsonValue, DocumentMetadataObject, DocumentPlanV2, DocumentReceiptContract, DocumentTransactionInspectionV2, DocumentationCatalogSnapshotV2 } from "@agent-teams/engineering-foundation/document-authoring";
2
+ export declare const DOCS_PROTOCOL_ID: "agent-teams.docs-protocol";
3
+ export declare const DOCS_PROTOCOL_VERSION: 1;
4
+ export type DocsCommand = "docs.check" | "docs.doctor" | "docs.find" | "docs.info" | "docs.new" | "docs.recover";
5
+ export type DocsCommandOutcome = "authority-stale" | "cancelled" | "conflict" | "execution-failure" | "invalid-input" | "recovery-required" | "success" | "violation";
6
+ export interface DocsDiagnostic {
7
+ readonly message: string;
8
+ readonly phase: "apply" | "authority" | "input" | "planning" | "query" | "recovery";
9
+ readonly ruleId: string;
10
+ readonly severity: "error" | "info" | "warning";
11
+ readonly subject: string;
12
+ }
13
+ export interface DocsCommandEnvelope<Result = unknown> {
14
+ readonly schemaVersion: 1;
15
+ readonly protocol: {
16
+ readonly id: typeof DOCS_PROTOCOL_ID;
17
+ readonly version: typeof DOCS_PROTOCOL_VERSION;
18
+ };
19
+ readonly command: DocsCommand;
20
+ readonly outcome: DocsCommandOutcome;
21
+ readonly diagnostics: readonly DocsDiagnostic[];
22
+ readonly result: Result;
23
+ }
24
+ export interface DocsExecution<Result> {
25
+ readonly envelope: DocsCommandEnvelope<Result>;
26
+ readonly exitCode: 0 | 1 | 2 | 3 | 130;
27
+ }
28
+ export interface DocsTypeProfile {
29
+ readonly type: string;
30
+ readonly initialStatus: string;
31
+ readonly allowedOwnerIds: readonly string[];
32
+ readonly identity: {
33
+ readonly format: "adr-four-digits" | "open-decision-three-digits" | "qualified";
34
+ };
35
+ readonly heading: {
36
+ readonly kind: "id-colon-title" | "title";
37
+ };
38
+ readonly placement: {
39
+ readonly kind: "collection";
40
+ readonly [key: string]: unknown;
41
+ } | {
42
+ readonly kind: "explicit";
43
+ readonly requiredSegmentsInOrder: readonly string[];
44
+ } | {
45
+ readonly kind: "qualified-leaf-index";
46
+ readonly [key: string]: unknown;
47
+ };
48
+ readonly requiredMetadata: readonly string[];
49
+ readonly reachability: {
50
+ readonly kind: "manual-fixed-index";
51
+ readonly indexPath: string;
52
+ } | {
53
+ readonly kind: "manual-colocated-index";
54
+ readonly indexBasename: "README.md";
55
+ readonly pathPrefix: "before-required-segments";
56
+ } | {
57
+ readonly kind: "not-required";
58
+ readonly reason: string;
59
+ };
60
+ }
61
+ export interface DocsProtocolProfile {
62
+ readonly schemaVersion: 1;
63
+ readonly protocol: {
64
+ readonly id: typeof DOCS_PROTOCOL_ID;
65
+ readonly version: typeof DOCS_PROTOCOL_VERSION;
66
+ };
67
+ readonly foundationProfile: {
68
+ readonly metadataSidecarPolicy: "foundation-profile-v2-strict-merge";
69
+ readonly path: string;
70
+ readonly schemaVersion: 2;
71
+ };
72
+ readonly agentWorkflow: {
73
+ readonly skillPath: string;
74
+ };
75
+ readonly semanticValidatorIds: readonly string[];
76
+ }
77
+ export interface FoundationDocsDescription {
78
+ readonly authority: {
79
+ readonly metadataSchema: {
80
+ readonly digest: string;
81
+ readonly path: string;
82
+ readonly size: number;
83
+ };
84
+ readonly metadataSidecar?: {
85
+ readonly digest: string;
86
+ readonly path: string;
87
+ readonly size: number;
88
+ };
89
+ readonly ownerCatalog: {
90
+ readonly digest: string;
91
+ readonly path: string;
92
+ readonly size: number;
93
+ };
94
+ readonly profile: {
95
+ readonly digest: string;
96
+ readonly path: string;
97
+ readonly size: number;
98
+ };
99
+ readonly templates: readonly {
100
+ readonly evidence: {
101
+ readonly digest: string;
102
+ readonly path: string;
103
+ readonly size: number;
104
+ };
105
+ readonly type: string;
106
+ }[];
107
+ };
108
+ readonly projectId: string;
109
+ readonly profileSchemaVersion: 2;
110
+ readonly semanticDigest: string;
111
+ readonly metadataSchemaPath: string;
112
+ readonly metadataSidecar: {
113
+ readonly kind: "none";
114
+ } | {
115
+ readonly kind: "path-metadata-map";
116
+ readonly path: string;
117
+ };
118
+ readonly ownerIds: readonly string[];
119
+ readonly types: readonly DocsTypeProfile[];
120
+ readonly authorityPaths: readonly string[];
121
+ }
122
+ export interface DocsAdoptionInspector {
123
+ inspect(input: {
124
+ readonly authorityPaths: readonly string[];
125
+ readonly consumerRoot: string;
126
+ readonly profilePath: string;
127
+ readonly skillPath: string;
128
+ }): Promise<readonly DocsDiagnostic[]>;
129
+ }
130
+ export interface DocsFindQuery {
131
+ readonly text?: string;
132
+ readonly id?: string;
133
+ readonly type?: string;
134
+ readonly status?: string;
135
+ readonly owner?: string;
136
+ readonly related?: string;
137
+ readonly blockedBy?: string;
138
+ }
139
+ export interface DocsFindDocument extends DocumentDescriptor {
140
+ readonly metadata: DocumentMetadataObject;
141
+ readonly related: readonly string[];
142
+ readonly blockedBy: readonly string[];
143
+ }
144
+ export interface DocsNewRequest {
145
+ readonly apply: boolean;
146
+ readonly consumerRoot: string;
147
+ readonly profilePath: string;
148
+ readonly intent: Omit<DocumentIntent, "schemaVersion" | "related" | "additionalMetadata">;
149
+ readonly related?: readonly string[];
150
+ readonly blockedBy?: readonly string[];
151
+ readonly codeAnchors?: readonly DocumentJsonValue[];
152
+ readonly additionalMetadata?: Readonly<Record<string, DocumentJsonValue>>;
153
+ readonly signal?: AbortSignal;
154
+ }
155
+ export interface DocsCodeAnchor {
156
+ readonly enforcement: "advisory" | "required";
157
+ readonly pattern: string;
158
+ }
159
+ export type DocsNewResult = Readonly<{
160
+ kind: "new";
161
+ reservation: "none";
162
+ writeState: "blocked";
163
+ transaction: Readonly<{
164
+ state: "idle";
165
+ } | {
166
+ state: "recoverable";
167
+ transactionKind: "document";
168
+ recovery: Readonly<{
169
+ commandId: "docs.recover";
170
+ args: Readonly<{
171
+ exactFoundationBuildIdentity: string;
172
+ exactFoundationVersion: string;
173
+ }>;
174
+ }>;
175
+ } | {
176
+ state: "manual-recovery-required";
177
+ transactionKind?: "corrupt" | "document" | "local-mode" | "scaffold" | "transition-residue" | "unknown" | "version-mismatch";
178
+ reason: string;
179
+ recovery?: {
180
+ readonly commandId: "detach" | "docs-recover" | "scaffold-recover";
181
+ readonly args: Readonly<Record<string, string>>;
182
+ };
183
+ }>;
184
+ }> | Readonly<{
185
+ kind: "new";
186
+ reason: "adoption-invalid" | "authority-stale";
187
+ reservation: "none";
188
+ writeState: "blocked";
189
+ }> | Readonly<{
190
+ documentPath: string;
191
+ kind: "new";
192
+ planDigest: `sha256:${string}`;
193
+ reachability: ReachabilityAction;
194
+ reservation: "none";
195
+ writeState: "preview";
196
+ }> | Readonly<{
197
+ documentPath: string;
198
+ kind: "new";
199
+ planDigest: `sha256:${string}`;
200
+ reachability?: ReachabilityAction;
201
+ receipt: Readonly<{
202
+ commit: Readonly<{
203
+ publication: "none" | "preexisting-exact" | "published" | "unknown";
204
+ recoverability: "not-required" | "preserved-for-recovery";
205
+ state: "committed" | "manual-recovery-required" | "not-published" | "recovery-required";
206
+ }>;
207
+ directoryMaterialization?: {
208
+ readonly observedCreatedDirectories: readonly string[];
209
+ readonly plannedDirectories: readonly string[];
210
+ readonly state: "none-created" | "created-and-retained" | "preserved-unknown";
211
+ };
212
+ outcome: DocumentReceiptContract["outcome"];
213
+ }>;
214
+ receiptDigest: `sha256:${string}`;
215
+ receiptOutcome: DocumentReceiptContract["outcome"];
216
+ reservation: "none";
217
+ writeState: "already-applied" | "applied" | "published-recovery-required" | "unchanged" | "unknown";
218
+ }>;
219
+ export interface CodeAnchorMatcher {
220
+ matchedPatterns(input: {
221
+ readonly consumerRoot: string;
222
+ readonly patterns: readonly string[];
223
+ readonly signal?: AbortSignal;
224
+ }): Promise<readonly string[]>;
225
+ }
226
+ export interface ReachabilityAction {
227
+ readonly state: "manual-required" | "not-required";
228
+ readonly indexPath?: string;
229
+ readonly markdownLink?: string;
230
+ readonly reason?: string;
231
+ }
232
+ export interface FoundationDocsPort {
233
+ inspectEnvironment(input: {
234
+ readonly consumerRoot: string;
235
+ readonly signal?: AbortSignal;
236
+ }): Promise<{
237
+ readonly installedFoundationVersion: string;
238
+ readonly installedFoundationBuildIdentity: string;
239
+ readonly filesystem: {
240
+ readonly basis: "platform-contract";
241
+ readonly strictDirectoryDurability: "platform-supported" | "platform-unsupported";
242
+ };
243
+ }>;
244
+ describe(input: {
245
+ readonly consumerRoot: string;
246
+ readonly profilePath: string;
247
+ readonly signal?: AbortSignal;
248
+ }): Promise<FoundationDocsDescription>;
249
+ buildCatalog(input: {
250
+ readonly consumerRoot: string;
251
+ readonly profilePath: string;
252
+ readonly signal?: AbortSignal;
253
+ }): Promise<DocumentationCatalogSnapshotV2>;
254
+ find(input: {
255
+ readonly consumerRoot: string;
256
+ readonly profilePath: string;
257
+ readonly query: DocsFindQuery;
258
+ readonly signal?: AbortSignal;
259
+ }): Promise<readonly DocsFindDocument[]>;
260
+ inspect(consumerRoot: string): Promise<DocumentTransactionInspectionV2>;
261
+ plan(input: {
262
+ readonly consumerRoot: string;
263
+ readonly profilePath: string;
264
+ readonly intent: DocumentIntent;
265
+ readonly parentPolicy: "create-missing-real-directories";
266
+ readonly signal?: AbortSignal;
267
+ }): Promise<DocumentPlanV2>;
268
+ apply(input: {
269
+ readonly consumerRoot: string;
270
+ readonly plan: DocumentPlanV2;
271
+ readonly signal?: AbortSignal;
272
+ }): Promise<DocumentReceiptContract>;
273
+ recover(input: {
274
+ readonly consumerRoot: string;
275
+ readonly signal?: AbortSignal;
276
+ }): Promise<DocumentReceiptContract>;
277
+ }
278
+ export interface DocsProfileReader {
279
+ read(input: {
280
+ readonly consumerRoot: string;
281
+ readonly profilePath: string;
282
+ readonly signal?: AbortSignal;
283
+ }): Promise<DocsProtocolProfile>;
284
+ }
285
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/domain/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,EACd,uBAAuB,EACvB,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,wDAAwD,CAAC;AAEhE,eAAO,MAAM,gBAAgB,EAAG,2BAAoC,CAAC;AACrE,eAAO,MAAM,qBAAqB,EAAG,CAAU,CAAC;AAEhD,MAAM,MAAM,WAAW,GACnB,YAAY,GACZ,aAAa,GACb,WAAW,GACX,WAAW,GACX,UAAU,GACV,cAAc,CAAC;AAEnB,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,WAAW,GACX,UAAU,GACV,mBAAmB,GACnB,eAAe,GACf,mBAAmB,GACnB,SAAS,GACT,WAAW,CAAC;AAEhB,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC;IACpF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB,CAAC,MAAM,GAAG,OAAO;IACnD,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,EAAE,EAAE,OAAO,gBAAgB,CAAC;QACrC,QAAQ,CAAC,OAAO,EAAE,OAAO,qBAAqB,C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AC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;KAC/B,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,KAAK,EAAE;QACV,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;KAC/B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAClC"}
@@ -0,0 +1,3 @@
1
+ export const DOCS_PROTOCOL_ID = "agent-teams.docs-protocol";
2
+ export const DOCS_PROTOCOL_VERSION = 1;
3
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/domain/model.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,gBAAgB,GAAG,2BAAoC,CAAC;AACrE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAU,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type DocsProtocolProfile, type DocsTypeProfile, type ReachabilityAction } from "./model.js";
2
+ export declare class DocsProfileError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ export declare function parseDocsProtocolProfile(value: unknown): DocsProtocolProfile;
6
+ export declare function projectReachability(type: DocsTypeProfile, destination: string, heading: string): ReachabilityAction;
7
+ //# sourceMappingURL=profile-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-policy.d.ts","sourceRoot":"","sources":["../../src/domain/profile-policy.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACxB,MAAM,YAAY,CAAC;AAKpB,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AA6CD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CA2B5E;AAMD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAuBnH"}
@@ -0,0 +1,109 @@
1
+ import { posix } from "node:path";
2
+ import { DOCS_PROTOCOL_ID, DOCS_PROTOCOL_VERSION } from "./model.js";
3
+ const LOWER_ID = /^[a-z0-9][a-z0-9._/-]*$/u;
4
+ const REPOSITORY_PATH = /^(?!.*(?:^|\/)\.{1,2}(?:\/|$))[A-Za-z0-9._@-]+(?:\/[A-Za-z0-9._@-]+)*$/u;
5
+ export class DocsProfileError extends Error {
6
+ constructor(message) {
7
+ super(message);
8
+ this.name = "DocsProfileError";
9
+ }
10
+ }
11
+ function record(value, subject) {
12
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
13
+ throw new DocsProfileError(`${subject} must be an object.`);
14
+ }
15
+ return value;
16
+ }
17
+ function exactKeys(value, keys, subject) {
18
+ const expected = keys.toSorted();
19
+ const actual = Object.keys(value).toSorted();
20
+ if (expected.length !== actual.length || expected.some((key, index) => key !== actual[index])) {
21
+ throw new DocsProfileError(`${subject} must contain exactly: ${expected.join(", ")}.`);
22
+ }
23
+ }
24
+ function lowerId(value, subject) {
25
+ if (typeof value !== "string" || value.length === 0 || value.length > 160 || !LOWER_ID.test(value)) {
26
+ throw new DocsProfileError(`${subject} is invalid.`);
27
+ }
28
+ return value;
29
+ }
30
+ function repositoryPath(value, subject) {
31
+ if (typeof value !== "string" || value.length === 0 || value.length > 512 || !REPOSITORY_PATH.test(value)) {
32
+ throw new DocsProfileError(`${subject} is invalid.`);
33
+ }
34
+ if (Buffer.byteLength(value, "utf8") > 512 || value.split("/").some((segment) => Buffer.byteLength(segment, "utf8") > 255)) {
35
+ throw new DocsProfileError(`${subject} exceeds portable path limits.`);
36
+ }
37
+ return value;
38
+ }
39
+ function validatorIds(value) {
40
+ if (!Array.isArray(value) || value.length > 256) {
41
+ throw new DocsProfileError("profile.semanticValidatorIds must be a bounded array.");
42
+ }
43
+ const entries = value.map((entry, index) => lowerId(entry, `profile.semanticValidatorIds[${index}]`));
44
+ if (new Set(entries).size !== entries.length) {
45
+ throw new DocsProfileError("profile.semanticValidatorIds must not contain duplicates.");
46
+ }
47
+ return Object.freeze(entries.toSorted((left, right) => Buffer.compare(Buffer.from(left), Buffer.from(right))));
48
+ }
49
+ export function parseDocsProtocolProfile(value) {
50
+ const candidate = record(value, "profile");
51
+ exactKeys(candidate, ["schemaVersion", "protocol", "foundationProfile", "agentWorkflow", "semanticValidatorIds"], "profile");
52
+ if (candidate["schemaVersion"] !== 1) {
53
+ throw new DocsProfileError("profile.schemaVersion must be 1.");
54
+ }
55
+ const protocol = record(candidate["protocol"], "profile.protocol");
56
+ exactKeys(protocol, ["id", "version"], "profile.protocol");
57
+ if (protocol["id"] !== DOCS_PROTOCOL_ID || protocol["version"] !== DOCS_PROTOCOL_VERSION) {
58
+ throw new DocsProfileError(`profile.protocol must be ${DOCS_PROTOCOL_ID}/v${DOCS_PROTOCOL_VERSION}.`);
59
+ }
60
+ const foundationProfile = record(candidate["foundationProfile"], "profile.foundationProfile");
61
+ exactKeys(foundationProfile, ["metadataSidecarPolicy", "path", "schemaVersion"], "profile.foundationProfile");
62
+ if (foundationProfile["schemaVersion"] !== 2 || foundationProfile["metadataSidecarPolicy"] !== "foundation-profile-v2-strict-merge") {
63
+ throw new DocsProfileError("profile.foundationProfile must route to Foundation profile v2 strict sidecar merge.");
64
+ }
65
+ const workflow = record(candidate["agentWorkflow"], "profile.agentWorkflow");
66
+ exactKeys(workflow, ["skillPath"], "profile.agentWorkflow");
67
+ return Object.freeze({
68
+ schemaVersion: 1,
69
+ protocol: Object.freeze({ id: DOCS_PROTOCOL_ID, version: DOCS_PROTOCOL_VERSION }),
70
+ foundationProfile: Object.freeze({
71
+ metadataSidecarPolicy: "foundation-profile-v2-strict-merge",
72
+ path: repositoryPath(foundationProfile["path"], "profile.foundationProfile.path"),
73
+ schemaVersion: 2
74
+ }),
75
+ agentWorkflow: Object.freeze({ skillPath: repositoryPath(workflow["skillPath"], "profile.agentWorkflow.skillPath") }),
76
+ semanticValidatorIds: validatorIds(candidate["semanticValidatorIds"])
77
+ });
78
+ }
79
+ function markdownLabel(value) {
80
+ return value.replace(/\\/gu, "\\\\").replace(/\[/gu, "\\[").replace(/\]/gu, "\\]");
81
+ }
82
+ export function projectReachability(type, destination, heading) {
83
+ const strategy = type.reachability;
84
+ if (strategy.kind === "not-required") {
85
+ return Object.freeze({ state: "not-required", reason: strategy.reason });
86
+ }
87
+ let indexPath;
88
+ if (strategy.kind === "manual-fixed-index") {
89
+ indexPath = strategy.indexPath;
90
+ }
91
+ else {
92
+ if (type.placement.kind !== "explicit") {
93
+ throw new DocsProfileError("Colocated reachability requires explicit Foundation placement authority.");
94
+ }
95
+ const destinationSegments = destination.split("/");
96
+ const requiredSegments = type.placement.requiredSegmentsInOrder;
97
+ const candidates = destinationSegments.flatMap((_segment, start) => requiredSegments.every((segment, offset) => destinationSegments[start + offset] === segment) ? [start] : []);
98
+ if (candidates.length !== 1 || candidates[0] === undefined || candidates[0] === 0) {
99
+ throw new DocsProfileError(`Cannot derive one colocated index for ${destination}.`);
100
+ }
101
+ indexPath = `${destinationSegments.slice(0, candidates[0]).join("/")}/${strategy.indexBasename}`;
102
+ }
103
+ const relative = posix.relative(posix.dirname(indexPath), destination);
104
+ if (relative.length === 0) {
105
+ throw new DocsProfileError("Reachability index cannot equal the document path.");
106
+ }
107
+ return Object.freeze({ state: "manual-required", indexPath, markdownLink: `[${markdownLabel(heading)}](${relative})` });
108
+ }
109
+ //# sourceMappingURL=profile-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-policy.js","sourceRoot":"","sources":["../../src/domain/profile-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,OAAO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AC,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC;IACnG,CAAC;IACD,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;IACvE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAAA,MAAM,IAAI,gBAAgB,CAAC,oDAAoD,CAAC,CAAC;IAAA,CAAC;IAC9G,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,aAAa,CAAC,OAAO,CAAC,KAAK,QAAQ,GAAG,EAAE,CAAC,CAAC;AAC1H,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { renderDocsHuman, runDocsCli } from "./composition/cli.js";
2
+ export { docsCheck, docsDoctor, docsFind, docsInfo, docsNew, docsRecover } from "./composition/node-docs-api.js";
3
+ export type { DocsConsumerRequest } from "./composition/node-docs-api.js";
4
+ export { DOCS_PROTOCOL_ID, DOCS_PROTOCOL_VERSION } from "./domain/model.js";
5
+ export type { DocsCommand, DocsCommandEnvelope, DocsCommandOutcome, DocsCodeAnchor, DocsDiagnostic, DocsExecution, DocsFindDocument, DocsFindQuery, DocsNewResult, DocsNewRequest, DocsProtocolProfile, DocsTypeProfile, ReachabilityAction } from "./domain/model.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,WAAW,EACZ,MAAM,gCAAgC,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EACnB,MAAM,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { renderDocsHuman, runDocsCli } from "./composition/cli.js";
2
+ export { docsCheck, docsDoctor, docsFind, docsInfo, docsNew, docsRecover } from "./composition/node-docs-api.js";
3
+ export { DOCS_PROTOCOL_ID, DOCS_PROTOCOL_VERSION } from "./domain/model.js";
4
+ //# sourceMappingURL=index.js.map