@yanlinglabs/winter-agent-runtime 0.0.30 → 0.0.31
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/embedded-worker.js +3 -3
- package/dist/embedded.js +3 -3
- package/dist/{index-9df1q7j4.js → index-0xqzk1hm.js} +1 -1
- package/dist/{index-wsfqsrh5.js → index-c7kq6erg.js} +2 -2
- package/dist/{index-51673qbw.js → index-d4pmmr27.js} +41 -9
- package/dist/index.js +1 -1
- package/dist/mcp/lifecycle.d.ts +1 -0
- package/dist/rpc/bridge.d.ts +5 -1
- package/dist/store/dialect.d.ts +1 -1
- package/dist/testing.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
package/dist/embedded-worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./index-
|
|
1
|
+
import"./index-d4pmmr27.js";
|
|
2
2
|
import {
|
|
3
3
|
liveProcessGroups,
|
|
4
4
|
onProcessGroupChange
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
import"./index-z6s3r4xm.js";
|
|
7
7
|
import"./index-bgeqc7ax.js";
|
|
8
8
|
import"./index-bef62z3r.js";
|
|
9
|
-
import"./index-
|
|
9
|
+
import"./index-0xqzk1hm.js";
|
|
10
10
|
import {
|
|
11
11
|
runEmbeddedSession2
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-c7kq6erg.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-
|
|
4
|
-
import"./index-
|
|
5
|
-
import"./index-
|
|
3
|
+
} from "./index-c7kq6erg.js";
|
|
4
|
+
import"./index-0xqzk1hm.js";
|
|
5
|
+
import"./index-d4pmmr27.js";
|
|
6
6
|
import"./index-bgeqc7ax.js";
|
|
7
7
|
import"./index-bef62z3r.js";
|
|
8
8
|
import"./index-9s68t0pd.js";
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
resolveEngineSession2,
|
|
10
10
|
resolveProductionWinterHome2,
|
|
11
11
|
resolveProductionStoreHome
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-d4pmmr27.js";
|
|
13
13
|
import {
|
|
14
14
|
registerDefaultChildEngineFactory,
|
|
15
15
|
loadResumedChain,
|
|
16
16
|
buildProductionWiring,
|
|
17
17
|
withAutoSkillPermissions,
|
|
18
18
|
restoreChildRoster
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-0xqzk1hm.js";
|
|
20
20
|
|
|
21
21
|
// src/embedded.ts
|
|
22
22
|
import { splitFrames, encodeFrame } from "@yanlinglabs/winter-agent-sdk";
|
|
@@ -31,8 +31,9 @@ import {
|
|
|
31
31
|
// src/rpc/bridge.ts
|
|
32
32
|
import { randomUUID } from "node:crypto";
|
|
33
33
|
import { WinterRpcError, WinterRpcTimeoutError } from "@yanlinglabs/winter-agent-sdk";
|
|
34
|
-
function createRpcBridge2(output) {
|
|
34
|
+
function createRpcBridge2(output, bridgeOpts = {}) {
|
|
35
35
|
const pending = new Map;
|
|
36
|
+
let held = bridgeOpts.holdUntilOpen === true ? new Map : undefined;
|
|
36
37
|
let closed = false;
|
|
37
38
|
return {
|
|
38
39
|
request(subtype, payload, opts) {
|
|
@@ -49,6 +50,7 @@ function createRpcBridge2(output) {
|
|
|
49
50
|
const timeoutMs = opts.timeoutMs;
|
|
50
51
|
entry.timer = setTimeout(() => {
|
|
51
52
|
pending.delete(requestId);
|
|
53
|
+
held?.delete(requestId);
|
|
52
54
|
entry.detach?.();
|
|
53
55
|
reject(new WinterRpcTimeoutError(subtype, timeoutMs));
|
|
54
56
|
}, timeoutMs);
|
|
@@ -62,7 +64,8 @@ function createRpcBridge2(output) {
|
|
|
62
64
|
pending.delete(requestId);
|
|
63
65
|
if (entry.timer !== undefined)
|
|
64
66
|
clearTimeout(entry.timer);
|
|
65
|
-
|
|
67
|
+
if (held?.delete(requestId) !== true)
|
|
68
|
+
output.write({ type: "control_cancel_request", requestId });
|
|
66
69
|
reject(new WinterRpcError("cancelled", `the '${subtype}' request was cancelled: the runtime stopped waiting for it`));
|
|
67
70
|
};
|
|
68
71
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
@@ -70,9 +73,20 @@ function createRpcBridge2(output) {
|
|
|
70
73
|
}
|
|
71
74
|
pending.set(requestId, entry);
|
|
72
75
|
const frame = { type: "control_request", requestId, subtype, payload };
|
|
73
|
-
|
|
76
|
+
if (held !== undefined)
|
|
77
|
+
held.set(requestId, frame);
|
|
78
|
+
else
|
|
79
|
+
output.write(frame);
|
|
74
80
|
});
|
|
75
81
|
},
|
|
82
|
+
open() {
|
|
83
|
+
if (held === undefined)
|
|
84
|
+
return;
|
|
85
|
+
const queued = [...held.values()];
|
|
86
|
+
held = undefined;
|
|
87
|
+
for (const frame of queued)
|
|
88
|
+
output.write(frame);
|
|
89
|
+
},
|
|
76
90
|
ownsRequest(requestId) {
|
|
77
91
|
return pending.has(requestId);
|
|
78
92
|
},
|
|
@@ -102,6 +116,7 @@ function createRpcBridge2(output) {
|
|
|
102
116
|
entry.reject(err);
|
|
103
117
|
}
|
|
104
118
|
pending.clear();
|
|
119
|
+
held?.clear();
|
|
105
120
|
},
|
|
106
121
|
cancel(requestId) {
|
|
107
122
|
const entry = pending.get(requestId);
|
|
@@ -111,6 +126,7 @@ function createRpcBridge2(output) {
|
|
|
111
126
|
clearTimeout(entry.timer);
|
|
112
127
|
entry.detach?.();
|
|
113
128
|
pending.delete(requestId);
|
|
129
|
+
held?.delete(requestId);
|
|
114
130
|
}
|
|
115
131
|
};
|
|
116
132
|
}
|
|
@@ -5365,6 +5381,9 @@ function createMcpLifecycle(deps) {
|
|
|
5365
5381
|
setSlotState(slot.name, "connected", { toolNames });
|
|
5366
5382
|
}
|
|
5367
5383
|
async function start() {
|
|
5384
|
+
await launch();
|
|
5385
|
+
}
|
|
5386
|
+
function launch() {
|
|
5368
5387
|
const alwaysLoadWaits = [];
|
|
5369
5388
|
for (const slot of slots.values()) {
|
|
5370
5389
|
if (slot.state === "disabled")
|
|
@@ -5379,10 +5398,18 @@ function createMcpLifecycle(deps) {
|
|
|
5379
5398
|
}
|
|
5380
5399
|
}
|
|
5381
5400
|
if (deps.envConfig.connectionNonblocking === false) {
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5401
|
+
if (!stateSource.snapshot().some((server) => server.state === "pending"))
|
|
5402
|
+
return;
|
|
5403
|
+
return stateSource.waitForPending(undefined, deps.envConfig.connectTimeoutMs).then(() => {
|
|
5404
|
+
return;
|
|
5405
|
+
});
|
|
5385
5406
|
}
|
|
5407
|
+
if (alwaysLoadWaits.length > 0) {
|
|
5408
|
+
return Promise.race([Promise.all(alwaysLoadWaits).then(() => {
|
|
5409
|
+
return;
|
|
5410
|
+
}), new Promise((resolve) => setTimeout(resolve, deps.envConfig.connectTimeoutMs).unref?.())]);
|
|
5411
|
+
}
|
|
5412
|
+
return;
|
|
5386
5413
|
}
|
|
5387
5414
|
async function dispose() {
|
|
5388
5415
|
for (const slot of slots.values()) {
|
|
@@ -5517,6 +5544,7 @@ function createMcpLifecycle(deps) {
|
|
|
5517
5544
|
stateSource,
|
|
5518
5545
|
controlSeam: createMcpControlSeam(internals, { ...deps.reservedServerName !== undefined ? { reservedServerName: deps.reservedServerName } : {} }),
|
|
5519
5546
|
start,
|
|
5547
|
+
launch,
|
|
5520
5548
|
dispose,
|
|
5521
5549
|
listConnectedServerNames,
|
|
5522
5550
|
getConnectedClient,
|
|
@@ -22032,7 +22060,7 @@ ${escapeAttributionText(msg.body)}
|
|
|
22032
22060
|
const bypassAvailableToThisSession = bypassGate.allowDangerouslySkipPermissions && !bypassGate.disableBypassPermissionsMode;
|
|
22033
22061
|
const policyStateStore = new PolicyStateStore({ mode: initialMode, rules: initialRules }, bypassGate);
|
|
22034
22062
|
const permissionHome = homedir();
|
|
22035
|
-
const bridge = createRpcBridge2(output);
|
|
22063
|
+
const bridge = createRpcBridge2(output, { holdUntilOpen: true });
|
|
22036
22064
|
hostCredentialChannel?.bind(bridge);
|
|
22037
22065
|
const bridgePromptStage = createBridgePromptStage(bridge);
|
|
22038
22066
|
const realPromptStage = {
|
|
@@ -22877,6 +22905,7 @@ ${escapeAttributionText(msg.body)}
|
|
|
22877
22905
|
}
|
|
22878
22906
|
const sessionStateKey = config.agentId ?? config.sessionId;
|
|
22879
22907
|
let mcpLifecycle;
|
|
22908
|
+
let mcpStartupWait;
|
|
22880
22909
|
let disposeSessionMcpLifecycle;
|
|
22881
22910
|
if (mcpServerStateSource === undefined && mcpControlSeam === undefined) {
|
|
22882
22911
|
const sources = [{ origin: "explicit", servers: config.mcpServers ?? {} }, ...extraMcpServerSources ?? []];
|
|
@@ -22893,7 +22922,7 @@ ${escapeAttributionText(msg.body)}
|
|
|
22893
22922
|
cwd: config.cwd,
|
|
22894
22923
|
...mcpOAuthStore !== undefined ? { oauth: createSessionMcpOAuth({ store: mcpOAuthStore, sender: bridge, brand: sessionBrand, ...config.hostCredentials === true ? { hostOwnsRefresh: true } : {} }) } : {}
|
|
22895
22924
|
});
|
|
22896
|
-
|
|
22925
|
+
mcpStartupWait = mcpLifecycle.launch();
|
|
22897
22926
|
disposeSessionMcpLifecycle = registerSessionMcpLifecycle(sessionStateKey, mcpLifecycle);
|
|
22898
22927
|
}
|
|
22899
22928
|
const effectiveMcpStateSource = mcpServerStateSource ?? mcpLifecycle?.stateSource;
|
|
@@ -23139,6 +23168,7 @@ ${escapeAttributionText(msg.body)}
|
|
|
23139
23168
|
tools: advertisedToolNames,
|
|
23140
23169
|
...mcpServersWire !== undefined ? { mcp_servers: mcpServersWire } : {}
|
|
23141
23170
|
});
|
|
23171
|
+
bridge.open();
|
|
23142
23172
|
const initLoadedSurface = {
|
|
23143
23173
|
slash_commands: initSlashCommands !== undefined ? [...initSlashCommands] : [],
|
|
23144
23174
|
output_style: initOutputStyle ?? config.outputStyle ?? DEFAULT_OUTPUT_STYLE,
|
|
@@ -23681,6 +23711,8 @@ ${escapeAttributionText(msg.body)}
|
|
|
23681
23711
|
envConfig: mcpEnvConfig
|
|
23682
23712
|
});
|
|
23683
23713
|
};
|
|
23714
|
+
if (mcpStartupWait !== undefined)
|
|
23715
|
+
await mcpStartupWait;
|
|
23684
23716
|
{
|
|
23685
23717
|
const deadlineMs = firstTurnMcpWaitMs();
|
|
23686
23718
|
if (deadlineMs !== undefined && mcpLifecycle.stateSource.snapshot().some((server) => server.state === "pending")) {
|
|
@@ -26502,7 +26534,7 @@ class TranscriptWriter2 {
|
|
|
26502
26534
|
return entries;
|
|
26503
26535
|
}
|
|
26504
26536
|
}
|
|
26505
|
-
var RUNTIME_ENGINE_VERSION2 = "0.0.
|
|
26537
|
+
var RUNTIME_ENGINE_VERSION2 = "0.0.31";
|
|
26506
26538
|
function withPermissionJournal(writer, location) {
|
|
26507
26539
|
return {
|
|
26508
26540
|
transcriptPath: join25(location.winterHome, "projects", location.projectKey, `${location.sessionId}.jsonl`),
|
package/dist/index.js
CHANGED
package/dist/mcp/lifecycle.d.ts
CHANGED
|
@@ -130,6 +130,7 @@ export interface McpLifecycle {
|
|
|
130
130
|
readonly stateSource: McpServerStateSource;
|
|
131
131
|
readonly controlSeam: McpControlSeam;
|
|
132
132
|
start(): Promise<void>;
|
|
133
|
+
launch(): Promise<void> | undefined;
|
|
133
134
|
dispose(): Promise<void>;
|
|
134
135
|
listConnectedServerNames(): string[];
|
|
135
136
|
getConnectedClient(server: string): ConnectedMcpClient | undefined;
|
package/dist/rpc/bridge.d.ts
CHANGED
|
@@ -10,5 +10,9 @@ export interface RpcBridge {
|
|
|
10
10
|
ownsRequest(requestId: string): boolean;
|
|
11
11
|
rejectAllPending(err: unknown): void;
|
|
12
12
|
cancel(requestId: string): void;
|
|
13
|
+
open(): void;
|
|
13
14
|
}
|
|
14
|
-
export
|
|
15
|
+
export interface RpcBridgeOptions {
|
|
16
|
+
holdUntilOpen?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function createRpcBridge(output: FrameSink, bridgeOpts?: RpcBridgeOptions): RpcBridge;
|
package/dist/store/dialect.d.ts
CHANGED
|
@@ -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.
|
|
481
|
+
export declare const RUNTIME_ENGINE_VERSION = "0.0.31";
|
|
482
482
|
export interface ResolvedEngineSession {
|
|
483
483
|
config: RuntimeConfig;
|
|
484
484
|
store: SessionPersistence | undefined;
|
package/dist/testing.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
runEngine2,
|
|
4
4
|
echoProvider2,
|
|
5
5
|
resolveEngineSession2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-d4pmmr27.js";
|
|
7
7
|
import"./index-9s68t0pd.js";
|
|
8
8
|
import"./index-z6s3r4xm.js";
|
|
9
9
|
import"./index-bgeqc7ax.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
buildProductionWiring,
|
|
15
15
|
withAutoSkillPermissions,
|
|
16
16
|
restoreChildRoster
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-0xqzk1hm.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.
|
|
1
|
+
export declare const RUNTIME_VERSION = "0.0.31";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yanlinglabs/winter-agent-runtime",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
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-
|
|
77
|
-
"@yanlinglabs/winter-
|
|
78
|
-
"@yanlinglabs/winter-provider-catalog": "0.0.
|
|
76
|
+
"@yanlinglabs/winter-provider-runtime": "0.0.31",
|
|
77
|
+
"@yanlinglabs/winter-agent-sdk": "0.0.31",
|
|
78
|
+
"@yanlinglabs/winter-provider-catalog": "0.0.31"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@modelcontextprotocol/server": "^2.1.0"
|