@cat-factory/agents 0.99.0 → 0.101.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.
@@ -28,15 +28,22 @@ export interface FoundationalServiceSourceServiceDependencies {
28
28
  * The shared repo-source engine (`repoSourceSync`) owns the mechanics that every repo-sourced
29
29
  * library gets identically — pin the head commit BEFORE reading, run the reconcile, sweep
30
30
  * tombstones by produced id, stamp the sync state, invalidate only on a real change. The
31
- * differentiator supplied here is what a UNIT is, and there are two of them:
31
+ * differentiator supplied here is what a UNIT is, and there are three of them:
32
32
  *
33
33
  * - **`directory`**: one service per immediate subdirectory, identified by its `service.md`.
34
+ * - **`folder`**: one service, named on the LINK, whose contracts are every contract document
35
+ * found under `dirPath` — optionally including its subfolders.
34
36
  * - **`files`**: one service, named on the LINK, whose contracts are the linked file paths.
35
- * There is no directory convention to read identity from, which is exactly why the link
36
- * carries it (refused at the write boundary otherwise).
37
37
  *
38
- * Both modes anchor their staleness probe on ONE directory (`dirPath`), so a `files` source
39
- * with a dozen linked files still costs a single commit read per freshness check.
38
+ * Neither single-service mode has a directory convention to read identity from, which is
39
+ * exactly why the link carries it (refused at the write boundary otherwise). What separates
40
+ * them is WHEN the file set is decided: `files` pins the paths at link time, so a contract
41
+ * added upstream stays invisible until somebody edits the link, while `folder` re-discovers
42
+ * the set on every sync — which is why a spec directory that grows wants the folder shape.
43
+ *
44
+ * All three anchor their staleness probe on ONE directory (`dirPath`), so a `files` source with
45
+ * a dozen linked files, and a `folder` source with a whole subtree, each still cost a single
46
+ * commit read per freshness check.
40
47
  */
41
48
  export declare class FoundationalServiceSourceService {
42
49
  private readonly deps;
@@ -66,17 +73,58 @@ export declare class FoundationalServiceSourceService {
66
73
  */
67
74
  refreshStale(staleAfterMs: number, limit: number): Promise<number>;
68
75
  private runSync;
76
+ /**
77
+ * Log the two coverage outcomes an operator would want to know about, each named for the fix
78
+ * it needs — a truncated walk asks for a narrower link, a missing folder for a corrected one.
79
+ *
80
+ * This is the ONLY standing signal an AUTOREFRESH pass leaves: the sweep discards the sync
81
+ * result, so a folder that vanished upstream reaches a human through this line or not at all.
82
+ * (A manual resync also surfaces both on the SPA's toast.)
83
+ */
84
+ private warnAboutCoverage;
85
+ /**
86
+ * `folder` mode: ONE service, named on the link, whose contracts are every contract document
87
+ * under the linked folder (and its subfolders when the link says so).
88
+ */
89
+ private reconcileFolder;
90
+ /** Read the folder root's optional `service.md`, or null when there is none / it is unreadable. */
91
+ private readFolderOverview;
69
92
  /** `directory` mode: one service per immediate subdirectory carrying a `service.md`. */
70
93
  private reconcileDirectories;
71
94
  /** `files` mode: ONE service, named on the link, whose contracts are the linked paths. */
72
95
  private reconcileFiles;
96
+ /**
97
+ * The identity a single-service source names, or a refusal.
98
+ *
99
+ * Guaranteed by the link-time `v.check`, but a stored row outlives the schema that wrote it —
100
+ * so this is a real guard, not a type-narrowing convenience. It returns BOTH proven fields
101
+ * rather than just the id, so a caller narrows by using the result instead of re-asserting
102
+ * `serviceName as string` at each use — a cast that would survive the guard being weakened.
103
+ */
104
+ private requireNamedService;
73
105
  /**
74
106
  * Read the given repo paths and keep the ones that ARE contract documents. A file whose
75
107
  * format is unrecognised is skipped rather than stored as an opaque blob: the format is what
76
108
  * tells a downstream agent how to read it, and a "contract" nobody can interpret is worse in
77
109
  * an agent's context than an absent one.
110
+ *
111
+ * A path that could never yield a format is dropped without a read and without a count — it
112
+ * is a README or a `package.json` beside the specs, not a contract that failed. Everything
113
+ * else that fails is COUNTED on the report and NAMED in the log (see {@link skip}), because a
114
+ * link that produced fewer contracts than its author expected has no other explanation
115
+ * available to them.
78
116
  */
79
117
  private readContracts;
118
+ /**
119
+ * Count one dropped candidate and name it in the log.
120
+ *
121
+ * The count alone answers "did I lose anything?" but never "which file, and why?" — and one
122
+ * reason is undiagnosable without the log line: a DUPLICATE contract id silently keeps the
123
+ * first claimant, so the losing document is absent from the catalog under a name that is
124
+ * present. `debug` rather than `warn` because a thin catalog entry is usually intended (prose
125
+ * and drafts sit beside specs); the count on the sync result is what asks for attention.
126
+ */
127
+ private skip;
80
128
  private writeService;
81
129
  private listDir;
82
130
  private readFile;
@@ -1 +1 @@
1
- {"version":3,"file":"FoundationalServiceSourceService.d.ts","sourceRoot":"","sources":["../../src/foundationalServices/FoundationalServiceSourceService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,+BAA+B,EAC/B,6BAA6B,EAC7B,kCAAkC,EACnC,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAEV,qBAAqB,EACrB,KAAK,EAEL,6BAA6B,EAE7B,mCAAmC,EACnC,YAAY,EACZ,WAAW,EACX,MAAM,EAEP,MAAM,qBAAqB,CAAA;AAyB5B;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG,CAC9C,SAAS,EAAE,4BAA4B,EACvC,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;AAE3B,MAAM,WAAW,4CAA4C;IAC3D,mCAAmC,EAAE,mCAAmC,CAAA;IACxE,6BAA6B,EAAE,6BAA6B,CAAA;IAC5D,qBAAqB,EAAE,qBAAqB,CAAA;IAC5C,YAAY,EAAE,YAAY,CAAA;IAC1B,qBAAqB,EAAE,iCAAiC,CAAA;IACxD,WAAW,EAAE,WAAW,CAAA;IACxB,KAAK,EAAE,KAAK,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,oFAAoF;IACpF,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,4BAA4B,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAChG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,gCAAgC;IAG/B,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAE5B,YAA6B,IAAI,EAAE,4CAA4C,EAE9E;IAED,2DAA2D;IACrD,IAAI,CACR,SAAS,EAAE,4BAA4B,EACvC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAGtC;IAED,wFAAwF;IAClF,IAAI,CACR,SAAS,EAAE,4BAA4B,EACvC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,kCAAkC,GACxC,OAAO,CAAC,yBAAyB,CAAC,CA4BpC;IAED,+DAA+D;IACzD,MAAM,CACV,SAAS,EAAE,4BAA4B,EACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAgBf;IAED,yFAAyF;IACnF,MAAM,CACV,SAAS,EAAE,4BAA4B,EACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,+BAA+B,CAAC,CAI1C;IAED,kGAAkG;IAC5F,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAQvE;IAED,uFAAuF;IACjF,IAAI,CACR,SAAS,EAAE,4BAA4B,EACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,6BAA6B,CAAC,CAExC;IAED;;;;;;;;;OASG;IACG,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBvE;YAIa,OAAO;IA+CrB,wFAAwF;YAC1E,oBAAoB;IA+ElC,0FAA0F;YAC5E,cAAc;IAmD5B;;;;;OAKG;YACW,aAAa;YA4Cb,YAAY;IAsC1B,OAAO,CAAC,OAAO;IAcf,OAAO,CAAC,QAAQ;YAcF,OAAO;YAkBP,mBAAmB;CAUlC"}
1
+ {"version":3,"file":"FoundationalServiceSourceService.d.ts","sourceRoot":"","sources":["../../src/foundationalServices/FoundationalServiceSourceService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,4BAA4B,EAC5B,y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AAC,CAiCpC;IAED,+DAA+D;IACzD,MAAM,CACV,SAAS,EAAE,4BAA4B,EACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAgBf;IAED,yFAAyF;IACnF,MAAM,CACV,SAAS,EAAE,4BAA4B,EACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,+BAA+B,CAAC,CAI1C;IAED,kGAAkG;IAC5F,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAQvE;IAED,uFAAuF;IACjF,IAAI,CACR,SAAS,EAAE,4BAA4B,EACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,6BAA6B,CAAC,CAExC;IAED;;;;;;;;;OASG;IACG,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBvE;YAIa,OAAO;IA8DrB;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IAmBzB;;;OAGG;YACW,eAAe;IA0F7B,mGAAmG;YACrF,kBAAkB;IAWhC,wFAAwF;YAC1E,oBAAoB;IAkFlC,0FAA0F;YAC5E,cAAc;IA8C5B;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;;;;;;;;;;OAWG;YACW,aAAa;IAgE3B;;;;;;;;OAQG;IACH,OAAO,CAAC,IAAI;YAkBE,YAAY;IAsC1B,OAAO,CAAC,OAAO;IAcf,OAAO,CAAC,QAAQ;YAcF,OAAO;YAkBP,mBAAmB;CAUlC"}
@@ -1,6 +1,14 @@
1
- import { NotFoundError, ValidationError, assertFound, detectContractFormat, noopLogger, runBestEffort, summarizeContract, } from '@cat-factory/kernel';
1
+ import { NotFoundError, ValidationError, assertFound, detectContractFormat, isContractCandidatePath, noopLogger, runBestEffort, summarizeContract, } from '@cat-factory/kernel';
2
+ import pMap from 'p-map';
2
3
  import { normalizeDirPath, probeRepoSourceStatus, syncRepoSource, } from '../repoSourceSync/repo-source-sync.js';
3
- import { SERVICE_MANIFEST_FILE, commonDirectory, contractIdFromPath, contractTitleFromPath, normalizeFilePath, parseServiceManifest, slugFromDirName, } from './foundational-source.logic.js';
4
+ import { scanContractFolder } from './folder-scan.js';
5
+ import { SERVICE_MANIFEST_FILE, commonDirectory, contractIdFromPath, contractIdFromRelativePath, contractTitleFromPath, normalizeFilePath, parseServiceManifest, parseServiceOverview, slugFromDirName, } from './foundational-source.logic.js';
6
+ /**
7
+ * How many contract bodies one reconcile fetches at once. A `folder` source can take up to
8
+ * {@link MAX_FOLDER_CONTRACT_FILES} documents, and paying that one round trip at a time is the
9
+ * dominant cost of a sync that has any real work to do.
10
+ */
11
+ const CONTRACT_READ_CONCURRENCY = 8;
4
12
  /**
5
13
  * Repo-sourced foundational services: link a repo FOLDER of service definitions (or an
6
14
  * explicit FILE list for one service), resync it, and answer the cheap "check for changes"
@@ -10,15 +18,22 @@ import { SERVICE_MANIFEST_FILE, commonDirectory, contractIdFromPath, contractTit
10
18
  * The shared repo-source engine (`repoSourceSync`) owns the mechanics that every repo-sourced
11
19
  * library gets identically — pin the head commit BEFORE reading, run the reconcile, sweep
12
20
  * tombstones by produced id, stamp the sync state, invalidate only on a real change. The
13
- * differentiator supplied here is what a UNIT is, and there are two of them:
21
+ * differentiator supplied here is what a UNIT is, and there are three of them:
14
22
  *
15
23
  * - **`directory`**: one service per immediate subdirectory, identified by its `service.md`.
24
+ * - **`folder`**: one service, named on the LINK, whose contracts are every contract document
25
+ * found under `dirPath` — optionally including its subfolders.
16
26
  * - **`files`**: one service, named on the LINK, whose contracts are the linked file paths.
17
- * There is no directory convention to read identity from, which is exactly why the link
18
- * carries it (refused at the write boundary otherwise).
19
27
  *
20
- * Both modes anchor their staleness probe on ONE directory (`dirPath`), so a `files` source
21
- * with a dozen linked files still costs a single commit read per freshness check.
28
+ * Neither single-service mode has a directory convention to read identity from, which is
29
+ * exactly why the link carries it (refused at the write boundary otherwise). What separates
30
+ * them is WHEN the file set is decided: `files` pins the paths at link time, so a contract
31
+ * added upstream stays invisible until somebody edits the link, while `folder` re-discovers
32
+ * the set on every sync — which is why a spec directory that grows wants the folder shape.
33
+ *
34
+ * All three anchor their staleness probe on ONE directory (`dirPath`), so a `files` source with
35
+ * a dozen linked files, and a `folder` source with a whole subtree, each still cost a single
36
+ * commit read per freshness check.
22
37
  */
23
38
  export class FoundationalServiceSourceService {
24
39
  deps;
@@ -37,9 +52,13 @@ export class FoundationalServiceSourceService {
37
52
  const now = this.deps.clock.now();
38
53
  const filePaths = (input.filePaths ?? []).map(normalizeFilePath).filter(Boolean);
39
54
  // A `files` source anchors its probe on the linked files' deepest common directory, so
40
- // one commit read covers the whole set (see the class note). A `directory` source anchors
41
- // on the scanned subtree itself.
55
+ // one commit read covers the whole set (see the class note). The `directory` and `folder`
56
+ // sources anchor on the scanned subtree itself.
42
57
  const dirPath = input.mode === 'files' ? commonDirectory(filePaths) : normalizeDirPath(input.dirPath);
58
+ // Both single-service modes name their service on the link; only `files` enumerates paths
59
+ // and only `folder` walks a subtree. Storing each field solely where it is READ keeps a
60
+ // stored row from claiming a shape its mode never uses.
61
+ const namesService = input.mode === 'files' || input.mode === 'folder';
43
62
  const record = {
44
63
  id: this.deps.idGenerator.next('fndsrc'),
45
64
  ownerKind,
@@ -49,10 +68,11 @@ export class FoundationalServiceSourceService {
49
68
  gitRef: input.gitRef?.trim() || 'HEAD',
50
69
  mode: input.mode,
51
70
  dirPath,
52
- filePaths,
53
- serviceId: input.mode === 'files' ? (input.serviceId ?? null) : null,
54
- serviceName: input.mode === 'files' ? (input.serviceName ?? null) : null,
55
- serviceSummary: input.mode === 'files' ? (input.serviceSummary ?? null) : null,
71
+ recursive: input.mode === 'folder' && input.recursive === true,
72
+ filePaths: input.mode === 'files' ? filePaths : [],
73
+ serviceId: namesService ? (input.serviceId ?? null) : null,
74
+ serviceName: namesService ? (input.serviceName ?? null) : null,
75
+ serviceSummary: namesService ? (input.serviceSummary ?? null) : null,
56
76
  lastSyncedCommit: null,
57
77
  lastSyncedAt: null,
58
78
  createdAt: now,
@@ -118,7 +138,11 @@ export class FoundationalServiceSourceService {
118
138
  async runSync(source) {
119
139
  // Invariant across the whole sync — resolved ONCE, never per file.
120
140
  const installationId = await this.requireInstallation(source);
121
- return syncRepoSource({
141
+ // Accumulated by the reconcile and lifted onto the result below. The shared engine has no
142
+ // notion of a dropped file, and giving it one would put a foundational-services concern in
143
+ // the module the fragment and skill libraries share.
144
+ const report = { skipped: 0, folderScan: null };
145
+ const outcome = await syncRepoSource({
122
146
  source,
123
147
  installationId,
124
148
  githubClient: this.deps.githubClient,
@@ -130,15 +154,26 @@ export class FoundationalServiceSourceService {
130
154
  // it moved (manifest OR contract document), so every service is unchanged and not a
131
155
  // single per-directory read is paid for.
132
156
  if (!commitMoved) {
157
+ // A source that has NEVER synced reaches this line only because the head probe found
158
+ // no commit for its path AT ALL — for a repo we can read, that means the path is not
159
+ // there. Say so: the walk short-circuits before it could observe the empty listing,
160
+ // so without this a link with a mistyped folder syncs "successfully" forever, and the
161
+ // author is told 0 updated / 0 removed by a source that can never produce anything.
162
+ if (source.mode === 'folder' && source.lastSyncedCommit === null) {
163
+ report.folderScan = 'missing';
164
+ }
133
165
  return {
134
166
  liveIds: new Set(existing.map((s) => s.serviceId)),
135
167
  upserted: 0,
136
168
  unchanged: existing.length,
137
169
  };
138
170
  }
139
- return source.mode === 'files'
140
- ? this.reconcileFiles(source, installationId, readRef, now, existing)
141
- : this.reconcileDirectories(source, installationId, readRef, now, existing);
171
+ const args = [source, installationId, readRef, now, existing, report];
172
+ if (source.mode === 'files')
173
+ return this.reconcileFiles(...args);
174
+ if (source.mode === 'folder')
175
+ return this.reconcileFolder(...args);
176
+ return this.reconcileDirectories(...args);
142
177
  },
143
178
  tombstone: async (service, now) => {
144
179
  await this.deps.foundationalServiceRepository.softDelete(service.ownerKind, service.ownerId, service.serviceId, now);
@@ -147,9 +182,116 @@ export class FoundationalServiceSourceService {
147
182
  updateSyncState: (commit, now) => this.deps.foundationalServiceSourceRepository.updateSyncState(source.id, commit, now),
148
183
  invalidate: () => this.deps.invalidateCatalog?.(source.ownerKind, source.ownerId) ?? Promise.resolve(),
149
184
  });
185
+ this.warnAboutCoverage(source, report.folderScan);
186
+ return { ...outcome, skippedFiles: report.skipped, folderScan: report.folderScan };
187
+ }
188
+ /**
189
+ * Log the two coverage outcomes an operator would want to know about, each named for the fix
190
+ * it needs — a truncated walk asks for a narrower link, a missing folder for a corrected one.
191
+ *
192
+ * This is the ONLY standing signal an AUTOREFRESH pass leaves: the sweep discards the sync
193
+ * result, so a folder that vanished upstream reaches a human through this line or not at all.
194
+ * (A manual resync also surfaces both on the SPA's toast.)
195
+ */
196
+ warnAboutCoverage(source, coverage) {
197
+ if (coverage === null || coverage === 'complete')
198
+ return;
199
+ const fields = {
200
+ sourceId: source.id,
201
+ ownerKind: source.ownerKind,
202
+ ownerId: source.ownerId,
203
+ dirPath: source.dirPath,
204
+ recursive: source.recursive,
205
+ };
206
+ if (coverage === 'truncated') {
207
+ this.log.warn('Foundational folder source truncated by a scan cap', fields);
208
+ return;
209
+ }
210
+ this.log.warn('Foundational folder source points at a folder that is not there', fields);
211
+ }
212
+ /**
213
+ * `folder` mode: ONE service, named on the link, whose contracts are every contract document
214
+ * under the linked folder (and its subfolders when the link says so).
215
+ */
216
+ async reconcileFolder(source, installationId, readRef, now, existing, report) {
217
+ const { serviceId, serviceName } = this.requireNamedService(source);
218
+ const prior = existing.find((s) => s.serviceId === serviceId);
219
+ const scan = await scanContractFolder({
220
+ listDir: (path) => this.listDir(source, installationId, path, readRef),
221
+ root: source.dirPath,
222
+ recursive: source.recursive,
223
+ });
224
+ report.folderScan = scan.coverage;
225
+ // Candidates the WALK declined (too large to read) join the ones that failed on their
226
+ // bodies: both are files that looked like contracts and are not in the catalog, which is
227
+ // the one question the count answers.
228
+ report.skipped += scan.skippedCandidates;
229
+ const contracts = await this.readContracts({
230
+ source,
231
+ installationId,
232
+ readRef,
233
+ serviceId,
234
+ paths: scan.paths,
235
+ now,
236
+ report,
237
+ contractIdFor: (path) => contractIdFromRelativePath(path, source.dirPath),
238
+ });
239
+ if (contracts.length === 0) {
240
+ // THREE different states produce zero contracts, and the disposition splits on whether we
241
+ // have EVIDENCE about the folder — never on the empty result alone, which they share.
242
+ //
243
+ // STABLE — the walk saw the whole folder (`complete`), or the folder is not there at all
244
+ // (`missing`; git cannot store an empty directory, so an empty root listing means absent),
245
+ // and nothing under it even LOOKED like a contract. A spec folder nobody has filled in
246
+ // yet, one holding only prose, or one emptied upstream. Pin, and let the tombstone sweep
247
+ // retire the service, exactly as `directory` mode retires a directory that lost its
248
+ // `service.md`. Calling this incomplete instead would hold the pin back forever: every
249
+ // later sweep would re-walk the whole subtree to reach the same answer while the source
250
+ // never stopped reporting changes upstream.
251
+ if (scan.paths.length === 0 && scan.coverage !== 'truncated') {
252
+ return { liveIds: new Set(), upserted: 0, unchanged: 0 };
253
+ }
254
+ // TRANSIENT — either a cap stopped the walk BEFORE it reached any candidate, or every
255
+ // candidate it did reach read back unusable.
256
+ //
257
+ // The first is why the stable branch above tests coverage and not just the count: a
258
+ // truncated walk that found nothing is a statement about the WALK, not about the folder.
259
+ // A recursive link over a wide tree whose specs sit below the visited prefix would
260
+ // otherwise retire a live service on the strength of directories we declined to list, and
261
+ // pin the commit so it stayed retired. (A truncated walk that DID produce contracts is
262
+ // stable and pins normally — it is only the absence of evidence that is not evidence.)
263
+ //
264
+ // The second is the same disposition `files` mode takes, for the same reason: retiring a
265
+ // service over a momentary read failure strips a capability from every subsequent design.
266
+ //
267
+ // Both leave the pin behind so the next pass re-reads, and keep a prior row alive.
268
+ if (prior) {
269
+ return { liveIds: new Set([serviceId]), upserted: 0, unchanged: 1, incomplete: true };
270
+ }
271
+ return { liveIds: new Set(), upserted: 0, unchanged: 0, incomplete: true };
272
+ }
273
+ // An OPTIONAL `service.md` at the folder root enriches the catalog entry; it can never
274
+ // identify the service, because the link already did that (see `parseServiceOverview`).
275
+ const overview = await this.readFolderOverview(source, installationId, readRef, scan.manifestPath);
276
+ await this.writeService(source, {
277
+ serviceId,
278
+ name: serviceName,
279
+ summary: source.serviceSummary || overview?.summary || serviceName,
280
+ description: overview?.description ?? '',
281
+ capabilities: overview?.capabilities ?? [],
282
+ sourcePath: source.dirPath,
283
+ }, contracts, prior, readRef, now);
284
+ return { liveIds: new Set([serviceId]), upserted: 1, unchanged: 0 };
285
+ }
286
+ /** Read the folder root's optional `service.md`, or null when there is none / it is unreadable. */
287
+ async readFolderOverview(source, installationId, readRef, manifestPath) {
288
+ if (!manifestPath)
289
+ return null;
290
+ const file = await this.readFile(source, installationId, manifestPath, readRef);
291
+ return file ? parseServiceOverview(file.content) : null;
150
292
  }
151
293
  /** `directory` mode: one service per immediate subdirectory carrying a `service.md`. */
152
- async reconcileDirectories(source, installationId, readRef, now, existing) {
294
+ async reconcileDirectories(source, installationId, readRef, now, existing, report) {
153
295
  const existingById = new Map(existing.map((s) => [s.serviceId, s]));
154
296
  // Sorted by name (code-unit order, locale-independent) so slug-collision resolution is
155
297
  // deterministic — first wins — regardless of ICU collation.
@@ -188,9 +330,18 @@ export class FoundationalServiceSourceService {
188
330
  }
189
331
  continue;
190
332
  }
191
- const contracts = await this.readContracts(source, installationId, readRef, serviceId, entries
192
- .filter((e) => e.type === 'file' && e.path !== manifestEntry.path)
193
- .map((e) => e.path), now);
333
+ const contracts = await this.readContracts({
334
+ source,
335
+ installationId,
336
+ readRef,
337
+ serviceId,
338
+ paths: entries
339
+ .filter((e) => e.type === 'file' && e.path !== manifestEntry.path)
340
+ .map((e) => e.path),
341
+ now,
342
+ report,
343
+ contractIdFor: contractIdFromPath,
344
+ });
194
345
  await this.writeService(source, {
195
346
  serviceId,
196
347
  name: parsed.name,
@@ -208,18 +359,19 @@ export class FoundationalServiceSourceService {
208
359
  return { liveIds, upserted, unchanged: 0, ...(incomplete ? { incomplete: true } : {}) };
209
360
  }
210
361
  /** `files` mode: ONE service, named on the link, whose contracts are the linked paths. */
211
- async reconcileFiles(source, installationId, readRef, now, existing) {
212
- const serviceId = source.serviceId;
213
- // Guaranteed by the link-time `v.check`, but a stored row outlives the schema that wrote
214
- // it — so this is a real guard, not a type narrowing convenience.
215
- if (!serviceId || !source.serviceName) {
216
- throw new ValidationError('This source does not name the service its files describe', {
217
- reason: 'foundational_source_unnamed_service',
218
- sourceId: source.id,
219
- });
220
- }
362
+ async reconcileFiles(source, installationId, readRef, now, existing, report) {
363
+ const { serviceId, serviceName } = this.requireNamedService(source);
221
364
  const prior = existing.find((s) => s.serviceId === serviceId);
222
- const contracts = await this.readContracts(source, installationId, readRef, serviceId, source.filePaths, now);
365
+ const contracts = await this.readContracts({
366
+ source,
367
+ installationId,
368
+ readRef,
369
+ serviceId,
370
+ paths: source.filePaths,
371
+ now,
372
+ report,
373
+ contractIdFor: contractIdFromPath,
374
+ });
223
375
  if (contracts.length === 0) {
224
376
  // Every linked file read back unusable. Keep a prior row alive and leave the pin behind
225
377
  // so the next pass re-reads — the alternative is retiring a service that a momentary
@@ -230,33 +382,67 @@ export class FoundationalServiceSourceService {
230
382
  }
231
383
  await this.writeService(source, {
232
384
  serviceId,
233
- name: source.serviceName,
234
- summary: source.serviceSummary ?? source.serviceName,
385
+ name: serviceName,
386
+ summary: source.serviceSummary ?? serviceName,
235
387
  description: '',
236
388
  capabilities: [],
237
389
  sourcePath: source.dirPath,
238
390
  }, contracts, prior, readRef, now);
239
391
  return { liveIds: new Set([serviceId]), upserted: 1, unchanged: 0 };
240
392
  }
393
+ /**
394
+ * The identity a single-service source names, or a refusal.
395
+ *
396
+ * Guaranteed by the link-time `v.check`, but a stored row outlives the schema that wrote it —
397
+ * so this is a real guard, not a type-narrowing convenience. It returns BOTH proven fields
398
+ * rather than just the id, so a caller narrows by using the result instead of re-asserting
399
+ * `serviceName as string` at each use — a cast that would survive the guard being weakened.
400
+ */
401
+ requireNamedService(source) {
402
+ if (!source.serviceId || !source.serviceName) {
403
+ throw new ValidationError('This source does not name the service its contracts describe', {
404
+ reason: 'foundational_source_unnamed_service',
405
+ sourceId: source.id,
406
+ });
407
+ }
408
+ return { serviceId: source.serviceId, serviceName: source.serviceName };
409
+ }
241
410
  /**
242
411
  * Read the given repo paths and keep the ones that ARE contract documents. A file whose
243
412
  * format is unrecognised is skipped rather than stored as an opaque blob: the format is what
244
413
  * tells a downstream agent how to read it, and a "contract" nobody can interpret is worse in
245
414
  * an agent's context than an absent one.
415
+ *
416
+ * A path that could never yield a format is dropped without a read and without a count — it
417
+ * is a README or a `package.json` beside the specs, not a contract that failed. Everything
418
+ * else that fails is COUNTED on the report and NAMED in the log (see {@link skip}), because a
419
+ * link that produced fewer contracts than its author expected has no other explanation
420
+ * available to them.
246
421
  */
247
- async readContracts(source, installationId, readRef, serviceId, paths, now) {
422
+ async readContracts(params) {
423
+ const { source, installationId, readRef, serviceId, paths, now, report, contractIdFor } = params;
248
424
  const out = [];
249
425
  const seen = new Set();
250
- for (const path of paths) {
251
- const file = await this.readFile(source, installationId, path, readRef);
252
- if (!file)
426
+ // Read the bodies concurrently, then DECIDE over them in path order. The split matters: the
427
+ // reads are independent, but the id dedupe keeps the FIRST claimant of a colliding id, so
428
+ // the decision pass has to run in a deterministic order or which contract survives would
429
+ // depend on which response arrived first. `pMap` resolves in input order, so it does.
430
+ const fetched = await pMap(paths.filter(isContractCandidatePath), async (path) => ({ path, file: await this.readFile(source, installationId, path, readRef) }), { concurrency: CONTRACT_READ_CONCURRENCY });
431
+ for (const { path, file } of fetched) {
432
+ if (!file) {
433
+ this.skip(report, source, path, 'unreadable');
253
434
  continue;
435
+ }
254
436
  const format = detectContractFormat(path, file.content);
255
- if (!format)
437
+ if (!format) {
438
+ this.skip(report, source, path, 'unrecognised');
256
439
  continue;
257
- const contractId = contractIdFromPath(path);
258
- if (seen.has(contractId))
440
+ }
441
+ const contractId = contractIdFor(path);
442
+ if (seen.has(contractId)) {
443
+ this.skip(report, source, path, 'duplicate-contract-id', { contractId });
259
444
  continue;
445
+ }
260
446
  seen.add(contractId);
261
447
  const summary = summarizeContract({
262
448
  contractId,
@@ -283,6 +469,26 @@ export class FoundationalServiceSourceService {
283
469
  }
284
470
  return out;
285
471
  }
472
+ /**
473
+ * Count one dropped candidate and name it in the log.
474
+ *
475
+ * The count alone answers "did I lose anything?" but never "which file, and why?" — and one
476
+ * reason is undiagnosable without the log line: a DUPLICATE contract id silently keeps the
477
+ * first claimant, so the losing document is absent from the catalog under a name that is
478
+ * present. `debug` rather than `warn` because a thin catalog entry is usually intended (prose
479
+ * and drafts sit beside specs); the count on the sync result is what asks for attention.
480
+ */
481
+ skip(report, source, path, reason, fields) {
482
+ report.skipped++;
483
+ this.log.debug('Skipped a foundational contract candidate', {
484
+ sourceId: source.id,
485
+ ownerKind: source.ownerKind,
486
+ ownerId: source.ownerId,
487
+ path,
488
+ reason,
489
+ ...fields,
490
+ });
491
+ }
286
492
  async writeService(source, identity, contracts, prior, readRef, now) {
287
493
  await this.deps.foundationalServiceRepository.upsert({
288
494
  serviceId: identity.serviceId,
@@ -334,6 +540,7 @@ function toWire(record) {
334
540
  gitRef: record.gitRef,
335
541
  mode: record.mode,
336
542
  dirPath: record.dirPath,
543
+ recursive: record.recursive,
337
544
  filePaths: record.filePaths,
338
545
  serviceId: record.serviceId,
339
546
  serviceName: record.serviceName,
@@ -1 +1 @@
1
- {"version":3,"file":"FoundationalServiceSourceService.js","sourceRoot":"","sources":["../../src/foundationalServices/FoundationalServiceSourceService.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,aAAa,EACb,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,UAAU,EACV,aAAa,EACb,iBAAiB,GAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,GACf,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACL,qBAAqB,EACrB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AS;QAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"FoundationalServiceSourceService.js","sourceRoot":"","sources":["../../src/foundationalServices/FoundationalServiceSourceService.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,aAAa,EACb,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,uBAAuB,EACvB,UAAU,EACV,aAAa,EACb,iBAAiB,GAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,IAAI,MAAM,OAAO,CAAA;AACxB,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,GACf,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,GAChB,MAAM,gCAAgC,CAAA;AAkBvC;;;;GAIG;AACH,MAAM,yBAAyB,GAAG,CAAC,CAAA;AA0BnC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,gCAAgC;IAGd,IAAI;IAFhB,GAAG,CAAQ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ACzC,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,CAAA;AACH,CAAC"}
@@ -0,0 +1,78 @@
1
+ import type { FolderScanCoverage } from '@cat-factory/contracts';
2
+ import type { RepoContentEntry } from '@cat-factory/kernel';
3
+ /**
4
+ * How many subfolder levels below the scanned root a recursive walk descends. Deep enough for
5
+ * any real spec layout (`specs/<domain>/<version>/…`), shallow enough that a link pointed at a
6
+ * repo root cannot walk a whole monorepo.
7
+ */
8
+ export declare const MAX_FOLDER_SCAN_DEPTH = 8;
9
+ /**
10
+ * How many directory listings ONE scan may perform. This is the cost bound that matters: every
11
+ * directory is a separate upstream read, and a folder link is the one source shape whose reach
12
+ * nobody enumerated by hand.
13
+ */
14
+ export declare const MAX_FOLDER_SCAN_DIRECTORIES = 200;
15
+ /**
16
+ * How many candidate contract files one folder source may take. Each becomes a stored document
17
+ * that a declaring design's consumer folds into its context, so this bounds what a single link
18
+ * can put in front of an agent.
19
+ */
20
+ export declare const MAX_FOLDER_CONTRACT_FILES = 100;
21
+ /**
22
+ * How many of a level's directory listings are in flight at once. The walk's cost bound is
23
+ * {@link MAX_FOLDER_SCAN_DIRECTORIES} reads; this is what stops those reads from being paid
24
+ * one round trip at a time, which on a deep tree is the difference between a sync that takes
25
+ * seconds and one that takes minutes.
26
+ */
27
+ export declare const FOLDER_SCAN_CONCURRENCY = 8;
28
+ /**
29
+ * How large a candidate file may be before the walk declines to read it.
30
+ *
31
+ * Pinned to the host contents API's own ceiling rather than chosen freely: above 1 MiB GitHub
32
+ * answers a file read with EMPTY content, so fetching one can only ever cost a round trip and
33
+ * produce a skip. Declining it up front turns that into a reported skip with no read, and keeps
34
+ * a multi-megabyte document out of the YAML parser on the runtimes that do return it.
35
+ *
36
+ * A cap on the WALK, not on what a contract may be: `files` and `directory` sources name their
37
+ * documents, so nobody is protected from a file they asked for by name. It is the unbounded
38
+ * discovery that needs a bound.
39
+ */
40
+ export declare const MAX_FOLDER_CONTRACT_FILE_BYTES: number;
41
+ /** Lists one repo directory at the scan's pinned ref. */
42
+ export type ListRepoDirectory = (path: string) => Promise<RepoContentEntry[]>;
43
+ export interface FolderScanResult {
44
+ /** Candidate contract file paths, shallowest-first then by name. */
45
+ paths: string[];
46
+ /** The OPTIONAL `service.md` sitting at the folder root, if there is one. */
47
+ manifestPath: string | null;
48
+ /**
49
+ * How much of the folder this walk saw. The caller BRANCHES on it, because "found no
50
+ * candidates" means opposite things depending on whether the walk finished: see the
51
+ * reconcile's three-way disposition.
52
+ */
53
+ coverage: FolderScanCoverage;
54
+ /**
55
+ * Candidates the walk declined to read at all (too large — {@link
56
+ * MAX_FOLDER_CONTRACT_FILE_BYTES}). Reported so a cap never drops a file in silence; the
57
+ * caller folds it into the sync's skipped count beside the files that failed on their bodies.
58
+ */
59
+ skippedCandidates: number;
60
+ }
61
+ /**
62
+ * Walk `root` for contract documents.
63
+ *
64
+ * BREADTH-first with each listing sorted by name, which makes two things true at once: the
65
+ * result is deterministic across syncs (so a truncated scan keeps the same contracts rather
66
+ * than flapping), and the cap falls on the DEEPEST, least-specific files — a root-level
67
+ * `openapi.yaml` is never dropped in favour of something nested six levels down.
68
+ *
69
+ * Only files whose extension could yield a contract format are returned; the caller still has
70
+ * to read each body to know. That pre-filter is what keeps a scan's file reads proportional to
71
+ * the candidates rather than to everything the folder happens to contain.
72
+ */
73
+ export declare function scanContractFolder(params: {
74
+ listDir: ListRepoDirectory;
75
+ root: string;
76
+ recursive: boolean;
77
+ }): Promise<FolderScanResult>;
78
+ //# sourceMappingURL=folder-scan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folder-scan.d.ts","sourceRoot":"","sources":["../../src/foundationalServices/folder-scan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAc3D;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAA;AAE9C;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,MAAM,CAAA;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAA;AAExC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,8BAA8B,QAAc,CAAA;AAEzD,yDAAyD;AACzD,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAA;AA2E7E,MAAM,WAAW,gBAAgB;IAC/B,oEAAoE;IACpE,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,6EAA6E;IAC7E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B;;;;OAIG;IACH,QAAQ,EAAE,kBAAkB,CAAA;IAC5B;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE;IAC/C,OAAO,EAAE,iBAAiB,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;CACnB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAiE5B"}
@@ -0,0 +1,179 @@
1
+ import { isContractCandidatePath } from '@cat-factory/kernel';
2
+ import pMap from 'p-map';
3
+ import { SERVICE_MANIFEST_FILE } from './foundational-source.logic.js';
4
+ // ---------------------------------------------------------------------------
5
+ // The `folder`-mode walk: find every candidate contract document under one repo folder,
6
+ // optionally descending into its subfolders (backend/docs/adr/0031-foundational-services.md).
7
+ //
8
+ // The directory listing is INJECTED rather than taken as a GitHub client, so the walk's whole
9
+ // contract — ordering, the caps, what counts as a candidate — is unit-testable with no client
10
+ // and both facades get identical behaviour by construction.
11
+ // ---------------------------------------------------------------------------
12
+ /**
13
+ * How many subfolder levels below the scanned root a recursive walk descends. Deep enough for
14
+ * any real spec layout (`specs/<domain>/<version>/…`), shallow enough that a link pointed at a
15
+ * repo root cannot walk a whole monorepo.
16
+ */
17
+ export const MAX_FOLDER_SCAN_DEPTH = 8;
18
+ /**
19
+ * How many directory listings ONE scan may perform. This is the cost bound that matters: every
20
+ * directory is a separate upstream read, and a folder link is the one source shape whose reach
21
+ * nobody enumerated by hand.
22
+ */
23
+ export const MAX_FOLDER_SCAN_DIRECTORIES = 200;
24
+ /**
25
+ * How many candidate contract files one folder source may take. Each becomes a stored document
26
+ * that a declaring design's consumer folds into its context, so this bounds what a single link
27
+ * can put in front of an agent.
28
+ */
29
+ export const MAX_FOLDER_CONTRACT_FILES = 100;
30
+ /**
31
+ * How many of a level's directory listings are in flight at once. The walk's cost bound is
32
+ * {@link MAX_FOLDER_SCAN_DIRECTORIES} reads; this is what stops those reads from being paid
33
+ * one round trip at a time, which on a deep tree is the difference between a sync that takes
34
+ * seconds and one that takes minutes.
35
+ */
36
+ export const FOLDER_SCAN_CONCURRENCY = 8;
37
+ /**
38
+ * How large a candidate file may be before the walk declines to read it.
39
+ *
40
+ * Pinned to the host contents API's own ceiling rather than chosen freely: above 1 MiB GitHub
41
+ * answers a file read with EMPTY content, so fetching one can only ever cost a round trip and
42
+ * produce a skip. Declining it up front turns that into a reported skip with no read, and keeps
43
+ * a multi-megabyte document out of the YAML parser on the runtimes that do return it.
44
+ *
45
+ * A cap on the WALK, not on what a contract may be: `files` and `directory` sources name their
46
+ * documents, so nobody is protected from a file they asked for by name. It is the unbounded
47
+ * discovery that needs a bound.
48
+ */
49
+ export const MAX_FOLDER_CONTRACT_FILE_BYTES = 1024 * 1024;
50
+ /**
51
+ * Classify one directory's entries. Pure and per-directory, so the walk above stays a loop over
52
+ * levels and this stays the single place that decides what an entry IS.
53
+ *
54
+ * It deliberately applies no cap of its own: the file cap is a property of the WALK (it counts
55
+ * across directories), so applying it here would either need the running total threaded in or
56
+ * would silently cap per directory.
57
+ */
58
+ function readDirectoryListing(dir, entries, recursive) {
59
+ const files = [];
60
+ const children = [];
61
+ let manifestPath = null;
62
+ let depthCapped = false;
63
+ let oversize = 0;
64
+ // Code-unit order, locale-independent — the same rule the `directory` reconcile sorts by, so
65
+ // neither walk's outcome depends on ICU collation.
66
+ const sorted = [...entries].sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
67
+ for (const entry of sorted) {
68
+ if (entry.type === 'file') {
69
+ if (dir.depth === 0 && entry.name.toLowerCase() === SERVICE_MANIFEST_FILE) {
70
+ manifestPath = entry.path;
71
+ continue;
72
+ }
73
+ if (!isContractCandidatePath(entry.path))
74
+ continue;
75
+ // A size the listing does not carry is not a size we may assume is over the cap: the
76
+ // read still has to happen, and an oversized body then reads back empty and is skipped
77
+ // there. Declining on an ABSENT size would silently drop contracts on any host whose
78
+ // listing omits it.
79
+ if (entry.size !== undefined && entry.size > MAX_FOLDER_CONTRACT_FILE_BYTES) {
80
+ oversize++;
81
+ continue;
82
+ }
83
+ files.push(entry.path);
84
+ continue;
85
+ }
86
+ if (entry.type !== 'dir' || !recursive)
87
+ continue;
88
+ // A directory we decline to descend into is dropped COVERAGE, whether or not it happens to
89
+ // hold a contract — we cannot know which without the listing the cap just refused. So
90
+ // reporting truncation here is the only honest answer, not an over-report.
91
+ if (dir.depth + 1 > MAX_FOLDER_SCAN_DEPTH) {
92
+ depthCapped = true;
93
+ continue;
94
+ }
95
+ children.push({ path: entry.path, depth: dir.depth + 1 });
96
+ }
97
+ return { files, children, manifestPath, depthCapped, oversize };
98
+ }
99
+ /**
100
+ * Walk `root` for contract documents.
101
+ *
102
+ * BREADTH-first with each listing sorted by name, which makes two things true at once: the
103
+ * result is deterministic across syncs (so a truncated scan keeps the same contracts rather
104
+ * than flapping), and the cap falls on the DEEPEST, least-specific files — a root-level
105
+ * `openapi.yaml` is never dropped in favour of something nested six levels down.
106
+ *
107
+ * Only files whose extension could yield a contract format are returned; the caller still has
108
+ * to read each body to know. That pre-filter is what keeps a scan's file reads proportional to
109
+ * the candidates rather than to everything the folder happens to contain.
110
+ */
111
+ export async function scanContractFolder(params) {
112
+ const { listDir, root, recursive } = params;
113
+ const paths = [];
114
+ let manifestPath = null;
115
+ let truncated = false;
116
+ let listings = 0;
117
+ let skippedCandidates = 0;
118
+ // Git cannot represent an empty directory, so a root that lists NOTHING is a root that is not
119
+ // there — the host answers a missing path with an empty listing rather than an error. That
120
+ // makes this the one observation separating "the folder holds no contracts" from "the folder
121
+ // is gone", which the caller must tell apart to know whether retiring the service is warranted.
122
+ let rootIsEmpty = false;
123
+ // One LEVEL at a time. The listings within a level are independent of each other, so they run
124
+ // concurrently; the level boundary is what keeps the walk breadth-first, and therefore keeps
125
+ // the visit order — and every cap's outcome — identical to a one-at-a-time walk.
126
+ let frontier = [{ path: root, depth: 0 }];
127
+ while (frontier.length > 0 && paths.length < MAX_FOLDER_CONTRACT_FILES) {
128
+ const budget = MAX_FOLDER_SCAN_DIRECTORIES - listings;
129
+ if (budget <= 0) {
130
+ truncated = true;
131
+ break;
132
+ }
133
+ // The frontier is already in visit order, so taking its first `budget` entries drops exactly
134
+ // the directories a sequential walk would have run out of listings before reaching.
135
+ const batch = frontier.slice(0, budget);
136
+ if (batch.length < frontier.length)
137
+ truncated = true;
138
+ listings += batch.length;
139
+ // `pMap` resolves in INPUT order, so the decision pass below still sees the level in the
140
+ // order the walk defines rather than the order the network happened to answer in.
141
+ const listed = await pMap(batch, async (dir) => ({ dir, entries: await listDir(dir.path) }), {
142
+ concurrency: FOLDER_SCAN_CONCURRENCY,
143
+ });
144
+ const next = [];
145
+ for (const { dir, entries } of listed) {
146
+ if (dir.depth === 0 && entries.length === 0)
147
+ rootIsEmpty = true;
148
+ const yielded = readDirectoryListing(dir, entries, recursive);
149
+ if (yielded.manifestPath)
150
+ manifestPath = yielded.manifestPath;
151
+ if (yielded.depthCapped)
152
+ truncated = true;
153
+ skippedCandidates += yielded.oversize;
154
+ for (const file of yielded.files) {
155
+ if (paths.length >= MAX_FOLDER_CONTRACT_FILES) {
156
+ truncated = true;
157
+ break;
158
+ }
159
+ paths.push(file);
160
+ }
161
+ next.push(...yielded.children);
162
+ }
163
+ frontier = next;
164
+ }
165
+ // Anything left queued when the file cap ended the walk is unvisited, so the result is a
166
+ // prefix — say so rather than letting a full-looking list stand for a partial folder.
167
+ if (frontier.length > 0 && paths.length >= MAX_FOLDER_CONTRACT_FILES)
168
+ truncated = true;
169
+ // `missing` outranks `truncated` because it cannot co-occur with it in any real walk: an
170
+ // absent root queues no children, so nothing is left for a cap to refuse. Stating the
171
+ // precedence anyway keeps the invariant on the page rather than in the reader's head.
172
+ const coverage = rootIsEmpty
173
+ ? 'missing'
174
+ : truncated
175
+ ? 'truncated'
176
+ : 'complete';
177
+ return { paths, manifestPath, coverage, skippedCandidates };
178
+ }
179
+ //# sourceMappingURL=folder-scan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folder-scan.js","sourceRoot":"","sources":["../../src/foundationalServices/folder-scan.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,IAAI,MAAM,OAAO,CAAA;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AAEtE,8EAA8E;AAC9E,wFAAwF;AACxF,8FAA8F;AAC9F,EAAE;AACF,8FAA8F;AAC9F,8FAA8F;AAC9F,4DAA4D;AAC5D,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAEtC;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAA;AAE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAA;AAE5C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAA;AAExC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,GAAG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,CAAA;oBAChB,MAAK;gBACP,CAAC;gBACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAClB,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;QAChC,CAAC;QACD,QAAQ,GAAG,IAAI,CAAA;IACjB,CAAC;IACD,yFAAyF;IACzF,sFAAsF;IACtF,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,yBAAyB;QAAE,SAAS,GAAG,IAAI,CAAA;IAEtF,yFAAyF;IACzF,sFAAsF;IACtF,sFAAsF;IACtF,MAAM,QAAQ,GAAuB,WAAW;QAC9C,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,SAAS;YACT,CAAC,CAAC,WAAW;YACb,CAAC,CAAC,UAAU,CAAA;IAChB,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAA;AAC7D,CAAC"}
@@ -1,12 +1,25 @@
1
1
  /** The manifest file naming a service inside a `directory`-mode source. */
2
2
  export declare const SERVICE_MANIFEST_FILE = "service.md";
3
- /** The parsed identity half of a `service.md`. */
4
- export interface ParsedServiceManifest {
5
- name: string;
3
+ /** The DESCRIPTIVE half of a `service.md` — everything that is not the service's identity. */
4
+ export interface ParsedServiceOverview {
6
5
  summary: string;
7
6
  capabilities: string[];
8
7
  description: string;
9
8
  }
9
+ /** The parsed identity half of a `service.md`, with its overview. */
10
+ export interface ParsedServiceManifest extends ParsedServiceOverview {
11
+ name: string;
12
+ }
13
+ /**
14
+ * Parse the descriptive half of a `service.md` — no `name` required.
15
+ *
16
+ * This is what a `folder` source reads from an OPTIONAL `service.md` at the folder root: the
17
+ * link already names the service (there is no directory convention to take a name from), so a
18
+ * manifest there can only enrich, never identify. Requiring a name to read the description
19
+ * would silently drop the prose of a manifest whose frontmatter omits one, leaving the
20
+ * Architect's catalog with a service that has contracts and nothing saying what it is for.
21
+ */
22
+ export declare function parseServiceOverview(content: string): ParsedServiceOverview;
10
23
  /**
11
24
  * Parse a `service.md`. Returns null when it carries no `name` — an unnamed manifest
12
25
  * cannot be presented to a design agent as a service to consume, and inventing a name
@@ -29,6 +42,21 @@ export declare function slugFromDirName(name: string): string;
29
42
  * (so a renamed file replaces rather than duplicates, because the whole set is replaced).
30
43
  */
31
44
  export declare function contractIdFromPath(path: string): string;
45
+ /**
46
+ * The contract id a file yields inside a `folder` source: its path RELATIVE to the scanned
47
+ * folder, minus the extension, lower-kebabed — so `v1/users.yaml` under `specs/` becomes
48
+ * `v1-users`.
49
+ *
50
+ * A recursive scan is exactly where {@link contractIdFromPath}'s basename rule breaks down:
51
+ * `v1/users.yaml` and `v2/users.yaml` are the two most ordinary files a versioned spec folder
52
+ * holds, and collapsing both to `users` would silently keep one and drop the other — handing a
53
+ * coder v1's endpoints as though they were the whole interface. Relative paths collide only
54
+ * when the files genuinely are the same file.
55
+ *
56
+ * For a file sitting directly in the folder root this degrades to exactly the basename rule, so
57
+ * a non-recursive `folder` source and a `files` source produce identical ids.
58
+ */
59
+ export declare function contractIdFromRelativePath(path: string, root: string): string;
32
60
  /**
33
61
  * A human title for a contract file, derived from its path. Used only when the document
34
62
  * itself offers none (the TypeScript formats never do; an OpenAPI document's `info.title` is
@@ -1 +1 @@
1
- {"version":3,"file":"foundational-source.logic.d.ts","sourceRoot":"","sources":["../../src/foundationalServices/foundational-source.logic.ts"],"names":[],"mappings":"AAcA,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,eAAe,CAAA;AAEjD,kDAAkD;AAClD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CAWlF;AAiBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQpD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAWvD;AAED,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD"}
1
+ {"version":3,"file":"foundational-source.logic.d.ts","sourceRoot":"","sources":["../../src/foundationalServices/foundational-source.logic.ts"],"names":[],"mappings":"AAcA,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,eAAe,CAAA;AAEjD,8FAA8F;AAC9F,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,qEAAqE;AACrE,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAClE,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,qBAAqB,CAE3E;AAyBD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CAMlF;AAiBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQpD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAM7E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAWvD;AAED,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD"}
@@ -12,6 +12,33 @@ import { parseSimpleYaml, splitFrontmatter } from '../repoSourceSync/frontmatter
12
12
  // ---------------------------------------------------------------------------
13
13
  /** The manifest file naming a service inside a `directory`-mode source. */
14
14
  export const SERVICE_MANIFEST_FILE = 'service.md';
15
+ /**
16
+ * Parse the descriptive half of a `service.md` — no `name` required.
17
+ *
18
+ * This is what a `folder` source reads from an OPTIONAL `service.md` at the folder root: the
19
+ * link already names the service (there is no directory convention to take a name from), so a
20
+ * manifest there can only enrich, never identify. Requiring a name to read the description
21
+ * would silently drop the prose of a manifest whose frontmatter omits one, leaving the
22
+ * Architect's catalog with a service that has contracts and nothing saying what it is for.
23
+ */
24
+ export function parseServiceOverview(content) {
25
+ return overviewOf(splitManifest(content));
26
+ }
27
+ /**
28
+ * Split and parse a manifest ONCE. Both entry points below need the frontmatter and the body,
29
+ * and the name-checking one used to re-split the document to reach the overview.
30
+ */
31
+ function splitManifest(content) {
32
+ const { frontmatter, body } = splitFrontmatter(content);
33
+ return { meta: parseSimpleYaml(frontmatter), body };
34
+ }
35
+ function overviewOf({ meta, body }) {
36
+ return {
37
+ summary: str(meta.summary) || str(meta.description),
38
+ capabilities: strList(meta.capabilities),
39
+ description: body.trim(),
40
+ };
41
+ }
15
42
  /**
16
43
  * Parse a `service.md`. Returns null when it carries no `name` — an unnamed manifest
17
44
  * cannot be presented to a design agent as a service to consume, and inventing a name
@@ -22,17 +49,12 @@ export const SERVICE_MANIFEST_FILE = 'service.md';
22
49
  * rather than two rows silently claiming the same id from different folders.
23
50
  */
24
51
  export function parseServiceManifest(content) {
25
- const { frontmatter, body } = splitFrontmatter(content);
26
- const meta = parseSimpleYaml(frontmatter);
27
- const name = str(meta.name);
52
+ const split = splitManifest(content);
53
+ const name = str(split.meta.name);
28
54
  if (!name)
29
55
  return null;
30
- return {
31
- name,
32
- summary: str(meta.summary) || str(meta.description) || name,
33
- capabilities: strList(meta.capabilities),
34
- description: body.trim(),
35
- };
56
+ const overview = overviewOf(split);
57
+ return { ...overview, name, summary: overview.summary || name };
36
58
  }
37
59
  function str(value) {
38
60
  return typeof value === 'string' ? value.trim() : '';
@@ -69,6 +91,27 @@ export function contractIdFromPath(path) {
69
91
  const base = path.split('/').pop() ?? path;
70
92
  return slugFromDirName(base.replace(/\.[^.]+$/, ''));
71
93
  }
94
+ /**
95
+ * The contract id a file yields inside a `folder` source: its path RELATIVE to the scanned
96
+ * folder, minus the extension, lower-kebabed — so `v1/users.yaml` under `specs/` becomes
97
+ * `v1-users`.
98
+ *
99
+ * A recursive scan is exactly where {@link contractIdFromPath}'s basename rule breaks down:
100
+ * `v1/users.yaml` and `v2/users.yaml` are the two most ordinary files a versioned spec folder
101
+ * holds, and collapsing both to `users` would silently keep one and drop the other — handing a
102
+ * coder v1's endpoints as though they were the whole interface. Relative paths collide only
103
+ * when the files genuinely are the same file.
104
+ *
105
+ * For a file sitting directly in the folder root this degrades to exactly the basename rule, so
106
+ * a non-recursive `folder` source and a `files` source produce identical ids.
107
+ */
108
+ export function contractIdFromRelativePath(path, root) {
109
+ const prefix = root ? `${root}/` : '';
110
+ const relative = path.startsWith(prefix)
111
+ ? path.slice(prefix.length)
112
+ : (path.split('/').pop() ?? path);
113
+ return slugFromDirName(relative.replace(/\.[^.]+$/, ''));
114
+ }
72
115
  /**
73
116
  * A human title for a contract file, derived from its path. Used only when the document
74
117
  * itself offers none (the TypeScript formats never do; an OpenAPI document's `info.title` is
@@ -1 +1 @@
1
- {"version":3,"file":"foundational-source.logic.js","sourceRoot":"","sources":["../../src/foundationalServices/foundational-source.logic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AC,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACxB,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC;YAAE,MAAM,CAAC,IAAI,CAAC,OAAiB,CAAC,CAAA;;YAC/E,MAAK;IACZ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACzB,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;AAC5D,CAAC"}
1
+ {"version":3,"file":"foundational-source.logic.js","sourceRoot":"","sources":["../../src/foundationalServices/foundational-source.logic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAEpF,8EAA8E;AAC9E,4DAA4D;AAC5D,sFAAsF;AACtF,yEAAyE;AACzE,iFAAiF;AACjF,kFAAkF;AAClF,kFAAkF;AAClF,qDAAqD;AACrD,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAE9E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,CAAA;AAcjD;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,OAAO,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAA;AAC3C,CAAC;AAQD;;;GAGG;AACH,SAAS,aAAa,CAAC,OAAe;IACpC,MAAM,EAAE,WAAW,EAAE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ompts and fragment library for the Agent Architecture Board.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,14 +32,14 @@
32
32
  "handlebars": "^4.7.9",
33
33
  "p-map": "^7.0.6",
34
34
  "valibot": "^1.4.2",
35
- "@cat-factory/contracts": "0.207.0",
36
- "@cat-factory/kernel": "0.207.0",
37
- "@cat-factory/prompt-fragments": "0.15.31"
35
+ "@cat-factory/contracts": "0.209.0",
36
+ "@cat-factory/kernel": "0.209.0",
37
+ "@cat-factory/prompt-fragments": "0.15.33"
38
38
  },
39
39
  "devDependencies": {
40
40
  "typescript": "7.0.2",
41
41
  "vitest": "^4.1.10",
42
- "@cat-factory/caching": "0.12.4"
42
+ "@cat-factory/caching": "0.12.6"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsc -b tsconfig.build.json",