@bastani/atomic 0.9.80-alpha.1 → 0.9.81-alpha.1

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 (153) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  3. package/dist/builtin/intercom/broker/client.ts +12 -1
  4. package/dist/builtin/intercom/index.bundle.mjs +16 -4
  5. package/dist/builtin/intercom/package.json +1 -1
  6. package/dist/builtin/mcp/package.json +1 -1
  7. package/dist/builtin/subagents/CHANGELOG.md +10 -0
  8. package/dist/builtin/subagents/package.json +1 -1
  9. package/dist/builtin/subagents/skills/agent-desktop/SKILL.md +40 -2
  10. package/dist/builtin/subagents/src/extension/index.bundle.mjs +123 -25
  11. package/dist/builtin/web-access/package.json +1 -1
  12. package/dist/builtin/workflows/CHANGELOG.md +20 -0
  13. package/dist/builtin/workflows/builtin/{chunk-m56qhe4b.js → chunk-zpkcqyhr.js} +2 -0
  14. package/dist/builtin/workflows/builtin/index.js +1 -1
  15. package/dist/builtin/workflows/builtin/ralph.js +1 -1
  16. package/dist/builtin/workflows/package.json +1 -1
  17. package/dist/builtin/workflows/src/extension/index.bundle.mjs +16 -4
  18. package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +12 -2
  19. package/dist/builtin/workflows/src/index.js +12 -2
  20. package/dist/builtin/workflows/src/local-worker-entry.mjs +12 -2
  21. package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +8 -1
  22. package/dist/cli/args.d.ts.map +1 -1
  23. package/dist/cli/args.js +4 -2
  24. package/dist/cli/args.js.map +1 -1
  25. package/dist/core/cache-stats.d.ts +21 -0
  26. package/dist/core/cache-stats.d.ts.map +1 -1
  27. package/dist/core/cache-stats.js +42 -2
  28. package/dist/core/cache-stats.js.map +1 -1
  29. package/dist/core/exec.d.ts +1 -0
  30. package/dist/core/exec.d.ts.map +1 -1
  31. package/dist/core/exec.js +2 -1
  32. package/dist/core/exec.js.map +1 -1
  33. package/dist/core/execution-model-router.d.ts +17 -0
  34. package/dist/core/execution-model-router.d.ts.map +1 -1
  35. package/dist/core/execution-model-router.js +52 -23
  36. package/dist/core/execution-model-router.js.map +1 -1
  37. package/dist/core/model-fallback-failures.d.ts.map +1 -1
  38. package/dist/core/model-fallback-failures.js +1 -0
  39. package/dist/core/model-fallback-failures.js.map +1 -1
  40. package/dist/core/model-resolver-scope.d.ts +0 -1
  41. package/dist/core/model-resolver-scope.d.ts.map +1 -1
  42. package/dist/core/model-resolver-scope.js +0 -8
  43. package/dist/core/model-resolver-scope.js.map +1 -1
  44. package/dist/core/model-resolver.d.ts +1 -1
  45. package/dist/core/model-resolver.d.ts.map +1 -1
  46. package/dist/core/model-resolver.js +1 -1
  47. package/dist/core/model-resolver.js.map +1 -1
  48. package/dist/core/model-routing-candidates.d.ts +30 -5
  49. package/dist/core/model-routing-candidates.d.ts.map +1 -1
  50. package/dist/core/model-routing-candidates.js +381 -105
  51. package/dist/core/model-routing-candidates.js.map +1 -1
  52. package/dist/core/model-routing-estimates.d.ts +70 -0
  53. package/dist/core/model-routing-estimates.d.ts.map +1 -0
  54. package/dist/core/model-routing-estimates.js +244 -0
  55. package/dist/core/model-routing-estimates.js.map +1 -0
  56. package/dist/core/model-routing-needs.d.ts +1 -0
  57. package/dist/core/model-routing-needs.d.ts.map +1 -1
  58. package/dist/core/model-routing-needs.js +1 -1
  59. package/dist/core/model-routing-needs.js.map +1 -1
  60. package/dist/core/provider-display-names.js +2 -2
  61. package/dist/core/provider-display-names.js.map +1 -1
  62. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  63. package/dist/core/remote-catalog-provider.js +6 -0
  64. package/dist/core/remote-catalog-provider.js.map +1 -1
  65. package/dist/core/storage/session/released-history-files.d.ts.map +1 -1
  66. package/dist/core/storage/session/released-history-files.js +5 -0
  67. package/dist/core/storage/session/released-history-files.js.map +1 -1
  68. package/dist/core/tasks/supervisor.d.ts +1 -1
  69. package/dist/core/tasks/supervisor.d.ts.map +1 -1
  70. package/dist/core/tasks/supervisor.js.map +1 -1
  71. package/dist/core/tools/find.d.ts.map +1 -1
  72. package/dist/core/tools/find.js +20 -11
  73. package/dist/core/tools/find.js.map +1 -1
  74. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  75. package/dist/core/tools/output-accumulator.js +2 -1
  76. package/dist/core/tools/output-accumulator.js.map +1 -1
  77. package/dist/index.d.ts +1 -1
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js.map +1 -1
  80. package/dist/main.d.ts.map +1 -1
  81. package/dist/main.js +30 -10
  82. package/dist/main.js.map +1 -1
  83. package/dist/modes/interactive/components/chat-session-host-actions.d.ts +5 -0
  84. package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
  85. package/dist/modes/interactive/components/chat-session-host-actions.js +86 -9
  86. package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
  87. package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
  88. package/dist/modes/interactive/components/chat-session-host-events.js +6 -3
  89. package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
  90. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
  91. package/dist/modes/interactive/components/chat-session-host-rendering.js +5 -2
  92. package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
  93. package/dist/modes/interactive/components/chat-session-host-state.d.ts +5 -0
  94. package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
  95. package/dist/modes/interactive/components/chat-session-host-state.js +2 -0
  96. package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
  97. package/dist/modes/interactive/components/footer.d.ts +4 -2
  98. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  99. package/dist/modes/interactive/components/footer.js +11 -4
  100. package/dist/modes/interactive/components/footer.js.map +1 -1
  101. package/dist/modes/interactive/components/session-selector-list.d.ts +4 -1
  102. package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
  103. package/dist/modes/interactive/components/session-selector-list.js +24 -1
  104. package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
  105. package/dist/modes/interactive/components/session-selector.d.ts +1 -0
  106. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  107. package/dist/modes/interactive/components/session-selector.js +29 -36
  108. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  109. package/dist/modes/interactive/interactive-agent-events.js +6 -6
  110. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  111. package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
  112. package/dist/modes/interactive/interactive-deferred-startup.js +11 -3
  113. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  114. package/dist/modes/interactive/interactive-input-handling.js +11 -1
  115. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  116. package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
  117. package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
  118. package/dist/modes/interactive/interactive-mode-deps.js +1 -1
  119. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
  120. package/dist/modes/interactive/interactive-process-lifecycle.js +34 -7
  121. package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
  122. package/dist/modes/interactive/interactive-queueing.d.ts +24 -0
  123. package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
  124. package/dist/modes/interactive/interactive-queueing.js +61 -0
  125. package/dist/modes/interactive/interactive-queueing.js.map +1 -1
  126. package/dist/modes/interactive/interactive-render-chat.js +2 -3
  127. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  128. package/dist/modes/interactive/interactive-slash-commands.js +2 -2
  129. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  130. package/dist/modes/interactive-engine/isolated-runtime.d.ts +2 -0
  131. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  132. package/dist/modes/interactive-engine/isolated-runtime.js +10 -0
  133. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  134. package/dist/modes/rpc/rpc-mode.d.ts +2 -0
  135. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  136. package/dist/modes/rpc/rpc-mode.js +1 -0
  137. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  138. package/dist/modes/rpc/rpc-session-binding.d.ts +3 -1
  139. package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
  140. package/dist/modes/rpc/rpc-session-binding.js +4 -1
  141. package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
  142. package/docs/background-tasks.md +2 -2
  143. package/docs/extensions/api-reference.md +1 -1
  144. package/docs/models/model-selection.md +7 -7
  145. package/docs/providers.md +12 -17
  146. package/docs/skills.md +1 -1
  147. package/docs/subagents.md +3 -1
  148. package/docs/tools.md +1 -1
  149. package/docs/usage.md +1 -1
  150. package/docs/workflows/authoring.md +2 -0
  151. package/docs/workflows/operations.md +1 -1
  152. package/npm-shrinkwrap.json +57 -33
  153. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"model-resolver-scope.js","sourceRoot":"","sources":["../../src/core/model-resolver-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE7E,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAA6B,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAgBhG,SAAS,iBAAiB,CAAC,OAAe;IACzC,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,sBAAsB,CAAC,OAAe;I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B,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QACzG,CAAC;QACD,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;AACtC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACrD,QAAkB,EAClB,YAA0B;IAE1B,OAAO,2BAA2B,CAAC,QAAQ,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAC;AACnF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,QAAkB,EAAE,YAA0B;IACrF,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,gCAAgC,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACrG,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,YAAY,CAAC;AACrB,CAAC","sourcesContent":["import { type Api, type Model, modelsAreEqual } from \"@bastani/pi-ai/compat\";\nimport type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport chalk from \"chalk\";\nimport { minimatch } from \"minimatch\";\nimport { isValidThinkingLevel } from \"../cli/args.ts\";\nimport { normalizeModelReference } from \"./azure-provider-compat.js\";\nimport { type ModelReferenceResult, resolveModelReference } from \"./model-resolver-patterns.ts\";\nimport type { ScopedModel } from \"./model-resolver-types.ts\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\n\nexport interface ModelScopeDiagnostic {\n\ttype: \"warning\";\n\tcode: \"no-match\" | \"invalid-thinking-level\" | \"ambiguous\";\n\tmessage: string;\n\tpattern: string;\n}\n\nexport interface ResolveModelScopeResult {\n\tscopedModels: ScopedModel[];\n\tdiagnostics: ModelScopeDiagnostic[];\n}\n\nfunction hasGlobCharacters(pattern: string): boolean {\n\treturn pattern.includes(\"*\") || pattern.includes(\"?\") || pattern.includes(\"[\");\n}\n\nfunction parseGlobThinkingLevel(pattern: string): { globPattern: string; thinkingLevel?: ThinkingLevel } {\n\tconst colonIdx = pattern.lastIndexOf(\":\");\n\tif (colonIdx === -1) {\n\t\treturn { globPattern: pattern };\n\t}\n\n\tconst suffix = pattern.substring(colonIdx + 1);\n\tif (!isValidThinkingLevel(suffix)) {\n\t\treturn { globPattern: pattern };\n\t}\n\n\treturn { globPattern: pattern.substring(0, colonIdx), thinkingLevel: suffix };\n}\n\nfunction resolveExactReference(text: string, models: readonly Model<Api>[]): ModelReferenceResult {\n\treturn resolveModelReference({ text, thinkingSuffix: \"none\", fuzzy: false }, models, () => true);\n}\n\n/**\n * Resolve scope patterns (`--models`, `enabledModels`) to models with optional thinking levels.\n *\n * A complete literal reference is tried first, then glob patterns, then fuzzy matching with an\n * optional `:<thinking>` suffix. Every model in `models` is usable, so credentials cannot choose\n * between providers offering the same id. All of them are added, with a warning so the user can pick\n * one with `provider/id`.\n */\nexport function resolveModelScopeFromModels(\n\tpatterns: string[],\n\tmodels: readonly Model<Api>[],\n): ResolveModelScopeResult {\n\tconst scopedModels: ScopedModel[] = [];\n\tconst diagnostics: ModelScopeDiagnostic[] = [];\n\tconst add = (model: Model<Api>, thinkingLevel: ThinkingLevel | undefined) => {\n\t\tif (!scopedModels.some((scoped) => modelsAreEqual(scoped.model, model))) {\n\t\t\tscopedModels.push({ model, thinkingLevel });\n\t\t}\n\t};\n\tconst noMatch = (pattern: string) =>\n\t\tdiagnostics.push({ type: \"warning\", code: \"no-match\", message: `No models match pattern \"${pattern}\"`, pattern });\n\tconst ambiguous = (pattern: string, candidates: readonly Model<Api>[]) => {\n\t\tconst providers = [...new Set(candidates.map((model) => model.provider))].sort((a, b) => a.localeCompare(b));\n\t\tdiagnostics.push({\n\t\t\ttype: \"warning\",\n\t\t\tcode: \"ambiguous\",\n\t\t\tmessage: `Pattern \"${pattern}\" matches several providers: ${providers.join(\", \")}. Use provider/id to choose one.`,\n\t\t\tpattern,\n\t\t});\n\t};\n\tconst addResult = (\n\t\tpattern: string,\n\t\tresult: ModelReferenceResult,\n\t\tthinkingLevel: ThinkingLevel | undefined,\n\t): boolean => {\n\t\tif (result.status === \"not-found\") return false;\n\t\tif (result.status === \"ambiguous\") ambiguous(pattern, result.candidates);\n\t\tconst matches = result.status === \"resolved\" ? [result.model] : result.candidates;\n\t\tfor (const model of matches) add(model, thinkingLevel);\n\t\treturn true;\n\t};\n\n\tfor (const rawPattern of patterns) {\n\t\tconst pattern = normalizeModelReference(rawPattern);\n\t\tif (addResult(pattern, resolveExactReference(pattern, models), undefined)) continue;\n\n\t\tif (hasGlobCharacters(pattern)) {\n\t\t\tconst { globPattern, thinkingLevel } = parseGlobThinkingLevel(pattern);\n\t\t\t// Ids such as `bracketed-model[1m]` are not globs\n\t\t\tif (addResult(pattern, resolveExactReference(globPattern, models), thinkingLevel)) continue;\n\n\t\t\t// Match against \"provider/modelId\" format OR just model ID\n\t\t\t// This allows \"*sonnet*\" to match without requiring \"anthropic/*sonnet*\"\n\t\t\tconst matches = models.filter(\n\t\t\t\t(model) =>\n\t\t\t\t\tminimatch(`${model.provider}/${model.id}`, globPattern, { nocase: true }) ||\n\t\t\t\t\tminimatch(model.id, globPattern, { nocase: true }),\n\t\t\t);\n\t\t\tif (matches.length === 0) noMatch(pattern);\n\t\t\tfor (const model of matches) add(model, thinkingLevel);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst result = resolveModelReference(\n\t\t\t{ text: pattern, thinkingSuffix: \"lenient\", fuzzy: true },\n\t\t\tmodels,\n\t\t\t() => true,\n\t\t);\n\t\tif (result.status === \"not-found\") {\n\t\t\tnoMatch(pattern);\n\t\t\tcontinue;\n\t\t}\n\t\tif (result.warning) {\n\t\t\tdiagnostics.push({ type: \"warning\", code: \"invalid-thinking-level\", message: result.warning, pattern });\n\t\t}\n\t\taddResult(pattern, result, result.thinkingLevel);\n\t}\n\n\treturn { scopedModels, diagnostics };\n}\n\nexport async function resolveModelScopeWithDiagnostics(\n\tpatterns: string[],\n\tmodelRuntime: ModelRuntime,\n): Promise<ResolveModelScopeResult> {\n\treturn resolveModelScopeFromModels(patterns, modelRuntime.getAvailableSnapshot());\n}\n\nexport async function resolveModelScope(patterns: string[], modelRuntime: ModelRuntime): Promise<ScopedModel[]> {\n\tconst { scopedModels, diagnostics } = await resolveModelScopeWithDiagnostics(patterns, modelRuntime);\n\tfor (const diagnostic of diagnostics) {\n\t\tconsole.warn(chalk.yellow(`Warning: ${diagnostic.message}`));\n\t}\n\treturn scopedModels;\n}\n"]}
