@remnic/core 9.68.0 → 9.69.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 (45) hide show
  1. package/dist/access-admin-ops-surface.d.ts +1 -1
  2. package/dist/access-authorization-probe.d.ts +1 -1
  3. package/dist/access-boundary.d.ts +1 -1
  4. package/dist/access-cli.js +1 -1
  5. package/dist/access-extraction-force-flush.d.ts +1 -1
  6. package/dist/access-http-lcm-compaction.d.ts +1 -1
  7. package/dist/access-http-lifecycle-flush.d.ts +1 -1
  8. package/dist/access-http-offline-stream.d.ts +1 -1
  9. package/dist/access-http.d.ts +2 -2
  10. package/dist/access-lcm-surface.d.ts +1 -1
  11. package/dist/access-mcp.d.ts +1 -1
  12. package/dist/access-observe-write-surface.d.ts +1 -1
  13. package/dist/access-operations.d.ts +6 -6
  14. package/dist/access-recall-concurrency.d.ts +1 -1
  15. package/dist/access-recall-response.d.ts +1 -1
  16. package/dist/access-recall-surface.d.ts +1 -1
  17. package/dist/access-schema.d.ts +89 -89
  18. package/dist/access-service-helpers.d.ts +1 -1
  19. package/dist/access-service.d.ts +1 -1
  20. package/dist/access-surface-catalog.d.ts +1 -1
  21. package/dist/{chunk-WFFGUFFN.js → chunk-BZ26443Y.js} +60 -1
  22. package/dist/chunk-BZ26443Y.js.map +1 -0
  23. package/dist/{cli-Bvy4jdBu.d.ts → cli-CFpMhqz5.d.ts} +1 -1
  24. package/dist/cli.d.ts +2 -2
  25. package/dist/external-wiki-access.d.ts +1 -1
  26. package/dist/external-wiki-mcp-tools.d.ts +1 -1
  27. package/dist/index.d.ts +713 -681
  28. package/dist/index.js +5 -1
  29. package/dist/mcp-memory-inspector-app.d.ts +1 -1
  30. package/dist/memory-subject-cli.d.ts +1 -1
  31. package/dist/memory-subject.d.ts +1 -1
  32. package/dist/orchestrator.js +1 -1
  33. package/dist/{public-http-2MyshWxl.d.ts → public-http-C9-CHc40.d.ts} +1 -1
  34. package/dist/schemas.d.ts +176 -176
  35. package/dist/shared-context/manager.d.ts +6 -6
  36. package/dist/support-passport/index.d.ts +4 -4
  37. package/dist/transfer/types.d.ts +78 -78
  38. package/dist/who-knows-cli.d.ts +1 -1
  39. package/dist/who-knows.d.ts +1 -1
  40. package/package.json +2 -2
  41. package/src/activity/index.ts +1 -0
  42. package/src/activity/vault-status.test.ts +138 -0
  43. package/src/activity/vault-status.ts +96 -0
  44. package/dist/chunk-WFFGUFFN.js.map +0 -1
  45. package/dist/{access-service-LbwWl05g.d.ts → access-service-DcfM0Vf0.d.ts} +64 -64
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Pure vault-publish outcome aggregator (issue #1985).
3
+ *
4
+ * `summarizeVaultPublish` folds per-file publish results into the status
5
+ * shape the publish report and the dry-run print: sorted per-file outcomes
6
+ * plus zero-filled counts. It performs no I/O and never mutates its input.
7
+ *
8
+ * Fail-closed contract: an unrecognized outcome is refused, never coerced
9
+ * into `skipped` or `error`, and `skipped`/`error` must carry a non-blank
10
+ * reason so every un-actionable row says why.
11
+ */
12
+
13
+ export const VAULT_PUBLISH_OUTCOMES = ["updated", "unchanged", "skipped", "error"] as const;
14
+ export type VaultPublishOutcome = (typeof VAULT_PUBLISH_OUTCOMES)[number];
15
+
16
+ export interface VaultPublishResult {
17
+ /** Vault-relative note path. */
18
+ path: string;
19
+ outcome: string;
20
+ /** Required for skipped and error, e.g. "no_marker". */
21
+ reason?: string;
22
+ }
23
+
24
+ export interface VaultPublishStatus {
25
+ results: Array<{ path: string; outcome: VaultPublishOutcome; reason?: string }>;
26
+ counts: Record<VaultPublishOutcome, number>;
27
+ /** True when at least one entry is an error. */
28
+ hasError: boolean;
29
+ }
30
+
31
+ interface ValidatedEntry {
32
+ path: string;
33
+ outcome: VaultPublishOutcome;
34
+ reason?: string;
35
+ }
36
+
37
+ /** Total order: path asc, then outcome in allow-list order, then reason. */
38
+ function compareEntries(a: ValidatedEntry, b: ValidatedEntry): number {
39
+ if (a.path !== b.path) return a.path < b.path ? -1 : 1;
40
+ const rankA = VAULT_PUBLISH_OUTCOMES.indexOf(a.outcome);
41
+ const rankB = VAULT_PUBLISH_OUTCOMES.indexOf(b.outcome);
42
+ if (rankA !== rankB) return rankA < rankB ? -1 : 1;
43
+ const reasonA = a.reason ?? "";
44
+ const reasonB = b.reason ?? "";
45
+ if (reasonA !== reasonB) return reasonA < reasonB ? -1 : 1;
46
+ return 0;
47
+ }
48
+
49
+ export function summarizeVaultPublish(results: readonly VaultPublishResult[]): VaultPublishStatus {
50
+ if (!Array.isArray(results)) {
51
+ throw new TypeError(`summarizeVaultPublish expects an array of results (got ${typeof results})`);
52
+ }
53
+
54
+ const entries: ValidatedEntry[] = [];
55
+ for (const entry of results) {
56
+ if (typeof entry !== "object" || entry === null) {
57
+ throw new TypeError(`vault publish result entries must be objects (got ${typeof entry})`);
58
+ }
59
+ if (typeof entry.path !== "string" || entry.path.trim() === "") {
60
+ throw new RangeError(`vault publish result requires a non-blank path (got ${JSON.stringify(entry.path)})`);
61
+ }
62
+ const outcome = VAULT_PUBLISH_OUTCOMES.find((candidate) => candidate === entry.outcome);
63
+ if (outcome === undefined) {
64
+ throw new TypeError(
65
+ `unknown vault publish outcome ${JSON.stringify(entry.outcome)}; expected one of: ${VAULT_PUBLISH_OUTCOMES.join(", ")}`,
66
+ );
67
+ }
68
+ if (outcome === "skipped" || outcome === "error") {
69
+ if (typeof entry.reason !== "string" || entry.reason.trim() === "") {
70
+ throw new TypeError(
71
+ `vault publish outcome "${outcome}" requires a non-blank reason, e.g. "no_marker" (got ${JSON.stringify(entry.reason)})`,
72
+ );
73
+ }
74
+ entries.push({ path: entry.path, outcome, reason: entry.reason });
75
+ } else {
76
+ if (entry.reason !== undefined) {
77
+ throw new TypeError(
78
+ `vault publish outcome "${outcome}" must not carry a reason (got ${JSON.stringify(entry.reason)})`,
79
+ );
80
+ }
81
+ entries.push({ path: entry.path, outcome });
82
+ }
83
+ }
84
+
85
+ const sorted = [...entries].sort(compareEntries);
86
+
87
+ const counts = {} as Record<VaultPublishOutcome, number>;
88
+ for (const outcome of VAULT_PUBLISH_OUTCOMES) counts[outcome] = 0;
89
+ for (const entry of sorted) counts[entry.outcome] += 1;
90
+
91
+ return {
92
+ results: sorted,
93
+ counts,
94
+ hasError: counts.error > 0,
95
+ };
96
+ }