@oscharko-dev/keiko-contracts 0.2.7 → 0.2.9

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 (108) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/bff-wire.d.ts +86 -19
  3. package/dist/bff-wire.d.ts.map +1 -1
  4. package/dist/command-runner.d.ts +81 -0
  5. package/dist/command-runner.d.ts.map +1 -0
  6. package/dist/command-runner.js +209 -0
  7. package/dist/container-runtime.d.ts +125 -0
  8. package/dist/container-runtime.d.ts.map +1 -0
  9. package/dist/container-runtime.js +287 -0
  10. package/dist/context-engineering.js +2 -2
  11. package/dist/discussion-intelligence.d.ts +70 -0
  12. package/dist/discussion-intelligence.d.ts.map +1 -0
  13. package/dist/discussion-intelligence.js +440 -0
  14. package/dist/editor-agent-governance.d.ts +65 -0
  15. package/dist/editor-agent-governance.d.ts.map +1 -0
  16. package/dist/editor-agent-governance.js +180 -0
  17. package/dist/editor-agent.d.ts +29 -1
  18. package/dist/editor-agent.d.ts.map +1 -1
  19. package/dist/editor-agent.js +183 -6
  20. package/dist/editor-builtin-capabilities.d.ts +13 -0
  21. package/dist/editor-builtin-capabilities.d.ts.map +1 -0
  22. package/dist/editor-builtin-capabilities.js +135 -0
  23. package/dist/editor-language-mode-map.d.ts +11 -0
  24. package/dist/editor-language-mode-map.d.ts.map +1 -0
  25. package/dist/editor-language-mode-map.js +89 -0
  26. package/dist/editor-layout.d.ts +37 -0
  27. package/dist/editor-layout.d.ts.map +1 -1
  28. package/dist/editor-layout.js +125 -8
  29. package/dist/editor-workspace-path.d.ts +20 -0
  30. package/dist/editor-workspace-path.d.ts.map +1 -0
  31. package/dist/editor-workspace-path.js +133 -0
  32. package/dist/evidence.d.ts +3 -1
  33. package/dist/evidence.d.ts.map +1 -1
  34. package/dist/gateway.d.ts +72 -3
  35. package/dist/gateway.d.ts.map +1 -1
  36. package/dist/gateway.js +73 -3
  37. package/dist/git-commit-intent.d.ts +28 -0
  38. package/dist/git-commit-intent.d.ts.map +1 -0
  39. package/dist/git-commit-intent.js +155 -0
  40. package/dist/git-commit-policy.d.ts +29 -0
  41. package/dist/git-commit-policy.d.ts.map +1 -0
  42. package/dist/git-commit-policy.js +173 -0
  43. package/dist/git-delivery-action-sheet.d.ts +157 -0
  44. package/dist/git-delivery-action-sheet.d.ts.map +1 -0
  45. package/dist/git-delivery-action-sheet.js +430 -0
  46. package/dist/git-delivery-evidence.d.ts +92 -0
  47. package/dist/git-delivery-evidence.d.ts.map +1 -0
  48. package/dist/git-delivery-evidence.js +272 -0
  49. package/dist/git-delivery-policy.d.ts +40 -0
  50. package/dist/git-delivery-policy.d.ts.map +1 -0
  51. package/dist/git-delivery-policy.js +183 -0
  52. package/dist/git-delivery-provider.d.ts +53 -0
  53. package/dist/git-delivery-provider.d.ts.map +1 -0
  54. package/dist/git-delivery-provider.js +96 -0
  55. package/dist/git-delivery.d.ts +202 -0
  56. package/dist/git-delivery.d.ts.map +1 -0
  57. package/dist/git-delivery.js +410 -0
  58. package/dist/git-history.d.ts +27 -0
  59. package/dist/git-history.d.ts.map +1 -0
  60. package/dist/git-history.js +73 -0
  61. package/dist/git-merge.d.ts +67 -0
  62. package/dist/git-merge.d.ts.map +1 -0
  63. package/dist/git-merge.js +323 -0
  64. package/dist/git-pull-request.d.ts +112 -0
  65. package/dist/git-pull-request.d.ts.map +1 -0
  66. package/dist/git-pull-request.js +351 -0
  67. package/dist/git-repository-agent.d.ts +46 -0
  68. package/dist/git-repository-agent.d.ts.map +1 -0
  69. package/dist/git-repository-agent.js +198 -0
  70. package/dist/git-repository-summary.d.ts +54 -0
  71. package/dist/git-repository-summary.d.ts.map +1 -0
  72. package/dist/git-repository-summary.js +105 -0
  73. package/dist/git-repository.d.ts +60 -0
  74. package/dist/git-repository.d.ts.map +1 -0
  75. package/dist/git-repository.js +106 -0
  76. package/dist/git-sync.d.ts +49 -0
  77. package/dist/git-sync.d.ts.map +1 -0
  78. package/dist/git-sync.js +110 -0
  79. package/dist/index.d.ts +63 -9
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +33 -6
  82. package/dist/lsp-process.d.ts +38 -0
  83. package/dist/lsp-process.d.ts.map +1 -0
  84. package/dist/lsp-process.js +103 -0
  85. package/dist/prompt-enhancer-analyzer.d.ts.map +1 -1
  86. package/dist/prompt-enhancer-analyzer.js +198 -22
  87. package/dist/runtime-capabilities.d.ts +44 -0
  88. package/dist/runtime-capabilities.d.ts.map +1 -0
  89. package/dist/runtime-capabilities.js +141 -0
  90. package/dist/task-workspace.d.ts +302 -0
  91. package/dist/task-workspace.d.ts.map +1 -0
  92. package/dist/task-workspace.js +1236 -0
  93. package/dist/voice-action-intent.d.ts +86 -0
  94. package/dist/voice-action-intent.d.ts.map +1 -0
  95. package/dist/voice-action-intent.js +387 -0
  96. package/dist/voice-playback.d.ts +50 -0
  97. package/dist/voice-playback.d.ts.map +1 -0
  98. package/dist/voice-playback.js +240 -0
  99. package/dist/voice-protocol.d.ts +165 -0
  100. package/dist/voice-protocol.d.ts.map +1 -0
  101. package/dist/voice-protocol.js +312 -0
  102. package/dist/voice-transcript.d.ts +57 -0
  103. package/dist/voice-transcript.d.ts.map +1 -0
  104. package/dist/voice-transcript.js +221 -0
  105. package/package.json +5 -1
  106. package/dist/conversation-budget.d.ts +0 -37
  107. package/dist/conversation-budget.d.ts.map +0 -1
  108. package/dist/conversation-budget.js +0 -97
