@h-rig/contracts 0.0.6-alpha.16 → 0.0.6-alpha.161

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 (162) hide show
  1. package/dist/index.cjs +3280 -0
  2. package/dist/index.mjs +3239 -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/collab-session-viewer.d.ts +36 -0
  17. package/dist/src/collab-session-viewer.js +13 -0
  18. package/dist/src/config.d.ts +551 -0
  19. package/dist/src/config.js +765 -162
  20. package/dist/src/control-plane-types.d.ts +323 -0
  21. package/dist/src/control-plane-types.js +13 -0
  22. package/dist/src/conversation.d.ts +50 -0
  23. package/dist/src/conversation.js +3 -0
  24. package/dist/src/dependency-preflight.d.ts +43 -0
  25. package/dist/src/dependency-preflight.js +13 -0
  26. package/dist/src/doctor.d.ts +90 -0
  27. package/dist/src/doctor.js +13 -0
  28. package/dist/src/drift.d.ts +28 -0
  29. package/dist/src/drift.js +69 -0
  30. package/dist/src/editor.d.ts +25 -0
  31. package/dist/src/editor.js +3 -0
  32. package/dist/src/errors.d.ts +13 -0
  33. package/dist/src/errors.js +17 -0
  34. package/dist/src/git.d.ts +144 -0
  35. package/dist/src/git.js +3 -0
  36. package/dist/src/github.d.ts +146 -0
  37. package/dist/src/github.js +17 -0
  38. package/dist/src/graph.d.ts +360 -0
  39. package/dist/src/graph.js +137 -1
  40. package/dist/src/guard.d.ts +111 -0
  41. package/dist/src/guard.js +6 -0
  42. package/dist/src/harness-events.d.ts +8 -0
  43. package/dist/src/harness-events.js +1 -0
  44. package/dist/src/help-catalog.d.ts +41 -0
  45. package/dist/src/help-catalog.js +13 -0
  46. package/dist/src/host.d.ts +41 -0
  47. package/dist/src/host.js +13 -0
  48. package/dist/src/identity.d.ts +44 -0
  49. package/dist/src/identity.js +1 -0
  50. package/dist/src/index.d.ts +77 -0
  51. package/dist/src/index.js +2661 -3970
  52. package/dist/src/isolation.d.ts +213 -0
  53. package/dist/src/isolation.js +13 -0
  54. package/dist/src/kernel.d.ts +200 -0
  55. package/dist/src/kernel.js +261 -0
  56. package/dist/src/keybindings.d.ts +71 -0
  57. package/dist/src/keybindings.js +3 -0
  58. package/dist/src/layout.d.ts +49 -0
  59. package/dist/src/layout.js +10 -0
  60. package/dist/src/lifecycle-capabilities.d.ts +128 -0
  61. package/dist/src/lifecycle-capabilities.js +25 -0
  62. package/dist/src/managed-repos.d.ts +136 -0
  63. package/dist/src/managed-repos.js +17 -0
  64. package/dist/src/memory.d.ts +199 -0
  65. package/dist/src/memory.js +15 -0
  66. package/dist/src/model.d.ts +77 -0
  67. package/dist/src/notify.d.ts +46 -0
  68. package/dist/src/notify.js +13 -0
  69. package/dist/src/orchestration.d.ts +43 -0
  70. package/dist/src/orchestration.js +28 -961
  71. package/dist/src/panel-protocol.d.ts +17 -0
  72. package/dist/src/panel-protocol.js +10 -0
  73. package/dist/src/pi-session.d.ts +113 -0
  74. package/dist/src/pi-session.js +1 -0
  75. package/dist/src/planning.d.ts +64 -0
  76. package/dist/src/planning.js +90 -0
  77. package/dist/src/plugin-hooks.d.ts +51 -0
  78. package/dist/src/plugin-hooks.js +386 -0
  79. package/dist/src/plugin.d.ts +476 -0
  80. package/dist/src/plugin.js +346 -64
  81. package/dist/src/policy.d.ts +16 -0
  82. package/dist/src/policy.js +3 -0
  83. package/dist/src/project.d.ts +71 -0
  84. package/dist/src/project.js +3 -0
  85. package/dist/src/prompt.d.ts +29 -0
  86. package/dist/src/prompt.js +13 -0
  87. package/dist/src/protocol-version.d.ts +21 -0
  88. package/dist/src/protocol-version.js +6 -0
  89. package/dist/src/provider-instructions.d.ts +41 -0
  90. package/dist/src/provider-instructions.js +13 -0
  91. package/dist/src/provider.d.ts +105 -0
  92. package/dist/src/provider.js +4 -824
  93. package/dist/src/remote.d.ts +318 -0
  94. package/dist/src/remote.js +238 -1078
  95. package/dist/src/review.d.ts +18 -0
  96. package/dist/src/review.js +3 -0
  97. package/dist/src/rollups.d.ts +41 -0
  98. package/dist/src/rollups.js +70 -0
  99. package/dist/src/run-discovery.d.ts +79 -0
  100. package/dist/src/run-discovery.js +13 -0
  101. package/dist/src/run-dispatch.d.ts +34 -0
  102. package/dist/src/run-dispatch.js +13 -0
  103. package/dist/src/run-identity.d.ts +47 -0
  104. package/dist/src/run-identity.js +13 -0
  105. package/dist/src/run-journal.d.ts +694 -0
  106. package/dist/src/run-journal.js +569 -0
  107. package/dist/src/run-read-model.d.ts +234 -0
  108. package/dist/src/run-read-model.js +13 -0
  109. package/dist/src/run-record.d.ts +45 -0
  110. package/dist/src/run-record.js +1 -0
  111. package/dist/src/run-registry-backbone.d.ts +56 -0
  112. package/dist/src/run-registry-backbone.js +13 -0
  113. package/dist/src/run-session-journal.d.ts +69 -0
  114. package/dist/src/run-session-journal.js +78 -0
  115. package/dist/src/run-status.d.ts +10 -0
  116. package/dist/src/run-status.js +27 -0
  117. package/dist/src/run-timeline.d.ts +7 -0
  118. package/dist/src/run-timeline.js +1 -0
  119. package/dist/src/runtime-task-context.d.ts +82 -0
  120. package/dist/src/runtime-task-context.js +1 -0
  121. package/dist/src/runtime.d.ts +103 -0
  122. package/dist/src/runtime.js +73 -906
  123. package/dist/src/session-asset-materializer.d.ts +35 -0
  124. package/dist/src/session-asset-materializer.js +13 -0
  125. package/dist/src/setup.d.ts +47 -0
  126. package/dist/src/setup.js +13 -0
  127. package/dist/src/stage.d.ts +245 -0
  128. package/dist/src/stage.js +169 -0
  129. package/dist/src/supervisor-journal.d.ts +204 -0
  130. package/dist/src/supervisor-journal.js +334 -0
  131. package/dist/src/task-data.d.ts +239 -0
  132. package/dist/src/task-data.js +13 -0
  133. package/dist/src/task-graph-primitives.d.ts +47 -0
  134. package/dist/src/task-graph-primitives.js +1 -0
  135. package/dist/src/task-source.d.ts +102 -0
  136. package/dist/src/task-source.js +12 -0
  137. package/dist/src/task-state-metadata.d.ts +21 -0
  138. package/dist/src/task-state-metadata.js +1 -0
  139. package/dist/src/terminal.d.ts +130 -0
  140. package/dist/src/terminal.js +3 -0
  141. package/dist/src/tool-materializer.d.ts +36 -0
  142. package/dist/src/tool-materializer.js +13 -0
  143. package/dist/src/tool-registry.d.ts +3 -0
  144. package/dist/src/tool-registry.js +58 -0
  145. package/dist/src/toolchain-sources.d.ts +54 -0
  146. package/dist/src/toolchain-sources.js +17 -0
  147. package/dist/src/validation.d.ts +14 -0
  148. package/dist/src/validation.js +3 -0
  149. package/dist/src/workflow-journal.d.ts +92 -0
  150. package/dist/src/workflow-journal.js +18 -0
  151. package/dist/src/workspace-config.d.ts +18 -0
  152. package/dist/src/workspace-config.js +13 -0
  153. package/dist/src/workspace.d.ts +204 -0
  154. package/dist/src/workspace.js +76 -911
  155. package/package.json +51 -4
  156. package/dist/src/engine.js +0 -2278
  157. package/dist/src/providerRuntime.js +0 -1630
  158. package/dist/src/rig.js +0 -2374
  159. package/dist/src/server.js +0 -1053
  160. package/dist/src/serviceFabric.js +0 -1066
  161. package/dist/src/ws.js +0 -2968
  162. /package/dist/src/{ipc.js → agent-roles.js} +0 -0
