@h-rig/contracts 0.0.6-alpha.157 → 0.0.6-alpha.158

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 (126) hide show
  1. package/dist/index.cjs +2340 -6832
  2. package/dist/index.mjs +2116 -6608
  3. package/dist/src/agent-roles.d.ts +8 -0
  4. package/dist/src/browser.d.ts +34 -4
  5. package/dist/src/browser.js +8 -1
  6. package/dist/src/capability-id.d.ts +22 -0
  7. package/dist/src/capability-id.js +8 -0
  8. package/dist/src/cli-output.d.ts +24 -0
  9. package/dist/src/cli-runner.d.ts +43 -0
  10. package/dist/src/cli-runner.js +13 -0
  11. package/dist/src/collab-session-viewer.d.ts +36 -0
  12. package/dist/src/collab-session-viewer.js +13 -0
  13. package/dist/src/config.d.ts +11 -0
  14. package/dist/src/config.js +279 -1098
  15. package/dist/src/control-plane-types.d.ts +41 -1
  16. package/dist/src/control-plane-types.js +9 -25
  17. package/dist/src/dependency-preflight.d.ts +43 -0
  18. package/dist/src/dependency-preflight.js +13 -0
  19. package/dist/src/doctor.d.ts +67 -4
  20. package/dist/src/doctor.js +8 -9
  21. package/dist/src/errors.d.ts +13 -0
  22. package/dist/src/errors.js +17 -0
  23. package/dist/src/github.d.ts +43 -0
  24. package/dist/src/github.js +12 -1
  25. package/dist/src/graph.d.ts +37 -0
  26. package/dist/src/graph.js +13 -0
  27. package/dist/src/guard.d.ts +111 -0
  28. package/dist/src/guard.js +6 -0
  29. package/dist/src/harness-events.d.ts +8 -0
  30. package/dist/src/harness-events.js +1 -0
  31. package/dist/src/help-catalog.d.ts +17 -10
  32. package/dist/src/help-catalog.js +9 -651
  33. package/dist/src/host.d.ts +41 -0
  34. package/dist/src/host.js +13 -0
  35. package/dist/src/identity.d.ts +44 -0
  36. package/dist/src/identity.js +1 -0
  37. package/dist/src/index.d.ts +27 -7
  38. package/dist/src/index.js +2116 -6608
  39. package/dist/src/isolation.d.ts +207 -15
  40. package/dist/src/isolation.js +8 -1
  41. package/dist/src/kernel.d.ts +11 -0
  42. package/dist/src/kernel.js +7 -0
  43. package/dist/src/layout.d.ts +49 -0
  44. package/dist/src/layout.js +10 -0
  45. package/dist/src/lifecycle-capabilities.d.ts +99 -0
  46. package/dist/src/lifecycle-capabilities.js +18 -1
  47. package/dist/src/managed-repos.d.ts +79 -16
  48. package/dist/src/managed-repos.js +12 -1
  49. package/dist/src/memory.d.ts +52 -4
  50. package/dist/src/memory.js +8 -1
  51. package/dist/src/notify.d.ts +46 -0
  52. package/dist/src/notify.js +13 -0
  53. package/dist/src/orchestration.d.ts +0 -3652
  54. package/dist/src/orchestration.js +28 -964
  55. package/dist/src/plugin-hooks.js +22 -3
  56. package/dist/src/plugin.d.ts +47 -0
  57. package/dist/src/plugin.js +24 -3
  58. package/dist/src/prompt.d.ts +29 -0
  59. package/dist/src/prompt.js +13 -0
  60. package/dist/src/provider-instructions.d.ts +26 -4
  61. package/dist/src/provider-instructions.js +8 -1
  62. package/dist/src/provider.js +1 -824
  63. package/dist/src/remote.d.ts +0 -8
  64. package/dist/src/remote.js +229 -1075
  65. package/dist/src/run-discovery.d.ts +79 -0
  66. package/dist/src/run-discovery.js +13 -0
  67. package/dist/src/run-dispatch.d.ts +34 -0
  68. package/dist/src/run-dispatch.js +13 -0
  69. package/dist/src/run-identity.d.ts +47 -0
  70. package/dist/src/run-identity.js +13 -0
  71. package/dist/src/run-journal.d.ts +0 -236
  72. package/dist/src/run-journal.js +249 -1321
  73. package/dist/src/run-read-model.d.ts +234 -0
  74. package/dist/src/run-read-model.js +13 -0
  75. package/dist/src/run-record.d.ts +0 -11
  76. package/dist/src/run-record.js +0 -16
  77. package/dist/src/run-registry-backbone.d.ts +56 -0
  78. package/dist/src/run-registry-backbone.js +13 -0
  79. package/dist/src/run-session-journal.d.ts +1 -25
  80. package/dist/src/run-session-journal.js +0 -1731
  81. package/dist/src/run-status.d.ts +0 -2
  82. package/dist/src/run-status.js +0 -11
  83. package/dist/src/run-timeline.d.ts +0 -3
  84. package/dist/src/run-timeline.js +0 -1498
  85. package/dist/src/runtime-task-context.d.ts +82 -0
  86. package/dist/src/runtime-task-context.js +1 -0
  87. package/dist/src/runtime.js +66 -904
  88. package/dist/src/session-asset-materializer.d.ts +35 -0
  89. package/dist/src/session-asset-materializer.js +13 -0
  90. package/dist/src/setup.d.ts +47 -0
  91. package/dist/src/setup.js +13 -0
  92. package/dist/src/supervisor-journal.js +117 -955
  93. package/dist/src/task-data.d.ts +239 -0
  94. package/dist/src/task-data.js +13 -0
  95. package/dist/src/task-graph-primitives.d.ts +0 -21
  96. package/dist/src/task-graph-primitives.js +0 -318
  97. package/dist/src/task-source.d.ts +65 -0
  98. package/dist/src/task-source.js +12 -0
  99. package/dist/src/task-state-metadata.d.ts +21 -0
  100. package/dist/src/task-state-metadata.js +1 -0
  101. package/dist/src/tool-materializer.d.ts +36 -0
  102. package/dist/src/tool-materializer.js +13 -0
  103. package/dist/src/tool-registry.d.ts +3 -0
  104. package/dist/src/tool-registry.js +58 -0
  105. package/dist/src/toolchain-sources.d.ts +54 -0
  106. package/dist/src/toolchain-sources.js +17 -0
  107. package/dist/src/workflow-journal.d.ts +0 -32
  108. package/dist/src/workflow-journal.js +0 -371
  109. package/dist/src/workspace-config.d.ts +18 -0
  110. package/dist/src/workspace-config.js +13 -0
  111. package/dist/src/workspace.js +73 -911
  112. package/package.json +1 -1
  113. package/dist/src/engine.d.ts +0 -2789
  114. package/dist/src/engine.js +0 -2392
  115. package/dist/src/ipc.d.ts +0 -248
  116. package/dist/src/providerRuntime.d.ts +0 -3949
  117. package/dist/src/providerRuntime.js +0 -1633
  118. package/dist/src/rig.d.ts +0 -783
  119. package/dist/src/rig.js +0 -2537
  120. package/dist/src/server.d.ts +0 -106
  121. package/dist/src/server.js +0 -1056
  122. package/dist/src/serviceFabric.d.ts +0 -62
  123. package/dist/src/serviceFabric.js +0 -1069
  124. package/dist/src/ws.d.ts +0 -747
  125. package/dist/src/ws.js +0 -3126
  126. /package/dist/src/{ipc.js → agent-roles.js} +0 -0
