@h-rig/contracts 0.0.6-alpha.17 → 0.0.6-alpha.170

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 (176) hide show
  1. package/dist/index.cjs +3373 -0
  2. package/dist/index.mjs +3332 -0
  3. package/dist/src/agent-roles.d.ts +8 -0
  4. package/dist/src/artifact.d.ts +13 -0
  5. package/dist/src/artifact.js +3 -0
  6. package/dist/src/baseSchemas.d.ts +63 -0
  7. package/dist/src/baseSchemas.js +6 -0
  8. package/dist/src/browser.d.ts +80 -0
  9. package/dist/src/browser.js +13 -0
  10. package/dist/src/capability-id.d.ts +22 -0
  11. package/dist/src/capability-id.js +8 -0
  12. package/dist/src/cli-output.d.ts +348 -0
  13. package/dist/src/cli-output.js +190 -0
  14. package/dist/src/cli-runner.d.ts +43 -0
  15. package/dist/src/cli-runner.js +13 -0
  16. package/dist/src/cockpit.d.ts +28 -0
  17. package/dist/src/cockpit.js +13 -0
  18. package/dist/src/collab-session-viewer.d.ts +36 -0
  19. package/dist/src/collab-session-viewer.js +13 -0
  20. package/dist/src/config.d.ts +551 -0
  21. package/dist/src/config.js +765 -162
  22. package/dist/src/control-plane-types.d.ts +323 -0
  23. package/dist/src/control-plane-types.js +13 -0
  24. package/dist/src/conversation.d.ts +50 -0
  25. package/dist/src/conversation.js +3 -0
  26. package/dist/src/dependency-preflight.d.ts +43 -0
  27. package/dist/src/dependency-preflight.js +13 -0
  28. package/dist/src/docs-drift.d.ts +10 -0
  29. package/dist/src/docs-drift.js +12 -0
  30. package/dist/src/doctor.d.ts +90 -0
  31. package/dist/src/doctor.js +13 -0
  32. package/dist/src/drift.d.ts +28 -0
  33. package/dist/src/drift.js +69 -0
  34. package/dist/src/editor.d.ts +25 -0
  35. package/dist/src/editor.js +3 -0
  36. package/dist/src/errors.d.ts +13 -0
  37. package/dist/src/errors.js +17 -0
  38. package/dist/src/git.d.ts +152 -0
  39. package/dist/src/git.js +3 -0
  40. package/dist/src/github.d.ts +285 -0
  41. package/dist/src/github.js +17 -0
  42. package/dist/src/graph.d.ts +360 -0
  43. package/dist/src/graph.js +137 -1
  44. package/dist/src/guard.d.ts +111 -0
  45. package/dist/src/guard.js +6 -0
  46. package/dist/src/harness-events.d.ts +8 -0
  47. package/dist/src/harness-events.js +1 -0
  48. package/dist/src/help-catalog.d.ts +41 -0
  49. package/dist/src/help-catalog.js +13 -0
  50. package/dist/src/host.d.ts +41 -0
  51. package/dist/src/host.js +13 -0
  52. package/dist/src/identity.d.ts +44 -0
  53. package/dist/src/identity.js +1 -0
  54. package/dist/src/index.d.ts +84 -0
  55. package/dist/src/index.js +2746 -3962
  56. package/dist/src/isolation.d.ts +213 -0
  57. package/dist/src/isolation.js +13 -0
  58. package/dist/src/kernel.d.ts +200 -0
  59. package/dist/src/kernel.js +261 -0
  60. package/dist/src/keybindings.d.ts +71 -0
  61. package/dist/src/keybindings.js +3 -0
  62. package/dist/src/layout.d.ts +49 -0
  63. package/dist/src/layout.js +10 -0
  64. package/dist/src/lifecycle-capabilities.d.ts +186 -0
  65. package/dist/src/lifecycle-capabilities.js +33 -0
  66. package/dist/src/managed-repos.d.ts +239 -0
  67. package/dist/src/managed-repos.js +33 -0
  68. package/dist/src/memory.d.ts +199 -0
  69. package/dist/src/memory.js +15 -0
  70. package/dist/src/model.d.ts +77 -0
  71. package/dist/src/native-toolchain.d.ts +46 -0
  72. package/dist/src/native-toolchain.js +13 -0
  73. package/dist/src/notify.d.ts +46 -0
  74. package/dist/src/notify.js +13 -0
  75. package/dist/src/orchestration.d.ts +43 -0
  76. package/dist/src/orchestration.js +28 -961
  77. package/dist/src/panel-protocol.d.ts +17 -0
  78. package/dist/src/panel-protocol.js +10 -0
  79. package/dist/src/pi-session.d.ts +113 -0
  80. package/dist/src/pi-session.js +1 -0
  81. package/dist/src/planning.d.ts +64 -0
  82. package/dist/src/planning.js +90 -0
  83. package/dist/src/plugin-hooks.d.ts +51 -0
  84. package/dist/src/plugin-hooks.js +386 -0
  85. package/dist/src/plugin.d.ts +476 -0
  86. package/dist/src/plugin.js +346 -64
  87. package/dist/src/policy.d.ts +16 -0
  88. package/dist/src/policy.js +3 -0
  89. package/dist/src/project.d.ts +71 -0
  90. package/dist/src/project.js +3 -0
  91. package/dist/src/prompt.d.ts +29 -0
  92. package/dist/src/prompt.js +13 -0
  93. package/dist/src/protocol-version.d.ts +21 -0
  94. package/dist/src/protocol-version.js +6 -0
  95. package/dist/src/provider-instructions.d.ts +41 -0
  96. package/dist/src/provider-instructions.js +13 -0
  97. package/dist/src/provider.d.ts +105 -0
  98. package/dist/src/provider.js +4 -824
  99. package/dist/src/remote.d.ts +318 -0
  100. package/dist/src/remote.js +238 -1078
  101. package/dist/src/review.d.ts +18 -0
  102. package/dist/src/review.js +3 -0
  103. package/dist/src/rollups.d.ts +41 -0
  104. package/dist/src/rollups.js +70 -0
  105. package/dist/src/run-discovery.d.ts +79 -0
  106. package/dist/src/run-discovery.js +13 -0
  107. package/dist/src/run-dispatch.d.ts +34 -0
  108. package/dist/src/run-dispatch.js +13 -0
  109. package/dist/src/run-identity.d.ts +47 -0
  110. package/dist/src/run-identity.js +13 -0
  111. package/dist/src/run-journal.d.ts +694 -0
  112. package/dist/src/run-journal.js +569 -0
  113. package/dist/src/run-read-model.d.ts +255 -0
  114. package/dist/src/run-read-model.js +13 -0
  115. package/dist/src/run-record.d.ts +45 -0
  116. package/dist/src/run-record.js +1 -0
  117. package/dist/src/run-registry-backbone.d.ts +56 -0
  118. package/dist/src/run-registry-backbone.js +13 -0
  119. package/dist/src/run-session-journal.d.ts +69 -0
  120. package/dist/src/run-session-journal.js +78 -0
  121. package/dist/src/run-status.d.ts +10 -0
  122. package/dist/src/run-status.js +27 -0
  123. package/dist/src/run-timeline.d.ts +7 -0
  124. package/dist/src/run-timeline.js +1 -0
  125. package/dist/src/runtime-task-context.d.ts +82 -0
  126. package/dist/src/runtime-task-context.js +1 -0
  127. package/dist/src/runtime.d.ts +103 -0
  128. package/dist/src/runtime.js +73 -906
  129. package/dist/src/session-asset-materializer.d.ts +35 -0
  130. package/dist/src/session-asset-materializer.js +13 -0
  131. package/dist/src/setup.d.ts +88 -0
  132. package/dist/src/setup.js +13 -0
  133. package/dist/src/stage.d.ts +245 -0
  134. package/dist/src/stage.js +169 -0
  135. package/dist/src/supervisor-journal.d.ts +204 -0
  136. package/dist/src/supervisor-journal.js +334 -0
  137. package/dist/src/task-artifacts.d.ts +33 -0
  138. package/dist/src/task-artifacts.js +13 -0
  139. package/dist/src/task-context-renderer.d.ts +29 -0
  140. package/dist/src/task-context-renderer.js +13 -0
  141. package/dist/src/task-data.d.ts +198 -0
  142. package/dist/src/task-data.js +13 -0
  143. package/dist/src/task-graph-primitives.d.ts +47 -0
  144. package/dist/src/task-graph-primitives.js +1 -0
  145. package/dist/src/task-source.d.ts +136 -0
  146. package/dist/src/task-source.js +16 -0
  147. package/dist/src/task-state-metadata.d.ts +21 -0
  148. package/dist/src/task-state-metadata.js +1 -0
  149. package/dist/src/task-state-store.d.ts +16 -0
  150. package/dist/src/task-state-store.js +13 -0
  151. package/dist/src/task-tracker-state.d.ts +106 -0
  152. package/dist/src/task-tracker-state.js +39 -0
  153. package/dist/src/terminal.d.ts +130 -0
  154. package/dist/src/terminal.js +3 -0
  155. package/dist/src/tool-materializer.d.ts +36 -0
  156. package/dist/src/tool-materializer.js +13 -0
  157. package/dist/src/tool-registry.d.ts +3 -0
  158. package/dist/src/tool-registry.js +58 -0
  159. package/dist/src/toolchain-sources.d.ts +54 -0
  160. package/dist/src/toolchain-sources.js +17 -0
  161. package/dist/src/validation.d.ts +14 -0
  162. package/dist/src/validation.js +3 -0
  163. package/dist/src/workflow-journal.d.ts +92 -0
  164. package/dist/src/workflow-journal.js +18 -0
  165. package/dist/src/workspace-config.d.ts +18 -0
  166. package/dist/src/workspace-config.js +13 -0
  167. package/dist/src/workspace.d.ts +204 -0
  168. package/dist/src/workspace.js +76 -911
  169. package/package.json +51 -4
  170. package/dist/src/engine.js +0 -2278
  171. package/dist/src/providerRuntime.js +0 -1630
  172. package/dist/src/rig.js +0 -2374
  173. package/dist/src/server.js +0 -1053
  174. package/dist/src/serviceFabric.js +0 -1066
  175. package/dist/src/ws.js +0 -2968
  176. /package/dist/src/{ipc.js → agent-roles.js} +0 -0
