@deepstrike/wasm 0.2.42 → 0.2.43
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/harness/index.d.ts +6 -0
- package/dist/harness/index.js +1 -0
- package/dist/runtime/runner.js +17 -2
- package/package.json +3 -3
package/dist/harness/index.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ export interface AttemptRequest {
|
|
|
7
7
|
sessionId?: string;
|
|
8
8
|
goal: string;
|
|
9
9
|
criteria?: Criterion[];
|
|
10
|
+
/**
|
|
11
|
+
* Multimodal inputs (images / audio) attached to the task. Forwarded to every attempt
|
|
12
|
+
* unconditionally; the runner seeds them per session idempotently, so fresh-session carries
|
|
13
|
+
* re-seed while same-session carries do not double.
|
|
14
|
+
*/
|
|
15
|
+
attachments?: import("../types.js").ContentPart[];
|
|
10
16
|
extensions?: Record<string, unknown>;
|
|
11
17
|
inheritEvents?: Array<{
|
|
12
18
|
seq: number;
|
package/dist/harness/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export class RuntimeAttemptBody {
|
|
|
14
14
|
sessionId: context.sessionId,
|
|
15
15
|
goal: context.goal,
|
|
16
16
|
criteria: (context.criteria ?? []).map(criterion => criterion.text),
|
|
17
|
+
...(context.attachments?.length ? { attachments: context.attachments } : {}),
|
|
17
18
|
extensions: context.extensions,
|
|
18
19
|
...(context.attempt === 1 && context.inheritEvents
|
|
19
20
|
? { inheritEvents: context.inheritEvents }
|
package/dist/runtime/runner.js
CHANGED
|
@@ -158,6 +158,12 @@ export class RuntimeRunner {
|
|
|
158
158
|
async *run(req) {
|
|
159
159
|
const prior = req.inheritEvents ?? await this.opts.sessionLog.read(req.sessionId);
|
|
160
160
|
const midRun = isMidRun(prior);
|
|
161
|
+
// Idempotent per session: an earlier run's `run_started` already carries these attachments
|
|
162
|
+
// (same-session retry attempt), so replay reconstructs them — recording and seeding again
|
|
163
|
+
// would double them in history. Deduping at the append keeps live and replay in agreement.
|
|
164
|
+
const attachments = req.attachments?.length && !attachmentsAlreadySeeded(prior, req.attachments)
|
|
165
|
+
? req.attachments
|
|
166
|
+
: undefined;
|
|
161
167
|
if (!midRun) {
|
|
162
168
|
await this.opts.sessionLog.append(req.sessionId, {
|
|
163
169
|
kind: "run_started",
|
|
@@ -166,10 +172,10 @@ export class RuntimeRunner {
|
|
|
166
172
|
criteria: req.criteria ?? [],
|
|
167
173
|
agent_id: this.opts.agentId,
|
|
168
174
|
system_prompt: this.opts.systemPrompt,
|
|
169
|
-
...(
|
|
175
|
+
...(attachments ? { attachments } : {}),
|
|
170
176
|
});
|
|
171
177
|
}
|
|
172
|
-
yield* this.execute(req.sessionId, req.goal, req.criteria ?? [], req.extensions, prior.length > 0 ? prior : undefined, midRun,
|
|
178
|
+
yield* this.execute(req.sessionId, req.goal, req.criteria ?? [], req.extensions, prior.length > 0 ? prior : undefined, midRun, attachments);
|
|
173
179
|
}
|
|
174
180
|
async *wake(sessionId, extensions) {
|
|
175
181
|
const events = await this.opts.sessionLog.read(sessionId);
|
|
@@ -2143,6 +2149,15 @@ function signalToKernelEvent(delivery) {
|
|
|
2143
2149
|
},
|
|
2144
2150
|
};
|
|
2145
2151
|
}
|
|
2152
|
+
/**
|
|
2153
|
+
* True when an earlier run in this session already seeded the same attachments. Replay
|
|
2154
|
+
* reconstructs the attachment message from that run's `run_started`, so recording and
|
|
2155
|
+
* live-seeding them again (a same-session retry attempt) would double them in history.
|
|
2156
|
+
*/
|
|
2157
|
+
function attachmentsAlreadySeeded(prior, attachments) {
|
|
2158
|
+
const wanted = JSON.stringify(attachments);
|
|
2159
|
+
return prior.some(({ event }) => event.kind === "run_started" && JSON.stringify(event.attachments ?? []) === wanted);
|
|
2160
|
+
}
|
|
2146
2161
|
/** Convert SDK ContentParts (camelCase mediaType) to kernel serde shape (media_type). */
|
|
2147
2162
|
function attachmentsToKernelMessage(parts) {
|
|
2148
2163
|
const content = parts.map(p => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepstrike/wasm",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.43",
|
|
4
4
|
"description": "DeepStrike WASM SDK — browser, Cloudflare Workers, Deno Deploy",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"README.md"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build:wasm": "wasm-pack build
|
|
13
|
+
"build:wasm": "wasm-pack build ../crates/deepstrike-wasm --target bundler --out-dir ../../wasm/pkg",
|
|
14
14
|
"build": "tsc",
|
|
15
15
|
"test": "node --experimental-vm-modules node_modules/.bin/jest"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@deepstrike/wasm-kernel": "0.2.
|
|
18
|
+
"@deepstrike/wasm-kernel": "0.2.43"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/jest": "^30.0.0",
|