@agentfield/sdk 0.1.92-rc.1 → 0.1.92-rc.2
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 +0 -15
- package/dist/index.js +2 -52
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -273,14 +273,6 @@ interface ExecutionStatusUpdate {
|
|
|
273
273
|
progress?: number;
|
|
274
274
|
statusReason?: string;
|
|
275
275
|
}
|
|
276
|
-
interface RestartExecutionOptions {
|
|
277
|
-
scope?: 'workflow' | 'execution';
|
|
278
|
-
reuse?: 'succeeded-before' | 'all-succeeded' | 'none';
|
|
279
|
-
fork?: boolean;
|
|
280
|
-
reason?: string;
|
|
281
|
-
input?: Record<string, unknown>;
|
|
282
|
-
context?: Record<string, unknown>;
|
|
283
|
-
}
|
|
284
276
|
declare class AgentFieldClient {
|
|
285
277
|
private readonly http;
|
|
286
278
|
private readonly config;
|
|
@@ -302,11 +294,7 @@ declare class AgentFieldClient {
|
|
|
302
294
|
targetDid?: string;
|
|
303
295
|
agentNodeDid?: string;
|
|
304
296
|
agentNodeId?: string;
|
|
305
|
-
replaySourceRunId?: string;
|
|
306
|
-
replayBeforeExecutionId?: string;
|
|
307
|
-
replayMode?: string;
|
|
308
297
|
}): Promise<T>;
|
|
309
|
-
restartExecution(executionId: string, options?: RestartExecutionOptions): Promise<any>;
|
|
310
298
|
publishWorkflowEvent(event: {
|
|
311
299
|
executionId: string;
|
|
312
300
|
runId: string;
|
|
@@ -381,9 +369,6 @@ interface ExecutionMetadata {
|
|
|
381
369
|
callerDid?: string;
|
|
382
370
|
targetDid?: string;
|
|
383
371
|
agentNodeDid?: string;
|
|
384
|
-
replaySourceRunId?: string;
|
|
385
|
-
replayBeforeExecutionId?: string;
|
|
386
|
-
replayMode?: string;
|
|
387
372
|
}
|
|
388
373
|
declare class ExecutionContext {
|
|
389
374
|
readonly input: any;
|
package/dist/index.js
CHANGED
|
@@ -2323,9 +2323,6 @@ var AgentFieldClient = class {
|
|
|
2323
2323
|
if (metadata?.targetDid) headers["X-Target-DID"] = metadata.targetDid;
|
|
2324
2324
|
if (metadata?.agentNodeDid) headers["X-Agent-Node-DID"] = metadata.agentNodeDid;
|
|
2325
2325
|
if (metadata?.agentNodeId) headers["X-Agent-Node-ID"] = metadata.agentNodeId;
|
|
2326
|
-
if (metadata?.replaySourceRunId) headers["X-AgentField-Replay-Source-Run-ID"] = metadata.replaySourceRunId;
|
|
2327
|
-
if (metadata?.replayBeforeExecutionId) headers["X-AgentField-Replay-Before-Execution-ID"] = metadata.replayBeforeExecutionId;
|
|
2328
|
-
if (metadata?.replayMode) headers["X-AgentField-Replay-Mode"] = metadata.replayMode;
|
|
2329
2326
|
const bodyStr = JSON.stringify({ input });
|
|
2330
2327
|
const authHeaders = this.didAuthenticator.signRequest(Buffer.from(bodyStr));
|
|
2331
2328
|
try {
|
|
@@ -2352,44 +2349,6 @@ var AgentFieldClient = class {
|
|
|
2352
2349
|
throw err;
|
|
2353
2350
|
}
|
|
2354
2351
|
}
|
|
2355
|
-
async restartExecution(executionId, options = {}) {
|
|
2356
|
-
if (!executionId) {
|
|
2357
|
-
throw new Error("executionId is required");
|
|
2358
|
-
}
|
|
2359
|
-
const body = {
|
|
2360
|
-
scope: options.scope ?? "workflow",
|
|
2361
|
-
reuse: options.reuse ?? "succeeded-before",
|
|
2362
|
-
fork: options.fork,
|
|
2363
|
-
reason: options.reason,
|
|
2364
|
-
input: options.input,
|
|
2365
|
-
context: options.context
|
|
2366
|
-
};
|
|
2367
|
-
const bodyStr = JSON.stringify(body);
|
|
2368
|
-
const authHeaders = this.didAuthenticator.signRequest(Buffer.from(bodyStr));
|
|
2369
|
-
try {
|
|
2370
|
-
const res = await this.http.post(
|
|
2371
|
-
`/api/v1/executions/${encodeURIComponent(executionId)}/restart`,
|
|
2372
|
-
bodyStr,
|
|
2373
|
-
{ headers: this.mergeHeaders({ "Content-Type": "application/json", ...authHeaders }) }
|
|
2374
|
-
);
|
|
2375
|
-
return res.data;
|
|
2376
|
-
} catch (err) {
|
|
2377
|
-
const respData = err?.response?.data;
|
|
2378
|
-
if (respData) {
|
|
2379
|
-
const status = err.response.status;
|
|
2380
|
-
const msg = respData.message || respData.error || JSON.stringify(respData);
|
|
2381
|
-
const enriched = Object.assign(
|
|
2382
|
-
new Error(`restart execution ${executionId} failed (${status}): ${msg}`),
|
|
2383
|
-
{
|
|
2384
|
-
status,
|
|
2385
|
-
responseData: respData
|
|
2386
|
-
}
|
|
2387
|
-
);
|
|
2388
|
-
throw enriched;
|
|
2389
|
-
}
|
|
2390
|
-
throw err;
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
2352
|
async publishWorkflowEvent(event) {
|
|
2394
2353
|
const payload = {
|
|
2395
2354
|
execution_id: event.executionId,
|
|
@@ -2586,9 +2545,6 @@ var AgentFieldClient = class {
|
|
|
2586
2545
|
if (metadata.targetDid) headers["x-target-did"] = metadata.targetDid;
|
|
2587
2546
|
if (metadata.agentNodeDid) headers["x-agent-node-did"] = metadata.agentNodeDid;
|
|
2588
2547
|
if (metadata.agentNodeId) headers["x-agent-node-id"] = metadata.agentNodeId;
|
|
2589
|
-
if (metadata.replaySourceRunId) headers["x-agentfield-replay-source-run-id"] = metadata.replaySourceRunId;
|
|
2590
|
-
if (metadata.replayBeforeExecutionId) headers["x-agentfield-replay-before-execution-id"] = metadata.replayBeforeExecutionId;
|
|
2591
|
-
if (metadata.replayMode) headers["x-agentfield-replay-mode"] = metadata.replayMode;
|
|
2592
2548
|
return headers;
|
|
2593
2549
|
}
|
|
2594
2550
|
setDIDCredentials(did, privateKeyJwk) {
|
|
@@ -4296,10 +4252,7 @@ var Agent = class {
|
|
|
4296
4252
|
callerDid: parentMetadata?.callerDid,
|
|
4297
4253
|
targetDid: parentMetadata?.targetDid,
|
|
4298
4254
|
agentNodeDid: parentMetadata?.agentNodeDid,
|
|
4299
|
-
agentNodeId: this.config.nodeId
|
|
4300
|
-
replaySourceRunId: parentMetadata?.replaySourceRunId,
|
|
4301
|
-
replayBeforeExecutionId: parentMetadata?.replayBeforeExecutionId,
|
|
4302
|
-
replayMode: parentMetadata?.replayMode
|
|
4255
|
+
agentNodeId: this.config.nodeId
|
|
4303
4256
|
});
|
|
4304
4257
|
this.executionLogger.system("agent.call.completed", "Remote agent call completed", {
|
|
4305
4258
|
target,
|
|
@@ -4565,10 +4518,7 @@ var Agent = class {
|
|
|
4565
4518
|
reasonerId: overrides?.reasonerId ?? normalized["x-reasoner-id"],
|
|
4566
4519
|
callerDid: overrides?.callerDid ?? normalized["x-caller-did"],
|
|
4567
4520
|
targetDid: overrides?.targetDid ?? normalized["x-target-did"],
|
|
4568
|
-
agentNodeDid: overrides?.agentNodeDid ?? normalized["x-agent-node-did"] ?? normalized["x-agent-did"]
|
|
4569
|
-
replaySourceRunId: overrides?.replaySourceRunId ?? normalized["x-agentfield-replay-source-run-id"],
|
|
4570
|
-
replayBeforeExecutionId: overrides?.replayBeforeExecutionId ?? normalized["x-agentfield-replay-before-execution-id"],
|
|
4571
|
-
replayMode: overrides?.replayMode ?? normalized["x-agentfield-replay-mode"]
|
|
4521
|
+
agentNodeDid: overrides?.agentNodeDid ?? normalized["x-agent-node-did"] ?? normalized["x-agent-did"]
|
|
4572
4522
|
};
|
|
4573
4523
|
}
|
|
4574
4524
|
handleHttpRequest(req, res) {
|