@superdurable/dex-agents 0.0.0-stage → 0.1.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/LICENSE +105 -0
- package/README.md +475 -2
- package/dist/src/agent-event-writer.d.ts +26 -0
- package/dist/src/agent-event-writer.js +110 -0
- package/dist/src/agent-event-writer.js.map +1 -0
- package/dist/src/agent-framework-runner.d.ts +368 -0
- package/dist/src/agent-framework-runner.js +81 -0
- package/dist/src/agent-framework-runner.js.map +1 -0
- package/dist/src/agent-session-codecs.d.ts +44 -0
- package/dist/src/agent-session-codecs.js +355 -0
- package/dist/src/agent-session-codecs.js.map +1 -0
- package/dist/src/agent-session-flow.d.ts +148 -0
- package/dist/src/agent-session-flow.js +276 -0
- package/dist/src/agent-session-flow.js.map +1 -0
- package/dist/src/agent-session-persistence.d.ts +56 -0
- package/dist/src/agent-session-persistence.js +43 -0
- package/dist/src/agent-session-persistence.js.map +1 -0
- package/dist/src/agent-session-steps.d.ts +86 -0
- package/dist/src/agent-session-steps.js +533 -0
- package/dist/src/agent-session-steps.js.map +1 -0
- package/dist/src/agent-session-transitions.d.ts +61 -0
- package/dist/src/agent-session-transitions.js +202 -0
- package/dist/src/agent-session-transitions.js.map +1 -0
- package/dist/src/agent-session-values.d.ts +337 -0
- package/dist/src/agent-session-values.js +127 -0
- package/dist/src/agent-session-values.js.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +12 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/testing/agent-session-test-client.d.ts +148 -0
- package/dist/src/testing/agent-session-test-client.js +217 -0
- package/dist/src/testing/agent-session-test-client.js.map +1 -0
- package/dist/src/testing/agent-test-environment.d.ts +52 -0
- package/dist/src/testing/agent-test-environment.js +86 -0
- package/dist/src/testing/agent-test-environment.js.map +1 -0
- package/dist/src/testing/agent-worker-process.d.ts +91 -0
- package/dist/src/testing/agent-worker-process.js +150 -0
- package/dist/src/testing/agent-worker-process.js.map +1 -0
- package/dist/src/testing/child-process-group.d.ts +33 -0
- package/dist/src/testing/child-process-group.js +164 -0
- package/dist/src/testing/child-process-group.js.map +1 -0
- package/dist/src/testing/coordination.d.ts +99 -0
- package/dist/src/testing/coordination.js +155 -0
- package/dist/src/testing/coordination.js.map +1 -0
- package/dist/src/testing/index.d.ts +7 -0
- package/dist/src/testing/index.js +15 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/testing/polling.d.ts +31 -0
- package/dist/src/testing/polling.js +51 -0
- package/dist/src/testing/polling.js.map +1 -0
- package/dist/src/testing/private-dex-engine.d.ts +92 -0
- package/dist/src/testing/private-dex-engine.js +215 -0
- package/dist/src/testing/private-dex-engine.js.map +1 -0
- package/dist/src/testing/step-history.d.ts +40 -0
- package/dist/src/testing/step-history.js +59 -0
- package/dist/src/testing/step-history.js.map +1 -0
- package/package.json +50 -4
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright (c) 2026 Super Durable, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Sustainable Use License 1.0.
|
|
4
|
+
// You may not use this file except in compliance with the License.
|
|
5
|
+
// See the LICENSE file in the repository root.
|
|
6
|
+
//
|
|
7
|
+
// SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
|
|
8
|
+
import { execFile } from "node:child_process";
|
|
9
|
+
import { promisify } from "node:util";
|
|
10
|
+
const execFileAsync = promisify(execFile);
|
|
11
|
+
/** History event type of a completed `waitFor` method. */
|
|
12
|
+
export const waitForCompletedEvent = "StepWaitForCompleted";
|
|
13
|
+
/** History event type of a completed `execute` method. */
|
|
14
|
+
export const executeCompletedEvent = "StepExecuteCompleted";
|
|
15
|
+
/**
|
|
16
|
+
* Returns every completed Step method of a Flow's current run, in history order.
|
|
17
|
+
*
|
|
18
|
+
* It runs `dexcli flow history --all --output json`, as the Python core's `read_step_history` does. Use
|
|
19
|
+
* it to assert the Step shape of a turn, such as `RunModel`, `CallTool`, `ResumeTurn`, `RunModel`.
|
|
20
|
+
* Steps that are still waiting or running are not included.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const executed = (await readStepHistory(engine.serverAddress, sessionId))
|
|
25
|
+
* .filter((entry) => entry.eventType === executeCompletedEvent)
|
|
26
|
+
* .map((entry) => entry.stepType);
|
|
27
|
+
* ```
|
|
28
|
+
* @param serverAddress - Dex Server address.
|
|
29
|
+
* @param flowId - Flow ID to read.
|
|
30
|
+
* @param options - `dexcli` path.
|
|
31
|
+
* @returns One entry per completed `waitFor` or `execute` method.
|
|
32
|
+
* @throws {Error} When `dexcli` fails or prints unexpected JSON.
|
|
33
|
+
*/
|
|
34
|
+
export async function readStepHistory(serverAddress, flowId, options = {}) {
|
|
35
|
+
const dexcliPath = options.dexcliPath ?? process.env.DEXCLI ?? "dexcli";
|
|
36
|
+
const { stdout } = await execFileAsync(dexcliPath, ["flow", "history", flowId, "--server", serverAddress, "--all", "--output", "json"], { maxBuffer: 64 * 1024 * 1024 });
|
|
37
|
+
const history = JSON.parse(stdout);
|
|
38
|
+
if (!Array.isArray(history.events)) {
|
|
39
|
+
throw new Error(`dexcli flow history printed no events for ${flowId}`);
|
|
40
|
+
}
|
|
41
|
+
const entries = [];
|
|
42
|
+
for (const event of history.events) {
|
|
43
|
+
if (event.type !== waitForCompletedEvent && event.type !== executeCompletedEvent) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const stepContext = event.payload?.context;
|
|
47
|
+
if (stepContext === undefined) {
|
|
48
|
+
throw new Error(`history event ${event.type} of ${flowId} has no Step context`);
|
|
49
|
+
}
|
|
50
|
+
entries.push({
|
|
51
|
+
eventType: event.type,
|
|
52
|
+
stepType: String(stepContext.stepType),
|
|
53
|
+
stepExecutionId: String(stepContext.stepExecutionId),
|
|
54
|
+
finalAttempt: Number(stepContext.finalAttempt),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return entries;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=step-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-history.js","sourceRoot":"","sources":["../../../src/testing/step-history.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,0DAA0D;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,0DAA0D;AAC1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAC5D,0DAA0D;AAC1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAoB5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,aAAqB,EACrB,MAAc,EACd,UAAkC,EAAE;IAEpC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,QAAQ,CAAC;IACxE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CACpC,UAAU,EACV,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,EACnF,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,CAChC,CAAC;IACF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAyB,CAAC;IAC3D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,6CAA6C,MAAM,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,MAAM,OAAO,GAAuB,EAAE,CAAC;IACvC,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAsD,EAAE,CAAC;QACnF,IAAI,KAAK,CAAC,IAAI,KAAK,qBAAqB,IAAI,KAAK,CAAC,IAAI,KAAK,qBAAqB,EAAE,CAAC;YACjF,SAAS;QACX,CAAC;QACD,MAAM,WAAW,GAAI,KAAK,CAAC,OAA6D,EAAE,OAAO,CAAC;QAClG,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,iBAAiB,KAAK,CAAC,IAAI,OAAO,MAAM,sBAAsB,CAAC,CAAC;QAClF,CAAC;QACD,OAAO,CAAC,IAAI,CAAC;YACX,SAAS,EAAE,KAAK,CAAC,IAAI;YACrB,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;YACtC,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC;YACpD,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC;SAC/C,CAAC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/dex-agents",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Durable agent sessions for Dex, shared by the Dex TypeScript agent framework adapters",
|
|
5
|
+
"license": "LicenseRef-Sustainable-Use-1.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/superdurable/dex.git",
|
|
9
|
+
"directory": "agents/typescript/core"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/superdurable/dex/tree/main/agents/typescript/core#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/superdurable/dex/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"types": "./dist/src/index.d.ts",
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": "^22.0.0 || ^24.0.0"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist/src",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE"
|
|
24
|
+
],
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/src/index.d.ts",
|
|
28
|
+
"import": "./dist/src/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./testing": {
|
|
31
|
+
"types": "./dist/src/testing/index.d.ts",
|
|
32
|
+
"import": "./dist/src/testing/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc -p tsconfig.json",
|
|
37
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
38
|
+
"test:integration": "npm run build && node --test --test-concurrency=1 --test-timeout=240000 'dist/test/integ/*.integration.test.js'"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@superdurable/dex": "1.30.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@superdurable/dex": "1.30.0",
|
|
45
|
+
"@types/node": "22.20.5",
|
|
46
|
+
"typescript": "5.9.3"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public",
|
|
50
|
+
"provenance": true
|
|
51
|
+
}
|
|
52
|
+
}
|