@davidorex/pi-agent-dispatch 0.28.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 (85) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +37 -0
  3. package/dist/attested-commit.d.ts +32 -0
  4. package/dist/attested-commit.d.ts.map +1 -0
  5. package/dist/attested-commit.js +61 -0
  6. package/dist/attested-commit.js.map +1 -0
  7. package/dist/auth-gate.d.ts +92 -0
  8. package/dist/auth-gate.d.ts.map +1 -0
  9. package/dist/auth-gate.js +210 -0
  10. package/dist/auth-gate.js.map +1 -0
  11. package/dist/author-agent-spec-tool.d.ts +33 -0
  12. package/dist/author-agent-spec-tool.d.ts.map +1 -0
  13. package/dist/author-agent-spec-tool.js +98 -0
  14. package/dist/author-agent-spec-tool.js.map +1 -0
  15. package/dist/author-tool-grant-tool.d.ts +47 -0
  16. package/dist/author-tool-grant-tool.d.ts.map +1 -0
  17. package/dist/author-tool-grant-tool.js +87 -0
  18. package/dist/author-tool-grant-tool.js.map +1 -0
  19. package/dist/call-agent-tool.d.ts +42 -0
  20. package/dist/call-agent-tool.d.ts.map +1 -0
  21. package/dist/call-agent-tool.js +90 -0
  22. package/dist/call-agent-tool.js.map +1 -0
  23. package/dist/capability-composer.d.ts +11 -0
  24. package/dist/capability-composer.d.ts.map +1 -0
  25. package/dist/capability-composer.js +35 -0
  26. package/dist/capability-composer.js.map +1 -0
  27. package/dist/commit-attested-tool.d.ts +29 -0
  28. package/dist/commit-attested-tool.d.ts.map +1 -0
  29. package/dist/commit-attested-tool.js +45 -0
  30. package/dist/commit-attested-tool.js.map +1 -0
  31. package/dist/composite-loader.d.ts +36 -0
  32. package/dist/composite-loader.d.ts.map +1 -0
  33. package/dist/composite-loader.js +137 -0
  34. package/dist/composite-loader.js.map +1 -0
  35. package/dist/composites/command-allowlist.d.ts +29 -0
  36. package/dist/composites/command-allowlist.d.ts.map +1 -0
  37. package/dist/composites/command-allowlist.js +36 -0
  38. package/dist/composites/command-allowlist.js.map +1 -0
  39. package/dist/composites/git-log.d.ts +31 -0
  40. package/dist/composites/git-log.d.ts.map +1 -0
  41. package/dist/composites/git-log.js +39 -0
  42. package/dist/composites/git-log.js.map +1 -0
  43. package/dist/composites/grep-paths.d.ts +26 -0
  44. package/dist/composites/grep-paths.d.ts.map +1 -0
  45. package/dist/composites/grep-paths.js +34 -0
  46. package/dist/composites/grep-paths.js.map +1 -0
  47. package/dist/composites/read-files.d.ts +24 -0
  48. package/dist/composites/read-files.d.ts.map +1 -0
  49. package/dist/composites/read-files.js +35 -0
  50. package/dist/composites/read-files.js.map +1 -0
  51. package/dist/index.d.ts +18 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +77 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/operation-vocab.d.ts +25 -0
  56. package/dist/operation-vocab.d.ts.map +1 -0
  57. package/dist/operation-vocab.js +78 -0
  58. package/dist/operation-vocab.js.map +1 -0
  59. package/dist/read-truncation-gate.d.ts +143 -0
  60. package/dist/read-truncation-gate.d.ts.map +1 -0
  61. package/dist/read-truncation-gate.js +175 -0
  62. package/dist/read-truncation-gate.js.map +1 -0
  63. package/dist/real-check-runner.d.ts +66 -0
  64. package/dist/real-check-runner.d.ts.map +1 -0
  65. package/dist/real-check-runner.js +133 -0
  66. package/dist/real-check-runner.js.map +1 -0
  67. package/dist/run-real-checks-tool.d.ts +28 -0
  68. package/dist/run-real-checks-tool.d.ts.map +1 -0
  69. package/dist/run-real-checks-tool.js +47 -0
  70. package/dist/run-real-checks-tool.js.map +1 -0
  71. package/dist/run-work-order-loop-tool.d.ts +35 -0
  72. package/dist/run-work-order-loop-tool.d.ts.map +1 -0
  73. package/dist/run-work-order-loop-tool.js +46 -0
  74. package/dist/run-work-order-loop-tool.js.map +1 -0
  75. package/dist/verified-identity.d.ts +54 -0
  76. package/dist/verified-identity.d.ts.map +1 -0
  77. package/dist/verified-identity.js +133 -0
  78. package/dist/verified-identity.js.map +1 -0
  79. package/dist/work-order-loop.d.ts +82 -0
  80. package/dist/work-order-loop.d.ts.map +1 -0
  81. package/dist/work-order-loop.js +149 -0
  82. package/dist/work-order-loop.js.map +1 -0
  83. package/package.json +59 -0
  84. package/skill-narrative.md +53 -0
  85. package/skills/pi-agent-dispatch/SKILL.md +138 -0