1
+ {"version":3,"file":"model-resolver-scope.js","sourceRoot":"","sources":["../../src/core/model-resolver-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE7E,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAA6B,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAgBhG,SAAS,iBAAiB,CAAC,OAAe;IACzC,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,sBAAsB,CAAC,OAAe;IAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC1C,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;QACrB,OAAO,EAAE,WAAW,E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QACzG,CAAC;QACD,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;AACtC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACrD,QAAkB,EAClB,YAA0B;IAE1B,OAAO,2BAA2B,CAAC,QAAQ,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAC;AACnF,CAAC","sourcesContent":["import { type Api, type Model, modelsAreEqual } from \"@bastani/pi-ai/compat\";\nimport type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport { minimatch } from \"minimatch\";\nimport { isValidThinkingLevel } from \"../cli/args.ts\";\nimport { normalizeModelReference } from \"./azure-provider-compat.js\";\nimport { type ModelReferenceResult, resolveModelReference } from \"./model-resolver-patterns.ts\";\nimport type { ScopedModel } from \"./model-resolver-types.ts\";\nimport type { ModelRuntime } from \"./model-runtime.js\";\n\nexport interface ModelScopeDiagnostic {\n\ttype: \"warning\";\n\tcode: \"no-match\" | \"invalid-thinking-level\" | \"ambiguous\";\n\tmessage: string;\n\tpattern: string;\n}\n\nexport interface ResolveModelScopeResult {\n\tscopedModels: ScopedModel[];\n\tdiagnostics: ModelScopeDiagnostic[];\n}\n\nfunction hasGlobCharacters(pattern: string): boolean {\n\treturn pattern.includes(\"*\") || pattern.includes(\"?\") || pattern.includes(\"[\");\n}\n\nfunction parseGlobThinkingLevel(pattern: string): { globPattern: string; thinkingLevel?: ThinkingLevel } {\n\tconst colonIdx = pattern.lastIndexOf(\":\");\n\tif (colonIdx === -1) {\n\t\treturn { globPattern: pattern };\n\t}\n\n\tconst suffix = pattern.substring(colonIdx + 1);\n\tif (!isValidThinkingLevel(suffix)) {\n\t\treturn { globPattern: pattern };\n\t}\n\n\treturn { globPattern: pattern.substring(0, colonIdx), thinkingLevel: suffix };\n}\n\nfunction resolveExactReference(text: string, models: readonly Model<Api>[]): ModelReferenceResult {\n\treturn resolveModelReference({ text, thinkingSuffix: \"none\", fuzzy: false }, models, () => true);\n}\n\n/**\n * Resolve scope patterns (`--models`, `enabledModels`) to models with optional thinking levels.\n *\n * A complete literal reference is tried first, then glob patterns, then fuzzy matching with an\n * optional `:<thinking>` suffix. Every model in `models` is usable, so credentials cannot choose\n * between providers offering the same id. All of them are added, with a warning so the user can pick\n * one with `provider/id`.\n */\nexport function resolveModelScopeFromModels(\n\tpatterns: string[],\n\tmodels: readonly Model<Api>[],\n): ResolveModelScopeResult {\n\tconst scopedModels: ScopedModel[] = [];\n\tconst diagnostics: ModelScopeDiagnostic[] = [];\n\tconst add = (model: Model<Api>, thinkingLevel: ThinkingLevel | undefined) => {\n\t\tif (!scopedModels.some((scoped) => modelsAreEqual(scoped.model, model))) {\n\t\t\tscopedModels.push({ model, thinkingLevel });\n\t\t}\n\t};\n\tconst noMatch = (pattern: string) =>\n\t\tdiagnostics.push({ type: \"warning\", code: \"no-match\", message: `No models match pattern \"${pattern}\"`, pattern });\n\tconst ambiguous = (pattern: string, candidates: readonly Model<Api>[]) => {\n\t\tconst providers = [...new Set(candidates.map((model) => model.provider))].sort((a, b) => a.localeCompare(b));\n\t\tdiagnostics.push({\n\t\t\ttype: \"warning\",\n\t\t\tcode: \"ambiguous\",\n\t\t\tmessage: `Pattern \"${pattern}\" matches several providers: ${providers.join(\", \")}. Use provider/id to choose one.`,\n\t\t\tpattern,\n\t\t});\n\t};\n\tconst addResult = (\n\t\tpattern: string,\n\t\tresult: ModelReferenceResult,\n\t\tthinkingLevel: ThinkingLevel | undefined,\n\t): boolean => {\n\t\tif (result.status === \"not-found\") return false;\n\t\tif (result.status === \"ambiguous\") ambiguous(pattern, result.candidates);\n\t\tconst matches = result.status === \"resolved\" ? [result.model] : result.candidates;\n\t\tfor (const model of matches) add(model, thinkingLevel);\n\t\treturn true;\n\t};\n\n\tfor (const rawPattern of patterns) {\n\t\tconst pattern = normalizeModelReference(rawPattern);\n\t\tif (addResult(pattern, resolveExactReference(pattern, models), undefined)) continue;\n\n\t\tif (hasGlobCharacters(pattern)) {\n\t\t\tconst { globPattern, thinkingLevel } = parseGlobThinkingLevel(pattern);\n\t\t\t// Ids such as `bracketed-model[1m]` are not globs\n\t\t\tif (addResult(pattern, resolveExactReference(globPattern, models), thinkingLevel)) continue;\n\n\t\t\t// Match against \"provider/modelId\" format OR just model ID\n\t\t\t// This allows \"*sonnet*\" to match without requiring \"anthropic/*sonnet*\"\n\t\t\tconst matches = models.filter(\n\t\t\t\t(model) =>\n\t\t\t\t\tminimatch(`${model.provider}/${model.id}`, globPattern, { nocase: true }) ||\n\t\t\t\t\tminimatch(model.id, globPattern, { nocase: true }),\n\t\t\t);\n\t\t\tif (matches.length === 0) noMatch(pattern);\n\t\t\tfor (const model of matches) add(model, thinkingLevel);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst result = resolveModelReference(\n\t\t\t{ text: pattern, thinkingSuffix: \"lenient\", fuzzy: true },\n\t\t\tmodels,\n\t\t\t() => true,\n\t\t);\n\t\tif (result.status === \"not-found\") {\n\t\t\tnoMatch(pattern);\n\t\t\tcontinue;\n\t\t}\n\t\tif (result.warning) {\n\t\t\tdiagnostics.push({ type: \"warning\", code: \"invalid-thinking-level\", message: result.warning, pattern });\n\t\t}\n\t\taddResult(pattern, result, result.thinkingLevel);\n\t}\n\n\treturn { scopedModels, diagnostics };\n}\n\nexport async function resolveModelScopeWithDiagnostics(\n\tpatterns: string[],\n\tmodelRuntime: ModelRuntime,\n): Promise<ResolveModelScopeResult> {\n\treturn resolveModelScopeFromModels(patterns, modelRuntime.getAvailableSnapshot());\n}\n"]}
@@ -7,6 +7,6 @@ export { findInitialModel, resolveRestoredModelReference, restoreModelFromSessio
7
7
  export type { ModelReferenceRequest, ModelReferenceResult, ModelReferenceTarget, } from "./model-resolver-patterns.ts";
8
8
  export { findExactModelReferenceMatch, resolveModelReference } from "./model-resolver-patterns.ts";
9
9
  export type { ModelScopeDiagnostic, ResolveModelScopeResult } from "./model-resolver-scope.ts";
10
- export { resolveModelScope, resolveModelScopeFromModels, resolveModelScopeWithDiagnostics, } from "./model-resolver-scope.ts";
10
+ export { resolveModelScopeFromModels, resolveModelScopeWithDiagnostics, } from "./model-resolver-scope.ts";
11
11
  export type { InitialModelResult, ResolveCliModelResult, ScopedModel, } from "./model-resolver-types.ts";
12
12
  //# sourceMappingURL=model-resolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-resolver.d.ts","sourceRoot":"","sources":["../../src/core/model-resolver.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACN,gBAAgB,EAChB,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,GACxB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACX,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACnG,YAAY,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EACN,iBAAiB,EACjB,2BAA2B,EAC3B,gCAAgC,GAChC,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACX,kBAAkB,EAClB,qBAAqB,EACrB,WAAW,GACX,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"model-resolver.d.ts","sourceRoot":"","sources":["../../src/core/model-resolver.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACN,gBAAgB,EAChB,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,GACxB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACX,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACnG,YAAY,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EACN,2BAA2B,EAC3B,gCAAgC,GAChC,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACX,kBAAkB,EAClB,qBAAqB,EACrB,WAAW,GACX,MAAM,2BAA2B,CAAC"}
@@ -5,5 +5,5 @@ export { resolveCliModel } from "./model-resolver-cli.js";
5
5
  export { defaultModelPerProvider } from "./model-resolver-defaults.js";
6
6
  export { findInitialModel, resolveRestoredModelReference, restoreModelFromSession, uncachedCopilotModelHint, } from "./model-resolver-initial.js";
7
7
  export { findExactModelReferenceMatch, resolveModelReference } from "./model-resolver-patterns.js";
8
- export { resolveModelScope, resolveModelScopeFromModels, resolveModelScopeWithDiagnostics, } from "./model-resolver-scope.js";
8
+ export { resolveModelScopeFromModels, resolveModelScopeWithDiagnostics, } from "./model-resolver-scope.js";
9
9
  //# sourceMappingURL=model-resolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-resolver.js","sourceRoot":"","sources":["../../src/core/model-resolver.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACN,gBAAgB,EAChB,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,GACxB,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAEnG,OAAO,EACN,iBAAiB,EACjB,2BAA2B,EAC3B,gCAAgC,GAChC,MAAM,2BAA2B,CAAC","sourcesContent":["/**\n * Model resolution, scoping, and initial selection\n */\n\nexport { resolveCliModel } from \"./model-resolver-cli.ts\";\nexport { defaultModelPerProvider } from \"./model-resolver-defaults.ts\";\nexport {\n\tfindInitialModel,\n\tresolveRestoredModelReference,\n\trestoreModelFromSession,\n\tuncachedCopilotModelHint,\n} from \"./model-resolver-initial.ts\";\nexport type {\n\tModelReferenceRequest,\n\tModelReferenceResult,\n\tModelReferenceTarget,\n} from \"./model-resolver-patterns.ts\";\nexport { findExactModelReferenceMatch, resolveModelReference } from \"./model-resolver-patterns.ts\";\nexport type { ModelScopeDiagnostic, ResolveModelScopeResult } from \"./model-resolver-scope.ts\";\nexport {\n\tresolveModelScope,\n\tresolveModelScopeFromModels,\n\tresolveModelScopeWithDiagnostics,\n} from \"./model-resolver-scope.ts\";\nexport type {\n\tInitialModelResult,\n\tResolveCliModelResult,\n\tScopedModel,\n} from \"./model-resolver-types.ts\";\n"]}
1
+ {"version":3,"file":"model-resolver.js","sourceRoot":"","sources":["../../src/core/model-resolver.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACN,gBAAgB,EAChB,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,GACxB,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAEnG,OAAO,EACN,2BAA2B,EAC3B,gCAAgC,GAChC,MAAM,2BAA2B,CAAC","sourcesContent":["/**\n * Model resolution, scoping, and initial selection\n */\n\nexport { resolveCliModel } from \"./model-resolver-cli.ts\";\nexport { defaultModelPerProvider } from \"./model-resolver-defaults.ts\";\nexport {\n\tfindInitialModel,\n\tresolveRestoredModelReference,\n\trestoreModelFromSession,\n\tuncachedCopilotModelHint,\n} from \"./model-resolver-initial.ts\";\nexport type {\n\tModelReferenceRequest,\n\tModelReferenceResult,\n\tModelReferenceTarget,\n} from \"./model-resolver-patterns.ts\";\nexport { findExactModelReferenceMatch, resolveModelReference } from \"./model-resolver-patterns.ts\";\nexport type { ModelScopeDiagnostic, ResolveModelScopeResult } from \"./model-resolver-scope.ts\";\nexport {\n\tresolveModelScopeFromModels,\n\tresolveModelScopeWithDiagnostics,\n} from \"./model-resolver-scope.ts\";\nexport type {\n\tInitialModelResult,\n\tResolveCliModelResult,\n\tScopedModel,\n} from \"./model-resolver-types.ts\";\n"]}
@@ -1,3 +1,4 @@
1
+ import { type QualityEstimate } from "./model-routing-estimates.js";
1
2
  import { type EvalsCatalog } from "./model-routing-evals.js";
2
3
  import { type ResolvedTaskNeeds } from "./model-routing-needs.js";
3
4
  /** What ranking needs to know about one eligible model. */
@@ -16,6 +17,11 @@ export interface CandidateModel {
16
17
  readonly fastRouteServiceTier?: "priority" | "ultrafast";
17
18
  /** True when `cost` already holds the route tier's published rates rather than the base model's. */
18
19
  readonly fastRoutePriced?: boolean;
20
+ /**
21
+ * Reasoning efforts the model can run at (`null` without configurable reasoning). Routing ranks the
22
+ * model at the effort it would run for the task; absent, every measured effort counts alike.
23
+ */
24
+ readonly efforts?: readonly (string | null)[];
19
25
  }
20
26
  export interface RankedCandidate extends CandidateModel {
21
27
  /** Identity shared by one model's providers and its derived fast route, which collapse onto it. */
@@ -25,14 +31,31 @@ export interface RankedCandidate extends CandidateModel {
25
31
  /** How each quoted value was measured, for example its effort, harness or reporter. */
26
32
  readonly conditions: ReadonlyMap<string, string>;
27
33
  readonly released?: string;
34
+ /**
35
+ * Standing among benchmarked catalog models of the conservative quality
36
+ * estimate for this work, present when the model has any result in the fit.
37
+ */
28
38
  readonly workStanding?: number;
29
39
  readonly overallStanding?: number;
40
+ /** Quality for this work, from measured results and the completion's estimates of missing ones. */
41
+ readonly estimate?: QualityEstimate;
42
+ /** True when the model has a measured DeepSWE or FrontierCode result, from a leaderboard or its vendor. */
43
+ readonly longTaskEvidence?: boolean;
44
+ /** The effort the model is ranked at: the one routing would run it at for this task. */
45
+ readonly effort?: string | null;
46
+ /** Results measured at `effort`, quoted in preference to results at other efforts. */
47
+ readonly effortValues?: ReadonlyMap<string, number>;
48
+ readonly effortConditions?: ReadonlyMap<string, string>;
30
49
  }
31
50
  /**
32
- * Rank every eligible model for the task in code. Quality is the model's
33
- * standing among every benchmarked model in the catalog on the benchmarks for
34
- * this kind of work (overall intelligence when it has none), so it does not
35
- * depend on which other models are eligible. It is weighed against price by how
51
+ * Rank every eligible model for the task in code. Quality is a conservative
52
+ * estimate for this kind of work: the model's weighted results on the work's
53
+ * benchmarks, with missing ones estimated from all of its other results, less
54
+ * one standard error, scaled from the weakest to the strongest candidate. A
55
+ * model with one strong result therefore ranks below models with broader,
56
+ * consistent evidence. The standing quoted to the router compares the same
57
+ * estimate with every benchmarked catalog model, so it does not depend on
58
+ * which other models are eligible. Quality is weighed against price by how
36
59
  * demanding the task is, with a small preference for newer releases.
37
60
  */
38
61
  export declare function rankCandidates(catalog: EvalsCatalog, candidates: readonly CandidateModel[], needs: ResolvedTaskNeeds): RankedCandidate[];
@@ -41,7 +64,9 @@ export declare function distinctTop(ranked: readonly RankedCandidate[], size: nu
41
64
  /**
42
65
  * One shortlisted option described with its own evidence, so the router compares
43
66
  * options directly: release date, price tier, image input, and results for this
44
- * kind of work and overall, with standings among catalog models measured on the same benchmark by the same source.
67
+ * kind of work and overall. The work standing compares the conservative
68
+ * quality estimate with every benchmarked catalog model's, and says which
69
+ * results are measured and which are estimated from the model's other results.
45
70
  */
46
71
  export declare function describeOption(option: RankedCandidate, needs: ResolvedTaskNeeds, eligible: readonly RankedCandidate[]): string;
47
72
  //# sourceMappingURL=model-routing-candidates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-routing-candidates.d.ts","sourceRoot":"","sources":["../../src/core/model-routing-candidates.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,YAAY,EAEjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,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