@executor-js/sdk 0.2.0 → 0.2.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.
@@ -3125,10 +3125,26 @@ var staticDeclToTool = (source, tool, pluginId) => ({
3125
3125
  pluginId,
3126
3126
  name: tool.name,
3127
3127
  description: tool.description,
3128
- inputSchema: tool.inputSchema,
3129
- outputSchema: tool.outputSchema,
3128
+ inputSchema: toToolJsonSchema(tool.inputSchema),
3129
+ outputSchema: toToolJsonSchema(tool.outputSchema, "output"),
3130
3130
  annotations: tool.annotations
3131
3131
  });
3132
+ var toToolJsonSchema = (schema, direction = "input") => {
3133
+ if (schema == null) return void 0;
3134
+ return schema["~standard"].jsonSchema[direction]({
3135
+ target: "draft-2020-12"
3136
+ });
3137
+ };
3138
+ var EXECUTOR_SOURCE_ID = "executor";
3139
+ var EXECUTOR_SOURCE = {
3140
+ id: EXECUTOR_SOURCE_ID,
3141
+ kind: "built-in",
3142
+ name: "Executor",
3143
+ canRemove: false,
3144
+ canRefresh: false,
3145
+ canEdit: false,
3146
+ tools: []
3147
+ };
3132
3148
  var writeSourceInput = (core, pluginId, input) => Effect12.gen(function* () {
3133
3149
  yield* deleteSourceById(core, input.id, input.scope);
3134
3150
  const now = /* @__PURE__ */ new Date();
@@ -4700,15 +4716,30 @@ var createExecutor = (config) => Effect12.gen(function* () {
4700
4716
  }
4701
4717
  const decls = plugin.staticSources ? plugin.staticSources(extension) : [];
4702
4718
  for (const source of decls) {
4703
- if (staticSources.has(source.id)) {
4704
- return yield* new StorageError3({
4705
- message: `Duplicate static source id: ${source.id} (plugin ${plugin.id})`,
4706
- cause: void 0
4707
- });
4719
+ const mountUnderExecutor = source.kind === "executor" && source.id === plugin.id;
4720
+ const mountedSource = mountUnderExecutor ? EXECUTOR_SOURCE : source;
4721
+ if (mountUnderExecutor) {
4722
+ if (!staticSources.has(EXECUTOR_SOURCE_ID)) {
4723
+ staticSources.set(EXECUTOR_SOURCE_ID, {
4724
+ source: EXECUTOR_SOURCE,
4725
+ pluginId: EXECUTOR_SOURCE_ID
4726
+ });
4727
+ }
4728
+ } else {
4729
+ if (staticSources.has(source.id)) {
4730
+ return yield* new StorageError3({
4731
+ message: `Duplicate static source id: ${source.id} (plugin ${plugin.id})`,
4732
+ cause: void 0
4733
+ });
4734
+ }
4735
+ staticSources.set(source.id, { source, pluginId: plugin.id });
4708
4736
  }
4709
- staticSources.set(source.id, { source, pluginId: plugin.id });
4710
4737
  for (const tool of source.tools) {
4711
- const fqid = `${source.id}.${tool.name}`;
4738
+ const mountedTool = mountUnderExecutor ? {
4739
+ ...tool,
4740
+ name: `${plugin.id}.${tool.name}`
4741
+ } : tool;
4742
+ const fqid = `${mountedSource.id}.${mountedTool.name}`;
4712
4743
  if (staticTools.has(fqid)) {
4713
4744
  return yield* new StorageError3({
4714
4745
  message: `Duplicate static tool id: ${fqid} (plugin ${plugin.id})`,
@@ -4716,8 +4747,8 @@ var createExecutor = (config) => Effect12.gen(function* () {
4716
4747
  });
4717
4748
  }
4718
4749
  staticTools.set(fqid, {
4719
- source,
4720
- tool,
4750
+ source: mountedSource,
4751
+ tool: mountedTool,
4721
4752
  pluginId: plugin.id,
4722
4753
  ctx
4723
4754
  });
@@ -4928,8 +4959,8 @@ var createExecutor = (config) => Effect12.gen(function* () {
4928
4959
  name: staticEntry.tool.name,
4929
4960
  description: staticEntry.tool.description,
4930
4961
  sourceId: void 0,
4931
- rawInput: staticEntry.tool.inputSchema,
4932
- rawOutput: staticEntry.tool.outputSchema
4962
+ rawInput: toToolJsonSchema(staticEntry.tool.inputSchema),
4963
+ rawOutput: toToolJsonSchema(staticEntry.tool.outputSchema, "output")
4933
4964
  });
4934
4965
  }
4935
4966
  const rows = yield* core.findMany({
@@ -5529,4 +5560,4 @@ export {
5529
5560
  createExecutor,
5530
5561
  Scope
5531
5562
  };
5532
- //# sourceMappingURL=chunk-VLVPSIQ4.js.map
5563
+ //# sourceMappingURL=chunk-NPWV4R3N.js.map