archctx-contracts 0.10.0 → 0.11.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "archcontext.capabilities/v1",
|
|
3
|
-
"package": { "name": "archctx", "version": "0.
|
|
3
|
+
"package": { "name": "archctx", "version": "0.11.0" },
|
|
4
4
|
"protocols": {
|
|
5
5
|
"projectionRequest": "archcontext.projection-request/v1",
|
|
6
6
|
"projectionResult": "archcontext.projection-result/v2",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": "archcontext.product-version-manifest/v1",
|
|
3
3
|
"product": {
|
|
4
4
|
"name": "archctx",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.11.0",
|
|
6
6
|
"distribution": "one-package"
|
|
7
7
|
},
|
|
8
8
|
"packageManager": "bun@1.4.3",
|
|
@@ -12,25 +12,25 @@
|
|
|
12
12
|
"surfaces": {
|
|
13
13
|
"cli": {
|
|
14
14
|
"packageName": "@archcontext/surfaces",
|
|
15
|
-
"version": "0.
|
|
15
|
+
"version": "0.11.0",
|
|
16
16
|
"entrypoint": "archctx"
|
|
17
17
|
},
|
|
18
18
|
"daemon": {
|
|
19
19
|
"packageName": "@archcontext/local-runtime",
|
|
20
|
-
"version": "0.
|
|
20
|
+
"version": "0.11.0",
|
|
21
21
|
"entrypoint": "archctx daemon start",
|
|
22
22
|
"rpcSchemaVersion": "archcontext.runtime-rpc/v2"
|
|
23
23
|
},
|
|
24
24
|
"mcp": {
|
|
25
25
|
"packageName": "@archcontext/surfaces",
|
|
26
|
-
"version": "0.
|
|
26
|
+
"version": "0.11.0",
|
|
27
27
|
"entrypoint": "archctx mcp",
|
|
28
28
|
"transport": "stdio"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"schemas": {
|
|
32
32
|
"schemaSetVersion": "2026-06-25.al0-ledger",
|
|
33
|
-
"contractsPackageVersion": "0.
|
|
33
|
+
"contractsPackageVersion": "0.11.0",
|
|
34
34
|
"reviewChallenge": "archcontext.review-challenge/v2",
|
|
35
35
|
"attestation": "archcontext.attestation/v2",
|
|
36
36
|
"deviceIdentity": "archcontext.device-identity/v1",
|
package/package.json
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { isRepoRelativePosixPath } from "./schema";
|
|
2
|
+
|
|
3
|
+
export const ARCHITECTURE_HISTORY_SCHEMA_VERSION = "archcontext.architecture-history/v1" as const;
|
|
4
|
+
export const ARCHITECTURE_HISTORY_MERMAID_SCHEMA_VERSION = "archcontext.architecture-history-mermaid/v1" as const;
|
|
5
|
+
export const ARCHITECTURE_HISTORY_DERIVATION_VERSION = "v3" as const;
|
|
6
|
+
|
|
7
|
+
export type HistoryErrorCode = "history-model-layout-unsupported" | "history-model-missing" | "history-model-invalid" | "history-model-too-large";
|
|
8
|
+
export interface HistoryNode { id: string; name: string; domain: string | null }
|
|
9
|
+
export interface HistoryEdge { source: string; target: string }
|
|
10
|
+
export interface HistoryStructureNode { id: string; kind: "capability" | "module" | "component"; name: string; capability: string | null }
|
|
11
|
+
export interface HistoryDelta {
|
|
12
|
+
baseRev: string | null;
|
|
13
|
+
added: Array<Pick<HistoryStructureNode, "id" | "kind" | "capability">>;
|
|
14
|
+
removed: Array<Pick<HistoryStructureNode, "id" | "kind" | "capability">>;
|
|
15
|
+
renamed: Array<Pick<HistoryStructureNode, "id" | "kind" | "capability"> & { from: string; to: string }>;
|
|
16
|
+
edgesChanged: { added: HistoryEdge[]; removed: HistoryEdge[] };
|
|
17
|
+
}
|
|
18
|
+
export type HistoryState = { nodes: HistoryNode[]; edges: HistoryEdge[]; structure: HistoryStructureNode[]; error?: never } | { nodes: null; edges: null; structure: null; error: { code: HistoryErrorCode; path?: string } };
|
|
19
|
+
export type HistoryMilestone = { rev: string; date: string; subject: string } & ({ nodes: HistoryNode[]; edges: HistoryEdge[]; delta: HistoryDelta; error?: never } | { nodes: null; edges: null; delta: null; error: { code: HistoryErrorCode; path?: string } });
|
|
20
|
+
export interface ArchitectureHistory { schemaVersion: typeof ARCHITECTURE_HISTORY_SCHEMA_VERSION; head: string; total: number; offset: number; limit: number; milestones: HistoryMilestone[] }
|
|
21
|
+
|
|
22
|
+
const object = (v: unknown): v is Record<string, unknown> => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
23
|
+
const string = (v: unknown): v is string => typeof v === "string";
|
|
24
|
+
const edge = (v: unknown) => object(v) && string(v.source) && string(v.target);
|
|
25
|
+
const kind = (v: unknown) => v === "capability" || v === "module" || v === "component";
|
|
26
|
+
const item = (v: unknown) => object(v) && string(v.id) && kind(v.kind) && (v.capability === null || string(v.capability)) && (v.kind !== "capability" || v.capability === v.id);
|
|
27
|
+
const structure = (v: unknown) => item(v) && object(v) && string(v.name);
|
|
28
|
+
const node = (v: unknown) => object(v) && string(v.id) && string(v.name) && (v.domain === null || string(v.domain));
|
|
29
|
+
const errors: readonly string[] = ["history-model-layout-unsupported", "history-model-missing", "history-model-invalid", "history-model-too-large"];
|
|
30
|
+
const sha = (v: unknown) => string(v) && /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(v);
|
|
31
|
+
const count = (v: unknown): v is number => typeof v === "number" && Number.isSafeInteger(v) && v >= 0;
|
|
32
|
+
const error = (v: unknown) => object(v) && string(v.code) && errors.includes(v.code) && (v.path === undefined || (string(v.path) && isRepoRelativePosixPath(v.path)));
|
|
33
|
+
const list = (v: unknown, check: (item: unknown) => unknown) => Array.isArray(v) && v.every(check);
|
|
34
|
+
|
|
35
|
+
/** Cache entries are untrusted and never authority for malformed data. */
|
|
36
|
+
export function decodeArchitectureHistoryState(value: unknown): HistoryState | undefined {
|
|
37
|
+
if (!object(value)) return undefined;
|
|
38
|
+
if (value.nodes === null && value.edges === null && value.structure === null && error(value.error)) return value as unknown as HistoryState;
|
|
39
|
+
if (value.error === undefined && list(value.nodes, node) && list(value.edges, edge) && list(value.structure, structure)) return value as unknown as HistoryState;
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function architectureHistoryIssues(value: unknown): string[] {
|
|
44
|
+
if (!object(value) || value.schemaVersion !== ARCHITECTURE_HISTORY_SCHEMA_VERSION || !sha(value.head) || !count(value.total) || !count(value.offset) || !count(value.limit) || value.limit > 1000 || !Array.isArray(value.milestones) || value.milestones.length > value.limit || value.milestones.length > Math.max(0, value.total - value.offset)) return ["invalid history envelope"];
|
|
45
|
+
let previousValid: string | null = null;
|
|
46
|
+
const valid = value.milestones.every((m: unknown) => {
|
|
47
|
+
if (!object(m) || !sha(m.rev) || !string(m.date) || !string(m.subject)) return false;
|
|
48
|
+
if (m.nodes === null && m.edges === null && m.delta === null) return error(m.error);
|
|
49
|
+
if (m.error !== undefined || !list(m.nodes, node) || !list(m.edges, edge) || !object(m.delta) || (m.delta.baseRev !== null && !sha(m.delta.baseRev)) || (previousValid !== null && m.delta.baseRev !== previousValid) || (previousValid === null && value.offset === 0 && m.delta.baseRev !== null)) return false;
|
|
50
|
+
previousValid = m.rev as string;
|
|
51
|
+
const renamed = (v: unknown) => item(v) && object(v) && string(v.from) && string(v.to);
|
|
52
|
+
return list(m.delta.added, item) && list(m.delta.removed, item) && list(m.delta.renamed, renamed) && object(m.delta.edgesChanged) && list(m.delta.edgesChanged.added, edge) && list(m.delta.edgesChanged.removed, edge);
|
|
53
|
+
});
|
|
54
|
+
return valid ? [] : ["invalid history milestones"];
|
|
55
|
+
}
|
|
56
|
+
export function decodeArchitectureHistory(value: unknown): ArchitectureHistory | undefined {
|
|
57
|
+
return architectureHistoryIssues(value).length === 0 ? value as ArchitectureHistory : undefined;
|
|
58
|
+
}
|
package/src/failure.ts
CHANGED
|
@@ -40,6 +40,7 @@ export const CODE_FACTS_ISSUE_MESSAGES = Object.freeze({
|
|
|
40
40
|
});
|
|
41
41
|
/** Each reason has a closed fact vocabulary. No source text or recovery binding is a summary fact. */
|
|
42
42
|
const policies: Record<string, Policy> = {
|
|
43
|
+
"history-shallow-repository": { code: "AC_PRECONDITION_FAILED", message: "Architecture history requires a complete Git repository.", action: "unshallow-repository" },
|
|
43
44
|
"code-facts-read-not-ready": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "The existing CodeGraph index does not attest to the current source population.", facts: { issues: "codeFactsIssues" }, action: "codegraph-sync", retryable: false },
|
|
44
45
|
"code-facts-snapshot-changed": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "Source or index inputs changed while reading the private snapshot.", action: "retry-read", retryable: true, facts: {} },
|
|
45
46
|
"code-facts-snapshot-limit-exceeded": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "The private CodeGraph snapshot exceeds its 512 MiB or 100000 entry limit.", action: "reduce-snapshot-size", retryable: false, facts: {} },
|
|
@@ -587,6 +588,7 @@ const nativeEnums: Readonly<Record<string, readonly string[]>> = {
|
|
|
587
588
|
],
|
|
588
589
|
"operation": [
|
|
589
590
|
"rev-parse",
|
|
591
|
+
"log",
|
|
590
592
|
"ls-tree",
|
|
591
593
|
"ls-files",
|
|
592
594
|
"cat-file"
|
package/src/index.ts
CHANGED
package/src/product-version.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const ARCHCONTEXT_PRODUCT_NAME = "archctx";
|
|
2
|
-
export const ARCHCONTEXT_PRODUCT_VERSION = "0.
|
|
2
|
+
export const ARCHCONTEXT_PRODUCT_VERSION = "0.11.0";
|
|
3
3
|
export const ARCHCONTEXT_PACKAGE_MANAGER = "bun@1.4.3";
|
|
4
4
|
export const ARCHCONTEXT_NODE_RANGE = ">=22.22 <26";
|
|
5
5
|
export const LOCAL_RUNTIME_RPC_SCHEMA_VERSION = "archcontext.runtime-rpc/v2";
|