@@ -0,0 +1,130 @@
1
+ import { Schema } from "effect";
2
+ export declare const DEFAULT_TERMINAL_ID = "default";
3
+ export declare const TerminalThreadInput: Schema.Struct<{
4
+ readonly threadId: Schema.Trim;
5
+ }>;
6
+ export type TerminalThreadInput = Schema.Codec.Encoded<typeof TerminalThreadInput>;
7
+ declare const TerminalSessionInput: Schema.Struct<{
8
+ readonly terminalId: Schema.withDecodingDefault<Schema.Trim>;
9
+ readonly threadId: Schema.Trim;
10
+ }>;
11
+ export type TerminalSessionInput = Schema.Codec.Encoded<typeof TerminalSessionInput>;
12
+ export declare const TerminalOpenInput: Schema.Struct<{
13
+ readonly cwd: Schema.Trim;
14
+ readonly cols: Schema.optional<Schema.Int>;
15
+ readonly rows: Schema.optional<Schema.Int>;
16
+ readonly env: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
17
+ readonly terminalId: Schema.withDecodingDefault<Schema.Trim>;
18
+ readonly threadId: Schema.Trim;
19
+ }>;
20
+ export type TerminalOpenInput = Schema.Codec.Encoded<typeof TerminalOpenInput>;
21
+ export declare const TerminalWriteInput: Schema.Struct<{
22
+ readonly data: Schema.String;
23
+ readonly terminalId: Schema.withDecodingDefault<Schema.Trim>;
24
+ readonly threadId: Schema.Trim;
25
+ }>;
26
+ export type TerminalWriteInput = Schema.Codec.Encoded<typeof TerminalWriteInput>;
27
+ export declare const TerminalResizeInput: Schema.Struct<{
28
+ readonly cols: Schema.Int;
29
+ readonly rows: Schema.Int;
30
+ readonly terminalId: Schema.withDecodingDefault<Schema.Trim>;
31
+ readonly threadId: Schema.Trim;
32
+ }>;
33
+ export type TerminalResizeInput = Schema.Codec.Encoded<typeof TerminalResizeInput>;
34
+ export declare const TerminalClearInput: Schema.Struct<{
35
+ readonly terminalId: Schema.withDecodingDefault<Schema.Trim>;
36
+ readonly threadId: Schema.Trim;
37
+ }>;
38
+ export type TerminalClearInput = Schema.Codec.Encoded<typeof TerminalClearInput>;
39
+ export declare const TerminalRestartInput: Schema.Struct<{
40
+ readonly cwd: Schema.Trim;
41
+ readonly cols: Schema.Int;
42
+ readonly rows: Schema.Int;
43
+ readonly env: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
44
+ readonly threadId: Schema.Trim;
45
+ }>;
46
+ export declare const TerminalCloseInput: Schema.Struct<{
47
+ readonly terminalId: Schema.optional<Schema.Trim>;
48
+ readonly deleteHistory: Schema.optional<Schema.Boolean>;
49
+ readonly threadId: Schema.Trim;
50
+ }>;
51
+ export type TerminalCloseInput = Schema.Codec.Encoded<typeof TerminalCloseInput>;
52
+ export declare const TerminalSessionStatus: Schema.Literals<readonly ["starting", "running", "exited", "error"]>;
53
+ export type TerminalSessionStatus = typeof TerminalSessionStatus.Type;
54
+ export declare const TerminalSessionSnapshot: Schema.Struct<{
55
+ readonly threadId: Schema.String;
56
+ readonly terminalId: Schema.String;
57
+ readonly cwd: Schema.String;
58
+ readonly status: Schema.Literals<readonly ["starting", "running", "exited", "error"]>;
59
+ readonly pid: Schema.NullOr<Schema.Int>;
60
+ readonly history: Schema.String;
61
+ readonly exitCode: Schema.NullOr<Schema.Int>;
62
+ readonly exitSignal: Schema.NullOr<Schema.String>;
63
+ readonly updatedAt: Schema.String;
64
+ }>;
65
+ export type TerminalSessionSnapshot = typeof TerminalSessionSnapshot.Type;
66
+ export declare const TerminalEvent: Schema.Union<readonly [Schema.Struct<{
67
+ readonly type: Schema.Literal<"started">;
68
+ readonly snapshot: Schema.Struct<{
69
+ readonly threadId: Schema.String;
70
+ readonly terminalId: Schema.String;
71
+ readonly cwd: Schema.String;
72
+ readonly status: Schema.Literals<readonly ["starting", "running", "exited", "error"]>;
73
+ readonly pid: Schema.NullOr<Schema.Int>;
74
+ readonly history: Schema.String;
75
+ readonly exitCode: Schema.NullOr<Schema.Int>;
76
+ readonly exitSignal: Schema.NullOr<Schema.String>;
77
+ readonly updatedAt: Schema.String;
78
+ }>;
79
+ readonly threadId: Schema.String;
80
+ readonly terminalId: Schema.String;
81
+ readonly createdAt: Schema.String;
82
+ }>, Schema.Struct<{
83
+ readonly type: Schema.Literal<"output">;
84
+ readonly data: Schema.String;
85
+ readonly threadId: Schema.String;
86
+ readonly terminalId: Schema.String;
87
+ readonly createdAt: Schema.String;
88
+ }>, Schema.Struct<{
89
+ readonly type: Schema.Literal<"exited">;
90
+ readonly exitCode: Schema.NullOr<Schema.Int>;
91
+ readonly exitSignal: Schema.NullOr<Schema.String>;
92
+ readonly threadId: Schema.String;
93
+ readonly terminalId: Schema.String;
94
+ readonly createdAt: Schema.String;
95
+ }>, Schema.Struct<{
96
+ readonly type: Schema.Literal<"error">;
97
+ readonly message: Schema.String;
98
+ readonly threadId: Schema.String;
99
+ readonly terminalId: Schema.String;
100
+ readonly createdAt: Schema.String;
101
+ }>, Schema.Struct<{
102
+ readonly type: Schema.Literal<"cleared">;
103
+ readonly threadId: Schema.String;
104
+ readonly terminalId: Schema.String;
105
+ readonly createdAt: Schema.String;
106
+ }>, Schema.Struct<{
107
+ readonly type: Schema.Literal<"restarted">;
108
+ readonly snapshot: Schema.Struct<{
109
+ readonly threadId: Schema.String;
110
+ readonly terminalId: Schema.String;
111
+ readonly cwd: Schema.String;
112
+ readonly status: Schema.Literals<readonly ["starting", "running", "exited", "error"]>;
113
+ readonly pid: Schema.NullOr<Schema.Int>;
114
+ readonly history: Schema.String;
115
+ readonly exitCode: Schema.NullOr<Schema.Int>;
116
+ readonly exitSignal: Schema.NullOr<Schema.String>;
117
+ readonly updatedAt: Schema.String;
118
+ }>;
119
+ readonly threadId: Schema.String;
120
+ readonly terminalId: Schema.String;
121
+ readonly createdAt: Schema.String;
122
+ }>, Schema.Struct<{
123
+ readonly type: Schema.Literal<"activity">;
124
+ readonly hasRunningSubprocess: Schema.Boolean;
125
+ readonly threadId: Schema.String;
126
+ readonly terminalId: Schema.String;
127
+ readonly createdAt: Schema.String;
128
+ }>]>;
129
+ export type TerminalEvent = typeof TerminalEvent.Type;
130
+ export {};
@@ -16,6 +16,9 @@ var WorkspaceId = makeEntityId("WorkspaceId");
16
16
  var GraphId = makeEntityId("GraphId");
