@jigging/jig 0.1.0-alpha.10 → 0.1.0-alpha.12

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/README.md CHANGED
@@ -7,8 +7,12 @@ has one finite command surface:
7
7
  jig init --bare <directory>
8
8
  jig review [project] [--yes]
9
9
  jig run <flow:path|binding:id> [--input JSON] [--timeout DURATION]
10
+ jig --version
10
11
  ```
11
12
 
13
+ `jig --version` prints the built package version without opening a project or
14
+ acquiring a sandbox.
15
+
12
16
  There is no `jig setup`. `review` and `run` transparently acquire the rootless
13
17
  authority they need or fail closed.
14
18
 
@@ -33,14 +37,24 @@ independently validated; Jig fails closed when a required capability is absent.
33
37
  The alpha requires:
34
38
 
35
39
  - Linux x86_64 with glibc 2.17 or newer and an SSE4.2-capable baseline CPU;
36
- - Bubblewrap 0.12 or newer at `/usr/bin/bwrap`;
37
- - GNU `readlink -f` at `/usr/bin/readlink` or `/bin/readlink`;
40
+ - Bubblewrap 0.12 or newer and GNU `readlink -f`, located as described below;
38
41
  - cgroup v2 with delegated `cpu`, `memory`, and `pids` controllers;
39
42
  - a systemd user manager with transient delegated scopes; and
40
43
  - unprivileged user, mount, PID, network, IPC, UTS, and cgroup namespaces.
41
44
 
42
45
  The glibc and SSE4.2 floors come from the selected Bun baseline runtime.
43
46
 
47
+ Host tools are resolved through `/usr/bin`, `/bin`, or the NixOS system profile
48
+ `/run/current-system/sw/bin`, never ambient `PATH`. An operator may select
49
+ Bubblewrap using an absolute `JIG_BWRAP_PATH`, including a shell-local Nix
50
+ dependency. It receives the same validation and never falls back on failure.
51
+ On NixOS, enable
52
+ `programs.nix-ld.enable` for the unmodified npm runtime. Jig uses the real glibc
53
+ loader at the system-managed `share/nix-ld/lib/ld.so` link, mounting only that
54
+ loader and its required libraries into Runs. It does not mount nix-ld or the
55
+ whole Nix store. NixOS path support is included in this source candidate;
56
+ independent NixOS host conformance is not yet established.
57
+
44
58
  Jig commands do not use `sudo`, download runtimes, or expose host control to
45
59
  Flow code. Runtime installation is handled once by npm with the Jig package.
46
60
 
@@ -136,7 +150,7 @@ import { defineBinding } from "@jigging/jig";
136
150
 
137
151
  export default defineBinding({
138
152
  package: "./flows/reviewer",
139
- slots: { research: "./flows/research" },
153
+ slots: { research: "flow:flows/research" },
140
154
  });
141
155
  ```
142
156
 
