@executor-js/execution 0.0.1-beta.0 → 0.0.1-beta.1

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.js CHANGED
@@ -2,18 +2,44 @@ import {
2
2
  ExecutionToolError,
3
3
  buildExecuteDescription,
4
4
  createExecutionEngine,
5
- describeTool,
6
5
  formatExecuteResult,
7
- formatPausedExecution,
8
- listExecutorSources,
9
- makeExecutorToolInvoker,
10
- searchTools
6
+ formatPausedExecution
11
7
  } from "./chunk-7ZEYKKLC.js";
12
8
 
13
9
  // src/promise.ts
14
10
  import { Effect } from "effect";
11
+ var wrapPromiseExecutor = (pe) => ({
12
+ scope: pe.scope,
13
+ tools: {
14
+ invoke: (id, args, options) => Effect.tryPromise({
15
+ try: () => pe.tools.invoke(id, args, options),
16
+ catch: (cause) => cause
17
+ }),
18
+ list: (filter) => Effect.tryPromise({
19
+ try: () => pe.tools.list(filter),
20
+ catch: (cause) => cause
21
+ }).pipe(Effect.orDie),
22
+ schema: (id) => Effect.tryPromise({
23
+ try: () => pe.tools.schema(id),
24
+ catch: (cause) => cause
25
+ }),
26
+ definitions: () => Effect.tryPromise({
27
+ try: () => pe.tools.definitions(),
28
+ catch: (cause) => cause
29
+ }).pipe(Effect.orDie)
30
+ },
31
+ sources: {
32
+ list: () => Effect.tryPromise({
33
+ try: () => pe.sources.list(),
34
+ catch: (cause) => cause
35
+ }).pipe(Effect.orDie)
36
+ }
37
+ });
15
38
  var createExecutionEngine2 = (config) => {
16
- const engine = createExecutionEngine(config);
39
+ const engine = createExecutionEngine({
40
+ executor: wrapPromiseExecutor(config.executor),
41
+ codeExecutor: config.codeExecutor
42
+ });
17
43
  return {
18
44
  execute: (code, options) => engine.execute(code, {
19
45
  onElicitation: (ctx) => Effect.tryPromise(() => options.onElicitation(ctx)).pipe(
@@ -29,11 +55,7 @@ export {
29
55
  ExecutionToolError,
30
56
  buildExecuteDescription,
31
57
  createExecutionEngine2 as createExecutionEngine,
32
- describeTool,
33
58
  formatExecuteResult,
34
- formatPausedExecution,
35
- listExecutorSources,
36
- makeExecutorToolInvoker,
37
- searchTools
59
+ formatPausedExecution
38
60
  };
39
61
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/promise.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// @executor/execution/promise — Promise-native surface for the execution\n// engine. Mirrors the sdk's promise/Effect split.\n//\n// Consumer goal: run executor code and handle elicitations with async/await\n// without touching Effect. The engine's public methods already return\n// `Promise<T>` (see `./engine`), so the only surface difference is the\n// `ElicitationHandler` callback type the Effect version returns\n// `Effect.Effect<ElicitationResponse>`, this version returns a plain Promise.\n//\n// The `executor` input is still the Effect-surface `Executor` from\n// `@executor/sdk`. Promise-sdk consumers should instantiate their executor\n// via `@executor-js/sdk/core`'s `createExecutor` and hand it in. We don't\n// attempt to unwrap the sdk's promise proxy back to its underlying Effect\n// executor — that would require leaking proxy internals and isn't worth the\n// complexity.\n// ---------------------------------------------------------------------------\n\nimport { Effect } from \"effect\";\n\nimport type {\n ElicitationContext,\n ElicitationResponse,\n Executor,\n} from \"@executor/sdk/core\";\nimport type { CodeExecutor, ExecuteResult } from \"@executor/codemode-core\";\n\nimport {\n createExecutionEngine as createEffectExecutionEngine,\n type ExecutionResult,\n type PausedExecution,\n type ResumeResponse,\n} from \"./engine\";\n\nexport type ElicitationHandler = (\n ctx: ElicitationContext,\n) => Promise<ElicitationResponse>;\n\nexport type ExecutionEngineConfig = {\n readonly executor: Executor;\n readonly codeExecutor?: CodeExecutor;\n};\n\nexport type ExecutionEngine = {\n readonly execute: (\n code: string,\n options: { readonly onElicitation: ElicitationHandler },\n ) => Promise<ExecuteResult>;\n readonly executeWithPause: (code: string) => Promise<ExecutionResult>;\n readonly resume: (\n executionId: string,\n response: ResumeResponse,\n ) => Promise<ExecutionResult | null>;\n readonly getDescription: () => Promise<string>;\n};\n\nexport const createExecutionEngine = (\n config: ExecutionEngineConfig,\n): ExecutionEngine => {\n const engine = createEffectExecutionEngine(config);\n return {\n execute: (code, options) =>\n engine.execute(code, {\n onElicitation: (ctx) =>\n Effect.tryPromise(() => options.onElicitation(ctx)).pipe(\n Effect.orDie,\n ),\n }),\n executeWithPause: (code) => engine.executeWithPause(code),\n resume: (executionId, response) => engine.resume(executionId, response),\n getDescription: () => engine.getDescription(),\n };\n};\n\n// ---------------------------------------------------------------------------\n// Re-exports — plain types/helpers that don't carry Effect signatures.\n// ---------------------------------------------------------------------------\n\nexport {\n formatExecuteResult,\n formatPausedExecution,\n} from \"./engine\";\n\nexport type { ExecutionResult, PausedExecution, ResumeResponse };\n\nexport { buildExecuteDescription } from \"./description\";\nexport { ExecutionToolError } from \"./errors\";\nexport {\n makeExecutorToolInvoker,\n searchTools,\n listExecutorSources,\n describeTool,\n} from \"./tool-invoker\";\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAS,cAAc;AAsChB,IAAMA,yBAAwB,CACnC,WACoB;AACpB,QAAM,SAAS,sBAA4B,MAAM;AACjD,SAAO;AAAA,IACL,SAAS,CAAC,MAAM,YACd,OAAO,QAAQ,MAAM;AAAA,MACnB,eAAe,CAAC,QACd,OAAO,WAAW,MAAM,QAAQ,cAAc,GAAG,CAAC,EAAE;AAAA,QAClD,OAAO;AAAA,MACT;AAAA,IACJ,CAAC;AAAA,IACH,kBAAkB,CAAC,SAAS,OAAO,iBAAiB,IAAI;AAAA,IACxD,QAAQ,CAAC,aAAa,aAAa,OAAO,OAAO,aAAa,QAAQ;AAAA,IACtE,gBAAgB,MAAM,OAAO,eAAe;AAAA,EAC9C;AACF;","names":["createExecutionEngine"]}
1
+ {"version":3,"sources":["../src/promise.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// @executor/execution/promise — Promise-native surface for the execution\n// engine. Accepts a Promise-style Executor (from @executor/sdk) and an\n// async `onElicitation` handlerno Effect imports required by callers.\n//\n// Under the hood the engine is Effect-based, so we wrap the incoming\n// Promise executor into the minimal Effect shape the engine consumes,\n// and bridge the elicitation handler via `Effect.tryPromise`.\n// ---------------------------------------------------------------------------\n\nimport { Effect } from \"effect\";\n\nimport type {\n ElicitationContext,\n ElicitationResponse,\n Executor as PromiseExecutor,\n} from \"@executor/sdk\";\nimport type { CodeExecutor, ExecuteResult } from \"@executor/codemode-core\";\n\nimport {\n createExecutionEngine as createEffectExecutionEngine,\n type ExecutionResult,\n type PausedExecution,\n type ResumeResponse,\n} from \"./engine\";\n\nexport type ElicitationHandler = (\n ctx: ElicitationContext,\n) => Promise<ElicitationResponse>;\n\nexport type ExecutionEngineConfig = {\n readonly executor: PromiseExecutor;\n readonly codeExecutor?: CodeExecutor;\n};\n\nexport type ExecutionEngine = {\n readonly execute: (\n code: string,\n options: { readonly onElicitation: ElicitationHandler },\n ) => Promise<ExecuteResult>;\n readonly executeWithPause: (code: string) => Promise<ExecutionResult>;\n readonly resume: (\n executionId: string,\n response: ResumeResponse,\n ) => Promise<ExecutionResult | null>;\n readonly getDescription: () => Promise<string>;\n};\n\n/**\n * Wrap a Promise-style executor into the Effect shape the engine consumes.\n * Only the four method families the engine actually touches need wrapping:\n * `tools.{invoke,list,schema}` and `sources.list`.\n */\nconst wrapPromiseExecutor = (pe: PromiseExecutor): any => ({\n scope: (pe as any).scope,\n tools: {\n invoke: (id: unknown, args: unknown, options: unknown) =>\n Effect.tryPromise({\n try: () => (pe.tools as any).invoke(id, args, options),\n catch: (cause) => cause,\n }),\n list: (filter?: unknown) =>\n Effect.tryPromise({\n try: () => (pe.tools as any).list(filter),\n catch: (cause) => cause,\n }).pipe(Effect.orDie),\n schema: (id: unknown) =>\n Effect.tryPromise({\n try: () => (pe.tools as any).schema(id),\n catch: (cause) => cause,\n }),\n definitions: () =>\n Effect.tryPromise({\n try: () => (pe.tools as any).definitions(),\n catch: (cause) => cause,\n }).pipe(Effect.orDie),\n },\n sources: {\n list: () =>\n Effect.tryPromise({\n try: () => (pe.sources as any).list(),\n catch: (cause) => cause,\n }).pipe(Effect.orDie),\n },\n});\n\nexport const createExecutionEngine = (\n config: ExecutionEngineConfig,\n): ExecutionEngine => {\n const engine = createEffectExecutionEngine({\n executor: wrapPromiseExecutor(config.executor),\n codeExecutor: config.codeExecutor,\n });\n return {\n execute: (code, options) =>\n engine.execute(code, {\n onElicitation: (ctx) =>\n Effect.tryPromise(() => options.onElicitation(ctx)).pipe(\n Effect.orDie,\n ),\n }),\n executeWithPause: (code) => engine.executeWithPause(code),\n resume: (executionId, response) => engine.resume(executionId, response),\n getDescription: () => engine.getDescription(),\n };\n};\n\n// ---------------------------------------------------------------------------\n// Re-exports — plain types/helpers that don't carry Effect signatures.\n// ---------------------------------------------------------------------------\n\nexport {\n formatExecuteResult,\n formatPausedExecution,\n} from \"./engine\";\n\nexport type { ExecutionResult, PausedExecution, ResumeResponse };\n\nexport { buildExecuteDescription } from \"./description\";\nexport { ExecutionToolError } from \"./errors\";\n"],"mappings":";;;;;;;;;AAUA,SAAS,cAAc;AA2CvB,IAAM,sBAAsB,CAAC,QAA8B;AAAA,EACzD,OAAQ,GAAW;AAAA,EACnB,OAAO;AAAA,IACL,QAAQ,CAAC,IAAa,MAAe,YACnC,OAAO,WAAW;AAAA,MAChB,KAAK,MAAO,GAAG,MAAc,OAAO,IAAI,MAAM,OAAO;AAAA,MACrD,OAAO,CAAC,UAAU;AAAA,IACpB,CAAC;AAAA,IACH,MAAM,CAAC,WACL,OAAO,WAAW;AAAA,MAChB,KAAK,MAAO,GAAG,MAAc,KAAK,MAAM;AAAA,MACxC,OAAO,CAAC,UAAU;AAAA,IACpB,CAAC,EAAE,KAAK,OAAO,KAAK;AAAA,IACtB,QAAQ,CAAC,OACP,OAAO,WAAW;AAAA,MAChB,KAAK,MAAO,GAAG,MAAc,OAAO,EAAE;AAAA,MACtC,OAAO,CAAC,UAAU;AAAA,IACpB,CAAC;AAAA,IACH,aAAa,MACX,OAAO,WAAW;AAAA,MAChB,KAAK,MAAO,GAAG,MAAc,YAAY;AAAA,MACzC,OAAO,CAAC,UAAU;AAAA,IACpB,CAAC,EAAE,KAAK,OAAO,KAAK;AAAA,EACxB;AAAA,EACA,SAAS;AAAA,IACP,MAAM,MACJ,OAAO,WAAW;AAAA,MAChB,KAAK,MAAO,GAAG,QAAgB,KAAK;AAAA,MACpC,OAAO,CAAC,UAAU;AAAA,IACpB,CAAC,EAAE,KAAK,OAAO,KAAK;AAAA,EACxB;AACF;AAEO,IAAMA,yBAAwB,CACnC,WACoB;AACpB,QAAM,SAAS,sBAA4B;AAAA,IACzC,UAAU,oBAAoB,OAAO,QAAQ;AAAA,IAC7C,cAAc,OAAO;AAAA,EACvB,CAAC;AACD,SAAO;AAAA,IACL,SAAS,CAAC,MAAM,YACd,OAAO,QAAQ,MAAM;AAAA,MACnB,eAAe,CAAC,QACd,OAAO,WAAW,MAAM,QAAQ,cAAc,GAAG,CAAC,EAAE;AAAA,QAClD,OAAO;AAAA,MACT;AAAA,IACJ,CAAC;AAAA,IACH,kBAAkB,CAAC,SAAS,OAAO,iBAAiB,IAAI;AAAA,IACxD,QAAQ,CAAC,aAAa,aAAa,OAAO,OAAO,aAAa,QAAQ;AAAA,IACtE,gBAAgB,MAAM,OAAO,eAAe;AAAA,EAC9C;AACF;","names":["createExecutionEngine"]}
package/dist/promise.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import type { ElicitationContext, ElicitationResponse, Executor } from "@executor-js/sdk/core";
1
+ import type { ElicitationContext, ElicitationResponse, Executor as PromiseExecutor } from "@executor-js/sdk";
2
2
  import type { CodeExecutor, ExecuteResult } from "@executor-js/codemode-core";
3
3
  import { type ExecutionResult, type PausedExecution, type ResumeResponse } from "./engine";
4
4
  export type ElicitationHandler = (ctx: ElicitationContext) => Promise<ElicitationResponse>;
5
5
  export type ExecutionEngineConfig = {
6
- readonly executor: Executor;
6
+ readonly executor: PromiseExecutor;
7
7
  readonly codeExecutor?: CodeExecutor;
8
8
  };
9
9
  export type ExecutionEngine = {
@@ -19,5 +19,4 @@ export { formatExecuteResult, formatPausedExecution, } from "./engine";
19
19
  export type { ExecutionResult, PausedExecution, ResumeResponse };
20
20
  export { buildExecuteDescription } from "./description";
21
21
  export { ExecutionToolError } from "./errors";
22
- export { makeExecutorToolInvoker, searchTools, listExecutorSources, describeTool, } from "./tool-invoker";
23
22
  //# sourceMappingURL=promise.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../src/promise.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,QAAQ,EACT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,kBAAkB,GAAG,CAC/B,GAAG,EAAE,kBAAkB,KACpB,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,OAAO,EAAE,CAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;QAAE,QAAQ,CAAC,aAAa,EAAE,kBAAkB,CAAA;KAAE,KACpD,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACtE,QAAQ,CAAC,MAAM,EAAE,CACf,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,cAAc,KACrB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IACrC,QAAQ,CAAC,cAAc,E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IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACtE,QAAQ,CAAC,MAAM,EAAE,CACf,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,cAAc,KACrB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IACrC,QAAQ,CAAC,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAChD,CAAC;AAwCF,eAAO,MAAM,qBAAqB,GAChC,QAAQ,qBAAqB,KAC5B,eAiBF,CAAC;AAMF,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAElB,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@executor-js/execution",
3
- "version": "0.0.1-beta.0",
3
+ "version": "0.0.1-beta.1",
4
4
  "homepage": "https://github.com/RhysSullivan/executor/tree/main/packages/core/execution",
5
5
  "bugs": {
6
6
  "url": "https://github.com/RhysSullivan/executor/issues"