@yanlinglabs/winter-agent-runtime 0.0.31 → 0.0.33

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.
@@ -9,14 +9,14 @@ import {
9
9
  resolveEngineSession2,
10
10
  resolveProductionWinterHome2,
11
11
  resolveProductionStoreHome
12
- } from "./index-d4pmmr27.js";
12
+ } from "./index-tk2cfedd.js";
13
13
  import {
14
14
  registerDefaultChildEngineFactory,
15
15
  loadResumedChain,
16
16
  buildProductionWiring,
17
17
  withAutoSkillPermissions,
18
18
  restoreChildRoster
19
- } from "./index-0xqzk1hm.js";
19
+ } from "./index-d2yr5j8d.js";
20
20
 
21
21
  // src/embedded.ts
22
22
  import { splitFrames, encodeFrame } from "@yanlinglabs/winter-agent-sdk";
package/dist/index.d.ts CHANGED
@@ -6,6 +6,9 @@ export { recordedProviderSystems, resetRecordedProviderSystems } from "./provide
6
6
  export { SCENARIO_FINAL_TEXT, SCENARIO_FIRST_TEXT, SCENARIO_CHILD_AGENT, SCENARIO_CHILD_MODEL, SCENARIO_CHILD_WIRE_ID, SCENARIO_DELEGATE_MARKER, SCENARIO_MODELS, SCENARIO_TOOL_CALLING_NONE, SCENARIO_TOOL_INPUT, SCENARIO_TOOL_NAME, startScenarioFake, } from "./provider/scenario-fake.js";
7
7
  export type { ScenarioFake, ScenarioFakeOptions, ScenarioRequest } from "./provider/scenario-fake.js";
8
8
  export { onCompaction } from "./tools/registry.js";
9
+ export { buildWorkflowWorkerSeatbeltProfile } from "./sandbox/profile.js";
10
+ export type { SandboxBrand } from "./sandbox/profile.js";
11
+ export { WORKFLOW_SANDBOX_REFUSED_EXIT_CODE } from "./workflows/runtime.js";
9
12
  export { createInMemoryChannel } from "./protocol/channel.js";
10
13
  export type { Duplex, FrameSource, FrameSink } from "./protocol/channel.js";
11
14
  export { createRpcBridge } from "./rpc/bridge.js";
package/dist/index.js CHANGED
@@ -6,6 +6,8 @@ import {
6
6
  sessionTempDir2,
7
7
  ensureTasksDir2,
8
8
  resolveProjectDirName2,
9
+ buildWorkflowWorkerSeatbeltProfile2,
10
+ WORKFLOW_SANDBOX_REFUSED_EXIT_CODE2,
9
11
  DEFAULT_CONTEXT_WINDOW_TOKENS2,
10
12
  createContextAccountant2,
11
13
  runEngine2,
@@ -53,8 +55,8 @@ import {
53
55
  DEFAULT_CLASSIFIER_TIMEOUT_MS2,
54
56
  createModelClassifier2,
55
57
  selectClassifierRoute2
56
- } from "./index-d4pmmr27.js";
57
- import"./index-9s68t0pd.js";
58
+ } from "./index-tk2cfedd.js";
59
+ import"./index-6edffgta.js";
58
60
  import"./index-z6s3r4xm.js";
59
61
  import"./index-bgeqc7ax.js";
60
62
  import"./index-bef62z3r.js";
