@cat-factory/kernel 0.6.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.
- package/LICENSE +21 -0
- package/dist/domain/catalog.d.ts +36 -0
- package/dist/domain/catalog.d.ts.map +1 -0
- package/dist/domain/catalog.js +55 -0
- package/dist/domain/catalog.js.map +1 -0
- package/dist/domain/errors.d.ts +57 -0
- package/dist/domain/errors.d.ts.map +1 -0
- package/dist/domain/errors.js +60 -0
- package/dist/domain/errors.js.map +1 -0
- package/dist/domain/models.d.ts +204 -0
- package/dist/domain/models.d.ts.map +1 -0
- package/dist/domain/models.js +522 -0
- package/dist/domain/models.js.map +1 -0
- package/dist/domain/pipeline-registry.d.ts +19 -0
- package/dist/domain/pipeline-registry.d.ts.map +1 -0
- package/dist/domain/pipeline-registry.js +48 -0
- package/dist/domain/pipeline-registry.js.map +1 -0
- package/dist/domain/seed.d.ts +14 -0
- package/dist/domain/seed.d.ts.map +1 -0
- package/dist/domain/seed.js +369 -0
- package/dist/domain/seed.js.map +1 -0
- package/dist/domain/service-registration.d.ts +31 -0
- package/dist/domain/service-registration.d.ts.map +1 -0
- package/dist/domain/service-registration.js +37 -0
- package/dist/domain/service-registration.js.map +1 -0
- package/dist/domain/subtasks.logic.d.ts +6 -0
- package/dist/domain/subtasks.logic.d.ts.map +1 -0
- package/dist/domain/subtasks.logic.js +20 -0
- package/dist/domain/subtasks.logic.js.map +1 -0
- package/dist/domain/types.d.ts +2 -0
- package/dist/domain/types.d.ts.map +1 -0
- package/dist/domain/types.js +2 -0
- package/dist/domain/types.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/ports/account-repositories.d.ts +46 -0
- package/dist/ports/account-repositories.d.ts.map +1 -0
- package/dist/ports/account-repositories.js +2 -0
- package/dist/ports/account-repositories.js.map +1 -0
- package/dist/ports/agent-executor.d.ts +361 -0
- package/dist/ports/agent-executor.d.ts.map +1 -0
- package/dist/ports/agent-executor.js +8 -0
- package/dist/ports/agent-executor.js.map +1 -0
- package/dist/ports/agent-runs.d.ts +28 -0
- package/dist/ports/agent-runs.d.ts.map +1 -0
- package/dist/ports/agent-runs.js +2 -0
- package/dist/ports/agent-runs.js.map +1 -0
- package/dist/ports/board-operations.d.ts +15 -0
- package/dist/ports/board-operations.d.ts.map +1 -0
- package/dist/ports/board-operations.js +2 -0
- package/dist/ports/board-operations.js.map +1 -0
- package/dist/ports/board-scan-repositories.d.ts +23 -0
- package/dist/ports/board-scan-repositories.d.ts.map +1 -0
- package/dist/ports/board-scan-repositories.js +2 -0
- package/dist/ports/board-scan-repositories.js.map +1 -0
- package/dist/ports/bootstrap-repositories.d.ts +71 -0
- package/dist/ports/bootstrap-repositories.d.ts.map +1 -0
- package/dist/ports/bootstrap-repositories.js +2 -0
- package/dist/ports/bootstrap-repositories.js.map +1 -0
- package/dist/ports/bootstrap-runner.d.ts +20 -0
- package/dist/ports/bootstrap-runner.d.ts.map +1 -0
- package/dist/ports/bootstrap-runner.js +12 -0
- package/dist/ports/bootstrap-runner.js.map +1 -0
- package/dist/ports/ci-status.d.ts +23 -0
- package/dist/ports/ci-status.d.ts.map +1 -0
- package/dist/ports/ci-status.js +8 -0
- package/dist/ports/ci-status.js.map +1 -0
- package/dist/ports/clarity-review-repositories.d.ts +12 -0
- package/dist/ports/clarity-review-repositories.d.ts.map +1 -0
- package/dist/ports/clarity-review-repositories.js +2 -0
- package/dist/ports/clarity-review-repositories.js.map +1 -0
- package/dist/ports/consensus-repositories.d.ts +12 -0
- package/dist/ports/consensus-repositories.d.ts.map +1 -0
- package/dist/ports/consensus-repositories.js +2 -0
- package/dist/ports/consensus-repositories.js.map +1 -0
- package/dist/ports/document-repositories.d.ts +55 -0
- package/dist/ports/document-repositories.d.ts.map +1 -0
- package/dist/ports/document-repositories.js +2 -0
- package/dist/ports/document-repositories.js.map +1 -0
- package/dist/ports/document-source.d.ts +55 -0
- package/dist/ports/document-source.d.ts.map +1 -0
- package/dist/ports/document-source.js +2 -0
- package/dist/ports/document-source.js.map +1 -0
- package/dist/ports/email-sender.d.ts +42 -0
- package/dist/ports/email-sender.d.ts.map +1 -0
- package/dist/ports/email-sender.js +7 -0
- package/dist/ports/email-sender.js.map +1 -0
- package/dist/ports/environment-provider.d.ts +67 -0
- package/dist/ports/environment-provider.d.ts.map +1 -0
- package/dist/ports/environment-provider.js +2 -0
- package/dist/ports/environment-provider.js.map +1 -0
- package/dist/ports/environment-repositories.d.ts +64 -0
- package/dist/ports/environment-repositories.d.ts.map +1 -0
- package/dist/ports/environment-repositories.js +2 -0
- package/dist/ports/environment-repositories.js.map +1 -0
- package/dist/ports/execution-events.d.ts +72 -0
- package/dist/ports/execution-events.d.ts.map +1 -0
- package/dist/ports/execution-events.js +16 -0
- package/dist/ports/execution-events.js.map +1 -0
- package/dist/ports/fragment-repositories.d.ts +65 -0
- package/dist/ports/fragment-repositories.d.ts.map +1 -0
- package/dist/ports/fragment-repositories.js +2 -0
- package/dist/ports/fragment-repositories.js.map +1 -0
- package/dist/ports/fragment-selector.d.ts +64 -0
- package/dist/ports/fragment-selector.d.ts.map +1 -0
- package/dist/ports/fragment-selector.js +2 -0
- package/dist/ports/fragment-selector.js.map +1 -0
- package/dist/ports/github-client.d.ts +226 -0
- package/dist/ports/github-client.d.ts.map +1 -0
- package/dist/ports/github-client.js +2 -0
- package/dist/ports/github-client.js.map +1 -0
- package/dist/ports/github-provisioning.d.ts +47 -0
- package/dist/ports/github-provisioning.d.ts.map +1 -0
- package/dist/ports/github-provisioning.js +12 -0
- package/dist/ports/github-provisioning.js.map +1 -0
- package/dist/ports/github-repositories.d.ts +136 -0
- package/dist/ports/github-repositories.d.ts.map +1 -0
- package/dist/ports/github-repositories.js +2 -0
- package/dist/ports/github-repositories.js.map +1 -0
- package/dist/ports/incident-enrichment.d.ts +40 -0
- package/dist/ports/incident-enrichment.d.ts.map +1 -0
- package/dist/ports/incident-enrichment.js +30 -0
- package/dist/ports/incident-enrichment.js.map +1 -0
- package/dist/ports/index.d.ts +68 -0
- package/dist/ports/index.d.ts.map +1 -0
- package/dist/ports/index.js +11 -0
- package/dist/ports/index.js.map +1 -0
- package/dist/ports/invitation-repositories.d.ts +28 -0
- package/dist/ports/invitation-repositories.d.ts.map +1 -0
- package/dist/ports/invitation-repositories.js +2 -0
- package/dist/ports/invitation-repositories.js.map +1 -0
- package/dist/ports/llm-metrics.d.ts +142 -0
- package/dist/ports/llm-metrics.d.ts.map +1 -0
- package/dist/ports/llm-metrics.js +16 -0
- package/dist/ports/llm-metrics.js.map +1 -0
- package/dist/ports/llm-trace-sink.d.ts +84 -0
- package/dist/ports/llm-trace-sink.d.ts.map +1 -0
- package/dist/ports/llm-trace-sink.js +55 -0
- package/dist/ports/llm-trace-sink.js.map +1 -0
- package/dist/ports/local-model-repositories.d.ts +29 -0
- package/dist/ports/local-model-repositories.d.ts.map +1 -0
- package/dist/ports/local-model-repositories.js +2 -0
- package/dist/ports/local-model-repositories.js.map +1 -0
- package/dist/ports/merge-preset-repositories.d.ts +14 -0
- package/dist/ports/merge-preset-repositories.d.ts.map +1 -0
- package/dist/ports/merge-preset-repositories.js +2 -0
- package/dist/ports/merge-preset-repositories.js.map +1 -0
- package/dist/ports/model-default-repositories.d.ts +9 -0
- package/dist/ports/model-default-repositories.d.ts.map +1 -0
- package/dist/ports/model-default-repositories.js +6 -0
- package/dist/ports/model-default-repositories.js.map +1 -0
- package/dist/ports/model-provider.d.ts +69 -0
- package/dist/ports/model-provider.d.ts.map +1 -0
- package/dist/ports/model-provider.js +16 -0
- package/dist/ports/model-provider.js.map +1 -0
- package/dist/ports/notification-channel.d.ts +16 -0
- package/dist/ports/notification-channel.d.ts.map +1 -0
- package/dist/ports/notification-channel.js +22 -0
- package/dist/ports/notification-channel.js.map +1 -0
- package/dist/ports/notification-repositories.d.ts +15 -0
- package/dist/ports/notification-repositories.d.ts.map +1 -0
- package/dist/ports/notification-repositories.js +2 -0
- package/dist/ports/notification-repositories.js.map +1 -0
- package/dist/ports/password-hasher.d.ts +14 -0
- package/dist/ports/password-hasher.d.ts.map +1 -0
- package/dist/ports/password-hasher.js +9 -0
- package/dist/ports/password-hasher.js.map +1 -0
- package/dist/ports/personal-secret-cipher.d.ts +7 -0
- package/dist/ports/personal-secret-cipher.d.ts.map +1 -0
- package/dist/ports/personal-secret-cipher.js +12 -0
- package/dist/ports/personal-secret-cipher.js.map +1 -0
- package/dist/ports/personal-subscription-repositories.d.ts +72 -0
- package/dist/ports/personal-subscription-repositories.d.ts.map +1 -0
- package/dist/ports/personal-subscription-repositories.js +2 -0
- package/dist/ports/personal-subscription-repositories.js.map +1 -0
- package/dist/ports/pr-mergeability.d.ts +24 -0
- package/dist/ports/pr-mergeability.d.ts.map +1 -0
- package/dist/ports/pr-mergeability.js +7 -0
- package/dist/ports/pr-mergeability.js.map +1 -0
- package/dist/ports/pr-merger.d.ts +10 -0
- package/dist/ports/pr-merger.d.ts.map +1 -0
- package/dist/ports/pr-merger.js +8 -0
- package/dist/ports/pr-merger.js.map +1 -0
- package/dist/ports/provider-api-key-repositories.d.ts +71 -0
- package/dist/ports/provider-api-key-repositories.d.ts.map +1 -0
- package/dist/ports/provider-api-key-repositories.js +15 -0
- package/dist/ports/provider-api-key-repositories.js.map +1 -0
- package/dist/ports/provider-subscription-repositories.d.ts +51 -0
- package/dist/ports/provider-subscription-repositories.d.ts.map +1 -0
- package/dist/ports/provider-subscription-repositories.js +15 -0
- package/dist/ports/provider-subscription-repositories.js.map +1 -0
- package/dist/ports/recurring-repositories.d.ts +46 -0
- package/dist/ports/recurring-repositories.d.ts.map +1 -0
- package/dist/ports/recurring-repositories.js +2 -0
- package/dist/ports/recurring-repositories.js.map +1 -0
- package/dist/ports/release-health-repositories.d.ts +42 -0
- package/dist/ports/release-health-repositories.d.ts.map +1 -0
- package/dist/ports/release-health-repositories.js +6 -0
- package/dist/ports/release-health-repositories.js.map +1 -0
- package/dist/ports/release-health.d.ts +59 -0
- package/dist/ports/release-health.d.ts.map +1 -0
- package/dist/ports/release-health.js +8 -0
- package/dist/ports/release-health.js.map +1 -0
- package/dist/ports/repo-bootstrapper.d.ts +80 -0
- package/dist/ports/repo-bootstrapper.d.ts.map +1 -0
- package/dist/ports/repo-bootstrapper.js +2 -0
- package/dist/ports/repo-bootstrapper.js.map +1 -0
- package/dist/ports/repo-scanner.d.ts +22 -0
- package/dist/ports/repo-scanner.d.ts.map +1 -0
- package/dist/ports/repo-scanner.js +2 -0
- package/dist/ports/repo-scanner.js.map +1 -0
- package/dist/ports/repositories.d.ts +131 -0
- package/dist/ports/repositories.d.ts.map +1 -0
- package/dist/ports/repositories.js +2 -0
- package/dist/ports/repositories.js.map +1 -0
- package/dist/ports/requirement-review-repositories.d.ts +16 -0
- package/dist/ports/requirement-review-repositories.d.ts.map +1 -0
- package/dist/ports/requirement-review-repositories.js +2 -0
- package/dist/ports/requirement-review-repositories.js.map +1 -0
- package/dist/ports/runner-pool-provider.d.ts +25 -0
- package/dist/ports/runner-pool-provider.d.ts.map +1 -0
- package/dist/ports/runner-pool-provider.js +2 -0
- package/dist/ports/runner-pool-provider.js.map +1 -0
- package/dist/ports/runner-pool-repositories.d.ts +27 -0
- package/dist/ports/runner-pool-repositories.d.ts.map +1 -0
- package/dist/ports/runner-pool-repositories.js +7 -0
- package/dist/ports/runner-pool-repositories.js.map +1 -0
- package/dist/ports/runner-transport.d.ts +119 -0
- package/dist/ports/runner-transport.d.ts.map +1 -0
- package/dist/ports/runner-transport.js +2 -0
- package/dist/ports/runner-transport.js.map +1 -0
- package/dist/ports/runtime.d.ts +9 -0
- package/dist/ports/runtime.d.ts.map +1 -0
- package/dist/ports/runtime.js +5 -0
- package/dist/ports/runtime.js.map +1 -0
- package/dist/ports/sandbox-repositories.d.ts +39 -0
- package/dist/ports/sandbox-repositories.d.ts.map +1 -0
- package/dist/ports/sandbox-repositories.js +2 -0
- package/dist/ports/sandbox-repositories.js.map +1 -0
- package/dist/ports/secret-cipher.d.ts +7 -0
- package/dist/ports/secret-cipher.d.ts.map +1 -0
- package/dist/ports/secret-cipher.js +7 -0
- package/dist/ports/secret-cipher.js.map +1 -0
- package/dist/ports/service-fragment-default-repositories.d.ts +7 -0
- package/dist/ports/service-fragment-default-repositories.d.ts.map +1 -0
- package/dist/ports/service-fragment-default-repositories.js +6 -0
- package/dist/ports/service-fragment-default-repositories.js.map +1 -0
- package/dist/ports/service-repositories.d.ts +68 -0
- package/dist/ports/service-repositories.d.ts.map +1 -0
- package/dist/ports/service-repositories.js +2 -0
- package/dist/ports/service-repositories.js.map +1 -0
- package/dist/ports/slack-repositories.d.ts +61 -0
- package/dist/ports/slack-repositories.d.ts.map +1 -0
- package/dist/ports/slack-repositories.js +2 -0
- package/dist/ports/slack-repositories.js.map +1 -0
- package/dist/ports/task-repositories.d.ts +61 -0
- package/dist/ports/task-repositories.d.ts.map +1 -0
- package/dist/ports/task-repositories.js +2 -0
- package/dist/ports/task-repositories.js.map +1 -0
- package/dist/ports/task-source.d.ts +69 -0
- package/dist/ports/task-source.d.ts.map +1 -0
- package/dist/ports/task-source.js +2 -0
- package/dist/ports/task-source.js.map +1 -0
- package/dist/ports/ticket-tracker.d.ts +19 -0
- package/dist/ports/ticket-tracker.d.ts.map +1 -0
- package/dist/ports/ticket-tracker.js +8 -0
- package/dist/ports/ticket-tracker.js.map +1 -0
- package/dist/ports/token-usage.d.ts +37 -0
- package/dist/ports/token-usage.d.ts.map +1 -0
- package/dist/ports/token-usage.js +6 -0
- package/dist/ports/token-usage.js.map +1 -0
- package/dist/ports/tracker-settings-repositories.d.ts +6 -0
- package/dist/ports/tracker-settings-repositories.d.ts.map +1 -0
- package/dist/ports/tracker-settings-repositories.js +2 -0
- package/dist/ports/tracker-settings-repositories.js.map +1 -0
- package/dist/ports/url-safety-policy.d.ts +15 -0
- package/dist/ports/url-safety-policy.d.ts.map +1 -0
- package/dist/ports/url-safety-policy.js +13 -0
- package/dist/ports/url-safety-policy.js.map +1 -0
- package/dist/ports/user-repositories.d.ts +52 -0
- package/dist/ports/user-repositories.d.ts.map +1 -0
- package/dist/ports/user-repositories.js +13 -0
- package/dist/ports/user-repositories.js.map +1 -0
- package/dist/ports/webhook-verifier.d.ts +9 -0
- package/dist/ports/webhook-verifier.d.ts.map +1 -0
- package/dist/ports/webhook-verifier.js +8 -0
- package/dist/ports/webhook-verifier.js.map +1 -0
- package/dist/ports/work-runner.d.ts +19 -0
- package/dist/ports/work-runner.d.ts.map +1 -0
- package/dist/ports/work-runner.js +19 -0
- package/dist/ports/work-runner.js.map +1 -0
- package/dist/ports/workspace-settings-repositories.d.ts +8 -0
- package/dist/ports/workspace-settings-repositories.d.ts.map +1 -0
- package/dist/ports/workspace-settings-repositories.js +2 -0
- package/dist/ports/workspace-settings-repositories.js.map +1 -0
- package/dist/shared/atlassian.logic.d.ts +11 -0
- package/dist/shared/atlassian.logic.d.ts.map +1 -0
- package/dist/shared/atlassian.logic.js +148 -0
- package/dist/shared/atlassian.logic.js.map +1 -0
- package/dist/shared/markdown.logic.d.ts +5 -0
- package/dist/shared/markdown.logic.d.ts.map +1 -0
- package/dist/shared/markdown.logic.js +21 -0
- package/dist/shared/markdown.logic.js.map +1 -0
- package/dist/shared/source-registry.logic.d.ts +10 -0
- package/dist/shared/source-registry.logic.d.ts.map +1 -0
- package/dist/shared/source-registry.logic.js +17 -0
- package/dist/shared/source-registry.logic.js.map +1 -0
- package/dist/shared/tasks-prompt.logic.d.ts +16 -0
- package/dist/shared/tasks-prompt.logic.d.ts.map +1 -0
- package/dist/shared/tasks-prompt.logic.js +29 -0
- package/dist/shared/tasks-prompt.logic.js.map +1 -0
- package/dist/workspace-guard.d.ts +4 -0
- package/dist/workspace-guard.d.ts.map +1 -0
- package/dist/workspace-guard.js +5 -0
- package/dist/workspace-guard.js.map +1 -0
- package/package.json +32 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Igor Savin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { BlockType, WorkspaceSettings } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The runtime settings every workspace starts with (lazily seeded on first read).
|
|
4
|
+
* `waitingEscalationMinutes` is how long a run may wait for human input before its
|
|
5
|
+
* notification turns red (runs are never auto-failed for waiting); the task limit is
|
|
6
|
+
* off by default so existing boards keep their unbounded concurrency.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_WORKSPACE_SETTINGS: WorkspaceSettings;
|
|
9
|
+
/**
|
|
10
|
+
* The built-in merge threshold preset seeded for every workspace, used by any
|
|
11
|
+
* task that hasn't picked its own. A PR auto-merges only when the `merger`
|
|
12
|
+
* agent's complexity/risk/impact all stay at or below these ceilings; otherwise a
|
|
13
|
+
* `merge_review` notification is raised. `ciMaxAttempts` bounds how many times the
|
|
14
|
+
* `ci-fixer` agent retries before the CI gate gives up.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_MERGE_PRESET: {
|
|
17
|
+
readonly name: 'Balanced';
|
|
18
|
+
readonly maxComplexity: 0.5;
|
|
19
|
+
readonly maxRisk: 0.4;
|
|
20
|
+
readonly maxImpact: 0.5;
|
|
21
|
+
readonly ciMaxAttempts: 10;
|
|
22
|
+
readonly maxRequirementIterations: 6;
|
|
23
|
+
readonly maxRequirementConcernAllowed: 'none';
|
|
24
|
+
readonly releaseWatchWindowMinutes: 30;
|
|
25
|
+
readonly releaseMaxAttempts: 1;
|
|
26
|
+
};
|
|
27
|
+
/** Fallback CI-fixer attempt budget when no preset resolves (defensive default). */
|
|
28
|
+
export declare const DEFAULT_CI_MAX_ATTEMPTS: 10;
|
|
29
|
+
/**
|
|
30
|
+
* Fallback cap on the iterative requirements-review loop (reviewer passes) when no
|
|
31
|
+
* preset resolves. One reviewer pass = one iteration; the initial review is iteration 1.
|
|
32
|
+
*/
|
|
33
|
+
export declare const DEFAULT_MAX_REQUIREMENT_ITERATIONS: 6;
|
|
34
|
+
/** Human-facing label per block type, used when titling freshly dropped frames. */
|
|
35
|
+
export declare const BLOCK_TYPE_LABEL: Record<BlockType, string>;
|
|
36
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/domain/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAI9D;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,EAAE,iBAKxC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;aAC/B,IAAI,EAAE,UAAU;aAChB,aAAa,EAAE,GAAG;aAClB,OAAO,EAAE,GAAG;aACZ,SAAS,EAAE,GAAG;aACd,aAAa,EAAE,EAAE;aACjB,wBAAwB,EAAE,CAAC;aAE3B,4BAA4B,EAAE,MAAM;aAKpC,yBAAyB,EAAE,EAAE;aAC7B,kBAAkB,EAAE,CAAC;CACb,CAAA;AAEV,oFAAoF;AACpF,eAAO,MAAM,uBAAuB,IAAqC,CAAA;AAEzE;;;GAGG;AACH,eAAO,MAAM,kCAAkC,GAAgD,CAAA;AAE/F,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAStD,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Static catalogs and constants used across the domain.
|
|
2
|
+
/**
|
|
3
|
+
* The runtime settings every workspace starts with (lazily seeded on first read).
|
|
4
|
+
* `waitingEscalationMinutes` is how long a run may wait for human input before its
|
|
5
|
+
* notification turns red (runs are never auto-failed for waiting); the task limit is
|
|
6
|
+
* off by default so existing boards keep their unbounded concurrency.
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_WORKSPACE_SETTINGS = {
|
|
9
|
+
waitingEscalationMinutes: 120,
|
|
10
|
+
taskLimitMode: 'off',
|
|
11
|
+
taskLimitShared: null,
|
|
12
|
+
taskLimitPerType: null,
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The built-in merge threshold preset seeded for every workspace, used by any
|
|
16
|
+
* task that hasn't picked its own. A PR auto-merges only when the `merger`
|
|
17
|
+
* agent's complexity/risk/impact all stay at or below these ceilings; otherwise a
|
|
18
|
+
* `merge_review` notification is raised. `ciMaxAttempts` bounds how many times the
|
|
19
|
+
* `ci-fixer` agent retries before the CI gate gives up.
|
|
20
|
+
*/
|
|
21
|
+
export const DEFAULT_MERGE_PRESET = {
|
|
22
|
+
name: 'Balanced',
|
|
23
|
+
maxComplexity: 0.5,
|
|
24
|
+
maxRisk: 0.4,
|
|
25
|
+
maxImpact: 0.5,
|
|
26
|
+
ciMaxAttempts: 10,
|
|
27
|
+
maxRequirementIterations: 6,
|
|
28
|
+
// Tolerate nothing by default: any reviewer finding pauses the run for a human.
|
|
29
|
+
maxRequirementConcernAllowed: 'none',
|
|
30
|
+
// Post-release-health gate: how long (minutes) the gate watches the deployed
|
|
31
|
+
// release's monitors/SLOs before declaring it healthy, and how many on-call
|
|
32
|
+
// investigations may be dispatched while watching (the on-call agent investigates
|
|
33
|
+
// rather than fixing prod, so 1 pass is the sensible default).
|
|
34
|
+
releaseWatchWindowMinutes: 30,
|
|
35
|
+
releaseMaxAttempts: 1,
|
|
36
|
+
};
|
|
37
|
+
/** Fallback CI-fixer attempt budget when no preset resolves (defensive default). */
|
|
38
|
+
export const DEFAULT_CI_MAX_ATTEMPTS = DEFAULT_MERGE_PRESET.ciMaxAttempts;
|
|
39
|
+
/**
|
|
40
|
+
* Fallback cap on the iterative requirements-review loop (reviewer passes) when no
|
|
41
|
+
* preset resolves. One reviewer pass = one iteration; the initial review is iteration 1.
|
|
42
|
+
*/
|
|
43
|
+
export const DEFAULT_MAX_REQUIREMENT_ITERATIONS = DEFAULT_MERGE_PRESET.maxRequirementIterations;
|
|
44
|
+
/** Human-facing label per block type, used when titling freshly dropped frames. */
|
|
45
|
+
export const BLOCK_TYPE_LABEL = {
|
|
46
|
+
frontend: 'Frontend',
|
|
47
|
+
service: 'Service',
|
|
48
|
+
api: 'API',
|
|
49
|
+
database: 'Database',
|
|
50
|
+
queue: 'Queue',
|
|
51
|
+
integration: 'Integration',
|
|
52
|
+
external: 'External',
|
|
53
|
+
environment: 'Environment',
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/domain/catalog.ts"],"names":[],"mappings":"AAEA,wDAAwD;AAExD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IAC3D,wBAAwB,EAAE,GAAG;IAC7B,aAAa,EAAE,KAAK;IACpB,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,IAAI;CACvB,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,UAAU;IAChB,aAAa,EAAE,GAAG;IAClB,OAAO,EAAE,GAAG;IACZ,SAAS,EAAE,GAAG;IACd,aAAa,EAAE,EAAE;IACjB,wBAAwB,EAAE,CAAC;IAC3B,gFAAgF;IAChF,4BAA4B,EAAE,MAAM;IACpC,6EAA6E;IAC7E,4EAA4E;IAC5E,kFAAkF;IAClF,+DAA+D;IAC/D,yBAAyB,EAAE,EAAE;IAC7B,kBAAkB,EAAE,CAAC;CACb,CAAA;AAEV,oFAAoF;AACpF,MAAM,CAAC,MAAM,uBAAuB,GAAG,oBAAoB,CAAC,aAAa,CAAA;AAEzE;;;GAGG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,oBAAoB,CAAC,wBAAwB,CAAA;AAE/F,mFAAmF;AACnF,MAAM,CAAC,MAAM,gBAAgB,GAA8B;IACzD,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,aAAa;CAC3B,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type DomainErrorCode = 'not_found' | 'validation' | 'conflict' | 'credential_required';
|
|
2
|
+
export declare class DomainError extends Error {
|
|
3
|
+
readonly code: DomainErrorCode;
|
|
4
|
+
/**
|
|
5
|
+
* Optional machine-readable detail the facade surfaces alongside the error
|
|
6
|
+
* (e.g. which vendor + why a personal credential is required), so a client can
|
|
7
|
+
* react precisely — prompt for a password vs offer to connect a subscription —
|
|
8
|
+
* without string-matching the message.
|
|
9
|
+
*/
|
|
10
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
11
|
+
constructor(code: DomainErrorCode, message: string,
|
|
12
|
+
/**
|
|
13
|
+
* Optional machine-readable detail the facade surfaces alongside the error
|
|
14
|
+
* (e.g. which vendor + why a personal credential is required), so a client can
|
|
15
|
+
* react precisely — prompt for a password vs offer to connect a subscription —
|
|
16
|
+
* without string-matching the message.
|
|
17
|
+
*/
|
|
18
|
+
details?: Record<string, unknown> | undefined);
|
|
19
|
+
}
|
|
20
|
+
/** A referenced entity does not exist (→ 404). */
|
|
21
|
+
export declare class NotFoundError extends DomainError {
|
|
22
|
+
constructor(entity: string, id: string);
|
|
23
|
+
}
|
|
24
|
+
/** Structurally valid but violates a domain rule (→ 422). */
|
|
25
|
+
export declare class ValidationError extends DomainError {
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
/** Conflicts with current state (→ 409). */
|
|
29
|
+
export declare class ConflictError extends DomainError {
|
|
30
|
+
constructor(message: string);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Why a personal (individual-usage) subscription credential can't be used right now.
|
|
34
|
+
* - `no_subscription` — the user has no stored credential for the vendor.
|
|
35
|
+
* - `password_required` — a credential exists but the request carried no password
|
|
36
|
+
* (or none is cached) to unlock it.
|
|
37
|
+
* - `wrong_password` — the supplied password did not decrypt the credential.
|
|
38
|
+
* - `subscription_expired`— the stored subscription's own expiry has passed; renew it.
|
|
39
|
+
*/
|
|
40
|
+
export type CredentialRequiredReason = 'no_subscription' | 'password_required' | 'wrong_password' | 'subscription_expired';
|
|
41
|
+
/**
|
|
42
|
+
* A user-scoped personal credential is needed before this action can proceed (→ 428
|
|
43
|
+
* Precondition Required). Carries the vendor + reason so the client prompts for a
|
|
44
|
+
* password or offers to connect/renew the subscription, rather than failing opaquely.
|
|
45
|
+
* Used by the individual-usage restricted mode (e.g. Claude personal subscriptions).
|
|
46
|
+
*/
|
|
47
|
+
export declare class CredentialRequiredError extends DomainError {
|
|
48
|
+
constructor(message: string, details: {
|
|
49
|
+
vendor: string;
|
|
50
|
+
reason: CredentialRequiredReason;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/** Resolve a maybe-null lookup or throw a {@link NotFoundError}. */
|
|
54
|
+
export declare function assertFound<T>(value: T | null | undefined, entity: string, id: string): T;
|
|
55
|
+
/** Extract a human-readable message from an unknown thrown value. */
|
|
56
|
+
export declare function getErrorMessage(error: unknown): string;
|
|
57
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/domain/errors.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,qBAAqB,CAAA;AAE7F,qBAAa,WAAY,SAAQ,KAAK;IAElC,QAAQ,CAAC,IAAI,EAAE,eAAe;IAE9B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAT5C,YACW,IAAI,EAAE,eAAe,EAC9B,OAAO,EAAE,MAAM;IACf;;;;;OAKG;IACM,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA,EAI3C;CACF;AAED,kDAAkD;AAClD,qBAAa,aAAc,SAAQ,WAAW;IAC5C,YAAY,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAErC;CACF;AAED,6DAA6D;AAC7D,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED,4CAA4C;AAC5C,qBAAa,aAAc,SAAQ,WAAW;IAC5C,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,wBAAwB,GAChC,iBAAiB,GACjB,mBAAmB,GACnB,gBAAgB,GAChB,sBAAsB,CAAA;AAE1B;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,WAAW;IACtD,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,wBAAwB,CAAA;KAAE,EAEzF;CACF;AAED,oEAAoE;AACpE,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,CAGzF;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEtD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Domain-level errors. The core throws these; the facade's error handler maps
|
|
2
|
+
// them to HTTP status codes. Keeping them framework-agnostic means the same core
|
|
3
|
+
// can be wrapped by a different transport (queue consumer, RPC, CLI) unchanged.
|
|
4
|
+
export class DomainError extends Error {
|
|
5
|
+
code;
|
|
6
|
+
details;
|
|
7
|
+
constructor(code, message,
|
|
8
|
+
/**
|
|
9
|
+
* Optional machine-readable detail the facade surfaces alongside the error
|
|
10
|
+
* (e.g. which vendor + why a personal credential is required), so a client can
|
|
11
|
+
* react precisely — prompt for a password vs offer to connect a subscription —
|
|
12
|
+
* without string-matching the message.
|
|
13
|
+
*/
|
|
14
|
+
details) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.code = code;
|
|
17
|
+
this.details = details;
|
|
18
|
+
this.name = new.target.name;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** A referenced entity does not exist (→ 404). */
|
|
22
|
+
export class NotFoundError extends DomainError {
|
|
23
|
+
constructor(entity, id) {
|
|
24
|
+
super('not_found', `${entity} '${id}' not found`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Structurally valid but violates a domain rule (→ 422). */
|
|
28
|
+
export class ValidationError extends DomainError {
|
|
29
|
+
constructor(message) {
|
|
30
|
+
super('validation', message);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** Conflicts with current state (→ 409). */
|
|
34
|
+
export class ConflictError extends DomainError {
|
|
35
|
+
constructor(message) {
|
|
36
|
+
super('conflict', message);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A user-scoped personal credential is needed before this action can proceed (→ 428
|
|
41
|
+
* Precondition Required). Carries the vendor + reason so the client prompts for a
|
|
42
|
+
* password or offers to connect/renew the subscription, rather than failing opaquely.
|
|
43
|
+
* Used by the individual-usage restricted mode (e.g. Claude personal subscriptions).
|
|
44
|
+
*/
|
|
45
|
+
export class CredentialRequiredError extends DomainError {
|
|
46
|
+
constructor(message, details) {
|
|
47
|
+
super('credential_required', message, details);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** Resolve a maybe-null lookup or throw a {@link NotFoundError}. */
|
|
51
|
+
export function assertFound(value, entity, id) {
|
|
52
|
+
if (value === null || value === undefined)
|
|
53
|
+
throw new NotFoundError(entity, id);
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
/** Extract a human-readable message from an unknown thrown value. */
|
|
57
|
+
export function getErrorMessage(error) {
|
|
58
|
+
return error instanceof Error ? error.message : String(error);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/domain/errors.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,iFAAiF;AACjF,gFAAgF;AAIhF,MAAM,OAAO,WAAY,SAAQ,KAAK;IAEzB,IAAI;IAQJ,OAAO;IATlB,YACW,IAAqB,EAC9B,OAAe;IACf;;;;;OAKG;IACM,OAAiC;QAE1C,KAAK,CAAC,OAAO,CAAC,CAAA;oBAVL,IAAI;uBAQJ,OAAO;QAGhB,IAAI,CAAC,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAA;IAC7B,CAAC;CACF;AAED,kDAAkD;AAClD,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C,YAAY,MAAc,EAAE,EAAU;QACpC,KAAK,CAAC,WAAW,EAAE,GAAG,MAAM,KAAK,EAAE,aAAa,CAAC,CAAA;IACnD,CAAC;CACF;AAED,6DAA6D;AAC7D,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C,YAAY,OAAe;QACzB,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;CACF;AAED,4CAA4C;AAC5C,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C,YAAY,OAAe;QACzB,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC5B,CAAC;CACF;AAgBD;;;;;GAKG;AACH,MAAM,OAAO,uBAAwB,SAAQ,WAAW;IACtD,YAAY,OAAe,EAAE,OAA6D;QACxF,KAAK,CAAC,qBAAqB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IAChD,CAAC;CACF;AAED,oEAAoE;AACpE,MAAM,UAAU,WAAW,CAAI,KAA2B,EAAE,MAAc,EAAE,EAAU;IACpF,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,MAAM,IAAI,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IAC9E,OAAO,KAAK,CAAA;AACd,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC/D,CAAC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { type ModelCost, type ModelOption, type SubscriptionVendor } from '@cat-factory/contracts';
|
|
2
|
+
import type { HarnessKind, ModelRef } from '../ports/model-provider.js';
|
|
3
|
+
export interface SubscriptionVendorConfig {
|
|
4
|
+
harness: Extract<HarnessKind, 'claude-code' | 'codex'>;
|
|
5
|
+
/** Anthropic-compatible base URL for a non-Anthropic claude-code vendor. */
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
/** Short label shown in the picker / credential UI. */
|
|
8
|
+
label: string;
|
|
9
|
+
/**
|
|
10
|
+
* The vendor's subscription credential is licensed for INDIVIDUAL use only, so it may
|
|
11
|
+
* NOT be pooled on a workspace (any member's runs leasing it) — it is stored per-user
|
|
12
|
+
* and only its owner's runs may use it. Set from each vendor's own terms of service:
|
|
13
|
+
*
|
|
14
|
+
* - `claude` — Anthropic consumer Claude (Pro/Max) is individual-use only.
|
|
15
|
+
* - `codex` — a ChatGPT `auth.json` is a per-seat credential; OpenAI prohibits
|
|
16
|
+
* credential sharing at EVERY tier (Plus/Pro and Team/Business/
|
|
17
|
+
* Enterprise alike — Team/Enterprise just grant more individual seats).
|
|
18
|
+
* - `glm` — Z.ai's GLM Coding Plan is "licensed only to the individual natural
|
|
19
|
+
* person" and forbids any organization using its quota.
|
|
20
|
+
*
|
|
21
|
+
* This is the right axis even across tiers: the pool models SHARING a subscription
|
|
22
|
+
* credential, which no consumer tier permits. Genuine org-wide / programmatic access
|
|
23
|
+
* goes through the DIRECT-PROVIDER API-KEY path (OpenAI/Anthropic keys), which is
|
|
24
|
+
* unaffected by this flag — so flagging a vendor here routes orgs to API keys, it does
|
|
25
|
+
* not lock them out. The commercial coding-plan vendors that DO permit org use stay
|
|
26
|
+
* poolable: `kimi` (Moonshot explicitly permits authorized enterprise use) and
|
|
27
|
+
* `deepseek` (a commercial API platform serving internal/external end users). See
|
|
28
|
+
* backend/docs/individual-subscription-usage.md §1 for the per-vendor ToS citations.
|
|
29
|
+
*/
|
|
30
|
+
individualOnly?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare const SUBSCRIPTION_VENDORS: Record<SubscriptionVendor, SubscriptionVendorConfig>;
|
|
33
|
+
export interface ModelVariant {
|
|
34
|
+
ref: ModelRef;
|
|
35
|
+
/** Env var whose presence switches this model to its direct provider. */
|
|
36
|
+
keyEnv: string;
|
|
37
|
+
/** Short provider label shown in the picker, e.g. `DashScope`. */
|
|
38
|
+
providerLabel: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A subscription-only variant: the model runs in the Claude Code / Codex harness
|
|
42
|
+
* authenticated with a pooled subscription token (no Cloudflare/API-key fallback).
|
|
43
|
+
* The `ref` carries the `harness` the executor dispatches to.
|
|
44
|
+
*/
|
|
45
|
+
export interface SubscriptionVariant {
|
|
46
|
+
ref: ModelRef;
|
|
47
|
+
/** Vendor whose pooled token authenticates this model. */
|
|
48
|
+
vendor: SubscriptionVendor;
|
|
49
|
+
}
|
|
50
|
+
export interface SelectableModel {
|
|
51
|
+
/** Stable id stored on a block, e.g. `qwen`. */
|
|
52
|
+
id: string;
|
|
53
|
+
/** Model-family label shown in the picker, e.g. `Qwen3`. */
|
|
54
|
+
label: string;
|
|
55
|
+
/** One-line description shown alongside the label. */
|
|
56
|
+
description: string;
|
|
57
|
+
/** Always-available Cloudflare Workers AI variant (absent for subscription-only models). */
|
|
58
|
+
cloudflare?: ModelRef;
|
|
59
|
+
/** Optional direct-provider variant, used when its key is configured. */
|
|
60
|
+
direct?: ModelVariant;
|
|
61
|
+
/**
|
|
62
|
+
* Optional subscription variant (Claude Code / Codex). For subscription-ONLY
|
|
63
|
+
* models (Opus/Sonnet/GPT) it is the only variant; for dual-mode models
|
|
64
|
+
* (GLM/Kimi) it sits alongside a Cloudflare/direct base and WINS whenever the
|
|
65
|
+
* workspace has a token for its vendor.
|
|
66
|
+
*/
|
|
67
|
+
subscription?: SubscriptionVariant;
|
|
68
|
+
}
|
|
69
|
+
export declare const MODEL_CATALOG: SelectableModel[];
|
|
70
|
+
/** Look up a catalog model by id, or `undefined` for an unknown/empty id. */
|
|
71
|
+
export declare function getSelectableModel(id: string | undefined | null): SelectableModel | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* The total context window (input + output tokens) the catalog declares for a concrete
|
|
74
|
+
* model ref, matched by provider + model. Returns undefined for a ref the catalog does
|
|
75
|
+
* not carry or one with no declared window. Used by the LLM proxy to cap a call's
|
|
76
|
+
* requested output so input + output can't exceed a small-window model's limit — a model
|
|
77
|
+
* like `@cf/qwen/qwen3-30b-a3b-fp8` (32K total) otherwise rejects the whole request
|
|
78
|
+
* (Workers AI error 8007 → HTTP 502) when the output floor alone fills the window.
|
|
79
|
+
*/
|
|
80
|
+
export declare function contextWindowFor(ref: {
|
|
81
|
+
provider: string;
|
|
82
|
+
model: string;
|
|
83
|
+
}): number | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* What a deployment + workspace actually has configured, used to resolve a catalog
|
|
86
|
+
* model to its usable flavour. Replaces the old env-only `keyEnv` predicate: direct
|
|
87
|
+
* keys now live in the DB API-key pool (account/workspace/user scoped), subscription
|
|
88
|
+
* vendors in the token pools, and Cloudflare Workers AI is an opt-in provider lib.
|
|
89
|
+
*/
|
|
90
|
+
export interface ProviderCapabilities {
|
|
91
|
+
/** Direct providers (e.g. `qwen`, `openai`) with ≥1 key in the merged scope pool. */
|
|
92
|
+
directProviders: Set<string>;
|
|
93
|
+
/** Subscription vendors with a usable token (pool or personal). */
|
|
94
|
+
subscriptionVendors: Set<SubscriptionVendor>;
|
|
95
|
+
/** Whether the opt-in Cloudflare Workers AI lib is registered for this deployment. */
|
|
96
|
+
cloudflareEnabled: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* The dynamic local-runner model ids (`"<provider>:<model>"`, e.g. `ollama:gemma3`) the
|
|
99
|
+
* resolving USER has enabled. A local model needs no pooled key — the user's configured
|
|
100
|
+
* endpoint carries the (optional) key — so usability is gated on the SPECIFIC model
|
|
101
|
+
* being enabled, not merely the runner being configured (a stale pin to a model the user
|
|
102
|
+
* later un-enabled must NOT pass the start guard).
|
|
103
|
+
*/
|
|
104
|
+
localModels?: Set<string>;
|
|
105
|
+
}
|
|
106
|
+
/** Resolve the informational list cost for a model ref (e.g. from spend pricing). */
|
|
107
|
+
export type ModelCostResolver = (ref: ModelRef) => ModelCost | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Whether a catalog model is selectable for the given capabilities — it has at least
|
|
110
|
+
* one usable flavour (a configured direct key, an enabled Cloudflare lib, or a
|
|
111
|
+
* connected subscription vendor). Unknown ids are not usable.
|
|
112
|
+
*/
|
|
113
|
+
export declare function isModelUsable(id: string | undefined | null, caps: ProviderCapabilities): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* The subscription option for a catalog model id (vendor + ref carrying the
|
|
116
|
+
* harness), or undefined when the model has no subscription path. The executor
|
|
117
|
+
* uses this to override a step to its subscription flavour when the workspace has
|
|
118
|
+
* a pooled token for the vendor — "subscriptions always win".
|
|
119
|
+
*/
|
|
120
|
+
export declare function subscriptionOptionFor(id: string | undefined | null): {
|
|
121
|
+
vendor: SubscriptionVendor;
|
|
122
|
+
ref: ModelRef;
|
|
123
|
+
} | undefined;
|
|
124
|
+
/** Whether a vendor's subscription is licensed for individual use only (e.g. `claude`). */
|
|
125
|
+
export declare function isIndividualVendor(vendor: SubscriptionVendor): boolean;
|
|
126
|
+
/** Every vendor flagged individual-usage only — the single source of truth for the
|
|
127
|
+
* per-user personal-subscription flow (e.g. activation refresh) so it never drifts
|
|
128
|
+
* from {@link SUBSCRIPTION_VENDORS}. */
|
|
129
|
+
export declare const INDIVIDUAL_VENDORS: SubscriptionVendor[];
|
|
130
|
+
/**
|
|
131
|
+
* The individual-usage vendor a catalog model id runs on, or null. A model triggers
|
|
132
|
+
* the individual-usage restricted mode (per-user credential, no recurring, etc.) only
|
|
133
|
+
* when it has a subscription flavour AND that vendor is `individualOnly`. Used by the
|
|
134
|
+
* engine/controllers to gate a run on the initiator's personal subscription.
|
|
135
|
+
*/
|
|
136
|
+
export declare function individualVendorForModelId(id: string | undefined | null): SubscriptionVendor | null;
|
|
137
|
+
/**
|
|
138
|
+
* The individual-usage vendor whose PERSONAL credential a run on this catalog model id
|
|
139
|
+
* will ACTUALLY lease, given whether the run's user already has a personal subscription
|
|
140
|
+
* for the candidate vendor (`hasPersonalSubscription`). Returns null when no personal
|
|
141
|
+
* credential is needed. This is the gating-accurate refinement of
|
|
142
|
+
* {@link individualVendorForModelId}, and mirrors
|
|
143
|
+
* `ContainerAgentExecutor.resolveEffectiveRef`, so the credential gate prompts for a
|
|
144
|
+
* password exactly when dispatch will use one:
|
|
145
|
+
*
|
|
146
|
+
* - SUBSCRIPTION-ONLY individual model (Claude / Codex — no Cloudflare/direct base):
|
|
147
|
+
* there is no fallback, so the personal credential is always required.
|
|
148
|
+
* - DUAL-MODE individual model (e.g. GLM, which also has a Cloudflare base): per-user.
|
|
149
|
+
* A user WITH their own personal subscription for the vendor runs on it (gated on
|
|
150
|
+
* their password); a user WITHOUT one falls back to the Cloudflare base and is not
|
|
151
|
+
* gated. (Individual vendors are never pooled, so there is no shared fallback — only
|
|
152
|
+
* the user's own subscription or the base.)
|
|
153
|
+
* - Poolable / non-subscription models: never need a personal credential.
|
|
154
|
+
*/
|
|
155
|
+
export declare function personalCredentialVendorForModelId(id: string | undefined | null, hasPersonalSubscription: (vendor: SubscriptionVendor) => boolean): SubscriptionVendor | null;
|
|
156
|
+
/**
|
|
157
|
+
* The effective catalog for a deployment: each model resolved to the flavour that
|
|
158
|
+
* is actually in use given which direct-provider keys are configured. Served to
|
|
159
|
+
* the frontend so the picker can show whether a model runs direct, on Cloudflare,
|
|
160
|
+
* or on a subscription harness — plus its informational list cost when `costFor`
|
|
161
|
+
* is supplied. Subscription models are always listed; the frontend gates them on
|
|
162
|
+
* whether the workspace has a token for the vendor.
|
|
163
|
+
*/
|
|
164
|
+
export declare function effectiveCatalog(caps: ProviderCapabilities, costFor?: ModelCostResolver): ModelOption[];
|
|
165
|
+
/**
|
|
166
|
+
* Like {@link effectiveCatalog}, but with deployment/user-specific extra models
|
|
167
|
+
* appended to the static catalog — used to surface a user's locally-run models
|
|
168
|
+
* (see {@link localSelectableModels}) alongside the built-in catalog.
|
|
169
|
+
*/
|
|
170
|
+
export declare function effectiveCatalogWith(extra: SelectableModel[], caps: ProviderCapabilities, costFor?: ModelCostResolver): ModelOption[];
|
|
171
|
+
/** A user's enabled models for one local runner endpoint. */
|
|
172
|
+
export interface LocalEndpointModels {
|
|
173
|
+
/** The runner provider id (e.g. `ollama`), also the `ModelRef.provider`. */
|
|
174
|
+
provider: string;
|
|
175
|
+
/** The provider label shown in the picker (e.g. `Ollama`). */
|
|
176
|
+
label: string;
|
|
177
|
+
/** Enabled model ids on this endpoint. */
|
|
178
|
+
models: string[];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Build the dynamic, per-user catalog entries for a set of configured local endpoints.
|
|
182
|
+
* Each enabled model becomes a `direct`-flavour {@link SelectableModel} with a stable id
|
|
183
|
+
* `"<provider>:<model>"` and no key requirement (gated by `localModels`).
|
|
184
|
+
*/
|
|
185
|
+
export declare function localSelectableModels(endpoints: LocalEndpointModels[]): SelectableModel[];
|
|
186
|
+
/**
|
|
187
|
+
* Parse a dynamic local-model id of the form `"<provider>:<model>"` into a {@link ModelRef}.
|
|
188
|
+
* Splits on the FIRST colon so model ids that themselves contain colons (e.g.
|
|
189
|
+
* `ollama:qwen2.5-coder:32b`) round-trip correctly. Returns undefined for non-local ids.
|
|
190
|
+
*/
|
|
191
|
+
export declare function parseLocalModelId(id: string | undefined | null): {
|
|
192
|
+
provider: string;
|
|
193
|
+
model: string;
|
|
194
|
+
} | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Resolve a block's selected model id to the {@link ModelRef} that should run it,
|
|
197
|
+
* honouring the direct/Cloudflare fallback and carrying the subscription harness
|
|
198
|
+
* when applicable. Returns `undefined` for an unknown or absent id so the caller
|
|
199
|
+
* falls back to its default routing.
|
|
200
|
+
*/
|
|
201
|
+
export declare function resolveModelRef(id: string | undefined | null, caps: ProviderCapabilities): ModelRef | undefined;
|
|
202
|
+
/** Every subscription vendor (the full set), for building a permissive capability set. */
|
|
203
|
+
export declare const ALL_SUBSCRIPTION_VENDORS: SubscriptionVendor[];
|
|
204
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/domain/models.ts"],"names":[],"mappings":"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"}
|