@yanlinglabs/winter-agent-sdk 0.0.33 → 0.0.35

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/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export type { Query, SdkMessage, SessionMessagingFacet } from "./query.js";
3
3
  export type { QueryInternal, ControlRequestHandler, ControlRequestHandlerResult } from "./query.js";
4
4
  export type { Options } from "./options.js";
5
5
  export { SYSTEM_PROMPT_DYNAMIC_BOUNDARY, DEFAULT_CONTEXT_WINDOW_TOKENS, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_PLANS_DIRECTORY, DEFAULT_OUTPUT_STYLE } from "./options.js";
6
- export { DEFAULT_PROVIDER_STALL_TIMEOUT_MS, DEFAULT_KEYCHAIN_SERVICE, MCP_OAUTH_REFRESH_SUBTYPE, CREDENTIAL_RESOLVE_SUBTYPE } from "./options.js";
6
+ export { DEFAULT_PROVIDER_STALL_TIMEOUT_MS, DEFAULT_KEYCHAIN_SERVICE, TEST_KEYCHAIN_ENV, TEST_KEYCHAIN_MEMORY, MCP_OAUTH_REFRESH_SUBTYPE, CREDENTIAL_RESOLVE_SUBTYPE } from "./options.js";
7
7
  export { WEB_TOOLS_DEFAULTS, resolveWebToolsConfig } from "./options.js";
8
8
  export type { ResolvedWebToolsConfig } from "./options.js";
9
9
  export type { WebToolsConfig, WebSearchConfig, WebFetchConfig, WebPrivateAddressPolicy, AutoMemoryConfig } from "./protocol/config.js";
package/dist/index.js CHANGED
@@ -66,6 +66,8 @@ var DEFAULT_PLANS_DIRECTORY = `${WINTER_BRAND2.projectDirName}/plans`;
66
66
  var DEFAULT_OUTPUT_STYLE = "default";
67
67
  var DEFAULT_PROVIDER_STALL_TIMEOUT_MS = 120000;
68
68
  var DEFAULT_KEYCHAIN_SERVICE = WINTER_BRAND2.keychainService;
69
+ var TEST_KEYCHAIN_ENV = "WINTER_TEST_KEYCHAIN";
70
+ var TEST_KEYCHAIN_MEMORY = "memory";
69
71
  var MCP_OAUTH_REFRESH_SUBTYPE = "mcp_oauth_refresh";
70
72
  var CREDENTIAL_RESOLVE_SUBTYPE = "credential_resolve";
71
73
  var WEB_TOOLS_DEFAULTS = {
@@ -730,7 +732,7 @@ function query(args) {
730
732
  command,
731
733
  args: ["--run", "--config-json", JSON.stringify(config)],
732
734
  cwd: config.cwd,
733
- env: options.env ?? process.env,
735
+ env: withTestKeychainRedirect(options.env) ?? process.env,
734
736
  ...options.abortController ? { signal: options.abortController.signal } : {}
735
737
  };
736
738
  const proc = (options.spawnClaudeCodeProcess ?? defaultSpawn)(spawnOptions);
@@ -1127,8 +1129,14 @@ function query(args) {
1127
1129
  };
1128
1130
  return gen;
1129
1131
  }
1132
+ function withTestKeychainRedirect(env) {
1133
+ const redirect = process.env[TEST_KEYCHAIN_ENV];
1134
+ if (env === undefined || redirect === undefined || redirect === "" || env[TEST_KEYCHAIN_ENV] !== undefined)
1135
+ return env;
1136
+ return { ...env, [TEST_KEYCHAIN_ENV]: redirect };
1137
+ }
1130
1138
  // src/version.ts
1131
- var SDK_VERSION = "0.0.33";
1139
+ var SDK_VERSION = "0.0.35";
1132
1140
  // src/paths/project-key.ts
1133
1141
  var TRANSCRIPT_PROJECT_KEY_MAX_LENGTH = 64;
1134
1142
  var VENDOR_PROJECT_KEY_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