@@ -0,0 +1,29 @@
1
+ /**
2
+ * command-allowlist composite KIND — execute commands restricted to a
3
+ * registration-fixed allowlist.
4
+ *
5
+ * Instance scope (allowed_commands[]) is fixed at registration; per-call
6
+ * args carry the command name + args. Refuses any command not in the
7
+ * allowlist with throw — no return-with-error degradation. spawnSync
8
+ * captures exit_code, stdout, stderr, duration_ms.
9
+ */
10
+ import { Type } from "@earendil-works/pi-ai";
11
+ export interface CommandAllowlistInstance {
12
+ allowed_commands: string[];
13
+ }
14
+ export interface CommandAllowlistArgs {
15
+ command: string;
16
+ args?: string[];
17
+ }
18
+ export interface CommandAllowlistResult {
19
+ exit_code: number;
20
+ stdout: string;
21
+ stderr: string;
22
+ duration_ms: number;
23
+ }
24
+ export declare const commandAllowlistArgsSchema: Type.TObject<{
25
+ command: Type.TString;
26
+ args: Type.TOptional<Type.TArray<Type.TString>>;
27
+ }>;
28
+ export declare function runCommandAllowlist(cwd: string, instance: CommandAllowlistInstance, args: CommandAllowlistArgs): CommandAllowlistResult;
29
+ //# sourceMappingURL=command-allowlist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-allowlist.d.ts","sourceRoot":"","sources":["../../src/composites/command-allowlist.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,MAAM,WAAW,wBAAwB;IACxC,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,0BAA0B;;;EAGrC,CAAC;AAEH,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,wBAAwB,EAClC,IAAI,EAAE,oBAAoB,GACxB,sBAAsB,CAsBxB"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * command-allowlist composite KIND — execute commands restricted to a
3
+ * registration-fixed allowlist.
4
+ *
5
+ * Instance scope (allowed_commands[]) is fixed at registration; per-call
6
+ * args carry the command name + args. Refuses any command not in the
7
+ * allowlist with throw — no return-with-error degradation. spawnSync
8
+ * captures exit_code, stdout, stderr, duration_ms.
9
+ */
10
+ import { spawnSync } from "node:child_process";
11
+ import { Type } from "@earendil-works/pi-ai";
12
+ export const commandAllowlistArgsSchema = Type.Object({
13
+ command: Type.String({ description: "Command name — must be in instance.allowed_commands." }),
14
+ args: Type.Optional(Type.Array(Type.String(), { description: "Command arguments." })),
15
+ });
16
+ export function runCommandAllowlist(cwd, instance, args) {
17
+ if (!instance?.allowed_commands || instance.allowed_commands.length === 0) {
18
+ throw new Error("command-allowlist: instance.allowed_commands is required and must be non-empty.");
19
+ }
20
+ if (!args?.command) {
21
+ throw new Error("command-allowlist: args.command is required.");
22
+ }
23
+ if (!instance.allowed_commands.includes(args.command)) {
24
+ throw new Error(`command-allowlist: command '${args.command}' not in allowlist [${instance.allowed_commands.join(", ")}].`);
25
+ }
26
+ const start = Date.now();
27
+ const result = spawnSync(args.command, args.args ?? [], { cwd, encoding: "utf-8" });
28
+ const duration_ms = Date.now() - start;
29
+ return {
30
+ exit_code: result.status ?? -1,
31
+ stdout: result.stdout ?? "",
32
+ stderr: result.stderr ?? "",
33
+ duration_ms,
34
+ };
35
+ }
36
+ //# sourceMappingURL=command-allowlist.js.map
@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AI,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACpF,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;IACvC,OAAO;QACN,SAAS,EAAE,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;QAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;QAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;QAC3B,WAAW;KACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * git-log composite KIND — bounded git history read.
3
+ *
4
+ * Instance scope (paths[] / since) is fixed at registration time;
5
+ * per-call args carry only limit. Wraps `git log --format=%H%x00%an%x00%aI%x00%s`
6
+ * (null-byte field separator avoids parsing ambiguity on subjects containing
7
+ * whitespace) and returns a structured commit list. Non-zero git exit
8
+ * throws — refusal-by-throw parity with other KINDs.
9
+ */
10
+ import { Type } from "@earendil-works/pi-ai";
11
+ export interface GitLogInstance {
12
+ paths?: string[];
13
+ since?: string;
14
+ }
15
+ export interface GitLogArgs {
16
+ limit?: number;
17
+ }
18
+ export interface GitLogCommit {
19
+ sha: string;
20
+ author: string;
21
+ date: string;
22
+ message: string;
23
+ }
24
+ export interface GitLogResult {
25
+ commits: GitLogCommit[];
26
+ }
27
+ export declare const gitLogArgsSchema: Type.TObject<{
28
+ limit: Type.TOptional<Type.TNumber>;
29
+ }>;
30
+ export declare function runGitLog(cwd: string, instance: GitLogInstance, args: GitLogArgs): GitLogResult;
31
+ //# sourceMappingURL=git-log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-log.d.ts","sourceRoot":"","sources":["../../src/composites/git-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,MAAM,WAAW,cAAc;IAC9B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB;;EAE3B,CAAC;AAEH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,GAAG,YAAY,CAsB/F"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * git-log composite KIND — bounded git history read.
3
+ *
4
+ * Instance scope (paths[] / since) is fixed at registration time;
5
+ * per-call args carry only limit. Wraps `git log --format=%H%x00%an%x00%aI%x00%s`
6
+ * (null-byte field separator avoids parsing ambiguity on subjects containing
7
+ * whitespace) and returns a structured commit list. Non-zero git exit
8
+ * throws — refusal-by-throw parity with other KINDs.
9
+ */
10
+ import { spawnSync } from "node:child_process";
11
+ import { cleanGitEnv } from "@davidorex/pi-context/git-env";
12
+ import { Type } from "@earendil-works/pi-ai";
13
+ export const gitLogArgsSchema = Type.Object({
14
+ limit: Type.Optional(Type.Number({ description: "Maximum commits to return." })),
15
+ });
16
+ export function runGitLog(cwd, instance, args) {
17
+ const cmdArgs = ["log", "--format=%H%x00%an%x00%aI%x00%s"];
18
+ if (instance?.since)
19
+ cmdArgs.push(`--since=${instance.since}`);
20
+ if (args?.limit !== undefined)
21
+ cmdArgs.push(`-${args.limit}`);
22
+ if (instance?.paths && instance.paths.length > 0) {
23
+ cmdArgs.push("--");
24
+ cmdArgs.push(...instance.paths);
25
+ }
26
+ const result = spawnSync("git", cmdArgs, { cwd, encoding: "utf-8", env: cleanGitEnv() });
27
+ if (result.status !== 0) {
28
+ throw new Error(`git-log: git exited ${result.status}: ${result.stderr}`);
29
+ }
30
+ const commits = result.stdout
31
+ .split("\n")
32
+ .filter((line) => line.length > 0)
33
+ .map((line) => {
34
+ const [sha, author, date, message] = line.split("\x00");
35
+ return { sha, author, date, message };
36
+ });
37
+ return { commits };
38
+ }
39
+ //# sourceMappingURL=git-log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-log.js","sourceRoot":"","sources":["../../src/composites/git-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAsB7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3C,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC,CAAC;CAChF,CAAC,CAAC;AAEH,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,QAAwB,EAAE,IAAgB;IAChF,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,iCAAiC,CAAC,CAAC;IAC3D,IAAI,QAAQ,EAAE,KAAK;QAAE,OAAO,CAAC,IAAI,CAAC,WAAW,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAC/D,IAAI,IAAI,EAAE,KAAK,KAAK,SAAS;QAAE,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9D,IAAI,QAAQ,EAAE,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;IACzF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,uBAAuB,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,OAAO,GAAmB,MAAM,CAAC,MAAM;SAC3C,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;SACjC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACb,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACxD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;IACJ,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * grep-paths composite KIND — bounded recursive grep confined to allowed_roots.
3
+ *
4
+ * Instance scope (allowed_roots[]) is registration-fixed; per-call args carry
5
+ * pattern + optional glob (passed to grep as --include). Refusal-by-throw on
6
+ * empty allowed_roots (canon — empty grant ≠ unrestricted). grep exit codes:
7
+ * 0 = matches found, 1 = no matches, 2 = error. We surface 0/1 as success
8
+ * (with empty hits on 1) and throw on 2.
9
+ */
10
+ import { Type } from "@earendil-works/pi-ai";
11
+ export interface GrepPathsInstance {
12
+ allowed_roots: string[];
13
+ }
14
+ export interface GrepPathsArgs {
15
+ pattern: string;
16
+ glob?: string;
17
+ }
18
+ export interface GrepPathsResult {
19
+ hits: string;
20
+ }
21
+ export declare const grepPathsArgsSchema: Type.TObject<{
22
+ pattern: Type.TString;
23
+ glob: Type.TOptional<Type.TString>;
24
+ }>;
25
+ export declare function runGrepPaths(cwd: string, instance: GrepPathsInstance, args: GrepPathsArgs): GrepPathsResult;
26
+ //# sourceMappingURL=grep-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grep-paths.d.ts","sourceRoot":"","sources":["../../src/composites/grep-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IACjC,aAAa,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,mBAAmB;;;EAG9B,CAAC;AAEH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,aAAa,GAAG,eAAe,CAkB3G"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * grep-paths composite KIND — bounded recursive grep confined to allowed_roots.
3
+ *
4
+ * Instance scope (allowed_roots[]) is registration-fixed; per-call args carry
5
+ * pattern + optional glob (passed to grep as --include). Refusal-by-throw on
6
+ * empty allowed_roots (canon — empty grant ≠ unrestricted). grep exit codes:
7
+ * 0 = matches found, 1 = no matches, 2 = error. We surface 0/1 as success
8
+ * (with empty hits on 1) and throw on 2.
9
+ */
10
+ import { spawnSync } from "node:child_process";
11
+ import { Type } from "@earendil-works/pi-ai";
12
+ export const grepPathsArgsSchema = Type.Object({
13
+ pattern: Type.String({ description: "grep pattern (BRE)." }),
14
+ glob: Type.Optional(Type.String({ description: "--include glob (e.g. '*.ts')." })),
15
+ });
16
+ export function runGrepPaths(cwd, instance, args) {
17
+ if (!instance?.allowed_roots || instance.allowed_roots.length === 0) {
18
+ throw new Error("grep-paths: instance.allowed_roots is required and must be non-empty.");
19
+ }
20
+ if (!args?.pattern) {
21
+ throw new Error("grep-paths: args.pattern is required.");
22
+ }
23
+ const cmdArgs = ["-rn"];
24
+ if (args.glob)
25
+ cmdArgs.push(`--include=${args.glob}`);
26
+ cmdArgs.push(args.pattern);
27
+ cmdArgs.push(...instance.allowed_roots);
28
+ const result = spawnSync("grep", cmdArgs, { cwd, encoding: "utf-8" });
29
+ if (result.status === 2) {
30
+ throw new Error(`grep-paths: grep exited 2 (error): ${result.stderr}`);
31
+ }
32
+ return { hits: result.stdout };
33
+ }
34
+ //# sourceMappingURL=grep-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grep-paths.js","sourceRoot":"","sources":["../../src/composites/grep-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAe7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;IAC5D,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC,CAAC;CAClF,CAAC,CAAC;AAEH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,QAA2B,EAAE,IAAmB;IACzF,IAAI,CAAC,QAAQ,EAAE,aAAa,IAAI,QAAQ,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC1F,CAAC;IACD,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;IACxB,IAAI,IAAI,CAAC,IAAI;QAAE,OAAO,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACtD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IAExC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACtE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,sCAAsC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;AAChC,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * read-files composite KIND — bounded file read confined to allowed_roots.
3
+ *
4
+ * Instance scope (allowed_roots[]) is fixed at registration time per
5
+ * config.tool_operations[] entry; per-call args carry only the relative
6
+ * path. Refuses any path that, after normalization, falls outside the
7
+ * cartesian union of allowed_roots. Refusal is throw (not return) so
8
+ * callers can't silently degrade into the unrestricted-read shape.
9
+ */
10
+ import { Type } from "@earendil-works/pi-ai";
11
+ export interface ReadFilesInstance {
12
+ allowed_roots: string[];
13
+ }
14
+ export interface ReadFilesArgs {
15
+ path: string;
16
+ }
17
+ export interface ReadFilesResult {
18
+ content: string;
19
+ }
20
+ export declare const readFilesArgsSchema: Type.TObject<{
21
+ path: Type.TString;
22
+ }>;
23
+ export declare function runReadFiles(cwd: string, instance: ReadFilesInstance, args: ReadFilesArgs): ReadFilesResult;
24
+ //# sourceMappingURL=read-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-files.d.ts","sourceRoot":"","sources":["../../src/composites/read-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IACjC,aAAa,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,eAAe;IAC/B,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,mBAAmB;;EAE9B,CAAC;AAEH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,aAAa,GAAG,eAAe,CAsB3G"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * read-files composite KIND — bounded file read confined to allowed_roots.
3
+ *
4
+ * Instance scope (allowed_roots[]) is fixed at registration time per
5
+ * config.tool_operations[] entry; per-call args carry only the relative
6
+ * path. Refuses any path that, after normalization, falls outside the
7
+ * cartesian union of allowed_roots. Refusal is throw (not return) so
8
+ * callers can't silently degrade into the unrestricted-read shape.
9
+ */
10
+ import fs from "node:fs";
11
+ import path from "node:path";
12
+ import { Type } from "@earendil-works/pi-ai";
13
+ export const readFilesArgsSchema = Type.Object({
14
+ path: Type.String({ description: "Relative path under one of the instance's allowed_roots." }),
15
+ });
16
+ export function runReadFiles(cwd, instance, args) {
17
+ if (!instance?.allowed_roots || instance.allowed_roots.length === 0) {
18
+ throw new Error("read-files: instance.allowed_roots is required and must be non-empty.");
19
+ }
20
+ if (!args?.path) {
21
+ throw new Error("read-files: args.path is required.");
22
+ }
23
+ const absTarget = path.resolve(cwd, args.path);
24
+ const allowedAbs = instance.allowed_roots.map((r) => path.resolve(cwd, r));
25
+ const withinAllowed = allowedAbs.some((rootAbs) => {
26
+ const rootWithSep = rootAbs.endsWith(path.sep) ? rootAbs : `${rootAbs}${path.sep}`;
27
+ return absTarget === rootAbs || absTarget.startsWith(rootWithSep);
28
+ });
29
+ if (!withinAllowed) {
30
+ throw new Error(`read-files: path '${args.path}' resolves outside allowed_roots [${instance.allowed_roots.join(", ")}].`);
31
+ }
32
+ const content = fs.readFileSync(absTarget, "utf-8");
33
+ return { content };
34
+ }
35
+ //# sourceMappingURL=read-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-files.js","sourceRoot":"","sources":["../../src/composites/read-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAc7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,0DAA0D,EAAE,CAAC;CAC9F,CAAC,CAAC;AAEH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,QAA2B,EAAE,IAAmB;IACzF,IAAI,CAAC,QAAQ,EAAE,aAAa,IAAI,QAAQ,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC1F,CAAC;IACD,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3E,MAAM,aAAa,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QACjD,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACnF,OAAO,SAAS,KAAK,OAAO,IAAI,SAAS,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,aAAa,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACd,qBAAqB,IAAI,CAAC,IAAI,qCAAqC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CACxG,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACpD,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ import { type OperationDescriptor } from "./operation-vocab.js";
3
+ /**
4
+ * L3 runtime guard (FEAT-010): on extension load, assert defaults
5
+ * contains no FORBIDDEN_WHOLESALE_OPERATIONS token. Catches the failure mode
6
+ * where a future maintainer adds a wholesale entry to defaults and the L2
7
+ * test invariant is bypassed (e.g. tests not run pre-commit). Throws to
8
+ * halt extension load — refusing to start with a broken-canon vocabulary
9
+ * is the only safe option per feedback_no_parallel_ungated_paths.
10
+ *
11
+ * Exported (with `defaults` arg) so tests can supply a synthetic
12
+ * violator-containing map and assert the throw path without mutating the
13
+ * module-level const.
14
+ */
15
+ export declare function assertDefaultsClean(defaults?: Record<string, OperationDescriptor>): void;
16
+ declare const extension: (pi: ExtensionAPI) => void;
17
+ export default extension;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAOpE,OAAO,EAEN,KAAK,mBAAmB,EAExB,MAAM,sBAAsB,CAAC;AAK9B;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAA2B,GAAG,IAAI,CASjH;AAED,QAAA,MAAM,SAAS,GAAI,IAAI,YAAY,SAkDlC,CAAC;AAEF,eAAe,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,77 @@
1
+ import { registerAuthGate } from "./auth-gate.js";
2
+ import { authorAgentSpecTool } from "./author-agent-spec-tool.js";
3
+ import { authorToolGrantTool } from "./author-tool-grant-tool.js";
4
+ import { callAgentTool } from "./call-agent-tool.js";
5
+ import { commitAttestedTool } from "./commit-attested-tool.js";
6
+ import { loadComposites } from "./composite-loader.js";
7
+ import { FORBIDDEN_WHOLESALE_OPERATIONS, TOOL_OPERATION_DEFAULTS, } from "./operation-vocab.js";
8
+ import { registerReadTruncationGate } from "./read-truncation-gate.js";
9
+ import { runRealChecksTool } from "./run-real-checks-tool.js";
10
+ import { runWorkOrderLoopTool } from "./run-work-order-loop-tool.js";
11
+ /**
12
+ * L3 runtime guard (FEAT-010): on extension load, assert defaults
13
+ * contains no FORBIDDEN_WHOLESALE_OPERATIONS token. Catches the failure mode
14
+ * where a future maintainer adds a wholesale entry to defaults and the L2
15
+ * test invariant is bypassed (e.g. tests not run pre-commit). Throws to
16
+ * halt extension load — refusing to start with a broken-canon vocabulary
17
+ * is the only safe option per feedback_no_parallel_ungated_paths.
18
+ *
19
+ * Exported (with `defaults` arg) so tests can supply a synthetic
20
+ * violator-containing map and assert the throw path without mutating the
21
+ * module-level const.
22
+ */
23
+ export function assertDefaultsClean(defaults = TOOL_OPERATION_DEFAULTS) {
24
+ const violators = Object.values(defaults).filter((op) => FORBIDDEN_WHOLESALE_OPERATIONS.includes(op.canonical_id));
25
+ if (violators.length > 0) {
26
+ throw new Error(`pi-agent-dispatch: L3 runtime guard tripped — TOOL_OPERATION_DEFAULTS contains forbidden wholesale tokens [${violators.map((v) => v.canonical_id).join(", ")}]. Source change + release required to remove.`);
27
+ }
28
+ }
29
+ const extension = (pi) => {
30
+ // L3: assert framework defaults clean of forbidden-wholesale tokens
31
+ assertDefaultsClean();
32
+ // Static tools (FEAT-005 / DEC-0047 / TASK-088-090; run-work-order-loop FEAT-006 / TASK-091)
33
+ pi.registerTool(authorAgentSpecTool);
34
+ pi.registerTool(callAgentTool);
35
+ pi.registerTool(runRealChecksTool);
36
+ pi.registerTool(commitAttestedTool);
37
+ pi.registerTool(authorToolGrantTool);
38
+ pi.registerTool(runWorkOrderLoopTool);
39
+ // Dynamic composite-tool registration from config.tool_operations[]
40
+ // (FEAT-010). loadComposites throws if any entry hits the L1∪L5
41
+ // forbidden union — refuse to start rather than register a parallel
42
+ // ungated path.
43
+ //
44
+ // Observability of the config-absent degrade path (FGAP-121 layer-a):
45
+ // pi.ui.notify is on ExtensionContext (tool-execution time), NOT on
46
+ // ExtensionAPI (factory time). At factory load the only canonical
47
+ // observability channel is the TraceEntry pipeline, which
48
+ // loadComposites already writes via writeAgentTrace per DEC-0002 /
49
+ // TASK-086 precedent. The returned config_absent flag is kept on the
50
+ // surface for any future factory-time UI hook upstream may add; today
51
+ // it is functionally informational + queryable via the trace JSONL.
52
+ const result = loadComposites(process.cwd(), pi);
53
+ void result;
54
+ // FGAP-134: per-tool user-auth gate at pi-dispatch layer. Registered
55
+ // AFTER static + composite tools so the handler sees the full surface
56
+ // (registration order does not affect handler-invocation behavior —
57
+ // pi.on('tool_call') fires for every tool regardless of registration
58
+ // sequence — but placing the registration last preserves a readable
59
+ // 'tools first, gates last' factory shape). Closes the writer.kind
60
+ // spoof at the dispatch boundary regardless of caller-supplied field
61
+ // values. Bucket-2 vocabulary + handler semantics live in auth-gate.ts;
62
+ // see that module's header for the governance rationale + Bucket-2
63
+ // member list.
64
+ registerAuthGate(pi);
65
+ // FGAP-135: pi.on('tool_result') gate intercepts pi's built-in `read`
66
+ // tool responses when the structured details.truncation field signals
67
+ // truncation, and REPLACES the content payload with a hard-refusal
68
+ // directive. Mirrors pi-context serializeForRead overCapDirective
69
+ // canon — the directive IS the response so the agent cannot skim past
70
+ // it. Coexists with the tool_call auth-gate above on the orthogonal
71
+ // tool_result event; multi-handler composition is the SDK contract.
72
+ // See read-truncation-gate.ts header for the full canonical-model
73
+ // docstring.
74
+ registerReadTruncationGate(pi);
75
+ };
76
+ export default extension;
77
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACN,8BAA8B,EAE9B,uBAAuB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAgD,uBAAuB;IAC1G,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CACtD,8B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IACnE,kEAAkE;IAClE,sEAAsE;IACtE,oEAAoE;IACpE,oEAAoE;IACpE,kEAAkE;IAClE,aAAa;IACb,0BAA0B,CAAC,EAAE,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Canonical operation-granular tool grant vocabulary (FEAT-005 / DEC-0047).
3
+ * Each entry names a Pi tool that can be granted to a privileged JIT-agent.
4
+ * Per DEC-0047: default grant is EMPTY; consumers must opt-in operations
5
+ * per dispatch. Per-project config.tool_operations[] entries shadow these
6
+ * defaults at resolve time via resolveOperationVocabulary().
7
+ */
8
+ export interface OperationDescriptor {
9
+ canonical_id: string;
10
+ display_name?: string;
11
+ category?: string;
12
+ }
13
+ /**
14
+ * Operations forbidden from TOOL_OPERATION_DEFAULTS AND from
15
+ * config.tool_operations[] AND config.tool_operations_forbidden[]
16
+ * union. Wholesale tokens that, if granted, dissolve operation-granular
17
+ * bounds — e.g. granting "bash" makes "git-log-recent" a gated
18
+ * alternative to an unrestricted original (feedback_no_parallel_ungated_paths).
19
+ * Extending L1 (this list) requires source change + release (release-
20
+ * gated, not config-mutable). L5 (config.tool_operations_forbidden[])
21
+ * admits project-specific additions under writer.kind=human per DEC-0047.
22
+ */
23
+ export declare const FORBIDDEN_WHOLESALE_OPERATIONS: readonly ["bash", "write", "edit", "shell", "execute"];
24
+ export declare const TOOL_OPERATION_DEFAULTS: Record<string, OperationDescriptor>;
25
+ //# sourceMappingURL=operation-vocab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation-vocab.d.ts","sourceRoot":"","sources":["../src/operation-vocab.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,mBAAmB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,8BAA8B,wDAAyD,CAAC;AAErG,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CA4DvE,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Canonical operation-granular tool grant vocabulary (FEAT-005 / DEC-0047).
3
+ * Each entry names a Pi tool that can be granted to a privileged JIT-agent.
4
+ * Per DEC-0047: default grant is EMPTY; consumers must opt-in operations
5
+ * per dispatch. Per-project config.tool_operations[] entries shadow these
6
+ * defaults at resolve time via resolveOperationVocabulary().
7
+ */
8
+ /**
9
+ * Operations forbidden from TOOL_OPERATION_DEFAULTS AND from
10
+ * config.tool_operations[] AND config.tool_operations_forbidden[]
11
+ * union. Wholesale tokens that, if granted, dissolve operation-granular
12
+ * bounds — e.g. granting "bash" makes "git-log-recent" a gated
13
+ * alternative to an unrestricted original (feedback_no_parallel_ungated_paths).
14
+ * Extending L1 (this list) requires source change + release (release-
15
+ * gated, not config-mutable). L5 (config.tool_operations_forbidden[])
16
+ * admits project-specific additions under writer.kind=human per DEC-0047.
17
+ */
18
+ export const FORBIDDEN_WHOLESALE_OPERATIONS = ["bash", "write", "edit", "shell", "execute"];
19
+ export const TOOL_OPERATION_DEFAULTS = {
20
+ // pi-context (40)
21
+ "amend-config": { canonical_id: "amend-config", category: "context" },
22
+ "append-block-item": { canonical_id: "append-block-item", category: "context" },
23
+ "append-block-nested-item": { canonical_id: "append-block-nested-item", category: "context" },
24
+ "append-relation": { canonical_id: "append-relation", category: "context" },
25
+ "complete-task": { canonical_id: "complete-task", category: "context" },
26
+ "context-accept-all": { canonical_id: "context-accept-all", category: "context" },
27
+ "context-bootstrap-state": { canonical_id: "context-bootstrap-state", category: "context" },
28
+ "context-current-state": { canonical_id: "context-current-state", category: "context" },
29
+ "context-edges-for-lens": { canonical_id: "context-edges-for-lens", category: "context" },
30
+ "context-init": { canonical_id: "context-init", category: "context" },
31
+ "context-roadmap-list": { canonical_id: "context-roadmap-list", category: "context" },
32
+ "context-roadmap-load": { canonical_id: "context-roadmap-load", category: "context" },
33
+ "context-roadmap-render": { canonical_id: "context-roadmap-render", category: "context" },
34
+ "context-roadmap-validate": { canonical_id: "context-roadmap-validate", category: "context" },
35
+ "context-status": { canonical_id: "context-status", category: "context" },
36
+ "context-validate": { canonical_id: "context-validate", category: "context" },
37
+ "context-validate-relations": { canonical_id: "context-validate-relations", category: "context" },
38
+ "context-walk-descendants": { canonical_id: "context-walk-descendants", category: "context" },
39
+ "filter-block-items": { canonical_id: "filter-block-items", category: "context" },
40
+ "find-references": { canonical_id: "find-references", category: "context" },
41
+ "gather-execution-context": { canonical_id: "gather-execution-context", category: "context" },
42
+ "join-blocks": { canonical_id: "join-blocks", category: "context" },
43
+ "list-tools": { canonical_id: "list-tools", category: "context" },
44
+ "read-block": { canonical_id: "read-block", category: "context" },
45
+ "read-block-dir": { canonical_id: "read-block-dir", category: "context" },
46
+ "read-block-item": { canonical_id: "read-block-item", category: "context" },
47
+ "read-block-page": { canonical_id: "read-block-page", category: "context" },
48
+ "read-config": { canonical_id: "read-config", category: "context" },
49
+ "read-samples-catalog": { canonical_id: "read-samples-catalog", category: "context" },
50
+ "read-schema": { canonical_id: "read-schema", category: "context" },
51
+ "remove-block-item": { canonical_id: "remove-block-item", category: "context" },
52
+ "remove-block-nested-item": { canonical_id: "remove-block-nested-item", category: "context" },
53
+ "rename-canonical-id": { canonical_id: "rename-canonical-id", category: "context" },
54
+ "resolve-item-by-id": { canonical_id: "resolve-item-by-id", category: "context" },
55
+ "resolve-items-by-id": { canonical_id: "resolve-items-by-id", category: "context" },
56
+ "update-block-item": { canonical_id: "update-block-item", category: "context" },
57
+ "update-block-nested-item": { canonical_id: "update-block-nested-item", category: "context" },
58
+ "walk-ancestors": { canonical_id: "walk-ancestors", category: "context" },
59
+ "write-block": { canonical_id: "write-block", category: "context" },
60
+ "write-schema": { canonical_id: "write-schema", category: "context" },
61
+ // pi-workflows (9)
62
+ "enforce-budget": { canonical_id: "enforce-budget", category: "workflow" },
63
+ "render-item-by-id": { canonical_id: "render-item-by-id", category: "workflow" },
64
+ "workflow-agents": { canonical_id: "workflow-agents", category: "workflow" },
65
+ "workflow-execute": { canonical_id: "workflow-execute", category: "workflow" },
66
+ "workflow-init": { canonical_id: "workflow-init", category: "workflow" },
67
+ "workflow-list": { canonical_id: "workflow-list", category: "workflow" },
68
+ "workflow-resume": { canonical_id: "workflow-resume", category: "workflow" },
69
+ "workflow-status": { canonical_id: "workflow-status", category: "workflow" },
70
+ "workflow-validate": { canonical_id: "workflow-validate", category: "workflow" },
71
+ // pi-behavior-monitors (5)
72
+ "monitors-control": { canonical_id: "monitors-control", category: "monitor" },
73
+ "monitors-inspect": { canonical_id: "monitors-inspect", category: "monitor" },
74
+ "monitors-patterns": { canonical_id: "monitors-patterns", category: "monitor" },
75
+ "monitors-rules": { canonical_id: "monitors-rules", category: "monitor" },
76
+ "monitors-status": { canonical_id: "monitors-status", category: "monitor" },
77
+ };
78
+ //# sourceMappingURL=operation-vocab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation-vocab.js","sourceRoot":"","sources":["../src/operation-vocab.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AAErG,MAAM,CAAC,MAAM,uBAAuB,GAAwC;IAC3E,kBAAkB;IAClB,cAAc,EAAE,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE;IACrE,mBAAmB,EAAE,EAAE,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,SAAS,EAAE;IAC/E,0BAA0B,EAAE,EAAE,YAAY,EAAE,0BAA0B,EAAE,QAAQ,EAAE,SAAS,EAAE;IAC7F,iBAAiB,EAAE,EAAE,YAAY,EAAE,iBAAiB,EAAE,QAAQ,EAAE,SAAS,EAAE;IA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