archctx-contracts 0.14.1 → 0.16.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.14.1" },
3
+ "package": { "name": "archctx", "version": "0.16.0" },
4
4
  "protocols": {
5
5
  "projectionRequest": "archcontext.projection-request/v1",
6
6
  "projectionResult": "archcontext.projection-result/v3",
@@ -2,35 +2,35 @@
2
2
  "schemaVersion": "archcontext.product-version-manifest/v1",
3
3
  "product": {
4
4
  "name": "archctx",
5
- "version": "0.14.1",
5
+ "version": "0.16.0",
6
6
  "distribution": "one-package"
7
7
  },
8
- "packageManager": "bun@1.4.3",
8
+ "packageManager": "bun@1.4.4",
9
9
  "engines": {
10
10
  "node": ">=22.22 <26"
11
11
  },
12
12
  "surfaces": {
13
13
  "cli": {
14
14
  "packageName": "@archcontext/surfaces",
15
- "version": "0.14.1",
15
+ "version": "0.16.0",
16
16
  "entrypoint": "archctx"
17
17
  },
18
18
  "daemon": {
19
19
  "packageName": "@archcontext/local-runtime",
20
- "version": "0.14.1",
20
+ "version": "0.16.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.14.1",
26
+ "version": "0.16.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.14.1"
33
+ "contractsPackageVersion": "0.16.0"
34
34
  },
35
35
  "runtime": {
36
36
  "localRpc": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archctx-contracts",
3
- "version": "0.14.1",
3
+ "version": "0.16.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
package/src/failure.ts CHANGED
@@ -34,21 +34,16 @@ export interface FailureEnvelope<C extends FailureCode = FailureCode> {
34
34
  type Policy = { code: FailureCode; message: string; fields?: readonly string[]; action?: string; facts?: Readonly<Record<string, string>>; native?: boolean; recovery?: boolean; journalRecovery?: boolean; retryable?: boolean };
35
35
  /** Closed repository diagnostics. Messages contain no process output or filesystem paths. */
36
36
  export const CODE_FACTS_ISSUE_MESSAGES = Object.freeze({
37
- "not-initialized": "CodeGraph repository status is not initialized",
38
37
  "version-mismatch": "CodeGraph repository status version mismatch",
39
38
  "project-path-mismatch": "CodeGraph repository project path mismatch",
40
39
  "index-incomplete": "CodeGraph repository index is not complete and compatible",
41
40
  "extraction-version-mismatch": "CodeGraph repository extraction version mismatch",
42
- "worktree-mismatch": "CodeGraph repository worktree mismatch",
43
41
  "pending-source-changes": "CodeGraph repository index has pending or unreported source changes"
44
42
  });
45
43
  /** Each reason has a closed fact vocabulary. No source text or recovery binding is a summary fact. */
46
44
  const policies: Record<string, Policy> = {
47
45
  "history-shallow-repository": { code: "AC_PRECONDITION_FAILED", message: "Architecture history requires a complete Git repository.", action: "unshallow-repository", facts: { historyReadReason: "optional:historyReadReason" } },
48
46
  "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 },
49
- "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: {} },
50
- "code-facts-snapshot-limit-exceeded": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "The private CodeGraph snapshot copy exceeds its 512 MiB or 100000 entry limit.", action: "reduce-snapshot-size", retryable: false, facts: { limit: "snapshotLimit", maxBytes: "uint", maxEntries: "uint", sourceBytes: "uint", sourceEntries: "uint", gitBytes: "uint", gitEntries: "uint", gitObjectEntries: "uint", indexBytes: "uint", indexEntries: "uint" } },
51
- "code-facts-snapshot-layout-unsupported": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "The repository layout cannot be safely isolated for a zero-write CodeGraph read.", action: "inspect-repository-layout", retryable: false, facts: {} },
52
47
  "daemon-root-missing": { code: "AC_RUNTIME_UNAVAILABLE", message: "The daemon start worktree no longer exists. Stop this daemon using its workspace state directory.", action: "stop-targeted-daemon", retryable: false, facts: {} },
53
48
  "changeset-receipt-journal-unavailable": { code: "AC_PRECONDITION_FAILED", message: "No committed ChangeSet journal exists for this repository and journal id.", action: "select-committed-journal" },
54
49
  "changeset-receipt-transition-unavailable": { code: "AC_PRECONDITION_FAILED", message: "This journal has no recorded model transition; a complete receipt cannot be exported.", action: "inspect-journal-evidence" },
@@ -63,7 +58,9 @@ const policies: Record<string, Policy> = {
63
58
  "projection-manifest-invalid": { code: "AC_PRECONDITION_FAILED", message: "The committed projection manifest violates its contract." },
64
59
  "architecture-model-ignored": { code: "AC_PRECONDITION_FAILED", action: "commit-architecture-model", message: "Git ignore rules exclude architecture model paths, so the model cannot be committed and a manifest digest cannot rebuild it. Remove or narrow the rule, commit the model, then retry adoption. The diagnostic command prints each deciding rule.", facts: { pathCount: "uint", paths: "optional:diagnosticPaths", commands: "optional:diagnosticCommands", omittedPathCount: "uint" } },
65
60
  "projection-footprint-uncovered": { code: "AC_PRECONDITION_FAILED", message: "Declared source footprints lack a projection target." },
66
- "index-missing": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "Required code facts have no available index. Run codegraph init." },
61
+ "index-missing": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "Required code facts have no available index. Run codegraph init, or in a linked worktree run archctx sync after archctx sync in the primary checkout has published a base index." },
62
+ "index-base-building": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "This worktree has no index and the primary checkout is publishing its first base index. Retry after it finishes.", retryable: true },
63
+ "index-open-failed": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "The CodeGraph index exists but could not be opened and read read-only. Run archctx doctor --json.", action: "inspect-diagnostics", retryable: false },
67
64
  "code-facts-not-ready": { code: "AC_CODE_FACTS_NOT_READY", message: "Repository code facts are not ready. Run archctx doctor --json and follow the reported action.", facts: { issues: "codeFactsIssues" } },
