@yanlinglabs/winter-agent-runtime 0.0.35 → 0.0.38

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.
@@ -53,6 +53,24 @@ export interface PlanModeAttachment extends AttachmentPayload {
53
53
  plansDirectoryFallback?: string;
54
54
  hostPlanBody?: string;
55
55
  }
56
+ /**
57
+ * claude's `deferred_tools_delta`: the DEFERRED tools (loaded through `ToolSearch` on first use) the
58
+ * history has not yet announced, and the ones it announced that are gone. Without it a model cannot know
59
+ * a deferred tool exists -- its schema is not in `tools` (or rides `defer_loading`, which the model does
60
+ * not see) -- so it could only find one by guessing a keyword. Persisted like every attachment, so the
61
+ * announcement is a stable, cacheable part of the history and a pool change costs one appended entry,
62
+ * never a moved prefix (claude's reason for the delta form over its older per-request
63
+ * `<available-deferred-tools>` prepend).
64
+ */
65
+ export interface DeferredToolsDeltaAttachment extends AttachmentPayload {
66
+ type: "deferred_tools_delta";
67
+ addedNames: string[];
68
+ addedLines: string[];
69
+ removedNames: string[];
70
+ }
71
+ /** claude's own two headers for `deferred_tools_delta` (`utils/messages.ts`), verbatim. */
72
+ export declare const DEFERRED_TOOLS_ADDED_HEADER = "The following deferred tools are now available via ToolSearch:";
73
+ export declare const DEFERRED_TOOLS_REMOVED_HEADER = "The following deferred tools are no longer available (their MCP server disconnected). Do not search for them \u2014 ToolSearch will return no match:";
56
74
  export declare const AGENT_LISTING_INITIAL_HEADER = "Available agent types for the Agent tool:";
57
75
  export declare const AGENT_LISTING_ADDED_HEADER = "New agent types are now available for the Agent tool:";
58
76
  export declare const AGENT_LISTING_REMOVED_HEADER = "The following agent types are no longer available:";
@@ -103,6 +121,20 @@ export interface AttachmentRendererOptions {
103
121
  export declare function registerAttachmentRenderer(type: string, renderer: AttachmentRenderer, options?: AttachmentRendererOptions): void;
104
122
  /** WS-23: whether this attachment's renderer opted into the mid-conversation `system` role. */
105
123
  export declare function isSystemRoleAttachment(attachment: AttachmentPayload): boolean;
124
+ /**
125
+ * claude's fold for `deferred_tools_delta`: the deferred tool names the history has announced and not
126
+ * since withdrawn. A delta's `addedNames` count only when it carries `addedLines` (as the agent fold).
127
+ */
128
+ export declare function announcedDeferredTools(messages: readonly ProviderMessage[]): Set<string>;
129
+ /**
130
+ * The `deferred_tools_delta` this history needs now, or `undefined` when nothing changed. `deferred` = the
131
+ * session's deferred tool names, as the model would call them; `offered` = EVERY name it is offered now,
132
+ * eager ones included. An announced name is withdrawn only when it is not offered AT ALL: a tool that went
133
+ * from deferred to eager (a switch to a provider that cannot search, which injects everything) is still
134
+ * there, and telling the model "do not search for it" would be false. It stays announced, so it is not
135
+ * re-announced if it defers again.
136
+ */
137
+ export declare function computeDeferredToolsDelta(deferred: readonly string[], offered: readonly string[], history: readonly ProviderMessage[]): DeferredToolsDeltaAttachment | undefined;
106
138
  /** The wrapped model-facing text for an attachment, or `undefined` when there is none (an unknown type included). */
107
139
  export declare function renderAttachment(attachment: AttachmentPayload): string | undefined;
108
140
  /** The history message for an attachment, or `undefined` when it renders to nothing (it is then not appended at all). */
@@ -1,4 +1,4 @@
1
- import"./index-q5jpx2mz.js";
1
+ import"./index-5xe59vkt.js";
2
2
  import {
3
3
  liveProcessGroups,
4
4
  onProcessGroupChange
@@ -6,10 +6,10 @@ import {
6
6
  import"./index-mwew595z.js";
7
7
  import"./index-2wgfv0pa.js";
8
8
  import"./index-bef62z3r.js";
9
- import"./index-838n35xx.js";
9
+ import"./index-z3970wsj.js";
10
10
  import {
11
11
  runEmbeddedSession2
12
- } from "./index-91rvsndj.js";
12
+ } from "./index-8x4yjdg7.js";
13
13
  import {
14
14
  Queue
15
15
  } from "./index-97t2rmtf.js";
package/dist/embedded.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  runEmbeddedSession2
3
- } from "./index-91rvsndj.js";
4
- import"./index-838n35xx.js";
5
- import"./index-q5jpx2mz.js";
3
+ } from "./index-8x4yjdg7.js";
4
+ import"./index-z3970wsj.js";
5
+ import"./index-5xe59vkt.js";
6
6
  import"./index-2wgfv0pa.js";