@@ -145,21 +159,24 @@ jig run binding:reviewer --input '{}'
145
159
  ```
146
160
 
147
161
  `slots` is optional and omission normalizes to `{}`. It maps at most 256
148
- LocalName keys to other selected, direct-eligible Flow package paths in the
149
- same admitted generation. Slots belong to the Binding; a direct `flow:` Run
150
- has none.
162
+ LocalName keys to explicit `flow:<path>` or `binding:<id>` targets in the same
163
+ admitted generation. Slots belong to the Binding; a direct `flow:` Run has none.
164
+ Selected child Bindings must have no child slots of their own.
151
165
 
152
166
  Each `flow/call` carries JSON/1 input into a fresh child context and returns a
153
- complete JSON/1 Run result. The child receives empty settings and attachments,
154
- no inherited slots, and a deadline no later than its parent. Run/1 controls
167
+ complete JSON/1 Run result. The child receives its selected target's admitted
168
+ settings and Agent capability, empty attachments, no inherited slots, and a
169
+ deadline no later than its parent. It selects its own package-local Skills per
170
+ Agent call; providers and credentials remain host choices. Run/1 controls
155
171
  operation identity, duplicate joins, conflicting reuse, cancellation, and
156
172
  uncertainty; Jig does not replay uncertain dispatch automatically. There is no
157
173
  separate child history, administration, scheduler, catalogue, or resolver. Jig
158
174
  also never guesses an unprefixed target.
159
175
 
160
- The alpha admits one active child operation per parent; excess distinct
161
- concurrent calls receive `RESOURCE_EXHAUSTED`, while sequential calls remain
162
- available.
176
+ Each Run context admits one active operation; a child Flow can own one Agent
177
+ operation while its parent awaits it. Excess distinct concurrent calls receive
178
+ `RESOURCE_EXHAUSTED`, while sequential calls remain available. Cancellation and
179
+ cleanup cover the specialist and its locally owned Agent worker.
163
180
 
164
181
  One experimental [Agent Run capability](https://jig.md/spec/agent-run) is
165
182
  available through ordinary Run/1 `effect/call`. The host may use the official
package/bin/jig CHANGED
@@ -16,6 +16,8 @@ if [ -x /usr/bin/readlink ]; then
16
16
  readlink=/usr/bin/readlink
17
17
  elif [ -x /bin/readlink ]; then
18
18
  readlink=/bin/readlink
19
+ elif [ -x /run/current-system/sw/bin/readlink ]; then
20
+ readlink=/run/current-system/sw/bin/readlink
19
21
  else
20
22
  fail
21
23
  fi
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { defineBinding, defineJig, discover, type JigDefinitionInput, type PackageBindingInput, } from "./project/author.js";
1
+ export { defineBinding, defineJig, discover, type JigDefinitionInput, type PackageBindingInput, } from './project/author.js';
package/dist/index.js CHANGED
@@ -1783,6 +1783,18 @@ function normalizeJig(input, canonical) {
1783
1783
  function defineBinding(input) {
1784
1784
  return normalizeBinding(input, false);
1785
1785
  }
1786
+ function flowRef(path) {
1787
+ return record({
1788
+ kind: "flow",
1789
+ path: normalizeProjectPath(path, "Flow reference")
1790
+ });
1791
+ }
1792
+ function bindingRef(id) {
1793
+ return record({
1794
+ kind: "binding",
1795
+ id: validateLocalName(id, "Binding reference")
1796
+ });
1797
+ }
1786
1798
  function normalizeBinding(input, canonical) {
1787
1799
  const captured = snapshotJsonObject(input, "Binding definition");
1788
1800
  assertClosedObject(captured, canonical ? ["kind", "package", "settings", "slots"] : ["package", "settings", "slots"], "Binding definition");
@@ -1794,7 +1806,12 @@ function normalizeBinding(input, canonical) {
1794
1806
  const packagePath = normalizeProjectPath(captured.package, "package");
1795
1807
  const settings = Object.hasOwn(captured, "settings") ? expectJsonObject(captured.settings, "settings") : emptyRecord();
1796
1808
  const slots = Object.hasOwn(captured, "slots") ? normalizeFlowSlots(captured.slots) : emptyRecord();
1797
- return record({ kind: "package", package: packagePath, settings, slots });
1809
+ return record({
1810
+ kind: "package",
1811
+ package: packagePath,
1812
+ settings,
1813
+ slots
1814
+ });
1798
1815
  }
1799
1816
  function normalizeFlowSlots(value) {
1800
1817
  const input = snapshotJsonObject(value, "slots");
@@ -1804,10 +1821,20 @@ function normalizeFlowSlots(value) {
1804
1821
  const output = Object.create(null);
1805
1822
  for (const name of Object.keys(input).sort(compareUtf8)) {
1806
1823
  validateLocalName(name, "slot name");
1807
- output[name] = normalizeProjectPath(input[name], `slot ${name}`);
1824
+ const target = parseRunTargetSelector(input[name], `slot ${name}`);
1825
+ output[name] = target.kind === "flow" ? `flow:${target.path}` : `binding:${target.id}`;
1808
1826
  }
1809
1827
  return Object.freeze(output);
1810
1828
  }
1829
+ function parseRunTargetSelector(value, label) {
1830
+ if (typeof value !== "string")
1831
+ throw new TypeError(`${label} must be a target selector`);
1832
+ if (value.startsWith("flow:"))
1833
+ return flowRef(normalizeProjectPath(value.slice(5), label));
1834
+ if (value.startsWith("binding:"))
1835
+ return bindingRef(validateLocalName(value.slice(8), label));
1836
+ throw new TypeError(`${label} must select flow:<path> or binding:<id>`);
1837
+ }
1811
1838
  function normalizeSource(value, field, canonical) {
1812
1839
  if (value === undefined)
1813
1840
  throw new TypeError(`${field} cannot be undefined`);
@@ -1,10 +1,10 @@
1
- import type { JsonObject } from "../json.js";
1
+ import type { JsonObject } from '../json.js';
2
2
  export interface DiscoverySource {
3
- readonly kind: "discover";
3
+ readonly kind: 'discover';
4
4
  readonly roots: readonly string[];
5
5
  }
6
6
  export interface MembersSource {
7
- readonly kind: "members";
7
+ readonly kind: 'members';
8
8
  readonly paths: readonly string[];
9
9
  }
10
10
  export type ProjectSource = DiscoverySource | MembersSource;
@@ -18,16 +18,16 @@ export interface JigDefinitionInput {
18
18
  readonly bindings?: ProjectSourceInput;
19
19
  }
20
20
  export interface FlowRef {
21
- readonly kind: "flow";
21
+ readonly kind: 'flow';
22
22
  readonly path: string;
23
23
  }
24
24
  export interface BindingRef {
25
- readonly kind: "binding";
25
+ readonly kind: 'binding';
26
26
  readonly id: string;
27
27
  }
28
28
  export type RunTargetRef = FlowRef | BindingRef;
29
29
  export interface PackageBindingDefinition {
30
- readonly kind: "package";
30
+ readonly kind: 'package';
31
31
  readonly package: string;
32
32
  readonly settings: JsonObject;
33
33
  readonly slots: Readonly<Record<string, string>>;
@@ -47,3 +47,5 @@ export declare function flowRef(path: string): FlowRef;
47
47
  export declare function bindingRef(id: string): BindingRef;
48
48
  /** Evaluator-only canonical re-normalization; absent from the package root. */
49
49
  export declare function normalizePackageBindingDefinition(input: unknown): PackageBindingDefinition;
50
+ /** Internal selector parsing shared by authoring and exact project linking. */
51
+ export declare function parseRunTargetSelector(value: unknown, label: string): RunTargetRef;