@yanlinglabs/winter-conformance 0.0.16 → 0.0.17

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 (31) hide show
  1. package/dist/official/web-tools-script.d.ts +118 -0
  2. package/goldens/advertised-set-round.trace.json +2 -0
  3. package/goldens/background-task-round.trace.json +2 -0
  4. package/goldens/bash-background-round.trace.json +2 -0
  5. package/goldens/canusetool-approved-round.trace.json +2 -0
  6. package/goldens/compaction-auto-round.trace.json +2 -0
  7. package/goldens/compaction-manual-round.trace.json +2 -0
  8. package/goldens/denied-tool-round.trace.json +2 -0
  9. package/goldens/hook-denied-round.trace.json +2 -0
  10. package/goldens/hooked-tool-round.trace.json +2 -0
  11. package/goldens/interrupt.trace.json +4 -0
  12. package/goldens/mcp-tool-round.trace.json +2 -0
  13. package/goldens/messaging-facet-round.trace.json +4 -0
  14. package/goldens/mode-switch-mid-session.trace.json +2 -0
  15. package/goldens/multi-turn.trace.json +2 -0
  16. package/goldens/p6-anthropic-fake.trace.json +2 -0
  17. package/goldens/p6-gemini-fake.trace.json +2 -0
  18. package/goldens/p6-openai-chat-fake.trace.json +2 -0
  19. package/goldens/p6-openai-responses-fake.trace.json +2 -0
  20. package/goldens/p6-resolution-failure.trace.json +2 -0
  21. package/goldens/plain-query.trace.json +2 -0
  22. package/goldens/resume.trace.json +4 -0
  23. package/goldens/sendmessage-child-round.trace.json +2 -0
  24. package/goldens/skill-invocation-round.trace.json +2 -0
  25. package/goldens/structured-exhaustion-round.trace.json +2 -0
  26. package/goldens/structured-output-round.trace.json +2 -0
  27. package/goldens/subagent-permission-round.trace.json +2 -0
  28. package/goldens/subagent-spawn-round.trace.json +2 -0
  29. package/goldens/tool-round.trace.json +2 -0
  30. package/goldens/toolsearch-select-round.trace.json +2 -0
  31. package/package.json +1 -1
