@h-rig/contracts 0.0.6-alpha.18 → 0.0.6-alpha.181

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 (205) hide show
  1. package/dist/index.cjs +3442 -0
  2. package/dist/index.mjs +3401 -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/blocker-classifier.d.ts +21 -0
  9. package/dist/src/blocker-classifier.js +13 -0
  10. package/dist/src/browser.d.ts +80 -0
  11. package/dist/src/browser.js +13 -0
  12. package/dist/src/capability-id.d.ts +22 -0
  13. package/dist/src/capability-id.js +8 -0
  14. package/dist/src/cli-output.d.ts +348 -0
  15. package/dist/src/cli-output.js +190 -0
  16. package/dist/src/cli-runner.d.ts +43 -0
  17. package/dist/src/cli-runner.js +13 -0
  18. package/dist/src/cockpit.d.ts +58 -0
  19. package/dist/src/cockpit.js +13 -0
  20. package/dist/src/collab-session-viewer.d.ts +36 -0
  21. package/dist/src/collab-session-viewer.js +13 -0
  22. package/dist/src/config.d.ts +553 -0
  23. package/dist/src/config.js +767 -162
  24. package/dist/src/control-plane-types.d.ts +323 -0
  25. package/dist/src/control-plane-types.js +13 -0
  26. package/dist/src/conversation.d.ts +50 -0
  27. package/dist/src/conversation.js +3 -0
  28. package/dist/src/dependency-preflight.d.ts +43 -0
  29. package/dist/src/dependency-preflight.js +13 -0
  30. package/dist/src/docs-drift.d.ts +10 -0
  31. package/dist/src/docs-drift.js +12 -0
  32. package/dist/src/doctor.d.ts +90 -0
  33. package/dist/src/doctor.js +13 -0
  34. package/dist/src/drift.d.ts +28 -0
  35. package/dist/src/drift.js +69 -0
  36. package/dist/src/editor.d.ts +25 -0
  37. package/dist/src/editor.js +3 -0
  38. package/dist/src/errors.d.ts +13 -0
  39. package/dist/src/errors.js +17 -0
  40. package/dist/src/git.d.ts +152 -0
  41. package/dist/src/git.js +3 -0
  42. package/dist/src/github.d.ts +295 -0
  43. package/dist/src/github.js +17 -0
  44. package/dist/src/graph.d.ts +360 -0
  45. package/dist/src/graph.js +137 -1
  46. package/dist/src/guard.d.ts +118 -0
  47. package/dist/src/guard.js +15 -0
  48. package/dist/src/harness-events.d.ts +8 -0
  49. package/dist/src/harness-events.js +1 -0
  50. package/dist/src/harness-profile-state.d.ts +10 -0
  51. package/dist/src/harness-profile-state.js +13 -0
  52. package/dist/src/help-catalog.d.ts +41 -0
  53. package/dist/src/help-catalog.js +13 -0
  54. package/dist/src/host.d.ts +41 -0
  55. package/dist/src/host.js +13 -0
  56. package/dist/src/identity.d.ts +44 -0
  57. package/dist/src/identity.js +1 -0
  58. package/dist/src/index.d.ts +98 -0
  59. package/dist/src/index.js +2605 -3752
  60. package/dist/src/isolation.d.ts +213 -0
  61. package/dist/src/isolation.js +13 -0
  62. package/dist/src/kernel.d.ts +200 -0
  63. package/dist/src/kernel.js +261 -0
  64. package/dist/src/keybindings.d.ts +71 -0
  65. package/dist/src/keybindings.js +3 -0
  66. package/dist/src/layout.d.ts +44 -0
  67. package/dist/src/layout.js +8 -0
  68. package/dist/src/lifecycle-capabilities.d.ts +224 -0
  69. package/dist/src/lifecycle-capabilities.js +45 -0
  70. package/dist/src/managed-repos.d.ts +339 -0
  71. package/dist/src/managed-repos.js +37 -0
  72. package/dist/src/memory.d.ts +199 -0
  73. package/dist/src/memory.js +15 -0
  74. package/dist/src/model.d.ts +13 -0
  75. package/dist/src/model.js +3 -58
  76. package/dist/src/native-toolchain.d.ts +46 -0
  77. package/dist/src/native-toolchain.js +13 -0
  78. package/dist/src/notify.d.ts +46 -0
  79. package/dist/src/notify.js +13 -0
  80. package/dist/src/orchestration.d.ts +43 -0
  81. package/dist/src/orchestration.js +28 -961
  82. package/dist/src/panel-protocol.d.ts +17 -0
  83. package/dist/src/panel-protocol.js +10 -0
  84. package/dist/src/pi-session.d.ts +113 -0
  85. package/dist/src/pi-session.js +1 -0
  86. package/dist/src/placement.d.ts +47 -0
  87. package/dist/src/placement.js +13 -0
  88. package/dist/src/planning.d.ts +64 -0
  89. package/dist/src/planning.js +90 -0
  90. package/dist/src/plugin-hooks.d.ts +51 -0
  91. package/dist/src/plugin-hooks.js +386 -0
  92. package/dist/src/plugin.d.ts +476 -0
  93. package/dist/src/plugin.js +346 -64
  94. package/dist/src/policy.d.ts +16 -0
  95. package/dist/src/policy.js +3 -0
  96. package/dist/src/product-entrypoint.d.ts +22 -0
  97. package/dist/src/product-entrypoint.js +13 -0
  98. package/dist/src/project.d.ts +71 -0
  99. package/dist/src/project.js +3 -0
  100. package/dist/src/prompt.d.ts +29 -0
  101. package/dist/src/prompt.js +13 -0
  102. package/dist/src/protocol-version.d.ts +21 -0
  103. package/dist/src/protocol-version.js +6 -0
  104. package/dist/src/provider-instructions.d.ts +41 -0
  105. package/dist/src/provider-instructions.js +13 -0
  106. package/dist/src/provider.d.ts +105 -0
  107. package/dist/src/provider.js +16 -835
  108. package/dist/src/remote-control.d.ts +93 -0
  109. package/dist/src/remote-control.js +26 -0
  110. package/dist/src/remote.d.ts +318 -0
  111. package/dist/src/remote.js +238 -1078
  112. package/dist/src/review.d.ts +18 -0
  113. package/dist/src/review.js +3 -0
  114. package/dist/src/rollups.d.ts +41 -0
  115. package/dist/src/rollups.js +70 -0
  116. package/dist/src/run-control.d.ts +164 -0
  117. package/dist/src/run-control.js +13 -0
  118. package/dist/src/run-discovery.d.ts +83 -0
  119. package/dist/src/run-discovery.js +13 -0
  120. package/dist/src/run-dispatch.d.ts +34 -0
  121. package/dist/src/run-dispatch.js +13 -0
  122. package/dist/src/run-identity.d.ts +47 -0
  123. package/dist/src/run-identity.js +13 -0
  124. package/dist/src/run-journal.d.ts +694 -0
  125. package/dist/src/run-journal.js +569 -0
  126. package/dist/src/run-queue.d.ts +36 -0
  127. package/dist/src/run-queue.js +13 -0
  128. package/dist/src/run-read-model.d.ts +200 -0
  129. package/dist/src/run-read-model.js +13 -0
  130. package/dist/src/run-record.d.ts +45 -0
  131. package/dist/src/run-record.js +1 -0
  132. package/dist/src/run-registry-backbone.d.ts +56 -0
  133. package/dist/src/run-registry-backbone.js +13 -0
  134. package/dist/src/run-session-journal.d.ts +154 -0
  135. package/dist/src/run-session-journal.js +87 -0
  136. package/dist/src/run-status.d.ts +10 -0
  137. package/dist/src/run-status.js +27 -0
  138. package/dist/src/run-timeline.d.ts +7 -0
  139. package/dist/src/run-timeline.js +1 -0
  140. package/dist/src/runtime-secrets.d.ts +10 -0
  141. package/dist/src/runtime-secrets.js +13 -0
  142. package/dist/src/runtime-task-context.d.ts +82 -0
  143. package/dist/src/runtime-task-context.js +1 -0
  144. package/dist/src/runtime.d.ts +103 -0
  145. package/dist/src/runtime.js +73 -906
  146. package/dist/src/session-asset-materializer.d.ts +35 -0
  147. package/dist/src/session-asset-materializer.js +13 -0
  148. package/dist/src/session-hook-materializer.d.ts +41 -0
  149. package/dist/src/session-hook-materializer.js +13 -0
  150. package/dist/src/setup.d.ts +154 -0
  151. package/dist/src/setup.js +13 -0
  152. package/dist/src/stage.d.ts +245 -0
  153. package/dist/src/stage.js +169 -0
  154. package/dist/src/supervisor-journal.d.ts +204 -0
  155. package/dist/src/supervisor-journal.js +336 -0
  156. package/dist/src/supervisor-loop.d.ts +40 -0
  157. package/dist/src/supervisor-loop.js +13 -0
  158. package/dist/src/task-artifacts.d.ts +53 -0
  159. package/dist/src/task-artifacts.js +13 -0
  160. package/dist/src/task-config.d.ts +22 -0
  161. package/dist/src/task-config.js +1 -0
  162. package/dist/src/task-context-renderer.d.ts +29 -0
  163. package/dist/src/task-context-renderer.js +13 -0
  164. package/dist/src/task-data.d.ts +196 -0
  165. package/dist/src/task-data.js +13 -0
  166. package/dist/src/task-graph-primitives.d.ts +47 -0
  167. package/dist/src/task-graph-primitives.js +1 -0
  168. package/dist/src/task-source.d.ts +167 -0
  169. package/dist/src/task-source.js +24 -0
  170. package/dist/src/task-state-metadata.d.ts +21 -0
  171. package/dist/src/task-state-metadata.js +1 -0
  172. package/dist/src/task-state-paths.d.ts +14 -0
  173. package/dist/src/task-state-paths.js +13 -0
  174. package/dist/src/task-state-store.d.ts +36 -0
  175. package/dist/src/task-state-store.js +17 -0
  176. package/dist/src/task-tracker-state.d.ts +101 -0
  177. package/dist/src/task-tracker-state.js +39 -0
  178. package/dist/src/terminal.d.ts +130 -0
  179. package/dist/src/terminal.js +3 -0
  180. package/dist/src/tool-materializer.d.ts +36 -0
  181. package/dist/src/tool-materializer.js +13 -0
  182. package/dist/src/tool-registry.d.ts +3 -0
  183. package/dist/src/tool-registry.js +58 -0
  184. package/dist/src/toolchain-sources.d.ts +54 -0
  185. package/dist/src/toolchain-sources.js +17 -0
  186. package/dist/src/transport-config.d.ts +161 -0
  187. package/dist/src/transport-config.js +15 -0
  188. package/dist/src/validation.d.ts +14 -0
  189. package/dist/src/validation.js +3 -0
  190. package/dist/src/workflow-journal.d.ts +125 -0
  191. package/dist/src/workflow-journal.js +27 -0
  192. package/dist/src/workspace-config.d.ts +18 -0
  193. package/dist/src/workspace-config.js +13 -0
  194. package/dist/src/workspace-service.d.ts +16 -0
  195. package/dist/src/workspace-service.js +13 -0
  196. package/dist/src/workspace.d.ts +204 -0
  197. package/dist/src/workspace.js +76 -911
  198. package/package.json +55 -4
  199. package/dist/src/engine.js +0 -2278
  200. package/dist/src/providerRuntime.js +0 -1630
  201. package/dist/src/rig.js +0 -2374
  202. package/dist/src/server.js +0 -1053
  203. package/dist/src/serviceFabric.js +0 -1066
  204. package/dist/src/ws.js +0 -2968
  205. /package/dist/src/{ipc.js → agent-roles.js} +0 -0
@@ -0,0 +1,71 @@
1
+ import { Schema } from "effect";
2
+ export declare const MAX_KEYBINDING_VALUE_LENGTH = 64;
3
+ export declare const MAX_WHEN_EXPRESSION_DEPTH = 64;
4
+ export declare const MAX_SCRIPT_ID_LENGTH = 24;
5
+ export declare const MAX_KEYBINDINGS_COUNT = 256;
6
+ export declare const SCRIPT_RUN_COMMAND_PATTERN: Schema.TemplateLiteral<readonly [Schema.Literal<"script.">, Schema.String, Schema.Literal<".run">]>;
7
+ export declare const KeybindingCommand: Schema.Union<readonly [Schema.Literals<readonly ["terminal.toggle", "terminal.split", "terminal.new", "terminal.close", "diff.toggle", "chat.new", "chat.newLocal", "editor.openFavorite"]>, Schema.TemplateLiteral<readonly [Schema.Literal<"script.">, Schema.String, Schema.Literal<".run">]>]>;
8
+ export type KeybindingCommand = typeof KeybindingCommand.Type;
9
+ export declare const KeybindingRule: Schema.Struct<{
10
+ readonly key: Schema.Trim;
11
+ readonly command: Schema.Union<readonly [Schema.Literals<readonly ["terminal.toggle", "terminal.split", "terminal.new", "terminal.close", "diff.toggle", "chat.new", "chat.newLocal", "editor.openFavorite"]>, Schema.TemplateLiteral<readonly [Schema.Literal<"script.">, Schema.String, Schema.Literal<".run">]>]>;
12
+ readonly when: Schema.optional<Schema.Trim>;
13
+ }>;
14
+ export type KeybindingRule = typeof KeybindingRule.Type;
15
+ export declare const KeybindingsConfig: Schema.$Array<Schema.Struct<{
16
+ readonly key: Schema.Trim;
17
+ readonly command: Schema.Union<readonly [Schema.Literals<readonly ["terminal.toggle", "terminal.split", "terminal.new", "terminal.close", "diff.toggle", "chat.new", "chat.newLocal", "editor.openFavorite"]>, Schema.TemplateLiteral<readonly [Schema.Literal<"script.">, Schema.String, Schema.Literal<".run">]>]>;
18
+ readonly when: Schema.optional<Schema.Trim>;
19
+ }>>;
20
+ export type KeybindingsConfig = typeof KeybindingsConfig.Type;
21
+ export declare const KeybindingShortcut: Schema.Struct<{
22
+ readonly key: Schema.Trim;
23
+ readonly metaKey: Schema.Boolean;
24
+ readonly ctrlKey: Schema.Boolean;
25
+ readonly shiftKey: Schema.Boolean;
26
+ readonly altKey: Schema.Boolean;
27
+ readonly modKey: Schema.Boolean;
28
+ }>;
29
+ export type KeybindingShortcut = typeof KeybindingShortcut.Type;
30
+ export declare const KeybindingWhenNode: Schema.Schema<KeybindingWhenNode>;
31
+ export type KeybindingWhenNode = {
32
+ type: "identifier";
33
+ name: string;
34
+ } | {
35
+ type: "not";
36
+ node: KeybindingWhenNode;
37
+ } | {
38
+ type: "and";
39
+ left: KeybindingWhenNode;
40
+ right: KeybindingWhenNode;
41
+ } | {
42
+ type: "or";
43
+ left: KeybindingWhenNode;
44
+ right: KeybindingWhenNode;
45
+ };
46
+ export declare const ResolvedKeybindingRule: Schema.Struct<{
47
+ readonly command: Schema.Union<readonly [Schema.Literals<readonly ["terminal.toggle", "terminal.split", "terminal.new", "terminal.close", "diff.toggle", "chat.new", "chat.newLocal", "editor.openFavorite"]>, Schema.TemplateLiteral<readonly [Schema.Literal<"script.">, Schema.String, Schema.Literal<".run">]>]>;
48
+ readonly shortcut: Schema.Struct<{
49
+ readonly key: Schema.Trim;
50
+ readonly metaKey: Schema.Boolean;
51
+ readonly ctrlKey: Schema.Boolean;
52
+ readonly shiftKey: Schema.Boolean;
53
+ readonly altKey: Schema.Boolean;
54
+ readonly modKey: Schema.Boolean;
55
+ }>;
56
+ readonly whenAst: Schema.optional<Schema.Schema<KeybindingWhenNode>>;
57
+ }>;
58
+ export type ResolvedKeybindingRule = typeof ResolvedKeybindingRule.Type;
59
+ export declare const ResolvedKeybindingsConfig: Schema.$Array<Schema.Struct<{
60
+ readonly command: Schema.Union<readonly [Schema.Literals<readonly ["terminal.toggle", "terminal.split", "terminal.new", "terminal.close", "diff.toggle", "chat.new", "chat.newLocal", "editor.openFavorite"]>, Schema.TemplateLiteral<readonly [Schema.Literal<"script.">, Schema.String, Schema.Literal<".run">]>]>;
61
+ readonly shortcut: Schema.Struct<{
62
+ readonly key: Schema.Trim;
63
+ readonly metaKey: Schema.Boolean;
64
+ readonly ctrlKey: Schema.Boolean;
65
+ readonly shiftKey: Schema.Boolean;
66
+ readonly altKey: Schema.Boolean;
67
+ readonly modKey: Schema.Boolean;
68
+ }>;
69
+ readonly whenAst: Schema.optional<Schema.Schema<KeybindingWhenNode>>;
70
+ }>>;
71
+ export type ResolvedKeybindingsConfig = typeof ResolvedKeybindingsConfig.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,44 @@
1
+ /** Directory name for a project's checked-in rig definition (`<root>/rig`). */
2
+ export declare const RIG_DEFINITION_DIRNAME = "rig";
3
+ /** Directory name for rig's per-project state (`<root>/.rig`). */
4
+ export declare const RIG_STATE_DIRNAME = ".rig";
5
+ export type RigLayout = {
6
+ projectRoot: string;
7
+ monorepoRoot: string;
8
+ definitionRoot: string;
9
+ runtimeWorkspaceRoot: string;
10
+ stateRoot: string;
11
+ configPath: string;
12
+ policyDir: string;
13
+ policyFile: string;
14
+ pluginsDir: string;
15
+ hooksDir: string;
16
+ toolsDir: string;
17
+ templatesDir: string;
18
+ validationDir: string;
19
+ stateDir: string;
20
+ logsDir: string;
21
+ notificationsDir: string;
22
+ runtimeDir: string;
23
+ distDir: string;
24
+ binDir: string;
25
+ pluginBinDir: string;
26
+ keybindingsPath: string;
27
+ controlPlaneEventsFile: string;
28
+ };
29
+ export type RuntimeWorkspaceLayout = {
30
+ workspaceDir: string;
31
+ rigRoot: string;
32
+ stateDir: string;
33
+ logsDir: string;
34
+ runtimeDir: string;
35
+ homeDir: string;
36
+ tmpDir: string;
37
+ cacheDir: string;
38
+ sessionDir: string;
39
+ binDir: string;
40
+ distDir: string;
41
+ pluginBinDir: string;
42
+ contextPath: string;
43
+ controlPlaneEventsFile: string;
44
+ };
@@ -0,0 +1,8 @@
1
+ // @bun
2
+ // packages/contracts/src/layout.ts
3
+ var RIG_DEFINITION_DIRNAME = "rig";
4
+ var RIG_STATE_DIRNAME = ".rig";
5
+ export {
6
+ RIG_STATE_DIRNAME,
7
+ RIG_DEFINITION_DIRNAME
8
+ };
@@ -0,0 +1,224 @@
1
+ /**
2
+ * Typed ports for the default-lifecycle bundle's verification services.
3
+ *
4
+ * The dumb runtime substrate (rig-agent, harness-cli) must NOT import the
5
+ * lifecycle bundle (substrate->plugin cycle). Instead the bundle plugin
6
+ * registers executable impls under these ids on its
7
+ * `contributes.capabilities[].run`, and the runtime resolves them by id from
8
+ * `pluginHost.listExecutableCapabilities()`. These pure types are the shared
9
+ * contract for that seam — they carry no behaviour and import nothing.
10
+ */
11
+ import type { CapabilityId } from "./capability-id";
12
+ import type { JournalCapability } from "./kernel";
13
+ import type { RigAutomationConfig, StrictPrGreptileApiOptions } from "./control-plane-types";
14
+ import type { RunCloseoutPhase, RunCloseoutPhaseOutcome } from "./run-journal";
15
+ import type { RunJournal, RunJournalSessionManager } from "./run-session-journal";
16
+ import type { TaskSourceUpdateResult, TaskTerminalStateInput } from "./task-source";
17
+ import type { TaskReopenSummary } from "./task-data";
18
+ /** Capability id the bundle registers its `taskVerify` orchestration under. */
19
+ export declare const TASK_VERIFY_CAPABILITY_ID = "default-lifecycle.task-verify";
20
+ /** Capability id the bundle registers its task validation runner under. */
21
+ export declare const TASK_VALIDATION_CAPABILITY_ID = "default-lifecycle.task-validation";
22
+ /** Capability id the bundle registers the completion-verification gate under. */
23
+ export declare const COMPLETION_VERIFICATION_CAPABILITY_ID = "default-lifecycle.completion-verification";
24
+ /** Capability id the bundle registers its run-worker closeout driver under. */
25
+ export declare const RUN_CLOSEOUT_CAPABILITY_ID = "default-lifecycle.run-closeout";
26
+ /** Capability id @rig/run-worker registers for writable run-session journal binding. */
27
+ export declare const RUN_SESSION_JOURNAL_WRITER_CAPABILITY_ID = "run-worker.run-session-journal-writer";
28
+ /** Capability id the bundle registers its lifecycle-owned task-source reflection under. */
29
+ export declare const TASK_SOURCE_REFLECTION_CAPABILITY_ID = "default-lifecycle.task-source-reflection";
30
+ /** Capability id the bundle registers its lifecycle-owned task terminal-state policy under. */
31
+ export declare const TASK_TERMINAL_STATE_CAPABILITY_ID = "default-lifecycle.task-terminal-state";
32
+ /** Capability id the bundle registers its lifecycle-owned task reopen policy under. */
33
+ export declare const TASK_REOPEN_CAPABILITY_ID = "default-lifecycle.task-reopen";
34
+ /** Capability id the bundle registers its agent-facing git helper surface under. */
35
+ export declare const LIFECYCLE_GIT_AGENT_CAPABILITY_ID = "default-lifecycle.git-agent";
36
+ export interface TaskVerifyCapabilityInput {
37
+ readonly projectRoot: string;
38
+ readonly taskId?: string;
39
+ }
40
+ /** Resolves true when the task is approved, false when verification rejects. */
41
+ export type TaskVerifyCapabilityRun = (input: TaskVerifyCapabilityInput) => Promise<boolean>;
42
+ /**
43
+ * The typed capability id the bundle provides its task-verify run under, phantom-
44
+ * typed with {@link TaskVerifyCapabilityRun} so `defineCapability(TASK_VERIFY_CAPABILITY)`
45
+ * resolves to the run function with no cast leaking to callers. Its string value
46
+ * is {@link TASK_VERIFY_CAPABILITY_ID}, so it indexes the same host entry.
47
+ */
48
+ export declare const TASK_VERIFY_CAPABILITY: CapabilityId<TaskVerifyCapabilityRun>;
49
+ export interface TaskValidationCapabilityInput {
50
+ readonly projectRoot: string;
51
+ readonly taskId?: string;
52
+ readonly validatorRegistry?: unknown;
53
+ }
54
+ /** Resolves true when task validation passes or is skipped, false on validation failures. */
55
+ export type TaskValidationCapabilityRun = (input: TaskValidationCapabilityInput) => Promise<boolean>;
56
+ export declare const TASK_VALIDATION_CAPABILITY: CapabilityId<TaskValidationCapabilityRun>;
57
+ export interface CompletionVerificationCapabilityInput {
58
+ readonly projectRoot: string;
59
+ readonly taskId?: string;
60
+ }
61
+ export interface CompletionVerificationCapabilityResult {
62
+ /** True when every completion gate passed; false when the gate blocks. */
63
+ readonly ok: boolean;
64
+ }
65
+ export type CompletionVerificationCapabilityRun = (input: CompletionVerificationCapabilityInput) => Promise<CompletionVerificationCapabilityResult>;
66
+ /**
67
+ * The typed capability id the bundle provides its completion-verification gate
68
+ * under, phantom-typed with {@link CompletionVerificationCapabilityRun}. Its
69
+ * string value is {@link COMPLETION_VERIFICATION_CAPABILITY_ID}, so it indexes
70
+ * the same host entry.
71
+ */
72
+ export declare const COMPLETION_VERIFICATION_CAPABILITY: CapabilityId<CompletionVerificationCapabilityRun>;
73
+ export type LifecycleGitCommitOptions = {
74
+ projectRoot: string;
75
+ taskId?: string;
76
+ target: "monorepo" | "project" | "both";
77
+ message?: string;
78
+ allowEmpty: boolean;
79
+ scoped?: boolean;
80
+ };
81
+ export type LifecycleGitOpenPrOptions = {
82
+ projectRoot: string;
83
+ taskId?: string;
84
+ target?: "monorepo" | "project";
85
+ reviewer?: string;
86
+ base?: string;
87
+ title?: string;
88
+ body?: string;
89
+ draft?: boolean;
90
+ };
91
+ export type LifecycleGitOpenPrResult = {
92
+ url: string;
93
+ reviewer?: string;
94
+ reviewerSource?: "flag" | "task-config" | "changed-files" | "env";
95
+ target: "monorepo" | "project";
96
+ repoLabel: string;
97
+ branch: string;
98
+ base: string;
99
+ };
100
+ export type LifecycleGitAgentService = {
101
+ shouldScopeGitCommit(args: string[], hasTaskContext: boolean): boolean;
102
+ gitStatus(projectRoot: string, taskId?: string): void;
103
+ gitChanged(projectRoot: string, taskId: string | undefined, scoped: boolean): string[];
104
+ gitPreflight(projectRoot: string, taskId: string | undefined, strict: boolean): boolean;
105
+ gitSyncBranch(projectRoot: string, taskId?: string, targetRepo?: "monorepo" | "project"): void;
106
+ gitCommit(options: LifecycleGitCommitOptions): void;
107
+ gitSnapshot(projectRoot: string, taskId?: string, outputPath?: string): string;
108
+ gitOpenPr(options: LifecycleGitOpenPrOptions): LifecycleGitOpenPrResult;
109
+ };
110
+ export declare const LIFECYCLE_GIT_AGENT: CapabilityId<LifecycleGitAgentService>;
111
+ export type RunTaskSourceReflectStatus = "under_review" | "ci_fixing" | "merging" | "closed" | "needs_attention";
112
+ export type RunTaskSourceLifecycleStatus = "running" | RunTaskSourceReflectStatus | "cancelled";
113
+ export type RunTaskSourceLifecycleRun = {
114
+ runId?: string | null;
115
+ taskId?: string | null;
116
+ sourceTask?: unknown;
117
+ worktreePath?: string | null;
118
+ logRoot?: string | null;
119
+ sessionPath?: string | null;
120
+ errorText?: string | null;
121
+ };
122
+ export type RunTaskSourceLifecycleOptions = {
123
+ errorText?: string | null;
124
+ };
125
+ export type RunTaskSourceStoppedOptions = RunTaskSourceLifecycleOptions & {
126
+ reason?: string | null;
127
+ };
128
+ export type TaskSourceReflectionInput = {
129
+ readonly projectRoot: string;
130
+ readonly taskId: string;
131
+ readonly sourceTask?: unknown;
132
+ readonly runId?: string | null;
133
+ /** Generic source status to write. Omit/null for comment-only reflection. */
134
+ readonly status?: string | null;
135
+ /** Status text rendered in the lifecycle comment; defaults to `status`. */
136
+ readonly commentStatus?: string | null;
137
+ readonly summary: string;
138
+ readonly runtimeWorkspace?: string | null;
139
+ readonly logsDir?: string | null;
140
+ readonly sessionDir?: string | null;
141
+ readonly errorText?: string | null;
142
+ readonly prUrl?: string | null;
143
+ };
144
+ export type TaskSourceMergedPrReflectionInput = {
145
+ readonly projectRoot: string;
146
+ readonly taskId: string;
147
+ readonly runId: string;
148
+ readonly prUrl: string;
149
+ readonly sourceTask?: unknown;
150
+ };
151
+ export type TaskSourceReflectionResult = TaskSourceUpdateResult & {
152
+ /** Lifecycle-owned status projected into the source update request. */
153
+ readonly projectedStatus?: RunTaskSourceLifecycleStatus | null;
154
+ };
155
+ export interface TaskSourceReflectionService {
156
+ reflectTaskSourceStatus(input: TaskSourceReflectionInput): Promise<TaskSourceReflectionResult | null>;
157
+ reflectRunStarted(projectRoot: string, run: RunTaskSourceLifecycleRun, options?: RunTaskSourceLifecycleOptions): Promise<TaskSourceReflectionResult | null>;
158
+ reflectRunStopped(projectRoot: string, run: RunTaskSourceLifecycleRun, options?: RunTaskSourceStoppedOptions): Promise<TaskSourceReflectionResult | null>;
159
+ updateRunTaskSourceLifecycle(projectRoot: string, run: RunTaskSourceLifecycleRun, status: RunTaskSourceLifecycleStatus, summary: string, options?: RunTaskSourceLifecycleOptions): Promise<TaskSourceReflectionResult | null>;
160
+ closeMergedPr(input: TaskSourceMergedPrReflectionInput): Promise<TaskSourceReflectionResult | null>;
161
+ }
162
+ export declare const TASK_SOURCE_REFLECTION: CapabilityId<TaskSourceReflectionService>;
163
+ export interface TaskTerminalStateService {
164
+ isTaskTerminal(input: TaskTerminalStateInput): Promise<boolean>;
165
+ }
166
+ export declare const TASK_TERMINAL_STATE: CapabilityId<TaskTerminalStateService>;
167
+ export type TaskReopenInput = {
168
+ readonly projectRoot: string;
169
+ readonly all: boolean;
170
+ readonly taskId?: string;
171
+ readonly dryRun?: boolean;
172
+ };
173
+ /** Lifecycle-owned reopen policy for legacy `task reopen`; source plugin only performs config IO. */
174
+ export interface TaskReopenService {
175
+ reopenTasks(input: TaskReopenInput): TaskReopenSummary;
176
+ }
177
+ export declare const TASK_REOPEN: CapabilityId<TaskReopenService>;
178
+ export interface RunSessionJournalWriterService {
179
+ createRunJournal(sessionManager: RunJournalSessionManager, runId: string): Promise<RunJournal | null>;
180
+ }
181
+ /**
182
+ * Writable run-session journal factory. Kept separate from RUN_SESSION_JOURNAL so
183
+ * the read-model plugin remains projection/read-only and append ownership lives
184
+ * with the run-worker lifecycle package.
185
+ */
186
+ export declare const RUN_SESSION_JOURNAL_WRITER: CapabilityId<RunSessionJournalWriterService>;
187
+ export type RunCloseoutResultStatus = "merged" | "opened" | "skipped" | "needs-attention";
188
+ export type RunCloseoutResult = {
189
+ status: RunCloseoutResultStatus;
190
+ prUrl?: string;
191
+ iterations: number;
192
+ feedback: readonly string[];
193
+ };
194
+ export type RunCloseoutValidationInput = {
195
+ projectRoot: string;
196
+ taskId: string;
197
+ };
198
+ export type RunCloseoutValidationRunner = (input: RunCloseoutValidationInput) => Promise<boolean> | boolean;
199
+ export type RunCloseoutInput = {
200
+ projectRoot: string;
201
+ runId: string;
202
+ taskId: string;
203
+ branch: string;
204
+ workspace: string;
205
+ artifactRoot?: string | null;
206
+ config?: RigAutomationConfig | null;
207
+ sourceTask?: Record<string, unknown> | null;
208
+ steerPi: (message: string) => Promise<void>;
209
+ greptileApi?: StrictPrGreptileApiOptions;
210
+ runValidation?: RunCloseoutValidationRunner;
211
+ onValidationStart?: () => Promise<void> | void;
212
+ kernelJournal?: JournalCapability | null;
213
+ journalPhase: (phase: RunCloseoutPhase, outcome: RunCloseoutPhaseOutcome, detail?: string | null) => Promise<void> | void;
214
+ reflect: (status: RunTaskSourceReflectStatus, summary: string, options?: {
215
+ errorText?: string | null;
216
+ }) => Promise<void> | void;
217
+ };
218
+ export type RunCloseoutCapabilityRun = (input: RunCloseoutInput) => Promise<RunCloseoutResult>;
219
+ /**
220
+ * The typed capability id the bundle provides its run-worker closeout driver
221
+ * under, so @rig/run-worker can close out by resolving the lifecycle capability
222
+ * instead of importing the lifecycle plugin implementation.
223
+ */
224
+ export declare const RUN_CLOSEOUT_CAPABILITY: CapabilityId<RunCloseoutCapabilityRun>;
@@ -0,0 +1,45 @@
1
+ // @bun
2
+ // packages/contracts/src/capability-id.ts
3
+ function makeCapabilityId(id) {
4
+ return id;
5
+ }
6
+
7
+ // packages/contracts/src/lifecycle-capabilities.ts
8
+ var TASK_VERIFY_CAPABILITY_ID = "default-lifecycle.task-verify";
9
+ var TASK_VALIDATION_CAPABILITY_ID = "default-lifecycle.task-validation";
10
+ var COMPLETION_VERIFICATION_CAPABILITY_ID = "default-lifecycle.completion-verification";
11
+ var RUN_CLOSEOUT_CAPABILITY_ID = "default-lifecycle.run-closeout";
12
+ var RUN_SESSION_JOURNAL_WRITER_CAPABILITY_ID = "run-worker.run-session-journal-writer";
13
+ var TASK_SOURCE_REFLECTION_CAPABILITY_ID = "default-lifecycle.task-source-reflection";
14
+ var TASK_TERMINAL_STATE_CAPABILITY_ID = "default-lifecycle.task-terminal-state";
15
+ var TASK_REOPEN_CAPABILITY_ID = "default-lifecycle.task-reopen";
16
+ var LIFECYCLE_GIT_AGENT_CAPABILITY_ID = "default-lifecycle.git-agent";
17
+ var TASK_VERIFY_CAPABILITY = makeCapabilityId(TASK_VERIFY_CAPABILITY_ID);
18
+ var TASK_VALIDATION_CAPABILITY = makeCapabilityId(TASK_VALIDATION_CAPABILITY_ID);
19
+ var COMPLETION_VERIFICATION_CAPABILITY = makeCapabilityId(COMPLETION_VERIFICATION_CAPABILITY_ID);
20
+ var LIFECYCLE_GIT_AGENT = makeCapabilityId(LIFECYCLE_GIT_AGENT_CAPABILITY_ID);
21
+ var TASK_SOURCE_REFLECTION = makeCapabilityId(TASK_SOURCE_REFLECTION_CAPABILITY_ID);
22
+ var TASK_TERMINAL_STATE = makeCapabilityId(TASK_TERMINAL_STATE_CAPABILITY_ID);
23
+ var TASK_REOPEN = makeCapabilityId(TASK_REOPEN_CAPABILITY_ID);
24
+ var RUN_SESSION_JOURNAL_WRITER = makeCapabilityId(RUN_SESSION_JOURNAL_WRITER_CAPABILITY_ID);
25
+ var RUN_CLOSEOUT_CAPABILITY = makeCapabilityId(RUN_CLOSEOUT_CAPABILITY_ID);
26
+ export {
27
+ TASK_VERIFY_CAPABILITY_ID,
28
+ TASK_VERIFY_CAPABILITY,
29
+ TASK_VALIDATION_CAPABILITY_ID,
30
+ TASK_VALIDATION_CAPABILITY,
31
+ TASK_TERMINAL_STATE_CAPABILITY_ID,
32
+ TASK_TERMINAL_STATE,
33
+ TASK_SOURCE_REFLECTION_CAPABILITY_ID,
34
+ TASK_SOURCE_REFLECTION,
35
+ TASK_REOPEN_CAPABILITY_ID,
36
+ TASK_REOPEN,
37
+ RUN_SESSION_JOURNAL_WRITER_CAPABILITY_ID,
38
+ RUN_SESSION_JOURNAL_WRITER,
39
+ RUN_CLOSEOUT_CAPABILITY_ID,
40
+ RUN_CLOSEOUT_CAPABILITY,
41
+ LIFECYCLE_GIT_AGENT_CAPABILITY_ID,
42
+ LIFECYCLE_GIT_AGENT,
43
+ COMPLETION_VERIFICATION_CAPABILITY_ID,
44
+ COMPLETION_VERIFICATION_CAPABILITY
45
+ };