68
65
  "checkpoint-input-invalid": { code: "AC_SCHEMA_INVALID", message: "Checkpoint arguments violate the declared input schema.", fields: ["issueCount"], action: "correct-command-arguments" },
69
66
  "cli-input-invalid": { code: "AC_SCHEMA_INVALID", message: "Command arguments violate the declared input contract.", action: "correct-command-arguments" },
@@ -393,7 +390,6 @@ const localEnums: Readonly<Record<string, readonly string[]>> = {
393
390
  depsField: ["from", "into", "importNodeLimit", "edgeLimit"],
394
391
  depsIssue: ["unknown-node", "invalid-limit", "missing-value"],
395
392
  snapshotField: ["repositoryId", "workspaceId", "headSha", "worktreeDigest"],
396
- snapshotLimit: ["bytes", "entries"],
397
393
  jobsField: ["workerId"],
398
394
  observedDomain: ["observed"],
399
395
  inputAvailability: ["unavailable"],
package/src/ports.ts CHANGED
@@ -20,12 +20,39 @@ export interface RepositorySnapshot {
20
20
  modelDigest?: string;
21
21
  }
22
22
 
23
+ /**
24
+ * What a sync did to the repository's shared CodeGraph base index (#608). `published`: a new base
25
+ * is current. `current`: the base already names this `HEAD`. `skipped-busy`: another refresh holds
26
+ * the lock. `skipped-moved`: a build ran, the index revision moved or `HEAD` moved during the
27
+ * snapshot. `skipped-unborn`: `HEAD` names no commit. `not-primary`: a linked worktree never
28
+ * publishes. `skipped-unverifiable`: the SDK resolves another database than `.codegraph/codegraph.db`.
29
+ * `skipped-unproven`: `current.json` has no creation record, or `refresh.lock` is stale; archctx
30
+ * replaces or removes neither, and lists it in `codeGraphKept`. `failed`: the snapshot or the
31
+ * publish failed; the sync itself still succeeded.
32
+ */
33
+ /**
34
+ * A path at a name the base index uses that archctx left in place, with how to clean it up by hand.
35
+ * archctx removes only what it created in the same run, so leftovers of a crashed seed, old
36
+ * unreferenced snapshots, a stale `refresh.lock` and an unproven `current.json` stay.
37
+ */
38
+ export interface CodeGraphKeptPathV1 {
39
+ path: string;
40
+ kind: "abandoned-staging" | "staging-not-removed" | "unreferenced-snapshot" | "snapshot-not-removed" | "stale-refresh-lock" | "unproven-pointer";
41
+ cleanup: string;
42
+ }
43
+
44
+ export type CodeGraphBaseRefreshV1 = "published" | "current" | "skipped-busy" | "skipped-moved" | "skipped-unborn" | "skipped-unverifiable" | "skipped-unproven" | "not-primary" | "failed";
45
+
23
46
  export interface CodeFactsSnapshot {
24
47
  provider: "codegraph";
25
48
  version: string;
26
49
  schemaDigest: string;
27
50
  indexedAt: string;
28
51
  workspaceDigest: string;
52
+ /** Set by a provider that refreshes the base index after its sync. */
53
+ codeGraphBase?: CodeGraphBaseRefreshV1;
54
+ /** Paths at names the base index uses that archctx left in place for hand cleanup. */
55
+ codeGraphKept?: CodeGraphKeptPathV1[];
29
56
  }
30
57
 
31
58
  export interface NormalizedSymbol {
@@ -95,24 +122,12 @@ export interface NormalizedCodeContext {
95
122
  digest: string;
96
123
  }
97
124
 
98
- export interface NormalizedImpact {
99
- symbolId: string;
100
- callers: NormalizedEdge[];
101
- callees: NormalizedEdge[];
102
- affectedPaths: string[];
103
- }
104
-
105
125
  export interface SymbolQuery {
106
126
  query: string;
107
127
  kinds?: string[];
108
128
  limit?: number;
109
129
  }
110
130
 
111
- export interface ImpactQuery {
112
- symbolId: string;
113
- depth: number;
114
- }
115
-
116
131
  export interface SourceSelector {
117
132
  path: string;
118
133
  symbolId?: string;
@@ -121,15 +136,24 @@ export interface SourceSelector {
121
136
  }
122
137
 
123
138
  export interface CodeFactsPort {
124
- /** Read-only compatibility check before the existing incremental sync. No retry or rebuild. */
125
- assertCanSync?(workspaceRoot: string): void;
126
- ensureReady(workspace: WorkspaceRef): Promise<CodeFactsSnapshot>;
139
+ /**
140
+ * Runs before a command's incremental sync: seeds a missing index from the repository's base
141
+ * index (#608), then refuses an incompatible one. No retry or rebuild.
142
+ */
143
+ prepareSync?(workspaceRoot: string): void;
144
+ /**
145
+ * Makes `workspace`'s facts readable. An existing index is verified read-only, on the first call
146
+ * and every later one. Only a command that owns a sync passes `syncOnMiss`, which syncs the
147
+ * workspace once when this port has not verified it yet.
148
+ */
149
+ ensureReady(workspace: WorkspaceRef, options?: { syncOnMiss?: boolean }): Promise<CodeFactsSnapshot>;
127
150
  sync(input: { workspace: WorkspaceRef; changedPaths?: string[] }): Promise<CodeFactsSnapshot>;
128
- buildTaskContext(input: { task: string; maxSymbols: number; includeSource: boolean; changedPaths?: string[] }): Promise<NormalizedCodeContext>;
129
- findSymbols(query: SymbolQuery): Promise<NormalizedSymbol[]>;
130
- getImpact(input: ImpactQuery): Promise<NormalizedImpact>;
131
- getCallers(symbolId: string): Promise<NormalizedEdge[]>;
132
- getCallees(symbolId: string): Promise<NormalizedEdge[]>;
151
+ /**
152
+ * Reads facts of `workspace`'s own index only, after `ensureReady` or `sync` of that workspace;
153
+ * a workspace with no successful sync, or whose index changed since it was verified, is refused.
154
+ */
155
+ buildTaskContext(input: { workspace: WorkspaceRef; task: string; maxSymbols: number; includeSource: boolean; changedPaths?: string[] }): Promise<NormalizedCodeContext>;
156
+ findSymbols(query: SymbolQuery, workspace: WorkspaceRef): Promise<NormalizedSymbol[]>;
133
157
  resolveEvidence(selectors: SourceSelector[]): Promise<ObservedEvidence[]>;
134
158
  }
135
159
 
@@ -1,6 +1,6 @@
1
1
  export const ARCHCONTEXT_PRODUCT_NAME = "archctx";
2
- export const ARCHCONTEXT_PRODUCT_VERSION = "0.14.1";
3
- export const ARCHCONTEXT_PACKAGE_MANAGER = "bun@1.4.3";
2
+ export const ARCHCONTEXT_PRODUCT_VERSION = "0.16.0";
3
+ export const ARCHCONTEXT_PACKAGE_MANAGER = "bun@1.4.4";
4
4
  export const ARCHCONTEXT_NODE_RANGE = ">=22.22 <26";
5
5
  export const LOCAL_RUNTIME_RPC_SCHEMA_VERSION = "archcontext.runtime-rpc/v2";
6
6
  export const ARCHCONTEXT_SCHEMA_SET_VERSION = "2026-07-11.explorer-view-v2";