@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,18 @@
1
+ import { Schema } from "effect";
2
+ export declare const ReviewMode: Schema.Literals<readonly ["off", "advisory", "required"]>;
3
+ export type ReviewMode = typeof ReviewMode.Type;
4
+ export declare const ReviewStatus: Schema.Literals<readonly ["pending", "running", "approved", "rejected", "error"]>;
5
+ export type ReviewStatus = typeof ReviewStatus.Type;
6
+ export declare const ReviewSummary: Schema.Struct<{
7
+ readonly id: Schema.brand<Schema.Trim, "ReviewResultId">;
8
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
9
+ readonly taskId: Schema.NullOr<Schema.brand<Schema.Trim, "TaskId">>;
10
+ readonly provider: Schema.Trim;
11
+ readonly mode: Schema.Literals<readonly ["off", "advisory", "required"]>;
12
+ readonly status: Schema.Literals<readonly ["pending", "running", "approved", "rejected", "error"]>;
13
+ readonly summary: Schema.NullOr<Schema.String>;
14
+ readonly output: Schema.Unknown;
15
+ readonly createdAt: Schema.String;
16
+ readonly completedAt: Schema.NullOr<Schema.String>;
17
+ }>;
18
+ export type ReviewSummary = typeof ReviewSummary.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,41 @@
1
+ import { Schema } from "effect";
2
+ export declare const PercentComplete: Schema.Int;
3
+ export type PercentComplete = typeof PercentComplete.Type;
4
+ export declare const EpicRollup: Schema.Struct<{
5
+ readonly epicKey: Schema.Trim;
6
+ readonly total: Schema.Int;
7
+ readonly percentComplete: Schema.Int;
8
+ readonly blockedCount: Schema.Int;
9
+ readonly humanBlockedCount: Schema.Int;
10
+ readonly inFlightCount: Schema.Int;
11
+ readonly byStatus: Schema.$Record<Schema.String, Schema.Int>;
12
+ }>;
13
+ export type EpicRollup = typeof EpicRollup.Type;
14
+ export declare const AssigneeRollup: Schema.Struct<{
15
+ readonly assignee: Schema.Trim;
16
+ readonly openTaskCount: Schema.Int;
17
+ readonly inFlightRunCount: Schema.Int;
18
+ readonly prsAwaitingReview: Schema.Int;
19
+ readonly blockers: Schema.$Array<Schema.brand<Schema.Trim, "TaskId">>;
20
+ }>;
21
+ export type AssigneeRollup = typeof AssigneeRollup.Type;
22
+ export declare const WorkspaceRollups: Schema.Struct<{
23
+ readonly epics: Schema.$Array<Schema.Struct<{
24
+ readonly epicKey: Schema.Trim;
25
+ readonly total: Schema.Int;
26
+ readonly percentComplete: Schema.Int;
27
+ readonly blockedCount: Schema.Int;
28
+ readonly humanBlockedCount: Schema.Int;
29
+ readonly inFlightCount: Schema.Int;
30
+ readonly byStatus: Schema.$Record<Schema.String, Schema.Int>;
31
+ }>>;
32
+ readonly assignees: Schema.$Array<Schema.Struct<{
33
+ readonly assignee: Schema.Trim;
34
+ readonly openTaskCount: Schema.Int;
35
+ readonly inFlightRunCount: Schema.Int;
36
+ readonly prsAwaitingReview: Schema.Int;
37
+ readonly blockers: Schema.$Array<Schema.brand<Schema.Trim, "TaskId">>;
38
+ }>>;
39
+ readonly generatedAt: Schema.String;
40
+ }>;
41
+ export type WorkspaceRollups = typeof WorkspaceRollups.Type;
@@ -0,0 +1,70 @@
1
+ // @bun
2
+ // packages/contracts/src/rollups.ts
3
+ import { Schema as Schema2 } from "effect";
4
+
5
+ // packages/contracts/src/baseSchemas.ts
6
+ import { Schema } from "effect";
7
+ var TrimmedString = Schema.Trim;
8
+ var TrimmedNonEmptyString = TrimmedString.check(Schema.isNonEmpty());
9
+ var NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
10
+ var PositiveInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1));
11
+ var IsoDateTime = Schema.String;
12
+ var makeEntityId = (brand) => TrimmedNonEmptyString.pipe(Schema.brand(brand));
13
+ var ThreadId = makeEntityId("ThreadId");
14
+ var ProjectId = makeEntityId("ProjectId");
15
+ var WorkspaceId = makeEntityId("WorkspaceId");
16
+ var GraphId = makeEntityId("GraphId");
17
+ var TaskId = makeEntityId("TaskId");
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"));
22
+ var EngineRuntimeId = makeEntityId("EngineRuntimeId");
23
+ var ConversationId = makeEntityId("ConversationId");
24
+ var ActionId = makeEntityId("ActionId");
25
+ var ArtifactId = makeEntityId("ArtifactId");
26
+ var WorktreeId = makeEntityId("WorktreeId");
27
+ var ValidationResultId = makeEntityId("ValidationResultId");
28
+ var ReviewResultId = makeEntityId("ReviewResultId");
29
+ var CommandId = makeEntityId("CommandId");
30
+ var EventId = makeEntityId("EventId");
31
+ var MessageId = makeEntityId("MessageId");
32
+ var TurnId = makeEntityId("TurnId");
33
+ var ProviderItemId = makeEntityId("ProviderItemId");
34
+ var RuntimeSessionId = makeEntityId("RuntimeSessionId");
35
+ var RuntimeItemId = makeEntityId("RuntimeItemId");
36
+ var RuntimeRequestId = makeEntityId("RuntimeRequestId");
37
+ var RuntimeTaskId = makeEntityId("RuntimeTaskId");
38
+ var ApprovalRequestId = makeEntityId("ApprovalRequestId");
39
+ var CheckpointRef = makeEntityId("CheckpointRef");
40
+ var RemoteEndpointId = makeEntityId("RemoteEndpointId");
41
+
42
+ // packages/contracts/src/rollups.ts
43
+ var PercentComplete = NonNegativeInt.check(Schema2.isLessThanOrEqualTo(100));
44
+ var EpicRollup = Schema2.Struct({
45
+ epicKey: TrimmedNonEmptyString,
46
+ total: NonNegativeInt,
47
+ percentComplete: PercentComplete,
48
+ blockedCount: NonNegativeInt,
49
+ humanBlockedCount: NonNegativeInt,
50
+ inFlightCount: NonNegativeInt,
51
+ byStatus: Schema2.Record(Schema2.String, NonNegativeInt)
52
+ });
53
+ var AssigneeRollup = Schema2.Struct({
54
+ assignee: TrimmedNonEmptyString,
55
+ openTaskCount: NonNegativeInt,
56
+ inFlightRunCount: NonNegativeInt,
57
+ prsAwaitingReview: NonNegativeInt,
58
+ blockers: Schema2.Array(TaskId)
59
+ });
60
+ var WorkspaceRollups = Schema2.Struct({
61
+ epics: Schema2.Array(EpicRollup),
62
+ assignees: Schema2.Array(AssigneeRollup),
63
+ generatedAt: IsoDateTime
64
+ });
65
+ export {
66
+ WorkspaceRollups,
67
+ PercentComplete,
68
+ EpicRollup,
69
+ AssigneeRollup
70
+ };
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Run-discovery capability seam.
3
+ *
4
+ * Contracts-native types for the RUN_DISCOVERY service: inline structural
5
+ * equivalents of the @oh-my-pi and @rig/relay-registry types. We define
6
+ * them here rather than importing from those packages to keep @rig/contracts
7
+ * floor-neutral (@rig/relay-registry depends on @rig/contracts — importing
8
+ * relay-registry here would be circular; @oh-my-pi is a vendor package that
9
+ * doesn't belong on the floor).
10
+ *
11
+ * TypeScript's structural type system makes these compatible with the
12
+ * corresponding @oh-my-pi / relay-registry types at the impl site.
13
+ *
14
+ * Pure: types + one branded id, no behaviour.
15
+ */
16
+ import type { CapabilityId } from "./capability-id";
17
+ import type { Stream } from "effect";
18
+ /** Structural equivalent of @oh-my-pi CollabRegistryFilter. */
19
+ export interface RunDiscoveryFilter {
20
+ githubUserId?: string;
21
+ namespaceKey?: string;
22
+ selectedRepo?: string;
23
+ cwd?: string;
24
+ }
25
+ /** Structural equivalent of @oh-my-pi LiveCollabOwner. */
26
+ export interface RunDiscoveryOwner {
27
+ githubUserId?: string;
28
+ login?: string;
29
+ namespaceKey?: string;
30
+ }
31
+ /** Structural equivalent of @oh-my-pi LiveCollabProjection. */
32
+ export interface LiveRunCollabProjection {
33
+ sessionId: string;
34
+ sessionPath: string;
35
+ cwd: string;
36
+ title: string;
37
+ joinLink: string;
38
+ webLink: string;
39
+ relayUrl?: string;
40
+ owner?: RunDiscoveryOwner;
41
+ selectedRepo?: string;
42
+ startedAt: string;
43
+ updatedAt: string;
44
+ pid?: number;
45
+ stale: boolean;
46
+ }
47
+ /** Input for attaching to a run via the relay (structural equiv of AttachViaRelayInput). */
48
+ export interface RigRunAttachInput {
49
+ readonly runId: string;
50
+ readonly taskId?: string | null;
51
+ readonly identityFilter: RunDiscoveryFilter;
52
+ readonly timeoutMs?: number;
53
+ readonly projectRoot?: string;
54
+ }
55
+ /** Result of a relay attach (structural equiv of RigExtensionAttachResult). */
56
+ export interface RigRunAttachResult {
57
+ readonly sessionPath: string | null;
58
+ readonly joinLink: string | null;
59
+ readonly collabSessionId: string | null;
60
+ }
61
+ /**
62
+ * The run-discovery service surface: the unified active-run list (local FS +
63
+ * remote registry) and relay attach. registrySnapshotStream is intentionally
64
+ * omitted — its entry type (`RegistrySnapshotFrame` from @rig/relay-registry)
65
+ * cannot be referenced here without creating a circular dep; consumers that
66
+ * need snapshot frames must cast through the transport-plugin's richer type.
67
+ */
68
+ export interface RunDiscoveryService {
69
+ readonly listActiveRunCollab: (projectRoot: string, filter: RunDiscoveryFilter) => Promise<readonly LiveRunCollabProjection[]>;
70
+ readonly runDiscoveryStream: (projectRoot: string) => Stream.Stream<void>;
71
+ readonly attachViaRelay: (input: RigRunAttachInput) => Promise<RigRunAttachResult | null>;
72
+ }
73
+ /** Stable id string for the run-discovery service capability. */
74
+ export declare const RUN_DISCOVERY_CAPABILITY_ID = "rig.runs.discovery";
75
+ /**
76
+ * The branded run-discovery capability id. `defineCapability(RUN_DISCOVERY)`
77
+ * (provider and consumers independently) resolves to a `RunDiscoveryService`.
78
+ */
79
+ export declare const RUN_DISCOVERY: CapabilityId<RunDiscoveryService>;
@@ -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/run-discovery.ts
8
+ var RUN_DISCOVERY_CAPABILITY_ID = "rig.runs.discovery";
9
+ var RUN_DISCOVERY = makeCapabilityId(RUN_DISCOVERY_CAPABILITY_ID);
10
+ export {
11
+ RUN_DISCOVERY_CAPABILITY_ID,
12
+ RUN_DISCOVERY
13
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * run-dispatch.ts — pure capability vocabulary for placement-aware run dispatch.
3
+ *
4
+ * The dispatch IMPL (local + remote placement, run-process spawn, session-id
5
+ * wait) lives in @rig/transport-plugin (`./dispatch`, the `transport` backbone).
6
+ * Programmatic consumers (rig-extension, supervisor) resolve it off a project's
7
+ * plugin host under {@link RUN_DISPATCH_CAPABILITY_ID} — WITHOUT importing the
8
+ * transport plugin's impl. This file holds ONLY the pure id + interface shared
9
+ * by the provider and its consumers (no IO, no plugin imports).
10
+ */
11
+ import type { CapabilityId } from "./capability-id";
12
+ /** The placement-aware run dispatch input (plain, OMP-type-free). */
13
+ export interface RunDispatchInput {
14
+ readonly projectRoot: string;
15
+ readonly taskId: string;
16
+ readonly title?: string | null;
17
+ readonly model?: string | null;
18
+ readonly prompt?: string | null;
19
+ readonly force?: boolean;
20
+ }
21
+ /**
22
+ * The host-resolved run-dispatch surface: dispatch a run (resolving local vs
23
+ * remote/fleet placement at dispatch time) and resolve once an OMP session id
24
+ * has appeared. Mirrors `dispatchRun` in @rig/transport-plugin.
25
+ */
26
+ export interface RunDispatchService {
27
+ readonly dispatchRun: (input: RunDispatchInput) => Promise<{
28
+ readonly runId: string;
29
+ }>;
30
+ }
31
+ /** The capability id the transport plugin registers its run dispatcher under. */
32
+ export declare const RUN_DISPATCH_CAPABILITY_ID = "rig.runs.dispatch";
33
+ /** Phantom-typed id; string value is {@link RUN_DISPATCH_CAPABILITY_ID}. */
34
+ export declare const RUN_DISPATCH: CapabilityId<RunDispatchService>;
@@ -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/run-dispatch.ts
8
+ var RUN_DISPATCH_CAPABILITY_ID = "rig.runs.dispatch";
9
+ var RUN_DISPATCH = makeCapabilityId(RUN_DISPATCH_CAPABILITY_ID);
10
+ export {
11
+ RUN_DISPATCH_CAPABILITY_ID,
12
+ RUN_DISPATCH
13
+ };
@@ -0,0 +1,47 @@
1
+ /**
2
+ * cap:run-identity-env — GitHub/Rig run identity capability seam.
3
+ *
4
+ * The CLI seed and sibling plugins must not implement GitHub identity policy or
5
+ * import a provider implementation directly. The identity owner
6
+ * (`@rig/github-provider-plugin`) registers this capability with public
7
+ * identity-env hydration, run-child credential stripping, and runtime identity
8
+ * resolution. This file holds ONLY pure seam vocabulary — no IO.
9
+ */
10
+ import type { CapabilityId } from "./capability-id";
11
+ import type { RigIdentityContext, RigResolvedIdentity } from "./identity";
12
+ /** Structural mirror of `@rig/relay-registry`'s `CollabRegistryFilter` (no transport dep). */
13
+ export type IdentityRegistryFilter = {
14
+ readonly cwd?: string;
15
+ readonly selectedRepo?: string;
16
+ readonly githubUserId?: string;
17
+ readonly namespaceKey?: string;
18
+ };
19
+ /** Capability id the identity owner registers its run identity policy under. */
20
+ export declare const RUN_IDENTITY_ENV_CAPABILITY_ID = "cap:run-identity-env";
21
+ /** GitHub/Rig identity operations consumers resolve through the provider capability. */
22
+ export interface RunIdentityEnvService {
23
+ /**
24
+ * Resolve public identity env vars for `workspaceRoot` without mutating
25
+ * process.env.
26
+ */
27
+ resolveIdentityEnv(workspaceRoot: string): Partial<Record<"RIG_SELECTED_REPO" | "RIG_GITHUB_USER_ID" | "RIG_GITHUB_LOGIN" | "RIG_GITHUB_NAMESPACE_KEY", string>>;
28
+ /**
29
+ * Hydrate the public-identity env vars for `workspaceRoot` into process.env
30
+ * (RIG_SELECTED_REPO / RIG_GITHUB_USER_ID / RIG_GITHUB_LOGIN / namespace key /
31
+ * auth-state-file pointer). Returns a restore closure that reverts the change.
32
+ */
33
+ applyIdentityEnv(workspaceRoot: string): () => void;
34
+ /** Build a registry discovery filter from the current public identity env. */
35
+ identityFilterFromEnv(): IdentityRegistryFilter;
36
+ /**
37
+ * Return a copy of `env` (default process.env) with the run-scoped credential
38
+ * tokens removed, for use as a spawned run-host child's environment.
39
+ */
40
+ stripRunChildCredentialEnv(env?: Record<string, string | undefined>): Record<string, string | undefined>;
41
+ /** Resolve the current Rig run identity from the OMP session/auth context. */
42
+ resolveRigIdentity(ctx: RigIdentityContext): RigResolvedIdentity | null;
43
+ /** Resolve the registry filter corresponding to the current Rig run identity. */
44
+ resolveRigIdentityFilter(ctx: RigIdentityContext): IdentityRegistryFilter | null;
45
+ }
46
+ /** Typed capability id; string value is {@link RUN_IDENTITY_ENV_CAPABILITY_ID}. */
47
+ export declare const RUN_IDENTITY_ENV: CapabilityId<RunIdentityEnvService>;
@@ -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/run-identity.ts
8
+ var RUN_IDENTITY_ENV_CAPABILITY_ID = "cap:run-identity-env";
9
+ var RUN_IDENTITY_ENV = makeCapabilityId(RUN_IDENTITY_ENV_CAPABILITY_ID);
10
+ export {
11
+ RUN_IDENTITY_ENV_CAPABILITY_ID,
12
+ RUN_IDENTITY_ENV
13
+ };