open-multi-agent-kit 0.98.5 → 0.99.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 (163) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +3 -2
  3. package/dist/cli/help.d.ts.map +1 -1
  4. package/dist/cli/help.js +1 -0
  5. package/dist/cli/help.js.map +1 -1
  6. package/dist/commands/verified-run-cli.d.ts.map +1 -1
  7. package/dist/commands/verified-run-cli.js +2 -2
  8. package/dist/commands/verified-run-cli.js.map +1 -1
  9. package/dist/core/agent-session.d.ts.map +1 -1
  10. package/dist/core/agent-session.js +19 -2
  11. package/dist/core/agent-session.js.map +1 -1
  12. package/dist/core/devin-harness-dispatch.d.ts +12 -0
  13. package/dist/core/devin-harness-dispatch.d.ts.map +1 -0
  14. package/dist/core/devin-harness-dispatch.js +12 -0
  15. package/dist/core/devin-harness-dispatch.js.map +1 -0
  16. package/dist/core/devin-harness.d.ts +53 -0
  17. package/dist/core/devin-harness.d.ts.map +1 -0
  18. package/dist/core/devin-harness.js +112 -0
  19. package/dist/core/devin-harness.js.map +1 -0
  20. package/dist/core/domain-dispatch.d.ts +4 -1
  21. package/dist/core/domain-dispatch.d.ts.map +1 -1
  22. package/dist/core/domain-dispatch.js +5 -0
  23. package/dist/core/domain-dispatch.js.map +1 -1
  24. package/dist/core/domain-loadouts-provider-harness.d.ts +12 -0
  25. package/dist/core/domain-loadouts-provider-harness.d.ts.map +1 -0
  26. package/dist/core/domain-loadouts-provider-harness.js +122 -0
  27. package/dist/core/domain-loadouts-provider-harness.js.map +1 -0
  28. package/dist/core/domain-loadouts.d.ts +2 -33
  29. package/dist/core/domain-loadouts.d.ts.map +1 -1
  30. package/dist/core/domain-loadouts.js +3 -56
  31. package/dist/core/domain-loadouts.js.map +1 -1
  32. package/dist/core/domain-profile.d.ts +40 -0
  33. package/dist/core/domain-profile.d.ts.map +1 -0
  34. package/dist/core/domain-profile.js +7 -0
  35. package/dist/core/domain-profile.js.map +1 -0
  36. package/dist/core/grok-harness-dispatch.d.ts +6 -20
  37. package/dist/core/grok-harness-dispatch.d.ts.map +1 -1
  38. package/dist/core/grok-harness-dispatch.js +6 -55
  39. package/dist/core/grok-harness-dispatch.js.map +1 -1
  40. package/dist/core/grok-harness.d.ts +7 -9
  41. package/dist/core/grok-harness.d.ts.map +1 -1
  42. package/dist/core/grok-harness.js +9 -23
  43. package/dist/core/grok-harness.js.map +1 -1
  44. package/dist/core/harness-skills.d.ts +20 -0
  45. package/dist/core/harness-skills.d.ts.map +1 -0
  46. package/dist/core/harness-skills.js +36 -0
  47. package/dist/core/harness-skills.js.map +1 -0
  48. package/dist/core/loadout-runtime-state.d.ts +25 -0
  49. package/dist/core/loadout-runtime-state.d.ts.map +1 -0
  50. package/dist/core/loadout-runtime-state.js +39 -0
  51. package/dist/core/loadout-runtime-state.js.map +1 -0
  52. package/dist/core/loadout-runtime.d.ts +2 -12
  53. package/dist/core/loadout-runtime.d.ts.map +1 -1
  54. package/dist/core/loadout-runtime.js +6 -13
  55. package/dist/core/loadout-runtime.js.map +1 -1
  56. package/dist/core/model-resolver.d.ts +1 -41
  57. package/dist/core/model-resolver.d.ts.map +1 -1
  58. package/dist/core/model-resolver.js +2 -49
  59. package/dist/core/model-resolver.js.map +1 -1
  60. package/dist/core/provider-default-models.d.ts +42 -0
  61. package/dist/core/provider-default-models.d.ts.map +1 -0
  62. package/dist/core/provider-default-models.js +50 -0
  63. package/dist/core/provider-default-models.js.map +1 -0
  64. package/dist/core/provider-display-names.d.ts.map +1 -1
  65. package/dist/core/provider-display-names.js +1 -0
  66. package/dist/core/provider-display-names.js.map +1 -1
  67. package/dist/core/provider-harness-dispatch.d.ts +63 -0
  68. package/dist/core/provider-harness-dispatch.d.ts.map +1 -0
  69. package/dist/core/provider-harness-dispatch.js +60 -0
  70. package/dist/core/provider-harness-dispatch.js.map +1 -0
  71. package/dist/core/provider-usage-devin.d.ts +16 -0
  72. package/dist/core/provider-usage-devin.d.ts.map +1 -0
  73. package/dist/core/provider-usage-devin.js +61 -0
  74. package/dist/core/provider-usage-devin.js.map +1 -0
  75. package/dist/core/provider-usage-text.d.ts +5 -0
  76. package/dist/core/provider-usage-text.d.ts.map +1 -0
  77. package/dist/core/provider-usage-text.js +15 -0
  78. package/dist/core/provider-usage-text.js.map +1 -0
  79. package/dist/core/provider-usage-types.d.ts +2 -1
  80. package/dist/core/provider-usage-types.d.ts.map +1 -1
  81. package/dist/core/provider-usage-types.js.map +1 -1
  82. package/dist/core/provider-usage.d.ts +1 -2
  83. package/dist/core/provider-usage.d.ts.map +1 -1
  84. package/dist/core/provider-usage.js +12 -7
  85. package/dist/core/provider-usage.js.map +1 -1
  86. package/dist/core/run-execution-api.d.ts +1 -1
  87. package/dist/core/run-execution-api.d.ts.map +1 -1
  88. package/dist/core/run-execution-api.js.map +1 -1
  89. package/dist/core/sdk.d.ts.map +1 -1
  90. package/dist/core/sdk.js +23 -18
  91. package/dist/core/sdk.js.map +1 -1
  92. package/dist/core/verified-run/dag-phase.d.ts +1 -1
  93. package/dist/core/verified-run/dag-phase.d.ts.map +1 -1
  94. package/dist/core/verified-run/dag-phase.js +46 -8
  95. package/dist/core/verified-run/dag-phase.js.map +1 -1
  96. package/dist/core/verified-run/dag-projection.d.ts.map +1 -1
  97. package/dist/core/verified-run/dag-projection.js +25 -12
  98. package/dist/core/verified-run/dag-projection.js.map +1 -1
  99. package/dist/core/verified-run/dag-types.d.ts +11 -0
  100. package/dist/core/verified-run/dag-types.d.ts.map +1 -1
  101. package/dist/core/verified-run/dag-types.js.map +1 -1
  102. package/dist/core/verified-run/event-parser.d.ts.map +1 -1
  103. package/dist/core/verified-run/event-parser.js +1 -0
  104. package/dist/core/verified-run/event-parser.js.map +1 -1
  105. package/dist/core/verified-run/owned-execution.d.ts +1 -0
  106. package/dist/core/verified-run/owned-execution.d.ts.map +1 -1
  107. package/dist/core/verified-run/owned-execution.js +7 -1
  108. package/dist/core/verified-run/owned-execution.js.map +1 -1
  109. package/dist/core/verified-run/process-projection.d.ts +13 -0
  110. package/dist/core/verified-run/process-projection.d.ts.map +1 -0
  111. package/dist/core/verified-run/process-projection.js +82 -0
  112. package/dist/core/verified-run/process-projection.js.map +1 -0
  113. package/dist/core/verified-run/projection.d.ts.map +1 -1
  114. package/dist/core/verified-run/projection.js +11 -55
  115. package/dist/core/verified-run/projection.js.map +1 -1
  116. package/dist/core/verified-run/run-types.d.ts +1 -0
  117. package/dist/core/verified-run/run-types.d.ts.map +1 -1
  118. package/dist/core/verified-run/run-types.js.map +1 -1
  119. package/dist/core/verified-run/task-execution.d.ts +9 -0
  120. package/dist/core/verified-run/task-execution.d.ts.map +1 -0
  121. package/dist/core/verified-run/task-execution.js +29 -0
  122. package/dist/core/verified-run/task-execution.js.map +1 -0
  123. package/dist/core/verified-run/writer-projection.d.ts.map +1 -1
  124. package/dist/core/verified-run/writer-projection.js +6 -5
  125. package/dist/core/verified-run/writer-projection.js.map +1 -1
  126. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  127. package/dist/modes/interactive/interactive-mode.js +2 -5
  128. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  129. package/dist/modes/interactive/resource-description.d.ts +3 -0
  130. package/dist/modes/interactive/resource-description.d.ts.map +1 -0
  131. package/dist/modes/interactive/resource-description.js +15 -0
  132. package/dist/modes/interactive/resource-description.js.map +1 -0
  133. package/docs/devin-harness.md +121 -0
  134. package/docs/docs.json +4 -0
  135. package/docs/environment-variables.md +2 -1
  136. package/docs/index.md +1 -0
  137. package/docs/loadout-domains/README.md +2 -1
  138. package/docs/loadout-domains/devin-harness.md +72 -0
  139. package/docs/metrics.md +57 -16
  140. package/docs/providers.md +76 -0
  141. package/docs/release-audit-0.98.5.md +17 -0
  142. package/docs/release-audit-0.99.0.md +68 -0
  143. package/docs/run-protocol.md +4 -3
  144. package/docs/runtime-algorithms.md +4 -1
  145. package/docs/sdk.md +9 -5
  146. package/docs/settings.md +1 -1
  147. package/docs/startup-resource-labels-testing.md +47 -0
  148. package/docs/tb21-audit.md +18 -4
  149. package/docs/usage.md +5 -0
  150. package/docs/verified-run-remaining-design.md +881 -0
  151. package/docs/verified-run-testing.md +91 -0
  152. package/docs/verified-run.md +30 -9
  153. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  154. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  155. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  156. package/examples/extensions/gondolin/package-lock.json +2 -2
  157. package/examples/extensions/gondolin/package.json +1 -1
  158. package/examples/extensions/sandbox/package-lock.json +2 -2
  159. package/examples/extensions/sandbox/package.json +1 -1
  160. package/examples/extensions/with-deps/package-lock.json +2 -2
  161. package/examples/extensions/with-deps/package.json +1 -1
  162. package/npm-shrinkwrap.json +18 -18
  163. package/package.json +6 -6
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Apply the `devin-harness` domain loadout when the active provider is Devin.
3
+ * Does not require `OMK_DOMAIN_ROUTING=1`. Convenience wrapper over
4
+ * `tryProviderHarnessDispatch()` bound to the real loadout runtime.
5
+ */
6
+ import type { LoadoutRuntimeSession, LoadoutRuntimeState } from "./loadout-runtime.ts";
7
+ import { type ProviderHarnessDispatchInput, type ProviderHarnessDispatchResult } from "./provider-harness-dispatch.ts";
8
+ import type { ResourceLoader } from "./resource-loader.ts";
9
+ export type DevinHarnessDispatchInput = ProviderHarnessDispatchInput<LoadoutRuntimeSession, ResourceLoader>;
10
+ export type DevinHarnessDispatchResult = ProviderHarnessDispatchResult<LoadoutRuntimeState>;
11
+ export declare function tryDevinHarnessDispatch(input: DevinHarnessDispatchInput): DevinHarnessDispatchResult;
12
+ //# sourceMappingURL=devin-harness-dispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devin-harness-dispatch.d.ts","sourceRoot":"","sources":["../../src/core/devin-harness-dispatch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EACN,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAElC,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,MAAM,yBAAyB,GAAG,4BAA4B,CAAC,qBAAqB,EAAE,cAAc,CAAC,CAAC;AAC5G,MAAM,MAAM,0BAA0B,GAAG,6BAA6B,CAAC,mBAAmB,CAAC,CAAC;AAE5F,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,yBAAyB,GAAG,0BAA0B,CAEpG","sourcesContent":["/**\n * Apply the `devin-harness` domain loadout when the active provider is Devin.\n * Does not require `OMK_DOMAIN_ROUTING=1`. Convenience wrapper over\n * `tryProviderHarnessDispatch()` bound to the real loadout runtime.\n */\n\nimport { DEVIN_HARNESS_SPEC } from \"./devin-harness.ts\";\nimport { LOADOUT_HARNESS_RUNTIME } from \"./domain-dispatch.ts\";\nimport type { LoadoutRuntimeSession, LoadoutRuntimeState } from \"./loadout-runtime.ts\";\nimport {\n\ttype ProviderHarnessDispatchInput,\n\ttype ProviderHarnessDispatchResult,\n\ttryProviderHarnessDispatch,\n} from \"./provider-harness-dispatch.ts\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\n\nexport type DevinHarnessDispatchInput = ProviderHarnessDispatchInput<LoadoutRuntimeSession, ResourceLoader>;\nexport type DevinHarnessDispatchResult = ProviderHarnessDispatchResult<LoadoutRuntimeState>;\n\nexport function tryDevinHarnessDispatch(input: DevinHarnessDispatchInput): DevinHarnessDispatchResult {\n\treturn tryProviderHarnessDispatch(DEVIN_HARNESS_SPEC, LOADOUT_HARNESS_RUNTIME, input);\n}\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Apply the `devin-harness` domain loadout when the active provider is Devin.
3
+ * Does not require `OMK_DOMAIN_ROUTING=1`. Convenience wrapper over
4
+ * `tryProviderHarnessDispatch()` bound to the real loadout runtime.
5
+ */
6
+ import { DEVIN_HARNESS_SPEC } from "./devin-harness.js";
7
+ import { LOADOUT_HARNESS_RUNTIME } from "./domain-dispatch.js";
8
+ import { tryProviderHarnessDispatch, } from "./provider-harness-dispatch.js";
9
+ export function tryDevinHarnessDispatch(input) {
10
+ return tryProviderHarnessDispatch(DEVIN_HARNESS_SPEC, LOADOUT_HARNESS_RUNTIME, input);
11
+ }
12
+ //# sourceMappingURL=devin-harness-dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devin-harness-dispatch.js","sourceRoot":"","sources":["../../src/core/devin-harness-dispatch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAGN,0BAA0B,GAC1B,MAAM,gCAAgC,CAAC;AAMxC,MAAM,UAAU,uBAAuB,CAAC,KAAgC,EAA8B;IACrG,OAAO,0BAA0B,CAAC,kBAAkB,EAAE,uBAAuB,EAAE,KAAK,CAAC,CAAC;AAAA,CACtF","sourcesContent":["/**\n * Apply the `devin-harness` domain loadout when the active provider is Devin.\n * Does not require `OMK_DOMAIN_ROUTING=1`. Convenience wrapper over\n * `tryProviderHarnessDispatch()` bound to the real loadout runtime.\n */\n\nimport { DEVIN_HARNESS_SPEC } from \"./devin-harness.ts\";\nimport { LOADOUT_HARNESS_RUNTIME } from \"./domain-dispatch.ts\";\nimport type { LoadoutRuntimeSession, LoadoutRuntimeState } from \"./loadout-runtime.ts\";\nimport {\n\ttype ProviderHarnessDispatchInput,\n\ttype ProviderHarnessDispatchResult,\n\ttryProviderHarnessDispatch,\n} from \"./provider-harness-dispatch.ts\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\n\nexport type DevinHarnessDispatchInput = ProviderHarnessDispatchInput<LoadoutRuntimeSession, ResourceLoader>;\nexport type DevinHarnessDispatchResult = ProviderHarnessDispatchResult<LoadoutRuntimeState>;\n\nexport function tryDevinHarnessDispatch(input: DevinHarnessDispatchInput): DevinHarnessDispatchResult {\n\treturn tryProviderHarnessDispatch(DEVIN_HARNESS_SPEC, LOADOUT_HARNESS_RUNTIME, input);\n}\n"]}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Devin SWE-2 harness: provider identity, auto-apply flag, per-turn skill
3
+ * grants, and the optional `~/.omk/agent/devin.md` operator overlay.
4
+ *
5
+ * The canonical operator contract is `docs/devin-harness.md`; the domain
6
+ * loadout is `devin-harness` in `domain-loadouts.ts`.
7
+ */
8
+ import { type HarnessSkillCandidate, type HarnessSkillSelectionOptions } from "./harness-skills.ts";
9
+ import type { ProviderHarnessSpec } from "./provider-harness-dispatch.ts";
10
+ /** Built-in provider id for the Devin CLI subscription adapter. */
11
+ export declare const DEVIN_PROVIDER = "devin";
12
+ /** The only logical model the Devin adapter serves. */
13
+ export declare const DEVIN_SWE2_MODEL_ID = "swe-2";
14
+ /** Local context budget bundled with `devin/swe-2`; mirrors `DEVIN_LONG_CONTEXT_TOKENS` in omk-ai. */
15
+ export declare const DEVIN_SWE2_CONTEXT_WINDOW = 1000000;
16
+ /** Domain loadout id applied automatically when the Devin provider is active. */
17
+ export declare const DEVIN_HARNESS_DOMAIN_ID = "devin-harness";
18
+ /** Optional host-specific operator overlay appended to the system prompt on Devin sessions. */
19
+ export declare const DEVIN_PLAYBOOK_FILENAME = "devin.md";
20
+ /** Cap live system-prompt append size to reduce threshold autocompaction churn. */
21
+ export declare const DEVIN_PLAYBOOK_MAX_APPEND_CHARS = 24000;
22
+ /** SWE-2 efforts the adapter accepts; every other thinking level is rejected before credentials are sent. */
23
+ export declare const DEVIN_SWE2_EFFORTS: readonly ["medium", "high", "max"];
24
+ export type DevinSwe2Effort = (typeof DEVIN_SWE2_EFFORTS)[number];
25
+ export type DevinHarnessIntent = "code" | "debug" | "test" | "repo";
26
+ export type DevinHarnessSkillCandidate = HarnessSkillCandidate;
27
+ export type DevinHarnessSkillSelectionOptions = HarnessSkillSelectionOptions;
28
+ export declare function isDevinProvider(provider: string | undefined): boolean;
29
+ export declare function isDevinSwe2Effort(level: string | undefined): level is DevinSwe2Effort;
30
+ /**
31
+ * Recommended effort for a task class. SWE-2 medium acts sooner on simple and
32
+ * intermediate work; high and max plan and verify more on complex work.
33
+ */
34
+ export declare function recommendedDevinEffortForIntent(intent: DevinHarnessIntent): DevinSwe2Effort;
35
+ export declare function recommendedDevinSkillTierForIntent(intent: DevinHarnessIntent): readonly string[];
36
+ /**
37
+ * Smallest devin-harness skill grant from the live inventory. The domain
38
+ * profile owns the allowlist; explicit-only skills are excluded. `headroom`
39
+ * requires lexical or measured pressure, and the result never exceeds
40
+ * `MAX_SELECTED_SKILLS` names.
41
+ */
42
+ export declare function selectDevinHarnessSkills(task: string, inventory: readonly DevinHarnessSkillCandidate[], options?: DevinHarnessSkillSelectionOptions): readonly string[];
43
+ /**
44
+ * When true (default), selecting the `devin` provider applies the `devin-harness`
45
+ * domain loadout (skills/MCP/hooks/tool gate). Set `OMK_DEVIN_HARNESS=0` to disable.
46
+ */
47
+ export declare function devinHarnessAutoApplyEnabled(env?: NodeJS.ProcessEnv | Readonly<Record<string, string | undefined>>): boolean;
48
+ /** Provider-harness spec consumed by `tryProviderHarnessDispatch()`. */
49
+ export declare const DEVIN_HARNESS_SPEC: ProviderHarnessSpec;
50
+ /** Read ~/.omk/agent/devin.md for appending to the system prompt on Devin sessions. */
51
+ export declare function loadDevinPlaybookAppend(): string | undefined;
52
+ export declare function devinPlaybookAppendForProvider(provider: string | undefined): string | undefined;
53
+ //# sourceMappingURL=devin-harness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devin-harness.d.ts","sourceRoot":"","sources":["../../src/core/devin-harness.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EAEjC,MAAM,qBAAqB,CAAC;AAE7B,O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M,CAAC,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,GACjF,OAAO,CAMT;AAED,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,EAAE,mBAIhC,CAAC;AAEF,uFAAuF;AACvF,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,SAAS,CAiB5D;AAED,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAK/F","sourcesContent":["/**\n * Devin SWE-2 harness: provider identity, auto-apply flag, per-turn skill\n * grants, and the optional `~/.omk/agent/devin.md` operator overlay.\n *\n * The canonical operator contract is `docs/devin-harness.md`; the domain\n * loadout is `devin-harness` in `domain-loadouts.ts`.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { getAgentDir } from \"../config.ts\";\nimport { getDomainProfile } from \"./domain-loadouts.ts\";\nimport {\n\ttype HarnessSkillCandidate,\n\ttype HarnessSkillSelectionOptions,\n\tselectHarnessSkills,\n} from \"./harness-skills.ts\";\nimport { capabilityGateNames } from \"./loadout-safety.ts\";\nimport type { ProviderHarnessSpec } from \"./provider-harness-dispatch.ts\";\n\n/** Built-in provider id for the Devin CLI subscription adapter. */\nexport const DEVIN_PROVIDER = \"devin\";\n\n/** The only logical model the Devin adapter serves. */\nexport const DEVIN_SWE2_MODEL_ID = \"swe-2\";\n\n/** Local context budget bundled with `devin/swe-2`; mirrors `DEVIN_LONG_CONTEXT_TOKENS` in omk-ai. */\nexport const DEVIN_SWE2_CONTEXT_WINDOW = 1_000_000;\n\n/** Domain loadout id applied automatically when the Devin provider is active. */\nexport const DEVIN_HARNESS_DOMAIN_ID = \"devin-harness\";\n\nconst DEVIN_HARNESS_AUTO_APPLY_ENV = \"OMK_DEVIN_HARNESS\";\n\n/** Optional host-specific operator overlay appended to the system prompt on Devin sessions. */\nexport const DEVIN_PLAYBOOK_FILENAME = \"devin.md\";\n\n/** Cap live system-prompt append size to reduce threshold autocompaction churn. */\nexport const DEVIN_PLAYBOOK_MAX_APPEND_CHARS = 24_000;\n\n/** SWE-2 efforts the adapter accepts; every other thinking level is rejected before credentials are sent. */\nexport const DEVIN_SWE2_EFFORTS = [\"medium\", \"high\", \"max\"] as const;\nexport type DevinSwe2Effort = (typeof DEVIN_SWE2_EFFORTS)[number];\n\nexport type DevinHarnessIntent = \"code\" | \"debug\" | \"test\" | \"repo\";\n\nconst SKILLS_BY_INTENT = {\n\tcode: [\"packages\", \"programming\"],\n\tdebug: [\"packages\", \"debugging\", \"programming\"],\n\ttest: [\"tdd-workflow\", \"programming\"],\n\trepo: [\"understand-anything\", \"packages\"],\n} as const satisfies Record<DevinHarnessIntent, readonly string[]>;\n\nexport type DevinHarnessSkillCandidate = HarnessSkillCandidate;\nexport type DevinHarnessSkillSelectionOptions = HarnessSkillSelectionOptions;\n\nconst DEVIN_HARNESS_ALLOWED_SKILLS: ReadonlySet<string> = new Set(\n\tcapabilityGateNames(getDomainProfile(DEVIN_HARNESS_DOMAIN_ID).skills),\n);\n\nexport function isDevinProvider(provider: string | undefined): boolean {\n\treturn provider === DEVIN_PROVIDER;\n}\n\nexport function isDevinSwe2Effort(level: string | undefined): level is DevinSwe2Effort {\n\treturn (DEVIN_SWE2_EFFORTS as readonly string[]).includes(level ?? \"\");\n}\n\n/**\n * Recommended effort for a task class. SWE-2 medium acts sooner on simple and\n * intermediate work; high and max plan and verify more on complex work.\n */\nexport function recommendedDevinEffortForIntent(intent: DevinHarnessIntent): DevinSwe2Effort {\n\tswitch (intent) {\n\t\tcase \"code\":\n\t\t\treturn \"medium\";\n\t\tcase \"test\":\n\t\t\treturn \"high\";\n\t\tcase \"debug\":\n\t\tcase \"repo\":\n\t\t\treturn \"max\";\n\t}\n}\n\nexport function recommendedDevinSkillTierForIntent(intent: DevinHarnessIntent): readonly string[] {\n\treturn SKILLS_BY_INTENT[intent];\n}\n\n/**\n * Smallest devin-harness skill grant from the live inventory. The domain\n * profile owns the allowlist; explicit-only skills are excluded. `headroom`\n * requires lexical or measured pressure, and the result never exceeds\n * `MAX_SELECTED_SKILLS` names.\n */\nexport function selectDevinHarnessSkills(\n\ttask: string,\n\tinventory: readonly DevinHarnessSkillCandidate[],\n\toptions: DevinHarnessSkillSelectionOptions = {},\n): readonly string[] {\n\treturn selectHarnessSkills(DEVIN_HARNESS_ALLOWED_SKILLS, task, inventory, options);\n}\n\n/**\n * When true (default), selecting the `devin` provider applies the `devin-harness`\n * domain loadout (skills/MCP/hooks/tool gate). Set `OMK_DEVIN_HARNESS=0` to disable.\n */\nexport function devinHarnessAutoApplyEnabled(\n\tenv: NodeJS.ProcessEnv | Readonly<Record<string, string | undefined>> = process.env,\n): boolean {\n\tconst raw = env[DEVIN_HARNESS_AUTO_APPLY_ENV]?.trim().toLowerCase();\n\tif (raw === \"0\" || raw === \"false\" || raw === \"off\" || raw === \"no\") {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\n/** Provider-harness spec consumed by `tryProviderHarnessDispatch()`. */\nexport const DEVIN_HARNESS_SPEC: ProviderHarnessSpec = {\n\tdomainId: DEVIN_HARNESS_DOMAIN_ID,\n\tapplies: (provider, env) => devinHarnessAutoApplyEnabled(env) && isDevinProvider(provider),\n\tselectSkills: (task, inventory, options) => selectDevinHarnessSkills(task, inventory, { paths: options.paths }),\n};\n\n/** Read ~/.omk/agent/devin.md for appending to the system prompt on Devin sessions. */\nexport function loadDevinPlaybookAppend(): string | undefined {\n\tconst path = join(getAgentDir(), DEVIN_PLAYBOOK_FILENAME);\n\tif (!existsSync(path)) {\n\t\treturn undefined;\n\t}\n\ttry {\n\t\tlet text = readFileSync(path, \"utf-8\").trim();\n\t\tif (text.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (text.length > DEVIN_PLAYBOOK_MAX_APPEND_CHARS) {\n\t\t\ttext = `${text.slice(0, DEVIN_PLAYBOOK_MAX_APPEND_CHARS)}\\n\\n[... devin.md truncated for system prompt; full file: ${path}]`;\n\t\t}\n\t\treturn text;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport function devinPlaybookAppendForProvider(provider: string | undefined): string | undefined {\n\tif (!isDevinProvider(provider)) {\n\t\treturn undefined;\n\t}\n\treturn loadDevinPlaybookAppend();\n}\n"]}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Devin SWE-2 harness: provider identity, auto-apply flag, per-turn skill
3
+ * grants, and the optional `~/.omk/agent/devin.md` operator overlay.
4
+ *
5
+ * The canonical operator contract is `docs/devin-harness.md`; the domain
6
+ * loadout is `devin-harness` in `domain-loadouts.ts`.
7
+ */
8
+ import { existsSync, readFileSync } from "node:fs";
9
+ import { join } from "node:path";
10
+ import { getAgentDir } from "../config.js";
11
+ import { getDomainProfile } from "./domain-loadouts.js";
12
+ import { selectHarnessSkills, } from "./harness-skills.js";
13
+ import { capabilityGateNames } from "./loadout-safety.js";
14
+ /** Built-in provider id for the Devin CLI subscription adapter. */
15
+ export const DEVIN_PROVIDER = "devin";
16
+ /** The only logical model the Devin adapter serves. */
17
+ export const DEVIN_SWE2_MODEL_ID = "swe-2";
18
+ /** Local context budget bundled with `devin/swe-2`; mirrors `DEVIN_LONG_CONTEXT_TOKENS` in omk-ai. */
19
+ export const DEVIN_SWE2_CONTEXT_WINDOW = 1_000_000;
20
+ /** Domain loadout id applied automatically when the Devin provider is active. */
21
+ export const DEVIN_HARNESS_DOMAIN_ID = "devin-harness";
22
+ const DEVIN_HARNESS_AUTO_APPLY_ENV = "OMK_DEVIN_HARNESS";
23
+ /** Optional host-specific operator overlay appended to the system prompt on Devin sessions. */
24
+ export const DEVIN_PLAYBOOK_FILENAME = "devin.md";
25
+ /** Cap live system-prompt append size to reduce threshold autocompaction churn. */
26
+ export const DEVIN_PLAYBOOK_MAX_APPEND_CHARS = 24_000;
27
+ /** SWE-2 efforts the adapter accepts; every other thinking level is rejected before credentials are sent. */
28
+ export const DEVIN_SWE2_EFFORTS = ["medium", "high", "max"];
29
+ const SKILLS_BY_INTENT = {
30
+ code: ["packages", "programming"],
31
+ debug: ["packages", "debugging", "programming"],
32
+ test: ["tdd-workflow", "programming"],
33
+ repo: ["understand-anything", "packages"],
34
+ };
35
+ const DEVIN_HARNESS_ALLOWED_SKILLS = new Set(capabilityGateNames(getDomainProfile(DEVIN_HARNESS_DOMAIN_ID).skills));
36
+ export function isDevinProvider(provider) {
37
+ return provider === DEVIN_PROVIDER;
38
+ }
39
+ export function isDevinSwe2Effort(level) {
40
+ return DEVIN_SWE2_EFFORTS.includes(level ?? "");
41
+ }
42
+ /**
43
+ * Recommended effort for a task class. SWE-2 medium acts sooner on simple and
44
+ * intermediate work; high and max plan and verify more on complex work.
45
+ */
46
+ export function recommendedDevinEffortForIntent(intent) {
47
+ switch (intent) {
48
+ case "code":
49
+ return "medium";
50
+ case "test":
51
+ return "high";
52
+ case "debug":
53
+ case "repo":
54
+ return "max";
55
+ }
56
+ }
57
+ export function recommendedDevinSkillTierForIntent(intent) {
58
+ return SKILLS_BY_INTENT[intent];
59
+ }
60
+ /**
61
+ * Smallest devin-harness skill grant from the live inventory. The domain
62
+ * profile owns the allowlist; explicit-only skills are excluded. `headroom`
63
+ * requires lexical or measured pressure, and the result never exceeds
64
+ * `MAX_SELECTED_SKILLS` names.
65
+ */
66
+ export function selectDevinHarnessSkills(task, inventory, options = {}) {
67
+ return selectHarnessSkills(DEVIN_HARNESS_ALLOWED_SKILLS, task, inventory, options);
68
+ }
69
+ /**
70
+ * When true (default), selecting the `devin` provider applies the `devin-harness`
71
+ * domain loadout (skills/MCP/hooks/tool gate). Set `OMK_DEVIN_HARNESS=0` to disable.
72
+ */
73
+ export function devinHarnessAutoApplyEnabled(env = process.env) {
74
+ const raw = env[DEVIN_HARNESS_AUTO_APPLY_ENV]?.trim().toLowerCase();
75
+ if (raw === "0" || raw === "false" || raw === "off" || raw === "no") {
76
+ return false;
77
+ }
78
+ return true;
79
+ }
80
+ /** Provider-harness spec consumed by `tryProviderHarnessDispatch()`. */
81
+ export const DEVIN_HARNESS_SPEC = {
82
+ domainId: DEVIN_HARNESS_DOMAIN_ID,
83
+ applies: (provider, env) => devinHarnessAutoApplyEnabled(env) && isDevinProvider(provider),
84
+ selectSkills: (task, inventory, options) => selectDevinHarnessSkills(task, inventory, { paths: options.paths }),
85
+ };
86
+ /** Read ~/.omk/agent/devin.md for appending to the system prompt on Devin sessions. */
87
+ export function loadDevinPlaybookAppend() {
88
+ const path = join(getAgentDir(), DEVIN_PLAYBOOK_FILENAME);
89
+ if (!existsSync(path)) {
90
+ return undefined;
91
+ }
92
+ try {
93
+ let text = readFileSync(path, "utf-8").trim();
94
+ if (text.length === 0) {
95
+ return undefined;
96
+ }
97
+ if (text.length > DEVIN_PLAYBOOK_MAX_APPEND_CHARS) {
98
+ text = `${text.slice(0, DEVIN_PLAYBOOK_MAX_APPEND_CHARS)}\n\n[... devin.md truncated for system prompt; full file: ${path}]`;
99
+ }
100
+ return text;
101
+ }
102
+ catch {
103
+ return undefined;
104
+ }
105
+ }
106
+ export function devinPlaybookAppendForProvider(provider) {
107
+ if (!isDevinProvider(provider)) {
108
+ return undefined;
109
+ }
110
+ return loadDevinPlaybookAppend();
111
+ }
112
+ //# sourceMappingURL=devin-harness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devin-harness.js","sourceRoot":"","sources":["../../src/core/devin-harness.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAGN,mBAAmB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,mEAAmE;AACnE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GAAG,IAAI,CAAC,WAAW,EAAE,EAAE,uBAAuB,CAAC,CAAC;IAC1D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,IAAI,CAAC;QACJ,IAAI,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,GAAG,+BAA+B,EAAE,CAAC;YACnD,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,+BAA+B,CAAC,6DAA6D,IAAI,GAAG,CAAC;QAC9H,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AAAA,CACD;AAED,MAAM,UAAU,8BAA8B,CAAC,QAA4B,EAAsB;IAChG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,OAAO,uBAAuB,EAAE,CAAC;AAAA,CACjC","sourcesContent":["/**\n * Devin SWE-2 harness: provider identity, auto-apply flag, per-turn skill\n * grants, and the optional `~/.omk/agent/devin.md` operator overlay.\n *\n * The canonical operator contract is `docs/devin-harness.md`; the domain\n * loadout is `devin-harness` in `domain-loadouts.ts`.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { getAgentDir } from \"../config.ts\";\nimport { getDomainProfile } from \"./domain-loadouts.ts\";\nimport {\n\ttype HarnessSkillCandidate,\n\ttype HarnessSkillSelectionOptions,\n\tselectHarnessSkills,\n} from \"./harness-skills.ts\";\nimport { capabilityGateNames } from \"./loadout-safety.ts\";\nimport type { ProviderHarnessSpec } from \"./provider-harness-dispatch.ts\";\n\n/** Built-in provider id for the Devin CLI subscription adapter. */\nexport const DEVIN_PROVIDER = \"devin\";\n\n/** The only logical model the Devin adapter serves. */\nexport const DEVIN_SWE2_MODEL_ID = \"swe-2\";\n\n/** Local context budget bundled with `devin/swe-2`; mirrors `DEVIN_LONG_CONTEXT_TOKENS` in omk-ai. */\nexport const DEVIN_SWE2_CONTEXT_WINDOW = 1_000_000;\n\n/** Domain loadout id applied automatically when the Devin provider is active. */\nexport const DEVIN_HARNESS_DOMAIN_ID = \"devin-harness\";\n\nconst DEVIN_HARNESS_AUTO_APPLY_ENV = \"OMK_DEVIN_HARNESS\";\n\n/** Optional host-specific operator overlay appended to the system prompt on Devin sessions. */\nexport const DEVIN_PLAYBOOK_FILENAME = \"devin.md\";\n\n/** Cap live system-prompt append size to reduce threshold autocompaction churn. */\nexport const DEVIN_PLAYBOOK_MAX_APPEND_CHARS = 24_000;\n\n/** SWE-2 efforts the adapter accepts; every other thinking level is rejected before credentials are sent. */\nexport const DEVIN_SWE2_EFFORTS = [\"medium\", \"high\", \"max\"] as const;\nexport type DevinSwe2Effort = (typeof DEVIN_SWE2_EFFORTS)[number];\n\nexport type DevinHarnessIntent = \"code\" | \"debug\" | \"test\" | \"repo\";\n\nconst SKILLS_BY_INTENT = {\n\tcode: [\"packages\", \"programming\"],\n\tdebug: [\"packages\", \"debugging\", \"programming\"],\n\ttest: [\"tdd-workflow\", \"programming\"],\n\trepo: [\"understand-anything\", \"packages\"],\n} as const satisfies Record<DevinHarnessIntent, readonly string[]>;\n\nexport type DevinHarnessSkillCandidate = HarnessSkillCandidate;\nexport type DevinHarnessSkillSelectionOptions = HarnessSkillSelectionOptions;\n\nconst DEVIN_HARNESS_ALLOWED_SKILLS: ReadonlySet<string> = new Set(\n\tcapabilityGateNames(getDomainProfile(DEVIN_HARNESS_DOMAIN_ID).skills),\n);\n\nexport function isDevinProvider(provider: string | undefined): boolean {\n\treturn provider === DEVIN_PROVIDER;\n}\n\nexport function isDevinSwe2Effort(level: string | undefined): level is DevinSwe2Effort {\n\treturn (DEVIN_SWE2_EFFORTS as readonly string[]).includes(level ?? \"\");\n}\n\n/**\n * Recommended effort for a task class. SWE-2 medium acts sooner on simple and\n * intermediate work; high and max plan and verify more on complex work.\n */\nexport function recommendedDevinEffortForIntent(intent: DevinHarnessIntent): DevinSwe2Effort {\n\tswitch (intent) {\n\t\tcase \"code\":\n\t\t\treturn \"medium\";\n\t\tcase \"test\":\n\t\t\treturn \"high\";\n\t\tcase \"debug\":\n\t\tcase \"repo\":\n\t\t\treturn \"max\";\n\t}\n}\n\nexport function recommendedDevinSkillTierForIntent(intent: DevinHarnessIntent): readonly string[] {\n\treturn SKILLS_BY_INTENT[intent];\n}\n\n/**\n * Smallest devin-harness skill grant from the live inventory. The domain\n * profile owns the allowlist; explicit-only skills are excluded. `headroom`\n * requires lexical or measured pressure, and the result never exceeds\n * `MAX_SELECTED_SKILLS` names.\n */\nexport function selectDevinHarnessSkills(\n\ttask: string,\n\tinventory: readonly DevinHarnessSkillCandidate[],\n\toptions: DevinHarnessSkillSelectionOptions = {},\n): readonly string[] {\n\treturn selectHarnessSkills(DEVIN_HARNESS_ALLOWED_SKILLS, task, inventory, options);\n}\n\n/**\n * When true (default), selecting the `devin` provider applies the `devin-harness`\n * domain loadout (skills/MCP/hooks/tool gate). Set `OMK_DEVIN_HARNESS=0` to disable.\n */\nexport function devinHarnessAutoApplyEnabled(\n\tenv: NodeJS.ProcessEnv | Readonly<Record<string, string | undefined>> = process.env,\n): boolean {\n\tconst raw = env[DEVIN_HARNESS_AUTO_APPLY_ENV]?.trim().toLowerCase();\n\tif (raw === \"0\" || raw === \"false\" || raw === \"off\" || raw === \"no\") {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\n/** Provider-harness spec consumed by `tryProviderHarnessDispatch()`. */\nexport const DEVIN_HARNESS_SPEC: ProviderHarnessSpec = {\n\tdomainId: DEVIN_HARNESS_DOMAIN_ID,\n\tapplies: (provider, env) => devinHarnessAutoApplyEnabled(env) && isDevinProvider(provider),\n\tselectSkills: (task, inventory, options) => selectDevinHarnessSkills(task, inventory, { paths: options.paths }),\n};\n\n/** Read ~/.omk/agent/devin.md for appending to the system prompt on Devin sessions. */\nexport function loadDevinPlaybookAppend(): string | undefined {\n\tconst path = join(getAgentDir(), DEVIN_PLAYBOOK_FILENAME);\n\tif (!existsSync(path)) {\n\t\treturn undefined;\n\t}\n\ttry {\n\t\tlet text = readFileSync(path, \"utf-8\").trim();\n\t\tif (text.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (text.length > DEVIN_PLAYBOOK_MAX_APPEND_CHARS) {\n\t\t\ttext = `${text.slice(0, DEVIN_PLAYBOOK_MAX_APPEND_CHARS)}\\n\\n[... devin.md truncated for system prompt; full file: ${path}]`;\n\t\t}\n\t\treturn text;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport function devinPlaybookAppendForProvider(provider: string | undefined): string | undefined {\n\tif (!isDevinProvider(provider)) {\n\t\treturn undefined;\n\t}\n\treturn loadDevinPlaybookAppend();\n}\n"]}
@@ -8,9 +8,12 @@
8
8
  import type { ToolDefinition } from "./extensions/types.ts";
