@stackables/bridge 1.2.0 → 1.4.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.
Files changed (40) hide show
  1. package/build/{ExecutionTree.d.ts → src/ExecutionTree.d.ts} +1 -0
  2. package/build/src/ExecutionTree.d.ts.map +1 -0
  3. package/build/{ExecutionTree.js → src/ExecutionTree.js} +12 -2
  4. package/build/{bridge-format.d.ts → src/bridge-format.d.ts} +1 -10
  5. package/build/src/bridge-format.d.ts.map +1 -0
  6. package/build/{bridge-format.js → src/bridge-format.js} +680 -220
  7. package/build/{bridge-transform.d.ts → src/bridge-transform.d.ts} +1 -0
  8. package/build/src/bridge-transform.d.ts.map +1 -0
  9. package/build/{index.d.ts → src/index.d.ts} +1 -0
  10. package/build/src/index.d.ts.map +1 -0
  11. package/build/{tools → src/tools}/find-object.d.ts +1 -0
  12. package/build/src/tools/find-object.d.ts.map +1 -0
  13. package/build/{tools → src/tools}/http-call.d.ts +1 -0
  14. package/build/src/tools/http-call.d.ts.map +1 -0
  15. package/build/{tools → src/tools}/index.d.ts +1 -0
  16. package/build/src/tools/index.d.ts.map +1 -0
  17. package/build/{tools → src/tools}/lower-case.d.ts +1 -0
  18. package/build/src/tools/lower-case.d.ts.map +1 -0
  19. package/build/{tools → src/tools}/pick-first.d.ts +1 -0
  20. package/build/src/tools/pick-first.d.ts.map +1 -0
  21. package/build/{tools → src/tools}/to-array.d.ts +1 -0
  22. package/build/src/tools/to-array.d.ts.map +1 -0
  23. package/build/{tools → src/tools}/upper-case.d.ts +1 -0
  24. package/build/src/tools/upper-case.d.ts.map +1 -0
  25. package/build/{types.d.ts → src/types.d.ts} +49 -1
  26. package/build/src/types.d.ts.map +1 -0
  27. package/build/tsconfig.tsbuildinfo +1 -0
  28. package/package.json +9 -6
  29. package/LICENSE +0 -21
  30. package/README.md +0 -361
  31. /package/build/{bridge-transform.js → src/bridge-transform.js} +0 -0
  32. /package/build/{index.js → src/index.js} +0 -0
  33. /package/build/{tools → src/tools}/find-object.js +0 -0
  34. /package/build/{tools → src/tools}/http-call.js +0 -0
  35. /package/build/{tools → src/tools}/index.js +0 -0
  36. /package/build/{tools → src/tools}/lower-case.js +0 -0
  37. /package/build/{tools → src/tools}/pick-first.js +0 -0
  38. /package/build/{tools → src/tools}/to-array.js +0 -0
  39. /package/build/{tools → src/tools}/upper-case.js +0 -0
  40. /package/build/{types.js → src/types.js} +0 -0
@@ -50,3 +50,4 @@ export declare class ExecutionTree {
50
50
  response(ipath: Path, array: boolean): Promise<any>;
51
51
  }
52
52
  export {};
