@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,199 @@
1
+ /**
2
+ * Pure memory-service contract types.
3
+ *
4
+ * These types are the neutral home for the shared-memory data model so that the
5
+ * dumb runtime substrate (hooks, harness-cli, isolation, rig-agent) and the
6
+ * @rig/memory-plugin that owns the implementation can both reference them
7
+ * without a substrate->plugin import cycle. They carry no behaviour and import
8
+ * nothing — exactly like `lifecycle-capabilities.ts`.
9
+ *
10
+ * The plugin registers its executable `MemoryService` impl under the typed
11
+ * capability id {@link MEMORY} (whose string value is
12
+ * {@link MEMORY_SERVICE_CAPABILITY_ID}); the runtime resolves it by id from
13
+ * `pluginHost.listExecutableCapabilities()` via the `defineCapability` seam
14
+ * (`@rig/core/capability`), re-exported from the thin
15
+ * `@rig/runtime/control-plane/memory-service-port`.
16
+ */
17
+ import type { CapabilityId } from "./capability-id";
18
+ import type { RuntimeMemoryRetrievalConfig, RuntimeTaskContext } from "./runtime-task-context";
19
+ /** Capability id the memory plugin registers its `MemoryService` factory under. */
20
+ export declare const MEMORY_SERVICE_CAPABILITY_ID = "memory.service";
21
+ export declare const NO_MATCH_RETRIEVAL_CANONICAL_KEY = "__memory_recall__:none";
22
+ export type MemoryDbStatement = {
23
+ sql: string;
24
+ args?: unknown[];
25
+ };
26
+ export type MemoryDbExecuteResult = {
27
+ rows: Array<Record<string, unknown>>;
28
+ rowsAffected?: number;
29
+ };
30
+ export type MemoryDbTransaction = {
31
+ execute(statement: MemoryDbStatement | string, args?: unknown[]): Promise<MemoryDbExecuteResult>;
32
+ commit(): Promise<void>;
33
+ rollback(): Promise<void>;
34
+ close(): void;
35
+ };
36
+ export type MemoryDbClient = {
37
+ execute(statement: MemoryDbStatement | string, args?: unknown[]): Promise<MemoryDbExecuteResult>;
38
+ transaction(mode: "write"): Promise<MemoryDbTransaction>;
39
+ close(): void;
40
+ };
41
+ export type MemoryEventType = "observed" | "promoted" | "corrected" | "superseded" | "retracted" | "reinforced" | "retrieved" | "feedback_recorded";
42
+ export type MemoryStatus = "active" | "superseded" | "retracted";
43
+ export type RetrievalFeedbackOutcome = "helpful" | "ignored" | "incorrect";
44
+ type MemoryEventBase = {
45
+ eventId: string;
46
+ canonicalKey: string;
47
+ sourceRunId?: string | null;
48
+ sourceTaskId?: string | null;
49
+ branch?: string | null;
50
+ createdAt: string;
51
+ };
52
+ type MemoryProjectionSeed = {
53
+ summary: string;
54
+ kind: string;
55
+ category?: string | null;
56
+ confidence: number;
57
+ details?: Record<string, unknown> | null;
58
+ };
59
+ export type MemoryEventInput = (MemoryEventBase & MemoryProjectionSeed & {
60
+ eventType: "observed";
61
+ }) | (MemoryEventBase & MemoryProjectionSeed & {
62
+ eventType: "promoted";
63
+ sourceCanonicalKey: string;
64
+ }) | (MemoryEventBase & MemoryProjectionSeed & {
65
+ eventType: "corrected";
66
+ sourceCanonicalKey: string;
67
+ }) | (MemoryEventBase & {
68
+ eventType: "superseded";
69
+ replacementCanonicalKey: string;
70
+ }) | (MemoryEventBase & {
71
+ eventType: "retracted";
72
+ }) | (MemoryEventBase & {
73
+ eventType: "reinforced";
74
+ confidence: number;
75
+ }) | (MemoryEventBase & {
76
+ eventType: "retrieved";
77
+ retrievalQuery: string;
78
+ retrievalRank: number;
79
+ }) | (MemoryEventBase & {
80
+ eventType: "feedback_recorded";
81
+ feedbackOutcome: RetrievalFeedbackOutcome;
82
+ retrievalRank: number;
83
+ retrievalQuery?: string | null;
84
+ });
85
+ export type MemoryEventMetadata = {
86
+ sourceCanonicalKey?: string | null;
87
+ replacementCanonicalKey?: string | null;
88
+ retrievalQuery?: string | null;
89
+ retrievalRank?: number | null;
90
+ feedbackOutcome?: RetrievalFeedbackOutcome | null;
91
+ summary?: string | null;
92
+ kind?: string | null;
93
+ category?: string | null;
94
+ confidence?: number | null;
95
+ details?: Record<string, unknown> | null;
96
+ };
97
+ export type MemoryEventRow = {
98
+ eventId: string;
99
+ eventType: MemoryEventType;
100
+ canonicalKey: string;
101
+ summary: string;
102
+ createdAt: string;
103
+ };
104
+ export type MemoryItemRow = {
105
+ canonicalKey: string;
106
+ summary: string;
107
+ kind: string | null;
108
+ category: string | null;
109
+ status: MemoryStatus;
110
+ confidence: number;
111
+ sourceRunId: string | null;
112
+ sourceTaskId: string | null;
113
+ branch: string | null;
114
+ details: Record<string, unknown> | null;
115
+ createdAt: string;
116
+ updatedAt: string;
117
+ lastEventId: string;
118
+ supersededBy: string | null;
119
+ embedding: number[] | null;
120
+ };
121
+ export type MemoryQueryOptions = {
122
+ canonicalKey?: string;
123
+ includeInactive?: boolean;
124
+ };
125
+ export type MemoryDb = {
126
+ path: string;
127
+ client: MemoryDbClient;
128
+ close(): Promise<void>;
129
+ };
130
+ /** A scored, ranked shared-memory item returned by the retrieval query. */
131
+ export type MemoryQueryResult = {
132
+ canonicalKey: string;
133
+ summary: string;
134
+ kind: string | null;
135
+ category: string | null;
136
+ confidence: number;
137
+ updatedAt: string;
138
+ score: number;
139
+ lexicalScore: number;
140
+ vectorScore: number;
141
+ recencyScore: number;
142
+ };
143
+ /** Embeds text into vectors for memory retrieval; provider-agnostic. */
144
+ export type MemoryEmbedder = {
145
+ embed(texts: string[]): Promise<number[][]>;
146
+ };
147
+ /** A materialized read-only snapshot of the canonical project-memory database. */
148
+ export type CanonicalMemorySnapshot = {
149
+ repoPath: string;
150
+ baseOid: string;
151
+ dbPath: string;
152
+ createdFresh: boolean;
153
+ cleanup(): Promise<void>;
154
+ };
155
+ /**
156
+ * Minimal telemetry sink the memory command emits run events through. The
157
+ * substrate's concrete event bus (`@rig/runtime` `EventBusLike`) is a superset
158
+ * and is structurally assignable to this; the memory contract only depends on
159
+ * `emit`, so the pure contract stays free of any runtime/behaviour import.
160
+ */
161
+ export interface MemoryCommandEventSink {
162
+ emit<TPayload extends Record<string, unknown>>(type: string, payload: TPayload): Promise<unknown>;
163
+ }
164
+ /** Options for the agent-facing `rig-agent memory <verb>` command dispatch. */
165
+ export type ExecuteMemoryCommandOptions = {
166
+ projectRoot: string;
167
+ taskId: string;
168
+ runtimeContext: RuntimeTaskContext | null;
169
+ args: string[];
170
+ eventBus?: MemoryCommandEventSink;
171
+ };
172
+ /** The retrieval-query shape the substrate passes through to the impl. */
173
+ export type MemoryQueryPortInput = {
174
+ query: string;
175
+ limit?: number;
176
+ retrieval?: RuntimeMemoryRetrievalConfig;
177
+ };
178
+ /**
179
+ * The cohesive set of shared-memory operations the runtime consumers depend on.
180
+ * This is pure capability VOCAB: the `@rig/memory-plugin` provides a concrete
181
+ * impl (statically checked against this interface via `MemoryCap.provide`), and
182
+ * the substrate only ever sees this contract — resolved by id off a plugin host
183
+ * with no `as unknown as` at any call site.
184
+ */
185
+ export interface MemoryService {
186
+ executeMemoryCommand(options: ExecuteMemoryCommandOptions): Promise<string>;
187
+ readCanonicalMemoryDb(projectRoot: string): Promise<CanonicalMemorySnapshot>;
188
+ openMemoryDb(dbPath: string): Promise<MemoryDb>;
189
+ queryRelevantMemory(db: MemoryDb, input: MemoryQueryPortInput): Promise<MemoryQueryResult[]>;
190
+ formatMemoryQueryResults(results: MemoryQueryResult[]): string;
191
+ }
192
+ /**
193
+ * The typed capability id the memory plugin provides and consumers require.
194
+ * Phantom-typed with `MemoryService` so `MemoryCap.require(host)` returns a
195
+ * `MemoryService` with no cast leaking to callers. Its string value is
196
+ * {@link MEMORY_SERVICE_CAPABILITY_ID}, so it indexes the same host entry.
197
+ */
198
+ export declare const MEMORY: CapabilityId<MemoryService>;
199
+ export {};
@@ -0,0 +1,15 @@
1
+ // @bun
2
+ // packages/contracts/src/capability-id.ts
3
+ function makeCapabilityId(id) {
4
+ return id;
5
+ }
6
+
7
+ // packages/contracts/src/memory.ts
8
+ var MEMORY_SERVICE_CAPABILITY_ID = "memory.service";
9
+ var NO_MATCH_RETRIEVAL_CANONICAL_KEY = "__memory_recall__:none";
10
+ var MEMORY = makeCapabilityId(MEMORY_SERVICE_CAPABILITY_ID);
11
+ export {
12
+ NO_MATCH_RETRIEVAL_CANONICAL_KEY,
13
+ MEMORY_SERVICE_CAPABILITY_ID,
14
+ MEMORY
15
+ };
@@ -0,0 +1,77 @@
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
+ }>;
19
+ 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 {};
@@ -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
+ };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Pure NOTIFY capability vocab.
3
+ *
4
+ * The neutral home for the notification event/target data types and the typed
5
+ * capability seam so the floor (and any consumer) can resolve a notifier off a
6
+ * plugin host WITHOUT importing the provider package. Carries no behaviour —
7
+ * exactly like `browser.ts` / `memory.ts`.
8
+ *
9
+ * `@rig/notifications-plugin` provides the concrete `NotifyService` impl
10
+ * (config load + target selection = policy) under
11
+ * {@link NOTIFY_SERVICE_CAPABILITY} via the `defineCapability` seam.
12
+ */
13
+ import type { CapabilityId } from "./capability-id";
14
+ /** A Rig lifecycle event eligible for outbound notification. */
15
+ export type RigEvent = {
16
+ id?: string;
17
+ runId?: string;
18
+ timestamp?: string;
19
+ type: string;
20
+ payload?: Record<string, unknown>;
21
+ };
22
+ /** A configured outbound notification channel. */
23
+ export type NotificationTarget = {
24
+ id: string;
25
+ type: "slack-webhook" | "linear-webhook" | "notion-webhook" | "generic-webhook";
26
+ url: string;
27
+ enabled?: boolean;
28
+ events?: string[];
29
+ headers?: Record<string, string>;
30
+ };
31
+ /** The on-disk notification policy (`.rig/notifications.json`). */
32
+ export type NotificationConfig = {
33
+ targets: NotificationTarget[];
34
+ };
35
+ /** Capability id the notifications plugin registers its `NotifyService` under. */
36
+ export declare const NOTIFY_SERVICE_CAPABILITY_ID = "notify.dispatch";
37
+ /**
38
+ * The cohesive notify operation consumers depend on. The impl owns the policy:
39
+ * which targets receive which events, loaded from the project's
40
+ * `.rig/notifications.json`. Returns the count of targets successfully notified.
41
+ */
42
+ export interface NotifyService {
43
+ notify(event: RigEvent): Promise<number>;
44
+ }
45
+ /** Typed capability id the notifications plugin provides and consumers require. */
46
+ export declare const NOTIFY_SERVICE_CAPABILITY: CapabilityId<NotifyService>;
@@ -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/notify.ts
8
+ var NOTIFY_SERVICE_CAPABILITY_ID = "notify.dispatch";
9
+ var NOTIFY_SERVICE_CAPABILITY = makeCapabilityId(NOTIFY_SERVICE_CAPABILITY_ID);
10
+ export {
11
+ NOTIFY_SERVICE_CAPABILITY_ID,
12
+ NOTIFY_SERVICE_CAPABILITY
13
+ };
@@ -0,0 +1,43 @@
1
+ import { Schema } from "effect";
2
+ export declare const ProviderKind: Schema.Literals<readonly ["codex", "claude"]>;
3
+ export type ProviderKind = typeof ProviderKind.Type;
4
+ export declare const ProviderApprovalPolicy: Schema.Literals<readonly ["untrusted", "on-failure", "on-request", "never"]>;
5
+ export type ProviderApprovalPolicy = typeof ProviderApprovalPolicy.Type;
6
+ export declare const ProviderSandboxMode: Schema.Literals<readonly ["read-only", "workspace-write", "danger-full-access"]>;
7
+ export type ProviderSandboxMode = typeof ProviderSandboxMode.Type;
8
+ export declare const ProviderServiceTier: Schema.Literals<readonly ["fast", "flex"]>;
9
+ export type ProviderServiceTier = typeof ProviderServiceTier.Type;
10
+ export declare const RuntimeMode: Schema.Literals<readonly ["approval-required", "full-access"]>;
11
+ export type RuntimeMode = typeof RuntimeMode.Type;
12
+ export declare const DEFAULT_RUNTIME_MODE: RuntimeMode;
13
+ export declare const ProviderInteractionMode: Schema.Literals<readonly ["default", "plan"]>;
14
+ export type ProviderInteractionMode = typeof ProviderInteractionMode.Type;
15
+ export declare const DEFAULT_PROVIDER_INTERACTION_MODE: ProviderInteractionMode;
16
+ export declare const ProviderRequestKind: Schema.Literals<readonly ["command", "file-read", "file-change"]>;
17
+ export type ProviderRequestKind = typeof ProviderRequestKind.Type;
18
+ export declare const ProviderApprovalDecision: Schema.Literals<readonly ["accept", "acceptForSession", "decline", "cancel"]>;
19
+ export type ProviderApprovalDecision = typeof ProviderApprovalDecision.Type;
20
+ export declare const ProviderUserInputAnswers: Schema.$Record<Schema.String, Schema.Unknown>;
21
+ export type ProviderUserInputAnswers = typeof ProviderUserInputAnswers.Type;
22
+ export declare const PROVIDER_SEND_TURN_MAX_INPUT_CHARS = 120000;
23
+ export declare const PROVIDER_SEND_TURN_MAX_ATTACHMENTS = 8;
24
+ export declare const PROVIDER_SEND_TURN_MAX_IMAGE_BYTES: number;
25
+ declare const ChatAttachmentId: Schema.Trim;
26
+ export type ChatAttachmentId = typeof ChatAttachmentId.Type;
27
+ export declare const ChatImageAttachment: Schema.Struct<{
28
+ readonly type: Schema.Literal<"image">;
29
+ readonly id: Schema.Trim;
30
+ readonly name: Schema.Trim;
31
+ readonly mimeType: Schema.Trim;
32
+ readonly sizeBytes: Schema.Int;
33
+ }>;
34
+ export type ChatImageAttachment = typeof ChatImageAttachment.Type;
35
+ export declare const ChatAttachment: Schema.Union<readonly [Schema.Struct<{
36
+ readonly type: Schema.Literal<"image">;
37
+ readonly id: Schema.Trim;
38
+ readonly name: Schema.Trim;
39
+ readonly mimeType: Schema.Trim;
40
+ readonly sizeBytes: Schema.Int;
41
+ }>]>;
42
+ export type ChatAttachment = typeof ChatAttachment.Type;
43
+ export {};