9
9
  import type { LoadoutAccessPolicy } from "./loadout-access-policy.ts";
10
10
  import { type CompositionTrace, type ScopeHints } from "./loadout-compose.ts";
11
- import { type LoadoutRuntimeSession } from "./loadout-runtime.ts";
11
+ import { type LoadoutRuntimeSession, type LoadoutRuntimeState } from "./loadout-runtime.ts";
12
12
  import type { LoadoutAuthority, LoadoutProfile, LoadoutRole } from "./loadouts.ts";
13
+ import type { ProviderHarnessRuntime } from "./provider-harness-dispatch.ts";
13
14
  import type { ResourceLoader } from "./resource-loader.ts";
15
+ /** Real loadout runtime entry points for provider-harness dispatch (`tryProviderHarnessDispatch`). */
16
+ export declare const LOADOUT_HARNESS_RUNTIME: ProviderHarnessRuntime<LoadoutRuntimeSession, ResourceLoader, LoadoutRuntimeState>;
14
17
  export interface DomainDispatchInput {
15
18
  readonly role: Load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C,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAC9D,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAC7C;AAED,MAAM,WAAW,mCAAmC;IACnD,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IACjD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/C;AAED,wBAAgB,kCAAkC,CACjD,OAAO,EAAE,mCAAmC,GAC1C,qBAAqB,CA0BvB;AAED,wBAAgB,sBAAsB,CACrC,GAAG,GAAE,MAAM,CAAC,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,GACjF,OAAO,CAET;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,CAyClF","sourcesContent":["/**\n * Opt-in domain dispatch orchestration.\n *\n * Callers can invoke it to route an initial prompt, compose a role/domain\n * loadout, apply it to the current runtime inventory, and receive an access\n * policy suitable for existing AgentSession enforcement.\n */\n\nimport { routeDomain } from \"./domain-router.ts\";\nimport type { RegisteredTool, ToolDefinition } from \"./extensions/types.ts\";\nimport type { LoadoutAccessPolicy } from \"./loadout-access-policy.ts\";\nimport {\n\ttype ComposeLoadoutOptions,\n\ttype CompositionTrace,\n\tcomposeLoadout,\n\ttype ScopeHints,\n} from \"./loadout-compose.ts\";\nimport { createLoadoutPolicyFromRuntimeState, validatePolicyIntegrity } from \"./loadout-policy-bridge.ts\";\nimport { applyLoadoutToRuntime, type LoadoutRuntimeSession, type LoadoutRuntimeState } from \"./loadout-runtime.ts\";\nimport type { LoadoutAuthority, LoadoutProfile, LoadoutRole } from \"./loadouts.ts\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\n\nexport interface DomainDispatchInput {\n\treadonly role: LoadoutRole;\n\treadonly initialPrompt: string;\n\treadonly session: LoadoutRuntimeSession;\n\treadonly resourceLoader: ResourceLoader;\n\treadonly cwd: string;\n\treadonly agentDir: string;\n\treadonly grantAuthority?: LoadoutAuthority;\n\treadonly scopeHints?: ScopeHints;\n\treadonly env?: NodeJS.ProcessEnv | Readonly<Record<string, string | undefined>>;\n\treadonly roleProfileOverride?: LoadoutProfile;\n\treadonly blockedPaths?: readonly string[];\n}\n\nexport interface DomainDispatchResult {\n\treadonly loadoutAccessPolicy: LoadoutAccessPolicy | undefined;\n\treadonly domainUsed: string | undefined;\n\treadonly fallback: boolean;\n\treadonly warnings: readonly string[];\n\treadonly trace: CompositionTrace | undefined;\n}\n\nexport interface DomainDispatchRuntimeSessionOptions {\n\treadonly baseToolNames: readonly string[];\n\treadonly resourceLoader: ResourceLoader;\n\treadonly customTools?: readonly ToolDefinition[];\n\treadonly allowedToolNames?: readonly string[];\n\treadonly excludedToolNames?: readonly string[];\n}\n\nexport function createDomainDispatchRuntimeSession(\n\toptions: DomainDispatchRuntimeSessionOptions,\n): LoadoutRuntimeSession {\n\tconst allowedToolNameSet = options.allowedToolNames ? new Set(options.allowedToolNames) : undefined;\n\tconst excludedToolNameSet = options.excludedToolNames ? new Set(options.excludedToolNames) : undefined;\n\tconst isAllowedTool = (name: string): boolean =>\n\t\t(!allowedToolNameSet || allowedToolNameSet.has(name)) && !excludedToolNameSet?.has(name);\n\n\tconst base = new Map<string, ToolDefinition>();\n\tfor (const name of uniqueSorted(options.baseToolNames).filter(isAllowedTool)) {\n\t\tbase.set(name, { name } as unknown as ToolDefinition);\n\t}\n\n\tconst extensionToolsByName = new Map<string, RegisteredTool>();\n\tfor (const extension of options.resourceLoader.getExtensions().extensions) {\n\t\tfor (const tool of extension.tools.values()) {\n\t\t\tconst name = tool.definition.name;\n\t\t\tif (isAllowedTool(name) && !extensionToolsByName.has(name)) {\n\t\t\t\textensionToolsByName.set(name, tool);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\t_baseToolDefinitions: base,\n\t\t_extensionRunner: { getAllRegisteredTools: () => [...extensionToolsByName.values()] },\n\t\t_customTools: [...(options.customTools ?? [])].filter((tool) => isAllowedTool(tool.name)),\n\t};\n}\n\nexport function isDomainRoutingEnabled(\n\tenv: NodeJS.ProcessEnv | Readonly<Record<string, string | undefined>> = process.env,\n): boolean {\n\treturn env.OMK_DOMAIN_ROUTING === \"1\";\n}\n\nexport function tryDomainDispatch(input: DomainDispatchInput): DomainDispatchResult {\n\tif (!isDomainRoutingEnabled(input.env)) {\n\t\treturn noPolicy(false, [], undefined, undefined);\n\t}\n\n\tlet domainUsed: string | undefined;\n\tlet trace: CompositionTrace | undefined;\n\ttry {\n\t\tconst route = routeDomain({ task: input.initialPrompt });\n\t\tdomainUsed = route.primary.id;\n\t\tconst composeOptions: ComposeLoadoutOptions = {\n\t\t\tgrantAuthority: input.grantAuthority,\n\t\t\tscopeHints: input.scopeHints,\n\t\t\troleProfileOverride: input.roleProfileOverride,\n\t\t};\n\t\tconst profile = composeLoadout(input.role, route.primary, composeOptions);\n\t\ttrace = profile.composition;\n\t\tconst state = applyLoadoutToRuntime(input.session, input.resourceLoader, input.cwd, input.agentDir, {\n\t\t\tprofile,\n\t\t\trole: input.role,\n\t\t\tgrantAuthority: input.grantAuthority,\n\t\t\tassignedReadPaths: input.scopeHints?.readScope,\n\t\t\tassignedWritePaths: input.scopeHints?.writeScope,\n\t\t});\n\t\tconst policy = createPolicyOrThrow(state, profile.commands, input.cwd, input.blockedPaths);\n\t\tconst integrity = validatePolicyIntegrity(policy, state);\n\t\treturn {\n\t\t\tloadoutAccessPolicy: policy,\n\t\t\tdomainUsed,\n\t\t\tfallback: route.confidence === \"fallback\",\n\t\t\twarnings: uniqueSorted([\n\t\t\t\t...routeWarnings(route),\n\t\t\t\t...profile.composition.warnings,\n\t\t\t\t...state.warnings,\n\t\t\t\t...integrity.warnings,\n\t\t\t]),\n\t\t\ttrace,\n\t\t};\n\t} catch (error) {\n\t\treturn noPolicy(true, [errorMessage(error)], domainUsed, trace);\n\t}\n}\n\nfunction createPolicyOrThrow(\n\tstate: LoadoutRuntimeState,\n\tcommands: LoadoutProfile[\"commands\"],\n\tcwd: string,\n\tblockedPaths: readonly string[] | undefined,\n): LoadoutAccessPolicy {\n\treturn createLoadoutPolicyFromRuntimeState(state, {\n\t\tcwd,\n\t\tblockedPaths,\n\t\tcommands,\n\t});\n}\n\nfunction noPolicy(\n\tfallback: boolean,\n\twarnings: readonly string[],\n\tdomainUsed: string | undefined,\n\ttrace: CompositionTrace | undefined,\n): DomainDispatchResult {\n\treturn {\n\t\tloadoutAccessPolicy: undefined,\n\t\tdomainUsed,\n\t\tfallback,\n\t\twarnings: uniqueSorted(warnings),\n\t\ttrace,\n\t};\n}\n\nfunction routeWarnings(route: ReturnType<typeof routeDomain>): string[] {\n\tconst warnings: string[] = [];\n\tif (route.ambiguous) warnings.push(route.reason);\n\tif (route.confidence === \"fallback\") warnings.push(route.reason);\n\treturn warnings;\n}\n\nfunction errorMessage(error: unknown): string {\n\tif (error instanceof Error) return error.message;\n\treturn String(error);\n}\n\nfunction uniqueSorted(values: readonly string[]): string[] {\n\treturn [...new Set(values.map((value) => value.trim()).filter((value) => value !== \"\"))].sort((a, b) => {\n\t\tif (a < b) return -1;\n\t\tif (a > b) return 1;\n\t\treturn 0;\n\t});\n}\n"]}
