@stigmer/runner 3.12.5 → 3.12.6
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/dist/.build-fingerprint +1 -1
- package/dist/activities/call-agent.js +19 -6
- package/dist/activities/call-agent.js.map +1 -1
- package/dist/activities/execute-cursor/error-classifier.d.ts +9 -0
- package/dist/activities/execute-cursor/error-classifier.js +30 -1
- package/dist/activities/execute-cursor/error-classifier.js.map +1 -1
- package/dist/activities/execute-cursor/index.js +15 -7
- package/dist/activities/execute-cursor/index.js.map +1 -1
- package/dist/activities/execute-cursor/service-tier.d.ts +38 -29
- package/dist/activities/execute-cursor/service-tier.js +92 -63
- package/dist/activities/execute-cursor/service-tier.js.map +1 -1
- package/dist/activities/execute-cursor/usage-accumulator.d.ts +16 -2
- package/dist/activities/execute-cursor/usage-accumulator.js +12 -2
- package/dist/activities/execute-cursor/usage-accumulator.js.map +1 -1
- package/dist/shared/caller-identity.d.ts +10 -7
- package/dist/shared/caller-identity.js +10 -7
- package/dist/shared/caller-identity.js.map +1 -1
- package/dist/shared/thinking-mode.d.ts +35 -0
- package/dist/shared/thinking-mode.js +43 -0
- package/dist/shared/thinking-mode.js.map +1 -0
- package/dist/workflow-engine/loader.js +52 -13
- package/dist/workflow-engine/loader.js.map +1 -1
- package/dist/workflow-engine/tasks/human-input.d.ts +2 -1
- package/dist/workflow-engine/tasks/human-input.js +8 -1
- package/dist/workflow-engine/tasks/human-input.js.map +1 -1
- package/dist/workflow-engine/types.d.ts +17 -3
- package/dist/workflow-engine/types.js.map +1 -1
- package/dist/workflows/human-input-orchestrator.d.ts +4 -0
- package/dist/workflows/human-input-orchestrator.js +13 -0
- package/dist/workflows/human-input-orchestrator.js.map +1 -1
- package/package.json +2 -2
- package/src/activities/call-agent.ts +20 -6
- package/src/activities/execute-cursor/__tests__/error-classifier-billing.test.ts +67 -0
- package/src/activities/execute-cursor/__tests__/service-tier.test.ts +67 -7
- package/src/activities/execute-cursor/__tests__/usage-accumulator.test.ts +33 -1
- package/src/activities/execute-cursor/error-classifier.ts +42 -1
- package/src/activities/execute-cursor/index.ts +15 -6
- package/src/activities/execute-cursor/service-tier.ts +94 -63
- package/src/activities/execute-cursor/usage-accumulator.ts +11 -1
- package/src/shared/caller-identity.ts +10 -7
- package/src/shared/thinking-mode.ts +52 -0
- package/src/workflow-engine/__tests__/loader.test.ts +47 -3
- package/src/workflow-engine/__tests__/tasks/human-input.test.ts +39 -0
- package/src/workflow-engine/loader.ts +63 -17
- package/src/workflow-engine/tasks/human-input.ts +8 -1
- package/src/workflow-engine/types.ts +18 -3
- package/src/workflows/human-input-orchestrator.ts +20 -2
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Variant-attribute → Cursor variant-parameter translation
|
|
3
|
+
* (stigmer/stigmer#357 service tier, #772 thinking mode).
|
|
3
4
|
*
|
|
4
5
|
* The platform contract: an execution's model selection is ALWAYS explicit.
|
|
5
|
-
* A bare `{ id }` lets the Cursor catalog's default variant decide the
|
|
6
|
-
* (observed 2026-08-06: composer-2.5 defaults to fast=true at ~4x
|
|
7
|
-
* rates, claude-haiku-4-5 to thinking=true), and that default follows
|
|
8
|
-
* out-of-band account setting. This module pins every
|
|
9
|
-
* parameter the model declares, so the
|
|
10
|
-
* function of
|
|
6
|
+
* A bare `{ id }` lets the Cursor catalog's default variant decide the
|
|
7
|
+
* variant (observed 2026-08-06: composer-2.5 defaults to fast=true at ~4x
|
|
8
|
+
* base rates, claude-haiku-4-5 to thinking=true), and that default follows
|
|
9
|
+
* an out-of-band account setting. This module pins every user-selectable
|
|
10
|
+
* variant parameter the model declares, so the served variant is a
|
|
11
|
+
* deterministic function of the execution config:
|
|
11
12
|
*
|
|
12
|
-
* -
|
|
13
|
-
*
|
|
14
|
-
* -
|
|
15
|
-
*
|
|
13
|
+
* - fast: pinned from ExecutionConfig.service_tier (FAST → true).
|
|
14
|
+
* Price-bearing — the fast variant bills at pricingVariants.fast rates.
|
|
15
|
+
* - thinking: pinned from ExecutionConfig.thinking_mode (ENABLED → true).
|
|
16
|
+
* Per-token price-neutral (ledger-verified 2026-08-15: thinking wire ids
|
|
17
|
+
* bill exactly base rates; thinking+fast bills exactly the fast rate) —
|
|
18
|
+
* pinned anyway because the served variant must never follow the account
|
|
19
|
+
* default, and ENABLED turns consume more output (reasoning) tokens.
|
|
20
|
+
* - Parameters that are neither (e.g. effort) are deliberately NOT pinned —
|
|
16
21
|
* they follow the catalog default and do not change the bill.
|
|
17
22
|
*
|
|
18
23
|
* Parameter bundles come from Cursor.models.list() (worker-cached): the
|
|
@@ -20,13 +25,15 @@
|
|
|
20
25
|
* rides the same proxy fetch-interceptor as every other SDK call, so it
|
|
21
26
|
* works identically in proxy and direct modes.
|
|
22
27
|
*
|
|
23
|
-
* The harness-neutral halves — the
|
|
24
|
-
* UNSPECIFIED→
|
|
25
|
-
*
|
|
26
|
-
*
|
|
28
|
+
* The harness-neutral halves — the enum semantics and the single
|
|
29
|
+
* UNSPECIFIED→default resolution points — live in `shared/service-tier.ts`
|
|
30
|
+
* (since #361 extended tiers to the native harness) and
|
|
31
|
+
* `shared/thinking-mode.ts`; this module keeps only the Cursor-catalog
|
|
32
|
+
* translation.
|
|
27
33
|
*/
|
|
28
34
|
import type { ModelParameterValue } from "@cursor/sdk";
|
|
29
35
|
import { type EffectiveServiceTier } from "../../shared/service-tier.js";
|
|
36
|
+
import { type EffectiveThinkingMode } from "../../shared/thinking-mode.js";
|
|
30
37
|
/** Test-only: drop the worker-level catalog cache. */
|
|
31
38
|
export declare function resetCatalogCacheForTests(): void;
|
|
32
39
|
export interface ResolveServiceTierParamsOptions {
|
|
@@ -34,25 +41,27 @@ export interface ResolveServiceTierParamsOptions {
|
|
|
34
41
|
/** Validated model id the execution runs on (may be "default" for Auto). */
|
|
35
42
|
readonly modelId: string;
|
|
36
43
|
readonly tier: EffectiveServiceTier;
|
|
44
|
+
readonly thinking: EffectiveThinkingMode;
|
|
37
45
|
/** For log correlation only. */
|
|
38
46
|
readonly executionId: string;
|
|
39
47
|
}
|
|
40
48
|
/**
|
|
41
|
-
* Translate the effective tier into the explicit variant
|
|
42
|
-
* with every Agent.create/resume for this execution.
|
|
49
|
+
* Translate the effective tier + thinking mode into the explicit variant
|
|
50
|
+
* parameters to send with every Agent.create/resume for this execution.
|
|
43
51
|
*
|
|
44
|
-
* Fail-closed posture:
|
|
45
|
-
* never a silent downgrade —
|
|
46
|
-
*
|
|
47
|
-
* must be heard about, not
|
|
52
|
+
* Fail-closed posture: an ACTIVE selection (FAST tier, ENABLED thinking)
|
|
53
|
+
* with no pinnable dimension is an error, never a silent downgrade —
|
|
54
|
+
* create-time validation makes this unreachable unless the registry and the
|
|
55
|
+
* provider catalog have drifted, and that drift must be heard about, not
|
|
56
|
+
* absorbed.
|
|
48
57
|
*
|
|
49
|
-
* STANDARD degrades to empty params on
|
|
50
|
-
* the execution — but be clear about
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* exists to prevent). Failing every
|
|
54
|
-
* endpoint blips would be the worse trade; the WARN
|
|
55
|
-
* requested-vs-billed mismatch
|
|
56
|
-
* are the compensating controls.
|
|
58
|
+
* The base selection (STANDARD + DISABLED) degrades to empty params on
|
|
59
|
+
* catalog failures rather than failing the execution — but be clear about
|
|
60
|
+
* what that costs: an unpinned selection falls to the catalog default
|
|
61
|
+
* variant, which for several models IS the fast/thinking variant (the
|
|
62
|
+
* incident this module exists to prevent). Failing every base execution
|
|
63
|
+
* whenever the catalog endpoint blips would be the worse trade; the WARN
|
|
64
|
+
* below plus billing's requested-vs-billed mismatch alarms (which catch
|
|
65
|
+
* exactly this window) are the compensating controls.
|
|
57
66
|
*/
|
|
58
67
|
export declare function resolveServiceTierParams(options: ResolveServiceTierParamsOptions): Promise<ModelParameterValue[]>;
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Variant-attribute → Cursor variant-parameter translation
|
|
3
|
+
* (stigmer/stigmer#357 service tier, #772 thinking mode).
|
|
3
4
|
*
|
|
4
5
|
* The platform contract: an execution's model selection is ALWAYS explicit.
|
|
5
|
-
* A bare `{ id }` lets the Cursor catalog's default variant decide the
|
|
6
|
-
* (observed 2026-08-06: composer-2.5 defaults to fast=true at ~4x
|
|
7
|
-
* rates, claude-haiku-4-5 to thinking=true), and that default follows
|
|
8
|
-
* out-of-band account setting. This module pins every
|
|
9
|
-
* parameter the model declares, so the
|
|
10
|
-
* function of
|
|
6
|
+
* A bare `{ id }` lets the Cursor catalog's default variant decide the
|
|
7
|
+
* variant (observed 2026-08-06: composer-2.5 defaults to fast=true at ~4x
|
|
8
|
+
* base rates, claude-haiku-4-5 to thinking=true), and that default follows
|
|
9
|
+
* an out-of-band account setting. This module pins every user-selectable
|
|
10
|
+
* variant parameter the model declares, so the served variant is a
|
|
11
|
+
* deterministic function of the execution config:
|
|
11
12
|
*
|
|
12
|
-
* -
|
|
13
|
-
*
|
|
14
|
-
* -
|
|
15
|
-
*
|
|
13
|
+
* - fast: pinned from ExecutionConfig.service_tier (FAST → true).
|
|
14
|
+
* Price-bearing — the fast variant bills at pricingVariants.fast rates.
|
|
15
|
+
* - thinking: pinned from ExecutionConfig.thinking_mode (ENABLED → true).
|
|
16
|
+
* Per-token price-neutral (ledger-verified 2026-08-15: thinking wire ids
|
|
17
|
+
* bill exactly base rates; thinking+fast bills exactly the fast rate) —
|
|
18
|
+
* pinned anyway because the served variant must never follow the account
|
|
19
|
+
* default, and ENABLED turns consume more output (reasoning) tokens.
|
|
20
|
+
* - Parameters that are neither (e.g. effort) are deliberately NOT pinned —
|
|
16
21
|
* they follow the catalog default and do not change the bill.
|
|
17
22
|
*
|
|
18
23
|
* Parameter bundles come from Cursor.models.list() (worker-cached): the
|
|
@@ -20,14 +25,16 @@
|
|
|
20
25
|
* rides the same proxy fetch-interceptor as every other SDK call, so it
|
|
21
26
|
* works identically in proxy and direct modes.
|
|
22
27
|
*
|
|
23
|
-
* The harness-neutral halves — the
|
|
24
|
-
* UNSPECIFIED→
|
|
25
|
-
*
|
|
26
|
-
*
|
|
28
|
+
* The harness-neutral halves — the enum semantics and the single
|
|
29
|
+
* UNSPECIFIED→default resolution points — live in `shared/service-tier.ts`
|
|
30
|
+
* (since #361 extended tiers to the native harness) and
|
|
31
|
+
* `shared/thinking-mode.ts`; this module keeps only the Cursor-catalog
|
|
32
|
+
* translation.
|
|
27
33
|
*/
|
|
28
34
|
import { Cursor } from "@cursor/sdk";
|
|
29
|
-
import { ServiceTier } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
35
|
+
import { ServiceTier, ThinkingMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
30
36
|
import { serviceTierLabel } from "../../shared/service-tier.js";
|
|
37
|
+
import { thinkingModeLabel } from "../../shared/thinking-mode.js";
|
|
31
38
|
/**
|
|
32
39
|
* Catalog ids that mean "Cursor picks the model" (Auto). Auto's single
|
|
33
40
|
* catalog variant has an empty parameter set — there is no tier dimension
|
|
@@ -37,9 +44,11 @@ import { serviceTierLabel } from "../../shared/service-tier.js";
|
|
|
37
44
|
*/
|
|
38
45
|
const AUTO_MODEL_IDS = new Set(["default", "auto"]);
|
|
39
46
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
47
|
+
* The user-selectable variant parameter ids. Pinning exactly these keeps
|
|
48
|
+
* the served variant deterministic while leaving effort knobs on their
|
|
49
|
+
* catalog defaults. `fast` changes the per-token price; `thinking` is
|
|
50
|
+
* price-neutral but changes token consumption and must never follow the
|
|
51
|
+
* account default. Sourced from the Cursor catalog survey
|
|
43
52
|
* (stigmer-cloud _projects/2026-08/20260806.04.model-service-tier).
|
|
44
53
|
*/
|
|
45
54
|
const FAST_PARAM_ID = "fast";
|
|
@@ -85,35 +94,45 @@ function findCatalogModel(models, modelId) {
|
|
|
85
94
|
return models.find((m) => m.id === modelId || m.aliases?.includes(modelId));
|
|
86
95
|
}
|
|
87
96
|
/**
|
|
88
|
-
* Translate the effective tier into the explicit variant
|
|
89
|
-
* with every Agent.create/resume for this execution.
|
|
97
|
+
* Translate the effective tier + thinking mode into the explicit variant
|
|
98
|
+
* parameters to send with every Agent.create/resume for this execution.
|
|
90
99
|
*
|
|
91
|
-
* Fail-closed posture:
|
|
92
|
-
* never a silent downgrade —
|
|
93
|
-
*
|
|
94
|
-
* must be heard about, not
|
|
100
|
+
* Fail-closed posture: an ACTIVE selection (FAST tier, ENABLED thinking)
|
|
101
|
+
* with no pinnable dimension is an error, never a silent downgrade —
|
|
102
|
+
* create-time validation makes this unreachable unless the registry and the
|
|
103
|
+
* provider catalog have drifted, and that drift must be heard about, not
|
|
104
|
+
* absorbed.
|
|
95
105
|
*
|
|
96
|
-
* STANDARD degrades to empty params on
|
|
97
|
-
* the execution — but be clear about
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* exists to prevent). Failing every
|
|
101
|
-
* endpoint blips would be the worse trade; the WARN
|
|
102
|
-
* requested-vs-billed mismatch
|
|
103
|
-
* are the compensating controls.
|
|
106
|
+
* The base selection (STANDARD + DISABLED) degrades to empty params on
|
|
107
|
+
* catalog failures rather than failing the execution — but be clear about
|
|
108
|
+
* what that costs: an unpinned selection falls to the catalog default
|
|
109
|
+
* variant, which for several models IS the fast/thinking variant (the
|
|
110
|
+
* incident this module exists to prevent). Failing every base execution
|
|
111
|
+
* whenever the catalog endpoint blips would be the worse trade; the WARN
|
|
112
|
+
* below plus billing's requested-vs-billed mismatch alarms (which catch
|
|
113
|
+
* exactly this window) are the compensating controls.
|
|
104
114
|
*/
|
|
105
115
|
export async function resolveServiceTierParams(options) {
|
|
106
|
-
const { apiKey, modelId, tier, executionId } = options;
|
|
116
|
+
const { apiKey, modelId, tier, thinking, executionId } = options;
|
|
107
117
|
const tierName = serviceTierLabel(tier);
|
|
118
|
+
const thinkingName = thinkingModeLabel(thinking);
|
|
119
|
+
// Selections that actively deviate from the base variant must fail loudly
|
|
120
|
+
// when they cannot be pinned; the base selection may degrade with a WARN.
|
|
121
|
+
const active = [];
|
|
122
|
+
if (tier === ServiceTier.FAST)
|
|
123
|
+
active.push("service_tier=fast");
|
|
124
|
+
if (thinking === ThinkingMode.ENABLED)
|
|
125
|
+
active.push("thinking=enabled");
|
|
108
126
|
if (AUTO_MODEL_IDS.has(modelId)) {
|
|
109
|
-
if (
|
|
110
|
-
throw new Error(
|
|
111
|
-
`
|
|
112
|
-
`create time; the model registry and provider catalog may
|
|
127
|
+
if (active.length > 0) {
|
|
128
|
+
throw new Error(`${active.join(" + ")} requires a pinned model — Auto ("${modelId}") has ` +
|
|
129
|
+
`no variant dimensions. Execution ${executionId} should have been ` +
|
|
130
|
+
`refused at create time; the model registry and provider catalog may ` +
|
|
131
|
+
`have drifted.`);
|
|
113
132
|
}
|
|
114
|
-
console.log(`
|
|
115
|
-
`Auto has no variant parameters; Cursor picks
|
|
116
|
-
`(documented v1 limitation).`);
|
|
133
|
+
console.log(`VariantParams: execution=${executionId} model=${modelId} tier=${tierName} ` +
|
|
134
|
+
`thinking=${thinkingName} — Auto has no variant parameters; Cursor picks ` +
|
|
135
|
+
`the model and variant (documented v1 limitation).`);
|
|
117
136
|
return [];
|
|
118
137
|
}
|
|
119
138
|
let models;
|
|
@@ -121,29 +140,30 @@ export async function resolveServiceTierParams(options) {
|
|
|
121
140
|
models = await listCatalogModels(apiKey);
|
|
122
141
|
}
|
|
123
142
|
catch (err) {
|
|
124
|
-
if (
|
|
125
|
-
throw new Error(
|
|
126
|
-
`catalog to resolve variant params for "${modelId}", and the
|
|
127
|
-
`fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
143
|
+
if (active.length > 0) {
|
|
144
|
+
throw new Error(`${active.join(" + ")} for execution ${executionId} needs the Cursor ` +
|
|
145
|
+
`model catalog to resolve variant params for "${modelId}", and the ` +
|
|
146
|
+
`catalog fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
128
147
|
}
|
|
129
|
-
console.warn(`
|
|
130
|
-
`catalog fetch failed
|
|
131
|
-
`
|
|
132
|
-
`
|
|
133
|
-
`expensive direction).
|
|
134
|
-
`
|
|
148
|
+
console.warn(`VariantParams UNPINNED: execution=${executionId} model=${modelId} tier=${tierName} ` +
|
|
149
|
+
`thinking=${thinkingName} — catalog fetch failed ` +
|
|
150
|
+
`(${err instanceof Error ? err.message : err}); sending no variant params, ` +
|
|
151
|
+
`so the catalog DEFAULT variant decides the served variant for this ` +
|
|
152
|
+
`execution (fast/thinking on several models — the expensive direction). ` +
|
|
153
|
+
`Billing's requested-vs-billed mismatch alarms cover this window.`);
|
|
135
154
|
return [];
|
|
136
155
|
}
|
|
137
156
|
const model = findCatalogModel(models, modelId);
|
|
138
157
|
if (!model) {
|
|
139
|
-
if (
|
|
140
|
-
throw new Error(
|
|
141
|
-
`but the Cursor catalog does not list that model — cannot pin
|
|
142
|
-
`variant. The model registry and provider catalog have drifted.`);
|
|
158
|
+
if (active.length > 0) {
|
|
159
|
+
throw new Error(`${active.join(" + ")} requested for "${modelId}" (execution ${executionId}) ` +
|
|
160
|
+
`but the Cursor catalog does not list that model — cannot pin its ` +
|
|
161
|
+
`variant parameters. The model registry and provider catalog have drifted.`);
|
|
143
162
|
}
|
|
144
|
-
console.warn(`
|
|
145
|
-
`model not in the Cursor catalog; sending no
|
|
146
|
-
`catalog DEFAULT variant decides the
|
|
163
|
+
console.warn(`VariantParams UNPINNED: execution=${executionId} model=${modelId} tier=${tierName} ` +
|
|
164
|
+
`thinking=${thinkingName} — model not in the Cursor catalog; sending no ` +
|
|
165
|
+
`variant params, so the catalog DEFAULT variant decides the served ` +
|
|
166
|
+
`variant for this execution.`);
|
|
147
167
|
return [];
|
|
148
168
|
}
|
|
149
169
|
const params = [];
|
|
@@ -152,10 +172,13 @@ export async function resolveServiceTierParams(options) {
|
|
|
152
172
|
params.push({ id: FAST_PARAM_ID, value: tier === ServiceTier.FAST ? "true" : "false" });
|
|
153
173
|
}
|
|
154
174
|
else if (def.id === THINKING_PARAM_ID) {
|
|
155
|
-
params.push({
|
|
175
|
+
params.push({
|
|
176
|
+
id: THINKING_PARAM_ID,
|
|
177
|
+
value: thinking === ThinkingMode.ENABLED ? "true" : "false",
|
|
178
|
+
});
|
|
156
179
|
}
|
|
157
|
-
// Any other parameter (e.g. effort) is price-neutral
|
|
158
|
-
// catalog default variant on purpose.
|
|
180
|
+
// Any other parameter (e.g. effort) is price-neutral and not
|
|
181
|
+
// user-selectable: left to the catalog default variant on purpose.
|
|
159
182
|
}
|
|
160
183
|
if (tier === ServiceTier.FAST && !params.some((p) => p.id === FAST_PARAM_ID)) {
|
|
161
184
|
throw new Error(`service_tier=fast requested for "${modelId}" (execution ${executionId}) ` +
|
|
@@ -163,9 +186,15 @@ export async function resolveServiceTierParams(options) {
|
|
|
163
186
|
`registry prices a fast variant the provider no longer offers — refusing ` +
|
|
164
187
|
`rather than silently billing an unknown variant.`);
|
|
165
188
|
}
|
|
189
|
+
if (thinking === ThinkingMode.ENABLED && !params.some((p) => p.id === THINKING_PARAM_ID)) {
|
|
190
|
+
throw new Error(`thinking=enabled requested for "${modelId}" (execution ${executionId}) ` +
|
|
191
|
+
`but the Cursor catalog declares no "thinking" parameter for it. The ` +
|
|
192
|
+
`model registry claims a thinking capability the provider no longer ` +
|
|
193
|
+
`offers — refusing rather than silently serving the base variant.`);
|
|
194
|
+
}
|
|
166
195
|
params.sort((a, b) => a.id.localeCompare(b.id));
|
|
167
|
-
console.log(`
|
|
168
|
-
`params=${JSON.stringify(params)}`);
|
|
196
|
+
console.log(`VariantParams: execution=${executionId} model=${modelId} tier=${tierName} ` +
|
|
197
|
+
`thinking=${thinkingName} params=${JSON.stringify(params)}`);
|
|
169
198
|
return params;
|
|
170
199
|
}
|
|
171
200
|
//# sourceMappingURL=service-tier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-tier.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/service-tier.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"service-tier.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/service-tier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAC;AAEzG,OAAO,EAAE,gBAAgB,EAA6B,MAAM,8BAA8B,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAA8B,MAAM,+BAA+B,CAAC;AAE9F;;;;;;GAMG;AACH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,MAAM,CAAC;AAC7B,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAErC,MAAM,oBAAoB,GAAG,SAAS,CAAC,CAAC,yCAAyC;AAQjF,IAAI,YAAY,GAAwB,IAAI,CAAC;AAC7C,uEAAuE;AACvE,4EAA4E;AAC5E,4EAA4E;AAC5E,IAAI,oBAAoB,GAA4F,IAAI,CAAC;AAEzH,sDAAsD;AACtD,MAAM,UAAU,yBAAyB;IACvC,YAAY,GAAG,IAAI,CAAC;IACpB,oBAAoB,GAAG,IAAI,CAAC;AAC9B,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,MAAc;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,IAAI,YAAY,IAAI,YAAY,CAAC,MAAM,KAAK,MAAM,IAAI,YAAY,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC;QACnF,OAAO,YAAY,CAAC,MAAM,CAAC;IAC7B,CAAC;IACD,IAAI,oBAAoB,EAAE,MAAM,KAAK,MAAM;QAAE,OAAO,oBAAoB,CAAC,OAAO,CAAC;IAEjF,IAAI,KAA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AA6D;QAC7D,mEAAmE;IACrE,CAAC;IAED,IAAI,IAAI,KAAK,WAAW,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,aAAa,CAAC,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CACb,oCAAoC,OAAO,gBAAgB,WAAW,IAAI;YAC1E,wEAAwE;YACxE,0EAA0E;YAC1E,kDAAkD,CACnD,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,KAAK,YAAY,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,iBAAiB,CAAC,EAAE,CAAC;QACzF,MAAM,IAAI,KAAK,CACb,mCAAmC,OAAO,gBAAgB,WAAW,IAAI;YACzE,sEAAsE;YACtE,qEAAqE;YACrE,kEAAkE,CACnE,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CACT,4BAA4B,WAAW,UAAU,OAAO,SAAS,QAAQ,GAAG;QAC5E,YAAY,YAAY,WAAW,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAC5D,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* wire via ProxyUsageReporter once traffic routing (Task 5B) is complete.
|
|
14
14
|
*/
|
|
15
15
|
import type { ModelParameterValue } from "@cursor/sdk";
|
|
16
|
-
import { ServiceTier } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
16
|
+
import { ServiceTier, ThinkingMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
17
17
|
export interface TurnUsage {
|
|
18
18
|
readonly inputTokens?: number;
|
|
19
19
|
readonly outputTokens?: number;
|
|
@@ -34,6 +34,8 @@ export interface UsageSnapshot {
|
|
|
34
34
|
readonly requestedServiceTier: ServiceTier;
|
|
35
35
|
/** JSON-encoded ModelSelection.params the runner sent; "" when none. */
|
|
36
36
|
readonly requestedModelParams: string;
|
|
37
|
+
/** Thinking mode the runner requested — always explicit post-translation (#772). */
|
|
38
|
+
readonly requestedThinkingMode: ThinkingMode;
|
|
37
39
|
}
|
|
38
40
|
export interface TurnRecord {
|
|
39
41
|
readonly sequence: number;
|
|
@@ -50,6 +52,12 @@ export declare class UsageAccumulator {
|
|
|
50
52
|
* never left in control (#357).
|
|
51
53
|
*/
|
|
52
54
|
private readonly requestedServiceTier;
|
|
55
|
+
/**
|
|
56
|
+
* The explicit thinking mode the runner requested. Price-neutral
|
|
57
|
+
* (thinking bills at base rates, #772), so it never enters the
|
|
58
|
+
* estimate — recorded purely as the audit trail twin of the tier.
|
|
59
|
+
*/
|
|
60
|
+
private readonly requestedThinkingMode;
|
|
53
61
|
private inputTokens;
|
|
54
62
|
private outputTokens;
|
|
55
63
|
private cacheReadTokens;
|
|
@@ -66,7 +74,13 @@ export declare class UsageAccumulator {
|
|
|
66
74
|
* verbatim into status as the audit trail that the account default was
|
|
67
75
|
* never left in control (#357).
|
|
68
76
|
*/
|
|
69
|
-
requestedServiceTier?: ServiceTier, requestedModelParams?: readonly ModelParameterValue[]
|
|
77
|
+
requestedServiceTier?: ServiceTier, requestedModelParams?: readonly ModelParameterValue[],
|
|
78
|
+
/**
|
|
79
|
+
* The explicit thinking mode the runner requested. Price-neutral
|
|
80
|
+
* (thinking bills at base rates, #772), so it never enters the
|
|
81
|
+
* estimate — recorded purely as the audit trail twin of the tier.
|
|
82
|
+
*/
|
|
83
|
+
requestedThinkingMode?: ThinkingMode);
|
|
70
84
|
addTurn(usage: TurnUsage): void;
|
|
71
85
|
get hasTurns(): boolean;
|
|
72
86
|
get modelName(): string;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* BiDi proxy (CursorBidiStreamHandler) which will record usage from the
|
|
13
13
|
* wire via ProxyUsageReporter once traffic routing (Task 5B) is complete.
|
|
14
14
|
*/
|
|
15
|
-
import { ServiceTier } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
15
|
+
import { ServiceTier, ThinkingMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
16
16
|
import { getCursorModelPricingForVariant, computeTurnCost } from "./model-pricing.js";
|
|
17
17
|
const EMPTY_SNAPSHOT = {
|
|
18
18
|
inputTokens: 0n,
|
|
@@ -26,10 +26,12 @@ const EMPTY_SNAPSHOT = {
|
|
|
26
26
|
observedAt: "",
|
|
27
27
|
requestedServiceTier: ServiceTier.UNSPECIFIED,
|
|
28
28
|
requestedModelParams: "",
|
|
29
|
+
requestedThinkingMode: ThinkingMode.UNSPECIFIED,
|
|
29
30
|
};
|
|
30
31
|
export class UsageAccumulator {
|
|
31
32
|
model;
|
|
32
33
|
requestedServiceTier;
|
|
34
|
+
requestedThinkingMode;
|
|
33
35
|
inputTokens = 0;
|
|
34
36
|
outputTokens = 0;
|
|
35
37
|
cacheReadTokens = 0;
|
|
@@ -46,9 +48,16 @@ export class UsageAccumulator {
|
|
|
46
48
|
* verbatim into status as the audit trail that the account default was
|
|
47
49
|
* never left in control (#357).
|
|
48
50
|
*/
|
|
49
|
-
requestedServiceTier = ServiceTier.UNSPECIFIED, requestedModelParams = []
|
|
51
|
+
requestedServiceTier = ServiceTier.UNSPECIFIED, requestedModelParams = [],
|
|
52
|
+
/**
|
|
53
|
+
* The explicit thinking mode the runner requested. Price-neutral
|
|
54
|
+
* (thinking bills at base rates, #772), so it never enters the
|
|
55
|
+
* estimate — recorded purely as the audit trail twin of the tier.
|
|
56
|
+
*/
|
|
57
|
+
requestedThinkingMode = ThinkingMode.UNSPECIFIED) {
|
|
50
58
|
this.model = model;
|
|
51
59
|
this.requestedServiceTier = requestedServiceTier;
|
|
60
|
+
this.requestedThinkingMode = requestedThinkingMode;
|
|
52
61
|
this.requestedModelParams =
|
|
53
62
|
requestedModelParams.length > 0 ? JSON.stringify(requestedModelParams) : "";
|
|
54
63
|
}
|
|
@@ -105,6 +114,7 @@ export class UsageAccumulator {
|
|
|
105
114
|
observedAt: this.observedAt,
|
|
106
115
|
requestedServiceTier: this.requestedServiceTier,
|
|
107
116
|
requestedModelParams: this.requestedModelParams,
|
|
117
|
+
requestedThinkingMode: this.requestedThinkingMode,
|
|
108
118
|
};
|
|
109
119
|
}
|
|
110
120
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage-accumulator.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/usage-accumulator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,8DAA8D,CAAC;
|
|
1
|
+
{"version":3,"file":"usage-accumulator.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/usage-accumulator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAC;AAEzG,OAAO,EAAE,+BAA+B,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AA2BtF,MAAM,cAAc,GAAkB;IACpC,WAAW,EAAE,EAAE;IACf,YAAY,EAAE,EAAE;IAChB,eAAe,EAAE,EAAE;IACnB,gBAAgB,EAAE,EAAE;IACpB,WAAW,EAAE,EAAE;IACf,SAAS,EAAE,CAAC;IACZ,gBAAgB,EAAE,CAAC;IACnB,KAAK,EAAE,EAAE;IACT,UAAU,EAAE,EAAE;IACd,oBAAoB,EAAE,WAAW,CAAC,WAAW;IAC7C,oBAAoB,EAAE,EAAE;IACxB,qBAAqB,EAAE,YAAY,CAAC,WAAW;CAChD,CAAC;AAUF,MAAM,OAAO,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;YACzD,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;YAC/C,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;YAC/C,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;SAClD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -50,15 +50,18 @@ export declare const STIGMER_USER_KIND = "stigmer_user";
|
|
|
50
50
|
export declare const ANONYMOUS_KIND = "anonymous";
|
|
51
51
|
/**
|
|
52
52
|
* Audit-actor id that backends stamp when NO caller identity exists —
|
|
53
|
-
* the OSS server writes it on every create
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
53
|
+
* the OSS server writes it on every create unless the deployment
|
|
54
|
+
* configured an operator identity (STIGMER_OPERATOR_EMAIL,
|
|
55
|
+
* stigmer/stigmer#400; a configured install stamps a real actor whose
|
|
56
|
+
* email resolves below like any other), and the cloud's
|
|
57
|
+
* AuditActorBuilder falls back to it for caller-less internal writes.
|
|
58
|
+
* It names "nobody in particular": unrelated sessions from unrelated
|
|
59
|
+
* people all carry it, so presenting it as a caller identity would make
|
|
60
|
+
* the one string a grantable value that silently covers ALL such
|
|
61
|
+
* traffic in an MCP server's binding sheet. A creator matching this
|
|
59
62
|
* sentinel (and carrying no email) is therefore unresolvable and falls
|
|
60
63
|
* to anonymous — the deny-by-default the docs guide already promises
|
|
61
|
-
* for self-hosted backends.
|
|
64
|
+
* for unconfigured self-hosted backends.
|
|
62
65
|
*/
|
|
63
66
|
export declare const SYSTEM_CREATOR_SENTINEL = "system";
|
|
64
67
|
/** The resolved caller identity. */
|
|
@@ -51,15 +51,18 @@ export const STIGMER_USER_KIND = "stigmer_user";
|
|
|
51
51
|
export const ANONYMOUS_KIND = "anonymous";
|
|
52
52
|
/**
|
|
53
53
|
* Audit-actor id that backends stamp when NO caller identity exists —
|
|
54
|
-
* the OSS server writes it on every create
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
54
|
+
* the OSS server writes it on every create unless the deployment
|
|
55
|
+
* configured an operator identity (STIGMER_OPERATOR_EMAIL,
|
|
56
|
+
* stigmer/stigmer#400; a configured install stamps a real actor whose
|
|
57
|
+
* email resolves below like any other), and the cloud's
|
|
58
|
+
* AuditActorBuilder falls back to it for caller-less internal writes.
|
|
59
|
+
* It names "nobody in particular": unrelated sessions from unrelated
|
|
60
|
+
* people all carry it, so presenting it as a caller identity would make
|
|
61
|
+
* the one string a grantable value that silently covers ALL such
|
|
62
|
+
* traffic in an MCP server's binding sheet. A creator matching this
|
|
60
63
|
* sentinel (and carrying no email) is therefore unresolvable and falls
|
|
61
64
|
* to anonymous — the deny-by-default the docs guide already promises
|
|
62
|
-
* for self-hosted backends.
|
|
65
|
+
* for unconfigured self-hosted backends.
|
|
63
66
|
*/
|
|
64
67
|
export const SYSTEM_CREATOR_SENTINEL = "system";
|
|
65
68
|
/** The identity injected when no session context exists (discovery). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caller-identity.js","sourceRoot":"","sources":["../../src/shared/caller-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,mDAAmD;AACnD,MAAM,CAAC,MAAM,4BAA4B,GAAG,8BAA8B,CAAC;AAE3E,8CAA8C;AAC9C,MAAM,CAAC,MAAM,6BAA6B,GAAG,+BAA+B,CAAC;AAE7E,mEAAmE;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,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GAA2B;QACxC,CAAC,4BAA4B,CAAC,EAAE,SAAS,CAAC,IAAI;QAC9C,CAAC,6BAA6B,CAAC,EAAE,SAAS,CAAC,KAAK;QAChD,CAAC,kBAAkB,CAAC,EAAE,EAAE;KACzB,CAAC;IAEF,IAAI,MAA0C,CAAC;IAC/C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACrD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QACxC,IAAI,CAAC,MAAM;YAAE,MAAM,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,OAAO,MAAM,IAAI,OAAO,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Harness-neutral thinking-mode semantics (stigmer/stigmer#772) — the
|
|
3
|
+
* second variant dimension alongside `shared/service-tier.ts`.
|
|
4
|
+
*
|
|
5
|
+
* The platform contract mirrors the service tier's: the thinking pin is
|
|
6
|
+
* ALWAYS explicit by the time a provider request leaves the runner.
|
|
7
|
+
* UNSPECIFIED resolves to DISABLED here and ONLY here — every upstream
|
|
8
|
+
* layer preserves the caller's raw enum so "user chose disabled" stays
|
|
9
|
+
* distinguishable from "platform default" all the way to the ledger.
|
|
10
|
+
*
|
|
11
|
+
* Unlike the fast tier, thinking is NOT separately priced: Cursor bills
|
|
12
|
+
* thinking variants at base per-token rates (ledger-verified 2026-08-15 —
|
|
13
|
+
* 277 events at exactly base; thinking+fast at exactly the fast rate).
|
|
14
|
+
* The cost of ENABLED is the extra reasoning tokens, billed as output.
|
|
15
|
+
* Selection is therefore capability-gated (registry capabilities.thinking)
|
|
16
|
+
* rather than pricing-gated, and the estimate/billing paths need no
|
|
17
|
+
* thinking-specific rates.
|
|
18
|
+
*
|
|
19
|
+
* v1 translates thinking on the Cursor harness only (the explicit
|
|
20
|
+
* `thinking` variant parameter, `execute-cursor/service-tier.ts`). No
|
|
21
|
+
* native wire mapping exists yet — create-time validation refuses ENABLED
|
|
22
|
+
* for native-harness models, mirroring the tier's #361 posture.
|
|
23
|
+
*/
|
|
24
|
+
import { ThinkingMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
25
|
+
/**
|
|
26
|
+
* The effective mode after platform-default resolution: never UNSPECIFIED.
|
|
27
|
+
*/
|
|
28
|
+
export type EffectiveThinkingMode = ThinkingMode.DISABLED | ThinkingMode.ENABLED;
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the configured mode to its effective value. The single place in
|
|
31
|
+
* the platform where UNSPECIFIED becomes DISABLED.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveEffectiveThinkingMode(configured: ThinkingMode | undefined): EffectiveThinkingMode;
|
|
34
|
+
/** Human-readable mode label for logs and error messages. */
|
|
35
|
+
export declare function thinkingModeLabel(mode: ThinkingMode): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Harness-neutral thinking-mode semantics (stigmer/stigmer#772) — the
|
|
3
|
+
* second variant dimension alongside `shared/service-tier.ts`.
|
|
4
|
+
*
|
|
5
|
+
* The platform contract mirrors the service tier's: the thinking pin is
|
|
6
|
+
* ALWAYS explicit by the time a provider request leaves the runner.
|
|
7
|
+
* UNSPECIFIED resolves to DISABLED here and ONLY here — every upstream
|
|
8
|
+
* layer preserves the caller's raw enum so "user chose disabled" stays
|
|
9
|
+
* distinguishable from "platform default" all the way to the ledger.
|
|
10
|
+
*
|
|
11
|
+
* Unlike the fast tier, thinking is NOT separately priced: Cursor bills
|
|
12
|
+
* thinking variants at base per-token rates (ledger-verified 2026-08-15 —
|
|
13
|
+
* 277 events at exactly base; thinking+fast at exactly the fast rate).
|
|
14
|
+
* The cost of ENABLED is the extra reasoning tokens, billed as output.
|
|
15
|
+
* Selection is therefore capability-gated (registry capabilities.thinking)
|
|
16
|
+
* rather than pricing-gated, and the estimate/billing paths need no
|
|
17
|
+
* thinking-specific rates.
|
|
18
|
+
*
|
|
19
|
+
* v1 translates thinking on the Cursor harness only (the explicit
|
|
20
|
+
* `thinking` variant parameter, `execute-cursor/service-tier.ts`). No
|
|
21
|
+
* native wire mapping exists yet — create-time validation refuses ENABLED
|
|
22
|
+
* for native-harness models, mirroring the tier's #361 posture.
|
|
23
|
+
*/
|
|
24
|
+
import { ThinkingMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the configured mode to its effective value. The single place in
|
|
27
|
+
* the platform where UNSPECIFIED becomes DISABLED.
|
|
28
|
+
*/
|
|
29
|
+
export function resolveEffectiveThinkingMode(configured) {
|
|
30
|
+
return configured === ThinkingMode.ENABLED ? ThinkingMode.ENABLED : ThinkingMode.DISABLED;
|
|
31
|
+
}
|
|
32
|
+
/** Human-readable mode label for logs and error messages. */
|
|
33
|
+
export function thinkingModeLabel(mode) {
|
|
34
|
+
switch (mode) {
|
|
35
|
+
case ThinkingMode.ENABLED:
|
|
36
|
+
return "enabled";
|
|
37
|
+
case ThinkingMode.DISABLED:
|
|
38
|
+
return "disabled";
|
|
39
|
+
default:
|
|
40
|
+
return "unspecified";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=thinking-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinking-mode.js","sourceRoot":"","sources":["../../src/shared/thinking-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAC;AAO5F;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAC1C,UAAoC;IAEpC,OAAO,UAAU,KAAK,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC;AAC5F,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,iBAAiB,CAAC,IAAkB;IAClD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,YAAY,CAAC,OAAO;YACvB,OAAO,SAAS,CAAC;QACnB,KAAK,YAAY,CAAC,QAAQ;YACxB,OAAO,UAAU,CAAC;QACpB;YACE,OAAO,aAAa,CAAC;IACzB,CAAC;AACH,CAAC"}
|