@h-rig/contracts 0.0.6-alpha.175 → 0.0.6-alpha.177

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 (67) hide show
  1. package/dist/index.cjs +132 -63
  2. package/dist/index.mjs +132 -63
  3. package/dist/src/blocker-classifier.d.ts +21 -0
  4. package/dist/src/blocker-classifier.js +13 -0
  5. package/dist/src/cockpit.d.ts +30 -0
  6. package/dist/src/config.d.ts +7 -5
  7. package/dist/src/config.js +3 -1
  8. package/dist/src/control-plane-types.d.ts +2 -2
  9. package/dist/src/github.d.ts +10 -0
  10. package/dist/src/guard.d.ts +7 -0
  11. package/dist/src/guard.js +10 -1
  12. package/dist/src/harness-profile-state.d.ts +10 -0
  13. package/dist/src/harness-profile-state.js +13 -0
  14. package/dist/src/index.d.ts +14 -0
  15. package/dist/src/index.js +132 -63
  16. package/dist/src/layout.d.ts +0 -5
  17. package/dist/src/layout.js +1 -3
  18. package/dist/src/lifecycle-capabilities.d.ts +40 -2
  19. package/dist/src/lifecycle-capabilities.js +12 -0
  20. package/dist/src/managed-repos.d.ts +103 -3
  21. package/dist/src/managed-repos.js +4 -0
  22. package/dist/src/model.d.ts +11 -75
  23. package/dist/src/model.js +3 -58
  24. package/dist/src/placement.d.ts +47 -0
  25. package/dist/src/placement.js +13 -0
  26. package/dist/src/product-entrypoint.d.ts +22 -0
  27. package/dist/src/product-entrypoint.js +13 -0
  28. package/dist/src/provider.d.ts +14 -14
  29. package/dist/src/provider.js +12 -11
  30. package/dist/src/remote-control.d.ts +93 -0
  31. package/dist/src/remote-control.js +26 -0
  32. package/dist/src/run-control.d.ts +164 -0
  33. package/dist/src/run-control.js +13 -0
  34. package/dist/src/run-discovery.d.ts +5 -1
  35. package/dist/src/run-queue.d.ts +36 -0
  36. package/dist/src/run-queue.js +13 -0
  37. package/dist/src/run-read-model.d.ts +33 -88
  38. package/dist/src/run-session-journal.d.ts +86 -1
  39. package/dist/src/run-session-journal.js +9 -0
  40. package/dist/src/runtime-secrets.d.ts +10 -0
  41. package/dist/src/runtime-secrets.js +13 -0
  42. package/dist/src/session-hook-materializer.d.ts +41 -0
  43. package/dist/src/session-hook-materializer.js +13 -0
  44. package/dist/src/setup.d.ts +67 -1
  45. package/dist/src/supervisor-journal.d.ts +9 -9
  46. package/dist/src/supervisor-journal.js +2 -0
  47. package/dist/src/supervisor-loop.d.ts +40 -0
  48. package/dist/src/supervisor-loop.js +13 -0
  49. package/dist/src/task-artifacts.d.ts +20 -0
  50. package/dist/src/task-config.d.ts +22 -0
  51. package/dist/src/task-config.js +1 -0
  52. package/dist/src/task-data.d.ts +6 -8
  53. package/dist/src/task-source.d.ts +58 -27
  54. package/dist/src/task-source.js +9 -1
  55. package/dist/src/task-state-paths.d.ts +14 -0
  56. package/dist/src/task-state-paths.js +13 -0
  57. package/dist/src/task-state-store.d.ts +21 -1
  58. package/dist/src/task-state-store.js +4 -0
  59. package/dist/src/task-tracker-state.d.ts +5 -10
  60. package/dist/src/toolchain-sources.d.ts +1 -1
  61. package/dist/src/transport-config.d.ts +161 -0
  62. package/dist/src/transport-config.js +15 -0
  63. package/dist/src/workflow-journal.d.ts +33 -0
  64. package/dist/src/workflow-journal.js +9 -0
  65. package/dist/src/workspace-service.d.ts +16 -0
  66. package/dist/src/workspace-service.js +13 -0
  67. package/package.json +5 -1
@@ -12,7 +12,9 @@ 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
+ import type { RunJournal, RunJournalSessionManager } from "./run-session-journal";
16
+ import type { TaskSourceUpdateResult, TaskTerminalStateInput } from "./task-source";
17
+ import type { TaskReopenSummary } from "./task-data";
16
18
  /** Capability id the bundle registers its `taskVerify` orchestration under. */
17
19
  export declare const TASK_VERIFY_CAPABILITY_ID = "default-lifecycle.task-verify";
18
20
  /** Capability id the bundle registers its task validation runner under. */
@@ -21,8 +23,14 @@ export declare const TASK_VALIDATION_CAPABILITY_ID = "default-lifecycle.task-val
21
23
  export declare const COMPLETION_VERIFICATION_CAPABILITY_ID = "default-lifecycle.completion-verification";
22
24
  /** Capability id the bundle registers its run-worker closeout driver under. */
23
25
  export declare const RUN_CLOSEOUT_CAPABILITY_ID = "default-lifecycle.run-closeout";
26
+ /** Capability id @rig/run-worker registers for writable run-session journal binding. */
27
+ export declare const RUN_SESSION_JOURNAL_WRITER_CAPABILITY_ID = "run-worker.run-session-journal-writer";
24
28
  /** Capability id the bundle registers its lifecycle-owned task-source reflection under. */
25
29
  export declare const TASK_SOURCE_REFLECTION_CAPABILITY_ID = "default-lifecycle.task-source-reflection";
30
+ /** Capability id the bundle registers its lifecycle-owned task terminal-state policy under. */
31
+ export declare const TASK_TERMINAL_STATE_CAPABILITY_ID = "default-lifecycle.task-terminal-state";
32
+ /** Capability id the bundle registers its lifecycle-owned task reopen policy under. */
33
+ export declare const TASK_REOPEN_CAPABILITY_ID = "default-lifecycle.task-reopen";
26
34
  /** Capability id the bundle registers its agent-facing git helper surface under. */
27
35
  export declare const LIFECYCLE_GIT_AGENT_CAPABILITY_ID = "default-lifecycle.git-agent";
28
36
  export interface TaskVerifyCapabilityInput {
@@ -114,6 +122,9 @@ export type RunTaskSourceLifecycleRun = {
114
122
  export type RunTaskSourceLifecycleOptions = {
115
123
  errorText?: string | null;
116
124
  };
125
+ export type RunTaskSourceStoppedOptions = RunTaskSourceLifecycleOptions & {
126
+ reason?: string | null;
127
+ };
117
128
  export type TaskSourceReflectionInput = {
118
129
  readonly projectRoot: string;
119
130
  readonly taskId: string;
@@ -138,14 +149,41 @@ export type TaskSourceMergedPrReflectionInput = {
138
149
  readonly sourceTask?: unknown;
139
150
  };
140
151
  export type TaskSourceReflectionResult = TaskSourceUpdateResult & {
141
- readonly status?: unknown;
152
+ /** Lifecycle-owned status projected into the source update request. */
153
+ readonly projectedStatus?: RunTaskSourceLifecycleStatus | null;
142
154
  };
143
155
  export interface TaskSourceReflectionService {
144
156
  reflectTaskSourceStatus(input: TaskSourceReflectionInput): Promise<TaskSourceReflectionResult | null>;
157
+ reflectRunStarted(projectRoot: string, run: RunTaskSourceLifecycleRun, options?: RunTaskSourceLifecycleOptions): Promise<TaskSourceReflectionResult | null>;
158
+ reflectRunStopped(projectRoot: string, run: RunTaskSourceLifecycleRun, options?: RunTaskSourceStoppedOptions): Promise<TaskSourceReflectionResult | null>;
145
159
  updateRunTaskSourceLifecycle(projectRoot: string, run: RunTaskSourceLifecycleRun, status: RunTaskSourceLifecycleStatus, summary: string, options?: RunTaskSourceLifecycleOptions): Promise<TaskSourceReflectionResult | null>;
146
160
  closeMergedPr(input: TaskSourceMergedPrReflectionInput): Promise<TaskSourceReflectionResult | null>;
147
161
  }
148
162
  export declare const TASK_SOURCE_REFLECTION: CapabilityId<TaskSourceReflectionService>;
163
+ export interface TaskTerminalStateService {
164
+ isTaskTerminal(input: TaskTerminalStateInput): Promise<boolean>;
165
+ }
166
+ export declare const TASK_TERMINAL_STATE: CapabilityId<TaskTerminalStateService>;
167
+ export type TaskReopenInput = {
168
+ readonly projectRoot: string;
169
+ readonly all: boolean;
170
+ readonly taskId?: string;
171
+ readonly dryRun?: boolean;
172
+ };
173
+ /** Lifecycle-owned reopen policy for legacy `task reopen`; source plugin only performs config IO. */
174
+ export interface TaskReopenService {
175
+ reopenTasks(input: TaskReopenInput): TaskReopenSummary;
176
+ }
177
+ export declare const TASK_REOPEN: CapabilityId<TaskReopenService>;
178
+ export interface RunSessionJournalWriterService {
179
+ createRunJournal(sessionManager: RunJournalSessionManager, runId: string): Promise<RunJournal | null>;
180
+ }
181
+ /**
182
+ * Writable run-session journal factory. Kept separate from RUN_SESSION_JOURNAL so
183
+ * the read-model plugin remains projection/read-only and append ownership lives
184
+ * with the run-worker lifecycle package.
185
+ */
186
+ export declare const RUN_SESSION_JOURNAL_WRITER: CapabilityId<RunSessionJournalWriterService>;
149
187
  export type RunCloseoutResultStatus = "merged" | "opened" | "skipped" | "needs-attention";
150
188
  export type RunCloseoutResult = {
151
189
  status: RunCloseoutResultStatus;
@@ -9,21 +9,33 @@ var TASK_VERIFY_CAPABILITY_ID = "default-lifecycle.task-verify";
9
9
  var TASK_VALIDATION_CAPABILITY_ID = "default-lifecycle.task-validation";
10
10
  var COMPLETION_VERIFICATION_CAPABILITY_ID = "default-lifecycle.completion-verification";
11
11
  var RUN_CLOSEOUT_CAPABILITY_ID = "default-lifecycle.run-closeout";
12
+ var RUN_SESSION_JOURNAL_WRITER_CAPABILITY_ID = "run-worker.run-session-journal-writer";
12
13
  var TASK_SOURCE_REFLECTION_CAPABILITY_ID = "default-lifecycle.task-source-reflection";
14
+ var TASK_TERMINAL_STATE_CAPABILITY_ID = "default-lifecycle.task-terminal-state";
15
+ var TASK_REOPEN_CAPABILITY_ID = "default-lifecycle.task-reopen";
13
16
  var LIFECYCLE_GIT_AGENT_CAPABILITY_ID = "default-lifecycle.git-agent";
14
17
  var TASK_VERIFY_CAPABILITY = makeCapabilityId(TASK_VERIFY_CAPABILITY_ID);
15
18
  var TASK_VALIDATION_CAPABILITY = makeCapabilityId(TASK_VALIDATION_CAPABILITY_ID);
16
19
  var COMPLETION_VERIFICATION_CAPABILITY = makeCapabilityId(COMPLETION_VERIFICATION_CAPABILITY_ID);
17
20
  var LIFECYCLE_GIT_AGENT = makeCapabilityId(LIFECYCLE_GIT_AGENT_CAPABILITY_ID);
18
21
  var TASK_SOURCE_REFLECTION = makeCapabilityId(TASK_SOURCE_REFLECTION_CAPABILITY_ID);
22
+ var TASK_TERMINAL_STATE = makeCapabilityId(TASK_TERMINAL_STATE_CAPABILITY_ID);
23
+ var TASK_REOPEN = makeCapabilityId(TASK_REOPEN_CAPABILITY_ID);
24
+ var RUN_SESSION_JOURNAL_WRITER = makeCapabilityId(RUN_SESSION_JOURNAL_WRITER_CAPABILITY_ID);
19
25
  var RUN_CLOSEOUT_CAPABILITY = makeCapabilityId(RUN_CLOSEOUT_CAPABILITY_ID);
20
26
  export {
21
27
  TASK_VERIFY_CAPABILITY_ID,
22
28
  TASK_VERIFY_CAPABILITY,
23
29
  TASK_VALIDATION_CAPABILITY_ID,
24
30
  TASK_VALIDATION_CAPABILITY,
31
+ TASK_TERMINAL_STATE_CAPABILITY_ID,
32
+ TASK_TERMINAL_STATE,
25
33
  TASK_SOURCE_REFLECTION_CAPABILITY_ID,
26
34
  TASK_SOURCE_REFLECTION,
35
+ TASK_REOPEN_CAPABILITY_ID,
36
+ TASK_REOPEN,
37
+ RUN_SESSION_JOURNAL_WRITER_CAPABILITY_ID,
38
+ RUN_SESSION_JOURNAL_WRITER,
27
39
  RUN_CLOSEOUT_CAPABILITY_ID,
28
40
  RUN_CLOSEOUT_CAPABILITY,
29
41
  LIFECYCLE_GIT_AGENT_CAPABILITY_ID,
@@ -7,9 +7,11 @@
7
7
  * - `RepoOperationsService` under {@link REPO_OPERATIONS_CAPABILITY_ID} for
8
8
  * task repo pinning, baseline reset, and project-main pre-run sync,
9
9
  * - `RepoNativeGitService` under {@link REPO_NATIVE_GIT_CAPABILITY_ID} for
10
- * repo-native git command wrappers, and
10
+ * repo-native git command wrappers,
11
11
  * - `RepoGitBinaryService` under {@link REPO_GIT_BINARY_CAPABILITY_ID} for
12
- * the repo-owned rig-git helper binary.
12
+ * the repo-owned rig-git helper binary, and
13
+ * - `RepoTrackerPersistenceService` under {@link REPO_TRACKER_PERSISTENCE_CAPABILITY_ID}
14
+ * for mechanical tracker snapshot reads and owner-supplied mutation persistence.
13
15
  *
14
16
  * This module carries no behaviour and imports only pure sibling types, so
15
17
  * consumers resolve typed ids through `@rig/core` without importing the provider
@@ -19,6 +21,8 @@ import type { CapabilityId } from "./capability-id";
19
21
  import type { RepoSourceRegistration } from "./plugin";
20
22
  import type { GitWorkingTreeFileChange } from "./git";
21
23
  import type { NativeToolchainBinaryArtifact, NativeToolchainTarget } from "./native-toolchain";
24
+ import type { SyncedTrackerSnapshot, ReadSyncedTrackerOptions } from "./task-data";
25
+ import type { CanonicalTaskLifecycleStatus, TaskStateMetadata } from "./task-state-metadata";
22
26
  export type ManagedRepoId = string;
23
27
  export type ManagedRepoAlias = string;
24
28
  export type ManagedRepoHealth = "missing" | "ready" | "stale" | "misconfigured";
@@ -101,18 +105,90 @@ export type RepoNativeGitTreeCommitUpdate = {
101
105
  readonly path: string;
102
106
  readonly content: string;
103
107
  readonly executable?: boolean;
108
+ } | {
109
+ readonly path: string;
110
+ readonly sourceFilePath: string;
111
+ readonly executable?: boolean;
104
112
  } | {
105
113
  readonly path: string;
106
114
  readonly delete: true;
107
115
  };
116
+ export type RepoNativeGitPendingFile = {
117
+ readonly path: string;
118
+ readonly status: string;
119
+ };
120
+ export type RepoNativeGitCommandResult = {
121
+ readonly exitCode: number;
122
+ readonly stdout: string;
123
+ readonly stderr: string;
124
+ };
125
+ export type RepoNativeGitRunOptions = {
126
+ /** Project root used to derive runtime git environment/secrets when different from repoPath. */
127
+ readonly projectRoot?: string;
128
+ readonly input?: string;
129
+ readonly env?: Readonly<Record<string, string | undefined>>;
130
+ };
131
+ export type RepoNativeGitCommitOptions = {
132
+ readonly message: string;
133
+ readonly allowEmpty?: boolean;
134
+ /** Explicit repo-relative paths to stage. Provider may use pathspec files to avoid argv limits. */
135
+ readonly paths?: readonly string[];
136
+ /** Stage all repo changes except excludes when no explicit paths are provided. */
137
+ readonly stageAll?: boolean;
138
+ readonly excludePathspecs?: readonly string[];
139
+ readonly projectRoot?: string;
140
+ };
141
+ export type RepoNativeGitCommitResult = {
142
+ readonly committed: boolean;
143
+ readonly status: string;
144
+ readonly stagedChangeCount: number;
145
+ readonly stagedPathCount: number;
146
+ };
147
+ export type RepoNativeGitCheckoutOptions = {
148
+ readonly createIfMissing?: boolean;
149
+ readonly resetIfDetachedExisting?: boolean;
150
+ readonly projectRoot?: string;
151
+ };
152
+ export type RepoNativeGitPushBranchOptions = {
153
+ readonly remote?: string;
154
+ readonly setUpstream?: boolean;
155
+ readonly forceWithLease?: boolean;
156
+ readonly projectRoot?: string;
157
+ };
158
+ export type RepoNativeGitRemoteDispatchCheckoutInput = {
159
+ /**
160
+ * Shell expression for the checkout path, e.g. "$CHECKOUT" or "$HOME/.rig/checkouts/repo".
161
+ * The caller owns quoting this path expression before passing it across the seam.
162
+ */
163
+ readonly checkoutExpression: string;
164
+ /** Shell expression that points at the materialized github-auth.json temp file. */
165
+ readonly authStateFileExpression: string;
166
+ /** Shell expression that points at a temp executable credential-helper file. */
167
+ readonly credentialHelperFileExpression: string;
168
+ readonly originUrl?: string | null;
169
+ readonly operatorHead: string;
170
+ };
108
171
  /**
109
172
  * Repo-owned native git command seam. Implementations live in `@rig/repos-plugin`;
110
173
  * native-toolchain only builds/materializes binaries and does not own repo or git
111
- * workflow semantics.
174
+ * workflow semantics. Lifecycle and other consumers keep policy decisions but
175
+ * delegate checkout/stage/commit/fetch/push mechanics through this capability.
112
176
  */
113
177
  export interface RepoNativeGitService {
178
+ run(repoPath: string, args: readonly string[], options?: RepoNativeGitRunOptions): RepoNativeGitCommandResult;
179
+ branchName(repoPath: string, projectRoot?: string): string | null;
180
+ headOid(repoPath: string, projectRoot?: string): string | null;
181
+ githubOriginSlug(repoPath: string, projectRoot?: string): string | null;
182
+ changeCount(repoPath: string, projectRoot?: string): number | null;
183
+ pendingFiles(repoPath: string, projectRoot?: string): readonly RepoNativeGitPendingFile[] | null;
184
+ fileHasChanges(repoPath: string, filePath: string, projectRoot?: string): boolean | null;
185
+ checkoutBranch(repoPath: string, branch: string, options?: RepoNativeGitCheckoutOptions): RepoNativeGitCommandResult;
186
+ commit(repoPath: string, options: RepoNativeGitCommitOptions): RepoNativeGitCommitResult;
187
+ pushBranch(repoPath: string, branch: string, options?: RepoNativeGitPushBranchOptions): RepoNativeGitCommandResult;
188
+ remoteDispatchCheckoutShell(input: RepoNativeGitRemoteDispatchCheckoutInput): readonly string[];
114
189
  fetchRef(repoPath: string, remote: string, branch: string): string;
115
190
  readBlobAtRef(repoPath: string, ref: string, path: string): string;
191
+ readBlobBytesAtRef(repoPath: string, ref: string, path: string): Uint8Array;
116
192
  writeTreeCommit(repoPath: string, baseRef: string, updates: readonly RepoNativeGitTreeCommitUpdate[], message: string): string;
117
193
  pushRefWithLease(repoPath: string, localOid: string, remoteRef: string, expectedOldOid: string, remote?: string): string;
118
194
  }
@@ -220,11 +296,35 @@ export interface RepoOperationsService {
220
296
  repoVerify(projectRoot: string, taskId?: string): boolean;
221
297
  repoDiscover(projectRoot: string, taskId?: string): RepoPins;
222
298
  repoBaseline(projectRoot: string, refresh?: boolean): RepoPins;
299
+ recordTaskRepoCommits(projectRoot: string, taskId: string): void;
223
300
  resetBaseline(projectRoot: string, keepTaskStatus: boolean): void;
224
301
  ensureProjectMainFreshBeforeRun(options: ProjectMainPreRunSyncOptions): Promise<ProjectMainPreRunSyncResult>;
225
302
  }
226
303
  export declare const REPO_OPERATIONS_CAPABILITY_ID = "repos.operations";
227
304
  export declare const REPO_OPERATIONS_CAPABILITY: CapabilityId<RepoOperationsService>;
305
+ export type RepoTrackerPersistenceMutationResult = {
306
+ readonly outcome: "applied" | "noop";
307
+ readonly snapshot: SyncedTrackerSnapshot;
308
+ readonly commitOid: string | null;
309
+ };
310
+ export type RepoTrackerPersistenceMutation = {
311
+ readonly taskId: string;
312
+ readonly lifecycleStatus: CanonicalTaskLifecycleStatus;
313
+ readonly metadata?: TaskStateMetadata | null;
314
+ /** Mechanical owner-supplied compare-and-set precondition. */
315
+ readonly expectedLifecycleStatus?: CanonicalTaskLifecycleStatus | readonly CanonicalTaskLifecycleStatus[];
316
+ };
317
+ export type RepoTrackerPersistenceMutationsInput = {
318
+ readonly projectRoot: string;
319
+ readonly mutations: readonly RepoTrackerPersistenceMutation[];
320
+ readonly reason?: string;
321
+ };
322
+ export interface RepoTrackerPersistenceService {
323
+ readSnapshot(projectRoot: string, options?: ReadSyncedTrackerOptions): SyncedTrackerSnapshot;
324
+ persistMutations(input: RepoTrackerPersistenceMutationsInput): RepoTrackerPersistenceMutationResult;
325
+ }
326
+ export declare const REPO_TRACKER_PERSISTENCE_CAPABILITY_ID = "repos.tracker-persistence";
327
+ export declare const REPO_TRACKER_PERSISTENCE: CapabilityId<RepoTrackerPersistenceService>;
228
328
  /** The capability `run` shape the plugin registers: a (lazy) service factory. */
229
329
  export type ManagedRepoServiceCapabilityRun = () => ManagedRepoService | Promise<ManagedRepoService>;
230
330
  /** Capability id the managed-repo service plugin registers its factory under. */
@@ -15,9 +15,13 @@ var REPO_CHANGE_SET_CAPABILITY_ID = "repos.change-set";
15
15
  var REPO_CHANGE_SET = makeCapabilityId(REPO_CHANGE_SET_CAPABILITY_ID);
16
16
  var REPO_OPERATIONS_CAPABILITY_ID = "repos.operations";
17
17
  var REPO_OPERATIONS_CAPABILITY = makeCapabilityId(REPO_OPERATIONS_CAPABILITY_ID);
18
+ var REPO_TRACKER_PERSISTENCE_CAPABILITY_ID = "repos.tracker-persistence";
19
+ var REPO_TRACKER_PERSISTENCE = makeCapabilityId(REPO_TRACKER_PERSISTENCE_CAPABILITY_ID);
18
20
  var MANAGED_REPO_SERVICE_CAPABILITY_ID = "managed-repos.service";
19
21
  var MANAGED_REPO_SERVICE_CAPABILITY = makeCapabilityId(MANAGED_REPO_SERVICE_CAPABILITY_ID);
20
22
  export {
23
+ REPO_TRACKER_PERSISTENCE_CAPABILITY_ID,
24
+ REPO_TRACKER_PERSISTENCE,
21
25
  REPO_OPERATIONS_CAPABILITY_ID,
22
26
  REPO_OPERATIONS_CAPABILITY,
23
27
  REPO_NATIVE_GIT_CAPABILITY_ID,
@@ -1,77 +1,13 @@
1
1
  import { Schema } from "effect";
2
- import { ProviderKind } from "./orchestration";
3
- export declare const CODEX_REASONING_EFFORT_OPTIONS: readonly ["xhigh", "high", "medium", "low"];
4
- export type CodexReasoningEffort = (typeof CODEX_REASONING_EFFORT_OPTIONS)[number];
5
- export declare const CodexModelOptions: Schema.Struct<{
6
- readonly reasoningEffort: Schema.optional<Schema.Literals<readonly ["xhigh", "high", "medium", "low"]>>;
7
- readonly fastMode: Schema.optional<Schema.Boolean>;
8
- }>;
9
- export type CodexModelOptions = typeof CodexModelOptions.Type;
10
- export declare const ClaudeModelOptions: Schema.Struct<{}>;
11
- export type ClaudeModelOptions = typeof ClaudeModelOptions.Type;
12
- export declare const ProviderModelOptions: Schema.Struct<{
13
- readonly codex: Schema.optional<Schema.Struct<{
14
- readonly reasoningEffort: Schema.optional<Schema.Literals<readonly ["xhigh", "high", "medium", "low"]>>;
15
- readonly fastMode: Schema.optional<Schema.Boolean>;
16
- }>>;
17
- readonly claude: Schema.optional<Schema.Struct<{}>>;
18
- }>;
2
+ /**
3
+ * Provider model vocabulary shared by the transport contract.
4
+ *
5
+ * Concrete model catalogs, aliases, defaults, and reasoning-effort policy are
6
+ * runtime/provider ownership concerns and live in `@rig/provider-plugin/model`.
7
+ * The contract layer intentionally accepts opaque model slugs/options so new
8
+ * provider packages can evolve without changing the floor package.
9
+ */
10
+ export declare const ModelSlug: Schema.String;
11
+ export type ModelSlug = typeof ModelSlug.Type;
12
+ export declare const ProviderModelOptions: Schema.$Record<Schema.String, Schema.Unknown>;
19
13
  export type ProviderModelOptions = typeof ProviderModelOptions.Type;
20
- export declare const MODEL_OPTIONS_BY_PROVIDER: {
21
- readonly codex: readonly [{
22
- readonly slug: "gpt-5.4";
23
- readonly name: "GPT-5.4";
24
- }, {
25
- readonly slug: "gpt-5.3-codex";
26
- readonly name: "GPT-5.3 Codex";
27
- }, {
28
- readonly slug: "gpt-5.3-codex-spark";
29
- readonly name: "GPT-5.3 Codex Spark";
30
- }, {
31
- readonly slug: "gpt-5.2-codex";
32
- readonly name: "GPT-5.2 Codex";
33
- }, {
34
- readonly slug: "gpt-5.2";
35
- readonly name: "GPT-5.2";
36
- }];
37
- readonly claude: readonly [{
38
- readonly slug: "claude-sonnet-4-6";
39
- readonly name: "Claude Sonnet 4.6";
40
- }, {
41
- readonly slug: "claude-opus-4-1";
42
- readonly name: "Claude Opus 4.1";
43
- }, {
44
- readonly slug: "claude-3-7-sonnet-latest";
45
- readonly name: "Claude 3.7 Sonnet";
46
- }];
47
- };
48
- export type ModelOptionsByProvider = typeof MODEL_OPTIONS_BY_PROVIDER;
49
- type BuiltInModelSlug = ModelOptionsByProvider[ProviderKind][number]["slug"];
50
- export type ModelSlug = BuiltInModelSlug | (string & {});
51
- export declare const DEFAULT_MODEL_BY_PROVIDER: {
52
- readonly codex: "gpt-5.4";
53
- readonly claude: "claude-sonnet-4-6";
54
- };
55
- export declare const MODEL_SLUG_ALIASES_BY_PROVIDER: {
56
- readonly codex: {
57
- readonly "5.4": "gpt-5.4";
58
- readonly "5.3": "gpt-5.3-codex";
59
- readonly "gpt-5.3": "gpt-5.3-codex";
60
- readonly "5.3-spark": "gpt-5.3-codex-spark";
61
- readonly "gpt-5.3-spark": "gpt-5.3-codex-spark";
62
- };
63
- readonly claude: {
64
- readonly sonnet: "claude-sonnet-4-6";
65
- readonly opus: "claude-opus-4-1";
66
- readonly "3.7-sonnet": "claude-3-7-sonnet-latest";
67
- };
68
- };
69
- export declare const REASONING_EFFORT_OPTIONS_BY_PROVIDER: {
70
- readonly codex: readonly ["xhigh", "high", "medium", "low"];
71
- readonly claude: readonly [];
72
- };
73
- export declare const DEFAULT_REASONING_EFFORT_BY_PROVIDER: {
74
- readonly codex: "high";
75
- readonly claude: null;
76
- };
77
- export {};
package/dist/src/model.js CHANGED
@@ -1,64 +1,9 @@
1
1
  // @bun
2
2
  // packages/contracts/src/model.ts
3
3
  import { Schema } from "effect";
4
- var CODEX_REASONING_EFFORT_OPTIONS = ["xhigh", "high", "medium", "low"];
5
- var CodexModelOptions = Schema.Struct({
6
- reasoningEffort: Schema.optional(Schema.Literals(CODEX_REASONING_EFFORT_OPTIONS)),
7
- fastMode: Schema.optional(Schema.Boolean)
8
- });
9
- var ClaudeModelOptions = Schema.Struct({});
10
- var ProviderModelOptions = Schema.Struct({
11
- codex: Schema.optional(CodexModelOptions),
12
- claude: Schema.optional(ClaudeModelOptions)
13
- });
14
- var MODEL_OPTIONS_BY_PROVIDER = {
15
- codex: [
16
- { slug: "gpt-5.4", name: "GPT-5.4" },
17
- { slug: "gpt-5.3-codex", name: "GPT-5.3 Codex" },
18
- { slug: "gpt-5.3-codex-spark", name: "GPT-5.3 Codex Spark" },
19
- { slug: "gpt-5.2-codex", name: "GPT-5.2 Codex" },
20
- { slug: "gpt-5.2", name: "GPT-5.2" }
21
- ],
22
- claude: [
23
- { slug: "claude-sonnet-4-6", name: "Claude Sonnet 4.6" },
24
- { slug: "claude-opus-4-1", name: "Claude Opus 4.1" },
25
- { slug: "claude-3-7-sonnet-latest", name: "Claude 3.7 Sonnet" }
26
- ]
27
- };
28
- var DEFAULT_MODEL_BY_PROVIDER = {
29
- codex: "gpt-5.4",
30
- claude: "claude-sonnet-4-6"
31
- };
32
- var MODEL_SLUG_ALIASES_BY_PROVIDER = {
33
- codex: {
34
- "5.4": "gpt-5.4",
35
- "5.3": "gpt-5.3-codex",
36
- "gpt-5.3": "gpt-5.3-codex",
37
- "5.3-spark": "gpt-5.3-codex-spark",
38
- "gpt-5.3-spark": "gpt-5.3-codex-spark"
39
- },
40
- claude: {
41
- sonnet: "claude-sonnet-4-6",
42
- opus: "claude-opus-4-1",
43
- "3.7-sonnet": "claude-3-7-sonnet-latest"
44
- }
45
- };
46
- var REASONING_EFFORT_OPTIONS_BY_PROVIDER = {
47
- codex: CODEX_REASONING_EFFORT_OPTIONS,
48
- claude: []
49
- };
50
- var DEFAULT_REASONING_EFFORT_BY_PROVIDER = {
51
- codex: "high",
52
- claude: null
53
- };
4
+ var ModelSlug = Schema.String;
5
+ var ProviderModelOptions = Schema.Record(Schema.String, Schema.Unknown);
54
6
  export {
55
- REASONING_EFFORT_OPTIONS_BY_PROVIDER,
56
7
  ProviderModelOptions,
57
- MODEL_SLUG_ALIASES_BY_PROVIDER,
58
- MODEL_OPTIONS_BY_PROVIDER,
59
- DEFAULT_REASONING_EFFORT_BY_PROVIDER,
60
- DEFAULT_MODEL_BY_PROVIDER,
61
- CodexModelOptions,
62
- ClaudeModelOptions,
63
- CODEX_REASONING_EFFORT_OPTIONS
8
+ ModelSlug
64
9
  };
@@ -0,0 +1,47 @@
1
+ import type { CapabilityId } from "./capability-id";
2
+ export type PlacementKind = "local" | "remote";
3
+ export type Placement = {
4
+ readonly alias: string;
5
+ readonly kind: PlacementKind;
6
+ readonly host?: string | null;
7
+ readonly port?: number | null;
8
+ readonly baseUrl?: string | null;
9
+ readonly projectRoot?: string | null;
10
+ readonly status?: string | null;
11
+ readonly taskSource?: string | null;
12
+ };
13
+ export type AddPlacementInput = {
14
+ readonly alias: string;
15
+ readonly host: string;
16
+ readonly port?: number;
17
+ readonly token?: string | null;
18
+ readonly select?: boolean;
19
+ };
20
+ export interface PlacementService {
21
+ readonly readPlacement: (input: {
22
+ readonly projectRoot: string;
23
+ }) => Promise<Placement>;
24
+ readonly listPlacements: (input: {
25
+ readonly projectRoot: string;
26
+ }) => Promise<readonly Placement[]>;
27
+ readonly selectPlacement: (input: {
28
+ readonly projectRoot: string;
29
+ readonly alias: string;
30
+ readonly dryRun?: boolean;
31
+ }) => Promise<Placement>;
32
+ readonly addPlacement: (input: {
33
+ readonly projectRoot: string;
34
+ readonly placement: AddPlacementInput;
35
+ readonly dryRun?: boolean;
36
+ }) => Promise<Placement>;
37
+ readonly removePlacement: (input: {
38
+ readonly projectRoot: string;
39
+ readonly alias: string;
40
+ readonly dryRun?: boolean;
41
+ }) => Promise<{
42
+ readonly alias: string;
43
+ readonly removed: boolean;
44
+ }>;
45
+ }
46
+ export declare const PLACEMENT_SERVICE_CAPABILITY_ID = "rig.transport.placement";
47
+ export declare const PLACEMENT_SERVICE: CapabilityId<PlacementService>;
@@ -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/placement.ts
8
+ var PLACEMENT_SERVICE_CAPABILITY_ID = "rig.transport.placement";
9
+ var PLACEMENT_SERVICE = makeCapabilityId(PLACEMENT_SERVICE_CAPABILITY_ID);
10
+ export {
11
+ PLACEMENT_SERVICE_CAPABILITY_ID,
12
+ PLACEMENT_SERVICE
13
+ };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * product-entrypoint.ts — pure capability vocabulary for product-owned session entrypoints.
3
+ *
4
+ * The implementation lives in @rig/product-entrypoint-plugin. CLI consumers resolve
5
+ * this capability from the project plugin host instead of importing product runtime
6
+ * entrypoint code directly.
7
+ */
8
+ import type { CapabilityId } from "./capability-id";
9
+ export interface ProductEntrypointJoinSessionInput {
10
+ readonly projectRoot: string;
11
+ readonly link: string;
12
+ }
13
+ export interface ProductEntrypointJoinSessionResult {
14
+ readonly ok: true;
15
+ readonly group: "product";
16
+ readonly command: "join";
17
+ }
18
+ export interface ProductEntrypointService {
19
+ readonly joinSession: (input: ProductEntrypointJoinSessionInput) => Promise<ProductEntrypointJoinSessionResult>;
20
+ }
21
+ export declare const PRODUCT_ENTRYPOINT_CAPABILITY_ID = "rig.product.entrypoint";
22
+ export declare const PRODUCT_ENTRYPOINT: CapabilityId<ProductEntrypointService>;
@@ -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/product-entrypoint.ts
8
+ var PRODUCT_ENTRYPOINT_CAPABILITY_ID = "rig.product.entrypoint";
9
+ var PRODUCT_ENTRYPOINT = makeCapabilityId(PRODUCT_ENTRYPOINT_CAPABILITY_ID);
10
+ export {
11
+ PRODUCT_ENTRYPOINT_CAPABILITY_ID,
12
+ PRODUCT_ENTRYPOINT
13
+ };
@@ -1,4 +1,5 @@
1
1
  import { Schema } from "effect";
2
+ import type { CapabilityId } from "./capability-id";
2
3
  export declare const ProviderSession: Schema.Struct<{
3
4
  readonly provider: Schema.Literals<readonly ["codex", "claude"]>;
4
5
  readonly status: Schema.Literals<readonly ["connecting", "ready", "running", "error", "closed"]>;
@@ -18,13 +19,7 @@ export declare const ProviderSessionStartInput: Schema.Struct<{
18
19
  readonly provider: Schema.optional<Schema.Literals<readonly ["codex", "claude"]>>;
19
20
  readonly cwd: Schema.optional<Schema.Trim>;
20
21
  readonly model: Schema.optional<Schema.Trim>;
21
- readonly modelOptions: Schema.optional<Schema.Struct<{
22
- readonly codex: Schema.optional<Schema.Struct<{
23
- readonly reasoningEffort: Schema.optional<Schema.Literals<readonly ["xhigh", "high", "medium", "low"]>>;
24
- readonly fastMode: Schema.optional<Schema.Boolean>;
25
- }>>;
26
- readonly claude: Schema.optional<Schema.Struct<{}>>;
27
- }>>;
22
+ readonly modelOptions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
28
23
  readonly resumeCursor: Schema.optional<Schema.Unknown>;
29
24
  readonly serviceTier: Schema.optional<Schema.NullOr<Schema.Literals<readonly ["fast", "flex"]>>>;
30
25
  readonly approvalPolicy: Schema.optional<Schema.Literals<readonly ["untrusted", "on-failure", "on-request", "never"]>>;
@@ -50,13 +45,7 @@ export declare const ProviderSendTurnInput: Schema.Struct<{
50
45
  }>]>>>;
51
46
  readonly model: Schema.optional<Schema.Trim>;
52
47
  readonly serviceTier: Schema.optional<Schema.NullOr<Schema.Literals<readonly ["fast", "flex"]>>>;
53
- readonly modelOptions: Schema.optional<Schema.Struct<{
54
- readonly codex: Schema.optional<Schema.Struct<{
55
- readonly reasoningEffort: Schema.optional<Schema.Literals<readonly ["xhigh", "high", "medium", "low"]>>;
56
- readonly fastMode: Schema.optional<Schema.Boolean>;
57
- }>>;
58
- readonly claude: Schema.optional<Schema.Struct<{}>>;
59
- }>>;
48
+ readonly modelOptions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
60
49
  readonly interactionMode: Schema.optional<Schema.Literals<readonly ["default", "plan"]>>;
61
50
  }>;
62
51
  export type ProviderSendTurnInput = typeof ProviderSendTurnInput.Type;
@@ -103,3 +92,14 @@ export declare const ProviderEvent: Schema.Struct<{
103
92
  readonly payload: Schema.optional<Schema.Unknown>;
104
93
  }>;
105
94
  export type ProviderEvent = typeof ProviderEvent.Type;
95
+ export interface AgentHarnessRunWrapperInput {
96
+ readonly argv: readonly string[];
97
+ }
98
+ export interface AgentHarnessService {
99
+ /** Provider-owned source entrypoint used when a project-local rig-agent binary must be materialized from source. */
100
+ readonly resolveAgentWrapperEntrypoint: () => string;
101
+ readonly runAgentWrapper: (input: AgentHarnessRunWrapperInput) => Promise<number>;
102
+ readonly runRigAgentEntrypoint: () => Promise<void>;
103
+ }
104
+ export declare const AGENT_HARNESS_CAPABILITY_ID = "rig.provider.agent-harness";
105
+ export declare const AGENT_HARNESS: CapabilityId<AgentHarnessService>;
@@ -2,6 +2,11 @@
2
2
  // packages/contracts/src/provider.ts
3
3
  import { Schema as Schema4 } from "effect";
4
4
 
5
+ // packages/contracts/src/capability-id.ts
6
+ function makeCapabilityId(id) {
7
+ return id;
8
+ }
9
+
5
10
  // packages/contracts/src/baseSchemas.ts
6
11
  import { Schema } from "effect";
7
12
  var TrimmedString = Schema.Trim;
@@ -41,16 +46,8 @@ var RemoteEndpointId = makeEntityId("RemoteEndpointId");
41
46
 
42
47
  // packages/contracts/src/model.ts
43
48
  import { Schema as Schema2 } from "effect";
44
- var CODEX_REASONING_EFFORT_OPTIONS = ["xhigh", "high", "medium", "low"];
45
- var CodexModelOptions = Schema2.Struct({
46
- reasoningEffort: Schema2.optional(Schema2.Literals(CODEX_REASONING_EFFORT_OPTIONS)),
47
- fastMode: Schema2.optional(Schema2.Boolean)
48
- });
49
- var ClaudeModelOptions = Schema2.Struct({});
50
- var ProviderModelOptions = Schema2.Struct({
51
- codex: Schema2.optional(CodexModelOptions),
52
- claude: Schema2.optional(ClaudeModelOptions)
53
- });
49
+ var ModelSlug = Schema2.String;
50
+ var ProviderModelOptions = Schema2.Record(Schema2.String, Schema2.Unknown);
54
51
 
55
52
  // packages/contracts/src/orchestration.ts
56
53
  import { Schema as Schema3 } from "effect";
@@ -180,6 +177,8 @@ var ProviderEvent = Schema4.Struct({
180
177
  textDelta: Schema4.optional(Schema4.String),
181
178
  payload: Schema4.optional(Schema4.Unknown)
182
179
  });
180
+ var AGENT_HARNESS_CAPABILITY_ID = "rig.provider.agent-harness";
181
+ var AGENT_HARNESS = makeCapabilityId(AGENT_HARNESS_CAPABILITY_ID);
183
182
  export {
184
183
  ProviderTurnStartResult,
185
184
  ProviderStopSessionInput,
@@ -189,5 +188,7 @@ export {
189
188
  ProviderRespondToUserInputInput,
190
189
  ProviderRespondToRequestInput,
191
190
  ProviderInterruptTurnInput,
192
- ProviderEvent
191
+ ProviderEvent,
192
+ AGENT_HARNESS_CAPABILITY_ID,
193
+ AGENT_HARNESS
193
194
  };