17
17
  var TaskId = makeEntityId("TaskId");
18
18
  var RunId = makeEntityId("RunId");
19
+ var SafePathSegment = TrimmedNonEmptyString.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)).pipe(Schema.brand("SafePathSegment"));
20
+ var SafeRunId = TrimmedNonEmptyString.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/)).pipe(Schema.brand("SafeRunId"));
21
+ var SafeGitRefComponent = TrimmedNonEmptyString.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)).pipe(Schema.brand("SafeGitRefComponent"));
19
22
  var EngineRuntimeId = makeEntityId("EngineRuntimeId");
20
23
  var ConversationId = makeEntityId("ConversationId");
21
24
  var ActionId = makeEntityId("ActionId");
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Tool-materializer capability seam.
3
+ *
4
+ * Defines the TOOL_MATERIALIZER service port that @rig/isolation-plugin
5
+ * consumes to build the runtime tool binaries (tool gateway, file tools,
6
+ * claude router, browser tools) without importing @rig/provider-plugin impl
7
+ * files directly. @rig/provider-plugin provides the capability; isolation-plugin
8
+ * resolves it via requireInstalledCapability — the SEAM-ONLY replacement for
9
+ * the four cross-plugin impl imports (§6.4).
10
+ *
11
+ * Pure: types + one branded id, no behaviour.
12
+ */
13
+ import type { CapabilityId } from "./capability-id";
14
+ /**
15
+ * The tool-materializer service: builds provider-plugin-owned runtime tool
16
+ * binaries into the given bin directory.
17
+ */
18
+ export interface ToolMaterializerService {
19
+ /** Materialize the runtime tool gateway binary. Returns the path. */
20
+ materializeRuntimeToolGateway(binDir: string): Promise<string>;
21
+ /** Materialize the runtime file-tools binary. Returns the path. */
22
+ materializeRuntimeFileTools(targetDir: string): Promise<string>;
23
+ /** Materialize the Claude tool-router binary. Returns the path. */
24
+ materializeClaudeToolRouterBinary(projectRoot: string, targetDir: string): Promise<string>;
25
+ /** Materialize the runtime browser-tools binary. Returns the path. */
26
+ materializeRuntimeBrowserTools(targetDir: string): Promise<string>;
27
+ /** Synchronously resolve the runtime browser-tool binary name. */
28
+ runtimeBrowserToolBinaryName(): string;
29
+ }
30
+ /** Stable id string for the tool-materializer service capability. */
31
+ export declare const TOOL_MATERIALIZER_CAPABILITY_ID = "provider.tool-materializer";
32
+ /**
33
+ * The branded tool-materializer capability id. `defineCapability(TOOL_MATERIALIZER)`
34
+ * (provider and consumers independently) resolves to a `ToolMaterializerService`.
35
+ */
36
+ export declare const TOOL_MATERIALIZER: CapabilityId<ToolMaterializerService>;
@@ -0,0 +1,13 @@
1
+ // @bun
2
+ // packages/contracts/src/capability-id.ts
3
+ function makeCapabilityId(id) {
4
+ return id;
5
+ }
6
+
7
+ // packages/contracts/src/tool-materializer.ts
8
+ var TOOL_MATERIALIZER_CAPABILITY_ID = "provider.tool-materializer";
9
+ var TOOL_MATERIALIZER = makeCapabilityId(TOOL_MATERIALIZER_CAPABILITY_ID);
10
+ export {
11
+ TOOL_MATERIALIZER_CAPABILITY_ID,
12
+ TOOL_MATERIALIZER
13
+ };
@@ -0,0 +1,3 @@
1
+ export declare const RUNTIME_SHELL_TOOL_NAMES: readonly string[];
2
+ export declare const RUNTIME_FILE_TOOL_NAMES: readonly string[];
3
+ export declare const RUNTIME_BROWSER_TOOL_NAMES: readonly string[];
@@ -0,0 +1,58 @@
1
+ // @bun
2
+ // packages/contracts/src/tool-registry.ts
3
+ var RUNTIME_SHELL_TOOL_NAMES = [
4
+ "bash",
5
+ "sh",
6
+ "zsh",
7
+ "git",
8
+ "bun",
9
+ "node",
10
+ "python3",
11
+ "rg",
12
+ "grep",
13
+ "sed",
14
+ "cat",
15
+ "ls",
16
+ "find",
17
+ "tsc",
18
+ "gh",
19
+ "mkdir",
20
+ "rm",
21
+ "mv",
22
+ "cp",
23
+ "touch",
24
+ "pwd",
25
+ "head",
26
+ "tail",
27
+ "wc",
28
+ "sort",
29
+ "uniq",
30
+ "awk",
31
+ "xargs",
32
+ "dirname",
33
+ "basename",
34
+ "realpath",
35
+ "env",
36
+ "jq",
37
+ "tee",
38
+ "which"
39
+ ];
40
+ var RUNTIME_FILE_TOOL_NAMES = [
41
+ "rig-read",
42
+ "rig-write",
43
+ "rig-edit",
44
+ "rig-glob",
45
+ "rig-grep"
46
+ ];
47
+ var RUNTIME_BROWSER_TOOL_NAMES = [
48
+ "rig-browser-launch",
49
+ "rig-browser-check",
50
+ "rig-browser-attach-info",
51
+ "rig-browser-e2e",
52
+ "rig-browser-reset-profile"
53
+ ];
54
+ export {
55
+ RUNTIME_SHELL_TOOL_NAMES,
56
+ RUNTIME_FILE_TOOL_NAMES,
57
+ RUNTIME_BROWSER_TOOL_NAMES
58
+ };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Toolchain-source contribution seam.
3
+ *
4
+ * @rig/isolation-plugin's runtime toolchain materializes per-run hook binaries
5
+ * (guard hooks, lifecycle hooks) and standalone helper binaries (controlled-bash)
6
+ * by compiling SOURCE files owned by OTHER plugins. Hardcoding those sibling
7
+ * `packages/<plugin>/src/...` paths inside the toolchain couples it to every
8
+ * owning plugin's file layout (and trips the rule-8b arch invariant).
9
+ *
10
+ * Instead, each owning plugin CONTRIBUTES its build sources as DATA through a
11
+ * typed capability id, and the toolchain RESOLVES them off the project's plugin
12
+ * host. Each contributor owns a DISTINCT capability id (the plugin host enforces
13
+ * one-provider-per-id, so the two contributors cannot share a single id) — the
14
+ * toolchain merges the contributions it finds.
15
+ *
16
+ * Pure: types + branded ids, no behaviour.
17
+ */
18
+ import type { CapabilityId } from "./capability-id";
19
+ /**
20
+ * One per-run hook binary build spec: the binary NAME (the basename the runtime
21
+ * dispatches by) and its `source` entrypoint, expressed RELATIVE to the rig
22
+ * source root (the same string the toolchain feeds to `buildBinary`).
23
+ */
24
+ export interface ToolchainHookBinarySource {
25
+ readonly name: string;
26
+ readonly source: string;
27
+ }
28
+ /**
29
+ * A plugin's contribution of runtime-toolchain build sources.
30
+ *
31
+ * - `hookBinaries` are compiled uniformly into the runtime `hooks/` directory
32
+ * with the shared hook defines.
33
+ * - `namedSources` are standalone source paths the toolchain compiles with its
34
+ * own per-binary defines, keyed by a stable build id (e.g. `"controlled-bash"`).
35
+ *
36
+ * All paths are RELATIVE to the rig source root (unchanged from the literals the
37
+ * toolchain previously embedded), so resolution behaviour is identical.
38
+ */
39
+ export interface ToolchainSourceContribution {
40
+ readonly hookBinaries?: ReadonlyArray<ToolchainHookBinarySource>;
41
+ readonly namedSources?: Readonly<Record<string, string>>;
42
+ }
43
+ /** Stable id for @rig/guard-plugin's toolchain-source contribution. */
44
+ export declare const GUARD_TOOLCHAIN_SOURCES_CAPABILITY_ID = "rig.toolchain.sources.guard";
45
+ /** Stable id for @rig/bundle-default-lifecycle's toolchain-source contribution. */
46
+ export declare const LIFECYCLE_TOOLCHAIN_SOURCES_CAPABILITY_ID = "rig.toolchain.sources.lifecycle";
47
+ /**
48
+ * The guard-plugin toolchain-source capability id. `defineCapability(...)` (the
49
+ * provider and the isolation-plugin consumer construct it independently from the
50
+ * shared id) resolves to a `ToolchainSourceContribution`.
51
+ */
52
+ export declare const GUARD_TOOLCHAIN_SOURCES: CapabilityId<ToolchainSourceContribution>;
53
+ /** The bundle-default-lifecycle toolchain-source capability id. */
54
+ export declare const LIFECYCLE_TOOLCHAIN_SOURCES: CapabilityId<ToolchainSourceContribution>;
@@ -0,0 +1,17 @@
1
+ // @bun
2
+ // packages/contracts/src/capability-id.ts
3
+ function makeCapabilityId(id) {
4
+ return id;
5
+ }
6
+
7
+ // packages/contracts/src/toolchain-sources.ts
8
+ var GUARD_TOOLCHAIN_SOURCES_CAPABILITY_ID = "rig.toolchain.sources.guard";
9
+ var LIFECYCLE_TOOLCHAIN_SOURCES_CAPABILITY_ID = "rig.toolchain.sources.lifecycle";
10
+ var GUARD_TOOLCHAIN_SOURCES = makeCapabilityId(GUARD_TOOLCHAIN_SOURCES_CAPABILITY_ID);
11
+ var LIFECYCLE_TOOLCHAIN_SOURCES = makeCapabilityId(LIFECYCLE_TOOLCHAIN_SOURCES_CAPABILITY_ID);
12
+ export {
13
+ LIFECYCLE_TOOLCHAIN_SOURCES_CAPABILITY_ID,
14
+ LIFECYCLE_TOOLCHAIN_SOURCES,
15
+ GUARD_TOOLCHAIN_SOURCES_CAPABILITY_ID,
16
+ GUARD_TOOLCHAIN_SOURCES
17
+ };
@@ -0,0 +1,14 @@
1
+ import { Schema } from "effect";
2
+ export declare const ValidationStatus: Schema.Literals<readonly ["pending", "running", "passed", "failed", "skipped"]>;
3
+ export type ValidationStatus = typeof ValidationStatus.Type;
4
+ export declare const ValidationSummary: Schema.Struct<{
5
+ readonly id: Schema.brand<Schema.Trim, "ValidationResultId">;
6
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
7
+ readonly taskId: Schema.NullOr<Schema.brand<Schema.Trim, "TaskId">>;
8
+ readonly validatorKey: Schema.Trim;
9
+ readonly status: Schema.Literals<readonly ["pending", "running", "passed", "failed", "skipped"]>;
10
+ readonly output: Schema.Unknown;
11
+ readonly startedAt: Schema.String;
12
+ readonly completedAt: Schema.NullOr<Schema.String>;
13
+ }>;
14
+ export type ValidationSummary = typeof ValidationSummary.Type;
@@ -16,6 +16,9 @@ var WorkspaceId = makeEntityId("WorkspaceId");
16
16
  var GraphId = makeEntityId("GraphId");
