strands-darwin 0.0.48 → 0.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/dist/patches/{@strands-agents+sdk+1.18.0.patch → @strands-agents+sdk+1.20.0.patch} +28 -52
  4. package/dist/src/agent/background-delegation.d.ts +1 -1
  5. package/dist/src/agent/background-delegation.js +3 -3
  6. package/dist/src/agent/cache-miss.d.ts +3 -3
  7. package/dist/src/agent/cache-miss.js +6 -3
  8. package/dist/src/agent/cache-miss.js.map +1 -1
  9. package/dist/src/agent/compact.js +1 -1
  10. package/dist/src/agent/cost.d.ts +1 -1
  11. package/dist/src/agent/runtime.d.ts +22 -5
  12. package/dist/src/agent/runtime.js +124 -7
  13. package/dist/src/agent/runtime.js.map +1 -1
  14. package/dist/src/agent/usage-state.d.ts +29 -0
  15. package/dist/src/agent/usage-state.js +131 -0
  16. package/dist/src/agent/usage-state.js.map +1 -0
  17. package/dist/src/agent/usage.d.ts +1 -1
  18. package/dist/src/headless-runner.js +10 -7
  19. package/dist/src/headless-runner.js.map +1 -1
  20. package/dist/src/headless.d.ts +1 -1
  21. package/dist/src/headless.js +1 -1
  22. package/dist/src/mcp/codegraph-preflight.js +8 -4
  23. package/dist/src/mcp/codegraph-preflight.js.map +1 -1
  24. package/dist/src/mcp/oauth-login.js +1 -1
  25. package/dist/src/mcp/oauth-login.js.map +1 -1
  26. package/dist/src/mcp/oauth-provider.d.ts +1 -2
  27. package/dist/src/mcp/oauth-provider.js +9 -0
  28. package/dist/src/mcp/oauth-provider.js.map +1 -1
  29. package/dist/src/mcp/oauth-store.d.ts +1 -2
  30. package/dist/src/mcp/oauth-store.js +9 -2
  31. package/dist/src/mcp/oauth-store.js.map +1 -1
  32. package/dist/src/mcp/prompts.d.ts +0 -18
  33. package/dist/src/mcp/prompts.js +25 -4
  34. package/dist/src/mcp/prompts.js.map +1 -1
  35. package/dist/src/mcp/web-search-empty-results.js +8 -4
  36. package/dist/src/mcp/web-search-empty-results.js.map +1 -1
  37. package/dist/src/npm-package/patch-package-format.d.ts +5 -5
  38. package/dist/src/npm-package/patch-package-format.js +4 -4
  39. package/dist/src/sdk-patch-preflight.js +1 -1
  40. package/dist/src/trajectory/record.d.ts +1 -1
  41. package/dist/src/tui/App.d.ts +1 -1
  42. package/dist/src/tui/App.js +7 -7
  43. package/dist/src/tui/App.js.map +1 -1
  44. package/dist/src/tui/task-wake.d.ts +1 -1
  45. package/dist/src/tui/task-wake.js +1 -1
  46. package/dist/src/tui/turn-state.d.ts +1 -1
  47. package/dist/src/tui/turn-state.js +10 -2
  48. package/dist/src/tui/turn-state.js.map +1 -1
  49. package/package.json +3 -2
@@ -28,7 +28,7 @@ export class WebSearchEmptyResults {
28
28
  return replacements.length;
29
29
  }
