@h-rig/contracts 0.0.6-alpha.164 → 0.0.6-alpha.166

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.
package/dist/src/index.js CHANGED
@@ -1430,7 +1430,7 @@ var GitHubProjectStatusConfig = Schema13.Struct({
1430
1430
  }))
1431
1431
  });
1432
1432
  var GitHubConfig = Schema13.Struct({
1433
- issueUpdates: Schema13.optional(Schema13.Literals(["lifecycle", "minimal", "off"])),
1433
+ issueUpdates: Schema13.optional(Schema13.Literals(["all", "lifecycle", "minimal", "off"])),
1434
1434
  projects: Schema13.optional(GitHubProjectStatusConfig)
1435
1435
  });
1436
1436
  var AutomationConfig = Schema13.Struct({
@@ -2387,11 +2387,43 @@ var RUN_IDENTITY_ENV = makeCapabilityId(RUN_IDENTITY_ENV_CAPABILITY_ID);
2387
2387
  var PRIOR_PROGRESS_PROMPT_CAPABILITY_ID = "prompt.prior-progress";
2388
2388
  var PRIOR_PROGRESS_PROMPT = makeCapabilityId(PRIOR_PROGRESS_PROMPT_CAPABILITY_ID);
2389
2389
  // packages/contracts/src/task-source.ts
2390
+ var TASK_SOURCE_UPDATE_CAPABILITY_ID = "task-sources.update";
2391
+ var TASK_SOURCE_UPDATE = makeCapabilityId(TASK_SOURCE_UPDATE_CAPABILITY_ID);
2390
2392
  var TASK_IO_SERVICE_CAPABILITY_ID = "task-sources.task-io";
2391
2393
  var TASK_IO_SERVICE_CAPABILITY = makeCapabilityId(TASK_IO_SERVICE_CAPABILITY_ID);
2392
2394
  // packages/contracts/src/task-data.ts
2393
2395
  var TASK_DATA_SERVICE_CAPABILITY_ID = "task-sources.task-data";
2394
2396
  var TASK_DATA_SERVICE_CAPABILITY = makeCapabilityId(TASK_DATA_SERVICE_CAPABILITY_ID);
2397
+ // packages/contracts/src/task-state-store.ts
2398
+ var TASK_STATE_STORE_CAPABILITY_ID = "task-state.store";
2399
+ var TASK_STATE_STORE = makeCapabilityId(TASK_STATE_STORE_CAPABILITY_ID);
2400
+ // packages/contracts/src/task-artifacts.ts
2401
+ var TASK_ARTIFACTS_CAPABILITY_ID = "task-state.artifacts";
2402
+ var TASK_ARTIFACTS = makeCapabilityId(TASK_ARTIFACTS_CAPABILITY_ID);
2403
+ // packages/contracts/src/task-context-renderer.ts
2404
+ var TASK_CONTEXT_RENDERER_CAPABILITY_ID = "provider.task-context-renderer";
2405
+ var TASK_CONTEXT_RENDERER = makeCapabilityId(TASK_CONTEXT_RENDERER_CAPABILITY_ID);
2406
+ // packages/contracts/src/task-tracker-state.ts
2407
+ var TASK_TRACKER_LIFECYCLE_STATUSES = [
2408
+ "draft",
2409
+ "open",
2410
+ "ready",
2411
+ "queued",
2412
+ "in_progress",
2413
+ "under_review",
2414
+ "blocked",
2415
+ "completed",
2416
+ "cancelled"
2417
+ ];
2418
+ var TASK_TRACKER_STALE_CLAIM_MS = 24 * 60 * 60 * 1000;
2419
+ var TASK_TRACKER_RECONCILIATION_POLICY_CAPABILITY_ID = "lifecycle.task-tracker-reconciliation-policy";
2420
+ var TASK_TRACKER_RECONCILIATION_POLICY = makeCapabilityId(TASK_TRACKER_RECONCILIATION_POLICY_CAPABILITY_ID);
2421
+ var TASK_TRACKER_READINESS_POLICY_CAPABILITY_ID = "scheduler.task-tracker-readiness-policy";
2422
+ var TASK_TRACKER_READINESS_POLICY = makeCapabilityId(TASK_TRACKER_READINESS_POLICY_CAPABILITY_ID);
2423
+ var TASK_TRACKER_REPO_LOCATOR_CAPABILITY_ID = "task-state.tracker-repo-locator";
2424
+ var TASK_TRACKER_REPO_LOCATOR = makeCapabilityId(TASK_TRACKER_REPO_LOCATOR_CAPABILITY_ID);
2425
+ var TASK_TRACKER_STATE_CAPABILITY_ID = "task-state.tracker-state";
2426
+ var TASK_TRACKER_STATE = makeCapabilityId(TASK_TRACKER_STATE_CAPABILITY_ID);
2395
2427
  // packages/contracts/src/cli-output.ts
2396
2428
  import { Schema as Schema26 } from "effect";
2397
2429
  var CLI_OUTPUT_VERSION = 1;
@@ -2683,12 +2715,16 @@ class CliError extends Error {
2683
2715
  }
2684
2716
  // packages/contracts/src/lifecycle-capabilities.ts
2685
2717
  var TASK_VERIFY_CAPABILITY_ID = "default-lifecycle.task-verify";
2718
+ var TASK_VALIDATION_CAPABILITY_ID = "default-lifecycle.task-validation";
2686
2719
  var COMPLETION_VERIFICATION_CAPABILITY_ID = "default-lifecycle.completion-verification";
2687
2720
  var RUN_CLOSEOUT_CAPABILITY_ID = "default-lifecycle.run-closeout";
2721
+ var TASK_SOURCE_REFLECTION_CAPABILITY_ID = "default-lifecycle.task-source-reflection";
2688
2722
  var LIFECYCLE_GIT_AGENT_CAPABILITY_ID = "default-lifecycle.git-agent";
2689
2723
  var TASK_VERIFY_CAPABILITY = makeCapabilityId(TASK_VERIFY_CAPABILITY_ID);
2724
+ var TASK_VALIDATION_CAPABILITY = makeCapabilityId(TASK_VALIDATION_CAPABILITY_ID);
2690
2725
  var COMPLETION_VERIFICATION_CAPABILITY = makeCapabilityId(COMPLETION_VERIFICATION_CAPABILITY_ID);
2691
2726
  var LIFECYCLE_GIT_AGENT = makeCapabilityId(LIFECYCLE_GIT_AGENT_CAPABILITY_ID);
2727
+ var TASK_SOURCE_REFLECTION = makeCapabilityId(TASK_SOURCE_REFLECTION_CAPABILITY_ID);
2692
2728
  var RUN_CLOSEOUT_CAPABILITY = makeCapabilityId(RUN_CLOSEOUT_CAPABILITY_ID);
2693
2729
  // packages/contracts/src/browser.ts
2694
2730
  var BROWSER_CONTRACT_SERVICE_CAPABILITY_ID = "browser.contract";
@@ -2713,6 +2749,14 @@ var SESSION_ASSET_MATERIALIZER = makeCapabilityId(SESSION_ASSET_MATERIALIZER_CAP
2713
2749
  var ISOLATION_BACKEND_CAPABILITY_ID = "isolation.backend";
2714
2750
  var ISOLATION_BACKEND = makeCapabilityId(ISOLATION_BACKEND_CAPABILITY_ID);
2715
2751
  // packages/contracts/src/managed-repos.ts
2752
+ var REPO_NATIVE_GIT_CAPABILITY_ID = "native-toolchain.git";
2753
+ var REPO_NATIVE_GIT = makeCapabilityId(REPO_NATIVE_GIT_CAPABILITY_ID);
2754
+ var NATIVE_TOOLCHAIN_GIT_CAPABILITY_ID = REPO_NATIVE_GIT_CAPABILITY_ID;
2755
+ var NATIVE_TOOLCHAIN_GIT = REPO_NATIVE_GIT;
2756
+ var REPO_GIT_BINARY_CAPABILITY_ID = "repos.git-binary";
2757
+ var REPO_GIT_BINARY = makeCapabilityId(REPO_GIT_BINARY_CAPABILITY_ID);
2758
+ var REPO_CHANGE_SET_CAPABILITY_ID = "repos.change-set";
2759
+ var REPO_CHANGE_SET = makeCapabilityId(REPO_CHANGE_SET_CAPABILITY_ID);
2716
2760
  var REPO_OPERATIONS_CAPABILITY_ID = "repos.operations";
2717
2761
  var REPO_OPERATIONS_CAPABILITY = makeCapabilityId(REPO_OPERATIONS_CAPABILITY_ID);
2718
2762
  var MANAGED_REPO_SERVICE_CAPABILITY_ID = "managed-repos.service";
@@ -2742,6 +2786,17 @@ var GUARD_TOOLCHAIN_SOURCES_CAPABILITY_ID = "rig.toolchain.sources.guard";
2742
2786
  var LIFECYCLE_TOOLCHAIN_SOURCES_CAPABILITY_ID = "rig.toolchain.sources.lifecycle";
2743
2787
  var GUARD_TOOLCHAIN_SOURCES = makeCapabilityId(GUARD_TOOLCHAIN_SOURCES_CAPABILITY_ID);
2744
2788
  var LIFECYCLE_TOOLCHAIN_SOURCES = makeCapabilityId(LIFECYCLE_TOOLCHAIN_SOURCES_CAPABILITY_ID);
2789
+ // packages/contracts/src/native-toolchain.ts
2790
+ var NATIVE_TOOLCHAIN_BINARY_BUILD_CAPABILITY_ID = "native-toolchain.binary-build";
2791
+ var NATIVE_TOOLCHAIN_BINARY_BUILD = makeCapabilityId(NATIVE_TOOLCHAIN_BINARY_BUILD_CAPABILITY_ID);
2792
+ // packages/contracts/src/cockpit.ts
2793
+ var TASK_PROJECTION_CAPABILITY_ID = makeCapabilityId("rig:task-projection");
2794
+ var DISPATCH_OUTCOME_CAPABILITY_ID = makeCapabilityId("rig:dispatch-outcome");
2795
+ // packages/contracts/src/docs-drift.ts
2796
+ var DOCS_DRIFT_VALIDATOR_ID = "std:docs-drift";
2797
+ var DOCS_DRIFT_CLI_ID = "std:drift";
2798
+ var DOCS_DRIFT_STAGE_ID = "docs-drift";
2799
+ var DOCS_DRIFT_CAPABILITY_ID = "std:docs-drift-capability";
2745
2800
  // packages/contracts/src/cli-runner.ts
2746
2801
  var CLI_RUNNER_CAPABILITY_ID = "rig.cli.runner";
2747
2802
  var CLI_RUNNER = makeCapabilityId(CLI_RUNNER_CAPABILITY_ID);
@@ -2809,12 +2864,35 @@ export {
2809
2864
  TOOL_MATERIALIZER,
2810
2865
  TASK_VERIFY_CAPABILITY_ID,
2811
2866
  TASK_VERIFY_CAPABILITY,
2867
+ TASK_VALIDATION_CAPABILITY_ID,
2868
+ TASK_VALIDATION_CAPABILITY,
2869
+ TASK_TRACKER_STATE_CAPABILITY_ID,
2870
+ TASK_TRACKER_STATE,
2871
+ TASK_TRACKER_STALE_CLAIM_MS,
2872
+ TASK_TRACKER_REPO_LOCATOR_CAPABILITY_ID,
2873
+ TASK_TRACKER_REPO_LOCATOR,
2874
+ TASK_TRACKER_RECONCILIATION_POLICY_CAPABILITY_ID,
2875
+ TASK_TRACKER_RECONCILIATION_POLICY,
2876
+ TASK_TRACKER_READINESS_POLICY_CAPABILITY_ID,
2877
+ TASK_TRACKER_READINESS_POLICY,
2878
+ TASK_TRACKER_LIFECYCLE_STATUSES,
2879
+ TASK_STATE_STORE_CAPABILITY_ID,
2880
+ TASK_STATE_STORE,
2881
+ TASK_SOURCE_UPDATE_CAPABILITY_ID,
2882
+ TASK_SOURCE_UPDATE,
2883
+ TASK_SOURCE_REFLECTION_CAPABILITY_ID,
2884
+ TASK_SOURCE_REFLECTION,
2812
2885
  TASK_SELECTION_CAPABILITY_ID,
2813
2886
  TASK_SELECTION,
2887
+ TASK_PROJECTION_CAPABILITY_ID,
2814
2888
  TASK_IO_SERVICE_CAPABILITY_ID,
2815
2889
  TASK_IO_SERVICE_CAPABILITY,
2816
2890
  TASK_DATA_SERVICE_CAPABILITY_ID,
2817
2891
  TASK_DATA_SERVICE_CAPABILITY,
2892
+ TASK_CONTEXT_RENDERER_CAPABILITY_ID,
2893
+ TASK_CONTEXT_RENDERER,
2894
+ TASK_ARTIFACTS_CAPABILITY_ID,
2895
+ TASK_ARTIFACTS,
2818
2896
  SupervisorStoppedEvent,
2819
2897
  SupervisorStopReason,
2820
2898
  SupervisorStatus,
@@ -3009,6 +3087,12 @@ export {
3009
3087
  RIG_ARTIFACTS_DIRNAME,
3010
3088
  REPO_OPERATIONS_CAPABILITY_ID,
3011
3089
  REPO_OPERATIONS_CAPABILITY,
3090
+ REPO_NATIVE_GIT_CAPABILITY_ID,
3091
+ REPO_NATIVE_GIT,
3092
+ REPO_GIT_BINARY_CAPABILITY_ID,
3093
+ REPO_GIT_BINARY,
3094
+ REPO_CHANGE_SET_CAPABILITY_ID,
3095
+ REPO_CHANGE_SET,
3012
3096
  REASONING_EFFORT_OPTIONS_BY_PROVIDER,
3013
3097
  QueueEntry,
3014
3098
  PullRequestConfig,
@@ -3075,6 +3159,10 @@ export {
3075
3159
  NO_MATCH_RETRIEVAL_CANONICAL_KEY,
3076
3160
  NOTIFY_SERVICE_CAPABILITY_ID,
3077
3161
  NOTIFY_SERVICE_CAPABILITY,
3162
+ NATIVE_TOOLCHAIN_GIT_CAPABILITY_ID,
3163
+ NATIVE_TOOLCHAIN_GIT,
3164
+ NATIVE_TOOLCHAIN_BINARY_BUILD_CAPABILITY_ID,
3165
+ NATIVE_TOOLCHAIN_BINARY_BUILD,
3078
3166
  MissingCapability,
3079
3167
  MessageId,
3080
3168
  MergeConfig,
@@ -3173,6 +3261,11 @@ export {
3173
3261
  DependencyEdge,
3174
3262
  DOCTOR_RUNNER_CAPABILITY_ID,
3175
3263
  DOCTOR,
3264
+ DOCS_DRIFT_VALIDATOR_ID,
3265
+ DOCS_DRIFT_STAGE_ID,
3266
+ DOCS_DRIFT_CLI_ID,
3267
+ DOCS_DRIFT_CAPABILITY_ID,
3268
+ DISPATCH_OUTCOME_CAPABILITY_ID,
3176
3269
  DEPENDENCY_PREFLIGHT_CAPABILITY_ID,
3177
3270
  DEPENDENCY_PREFLIGHT_CAPABILITY,
3178
3271
  DEFAULT_TERMINAL_ID,
@@ -12,12 +12,17 @@ import type { CapabilityId } from "./capability-id";
12
12
  import type { JournalCapability } from "./kernel";
13
13
  import type { RigAutomationConfig, StrictPrGreptileApiOptions } from "./control-plane-types";
14
14
  import type { RunCloseoutPhase, RunCloseoutPhaseOutcome } from "./run-journal";
15
+ import type { TaskSourceUpdateResult } from "./task-source";
15
16
  /** Capability id the bundle registers its `taskVerify` orchestration under. */
16
17
  export declare const TASK_VERIFY_CAPABILITY_ID = "default-lifecycle.task-verify";
18
+ /** Capability id the bundle registers its task validation runner under. */
19
+ export declare const TASK_VALIDATION_CAPABILITY_ID = "default-lifecycle.task-validation";
17
20
  /** Capability id the bundle registers the completion-verification gate under. */
18
21
  export declare const COMPLETION_VERIFICATION_CAPABILITY_ID = "default-lifecycle.completion-verification";
19
22
  /** Capability id the bundle registers its run-worker closeout driver under. */
20
23
  export declare const RUN_CLOSEOUT_CAPABILITY_ID = "default-lifecycle.run-closeout";
24
+ /** Capability id the bundle registers its lifecycle-owned task-source reflection under. */
25
+ export declare const TASK_SOURCE_REFLECTION_CAPABILITY_ID = "default-lifecycle.task-source-reflection";
21
26
  /** Capability id the bundle registers its agent-facing git helper surface under. */
22
27
  export declare const LIFECYCLE_GIT_AGENT_CAPABILITY_ID = "default-lifecycle.git-agent";
23
28
  export interface TaskVerifyCapabilityInput {
@@ -33,6 +38,14 @@ export type TaskVerifyCapabilityRun = (input: TaskVerifyCapabilityInput) => Prom
33
38
  * is {@link TASK_VERIFY_CAPABILITY_ID}, so it indexes the same host entry.
34
39
  */
35
40
  export declare const TASK_VERIFY_CAPABILITY: CapabilityId<TaskVerifyCapabilityRun>;
41
+ export interface TaskValidationCapabilityInput {
42
+ readonly projectRoot: string;
43
+ readonly taskId?: string;
44
+ readonly validatorRegistry?: unknown;
45
+ }
46
+ /** Resolves true when task validation passes or is skipped, false on validation failures. */
47
+ export type TaskValidationCapabilityRun = (input: TaskValidationCapabilityInput) => Promise<boolean>;
48
+ export declare const TASK_VALIDATION_CAPABILITY: CapabilityId<TaskValidationCapabilityRun>;
36
49
  export interface CompletionVerificationCapabilityInput {
37
50
  readonly projectRoot: string;
38
51
  readonly taskId?: string;
@@ -88,6 +101,51 @@ export type LifecycleGitAgentService = {
88
101
  };
89
102
  export declare const LIFECYCLE_GIT_AGENT: CapabilityId<LifecycleGitAgentService>;
90
103
  export type RunTaskSourceReflectStatus = "under_review" | "ci_fixing" | "merging" | "closed" | "needs_attention";
104
+ export type RunTaskSourceLifecycleStatus = "running" | RunTaskSourceReflectStatus | "cancelled";
105
+ export type RunTaskSourceLifecycleRun = {
106
+ runId?: string | null;
107
+ taskId?: string | null;
108
+ sourceTask?: unknown;
109
+ worktreePath?: string | null;
110
+ logRoot?: string | null;
111
+ sessionPath?: string | null;
112
+ errorText?: string | null;
113
+ };
114
+ export type RunTaskSourceLifecycleOptions = {
115
+ errorText?: string | null;
116
+ };
117
+ export type TaskSourceReflectionInput = {
118
+ readonly projectRoot: string;
119
+ readonly taskId: string;
120
+ readonly sourceTask?: unknown;
121
+ readonly runId?: string | null;
122
+ /** Generic source status to write. Omit/null for comment-only reflection. */
123
+ readonly status?: string | null;
124
+ /** Status text rendered in the lifecycle comment; defaults to `status`. */
125
+ readonly commentStatus?: string | null;
126
+ readonly summary: string;
127
+ readonly runtimeWorkspace?: string | null;
128
+ readonly logsDir?: string | null;
129
+ readonly sessionDir?: string | null;
130
+ readonly errorText?: string | null;
131
+ readonly prUrl?: string | null;
132
+ };
133
+ export type TaskSourceMergedPrReflectionInput = {
134
+ readonly projectRoot: string;
135
+ readonly taskId: string;
136
+ readonly runId: string;
137
+ readonly prUrl: string;
138
+ readonly sourceTask?: unknown;
139
+ };
140
+ export type TaskSourceReflectionResult = TaskSourceUpdateResult & {
141
+ readonly status?: unknown;
142
+ };
143
+ export interface TaskSourceReflectionService {
144
+ reflectTaskSourceStatus(input: TaskSourceReflectionInput): Promise<TaskSourceReflectionResult | null>;
145
+ updateRunTaskSourceLifecycle(projectRoot: string, run: RunTaskSourceLifecycleRun, status: RunTaskSourceLifecycleStatus, summary: string, options?: RunTaskSourceLifecycleOptions): Promise<TaskSourceReflectionResult | null>;
146
+ closeMergedPr(input: TaskSourceMergedPrReflectionInput): Promise<TaskSourceReflectionResult | null>;
147
+ }
148
+ export declare const TASK_SOURCE_REFLECTION: CapabilityId<TaskSourceReflectionService>;
91
149
  export type RunCloseoutResultStatus = "merged" | "opened" | "skipped" | "needs-attention";
92
150
  export type RunCloseoutResult = {
93
151
  status: RunCloseoutResultStatus;
@@ -6,16 +6,24 @@ function makeCapabilityId(id) {
6
6
 
7
7
  // packages/contracts/src/lifecycle-capabilities.ts
8
8
  var TASK_VERIFY_CAPABILITY_ID = "default-lifecycle.task-verify";
9
+ var TASK_VALIDATION_CAPABILITY_ID = "default-lifecycle.task-validation";
9
10
  var COMPLETION_VERIFICATION_CAPABILITY_ID = "default-lifecycle.completion-verification";
10
11
  var RUN_CLOSEOUT_CAPABILITY_ID = "default-lifecycle.run-closeout";
12
+ var TASK_SOURCE_REFLECTION_CAPABILITY_ID = "default-lifecycle.task-source-reflection";
11
13
  var LIFECYCLE_GIT_AGENT_CAPABILITY_ID = "default-lifecycle.git-agent";
12
14
  var TASK_VERIFY_CAPABILITY = makeCapabilityId(TASK_VERIFY_CAPABILITY_ID);
15
+ var TASK_VALIDATION_CAPABILITY = makeCapabilityId(TASK_VALIDATION_CAPABILITY_ID);
13
16
  var COMPLETION_VERIFICATION_CAPABILITY = makeCapabilityId(COMPLETION_VERIFICATION_CAPABILITY_ID);
14
17
  var LIFECYCLE_GIT_AGENT = makeCapabilityId(LIFECYCLE_GIT_AGENT_CAPABILITY_ID);
18
+ var TASK_SOURCE_REFLECTION = makeCapabilityId(TASK_SOURCE_REFLECTION_CAPABILITY_ID);
15
19
  var RUN_CLOSEOUT_CAPABILITY = makeCapabilityId(RUN_CLOSEOUT_CAPABILITY_ID);
16
20
  export {
17
21
  TASK_VERIFY_CAPABILITY_ID,
18
22
  TASK_VERIFY_CAPABILITY,
23
+ TASK_VALIDATION_CAPABILITY_ID,
24
+ TASK_VALIDATION_CAPABILITY,
25
+ TASK_SOURCE_REFLECTION_CAPABILITY_ID,
26
+ TASK_SOURCE_REFLECTION,
19
27
  RUN_CLOSEOUT_CAPABILITY_ID,
20
28
  RUN_CLOSEOUT_CAPABILITY,
21
29
  LIFECYCLE_GIT_AGENT_CAPABILITY_ID,
@@ -1,11 +1,15 @@
1
1
  /**
2
- * Pure managed-repo and repo-operation contract types + capability ids.
2
+ * Pure managed-repo, repo-operation, and repo-native git contract types + capability ids.
3
3
  *
4
4
  * `@rig/repos-plugin` owns the concrete implementations. It contributes:
5
5
  * - `ManagedRepoService` under {@link MANAGED_REPO_SERVICE_CAPABILITY_ID} for
6
- * registry/layout/mirror state, and
6
+ * registry/layout/mirror state,
7
7
  * - `RepoOperationsService` under {@link REPO_OPERATIONS_CAPABILITY_ID} for
8
- * task repo pinning, baseline reset, and project-main pre-run sync.
8
+ * task repo pinning, baseline reset, and project-main pre-run sync,
9
+ * - `RepoNativeGitService` under {@link REPO_NATIVE_GIT_CAPABILITY_ID} for
10
+ * repo-native git command wrappers, and
11
+ * - `RepoGitBinaryService` under {@link REPO_GIT_BINARY_CAPABILITY_ID} for
12
+ * the repo-owned rig-git helper binary.
9
13
  *
10
14
  * This module carries no behaviour and imports only pure sibling types, so
11
15
  * consumers resolve typed ids through `@rig/core` without importing the provider
@@ -13,6 +17,8 @@
13
17
  */
14
18
  import type { CapabilityId } from "./capability-id";
15
19
  import type { RepoSourceRegistration } from "./plugin";
20
+ import type { GitWorkingTreeFileChange } from "./git";
21
+ import type { NativeToolchainBinaryArtifact, NativeToolchainTarget } from "./native-toolchain";
16
22
  export type ManagedRepoId = string;
17
23
  export type ManagedRepoAlias = string;
18
24
  export type ManagedRepoHealth = "missing" | "ready" | "stale" | "misconfigured";
@@ -91,6 +97,61 @@ export interface ManagedRepoService {
91
97
  syncManagedRepo(projectRoot: string, repoId: ManagedRepoId): ManagedRepoSyncResult;
92
98
  }
93
99
  export type RepoPins = Record<string, string>;
100
+ export type RepoNativeGitTreeCommitUpdate = {
101
+ readonly path: string;
102
+ readonly content: string;
103
+ readonly executable?: boolean;
104
+ } | {
105
+ readonly path: string;
106
+ readonly delete: true;
107
+ };
108
+ /**
109
+ * Repo-owned native git command seam. Implementations live in `@rig/repos-plugin`;
110
+ * native-toolchain only builds/materializes binaries and does not own repo or git
111
+ * workflow semantics.
112
+ */
113
+ export interface RepoNativeGitService {
114
+ fetchRef(repoPath: string, remote: string, branch: string): string;
115
+ readBlobAtRef(repoPath: string, ref: string, path: string): string;
116
+ writeTreeCommit(repoPath: string, baseRef: string, updates: readonly RepoNativeGitTreeCommitUpdate[], message: string): string;
117
+ pushRefWithLease(repoPath: string, localOid: string, remoteRef: string, expectedOldOid: string, remote?: string): string;
118
+ }
119
+ /**
120
+ * Repo-native git is intentionally named from repos contracts. The capability id
121
+ * remains `native-toolchain.git` for compatibility with already published
122
+ * providers/consumers; treat that string as a legacy wire id, not ownership.
123
+ */
124
+ export declare const REPO_NATIVE_GIT_CAPABILITY_ID = "native-toolchain.git";
125
+ export declare const REPO_NATIVE_GIT: CapabilityId<RepoNativeGitService>;
126
+ /** @deprecated Use RepoNativeGitTreeCommitUpdate. */
127
+ export type NativeGitTreeCommitUpdate = RepoNativeGitTreeCommitUpdate;
128
+ /** @deprecated Use RepoNativeGitService. */
129
+ export type NativeGitService = RepoNativeGitService;
130
+ /** @deprecated Use REPO_NATIVE_GIT_CAPABILITY_ID; this is the legacy wire id. */
131
+ export declare const NATIVE_TOOLCHAIN_GIT_CAPABILITY_ID = "native-toolchain.git";
132
+ /** @deprecated Use REPO_NATIVE_GIT. */
133
+ export declare const NATIVE_TOOLCHAIN_GIT: CapabilityId<RepoNativeGitService>;
134
+ export interface RepoGitBinaryResolveInput {
135
+ readonly projectRoot?: string;
136
+ readonly target?: NativeToolchainTarget;
137
+ }
138
+ export interface RepoGitBinaryMaterializeInput {
139
+ readonly projectRoot: string;
140
+ readonly targetDir: string;
141
+ readonly target?: NativeToolchainTarget;
142
+ }
143
+ export interface RepoGitBinaryArtifact extends NativeToolchainBinaryArtifact {
144
+ readonly name: "rig-git";
145
+ readonly kind: "executable";
146
+ readonly commandName: string;
147
+ }
148
+ export interface RepoGitBinaryService {
149
+ gitHelperBinaryName(input?: RepoGitBinaryResolveInput): string;
150
+ resolveGitHelperBinary(input?: RepoGitBinaryResolveInput): RepoGitBinaryArtifact | null | Promise<RepoGitBinaryArtifact | null>;
151
+ materializeGitHelperBinary(input: RepoGitBinaryMaterializeInput): Promise<RepoGitBinaryArtifact>;
152
+ }
153
+ export declare const REPO_GIT_BINARY_CAPABILITY_ID = "repos.git-binary";
154
+ export declare const REPO_GIT_BINARY: CapabilityId<RepoGitBinaryService>;
94
155
  export type ProjectMainPreRunSyncResult = {
95
156
  status: "disabled";
96
157
  } | {
@@ -111,6 +172,48 @@ export type ProjectMainPreRunSyncOptions = {
111
172
  runBootstrap: () => Promise<void>;
112
173
  syncMonorepo?: (projectRoot: string) => void | Promise<void>;
113
174
  };
175
+ export type RepoChangeSetSelector = {
176
+ readonly kind: "task";
177
+ readonly taskId: string;
178
+ readonly scoped: boolean;
179
+ } | {
180
+ readonly kind: "scope";
181
+ readonly paths: readonly string[];
182
+ } | {
183
+ readonly kind: "workspace";
184
+ };
185
+ export type RepoChangeSetTarget = {
186
+ readonly kind: "project";
187
+ readonly projectRoot: string;
188
+ } | {
189
+ readonly kind: "managed-repo";
190
+ readonly projectRoot: string;
191
+ readonly repoId: ManagedRepoId;
192
+ } | {
193
+ readonly kind: "repo-root";
194
+ readonly repoRoot: string;
195
+ readonly projectRoot?: string;
196
+ };
197
+ export interface RepoChangeSetInput {
198
+ readonly projectRoot: string;
199
+ readonly selector: RepoChangeSetSelector;
200
+ readonly target?: RepoChangeSetTarget;
201
+ }
202
+ export interface RepoChangeSetFile extends GitWorkingTreeFileChange {
203
+ readonly repoRoot: string;
204
+ readonly repoId?: ManagedRepoId;
205
+ }
206
+ export interface RepoChangeSet {
207
+ readonly changedFiles: readonly RepoChangeSetFile[];
208
+ readonly pendingFiles: readonly RepoChangeSetFile[];
209
+ }
210
+ export interface RepoChangeSetService {
211
+ collectChangeSet(input: RepoChangeSetInput): RepoChangeSet | Promise<RepoChangeSet>;
212
+ changedFiles(input: RepoChangeSetInput): readonly RepoChangeSetFile[] | Promise<readonly RepoChangeSetFile[]>;
213
+ pendingFiles(input: RepoChangeSetInput): readonly RepoChangeSetFile[] | Promise<readonly RepoChangeSetFile[]>;
214
+ }
215
+ export declare const REPO_CHANGE_SET_CAPABILITY_ID = "repos.change-set";
216
+ export declare const REPO_CHANGE_SET: CapabilityId<RepoChangeSetService>;
114
217
  export interface RepoOperationsService {
115
218
  repoEnsure(projectRoot: string, taskId?: string): void;
116
219
  repoPins(projectRoot: string, taskId?: string): RepoPins;
@@ -5,6 +5,14 @@ function makeCapabilityId(id) {
5
5
  }
6
6
 
7
7
  // packages/contracts/src/managed-repos.ts
8
+ var REPO_NATIVE_GIT_CAPABILITY_ID = "native-toolchain.git";
9
+ var REPO_NATIVE_GIT = makeCapabilityId(REPO_NATIVE_GIT_CAPABILITY_ID);
10
+ var NATIVE_TOOLCHAIN_GIT_CAPABILITY_ID = REPO_NATIVE_GIT_CAPABILITY_ID;
11
+ var NATIVE_TOOLCHAIN_GIT = REPO_NATIVE_GIT;
12
+ var REPO_GIT_BINARY_CAPABILITY_ID = "repos.git-binary";
13
+ var REPO_GIT_BINARY = makeCapabilityId(REPO_GIT_BINARY_CAPABILITY_ID);
14
+ var REPO_CHANGE_SET_CAPABILITY_ID = "repos.change-set";
15
+ var REPO_CHANGE_SET = makeCapabilityId(REPO_CHANGE_SET_CAPABILITY_ID);
8
16
  var REPO_OPERATIONS_CAPABILITY_ID = "repos.operations";
9
17
  var REPO_OPERATIONS_CAPABILITY = makeCapabilityId(REPO_OPERATIONS_CAPABILITY_ID);
10
18
  var MANAGED_REPO_SERVICE_CAPABILITY_ID = "managed-repos.service";
@@ -12,6 +20,14 @@ var MANAGED_REPO_SERVICE_CAPABILITY = makeCapabilityId(MANAGED_REPO_SERVICE_CAPA
12
20
  export {
13
21
  REPO_OPERATIONS_CAPABILITY_ID,
14
22
  REPO_OPERATIONS_CAPABILITY,
23
+ REPO_NATIVE_GIT_CAPABILITY_ID,
24
+ REPO_NATIVE_GIT,
25
+ REPO_GIT_BINARY_CAPABILITY_ID,
26
+ REPO_GIT_BINARY,
27
+ REPO_CHANGE_SET_CAPABILITY_ID,
28
+ REPO_CHANGE_SET,
29
+ NATIVE_TOOLCHAIN_GIT_CAPABILITY_ID,
30
+ NATIVE_TOOLCHAIN_GIT,
15
31
  MANAGED_REPO_SERVICE_CAPABILITY_ID,
16
32
  MANAGED_REPO_SERVICE_CAPABILITY
17
33
  };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Mechanical native-toolchain capability seams.
3
+ *
4
+ * These contracts describe binary build/materialization services only. Repo
5
+ * meaning, task scoping, repo-native git wrappers, and git workflow semantics
6
+ * belong to repo contracts; native-toolchain providers only locate, compile, or
7
+ * materialize binaries.
8
+ *
9
+ * Pure: types + branded ids, no behaviour.
10
+ */
11
+ import type { CapabilityId } from "./capability-id";
12
+ export type NativeToolchainBinaryKind = "executable" | "dynamic-library";
13
+ export interface NativeToolchainTarget {
14
+ readonly platform: string;
15
+ readonly arch: string;
16
+ readonly triple?: string;
17
+ readonly abi?: string;
18
+ }
19
+ export interface NativeToolchainBinaryArtifact {
20
+ readonly name: string;
21
+ readonly path: string;
22
+ readonly kind: NativeToolchainBinaryKind;
23
+ readonly target?: NativeToolchainTarget;
24
+ }
25
+ export interface NativeToolchainBinaryBuildInput {
26
+ readonly projectRoot: string;
27
+ readonly name: string;
28
+ readonly sourcePath: string;
29
+ readonly outputPath: string;
30
+ readonly kind: NativeToolchainBinaryKind;
31
+ readonly target?: NativeToolchainTarget;
32
+ readonly buildArgs?: readonly string[];
33
+ readonly defines?: Readonly<Record<string, string>>;
34
+ }
35
+ export interface NativeToolchainBinaryMaterializeInput {
36
+ readonly projectRoot: string;
37
+ readonly name: string;
38
+ readonly targetDir: string;
39
+ readonly target?: NativeToolchainTarget;
40
+ }
41
+ export interface NativeToolchainBinaryBuildService {
42
+ buildNativeBinary(input: NativeToolchainBinaryBuildInput): Promise<NativeToolchainBinaryArtifact>;
43
+ materializeNativeBinary(input: NativeToolchainBinaryMaterializeInput): Promise<NativeToolchainBinaryArtifact>;
44
+ }
45
+ export declare const NATIVE_TOOLCHAIN_BINARY_BUILD_CAPABILITY_ID = "native-toolchain.binary-build";
46
+ export declare const NATIVE_TOOLCHAIN_BINARY_BUILD: CapabilityId<NativeToolchainBinaryBuildService>;
@@ -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/native-toolchain.ts
8
+ var NATIVE_TOOLCHAIN_BINARY_BUILD_CAPABILITY_ID = "native-toolchain.binary-build";
9
+ var NATIVE_TOOLCHAIN_BINARY_BUILD = makeCapabilityId(NATIVE_TOOLCHAIN_BINARY_BUILD_CAPABILITY_ID);
10
+ export {
11
+ NATIVE_TOOLCHAIN_BINARY_BUILD_CAPABILITY_ID,
12
+ NATIVE_TOOLCHAIN_BINARY_BUILD
13
+ };
@@ -5,14 +5,14 @@ export type HookToolInput = typeof HookToolInput.Type;
5
5
  /**
6
6
  * Parsed hook invocation handed to a typed hook implementation.
7
7
  *
8
- * Derived from the Claude Code hook stdin payload (see @rig/hook-kit's
9
- * `readHookInput`) plus the runner's resolved environment:
8
+ * Derived from the Claude Code hook stdin payload (see
9
+ * @rig/core/hook-protocol's `readHookInput`) plus the runner's resolved
10
+ * environment:
10
11
  * - `event` — the lifecycle event the hook fired on
11
12
  * - `toolName` — `tool_name` from the payload (absent for non-tool events)
12
13
  * - `toolInput` — `tool_input` from the payload (`{}` when absent)
13
14
  * - `filePaths` — file path candidates extracted from the tool input
14
- * (@rig/hook-kit's `extractToolFilePaths`)
15
- * - `projectRoot` — resolved project root (@rig/hook-kit's `resolveProjectRoot`)
15
+ * - `projectRoot` — resolved project root
16
16
  * - `taskId` — current Rig task id, `""` when not running inside a task
17
17
  */
18
18
  export declare const HookContext: Schema.Struct<{
@@ -29,8 +29,8 @@ export type HookDecision = typeof HookDecision.Type;
29
29
  /**
30
30
  * Result returned by a typed hook implementation.
31
31
  *
32
- * Serialized to the same stdout/exit-code protocol that @rig/hook-kit's
33
- * `block()` uses (the contract Claude Code's hook runner expects):
32
+ * Serialized to the same stdout/exit-code protocol that
33
+ * @rig/core/hook-protocol's `block()` uses:
34
34
  * - `decision: "block"` → `BLOCKED: <reason>` on stdout, non-zero exit
35
35
  * - `decision: "allow"` → exit 0; `systemMessage` (when set) on stdout
36
36
  */
@@ -14,6 +14,8 @@ import type { CapabilityId } from "./capability-id";
14
14
  import type { RigStatsData } from "./cli-output";
15
15
  import type { RunDiscoveryFilter } from "./run-discovery";
16
16
  import type { RunJournalProjection } from "./run-journal";
17
+ import type { RunRegistryRunProjection } from "./run-registry-backbone";
18
+ import type { RigRunTimelineEntry } from "./run-timeline";
17
19
  import type { RunRecord, UnifiedInboxRequest } from "./run-record";
18
20
  import type { RunInboxResolutionInit, RunSessionCustomEntry } from "./run-session-journal";
19
21
  import type { TaskRecord } from "./task-source";
@@ -43,6 +45,24 @@ export interface RunReadModelProjectionInput {
43
45
  readonly sessionPath?: string | null;
44
46
  readonly discoveryFilter?: RunDiscoveryFilter;
45
47
  }
48
+ export interface RunReadModelRegistryProjectionInput {
49
+ /** Canonical run id/session id. */
50
+ readonly runId: string;
51
+ readonly folded: RunJournalProjection;
52
+ /** Raw run-session custom entries; providers own timeline extraction from them. */
53
+ readonly entries: readonly RunSessionCustomEntry[];
54
+ readonly title: string;
55
+ readonly joinLink?: string | null;
56
+ readonly webLink?: string | null;
57
+ readonly relayUrl?: string | null;
58
+ readonly sessionPath?: string | null;
59
+ readonly cwd?: string | null;
60
+ readonly collabCwd?: string | null;
61
+ readonly dispatchHandle?: string | null;
62
+ readonly timelineLimit?: number;
63
+ /** Optional caller-supplied timeline for compatibility; providers should prefer entries. */
64
+ readonly timeline?: readonly RigRunTimelineEntry[];
65
+ }
46
66
  export interface RunReadModelDetailsInput extends RunReadModelGetInput {
47
67
  readonly includeLogs?: boolean;
48
68
  readonly includeSourceTask?: boolean;
@@ -213,6 +233,7 @@ export interface RunReadModelService {
213
233
  readonly listRuns: (input: RunReadModelListInput) => Promise<readonly RunRecord[]>;
214
234
  readonly getRun: (input: RunReadModelGetInput) => Promise<RunRecord | null>;
215
235
  readonly getRunProjection: (input: RunReadModelProjectionInput) => Promise<RunJournalProjection | null>;
236
+ readonly buildRegistryProjection: (input: RunReadModelRegistryProjectionInput) => RunRegistryRunProjection;
216
237
  readonly getRunDetails: (input: RunReadModelDetailsInput) => Promise<RunReadModelDetails | null>;
217
238
  readonly inspectRun: (input: RunReadModelDetailsInput) => Promise<RunReadModelInspectResult | null>;
218
239
  readonly listInboxRecords: (input: RunReadModelInboxInput) => Promise<readonly RunReadModelInboxRecord[]>;
@@ -8,6 +8,7 @@
8
8
  * function-laden deps (those are the impl's concern, not the cross-plugin seam).
9
9
  */
10
10
  import type { CapabilityId } from "./capability-id";
11
+ import type { GitHubAuthStatus } from "./github";
11
12
  /** Capability id the init/setup plugin registers its setup runner under. */
12
13
  export declare const PROJECT_SETUP_CAPABILITY_ID = "cap:project-setup";
13
14
  /**
@@ -17,7 +18,7 @@ export declare const PROJECT_SETUP_CAPABILITY_ID = "cap:project-setup";
17
18
  */
18
19
  export type ProjectSetupPlacement = {
19
20
  readonly alias: string;
20
- readonly kind: string;
21
+ readonly kind: "local" | "remote";
21
22
  readonly host?: string;
22
23
  readonly port?: number;
23
24
  readonly token?: string | null;
@@ -33,14 +34,54 @@ export type ProjectSetupInput = {
33
34
  readonly githubToken?: string | null;
34
35
  readonly importGhToken?: boolean;
35
36
  };
36
- /** Pure summary of a project-setup pass. */
37
+ export type ProjectRepoSlug = {
38
+ readonly owner: string;
39
+ readonly repo: string;
40
+ readonly slug: string;
41
+ };
42
+ export type RigConfigStatus = {
43
+ readonly exists: boolean;
44
+ readonly valid: boolean;
45
+ readonly path: string;
46
+ readonly slug: string | null;
47
+ readonly reason?: string;
48
+ };
49
+ export type RigStateStatus = {
50
+ readonly valid: boolean;
51
+ readonly selected: string | null;
52
+ readonly project: string | null;
53
+ readonly reason?: string;
54
+ };
55
+ export type RigAuthValidation = {
56
+ readonly ok: boolean;
57
+ readonly source: "stored-token" | "gh" | "missing";
58
+ readonly login?: string | null;
59
+ readonly detail: string;
60
+ readonly status?: GitHubAuthStatus;
61
+ };
62
+ export type RigSetupStatus = {
63
+ readonly configured: boolean;
64
+ readonly projectRoot: string;
65
+ readonly slug: string | null;
66
+ readonly config: RigConfigStatus;
67
+ readonly state: RigStateStatus;
68
+ readonly auth: RigAuthValidation;
69
+ readonly reasons: readonly string[];
70
+ };
37
71
  export type ProjectSetupResult = {
38
72
  readonly repoSlug: string;
39
73
  readonly placement: string;
40
74
  readonly configWritten: boolean;
75
+ readonly labels: unknown;
76
+ readonly pi: unknown;
77
+ readonly status: RigSetupStatus;
41
78
  };
42
- /** The cohesive project-setup operation the CLI surface depends on. Async (does IO). */
79
+ /** The cohesive project-setup operation the CLI surface depends on. Async methods do IO. */
43
80
  export interface ProjectSetupService {
81
+ parseRepoSlug(value: string): ProjectRepoSlug;
82
+ detectStartupStatus(input: {
83
+ readonly projectRoot: string;
84
+ }): Promise<RigSetupStatus>;
44
85
  runSetup(input: ProjectSetupInput): Promise<ProjectSetupResult>;
45
86
  }
46
87
  /** Typed capability id; string value is {@link PROJECT_SETUP_CAPABILITY_ID}. */