@@ -306,11 +308,13 @@ export {
306
308
  SUBAGENT_CHILD_PROBE_TEXT2 as SUBAGENT_CHILD_PROBE_TEXT,
307
309
  TranscriptWriter2 as TranscriptWriter,
308
310
  TranscriptWriterError2 as TranscriptWriterError,
311
+ WORKFLOW_SANDBOX_REFUSED_EXIT_CODE2 as WORKFLOW_SANDBOX_REFUSED_EXIT_CODE,
309
312
  WinterCompatibilitySessionStore,
310
313
  WinterPathsError2 as WinterPathsError,
311
314
  WinterStoreError,
312
315
  WinterStoreLeaseError,
313
316
  assistantEntry2 as assistantEntry,
317
+ buildWorkflowWorkerSeatbeltProfile2 as buildWorkflowWorkerSeatbeltProfile,
314
318
  claudeCompactBoundaryEntry2 as claudeCompactBoundaryEntry,
315
319
  claudeCompactSummaryEntry2 as claudeCompactSummaryEntry,
316
320
  compatibilityKeys,
@@ -80,8 +80,13 @@ export interface ConnectedMcpClient {
80
80
  readResource(uri: string, opts?: {
81
81
  timeoutMs?: number;
82
82
  }): Promise<McpResourceContent[]>;
83
+ /**
84
+ * WS-27: `opts.signal` is the calling tool execution's abort (a turn interrupt). It cancels the MCP
85
+ * request (`notifications/cancelled`) and any elicitation the call raised (see `callScope` below).
86
+ */
83
87
  callTool(toolName: string, args: Record<string, unknown>, opts?: {
84
88
  timeoutMs?: number;
89
+ signal?: AbortSignal;
85
90
  }): Promise<McpToolCallResult>;
86
91
  close(): Promise<void>;
87
92
  }
@@ -19,9 +19,18 @@ export declare const MCP_ELICITATION_SUBTYPE = "mcp_elicitation";
19
19
  export interface ElicitationSender {
20
20
  request<T = unknown>(subtype: string, payload: unknown, opts?: {
21
21
  timeoutMs?: number;
22
+ signal?: AbortSignal;
22
23
  }): Promise<T>;
23
24
  }
24
- export type ElicitationAsker = (payload: ElicitationRequestPayload) => Promise<ElicitationResultPayload>;
25
+ /**
26
+ * WS-27: `opts.signal` aborts when the elicitation stops mattering -- the MCP server cancelled its request,
27
+ * or the tool call that raised it ended. The asker then stops waiting at once: the bridge sends the host a
28
+ * `control_cancel_request` (which aborts `Options.onElicitation`'s own `options.signal`), a host answer that
29
+ * arrives afterwards is dropped as an unknown request id, and the server is answered `cancel`.
30
+ */
31
+ export type ElicitationAsker = (payload: ElicitationRequestPayload, opts?: {
32
+ signal?: AbortSignal;
33
+ }) => Promise<ElicitationResultPayload>;
25
34
  export declare function createElicitationAsker(sender: ElicitationSender | undefined): ElicitationAsker;
26
35
  interface RawElicitParams {
27
36
  message: string;
@@ -31,5 +40,5 @@ interface RawElicitParams {
31
40
  requestedSchema?: Record<string, unknown> | undefined;
32
41
  }
33
42
  export declare function buildElicitationPayload(serverName: string, params: RawElicitParams): ElicitationRequestPayload;
34
- export declare function installElicitationHandler(client: Client, serverName: string, ask: ElicitationAsker): void;
43
+ export declare function installElicitationHandler(client: Client, serverName: string, ask: ElicitationAsker, callScope?: () => AbortSignal | undefined): void;
35
44
  export {};
@@ -5,7 +5,7 @@ import {
5
5
  McpConnectError2,
6
6
  resolveVersionNegotiation2,
7
7
  connectMcpServer2
8
- } from "./index-9s68t0pd.js";
8
+ } from "./index-6edffgta.js";
9
9
  import"./index-z6s3r4xm.js";
10
10
 
11
11
  // src/mcp-client.ts
@@ -1,4 +1,4 @@
1
- import type { PermissionBehavior, PermissionUpdate, RuleSource, PermissionDecisionClassification } from "@yanlinglabs/winter-agent-sdk";
1
+ import type { McpServerIdentity, PermissionBehavior, PermissionUpdate, RuleSource, PermissionDecisionClassification } from "@yanlinglabs/winter-agent-sdk";
2
2
  import type { SourcedRuleEntry, SourcedRuleSet } from "./ruleset.js";
3
3
  import type { PolicyState, AutoModeConfig } from "./policy-state.js";
4
4
  import { type ProtectedBrand } from "./protected.js";
@@ -9,6 +9,12 @@ export interface PermissionCall {
9
9
  input: Record<string, unknown>;
10
10
  toolUseId?: string;
11
11
  agentId?: string;
12
+ /**
13
+ * WS-27: the MCP server the CALLED tool belongs to (hooks/runner.ts's `mcpServerIdentity`, computed
14
+ * by the engine from the name the model called -- `toolName` may be a renamed server's declared
15
+ * spelling). Carried to the PreToolUse hook's `winter_mcp_server` and `canUseTool`'s `mcpServer`.
16
+ */
17
+ mcpServer?: McpServerIdentity;
12
18
  }
13
19
  export declare const ASK_USER_QUESTION_TOOL_NAME = "AskUserQuestion";
14
20
  export interface HookDecision {
@@ -478,7 +478,7 @@ export declare class TranscriptWriter implements SessionPersistence {
478
478
  private dialectRecord;
479
479
  static readBack(store: SessionStore, key: SessionKey): Promise<SessionStoreEntry[]>;
480
480
  }
481
- export declare const RUNTIME_ENGINE_VERSION = "0.0.31";
481
+ export declare const RUNTIME_ENGINE_VERSION = "0.0.33";
482
482
  export interface ResolvedEngineSession {
483
483
  config: RuntimeConfig;
484
484
  store: SessionPersistence | undefined;
package/dist/testing.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  runEngine2,
4
4
  echoProvider2,
5
5
  resolveEngineSession2
6
- } from "./index-d4pmmr27.js";
7
- import"./index-9s68t0pd.js";
6
+ } from "./index-tk2cfedd.js";
7
+ import"./index-6edffgta.js";
8
8
  import"./index-z6s3r4xm.js";
9
9
  import"./index-bgeqc7ax.js";
10
10
  import"./index-bef62z3r.js";
@@ -14,7 +14,7 @@ import {
14
14
  buildProductionWiring,
15
15
  withAutoSkillPermissions,
16
16
  restoreChildRoster
17
- } from "./index-0xqzk1hm.js";
17
+ } from "./index-d2yr5j8d.js";
18
18
  import {
19
19
  Queue
20
20
  } from "./index-97t2rmtf.js";
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const RUNTIME_VERSION = "0.0.31";
1
+ export declare const RUNTIME_VERSION = "0.0.33";
package/dist/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var RUNTIME_VERSION = "0.0.31";
2
+ var RUNTIME_VERSION = "0.0.33";
3
3
  export {
4
4
  RUNTIME_VERSION
5
5
  };