30
30
  wrap(candidate, clients) {
31
- const owner = mcpOwner(candidate);
31
+ const owner = mcpOwner(candidate, clients);
32
32
  if (owner === undefined || !clients.includes(owner))
33
33
  return candidate;
34
34
  return mcpServerToolName(owner, candidate) === WEB_SEARCH_TOOL_NAME
@@ -82,9 +82,13 @@ function isEmptyResultsError(result) {
82
82
  result.content[0]?.type === 'textBlock' &&
83
83
  result.content[0].text === EMPTY_RESULTS_ERROR;
84
84
  }
85
- function mcpOwner(tool) {
86
- const owner = tool.mcpClient;
87
- return owner !== null && typeof owner === 'object' ? owner : undefined;
85
+ function mcpOwner(tool, clients) {
86
+ return clients.find((client) => isRegisteredMcpTool(tool, client) && tool.mcpClient === client);
87
+ }
88
+ function isRegisteredMcpTool(tool, client) {
89
+ // SDK discovery records only its real McpTool objects in this client's map.
90
+ // Check exact object membership before reading the public owner getter.
91
+ return mcpServerToolName(client, tool) !== undefined;
88
92
  }
89
93
  function mcpServerToolName(client, tool) {
90
94
  const names = client._serverToolNames;
@@ -1 +1 @@
1
- {"version":3,"file":"web-search-empty-results.js","sourceRoot":"","sources":["../../../src/mcp/web-search-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,CAAC,IAAU,EAAE,OAA6B;IACzD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC;AAClG,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAU,EAAE,MAAiB;IACxD,4EAA4E;IAC5E,wEAAwE;IACxE,OAAO,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,SAAS,CAAC;AACvD,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAiB,EAAE,IAAU;IACtD,MAAM,KAAK,GAAI,MAEb,CAAC,gBAAgB,CAAC;IACpB,MAAM,IAAI,GAAG,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * Conversion of a pnpm dependency patch into `patch-package` format.
3
3
  *
4
4
  * The repository pins its SDK patch once, as a pnpm patch
5
- * (`patches/@strands-agents__sdk@1.18.0.patch`, `pnpm patch-commit`, applied by
5
+ * (`patches/@strands-agents__sdk@1.20.0.patch`, `pnpm patch-commit`, applied by
6
6
  * `pnpm-workspace.yaml` `patchedDependencies`). The npm package cannot use pnpm's
7
7
  * mechanism, so `postinstall` runs `patch-package`, which reads the *same* patch in a
8
8
  * slightly different dialect. The two formats differ only in two places:
@@ -10,8 +10,8 @@
10
10
  * - **paths** — pnpm writes them relative to the package (`a/dist/src/index.js`),
11
11
  * patch-package expects them rooted at the app (`a/node_modules/@strands-agents/sdk/dist/src/index.js`);
12
12
  * - **file name** — pnpm encodes the scope slash as `__` and separates the version
13
- * with `@` (`@strands-agents__sdk@1.18.0.patch`), patch-package uses `+` for both
14
- * (`@strands-agents+sdk+1.18.0.patch`).
13
+ * with `@` (`@strands-agents__sdk@1.20.0.patch`), patch-package uses `+` for both
14
+ * (`@strands-agents+sdk+1.20.0.patch`).
15
15
  *
16
16
  * This module is the whole conversion, as pure functions. It is applied at build time
17
17
  * by `generate-patch.ts`, so there is never a second hand-maintained copy of the patch:
@@ -22,7 +22,7 @@
22
22
  export interface PnpmPatchIdentity {
23
23
  /** The package name, scope slash restored (`@strands-agents/sdk`). */
24
24
  readonly packageName: string;
25
- /** The exact version the patch was recorded against (`1.18.0`). */
25
+ /** The exact version the patch was recorded against (`1.20.0`). */
26
26
  readonly version: string;
27
27
  }
28
28
  /**
@@ -30,7 +30,7 @@ export interface PnpmPatchIdentity {
30
30
  * or `undefined` when the name is not in that shape.
31
31
  */
32
32
  export declare function parsePnpmPatchFileName(fileName: string): PnpmPatchIdentity | undefined;
33
- /** The patch-package file name for an identity (`@strands-agents+sdk+1.18.0.patch`). */
33
+ /** The patch-package file name for an identity (`@strands-agents+sdk+1.20.0.patch`). */
34
34
  export declare function patchPackageFileName(identity: PnpmPatchIdentity): string;
35
35
  /** Where patch-package expects the package to live, relative to the app root, with a trailing slash. */
36
36
  export declare function patchPackagePathPrefix(packageName: string): string;
@@ -2,7 +2,7 @@
2
2
  * Conversion of a pnpm dependency patch into `patch-package` format.
3
3
  *
4
4
  * The repository pins its SDK patch once, as a pnpm patch
5
- * (`patches/@strands-agents__sdk@1.18.0.patch`, `pnpm patch-commit`, applied by
5
+ * (`patches/@strands-agents__sdk@1.20.0.patch`, `pnpm patch-commit`, applied by
6
6
  * `pnpm-workspace.yaml` `patchedDependencies`). The npm package cannot use pnpm's
7
7
  * mechanism, so `postinstall` runs `patch-package`, which reads the *same* patch in a
8
8
  * slightly different dialect. The two formats differ only in two places:
@@ -10,8 +10,8 @@
10
10
  * - **paths** — pnpm writes them relative to the package (`a/dist/src/index.js`),
11
11
  * patch-package expects them rooted at the app (`a/node_modules/@strands-agents/sdk/dist/src/index.js`);
12
12
  * - **file name** — pnpm encodes the scope slash as `__` and separates the version
13
- * with `@` (`@strands-agents__sdk@1.18.0.patch`), patch-package uses `+` for both
14
- * (`@strands-agents+sdk+1.18.0.patch`).
13
+ * with `@` (`@strands-agents__sdk@1.20.0.patch`), patch-package uses `+` for both
14
+ * (`@strands-agents+sdk+1.20.0.patch`).
15
15
  *
16
16
  * This module is the whole conversion, as pure functions. It is applied at build time
17
17
  * by `generate-patch.ts`, so there is never a second hand-maintained copy of the patch:
@@ -30,7 +30,7 @@ export function parsePnpmPatchFileName(fileName) {
30
30
  const { name, version } = match.groups;
31
31
  return { packageName: name.replace('__', '/'), version };
32
32
  }
33
- /** The patch-package file name for an identity (`@strands-agents+sdk+1.18.0.patch`). */
33
+ /** The patch-package file name for an identity (`@strands-agents+sdk+1.20.0.patch`). */
34
34
  export function patchPackageFileName(identity) {
35
35
  return `${identity.packageName.replace('/', '+')}+${identity.version}.patch`;
36
36
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Startup preflight: refuse to run on an unpatched `@strands-agents/sdk`.
3
3
  *
4
- * darwin depends on its pinned SDK patch (`patches/@strands-agents__sdk@1.18.0.patch`).
4
+ * darwin depends on its pinned SDK patch (`patches/@strands-agents__sdk@1.20.0.patch`).
5
5
  * pnpm applies it in a clone; the npm package applies it from `postinstall` with
6
6
  * `patch-package`. An install that skipped scripts (`npm install --ignore-scripts`,
7
7
  * or `pnpm add -g`, whose isolated layout patch-package cannot address) leaves the
@@ -323,7 +323,7 @@ export interface ShellCommandRecord extends RecordEnvelope {
323
323
  * delegation label the transcript row shows (`subagent general#bg1: count things`),
324
324
  * `taskId` the SDK task id, `exitCode`/`signal` always `null`, and `state` is
325
325
  * `succeeded`/`failed` from the run's tool result — the report itself is never here,
326
- * it reaches the model only as the SDK's own `strands_background_task_result` pair.
326
+ * it reaches the model only as the SDK's own `strands_manage_background_task` pair.
327
327
  */
328
328
  export interface TaskNotificationFields {
329
329
  taskId: string;
@@ -53,7 +53,7 @@ export declare function workingStatusIndex(frame: number): number;
53
53
  export declare function formatUsageReport(usage: UsageTotals, config: AppConfig, resumed: boolean, turnInFlight?: boolean, lastTurn?: UsageTotals, children?: {
54
54
  dispatches: number;
55
55
  usage: UsageTotals;
56
- }, callStats?: SessionCallStats, modelShares?: readonly ModelUsageShare[], cacheMisses?: CacheMissReport): string;
56
+ }, callStats?: SessionCallStats, modelShares?: readonly ModelUsageShare[], cacheMisses?: CacheMissReport, historyComplete?: boolean): string;
57
57
  /**
58
58
  * Wraps a reducer dispatch so every notice is also written to the diagnostics log,
59
59
  * with the severity it was shown at — or hands the dispatch straight back when there
@@ -1227,7 +1227,7 @@ export function App({ runtime: initialRuntime, permissions, initialHistory = [],
1227
1227
  dispatch({ type: 'userInput', text });
1228
1228
  dispatch({
1229
1229
  type: 'notice',
1230
- text: formatUsageReport(runtime.usage, runtime.config, runtime.info.resumed, status === 'streaming', runtime.lastTurnUsage, runtime.childUsage, runtime.callStats, runtime.modelShares, runtime.cacheMissReport()),
1230
+ text: formatUsageReport(runtime.usage, runtime.config, runtime.info.resumed, status === 'streaming', runtime.lastTurnUsage, runtime.childUsage, runtime.callStats, runtime.modelShares, runtime.cacheMissReport(), runtime.hasCompleteUsageHistory),
1231
1231
  });
1232
1232
  return;
1233
1233
  }
@@ -3225,7 +3225,7 @@ function capabilityCount(count, label) {
3225
3225
  * working), and that comparison is what a column makes readable. An unavailable
3226
3226
  * provider metric remains text rather than masquerading as numeric zero.
3227
3227
  */
3228
- export function formatUsageReport(usage, config, resumed, turnInFlight = false, lastTurn, children, callStats, modelShares, cacheMisses) {
3228
+ export function formatUsageReport(usage, config, resumed, turnInFlight = false, lastTurn, children, callStats, modelShares, cacheMisses, historyComplete = !resumed) {
3229
3229
  const rows = usageRows(usage, config);
3230
3230
  const derived = cacheEffectivenessRows(usage, config);
3231
3231
  // The miss count is a fact only once a miss was observed (SER-074): a session
@@ -3256,11 +3256,11 @@ export function formatUsageReport(usage, config, resumed, turnInFlight = false,
3256
3256
  }
3257
3257
  }
3258
3258
  }
3259
- // "This run" is the honest scope: the SDK's meter is per-process, so a resumed
3260
- // session's earlier spend is simply not knowable here.
3261
- const heading = resumed
3262
- ? 'token usage — this run (resumed: earlier runs are not counted)'
3263
- : 'token usage — this run';
3259
+ const heading = !historyComplete
3260
+ ? 'token usage — this session (earlier usage unavailable: no valid saved counters)'
3261
+ : resumed
3262
+ ? 'token usage — this session (including earlier runs)'
3263
+ : 'token usage — this session';
3264
3264
  // Asked mid-turn, the totals are the ones from before it: the meter accumulates
3265
3265
  // a model call when it finishes. Said out loud, because numbers that do not move
3266
3266
  // while the agent is visibly working read as a broken counter.