@pumped-fn/agent-sdk-test 1.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License Copyright (c) 2025 Duke
2
+
3
+ Permission is hereby granted, free of
4
+ charge, to any person obtaining a copy of this software and associated
5
+ documentation files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use, copy, modify, merge,
7
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to the
9
+ following conditions:
10
+
11
+ The above copyright notice and this permission notice
12
+ (including the next paragraph) shall be included in all copies or substantial
13
+ portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
16
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
18
+ EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # @pumped-fn/agent-sdk-test
2
+
3
+ In-memory test helpers for `@pumped-fn/agent-sdk`.
4
+
5
+ Use `kit()` to install the agent workflow extensions with a `MemoryWorkflowLog`. The helper keeps the normal pumped-fn seam: tests still exercise public APIs through `createScope({ presets, tags, extensions })`.
6
+
7
+ ```ts
8
+ import { createScope } from "@pumped-fn/lite"
9
+ import { kit } from "@pumped-fn/agent-sdk-test"
10
+
11
+ const { extensions, log } = kit()
12
+ const scope = createScope({ extensions })
13
+ const ctx = scope.createContext()
14
+ ```
15
+
16
+ `localRemoteRunner` executes remote-tagged steps in process for tests. `MemoryWorkflowLog` implements the same `RunLog` contract used by `inspect()`.
package/dist/index.cjs ADDED
@@ -0,0 +1,58 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let _pumped_fn_agent_sdk = require("@pumped-fn/agent-sdk");
3
+ let _pumped_fn_lite_extension_suspense = require("@pumped-fn/lite-extension-suspense");
4
+ //#region src/index.ts
5
+ var MemorySuspenseLog = class {
6
+ store = /* @__PURE__ */ new Map();
7
+ async get(key) {
8
+ return this.store.get((0, _pumped_fn_lite_extension_suspense.formatSuspenseStepKey)(key));
9
+ }
10
+ async putPending(entry) {
11
+ this.store.set((0, _pumped_fn_lite_extension_suspense.formatSuspenseStepKey)(entry.key), entry);
12
+ }
13
+ async putCompleted(entry) {
14
+ this.store.set((0, _pumped_fn_lite_extension_suspense.formatSuspenseStepKey)(entry.key), entry);
15
+ }
16
+ async resolve(key, value) {
17
+ const current = this.store.get((0, _pumped_fn_lite_extension_suspense.formatSuspenseStepKey)(key));
18
+ if (!current || current.status !== "pending") throw new Error(`Pending step "${(0, _pumped_fn_lite_extension_suspense.formatSuspenseStepKey)(key)}" not found`);
19
+ this.store.set((0, _pumped_fn_lite_extension_suspense.formatSuspenseStepKey)(key), {
20
+ status: "resolved",
21
+ key,
22
+ targetName: current.targetName,
23
+ value
24
+ });
25
+ }
26
+ entries(query = {}) {
27
+ return [...this.store.values()].filter((entry) => (query.taskId === void 0 || entry.key.taskId === query.taskId) && (query.runId === void 0 || entry.key.runId === query.runId));
28
+ }
29
+ };
30
+ var MemoryWorkflowLog = class extends MemorySuspenseLog {};
31
+ const localRemoteRunner = { run: (_event, next) => next() };
32
+ function suspense(options = {}) {
33
+ const log = options.log ?? new MemorySuspenseLog();
34
+ return {
35
+ log,
36
+ extension: (0, _pumped_fn_lite_extension_suspense.extension)({
37
+ ...options,
38
+ log
39
+ })
40
+ };
41
+ }
42
+ function kit(options = {}) {
43
+ const log = options.log ?? new MemoryWorkflowLog();
44
+ return {
45
+ log,
46
+ extensions: [(0, _pumped_fn_agent_sdk.workflowExtension)({
47
+ log,
48
+ defaultTaskId: options.defaultTaskId,
49
+ defaultRunId: options.defaultRunId
50
+ }), (0, _pumped_fn_agent_sdk.extension)({ remoteRunner: options.remoteRunner ?? localRemoteRunner })]
51
+ };
52
+ }
53
+ //#endregion
54
+ exports.MemorySuspenseLog = MemorySuspenseLog;
55
+ exports.MemoryWorkflowLog = MemoryWorkflowLog;
56
+ exports.kit = kit;
57
+ exports.localRemoteRunner = localRemoteRunner;
58
+ exports.suspense = suspense;
@@ -0,0 +1,34 @@
1
+ import { ExtensionOptions, RemoteRunner, RunLog, RunQuery, WorkflowEventLog, WorkflowExtensionOptions } from "@pumped-fn/agent-sdk";
2
+ import { SuspenseEventLog, SuspenseExtensionOptions, SuspenseStepEntry, SuspenseStepKey } from "@pumped-fn/lite-extension-suspense";
3
+ import { Lite } from "@pumped-fn/lite";
4
+
5
+ //#region src/index.d.ts
6
+ declare class MemorySuspenseLog implements SuspenseEventLog {
7
+ private readonly store;
8
+ get(key: SuspenseStepKey): Promise<SuspenseStepEntry | undefined>;
9
+ putPending(entry: Extract<SuspenseStepEntry, {
10
+ status: "pending";
11
+ }>): Promise<void>;
12
+ putCompleted(entry: Extract<SuspenseStepEntry, {
13
+ status: "completed";
14
+ }>): Promise<void>;
15
+ resolve(key: SuspenseStepKey, value: unknown): Promise<void>;
16
+ entries(query?: Partial<RunQuery>): SuspenseStepEntry[];
17
+ }
18
+ declare class MemoryWorkflowLog extends MemorySuspenseLog implements WorkflowEventLog, RunLog {}
19
+ declare const localRemoteRunner: RemoteRunner;
20
+ declare function suspense(options?: Omit<SuspenseExtensionOptions, "log"> & {
21
+ log?: SuspenseEventLog;
22
+ }): {
23
+ extension: Lite.Extension;
24
+ log: SuspenseEventLog;
25
+ };
26
+ declare function kit(options?: ExtensionOptions & Omit<WorkflowExtensionOptions, "log"> & {
27
+ log?: RunLog;
28
+ }): {
29
+ extensions: Lite.Extension[];
30
+ log: RunLog;
31
+ };
32
+ //#endregion
33
+ export { MemorySuspenseLog, MemoryWorkflowLog, kit, localRemoteRunner, suspense };
34
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;cAoBa,iBAAA,YAA6B,gBAAA;EAAA,iBACvB,KAAA;EAEX,GAAA,CAAI,GAAA,EAAK,eAAA,GAAkB,OAAA,CAAQ,iBAAA;EAInC,UAAA,CAAW,KAAA,EAAO,OAAA,CAAQ,iBAAA;IAAqB,MAAA;EAAA,KAAuB,OAAA;EAItE,YAAA,CAAa,KAAA,EAAO,OAAA,CAAQ,iBAAA;IAAqB,MAAA;EAAA,KAAyB,OAAA;EAI1E,OAAA,CAAQ,GAAA,EAAK,eAAA,EAAiB,KAAA,YAAiB,OAAA;EAWrD,OAAA,CAAQ,KAAA,GAAO,OAAA,CAAQ,QAAA,IAAiB,iBAAA;AAAA;AAAA,cAQ7B,iBAAA,SAA0B,iBAAA,YAA6B,gBAAA,EAAkB,MAAA;AAAA,cAEzE,iBAAA,EAAmB,YAE/B;AAAA,iBAEe,QAAA,CACd,OAAA,GAAS,IAAA,CAAK,wBAAA;EAAqC,GAAA,GAAM,gBAAA;AAAA;EACtD,SAAA,EAAW,IAAA,CAAK,SAAA;EAAW,GAAA,EAAK,gBAAA;AAAA;AAAA,iBAWrB,GAAA,CACd,OAAA,GAAS,gBAAA,GAAmB,IAAA,CAAK,wBAAA;EAAqC,GAAA,GAAM,MAAA;AAAA;EACzE,UAAA,EAAY,IAAA,CAAK,SAAA;EAAa,GAAA,EAAK,MAAA;AAAA"}
@@ -0,0 +1,34 @@
1
+ import { ExtensionOptions, RemoteRunner, RunLog, RunQuery, WorkflowEventLog, WorkflowExtensionOptions } from "@pumped-fn/agent-sdk";
2
+ import { SuspenseEventLog, SuspenseExtensionOptions, SuspenseStepEntry, SuspenseStepKey } from "@pumped-fn/lite-extension-suspense";
3
+ import { Lite } from "@pumped-fn/lite";
4
+
5
+ //#region src/index.d.ts
6
+ declare class MemorySuspenseLog implements SuspenseEventLog {
7
+ private readonly store;
8
+ get(key: SuspenseStepKey): Promise<SuspenseStepEntry | undefined>;
9
+ putPending(entry: Extract<SuspenseStepEntry, {
10
+ status: "pending";
11
+ }>): Promise<void>;
12
+ putCompleted(entry: Extract<SuspenseStepEntry, {
13
+ status: "completed";
14
+ }>): Promise<void>;
15
+ resolve(key: SuspenseStepKey, value: unknown): Promise<void>;
16
+ entries(query?: Partial<RunQuery>): SuspenseStepEntry[];
17
+ }
18
+ declare class MemoryWorkflowLog extends MemorySuspenseLog implements WorkflowEventLog, RunLog {}
19
+ declare const localRemoteRunner: RemoteRunner;
20
+ declare function suspense(options?: Omit<SuspenseExtensionOptions, "log"> & {
21
+ log?: SuspenseEventLog;
22
+ }): {
23
+ extension: Lite.Extension;
24
+ log: SuspenseEventLog;
25
+ };
26
+ declare function kit(options?: ExtensionOptions & Omit<WorkflowExtensionOptions, "log"> & {
27
+ log?: RunLog;
28
+ }): {
29
+ extensions: Lite.Extension[];
30
+ log: RunLog;
31
+ };
32
+ //#endregion
33
+ export { MemorySuspenseLog, MemoryWorkflowLog, kit, localRemoteRunner, suspense };
34
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;cAoBa,iBAAA,YAA6B,gBAAA;EAAA,iBACvB,KAAA;EAEX,GAAA,CAAI,GAAA,EAAK,eAAA,GAAkB,OAAA,CAAQ,iBAAA;EAInC,UAAA,CAAW,KAAA,EAAO,OAAA,CAAQ,iBAAA;IAAqB,MAAA;EAAA,KAAuB,OAAA;EAItE,YAAA,CAAa,KAAA,EAAO,OAAA,CAAQ,iBAAA;IAAqB,MAAA;EAAA,KAAyB,OAAA;EAI1E,OAAA,CAAQ,GAAA,EAAK,eAAA,EAAiB,KAAA,YAAiB,OAAA;EAWrD,OAAA,CAAQ,KAAA,GAAO,OAAA,CAAQ,QAAA,IAAiB,iBAAA;AAAA;AAAA,cAQ7B,iBAAA,SAA0B,iBAAA,YAA6B,gBAAA,EAAkB,MAAA;AAAA,cAEzE,iBAAA,EAAmB,YAE/B;AAAA,iBAEe,QAAA,CACd,OAAA,GAAS,IAAA,CAAK,wBAAA;EAAqC,GAAA,GAAM,gBAAA;AAAA;EACtD,SAAA,EAAW,IAAA,CAAK,SAAA;EAAW,GAAA,EAAK,gBAAA;AAAA;AAAA,iBAWrB,GAAA,CACd,OAAA,GAAS,gBAAA,GAAmB,IAAA,CAAK,wBAAA;EAAqC,GAAA,GAAM,MAAA;AAAA;EACzE,UAAA,EAAY,IAAA,CAAK,SAAA;EAAa,GAAA,EAAK,MAAA;AAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,55 @@
1
+ import { extension, workflowExtension } from "@pumped-fn/agent-sdk";
2
+ import { extension as extension$1, formatSuspenseStepKey } from "@pumped-fn/lite-extension-suspense";
3
+ //#region src/index.ts
4
+ var MemorySuspenseLog = class {
5
+ store = /* @__PURE__ */ new Map();
6
+ async get(key) {
7
+ return this.store.get(formatSuspenseStepKey(key));
8
+ }
9
+ async putPending(entry) {
10
+ this.store.set(formatSuspenseStepKey(entry.key), entry);
11
+ }
12
+ async putCompleted(entry) {
13
+ this.store.set(formatSuspenseStepKey(entry.key), entry);
14
+ }
15
+ async resolve(key, value) {
16
+ const current = this.store.get(formatSuspenseStepKey(key));
17
+ if (!current || current.status !== "pending") throw new Error(`Pending step "${formatSuspenseStepKey(key)}" not found`);
18
+ this.store.set(formatSuspenseStepKey(key), {
19
+ status: "resolved",
20
+ key,
21
+ targetName: current.targetName,
22
+ value
23
+ });
24
+ }
25
+ entries(query = {}) {
26
+ return [...this.store.values()].filter((entry) => (query.taskId === void 0 || entry.key.taskId === query.taskId) && (query.runId === void 0 || entry.key.runId === query.runId));
27
+ }
28
+ };
29
+ var MemoryWorkflowLog = class extends MemorySuspenseLog {};
30
+ const localRemoteRunner = { run: (_event, next) => next() };
31
+ function suspense(options = {}) {
32
+ const log = options.log ?? new MemorySuspenseLog();
33
+ return {
34
+ log,
35
+ extension: extension$1({
36
+ ...options,
37
+ log
38
+ })
39
+ };
40
+ }
41
+ function kit(options = {}) {
42
+ const log = options.log ?? new MemoryWorkflowLog();
43
+ return {
44
+ log,
45
+ extensions: [workflowExtension({
46
+ log,
47
+ defaultTaskId: options.defaultTaskId,
48
+ defaultRunId: options.defaultRunId
49
+ }), extension({ remoteRunner: options.remoteRunner ?? localRemoteRunner })]
50
+ };
51
+ }
52
+ //#endregion
53
+ export { MemorySuspenseLog, MemoryWorkflowLog, kit, localRemoteRunner, suspense };
54
+
55
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["suspenseExtension","agentExtension"],"sources":["../src/index.ts"],"sourcesContent":["import {\n extension as agentExtension,\n workflowExtension,\n type ExtensionOptions,\n type RemoteRunner,\n type RunLog,\n type RunQuery,\n type WorkflowEventLog,\n type WorkflowExtensionOptions,\n} from \"@pumped-fn/agent-sdk\"\nimport {\n extension as suspenseExtension,\n formatSuspenseStepKey,\n type SuspenseEventLog,\n type SuspenseExtensionOptions,\n type SuspenseStepEntry,\n type SuspenseStepKey,\n} from \"@pumped-fn/lite-extension-suspense\"\nimport type { Lite } from \"@pumped-fn/lite\"\n\nexport class MemorySuspenseLog implements SuspenseEventLog {\n private readonly store = new Map<string, SuspenseStepEntry>()\n\n async get(key: SuspenseStepKey): Promise<SuspenseStepEntry | undefined> {\n return this.store.get(formatSuspenseStepKey(key))\n }\n\n async putPending(entry: Extract<SuspenseStepEntry, { status: \"pending\" }>): Promise<void> {\n this.store.set(formatSuspenseStepKey(entry.key), entry)\n }\n\n async putCompleted(entry: Extract<SuspenseStepEntry, { status: \"completed\" }>): Promise<void> {\n this.store.set(formatSuspenseStepKey(entry.key), entry)\n }\n\n async resolve(key: SuspenseStepKey, value: unknown): Promise<void> {\n const current = this.store.get(formatSuspenseStepKey(key))\n if (!current || current.status !== \"pending\") throw new Error(`Pending step \"${formatSuspenseStepKey(key)}\" not found`)\n this.store.set(formatSuspenseStepKey(key), {\n status: \"resolved\",\n key,\n targetName: current.targetName,\n value,\n })\n }\n\n entries(query: Partial<RunQuery> = {}): SuspenseStepEntry[] {\n return [...this.store.values()].filter((entry) =>\n (query.taskId === undefined || entry.key.taskId === query.taskId) &&\n (query.runId === undefined || entry.key.runId === query.runId)\n )\n }\n}\n\nexport class MemoryWorkflowLog extends MemorySuspenseLog implements WorkflowEventLog, RunLog {}\n\nexport const localRemoteRunner: RemoteRunner = {\n run: (_event, next) => next(),\n}\n\nexport function suspense(\n options: Omit<SuspenseExtensionOptions, \"log\"> & { log?: SuspenseEventLog } = {}\n): { extension: Lite.Extension; log: SuspenseEventLog } {\n const log = options.log ?? new MemorySuspenseLog()\n return {\n log,\n extension: suspenseExtension({\n ...options,\n log,\n }),\n }\n}\n\nexport function kit(\n options: ExtensionOptions & Omit<WorkflowExtensionOptions, \"log\"> & { log?: RunLog } = {}\n): { extensions: Lite.Extension[]; log: RunLog } {\n const log = options.log ?? new MemoryWorkflowLog()\n return {\n log,\n extensions: [\n workflowExtension({\n log,\n defaultTaskId: options.defaultTaskId,\n defaultRunId: options.defaultRunId,\n }),\n agentExtension({\n remoteRunner: options.remoteRunner ?? localRemoteRunner,\n }),\n ],\n }\n}\n"],"mappings":";;;AAoBA,IAAa,oBAAb,MAA2D;CACzD,wBAAyB,IAAI,IAA+B;CAE5D,MAAM,IAAI,KAA8D;EACtE,OAAO,KAAK,MAAM,IAAI,sBAAsB,GAAG,CAAC;CAClD;CAEA,MAAM,WAAW,OAAyE;EACxF,KAAK,MAAM,IAAI,sBAAsB,MAAM,GAAG,GAAG,KAAK;CACxD;CAEA,MAAM,aAAa,OAA2E;EAC5F,KAAK,MAAM,IAAI,sBAAsB,MAAM,GAAG,GAAG,KAAK;CACxD;CAEA,MAAM,QAAQ,KAAsB,OAA+B;EACjE,MAAM,UAAU,KAAK,MAAM,IAAI,sBAAsB,GAAG,CAAC;EACzD,IAAI,CAAC,WAAW,QAAQ,WAAW,WAAW,MAAM,IAAI,MAAM,iBAAiB,sBAAsB,GAAG,EAAE,YAAY;EACtH,KAAK,MAAM,IAAI,sBAAsB,GAAG,GAAG;GACzC,QAAQ;GACR;GACA,YAAY,QAAQ;GACpB;EACF,CAAC;CACH;CAEA,QAAQ,QAA2B,CAAC,GAAwB;EAC1D,OAAO,CAAC,GAAG,KAAK,MAAM,OAAO,CAAC,EAAE,QAAQ,WACrC,MAAM,WAAW,KAAA,KAAa,MAAM,IAAI,WAAW,MAAM,YACzD,MAAM,UAAU,KAAA,KAAa,MAAM,IAAI,UAAU,MAAM,MAC1D;CACF;AACF;AAEA,IAAa,oBAAb,cAAuC,kBAAsD,CAAC;AAE9F,MAAa,oBAAkC,EAC7C,MAAM,QAAQ,SAAS,KAAK,EAC9B;AAEA,SAAgB,SACd,UAA8E,CAAC,GACzB;CACtD,MAAM,MAAM,QAAQ,OAAO,IAAI,kBAAkB;CACjD,OAAO;EACL;EACA,WAAWA,YAAkB;GAC3B,GAAG;GACH;EACF,CAAC;CACH;AACF;AAEA,SAAgB,IACd,UAAuF,CAAC,GACzC;CAC/C,MAAM,MAAM,QAAQ,OAAO,IAAI,kBAAkB;CACjD,OAAO;EACL;EACA,YAAY,CACV,kBAAkB;GAChB;GACA,eAAe,QAAQ;GACvB,cAAc,QAAQ;EACxB,CAAC,GACDC,UAAe,EACb,cAAc,QAAQ,gBAAgB,kBACxC,CAAC,CACH;CACF;AACF"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@pumped-fn/agent-sdk-test",
3
+ "version": "1.0.0",
4
+ "private": false,
5
+ "description": "In-memory test helpers for @pumped-fn/agent-sdk",
6
+ "type": "module",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.mjs",
9
+ "types": "./dist/index.d.cts",
10
+ "exports": {
11
+ ".": {
12
+ "import": {
13
+ "types": "./dist/index.d.mts",
14
+ "default": "./dist/index.mjs"
15
+ },
16
+ "require": {
17
+ "types": "./dist/index.d.cts",
18
+ "default": "./dist/index.cjs"
19
+ }
20
+ }
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md",
25
+ "LICENSE"
26
+ ],
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "build": "tsdown --config-loader tsx",
32
+ "typecheck": "tsgo --noEmit",
33
+ "test": "vitest run",
34
+ "test:watch": "vitest"
35
+ },
36
+ "peerDependencies": {
37
+ "@pumped-fn/agent-sdk": "^1.0.0",
38
+ "@pumped-fn/lite": "^3.1.0"
39
+ },
40
+ "dependencies": {
41
+ "@pumped-fn/lite-extension-suspense": "workspace:^"
42
+ },
43
+ "devDependencies": {
44
+ "@pumped-fn/agent-sdk": "workspace:*",
45
+ "@pumped-fn/lite": "workspace:*",
46
+ "@types/node": "catalog:",
47
+ "@typescript/native-preview": "catalog:",
48
+ "tsdown": "catalog:",
49
+ "typescript": "catalog:",
50
+ "vite": "catalog:",
51
+ "vitest": "catalog:"
52
+ },
53
+ "license": "MIT",
54
+ "repository": {
55
+ "type": "git",
56
+ "directory": "packages/agent-sdk-test",
57
+ "url": "git+https://github.com/pumped-fn/pumped-fn.git"
58
+ }
59
+ }