@@ -10,6 +10,13 @@
10
10
  // Leaf-package rule (ADR-0019 direction 1): no `@oscharko-dev/keiko-*` imports. The module reuses the
11
11
  // same-package `normalizePromptDraft` (which composes `stripUnsafeFormatChars`) for input hardening.
12
12
  import { PROMPT_ENHANCER_SCHEMA_VERSION, PROMPT_MISSING_CONTEXT_MAX_CHARS, isSafetyCriticalDomain, normalizePromptDraft, } from "./prompt-enhancer.js";
13
+ function foldForSearch(text) {
14
+ return text
15
+ .toLowerCase()
16
+ .normalize("NFKD")
17
+ .replace(/[\u0300-\u036f]/gu, "")
18
+ .replace(/ß/gu, "ss");
19
+ }
13
20
  const STOP_WORDS = new Set([
14
21
  "the",
15
22
  "a",
@@ -38,6 +45,36 @@ const STOP_WORDS = new Set([
38
45
  "how",
39
46
  "what",
40
47
  "why",
48
+ "der",
49
+ "die",
50
+ "das",
51
+ "den",
52
+ "dem",
53
+ "ein",
54
+ "eine",
55
+ "einen",
56
+ "und",
57
+ "oder",
58
+ "aber",
59
+ "zu",
60
+ "zum",
61
+ "zur",
62
+ "von",
63
+ "im",
64
+ "fur",
65
+ "mit",
66
+ "ist",
67
+ "sind",
68
+ "bitte",
69
+ "kannst",
70
+ "du",
71
+ "mir",
72
+ "mein",
73
+ "meine",
74
+ "ich",
75
+ "wie",
76
+ "was",
77
+ "warum",
41
78
  ]);
42
79
  function countMeaningfulTokens(lower) {
43
80
  const tokens = lower.split(/[^\p{L}\p{N}]+/u).filter((t) => t.length > 0);
@@ -49,7 +86,7 @@ function countMeaningfulTokens(lower) {
49
86
  return count;
50
87
  }
51
88
  function buildView(normalized, request) {
52
- const lower = normalized.toLowerCase();
89
+ const lower = foldForSearch(normalized);
53
90
  return {
54
91
  normalizedLength: normalized.length,
55
92
  lower,
@@ -75,8 +112,13 @@ const TASK_CLASS_RULES = [
75
112
  "rewrite the prompt",
76
113
  "meta-prompt",
77
114
  "system prompt for",
115
+ "verbessere diesen prompt",
116
+ "optimiere den prompt",
117
+ "schreibe einen prompt",
118
+ "prompt fur",
119
+ "prompt fuer",
78
120
  ],
79
- weak: ["prompt engineering", "better prompt", "prompt template"],
121
+ weak: ["prompt engineering", "better prompt", "prompt template", "promptvorlage"],
80
122
  },
81
123
  {
82
124
  taskClass: "code-debugging",
@@ -87,13 +129,36 @@ const TASK_CLASS_RULES = [
87
129
  "traceback",
88
130
  "why does this fail",
89
131
  "not working",
132
+ "fehler beheben",
133
+ "bug beheben",
134
+ "warum schlagt",
135
+ "funktioniert nicht",
90
136
  ],
91
- weak: ["error", "exception", "throws", "undefined is not", "segfault"],
137
+ weak: ["error", "exception", "throws", "undefined is not", "segfault", "fehler", "stacktrace"],
92
138
  },
93
139
  {
94
140
  taskClass: "code-architecture",
95
- strong: ["system design", "design the system", "software architecture", "architecture for"],
96
- weak: ["scalable", "microservice", "design pattern", "trade-offs between", "high-level design"],
141
+ strong: [
142
+ "system design",
143
+ "design the system",
144
+ "software architecture",
145
+ "architecture for",
146
+ "softwarearchitektur",
147
+ "architektur fur",
148
+ "systemdesign",
149
+ "migration strategy",
150
+ "sql migration strategy",
151
+ "migrationsstrategie",
152
+ ],
153
+ weak: [
154
+ "scalable",
155
+ "microservice",
156
+ "design pattern",
157
+ "trade-offs between",
158
+ "high-level design",
159
+ "skalierbar",
160
+ "migration",
161
+ ],
97
162
  },
98
163
  {
99
164
  taskClass: "code-generation",
@@ -104,6 +169,11 @@ const TASK_CLASS_RULES = [
104
169
  "generate code",
105
170
  "write a script",
106
171
  "create a class",
172
+ "schreibe code",
173
+ "implementiere",
174
+ "erstelle eine funktion",
175
+ "baue eine api",
176
+ "schreibe ein neues paket",
107
177
  ],
108
178
  weak: [
109
179
  "function that",
@@ -117,17 +187,23 @@ const TASK_CLASS_RULES = [
117
187
  "build an api",
118
188
  "refactor",
119
189
  "snippet",
190
+ "funktion",
191
+ "klasse",
192
+ "skript",
193
+ "paket",
194
+ "code-review",
195
+ "code review",
120
196
  ],
121
197
  },
122
198
  {
123
199
  taskClass: "structured-extraction",
124
200
  strong: ["extract the", "parse the", "pull out the", "extract fields", "into json"],
125
- weak: ["extract", "parse", "list all the", "structured output"],
201
+ weak: ["extract", "parse", "list all the", "structured output", "extrahiere", "parse"],
126
202
  },
127
203
  {
128
204
  taskClass: "summarization",
129
- strong: ["summarize", "tl;dr", "tldr", "give me a summary", "condense"],
130
- weak: ["summary", "key points", "in brief", "abstract of"],
205
+ strong: ["summarize", "tl;dr", "tldr", "give me a summary", "condense", "fasse zusammen"],
206
+ weak: ["summary", "key points", "in brief", "abstract of", "zusammenfassung", "kurzfassung"],
131
207
  },
132
208
  {
133
209
  taskClass: "data-analysis",
@@ -136,8 +212,10 @@ const TASK_CLASS_RULES = [
136
212
  "analyze the dataset",
137
213
  "statistical analysis",
138
214
  "correlation between",
215
+ "analysiere die daten",
216
+ "werte den datensatz aus",
139
217
  ],
140
- weak: ["dataset", "regression", "aggregate", "pivot", "trend", "metrics"],
218
+ weak: ["dataset", "regression", "aggregate", "pivot", "trend", "metrics", "datensatz"],
141
219
  },
142
220
  {
143
221
  taskClass: "rag-question-answering",
@@ -147,8 +225,11 @@ const TASK_CLASS_RULES = [
147
225
  "from the attached",
148
226
  "using the document",
149
227
  "in the provided text",
228
+ "basierend auf der datei",
229
+ "aus der angehangten",
230
+ "aus dem dokument",
150
231
  ],
151
- weak: ["from these files", "from the context", "in the attached"],
232
+ weak: ["from these files", "from the context", "in the attached", "aus diesen dateien"],
152
233
  },
153
234
  {
154
235
  taskClass: "research",
@@ -158,8 +239,11 @@ const TASK_CLASS_RULES = [
158
239
  "literature review",
159
240
  "state of the art",
160
241
  "survey of",
242
+ "recherchiere",
243
+ "umfassender uberblick",
244
+ "stand der technik",
161
245
  ],
162
- weak: ["research", "investigate", "background on", "explore the topic"],
246
+ weak: ["research", "investigate", "background on", "explore the topic", "untersuche"],
163
247
  },
164
248
  {
165
249
  taskClass: "creative-writing",
@@ -170,22 +254,69 @@ const TASK_CLASS_RULES = [
170
254
  "write lyrics",
171
255
  "screenplay",
172
256
  "short story",
257
+ "schreibe eine geschichte",
258
+ "schreibe ein gedicht",
173
259
  ],
174
- weak: ["poem", "fiction", "creative", "imagine a", "tale"],
260
+ weak: ["poem", "fiction", "creative", "imagine a", "tale", "geschichte", "gedicht", "roman"],
175
261
  },
176
262
  {
177
263
  taskClass: "writing-editing",
178
- strong: ["write an email", "draft a", "proofread", "rewrite this", "rephrase"],
179
- weak: ["edit", "improve this text", "make this clearer", "polish", "tone"],
264
+ strong: [
265
+ "write an email",
266
+ "draft a",
267
+ "proofread",
268
+ "rewrite this",
269
+ "rephrase",
270
+ "schreibe einen brief",
271
+ "schreibe eine email",
272
+ "formuliere",
273
+ "kundigungsbrief",
274
+ "kuendigungsbrief",
275
+ "kundigungsschreiben",
276
+ "kuendigungsschreiben",
277
+ ],
278
+ weak: ["edit", "improve this text", "make this clearer", "polish", "tone", "brief", "email"],
180
279
  },
181
280
  {
182
281
  taskClass: "decision-support",
183
- strong: ["should i", "pros and cons", "help me decide", "which is better", "compare options"],
184
- weak: ["recommend", "trade-offs", "decision", "evaluate options"],
282
+ strong: [
283
+ "should i",
284
+ "pros and cons",
285
+ "help me decide",
286
+ "which is better",
287
+ "compare options",
288
+ "soll ich",
289
+ "vor- und nachteile",
290
+ "hilf mir entscheiden",
291
+ "plan a trip",
292
+ "plane eine reise",
293
+ "plane einen urlaub",
294
+ ],
295
+ weak: [
296
+ "recommend",
297
+ "trade-offs",
298
+ "decision",
299
+ "evaluate options",
300
+ "empfehlung",
301
+ "vergleiche",
302
+ "reise",
303
+ "urlaub",
304
+ "itinerary",
305
+ "reiseplanung",
306
+ ],
185
307
  },
186
308
  {
187
309
  taskClass: "agentic-tool-use",
188
- strong: ["use the tool", "call the api", "automate", "take actions", "as an agent"],
310
+ strong: [
311
+ "use the tool",
312
+ "call the api",
313
+ "automate",
314
+ "take actions",
315
+ "as an agent",
316
+ "automatisiere",
317
+ "nutze das tool",
318
+ "ruf die api",
319
+ ],
189
320
  weak: ["execute", "browse", "fetch and", "step by step using tools", "orchestrate"],
190
321
  },
191
322
  ];
@@ -228,6 +359,11 @@ const DOMAIN_RULES = [
228
359
  "regulation",
229
360
  "copyright",
230
361
  "patent",
362
+ "vertrag",
363
+ "kundigung",
364
+ "kuendigung",
365
+ "recht",
366
+ "anwalt",
231
367
  ],
232
368
  },
233
369
  {
@@ -272,6 +408,8 @@ const DOMAIN_RULES = [
272
408
  "authentication",
273
409
  "encryption",
274
410
  "secrets management",
411
+ "authentifizierung",
412
+ "verschlusselung",
275
413
  ],
276
414
  },
277
415
  {
@@ -291,13 +429,27 @@ const DOMAIN_RULES = [
291
429
  },
292
430
  {
293
431
  domain: "business",
294
- keywords: ["marketing", "sales", "revenue", "business plan", "startup", "customer", "kpi"],
432
+ keywords: [
433
+ "marketing",
434
+ "sales",
435
+ "revenue",
436
+ "business plan",
437
+ "startup",
438
+ "customer",
439
+ "kpi",
440
+ "kunde",
441
+ "kunden",
442
+ "strategie",
443
+ ],
295
444
  },
296
445
  {
297
446
  domain: "education",
298
- keywords: ["teach", "lesson", "homework", "student", "tutorial", "curriculum"],
447
+ keywords: ["teach", "lesson", "homework", "student", "tutorial", "curriculum", "lerne"],
448
+ },
449
+ {
450
+ domain: "creative",
451
+ keywords: ["poem", "story", "novel", "song", "fiction", "screenplay", "geschichte", "gedicht"],
299
452
  },
300
- { domain: "creative", keywords: ["poem", "story", "novel", "song", "fiction", "screenplay"] },
301
453
  {
302
454
  domain: "software",
303
455
  keywords: [
@@ -311,6 +463,19 @@ const DOMAIN_RULES = [
311
463
  "compile",
312
464
  "react",
313
465
  "algorithm",
466
+ "code-review",
467
+ "code review",
468
+ "repository",
469
+ "repo",
470
+ "paket",
471
+ "npm",
472
+ "sql",
473
+ "datenbank",
474
+ "migration",
475
+ "migrationsstrategie",
476
+ "kundendaten",
477
+ "typescript",
478
+ "optimierung",
314
479
  ],
315
480
  },
316
481
  ];
@@ -524,12 +689,23 @@ const OUTPUT_HINT_RULES = [
524
689
  { hint: "explicit-json", format: "json", keywords: ["json", "as json", "in json"] },
525
690
  { hint: "explicit-yaml", format: "yaml", keywords: ["yaml"] },
526
691
  { hint: "explicit-csv", format: "csv", keywords: ["csv", "comma-separated"] },
527
- { hint: "explicit-table", format: "table", keywords: ["as a table", "in a table", "tabular"] },
692
+ {
693
+ hint: "explicit-table",
694
+ format: "table",
695
+ keywords: ["as a table", "in a table", "tabular", "als tabelle", "tabelle"],
696
+ },
528
697
  { hint: "explicit-code", format: "code", keywords: ["code block", "a snippet", "as code"] },
529
698
  {
530
699
  hint: "explicit-list",
531
700
  format: "list",
532
- keywords: ["bullet points", "bulleted list", "numbered list", "as a list"],
701
+ keywords: [
702
+ "bullet points",
703
+ "bulleted list",
704
+ "numbered list",
705
+ "as a list",
706
+ "stichpunkte",
707
+ "als liste",
708
+ ],
533
709
  },
534
710
  { hint: "explicit-markdown", format: "markdown", keywords: ["in markdown", "as markdown"] },
535
711
  ];
@@ -0,0 +1,44 @@
1
+ export declare const RUNTIME_CAPABILITY_SCHEMA_VERSION: "1";
2
+ export type RuntimeCapabilityKind = "git" | "node" | "package-manager" | "language-toolchain" | "container-engine" | "command-source";
3
+ export type RuntimeCapabilityState = "available" | "missing" | "unsupported" | "permission-denied" | "not-running" | "policy-blocked";
4
+ export type RuntimeCapabilityUnavailableReason = "executable-not-found" | "executable-not-runnable" | "unsupported-version" | "daemon-not-running" | "policy-blocked" | "unsafe-path" | "manifest-not-found" | "script-not-defined" | "probe-timed-out" | "probe-failed";
5
+ export type RuntimeCommandKind = "test" | "build" | "lint" | "typecheck";
6
+ export type RuntimeCommandSourceType = "package-json-script" | "ecosystem-manifest" | "lockfile";
7
+ export interface RuntimeCommandSource {
8
+ readonly type: RuntimeCommandSourceType;
9
+ readonly path: string;
10
+ readonly commandKind?: RuntimeCommandKind | undefined;
11
+ readonly scriptName?: string | undefined;
12
+ readonly packageManager?: string | undefined;
13
+ }
14
+ export interface RuntimeCapability {
15
+ readonly id: string;
16
+ readonly kind: RuntimeCapabilityKind;
17
+ readonly label: string;
18
+ readonly state: RuntimeCapabilityState;
19
+ readonly version?: string | undefined;
20
+ readonly unavailableReason?: RuntimeCapabilityUnavailableReason | undefined;
21
+ readonly remediationHint?: string | undefined;
22
+ readonly source?: RuntimeCommandSource | undefined;
23
+ }
24
+ export interface RuntimeCapabilitiesResponse {
25
+ readonly schemaVersion: typeof RUNTIME_CAPABILITY_SCHEMA_VERSION;
26
+ readonly generatedAtMs: number;
27
+ readonly deadlineMs: number;
28
+ readonly capabilities: readonly RuntimeCapability[];
29
+ }
30
+ export interface RuntimeCapabilitiesParseOk {
31
+ readonly ok: true;
32
+ readonly value: RuntimeCapabilitiesResponse;
33
+ }
34
+ export interface RuntimeCapabilitiesParseFail {
35
+ readonly ok: false;
36
+ readonly errors: readonly string[];
37
+ }
38
+ export type RuntimeCapabilitiesParse = RuntimeCapabilitiesParseOk | RuntimeCapabilitiesParseFail;
39
+ export declare const RUNTIME_CAPABILITY_KINDS: readonly RuntimeCapabilityKind[];
40
+ export declare const RUNTIME_CAPABILITY_STATES: readonly RuntimeCapabilityState[];
41
+ export declare const RUNTIME_CAPABILITY_UNAVAILABLE_REASONS: readonly RuntimeCapabilityUnavailableReason[];
42
+ export declare const RUNTIME_COMMAND_KINDS: readonly RuntimeCommandKind[];
43
+ export declare function validateRuntimeCapabilitiesResponse(value: unknown): RuntimeCapabilitiesParse;
44
+ //# sourceMappingURL=runtime-capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-capabilities.d.ts","sourceRoot":"","sources":["../src/runtime-capabilities.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iCAAiC,EAAG,GAAY,CAAC;AAE9D,MAAM,MAAM,qBAAqB,GAC7B,KAAK,GACL,MAAM,GACN,iBAAiB,GACjB,oBAAoB,GACpB,kBAAkB,GAClB,gBAAgB,CAAC;AAErB,MAAM,MAAM,sBAAsB,GAC9B,WAAW,GACX,SAAS,GACT,aAAa,GACb,mBAAmB,GACnB,aAAa,GACb,gBAAgB,CAAC;AAErB,MAAM,MAAM,kCAAkC,GAC1C,sBAAsB,GACtB,yBAAyB,GACzB,qBAAqB,GACrB,oBAAoB,GACpB,gBAAgB,GAChB,aAAa,GACb,oBAAoB,GACpB,oBAAoB,GACpB,iBAAiB,GACjB,cAAc,CAAC;AAEnB,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC;AAEzE,MAAM,MAAM,wBAAwB,GAAG,qBAAqB,GAAG,oBAAoB,GAAG,UAAU,CAAC;AAEjG,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACtD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9C;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,kCAAkC,GAAG,SAAS,CAAC;IAC5E,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;CACpD;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,aAAa,EAAE,OAAO,iCAAiC,CAAC;IACjE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACrD;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,KAAK,EAAE,2BAA2B,CAAC;CAC7C;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED,MAAM,MAAM,wBAAwB,GAAG,0BAA0B,GAAG,4BAA4B,CAAC;AAEjG,eAAO,MAAM,wBAAwB,EAAE,SAAS,qBAAqB,EAOf,CAAC;AAEvD,eAAO,MAAM,yBAAyB,EAAE,SAAS,sBAAsB,EAOhB,CAAC;AAExD,eAAO,MAAM,sCAAsC,EAAE,SAAS,kCAAkC,EAY3B,CAAC;AAEtE,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EAKZ,CAAC;AAsHpD,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CAW5F"}
@@ -0,0 +1,141 @@
1
+ // Local runtime capability contracts (Issue #1385, Epic #1491). This leaf module owns the
2
+ // wire-stable vocabulary for host tool/runtime detection only. It is intentionally pure: no IO,
3
+ // no process execution, no clock, no randomness, and no imports from sibling packages.
4
+ export const RUNTIME_CAPABILITY_SCHEMA_VERSION = "1";
5
+ export const RUNTIME_CAPABILITY_KINDS = Object.freeze([
6
+ "git",
7
+ "node",
8
+ "package-manager",
9
+ "language-toolchain",
10
+ "container-engine",
11
+ "command-source",
12
+ ]);
13
+ export const RUNTIME_CAPABILITY_STATES = Object.freeze([
14
+ "available",
15
+ "missing",
16
+ "unsupported",
17
+ "permission-denied",
18
+ "not-running",
19
+ "policy-blocked",
20
+ ]);
21
+ export const RUNTIME_CAPABILITY_UNAVAILABLE_REASONS = Object.freeze([
22
+ "executable-not-found",
23
+ "executable-not-runnable",
24
+ "unsupported-version",
25
+ "daemon-not-running",
26
+ "policy-blocked",
27
+ "unsafe-path",
28
+ "manifest-not-found",
29
+ "script-not-defined",
30
+ "probe-timed-out",
31
+ "probe-failed",
32
+ ]);
33
+ export const RUNTIME_COMMAND_KINDS = Object.freeze([
34
+ "test",
35
+ "build",
36
+ "lint",
37
+ "typecheck",
38
+ ]);
39
+ function isRecord(value) {
40
+ return typeof value === "object" && value !== null && !Array.isArray(value);
41
+ }
42
+ function isOneOf(value, allowed) {
43
+ return typeof value === "string" && allowed.includes(value);
44
+ }
45
+ function validateStringField(record, key, errors, optional = false, label = key) {
46
+ const value = record[key];
47
+ if (value === undefined && optional)
48
+ return;
49
+ if (typeof value !== "string" || value.length === 0) {
50
+ errors.push(`${label} must be a non-empty string`);
51
+ }
52
+ }
53
+ function validateCommandSource(value, path, errors) {
54
+ if (!isRecord(value)) {
55
+ errors.push(`${path} must be an object`);
56
+ return;
57
+ }
58
+ if (!isOneOf(value.type, ["package-json-script", "ecosystem-manifest", "lockfile"])) {
59
+ errors.push(`${path}.type is invalid`);
60
+ }
61
+ validateStringField(value, "path", errors, false, `${path}.path`);
62
+ if (value.commandKind !== undefined && !isOneOf(value.commandKind, RUNTIME_COMMAND_KINDS)) {
63
+ errors.push(`${path}.commandKind is invalid`);
64
+ }
65
+ if (value.scriptName !== undefined && typeof value.scriptName !== "string") {
66
+ errors.push(`${path}.scriptName must be a string`);
67
+ }
68
+ if (value.packageManager !== undefined && typeof value.packageManager !== "string") {
69
+ errors.push(`${path}.packageManager must be a string`);
70
+ }
71
+ }
72
+ function validateCapabilityRequiredFields(value, path, errors) {
73
+ validateStringField(value, "id", errors);
74
+ validateStringField(value, "label", errors);
75
+ if (!isOneOf(value.kind, RUNTIME_CAPABILITY_KINDS)) {
76
+ errors.push(`${path}.kind is invalid`);
77
+ }
78
+ if (!isOneOf(value.state, RUNTIME_CAPABILITY_STATES)) {
79
+ errors.push(`${path}.state is invalid`);
80
+ }
81
+ }
82
+ function validateCapabilityOptionalFields(value, path, errors) {
83
+ if (value.version !== undefined && typeof value.version !== "string") {
84
+ errors.push(`${path}.version must be a string`);
85
+ }
86
+ if (value.unavailableReason !== undefined &&
87
+ !isOneOf(value.unavailableReason, RUNTIME_CAPABILITY_UNAVAILABLE_REASONS)) {
88
+ errors.push(`${path}.unavailableReason is invalid`);
89
+ }
90
+ if (value.remediationHint !== undefined && typeof value.remediationHint !== "string") {
91
+ errors.push(`${path}.remediationHint must be a string`);
92
+ }
93
+ if (value.source !== undefined) {
94
+ validateCommandSource(value.source, `${path}.source`, errors);
95
+ }
96
+ }
97
+ function validateCapability(value, index, errors) {
98
+ const path = `capabilities[${String(index)}]`;
99
+ if (!isRecord(value)) {
100
+ errors.push(`${path} must be an object`);
101
+ return;
102
+ }
103
+ validateCapabilityRequiredFields(value, path, errors);
104
+ validateCapabilityOptionalFields(value, path, errors);
105
+ }
106
+ function validateResponseScalars(value, errors) {
107
+ if (value.schemaVersion !== RUNTIME_CAPABILITY_SCHEMA_VERSION)
108
+ errors.push("schemaVersion is invalid");
109
+ const generatedAtMs = value.generatedAtMs;
110
+ if (typeof generatedAtMs !== "number" ||
111
+ !Number.isSafeInteger(generatedAtMs) ||
112
+ generatedAtMs < 0) {
113
+ errors.push("generatedAtMs must be a non-negative safe integer");
114
+ }
115
+ const deadlineMs = value.deadlineMs;
116
+ if (typeof deadlineMs !== "number" || !Number.isSafeInteger(deadlineMs) || deadlineMs < 1) {
117
+ errors.push("deadlineMs must be a positive safe integer");
118
+ }
119
+ }
120
+ function validateCapabilitiesArray(value, errors) {
121
+ if (!Array.isArray(value.capabilities)) {
122
+ errors.push("capabilities must be an array");
123
+ }
124
+ else {
125
+ value.capabilities.forEach((entry, index) => {
126
+ validateCapability(entry, index, errors);
127
+ });
128
+ }
129
+ }
130
+ export function validateRuntimeCapabilitiesResponse(value) {
131
+ const errors = [];
132
+ if (!isRecord(value)) {
133
+ return { ok: false, errors: ["response must be an object"] };
134
+ }
135
+ validateResponseScalars(value, errors);
136
+ validateCapabilitiesArray(value, errors);
137
+ if (errors.length > 0) {
138
+ return { ok: false, errors };
139
+ }
140
+ return { ok: true, value: value };
141
+ }