@h-rig/contracts 0.0.6-alpha.18 → 0.0.6-alpha.181
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 +3442 -0
- package/dist/index.mjs +3401 -0
- package/dist/src/agent-roles.d.ts +8 -0
- package/dist/src/artifact.d.ts +13 -0
- package/dist/src/artifact.js +3 -0
- package/dist/src/baseSchemas.d.ts +63 -0
- package/dist/src/baseSchemas.js +6 -0
- package/dist/src/blocker-classifier.d.ts +21 -0
- package/dist/src/blocker-classifier.js +13 -0
- package/dist/src/browser.d.ts +80 -0
- package/dist/src/browser.js +13 -0
- package/dist/src/capability-id.d.ts +22 -0
- package/dist/src/capability-id.js +8 -0
- package/dist/src/cli-output.d.ts +348 -0
- package/dist/src/cli-output.js +190 -0
- package/dist/src/cli-runner.d.ts +43 -0
- package/dist/src/cli-runner.js +13 -0
- package/dist/src/cockpit.d.ts +58 -0
- package/dist/src/cockpit.js +13 -0
- package/dist/src/collab-session-viewer.d.ts +36 -0
- package/dist/src/collab-session-viewer.js +13 -0
- package/dist/src/config.d.ts +553 -0
- package/dist/src/config.js +767 -162
- package/dist/src/control-plane-types.d.ts +323 -0
- package/dist/src/control-plane-types.js +13 -0
- package/dist/src/conversation.d.ts +50 -0
- package/dist/src/conversation.js +3 -0
- package/dist/src/dependency-preflight.d.ts +43 -0
- package/dist/src/dependency-preflight.js +13 -0
- package/dist/src/docs-drift.d.ts +10 -0
- package/dist/src/docs-drift.js +12 -0
- package/dist/src/doctor.d.ts +90 -0
- package/dist/src/doctor.js +13 -0
- package/dist/src/drift.d.ts +28 -0
- package/dist/src/drift.js +69 -0
- package/dist/src/editor.d.ts +25 -0
- package/dist/src/editor.js +3 -0
- package/dist/src/errors.d.ts +13 -0
- package/dist/src/errors.js +17 -0
- package/dist/src/git.d.ts +152 -0
- package/dist/src/git.js +3 -0
- package/dist/src/github.d.ts +295 -0
- package/dist/src/github.js +17 -0
- package/dist/src/graph.d.ts +360 -0
- package/dist/src/graph.js +137 -1
- package/dist/src/guard.d.ts +118 -0
- package/dist/src/guard.js +15 -0
- package/dist/src/harness-events.d.ts +8 -0
- package/dist/src/harness-events.js +1 -0
- package/dist/src/harness-profile-state.d.ts +10 -0
- package/dist/src/harness-profile-state.js +13 -0
- package/dist/src/help-catalog.d.ts +41 -0
- package/dist/src/help-catalog.js +13 -0
- package/dist/src/host.d.ts +41 -0
- package/dist/src/host.js +13 -0
- package/dist/src/identity.d.ts +44 -0
- package/dist/src/identity.js +1 -0
- package/dist/src/index.d.ts +98 -0
- package/dist/src/index.js +2605 -3752
- package/dist/src/isolation.d.ts +213 -0
- package/dist/src/isolation.js +13 -0
- package/dist/src/kernel.d.ts +200 -0
- package/dist/src/kernel.js +261 -0
- package/dist/src/keybindings.d.ts +71 -0
- package/dist/src/keybindings.js +3 -0
- package/dist/src/layout.d.ts +44 -0
- package/dist/src/layout.js +8 -0
- package/dist/src/lifecycle-capabilities.d.ts +224 -0
- package/dist/src/lifecycle-capabilities.js +45 -0
- package/dist/src/managed-repos.d.ts +339 -0
- package/dist/src/managed-repos.js +37 -0
- package/dist/src/memory.d.ts +199 -0
- package/dist/src/memory.js +15 -0
- package/dist/src/model.d.ts +13 -0
- package/dist/src/model.js +3 -58
- package/dist/src/native-toolchain.d.ts +46 -0
- package/dist/src/native-toolchain.js +13 -0
- package/dist/src/notify.d.ts +46 -0
- package/dist/src/notify.js +13 -0
- package/dist/src/orchestration.d.ts +43 -0
- package/dist/src/orchestration.js +28 -961
- package/dist/src/panel-protocol.d.ts +17 -0
- package/dist/src/panel-protocol.js +10 -0
- package/dist/src/pi-session.d.ts +113 -0
- package/dist/src/pi-session.js +1 -0
- package/dist/src/placement.d.ts +47 -0
- package/dist/src/placement.js +13 -0
- package/dist/src/planning.d.ts +64 -0
- package/dist/src/planning.js +90 -0
- package/dist/src/plugin-hooks.d.ts +51 -0
- package/dist/src/plugin-hooks.js +386 -0
- package/dist/src/plugin.d.ts +476 -0
- package/dist/src/plugin.js +346 -64
- package/dist/src/policy.d.ts +16 -0
- package/dist/src/policy.js +3 -0
- package/dist/src/product-entrypoint.d.ts +22 -0
- package/dist/src/product-entrypoint.js +13 -0
- package/dist/src/project.d.ts +71 -0
- package/dist/src/project.js +3 -0
- package/dist/src/prompt.d.ts +29 -0
- package/dist/src/prompt.js +13 -0
- package/dist/src/protocol-version.d.ts +21 -0
- package/dist/src/protocol-version.js +6 -0
- package/dist/src/provider-instructions.d.ts +41 -0
- package/dist/src/provider-instructions.js +13 -0
- package/dist/src/provider.d.ts +105 -0
- package/dist/src/provider.js +16 -835
- package/dist/src/remote-control.d.ts +93 -0
- package/dist/src/remote-control.js +26 -0
- package/dist/src/remote.d.ts +318 -0
- package/dist/src/remote.js +238 -1078
- package/dist/src/review.d.ts +18 -0
- package/dist/src/review.js +3 -0
- package/dist/src/rollups.d.ts +41 -0
- package/dist/src/rollups.js +70 -0
- package/dist/src/run-control.d.ts +164 -0
- package/dist/src/run-control.js +13 -0
- package/dist/src/run-discovery.d.ts +83 -0
- package/dist/src/run-discovery.js +13 -0
- package/dist/src/run-dispatch.d.ts +34 -0
- package/dist/src/run-dispatch.js +13 -0
- package/dist/src/run-identity.d.ts +47 -0
- package/dist/src/run-identity.js +13 -0
- package/dist/src/run-journal.d.ts +694 -0
- package/dist/src/run-journal.js +569 -0
- package/dist/src/run-queue.d.ts +36 -0
- package/dist/src/run-queue.js +13 -0
- package/dist/src/run-read-model.d.ts +200 -0
- package/dist/src/run-read-model.js +13 -0
- package/dist/src/run-record.d.ts +45 -0
- package/dist/src/run-record.js +1 -0
- package/dist/src/run-registry-backbone.d.ts +56 -0
- package/dist/src/run-registry-backbone.js +13 -0
- package/dist/src/run-session-journal.d.ts +154 -0
- package/dist/src/run-session-journal.js +87 -0
- package/dist/src/run-status.d.ts +10 -0
- package/dist/src/run-status.js +27 -0
- package/dist/src/run-timeline.d.ts +7 -0
- package/dist/src/run-timeline.js +1 -0
- package/dist/src/runtime-secrets.d.ts +10 -0
- package/dist/src/runtime-secrets.js +13 -0
- package/dist/src/runtime-task-context.d.ts +82 -0
- package/dist/src/runtime-task-context.js +1 -0
- package/dist/src/runtime.d.ts +103 -0
- package/dist/src/runtime.js +73 -906
- package/dist/src/session-asset-materializer.d.ts +35 -0
- package/dist/src/session-asset-materializer.js +13 -0
- package/dist/src/session-hook-materializer.d.ts +41 -0
- package/dist/src/session-hook-materializer.js +13 -0
- package/dist/src/setup.d.ts +154 -0
- package/dist/src/setup.js +13 -0
- package/dist/src/stage.d.ts +245 -0
- package/dist/src/stage.js +169 -0
- package/dist/src/supervisor-journal.d.ts +204 -0
- package/dist/src/supervisor-journal.js +336 -0
- package/dist/src/supervisor-loop.d.ts +40 -0
- package/dist/src/supervisor-loop.js +13 -0
- package/dist/src/task-artifacts.d.ts +53 -0
- package/dist/src/task-artifacts.js +13 -0
- package/dist/src/task-config.d.ts +22 -0
- package/dist/src/task-config.js +1 -0
- package/dist/src/task-context-renderer.d.ts +29 -0
- package/dist/src/task-context-renderer.js +13 -0
- package/dist/src/task-data.d.ts +196 -0
- package/dist/src/task-data.js +13 -0
- package/dist/src/task-graph-primitives.d.ts +47 -0
- package/dist/src/task-graph-primitives.js +1 -0
- package/dist/src/task-source.d.ts +167 -0
- package/dist/src/task-source.js +24 -0
- package/dist/src/task-state-metadata.d.ts +21 -0
- package/dist/src/task-state-metadata.js +1 -0
- package/dist/src/task-state-paths.d.ts +14 -0
- package/dist/src/task-state-paths.js +13 -0
- package/dist/src/task-state-store.d.ts +36 -0
- package/dist/src/task-state-store.js +17 -0
- package/dist/src/task-tracker-state.d.ts +101 -0
- package/dist/src/task-tracker-state.js +39 -0
- package/dist/src/terminal.d.ts +130 -0
- package/dist/src/terminal.js +3 -0
- package/dist/src/tool-materializer.d.ts +36 -0
- package/dist/src/tool-materializer.js +13 -0
- package/dist/src/tool-registry.d.ts +3 -0
- package/dist/src/tool-registry.js +58 -0
- package/dist/src/toolchain-sources.d.ts +54 -0
- package/dist/src/toolchain-sources.js +17 -0
- package/dist/src/transport-config.d.ts +161 -0
- package/dist/src/transport-config.js +15 -0
- package/dist/src/validation.d.ts +14 -0
- package/dist/src/validation.js +3 -0
- package/dist/src/workflow-journal.d.ts +125 -0
- package/dist/src/workflow-journal.js +27 -0
- package/dist/src/workspace-config.d.ts +18 -0
- package/dist/src/workspace-config.js +13 -0
- package/dist/src/workspace-service.d.ts +16 -0
- package/dist/src/workspace-service.js +13 -0
- package/dist/src/workspace.d.ts +204 -0
- package/dist/src/workspace.js +76 -911
- package/package.json +55 -4
- package/dist/src/engine.js +0 -2278
- package/dist/src/providerRuntime.js +0 -1630
- package/dist/src/rig.js +0 -2374
- package/dist/src/server.js +0 -1053
- package/dist/src/serviceFabric.js +0 -1066
- package/dist/src/ws.js +0 -2968
- /package/dist/src/{ipc.js → agent-roles.js} +0 -0
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export type RigPiSessionTransport = "http-control-ws-events";
|
|
2
|
+
export interface RigPiSessionMetadata {
|
|
3
|
+
runId: string;
|
|
4
|
+
sessionId: string;
|
|
5
|
+
daemonId: string;
|
|
6
|
+
cwd: string;
|
|
7
|
+
agentDir: string;
|
|
8
|
+
sessionDir: string;
|
|
9
|
+
transport: RigPiSessionTransport;
|
|
10
|
+
/**
|
|
11
|
+
* Absolute path of the Pi session jsonl backing this session, when the
|
|
12
|
+
* session persists to disk. Recorded on the run record so a tier-1
|
|
13
|
+
* re-dispatch (deploy-safe runs) can reopen the same session.
|
|
14
|
+
*/
|
|
15
|
+
sessionFile?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Set when the daemon reopened a previous attempt's session file instead
|
|
18
|
+
* of creating a fresh session (tier-1 session resume).
|
|
19
|
+
*/
|
|
20
|
+
resumedFromSessionFile?: string;
|
|
21
|
+
serverBasePath: string;
|
|
22
|
+
eventsPath: string;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
backend: {
|
|
26
|
+
kind: "worker-pi-sessiond";
|
|
27
|
+
version: string;
|
|
28
|
+
pid?: number;
|
|
29
|
+
commit?: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export type RigPiDaemonConnection = {
|
|
33
|
+
mode: "unix";
|
|
34
|
+
socketPath: string;
|
|
35
|
+
tokenRef: string;
|
|
36
|
+
endpointId?: string;
|
|
37
|
+
hostId?: string;
|
|
38
|
+
} | {
|
|
39
|
+
mode: "http";
|
|
40
|
+
baseUrl: string;
|
|
41
|
+
tokenRef: string;
|
|
42
|
+
endpointId?: string;
|
|
43
|
+
hostId?: string;
|
|
44
|
+
};
|
|
45
|
+
export interface RigPiSessionPrivateMetadata {
|
|
46
|
+
public: RigPiSessionMetadata;
|
|
47
|
+
daemonConnection: RigPiDaemonConnection;
|
|
48
|
+
}
|
|
49
|
+
export type RigPiControlStreamingBehavior = "steer" | "followUp";
|
|
50
|
+
export interface RigPiPromptRequest {
|
|
51
|
+
text: string;
|
|
52
|
+
streamingBehavior?: RigPiControlStreamingBehavior;
|
|
53
|
+
}
|
|
54
|
+
export interface RigPiShellRequest {
|
|
55
|
+
text: string;
|
|
56
|
+
}
|
|
57
|
+
export interface RigPiCommandRequest {
|
|
58
|
+
text: string;
|
|
59
|
+
}
|
|
60
|
+
export interface RigPiCommandResponseRequest {
|
|
61
|
+
requestId: string;
|
|
62
|
+
value?: unknown;
|
|
63
|
+
cancelled?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface RigPiExtensionUiResponseRequest {
|
|
66
|
+
requestId: string;
|
|
67
|
+
value?: unknown;
|
|
68
|
+
cancelled?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface RigPiReadyPendingResponse {
|
|
71
|
+
ready: false;
|
|
72
|
+
runId: string;
|
|
73
|
+
status?: string;
|
|
74
|
+
retryAfterMs: number;
|
|
75
|
+
}
|
|
76
|
+
export interface RigPiReadyResponse {
|
|
77
|
+
ready: true;
|
|
78
|
+
metadata: RigPiSessionMetadata;
|
|
79
|
+
}
|
|
80
|
+
export type RigPiSessionResponse = RigPiReadyPendingResponse | RigPiReadyResponse;
|
|
81
|
+
export type RigPiEventEnvelope = {
|
|
82
|
+
type: "ready";
|
|
83
|
+
metadata: RigPiSessionMetadata;
|
|
84
|
+
} | {
|
|
85
|
+
type: "pi.event";
|
|
86
|
+
sessionId: string;
|
|
87
|
+
runId?: string;
|
|
88
|
+
event: unknown;
|
|
89
|
+
} | {
|
|
90
|
+
type: "pi.ui_event";
|
|
91
|
+
sessionId: string;
|
|
92
|
+
runId?: string;
|
|
93
|
+
event: unknown;
|
|
94
|
+
} | {
|
|
95
|
+
type: "extension_ui_request";
|
|
96
|
+
sessionId: string;
|
|
97
|
+
runId?: string;
|
|
98
|
+
request: unknown;
|
|
99
|
+
} | {
|
|
100
|
+
type: "status.update";
|
|
101
|
+
sessionId: string;
|
|
102
|
+
runId?: string;
|
|
103
|
+
status: unknown;
|
|
104
|
+
} | {
|
|
105
|
+
type: "activity.update";
|
|
106
|
+
sessionId: string;
|
|
107
|
+
runId?: string;
|
|
108
|
+
activity: unknown;
|
|
109
|
+
} | {
|
|
110
|
+
type: "error";
|
|
111
|
+
message: string;
|
|
112
|
+
detail?: unknown;
|
|
113
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// @bun
|
|
@@ -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,64 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const ClarificationStatus: Schema.Literals<readonly ["open", "resolved-from-code", "resolved-by-human", "deferred"]>;
|
|
3
|
+
export type ClarificationStatus = typeof ClarificationStatus.Type;
|
|
4
|
+
export declare const OpenQuestion: Schema.Struct<{
|
|
5
|
+
readonly id: Schema.Trim;
|
|
6
|
+
readonly question: Schema.Trim;
|
|
7
|
+
readonly status: Schema.Literals<readonly ["open", "resolved-from-code", "resolved-by-human", "deferred"]>;
|
|
8
|
+
readonly resolution: Schema.NullOr<Schema.String>;
|
|
9
|
+
}>;
|
|
10
|
+
export type OpenQuestion = typeof OpenQuestion.Type;
|
|
11
|
+
export declare const UserStory: Schema.Struct<{
|
|
12
|
+
readonly id: Schema.Trim;
|
|
13
|
+
readonly title: Schema.Trim;
|
|
14
|
+
readonly priority: Schema.Int;
|
|
15
|
+
}>;
|
|
16
|
+
export type UserStory = typeof UserStory.Type;
|
|
17
|
+
export declare const FunctionalRequirement: Schema.Struct<{
|
|
18
|
+
readonly id: Schema.Trim;
|
|
19
|
+
readonly text: Schema.Trim;
|
|
20
|
+
}>;
|
|
21
|
+
export type FunctionalRequirement = typeof FunctionalRequirement.Type;
|
|
22
|
+
export declare const PlanTask: Schema.Struct<{
|
|
23
|
+
readonly localId: Schema.Trim;
|
|
24
|
+
readonly title: Schema.Trim;
|
|
25
|
+
readonly description: Schema.String;
|
|
26
|
+
readonly acceptance: Schema.$Array<Schema.String>;
|
|
27
|
+
readonly scope: Schema.$Array<Schema.Trim>;
|
|
28
|
+
readonly validationKeys: Schema.$Array<Schema.Trim>;
|
|
29
|
+
readonly dependsOn: Schema.$Array<Schema.Trim>;
|
|
30
|
+
readonly parent: Schema.NullOr<Schema.Trim>;
|
|
31
|
+
readonly parallelizable: Schema.Boolean;
|
|
32
|
+
}>;
|
|
33
|
+
export type PlanTask = typeof PlanTask.Type;
|
|
34
|
+
export declare const PlanSpec: Schema.Struct<{
|
|
35
|
+
readonly prdTitle: Schema.Trim;
|
|
36
|
+
readonly userStories: Schema.$Array<Schema.Struct<{
|
|
37
|
+
readonly id: Schema.Trim;
|
|
38
|
+
readonly title: Schema.Trim;
|
|
39
|
+
readonly priority: Schema.Int;
|
|
40
|
+
}>>;
|
|
41
|
+
readonly functionalRequirements: Schema.$Array<Schema.Struct<{
|
|
42
|
+
readonly id: Schema.Trim;
|
|
43
|
+
readonly text: Schema.Trim;
|
|
44
|
+
}>>;
|
|
45
|
+
readonly openQuestions: Schema.$Array<Schema.Struct<{
|
|
46
|
+
readonly id: Schema.Trim;
|
|
47
|
+
readonly question: Schema.Trim;
|
|
48
|
+
readonly status: Schema.Literals<readonly ["open", "resolved-from-code", "resolved-by-human", "deferred"]>;
|
|
49
|
+
readonly resolution: Schema.NullOr<Schema.String>;
|
|
50
|
+
}>>;
|
|
51
|
+
readonly tasks: Schema.$Array<Schema.Struct<{
|
|
52
|
+
readonly localId: Schema.Trim;
|
|
53
|
+
readonly title: Schema.Trim;
|
|
54
|
+
readonly description: Schema.String;
|
|
55
|
+
readonly acceptance: Schema.$Array<Schema.String>;
|
|
56
|
+
readonly scope: Schema.$Array<Schema.Trim>;
|
|
57
|
+
readonly validationKeys: Schema.$Array<Schema.Trim>;
|
|
58
|
+
readonly dependsOn: Schema.$Array<Schema.Trim>;
|
|
59
|
+
readonly parent: Schema.NullOr<Schema.Trim>;
|
|
60
|
+
readonly parallelizable: Schema.Boolean;
|
|
61
|
+
}>>;
|
|
62
|
+
readonly generatedAt: Schema.String;
|
|
63
|
+
}>;
|
|
64
|
+
export type PlanSpec = typeof PlanSpec.Type;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/contracts/src/planning.ts
|
|
3
|
+
import { Schema as Schema2 } from "effect";
|
|
4
|
+
|
|
5
|
+
// packages/contracts/src/baseSchemas.ts
|
|
6
|
+
import { Schema } from "effect";
|
|
7
|
+
var TrimmedString = Schema.Trim;
|
|
8
|
+
var TrimmedNonEmptyString = TrimmedString.check(Schema.isNonEmpty());
|
|
9
|
+
var NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
|
|
10
|
+
var PositiveInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1));
|
|
11
|
+
var IsoDateTime = Schema.String;
|
|
12
|
+
var makeEntityId = (brand) => TrimmedNonEmptyString.pipe(Schema.brand(brand));
|
|
13
|
+
var ThreadId = makeEntityId("ThreadId");
|
|
14
|
+
var ProjectId = makeEntityId("ProjectId");
|
|
15
|
+
var WorkspaceId = makeEntityId("WorkspaceId");
|
|
16
|
+
var GraphId = makeEntityId("GraphId");
|
|
17
|
+
var TaskId = makeEntityId("TaskId");
|
|
18
|
+
var RunId = makeEntityId("RunId");
|
|
19
|
+
var SafePathSegment = TrimmedNonEmptyString.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)).pipe(Schema.brand("SafePathSegment"));
|
|
20
|
+
var SafeRunId = TrimmedNonEmptyString.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/)).pipe(Schema.brand("SafeRunId"));
|
|
21
|
+
var SafeGitRefComponent = TrimmedNonEmptyString.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)).pipe(Schema.brand("SafeGitRefComponent"));
|
|
22
|
+
var EngineRuntimeId = makeEntityId("EngineRuntimeId");
|
|
23
|
+
var ConversationId = makeEntityId("ConversationId");
|
|
24
|
+
var ActionId = makeEntityId("ActionId");
|
|
25
|
+
var ArtifactId = makeEntityId("ArtifactId");
|
|
26
|
+
var WorktreeId = makeEntityId("WorktreeId");
|
|
27
|
+
var ValidationResultId = makeEntityId("ValidationResultId");
|
|
28
|
+
var ReviewResultId = makeEntityId("ReviewResultId");
|
|
29
|
+
var CommandId = makeEntityId("CommandId");
|
|
30
|
+
var EventId = makeEntityId("EventId");
|
|
31
|
+
var MessageId = makeEntityId("MessageId");
|
|
32
|
+
var TurnId = makeEntityId("TurnId");
|
|
33
|
+
var ProviderItemId = makeEntityId("ProviderItemId");
|
|
34
|
+
var RuntimeSessionId = makeEntityId("RuntimeSessionId");
|
|
35
|
+
var RuntimeItemId = makeEntityId("RuntimeItemId");
|
|
36
|
+
var RuntimeRequestId = makeEntityId("RuntimeRequestId");
|
|
37
|
+
var RuntimeTaskId = makeEntityId("RuntimeTaskId");
|
|
38
|
+
var ApprovalRequestId = makeEntityId("ApprovalRequestId");
|
|
39
|
+
var CheckpointRef = makeEntityId("CheckpointRef");
|
|
40
|
+
var RemoteEndpointId = makeEntityId("RemoteEndpointId");
|
|
41
|
+
|
|
42
|
+
// packages/contracts/src/planning.ts
|
|
43
|
+
var ClarificationStatus = Schema2.Literals([
|
|
44
|
+
"open",
|
|
45
|
+
"resolved-from-code",
|
|
46
|
+
"resolved-by-human",
|
|
47
|
+
"deferred"
|
|
48
|
+
]);
|
|
49
|
+
var OpenQuestion = Schema2.Struct({
|
|
50
|
+
id: TrimmedNonEmptyString,
|
|
51
|
+
question: TrimmedNonEmptyString,
|
|
52
|
+
status: ClarificationStatus,
|
|
53
|
+
resolution: Schema2.NullOr(Schema2.String)
|
|
54
|
+
});
|
|
55
|
+
var UserStory = Schema2.Struct({
|
|
56
|
+
id: TrimmedNonEmptyString,
|
|
57
|
+
title: TrimmedNonEmptyString,
|
|
58
|
+
priority: PositiveInt
|
|
59
|
+
});
|
|
60
|
+
var FunctionalRequirement = Schema2.Struct({
|
|
61
|
+
id: TrimmedNonEmptyString,
|
|
62
|
+
text: TrimmedNonEmptyString
|
|
63
|
+
});
|
|
64
|
+
var PlanTask = Schema2.Struct({
|
|
65
|
+
localId: TrimmedNonEmptyString,
|
|
66
|
+
title: TrimmedNonEmptyString,
|
|
67
|
+
description: Schema2.String,
|
|
68
|
+
acceptance: Schema2.Array(Schema2.String),
|
|
69
|
+
scope: Schema2.Array(TrimmedNonEmptyString),
|
|
70
|
+
validationKeys: Schema2.Array(TrimmedNonEmptyString),
|
|
71
|
+
dependsOn: Schema2.Array(TrimmedNonEmptyString),
|
|
72
|
+
parent: Schema2.NullOr(TrimmedNonEmptyString),
|
|
73
|
+
parallelizable: Schema2.Boolean
|
|
74
|
+
});
|
|
75
|
+
var PlanSpec = Schema2.Struct({
|
|
76
|
+
prdTitle: TrimmedNonEmptyString,
|
|
77
|
+
userStories: Schema2.Array(UserStory),
|
|
78
|
+
functionalRequirements: Schema2.Array(FunctionalRequirement),
|
|
79
|
+
openQuestions: Schema2.Array(OpenQuestion),
|
|
80
|
+
tasks: Schema2.Array(PlanTask),
|
|
81
|
+
generatedAt: IsoDateTime
|
|
82
|
+
});
|
|
83
|
+
export {
|
|
84
|
+
UserStory,
|
|
85
|
+
PlanTask,
|
|
86
|
+
PlanSpec,
|
|
87
|
+
OpenQuestion,
|
|
88
|
+
FunctionalRequirement,
|
|
89
|
+
ClarificationStatus
|
|
90
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** Tool input payload as delivered on the hook's stdin (`tool_input`). */
|
|
3
|
+
export declare const HookToolInput: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
4
|
+
export type HookToolInput = typeof HookToolInput.Type;
|
|
5
|
+
/**
|
|
6
|
+
* Parsed hook invocation handed to a typed hook implementation.
|
|
7
|
+
*
|
|
8
|
+
* Derived from the Claude Code hook stdin payload (see
|
|
9
|
+
* @rig/core/hook-protocol's `readHookInput`) plus the runner's resolved
|
|
10
|
+
* environment:
|
|
11
|
+
* - `event` — the lifecycle event the hook fired on
|
|
12
|
+
* - `toolName` — `tool_name` from the payload (absent for non-tool events)
|
|
13
|
+
* - `toolInput` — `tool_input` from the payload (`{}` when absent)
|
|
14
|
+
* - `filePaths` — file path candidates extracted from the tool input
|
|
15
|
+
* - `projectRoot` — resolved project root
|
|
16
|
+
* - `taskId` — current Rig task id, `""` when not running inside a task
|
|
17
|
+
*/
|
|
18
|
+
export declare const HookContext: Schema.Struct<{
|
|
19
|
+
readonly event: Schema.Literals<readonly ["PreToolUse", "PostToolUse", "UserPromptSubmit", "Stop", "SessionStart", "SessionEnd"]>;
|
|
20
|
+
readonly toolName: Schema.optional<Schema.String>;
|
|
21
|
+
readonly toolInput: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
22
|
+
readonly filePaths: Schema.$Array<Schema.String>;
|
|
23
|
+
readonly projectRoot: Schema.String;
|
|
24
|
+
readonly taskId: Schema.String;
|
|
25
|
+
}>;
|
|
26
|
+
export type HookContext = typeof HookContext.Type;
|
|
27
|
+
export declare const HookDecision: Schema.Literals<readonly ["allow", "block"]>;
|
|
28
|
+
export type HookDecision = typeof HookDecision.Type;
|
|
29
|
+
/**
|
|
30
|
+
* Result returned by a typed hook implementation.
|
|
31
|
+
*
|
|
32
|
+
* Serialized to the same stdout/exit-code protocol that
|
|
33
|
+
* @rig/core/hook-protocol's `block()` uses:
|
|
34
|
+
* - `decision: "block"` → `BLOCKED: <reason>` on stdout, non-zero exit
|
|
35
|
+
* - `decision: "allow"` → exit 0; `systemMessage` (when set) on stdout
|
|
36
|
+
*/
|
|
37
|
+
export declare const HookResult: Schema.Struct<{
|
|
38
|
+
readonly decision: Schema.Literals<readonly ["allow", "block"]>;
|
|
39
|
+
/** Why the action was blocked. Surfaced to the agent on stdout. */
|
|
40
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
41
|
+
/** Extra context printed on stdout for either decision. */
|
|
42
|
+
readonly systemMessage: Schema.optional<Schema.String>;
|
|
43
|
+
}>;
|
|
44
|
+
export type HookResult = typeof HookResult.Type;
|
|
45
|
+
/**
|
|
46
|
+
* A typed hook implementation. Registered per hook id via definePlugin's
|
|
47
|
+
* plugin object: `definePlugin(meta, { hooks: { [hookId]: impl } })`.
|
|
48
|
+
* Functions can't be represented by Schema, so this is a plain type — the
|
|
49
|
+
* referential-integrity rules are enforced by @rig/core's definePlugin.
|
|
50
|
+
*/
|
|
51
|
+
export type HookImplementation = (input: HookContext) => Promise<HookResult> | HookResult;
|