open-multi-agent-kit 0.96.2 → 0.97.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 (138) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +4 -2
  3. package/dist/core/agent-session.d.ts +9 -1
  4. package/dist/core/agent-session.d.ts.map +1 -1
  5. package/dist/core/agent-session.js +84 -7
  6. package/dist/core/agent-session.js.map +1 -1
  7. package/dist/core/attachment-store.d.ts +39 -0
  8. package/dist/core/attachment-store.d.ts.map +1 -0
  9. package/dist/core/attachment-store.js +81 -0
  10. package/dist/core/attachment-store.js.map +1 -0
  11. package/dist/core/command-safety.d.ts +8 -0
  12. package/dist/core/command-safety.d.ts.map +1 -1
  13. package/dist/core/command-safety.js +140 -14
  14. package/dist/core/command-safety.js.map +1 -1
  15. package/dist/core/compaction/compaction.d.ts +6 -1
  16. package/dist/core/compaction/compaction.d.ts.map +1 -1
  17. package/dist/core/compaction/compaction.js +35 -1
  18. package/dist/core/compaction/compaction.js.map +1 -1
  19. package/dist/core/context-budget-governor-v2.d.ts +1 -1
  20. package/dist/core/context-budget-governor-v2.d.ts.map +1 -1
  21. package/dist/core/context-budget-governor-v2.js +1 -1
  22. package/dist/core/context-budget-governor-v2.js.map +1 -1
  23. package/dist/core/context-budget-v2-cache-keys.d.ts +3 -0
  24. package/dist/core/context-budget-v2-cache-keys.d.ts.map +1 -1
  25. package/dist/core/context-budget-v2-cache-keys.js +2 -0
  26. package/dist/core/context-budget-v2-cache-keys.js.map +1 -1
  27. package/dist/core/context-budget-v2-plan-cache-keys.d.ts.map +1 -1
  28. package/dist/core/context-budget-v2-plan-cache-keys.js +3 -0
  29. package/dist/core/context-budget-v2-plan-cache-keys.js.map +1 -1
  30. package/dist/core/context-budget-v2-planner.d.ts.map +1 -1
  31. package/dist/core/context-budget-v2-planner.js +2 -1
  32. package/dist/core/context-budget-v2-planner.js.map +1 -1
  33. package/dist/core/context-budget-v2-scoring.d.ts +17 -0
  34. package/dist/core/context-budget-v2-scoring.d.ts.map +1 -1
  35. package/dist/core/context-budget-v2-scoring.js +25 -8
  36. package/dist/core/context-budget-v2-scoring.js.map +1 -1
  37. package/dist/core/context-budget-v2-selection.d.ts +2 -2
  38. package/dist/core/context-budget-v2-selection.d.ts.map +1 -1
  39. package/dist/core/context-budget-v2-selection.js +18 -1
  40. package/dist/core/context-budget-v2-selection.js.map +1 -1
  41. package/dist/core/context-budget-v2-types.d.ts +17 -0
  42. package/dist/core/context-budget-v2-types.d.ts.map +1 -1
  43. package/dist/core/context-budget-v2-types.js +15 -0
  44. package/dist/core/context-budget-v2-types.js.map +1 -1
  45. package/dist/core/extensions/builtin/command-safety-gate.d.ts +3 -1
  46. package/dist/core/extensions/builtin/command-safety-gate.d.ts.map +1 -1
  47. package/dist/core/extensions/builtin/command-safety-gate.js +7 -0
  48. package/dist/core/extensions/builtin/command-safety-gate.js.map +1 -1
  49. package/dist/core/extensions/types.d.ts +12 -1
  50. package/dist/core/extensions/types.d.ts.map +1 -1
  51. package/dist/core/extensions/types.js.map +1 -1
  52. package/dist/core/model-registry.d.ts +8 -3
  53. package/dist/core/model-registry.d.ts.map +1 -1
  54. package/dist/core/model-registry.js +71 -1
  55. package/dist/core/model-registry.js.map +1 -1
  56. package/dist/core/package-doctor-source-scan.d.ts +9 -0
  57. package/dist/core/package-doctor-source-scan.d.ts.map +1 -1
  58. package/dist/core/package-doctor-source-scan.js +77 -4
  59. package/dist/core/package-doctor-source-scan.js.map +1 -1
  60. package/dist/core/prompt-attachment.d.ts +51 -0
  61. package/dist/core/prompt-attachment.d.ts.map +1 -0
  62. package/dist/core/prompt-attachment.js +186 -0
  63. package/dist/core/prompt-attachment.js.map +1 -0
  64. package/dist/core/provider-resilience.d.ts +28 -0
  65. package/dist/core/provider-resilience.d.ts.map +1 -1
  66. package/dist/core/provider-resilience.js +50 -0
  67. package/dist/core/provider-resilience.js.map +1 -1
  68. package/dist/core/provider-retry.d.ts +1 -1
  69. package/dist/core/provider-retry.d.ts.map +1 -1
  70. package/dist/core/provider-retry.js +1 -1
  71. package/dist/core/provider-retry.js.map +1 -1
  72. package/dist/core/provider-usage.d.ts.map +1 -1
  73. package/dist/core/provider-usage.js +68 -2
  74. package/dist/core/provider-usage.js.map +1 -1
  75. package/dist/core/reasoning-router-promotion.d.ts +84 -0
  76. package/dist/core/reasoning-router-promotion.d.ts.map +1 -0
  77. package/dist/core/reasoning-router-promotion.js +92 -0
  78. package/dist/core/reasoning-router-promotion.js.map +1 -0
  79. package/dist/core/session-bash-service.d.ts.map +1 -1
  80. package/dist/core/session-bash-service.js +4 -3
  81. package/dist/core/session-bash-service.js.map +1 -1
  82. package/dist/core/session-termination.d.ts +1 -1
  83. package/dist/core/session-termination.d.ts.map +1 -1
  84. package/dist/core/session-termination.js +11 -2
  85. package/dist/core/session-termination.js.map +1 -1
  86. package/dist/core/tools/bash.d.ts.map +1 -1
  87. package/dist/core/tools/bash.js +3 -7
  88. package/dist/core/tools/bash.js.map +1 -1
  89. package/dist/core/tools/grep.d.ts.map +1 -1
  90. package/dist/core/tools/grep.js +13 -48
  91. package/dist/core/tools/grep.js.map +1 -1
  92. package/dist/core/tools/read.d.ts.map +1 -1
  93. package/dist/core/tools/read.js +1 -34
  94. package/dist/core/tools/read.js.map +1 -1
  95. package/dist/index.d.ts +1 -1
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +1 -1
  98. package/dist/index.js.map +1 -1
  99. package/dist/modes/interactive/components/attachment-strip.d.ts +21 -0
  100. package/dist/modes/interactive/components/attachment-strip.d.ts.map +1 -0
  101. package/dist/modes/interactive/components/attachment-strip.js +136 -0
  102. package/dist/modes/interactive/components/attachment-strip.js.map +1 -0
  103. package/dist/modes/interactive/components/footer.d.ts +6 -0
  104. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  105. package/dist/modes/interactive/components/footer.js +26 -1
  106. package/dist/modes/interactive/components/footer.js.map +1 -1
  107. package/dist/modes/interactive/components/status-sidebar.d.ts.map +1 -1
  108. package/dist/modes/interactive/components/status-sidebar.js +12 -1
  109. package/dist/modes/interactive/components/status-sidebar.js.map +1 -1
  110. package/dist/modes/interactive/interactive-mode.d.ts +23 -4
  111. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  112. package/dist/modes/interactive/interactive-mode.js +174 -53
  113. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  114. package/docs/compaction.md +1 -1
  115. package/docs/extensions.md +12 -3
  116. package/docs/index.md +4 -1
  117. package/docs/metrics.md +74 -2
  118. package/docs/provider-resilience.md +11 -0
  119. package/docs/usage.md +1 -1
  120. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  121. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  122. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  123. package/examples/extensions/gondolin/package-lock.json +2 -2
  124. package/examples/extensions/gondolin/package.json +1 -1
  125. package/examples/extensions/sandbox/package-lock.json +2 -2
  126. package/examples/extensions/sandbox/package.json +1 -1
  127. package/examples/extensions/with-deps/package-lock.json +2 -2
  128. package/examples/extensions/with-deps/package.json +1 -1
  129. package/npm-shrinkwrap.json +18 -18
  130. package/package.json +7 -7
  131. package/dist/core/tools/omp-pure-seams.d.ts +0 -41
  132. package/dist/core/tools/omp-pure-seams.d.ts.map +0 -1
  133. package/dist/core/tools/omp-pure-seams.js +0 -142
  134. package/dist/core/tools/omp-pure-seams.js.map +0 -1
  135. package/dist/core/tools/omp-seam-runtime.d.ts +0 -100
  136. package/dist/core/tools/omp-seam-runtime.d.ts.map +0 -1
  137. package/dist/core/tools/omp-seam-runtime.js +0 -40
  138. package/dist/core/tools/omp-seam-runtime.js.map +0 -1
