@intentic/sandbox-contract 1.330.0 → 1.332.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/README.md +15 -0
- package/dist/chores/probes.d.ts.map +1 -1
- package/dist/chores/probes.js.map +1 -1
- package/dist/contracts/accounts.contract.d.ts +15 -0
- package/dist/contracts/accounts.contract.d.ts.map +1 -1
- package/dist/contracts/agent.contract.d.ts +38 -0
- package/dist/contracts/agent.contract.d.ts.map +1 -1
- package/dist/contracts/agent.contract.js +14 -3
- package/dist/contracts/agent.contract.js.map +1 -1
- package/dist/contracts/agents.contract.d.ts +29 -0
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/automations.contract.d.ts +2 -0
- package/dist/contracts/automations.contract.d.ts.map +1 -1
- package/dist/contracts/device.contract.d.ts +7 -0
- package/dist/contracts/device.contract.d.ts.map +1 -1
- package/dist/contracts/git.contract.d.ts +2 -0
- package/dist/contracts/git.contract.d.ts.map +1 -1
- package/dist/contracts/logs.contract.d.ts +10 -0
- package/dist/contracts/logs.contract.d.ts.map +1 -1
- package/dist/contracts/needs.contract.d.ts +7 -0
- package/dist/contracts/needs.contract.d.ts.map +1 -1
- package/dist/contracts/offload.contract.d.ts +70 -0
- package/dist/contracts/offload.contract.d.ts.map +1 -1
- package/dist/contracts/offload.contract.js +10 -1
- package/dist/contracts/offload.contract.js.map +1 -1
- package/dist/contracts/privacy.contract.d.ts +14 -0
- package/dist/contracts/privacy.contract.d.ts.map +1 -1
- package/dist/contracts/privacy.contract.js +11 -1
- package/dist/contracts/privacy.contract.js.map +1 -1
- package/dist/contracts/providers.contract.d.ts +3 -0
- package/dist/contracts/providers.contract.d.ts.map +1 -1
- package/dist/contracts/runner.contract.d.ts +106 -2
- package/dist/contracts/runner.contract.d.ts.map +1 -1
- package/dist/contracts/sessions.contract.d.ts +1 -0
- package/dist/contracts/sessions.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.d.ts +74 -94
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.js +19 -1
- package/dist/contracts/settings.contract.js.map +1 -1
- package/dist/contracts/system.contract.d.ts +20 -0
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/contracts/translator.contract.d.ts +8 -0
- package/dist/contracts/translator.contract.d.ts.map +1 -1
- package/dist/events/agent-events.d.ts +47 -0
- package/dist/events/agent-events.d.ts.map +1 -1
- package/dist/events/agent-events.js +6 -0
- package/dist/events/agent-events.js.map +1 -1
- package/dist/events/agent-words.d.ts.map +1 -1
- package/dist/events/agent-words.js +1 -1
- package/dist/events/agent-words.js.map +1 -1
- package/dist/events/resume.d.ts +3 -0
- package/dist/events/resume.d.ts.map +1 -1
- package/dist/events/resume.js +17 -2
- package/dist/events/resume.js.map +1 -1
- package/dist/events/sandbox-notice.d.ts +18 -0
- package/dist/events/sandbox-notice.d.ts.map +1 -1
- package/dist/events/sandbox-notice.js +27 -1
- package/dist/events/sandbox-notice.js.map +1 -1
- package/dist/events/system-events.d.ts +4 -0
- package/dist/events/system-events.d.ts.map +1 -1
- package/dist/events/transcript.d.ts +64 -0
- package/dist/events/transcript.d.ts.map +1 -1
- package/dist/events/transcript.js +17 -1
- package/dist/events/transcript.js.map +1 -1
- package/dist/index.d.ts +327 -124
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/models/agent-catalog.d.ts.map +1 -1
- package/dist/models/agent-catalog.js +8 -7
- package/dist/models/agent-catalog.js.map +1 -1
- package/dist/models/agent-runtimes.d.ts +3 -1
- package/dist/models/agent-runtimes.d.ts.map +1 -1
- package/dist/models/agent-runtimes.js +10 -0
- package/dist/models/agent-runtimes.js.map +1 -1
- package/dist/models/model-order.d.ts +1 -0
- package/dist/models/model-order.d.ts.map +1 -1
- package/dist/models/model-order.js +9 -0
- package/dist/models/model-order.js.map +1 -1
- package/dist/models/model-pins.d.ts.map +1 -1
- package/dist/models/model-pins.js.map +1 -1
- package/dist/models/model-roles.d.ts +32 -17
- package/dist/models/model-roles.d.ts.map +1 -1
- package/dist/models/model-roles.js +30 -26
- package/dist/models/model-roles.js.map +1 -1
- package/dist/models/model-setups.d.ts +46 -0
- package/dist/models/model-setups.d.ts.map +1 -0
- package/dist/models/model-setups.js +86 -0
- package/dist/models/model-setups.js.map +1 -0
- package/dist/models/plan-pools.d.ts +5 -1
- package/dist/models/plan-pools.d.ts.map +1 -1
- package/dist/models/plan-pools.js +41 -13
- package/dist/models/plan-pools.js.map +1 -1
- package/dist/models/provider-specs.d.ts +20 -0
- package/dist/models/provider-specs.d.ts.map +1 -1
- package/dist/models/provider-specs.js +13 -1
- package/dist/models/provider-specs.js.map +1 -1
- package/dist/policy/command-classes.d.ts.map +1 -1
- package/dist/policy/command-classes.js +26 -3
- package/dist/policy/command-classes.js.map +1 -1
- package/dist/policy/credential-material.d.ts +6 -0
- package/dist/policy/credential-material.d.ts.map +1 -1
- package/dist/policy/credential-material.js +37 -15
- package/dist/policy/credential-material.js.map +1 -1
- package/dist/policy/search-globs.d.ts +3 -0
- package/dist/policy/search-globs.d.ts.map +1 -1
- package/dist/policy/search-globs.js +118 -0
- package/dist/policy/search-globs.js.map +1 -1
- package/dist/policy/secret-hosts.d.ts +1 -0
- package/dist/policy/secret-hosts.d.ts.map +1 -1
- package/dist/policy/secret-hosts.js +1 -0
- package/dist/policy/secret-hosts.js.map +1 -1
- package/dist/policy/turned-away.d.ts.map +1 -1
- package/dist/policy/turned-away.js +1 -0
- package/dist/policy/turned-away.js.map +1 -1
- package/dist/protocol/doors/runner-protocol.d.ts +9 -0
- package/dist/protocol/doors/runner-protocol.d.ts.map +1 -1
- package/dist/protocol/doors/runner-protocol.js +5 -0
- package/dist/protocol/doors/runner-protocol.js.map +1 -1
- package/dist/protocol/pairing-redeem.d.ts +23 -0
- package/dist/protocol/pairing-redeem.d.ts.map +1 -0
- package/dist/protocol/pairing-redeem.js +44 -0
- package/dist/protocol/pairing-redeem.js.map +1 -0
- package/dist/protocol/peer-mcp-server.d.ts.map +1 -1
- package/dist/protocol/peer-mcp-server.js +1 -1
- package/dist/protocol/peer-mcp-server.js.map +1 -1
- package/dist/protocol/raw/raw-json-routes.d.ts +16 -0
- package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-json-routes.js +2 -0
- package/dist/protocol/raw/raw-json-routes.js.map +1 -1
- package/dist/protocol/raw/raw-routes.d.ts +8 -0
- package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-routes.js +2 -0
- package/dist/protocol/raw/raw-routes.js.map +1 -1
- package/dist/protocol/sse.d.ts +20 -1
- package/dist/protocol/sse.d.ts.map +1 -1
- package/dist/protocol/sse.js +112 -17
- package/dist/protocol/sse.js.map +1 -1
- package/dist/schemas/agent.d.ts +35 -0
- package/dist/schemas/agent.d.ts.map +1 -1
- package/dist/schemas/agent.js +12 -1
- package/dist/schemas/agent.js.map +1 -1
- package/dist/schemas/automations.d.ts +6 -0
- package/dist/schemas/automations.d.ts.map +1 -1
- package/dist/schemas/automations.js +3 -1
- package/dist/schemas/automations.js.map +1 -1
- package/dist/schemas/devices.d.ts +17 -0
- package/dist/schemas/devices.d.ts.map +1 -1
- package/dist/schemas/devices.js +2 -1
- package/dist/schemas/devices.js.map +1 -1
- package/dist/schemas/engines.d.ts +8 -1
- package/dist/schemas/engines.d.ts.map +1 -1
- package/dist/schemas/engines.js +1 -1
- package/dist/schemas/engines.js.map +1 -1
- package/dist/schemas/environment.d.ts +30 -0
- package/dist/schemas/environment.d.ts.map +1 -1
- package/dist/schemas/environment.js +13 -0
- package/dist/schemas/environment.js.map +1 -1
- package/dist/schemas/git/git-scope.d.ts +20 -0
- package/dist/schemas/git/git-scope.d.ts.map +1 -0
- package/dist/schemas/git/git-scope.js +37 -0
- package/dist/schemas/git/git-scope.js.map +1 -0
- package/dist/schemas/git/git.d.ts +1 -0
- package/dist/schemas/git/git.d.ts.map +1 -1
- package/dist/schemas/git/git.js +9 -1
- package/dist/schemas/git/git.js.map +1 -1
- package/dist/schemas/hosts.d.ts +42 -0
- package/dist/schemas/hosts.d.ts.map +1 -1
- package/dist/schemas/hosts.js +3 -0
- package/dist/schemas/hosts.js.map +1 -1
- package/dist/schemas/keep-warm.d.ts +1 -0
- package/dist/schemas/keep-warm.d.ts.map +1 -1
- package/dist/schemas/keep-warm.js +1 -1
- package/dist/schemas/keep-warm.js.map +1 -1
- package/dist/schemas/logs.d.ts +21 -0
- package/dist/schemas/logs.d.ts.map +1 -1
- package/dist/schemas/logs.js +19 -0
- package/dist/schemas/logs.js.map +1 -1
- package/dist/schemas/metrics.d.ts +12 -0
- package/dist/schemas/metrics.d.ts.map +1 -1
- package/dist/schemas/metrics.js +26 -8
- package/dist/schemas/metrics.js.map +1 -1
- package/dist/schemas/needs.d.ts +19 -0
- package/dist/schemas/needs.d.ts.map +1 -1
- package/dist/schemas/needs.js +17 -3
- package/dist/schemas/needs.js.map +1 -1
- package/dist/schemas/offload.d.ts +154 -0
- package/dist/schemas/offload.d.ts.map +1 -1
- package/dist/schemas/offload.js +34 -0
- package/dist/schemas/offload.js.map +1 -1
- package/dist/schemas/privacy.d.ts +19 -0
- package/dist/schemas/privacy.d.ts.map +1 -1
- package/dist/schemas/privacy.js +17 -2
- package/dist/schemas/privacy.js.map +1 -1
- package/dist/schemas/project-bring-back.d.ts +172 -0
- package/dist/schemas/project-bring-back.d.ts.map +1 -0
- package/dist/schemas/project-bring-back.js +39 -0
- package/dist/schemas/project-bring-back.js.map +1 -0
- package/dist/schemas/providers/handoff.d.ts +77 -0
- package/dist/schemas/providers/handoff.d.ts.map +1 -0
- package/dist/schemas/providers/handoff.js +85 -0
- package/dist/schemas/providers/handoff.js.map +1 -0
- package/dist/schemas/providers/plan-limits.d.ts +34 -0
- package/dist/schemas/providers/plan-limits.d.ts.map +1 -1
- package/dist/schemas/providers/plan-limits.js +13 -2
- package/dist/schemas/providers/plan-limits.js.map +1 -1
- package/dist/schemas/providers/provider-oauth.d.ts +8 -0
- package/dist/schemas/providers/provider-oauth.d.ts.map +1 -1
- package/dist/schemas/providers/usage.d.ts +3 -1
- package/dist/schemas/providers/usage.d.ts.map +1 -1
- package/dist/schemas/providers/usage.js +7 -2
- package/dist/schemas/providers/usage.js.map +1 -1
- package/dist/schemas/run-targets.d.ts.map +1 -1
- package/dist/schemas/run-targets.js +5 -2
- package/dist/schemas/run-targets.js.map +1 -1
- package/dist/schemas/settings-history.d.ts +6 -1
- package/dist/schemas/settings-history.d.ts.map +1 -1
- package/dist/schemas/settings-history.js +25 -1
- package/dist/schemas/settings-history.js.map +1 -1
- package/dist/schemas/settings.d.ts +69 -100
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +41 -24
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/short-codes.d.ts +31 -0
- package/dist/schemas/short-codes.d.ts.map +1 -0
- package/dist/schemas/short-codes.js +28 -0
- package/dist/schemas/short-codes.js.map +1 -0
- package/dist/schemas/system.d.ts +130 -0
- package/dist/schemas/system.d.ts.map +1 -1
- package/dist/schemas/system.js +37 -1
- package/dist/schemas/system.js.map +1 -1
- package/dist/state/definition.d.ts +64 -40
- package/dist/state/definition.d.ts.map +1 -1
- package/dist/state/history-state.d.ts.map +1 -1
- package/dist/state/history-state.js +1 -0
- package/dist/state/history-state.js.map +1 -1
- package/dist/state/runtime-state.d.ts +3 -0
- package/dist/state/runtime-state.d.ts.map +1 -1
- package/dist/state/runtime-state.js +1 -0
- package/dist/state/runtime-state.js.map +1 -1
- package/dist/state/versions.d.ts +6 -0
- package/dist/state/versions.d.ts.map +1 -1
- package/dist/state/versions.js +47 -0
- package/dist/state/versions.js.map +1 -1
- package/dist/text/embed.d.ts +2 -1
- package/dist/text/embed.d.ts.map +1 -1
- package/dist/text/embed.js +10 -5
- package/dist/text/embed.js.map +1 -1
- package/dist/text/title.d.ts.map +1 -1
- package/dist/text/title.js +4 -7
- package/dist/text/title.js.map +1 -1
- package/dist/text/transcript-fold.d.ts +2 -1
- package/dist/text/transcript-fold.d.ts.map +1 -1
- package/dist/text/transcript-fold.js +21 -6
- package/dist/text/transcript-fold.js.map +1 -1
- package/package.json +28 -6
- package/src/chores/probes.ts +3 -1
- package/src/contracts/agent.contract.ts +24 -3
- package/src/contracts/offload.contract.ts +21 -1
- package/src/contracts/privacy.contract.ts +13 -0
- package/src/contracts/settings.contract.ts +23 -0
- package/src/events/agent-events.ts +13 -0
- package/src/events/agent-words.ts +2 -3
- package/src/events/resume.test.ts +14 -2
- package/src/events/resume.ts +32 -3
- package/src/events/sandbox-notice.ts +31 -1
- package/src/events/transcript.ts +27 -2
- package/src/index.ts +5 -0
- package/src/models/agent-catalog.test.ts +4 -3
- package/src/models/agent-catalog.ts +10 -7
- package/src/models/agent-runtimes.ts +30 -1
- package/src/models/capability-ledger.test.ts +4 -0
- package/src/models/model-order.ts +13 -0
- package/src/models/model-pins.ts +5 -4
- package/src/models/model-roles.test.ts +9 -31
- package/src/models/model-roles.ts +42 -49
- package/src/models/model-setups.test.ts +100 -0
- package/src/models/model-setups.ts +151 -0
- package/src/models/plan-pools.test.ts +85 -0
- package/src/models/plan-pools.ts +76 -17
- package/src/models/provider-specs.ts +20 -2
- package/src/policy/command-classes.ts +34 -3
- package/src/policy/credential-material.ts +58 -16
- package/src/policy/search-globs.ts +135 -0
- package/src/policy/secret-hosts.ts +7 -0
- package/src/policy/tests/command-classes.test.ts +35 -0
- package/src/policy/tests/credential-material.test.ts +20 -0
- package/src/policy/tests/search-globs.test.ts +46 -1
- package/src/policy/tests/secret-hosts.test.ts +17 -1
- package/src/policy/turned-away.ts +2 -0
- package/src/protocol/doors/runner-protocol.ts +14 -1
- package/src/protocol/pairing-redeem.test.ts +86 -0
- package/src/protocol/pairing-redeem.ts +79 -0
- package/src/protocol/peer-mcp-server.ts +1 -2
- package/src/protocol/raw/raw-json-routes.ts +3 -0
- package/src/protocol/raw/raw-routes.ts +5 -0
- package/src/protocol/sse.test.ts +50 -1
- package/src/protocol/sse.ts +172 -26
- package/src/schemas/agent.ts +23 -2
- package/src/schemas/automations.ts +6 -2
- package/src/schemas/daemon-health.test.ts +28 -0
- package/src/schemas/devices.ts +11 -2
- package/src/schemas/engines.ts +1 -1
- package/src/schemas/environment.ts +25 -0
- package/src/schemas/git/git-scope.test.ts +91 -0
- package/src/schemas/git/git-scope.ts +71 -0
- package/src/schemas/git/git.ts +15 -1
- package/src/schemas/hosts.ts +7 -0
- package/src/schemas/keep-warm.ts +2 -1
- package/src/schemas/logs.ts +25 -0
- package/src/schemas/metrics.test.ts +80 -0
- package/src/schemas/metrics.ts +31 -9
- package/src/schemas/needs.ts +29 -3
- package/src/schemas/offload.ts +76 -0
- package/src/schemas/privacy.ts +27 -3
- package/src/schemas/project-bring-back.test.ts +15 -0
- package/src/schemas/project-bring-back.ts +78 -0
- package/src/schemas/providers/handoff.test.ts +42 -0
- package/src/schemas/providers/handoff.ts +128 -0
- package/src/schemas/providers/plan-limits.ts +23 -2
- package/src/schemas/providers/usage.ts +13 -7
- package/src/schemas/run-targets.ts +5 -2
- package/src/schemas/settings-history.ts +43 -1
- package/src/schemas/settings.test.ts +84 -6
- package/src/schemas/settings.ts +74 -44
- package/src/schemas/short-codes.ts +48 -0
- package/src/schemas/system.ts +63 -1
- package/src/state/history-state.ts +4 -0
- package/src/state/runtime-state.test.ts +4 -0
- package/src/state/runtime-state.ts +4 -0
- package/src/state/versions.test.ts +30 -1
- package/src/state/versions.ts +68 -0
- package/src/text/embed.test.ts +14 -0
- package/src/text/embed.ts +19 -10
- package/src/text/title.ts +5 -9
- package/src/text/transcript-fold.test.ts +61 -0
- package/src/text/transcript-fold.ts +31 -6
|
@@ -4,14 +4,15 @@ export declare const ModelRoleKindSchema: z.ZodEnum<{
|
|
|
4
4
|
run: "run";
|
|
5
5
|
}>;
|
|
6
6
|
export type ModelRoleKind = z.infer<typeof ModelRoleKindSchema>;
|
|
7
|
-
export
|
|
7
|
+
export declare const PRESET_SETUPS: readonly ["low", "medium", "high"];
|
|
8
|
+
export type PresetSetup = (typeof PRESET_SETUPS)[number];
|
|
8
9
|
interface ModelRoleRow {
|
|
9
10
|
readonly id: string;
|
|
10
11
|
readonly label: string;
|
|
11
12
|
readonly blurb: string;
|
|
12
13
|
readonly kind: ModelRoleKind;
|
|
13
|
-
readonly trigger?: ModelRoleTrigger;
|
|
14
14
|
readonly icon: string;
|
|
15
|
+
readonly setup: PresetSetup;
|
|
15
16
|
}
|
|
16
17
|
export declare const MODEL_ROLES: readonly [{
|
|
17
18
|
readonly id: "commit-message";
|
|
@@ -19,86 +20,105 @@ export declare const MODEL_ROLES: readonly [{
|
|
|
19
20
|
readonly blurb: "The subject written when an agent's work lands, and the release note under it.";
|
|
20
21
|
readonly kind: "helper";
|
|
21
22
|
readonly icon: "file-edit";
|
|
23
|
+
readonly setup: "low";
|
|
22
24
|
}, {
|
|
23
25
|
readonly id: "session-title";
|
|
24
26
|
readonly label: "Session titles";
|
|
25
27
|
readonly blurb: "The name a conversation wears on the board, written a second into its first turn.";
|
|
26
28
|
readonly kind: "helper";
|
|
27
29
|
readonly icon: "pencil";
|
|
30
|
+
readonly setup: "low";
|
|
28
31
|
}, {
|
|
29
32
|
readonly id: "safety-judge";
|
|
30
33
|
readonly label: "Safety judge";
|
|
31
34
|
readonly blurb: "Which model reads your safety policy before a flagged command runs.";
|
|
32
35
|
readonly kind: "helper";
|
|
33
36
|
readonly icon: "shield";
|
|
37
|
+
readonly setup: "medium";
|
|
34
38
|
}, {
|
|
35
39
|
readonly id: "loop-verdict";
|
|
36
40
|
readonly label: "Loop verdicts";
|
|
37
41
|
readonly blurb: "Whether a loop's iteration met the goal, or the loop goes round again.";
|
|
38
42
|
readonly kind: "helper";
|
|
39
43
|
readonly icon: "check-square";
|
|
44
|
+
readonly setup: "medium";
|
|
45
|
+
}, {
|
|
46
|
+
readonly id: "handoff-summary";
|
|
47
|
+
readonly label: "Hand-off summaries";
|
|
48
|
+
readonly blurb: "The summary a fresh session opens with when you choose to summarise a long conversation that hit a usage limit, instead of re-reading it all.";
|
|
49
|
+
readonly kind: "helper";
|
|
50
|
+
readonly icon: "align-left";
|
|
51
|
+
readonly setup: "low";
|
|
40
52
|
}, {
|
|
41
53
|
readonly id: "model-router";
|
|
42
54
|
readonly label: "New chat routing";
|
|
43
55
|
readonly blurb: "Which model reads a new chat's first message and picks what it opens on: the model, effort and account, and the persona.";
|
|
44
56
|
readonly kind: "helper";
|
|
45
57
|
readonly icon: "sparkles";
|
|
58
|
+
readonly setup: "low";
|
|
46
59
|
}, {
|
|
47
60
|
readonly id: "pipeline-fix";
|
|
48
61
|
readonly label: "Pipeline fixes";
|
|
49
62
|
readonly blurb: "The agent started by Fix on a failed pipeline.";
|
|
50
63
|
readonly kind: "run";
|
|
51
|
-
readonly trigger: "pressed";
|
|
52
64
|
readonly icon: "wave-pulse";
|
|
65
|
+
readonly setup: "high";
|
|
53
66
|
}, {
|
|
54
67
|
readonly id: "deployment-fix";
|
|
55
68
|
readonly label: "Deployment fixes";
|
|
56
69
|
readonly blurb: "The agent started by Fix on a deployment that is down.";
|
|
57
70
|
readonly kind: "run";
|
|
58
|
-
readonly trigger: "pressed";
|
|
59
71
|
readonly icon: "server";
|
|
72
|
+
readonly setup: "high";
|
|
60
73
|
}, {
|
|
61
74
|
readonly id: "maintenance-chore";
|
|
62
75
|
readonly label: "Maintenance chores";
|
|
63
76
|
readonly blurb: "A chore run started from the Maintenance board.";
|
|
64
77
|
readonly kind: "run";
|
|
65
|
-
readonly trigger: "pressed";
|
|
66
78
|
readonly icon: "wrench";
|
|
79
|
+
readonly setup: "medium";
|
|
80
|
+
}, {
|
|
81
|
+
readonly id: "refactor-run";
|
|
82
|
+
readonly label: "Refactors";
|
|
83
|
+
readonly blurb: "The agent started from a hotspot or key module on a repository's Health tab.";
|
|
84
|
+
readonly kind: "run";
|
|
85
|
+
readonly icon: "hammer";
|
|
86
|
+
readonly setup: "high";
|
|
67
87
|
}, {
|
|
68
88
|
readonly id: "documentation-run";
|
|
69
89
|
readonly label: "Documentation runs";
|
|
70
90
|
readonly blurb: "A pass over a repo's own documentation.";
|
|
71
91
|
readonly kind: "run";
|
|
72
|
-
readonly trigger: "pressed";
|
|
73
92
|
readonly icon: "book";
|
|
93
|
+
readonly setup: "medium";
|
|
74
94
|
}, {
|
|
75
95
|
readonly id: "acceptance-run";
|
|
76
96
|
readonly label: "Acceptance runs";
|
|
77
97
|
readonly blurb: "One session per story in an acceptance fan-out.";
|
|
78
98
|
readonly kind: "run";
|
|
79
|
-
readonly trigger: "pressed";
|
|
80
99
|
readonly icon: "list-check";
|
|
100
|
+
readonly setup: "high";
|
|
81
101
|
}, {
|
|
82
102
|
readonly id: "approval-queue";
|
|
83
103
|
readonly label: "Approvals queue";
|
|
84
104
|
readonly blurb: "The turn that publishes or acts on what you approved.";
|
|
85
105
|
readonly kind: "run";
|
|
86
|
-
readonly trigger: "pressed";
|
|
87
106
|
readonly icon: "check-circle";
|
|
107
|
+
readonly setup: "medium";
|
|
88
108
|
}, {
|
|
89
109
|
readonly id: "extension-review";
|
|
90
110
|
readonly label: "Extension update reviews";
|
|
91
111
|
readonly blurb: "The agent that reads an extension update before it is applied.";
|
|
92
112
|
readonly kind: "run";
|
|
93
|
-
readonly trigger: "unprompted";
|
|
94
113
|
readonly icon: "box";
|
|
114
|
+
readonly setup: "medium";
|
|
95
115
|
}, {
|
|
96
116
|
readonly id: "loop-iteration";
|
|
97
117
|
readonly label: "Loop iterations";
|
|
98
118
|
readonly blurb: "Each round of a loop working towards its goal.";
|
|
99
119
|
readonly kind: "run";
|
|
100
|
-
readonly trigger: "unprompted";
|
|
101
120
|
readonly icon: "repeat";
|
|
121
|
+
readonly setup: "high";
|
|
102
122
|
}];
|
|
103
123
|
export type ModelRole = (typeof MODEL_ROLES)[number]["id"];
|
|
104
124
|
export type ModelRoleSpec = ModelRoleRow & {
|
|
@@ -112,20 +132,15 @@ export declare const ModelRoleSchema: z.ZodEnum<{
|
|
|
112
132
|
"deployment-fix": "deployment-fix";
|
|
113
133
|
"documentation-run": "documentation-run";
|
|
114
134
|
"extension-review": "extension-review";
|
|
135
|
+
"handoff-summary": "handoff-summary";
|
|
115
136
|
"loop-iteration": "loop-iteration";
|
|
116
137
|
"loop-verdict": "loop-verdict";
|
|
117
138
|
"maintenance-chore": "maintenance-chore";
|
|
118
139
|
"model-router": "model-router";
|
|
119
140
|
"pipeline-fix": "pipeline-fix";
|
|
141
|
+
"refactor-run": "refactor-run";
|
|
120
142
|
"safety-judge": "safety-judge";
|
|
121
143
|
"session-title": "session-title";
|
|
122
144
|
}>;
|
|
123
|
-
export type ModelRoleBlockId = "helper" | "pressed" | "unprompted";
|
|
124
|
-
export interface ModelRoleBlock {
|
|
125
|
-
readonly id: ModelRoleBlockId;
|
|
126
|
-
readonly label: string;
|
|
127
|
-
readonly roles: readonly ModelRoleSpec[];
|
|
128
|
-
}
|
|
129
|
-
export declare const MODEL_ROLE_BLOCKS: readonly ModelRoleBlock[];
|
|
130
145
|
export {};
|
|
131
146
|
//# sourceMappingURL=model-roles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-roles.d.ts","sourceRoot":"","sources":["../../src/models/model-roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"model-roles.d.ts","sourceRoot":"","sources":["../../src/models/model-roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,mBAAmB;;;EAA4B,CAAC;AAC7D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAIhE,eAAO,MAAM,aAAa,YAAI,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,C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mBAC1C,KAAK;mBACL,MAAM;oBACL,QAAQ;;iBAGX,gBAAgB;oBACb,iBAAiB;oBACjB,iDAAiD;mBAClD,KAAK;mBACL,YAAY;oBACX,MAAM;;iBAGT,gBAAgB;oBACb,iBAAiB;oBACjB,uDAAuD;mBACxD,KAAK;mBACL,cAAc;oBACb,QAAQ;;iBAGX,kBAAkB;oBACf,0BAA0B;oBAC1B,gEAAgE;mBACjE,KAAK;mBACL,KAAK;oBACJ,QAAQ;;iBAGX,gBAAgB;oBACb,iBAAiB;oBACjB,gDAAgD;mBACjD,KAAK;mBACL,QAAQ;oBACP,MAAM;EAEuB,CAAC;AAE7C,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3D,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAA;CAAE,CAAC;AAEtE,eAAO,MAAM,cAAc,EAAyC,SAAS,SAAS,EAAE,CAAC;AAGzF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;EAAwD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export const ModelRoleKindSchema = z.enum(["helper", "run"]);
|
|
3
|
+
export const PRESET_SETUPS = ["low", "medium", "high"];
|
|
3
4
|
export const MODEL_ROLES = [
|
|
4
5
|
{
|
|
5
6
|
id: "commit-message",
|
|
@@ -7,6 +8,7 @@ export const MODEL_ROLES = [
|
|
|
7
8
|
blurb: "The subject written when an agent's work lands, and the release note under it.",
|
|
8
9
|
kind: "helper",
|
|
9
10
|
icon: "file-edit",
|
|
11
|
+
setup: "low",
|
|
10
12
|
},
|
|
11
13
|
{
|
|
12
14
|
id: "session-title",
|
|
@@ -14,6 +16,7 @@ export const MODEL_ROLES = [
|
|
|
14
16
|
blurb: "The name a conversation wears on the board, written a second into its first turn.",
|
|
15
17
|
kind: "helper",
|
|
16
18
|
icon: "pencil",
|
|
19
|
+
setup: "low",
|
|
17
20
|
},
|
|
18
21
|
{
|
|
19
22
|
id: "safety-judge",
|
|
@@ -21,6 +24,7 @@ export const MODEL_ROLES = [
|
|
|
21
24
|
blurb: "Which model reads your safety policy before a flagged command runs.",
|
|
22
25
|
kind: "helper",
|
|
23
26
|
icon: "shield",
|
|
27
|
+
setup: "medium",
|
|
24
28
|
},
|
|
25
29
|
{
|
|
26
30
|
id: "loop-verdict",
|
|
@@ -28,6 +32,15 @@ export const MODEL_ROLES = [
|
|
|
28
32
|
blurb: "Whether a loop's iteration met the goal, or the loop goes round again.",
|
|
29
33
|
kind: "helper",
|
|
30
34
|
icon: "check-square",
|
|
35
|
+
setup: "medium",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "handoff-summary",
|
|
39
|
+
label: "Hand-off summaries",
|
|
40
|
+
blurb: "The summary a fresh session opens with when you choose to summarise a long conversation that hit a usage limit, instead of re-reading it all.",
|
|
41
|
+
kind: "helper",
|
|
42
|
+
icon: "align-left",
|
|
43
|
+
setup: "low",
|
|
31
44
|
},
|
|
32
45
|
{
|
|
33
46
|
id: "model-router",
|
|
@@ -35,90 +48,81 @@ export const MODEL_ROLES = [
|
|
|
35
48
|
blurb: "Which model reads a new chat's first message and picks what it opens on: the model, effort and account, and the persona.",
|
|
36
49
|
kind: "helper",
|
|
37
50
|
icon: "sparkles",
|
|
51
|
+
setup: "low",
|
|
38
52
|
},
|
|
39
53
|
{
|
|
40
54
|
id: "pipeline-fix",
|
|
41
55
|
label: "Pipeline fixes",
|
|
42
56
|
blurb: "The agent started by Fix on a failed pipeline.",
|
|
43
57
|
kind: "run",
|
|
44
|
-
trigger: "pressed",
|
|
45
58
|
icon: "wave-pulse",
|
|
59
|
+
setup: "high",
|
|
46
60
|
},
|
|
47
61
|
{
|
|
48
62
|
id: "deployment-fix",
|
|
49
63
|
label: "Deployment fixes",
|
|
50
64
|
blurb: "The agent started by Fix on a deployment that is down.",
|
|
51
65
|
kind: "run",
|
|
52
|
-
trigger: "pressed",
|
|
53
66
|
icon: "server",
|
|
67
|
+
setup: "high",
|
|
54
68
|
},
|
|
55
69
|
{
|
|
56
70
|
id: "maintenance-chore",
|
|
57
71
|
label: "Maintenance chores",
|
|
58
72
|
blurb: "A chore run started from the Maintenance board.",
|
|
59
73
|
kind: "run",
|
|
60
|
-
trigger: "pressed",
|
|
61
74
|
icon: "wrench",
|
|
75
|
+
setup: "medium",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "refactor-run",
|
|
79
|
+
label: "Refactors",
|
|
80
|
+
blurb: "The agent started from a hotspot or key module on a repository's Health tab.",
|
|
81
|
+
kind: "run",
|
|
82
|
+
icon: "hammer",
|
|
83
|
+
setup: "high",
|
|
62
84
|
},
|
|
63
85
|
{
|
|
64
86
|
id: "documentation-run",
|
|
65
87
|
label: "Documentation runs",
|
|
66
88
|
blurb: "A pass over a repo's own documentation.",
|
|
67
89
|
kind: "run",
|
|
68
|
-
trigger: "pressed",
|
|
69
90
|
icon: "book",
|
|
91
|
+
setup: "medium",
|
|
70
92
|
},
|
|
71
93
|
{
|
|
72
94
|
id: "acceptance-run",
|
|
73
95
|
label: "Acceptance runs",
|
|
74
96
|
blurb: "One session per story in an acceptance fan-out.",
|
|
75
97
|
kind: "run",
|
|
76
|
-
trigger: "pressed",
|
|
77
98
|
icon: "list-check",
|
|
99
|
+
setup: "high",
|
|
78
100
|
},
|
|
79
101
|
{
|
|
80
102
|
id: "approval-queue",
|
|
81
103
|
label: "Approvals queue",
|
|
82
104
|
blurb: "The turn that publishes or acts on what you approved.",
|
|
83
105
|
kind: "run",
|
|
84
|
-
trigger: "pressed",
|
|
85
106
|
icon: "check-circle",
|
|
107
|
+
setup: "medium",
|
|
86
108
|
},
|
|
87
109
|
{
|
|
88
110
|
id: "extension-review",
|
|
89
111
|
label: "Extension update reviews",
|
|
90
112
|
blurb: "The agent that reads an extension update before it is applied.",
|
|
91
113
|
kind: "run",
|
|
92
|
-
trigger: "unprompted",
|
|
93
114
|
icon: "box",
|
|
115
|
+
setup: "medium",
|
|
94
116
|
},
|
|
95
117
|
{
|
|
96
118
|
id: "loop-iteration",
|
|
97
119
|
label: "Loop iterations",
|
|
98
120
|
blurb: "Each round of a loop working towards its goal.",
|
|
99
121
|
kind: "run",
|
|
100
|
-
trigger: "unprompted",
|
|
101
122
|
icon: "repeat",
|
|
123
|
+
setup: "high",
|
|
102
124
|
},
|
|
103
125
|
];
|
|
104
126
|
export const MODEL_ROLE_IDS = MODEL_ROLES.map((role) => role.id);
|
|
105
127
|
export const ModelRoleSchema = z.enum(MODEL_ROLE_IDS);
|
|
106
|
-
const rolesWhere = (match) => MODEL_ROLES.filter((role) => match(role));
|
|
107
|
-
export const MODEL_ROLE_BLOCKS = [
|
|
108
|
-
{
|
|
109
|
-
id: "helper",
|
|
110
|
-
label: "Automatic helpers",
|
|
111
|
-
roles: rolesWhere((role) => role.kind === "helper"),
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
id: "pressed",
|
|
115
|
-
label: "Runs you start",
|
|
116
|
-
roles: rolesWhere((role) => role.kind === "run" && role.trigger === "pressed"),
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
id: "unprompted",
|
|
120
|
-
label: "Runs that start themselves",
|
|
121
|
-
roles: rolesWhere((role) => role.kind === "run" && role.trigger === "unprompted"),
|
|
122
|
-
},
|
|
123
|
-
];
|
|
124
128
|
//# sourceMappingURL=model-roles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-roles.js","sourceRoot":"","sources":["../../src/models/model-roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"model-roles.js","sourceRoot":"","sources":["../../src/models/model-roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,MAAM,CAAC,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,EAAE,EAAE,gBAAgB;QACpB,KAAK,EAAE,iBAAiB;QACxB,KAAK,EAAE,gDAAgD;QACvD,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,MAAM;KAChB;CACuC,CAAC;AAK7C,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAyB,CAAC;AAGzF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,cAA6C,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type ModelPin } from "../schemas/agent.js";
|
|
3
|
+
import type { ModelSource } from "./model-pins.js";
|
|
4
|
+
import { type ModelRole, type PresetSetup } from "./model-roles.js";
|
|
5
|
+
export declare const MODEL_SETUP_ID: RegExp;
|
|
6
|
+
export declare const ModelSetupSchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
name: z.ZodOptional<z.ZodString>;
|
|
9
|
+
pins: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
10
|
+
provider: z.ZodString;
|
|
11
|
+
model: z.ZodString;
|
|
12
|
+
effort: z.ZodOptional<z.ZodString>;
|
|
13
|
+
thinking: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
fast: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
harness: z.ZodOptional<z.ZodEnum<{
|
|
16
|
+
"claude-code": "claude-code";
|
|
17
|
+
native: "native";
|
|
18
|
+
}>>;
|
|
19
|
+
}, z.core.$strip>>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type ModelSetup = z.infer<typeof ModelSetupSchema>;
|
|
22
|
+
export declare const isPresetSetup: (id: string) => id is PresetSetup;
|
|
23
|
+
export interface SetupSettings {
|
|
24
|
+
readonly modelSetups: readonly ModelSetup[];
|
|
25
|
+
readonly roleSetups: Partial<Record<ModelRole, string>>;
|
|
26
|
+
}
|
|
27
|
+
export declare const suggestedSetup: (role: ModelRole) => PresetSetup;
|
|
28
|
+
export declare const storedSetup: (settings: Pick<SetupSettings, "modelSetups">, id: string) => ModelSetup | undefined;
|
|
29
|
+
export declare const roleSetupId: (settings: SetupSettings, role: ModelRole) => string | undefined;
|
|
30
|
+
export type SetupLadder = {
|
|
31
|
+
readonly kind: `pins`;
|
|
32
|
+
readonly pins: readonly ModelPin[];
|
|
33
|
+
} | {
|
|
34
|
+
readonly kind: `preset`;
|
|
35
|
+
readonly preset: PresetSetup;
|
|
36
|
+
};
|
|
37
|
+
export declare const setupLadder: (settings: Pick<SetupSettings, "modelSetups">, id: string | undefined) => SetupLadder;
|
|
38
|
+
export declare const roleLadder: (settings: SetupSettings, role: ModelRole) => SetupLadder;
|
|
39
|
+
export declare const ladderIsEmpty: (ladder: SetupLadder) => boolean;
|
|
40
|
+
export declare const presetPins: (preset: PresetSetup, sources: readonly ModelSource[]) => readonly ModelPin[];
|
|
41
|
+
export declare const ladderPins: (ladder: SetupLadder, sources: readonly ModelSource[]) => readonly ModelPin[];
|
|
42
|
+
export declare const rolePins: (settings: SetupSettings, role: ModelRole, sources: readonly ModelSource[]) => readonly ModelPin[];
|
|
43
|
+
export declare const setupsFromRoleLists: (lists: Partial<Record<ModelRole, readonly ModelPin[]>>) => SetupSettings & {
|
|
44
|
+
modelSetups: ModelSetup[];
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=model-setups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-setups.d.ts","sourceRoot":"","sources":["../../src/models/model-setups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,qBAAqB,CAAC;AAGpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,E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AM,UAAU,WAAY,WAAW,WAAW,SAAS,WAAW,EAAE,KAAG,SAAS,QAAQ,EAOnE,CAAC;AAEjC,eAAO,MAAM,UAAU,WAAY,WAAW,WAAW,SAAS,WAAW,EAAE,KAAG,SAAS,QAAQ,EACtB,CAAC;AAG9E,eAAO,MAAM,QAAQ,aAAc,aAAa,QAAQ,SAAS,WAAW,SAAS,WAAW,EAAE,KAAG,SAAS,QAAQ,EACnE,CAAC;AAQpD,eAAO,MAAM,mBAAmB,UAAW,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAC,CAAC,KAAG,aAAa,GAAG;IAAE,WAAW,EAAE,UAAU,EAAE,CAAA;CAyBvI,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ModelPinSchema } from "../schemas/agent.js";
|
|
3
|
+
import { isEndpointProvider } from "./agent-catalog.js";
|
|
4
|
+
import { compareModelIds, modelRungOf } from "./model-order.js";
|
|
5
|
+
import { MODEL_ROLE_IDS, MODEL_ROLES, PRESET_SETUPS } from "./model-roles.js";
|
|
6
|
+
export const MODEL_SETUP_ID = /^[a-z0-9][a-z0-9-]{0,39}$/;
|
|
7
|
+
export const ModelSetupSchema = z.object({
|
|
8
|
+
id: z.string().regex(MODEL_SETUP_ID).describe("Which setup this is. `low`, `medium` and `high` are the three every sandbox has; any other is one you made."),
|
|
9
|
+
name: z.string().trim().min(1).max(40).optional().describe("What it is called on the settings page. Left out, a preset keeps its own name."),
|
|
10
|
+
pins: z
|
|
11
|
+
.array(ModelPinSchema)
|
|
12
|
+
.max(10)
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("The models it runs on, tried in order, so one spent account does not take its jobs down. Left out on a preset, it is worked out from the accounts this sandbox has connected and follows them as they change; left out on one you made, it has none."),
|
|
15
|
+
});
|
|
16
|
+
export const isPresetSetup = (id) => PRESET_SETUPS.some((preset) => preset === id);
|
|
17
|
+
const SUGGESTED = new Map(MODEL_ROLES.map((role) => [role.id, role.setup]));
|
|
18
|
+
export const suggestedSetup = (role) => SUGGESTED.get(role) ?? `medium`;
|
|
19
|
+
export const storedSetup = (settings, id) => settings.modelSetups.find((setup) => setup.id === id);
|
|
20
|
+
export const roleSetupId = (settings, role) => {
|
|
21
|
+
const assigned = settings.roleSetups[role];
|
|
22
|
+
return assigned !== undefined && (isPresetSetup(assigned) || storedSetup(settings, assigned) !== undefined) ? assigned : undefined;
|
|
23
|
+
};
|
|
24
|
+
const NO_MODELS = { kind: `pins`, pins: [] };
|
|
25
|
+
export const setupLadder = (settings, id) => {
|
|
26
|
+
if (id === undefined) {
|
|
27
|
+
return NO_MODELS;
|
|
28
|
+
}
|
|
29
|
+
const pins = storedSetup(settings, id)?.pins;
|
|
30
|
+
if (pins !== undefined) {
|
|
31
|
+
return { kind: `pins`, pins };
|
|
32
|
+
}
|
|
33
|
+
return isPresetSetup(id) ? { kind: `preset`, preset: id } : NO_MODELS;
|
|
34
|
+
};
|
|
35
|
+
export const roleLadder = (settings, role) => setupLadder(settings, roleSetupId(settings, role));
|
|
36
|
+
export const ladderIsEmpty = (ladder) => ladder.kind === `pins` && ladder.pins.length === 0;
|
|
37
|
+
const PRESET_RUNG = { high: 0, medium: 1, low: 2 };
|
|
38
|
+
const PRESET_LENGTH = 3;
|
|
39
|
+
const ownPrefix = (models) => {
|
|
40
|
+
const counts = new Map();
|
|
41
|
+
for (const model of models) {
|
|
42
|
+
const prefix = model.split(/[-_]/)[0] ?? model;
|
|
43
|
+
counts.set(prefix, (counts.get(prefix) ?? 0) + 1);
|
|
44
|
+
}
|
|
45
|
+
return [...counts].toSorted(([, a], [, b]) => b - a)[0]?.[0];
|
|
46
|
+
};
|
|
47
|
+
const newestOnRung = (models, rung) => {
|
|
48
|
+
const own = ownPrefix(models);
|
|
49
|
+
const onRung = models.filter((model) => modelRungOf(model) === rung).toSorted(compareModelIds);
|
|
50
|
+
return onRung.find((model) => model.split(/[-_]/)[0] === own) ?? onRung[0];
|
|
51
|
+
};
|
|
52
|
+
export const presetPins = (preset, sources) => sources
|
|
53
|
+
.filter((source) => source.ready && !isEndpointProvider(source.provider))
|
|
54
|
+
.flatMap((source) => {
|
|
55
|
+
const newest = newestOnRung(source.models, PRESET_RUNG[preset]);
|
|
56
|
+
return newest === undefined ? [] : [{ provider: source.provider, model: newest }];
|
|
57
|
+
})
|
|
58
|
+
.slice(0, PRESET_LENGTH);
|
|
59
|
+
export const ladderPins = (ladder, sources) => ladder.kind === `pins` ? ladder.pins : presetPins(ladder.preset, sources);
|
|
60
|
+
export const rolePins = (settings, role, sources) => ladderPins(roleLadder(settings, role), sources);
|
|
61
|
+
export const setupsFromRoleLists = (lists) => {
|
|
62
|
+
const modelSetups = [];
|
|
63
|
+
const roleSetups = {};
|
|
64
|
+
const groups = new Map();
|
|
65
|
+
for (const role of MODEL_ROLE_IDS) {
|
|
66
|
+
const list = lists[role];
|
|
67
|
+
if (list !== undefined && list.length > 0) {
|
|
68
|
+
const key = JSON.stringify(list);
|
|
69
|
+
groups.set(key, [...(groups.get(key) ?? []), role]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
let made = 0;
|
|
73
|
+
for (const roles of groups.values()) {
|
|
74
|
+
const pins = lists[roles[0]] ?? [];
|
|
75
|
+
const votes = roles.map(suggestedSetup);
|
|
76
|
+
const preset = votes.toSorted((a, b) => votes.filter((vote) => vote === b).length - votes.filter((vote) => vote === a).length)[0];
|
|
77
|
+
const free = storedSetup({ modelSetups }, preset) === undefined;
|
|
78
|
+
const id = free ? preset : `setup-${++made}`;
|
|
79
|
+
modelSetups.push(free ? { id, pins: [...pins] } : { id, name: `Setup ${made}`, pins: [...pins] });
|
|
80
|
+
for (const role of roles) {
|
|
81
|
+
roleSetups[role] = id;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return { modelSetups, roleSetups };
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=model-setups.js.map
|
|
@@ -0,0 +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E,CAAC;QACnI,MAAM,IAAI,GAAG,WAAW,CAAC,EAAE,WAAW,EAAE,EAAE,MAAM,CAAC,KAAK,SAAS,CAAC;QAChE,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC;QAC7C,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;QAClG,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAC1B,CAAC;IACL,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;AACvC,CAAC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { AccountState, AccountUsage, ProviderRefusal, UsageWindow, WindowGates } from "../schemas/providers/plan-limits.js";
|
|
2
2
|
export declare const SPENT_UTILIZATION = 100;
|
|
3
|
+
export declare const provenFull: (window: UsageWindow) => boolean;
|
|
4
|
+
export declare const pinnedFull: (window: UsageWindow) => UsageWindow;
|
|
3
5
|
export interface ModelRef {
|
|
4
6
|
readonly id: string;
|
|
5
7
|
readonly label?: string | undefined;
|
|
@@ -23,6 +25,7 @@ export declare const windowPeriod: (pool: {
|
|
|
23
25
|
readonly label?: string | undefined;
|
|
24
26
|
}) => WindowPeriod | undefined;
|
|
25
27
|
export declare const windowLive: (window: UsageWindow, measuredAt: number, now: number) => boolean;
|
|
28
|
+
export declare const currentWindows: (usage: AccountUsage, now: number) => UsageWindow[];
|
|
26
29
|
export interface ServiceFacts {
|
|
27
30
|
readonly account: string;
|
|
28
31
|
readonly needsReauth?: boolean | undefined;
|
|
@@ -39,7 +42,8 @@ export interface ServiceFacts {
|
|
|
39
42
|
export declare const refusalVerdict: (refusal: ProviderRefusal, accounts: readonly ServiceFacts[], now?: number) => "standing" | "answered" | "gone";
|
|
40
43
|
export declare const headroomState: (usage: AccountUsage | undefined, model?: ModelRef) => AccountState;
|
|
41
44
|
export declare const serviceState: (facts: ServiceFacts, refusal?: ProviderRefusal, model?: ModelRef, now?: number) => AccountState;
|
|
42
|
-
export
|
|
45
|
+
export type RefusalsOnFile = ProviderRefusal | readonly ProviderRefusal[] | undefined;
|
|
46
|
+
export declare const serviceStates: (accounts: readonly ServiceFacts[], refusals: RefusalsOnFile, model?: ModelRef, now?: number) => ReadonlyMap<string, AccountState>;
|
|
43
47
|
export declare const preferredAccount: <T extends {
|
|
44
48
|
readonly state: AccountState;
|
|
45
49
|
}>(entries: readonly T[]) => T | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-pools.d.ts","sourceRoot":"","sources":["../../src/models/plan-pools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAQjI,eAAO,MAAM,iBAAiB,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"plan-pools.d.ts","sourceRoot":"","sources":["../../src/models/plan-pools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAQjI,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAMrC,eAAO,MAAM,UAAU,WAAY,WAAW,KAAG,OAA6E,CAAC;AAG/H,eAAO,MAAM,UAAU,WAAY,WAAW,KAAG,WAGhD,CAAC;AAEF,MAAM,WAAW,QAAQ;IAErB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,KAA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AAM,eAAe,GAAI,CAAC,SAAS;IAAE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;CAAE,WAAW,SAAS,CAAC,EAAE,KAAG,CAAC,GAAG,SACH,CAAC"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export const SPENT_UTILIZATION = 100;
|
|
2
|
+
export const provenFull = (window) => window.utilization >= SPENT_UTILIZATION && window.rounded !== true;
|
|
3
|
+
export const pinnedFull = (window) => {
|
|
4
|
+
const { rounded: _rounded, ...pool } = window;
|
|
5
|
+
return { ...pool, utilization: Math.max(window.utilization, SPENT_UTILIZATION) };
|
|
6
|
+
};
|
|
2
7
|
export const wordsOf = (text) => text
|
|
3
8
|
.toLowerCase()
|
|
4
9
|
.split(/[^a-z0-9]+/)
|
|
@@ -71,6 +76,18 @@ export const windowLive = (window, measuredAt, now) => {
|
|
|
71
76
|
const period = windowPeriod(window);
|
|
72
77
|
return period === undefined || measuredAt + period.seconds * 1000 > now;
|
|
73
78
|
};
|
|
79
|
+
const lapsedWindow = (window, measuredAt) => {
|
|
80
|
+
const { resetsAt, rounded: _rounded, utilization: _utilization, ...pool } = window;
|
|
81
|
+
const closedAt = resetsAt ?? Math.floor((measuredAt + (windowPeriod(window)?.seconds ?? 0) * 1000) / 1000);
|
|
82
|
+
return { ...pool, utilization: 0, lapsedAt: closedAt };
|
|
83
|
+
};
|
|
84
|
+
export const currentWindows = (usage, now) => {
|
|
85
|
+
const live = (window) => window.lapsedAt === undefined && windowLive(window, usage.measuredAt, now);
|
|
86
|
+
if (!usage.windows.some(live)) {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
return usage.windows.map((window) => (window.lapsedAt !== undefined || live(window) ? window : lapsedWindow(window, usage.measuredAt)));
|
|
90
|
+
};
|
|
74
91
|
const answers = (refusal, facts) => {
|
|
75
92
|
const measuredAt = facts.usage?.measuredAt;
|
|
76
93
|
if (refusal.kind === "entitlement" || measuredAt === undefined || measuredAt <= refusal.at) {
|
|
@@ -102,15 +119,15 @@ export const headroomState = (usage, model) => {
|
|
|
102
119
|
if (windows.length === 0) {
|
|
103
120
|
return { kind: "unknown" };
|
|
104
121
|
}
|
|
105
|
-
const full = windows.filter(
|
|
106
|
-
const open = windows.filter((window) => window
|
|
122
|
+
const full = windows.filter(provenFull);
|
|
123
|
+
const open = windows.filter((window) => !provenFull(window));
|
|
107
124
|
if (model !== undefined || full.some((window) => window.gates === "all") || open.length === 0) {
|
|
108
125
|
const holding = model !== undefined ? full : full.some((window) => window.gates === "all") ? full.filter((window) => window.gates === "all") : full;
|
|
109
126
|
if (holding.length > 0) {
|
|
110
127
|
return spent(reopening(holding, model === undefined && !holding.some((window) => window.gates === "all")));
|
|
111
128
|
}
|
|
112
129
|
}
|
|
113
|
-
return { kind: "ready", room: SPENT_UTILIZATION - Math.max(...open.map((window) => window.utilization)) };
|
|
130
|
+
return { kind: "ready", room: Math.max(0, SPENT_UTILIZATION - Math.max(...open.map((window) => window.utilization))) };
|
|
114
131
|
};
|
|
115
132
|
const refusedPool = (usage, refusal, model) => {
|
|
116
133
|
const refusedModel = refusal.model === undefined ? model : { id: refusal.model };
|
|
@@ -119,7 +136,7 @@ const refusedPool = (usage, refusal, model) => {
|
|
|
119
136
|
const sameModel = refusal.model === undefined || model === undefined || refusal.model === model.id;
|
|
120
137
|
return sameModel ? spent(refusal.resetsAt) : headroomState(usage, model);
|
|
121
138
|
}
|
|
122
|
-
const pinned = usage.windows.map((window) => (window === binding ?
|
|
139
|
+
const pinned = usage.windows.map((window) => (window === binding ? pinnedFull(window) : window));
|
|
123
140
|
const state = headroomState({ ...usage, windows: pinned }, model);
|
|
124
141
|
return state.kind === "spent" && refusal.resetsAt !== undefined ? spent(refusal.resetsAt) : state;
|
|
125
142
|
};
|
|
@@ -148,20 +165,31 @@ export const serviceState = (facts, refusal, model, now = Date.now()) => {
|
|
|
148
165
|
}
|
|
149
166
|
return refusal?.kind === "limit" ? refusedPool(facts.usage, refusal, model) : headroomState(facts.usage, model);
|
|
150
167
|
};
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
]));
|
|
168
|
+
const refusalList = (refusals) => refusals === undefined ? [] : "kind" in refusals ? [refusals] : refusals;
|
|
169
|
+
export const serviceStates = (accounts, refusals, model, now = Date.now()) => {
|
|
170
|
+
const standing = refusalList(refusals)
|
|
171
|
+
.filter((refusal) => refusalVerdict(refusal, accounts, now) === "standing")
|
|
172
|
+
.toSorted((left, right) => right.at - left.at);
|
|
173
|
+
return new Map(accounts.map((facts) => [facts.account, serviceState(facts, standing.find((refusal) => (refusal.account ?? facts.account) === facts.account), model, now)]));
|
|
174
|
+
};
|
|
175
|
+
const preference = (state) => {
|
|
176
|
+
switch (state.kind) {
|
|
177
|
+
case "ready":
|
|
178
|
+
return state.room > 0 ? 0 : 2;
|
|
179
|
+
case "unknown":
|
|
180
|
+
return 1;
|
|
181
|
+
case "spent":
|
|
182
|
+
return 3;
|
|
183
|
+
case "blocked":
|
|
184
|
+
return 4;
|
|
185
|
+
}
|
|
157
186
|
};
|
|
158
|
-
const PREFERENCE = { ready: 0, unknown: 1, spent: 2, blocked: 3 };
|
|
159
187
|
export const preferredAccount = (entries) => entries.reduce((best, next) => {
|
|
160
188
|
if (best === undefined) {
|
|
161
189
|
return next;
|
|
162
190
|
}
|
|
163
|
-
const tier =
|
|
191
|
+
const tier = preference(next.state) - preference(best.state);
|
|
164
192
|
return tier < 0 || (tier === 0 && next.state.kind === "ready" && best.state.kind === "ready" && next.state.room > best.state.room) ? next : best;
|
|
165
193
|
}, undefined);
|
|
166
|
-
export const roomiestAccount = (entries) => preferredAccount(entries.filter((entry) => entry.state.kind === "ready"));
|
|
194
|
+
export const roomiestAccount = (entries) => preferredAccount(entries.filter((entry) => entry.state.kind === "ready" && entry.state.room > 0));
|
|
167
195
|
//# sourceMappingURL=plan-pools.js.map
|