1
+ {"version":3,"file":"domain-dispatch.d.ts","sourceRoot":"","sources":["../../src/core/domain-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,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,oBAAoB;IACpC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAC9D,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAC7C;AAED,MAAM,WAAW,mCAAmC;IACnD,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IACjD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/C;AAED,wBAAgB,kCAAkC,CACjD,OAAO,EAAE,mCAAmC,GAC1C,qBAAqB,CA0BvB;AAED,wBAAgB,sBAAsB,CACrC,GAAG,GAAE,MAAM,CAAC,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,GACjF,OAAO,CAET;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,CAyClF","sourcesContent":["/**\n * Opt-in domain dispatch orchestration.\n *\n * Callers can invoke it to route an initial prompt, compose a role/domain\n * loadout, apply it to the current runtime inventory, and receive an access\n * policy suitable for existing AgentSession enforcement.\n */\n\nimport { routeDomain } from \"./domain-router.ts\";\nimport type { RegisteredTool, ToolDefinition } from \"./extensions/types.ts\";\nimport type { LoadoutAccessPolicy } from \"./loadout-access-policy.ts\";\nimport {\n\ttype ComposeLoadoutOptions,\n\ttype CompositionTrace,\n\tcomposeLoadout,\n\ttype ScopeHints,\n} from \"./loadout-compose.ts\";\nimport { createLoadoutPolicyFromRuntimeState, validatePolicyIntegrity } from \"./loadout-policy-bridge.ts\";\nimport { applyLoadoutToRuntime, type LoadoutRuntimeSession, type LoadoutRuntimeState } from \"./loadout-runtime.ts\";\nimport type { LoadoutAuthority, LoadoutProfile, LoadoutRole } from \"./loadouts.ts\";\nimport type { ProviderHarnessRuntime } from \"./provider-harness-dispatch.ts\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\n\n/** Real loadout runtime entry points for provider-harness dispatch (`tryProviderHarnessDispatch`). */\nexport const LOADOUT_HARNESS_RUNTIME: ProviderHarnessRuntime<\n\tLoadoutRuntimeSession,\n\tResourceLoader,\n\tLoadoutRuntimeState\n> = {\n\tapplyLoadoutToRuntime,\n\tcreateLoadoutPolicyFromRuntimeState,\n};\n\nexport interface DomainDispatchInput {\n\treadonly role: LoadoutRole;\n\treadonly initialPrompt: string;\n\treadonly session: LoadoutRuntimeSession;\n\treadonly resourceLoader: ResourceLoader;\n\treadonly cwd: string;\n\treadonly agentDir: string;\n\treadonly grantAuthority?: LoadoutAuthority;\n\treadonly scopeHints?: ScopeHints;\n\treadonly env?: NodeJS.ProcessEnv | Readonly<Record<string, string | undefined>>;\n\treadonly roleProfileOverride?: LoadoutProfile;\n\treadonly blockedPaths?: readonly string[];\n}\n\nexport interface DomainDispatchResult {\n\treadonly loadoutAccessPolicy: LoadoutAccessPolicy | undefined;\n\treadonly domainUsed: string | undefined;\n\treadonly fallback: boolean;\n\treadonly warnings: readonly string[];\n\treadonly trace: CompositionTrace | undefined;\n}\n\nexport interface DomainDispatchRuntimeSessionOptions {\n\treadonly baseToolNames: readonly string[];\n\treadonly resourceLoader: ResourceLoader;\n\treadonly customTools?: readonly ToolDefinition[];\n\treadonly allowedToolNames?: readonly string[];\n\treadonly excludedToolNames?: readonly string[];\n}\n\nexport function createDomainDispatchRuntimeSession(\n\toptions: DomainDispatchRuntimeSessionOptions,\n): LoadoutRuntimeSession {\n\tconst allowedToolNameSet = options.allowedToolNames ? new Set(options.allowedToolNames) : undefined;\n\tconst excludedToolNameSet = options.excludedToolNames ? new Set(options.excludedToolNames) : undefined;\n\tconst isAllowedTool = (name: string): boolean =>\n\t\t(!allowedToolNameSet || allowedToolNameSet.has(name)) && !excludedToolNameSet?.has(name);\n\n\tconst base = new Map<string, ToolDefinition>();\n\tfor (const name of uniqueSorted(options.baseToolNames).filter(isAllowedTool)) {\n\t\tbase.set(name, { name } as unknown as ToolDefinition);\n\t}\n\n\tconst extensionToolsByName = new Map<string, RegisteredTool>();\n\tfor (const extension of options.resourceLoader.getExtensions().extensions) {\n\t\tfor (const tool of extension.tools.values()) {\n\t\t\tconst name = tool.definition.name;\n\t\t\tif (isAllowedTool(name) && !extensionToolsByName.has(name)) {\n\t\t\t\textensionToolsByName.set(name, tool);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\t_baseToolDefinitions: base,\n\t\t_extensionRunner: { getAllRegisteredTools: () => [...extensionToolsByName.values()] },\n\t\t_customTools: [...(options.customTools ?? [])].filter((tool) => isAllowedTool(tool.name)),\n\t};\n}\n\nexport function isDomainRoutingEnabled(\n\tenv: NodeJS.ProcessEnv | Readonly<Record<string, string | undefined>> = process.env,\n): boolean {\n\treturn env.OMK_DOMAIN_ROUTING === \"1\";\n}\n\nexport function tryDomainDispatch(input: DomainDispatchInput): DomainDispatchResult {\n\tif (!isDomainRoutingEnabled(input.env)) {\n\t\treturn noPolicy(false, [], undefined, undefined);\n\t}\n\n\tlet domainUsed: string | undefined;\n\tlet trace: CompositionTrace | undefined;\n\ttry {\n\t\tconst route = routeDomain({ task: input.initialPrompt });\n\t\tdomainUsed = route.primary.id;\n\t\tconst composeOptions: ComposeLoadoutOptions = {\n\t\t\tgrantAuthority: input.grantAuthority,\n\t\t\tscopeHints: input.scopeHints,\n\t\t\troleProfileOverride: input.roleProfileOverride,\n\t\t};\n\t\tconst profile = composeLoadout(input.role, route.primary, composeOptions);\n\t\ttrace = profile.composition;\n\t\tconst state = applyLoadoutToRuntime(input.session, input.resourceLoader, input.cwd, input.agentDir, {\n\t\t\tprofile,\n\t\t\trole: input.role,\n\t\t\tgrantAuthority: input.grantAuthority,\n\t\t\tassignedReadPaths: input.scopeHints?.readScope,\n\t\t\tassignedWritePaths: input.scopeHints?.writeScope,\n\t\t});\n\t\tconst policy = createPolicyOrThrow(state, profile.commands, input.cwd, input.blockedPaths);\n\t\tconst integrity = validatePolicyIntegrity(policy, state);\n\t\treturn {\n\t\t\tloadoutAccessPolicy: policy,\n\t\t\tdomainUsed,\n\t\t\tfallback: route.confidence === \"fallback\",\n\t\t\twarnings: uniqueSorted([\n\t\t\t\t...routeWarnings(route),\n\t\t\t\t...profile.composition.warnings,\n\t\t\t\t...state.warnings,\n\t\t\t\t...integrity.warnings,\n\t\t\t]),\n\t\t\ttrace,\n\t\t};\n\t} catch (error) {\n\t\treturn noPolicy(true, [errorMessage(error)], domainUsed, trace);\n\t}\n}\n\nfunction createPolicyOrThrow(\n\tstate: LoadoutRuntimeState,\n\tcommands: LoadoutProfile[\"commands\"],\n\tcwd: string,\n\tblockedPaths: readonly string[] | undefined,\n): LoadoutAccessPolicy {\n\treturn createLoadoutPolicyFromRuntimeState(state, {\n\t\tcwd,\n\t\tblockedPaths,\n\t\tcommands,\n\t});\n}\n\nfunction noPolicy(\n\tfallback: boolean,\n\twarnings: readonly string[],\n\tdomainUsed: string | undefined,\n\ttrace: CompositionTrace | undefined,\n): DomainDispatchResult {\n\treturn {\n\t\tloadoutAccessPolicy: undefined,\n\t\tdomainUsed,\n\t\tfallback,\n\t\twarnings: uniqueSorted(warnings),\n\t\ttrace,\n\t};\n}\n\nfunction routeWarnings(route: ReturnType<typeof routeDomain>): string[] {\n\tconst warnings: string[] = [];\n\tif (route.ambiguous) warnings.push(route.reason);\n\tif (route.confidence === \"fallback\") warnings.push(route.reason);\n\treturn warnings;\n}\n\nfunction errorMessage(error: unknown): string {\n\tif (error instanceof Error) return error.message;\n\treturn String(error);\n}\n\nfunction uniqueSorted(values: readonly string[]): string[] {\n\treturn [...new Set(values.map((value) => value.trim()).filter((value) => value !== \"\"))].sort((a, b) => {\n\t\tif (a < b) return -1;\n\t\tif (a > b) return 1;\n\t\treturn 0;\n\t});\n}\n"]}
@@ -9,6 +9,11 @@ import { routeDomain } from "./domain-router.js";
9
9
  import { composeLoadout, } from "./loadout-compose.js";
10
10
  import { createLoadoutPolicyFromRuntimeState, validatePolicyIntegrity } from "./loadout-policy-bridge.js";
11
11
  import { applyLoadoutToRuntime } from "./loadout-runtime.js";
12
+ /** Real loadout runtime entry points for provider-harness dispatch (`tryProviderHarnessDispatch`). */
13
+ export const LOADOUT_HARNESS_RUNTIME = {
14
+ applyLoadoutToRuntime,
15
+ createLoadoutPolicyFromRuntimeState,
16
+ };
12
17
  export function createDomainDispatchRuntimeSession(options) {
13
18
  const allowedToolNameSet = options.allowedToolNames ? new Set(options.allowedToolNames) : undefined;
14
19
  const excludedToolNameSet = options.excludedToolNames ? new Set(options.excludedToolNames) : undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"domain-dispatch.js","sourceRoot":"","sources":["../../src/core/domain-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,EAGN,cAAc,GAEd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mCAAmC,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1G,OAAO,EAAE,qBAAqB,EAAwD,MAAM,sBAAsB,CAAC;AAkCnH,MAAM,UAAU,kCAAkC,CACjD,OAA4C,EACpB;IACxB,MAAM,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpG,MAAM,mBAAmB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,I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QAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACjD,IAAI,KAAK,CAAC,UAAU,KAAK,UAAU;QAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACjE,OAAO,QAAQ,CAAC;AAAA,CAChB;AAED,SAAS,YAAY,CAAC,KAAc,EAAU;IAC7C,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC;IACjD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AAAA,CACrB;AAED,SAAS,YAAY,CAAC,MAAyB,EAAY;IAC1D,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACvG,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,CAAC,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,CAAC;QACpB,OAAO,CAAC,CAAC;IAAA,CACT,CAAC,CAAC;AAAA,CACH","sourcesContent":["/**\n * Opt-in domain dispatch orchestration.\n *\n * Callers can invoke it to route an initial prompt, compose a role/domain\n * loadout, apply it to the current runtime inventory, and receive an access\n * policy suitable for existing AgentSession enforcement.\n */\n\nimport { routeDomain } from \"./domain-router.ts\";\nimport type { RegisteredTool, ToolDefinition } from \"./extensions/types.ts\";\nimport type { LoadoutAccessPolicy } from \"./loadout-access-policy.ts\";\nimport {\n\ttype ComposeLoadoutOptions,\n\ttype CompositionTrace,\n\tcomposeLoadout,\n\ttype ScopeHints,\n} from \"./loadout-compose.ts\";\nimport { createLoadoutPolicyFromRuntimeState, validatePolicyIntegrity } from \"./loadout-policy-bridge.ts\";\nimport { applyLoadoutToRuntime, type LoadoutRuntimeSession, type LoadoutRuntimeState } from \"./loadout-runtime.ts\";\nimport type { LoadoutAuthority, LoadoutProfile, LoadoutRole } from \"./loadouts.ts\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\n\nexport interface DomainDispatchInput {\n\treadonly role: LoadoutRole;\n\treadonly initialPrompt: string;\n\treadonly session: LoadoutRuntimeSession;\n\treadonly resourceLoader: ResourceLoader;\n\treadonly cwd: string;\n\treadonly agentDir: string;\n\treadonly grantAuthority?: LoadoutAuthority;\n\treadonly scopeHints?: ScopeHints;\n\treadonly env?: NodeJS.ProcessEnv | Readonly<Record<string, string | undefined>>;\n\treadonly roleProfileOverride?: LoadoutProfile;\n\treadonly blockedPaths?: readonly string[];\n}\n\nexport interface DomainDispatchResult {\n\treadonly loadoutAccessPolicy: LoadoutAccessPolicy | undefined;\n\treadonly domainUsed: string | undefined;\n\treadonly fallback: boolean;\n\treadonly warnings: readonly string[];\n\treadonly trace: CompositionTrace | undefined;\n}\n\nexport interface DomainDispatchRuntimeSessionOptions {\n\treadonly baseToolNames: readonly string[];\n\treadonly resourceLoader: ResourceLoader;\n\treadonly customTools?: readonly ToolDefinition[];\n\treadonly allowedToolNames?: readonly string[];\n\treadonly excludedToolNames?: readonly string[];\n}\n\nexport function createDomainDispatchRuntimeSession(\n\toptions: DomainDispatchRuntimeSessionOptions,\n): LoadoutRuntimeSession {\n\tconst allowedToolNameSet = options.allowedToolNames ? new Set(options.allowedToolNames) : undefined;\n\tconst excludedToolNameSet = options.excludedToolNames ? new Set(options.excludedToolNames) : undefined;\n\tconst isAllowedTool = (name: string): boolean =>\n\t\t(!allowedToolNameSet || allowedToolNameSet.has(name)) && !excludedToolNameSet?.has(name);\n\n\tconst base = new Map<string, ToolDefinition>();\n\tfor (const name of uniqueSorted(options.baseToolNames).filter(isAllowedTool)) {\n\t\tbase.set(name, { name } as unknown as ToolDefinition);\n\t}\n\n\tconst extensionToolsByName = new Map<string, RegisteredTool>();\n\tfor (const extension of options.resourceLoader.getExtensions().extensions) {\n\t\tfor (const tool of extension.tools.values()) {\n\t\t\tconst name = tool.definition.name;\n\t\t\tif (isAllowedTool(name) && !extensionToolsByName.has(name)) {\n\t\t\t\textensionToolsByName.set(name, tool);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\t_baseToolDefinitions: base,\n\t\t_extensionRunner: { getAllRegisteredTools: () => [...extensionToolsByName.values()] },\n\t\t_customTools: [...(options.customTools ?? [])].filter((tool) => isAllowedTool(tool.name)),\n\t};\n}\n\nexport function isDomainRoutingEnabled(\n\tenv: NodeJS.ProcessEnv | Readonly<Record<string, string | undefined>> = process.env,\n): boolean {\n\treturn env.OMK_DOMAIN_ROUTING === \"1\";\n}\n\nexport function tryDomainDispatch(input: DomainDispatchInput): DomainDispatchResult {\n\tif (!isDomainRoutingEnabled(input.env)) {\n\t\treturn noPolicy(false, [], undefined, undefined);\n\t}\n\n\tlet domainUsed: string | undefined;\n\tlet trace: CompositionTrace | undefined;\n\ttry {\n\t\tconst route = routeDomain({ task: input.initialPrompt });\n\t\tdomainUsed = route.primary.id;\n\t\tconst composeOptions: ComposeLoadoutOptions = {\n\t\t\tgrantAuthority: input.grantAuthority,\n\t\t\tscopeHints: input.scopeHints,\n\t\t\troleProfileOverride: input.roleProfileOverride,\n\t\t};\n\t\tconst profile = composeLoadout(input.role, route.primary, composeOptions);\n\t\ttrace = profile.composition;\n\t\tconst state = applyLoadoutToRuntime(input.session, input.resourceLoader, input.cwd, input.agentDir, {\n\t\t\tprofile,\n\t\t\trole: input.role,\n\t\t\tgrantAuthority: input.grantAuthority,\n\t\t\tassignedReadPaths: input.scopeHints?.readScope,\n\t\t\tassignedWritePaths: input.scopeHints?.writeScope,\n\t\t});\n\t\tconst policy = createPolicyOrThrow(state, profile.commands, input.cwd, input.blockedPaths);\n\t\tconst integrity = validatePolicyIntegrity(policy, state);\n\t\treturn {\n\t\t\tloadoutAccessPolicy: policy,\n\t\t\tdomainUsed,\n\t\t\tfallback: route.confidence === \"fallback\",\n\t\t\twarnings: uniqueSorted([\n\t\t\t\t...routeWarnings(route),\n\t\t\t\t...profile.composition.warnings,\n\t\t\t\t...state.warnings,\n\t\t\t\t...integrity.warnings,\n\t\t\t]),\n\t\t\ttrace,\n\t\t};\n\t} catch (error) {\n\t\treturn noPolicy(true, [errorMessage(error)], domainUsed, trace);\n\t}\n}\n\nfunction createPolicyOrThrow(\n\tstate: LoadoutRuntimeState,\n\tcommands: LoadoutProfile[\"commands\"],\n\tcwd: string,\n\tblockedPaths: readonly string[] | undefined,\n): LoadoutAccessPolicy {\n\treturn createLoadoutPolicyFromRuntimeState(state, {\n\t\tcwd,\n\t\tblockedPaths,\n\t\tcommands,\n\t});\n}\n\nfunction noPolicy(\n\tfallback: boolean,\n\twarnings: readonly string[],\n\tdomainUsed: string | undefined,\n\ttrace: CompositionTrace | undefined,\n): DomainDispatchResult {\n\treturn {\n\t\tloadoutAccessPolicy: undefined,\n\t\tdomainUsed,\n\t\tfallback,\n\t\twarnings: uniqueSorted(warnings),\n\t\ttrace,\n\t};\n}\n\nfunction routeWarnings(route: ReturnType<typeof routeDomain>): string[] {\n\tconst warnings: string[] = [];\n\tif (route.ambiguous) warnings.push(route.reason);\n\tif (route.confidence === \"fallback\") warnings.push(route.reason);\n\treturn warnings;\n}\n\nfunction errorMessage(error: unknown): string {\n\tif (error instanceof Error) return error.message;\n\treturn String(error);\n}\n\nfunction uniqueSorted(values: readonly string[]): string[] {\n\treturn [...new Set(values.map((value) => value.trim()).filter((value) => value !== \"\"))].sort((a, b) => {\n\t\tif (a < b) return -1;\n\t\tif (a > b) return 1;\n\t\treturn 0;\n\t});\n}\n"]}
1
+ {"version":3,"file":"domain-dispatch.js","sourceRoot":"","sources":["../../src/core/domain-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO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CAAC;QACrB,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,CAAC;QACpB,OAAO,CAAC,CAAC;IAAA,CACT,CAAC,CAAC;AAAA,CACH","sourcesContent":["/**\n * Opt-in domain dispatch orchestration.\n *\n * Callers can invoke it to route an initial prompt, compose a role/domain\n * loadout, apply it to the current runtime inventory, and receive an access\n * policy suitable for existing AgentSession enforcement.\n */\n\nimport { routeDomain } from \"./domain-router.ts\";\nimport type { RegisteredTool, ToolDefinition } from \"./extensions/types.ts\";\nimport type { LoadoutAccessPolicy } from \"./loadout-access-policy.ts\";\nimport {\n\ttype ComposeLoadoutOptions,\n\ttype CompositionTrace,\n\tcomposeLoadout,\n\ttype ScopeHints,\n} from \"./loadout-compose.ts\";\nimport { createLoadoutPolicyFromRuntimeState, validatePolicyIntegrity } from \"./loadout-policy-bridge.ts\";\nimport { applyLoadoutToRuntime, type LoadoutRuntimeSession, type LoadoutRuntimeState } from \"./loadout-runtime.ts\";\nimport type { LoadoutAuthority, LoadoutProfile, LoadoutRole } from \"./loadouts.ts\";\nimport type { ProviderHarnessRuntime } from \"./provider-harness-dispatch.ts\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\n\n/** Real loadout runtime entry points for provider-harness dispatch (`tryProviderHarnessDispatch`). */\nexport const LOADOUT_HARNESS_RUNTIME: ProviderHarnessRuntime<\n\tLoadoutRuntimeSession,\n\tResourceLoader,\n\tLoadoutRuntimeState\n> = {\n\tapplyLoadoutToRuntime,\n\tcreateLoadoutPolicyFromRuntimeState,\n};\n\nexport interface DomainDispatchInput {\n\treadonly role: LoadoutRole;\n\treadonly initialPrompt: string;\n\treadonly session: LoadoutRuntimeSession;\n\treadonly resourceLoader: ResourceLoader;\n\treadonly cwd: string;\n\treadonly agentDir: string;\n\treadonly grantAuthority?: LoadoutAuthority;\n\treadonly scopeHints?: ScopeHints;\n\treadonly env?: NodeJS.ProcessEnv | Readonly<Record<string, string | undefined>>;\n\treadonly roleProfileOverride?: LoadoutProfile;\n\treadonly blockedPaths?: readonly string[];\n}\n\nexport interface DomainDispatchResult {\n\treadonly loadoutAccessPolicy: LoadoutAccessPolicy | undefined;\n\treadonly domainUsed: string | undefined;\n\treadonly fallback: boolean;\n\treadonly warnings: readonly string[];\n\treadonly trace: CompositionTrace | undefined;\n}\n\nexport interface DomainDispatchRuntimeSessionOptions {\n\treadonly baseToolNames: readonly string[];\n\treadonly resourceLoader: ResourceLoader;\n\treadonly customTools?: readonly ToolDefinition[];\n\treadonly allowedToolNames?: readonly string[];\n\treadonly excludedToolNames?: readonly string[];\n}\n\nexport function createDomainDispatchRuntimeSession(\n\toptions: DomainDispatchRuntimeSessionOptions,\n): LoadoutRuntimeSession {\n\tconst allowedToolNameSet = options.allowedToolNames ? new Set(options.allowedToolNames) : undefined;\n\tconst excludedToolNameSet = options.excludedToolNames ? new Set(options.excludedToolNames) : undefined;\n\tconst isAllowedTool = (name: string): boolean =>\n\t\t(!allowedToolNameSet || allowedToolNameSet.has(name)) && !excludedToolNameSet?.has(name);\n\n\tconst base = new Map<string, ToolDefinition>();\n\tfor (const name of uniqueSorted(options.baseToolNames).filter(isAllowedTool)) {\n\t\tbase.set(name, { name } as unknown as ToolDefinition);\n\t}\n\n\tconst extensionToolsByName = new Map<string, RegisteredTool>();\n\tfor (const extension of options.resourceLoader.getExtensions().extensions) {\n\t\tfor (const tool of extension.tools.values()) {\n\t\t\tconst name = tool.definition.name;\n\t\t\tif (isAllowedTool(name) && !extensionToolsByName.has(name)) {\n\t\t\t\textensionToolsByName.set(name, tool);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\t_baseToolDefinitions: base,\n\t\t_extensionRunner: { getAllRegisteredTools: () => [...extensionToolsByName.values()] },\n\t\t_customTools: [...(options.customTools ?? [])].filter((tool) => isAllowedTool(tool.name)),\n\t};\n}\n\nexport function isDomainRoutingEnabled(\n\tenv: NodeJS.ProcessEnv | Readonly<Record<string, string | undefined>> = process.env,\n): boolean {\n\treturn env.OMK_DOMAIN_ROUTING === \"1\";\n}\n\nexport function tryDomainDispatch(input: DomainDispatchInput): DomainDispatchResult {\n\tif (!isDomainRoutingEnabled(input.env)) {\n\t\treturn noPolicy(false, [], undefined, undefined);\n\t}\n\n\tlet domainUsed: string | undefined;\n\tlet trace: CompositionTrace | undefined;\n\ttry {\n\t\tconst route = routeDomain({ task: input.initialPrompt });\n\t\tdomainUsed = route.primary.id;\n\t\tconst composeOptions: ComposeLoadoutOptions = {\n\t\t\tgrantAuthority: input.grantAuthority,\n\t\t\tscopeHints: input.scopeHints,\n\t\t\troleProfileOverride: input.roleProfileOverride,\n\t\t};\n\t\tconst profile = composeLoadout(input.role, route.primary, composeOptions);\n\t\ttrace = profile.composition;\n\t\tconst state = applyLoadoutToRuntime(input.session, input.resourceLoader, input.cwd, input.agentDir, {\n\t\t\tprofile,\n\t\t\trole: input.role,\n\t\t\tgrantAuthority: input.grantAuthority,\n\t\t\tassignedReadPaths: input.scopeHints?.readScope,\n\t\t\tassignedWritePaths: input.scopeHints?.writeScope,\n\t\t});\n\t\tconst policy = createPolicyOrThrow(state, profile.commands, input.cwd, input.blockedPaths);\n\t\tconst integrity = validatePolicyIntegrity(policy, state);\n\t\treturn {\n\t\t\tloadoutAccessPolicy: policy,\n\t\t\tdomainUsed,\n\t\t\tfallback: route.confidence === \"fallback\",\n\t\t\twarnings: uniqueSorted([\n\t\t\t\t...routeWarnings(route),\n\t\t\t\t...profile.composition.warnings,\n\t\t\t\t...state.warnings,\n\t\t\t\t...integrity.warnings,\n\t\t\t]),\n\t\t\ttrace,\n\t\t};\n\t} catch (error) {\n\t\treturn noPolicy(true, [errorMessage(error)], domainUsed, trace);\n\t}\n}\n\nfunction createPolicyOrThrow(\n\tstate: LoadoutRuntimeState,\n\tcommands: LoadoutProfile[\"commands\"],\n\tcwd: string,\n\tblockedPaths: readonly string[] | undefined,\n): LoadoutAccessPolicy {\n\treturn createLoadoutPolicyFromRuntimeState(state, {\n\t\tcwd,\n\t\tblockedPaths,\n\t\tcommands,\n\t});\n}\n\nfunction noPolicy(\n\tfallback: boolean,\n\twarnings: readonly string[],\n\tdomainUsed: string | undefined,\n\ttrace: CompositionTrace | undefined,\n): DomainDispatchResult {\n\treturn {\n\t\tloadoutAccessPolicy: undefined,\n\t\tdomainUsed,\n\t\tfallback,\n\t\twarnings: uniqueSorted(warnings),\n\t\ttrace,\n\t};\n}\n\nfunction routeWarnings(route: ReturnType<typeof routeDomain>): string[] {\n\tconst warnings: string[] = [];\n\tif (route.ambiguous) warnings.push(route.reason);\n\tif (route.confidence === \"fallback\") warnings.push(route.reason);\n\treturn warnings;\n}\n\nfunction errorMessage(error: unknown): string {\n\tif (error instanceof Error) return error.message;\n\treturn String(error);\n}\n\nfunction uniqueSorted(values: readonly string[]): string[] {\n\treturn [...new Set(values.map((value) => value.trim()).filter((value) => value !== \"\"))].sort((a, b) => {\n\t\tif (a < b) return -1;\n\t\tif (a > b) return 1;\n\t\treturn 0;\n\t});\n}\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Provider-harness domain profiles: `grok-harness` (native `xai`) and
3
+ * `devin-harness` (Devin SWE-2). They are registered in `DOMAIN_PROFILES`
4
+ * by `domain-loadouts.ts` and auto-applied by the provider harness dispatch
5
+ * without requiring `OMK_DOMAIN_ROUTING=1`.
6
+ *
7
+ * I/O-free and side-effect-free; erasable TypeScript only.
8
+ */
9
+ import type { DomainProfile } from "./domain-profile.ts";
10
+ export declare const GROK_HARNESS_PROFILE: DomainProfile;
11
+ export declare const DEVIN_HARNESS_PROFILE: DomainProfile;
12
+ //# sourceMappingURL=domain-loadouts-provider-harness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-loadouts-provider-harness.d.ts","sourceRoot":"","sources":["../../src/core/domain-loadouts-provider-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAazD,eAAO,MAAM,oBAAoB,EAAE,aAuDlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,aAiDnC,CAAC","sourcesContent":["/**\n * Provider-harness domain profiles: `grok-harness` (native `xai`) and\n * `devin-harness` (Devin SWE-2). They are registered in `DOMAIN_PROFILES`\n * by `domain-loadouts.ts` and auto-applied by the provider harness dispatch\n * without requiring `OMK_DOMAIN_ROUTING=1`.\n *\n * I/O-free and side-effect-free; erasable TypeScript only.\n */\n\nimport type { DomainProfile } from \"./domain-profile.ts\";\nimport type { CapabilityGate, LoadoutCommands, ToolGate } from \"./loadouts.ts\";\n\nconst WRITE_TOOLS: ToolGate = { allow: [\"read\", \"grep\", \"find\", \"ls\", \"edit\", \"write\", \"bash\"] };\n\nfunction gate(kind: \"skill\" | \"mcp\" | \"hook\", names: readonly string[]): CapabilityGate {\n\treturn { allow: [{ kind, names }] };\n}\n\nfunction commands(mode: LoadoutCommands[\"mode\"]): LoadoutCommands {\n\treturn { mode };\n}\n\nexport const GROK_HARNESS_PROFILE: DomainProfile = {\n\tschemaVersion: \"omk.loadout.v1\",\n\tid: \"grok-harness\",\n\tname: \"grok-harness\",\n\tlabel: \"Grok xAI Harness\",\n\tauthority: \"write-scoped\",\n\ttools: WRITE_TOOLS,\n\tskills: gate(\"skill\", [\n\t\t\"packages\",\n\t\t\"headroom\",\n\t\t\"programming\",\n\t\t\"debugging\",\n\t\t\"adaptorch-route\",\n\t\t\"adaptorch-synthesize\",\n\t\t\"understand-anything\",\n\t]),\n\tmcp: gate(\"mcp\", [\"adaptorch\", \"fetch\", \"understand-anything\", \"playwright\"]),\n\thooks: gate(\"hook\", [\n\t\t\"pre-shell-guard\",\n\t\t\"protect-secrets\",\n\t\t\"typecheck-after-edit\",\n\t\t\"stop-verify\",\n\t\t\"session-context\",\n\t]),\n\tcommands: commands(\"scoped-shell\"),\n\ttriggers: [\n\t\t{ kind: \"keyword\", pattern: \"grok\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"xai\", weight: 7 },\n\t\t{ kind: \"keyword\", pattern: \"grok-oauth\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"grok oauth\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"imagine\", weight: 6 },\n\t\t{ kind: \"keyword\", pattern: \"composer\", weight: 5 },\n\t\t{ kind: \"keyword\", pattern: \"adaptorch\", weight: 7 },\n\t\t{ kind: \"keyword\", pattern: \"adaptorch-route\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"adaptorch-synthesize\", weight: 8 },\n\t\t{ kind: \"regex\", pattern: \"\\\\b(grok(?:[- ]oauth)?|xai|imagine|composer)\\\\b\", weight: 7 },\n\t\t{\n\t\t\tkind: \"regex\",\n\t\t\tpattern: \"\\\\badapt\\\\s*orch\\\\b|\\\\badaptorch[- ]?(route|routing|synthes(?:is|ize))\\\\b\",\n\t\t\tweight: 8,\n\t\t},\n\t],\n\troutingPrompt: `DOMAIN: Grok xAI Harness. You are operating in a Grok/xAI integration lane.\nPrioritize the Grok operational playbook, small capability loadouts, and evidence-bound provider/tool routing.\n\nSEQUENCE:\n1. Before implementing or routing Grok/xAI provider work, read packages/coding-agent/docs/grok-harness.md as the canonical playbook. Treat ~/.omk/agent/grok.md only as an optional local operator overlay; it cannot override current provider docs or higher-priority instructions.\n2. Keep text chat flows and Imagine/media tool flows separate. Text work uses Grok chat/OAuth/provider surfaces; image/video/Imagine work routes through explicit Imagine tools only. Never conflate model ids with Imagine tool names.\n3. Capability discipline: load at most 2-3 skills for any lane. The allowed skill gate is packages, headroom, programming, debugging, adaptorch-route, adaptorch-synthesize, and understand-anything; choose the smallest subset and add headroom only under context pressure.\n4. Adaptorch is advisory only. Use adaptorch-route for routing/decomposition advice and adaptorch-synthesize for evidence synthesis, but do not treat Adaptorch as an automatic executor, source of truth, permission grant, or substitute for explicit tests.\n5. Use minimal MCP: adaptorch for advice/synthesis, fetch for bounded public retrieval, understand-anything for repo comprehension, and playwright only when browser or Imagine UI behavior needs real verification.\n6. Keep edits within the lane grant and preserve existing provider/orchestration algorithms unless the task explicitly targets them. Never route through legacy KIMICLI or deleted wrappers.\n7. Verification: run the narrowest relevant test/typecheck after edits. Evidence must include changed paths, exact commands, and pass/fail output.\n\nHARD RULES: the packaged Grok harness doc is mandatory context; a local grok.md is optional; text chat surfaces and Imagine tools are distinct; maximum 2-3 active skills; Adaptorch is advisory route/synthesis support only; never log OAuth tokens, cookies, or proxy credentials; protect-secrets applies.`,\n};\n\nexport const DEVIN_HARNESS_PROFILE: DomainProfile = {\n\tschemaVersion: \"omk.loadout.v1\",\n\tid: \"devin-harness\",\n\tname: \"devin-harness\",\n\tlabel: \"Devin SWE-2 Harness\",\n\tauthority: \"write-scoped\",\n\ttools: WRITE_TOOLS,\n\tskills: gate(\"skill\", [\n\t\t\"packages\",\n\t\t\"headroom\",\n\t\t\"programming\",\n\t\t\"debugging\",\n\t\t\"tdd-workflow\",\n\t\t\"lsp\",\n\t\t\"ast-grep\",\n\t\t\"understand-anything\",\n\t]),\n\tmcp: gate(\"mcp\", [\"fetch\", \"context7\", \"understand-anything\", \"playwright\"]),\n\thooks: gate(\"hook\", [\n\t\t\"pre-shell-guard\",\n\t\t\"protect-secrets\",\n\t\t\"typecheck-after-edit\",\n\t\t\"stop-verify\",\n\t\t\"session-context\",\n\t\t\"precompact-checkpoint\",\n\t]),\n\tcommands: commands(\"scoped-shell\"),\n\ttriggers: [\n\t\t{ kind: \"keyword\", pattern: \"devin\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"swe-2\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"swe2\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"cognition\", weight: 6 },\n\t\t{ kind: \"keyword\", pattern: \"devin cli\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"1m context\", weight: 5 },\n\t\t{ kind: \"regex\", pattern: \"\\\\b(devin|swe[- ]?2|cognition)\\\\b\", weight: 7 },\n\t],\n\troutingPrompt: `DOMAIN: Devin SWE-2 Harness. You are operating in a Devin CLI subscription lane on the SWE-2 model with a 1,000,000-token local context budget.\nPrioritize the SWE-2 operational playbook, focused exploration, small capability loadouts, and evidence-bound verification.\n\nSEQUENCE:\n1. Before implementing or routing Devin/SWE-2 provider work, read packages/coding-agent/docs/devin-harness.md as the canonical playbook. Treat ~/.omk/agent/devin.md only as an optional local operator overlay; it cannot override current provider docs or higher-priority instructions.\n2. Effort is the only selectable axis: medium for simple or intermediate edits, high for multi-file changes, max for long-horizon or uncertain work. Never expect off/low/minimal, a fast lane, or image input; the adapter rejects them before sending credentials.\n3. Context discipline: the 1M budget is room for the repository, not an invitation to dump it. Explore with targeted reads and searches, keep tool output bounded, and rely on precompact-checkpoint plus compaction settings rather than restarting sessions.\n4. Capability discipline: load at most 2-3 skills for any lane. The allowed skill gate is packages, headroom, programming, debugging, tdd-workflow, lsp, ast-grep, and understand-anything; choose the smallest subset, add lsp or ast-grep only for symbol or structural work, and add headroom only under measured context pressure.\n5. Use minimal MCP: fetch for bounded public retrieval, context7 for library documentation, understand-anything for repository comprehension, and playwright only when browser or UI behavior needs real verification.\n6. Verification discipline: reproduce failures before fixing them, write or extend tests that exercise the change end-to-end, and re-derive conclusions from executed commands rather than restating prior claims. Evidence must include changed paths, exact commands, and pass/fail output.\n7. Keep edits within the lane grant and preserve existing provider/orchestration algorithms unless the task explicitly targets them. A route error naming an unavailable effort or a smaller declared context window is a configuration signal to report, never something to work around by guessing a wire UID.\n\nHARD RULES: the packaged Devin harness doc is mandatory context; a local devin.md is optional; medium/high/max are the only efforts; the 1M budget never justifies unbounded dumps; maximum 2-3 active skills; never log the Devin session token, user JWT, or auth.json contents; protect-secrets applies.`,\n};\n"]}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Provider-harness domain profiles: `grok-harness` (native `xai`) and
3
+ * `devin-harness` (Devin SWE-2). They are registered in `DOMAIN_PROFILES`
4
+ * by `domain-loadouts.ts` and auto-applied by the provider harness dispatch
5
+ * without requiring `OMK_DOMAIN_ROUTING=1`.
6
+ *
7
+ * I/O-free and side-effect-free; erasable TypeScript only.
8
+ */
9
+ const WRITE_TOOLS = { allow: ["read", "grep", "find", "ls", "edit", "write", "bash"] };
10
+ function gate(kind, names) {
11
+ return { allow: [{ kind, names }] };
12
+ }
13
+ function commands(mode) {
14
+ return { mode };
15
+ }
16
+ export const GROK_HARNESS_PROFILE = {
17
+ schemaVersion: "omk.loadout.v1",
18
+ id: "grok-harness",
19
+ name: "grok-harness",
20
+ label: "Grok xAI Harness",
21
+ authority: "write-scoped",
22
+ tools: WRITE_TOOLS,
23
+ skills: gate("skill", [
24
+ "packages",
25
+ "headroom",
26
+ "programming",
27
+ "debugging",
28
+ "adaptorch-route",
29
+ "adaptorch-synthesize",
30
+ "understand-anything",
31
+ ]),
32
+ mcp: gate("mcp", ["adaptorch", "fetch", "understand-anything", "playwright"]),
33
+ hooks: gate("hook", [
34
+ "pre-shell-guard",
35
+ "protect-secrets",
36
+ "typecheck-after-edit",
37
+ "stop-verify",
38
+ "session-context",
39
+ ]),
40
+ commands: commands("scoped-shell"),
41
+ triggers: [
42
+ { kind: "keyword", pattern: "grok", weight: 8 },
43
+ { kind: "keyword", pattern: "xai", weight: 7 },
44
+ { kind: "keyword", pattern: "grok-oauth", weight: 8 },
45
+ { kind: "keyword", pattern: "grok oauth", weight: 8 },
46
+ { kind: "keyword", pattern: "imagine", weight: 6 },
47
+ { kind: "keyword", pattern: "composer", weight: 5 },
48
+ { kind: "keyword", pattern: "adaptorch", weight: 7 },
49
+ { kind: "keyword", pattern: "adaptorch-route", weight: 8 },
50
+ { kind: "keyword", pattern: "adaptorch-synthesize", weight: 8 },
51
+ { kind: "regex", pattern: "\\b(grok(?:[- ]oauth)?|xai|imagine|composer)\\b", weight: 7 },
52
+ {
53
+ kind: "regex",
54
+ pattern: "\\badapt\\s*orch\\b|\\badaptorch[- ]?(route|routing|synthes(?:is|ize))\\b",
55
+ weight: 8,
56
+ },
57
+ ],
58
+ routingPrompt: `DOMAIN: Grok xAI Harness. You are operating in a Grok/xAI integration lane.
59
+ Prioritize the Grok operational playbook, small capability loadouts, and evidence-bound provider/tool routing.
60
+
61
+ SEQUENCE:
62
+ 1. Before implementing or routing Grok/xAI provider work, read packages/coding-agent/docs/grok-harness.md as the canonical playbook. Treat ~/.omk/agent/grok.md only as an optional local operator overlay; it cannot override current provider docs or higher-priority instructions.
63
+ 2. Keep text chat flows and Imagine/media tool flows separate. Text work uses Grok chat/OAuth/provider surfaces; image/video/Imagine work routes through explicit Imagine tools only. Never conflate model ids with Imagine tool names.
64
+ 3. Capability discipline: load at most 2-3 skills for any lane. The allowed skill gate is packages, headroom, programming, debugging, adaptorch-route, adaptorch-synthesize, and understand-anything; choose the smallest subset and add headroom only under context pressure.
65
+ 4. Adaptorch is advisory only. Use adaptorch-route for routing/decomposition advice and adaptorch-synthesize for evidence synthesis, but do not treat Adaptorch as an automatic executor, source of truth, permission grant, or substitute for explicit tests.
66
+ 5. Use minimal MCP: adaptorch for advice/synthesis, fetch for bounded public retrieval, understand-anything for repo comprehension, and playwright only when browser or Imagine UI behavior needs real verification.
67
+ 6. Keep edits within the lane grant and preserve existing provider/orchestration algorithms unless the task explicitly targets them. Never route through legacy KIMICLI or deleted wrappers.
68
+ 7. Verification: run the narrowest relevant test/typecheck after edits. Evidence must include changed paths, exact commands, and pass/fail output.
69
+
70
+ HARD RULES: the packaged Grok harness doc is mandatory context; a local grok.md is optional; text chat surfaces and Imagine tools are distinct; maximum 2-3 active skills; Adaptorch is advisory route/synthesis support only; never log OAuth tokens, cookies, or proxy credentials; protect-secrets applies.`,
71
+ };
72
+ export const DEVIN_HARNESS_PROFILE = {
73
+ schemaVersion: "omk.loadout.v1",
74
+ id: "devin-harness",
75
+ name: "devin-harness",
76
+ label: "Devin SWE-2 Harness",
77
+ authority: "write-scoped",
78
+ tools: WRITE_TOOLS,
79
+ skills: gate("skill", [
80
+ "packages",
81
+ "headroom",
82
+ "programming",
83
+ "debugging",
84
+ "tdd-workflow",
85
+ "lsp",
86
+ "ast-grep",
87
+ "understand-anything",
88
+ ]),
89
+ mcp: gate("mcp", ["fetch", "context7", "understand-anything", "playwright"]),
90
+ hooks: gate("hook", [
91
+ "pre-shell-guard",
92
+ "protect-secrets",
93
+ "typecheck-after-edit",
94
+ "stop-verify",
95
+ "session-context",
96
+ "precompact-checkpoint",
97
+ ]),
98
+ commands: commands("scoped-shell"),
99
+ triggers: [
100
+ { kind: "keyword", pattern: "devin", weight: 8 },
101
+ { kind: "keyword", pattern: "swe-2", weight: 8 },
102
+ { kind: "keyword", pattern: "swe2", weight: 8 },
103
+ { kind: "keyword", pattern: "cognition", weight: 6 },
104
+ { kind: "keyword", pattern: "devin cli", weight: 8 },
105
+ { kind: "keyword", pattern: "1m context", weight: 5 },
106
+ { kind: "regex", pattern: "\\b(devin|swe[- ]?2|cognition)\\b", weight: 7 },
107
+ ],
108
+ routingPrompt: `DOMAIN: Devin SWE-2 Harness. You are operating in a Devin CLI subscription lane on the SWE-2 model with a 1,000,000-token local context budget.
109
+ Prioritize the SWE-2 operational playbook, focused exploration, small capability loadouts, and evidence-bound verification.
110
+
111
+ SEQUENCE:
112
+ 1. Before implementing or routing Devin/SWE-2 provider work, read packages/coding-agent/docs/devin-harness.md as the canonical playbook. Treat ~/.omk/agent/devin.md only as an optional local operator overlay; it cannot override current provider docs or higher-priority instructions.
113
+ 2. Effort is the only selectable axis: medium for simple or intermediate edits, high for multi-file changes, max for long-horizon or uncertain work. Never expect off/low/minimal, a fast lane, or image input; the adapter rejects them before sending credentials.
114
+ 3. Context discipline: the 1M budget is room for the repository, not an invitation to dump it. Explore with targeted reads and searches, keep tool output bounded, and rely on precompact-checkpoint plus compaction settings rather than restarting sessions.
115
+ 4. Capability discipline: load at most 2-3 skills for any lane. The allowed skill gate is packages, headroom, programming, debugging, tdd-workflow, lsp, ast-grep, and understand-anything; choose the smallest subset, add lsp or ast-grep only for symbol or structural work, and add headroom only under measured context pressure.
116
+ 5. Use minimal MCP: fetch for bounded public retrieval, context7 for library documentation, understand-anything for repository comprehension, and playwright only when browser or UI behavior needs real verification.
117
+ 6. Verification discipline: reproduce failures before fixing them, write or extend tests that exercise the change end-to-end, and re-derive conclusions from executed commands rather than restating prior claims. Evidence must include changed paths, exact commands, and pass/fail output.
118
+ 7. Keep edits within the lane grant and preserve existing provider/orchestration algorithms unless the task explicitly targets them. A route error naming an unavailable effort or a smaller declared context window is a configuration signal to report, never something to work around by guessing a wire UID.
119
+
120
+ HARD RULES: the packaged Devin harness doc is mandatory context; a local devin.md is optional; medium/high/max are the only efforts; the 1M budget never justifies unbounded dumps; maximum 2-3 active skills; never log the Devin session token, user JWT, or auth.json contents; protect-secrets applies.`,
121
+ };
122
+ //# sourceMappingURL=domain-loadouts-provider-harness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-loadouts-provider-harness.js","sourceRoot":"","sources":["../../src/core/domain-loadouts-provider-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,MAAM,WAAW,GAAa,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;AAEjG,SAAS,IAAI,CAAC,IAA8B,EAAE,KAAwB,EAAkB;IACvF,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAAA,CACpC;AAED,SAAS,QAAQ,CAAC,IAA6B,EAAmB;IACjE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAA,CAChB;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAkB;IAClD,aAAa,EAAE,gBAAgB;IAC/B,EAAE,EAAE,cAAc;IAClB,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,cAAc;IACzB,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE;QACrB,UAAU;QACV,UAAU;Q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E,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE;QACrD,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,mCAAmC,EAAE,MAAM,EAAE,CAAC,EAAE;KAC1E;IACD,aAAa,EAAE;;;;;;;;;;;;4SAY4R;CAC3S,CAAC","sourcesContent":["/**\n * Provider-harness domain profiles: `grok-harness` (native `xai`) and\n * `devin-harness` (Devin SWE-2). They are registered in `DOMAIN_PROFILES`\n * by `domain-loadouts.ts` and auto-applied by the provider harness dispatch\n * without requiring `OMK_DOMAIN_ROUTING=1`.\n *\n * I/O-free and side-effect-free; erasable TypeScript only.\n */\n\nimport type { DomainProfile } from \"./domain-profile.ts\";\nimport type { CapabilityGate, LoadoutCommands, ToolGate } from \"./loadouts.ts\";\n\nconst WRITE_TOOLS: ToolGate = { allow: [\"read\", \"grep\", \"find\", \"ls\", \"edit\", \"write\", \"bash\"] };\n\nfunction gate(kind: \"skill\" | \"mcp\" | \"hook\", names: readonly string[]): CapabilityGate {\n\treturn { allow: [{ kind, names }] };\n}\n\nfunction commands(mode: LoadoutCommands[\"mode\"]): LoadoutCommands {\n\treturn { mode };\n}\n\nexport const GROK_HARNESS_PROFILE: DomainProfile = {\n\tschemaVersion: \"omk.loadout.v1\",\n\tid: \"grok-harness\",\n\tname: \"grok-harness\",\n\tlabel: \"Grok xAI Harness\",\n\tauthority: \"write-scoped\",\n\ttools: WRITE_TOOLS,\n\tskills: gate(\"skill\", [\n\t\t\"packages\",\n\t\t\"headroom\",\n\t\t\"programming\",\n\t\t\"debugging\",\n\t\t\"adaptorch-route\",\n\t\t\"adaptorch-synthesize\",\n\t\t\"understand-anything\",\n\t]),\n\tmcp: gate(\"mcp\", [\"adaptorch\", \"fetch\", \"understand-anything\", \"playwright\"]),\n\thooks: gate(\"hook\", [\n\t\t\"pre-shell-guard\",\n\t\t\"protect-secrets\",\n\t\t\"typecheck-after-edit\",\n\t\t\"stop-verify\",\n\t\t\"session-context\",\n\t]),\n\tcommands: commands(\"scoped-shell\"),\n\ttriggers: [\n\t\t{ kind: \"keyword\", pattern: \"grok\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"xai\", weight: 7 },\n\t\t{ kind: \"keyword\", pattern: \"grok-oauth\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"grok oauth\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"imagine\", weight: 6 },\n\t\t{ kind: \"keyword\", pattern: \"composer\", weight: 5 },\n\t\t{ kind: \"keyword\", pattern: \"adaptorch\", weight: 7 },\n\t\t{ kind: \"keyword\", pattern: \"adaptorch-route\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"adaptorch-synthesize\", weight: 8 },\n\t\t{ kind: \"regex\", pattern: \"\\\\b(grok(?:[- ]oauth)?|xai|imagine|composer)\\\\b\", weight: 7 },\n\t\t{\n\t\t\tkind: \"regex\",\n\t\t\tpattern: \"\\\\badapt\\\\s*orch\\\\b|\\\\badaptorch[- ]?(route|routing|synthes(?:is|ize))\\\\b\",\n\t\t\tweight: 8,\n\t\t},\n\t],\n\troutingPrompt: `DOMAIN: Grok xAI Harness. You are operating in a Grok/xAI integration lane.\nPrioritize the Grok operational playbook, small capability loadouts, and evidence-bound provider/tool routing.\n\nSEQUENCE:\n1. Before implementing or routing Grok/xAI provider work, read packages/coding-agent/docs/grok-harness.md as the canonical playbook. Treat ~/.omk/agent/grok.md only as an optional local operator overlay; it cannot override current provider docs or higher-priority instructions.\n2. Keep text chat flows and Imagine/media tool flows separate. Text work uses Grok chat/OAuth/provider surfaces; image/video/Imagine work routes through explicit Imagine tools only. Never conflate model ids with Imagine tool names.\n3. Capability discipline: load at most 2-3 skills for any lane. The allowed skill gate is packages, headroom, programming, debugging, adaptorch-route, adaptorch-synthesize, and understand-anything; choose the smallest subset and add headroom only under context pressure.\n4. Adaptorch is advisory only. Use adaptorch-route for routing/decomposition advice and adaptorch-synthesize for evidence synthesis, but do not treat Adaptorch as an automatic executor, source of truth, permission grant, or substitute for explicit tests.\n5. Use minimal MCP: adaptorch for advice/synthesis, fetch for bounded public retrieval, understand-anything for repo comprehension, and playwright only when browser or Imagine UI behavior needs real verification.\n6. Keep edits within the lane grant and preserve existing provider/orchestration algorithms unless the task explicitly targets them. Never route through legacy KIMICLI or deleted wrappers.\n7. Verification: run the narrowest relevant test/typecheck after edits. Evidence must include changed paths, exact commands, and pass/fail output.\n\nHARD RULES: the packaged Grok harness doc is mandatory context; a local grok.md is optional; text chat surfaces and Imagine tools are distinct; maximum 2-3 active skills; Adaptorch is advisory route/synthesis support only; never log OAuth tokens, cookies, or proxy credentials; protect-secrets applies.`,\n};\n\nexport const DEVIN_HARNESS_PROFILE: DomainProfile = {\n\tschemaVersion: \"omk.loadout.v1\",\n\tid: \"devin-harness\",\n\tname: \"devin-harness\",\n\tlabel: \"Devin SWE-2 Harness\",\n\tauthority: \"write-scoped\",\n\ttools: WRITE_TOOLS,\n\tskills: gate(\"skill\", [\n\t\t\"packages\",\n\t\t\"headroom\",\n\t\t\"programming\",\n\t\t\"debugging\",\n\t\t\"tdd-workflow\",\n\t\t\"lsp\",\n\t\t\"ast-grep\",\n\t\t\"understand-anything\",\n\t]),\n\tmcp: gate(\"mcp\", [\"fetch\", \"context7\", \"understand-anything\", \"playwright\"]),\n\thooks: gate(\"hook\", [\n\t\t\"pre-shell-guard\",\n\t\t\"protect-secrets\",\n\t\t\"typecheck-after-edit\",\n\t\t\"stop-verify\",\n\t\t\"session-context\",\n\t\t\"precompact-checkpoint\",\n\t]),\n\tcommands: commands(\"scoped-shell\"),\n\ttriggers: [\n\t\t{ kind: \"keyword\", pattern: \"devin\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"swe-2\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"swe2\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"cognition\", weight: 6 },\n\t\t{ kind: \"keyword\", pattern: \"devin cli\", weight: 8 },\n\t\t{ kind: \"keyword\", pattern: \"1m context\", weight: 5 },\n\t\t{ kind: \"regex\", pattern: \"\\\\b(devin|swe[- ]?2|cognition)\\\\b\", weight: 7 },\n\t],\n\troutingPrompt: `DOMAIN: Devin SWE-2 Harness. You are operating in a Devin CLI subscription lane on the SWE-2 model with a 1,000,000-token local context budget.\nPrioritize the SWE-2 operational playbook, focused exploration, small capability loadouts, and evidence-bound verification.\n\nSEQUENCE:\n1. Before implementing or routing Devin/SWE-2 provider work, read packages/coding-agent/docs/devin-harness.md as the canonical playbook. Treat ~/.omk/agent/devin.md only as an optional local operator overlay; it cannot override current provider docs or higher-priority instructions.\n2. Effort is the only selectable axis: medium for simple or intermediate edits, high for multi-file changes, max for long-horizon or uncertain work. Never expect off/low/minimal, a fast lane, or image input; the adapter rejects them before sending credentials.\n3. Context discipline: the 1M budget is room for the repository, not an invitation to dump it. Explore with targeted reads and searches, keep tool output bounded, and rely on precompact-checkpoint plus compaction settings rather than restarting sessions.\n4. Capability discipline: load at most 2-3 skills for any lane. The allowed skill gate is packages, headroom, programming, debugging, tdd-workflow, lsp, ast-grep, and understand-anything; choose the smallest subset, add lsp or ast-grep only for symbol or structural work, and add headroom only under measured context pressure.\n5. Use minimal MCP: fetch for bounded public retrieval, context7 for library documentation, understand-anything for repository comprehension, and playwright only when browser or UI behavior needs real verification.\n6. Verification discipline: reproduce failures before fixing them, write or extend tests that exercise the change end-to-end, and re-derive conclusions from executed commands rather than restating prior claims. Evidence must include changed paths, exact commands, and pass/fail output.\n7. Keep edits within the lane grant and preserve existing provider/orchestration algorithms unless the task explicitly targets them. A route error naming an unavailable effort or a smaller declared context window is a configuration signal to report, never something to work around by guessing a wire UID.\n\nHARD RULES: the packaged Devin harness doc is mandatory context; a local devin.md is optional; medium/high/max are the only efforts; the 1M budget never justifies unbounded dumps; maximum 2-3 active skills; never log the Devin session token, user JWT, or auth.json contents; protect-secrets applies.`,\n};\n"]}
@@ -21,40 +21,9 @@
21
21
  *
22
22
  * Erasable TypeScript only (no enum/namespace/parameter properties).
23
23
  */
24
+ import type { DomainProfile } from "./domain-profile.ts";
24
25
  import type { LoadoutProfile } from "./loadouts.ts";
25
- /** Signal kinds the router evaluates. */
26
- export type TriggerKind = "keyword" | "regex" | "extension" | "path";
27
- /**
28
- * One routing signal for a domain.
29
- *
30
- * - `keyword`: case-insensitive, word-boundary substring of the task text.
31
- * Multi-word phrases are matched literally. Matched occurrences are counted
32
- * (capped) so repeated mentions raise confidence.
33
- * - `regex`: matched against the lowercased task text via RegExp. Use for
34
- * intent clusters that keywords cannot express compactly (e.g. `cve-\d`).
35
- * - `extension`: matched against the suffix of any provided path hint.
36
- * - `path`: glob fragment matched against any provided path hint.
37
- */
38
- export interface TriggerSpec {
39
- readonly kind: TriggerKind;
40
- readonly pattern: string;
41
- readonly weight: number;
42
- }
43
- /** Domain routing + identity metadata layered on top of a LoadoutProfile. */
44
- export interface DomainProfile extends LoadoutProfile {
45
- /** Stable domain id, e.g. "frontend-ui". Used as the registry key. */
46
- readonly id: string;
47
- /** Human label, e.g. "Frontend & UI". */
48
- readonly label: string;
49
- /** Deterministic routing signals consumed by `domain-router.ts`. */
50
- readonly triggers: readonly TriggerSpec[];
51
- /**
52
- * Detailed English routing prompt. When the router selects this domain, the
53
- * orchestrator prepends this to the lane's task prompt so the model knows
54
- * exactly which capabilities to lean on and how to sequence the work.
55
- */
56
- readonly routingPrompt: string;
57
- }
26
+ export type { DomainProfile, TriggerKind, TriggerSpec } from "./domain-profile.ts";
58
27
  /**
59
28
  * All domain profiles, keyed by id. Order is intentional only for human reading;
60
29
  * the router scores every entry independently.