@@ -0,0 +1,8 @@
1
+ import type { AgentRoleRegistration } from "./plugin";
2
+ export interface ResolvedAgentRole extends AgentRoleRegistration {
3
+ model: string;
4
+ }
5
+ export interface AgentRoleRegistry {
6
+ resolve(id: string): ResolvedAgentRole;
7
+ list(): readonly ResolvedAgentRole[];
8
+ }
@@ -0,0 +1,13 @@
1
+ import { Schema } from "effect";
2
+ export declare const ArtifactSummary: Schema.Struct<{
3
+ readonly id: Schema.brand<Schema.Trim, "ArtifactId">;
4
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
5
+ readonly taskId: Schema.NullOr<Schema.brand<Schema.Trim, "TaskId">>;
6
+ readonly kind: Schema.Trim;
7
+ readonly label: Schema.Trim;
8
+ readonly path: Schema.NullOr<Schema.Trim>;
9
+ readonly url: Schema.NullOr<Schema.Trim>;
10
+ readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
11
+ readonly createdAt: Schema.String;
12
+ }>;
13
+ export type ArtifactSummary = typeof ArtifactSummary.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,63 @@
1
+ import { Schema } from "effect";
2
+ export declare const TrimmedString: Schema.Trim;
3
+ export declare const TrimmedNonEmptyString: Schema.Trim;
4
+ export declare const NonNegativeInt: Schema.Int;
5
+ export declare const PositiveInt: Schema.Int;
6
+ export declare const IsoDateTime: Schema.String;
7
+ export type IsoDateTime = typeof IsoDateTime.Type;
8
+ export declare const ThreadId: Schema.brand<Schema.Trim, "ThreadId">;
9
+ export type ThreadId = typeof ThreadId.Type;
10
+ export declare const ProjectId: Schema.brand<Schema.Trim, "ProjectId">;
11
+ export type ProjectId = typeof ProjectId.Type;
12
+ export declare const WorkspaceId: Schema.brand<Schema.Trim, "WorkspaceId">;
13
+ export type WorkspaceId = typeof WorkspaceId.Type;
14
+ export declare const GraphId: Schema.brand<Schema.Trim, "GraphId">;
15
+ export type GraphId = typeof GraphId.Type;
16
+ export declare const TaskId: Schema.brand<Schema.Trim, "TaskId">;
17
+ export type TaskId = typeof TaskId.Type;
18
+ export declare const RunId: Schema.brand<Schema.Trim, "RunId">;
19
+ export type RunId = typeof RunId.Type;
20
+ export declare const SafePathSegment: Schema.brand<Schema.Trim, "SafePathSegment">;
21
+ export type SafePathSegment = typeof SafePathSegment.Type;
22
+ export declare const SafeRunId: Schema.brand<Schema.Trim, "SafeRunId">;
23
+ export type SafeRunId = typeof SafeRunId.Type;
24
+ export declare const SafeGitRefComponent: Schema.brand<Schema.Trim, "SafeGitRefComponent">;
25
+ export type SafeGitRefComponent = typeof SafeGitRefComponent.Type;
26
+ export declare const EngineRuntimeId: Schema.brand<Schema.Trim, "EngineRuntimeId">;
27
+ export type EngineRuntimeId = typeof EngineRuntimeId.Type;
28
+ export declare const ConversationId: Schema.brand<Schema.Trim, "ConversationId">;
29
+ export type ConversationId = typeof ConversationId.Type;
30
+ export declare const ActionId: Schema.brand<Schema.Trim, "ActionId">;
31
+ export type ActionId = typeof ActionId.Type;
32
+ export declare const ArtifactId: Schema.brand<Schema.Trim, "ArtifactId">;
33
+ export type ArtifactId = typeof ArtifactId.Type;
34
+ export declare const WorktreeId: Schema.brand<Schema.Trim, "WorktreeId">;
35
+ export type WorktreeId = typeof WorktreeId.Type;
36
+ export declare const ValidationResultId: Schema.brand<Schema.Trim, "ValidationResultId">;
37
+ export type ValidationResultId = typeof ValidationResultId.Type;
38
+ export declare const ReviewResultId: Schema.brand<Schema.Trim, "ReviewResultId">;
39
+ export type ReviewResultId = typeof ReviewResultId.Type;
40
+ export declare const CommandId: Schema.brand<Schema.Trim, "CommandId">;
41
+ export type CommandId = typeof CommandId.Type;
42
+ export declare const EventId: Schema.brand<Schema.Trim, "EventId">;
43
+ export type EventId = typeof EventId.Type;
44
+ export declare const MessageId: Schema.brand<Schema.Trim, "MessageId">;
45
+ export type MessageId = typeof MessageId.Type;
46
+ export declare const TurnId: Schema.brand<Schema.Trim, "TurnId">;
47
+ export type TurnId = typeof TurnId.Type;
48
+ export declare const ProviderItemId: Schema.brand<Schema.Trim, "ProviderItemId">;
49
+ export type ProviderItemId = typeof ProviderItemId.Type;
50
+ export declare const RuntimeSessionId: Schema.brand<Schema.Trim, "RuntimeSessionId">;
51
+ export type RuntimeSessionId = typeof RuntimeSessionId.Type;
52
+ export declare const RuntimeItemId: Schema.brand<Schema.Trim, "RuntimeItemId">;
53
+ export type RuntimeItemId = typeof RuntimeItemId.Type;
54
+ export declare const RuntimeRequestId: Schema.brand<Schema.Trim, "RuntimeRequestId">;
55
+ export type RuntimeRequestId = typeof RuntimeRequestId.Type;
56
+ export declare const RuntimeTaskId: Schema.brand<Schema.Trim, "RuntimeTaskId">;
57
+ export type RuntimeTaskId = typeof RuntimeTaskId.Type;
58
+ export declare const ApprovalRequestId: Schema.brand<Schema.Trim, "ApprovalRequestId">;
59
+ export type ApprovalRequestId = typeof ApprovalRequestId.Type;
60
+ export declare const CheckpointRef: Schema.brand<Schema.Trim, "CheckpointRef">;
61
+ export type CheckpointRef = typeof CheckpointRef.Type;
62
+ export declare const RemoteEndpointId: Schema.brand<Schema.Trim, "RemoteEndpointId">;
63
+ export type RemoteEndpointId = typeof RemoteEndpointId.Type;
@@ -13,6 +13,9 @@ var WorkspaceId = makeEntityId("WorkspaceId");
13
13
  var GraphId = makeEntityId("GraphId");