@@ -1,142 +0,0 @@
1
- var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
- if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
- return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
- return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
- });
6
- }
7
- return path;
8
- };
9
- /**
10
- * Flag-gated loader for the vendored oh-my-pi "pure" read/search/hashline seams.
11
- *
12
- * These seams are pure data/proposal-only functions (planning + presentation +
13
- * hashline parsing). They do NOT touch edit/write/file-mutation paths. The
14
- * loader is enabled by default and opts out via OMK_OMP_SEAMS=0 (ADR-OMP-009);
15
- * when disabled it throws DISABLED and tool behavior falls back to the
16
- * pre-seam implementation byte-identically.
17
- *
18
- * The file is erasable TypeScript: no `enum`, no parameter properties, no `as`,
19
- * no non-null assertions, no `any` annotations, and no runtime dependencies
20
- * beyond the Node.js standard library.
21
- */
22
- import { existsSync } from "node:fs";
23
- import { dirname, isAbsolute, join, resolve } from "node:path";
24
- import { fileURLToPath, pathToFileURL } from "node:url";
25
- /** Typed error thrown by {@link loadOmpPureSeams}. */
26
- export class OmpSeamsError extends Error {
27
- code;
28
- constructor(code, message) {
29
- super(message);
30
- this.name = "OmpSeamsError";
31
- this.code = code;
32
- }
33
- }
34
- /**
35
- * Returns true unless the seams feature is explicitly disabled
36
- * (OMK_OMP_SEAMS === "0"). Enabled by default per ADR-OMP-009.
37
- * Reads `process.env` when no record is supplied.
38
- */
39
- export function isOmpSeamsEnabled(env) {
40
- const source = env ?? process.env;
41
- return source.OMK_OMP_SEAMS !== "0";
42
- }
43
- const VENDOR_SEGMENT = join("vendor", "oh-my-pi");
44
- const VENDOR_MARKER = join(VENDOR_SEGMENT, "packages", "coding-agent", "src", "pure", "read.ts");
45
- const MAX_WALK_UP_LEVELS = 8;
46
- /**
47
- * Walks up from `startDir` (inclusive) looking for a `vendor/oh-my-pi`
48
- * directory that contains the pure read seam marker file. Returns the absolute
49
- * vendor directory path, or `undefined` when none is found within the level cap.
50
- */
51
- export function resolveOmpVendorDir(startDir) {
52
- let dir = isAbsolute(startDir) ? startDir : resolve(startDir);
53
- for (let level = 0; level <= MAX_WALK_UP_LEVELS; level += 1) {
54
- if (existsSync(join(dir, VENDOR_MARKER))) {
55
- return join(dir, VENDOR_SEGMENT);
56
- }
57
- const parent = dirname(dir);
58
- if (parent === dir)
59
- break;
60
- dir = parent;
61
- }
62
- return undefined;
63
- }
64
- function isSeamFn(member) {
65
- return typeof member === "function";
66
- }
67
- function isSeamAsyncStrFn(member) {
68
- return typeof member === "function";
69
- }
70
- function expectFn(member, guard, name) {
71
- if (guard(member))
72
- return member;
73
- throw new OmpSeamsError("INVALID_SEAM", `OMP seam missing or non-function: ${name}`);
74
- }
75
- const READ_SEAM = join("packages", "coding-agent", "src", "pure", "read.ts");
76
- const SEARCH_SEAM = join("packages", "coding-agent", "src", "pure", "search.ts");
77
- const PROPOSAL_SEAM = join("packages", "hashline", "src", "proposal.ts");
78
- /**
79
- * Loads and validates the three pure seam modules from the vendored oh-my-pi
80
- * tree and returns a frozen {@link OmpPureSeams} record. Throws
81
- * {@link OmpSeamsError} with code DISABLED when the feature is off,
82
- * VENDOR_NOT_FOUND when the vendor tree cannot be located, or INVALID_SEAM when
83
- * any expected export is missing or not a function.
84
- */
85
- export async function loadOmpPureSeams(options) {
86
- const env = options?.env ?? process.env;
87
- if (!isOmpSeamsEnabled(env)) {
88
- throw new OmpSeamsError("DISABLED", "OMP pure seams are disabled (OMK_OMP_SEAMS=0; unset or set to any other value to enable).");
89
- }
90
- let vendorDir = options?.vendorDir ?? env.OMK_OMP_VENDOR_DIR;
91
- if (!vendorDir) {
92
- const moduleUrl = new URL(".", import.meta.url);
93
- if (moduleUrl.protocol !== "file:") {
94
- throw new OmpSeamsError("VENDOR_NOT_FOUND", "OMP vendor dir was not provided and the module is not a file URL.");
95
- }
96
- const found = resolveOmpVendorDir(fileURLToPath(moduleUrl));
97
- if (!found) {
98
- throw new OmpSeamsError("VENDOR_NOT_FOUND", "OMP vendor dir not found by walking up from the module directory.");
99
- }
100
- vendorDir = found;
101
- }
102
- if (!existsSync(vendorDir)) {
103
- throw new OmpSeamsError("VENDOR_NOT_FOUND", `OMP vendor dir does not exist: ${vendorDir}`);
104
- }
105
- const readUrl = pathToFileURL(join(vendorDir, READ_SEAM)).href;
106
- const searchUrl = pathToFileURL(join(vendorDir, SEARCH_SEAM)).href;
107
- const proposalUrl = pathToFileURL(join(vendorDir, PROPOSAL_SEAM)).href;
108
- const readMod = await import(__rewriteRelativeImportExtension(readUrl));
109
- const searchMod = await import(__rewriteRelativeImportExtension(searchUrl));
110
- const proposalMod = await import(__rewriteRelativeImportExtension(proposalUrl));
111
- // Validate every expected member up front so the INVALID_SEAM error lists
112
- // ALL missing/non-function exports, not just the first one encountered.
113
- const expected = [
114
- [readMod.planRead, "planRead"],
115
- [readMod.presentRead, "presentRead"],
116
- [searchMod.planSearch, "planSearch"],
117
- [searchMod.presentSearch, "presentSearch"],
118
- [proposalMod.parseHashlineProposal, "parseHashlineProposal"],
119
- [proposalMod.hashProposalLine, "hashProposalLine"],
120
- [proposalMod.hashProposalSource, "hashProposalSource"],
121
- ];
122
- const missing = [];
123
- for (const [member, name] of expected) {
124
- if (typeof member !== "function")
125
- missing.push(name);
126
- }
127
- if (missing.length > 0) {
128
- throw new OmpSeamsError("INVALID_SEAM", `OMP seams missing or non-function: ${missing.join(", ")}`);
129
- }
130
- const rec = {
131
- planRead: expectFn(readMod.planRead, isSeamFn, "planRead"),
132
- presentRead: expectFn(readMod.presentRead, isSeamFn, "presentRead"),
133
- planSearch: expectFn(searchMod.planSearch, isSeamFn, "planSearch"),
134
- presentSearch: expectFn(searchMod.presentSearch, isSeamFn, "presentSearch"),
135
- parseHashlineProposal: expectFn(proposalMod.parseHashlineProposal, isSeamFn, "parseHashlineProposal"),
136
- hashProposalLine: expectFn(proposalMod.hashProposalLine, isSeamAsyncStrFn, "hashProposalLine"),
137
- hashProposalSource: expectFn(proposalMod.hashProposalSource, isSeamAsyncStrFn, "hashProposalSource"),
138
- };
139
- Object.freeze(rec);
140
- return rec;
141
- }
142
- //# sourceMappingURL=omp-pure-seams.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"omp-pure-seams.js","sourceRoot":"","sources":["../../../src/core/tools/omp-pure-seams.ts"],"names":[],"mappings":";;;;;;;;AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKxD,sDAAsD;AACtD,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC9B,IAAI,CAAoB;IAEjC,YAAY,IAAuB,EAAE,OAAe,EAAE;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAAA,CACjB;CACD;AAaD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAwC,EAAW;IACpF,MAAM,MAAM,GAAuC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACtE,OAAO,MAAM,CAAC,aAAa,KAAK,GAAG,CAAC;AAAA,CACpC;AAED,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAClD,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AACjG,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAsB;IACzE,IAAI,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9D,KAA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AAE,eAAe,CAAC;QAC3E,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAAC,qBAAqB,EAAE,QAAQ,EAAE,uBAAuB,CAAC;QACrG,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,CAAC;QAC9F,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,oBAAoB,CAAC;KACpG,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,GAAG,CAAC;AAAA,CACX","sourcesContent":["/**\n * Flag-gated loader for the vendored oh-my-pi \"pure\" read/search/hashline seams.\n *\n * These seams are pure data/proposal-only functions (planning + presentation +\n * hashline parsing). They do NOT touch edit/write/file-mutation paths. The\n * loader is enabled by default and opts out via OMK_OMP_SEAMS=0 (ADR-OMP-009);\n * when disabled it throws DISABLED and tool behavior falls back to the\n * pre-seam implementation byte-identically.\n *\n * The file is erasable TypeScript: no `enum`, no parameter properties, no `as`,\n * no non-null assertions, no `any` annotations, and no runtime dependencies\n * beyond the Node.js standard library.\n */\nimport { existsSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\n\n/** Error categories raised by the OMP pure-seam loader. */\nexport type OmpSeamsErrorCode = \"DISABLED\" | \"VENDOR_NOT_FOUND\" | \"INVALID_SEAM\";\n\n/** Typed error thrown by {@link loadOmpPureSeams}. */\nexport class OmpSeamsError extends Error {\n\treadonly code: OmpSeamsErrorCode;\n\n\tconstructor(code: OmpSeamsErrorCode, message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"OmpSeamsError\";\n\t\tthis.code = code;\n\t}\n}\n\n/** The validated set of pure oh-my-pi seams (data/proposal-only). */\nexport interface OmpPureSeams {\n\tplanRead(input: unknown): unknown;\n\tpresentRead(plan: unknown, file: unknown): unknown;\n\tplanSearch(input: unknown): unknown;\n\tpresentSearch(plan: unknown, matches: unknown, sourceDigests?: unknown): unknown;\n\tparseHashlineProposal(text: string): unknown;\n\thashProposalLine(text: string): Promise<string>;\n\thashProposalSource(text: string): Promise<string>;\n}\n\n/**\n * Returns true unless the seams feature is explicitly disabled\n * (OMK_OMP_SEAMS === \"0\"). Enabled by default per ADR-OMP-009.\n * Reads `process.env` when no record is supplied.\n */\nexport function isOmpSeamsEnabled(env?: Record<string, string | undefined>): boolean {\n\tconst source: Record<string, string | undefined> = env ?? process.env;\n\treturn source.OMK_OMP_SEAMS !== \"0\";\n}\n\nconst VENDOR_SEGMENT = join(\"vendor\", \"oh-my-pi\");\nconst VENDOR_MARKER = join(VENDOR_SEGMENT, \"packages\", \"coding-agent\", \"src\", \"pure\", \"read.ts\");\nconst MAX_WALK_UP_LEVELS = 8;\n\n/**\n * Walks up from `startDir` (inclusive) looking for a `vendor/oh-my-pi`\n * directory that contains the pure read seam marker file. Returns the absolute\n * vendor directory path, or `undefined` when none is found within the level cap.\n */\nexport function resolveOmpVendorDir(startDir: string): string | undefined {\n\tlet dir = isAbsolute(startDir) ? startDir : resolve(startDir);\n\tfor (let level = 0; level <= MAX_WALK_UP_LEVELS; level += 1) {\n\t\tif (existsSync(join(dir, VENDOR_MARKER))) {\n\t\t\treturn join(dir, VENDOR_SEGMENT);\n\t\t}\n\t\tconst parent = dirname(dir);\n\t\tif (parent === dir) break;\n\t\tdir = parent;\n\t}\n\treturn undefined;\n}\n\n// --- internal narrowing helpers (no `as`; type guards carry the signatures) ---\n\ntype SeamFn = (...args: never[]) => unknown;\ntype SeamAsyncStrFn = (...args: never[]) => Promise<string>;\n\nfunction isSeamFn(member: unknown): member is SeamFn {\n\treturn typeof member === \"function\";\n}\n\nfunction isSeamAsyncStrFn(member: unknown): member is SeamAsyncStrFn {\n\treturn typeof member === \"function\";\n}\n\nfunction expectFn<T extends SeamFn>(member: unknown, guard: (m: unknown) => m is T, name: string): T {\n\tif (guard(member)) return member;\n\tthrow new OmpSeamsError(\"INVALID_SEAM\", `OMP seam missing or non-function: ${name}`);\n}\n\nconst READ_SEAM = join(\"packages\", \"coding-agent\", \"src\", \"pure\", \"read.ts\");\nconst SEARCH_SEAM = join(\"packages\", \"coding-agent\", \"src\", \"pure\", \"search.ts\");\nconst PROPOSAL_SEAM = join(\"packages\", \"hashline\", \"src\", \"proposal.ts\");\n\n/**\n * Loads and validates the three pure seam modules from the vendored oh-my-pi\n * tree and returns a frozen {@link OmpPureSeams} record. Throws\n * {@link OmpSeamsError} with code DISABLED when the feature is off,\n * VENDOR_NOT_FOUND when the vendor tree cannot be located, or INVALID_SEAM when\n * any expected export is missing or not a function.\n */\nexport async function loadOmpPureSeams(options?: {\n\tvendorDir?: string;\n\tenv?: Record<string, string | undefined>;\n}): Promise<OmpPureSeams> {\n\tconst env: Record<string, string | undefined> = options?.env ?? process.env;\n\tif (!isOmpSeamsEnabled(env)) {\n\t\tthrow new OmpSeamsError(\n\t\t\t\"DISABLED\",\n\t\t\t\"OMP pure seams are disabled (OMK_OMP_SEAMS=0; unset or set to any other value to enable).\",\n\t\t);\n\t}\n\n\tlet vendorDir: string | undefined = options?.vendorDir ?? env.OMK_OMP_VENDOR_DIR;\n\tif (!vendorDir) {\n\t\tconst moduleUrl = new URL(\".\", import.meta.url);\n\t\tif (moduleUrl.protocol !== \"file:\") {\n\t\t\tthrow new OmpSeamsError(\n\t\t\t\t\"VENDOR_NOT_FOUND\",\n\t\t\t\t\"OMP vendor dir was not provided and the module is not a file URL.\",\n\t\t\t);\n\t\t}\n\t\tconst found = resolveOmpVendorDir(fileURLToPath(moduleUrl));\n\t\tif (!found) {\n\t\t\tthrow new OmpSeamsError(\n\t\t\t\t\"VENDOR_NOT_FOUND\",\n\t\t\t\t\"OMP vendor dir not found by walking up from the module directory.\",\n\t\t\t);\n\t\t}\n\t\tvendorDir = found;\n\t}\n\tif (!existsSync(vendorDir)) {\n\t\tthrow new OmpSeamsError(\"VENDOR_NOT_FOUND\", `OMP vendor dir does not exist: ${vendorDir}`);\n\t}\n\n\tconst readUrl = pathToFileURL(join(vendorDir, READ_SEAM)).href;\n\tconst searchUrl = pathToFileURL(join(vendorDir, SEARCH_SEAM)).href;\n\tconst proposalUrl = pathToFileURL(join(vendorDir, PROPOSAL_SEAM)).href;\n\n\tconst readMod = await import(readUrl);\n\tconst searchMod = await import(searchUrl);\n\tconst proposalMod = await import(proposalUrl);\n\n\t// Validate every expected member up front so the INVALID_SEAM error lists\n\t// ALL missing/non-function exports, not just the first one encountered.\n\tconst expected: ReadonlyArray<readonly [unknown, string]> = [\n\t\t[readMod.planRead, \"planRead\"],\n\t\t[readMod.presentRead, \"presentRead\"],\n\t\t[searchMod.planSearch, \"planSearch\"],\n\t\t[searchMod.presentSearch, \"presentSearch\"],\n\t\t[proposalMod.parseHashlineProposal, \"parseHashlineProposal\"],\n\t\t[proposalMod.hashProposalLine, \"hashProposalLine\"],\n\t\t[proposalMod.hashProposalSource, \"hashProposalSource\"],\n\t];\n\tconst missing: string[] = [];\n\tfor (const [member, name] of expected) {\n\t\tif (typeof member !== \"function\") missing.push(name);\n\t}\n\tif (missing.length > 0) {\n\t\tthrow new OmpSeamsError(\"INVALID_SEAM\", `OMP seams missing or non-function: ${missing.join(\", \")}`);\n\t}\n\n\tconst rec: OmpPureSeams = {\n\t\tplanRead: expectFn(readMod.planRead, isSeamFn, \"planRead\"),\n\t\tpresentRead: expectFn(readMod.presentRead, isSeamFn, \"presentRead\"),\n\t\tplanSearch: expectFn(searchMod.planSearch, isSeamFn, \"planSearch\"),\n\t\tpresentSearch: expectFn(searchMod.presentSearch, isSeamFn, \"presentSearch\"),\n\t\tparseHashlineProposal: expectFn(proposalMod.parseHashlineProposal, isSeamFn, \"parseHashlineProposal\"),\n\t\thashProposalLine: expectFn(proposalMod.hashProposalLine, isSeamAsyncStrFn, \"hashProposalLine\"),\n\t\thashProposalSource: expectFn(proposalMod.hashProposalSource, isSeamAsyncStrFn, \"hashProposalSource\"),\n\t};\n\tObject.freeze(rec);\n\treturn rec;\n}\n"]}
@@ -1,100 +0,0 @@
1
- /**
2
- * Typed runtime facade over the flag-gated OMP pure-seam loader.
3
- *
4
- * Wiring boundary for I2 (ADR-OMP-008/009): the read and grep tools delegate
5
- * request validation and output presentation to the vendored OMP pure seams.
6
- * Enabled by default; `OMK_OMP_SEAMS=0` opts out and tool behavior falls back
7
- * byte-identically to the pre-seam implementation.
8
- *
9
- * The loader exposes unknown-in/unknown-out signatures; all structural
10
- * assertions live in this single file so tool code stays clean.
11
- */
12
- import { type OmpPureSeams } from "./omp-pure-seams.ts";
13
- export interface OmpIssue {
14
- readonly field: string;
15
- readonly code: string;
16
- readonly message: string;
17
- }
18
- export interface OmpReadPlan {
19
- readonly path: string;
20
- readonly offset: number;
21
- readonly limit: number;
22
- }
23
- export type OmpReadPlanResult = {
24
- readonly ok: true;
25
- readonly plan: OmpReadPlan;
26
- } | {
27
- readonly ok: false;
28
- readonly issues: readonly OmpIssue[];
29
- };
30
- export interface OmpReadPresentation {
31
- readonly text: string;
32
- readonly window: {
33
- readonly startLine: number;
34
- readonly endLine: number;
35
- readonly totalLines: number;
36
- readonly truncated: boolean;
37
- };
38
- }
39
- export type OmpReadPresentResult = {
40
- readonly ok: true;
41
- readonly presentation: OmpReadPresentation;
42
- } | {
43
- readonly ok: false;
44
- readonly conflicts: readonly unknown[];
45
- };
46
- export interface OmpSearchPlan {
47
- readonly pattern: string;
48
- readonly path: string;
49
- readonly glob?: string;
50
- readonly ignoreCase: boolean;
51
- readonly literal: boolean;
52
- readonly context: number;
53
- readonly limit: number;
54
- }
55
- export type OmpSearchPlanResult = {
56
- readonly ok: true;
57
- readonly plan: OmpSearchPlan;
58
- } | {
59
- readonly ok: false;
60
- readonly issues: readonly OmpIssue[];
61
- };
62
- export interface OmpSearchHostMatch {
63
- readonly file: string;
64
- readonly line: number;
65
- readonly column?: number;
66
- readonly text: string;
67
- readonly expectedLineHash?: string;
68
- }
69
- export interface OmpSearchPresentation {
70
- readonly text: string;
71
- readonly totalMatches: number;
72
- readonly omittedMatches: number;
73
- readonly truncated: boolean;
74
- }
75
- export type OmpSearchPresentResult = {
76
- readonly ok: true;
77
- readonly presentation: OmpSearchPresentation;
78
- } | {
79
- readonly ok: false;
80
- readonly conflicts: readonly unknown[];
81
- };
82
- /**
83
- * Returns the memoized seam set unless `OMK_OMP_SEAMS=0`; `undefined` when
84
- * opted out. Loader errors (VENDOR_NOT_FOUND, INVALID_SEAM) propagate to
85
- * the caller of the returned promise.
86
- */
87
- export declare function getOmpSeams(): Promise<OmpPureSeams> | undefined;
88
- export declare function planRead(seams: OmpPureSeams, input: unknown): OmpReadPlanResult;
89
- export declare function presentRead(seams: OmpPureSeams, plan: OmpReadPlan, file: {
90
- text: string;
91
- sourceDigest?: string;
92
- lineDigests?: readonly {
93
- line: number;
94
- digest: string;
95
- }[];
96
- }): OmpReadPresentResult;
97
- export declare function planSearch(seams: OmpPureSeams, input: unknown): OmpSearchPlanResult;
98
- export declare function presentSearch(seams: OmpPureSeams, plan: OmpSearchPlan, matches: readonly OmpSearchHostMatch[]): OmpSearchPresentResult;
99
- export declare function formatOmpIssues(issues: readonly OmpIssue[]): string;
100
- //# sourceMappingURL=omp-seam-runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"omp-seam-runtime.d.ts","sourceRoot":"","sources":["../../../src/core/tools/omp-seam-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAuC,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE7F,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACx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,WAAW,CAAC,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,GACtG,oBAAoB,CAEtB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAEnF;AAED,wBAAgB,aAAa,CAC5B,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,SAAS,kBAAkB,EAAE,GACpC,sBAAsB,CAExB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,GAAG,MAAM,CAEnE","sourcesContent":["/**\n * Typed runtime facade over the flag-gated OMP pure-seam loader.\n *\n * Wiring boundary for I2 (ADR-OMP-008/009): the read and grep tools delegate\n * request validation and output presentation to the vendored OMP pure seams.\n * Enabled by default; `OMK_OMP_SEAMS=0` opts out and tool behavior falls back\n * byte-identically to the pre-seam implementation.\n *\n * The loader exposes unknown-in/unknown-out signatures; all structural\n * assertions live in this single file so tool code stays clean.\n */\nimport { isOmpSeamsEnabled, loadOmpPureSeams, type OmpPureSeams } from \"./omp-pure-seams.ts\";\n\nexport interface OmpIssue {\n\treadonly field: string;\n\treadonly code: string;\n\treadonly message: string;\n}\n\nexport interface OmpReadPlan {\n\treadonly path: string;\n\treadonly offset: number;\n\treadonly limit: number;\n}\n\nexport type OmpReadPlanResult =\n\t| { readonly ok: true; readonly plan: OmpReadPlan }\n\t| { readonly ok: false; readonly issues: readonly OmpIssue[] };\n\nexport interface OmpReadPresentation {\n\treadonly text: string;\n\treadonly window: {\n\t\treadonly startLine: number;\n\t\treadonly endLine: number;\n\t\treadonly totalLines: number;\n\t\treadonly truncated: boolean;\n\t};\n}\n\nexport type OmpReadPresentResult =\n\t| { readonly ok: true; readonly presentation: OmpReadPresentation }\n\t| { readonly ok: false; readonly conflicts: readonly unknown[] };\n\nexport interface OmpSearchPlan {\n\treadonly pattern: string;\n\treadonly path: string;\n\treadonly glob?: string;\n\treadonly ignoreCase: boolean;\n\treadonly literal: boolean;\n\treadonly context: number;\n\treadonly limit: number;\n}\n\nexport type OmpSearchPlanResult =\n\t| { readonly ok: true; readonly plan: OmpSearchPlan }\n\t| { readonly ok: false; readonly issues: readonly OmpIssue[] };\n\nexport interface OmpSearchHostMatch {\n\treadonly file: string;\n\treadonly line: number;\n\treadonly column?: number;\n\treadonly text: string;\n\treadonly expectedLineHash?: string;\n}\n\nexport interface OmpSearchPresentation {\n\treadonly text: string;\n\treadonly totalMatches: number;\n\treadonly omittedMatches: number;\n\treadonly truncated: boolean;\n}\n\nexport type OmpSearchPresentResult =\n\t| { readonly ok: true; readonly presentation: OmpSearchPresentation }\n\t| { readonly ok: false; readonly conflicts: readonly unknown[] };\n\nlet cached: Promise<OmpPureSeams> | undefined;\n\n/**\n * Returns the memoized seam set unless `OMK_OMP_SEAMS=0`; `undefined` when\n * opted out. Loader errors (VENDOR_NOT_FOUND, INVALID_SEAM) propagate to\n * the caller of the returned promise.\n */\nexport function getOmpSeams(): Promise<OmpPureSeams> | undefined {\n\tif (!isOmpSeamsEnabled()) return undefined;\n\tcached ??= loadOmpPureSeams();\n\treturn cached;\n}\n\nexport function planRead(seams: OmpPureSeams, input: unknown): OmpReadPlanResult {\n\treturn seams.planRead(input) as OmpReadPlanResult;\n}\n\nexport function presentRead(\n\tseams: OmpPureSeams,\n\tplan: OmpReadPlan,\n\tfile: { text: string; sourceDigest?: string; lineDigests?: readonly { line: number; digest: string }[] },\n): OmpReadPresentResult {\n\treturn seams.presentRead(plan, file) as OmpReadPresentResult;\n}\n\nexport function planSearch(seams: OmpPureSeams, input: unknown): OmpSearchPlanResult {\n\treturn seams.planSearch(input) as OmpSearchPlanResult;\n}\n\nexport function presentSearch(\n\tseams: OmpPureSeams,\n\tplan: OmpSearchPlan,\n\tmatches: readonly OmpSearchHostMatch[],\n): OmpSearchPresentResult {\n\treturn seams.presentSearch(plan, matches) as OmpSearchPresentResult;\n}\n\nexport function formatOmpIssues(issues: readonly OmpIssue[]): string {\n\treturn issues.map((issue) => `${issue.field}: ${issue.message}`).join(\"; \");\n}\n"]}
@@ -1,40 +0,0 @@
1
- /**
2
- * Typed runtime facade over the flag-gated OMP pure-seam loader.
3
- *
4
- * Wiring boundary for I2 (ADR-OMP-008/009): the read and grep tools delegate
5
- * request validation and output presentation to the vendored OMP pure seams.
6
- * Enabled by default; `OMK_OMP_SEAMS=0` opts out and tool behavior falls back
7
- * byte-identically to the pre-seam implementation.
8
- *
9
- * The loader exposes unknown-in/unknown-out signatures; all structural
10
- * assertions live in this single file so tool code stays clean.
11
- */
12
- import { isOmpSeamsEnabled, loadOmpPureSeams } from "./omp-pure-seams.js";
13
- let cached;
14
- /**
15
- * Returns the memoized seam set unless `OMK_OMP_SEAMS=0`; `undefined` when
16
- * opted out. Loader errors (VENDOR_NOT_FOUND, INVALID_SEAM) propagate to
17
- * the caller of the returned promise.
18
- */
19
- export function getOmpSeams() {
20
- if (!isOmpSeamsEnabled())
21
- return undefined;
22
- cached ??= loadOmpPureSeams();
23
- return cached;
24
- }
25
- export function planRead(seams, input) {
26
- return seams.planRead(input);
27
- }
28
- export function presentRead(seams, plan, file) {
29
- return seams.presentRead(plan, file);
30
- }
31
- export function planSearch(seams, input) {
32
- return seams.planSearch(input);
33
- }
34
- export function presentSearch(seams, plan, matches) {
35
- return seams.presentSearch(plan, matches);
36
- }
37
- export function formatOmpIssues(issues) {
38
- return issues.map((issue) => `${issue.field}: ${issue.message}`).join("; ");
39
- }
40
- //# sourceMappingURL=omp-seam-runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"omp-seam-runtime.js","sourceRoot":"","sources":["../../../src/core/tools/omp-seam-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAqB,MAAM,qBAAqB,CAAC;AAiE7F,IAAI,MAAyC,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,WAAW,GAAsC;IAChE,IAAI,CAAC,iBAAiB,EAAE;QAAE,OAAO,SAAS,CAAC;IAC3C,MAAM,KAAK,gBAAgB,EAAE,CAAC;IAC9B,OAAO,MAAM,CAAC;AAAA,CACd;AAED,MAAM,UAAU,QAAQ,CAAC,KAAmB,EAAE,KAAc,EAAqB;IAChF,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAsB,CAAC;AAAA,CAClD;AAED,MAAM,UAAU,WAAW,CAC1B,KAAmB,EACnB,IAAiB,EACjB,IAAwG,EACjF;IACvB,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAyB,CAAC;AAAA,CAC7D;AAED,MAAM,UAAU,UAAU,CAAC,KAAmB,EAAE,KAAc,EAAuB;IACpF,OAAO,KAAK,CAAC,UAAU,CAAC,KAAK,CAAwB,CAAC;AAAA,CACtD;AAED,MAAM,UAAU,aAAa,CAC5B,KAAmB,EACnB,IAAmB,EACnB,OAAsC,EACb;IACzB,OAAO,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAA2B,CAAC;AAAA,CACpE;AAED,MAAM,UAAU,eAAe,CAAC,MAA2B,EAAU;IACpE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAAA,CAC5E","sourcesContent":["/**\n * Typed runtime facade over the flag-gated OMP pure-seam loader.\n *\n * Wiring boundary for I2 (ADR-OMP-008/009): the read and grep tools delegate\n * request validation and output presentation to the vendored OMP pure seams.\n * Enabled by default; `OMK_OMP_SEAMS=0` opts out and tool behavior falls back\n * byte-identically to the pre-seam implementation.\n *\n * The loader exposes unknown-in/unknown-out signatures; all structural\n * assertions live in this single file so tool code stays clean.\n */\nimport { isOmpSeamsEnabled, loadOmpPureSeams, type OmpPureSeams } from \"./omp-pure-seams.ts\";\n\nexport interface OmpIssue {\n\treadonly field: string;\n\treadonly code: string;\n\treadonly message: string;\n}\n\nexport interface OmpReadPlan {\n\treadonly path: string;\n\treadonly offset: number;\n\treadonly limit: number;\n}\n\nexport type OmpReadPlanResult =\n\t| { readonly ok: true; readonly plan: OmpReadPlan }\n\t| { readonly ok: false; readonly issues: readonly OmpIssue[] };\n\nexport interface OmpReadPresentation {\n\treadonly text: string;\n\treadonly window: {\n\t\treadonly startLine: number;\n\t\treadonly endLine: number;\n\t\treadonly totalLines: number;\n\t\treadonly truncated: boolean;\n\t};\n}\n\nexport type OmpReadPresentResult =\n\t| { readonly ok: true; readonly presentation: OmpReadPresentation }\n\t| { readonly ok: false; readonly conflicts: readonly unknown[] };\n\nexport interface OmpSearchPlan {\n\treadonly pattern: string;\n\treadonly path: string;\n\treadonly glob?: string;\n\treadonly ignoreCase: boolean;\n\treadonly literal: boolean;\n\treadonly context: number;\n\treadonly limit: number;\n}\n\nexport type OmpSearchPlanResult =\n\t| { readonly ok: true; readonly plan: OmpSearchPlan }\n\t| { readonly ok: false; readonly issues: readonly OmpIssue[] };\n\nexport interface OmpSearchHostMatch {\n\treadonly file: string;\n\treadonly line: number;\n\treadonly column?: number;\n\treadonly text: string;\n\treadonly expectedLineHash?: string;\n}\n\nexport interface OmpSearchPresentation {\n\treadonly text: string;\n\treadonly totalMatches: number;\n\treadonly omittedMatches: number;\n\treadonly truncated: boolean;\n}\n\nexport type OmpSearchPresentResult =\n\t| { readonly ok: true; readonly presentation: OmpSearchPresentation }\n\t| { readonly ok: false; readonly conflicts: readonly unknown[] };\n\nlet cached: Promise<OmpPureSeams> | undefined;\n\n/**\n * Returns the memoized seam set unless `OMK_OMP_SEAMS=0`; `undefined` when\n * opted out. Loader errors (VENDOR_NOT_FOUND, INVALID_SEAM) propagate to\n * the caller of the returned promise.\n */\nexport function getOmpSeams(): Promise<OmpPureSeams> | undefined {\n\tif (!isOmpSeamsEnabled()) return undefined;\n\tcached ??= loadOmpPureSeams();\n\treturn cached;\n}\n\nexport function planRead(seams: OmpPureSeams, input: unknown): OmpReadPlanResult {\n\treturn seams.planRead(input) as OmpReadPlanResult;\n}\n\nexport function presentRead(\n\tseams: OmpPureSeams,\n\tplan: OmpReadPlan,\n\tfile: { text: string; sourceDigest?: string; lineDigests?: readonly { line: number; digest: string }[] },\n): OmpReadPresentResult {\n\treturn seams.presentRead(plan, file) as OmpReadPresentResult;\n}\n\nexport function planSearch(seams: OmpPureSeams, input: unknown): OmpSearchPlanResult {\n\treturn seams.planSearch(input) as OmpSearchPlanResult;\n}\n\nexport function presentSearch(\n\tseams: OmpPureSeams,\n\tplan: OmpSearchPlan,\n\tmatches: readonly OmpSearchHostMatch[],\n): OmpSearchPresentResult {\n\treturn seams.presentSearch(plan, matches) as OmpSearchPresentResult;\n}\n\nexport function formatOmpIssues(issues: readonly OmpIssue[]): string {\n\treturn issues.map((issue) => `${issue.field}: ${issue.message}`).join(\"; \");\n}\n"]}