17
17
  var TaskId = makeEntityId("TaskId");
18
18
  var RunId = makeEntityId("RunId");
19
+ var SafePathSegment = TrimmedNonEmptyString.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)).pipe(Schema.brand("SafePathSegment"));
20
+ var SafeRunId = TrimmedNonEmptyString.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/)).pipe(Schema.brand("SafeRunId"));
21
+ var SafeGitRefComponent = TrimmedNonEmptyString.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)).pipe(Schema.brand("SafeGitRefComponent"));
19
22
  var EngineRuntimeId = makeEntityId("EngineRuntimeId");
20
23
  var ConversationId = makeEntityId("ConversationId");
21
24
  var ActionId = makeEntityId("ActionId");
@@ -0,0 +1,92 @@
1
+ export declare const RIG_WORKFLOW_STARTED: "rig.workflow.started";
2
+ export declare const RIG_WORKFLOW_TARGET_SELECTED: "rig.workflow.target.selected";
3
+ export declare const RIG_WORKFLOW_TASK_SELECTED: "rig.workflow.task.selected";
4
+ export declare const RIG_WORKFLOW_STATUS_CHANGED: "rig.workflow.status.changed";
5
+ export declare const RIG_WORKFLOW_OPERATOR_NOTE: "rig.workflow.operator.note";
6
+ export declare const RIG_WORKFLOW_INBOX_REQUESTED: "rig.workflow.inbox.requested";
7
+ export declare const RIG_WORKFLOW_INBOX_RESOLVED: "rig.workflow.inbox.resolved";
8
+ export type RigWorkflowEntryType = typeof RIG_WORKFLOW_STARTED | typeof RIG_WORKFLOW_TARGET_SELECTED | typeof RIG_WORKFLOW_TASK_SELECTED | typeof RIG_WORKFLOW_STATUS_CHANGED | typeof RIG_WORKFLOW_OPERATOR_NOTE | typeof RIG_WORKFLOW_INBOX_REQUESTED | typeof RIG_WORKFLOW_INBOX_RESOLVED;
9
+ export type RigWorkflowTarget = "local" | "remote";
10
+ export type RigWorkflowOwner = {
11
+ githubUserId: string;
12
+ login: string;
13
+ namespaceKey: string;
14
+ };
15
+ export type RigWorkflowStarted = {
16
+ schemaVersion: 1;
17
+ workflowId: string;
18
+ target: RigWorkflowTarget;
19
+ selectedRepo: string;
20
+ owner: RigWorkflowOwner;
21
+ createdAt: string;
22
+ };
23
+ export type RigWorkflowTargetSelected = {
24
+ schemaVersion: 1;
25
+ target: RigWorkflowTarget;
26
+ reason?: string;
27
+ selectedAt: string;
28
+ };
29
+ export type RigWorkflowTaskSelected = {
30
+ schemaVersion: 1;
31
+ taskId: string;
32
+ title?: string;
33
+ selectedAt: string;
34
+ };
35
+ export type RigWorkflowStatus = "starting" | "running" | "waiting-approval" | "waiting-input" | "completed" | "failed" | "stopped";
36
+ export type RigWorkflowStatusChanged = {
37
+ schemaVersion: 1;
38
+ status: RigWorkflowStatus;
39
+ detail?: string;
40
+ changedAt: string;
41
+ };
42
+ export type RigWorkflowOperatorNote = {
43
+ schemaVersion: 1;
44
+ noteId?: string;
45
+ note: string;
46
+ notedAt: string;
47
+ };
48
+ export type RigWorkflowInboxRequested = {
49
+ schemaVersion: 1;
50
+ requestId: string;
51
+ kind: "approval" | "input";
52
+ title: string;
53
+ body?: string;
54
+ options?: readonly string[];
55
+ requestedAt: string;
56
+ };
57
+ export type RigWorkflowInboxResolved = {
58
+ schemaVersion: 1;
59
+ requestId: string;
60
+ decision: "approved" | "rejected" | "answered";
61
+ answer?: unknown;
62
+ resolvedAt: string;
63
+ };
64
+ export type RigWorkflowProjection = {
65
+ started: RigWorkflowStarted | null;
66
+ target: RigWorkflowTargetSelected | null;
67
+ task: RigWorkflowTaskSelected | null;
68
+ status: RigWorkflowStatusChanged | null;
69
+ notes: readonly RigWorkflowOperatorNote[];
70
+ inbox: readonly RigWorkflowInboxRequested[];
71
+ resolvedInbox: readonly RigWorkflowInboxResolved[];
72
+ updatedAt: string | null;
73
+ };
74
+ export type RigWorkflowCustomEntry = {
75
+ type: string;
76
+ customType?: string;
77
+ data?: unknown;
78
+ };
79
+ export type RigCollabWorkflowMarkerInput = {
80
+ sessionId: string;
81
+ sessionPath: string;
82
+ cwd: string;
83
+ title: string;
84
+ joinLink: string;
85
+ webLink: string;
86
+ relayUrl?: string;
87
+ selectedRepo?: string;
88
+ owner?: Partial<RigWorkflowOwner>;
89
+ startedAt: string;
90
+ updatedAt: string;
91
+ stale: boolean;
92
+ };
@@ -0,0 +1,18 @@
1
+ // @bun
2
+ // packages/contracts/src/workflow-journal.ts
3
+ var RIG_WORKFLOW_STARTED = "rig.workflow.started";
4
+ var RIG_WORKFLOW_TARGET_SELECTED = "rig.workflow.target.selected";
5
+ var RIG_WORKFLOW_TASK_SELECTED = "rig.workflow.task.selected";
6
+ var RIG_WORKFLOW_STATUS_CHANGED = "rig.workflow.status.changed";
7
+ var RIG_WORKFLOW_OPERATOR_NOTE = "rig.workflow.operator.note";
8
+ var RIG_WORKFLOW_INBOX_REQUESTED = "rig.workflow.inbox.requested";
9
+ var RIG_WORKFLOW_INBOX_RESOLVED = "rig.workflow.inbox.resolved";
10
+ export {
11
+ RIG_WORKFLOW_TASK_SELECTED,
12
+ RIG_WORKFLOW_TARGET_SELECTED,
13
+ RIG_WORKFLOW_STATUS_CHANGED,
14
+ RIG_WORKFLOW_STARTED,
15
+ RIG_WORKFLOW_OPERATOR_NOTE,
16
+ RIG_WORKFLOW_INBOX_RESOLVED,
17
+ RIG_WORKFLOW_INBOX_REQUESTED
18
+ };
@@ -0,0 +1,18 @@
1
+ import type { CapabilityId } from "./capability-id";
2
+ export type EnsureDeclarativeConfigInput = {
3
+ readonly projectRoot: string;
4
+ readonly repoSlug?: string;
5
+ };
6
+ export type EnsureDeclarativeConfigResult = {
7
+ /** True when this call wrote a new `.rig/rigfig.toml`. */
8
+ readonly created: boolean;
9
+ /** The rigfig path when one now exists (created or pre-existing), else null. */
10
+ readonly path: string | null;
11
+ /** Why nothing was created (code config present, no plugin produced a config, …). */
12
+ readonly reason?: string;
13
+ };
14
+ export interface WorkspaceConfigEnsureService {
15
+ ensureDeclarativeConfig(input: EnsureDeclarativeConfigInput): EnsureDeclarativeConfigResult;
16
+ }
17
+ export declare const WORKSPACE_CONFIG_ENSURE_CAPABILITY_ID = "workspace.config.ensure";
18
+ export declare const WORKSPACE_CONFIG_ENSURE: CapabilityId<WorkspaceConfigEnsureService>;
@@ -0,0 +1,13 @@
1
+ // @bun
2
+ // packages/contracts/src/capability-id.ts
3
+ function makeCapabilityId(id) {
4
+ return id;
5
+ }
6
+
7
+ // packages/contracts/src/workspace-config.ts
8
+ var WORKSPACE_CONFIG_ENSURE_CAPABILITY_ID = "workspace.config.ensure";
9
+ var WORKSPACE_CONFIG_ENSURE = makeCapabilityId(WORKSPACE_CONFIG_ENSURE_CAPABILITY_ID);
10
+ export {
11
+ WORKSPACE_CONFIG_ENSURE_CAPABILITY_ID,
12
+ WORKSPACE_CONFIG_ENSURE
13
+ };