7
7
  import"./index-bef62z3r.js";
8
8
  import"./index-1hef2gff.js";
package/dist/engine.d.ts CHANGED
@@ -25,6 +25,7 @@ import { type HookAuditRecord } from "./hooks/runner.js";
25
25
  import { type DurableApprovalStore } from "./permissions/approvals.js";
26
26
  import "./tools/descriptors/index.ts";
27
27
  import "./tools/impl/index.ts";
28
+ import { type ToolResultBlock, type ToolResultSiteIcon } from "./tools/registry.js";
28
29
  import { type ResolvedReviewer } from "./tools/impl/advisor.js";
29
30
  import type { AuxiliaryModelResolution } from "./provider/session-provider.js";
30
31
  import type { ToolSecretResolver } from "./provider/tool-secret.js";
@@ -416,6 +417,12 @@ export declare class ProviderTurnError extends Error {
416
417
  * the engine answers it with one reactive compaction and one retry. `undefined` for any other failure.
417
418
  */
418
419
  readonly contextOverflow: true | undefined;
420
+ /**
421
+ * Code-mode images: the provider refused the request for its IMAGES (too many, or past a many-image
422
+ * size limit). The engine answers it with ONE retry that sends every image but the newest as a note
423
+ * (`imagesOnlyNewest`), sticky for the rest of the run. `undefined` for any other failure.
424
+ */
425
+ readonly imageOverflow: true | undefined;
419
426
  constructor(message: string, opts?: {
420
427
  status?: number;
421
428
  providerCode?: string;
@@ -423,6 +430,7 @@ export declare class ProviderTurnError extends Error {
423
430
  retryable?: boolean;
424
431
  committed?: boolean;
425
432
  contextOverflow?: true;
433
+ imageOverflow?: true;
426
434
  cause?: unknown;
427
435
  });
428
436
  }
@@ -528,6 +536,26 @@ export declare function inStreamOrder(turn: ProviderTurn): ContentBlock[] | unde
528
536
  * so a host that renders "thinking…" or "[redacted]" keeps working.
529
537
  */
530
538
  export declare function contentForHost(content: ContentBlock[]): ContentBlock[];
539
+ /**
540
+ * Code-mode images: a tool round's results as the HOST sees them on the `user` frame -- every image block
541
+ * (top level or inside a `tool_result`) keeps its shape and `media_type` and loses its bytes: `data`
542
+ * becomes `""`. The bytes exist for one reader, the provider on the next request, and they reach it from
543
+ * the engine's history and the session transcript. The frame is one NDJSON line on the child's stdout, and
544
+ * the host SDK bounds an unterminated line at `maxBufferSize` (1 MiB by default, `sdk/src/query.ts`): an
545
+ * image Read's base64 (up to ~5.2 MB) would end the session with a `ProtocolDecodeError`. A host that
546
+ * renders "[image]" keeps working, and the transcript (which the host can read) holds the real bytes.
547
+ * Everything else is returned by identity.
548
+ */
549
+ export declare function toolResultsForHost(content: ContentBlock[]): ContentBlock[];
550
+ /**
551
+ * The host's copy of a tool round's results, each `tool_result` whose call reported site icons
552
+ * (`ToolResultPayload.siteIcons` -- WebFetch's page icon, WebSearch's Exa favicons) carrying them as
553
+ * `winter_site_icons: [{url, icon_url}]`. Host-only by construction: it is applied to the frame copy at
554
+ * the one tool-round write, and copies every block it touches -- `toolResultsForHost` can hand back the
555
+ * very block objects `resultBlocks` holds, which also feed the history, the transcript and every
556
+ * provider request, so mutating one would put the field in front of the model.
557
+ */
558
+ export declare function withHostSiteIcons(content: ContentBlock[], icons: ReadonlyMap<string, readonly ToolResultSiteIcon[]>): ContentBlock[];
531
559
  /**
532
560
  * Phase 6 (R6-9), widened by the fix wave: the session's RESOLVED provider identity as the engine
533
561
  * carries it -- the `MessageOrigin` half every `origin` record and `providerAnnotations` read, plus
@@ -663,7 +691,9 @@ export interface ToolExecutor {
663
691
  explicitApproval?: "prompt" | "rule";
664
692
  }): Promise<{
665
693
  output: string;
694
+ blocks?: ToolResultBlock[];
666
695
  isError?: boolean;
696
+ siteIcons?: ToolResultSiteIcon[];
667
697
  }>;
668
698
  }
669
699
  /**