@h-rig/contracts 0.0.6-alpha.155 → 0.0.6-alpha.157
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/index.cjs +407 -91
- package/dist/index.mjs +407 -91
- package/dist/src/browser.d.ts +50 -0
- package/dist/src/browser.js +6 -0
- package/dist/src/config.d.ts +4 -0
- package/dist/src/config.js +6 -14
- package/dist/src/control-plane-types.d.ts +283 -0
- package/dist/src/control-plane-types.js +29 -0
- package/dist/src/doctor.d.ts +27 -0
- package/dist/src/doctor.js +14 -0
- package/dist/src/github.d.ts +103 -0
- package/dist/src/github.js +6 -0
- package/dist/src/help-catalog.js +1 -1
- package/dist/src/index.d.ts +11 -0
- package/dist/src/index.js +407 -91
- package/dist/src/isolation.d.ts +21 -0
- package/dist/src/isolation.js +6 -0
- package/dist/src/kernel.d.ts +3 -35
- package/dist/src/kernel.js +0 -15
- package/dist/src/lifecycle-capabilities.d.ts +29 -0
- package/dist/src/lifecycle-capabilities.js +8 -0
- package/dist/src/managed-repos.d.ts +73 -0
- package/dist/src/managed-repos.js +6 -0
- package/dist/src/memory.d.ts +151 -0
- package/dist/src/memory.js +8 -0
- package/dist/src/panel-protocol.d.ts +17 -0
- package/dist/src/panel-protocol.js +10 -0
- package/dist/src/plugin-hooks.js +6 -14
- package/dist/src/plugin.d.ts +13 -0
- package/dist/src/plugin.js +7 -14
- package/dist/src/provider-instructions.d.ts +19 -0
- package/dist/src/provider-instructions.js +6 -0
- package/dist/src/run-journal.d.ts +1 -1
- package/dist/src/run-record.d.ts +11 -0
- package/dist/src/run-record.js +16 -0
- package/dist/src/supervisor-journal.d.ts +0 -1
- package/dist/src/supervisor-journal.js +0 -74
- package/dist/src/task-graph-primitives.d.ts +68 -0
- package/dist/src/task-graph-primitives.js +319 -0
- package/package.json +1 -1
package/dist/src/kernel.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
+
import type { RigPlugin } from "./plugin";
|
|
2
3
|
import { ResolvedPipeline, StageContext, StageDescriptor, StageMutation, StageResult, StageRunOutcome } from "./stage";
|
|
3
4
|
export declare const CapabilityTag: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
4
5
|
export type CapabilityTag = typeof CapabilityTag.Type;
|
|
@@ -17,33 +18,6 @@ export declare const CapabilityReplacementSpec: Schema.Union<readonly [Schema.St
|
|
|
17
18
|
readonly providerPluginId: Schema.Trim;
|
|
18
19
|
}>, Schema.Trim]>;
|
|
19
20
|
export type CapabilityReplacementSpec = typeof CapabilityReplacementSpec.Type;
|
|
20
|
-
export declare const PluginMeta: Schema.Struct<{
|
|
21
|
-
readonly id: Schema.Trim;
|
|
22
|
-
readonly version: Schema.Trim;
|
|
23
|
-
readonly provides: Schema.$Array<Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>>;
|
|
24
|
-
readonly requires: Schema.optional<Schema.$Array<Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>>>;
|
|
25
|
-
readonly replaces: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
26
|
-
readonly capability: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
27
|
-
readonly providerPluginId: Schema.Trim;
|
|
28
|
-
}>, Schema.Trim]>>>;
|
|
29
|
-
}>;
|
|
30
|
-
export type PluginMeta = typeof PluginMeta.Type;
|
|
31
|
-
export declare const LoadedPluginDescriptor: Schema.Struct<{
|
|
32
|
-
readonly meta: Schema.Struct<{
|
|
33
|
-
readonly id: Schema.Trim;
|
|
34
|
-
readonly version: Schema.Trim;
|
|
35
|
-
readonly provides: Schema.$Array<Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>>;
|
|
36
|
-
readonly requires: Schema.optional<Schema.$Array<Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>>>;
|
|
37
|
-
readonly replaces: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
38
|
-
readonly capability: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
39
|
-
readonly providerPluginId: Schema.Trim;
|
|
40
|
-
}>, Schema.Trim]>>>;
|
|
41
|
-
}>;
|
|
42
|
-
readonly provides: Schema.$Array<Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>>;
|
|
43
|
-
readonly contributes: Schema.Unknown;
|
|
44
|
-
readonly runtime: Schema.Unknown;
|
|
45
|
-
}>;
|
|
46
|
-
export type LoadedPluginDescriptor = typeof LoadedPluginDescriptor.Type;
|
|
47
21
|
export declare const KernelReplacementGrant: Schema.Struct<{
|
|
48
22
|
readonly pluginId: Schema.Trim;
|
|
49
23
|
readonly grantedBy: Schema.optional<Schema.Trim>;
|
|
@@ -182,12 +156,6 @@ export declare const JournalEvent: Schema.Struct<{
|
|
|
182
156
|
readonly payload: Schema.Unknown;
|
|
183
157
|
}>;
|
|
184
158
|
export type JournalEvent = typeof JournalEvent.Type;
|
|
185
|
-
export interface LoadedPlugin {
|
|
186
|
-
meta: PluginMeta;
|
|
187
|
-
provides: ReadonlySet<CapabilityTag>;
|
|
188
|
-
contributes: unknown;
|
|
189
|
-
runtime: unknown;
|
|
190
|
-
}
|
|
191
159
|
export interface JournalCapability {
|
|
192
160
|
append(event: unknown): Promise<void>;
|
|
193
161
|
recordPipeline(runId: string, pipeline: ResolvedPipeline): Promise<void>;
|
|
@@ -204,7 +172,7 @@ export interface TransportCapability {
|
|
|
204
172
|
serve?(): Promise<void>;
|
|
205
173
|
}
|
|
206
174
|
export interface LoaderPolicyCapability {
|
|
207
|
-
resolveCapability(plugins: readonly
|
|
175
|
+
resolveCapability(plugins: readonly RigPlugin[], capability: CapabilityTag, grants?: CapabilityGrants): CapabilityResolutionRecord;
|
|
208
176
|
}
|
|
209
177
|
export interface KernelCapability {
|
|
210
178
|
journal: JournalCapability;
|
|
@@ -215,7 +183,7 @@ export interface KernelCapability {
|
|
|
215
183
|
}
|
|
216
184
|
export interface BootResult {
|
|
217
185
|
kernel: KernelCapability;
|
|
218
|
-
plugins: readonly
|
|
186
|
+
plugins: readonly RigPlugin[];
|
|
219
187
|
capabilityProviderIds: Readonly<Record<CapabilityTag, string>>;
|
|
220
188
|
}
|
|
221
189
|
export type StageExecutor = (ctx: StageContext) => Promise<StageResult> | StageResult;
|
package/dist/src/kernel.js
CHANGED
|
@@ -163,19 +163,6 @@ var CapabilityReplacementSpec = Schema3.Union([
|
|
|
163
163
|
CapabilityReplacement,
|
|
164
164
|
TrimmedNonEmptyString
|
|
165
165
|
]);
|
|
166
|
-
var PluginMeta = Schema3.Struct({
|
|
167
|
-
id: TrimmedNonEmptyString,
|
|
168
|
-
version: TrimmedNonEmptyString,
|
|
169
|
-
provides: Schema3.Array(CapabilityTag),
|
|
170
|
-
requires: Schema3.optional(Schema3.Array(CapabilityTag)),
|
|
171
|
-
replaces: Schema3.optional(Schema3.Array(CapabilityReplacementSpec))
|
|
172
|
-
});
|
|
173
|
-
var LoadedPluginDescriptor = Schema3.Struct({
|
|
174
|
-
meta: PluginMeta,
|
|
175
|
-
provides: Schema3.Array(CapabilityTag),
|
|
176
|
-
contributes: Schema3.Unknown,
|
|
177
|
-
runtime: Schema3.Unknown
|
|
178
|
-
});
|
|
179
166
|
var KernelReplacementGrant = Schema3.Struct({
|
|
180
167
|
pluginId: TrimmedNonEmptyString,
|
|
181
168
|
grantedBy: Schema3.optional(TrimmedNonEmptyString),
|
|
@@ -246,10 +233,8 @@ var JournalEvent = Schema3.Struct({
|
|
|
246
233
|
payload: Schema3.Unknown
|
|
247
234
|
});
|
|
248
235
|
export {
|
|
249
|
-
PluginMeta,
|
|
250
236
|
PipelineUnresolvable,
|
|
251
237
|
MissingCapability,
|
|
252
|
-
LoadedPluginDescriptor,
|
|
253
238
|
KernelResolutionRecord,
|
|
254
239
|
KernelReplacementGrant,
|
|
255
240
|
KernelReplacementDenied,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed ports for the default-lifecycle bundle's verification services.
|
|
3
|
+
*
|
|
4
|
+
* The dumb runtime substrate (rig-agent, harness-cli) must NOT import the
|
|
5
|
+
* lifecycle bundle (substrate->plugin cycle). Instead the bundle plugin
|
|
6
|
+
* registers executable impls under these ids on its
|
|
7
|
+
* `contributes.capabilities[].run`, and the runtime resolves them by id from
|
|
8
|
+
* `pluginHost.listExecutableCapabilities()`. These pure types are the shared
|
|
9
|
+
* contract for that seam — they carry no behaviour and import nothing.
|
|
10
|
+
*/
|
|
11
|
+
/** Capability id the bundle registers its `taskVerify` orchestration under. */
|
|
12
|
+
export declare const TASK_VERIFY_CAPABILITY_ID = "default-lifecycle.task-verify";
|
|
13
|
+
/** Capability id the bundle registers the completion-verification gate under. */
|
|
14
|
+
export declare const COMPLETION_VERIFICATION_CAPABILITY_ID = "default-lifecycle.completion-verification";
|
|
15
|
+
export interface TaskVerifyCapabilityInput {
|
|
16
|
+
readonly projectRoot: string;
|
|
17
|
+
readonly taskId?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Resolves true when the task is approved, false when verification rejects. */
|
|
20
|
+
export type TaskVerifyCapabilityRun = (input: TaskVerifyCapabilityInput) => Promise<boolean>;
|
|
21
|
+
export interface CompletionVerificationCapabilityInput {
|
|
22
|
+
readonly projectRoot: string;
|
|
23
|
+
readonly taskId?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface CompletionVerificationCapabilityResult {
|
|
26
|
+
/** True when every completion gate passed; false when the gate blocks. */
|
|
27
|
+
readonly ok: boolean;
|
|
28
|
+
}
|
|
29
|
+
export type CompletionVerificationCapabilityRun = (input: CompletionVerificationCapabilityInput) => Promise<CompletionVerificationCapabilityResult>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/contracts/src/lifecycle-capabilities.ts
|
|
3
|
+
var TASK_VERIFY_CAPABILITY_ID = "default-lifecycle.task-verify";
|
|
4
|
+
var COMPLETION_VERIFICATION_CAPABILITY_ID = "default-lifecycle.completion-verification";
|
|
5
|
+
export {
|
|
6
|
+
TASK_VERIFY_CAPABILITY_ID,
|
|
7
|
+
COMPLETION_VERIFICATION_CAPABILITY_ID
|
|
8
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure managed-repo contract types + the managed-repo service capability id.
|
|
3
|
+
*
|
|
4
|
+
* The neutral home for the managed-repo (registry / layout / mirror) domain.
|
|
5
|
+
* The implementation lives in `@rig/repos-plugin`, which registers an
|
|
6
|
+
* executable `ManagedRepoService` factory under {@link MANAGED_REPO_SERVICE_CAPABILITY_ID}
|
|
7
|
+
* on `contributes.capabilities[].run`. The dumb runtime substrate (plugin-host
|
|
8
|
+
* boot wiring, the pre-run monorepo sync, native repo-ops pin recording, and the
|
|
9
|
+
* state-sync tracker-path resolver) resolves the service by this id from a
|
|
10
|
+
* plugin host built off the project's rig.config — exactly the seam shape of
|
|
11
|
+
* {@link MEMORY_SERVICE_CAPABILITY_ID} / ISOLATION_BACKEND_CAPABILITY_ID. This
|
|
12
|
+
* module carries no behaviour and imports only pure sibling types, so both the
|
|
13
|
+
* substrate and the plugin can reference these without a substrate->plugin
|
|
14
|
+
* import cycle.
|
|
15
|
+
*
|
|
16
|
+
* The service interface (`ManagedRepoService`) itself lives in the runtime port
|
|
17
|
+
* module `@rig/runtime/control-plane/managed-repo-service-port`, mirroring how
|
|
18
|
+
* `MemoryService` lives in the runtime port while only the pure data types live
|
|
19
|
+
* here.
|
|
20
|
+
*/
|
|
21
|
+
import type { RepoSourceRegistration } from "./plugin";
|
|
22
|
+
export type ManagedRepoId = string;
|
|
23
|
+
export type ManagedRepoAlias = string;
|
|
24
|
+
export type ManagedRepoHealth = "missing" | "ready" | "stale" | "misconfigured";
|
|
25
|
+
export type ManagedRepoRegistryEntry = {
|
|
26
|
+
id: ManagedRepoId;
|
|
27
|
+
alias: ManagedRepoAlias;
|
|
28
|
+
defaultBranch: string;
|
|
29
|
+
defaultRemoteUrl: string;
|
|
30
|
+
remoteEnvVar?: string;
|
|
31
|
+
checkoutEnvVar?: string;
|
|
32
|
+
};
|
|
33
|
+
export type ManagedRepoLayout = {
|
|
34
|
+
projectRoot: string;
|
|
35
|
+
repoId: ManagedRepoId;
|
|
36
|
+
alias: ManagedRepoAlias;
|
|
37
|
+
defaultBranch: string;
|
|
38
|
+
remoteUrl: string;
|
|
39
|
+
checkoutRoot: string;
|
|
40
|
+
worktreesRoot: string;
|
|
41
|
+
stateDir: string;
|
|
42
|
+
metadataRoot: string;
|
|
43
|
+
metadataRelativePath: string;
|
|
44
|
+
mirrorRoot: string;
|
|
45
|
+
mirrorStatePath: string;
|
|
46
|
+
mirrorStateRelativePath: string;
|
|
47
|
+
};
|
|
48
|
+
export type ManagedRepoMirrorState = {
|
|
49
|
+
version: 1;
|
|
50
|
+
repoId: ManagedRepoId;
|
|
51
|
+
remoteUrl: string;
|
|
52
|
+
defaultBranch: string;
|
|
53
|
+
initializedAt?: string;
|
|
54
|
+
lastSyncedAt?: string;
|
|
55
|
+
headRef?: string;
|
|
56
|
+
headCommit?: string;
|
|
57
|
+
};
|
|
58
|
+
export type ManagedRepoSyncResult = {
|
|
59
|
+
layout: ManagedRepoLayout;
|
|
60
|
+
headCommit: string;
|
|
61
|
+
};
|
|
62
|
+
/** A repo registration plus an optional computed local checkout path. */
|
|
63
|
+
export interface RepoEntry extends RepoSourceRegistration {
|
|
64
|
+
/** Optional computed local checkout path (runtime-specific, may be set by caller). */
|
|
65
|
+
localPath?: string;
|
|
66
|
+
}
|
|
67
|
+
/** An immutable, id-indexed view over plugin-contributed repo sources. */
|
|
68
|
+
export interface RepoRegistry {
|
|
69
|
+
getById(id: string): RepoEntry | undefined;
|
|
70
|
+
list(): readonly RepoEntry[];
|
|
71
|
+
}
|
|
72
|
+
/** Capability id the managed-repo service plugin registers its factory under. */
|
|
73
|
+
export declare const MANAGED_REPO_SERVICE_CAPABILITY_ID = "managed-repos.service";
|
|
@@ -0,0 +1,151 @@
|
|
|
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
|
|
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`.
|
|
14
|
+
*/
|
|
15
|
+
/** Capability id the memory plugin registers its `MemoryService` factory under. */
|
|
16
|
+
export declare const MEMORY_SERVICE_CAPABILITY_ID = "memory.service";
|
|
17
|
+
export declare const NO_MATCH_RETRIEVAL_CANONICAL_KEY = "__memory_recall__:none";
|
|
18
|
+
export type MemoryDbStatement = {
|
|
19
|
+
sql: string;
|
|
20
|
+
args?: unknown[];
|
|
21
|
+
};
|
|
22
|
+
export type MemoryDbExecuteResult = {
|
|
23
|
+
rows: Array<Record<string, unknown>>;
|
|
24
|
+
rowsAffected?: number;
|
|
25
|
+
};
|
|
26
|
+
export type MemoryDbTransaction = {
|
|
27
|
+
execute(statement: MemoryDbStatement | string, args?: unknown[]): Promise<MemoryDbExecuteResult>;
|
|
28
|
+
commit(): Promise<void>;
|
|
29
|
+
rollback(): Promise<void>;
|
|
30
|
+
close(): void;
|
|
31
|
+
};
|
|
32
|
+
export type MemoryDbClient = {
|
|
33
|
+
execute(statement: MemoryDbStatement | string, args?: unknown[]): Promise<MemoryDbExecuteResult>;
|
|
34
|
+
transaction(mode: "write"): Promise<MemoryDbTransaction>;
|
|
35
|
+
close(): void;
|
|
36
|
+
};
|
|
37
|
+
export type MemoryEventType = "observed" | "promoted" | "corrected" | "superseded" | "retracted" | "reinforced" | "retrieved" | "feedback_recorded";
|
|
38
|
+
export type MemoryStatus = "active" | "superseded" | "retracted";
|
|
39
|
+
export type RetrievalFeedbackOutcome = "helpful" | "ignored" | "incorrect";
|
|
40
|
+
type MemoryEventBase = {
|
|
41
|
+
eventId: string;
|
|
42
|
+
canonicalKey: string;
|
|
43
|
+
sourceRunId?: string | null;
|
|
44
|
+
sourceTaskId?: string | null;
|
|
45
|
+
branch?: string | null;
|
|
46
|
+
createdAt: string;
|
|
47
|
+
};
|
|
48
|
+
type MemoryProjectionSeed = {
|
|
49
|
+
summary: string;
|
|
50
|
+
kind: string;
|
|
51
|
+
category?: string | null;
|
|
52
|
+
confidence: number;
|
|
53
|
+
details?: Record<string, unknown> | null;
|
|
54
|
+
};
|
|
55
|
+
export type MemoryEventInput = (MemoryEventBase & MemoryProjectionSeed & {
|
|
56
|
+
eventType: "observed";
|
|
57
|
+
}) | (MemoryEventBase & MemoryProjectionSeed & {
|
|
58
|
+
eventType: "promoted";
|
|
59
|
+
sourceCanonicalKey: string;
|
|
60
|
+
}) | (MemoryEventBase & MemoryProjectionSeed & {
|
|
61
|
+
eventType: "corrected";
|
|
62
|
+
sourceCanonicalKey: string;
|
|
63
|
+
}) | (MemoryEventBase & {
|
|
64
|
+
eventType: "superseded";
|
|
65
|
+
replacementCanonicalKey: string;
|
|
66
|
+
}) | (MemoryEventBase & {
|
|
67
|
+
eventType: "retracted";
|
|
68
|
+
}) | (MemoryEventBase & {
|
|
69
|
+
eventType: "reinforced";
|
|
70
|
+
confidence: number;
|
|
71
|
+
}) | (MemoryEventBase & {
|
|
72
|
+
eventType: "retrieved";
|
|
73
|
+
retrievalQuery: string;
|
|
74
|
+
retrievalRank: number;
|
|
75
|
+
}) | (MemoryEventBase & {
|
|
76
|
+
eventType: "feedback_recorded";
|
|
77
|
+
feedbackOutcome: RetrievalFeedbackOutcome;
|
|
78
|
+
retrievalRank: number;
|
|
79
|
+
retrievalQuery?: string | null;
|
|
80
|
+
});
|
|
81
|
+
export type MemoryEventMetadata = {
|
|
82
|
+
sourceCanonicalKey?: string | null;
|
|
83
|
+
replacementCanonicalKey?: string | null;
|
|
84
|
+
retrievalQuery?: string | null;
|
|
85
|
+
retrievalRank?: number | null;
|
|
86
|
+
feedbackOutcome?: RetrievalFeedbackOutcome | null;
|
|
87
|
+
summary?: string | null;
|
|
88
|
+
kind?: string | null;
|
|
89
|
+
category?: string | null;
|
|
90
|
+
confidence?: number | null;
|
|
91
|
+
details?: Record<string, unknown> | null;
|
|
92
|
+
};
|
|
93
|
+
export type MemoryEventRow = {
|
|
94
|
+
eventId: string;
|
|
95
|
+
eventType: MemoryEventType;
|
|
96
|
+
canonicalKey: string;
|
|
97
|
+
summary: string;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
};
|
|
100
|
+
export type MemoryItemRow = {
|
|
101
|
+
canonicalKey: string;
|
|
102
|
+
summary: string;
|
|
103
|
+
kind: string | null;
|
|
104
|
+
category: string | null;
|
|
105
|
+
status: MemoryStatus;
|
|
106
|
+
confidence: number;
|
|
107
|
+
sourceRunId: string | null;
|
|
108
|
+
sourceTaskId: string | null;
|
|
109
|
+
branch: string | null;
|
|
110
|
+
details: Record<string, unknown> | null;
|
|
111
|
+
createdAt: string;
|
|
112
|
+
updatedAt: string;
|
|
113
|
+
lastEventId: string;
|
|
114
|
+
supersededBy: string | null;
|
|
115
|
+
embedding: number[] | null;
|
|
116
|
+
};
|
|
117
|
+
export type MemoryQueryOptions = {
|
|
118
|
+
canonicalKey?: string;
|
|
119
|
+
includeInactive?: boolean;
|
|
120
|
+
};
|
|
121
|
+
export type MemoryDb = {
|
|
122
|
+
path: string;
|
|
123
|
+
client: MemoryDbClient;
|
|
124
|
+
close(): Promise<void>;
|
|
125
|
+
};
|
|
126
|
+
/** A scored, ranked shared-memory item returned by the retrieval query. */
|
|
127
|
+
export type MemoryQueryResult = {
|
|
128
|
+
canonicalKey: string;
|
|
129
|
+
summary: string;
|
|
130
|
+
kind: string | null;
|
|
131
|
+
category: string | null;
|
|
132
|
+
confidence: number;
|
|
133
|
+
updatedAt: string;
|
|
134
|
+
score: number;
|
|
135
|
+
lexicalScore: number;
|
|
136
|
+
vectorScore: number;
|
|
137
|
+
recencyScore: number;
|
|
138
|
+
};
|
|
139
|
+
/** Embeds text into vectors for memory retrieval; provider-agnostic. */
|
|
140
|
+
export type MemoryEmbedder = {
|
|
141
|
+
embed(texts: string[]): Promise<number[][]>;
|
|
142
|
+
};
|
|
143
|
+
/** A materialized read-only snapshot of the canonical project-memory database. */
|
|
144
|
+
export type CanonicalMemorySnapshot = {
|
|
145
|
+
repoPath: string;
|
|
146
|
+
baseOid: string;
|
|
147
|
+
dbPath: string;
|
|
148
|
+
createdFresh: boolean;
|
|
149
|
+
cleanup(): Promise<void>;
|
|
150
|
+
};
|
|
151
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RunJournalProjection } from "./run-journal";
|
|
2
|
+
/**
|
|
3
|
+
* Cross-package panel-protocol vocabulary shared by the run-worker (panel
|
|
4
|
+
* producer side) and the plugins that contribute the supervisor panel
|
|
5
|
+
* registration. Lives in @rig/contracts so neither side has to depend on the
|
|
6
|
+
* other's package for these constants.
|
|
7
|
+
*/
|
|
8
|
+
export declare const RIG_RUN_STOP_PANEL_ACTION = "rig-run:stop";
|
|
9
|
+
export declare const RIG_CAPABILITY_PANEL_SLOT = "capability";
|
|
10
|
+
export declare const RIG_SUPERVISOR_PANEL_ID = "supervisor";
|
|
11
|
+
export interface WorkerPanelProducerContext {
|
|
12
|
+
readonly projectRoot: string;
|
|
13
|
+
readonly runId: string;
|
|
14
|
+
readonly folded: RunJournalProjection;
|
|
15
|
+
readonly taskIdAtStart?: string | null;
|
|
16
|
+
readonly runDisplayTitle: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/contracts/src/panel-protocol.ts
|
|
3
|
+
var RIG_RUN_STOP_PANEL_ACTION = "rig-run:stop";
|
|
4
|
+
var RIG_CAPABILITY_PANEL_SLOT = "capability";
|
|
5
|
+
var RIG_SUPERVISOR_PANEL_ID = "supervisor";
|
|
6
|
+
export {
|
|
7
|
+
RIG_SUPERVISOR_PANEL_ID,
|
|
8
|
+
RIG_RUN_STOP_PANEL_ACTION,
|
|
9
|
+
RIG_CAPABILITY_PANEL_SLOT
|
|
10
|
+
};
|
package/dist/src/plugin-hooks.js
CHANGED
|
@@ -170,19 +170,6 @@ var CapabilityReplacementSpec = Schema3.Union([
|
|
|
170
170
|
CapabilityReplacement,
|
|
171
171
|
TrimmedNonEmptyString
|
|
172
172
|
]);
|
|
173
|
-
var PluginMeta = Schema3.Struct({
|
|
174
|
-
id: TrimmedNonEmptyString,
|
|
175
|
-
version: TrimmedNonEmptyString,
|
|
176
|
-
provides: Schema3.Array(CapabilityTag),
|
|
177
|
-
requires: Schema3.optional(Schema3.Array(CapabilityTag)),
|
|
178
|
-
replaces: Schema3.optional(Schema3.Array(CapabilityReplacementSpec))
|
|
179
|
-
});
|
|
180
|
-
var LoadedPluginDescriptor = Schema3.Struct({
|
|
181
|
-
meta: PluginMeta,
|
|
182
|
-
provides: Schema3.Array(CapabilityTag),
|
|
183
|
-
contributes: Schema3.Unknown,
|
|
184
|
-
runtime: Schema3.Unknown
|
|
185
|
-
});
|
|
186
173
|
var KernelReplacementGrant = Schema3.Struct({
|
|
187
174
|
pluginId: TrimmedNonEmptyString,
|
|
188
175
|
grantedBy: Schema3.optional(TrimmedNonEmptyString),
|
|
@@ -327,6 +314,10 @@ var BlockerClassifierRegistration = Schema4.Struct({
|
|
|
327
314
|
description: Schema4.optional(Schema4.String),
|
|
328
315
|
priority: Schema4.optional(Schema4.Number)
|
|
329
316
|
});
|
|
317
|
+
var SessionExtensionRegistration = Schema4.Struct({
|
|
318
|
+
id: Schema4.String,
|
|
319
|
+
description: Schema4.optional(Schema4.String)
|
|
320
|
+
});
|
|
330
321
|
var PluginContributes = Schema4.Struct({
|
|
331
322
|
validators: Schema4.optional(Schema4.Array(ValidatorRegistration)),
|
|
332
323
|
hooks: Schema4.optional(Schema4.Array(HookRegistration)),
|
|
@@ -340,7 +331,8 @@ var PluginContributes = Schema4.Struct({
|
|
|
340
331
|
stageMutations: Schema4.optional(Schema4.Array(StageMutation)),
|
|
341
332
|
capabilities: Schema4.optional(Schema4.Array(ProductCapabilityRegistration)),
|
|
342
333
|
panels: Schema4.optional(Schema4.Array(PanelRegistration)),
|
|
343
|
-
blockerClassifiers: Schema4.optional(Schema4.Array(BlockerClassifierRegistration))
|
|
334
|
+
blockerClassifiers: Schema4.optional(Schema4.Array(BlockerClassifierRegistration)),
|
|
335
|
+
sessionExtensions: Schema4.optional(Schema4.Array(SessionExtensionRegistration))
|
|
344
336
|
});
|
|
345
337
|
var RigPlugin = Schema4.Struct({
|
|
346
338
|
name: Schema4.String,
|
package/dist/src/plugin.d.ts
CHANGED
|
@@ -118,6 +118,11 @@ export declare const BlockerClassifierRegistration: Schema.Struct<{
|
|
|
118
118
|
readonly priority: Schema.optional<Schema.Number>;
|
|
119
119
|
}>;
|
|
120
120
|
export type BlockerClassifierRegistration = typeof BlockerClassifierRegistration.Type;
|
|
121
|
+
export declare const SessionExtensionRegistration: Schema.Struct<{
|
|
122
|
+
readonly id: Schema.String;
|
|
123
|
+
readonly description: Schema.optional<Schema.String>;
|
|
124
|
+
}>;
|
|
125
|
+
export type SessionExtensionRegistration = typeof SessionExtensionRegistration.Type;
|
|
121
126
|
export declare const PluginContributes: Schema.Struct<{
|
|
122
127
|
readonly validators: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
123
128
|
readonly id: Schema.String;
|
|
@@ -259,6 +264,10 @@ export declare const PluginContributes: Schema.Struct<{
|
|
|
259
264
|
readonly description: Schema.optional<Schema.String>;
|
|
260
265
|
readonly priority: Schema.optional<Schema.Number>;
|
|
261
266
|
}>>>;
|
|
267
|
+
readonly sessionExtensions: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
268
|
+
readonly id: Schema.String;
|
|
269
|
+
readonly description: Schema.optional<Schema.String>;
|
|
270
|
+
}>>>;
|
|
262
271
|
}>;
|
|
263
272
|
export type PluginContributes = typeof PluginContributes.Type;
|
|
264
273
|
export declare const RigPlugin: Schema.Struct<{
|
|
@@ -411,6 +420,10 @@ export declare const RigPlugin: Schema.Struct<{
|
|
|
411
420
|
readonly description: Schema.optional<Schema.String>;
|
|
412
421
|
readonly priority: Schema.optional<Schema.Number>;
|
|
413
422
|
}>>>;
|
|
423
|
+
readonly sessionExtensions: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
424
|
+
readonly id: Schema.String;
|
|
425
|
+
readonly description: Schema.optional<Schema.String>;
|
|
426
|
+
}>>>;
|
|
414
427
|
}>>;
|
|
415
428
|
}>;
|
|
416
429
|
export type RigPlugin = typeof RigPlugin.Type;
|
package/dist/src/plugin.js
CHANGED
|
@@ -167,19 +167,6 @@ var CapabilityReplacementSpec = Schema3.Union([
|
|
|
167
167
|
CapabilityReplacement,
|
|
168
168
|
TrimmedNonEmptyString
|
|
169
169
|
]);
|
|
170
|
-
var PluginMeta = Schema3.Struct({
|
|
171
|
-
id: TrimmedNonEmptyString,
|
|
172
|
-
version: TrimmedNonEmptyString,
|
|
173
|
-
provides: Schema3.Array(CapabilityTag),
|
|
174
|
-
requires: Schema3.optional(Schema3.Array(CapabilityTag)),
|
|
175
|
-
replaces: Schema3.optional(Schema3.Array(CapabilityReplacementSpec))
|
|
176
|
-
});
|
|
177
|
-
var LoadedPluginDescriptor = Schema3.Struct({
|
|
178
|
-
meta: PluginMeta,
|
|
179
|
-
provides: Schema3.Array(CapabilityTag),
|
|
180
|
-
contributes: Schema3.Unknown,
|
|
181
|
-
runtime: Schema3.Unknown
|
|
182
|
-
});
|
|
183
170
|
var KernelReplacementGrant = Schema3.Struct({
|
|
184
171
|
pluginId: TrimmedNonEmptyString,
|
|
185
172
|
grantedBy: Schema3.optional(TrimmedNonEmptyString),
|
|
@@ -325,6 +312,10 @@ var BlockerClassifierRegistration = Schema4.Struct({
|
|
|
325
312
|
description: Schema4.optional(Schema4.String),
|
|
326
313
|
priority: Schema4.optional(Schema4.Number)
|
|
327
314
|
});
|
|
315
|
+
var SessionExtensionRegistration = Schema4.Struct({
|
|
316
|
+
id: Schema4.String,
|
|
317
|
+
description: Schema4.optional(Schema4.String)
|
|
318
|
+
});
|
|
328
319
|
var PluginContributes = Schema4.Struct({
|
|
329
320
|
validators: Schema4.optional(Schema4.Array(ValidatorRegistration)),
|
|
330
321
|
hooks: Schema4.optional(Schema4.Array(HookRegistration)),
|
|
@@ -338,7 +329,8 @@ var PluginContributes = Schema4.Struct({
|
|
|
338
329
|
stageMutations: Schema4.optional(Schema4.Array(StageMutation)),
|
|
339
330
|
capabilities: Schema4.optional(Schema4.Array(ProductCapabilityRegistration)),
|
|
340
331
|
panels: Schema4.optional(Schema4.Array(PanelRegistration)),
|
|
341
|
-
blockerClassifiers: Schema4.optional(Schema4.Array(BlockerClassifierRegistration))
|
|
332
|
+
blockerClassifiers: Schema4.optional(Schema4.Array(BlockerClassifierRegistration)),
|
|
333
|
+
sessionExtensions: Schema4.optional(Schema4.Array(SessionExtensionRegistration))
|
|
342
334
|
});
|
|
343
335
|
var RigPlugin = Schema4.Struct({
|
|
344
336
|
name: Schema4.String,
|
|
@@ -355,6 +347,7 @@ export {
|
|
|
355
347
|
TaskSourceKind,
|
|
356
348
|
TaskFieldExtension,
|
|
357
349
|
SkillRegistration,
|
|
350
|
+
SessionExtensionRegistration,
|
|
358
351
|
RigPlugin,
|
|
359
352
|
RepoSourceRegistration,
|
|
360
353
|
ProductCapabilityRegistration,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure provider-instruction contract types.
|
|
3
|
+
*
|
|
4
|
+
* Neutral home for the agent-harness provider identity so the dumb runtime
|
|
5
|
+
* substrate (native/task-ops, hooks/inject-context) and the
|
|
6
|
+
* @rig/provider-plugin that owns the instruction text can both reference it
|
|
7
|
+
* without a substrate->plugin import cycle. Carries no behaviour and imports
|
|
8
|
+
* nothing — exactly like `memory.ts` / `lifecycle-capabilities.ts`.
|
|
9
|
+
*
|
|
10
|
+
* The plugin registers its executable `RuntimeInstructionService` impl under
|
|
11
|
+
* {@link RUNTIME_INSTRUCTION_SERVICE_CAPABILITY_ID} on
|
|
12
|
+
* `contributes.capabilities[].run`; the runtime resolves it by id from
|
|
13
|
+
* `pluginHost.listExecutableCapabilities()` via the typed port in
|
|
14
|
+
* `@rig/runtime/control-plane/provider-instruction-port`.
|
|
15
|
+
*/
|
|
16
|
+
/** Capability id the provider plugin registers its instruction service under. */
|
|
17
|
+
export declare const RUNTIME_INSTRUCTION_SERVICE_CAPABILITY_ID = "provider.runtime-instructions";
|
|
18
|
+
/** The agent harness adapter the runtime is currently wired to. */
|
|
19
|
+
export type RuntimeInstructionProvider = "pi";
|
|
@@ -744,7 +744,7 @@ export declare const decodeRunJournalEvent: (input: unknown, options?: import("e
|
|
|
744
744
|
readonly v: 1;
|
|
745
745
|
readonly type: "approval-resolved";
|
|
746
746
|
readonly requestId: string;
|
|
747
|
-
readonly decision: "
|
|
747
|
+
readonly decision: "reject" | "approve";
|
|
748
748
|
readonly actor: {
|
|
749
749
|
readonly kind: "server" | "system" | "agent" | "operator";
|
|
750
750
|
readonly id?: string | null | undefined;
|
package/dist/src/run-record.d.ts
CHANGED
|
@@ -43,3 +43,14 @@ export interface RunRecord {
|
|
|
43
43
|
/** The full folded journal (empty projection when no journal was readable). */
|
|
44
44
|
readonly projection: RunJournalProjection;
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Index runs by their task id, keeping only the most-recently-updated run per
|
|
48
|
+
* task. Pure run primitive relocated out of the dissolved @rig/client facade
|
|
49
|
+
* (the META vocabulary floor is the correct home for a typed, policy-free run
|
|
50
|
+
* coercion that multiple plugins build projections on).
|
|
51
|
+
*/
|
|
52
|
+
export declare function latestRunByTaskId<T extends {
|
|
53
|
+
readonly taskId: string | null;
|
|
54
|
+
readonly updatedAt: string | null;
|
|
55
|
+
readonly startedAt: string | null;
|
|
56
|
+
}>(runs: readonly T[]): Map<string, T>;
|
package/dist/src/run-record.js
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
// packages/contracts/src/run-record.ts
|
|
3
|
+
function latestRunByTaskId(runs) {
|
|
4
|
+
const byTask = new Map;
|
|
5
|
+
const stamp = (run) => Date.parse(run.updatedAt ?? run.startedAt ?? "") || 0;
|
|
6
|
+
for (const run of runs) {
|
|
7
|
+
if (!run.taskId)
|
|
8
|
+
continue;
|
|
9
|
+
const current = byTask.get(run.taskId);
|
|
10
|
+
if (!current || stamp(run) >= stamp(current))
|
|
11
|
+
byTask.set(run.taskId, run);
|
|
12
|
+
}
|
|
13
|
+
return byTask;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
latestRunByTaskId
|
|
17
|
+
};
|
|
@@ -202,4 +202,3 @@ export declare const SupervisorProjection: Schema.Struct<{
|
|
|
202
202
|
readonly anomalies: Schema.$Array<Schema.String>;
|
|
203
203
|
}>;
|
|
204
204
|
export type SupervisorProjection = typeof SupervisorProjection.Type;
|
|
205
|
-
export declare function reduceSupervisorJournal(events: readonly SupervisorEvent[]): SupervisorProjection;
|