@@ -7,11 +7,15 @@
7
7
  * without a substrate->plugin import cycle. They carry no behaviour and import
8
8
  * nothing — exactly like `lifecycle-capabilities.ts`.
9
9
  *
10
- * The plugin registers its executable `MemoryService` impl under
11
- * {@link MEMORY_SERVICE_CAPABILITY_ID} on `contributes.capabilities[].run`; the
12
- * runtime resolves it by id from `pluginHost.listExecutableCapabilities()` via
13
- * the typed port in `@rig/runtime/control-plane/memory-service-port`.
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`.
14
16
  */
17
+ import type { CapabilityId } from "./capability-id";
18
+ import type { RuntimeMemoryRetrievalConfig, RuntimeTaskContext } from "./runtime-task-context";
15
19
  /** Capability id the memory plugin registers its `MemoryService` factory under. */
16
20
  export declare const MEMORY_SERVICE_CAPABILITY_ID = "memory.service";
17
21
  export declare const NO_MATCH_RETRIEVAL_CANONICAL_KEY = "__memory_recall__:none";
@@ -148,4 +152,48 @@ export type CanonicalMemorySnapshot = {
148
152
  createdFresh: boolean;
149
153
  cleanup(): Promise<void>;
150
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>;
151
199
  export {};
@@ -1,8 +1,15 @@
1
1
  // @bun
2
+ // packages/contracts/src/capability-id.ts
3
+ function makeCapabilityId(id) {
4
+ return id;
5
+ }
6
+
2
7
  // packages/contracts/src/memory.ts
3
8
  var MEMORY_SERVICE_CAPABILITY_ID = "memory.service";
4
9
  var NO_MATCH_RETRIEVAL_CANONICAL_KEY = "__memory_recall__:none";
10
+ var MEMORY = makeCapabilityId(MEMORY_SERVICE_CAPABILITY_ID);
5
11
  export {
6
12
  NO_MATCH_RETRIEVAL_CANONICAL_KEY,
7
- MEMORY_SERVICE_CAPABILITY_ID
13
+ MEMORY_SERVICE_CAPABILITY_ID,
14
+ MEMORY
8
15
  };
@@ -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
+ };