14
14
  var TaskId = makeEntityId("TaskId");
15
15
  var RunId = makeEntityId("RunId");
16
+ var SafePathSegment = TrimmedNonEmptyString.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)).pipe(Schema.brand("SafePathSegment"));
17
+ var SafeRunId = TrimmedNonEmptyString.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/)).pipe(Schema.brand("SafeRunId"));
18
+ var SafeGitRefComponent = TrimmedNonEmptyString.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)).pipe(Schema.brand("SafeGitRefComponent"));
16
19
  var EngineRuntimeId = makeEntityId("EngineRuntimeId");
17
20
  var ConversationId = makeEntityId("ConversationId");
18
21
  var ActionId = makeEntityId("ActionId");
@@ -41,6 +44,9 @@ export {
41
44
  TrimmedNonEmptyString,
42
45
  ThreadId,
43
46
  TaskId,
47
+ SafeRunId,
48
+ SafePathSegment,
49
+ SafeGitRefComponent,
44
50
  RuntimeTaskId,
45
51
  RuntimeSessionId,
46
52
  RuntimeRequestId,
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Pure browser-contract types.
3
+ *
4
+ * These types are the neutral home for the browser-required task contract so
5
+ * that the dumb runtime substrate (isolation provisioning, task info, rig-agent,
6
+ * rig-browser-tool) and the @rig/browser-plugin that owns the resolution logic
7
+ * can both reference them without a substrate->plugin import cycle. They carry
8
+ * no behaviour and import nothing — exactly like `memory.ts` /
9
+ * `lifecycle-capabilities.ts`.
10
+ *
11
+ * The plugin registers its executable `BrowserContractService` impl under the
12
+ * typed capability id {@link BROWSER_CONTRACT_SERVICE_CAPABILITY} (whose string
13
+ * value is {@link BROWSER_CONTRACT_SERVICE_CAPABILITY_ID}) via the
14
+ * `defineCapability` seam (`@rig/core/capability`); the runtime resolves it by id
15
+ * from `pluginHost.listExecutableCapabilities()` via the thin typed port in
16
+ * `@rig/runtime/control-plane/browser-contract-port`.
17
+ */
18
+ import type { CapabilityId } from "./capability-id";
19
+ /** Capability id the browser plugin registers its `BrowserContractService` factory under. */
20
+ export declare const BROWSER_CONTRACT_SERVICE_CAPABILITY_ID = "browser.contract";
21
+ /** Author-facing browser config attached to a task entry (rig.config / task source). */
22
+ export type TaskBrowserConfig = {
23
+ required?: boolean;
24
+ preset?: string;
25
+ profile?: string;
26
+ attach_url?: string;
27
+ state_dir?: string;
28
+ dev_command?: string;
29
+ launch_command?: string;
30
+ check_command?: string;
31
+ e2e_command?: string;
32
+ mode?: string;
33
+ };
34
+ /** Resolved, runtime-effective browser contract persisted into the runtime context. */
35
+ export type RuntimeBrowserContext = {
36
+ required: boolean;
37
+ preset: string;
38
+ mode: string;
39
+ stateDir: string;
40
+ defaultProfile: string;
41
+ effectiveProfile: string;
42
+ defaultAttachUrl: string;
43
+ effectiveAttachUrl: string;
44
+ devCommand?: string;
45
+ launchCommand?: string;
46
+ checkCommand?: string;
47
+ e2eCommand?: string;
48
+ launchHelper: string;
49
+ checkHelper: string;
50
+ attachInfoHelper: string;
51
+ e2eHelper: string;
52
+ resetProfileHelper: string;
53
+ };
54
+ /** Options for deriving the runtime-effective browser context. */
55
+ export type ResolveTaskBrowserContextOptions = {
56
+ hostProjectRoot?: string;
57
+ runtimeId?: string;
58
+ };
59
+ /**
60
+ * The cohesive set of browser-contract operations the runtime consumers depend
61
+ * on. This is pure capability VOCAB: the `@rig/browser-plugin` provides a
62
+ * concrete impl (statically checked against this interface via
63
+ * `BrowserContractCap.provide`), and the substrate only ever sees this contract —
64
+ * resolved by id off a plugin host with no `as unknown as` at any call site.
65
+ */
66
+ export interface BrowserContractService {
67
+ /** Resolve an author-facing `TaskBrowserConfig` into the runtime-effective context. */
68
+ resolveTaskBrowserContext(browser: TaskBrowserConfig | undefined, options?: ResolveTaskBrowserContextOptions): RuntimeBrowserContext | undefined;
69
+ /** Render the `task info` guidance lines for a resolved browser context. */
70
+ buildBrowserGuidanceLines(browser: RuntimeBrowserContext): string[];
71
+ }
72
+ /**
73
+ * The typed capability id the browser plugin provides and consumers require.
74
+ * Phantom-typed with {@link BrowserContractService} so
75
+ * `BrowserContractCap.require(host)` returns a `BrowserContractService` with no
76
+ * cast leaking to callers. Its string value is
77
+ * {@link BROWSER_CONTRACT_SERVICE_CAPABILITY_ID}, so it indexes the same host
78
+ * entry.
79
+ */
80
+ export declare const BROWSER_CONTRACT_SERVICE_CAPABILITY: CapabilityId<BrowserContractService>;
@@ -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/browser.ts
8
+ var BROWSER_CONTRACT_SERVICE_CAPABILITY_ID = "browser.contract";
9
+ var BROWSER_CONTRACT_SERVICE_CAPABILITY = makeCapabilityId(BROWSER_CONTRACT_SERVICE_CAPABILITY_ID);
10
+ export {
11
+ BROWSER_CONTRACT_SERVICE_CAPABILITY_ID,
12
+ BROWSER_CONTRACT_SERVICE_CAPABILITY
13
+ };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Capability-seam vocabulary.
3
+ *
4
+ * A `CapabilityId<T>` is a plain id string branded (phantom-typed) with the
5
+ * service type `T` it resolves to. `defineCapability<T>` (in `@rig/core`) reads
6
+ * this brand so `resolve`/`require` are typed as `T` with the `unknown → T` cast
7
+ * contained ONCE inside the helper — callers never cast.
8
+ *
9
+ * Pure: no imports, no behaviour. The brand lives only in an OPTIONAL phantom
10
+ * property so a plain `string` is still assignable to `CapabilityId<T>` via the
11
+ * `makeCapabilityId` cast, and a `CapabilityId<T>` is usable anywhere a `string`
12
+ * is (equality checks against `host` capability ids, `.toString()`, etc.).
13
+ */
14
+ declare const CapabilityIdBrand: unique symbol;
15
+ /** A capability id string branded with the service type `T` it resolves to. */
16
+ export type CapabilityId<T> = string & {
17
+ /** Phantom — never present at runtime; carries `T` for `defineCapability<T>`. */
18
+ readonly [CapabilityIdBrand]?: T;
19
+ };
20
+ /** Brand a plain id string as a `CapabilityId<T>`. */
21
+ export declare function makeCapabilityId<T>(id: string): CapabilityId<T>;
22
+ export {};
@@ -0,0 +1,8 @@
1
+ // @bun
2
+ // packages/contracts/src/capability-id.ts
3
+ function makeCapabilityId(id) {
4
+ return id;
5
+ }
6
+ export {
7
+ makeCapabilityId
8
+ };
@@ -0,0 +1,348 @@
1
+ import { Schema } from "effect";
2
+ export declare const CLI_OUTPUT_VERSION: 1;
3
+ /** Loose envelope shape shared by every schematized command. */
4
+ export declare const RigCliOutputEnvelope: Schema.Struct<{
5
+ readonly v: Schema.Literal<1>;
6
+ readonly command: Schema.String;
7
+ readonly data: Schema.Unknown;
8
+ }>;
9
+ export type RigCliOutputEnvelope = typeof RigCliOutputEnvelope.Type;
10
+ /** Task summary as emitted by `rig task list|show|next` (summarizeTask). */
11
+ export declare const CliTaskSummary: Schema.Struct<{
12
+ readonly id: Schema.NullOr<Schema.String>;
13
+ readonly title: Schema.NullOr<Schema.String>;
14
+ readonly status: Schema.NullOr<Schema.String>;
15
+ readonly source: Schema.optional<Schema.String>;
16
+ readonly url: Schema.optional<Schema.String>;
17
+ readonly number: Schema.optional<Schema.Number>;
18
+ readonly labels: Schema.optional<Schema.$Array<Schema.Unknown>>;
19
+ readonly assignees: Schema.optional<Schema.$Array<Schema.Unknown>>;
20
+ readonly readiness: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Boolean]>>;
21
+ readonly validators: Schema.optional<Schema.$Array<Schema.Unknown>>;
22
+ readonly raw: Schema.optional<Schema.Unknown>;
23
+ }>;
24
+ export type CliTaskSummary = typeof CliTaskSummary.Type;
25
+ export declare const CliTaskFilters: Schema.Struct<{
26
+ readonly assignee: Schema.optional<Schema.String>;
27
+ readonly state: Schema.optional<Schema.String>;
28
+ readonly status: Schema.optional<Schema.String>;
29
+ readonly limit: Schema.optional<Schema.Number>;
30
+ }>;
31
+ export type CliTaskFilters = typeof CliTaskFilters.Type;
32
+ /**
33
+ * Run records cross local disk state and remote server payloads, so the
34
+ * record itself stays an open map; identity fields are validated where the
35
+ * emitting command guarantees them.
36
+ */
37
+ export declare const CliRunRecord: Schema.$Record<Schema.String, Schema.Unknown>;
38
+ export type CliRunRecord = typeof CliRunRecord.Type;
39
+ export declare const CliInboxRecord: Schema.$Record<Schema.String, Schema.Unknown>;
40
+ export type CliInboxRecord = typeof CliInboxRecord.Type;
41
+ export declare const CliDoctorCheck: Schema.Struct<{
42
+ readonly id: Schema.String;
43
+ readonly label: Schema.String;
44
+ readonly status: Schema.Literals<readonly ["pass", "warn", "fail"]>;
45
+ readonly detail: Schema.optional<Schema.String>;
46
+ readonly remediation: Schema.optional<Schema.String>;
47
+ }>;
48
+ export type CliDoctorCheck = typeof CliDoctorCheck.Type;
49
+ export declare const CliServerConnection: Schema.Union<readonly [Schema.Struct<{
50
+ readonly kind: Schema.Literal<"local">;
51
+ readonly mode: Schema.Literal<"auto">;
52
+ }>, Schema.Struct<{
53
+ readonly kind: Schema.Literal<"remote">;
54
+ readonly baseUrl: Schema.String;
55
+ }>]>;
56
+ export type CliServerConnection = typeof CliServerConnection.Type;
57
+ export declare const CliRepoConnectionState: Schema.Struct<{
58
+ readonly selected: Schema.String;
59
+ readonly project: Schema.optional<Schema.String>;
60
+ readonly linkedAt: Schema.optional<Schema.String>;
61
+ readonly serverProjectRoot: Schema.optional<Schema.String>;
62
+ readonly serverProjectRootAlias: Schema.optional<Schema.String>;
63
+ readonly serverProjectRootBaseUrl: Schema.optional<Schema.String>;
64
+ }>;
65
+ export type CliRepoConnectionState = typeof CliRepoConnectionState.Type;
66
+ export declare const CliRemoteProjectLink: Schema.Struct<{
67
+ readonly ok: Schema.Boolean;
68
+ readonly status: Schema.String;
69
+ readonly alias: Schema.optional<Schema.String>;
70
+ readonly baseUrl: Schema.optional<Schema.String>;
71
+ readonly repoSlug: Schema.optional<Schema.String>;
72
+ readonly serverProjectRoot: Schema.optional<Schema.String>;
73
+ readonly source: Schema.optional<Schema.String>;
74
+ readonly prepared: Schema.optional<Schema.Boolean>;
75
+ readonly validated: Schema.optional<Schema.Boolean>;
76
+ readonly statusCode: Schema.optional<Schema.Number>;
77
+ readonly message: Schema.String;
78
+ readonly hint: Schema.String;
79
+ readonly next: Schema.optional<Schema.String>;
80
+ readonly skippedCandidates: Schema.optional<Schema.$Array<Schema.String>>;
81
+ }>;
82
+ export type CliRemoteProjectLink = typeof CliRemoteProjectLink.Type;
83
+ export declare const RigTaskListOutput: Schema.Struct<{
84
+ readonly v: Schema.Literal<1>;
85
+ readonly command: Schema.Literal<"task list">;
86
+ readonly data: Schema.Struct<{
87
+ readonly count: Schema.Number;
88
+ readonly filters: Schema.Struct<{
89
+ readonly assignee: Schema.optional<Schema.String>;
90
+ readonly state: Schema.optional<Schema.String>;
91
+ readonly status: Schema.optional<Schema.String>;
92
+ readonly limit: Schema.optional<Schema.Number>;
93
+ }>;
94
+ readonly raw: Schema.Boolean;
95
+ readonly tasks: Schema.$Array<Schema.Struct<{
96
+ readonly id: Schema.NullOr<Schema.String>;
97
+ readonly title: Schema.NullOr<Schema.String>;
98
+ readonly status: Schema.NullOr<Schema.String>;
99
+ readonly source: Schema.optional<Schema.String>;
100
+ readonly url: Schema.optional<Schema.String>;
101
+ readonly number: Schema.optional<Schema.Number>;
102
+ readonly labels: Schema.optional<Schema.$Array<Schema.Unknown>>;
103
+ readonly assignees: Schema.optional<Schema.$Array<Schema.Unknown>>;
104
+ readonly readiness: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Boolean]>>;
105
+ readonly validators: Schema.optional<Schema.$Array<Schema.Unknown>>;
106
+ readonly raw: Schema.optional<Schema.Unknown>;
107
+ }>>;
108
+ }>;
109
+ }>;
110
+ export type RigTaskListOutput = typeof RigTaskListOutput.Type;
111
+ export declare const RigTaskShowOutput: Schema.Struct<{
112
+ readonly v: Schema.Literal<1>;
113
+ readonly command: Schema.Literal<"task show">;
114
+ readonly data: Schema.Struct<{
115
+ readonly task: Schema.Struct<{
116
+ readonly id: Schema.NullOr<Schema.String>;
117
+ readonly title: Schema.NullOr<Schema.String>;
118
+ readonly status: Schema.NullOr<Schema.String>;
119
+ readonly source: Schema.optional<Schema.String>;
120
+ readonly url: Schema.optional<Schema.String>;
121
+ readonly number: Schema.optional<Schema.Number>;
122
+ readonly labels: Schema.optional<Schema.$Array<Schema.Unknown>>;
123
+ readonly assignees: Schema.optional<Schema.$Array<Schema.Unknown>>;
124
+ readonly readiness: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Boolean]>>;
125
+ readonly validators: Schema.optional<Schema.$Array<Schema.Unknown>>;
126
+ readonly raw: Schema.optional<Schema.Unknown>;
127
+ }>;
128
+ readonly raw: Schema.Boolean;
129
+ }>;
130
+ }>;
131
+ export type RigTaskShowOutput = typeof RigTaskShowOutput.Type;
132
+ export declare const RigRunListOutput: Schema.Struct<{
133
+ readonly v: Schema.Literal<1>;
134
+ readonly command: Schema.Literal<"run list">;
135
+ readonly data: Schema.Struct<{
136
+ readonly runs: Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>;
137
+ readonly source: Schema.Literals<readonly ["local", "server"]>;
138
+ }>;
139
+ }>;
140
+ export type RigRunListOutput = typeof RigRunListOutput.Type;
141
+ export declare const RigRunShowOutput: Schema.Struct<{
142
+ readonly v: Schema.Literal<1>;
143
+ readonly command: Schema.Literal<"run show">;
144
+ readonly data: Schema.$Record<Schema.String, Schema.Unknown>;
145
+ }>;
146
+ export type RigRunShowOutput = typeof RigRunShowOutput.Type;
147
+ export declare const RigServerUseOutput: Schema.Struct<{
148
+ readonly v: Schema.Literal<1>;
149
+ readonly command: Schema.Literal<"server use">;
150
+ readonly data: Schema.Struct<{
151
+ readonly selected: Schema.String;
152
+ readonly repo: Schema.NullOr<Schema.Struct<{
153
+ readonly selected: Schema.String;
154
+ readonly project: Schema.optional<Schema.String>;
155
+ readonly linkedAt: Schema.optional<Schema.String>;
156
+ readonly serverProjectRoot: Schema.optional<Schema.String>;
157
+ readonly serverProjectRootAlias: Schema.optional<Schema.String>;
158
+ readonly serverProjectRootBaseUrl: Schema.optional<Schema.String>;
159
+ }>>;
160
+ readonly remoteProjectLink: Schema.NullOr<Schema.Struct<{
161
+ readonly ok: Schema.Boolean;
162
+ readonly status: Schema.String;
163
+ readonly alias: Schema.optional<Schema.String>;
164
+ readonly baseUrl: Schema.optional<Schema.String>;
165
+ readonly repoSlug: Schema.optional<Schema.String>;
166
+ readonly serverProjectRoot: Schema.optional<Schema.String>;
167
+ readonly source: Schema.optional<Schema.String>;
168
+ readonly prepared: Schema.optional<Schema.Boolean>;
169
+ readonly validated: Schema.optional<Schema.Boolean>;
170
+ readonly statusCode: Schema.optional<Schema.Number>;
171
+ readonly message: Schema.String;
172
+ readonly hint: Schema.String;
173
+ readonly next: Schema.optional<Schema.String>;
174
+ readonly skippedCandidates: Schema.optional<Schema.$Array<Schema.String>>;
175
+ }>>;
176
+ }>;
177
+ }>;
178
+ export type RigServerUseOutput = typeof RigServerUseOutput.Type;
179
+ export declare const RigServerStatusOutput: Schema.Struct<{
180
+ readonly v: Schema.Literal<1>;
181
+ readonly command: Schema.Literal<"server status">;
182
+ readonly data: Schema.Struct<{
183
+ readonly selected: Schema.String;
184
+ readonly repo: Schema.NullOr<Schema.Struct<{
185
+ readonly selected: Schema.String;
186
+ readonly project: Schema.optional<Schema.String>;
187
+ readonly linkedAt: Schema.optional<Schema.String>;
188
+ readonly serverProjectRoot: Schema.optional<Schema.String>;
189
+ readonly serverProjectRootAlias: Schema.optional<Schema.String>;
190
+ readonly serverProjectRootBaseUrl: Schema.optional<Schema.String>;
191
+ }>>;
192
+ readonly connections: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
193
+ readonly kind: Schema.Literal<"local">;
194
+ readonly mode: Schema.Literal<"auto">;
195
+ }>, Schema.Struct<{
196
+ readonly kind: Schema.Literal<"remote">;
197
+ readonly baseUrl: Schema.String;
198
+ }>]>>;
199
+ readonly remoteProjectLink: Schema.NullOr<Schema.Struct<{
200
+ readonly ok: Schema.Boolean;
201
+ readonly status: Schema.String;
202
+ readonly alias: Schema.optional<Schema.String>;
203
+ readonly baseUrl: Schema.optional<Schema.String>;
204
+ readonly repoSlug: Schema.optional<Schema.String>;
205
+ readonly serverProjectRoot: Schema.optional<Schema.String>;
206
+ readonly source: Schema.optional<Schema.String>;
207
+ readonly prepared: Schema.optional<Schema.Boolean>;
208
+ readonly validated: Schema.optional<Schema.Boolean>;
209
+ readonly statusCode: Schema.optional<Schema.Number>;
210
+ readonly message: Schema.String;
211
+ readonly hint: Schema.String;
212
+ readonly next: Schema.optional<Schema.String>;
213
+ readonly skippedCandidates: Schema.optional<Schema.$Array<Schema.String>>;
214
+ }>>;
215
+ }>;
216
+ }>;
217
+ export type RigServerStatusOutput = typeof RigServerStatusOutput.Type;
218
+ export declare const RigServerRepairLinkOutput: Schema.Struct<{
219
+ readonly v: Schema.Literal<1>;
220
+ readonly command: Schema.Literal<"server repair-link">;
221
+ readonly data: Schema.Struct<{
222
+ readonly ok: Schema.Boolean;
223
+ readonly status: Schema.String;
224
+ readonly alias: Schema.optional<Schema.String>;
225
+ readonly baseUrl: Schema.optional<Schema.String>;
226
+ readonly repoSlug: Schema.optional<Schema.String>;
227
+ readonly serverProjectRoot: Schema.optional<Schema.String>;
228
+ readonly source: Schema.optional<Schema.String>;
229
+ readonly prepared: Schema.optional<Schema.Boolean>;
230
+ readonly validated: Schema.optional<Schema.Boolean>;
231
+ readonly statusCode: Schema.optional<Schema.Number>;
232
+ readonly message: Schema.String;
233
+ readonly hint: Schema.String;
234
+ readonly next: Schema.optional<Schema.String>;
235
+ readonly skippedCandidates: Schema.optional<Schema.$Array<Schema.String>>;
236
+ }>;
237
+ }>;
238
+ export type RigServerRepairLinkOutput = typeof RigServerRepairLinkOutput.Type;
239
+ export declare const RigInboxApprovalsOutput: Schema.Struct<{
240
+ readonly v: Schema.Literal<1>;
241
+ readonly command: Schema.Literal<"inbox approvals">;
242
+ readonly data: Schema.Struct<{
243
+ readonly approvals: Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>;
244
+ }>;
245
+ }>;
246
+ export type RigInboxApprovalsOutput = typeof RigInboxApprovalsOutput.Type;
247
+ export declare const RigInboxInputsOutput: Schema.Struct<{
248
+ readonly v: Schema.Literal<1>;
249
+ readonly command: Schema.Literal<"inbox inputs">;
250
+ readonly data: Schema.Struct<{
251
+ readonly requests: Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>;
252
+ }>;
253
+ }>;
254
+ export type RigInboxInputsOutput = typeof RigInboxInputsOutput.Type;
255
+ export declare const RigDoctorCheckOutput: Schema.Struct<{
256
+ readonly v: Schema.Literal<1>;
257
+ readonly command: Schema.Literal<"doctor check">;
258
+ readonly data: Schema.Struct<{
259
+ readonly checks: Schema.$Array<Schema.Struct<{
260
+ readonly id: Schema.String;
261
+ readonly label: Schema.String;
262
+ readonly status: Schema.Literals<readonly ["pass", "warn", "fail"]>;
263
+ readonly detail: Schema.optional<Schema.String>;
264
+ readonly remediation: Schema.optional<Schema.String>;
265
+ }>>;
266
+ readonly failures: Schema.Number;
267
+ }>;
268
+ }>;
269
+ export type RigDoctorCheckOutput = typeof RigDoctorCheckOutput.Type;
270
+ /** Fleet metrics computed from on-disk run journals (`rig stats`). */
271
+ export declare const RigStatsData: Schema.Struct<{
272
+ /** ISO timestamp of the window start, or null for all-time. */
273
+ readonly since: Schema.NullOr<Schema.String>;
274
+ readonly totalRuns: Schema.Number;
275
+ /** Run count per terminal/current status. */
276
+ readonly statusCounts: Schema.$Record<Schema.String, Schema.Number>;
277
+ readonly completedRuns: Schema.Number;
278
+ readonly failedRuns: Schema.Number;
279
+ readonly needsAttentionRuns: Schema.Number;
280
+ /** Rates over totalRuns; null when there are no runs in the window. */
281
+ readonly completionRate: Schema.NullOr<Schema.Number>;
282
+ readonly failureRate: Schema.NullOr<Schema.Number>;
283
+ readonly needsAttentionRate: Schema.NullOr<Schema.Number>;
284
+ /** Median createdAt -> completedAt for completed runs, in milliseconds. */
285
+ readonly medianCompletionMs: Schema.NullOr<Schema.Number>;
286
+ readonly steeringTotal: Schema.Number;
287
+ /** Average steering interventions per run; null when there are no runs. */
288
+ readonly steeringPerRun: Schema.NullOr<Schema.Number>;
289
+ readonly stallTotal: Schema.Number;
290
+ readonly approvalsRequested: Schema.Number;
291
+ readonly approvalsApproved: Schema.Number;
292
+ readonly approvalsRejected: Schema.Number;
293
+ readonly approvalsPending: Schema.Number;
294
+ }>;
295
+ export type RigStatsData = typeof RigStatsData.Type;
296
+ export declare const RigStatsOutput: Schema.Struct<{
297
+ readonly v: Schema.Literal<1>;
298
+ readonly command: Schema.Literal<"stats show">;
299
+ readonly data: Schema.Struct<{
300
+ /** ISO timestamp of the window start, or null for all-time. */
301
+ readonly since: Schema.NullOr<Schema.String>;
302
+ readonly totalRuns: Schema.Number;
303
+ /** Run count per terminal/current status. */
304
+ readonly statusCounts: Schema.$Record<Schema.String, Schema.Number>;
305
+ readonly completedRuns: Schema.Number;
306
+ readonly failedRuns: Schema.Number;
307
+ readonly needsAttentionRuns: Schema.Number;
308
+ /** Rates over totalRuns; null when there are no runs in the window. */
309
+ readonly completionRate: Schema.NullOr<Schema.Number>;
310
+ readonly failureRate: Schema.NullOr<Schema.Number>;
311
+ readonly needsAttentionRate: Schema.NullOr<Schema.Number>;
312
+ /** Median createdAt -> completedAt for completed runs, in milliseconds. */
313
+ readonly medianCompletionMs: Schema.NullOr<Schema.Number>;
314
+ readonly steeringTotal: Schema.Number;
315
+ /** Average steering interventions per run; null when there are no runs. */
316
+ readonly steeringPerRun: Schema.NullOr<Schema.Number>;
317
+ readonly stallTotal: Schema.Number;
318
+ readonly approvalsRequested: Schema.Number;
319
+ readonly approvalsApproved: Schema.Number;
320
+ readonly approvalsRejected: Schema.Number;
321
+ readonly approvalsPending: Schema.Number;
322
+ }>;
323
+ }>;
324
+ export type RigStatsOutput = typeof RigStatsOutput.Type;
325
+ export type OutputMode = "text" | "json";
326
+ export type CommandExecutionResult = {
327
+ command: string[];
328
+ formattedCommand: string;
329
+ exitCode: number;
330
+ durationMs: number;
331
+ startedAt: string;
332
+ finishedAt: string;
333
+ stdout?: string;
334
+ stderr?: string;
335
+ };
336
+ /** Structured outcome a `rig <group> <command>` handler returns to the runner. */
337
+ export type CommandOutcome = {
338
+ readonly ok: boolean;
339
+ readonly group: string;
340
+ readonly command: string;
341
+ readonly details?: Record<string, unknown>;
342
+ };
343
+ export type PluginValidatorResult = {
344
+ id: string;
345
+ passed: boolean;
346
+ summary: string;
347
+ details?: string;
348
+ };