@@ -22,7 +22,28 @@ export interface WorkerProcess {
22
22
  onExit(cb: (code: number | null) => void): void;
23
23
  onError(cb: (err: Error) => void): void;
24
24
  kill(): void;
25
+ /** WS-27: the worker's last non-empty stderr line so far, when the spawner captures stderr (the real one does). */
26
+ lastStderrLine?(): string | undefined;
25
27
  }
28
+ /**
29
+ * WS-27: the exit code a workflow worker uses to REFUSE to run -- it found itself outside a sandbox that
30
+ * denies Keychain access (a host's workers check this at start). Reported as a sandbox failure, never as a
31
+ * crash, so the host can tell the user what is actually wrong.
32
+ */
33
+ export declare const WORKFLOW_SANDBOX_REFUSED_EXIT_CODE = 77;
34
+ /** The failure text for a worker that exited without a terminal bridge message. */
35
+ export declare function workerExitMessage(code: number | null, lastStderrLine?: string): string;
36
+ /** At most this many characters of the reported line. */
37
+ export declare const STDERR_LINE_CAP = 500;
38
+ /** At most this many characters of an unterminated line are held while waiting for its newline. */
39
+ export declare const STDERR_CARRY_CAP = 4096;
40
+ /**
41
+ * Keeps the last non-empty line of a stream, bounded -- never the whole of a chatty worker's stderr.
42
+ * Decoded with a streaming `StringDecoder`, so a multi-byte character split across two chunks survives;
43
+ * the reported line is sanitized (`UNSAFE_LINE_CHARS`) and capped at `STDERR_LINE_CAP`, and an
44
+ * unterminated line keeps only its last `STDERR_CARRY_CAP` characters.
45
+ */
46
+ export declare function stderrTail(stream: NodeJS.ReadableStream | null | undefined): () => string | undefined;
26
47
  export type WorkerSpawner = (command: WorkerCommand, opts: {
27
48
  home?: string;
28
49
  winterHome?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yanlinglabs/winter-agent-runtime",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {
@@ -73,9 +73,9 @@
73
73
  "@modelcontextprotocol/client": "^2.1.0",
74
74
  "ajv": "^8.20.0",
75
75
  "ignore": "7.0.5",
76
- "@yanlinglabs/winter-provider-runtime": "0.0.31",
77
- "@yanlinglabs/winter-agent-sdk": "0.0.31",
78
- "@yanlinglabs/winter-provider-catalog": "0.0.31"
76
+ "@yanlinglabs/winter-agent-sdk": "0.0.33",
77
+ "@yanlinglabs/winter-provider-runtime": "0.0.33",
78
+ "@yanlinglabs/winter-provider-catalog": "0.0.33"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@modelcontextprotocol/server": "^2.1.0"