@skrr-ai/cli 0.1.67 → 0.1.69

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.
@@ -13,8 +13,7 @@ class AgentsReleasesRollback extends base_command_1.BaseCommand {
13
13
  async run() {
14
14
  this.requireAuth();
15
15
  const { args, flags } = await this.parse(AgentsReleasesRollback);
16
- // Through handleApiError so a refusal says why — in particular
17
- // STEP_UP_REQUIRED (OSK-12275), whose remedy is `step-up`, not a retry.
16
+ // Through handleApiError so a release or permission refusal says why.
18
17
  let result;
19
18
  try {
20
19
  result = await data_provider_1.dataService.rollbackAgentRelease({
@@ -36,7 +36,9 @@ function parseReleaseDependencies(entries) {
36
36
  for (const entry of entries) {
37
37
  const match = /^(skill|action):([^@]+)@(store_release_[A-Za-z0-9_-]+)$/.exec(entry);
38
38
  if (!match) {
39
- return { error: `--dependency expects skill:<id>@<store-release-id> or action:<id>@<store-release-id>, got "${entry}".` };
39
+ return {
40
+ error: `--dependency expects skill:<id>@<store-release-id> or action:<id>@<store-release-id>, got "${entry}".`,
41
+ };
40
42
  }
41
43
  dependencies.push({
42
44
  entityType: match[1],
@@ -47,10 +49,9 @@ function parseReleaseDependencies(entries) {
47
49
  return { dependencies };
48
50
  }
49
51
  class AgentsVisibility extends base_command_1.BaseCommand {
50
- static description = 'Set the visibility of an agent (accounts with 2FA need recent step-up for public publishing)';
52
+ static description = 'Set the visibility of an agent';
51
53
  static examples = [
52
54
  '<%= config.bin %> agents visibility <agent-id> --public',
53
- '<%= config.bin %> step-up # required before public publishing when 2FA is enabled',
54
55
  '<%= config.bin %> agents visibility <agent-id> --private',
55
56
  '<%= config.bin %> agents visibility <agent-id> --public --json',
56
57
  '<%= config.bin %> agents visibility <agent-id> --public --capability-rationale "network:*=Looks up flight prices on the web"',
@@ -111,7 +112,9 @@ class AgentsVisibility extends base_command_1.BaseCommand {
111
112
  if (dependencyError)
112
113
  this.error(dependencyError, { exit: 1 });
113
114
  if (dependencies && !isPublic) {
114
- this.error('--dependency declares pins on a public release; pass it with --public.', { exit: 1 });
115
+ this.error('--dependency declares pins on a public release; pass it with --public.', {
116
+ exit: 1,
117
+ });
115
118
  }
116
119
  if (capabilityRationales && !isPublic) {
117
120
  this.error('--capability-rationale applies only when publishing with --public.', {
@@ -125,29 +128,6 @@ class AgentsVisibility extends base_command_1.BaseCommand {
125
128
  exit: 1,
126
129
  });
127
130
  }
128
- // A public release reaches buyers. Accounts with 2FA need a recent
129
- // second-factor proof; accounts without 2FA can publish from a verified
130
- // sign-in session. Read that state before the publish write so the
131
- // remedy is visible in the normal CLI flow instead of only after a 403.
132
- // The server remains authoritative: this is user guidance, not a bypass.
133
- if (isPublic) {
134
- let stepUp;
135
- try {
136
- stepUp = await data_provider_1.dataService.getStepUpStatus(data_provider_1.STORE_PUBLISH_STEP_UP_PURPOSE);
137
- }
138
- catch (err) {
139
- this.handleApiError(err);
140
- }
141
- if (!stepUp.active) {
142
- const bin = this.config.bin;
143
- if (!stepUp.sessionBound) {
144
- this.error(`This credential is not tied to a sign-in session. Run \`${bin} login\` before publishing, then \`${bin} step-up\` if your account has 2FA enabled.`, { code: 'STEP_UP_SESSION_UNBOUND', exit: 2 });
145
- }
146
- if (stepUp.methods.length > 0) {
147
- this.error(`Public publishing needs a recent two-factor verification. Run \`${bin} step-up\`, then retry this command.`, { code: 'STEP_UP_PROOF_REQUIRED', exit: 2 });
148
- }
149
- }
150
- }
151
131
  let result;
152
132
  try {
153
133
  result = await data_provider_1.dataService.setAgentVisibility({
@@ -1,11 +1,10 @@
1
1
  import { BaseCommand } from '../base-command';
2
2
  /**
3
- * `skrr step-up` — confirm it is you before publishing to the Store
3
+ * `skrr step-up` — confirm it is you for a gated Store administration action
4
4
  * (OSK-12275).
5
5
  *
6
- * Making a release public, rolling the public listing back, or publishing a
7
- * governed release all reach buyers, so the server refuses them from a login
8
- * that has not recently proved a second factor. This command proves one — the
6
+ * Governed release administration may ask for a recent second factor.
7
+ * Self-service Agent publishing and rollback do not. This command proves one — the
9
8
  * code from the account's authenticator app, or an unused backup code — and
10
9
  * the verification is bound to THIS login only, for a few minutes. A token
11
10
  * stolen from another device, or a browser session, is not covered by it.
@@ -6,18 +6,17 @@ const base_command_1 = require("../base-command");
6
6
  const prompt_1 = require("../lib/prompt");
7
7
  const step_up_1 = require("../lib/step-up");
8
8
  /**
9
- * `skrr step-up` — confirm it is you before publishing to the Store
9
+ * `skrr step-up` — confirm it is you for a gated Store administration action
10
10
  * (OSK-12275).
11
11
  *
12
- * Making a release public, rolling the public listing back, or publishing a
13
- * governed release all reach buyers, so the server refuses them from a login
14
- * that has not recently proved a second factor. This command proves one — the
12
+ * Governed release administration may ask for a recent second factor.
13
+ * Self-service Agent publishing and rollback do not. This command proves one — the
15
14
  * code from the account's authenticator app, or an unused backup code — and
16
15
  * the verification is bound to THIS login only, for a few minutes. A token
17
16
  * stolen from another device, or a browser session, is not covered by it.
18
17
  */
19
18
  class StepUp extends base_command_1.BaseCommand {
20
- static description = 'Confirm it is you with an authenticator code before publishing to the Store';
19
+ static description = 'Confirm it is you with an authenticator code for gated Store administration';
21
20
  static examples = [
22
21
  '<%= config.bin %> step-up',
23
22
  '<%= config.bin %> step-up --otp 123456',
@@ -34,7 +33,7 @@ class StepUp extends base_command_1.BaseCommand {
34
33
  exclusive: ['otp', 'status'],
35
34
  }),
36
35
  status: core_1.Flags.boolean({
37
- description: 'Show whether this login is verified for publishing, without verifying',
36
+ description: 'Show whether this login has a recent second-factor proof',
38
37
  }),
39
38
  json: core_1.Flags.boolean({ description: 'Output the result as JSON' }),
40
39
  };
@@ -56,15 +55,15 @@ class StepUp extends base_command_1.BaseCommand {
56
55
  return;
57
56
  }
58
57
  this.log(status.active
59
- ? `Verified for publishing from this login until ${(0, step_up_1.formatStepUpExpiry)(status.expiresAt)}.`
60
- : `Not verified for publishing from this login. Run \`${bin} step-up\` to verify.`);
58
+ ? `Verified for gated Store actions from this login until ${(0, step_up_1.formatStepUpExpiry)(status.expiresAt)}.`
59
+ : `No recent second-factor proof for this login. Run \`${bin} step-up\` to verify.`);
61
60
  return;
62
61
  }
63
62
  if (!status.sessionBound) {
64
- this.error(`This credential is not tied to a sign-in session, so it cannot be verified for publishing. Run \`${bin} login\`, then \`${bin} step-up\`.`, { code: 'STEP_UP_SESSION_UNBOUND', exit: 2 });
63
+ this.error(`This credential is not tied to a sign-in session, so it cannot record a second-factor proof. Run \`${bin} login\`, then \`${bin} step-up\`.`, { code: 'STEP_UP_SESSION_UNBOUND', exit: 2 });
65
64
  }
66
65
  if (status.methods.length === 0) {
67
- this.error('Publishing to the Store needs two-factor authentication, and this account has none. ' +
66
+ this.error('A second-factor proof needs two-factor authentication, and this account has none. ' +
68
67
  `Turn it on in the web app (Settings → Account → Two-factor authentication), then run \`${bin} step-up\`.`, { code: 'STEP_UP_TWO_FACTOR_REQUIRED', exit: 2 });
69
68
  }
70
69
  let token = flags.otp?.trim();
@@ -90,7 +89,7 @@ class StepUp extends base_command_1.BaseCommand {
90
89
  return;
91
90
  }
92
91
  const via = result.method === 'backup_code' ? 'a backup code' : 'your authenticator app';
93
- this.log(`Verified with ${via}. Store publishing from this login is allowed until ${(0, step_up_1.formatStepUpExpiry)(result.expiresAt)}.`);
92
+ this.log(`Verified with ${via}. Gated Store actions from this login are allowed until ${(0, step_up_1.formatStepUpExpiry)(result.expiresAt)}.`);
94
93
  }
95
94
  }
96
95
  exports.default = StepUp;
@@ -63,6 +63,10 @@ const MIME_TYPES = {
63
63
  '.jpg': 'image/jpeg',
64
64
  '.js': 'text/javascript',
65
65
  '.json': 'application/json',
66
+ // A stream of JSON values is text evidence, not one JSON document.
67
+ // Preserve the original bytes and filename rather than forcing an array.
68
+ '.jsonl': 'text/plain',
69
+ '.ndjson': 'text/plain',
66
70
  '.log': 'text/plain',
67
71
  '.m4a': 'audio/m4a',
68
72
  '.m4v': 'video/m4v',
@@ -134,6 +134,11 @@ export interface HarnessLease {
134
134
  billing?: {
135
135
  billableState?: string;
136
136
  monthlySpendLimitCents?: number | null;
137
+ /** Monthly total shared by all machines of this product in the billing account. */
138
+ spendScope?: {
139
+ kind: 'owner_product' | 'workspace_product';
140
+ machineProduct: string;
141
+ };
137
142
  currentMonthSpendCents?: number;
138
143
  openUsageEstimateCents?: number;
139
144
  projectedCurrentMonthSpendCents?: number;
@@ -1,14 +1,12 @@
1
1
  /**
2
- * What the CLI says about step-up authentication before Store publishing
2
+ * What the CLI says about step-up authentication for gated Store actions
3
3
  * (OSK-12275).
4
4
  *
5
- * A public release reaches everyone who installs it, so the server refuses to
6
- * publish one, or to move the release buyers are served, on the strength of a
7
- * CLI token alone: it answers `STEP_UP_REQUIRED` until this same login has
8
- * proved a second factor through `skrr step-up`. The vocabulary (the code, the
5
+ * An explicitly gated Store action answers `STEP_UP_REQUIRED` until this login
6
+ * has proved a second factor through `skrr step-up`. The vocabulary (the code, the
9
7
  * reasons, the window) is `@skrr-ai/data-provider`'s; only the sentences live
10
8
  * here, because each reason has a different next step and a refusal that says
11
- * "forbidden" would leave a publisher guessing which one applies.
9
+ * "forbidden" would leave the caller guessing which one applies.
12
10
  */
13
11
  import type { TStepUpChallenge } from '@skrr-ai/data-provider';
14
12
  /**
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.describeStepUpRequired = describeStepUpRequired;
4
4
  exports.formatStepUpExpiry = formatStepUpExpiry;
5
- const NOTHING_CHANGED = 'Nothing was published or changed.';
5
+ const NOTHING_CHANGED = 'Nothing changed.';
6
6
  function windowPhrase(windowSeconds) {
7
7
  const minutes = Math.max(1, Math.round((windowSeconds ?? 600) / 60));
8
8
  return `${minutes} minute${minutes === 1 ? '' : 's'}`;
@@ -17,18 +17,18 @@ function describeStepUpRequired(challenge, bin) {
17
17
  switch (challenge?.reason) {
18
18
  case 'two_factor_not_enabled':
19
19
  return [
20
- `Publishing to the Store needs two-factor authentication, and this account has none. ${NOTHING_CHANGED}`,
20
+ `This action needs two-factor authentication, and this account has none. ${NOTHING_CHANGED}`,
21
21
  'Turn it on in the web app (Settings → Account → Two-factor authentication),',
22
22
  `then run \`${bin} step-up\` and run this command again within ${window}.`,
23
23
  ].join('\n');
24
24
  case 'credential_not_session_bound':
25
25
  return [
26
- `This credential is not tied to a sign-in session, so it cannot be verified for publishing. ${NOTHING_CHANGED}`,
26
+ `This credential is not tied to a sign-in session, so it cannot record a second-factor proof. ${NOTHING_CHANGED}`,
27
27
  `Run \`${bin} login\`, then \`${bin} step-up\`, and run this command again within ${window}.`,
28
28
  ].join('\n');
29
29
  default:
30
30
  return [
31
- `Publishing needs a fresh identity check: a public release reaches everyone who installs it, so this login alone is not enough. ${NOTHING_CHANGED}`,
31
+ `This action needs a fresh identity check; this login alone is not enough. ${NOTHING_CHANGED}`,
32
32
  `Run \`${bin} step-up\` and enter the code from your authenticator app, then run this command again within ${window}.`,
33
33
  ].join('\n');
34
34
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skrr-ai/auth-core",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "main": "dist/cjs/index.js",
5
5
  "types": "dist/esm/index.d.ts",
6
6
  "exports": {
@@ -41840,15 +41840,16 @@ function zE(e2, t2) {
41840
41840
  function FE(e2, t2, n2, o2, r2) {
41841
41841
  switch (t2.t) {
41842
41842
  case "text":
41843
- return (function(e3, t3, n3, o3) {
41844
- var r3 = "thinking" === mE(t3), a2 = e3.parts.length - 1, i2 = a2 >= 0 ? e3.parts[a2] : void 0;
41843
+ var a2 = (function(e3, t3, n3, o3) {
41844
+ var r3 = "thinking" === mE(t3), a3 = e3.parts.length - 1, i2 = a3 >= 0 ? e3.parts[a3] : void 0;
41845
41845
  if (i2 && ("text" === i2.kind || "thinking" === i2.kind) && "streaming" === i2.status && (r3 ? "thinking" === i2.kind : "text" === i2.kind)) {
41846
- var s2 = S(S({}, i2), { text: i2.text + t3.text }), c2 = QE(e3.parts, a2, s2);
41846
+ var s2 = S(S({}, i2), { text: i2.text + t3.text }), c2 = QE(e3.parts, a3, s2);
41847
41847
  return S(S({}, e3), { parts: c2, updatedAt: o3 });
41848
41848
  }
41849
41849
  var l2 = WE(e3.parts), u2 = r3 ? { id: n3(), kind: "thinking", text: t3.text, status: "streaming" } : { id: n3(), kind: "text", text: t3.text, status: "streaming" };
41850
41850
  return S(S({}, e3), { parts: w(w([], l2, true), [u2], false), updatedAt: o3 });
41851
41851
  })(e2, t2, o2, r2);
41852
+ return e2.pending ? a2 : S(S({}, a2), { parts: WE(a2.parts) });
41852
41853
  case "service":
41853
41854
  case "session-handoff":
41854
41855
  case "slash-commands-available":
@@ -41862,11 +41863,11 @@ function FE(e2, t2, n2, o2, r2) {
41862
41863
  return S(S({}, e2), { updatedAt: r2 });
41863
41864
  case "tool-call-start":
41864
41865
  return (function(e3, t3, n3, o3, r3) {
41865
- var a2, i2, s2 = WE(e3.parts), c2 = s2.findIndex(function(e4) {
41866
+ var a3, i2, s2 = WE(e3.parts), c2 = s2.findIndex(function(e4) {
41866
41867
  return "tool" === e4.kind && e4.callId === t3.call;
41867
41868
  }), l2 = { id: o3(), kind: "tool", callId: t3.call, name: t3.name, state: "running", input: t3.args, startedAt: r3, executionTarget: XE(n3) };
41868
41869
  if (c2 >= 0) {
41869
- var u2 = s2[c2], d2 = S(S({}, u2), { input: t3.args, name: t3.name, startedAt: r3, executionTarget: null !== (a2 = u2.executionTarget) && void 0 !== a2 ? a2 : l2.executionTarget, state: qE(u2.state) ? u2.state : "running", permission: "pending" === (null === (i2 = u2.permission) || void 0 === i2 ? void 0 : i2.status) ? S(S({}, u2.permission), { status: "approved", decidedAt: r3 }) : u2.permission });
41870
+ var u2 = s2[c2], d2 = S(S({}, u2), { input: t3.args, name: t3.name, startedAt: r3, executionTarget: null !== (a3 = u2.executionTarget) && void 0 !== a3 ? a3 : l2.executionTarget, state: qE(u2.state) ? u2.state : "running", permission: "pending" === (null === (i2 = u2.permission) || void 0 === i2 ? void 0 : i2.status) ? S(S({}, u2.permission), { status: "approved", decidedAt: r3 }) : u2.permission });
41870
41871
  return S(S({}, e3), { parts: QE(s2, c2, d2), updatedAt: r3 });
41871
41872
  }
41872
41873
  return S(S({}, e3), { parts: w(w([], s2, true), [l2], false), pending: true, updatedAt: r3 });
@@ -41877,20 +41878,20 @@ function FE(e2, t2, n2, o2, r2) {
41877
41878
  return "tool" === e4.kind && e4.callId === t3.call;
41878
41879
  });
41879
41880
  if (r3 < 0) {
41880
- var a2 = { id: n3(), kind: "tool", callId: t3.call, name: "tool", state: YE(t3.status), input: void 0, output: t3.output, completedAt: o3 };
41881
- return S(S({}, e3), { parts: w(w([], e3.parts, true), [a2], false), pending: BE(e3.parts.concat(a2)), updatedAt: o3 });
41881
+ var a3 = { id: n3(), kind: "tool", callId: t3.call, name: "tool", state: YE(t3.status), input: void 0, output: t3.output, completedAt: o3 };
41882
+ return S(S({}, e3), { parts: w(w([], e3.parts, true), [a3], false), pending: BE(e3.parts.concat(a3)), updatedAt: o3 });
41882
41883
  }
41883
41884
  var i2 = e3.parts[r3], s2 = S(S({}, i2), { state: YE(t3.status), output: t3.output, completedAt: o3 }), c2 = QE(e3.parts, r3, s2);
41884
41885
  return S(S({}, e3), { parts: c2, pending: BE(c2), updatedAt: o3 });
41885
41886
  })(e2, t2, o2, r2);
41886
41887
  case "permission-ask":
41887
41888
  return (function(e3, t3, n3, o3, r3) {
41888
- var a2, i2, s2, c2 = WE(e3.parts), l2 = (function(e4) {
41889
+ var a3, i2, s2, c2 = WE(e3.parts), l2 = (function(e4) {
41889
41890
  var t4;
41890
41891
  return null !== (t4 = e4.toolUseId) && void 0 !== t4 ? t4 : e4.requestId;
41891
41892
  })(t3), u2 = KE(c2, l2, t3.requestId), d2 = S(S(S({ status: "pending", requestId: t3.requestId }, t3.toolUseId ? { toolUseId: t3.toolUseId } : {}), { requestedAt: r3 }), t3.inputPreview ? { reason: t3.inputPreview } : {});
41892
41893
  if (u2 >= 0) {
41893
- var p2 = c2[u2], m2 = QE(c2, u2, S(S({}, p2), { name: null !== (a2 = t3.toolName) && void 0 !== a2 ? a2 : p2.name, input: VE(p2.input) ? p2.input : GE(t3), executionTarget: null !== (i2 = p2.executionTarget) && void 0 !== i2 ? i2 : XE(n3), permission: d2, state: HE(p2.state) }));
41894
+ var p2 = c2[u2], m2 = QE(c2, u2, S(S({}, p2), { name: null !== (a3 = t3.toolName) && void 0 !== a3 ? a3 : p2.name, input: VE(p2.input) ? p2.input : GE(t3), executionTarget: null !== (i2 = p2.executionTarget) && void 0 !== i2 ? i2 : XE(n3), permission: d2, state: HE(p2.state) }));
41894
41895
  return S(S({}, e3), { parts: m2, pending: BE(m2), updatedAt: r3 });
41895
41896
  }
41896
41897
  var f2 = { id: o3(), kind: "tool", callId: l2, name: null !== (s2 = t3.toolName) && void 0 !== s2 ? s2 : "tool", state: "pending", input: GE(t3), permission: d2, executionTarget: XE(n3) }, g2 = w(w([], c2, true), [f2], false);
@@ -41898,12 +41899,12 @@ function FE(e2, t2, n2, o2, r2) {
41898
41899
  })(e2, t2, n2, o2, r2);
41899
41900
  case "permission-resolved":
41900
41901
  return (function(e3, t3, n3, o3) {
41901
- var r3, a2, i2, s2, c2 = KE(e3.parts, t3.requestId, t3.requestId), l2 = "allow" === t3.decision ? "approved" : "denied";
41902
+ var r3, a3, i2, s2, c2 = KE(e3.parts, t3.requestId, t3.requestId), l2 = "allow" === t3.decision ? "approved" : "denied";
41902
41903
  if (c2 < 0) {
41903
41904
  var u2 = S({ id: n3(), kind: "tool", callId: t3.requestId, name: "tool", state: "approved" === l2 ? "pending" : "cancelled", input: {}, permission: S({ status: l2, requestId: t3.requestId, requestedAt: o3, decidedAt: o3, decidedBy: t3.by }, jE(t3)) }, "denied" === l2 ? { completedAt: o3, errorMessage: "Permission denied." } : {}), d2 = w(w([], e3.parts, true), [u2], false);
41904
41905
  return S(S({}, e3), { parts: d2, pending: BE(d2), updatedAt: o3 });
41905
41906
  }
41906
- var p2 = e3.parts[c2], m2 = "denied" === l2 && !qE(p2.state), f2 = S(S(S({}, p2), { state: m2 ? "cancelled" : p2.state, permission: S(S(S({}, p2.permission), { status: l2, requestId: null !== (a2 = null === (r3 = p2.permission) || void 0 === r3 ? void 0 : r3.requestId) && void 0 !== a2 ? a2 : t3.requestId, requestedAt: null !== (s2 = null === (i2 = p2.permission) || void 0 === i2 ? void 0 : i2.requestedAt) && void 0 !== s2 ? s2 : o3, decidedAt: o3, decidedBy: t3.by }), jE(t3)) }), m2 ? { completedAt: o3, errorMessage: "Permission denied." } : {}), g2 = QE(e3.parts, c2, f2);
41907
+ var p2 = e3.parts[c2], m2 = "denied" === l2 && !qE(p2.state), f2 = S(S(S({}, p2), { state: m2 ? "cancelled" : p2.state, permission: S(S(S({}, p2.permission), { status: l2, requestId: null !== (a3 = null === (r3 = p2.permission) || void 0 === r3 ? void 0 : r3.requestId) && void 0 !== a3 ? a3 : t3.requestId, requestedAt: null !== (s2 = null === (i2 = p2.permission) || void 0 === i2 ? void 0 : i2.requestedAt) && void 0 !== s2 ? s2 : o3, decidedAt: o3, decidedBy: t3.by }), jE(t3)) }), m2 ? { completedAt: o3, errorMessage: "Permission denied." } : {}), g2 = QE(e3.parts, c2, f2);
41907
41908
  return S(S({}, e3), { parts: g2, pending: BE(g2), updatedAt: o3 });
41908
41909
  })(e2, t2, o2, r2);
41909
41910
  case "turn-start":
@@ -41912,8 +41913,8 @@ function FE(e2, t2, n2, o2, r2) {
41912
41913
  return (function(e3, t3, n3) {
41913
41914
  var o3 = (function(e4, t4, n4) {
41914
41915
  var o4 = false, r3 = e4.map(function(e5) {
41915
- var r4, a2;
41916
- return "tool" !== e5.kind || "pending" !== e5.state && "running" !== e5.state ? e5 : (o4 = true, S(S({}, e5), "cancelled" === t4 ? { state: "cancelled", completedAt: n4, errorMessage: null !== (r4 = e5.errorMessage) && void 0 !== r4 ? r4 : "Tool was cancelled before completion." } : { state: "error", completedAt: n4, errorMessage: null !== (a2 = e5.errorMessage) && void 0 !== a2 ? a2 : "failed" === t4 ? "Tool did not complete before the turn failed." : "Tool did not emit a completion event before the turn ended." }));
41916
+ var r4, a3;
41917
+ return "tool" !== e5.kind || "pending" !== e5.state && "running" !== e5.state ? e5 : (o4 = true, S(S({}, e5), "cancelled" === t4 ? { state: "cancelled", completedAt: n4, errorMessage: null !== (r4 = e5.errorMessage) && void 0 !== r4 ? r4 : "Tool was cancelled before completion." } : { state: "error", completedAt: n4, errorMessage: null !== (a3 = e5.errorMessage) && void 0 !== a3 ? a3 : "failed" === t4 ? "Tool did not complete before the turn failed." : "Tool did not emit a completion event before the turn ended." }));
41917
41918
  });
41918
41919
  return o4 ? r3 : e4;
41919
41920
  })(WE(e3.parts), t3.status, n3);
@@ -49587,7 +49588,53 @@ exports.describeStoreReleaseAdvisoryStatus = function(e2) {
49587
49588
  return 0 === t2.length ? { min: e2.legacy.holdDays, max: e2.legacy.holdDays } : { min: Math.min.apply(Math, t2), max: Math.max.apply(Math, t2) };
49588
49589
  }, exports.matchesSeries = kh, exports.matchesViewCycleFilter = function(e2, t2, n2) {
49589
49590
  return !(null == t2 ? void 0 : t2.length) || !!e2 && k_(t2, n2).has(e2);
49590
- }, exports.matchingEnvelopeClasses = hA, exports.mayLiftCommitmentStop = function(e2, t2) {
49591
+ }, exports.matchingEnvelopeClasses = hA, exports.materializeAnswerTextReferences = function(e2, t2) {
49592
+ return A(this, arguments, void 0, function(e3, t3, n2) {
49593
+ var o2, r2, a2, i2, s2, c2, l2, u2, d2 = this;
49594
+ return void 0 === n2 && (n2 = function(e4) {
49595
+ return A(d2, void 0, void 0, function() {
49596
+ var t4;
49597
+ return E(this, function(n3) {
49598
+ switch (n3.label) {
49599
+ case 0:
49600
+ return [4, globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(e4))];
49601
+ case 1:
49602
+ return t4 = n3.sent(), [2, Array.from(new Uint8Array(t4), function(e5) {
49603
+ return e5.toString(16).padStart(2, "0");
49604
+ }).join("")];
49605
+ }
49606
+ });
49607
+ });
49608
+ }), E(this, function(d3) {
49609
+ switch (d3.label) {
49610
+ case 0:
49611
+ if (o2 = function() {
49612
+ return { envelopes: e3.filter(function(e4) {
49613
+ return !e4.__answerTextRange;
49614
+ }), complete: false };
49615
+ }, r2 = e3.filter(function(e4) {
49616
+ return e4.__answerTextRange;
49617
+ }), !r2.length || !t3) return [2, o2()];
49618
+ d3.label = 1;
49619
+ case 1:
49620
+ return d3.trys.push([1, 3, , 4]), [4, n2(t3)];
49621
+ case 2:
49622
+ return a2 = d3.sent(), [3, 4];
49623
+ case 3:
49624
+ return d3.sent(), [2, o2()];
49625
+ case 4:
49626
+ for (i2 = 0, s2 = 0, c2 = r2; s2 < c2.length; s2++) {
49627
+ if (l2 = c2[s2], u2 = l2.__answerTextRange, "agent" !== l2.role || l2.subagent || "text" !== l2.ev.t || true === l2.ev.thinking || !Number.isInteger(u2.start) || !Number.isInteger(u2.end) || u2.start !== i2 || u2.end <= u2.start || u2.end > t3.length || u2.length !== t3.length || u2.sha256 !== a2) return [2, o2()];
49628
+ i2 = u2.end;
49629
+ }
49630
+ return i2 !== t3.length ? [2, o2()] : [2, { complete: true, envelopes: e3.map(function(e4) {
49631
+ var n3 = e4.__answerTextRange;
49632
+ return n3 ? S(S({}, e4), { ev: S(S({}, e4.ev), { t: "text", text: t3.slice(n3.start, n3.end) }) }) : e4;
49633
+ }) }];
49634
+ }
49635
+ });
49636
+ });
49637
+ }, exports.mayLiftCommitmentStop = function(e2, t2) {
49591
49638
  return "user" === t2 || !(!e2 || !jk(e2.kind)) && "user" !== e2.kind;
49592
49639
  }, exports.mbToBytes = Lt, exports.measureTaskOutputBudget = function(e2) {
49593
49640
  var t2 = Vh(e2).length, n2 = Math.max(0, t2 - Kh);