@opengeni/ogtool 6.8.0 → 6.9.1-canary.41937124785001

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.
Files changed (2) hide show
  1. package/dist/bin/ogtool.cjs +39 -35
  2. package/package.json +5 -4
@@ -5240,14 +5240,6 @@ class ToolGatewayCatalogTooLargeError extends Error {
5240
5240
  }
5241
5241
  }
5242
5242
 
5243
- class ToolGatewayPathCollisionError extends Error {
5244
- code = "tool_path_collision";
5245
- constructor(path, kind) {
5246
- super(kind === "extends_leaf" ? `Tool path ${path.join(".")} extends a tool leaf` : `Tool path ${path.join(".")} collides`);
5247
- this.name = "ToolGatewayPathCollisionError";
5248
- }
5249
- }
5250
-
5251
5243
  // ../tool-gateway/src/catalog.ts
5252
5244
  function digestCanonicalJson(value) {
5253
5245
  return import_node_crypto.createHash("sha256").update(JSON.stringify(canonicalJsonValue(value)), "utf8").digest("hex");
@@ -5312,24 +5304,26 @@ function namespaceNode() {
5312
5304
  return { children: new Map, entry: null };
5313
5305
  }
5314
5306
  function insertEntry(root, entry) {
5307
+ let probe = root;
5308
+ for (const segment of entry.codemodePath) {
5309
+ if (probe.entry)
5310
+ return;
5311
+ probe = probe.children.get(segment);
5312
+ if (!probe)
5313
+ break;
5314
+ }
5315
+ if (probe && (probe.entry || probe.children.size > 0))
5316
+ return;
5315
5317
  let node = root;
5316
- for (const [index, segment] of entry.codemodePath.entries()) {
5317
- if (node.entry) {
5318
- throw new ToolGatewayPathCollisionError(entry.codemodePath, "extends_leaf");
5319
- }
5318
+ for (const segment of entry.codemodePath) {
5320
5319
  let child = node.children.get(segment);
5321
5320
  if (!child) {
5322
5321
  child = namespaceNode();
5323
5322
  node.children.set(segment, child);
5324
5323
  }
5325
5324
  node = child;
5326
- if (index === entry.codemodePath.length - 1) {
5327
- if (node.entry || node.children.size > 0) {
5328
- throw new ToolGatewayPathCollisionError(entry.codemodePath, "collision");
5329
- }
5330
- node.entry = entry;
5331
- }
5332
5325
  }
5326
+ node.entry = entry;
5333
5327
  }
5334
5328
  function renderChildren(node, indent, options) {
5335
5329
  const lines = [];
@@ -5933,23 +5927,32 @@ function assertRecoveredCodemodeOperation(operation, expected) {
5933
5927
  function compileCodemodeTools(catalog, client) {
5934
5928
  const verified = parseVerifiedAttemptToolCatalog(catalog);
5935
5929
  const root = Object.create(null);
5936
- for (const entry of verified.entries) {
5937
- let cursor = root;
5938
- for (const segment of entry.codemodePath.slice(0, -1)) {
5939
- let existing = cursor[segment];
5940
- if (typeof existing === "function")
5941
- throw new Error("Codemode path collides with a tool");
5942
- if (!existing) {
5943
- existing = Object.create(null);
5944
- cursor[segment] = existing;
5930
+ entries:
5931
+ for (const entry of verified.entries) {
5932
+ let probe = root;
5933
+ for (const segment of entry.codemodePath) {
5934
+ if (typeof probe === "function")
5935
+ continue entries;
5936
+ probe = probe[segment];
5937
+ if (probe === undefined)
5938
+ break;
5939
+ }
5940
+ if (probe !== undefined)
5941
+ continue;
5942
+ let cursor = root;
5943
+ for (const segment of entry.codemodePath.slice(0, -1)) {
5944
+ let existing = cursor[segment];
5945
+ if (!existing) {
5946
+ existing = Object.create(null);
5947
+ cursor[segment] = existing;
5948
+ }
5949
+ cursor = existing;
5945
5950
  }
5946
- cursor = existing;
5951
+ const leaf = entry.codemodePath.at(-1);
5952
+ const invoke = async (args = {}, options = {}) => await client.callPathValue(entry.codemodePath, args, options);
5953
+ Object.defineProperty(invoke, "entry", { value: entry, enumerable: false });
5954
+ cursor[leaf] = invoke;
5947
5955
  }
5948
- const leaf = entry.codemodePath.at(-1);
5949
- const invoke = async (args = {}, options = {}) => await client.callPathValue(entry.codemodePath, args, options);
5950
- Object.defineProperty(invoke, "entry", { value: entry, enumerable: false });
5951
- cursor[leaf] = invoke;
5952
- }
5953
5956
  return root;
5954
5957
  }
5955
5958
  function digestAttemptToolCatalog(catalog) {
@@ -6060,7 +6063,7 @@ async function abortableDelay(delayMs, signal) {
6060
6063
  // package.json
6061
6064
  var package_default = {
6062
6065
  name: "@opengeni/ogtool",
6063
- version: "6.8.0",
6066
+ version: "6.9.1-canary.41937124785001",
6064
6067
  description: "Codemode CLI and typed client entrypoint for an Opengeni execution attempt.",
6065
6068
  license: "Apache-2.0",
6066
6069
  repository: {
@@ -6106,7 +6109,8 @@ var package_default = {
6106
6109
  },
6107
6110
  engines: {
6108
6111
  node: ">=18"
6109
- }
6112
+ },
6113
+ gitHead: "1520118f9f68a6aa9ad7f092a6a2277570a0e0d7"
6110
6114
  };
6111
6115
 
6112
6116
  // src/catalog-discovery.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/ogtool",
3
- "version": "6.8.0",
3
+ "version": "6.9.1-canary.41937124785001",
4
4
  "description": "Codemode CLI and typed client entrypoint for an Opengeni execution attempt.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -37,10 +37,11 @@
37
37
  "prepublishOnly": "bash ../../scripts/prepublish-guard"
38
38
  },
39
39
  "dependencies": {
40
- "@opengeni/codemode": "6.8.0",
41
- "@opengeni/contracts": "6.8.0"
40
+ "@opengeni/codemode": "6.9.1-canary.41937124785001",
41
+ "@opengeni/contracts": "6.9.1-canary.41937124785001"
42
42
  },
43
43
  "engines": {
44
44
  "node": ">=18"
45
- }
45
+ },
46
+ "gitHead": "1520118f9f68a6aa9ad7f092a6a2277570a0e0d7"
46
47
  }