@@ -0,0 +1,118 @@
1
+ import { type OfficialRoots, type RawFrame, type SseEvent } from "./differential-harness.js";
2
+ /** One scripted search hit. `extra` rides along on the WIRE only (page_age, encrypted_content, ...) to prove it never survives. */
3
+ export interface ScriptedHit {
4
+ title: string;
5
+ url: string;
6
+ extra?: Record<string, unknown>;
7
+ }
8
+ /**
9
+ * The claude-side block sequence an inner `web_search_20250305` response carries. A `search` is a
10
+ * `server_tool_use` block immediately followed by its `web_search_tool_result` block (hits, or a
11
+ * result-block error).
12
+ */
13
+ export type ScriptedSearchBlock = {
14
+ kind: "text";
15
+ text: string;
16
+ } | {
17
+ kind: "search";
18
+ query: string;
19
+ hits: ScriptedHit[];
20
+ } | {
21
+ kind: "search_error";
22
+ query: string;
23
+ errorCode: string;
24
+ };
25
+ /** Structurally identical to the runtime's own `WebSearchStreamEvent` (declared here rather than imported so this module stays free of cross-package imports; each test file passes the result straight to the real assembler, so a drift in that type is a compile error THERE). */
26
+ export type WinterSearchEvent = {
27
+ type: "text";
28
+ text: string;
29
+ } | {
30
+ type: "search_result";
31
+ hits: Array<{
32
+ title: string;
33
+ url: string;
34
+ }>;
35
+ } | {
36
+ type: "search_error";
37
+ code: string;
38
+ };
39
+ /**
40
+ * The SAME scripted sequence in Winter's event shape. Deliberately passes every `extra` field
41
+ * through on the hit objects (as untyped excess properties), so "only title and url survive" is
42
+ * proven on Winter's side by the assembler dropping them, not by this mapper never offering them.
43
+ */
44
+ export declare function toWinterEvents(blocks: readonly ScriptedSearchBlock[]): WinterSearchEvent[];
45
+ /** The inner response as an SSE stream: one content block per text, two per search. */
46
+ export declare function sseInnerSearchTurn(blocks: readonly ScriptedSearchBlock[], model?: string): SseEvent[];
47
+ export declare const INNER_SEARCH_USER_PREFIX = "Perform a web search for the query: ";
48
+ export declare const INNER_FETCH_USER_PREFIX = "\nWeb page content:\n";
49
+ export declare function toolsOf(body: RawFrame): RawFrame[];
50
+ /** The inner search call: recognised by the server tool in its tool list, never by position. */
51
+ export declare function isInnerSearchRequest(body: RawFrame): boolean;
52
+ /** The first user message's text, whether the wire carries it as a string or as a one-block array. */
53
+ export declare function firstUserText(body: RawFrame): string;
54
+ /** The inner digest call: no tools at all, and the page-content template opening the user text. */
55
+ export declare function isInnerFetchRequest(body: RawFrame): boolean;
56
+ export declare function hasToolResult(messages: readonly RawFrame[]): boolean;
57
+ export interface OfficialToolResult {
58
+ /** The tool_result `content` as the binary's own stdout `user` frame carries it -- the tool's PURE output. */
59
+ content: string;
60
+ isError: boolean;
61
+ /** The binary's structured result for the call (`tool_use_result` on the same frame), when it has one. */
62
+ structured: unknown;
63
+ }
64
+ /** Every tool_result the binary emitted on stdout, keyed by `tool_use_id` (never by position -- batched calls finish in any order). */
65
+ export declare function toolResultsFromFrames(frames: readonly RawFrame[]): Map<string, OfficialToolResult>;
66
+ /** Every tool_result in a captured main-loop REQUEST, keyed by `tool_use_id` -- what actually went back to the API. */
67
+ export declare function toolResultsFromRequest(body: RawFrame): Map<string, string>;
68
+ /**
69
+ * The binary's MAIN LOOP appends a token-budget note to a tool_result on the wire (observed on the
70
+ * last tool_result of a request). It is loop decoration, not part of any tool's own output -- the
71
+ * stdout frame for the same call does not carry it -- so the wire comparison allows exactly this
72
+ * suffix and nothing else.
73
+ */
74
+ export declare const MAIN_LOOP_WIRE_SUFFIX: RegExp;
75
+ /** True when `wire` is `pure` exactly, or `pure` plus the one known main-loop suffix. */
76
+ export declare function wireMatchesPure(wire: string, pure: string): boolean;
77
+ export interface ProxyTrap {
78
+ url: string;
79
+ /** The first line of every request that reached the trap -- must stay EMPTY for a hermetic run. */
80
+ hits: string[];
81
+ stop(): void;
82
+ }
83
+ export declare function startProxyTrap(): ProxyTrap;
84
+ export interface LoopbackTls {
85
+ key: string;
86
+ cert: string;
87
+ certPath: string;
88
+ }
89
+ /** A self-signed cert for 127.0.0.1, written under `dir` (a mkdtemp root the caller owns). Returns `{reason}` when openssl is unavailable, so the caller can skip plainly rather than fail obscurely. */
90
+ export declare function makeLoopbackTls(dir: string): LoopbackTls | {
91
+ reason: string;
92
+ };
93
+ export interface OfficialRun {
94
+ /** Every POST body the loopback received, in arrival order. */
95
+ requests: RawFrame[];
96
+ /** Every stdout frame the binary emitted. */
97
+ frames: RawFrame[];
98
+ /** First lines of anything that tried to leave the box (see the header) -- asserted empty by every caller. */
99
+ trapHits: string[];
100
+ }
101
+ export interface OfficialRunOptions {
102
+ binaryPath: string;
103
+ model?: string;
104
+ prompt: string;
105
+ route: (messages: RawFrame[], body: RawFrame, count: number) => Response;
106
+ logPrefix: string;
107
+ /** Extra `--settings` JSON (always merged over `skipWebFetchPreflight: true`). */
108
+ settings?: Record<string, unknown>;
109
+ extraEnv?: Record<string, string>;
110
+ /** Called with the roots before the spawn -- for a caller that needs files under them (a TLS cert). */
111
+ roots?: OfficialRoots;
112
+ }
113
+ /**
114
+ * One headless `-p` invocation of the pinned binary against a scripted loopback, permission mode
115
+ * `bypassPermissions` -- the SAME way every other file in this family lets a tool run (WebSearch and
116
+ * WebFetch both prompt otherwise); no allow rule, no hook, nothing more invasive than that.
117
+ */
118
+ export declare function runOfficialOnce(opts: OfficialRunOptions): Promise<OfficialRun>;
@@ -38,6 +38,8 @@
38
38
  "TaskOutput",