53
+ //# sourceMappingURL=ExecutionTree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExecutionTree.d.ts","sourceRoot":"","sources":["../../src/ExecutionTree.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,MAAM,EAEN,WAAW,EACX,OAAO,EAGP,OAAO,EAER,MAAM,YAAY,CAAC;AAGpB,gFAAgF;AAChF,UAAU,IAAI;IACZ,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAED,KAAK,KAAK,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAsChF,qBAAa,aAAa;IAQf,KAAK,EAAE,KAAK;IACnB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,OAAO,CAAC;IAChB,OAAO,CAAC,OAAO,CAAC;IAChB,OAAO,CAAC,MAAM,CAAC;IAXjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAChC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,CAAC,YAAY,CAAwC;IAC5D,OAAO,CAAC,YAAY,CAA0C;IAC9D,OAAO,CAAC,aAAa,CAAsE;gBAGlF,KAAK,EAAE,KAAK,EACX,YAAY,EAAE,WAAW,EAAE,EAC3B,OAAO,CAAC,EAAE,OAAO,YAAA,EACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAAA,EAC7B,MAAM,CAAC,EAAE,aAAa,YAAA;IA8BhC,oCAAoC;IACpC,OAAO,CAAC,WAAW;IAKnB;uGACmG;IACnG,OAAO,CAAC,YAAY;IAsBpB,oEAAoE;IACpE,OAAO,CAAC,oBAAoB;IA8D5B,mEAAmE;YACrD,gBAAgB;IA0B9B,2EAA2E;YAC7D,iBAAiB;IAgC/B,kDAAkD;IAClD,OAAO,CAAC,cAAc;IAgCtB,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,GAAG;IAmF5B,MAAM,IAAI,aAAa;YAUT,UAAU;IA4BlB,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAqCzC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAI9B,6DAA6D;IAC7D,aAAa,IAAI,IAAI;IAqBrB;;oFAEgF;IAChF,OAAO,CAAC,YAAY;IA8Cd,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;CAsD1D"}
@@ -264,7 +264,12 @@ export class ExecutionTree {
264
264
  return [w.to.path, value];
265
265
  }));
266
266
  for (const [path, value] of resolved) {
267
- setNested(input, path, value);
267
+ if (path.length === 0 && value != null && typeof value === "object") {
268
+ Object.assign(input, value);
269
+ }
270
+ else {
271
+ setNested(input, path, value);
272
+ }
268
273
  }
269
274
  // Call ToolDef-backed tool function
270
275
  if (toolDef) {
@@ -289,6 +294,11 @@ export class ExecutionTree {
289
294
  if (directFn) {
290
295
  return directFn(input);
291
296
  }
297
+ // Define pass-through: synthetic trunks created by define inlining
298
+ // act as data containers — bridge wires set their values, no tool needed.
299
+ if (target.module.startsWith("__define_")) {
300
+ return input;
301
+ }
292
302
  throw new Error(`No tool found for "${toolName}"`);
293
303
  })();
294
304
  }
@@ -432,7 +442,7 @@ export class ExecutionTree {
432
442
  // Strip numeric indices (array positions) from path for wire matching
433
443
  const cleanPath = pathSegments.filter((p) => !/^\d+$/.test(p));
434
444
  // Find wires whose target matches this trunk + path
435
- const matches = this.bridge?.wires.filter((w) => !w.to.element &&
445
+ const matches = this.bridge?.wires.filter((w) => (w.to.element ? !!this.parent : true) &&
436
446
  sameTrunk(w.to, this.trunk) &&
437
447
  pathEquals(w.to.path, cleanPath)) ?? [];
438
448
  if (matches.length > 0) {
@@ -1,14 +1,4 @@
1
1
  import type { Instruction } from "./types.js";
2
- /**
3
- * Parse .bridge text format into structured instructions.
4
- *
5
- * The .bridge format is a human-readable representation of connection wires.
6
- * Multiple blocks are separated by `---`.
7
- * Tool blocks define API tools, bridge blocks define wire mappings.
8
- *
9
- * @param text - Bridge definition text
10
- * @returns Array of instructions (Bridge, ToolDef)
11
- */
12
2
  export declare function parseBridge(text: string): Instruction[];
13
3
  /**
14
4
  * Parse a dot-separated path with optional array indices.
@@ -22,3 +12,4 @@ export declare function parsePath(text: string): string[];
22
12
  * Serialize structured instructions back to .bridge text format.
23
13
  */
24
14
  export declare function serializeBridge(instructions: Instruction[]): string;
15
+ //# sourceMappingURL=bridge-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge-format.d.ts","sourceRoot":"","sources":["../../src/bridge-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKR,WAAW,EAMd,MAAM,YAAY,CAAC;AA8CpB,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CA0FvD;AAqwCD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAchD;AAID;;GAEG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,CA8BnE"}