@@ -2323,6 +2331,8 @@ export {
2323
2331
  SETTING_SOURCES,
2324
2332
  SYSTEM_PROMPT_DYNAMIC_BOUNDARY,
2325
2333
  SessionNotFoundError,
2334
+ TEST_KEYCHAIN_ENV,
2335
+ TEST_KEYCHAIN_MEMORY,
2326
2336
  TRANSCRIPT_PROJECT_KEY_MAX_LENGTH,
2327
2337
  WEB_TOOLS_DEFAULTS,
2328
2338
  WINTER_BRAND2 as WINTER_BRAND,
package/dist/options.d.ts CHANGED
@@ -15,6 +15,28 @@ export declare const DEFAULT_PLANS_DIRECTORY: string;
15
15
  export declare const DEFAULT_OUTPUT_STYLE = "default";
16
16
  export declare const DEFAULT_PROVIDER_STALL_TIMEOUT_MS = 120000;
17
17
  export declare const DEFAULT_KEYCHAIN_SERVICE: string;
18
+ /**
19
+ * TEST-ONLY. The environment variable that redirects every DEFAULT secrets backend (the runtime's
20
+ * `provider/keychain-store.ts`, the one site that may reach the macOS Keychain) to a per-process
21
+ * in-memory store. Exactly `TEST_KEYCHAIN_MEMORY` enables the redirect; unset or empty leaves the real
22
+ * Keychain; any other value is REFUSED (a typed `io` credential error, which stops the store stack),
23
+ * never a silent fall through to the real store or to "no credential". The first time the in-memory
24
+ * store engages, the process prints one stderr line saying so.
25
+ *
26
+ * WHY. A test that resolves a `{ kind: "keychain" }` ref in a process that was handed no store of its
27
+ * own (a real `winter` child, an embedded Worker) reached the developer's REAL login Keychain -- service
28
+ * `DEFAULT_KEYCHAIN_SERVICE` by default -- and macOS raised a consent dialog, which also hung the child. Every
29
+ * `bun test` run sets this through `scripts/test-keychain-guard.ts` (each package's `bunfig.toml`), and
30
+ * `query()` carries it into the child's environment even when a host supplies an explicit `env`.
31
+ *
32
+ * Honoured by a compiled binary too, deliberately: the compiled legs of the test suite run the
33
+ * release-shaped artifact, and a build that ignored the variable would put exactly those legs back on
34
+ * the real Keychain. Left on by accident it fails CLOSED -- credentials read as absent, writes vanish
35
+ * with the process -- and it exposes nothing. Never set it outside a test run.
36
+ */
37
+ export declare const TEST_KEYCHAIN_ENV = "WINTER_TEST_KEYCHAIN";
38
+ /** The one value of `TEST_KEYCHAIN_ENV` that selects the in-memory backend. */
39
+ export declare const TEST_KEYCHAIN_MEMORY = "memory";
18
40
  /**
19
41
  * WS-25 (MCP OAuth): the runtime -> host control subtype a session sends when a stored MCP sign-in needs
20
42
  * refreshing (`McpOAuthRefreshRequest` -> `McpOAuthRefreshAnswer`, protocol/config.ts). Spelled once:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yanlinglabs/winter-agent-sdk",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {
@@ -45,15 +45,15 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@yanlinglabs/winter-provider-catalog": "0.0.33"
48
+ "@yanlinglabs/winter-provider-catalog": "0.0.35"
49
49
  },
50
50
  "optionalDependencies": {
51
- "@yanlinglabs/winter-agent-sdk-darwin-arm64": "0.0.33"
51
+ "@yanlinglabs/winter-agent-sdk-darwin-arm64": "0.0.35"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^26.4.0",
55
- "@yanlinglabs/winter-agent-runtime": "0.0.33",
56
- "@yanlinglabs/winter-conformance": "0.0.33"
55
+ "@yanlinglabs/winter-conformance": "0.0.35",
56
+ "@yanlinglabs/winter-agent-runtime": "0.0.35"
57
57
  },
58
58
  "scripts": {}
59
59
  }