39
39
  "TaskStop",
40
40
  "TaskUpdate",
41
+ "WebFetch",
42
+ "WebSearch",
41
43
  "Workflow",
42
44
  "Write"
43
45
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ]
@@ -84,6 +86,8 @@
84
86
  "TaskOutput",
85
87
  "TaskStop",
86
88
  "TaskUpdate",
89
+ "WebFetch",
90
+ "WebSearch",
87
91
  "Workflow",
88
92
  "Write"
89
93
  ],
@@ -44,6 +44,8 @@
44
44
  "TaskStop",
45
45
  "TaskUpdate",
46
46
  "WaitForMcpServers",
47
+ "WebFetch",
48
+ "WebSearch",
47
49
  "Workflow",
48
50
  "Write",
49
51
  "mcp__t8mcpsdk__echo"
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ]
@@ -84,6 +86,8 @@
84
86
  "TaskOutput",
85
87
  "TaskStop",
86
88
  "TaskUpdate",
89
+ "WebFetch",
90
+ "WebSearch",
87
91
  "Workflow",
88
92
  "Write"
89
93
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -40,6 +40,8 @@
40
40
  "TaskOutput",
41
41
  "TaskStop",
42
42
  "TaskUpdate",
43
+ "WebFetch",
44
+ "WebSearch",
43
45
  "Workflow",
44
46
  "Write"
45
47
  ],
@@ -40,6 +40,8 @@
40
40
  "TaskOutput",
41
41
  "TaskStop",
42
42
  "TaskUpdate",
43
+ "WebFetch",
44
+ "WebSearch",
43
45
  "Workflow",
44
46
  "Write"
45
47
  ],
@@ -40,6 +40,8 @@
40
40
  "TaskOutput",
41
41
  "TaskStop",
42
42
  "TaskUpdate",
43
+ "WebFetch",
44
+ "WebSearch",
43
45
  "Workflow",
44
46
  "Write"
45
47
  ],
@@ -40,6 +40,8 @@
40
40
  "TaskOutput",
41
41
  "TaskStop",
42
42
  "TaskUpdate",
43
+ "WebFetch",
44
+ "WebSearch",
43
45
  "Workflow",
44
46
  "Write"
45
47
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -125,6 +127,8 @@
125
127
  "TaskOutput",
126
128
  "TaskStop",
127
129
  "TaskUpdate",
130
+ "WebFetch",
131
+ "WebSearch",
128
132
  "Workflow",
129
133
  "Write"
130
134
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -40,6 +40,8 @@
40
40
  "TaskOutput",
41
41
  "TaskStop",
42
42
  "TaskUpdate",
43
+ "WebFetch",
44
+ "WebSearch",
43
45
  "Workflow",
44
46
  "Write"
45
47
  ],
@@ -40,6 +40,8 @@
40
40
  "TaskOutput",
41
41
  "TaskStop",
42
42
  "TaskUpdate",
43
+ "WebFetch",
44
+ "WebSearch",
43
45
  "Workflow",
44
46
  "Write"
45
47
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -39,6 +39,8 @@
39
39
  "TaskOutput",
40
40
  "TaskStop",
41
41
  "TaskUpdate",
42
+ "WebFetch",
43
+ "WebSearch",
42
44
  "Workflow",
43
45
  "Write"
44
46
  ],
@@ -44,6 +44,8 @@
44
44
  "TaskStop",
45
45
  "TaskUpdate",
46
46
  "ToolSearch",
47
+ "WebFetch",
48
+ "WebSearch",
47
49
  "Workflow",
48
50
  "Write"
49
51
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yanlinglabs/winter-conformance",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {