executor 1.2.4-beta.5 → 1.2.4-beta.7

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/bin/executor.mjs CHANGED
@@ -357330,6 +357330,32 @@ var hasSubstringMatch = (value7, queryToken) => {
357330
357330
  return singular !== queryToken && value7.includes(singular);
357331
357331
  };
357332
357332
  var queryTokenWeight = (token) => LOW_SIGNAL_QUERY_TOKENS.has(token) ? 0.25 : 1;
357333
+ var namespaceFromPath2 = (path4) => {
357334
+ const [first3, second] = path4.split(".");
357335
+ return second ? `${first3}.${second}` : first3;
357336
+ };
357337
+ var sortNamespaces = (namespaces) => [...namespaces].sort((left3, right3) => left3.namespace.localeCompare(right3.namespace));
357338
+ var loadWorkspaceCatalogNamespaces = (input) => gen2(function* () {
357339
+ const catalogs = yield* input.sourceCatalogStore.loadWorkspaceSourceCatalogs({
357340
+ scopeId: input.scopeId,
357341
+ actorScopeId: input.actorScopeId
357342
+ });
357343
+ const namespaces = new Map;
357344
+ for (const catalog6 of catalogs) {
357345
+ if (!catalog6.source.enabled || catalog6.source.status !== "connected") {
357346
+ continue;
357347
+ }
357348
+ for (const descriptor2 of Object.values(catalog6.projected.toolDescriptors)) {
357349
+ const namespace = namespaceFromPath2(descriptor2.toolPath.join("."));
357350
+ const existing = namespaces.get(namespace);
357351
+ namespaces.set(namespace, {
357352
+ namespace,
357353
+ toolCount: (existing?.toolCount ?? 0) + 1
357354
+ });
357355
+ }
357356
+ }
357357
+ return sortNamespaces(namespaces.values());
357358
+ });
357333
357359
  var loadWorkspaceCatalogTools = (input) => map16(input.sourceCatalogStore.loadWorkspaceSourceCatalogToolIndex({
357334
357360
  scopeId: input.scopeId,
357335
357361
  actorScopeId: input.actorScopeId,
@@ -357450,7 +357476,11 @@ var createScopeSourceCatalog = (input) => {
357450
357476
  });
357451
357477
  }));
357452
357478
  return {
357453
- listNamespaces: ({ limit }) => provideRuntimeLocalScope(flatMap10(createSharedCatalog(false), (catalog6) => catalog6.listNamespaces({ limit })), input.runtimeLocalScope),
357479
+ listNamespaces: ({ limit }) => provideRuntimeLocalScope(provideWorkspaceStorage(map16(loadWorkspaceCatalogNamespaces({
357480
+ scopeId: input.scopeId,
357481
+ actorScopeId: input.actorScopeId,
357482
+ sourceCatalogStore: input.sourceCatalogStore
357483
+ }), (namespaces) => namespaces.slice(0, limit))), input.runtimeLocalScope),
357454
357484
  listTools: ({ namespace, query, limit, includeSchemas = false }) => provideRuntimeLocalScope(flatMap10(createSharedCatalog(includeSchemas), (catalog6) => catalog6.listTools({
357455
357485
  ...namespace !== undefined ? { namespace } : {},
357456
357486
  ...query !== undefined ? { query } : {},
@@ -368329,11 +368359,15 @@ var supportsManagedElicitation = (server2) => {
368329
368359
  return Boolean(capabilities?.elicitation?.form) && Boolean(capabilities?.elicitation?.url);
368330
368360
  };
368331
368361
  var interactionModeForServer = (server2) => supportsManagedElicitation(server2) ? "live_form" : "detach";
368332
- var buildExecuteWorkflowText = (namespaces = []) => [
368362
+ var executeDescriptionToolsPerSource = 5;
368363
+ var buildExecuteWorkflowText = (sourceToolExamples = []) => [
368333
368364
  "Execute TypeScript in sandbox; call tools via discovery workflow.",
368334
- ...namespaces.length > 0 ? [
368335
- "Available namespaces:",
368336
- ...namespaces.map((namespace) => `- ${namespace}`)
368365
+ ...sourceToolExamples.length > 0 ? [
368366
+ "Available source tool examples:",
368367
+ ...sourceToolExamples.flatMap((source2) => [
368368
+ `${source2.sourceName}:`,
368369
+ ...source2.toolPaths.map((toolPath) => `- ${toolPath}`)
368370
+ ])
368337
368371
  ] : [],
368338
368372
  "Workflow:",
368339
368373
  '1) const matches = await tools.discover({ query: "<intent>", limit: 12 });',
@@ -368347,18 +368381,19 @@ var buildExecuteWorkflowText = (namespaces = []) => [
368347
368381
  `);
368348
368382
  var defaultExecuteDescription = buildExecuteWorkflowText();
368349
368383
  var loadExecuteDescription = (runtime6) => runControlPlane(runtime6, gen2(function* () {
368350
- const resolveExecutionEnvironment = yield* RuntimeExecutionResolverService;
368351
- const environment3 = yield* resolveExecutionEnvironment({
368384
+ const sourceCatalogStore = yield* RuntimeSourceCatalogStoreService;
368385
+ const catalogs = yield* sourceCatalogStore.loadWorkspaceSourceCatalogs({
368352
368386
  scopeId: runtime6.localInstallation.scopeId,
368353
- actorScopeId: runtime6.localInstallation.actorScopeId,
368354
- executionId: ExecutionIdSchema.make("exec_mcp_help")
368387
+ actorScopeId: runtime6.localInstallation.actorScopeId
368355
368388
  });
368356
- const catalog6 = environment3.catalog;
368357
- if (!catalog6) {
368389
+ const sourceToolExamples = catalogs.filter((catalog6) => catalog6.source.enabled && catalog6.source.status === "connected").map((catalog6) => ({
368390
+ sourceName: catalog6.source.name,
368391
+ toolPaths: Object.values(catalog6.projected.toolDescriptors).map((descriptor2) => descriptor2.toolPath.join(".")).filter((toolPath) => toolPath.length > 0).sort((left3, right3) => left3.localeCompare(right3)).slice(0, executeDescriptionToolsPerSource)
368392
+ })).filter((catalog6) => catalog6.toolPaths.length > 0);
368393
+ if (sourceToolExamples.length === 0) {
368358
368394
  return defaultExecuteDescription;
368359
368395
  }
368360
- const namespaces = yield* catalog6.listNamespaces({ limit: 200 }).pipe(map16((items) => items.length > 0 ? items.map((item) => item.displayName ?? item.namespace) : ["none discovered yet"]), catchAll2(() => succeed8(["none discovered yet"])));
368361
- return buildExecuteWorkflowText(namespaces);
368396
+ return buildExecuteWorkflowText(sourceToolExamples);
368362
368397
  }).pipe(catchAll2(() => succeed8(defaultExecuteDescription))));
368363
368398
  var summarizeExecution = (execution2) => {
368364
368399
  switch (execution2.status) {
@@ -370351,7 +370386,6 @@ var waitForReachability = (baseUrl2, expected) => gen2(function* () {
370351
370386
  }
370352
370387
  return yield* failReachabilityTimeout({ baseUrl: baseUrl2, expected });
370353
370388
  });
370354
- var renderDenoSandboxDetail = (denoVersion) => denoVersion !== null ? `deno ${denoVersion}` : "deno not found (run `executor sandbox` to install)";
370355
370389
  var getServerStatus = (baseUrl2) => gen2(function* () {
370356
370390
  const pidRecord = yield* readPidRecord();
370357
370391
  const reachable = yield* isServerReachable(baseUrl2);
@@ -370362,7 +370396,6 @@ var getServerStatus = (baseUrl2) => gen2(function* () {
370362
370396
  const pid = typeof pidRecord?.pid === "number" ? pidRecord.pid : null;
370363
370397
  const pidRunning = pid !== null ? isPidRunning(pid) : false;
370364
370398
  const logFile = pidRecord?.logFile ?? DEFAULT_SERVER_LOG_FILE;
370365
- const denoVersion = yield* getDenoVersion();
370366
370399
  return {
370367
370400
  baseUrl: baseUrl2,
370368
370401
  reachable,
@@ -370372,8 +370405,7 @@ var getServerStatus = (baseUrl2) => gen2(function* () {
370372
370405
  logFile,
370373
370406
  localDataDir: DEFAULT_LOCAL_DATA_DIR,
370374
370407
  webAssetsDir: resolveRuntimeWebAssetsDir(),
370375
- installation,
370376
- denoVersion
370408
+ installation
370377
370409
  };
370378
370410
  });
370379
370411
  var renderStatus = (status2) => [
@@ -370385,8 +370417,21 @@ var renderStatus = (status2) => [
370385
370417
  `logFile: ${status2.logFile}`,
370386
370418
  `localDataDir: ${status2.localDataDir}`,
370387
370419
  `webAssetsDir: ${status2.webAssetsDir ?? "missing"}`,
370388
- `workspaceId: ${status2.installation?.workspaceId ?? "unavailable"}`,
370389
- `denoSandbox: ${renderDenoSandboxDetail(status2.denoVersion)}`
370420
+ `workspaceId: ${status2.installation?.workspaceId ?? "unavailable"}`
370421
+ ].join(`
370422
+ `);
370423
+ var appendUrlPath = (baseUrl2, pathname) => new URL(pathname, baseUrl2.endsWith("/") ? baseUrl2 : `${baseUrl2}/`).toString();
370424
+ var renderUpSummary = (input) => [
370425
+ input.started ? "Executor is ready." : "Executor is already running.",
370426
+ `API: ${input.status.baseUrl}`,
370427
+ `MCP: ${appendUrlPath(input.status.baseUrl, "mcp")}`,
370428
+ `OpenAPI: ${appendUrlPath(input.status.baseUrl, "v1/openapi.json")}`,
370429
+ `Workspace: ${input.status.installation?.workspaceId ?? "unavailable"}`,
370430
+ "",
370431
+ "Try next:",
370432
+ ` ${CLI_NAME} call 'return 1 + 1'`,
370433
+ ` ${CLI_NAME} status`,
370434
+ ` ${CLI_NAME} down`
370390
370435
  ].join(`
370391
370436
  `);
370392
370437
  var getDoctorReport = (baseUrl2) => getServerStatus(baseUrl2).pipe(map16((status2) => {
@@ -370414,10 +370459,6 @@ var getDoctorReport = (baseUrl2) => getServerStatus(baseUrl2).pipe(map16((status
370414
370459
  installation: {
370415
370460
  ok: status2.installation !== null,
370416
370461
  detail: status2.installation ? `workspace ${status2.installation.workspaceId}` : "local installation unavailable"
370417
- },
370418
- denoSandbox: {
370419
- ok: status2.denoVersion !== null,
370420
- detail: renderDenoSandboxDetail(status2.denoVersion)
370421
370462
  }
370422
370463
  };
370423
370464
  return {
@@ -370456,12 +370497,17 @@ var stopServer = (baseUrl2) => gen2(function* () {
370456
370497
  var ensureServer = (baseUrl2 = DEFAULT_SERVER_BASE_URL) => gen2(function* () {
370457
370498
  const reachable = yield* isServerReachable(baseUrl2);
370458
370499
  if (reachable) {
370459
- return;
370500
+ return {
370501
+ started: false
370502
+ };
370460
370503
  }
370461
370504
  const url3 = new URL(baseUrl2);
370462
370505
  const port2 = Number(url3.port || DEFAULT_SERVER_PORT);
370463
370506
  yield* startServerInBackground(port2);
370464
370507
  yield* waitForReachability(baseUrl2, true);
370508
+ return {
370509
+ started: true
370510
+ };
370465
370511
  });
370466
370512
  var isRecord9 = (value7) => typeof value7 === "object" && value7 !== null && !Array.isArray(value7);
370467
370513
  var getPromptFields = (requestedSchema) => {
@@ -370769,7 +370815,7 @@ var serverStartCommand = exports_Command2.make("start", {
370769
370815
  var serverCommand = exports_Command2.make("server").pipe(exports_Command2.withSubcommands([serverStartCommand]), exports_Command2.withDescription("Local server commands"));
370770
370816
  var upCommand = exports_Command2.make("up", {
370771
370817
  baseUrl: exports_Options.text("base-url").pipe(exports_Options.withDefault(DEFAULT_SERVER_BASE_URL))
370772
- }, ({ baseUrl: baseUrl2 }) => ensureServer(baseUrl2).pipe(zipRight3(getServerStatus(baseUrl2)), flatMap10((status2) => printText(renderStatus(status2))))).pipe(exports_Command2.withDescription("Ensure the local executor server is running"));
370818
+ }, ({ baseUrl: baseUrl2 }) => ensureServer(baseUrl2).pipe(flatMap10(({ started }) => getServerStatus(baseUrl2).pipe(flatMap10((status2) => printText(renderUpSummary({ started, status: status2 }))))))).pipe(exports_Command2.withDescription("Start the local executor server if needed and show how to use it"));
370773
370819
  var downCommand = exports_Command2.make("down", {
370774
370820
  baseUrl: exports_Options.text("base-url").pipe(exports_Options.withDefault(DEFAULT_SERVER_BASE_URL))
370775
370821
  }, ({ baseUrl: baseUrl2 }) => stopServer(baseUrl2).pipe(flatMap10((stopped) => printText(stopped ? "Stopped local executor server." : "Local executor server is not running.")))).pipe(exports_Command2.withDescription("Stop the local executor server"));
@@ -370785,55 +370831,6 @@ var doctorCommand = exports_Command2.make("doctor", {
370785
370831
  ...Object.entries(report.checks).map(([name, check3]) => `${name}: ${check3.ok ? "ok" : "fail"} - ${check3.detail}`)
370786
370832
  ].join(`
370787
370833
  `))))).pipe(exports_Command2.withDescription("Check local executor install and daemon health"));
370788
- var getDenoVersion = () => gen2(function* () {
370789
- const fs3 = yield* exports_FileSystem.FileSystem;
370790
- const configuredDenoExecutable = process.env.DENO_BIN?.trim();
370791
- const bundledDenoExecutable = process.env.HOME?.trim() ? `${process.env.HOME.trim()}/.deno/bin/deno` : null;
370792
- const bundledDenoExists = bundledDenoExecutable === null ? false : yield* fs3.exists(bundledDenoExecutable).pipe(catchAll2(() => succeed8(false)));
370793
- const denoExecutable = configuredDenoExecutable || (bundledDenoExists ? bundledDenoExecutable : null) || "deno";
370794
- return yield* tryPromise2({
370795
- try: () => new Promise((resolveVersion) => {
370796
- const child = spawn4(denoExecutable, ["--version"], {
370797
- stdio: ["ignore", "pipe", "ignore"],
370798
- timeout: 5000
370799
- });
370800
- let stdout = "";
370801
- child.stdout?.setEncoding("utf8");
370802
- child.stdout?.on("data", (chunk4) => {
370803
- stdout += chunk4;
370804
- });
370805
- child.once("error", () => resolveVersion(null));
370806
- child.once("close", (code2) => {
370807
- if (code2 !== 0) {
370808
- resolveVersion(null);
370809
- return;
370810
- }
370811
- const match18 = /deno\s+(\S+)/i.exec(stdout);
370812
- resolveVersion(match18 ? match18[1] : null);
370813
- });
370814
- }),
370815
- catch: () => null
370816
- }).pipe(catchAll2(() => succeed8(null)));
370817
- }).pipe(catchAll2(() => succeed8(null)));
370818
- var sandboxCommand = exports_Command2.make("sandbox", {}, () => gen2(function* () {
370819
- const version2 = yield* getDenoVersion();
370820
- if (version2 !== null) {
370821
- yield* printText(`Deno sandbox is ready (deno ${version2}).`);
370822
- return;
370823
- }
370824
- yield* printText([
370825
- "Deno is not installed.",
370826
- "",
370827
- "The executor sandbox requires Deno to run code in a secure, isolated subprocess.",
370828
- "",
370829
- "Install Deno:",
370830
- " curl -fsSL https://deno.land/install.sh | sh",
370831
- "",
370832
- "Or see: https://docs.deno.com/runtime/getting_started/installation/"
370833
- ].join(`
370834
- `));
370835
- process.exitCode = 1;
370836
- })).pipe(exports_Command2.withDescription("Check whether the Deno sandbox runtime is available"));
370837
370834
  var callCommand = exports_Command2.make("call", {
370838
370835
  code: exports_Args.text({ name: "code" }).pipe(exports_Args.withDescription("Inline code to execute."), exports_Args.optional),
370839
370836
  file: exports_Options.text("file").pipe(exports_Options.optional),
@@ -370922,7 +370919,6 @@ var root = exports_Command2.make("executor").pipe(exports_Command2.withSubcomman
370922
370919
  downCommand,
370923
370920
  statusCommand,
370924
370921
  doctorCommand,
370925
- sandboxCommand,
370926
370922
  callCommand,
370927
370923
  resumeCommand,
370928
370924
  devCommand
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "executor",
3
- "version": "1.2.4-beta.5",
3
+ "version": "1.2.4-beta.7",
4
4
  "description": "Local AI executor with a CLI, local API server, and web UI.",
5
5
  "keywords": [
6
6
  "executor",
@@ -1 +1 @@
1
- import{r,R as c,M as p,B as x}from"./mermaid-O7DHMXV3-C-YmyPuX.js";import{j as d}from"./index-CRuElBS1.js";var R=({code:i,language:e,raw:t,className:g,startLine:u,...m})=>{let{shikiTheme:o}=r.useContext(c),a=p(),[n,s]=r.useState(t);return r.useEffect(()=>{if(!a){s(t);return}let l=a.highlight({code:i,language:e,themes:o},h=>{s(h)});l&&s(l)},[i,e,o,a,t]),d.jsx(x,{className:g,language:e,result:n,startLine:u,...m})};export{R as HighlightedCodeBlockBody};
1
+ import{r,R as c,M as p,B as x}from"./mermaid-O7DHMXV3-d5ePT8Z-.js";import{j as d}from"./index-CRuElBS1.js";var R=({code:i,language:e,raw:t,className:g,startLine:u,...m})=>{let{shikiTheme:o}=r.useContext(c),a=p(),[n,s]=r.useState(t);return r.useEffect(()=>{if(!a){s(t);return}let l=a.highlight({code:i,language:e,themes:o},h=>{s(h)});l&&s(l)},[i,e,o,a,t]),d.jsx(x,{className:g,language:e,result:n,startLine:u,...m})};export{R as HighlightedCodeBlockBody};