@a3s-lab/code 3.4.0 → 3.5.0
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/generated.d.ts +90 -0
- package/package.json +7 -7
package/generated.d.ts
CHANGED
|
@@ -745,6 +745,52 @@ export interface McpServerStatusEntry {
|
|
|
745
745
|
toolCount: number
|
|
746
746
|
error?: string
|
|
747
747
|
}
|
|
748
|
+
/** One unit of orchestrated agent work — what to run, independent of where. */
|
|
749
|
+
export interface AgentStepSpecObject {
|
|
750
|
+
/** Stable id for this step (assigned by the caller). */
|
|
751
|
+
taskId: string
|
|
752
|
+
/** Registry key of the agent to run (e.g. "explore", "review"). */
|
|
753
|
+
agent: string
|
|
754
|
+
/** Short label for display/tracking. */
|
|
755
|
+
description: string
|
|
756
|
+
/** Instruction handed to the child agent. */
|
|
757
|
+
prompt: string
|
|
758
|
+
/** Optional per-step tool-round cap. */
|
|
759
|
+
maxSteps?: number
|
|
760
|
+
/** Optional parent session id for event correlation. */
|
|
761
|
+
parentSessionId?: string
|
|
762
|
+
/**
|
|
763
|
+
* When set, the step must return JSON conforming to this schema; the
|
|
764
|
+
* validated object lands in `StepOutcomeObject.structured`.
|
|
765
|
+
*/
|
|
766
|
+
outputSchema?: any
|
|
767
|
+
}
|
|
768
|
+
/** The result of running one orchestrated step. */
|
|
769
|
+
export interface StepOutcomeObject {
|
|
770
|
+
taskId: string
|
|
771
|
+
sessionId: string
|
|
772
|
+
agent: string
|
|
773
|
+
output: string
|
|
774
|
+
success: boolean
|
|
775
|
+
/** Schema-validated structured output, when the step requested one. */
|
|
776
|
+
structured?: any
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* A snapshot of a workflow's shared token ledger. `consumedTokens` is the total
|
|
780
|
+
* recorded across every step; `limitTokens` is the hard ceiling, if one was set.
|
|
781
|
+
*/
|
|
782
|
+
export interface WorkflowBudgetObject {
|
|
783
|
+
consumedTokens: number
|
|
784
|
+
limitTokens?: number
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* The result of a budgeted workflow fan-out: the per-step outcomes plus the
|
|
788
|
+
* shared budget ledger snapshot.
|
|
789
|
+
*/
|
|
790
|
+
export interface WorkflowParallelResult {
|
|
791
|
+
outcomes: Array<StepOutcomeObject>
|
|
792
|
+
budget: WorkflowBudgetObject
|
|
793
|
+
}
|
|
748
794
|
/**
|
|
749
795
|
* Shape of the JS handlers object accepted by `session.setBudgetGuard`.
|
|
750
796
|
* Each field is optional — methods that aren't provided fall back to
|
|
@@ -1213,6 +1259,50 @@ export declare class Session {
|
|
|
1213
1259
|
* when no checkpoint exists for `checkpointRunId`.
|
|
1214
1260
|
*/
|
|
1215
1261
|
resumeRun(checkpointRunId: string): Promise<AgentResult>
|
|
1262
|
+
/**
|
|
1263
|
+
* Run `specs` as a fan-out of agent steps, bounded by the session's
|
|
1264
|
+
* configured parallelism, and resolve with each step's outcome in input
|
|
1265
|
+
* order. A failed step surfaces as `success: false` without failing the
|
|
1266
|
+
* batch.
|
|
1267
|
+
*
|
|
1268
|
+
* Pass `budgetTokens` to run the fan-out under one shared token budget:
|
|
1269
|
+
* every child agent feeds a single ledger and, once the cap is reached,
|
|
1270
|
+
* further child LLM calls are denied (a *soft* cap — a wide fan-out can race
|
|
1271
|
+
* a few in-flight turns past it before the post-call ledger catches up; the
|
|
1272
|
+
* in-flight fan-out is never force-killed). With a budget the result is
|
|
1273
|
+
* `{ outcomes, budget }` (the ledger snapshot); without one it is the plain
|
|
1274
|
+
* outcomes array, unchanged.
|
|
1275
|
+
*/
|
|
1276
|
+
parallel(specs: Array<AgentStepSpecObject>, budgetTokens?: number | undefined | null): Promise<Array<StepOutcomeObject> | WorkflowParallelResult>
|
|
1277
|
+
/**
|
|
1278
|
+
* Like `parallel`, but resumable: progress is journaled under
|
|
1279
|
+
* `workflowId` via the session's `sessionStore`, so an interrupted run
|
|
1280
|
+
* skips already-completed steps. Rejects when no `sessionStore` is
|
|
1281
|
+
* configured.
|
|
1282
|
+
*/
|
|
1283
|
+
parallelResumable(specs: Array<AgentStepSpecObject>, workflowId: string): Promise<Array<StepOutcomeObject>>
|
|
1284
|
+
/**
|
|
1285
|
+
* Run each item through a chain of `stages`, with no barrier between
|
|
1286
|
+
* stages — item A can be in stage 3 while item B is still in stage 1.
|
|
1287
|
+
*
|
|
1288
|
+
* Each stage is a function `(ctx) => spec | null` where `ctx` is
|
|
1289
|
+
* `{ previous: StepOutcomeObject | null, item: any }`. Return an
|
|
1290
|
+
* `AgentStepSpecObject` (camelCase keys) to run that step, or `null` to
|
|
1291
|
+
* stop the item's chain. A chain also stops when a step fails.
|
|
1292
|
+
*
|
|
1293
|
+
* IMPORTANT: a stage callback MUST NOT throw — in this napi version a JS
|
|
1294
|
+
* throw at return-conversion aborts the process (same constraint as
|
|
1295
|
+
* `setBudgetGuard`). Wrap your logic in try/catch and return `null` on
|
|
1296
|
+
* error. A stage that hangs past `timeoutMs` (default 30s) fails closed
|
|
1297
|
+
* (treated as `null`, stopping that chain) rather than blocking forever.
|
|
1298
|
+
*
|
|
1299
|
+
* This is a *synchronous* napi method that returns a Promise via a
|
|
1300
|
+
* deferred: the JS stage functions (which are not `Send`) are converted
|
|
1301
|
+
* to thread-safe functions on the JS thread here, then the chains run on
|
|
1302
|
+
* the worker runtime and resolve the Promise — so the event loop is never
|
|
1303
|
+
* blocked and no non-`Send` value crosses the async boundary.
|
|
1304
|
+
*/
|
|
1305
|
+
pipeline(items: Array<any>, stages: Array<(ctx: { previous: StepOutcomeObject | null, item: any }) => AgentStepSpecObject | null>, timeoutMs?: number): Promise<Array<StepOutcomeObject | null>>
|
|
1216
1306
|
/**
|
|
1217
1307
|
* Send a prompt or request and get a streaming event iterator.
|
|
1218
1308
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a3s-lab/code",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "A3S Code - Native Node.js bindings for the coding-agent runtime",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"test:helpers": "node test-helpers.mjs"
|
|
44
44
|
},
|
|
45
45
|
"optionalDependencies": {
|
|
46
|
-
"@a3s-lab/code-darwin-arm64": "3.
|
|
47
|
-
"@a3s-lab/code-linux-x64-gnu": "3.
|
|
48
|
-
"@a3s-lab/code-linux-x64-musl": "3.
|
|
49
|
-
"@a3s-lab/code-linux-arm64-gnu": "3.
|
|
50
|
-
"@a3s-lab/code-linux-arm64-musl": "3.
|
|
51
|
-
"@a3s-lab/code-win32-x64-msvc": "3.
|
|
46
|
+
"@a3s-lab/code-darwin-arm64": "3.5.0",
|
|
47
|
+
"@a3s-lab/code-linux-x64-gnu": "3.5.0",
|
|
48
|
+
"@a3s-lab/code-linux-x64-musl": "3.5.0",
|
|
49
|
+
"@a3s-lab/code-linux-arm64-gnu": "3.5.0",
|
|
50
|
+
"@a3s-lab/code-linux-arm64-musl": "3.5.0",
|
|
51
|
+
"@a3s-lab/code-win32-x64-msvc": "3.5.0"
|
|
52
52
|
}
|
|
53
53
|
}
|