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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/index.cjs +132 -63
  2. package/dist/index.mjs +132 -63
  3. package/dist/src/blocker-classifier.d.ts +21 -0
  4. package/dist/src/blocker-classifier.js +13 -0
  5. package/dist/src/cockpit.d.ts +30 -0
  6. package/dist/src/config.d.ts +7 -5
  7. package/dist/src/config.js +3 -1
  8. package/dist/src/control-plane-types.d.ts +2 -2
  9. package/dist/src/github.d.ts +10 -0
  10. package/dist/src/guard.d.ts +7 -0
  11. package/dist/src/guard.js +10 -1
  12. package/dist/src/harness-profile-state.d.ts +10 -0
  13. package/dist/src/harness-profile-state.js +13 -0
  14. package/dist/src/index.d.ts +14 -0
  15. package/dist/src/index.js +132 -63
  16. package/dist/src/layout.d.ts +0 -5
  17. package/dist/src/layout.js +1 -3
  18. package/dist/src/lifecycle-capabilities.d.ts +40 -2
  19. package/dist/src/lifecycle-capabilities.js +12 -0
  20. package/dist/src/managed-repos.d.ts +103 -3
  21. package/dist/src/managed-repos.js +4 -0
  22. package/dist/src/model.d.ts +11 -75
  23. package/dist/src/model.js +3 -58
  24. package/dist/src/placement.d.ts +47 -0
  25. package/dist/src/placement.js +13 -0
  26. package/dist/src/product-entrypoint.d.ts +22 -0
  27. package/dist/src/product-entrypoint.js +13 -0
  28. package/dist/src/provider.d.ts +14 -14
  29. package/dist/src/provider.js +12 -11
  30. package/dist/src/remote-control.d.ts +93 -0
  31. package/dist/src/remote-control.js +26 -0
  32. package/dist/src/run-control.d.ts +164 -0
  33. package/dist/src/run-control.js +13 -0
  34. package/dist/src/run-discovery.d.ts +5 -1
  35. package/dist/src/run-queue.d.ts +36 -0
  36. package/dist/src/run-queue.js +13 -0
  37. package/dist/src/run-read-model.d.ts +33 -88
  38. package/dist/src/run-session-journal.d.ts +86 -1
  39. package/dist/src/run-session-journal.js +9 -0
  40. package/dist/src/runtime-secrets.d.ts +10 -0
  41. package/dist/src/runtime-secrets.js +13 -0
  42. package/dist/src/session-hook-materializer.d.ts +41 -0
  43. package/dist/src/session-hook-materializer.js +13 -0
  44. package/dist/src/setup.d.ts +67 -1
  45. package/dist/src/supervisor-journal.d.ts +9 -9
  46. package/dist/src/supervisor-journal.js +2 -0
  47. package/dist/src/supervisor-loop.d.ts +40 -0
  48. package/dist/src/supervisor-loop.js +13 -0
  49. package/dist/src/task-artifacts.d.ts +20 -0
  50. package/dist/src/task-config.d.ts +22 -0
  51. package/dist/src/task-config.js +1 -0
  52. package/dist/src/task-data.d.ts +6 -8
  53. package/dist/src/task-source.d.ts +58 -27
  54. package/dist/src/task-source.js +9 -1
  55. package/dist/src/task-state-paths.d.ts +14 -0
  56. package/dist/src/task-state-paths.js +13 -0
  57. package/dist/src/task-state-store.d.ts +21 -1
  58. package/dist/src/task-state-store.js +4 -0
  59. package/dist/src/task-tracker-state.d.ts +5 -10
  60. package/dist/src/toolchain-sources.d.ts +1 -1
  61. package/dist/src/transport-config.d.ts +161 -0
  62. package/dist/src/transport-config.js +15 -0
  63. package/dist/src/workflow-journal.d.ts +33 -0
  64. package/dist/src/workflow-journal.js +9 -0
  65. package/dist/src/workspace-service.d.ts +16 -0
  66. package/dist/src/workspace-service.js +13 -0
  67. package/package.json +5 -1
@@ -1,4 +1,9 @@
1
1
  // @bun
2
+ // packages/contracts/src/capability-id.ts
3
+ function makeCapabilityId(id) {
4
+ return id;
5
+ }
6
+
2
7
  // packages/contracts/src/run-session-journal.ts
3
8
  var RIG_RUN_STATUS_CHANGED = "rig.run.status-changed";
4
9
  var RIG_RUN_RECORD_PATCH = "rig.run.record-patch";
@@ -52,8 +57,12 @@ var TYPE_FOR_CUSTOM = {
52
57
  [RIG_RUN_PIPELINE_RESOLVED]: "pipeline-resolved",
53
58
  [RIG_RUN_STAGE_OUTCOME]: "stage-outcome"
54
59
  };
60
+ var RUN_SESSION_JOURNAL_CAPABILITY_ID = "rig.runs.session-journal";
61
+ var RUN_SESSION_JOURNAL = makeCapabilityId(RUN_SESSION_JOURNAL_CAPABILITY_ID);
55
62
  export {
56
63
  TYPE_FOR_CUSTOM,
64
+ RUN_SESSION_JOURNAL_CAPABILITY_ID,
65
+ RUN_SESSION_JOURNAL,
57
66
  RIG_STOP_SENTINEL_END,
58
67
  RIG_STOP_SENTINEL,
59
68
  RIG_RUN_TIMELINE_ENTRY,
@@ -0,0 +1,10 @@
1
+ import type { CapabilityId } from "./capability-id";
2
+ export type RuntimeSecretKey = "ANTHROPIC_API_KEY" | "OPENAI_API_KEY" | "OPENROUTER_API_KEY" | "AI_REVIEW_MODE" | "AI_REVIEW_PROVIDER" | "GREPTILE_API_BASE" | "GREPTILE_REMOTE" | "GREPTILE_REPOSITORY" | "GREPTILE_CONTEXT_BRANCH" | "GREPTILE_DEFAULT_BRANCH" | "GREPTILE_API_KEY" | "GREPTILE_GITHUB_TOKEN" | "GREPTILE_POLL_ATTEMPTS" | "GREPTILE_POLL_INTERVAL_MS" | "GH_TOKEN" | "GITHUB_TOKEN" | "GITHUB_SSH_KEY" | "AWS_ACCESS_KEY_ID" | "AWS_SECRET_ACCESS_KEY" | "AWS_REGION" | "LINEAR_API_KEY" | "LINEAR_WEBHOOK_SECRET";
3
+ export type RuntimeSecrets = Partial<Record<RuntimeSecretKey, string>>;
4
+ export interface RuntimeSecretsService {
5
+ resolveRuntimeSecrets(env: Record<string, string | undefined>, baked?: RuntimeSecrets): RuntimeSecrets;
6
+ loadDotEnvSecrets(projectRoot: string, env?: Record<string, string | undefined>): RuntimeSecrets;
7
+ secretDefinesFromEnv(env?: Record<string, string | undefined>, projectRoot?: string): Record<string, string>;
8
+ }
9
+ export declare const RUNTIME_SECRETS_CAPABILITY_ID = "provider.runtime-secrets";
10
+ export declare const RUNTIME_SECRETS: CapabilityId<RuntimeSecretsService>;
@@ -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/runtime-secrets.ts
8
+ var RUNTIME_SECRETS_CAPABILITY_ID = "provider.runtime-secrets";
9
+ var RUNTIME_SECRETS = makeCapabilityId(RUNTIME_SECRETS_CAPABILITY_ID);
10
+ export {
11
+ RUNTIME_SECRETS_CAPABILITY_ID,
12
+ RUNTIME_SECRETS
13
+ };
@@ -0,0 +1,41 @@
1
+ import type { CapabilityId } from "./capability-id";
2
+ import type { HookEvent, HookRegistration } from "./plugin";
3
+ /** Stable id string for provider/runtime-owned session hook materialization. */
4
+ export declare const SESSION_HOOK_MATERIALIZER_CAPABILITY_ID = "provider.session-hook-materializer";
5
+ /**
6
+ * A plugin hook contribution prepared for the active session host.
7
+ *
8
+ * `typed` means the hook has a runtime implementation attached to the authored
9
+ * plugin object. Concrete materializers decide how their session host invokes
10
+ * that implementation; metadata-only hooks (no command and not typed) can be
11
+ * skipped by implementations.
12
+ */
13
+ export interface PluginHookEntry {
14
+ readonly pluginName: string;
15
+ readonly hook: HookRegistration;
16
+ readonly typed?: boolean;
17
+ }
18
+ /** Alias naming the entries by the capability they are handed to. */
19
+ export type SessionHookEntry = PluginHookEntry;
20
+ /** Provider-owned materialization result; adapter ids are intentionally open. */
21
+ export type SessionHookMaterializerResult = {
22
+ readonly adapterId: string;
23
+ readonly status: "materialized";
24
+ readonly path?: string;
25
+ readonly events?: readonly HookEvent[];
26
+ } | {
27
+ readonly adapterId: string;
28
+ readonly status: "skipped";
29
+ readonly reason: string;
30
+ };
31
+ /**
32
+ * Materializes plugin-contributed hooks into whatever session host is active
33
+ * (Claude Code settings, Pi/OMP session integration, or another provider-owned
34
+ * substrate). The floor runtime resolves this capability and invokes it; it
35
+ * does not know adapter names, settings paths, or provider/session policy.
36
+ */
37
+ export interface SessionHookMaterializerService {
38
+ materializeSessionHooks(projectRoot: string, entries: readonly PluginHookEntry[]): Promise<readonly SessionHookMaterializerResult[]> | readonly SessionHookMaterializerResult[];
39
+ }
40
+ /** Branded capability id for the session-hook materializer service. */
41
+ export declare const SESSION_HOOK_MATERIALIZER: CapabilityId<SessionHookMaterializerService>;
@@ -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/session-hook-materializer.ts
8
+ var SESSION_HOOK_MATERIALIZER_CAPABILITY_ID = "provider.session-hook-materializer";
9
+ var SESSION_HOOK_MATERIALIZER = makeCapabilityId(SESSION_HOOK_MATERIALIZER_CAPABILITY_ID);
10
+ export {
11
+ SESSION_HOOK_MATERIALIZER_CAPABILITY_ID,
12
+ SESSION_HOOK_MATERIALIZER
13
+ };
@@ -8,7 +8,7 @@
8
8
  * function-laden deps (those are the impl's concern, not the cross-plugin seam).
9
9
  */
10
10
  import type { CapabilityId } from "./capability-id";
11
- import type { GitHubAuthStatus } from "./github";
11
+ import type { GitHubAuthStatus, GitHubProjectStatusField, GitHubProjectSummary } from "./github";
12
12
  /** Capability id the init/setup plugin registers its setup runner under. */
13
13
  export declare const PROJECT_SETUP_CAPABILITY_ID = "cap:project-setup";
14
14
  /**
@@ -34,6 +34,66 @@ export type ProjectSetupInput = {
34
34
  readonly githubToken?: string | null;
35
35
  readonly importGhToken?: boolean;
36
36
  };
37
+ export type ProjectInitAuthMethod = "gh" | "token" | "device" | "skip";
38
+ export type ProjectInitTaskSource = {
39
+ readonly kind: "github-issues";
40
+ readonly owner: string;
41
+ readonly repo: string;
42
+ readonly assignee?: string | undefined;
43
+ } | {
44
+ readonly kind: "files";
45
+ readonly path: string;
46
+ };
47
+ export type ProjectInitInput = {
48
+ readonly projectRoot: string;
49
+ readonly demo?: boolean | undefined;
50
+ readonly repoSlug?: string | undefined;
51
+ readonly taskSource?: ProjectInitTaskSource | undefined;
52
+ readonly githubToken?: string | undefined;
53
+ readonly githubAuthMethod?: ProjectInitAuthMethod | undefined;
54
+ readonly githubProject?: "off" | string | undefined;
55
+ readonly githubProjectStatusField?: string | undefined;
56
+ readonly githubProjectStatuses?: Readonly<Record<string, string>> | undefined;
57
+ readonly yes?: boolean | undefined;
58
+ readonly repair?: boolean | undefined;
59
+ readonly privateStateOnly?: boolean | undefined;
60
+ readonly server?: "local" | "remote" | undefined;
61
+ readonly remoteAlias?: string | undefined;
62
+ readonly remoteHost?: string | undefined;
63
+ readonly remotePort?: number | undefined;
64
+ readonly remoteCheckout?: string | undefined;
65
+ };
66
+ export type ProjectInitResult = {
67
+ readonly mode: "control-plane" | "local-files" | "demo" | "task-source";
68
+ readonly projectRoot: string;
69
+ readonly messages: readonly string[];
70
+ readonly details: Record<string, unknown>;
71
+ };
72
+ export type ProjectInitGitHubProjectsInput = {
73
+ readonly projectRoot: string;
74
+ readonly owner: string;
75
+ readonly token?: string | null | undefined;
76
+ };
77
+ export type ProjectInitGitHubProjectsResult = {
78
+ readonly ok: true;
79
+ readonly projects: readonly GitHubProjectSummary[];
80
+ } | {
81
+ readonly ok: false;
82
+ readonly error: string;
83
+ readonly projects: readonly [];
84
+ };
85
+ export type ProjectInitProjectStatusFieldInput = {
86
+ readonly projectRoot: string;
87
+ readonly projectId: string;
88
+ readonly token?: string | null | undefined;
89
+ };
90
+ export type ProjectInitProjectStatusFieldResult = {
91
+ readonly ok: true;
92
+ readonly field: GitHubProjectStatusField;
93
+ } | {
94
+ readonly ok: false;
95
+ readonly error: string;
96
+ };
37
97
  export type ProjectRepoSlug = {
38
98
  readonly owner: string;
39
99
  readonly repo: string;
@@ -79,10 +139,16 @@ export type ProjectSetupResult = {
79
139
  /** The cohesive project-setup operation the CLI surface depends on. Async methods do IO. */
80
140
  export interface ProjectSetupService {
81
141
  parseRepoSlug(value: string): ProjectRepoSlug;
142
+ detectOriginRepoSlug(input: {
143
+ readonly projectRoot: string;
144
+ }): string | null;
82
145
  detectStartupStatus(input: {
83
146
  readonly projectRoot: string;
84
147
  }): Promise<RigSetupStatus>;
85
148
  runSetup(input: ProjectSetupInput): Promise<ProjectSetupResult>;
149
+ listGitHubProjectsForInit(input: ProjectInitGitHubProjectsInput): Promise<ProjectInitGitHubProjectsResult>;
150
+ getGitHubProjectStatusFieldForInit(input: ProjectInitProjectStatusFieldInput): Promise<ProjectInitProjectStatusFieldResult>;
151
+ runInit(input: ProjectInitInput): Promise<ProjectInitResult>;
86
152
  }
87
153
  /** Typed capability id; string value is {@link PROJECT_SETUP_CAPABILITY_ID}. */
88
154
  export declare const PROJECT_SETUP: CapabilityId<ProjectSetupService>;
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- export declare const SupervisorStopReason: Schema.Literals<readonly ["all-done", "all-human-blocked", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>;
2
+ export declare const SupervisorStopReason: Schema.Literals<readonly ["all-done", "all-human-blocked", "blocked", "work-pending", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>;
3
3
  export type SupervisorStopReason = typeof SupervisorStopReason.Type;
4
4
  export declare const SupervisorSelectionPolicy: Schema.Literals<readonly ["rank", "max-unblock", "blocking-only"]>;
5
5
  export type SupervisorSelectionPolicy = typeof SupervisorSelectionPolicy.Type;
@@ -85,13 +85,13 @@ export type SupervisorSkippedEvent = typeof SupervisorSkippedEvent.Type;
85
85
  export declare const SupervisorIdleEvent: Schema.Struct<{
86
86
  readonly kind: Schema.Literal<"supervisor.idle">;
87
87
  readonly at: Schema.String;
88
- readonly reason: Schema.Literals<readonly ["all-done", "all-human-blocked", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>;
88
+ readonly reason: Schema.Literals<readonly ["all-done", "all-human-blocked", "blocked", "work-pending", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>;
89
89
  }>;
90
90
  export type SupervisorIdleEvent = typeof SupervisorIdleEvent.Type;
91
91
  export declare const SupervisorStoppedEvent: Schema.Struct<{
92
92
  readonly kind: Schema.Literal<"supervisor.stopped">;
93
93
  readonly at: Schema.String;
94
- readonly reason: Schema.Literals<readonly ["all-done", "all-human-blocked", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>;
94
+ readonly reason: Schema.Literals<readonly ["all-done", "all-human-blocked", "blocked", "work-pending", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>;
95
95
  }>;
96
96
  export type SupervisorStoppedEvent = typeof SupervisorStoppedEvent.Type;
97
97
  export declare const SupervisorFinishedEvent: Schema.Struct<{
@@ -101,7 +101,7 @@ export declare const SupervisorFinishedEvent: Schema.Struct<{
101
101
  readonly succeeded: Schema.Int;
102
102
  readonly failed: Schema.Int;
103
103
  readonly skipped: Schema.optional<Schema.Int>;
104
- readonly idleReason: Schema.NullOr<Schema.Literals<readonly ["all-done", "all-human-blocked", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>>;
104
+ readonly idleReason: Schema.NullOr<Schema.Literals<readonly ["all-done", "all-human-blocked", "blocked", "work-pending", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>>;
105
105
  }>;
106
106
  export type SupervisorFinishedEvent = typeof SupervisorFinishedEvent.Type;
107
107
  export declare const SupervisorEvent: Schema.Union<readonly [Schema.Struct<{
@@ -158,11 +158,11 @@ export declare const SupervisorEvent: Schema.Union<readonly [Schema.Struct<{
158
158
  }>, Schema.Struct<{
159
159
  readonly kind: Schema.Literal<"supervisor.idle">;
160
160
  readonly at: Schema.String;
161
- readonly reason: Schema.Literals<readonly ["all-done", "all-human-blocked", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>;
161
+ readonly reason: Schema.Literals<readonly ["all-done", "all-human-blocked", "blocked", "work-pending", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>;
162
162
  }>, Schema.Struct<{
163
163
  readonly kind: Schema.Literal<"supervisor.stopped">;
164
164
  readonly at: Schema.String;
165
- readonly reason: Schema.Literals<readonly ["all-done", "all-human-blocked", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>;
165
+ readonly reason: Schema.Literals<readonly ["all-done", "all-human-blocked", "blocked", "work-pending", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>;
166
166
  }>, Schema.Struct<{
167
167
  readonly kind: Schema.Literal<"supervisor.finished">;
168
168
  readonly at: Schema.String;
@@ -170,7 +170,7 @@ export declare const SupervisorEvent: Schema.Union<readonly [Schema.Struct<{
170
170
  readonly succeeded: Schema.Int;
171
171
  readonly failed: Schema.Int;
172
172
  readonly skipped: Schema.optional<Schema.Int>;
173
- readonly idleReason: Schema.NullOr<Schema.Literals<readonly ["all-done", "all-human-blocked", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>>;
173
+ readonly idleReason: Schema.NullOr<Schema.Literals<readonly ["all-done", "all-human-blocked", "blocked", "work-pending", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>>;
174
174
  }>]>;
175
175
  export type SupervisorEvent = typeof SupervisorEvent.Type;
176
176
  export declare const SupervisorProjection: Schema.Struct<{
@@ -186,8 +186,8 @@ export declare const SupervisorProjection: Schema.Struct<{
186
186
  readonly plannedOrder: Schema.$Array<Schema.brand<Schema.Trim, "TaskId">>;
187
187
  readonly selectionPolicy: Schema.NullOr<Schema.Literals<readonly ["rank", "max-unblock", "blocking-only"]>>;
188
188
  readonly concurrency: Schema.NullOr<Schema.Int>;
189
- readonly idleReason: Schema.NullOr<Schema.Literals<readonly ["all-done", "all-human-blocked", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>>;
190
- readonly stopReason: Schema.NullOr<Schema.Literals<readonly ["all-done", "all-human-blocked", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>>;
189
+ readonly idleReason: Schema.NullOr<Schema.Literals<readonly ["all-done", "all-human-blocked", "blocked", "work-pending", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>>;
190
+ readonly stopReason: Schema.NullOr<Schema.Literals<readonly ["all-done", "all-human-blocked", "blocked", "work-pending", "max-tasks", "budget", "judge-stop", "operator-stop", "source-error"]>>;
191
191
  readonly closures: Schema.$Array<Schema.Struct<{
192
192
  readonly taskId: Schema.brand<Schema.Trim, "TaskId">;
193
193
  readonly runId: Schema.brand<Schema.Trim, "RunId">;
@@ -201,6 +201,8 @@ var WorktreeSummary = Schema3.Struct({
201
201
  var SupervisorStopReason = Schema4.Literals([
202
202
  "all-done",
203
203
  "all-human-blocked",
204
+ "blocked",
205
+ "work-pending",
204
206
  "max-tasks",
205
207
  "budget",
206
208
  "judge-stop",
@@ -0,0 +1,40 @@
1
+ /**
2
+ * supervisor-loop.ts — typed service boundary for autonomous supervisor control.
3
+ *
4
+ * The supervisor plugin owns loop orchestration. Its implementation resolves the
5
+ * scheduler RUN_QUEUE, run read-model, and transport dispatch capabilities rather
6
+ * than making CLI surfaces assemble those cross-package decisions.
7
+ */
8
+ import type { CapabilityId } from "./capability-id";
9
+ import type { SupervisorEvent, SupervisorProjection, SupervisorSelectionPolicy } from "./supervisor-journal";
10
+ export interface SupervisorLoopRunInput {
11
+ readonly projectRoot: string;
12
+ readonly maxTasks?: number;
13
+ readonly concurrency?: number;
14
+ readonly selectionPolicy?: SupervisorSelectionPolicy;
15
+ readonly candidateTaskIds?: Iterable<string>;
16
+ readonly excludeTaskIds?: Iterable<string>;
17
+ readonly dryRun?: boolean;
18
+ readonly model?: string | null;
19
+ readonly force?: boolean;
20
+ readonly timeoutMs?: number;
21
+ }
22
+ export interface SupervisorLoopUnblockInput {
23
+ readonly projectRoot: string;
24
+ readonly taskId?: string | null;
25
+ readonly dryRun?: boolean;
26
+ readonly timeoutMs?: number;
27
+ }
28
+ export interface SupervisorLoopResult {
29
+ readonly ok: boolean;
30
+ readonly dryRun: boolean;
31
+ readonly plannedOrder: readonly string[];
32
+ readonly events: readonly SupervisorEvent[];
33
+ readonly projection: SupervisorProjection;
34
+ }
35
+ export interface SupervisorLoopService {
36
+ readonly runLoop: (input: SupervisorLoopRunInput) => Promise<SupervisorLoopResult>;
37
+ readonly unblock: (input: SupervisorLoopUnblockInput) => Promise<SupervisorLoopResult>;
38
+ }
39
+ export declare const SUPERVISOR_LOOP_CAPABILITY_ID = "rig.supervisor.loop";
40
+ export declare const SUPERVISOR_LOOP: CapabilityId<SupervisorLoopService>;
@@ -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/supervisor-loop.ts
8
+ var SUPERVISOR_LOOP_CAPABILITY_ID = "rig.supervisor.loop";
9
+ var SUPERVISOR_LOOP = makeCapabilityId(SUPERVISOR_LOOP_CAPABILITY_ID);
10
+ export {
11
+ SUPERVISOR_LOOP_CAPABILITY_ID,
12
+ SUPERVISOR_LOOP
13
+ };
@@ -22,12 +22,32 @@ export type TaskArtifactWriteResult = {
22
22
  readonly path: string;
23
23
  readonly sizeBytes: number;
24
24
  };
25
+ export type TaskDecisionAppendInput = TaskArtifactRef & {
26
+ readonly text: string;
27
+ readonly timestamp?: string;
28
+ };
29
+ export type TaskDecisionAppendResult = {
30
+ readonly taskId: string;
31
+ readonly path: string;
32
+ readonly message: string;
33
+ };
34
+ export type TaskCompletionArtifactsPrepareInput = TaskArtifactRef & {
35
+ readonly changedFiles: readonly string[];
36
+ readonly completedAt?: string;
37
+ };
38
+ export type TaskCompletionArtifactsPrepareResult = {
39
+ readonly taskId: string;
40
+ readonly artifactDir: string;
41
+ readonly message: string;
42
+ };
25
43
  /** Task artifact directory/list/read/write vocabulary. */
26
44
  export interface TaskArtifactsService {
27
45
  artifactDir(input: TaskArtifactRef): string;
28
46
  listArtifacts(input: TaskArtifactRef): Promise<readonly TaskArtifactListEntry[]>;
29
47
  readArtifact(input: TaskArtifactReadInput): Promise<TaskArtifactReadResult>;
30
48
  writeArtifact(input: TaskArtifactWriteInput): Promise<TaskArtifactWriteResult>;
49
+ appendDecision(input: TaskDecisionAppendInput): Promise<TaskDecisionAppendResult>;
50
+ prepareCompletionArtifacts(input: TaskCompletionArtifactsPrepareInput): Promise<TaskCompletionArtifactsPrepareResult>;
31
51
  }
32
52
  export declare const TASK_ARTIFACTS_CAPABILITY_ID = "task-state.artifacts";
33
53
  export declare const TASK_ARTIFACTS: CapabilityId<TaskArtifactsService>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * task-config.ts - floor-neutral local task config entry vocabulary.
3
+ *
4
+ * The shape is shared by task-state/task-io compatibility paths, but read,
5
+ * write, normalization, and source materialization policy are owned by plugins.
6
+ */
7
+ import type { TaskBrowserConfig } from "./browser";
8
+ export type TaskConfigEntry = {
9
+ title?: string;
10
+ status?: string;
11
+ role?: string;
12
+ description?: string;
13
+ acceptance_criteria?: string;
14
+ scope?: string[];
15
+ validation?: string[];
16
+ browser?: TaskBrowserConfig;
17
+ repo_pins?: Record<string, string>;
18
+ criticality?: "core" | "high" | "normal";
19
+ queue_weight?: number;
20
+ creates_repo?: boolean;
21
+ auto_synced?: boolean;
22
+ };
@@ -0,0 +1 @@
1
+ // @bun
@@ -26,7 +26,8 @@
26
26
  * Pure: types + one branded legacy id, no behaviour.
27
27
  */
28
28
  import type { CapabilityId } from "./capability-id";
29
- import type { TaskConfigEntry, TaskRecord, RegisteredTaskSource, TaskSourceUpdate } from "./task-source";
29
+ import type { TaskConfigEntry } from "./task-config";
30
+ import type { TaskRecord, RegisteredTaskSource, TaskSourceUpdate } from "./task-source";
30
31
  import type { TaskRecordReader } from "./isolation";
31
32
  import type { CanonicalTaskLifecycleStatus, TaskStateMetadataEnvelope } from "./task-state-metadata";
32
33
  /** Result of a bounded artifact-file read (preview + truncation metadata). */
@@ -88,7 +89,6 @@ export type ReadSyncedTrackerOptions = {
88
89
  export type SourceAwareTaskConfigReadOptions = {
89
90
  readonly configPath?: string;
90
91
  readonly ghBinary?: string;
91
- readonly allowLocalTaskConfigStatusFallback?: boolean;
92
92
  };
93
93
  /** Result of resolving a single task through the configured task source. */
94
94
  export type TaskSourceTaskReadResult = {
@@ -112,14 +112,13 @@ export type SourceTaskIdentity = {
112
112
  sourceIssueId?: unknown;
113
113
  source_issue_id?: unknown;
114
114
  };
115
- /** Result of pushing a task lifecycle update through the configured source. */
116
- export type TaskSourceLifecycleUpdateResult = {
115
+ /** Result of pushing an explicit source writeback through the configured source. */
116
+ export type TaskSourceWritebackResult = {
117
117
  taskId: string;
118
118
  updated: boolean;
119
- source: "plugin" | "compat" | "none" | "server";
119
+ source: "plugin" | "none";
120
120
  sourceKind: string | null;
121
121
  status: unknown;
122
- projectSync?: unknown;
123
122
  };
124
123
  /** Context for building a plugin-backed task-record reader. */
125
124
  export type PluginTaskRecordReaderContext = {
@@ -179,14 +178,13 @@ export interface TaskDataService {
179
178
  taskId: string;
180
179
  sourceTask?: SourceTaskIdentity | null;
181
180
  update: TaskSourceUpdate;
182
- }): Promise<TaskSourceLifecycleUpdateResult>;
181
+ }): Promise<TaskSourceWritebackResult>;
183
182
  createLegacyTaskConfigRecordReader(projectRoot: string, options?: {
184
183
  configPath?: string;
185
184
  }): TaskRecordReader;
186
185
  createSourceAwareTaskConfigRecordReader(projectRoot: string, options?: SourceAwareTaskConfigReadOptions): TaskRecordReader;
187
186
  createPluginTaskRecordReader(context: PluginTaskRecordReaderContext, options: PluginTaskRecordReaderOptions): TaskRecordReader;
188
187
  readSyncedTrackerState(projectRoot: string, deps?: unknown, options?: ReadSyncedTrackerOptions): SyncedTrackerSnapshot;
189
- listReadyTaskIdsFromTracker(snapshot: SyncedTrackerSnapshot): string[];
190
188
  normalizeTaskLifecycleStatus(status: unknown): CanonicalTaskLifecycleStatus | null;
191
189
  }
192
190
  /** Stable legacy id string for the TASK_DATA compatibility facade. */
@@ -1,26 +1,7 @@
1
1
  import type { CapabilityId } from "./capability-id";
2
2
  import type { TaskSourceRegistration } from "./plugin";
3
- import type { TaskBrowserConfig } from "./browser";
4
- /**
5
- * A single entry in the on-disk task-config map (`.rig/task-config.json`).
6
- * Floor-neutral DATA shape. Read/normalize/local-state policy is intentionally
7
- * outside this contract and belongs to the plugin that provides that domain.
8
- */
9
- export type TaskConfigEntry = {
10
- title?: string;
11
- status?: string;
12
- role?: string;
13
- description?: string;
14
- acceptance_criteria?: string;
15
- scope?: string[];
16
- validation?: string[];
17
- browser?: TaskBrowserConfig;
18
- repo_pins?: Record<string, string>;
19
- criticality?: "core" | "high" | "normal";
20
- queue_weight?: number;
21
- creates_repo?: boolean;
22
- auto_synced?: boolean;
23
- };
3
+ import type { TaskConfigEntry } from "./task-config";
4
+ export type { TaskConfigEntry } from "./task-config";
24
5
  /**
25
6
  * A single task record returned by a task source adapter.
26
7
  * Open-ended to allow adapters to include source-specific fields.
@@ -70,8 +51,6 @@ export interface TaskSourceProjectedUpdate {
70
51
  }
71
52
  /** Generic provider-owned source update payload. */
72
53
  export interface TaskSourceUpdate extends TaskSourceProjectedUpdate {
73
- /** @deprecated Prefer explicit projected update fields for source writeback. */
74
- status?: TaskRecord["status"];
75
54
  title?: string;
76
55
  body?: string;
77
56
  comment?: string;
@@ -92,12 +71,16 @@ export type TaskSourceUpdateRequest = {
92
71
  readonly sourceKind?: string | null;
93
72
  readonly update: TaskSourceUpdate;
94
73
  };
74
+ export type TaskSourceUpdateWriteResult = "applied" | "not-configured" | "unsupported";
95
75
  export type TaskSourceUpdateResult = {
96
76
  readonly taskId: string;
97
77
  readonly updated: boolean;
78
+ /** Authoritative source write outcome. `updated` is retained as a boolean compatibility projection. */
79
+ readonly writeResult: TaskSourceUpdateWriteResult;
98
80
  readonly sourceId?: string | null;
99
81
  readonly sourceKind?: string | null;
100
- readonly result?: unknown;
82
+ /** Best-effort status read back from the source after the write; absent/null when the adapter cannot read back. */
83
+ readonly sourceStatus?: unknown;
101
84
  };
102
85
  /**
103
86
  * Generic source-adapter writeback port. The legacy id string is retained, but
@@ -108,12 +91,37 @@ export type TaskSourceUpdateResult = {
108
91
  export interface TaskSourceUpdateService {
109
92
  updateTask(input: TaskSourceUpdateRequest): Promise<TaskSourceUpdateResult>;
110
93
  }
94
+ /**
95
+ * Synchronous projection seam for task-source-owned task config materialization.
96
+ *
97
+ * The service owns source adapter/config-path semantics (for example files-backed
98
+ * task directories and source task-config locations) while legacy sync state-store
99
+ * callers keep the existing `TaskStateStoreService` surface.
100
+ */
101
+ export interface TaskSourceConfigProjectionService {
102
+ /** Resolve the sync TaskStateStoreService readTaskConfig path, including source-owned fallback paths. */
103
+ resolveTaskConfigPath(projectRoot: string): string;
104
+ readSourceTaskConfig(projectRoot: string): Record<string, TaskConfigEntry>;
105
+ writeSourceTaskConfig(projectRoot: string, entries: Record<string, TaskConfigEntry>): void;
106
+ readSourceValidationDescriptions(projectRoot: string): Record<string, string>;
107
+ }
108
+ export declare const TASK_SOURCE_CONFIG_PROJECTION_CAPABILITY_ID = "task-sources.config-projection";
109
+ export declare const TASK_SOURCE_CONFIG_PROJECTION: CapabilityId<TaskSourceConfigProjectionService>;
110
+ export type TaskTerminalStateInput = {
111
+ readonly projectRoot: string;
112
+ readonly taskId: string;
113
+ };
114
+ /** Source-owned task terminal-state projection, including source config and Beads fallback. */
115
+ export interface TaskSourceTerminalStateService {
116
+ isTaskTerminal(input: TaskTerminalStateInput): Promise<boolean>;
117
+ }
118
+ export declare const TASK_SOURCE_TERMINAL_STATE_CAPABILITY_ID = "task-sources.terminal-state";
119
+ export declare const TASK_SOURCE_TERMINAL_STATE: CapabilityId<TaskSourceTerminalStateService>;
111
120
  export declare const TASK_SOURCE_UPDATE_CAPABILITY_ID = "task-sources.update";
112
121
  export declare const TASK_SOURCE_UPDATE: CapabilityId<TaskSourceUpdateService>;
113
122
  export interface RegisteredTaskSource extends TaskSourceRegistration {
114
123
  list(): Promise<readonly TaskRecord[]>;
115
124
  get?(id: string): Promise<TaskRecord | undefined>;
116
- updateStatus?(id: string, status: TaskRecord["status"]): Promise<void>;
117
125
  updateTask?(id: string, update: TaskSourceUpdate): Promise<void>;
118
126
  create?(input: TaskSourceCreateInput): Promise<TaskSourceCreateResult>;
119
127
  }
@@ -122,15 +130,38 @@ export type TaskIoCreateResult = {
122
130
  readonly source: string;
123
131
  readonly result: unknown;
124
132
  };
133
+ export type TaskFactRecordInput = {
134
+ readonly type: "decision" | "failure";
135
+ readonly text: string;
136
+ readonly taskId?: string;
137
+ };
138
+ export type TaskFactRecordResult = {
139
+ readonly taskId: string;
140
+ readonly message: string;
141
+ };
142
+ export type TaskArtifactsPrepareResult = {
143
+ readonly taskId: string;
144
+ readonly artifactDir: string;
145
+ readonly message: string;
146
+ };
147
+ export type TaskIoStateFilter = "open" | "closed";
148
+ export interface TaskIoListFilters {
149
+ readonly assignee?: string;
150
+ readonly state?: TaskIoStateFilter;
151
+ readonly limit?: number;
152
+ readonly search?: string;
153
+ }
125
154
  /**
126
155
  * Normalized task IO projection seam. The historical id string is retained for
127
156
  * compatibility, but this capability is owned/provided by @rig/task-io-plugin;
128
157
  * source-adapter plugins should contribute adapters and source writeback only.
129
158
  */
130
159
  export interface TaskIoService {
131
- listTasks(projectRoot: string): Promise<readonly RigTask[]>;
160
+ listTasks(projectRoot: string, filters?: TaskIoListFilters): Promise<readonly RigTask[]>;
132
161
  getTask(projectRoot: string, taskId: string): Promise<RigTask | null>;
133
162
  createTask(projectRoot: string, task: Record<string, unknown>): Promise<TaskIoCreateResult>;
163
+ recordTaskFact(projectRoot: string, input: TaskFactRecordInput): Promise<TaskFactRecordResult>;
164
+ prepareTaskArtifacts(projectRoot: string, taskId?: string): Promise<TaskArtifactsPrepareResult>;
134
165
  }
135
- export declare const TASK_IO_SERVICE_CAPABILITY_ID = "task-sources.task-io";
166
+ export declare const TASK_IO_SERVICE_CAPABILITY_ID = "rig.tasks.io";
136
167
  export declare const TASK_IO_SERVICE_CAPABILITY: CapabilityId<TaskIoService>;
@@ -5,13 +5,21 @@ function makeCapabilityId(id) {
5
5
  }
6
6
 
7
7
  // packages/contracts/src/task-source.ts
8
+ var TASK_SOURCE_CONFIG_PROJECTION_CAPABILITY_ID = "task-sources.config-projection";
9
+ var TASK_SOURCE_CONFIG_PROJECTION = makeCapabilityId(TASK_SOURCE_CONFIG_PROJECTION_CAPABILITY_ID);
10
+ var TASK_SOURCE_TERMINAL_STATE_CAPABILITY_ID = "task-sources.terminal-state";
11
+ var TASK_SOURCE_TERMINAL_STATE = makeCapabilityId(TASK_SOURCE_TERMINAL_STATE_CAPABILITY_ID);
8
12
  var TASK_SOURCE_UPDATE_CAPABILITY_ID = "task-sources.update";
9
13
  var TASK_SOURCE_UPDATE = makeCapabilityId(TASK_SOURCE_UPDATE_CAPABILITY_ID);
10
- var TASK_IO_SERVICE_CAPABILITY_ID = "task-sources.task-io";
14
+ var TASK_IO_SERVICE_CAPABILITY_ID = "rig.tasks.io";
11
15
  var TASK_IO_SERVICE_CAPABILITY = makeCapabilityId(TASK_IO_SERVICE_CAPABILITY_ID);
12
16
  export {
13
17
  TASK_SOURCE_UPDATE_CAPABILITY_ID,
14
18
  TASK_SOURCE_UPDATE,
19
+ TASK_SOURCE_TERMINAL_STATE_CAPABILITY_ID,
20
+ TASK_SOURCE_TERMINAL_STATE,
21
+ TASK_SOURCE_CONFIG_PROJECTION_CAPABILITY_ID,
22
+ TASK_SOURCE_CONFIG_PROJECTION,
15
23
  TASK_IO_SERVICE_CAPABILITY_ID,
16
24
  TASK_IO_SERVICE_CAPABILITY
17
25
  };
@@ -0,0 +1,14 @@
1
+ import type { CapabilityId } from "./capability-id";
2
+ /** Task-state-owned local path layout for task config/session/artifacts/metadata files. */
3
+ export interface TaskStatePaths {
4
+ readonly stateDir: string;
5
+ readonly artifactsDir: string;
6
+ readonly taskConfigPath: string;
7
+ readonly sessionPath: string;
8
+ readonly failedApproachesPath: string;
9
+ }
10
+ export interface TaskStatePathsService {
11
+ resolvePaths(projectRoot: string): TaskStatePaths;
12
+ }
13
+ export declare const TASK_STATE_PATHS_CAPABILITY_ID = "task-state.paths";
14
+ export declare const TASK_STATE_PATHS: CapabilityId<TaskStatePathsService>;
@@ -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/task-state-paths.ts
8
+ var TASK_STATE_PATHS_CAPABILITY_ID = "task-state.paths";
9
+ var TASK_STATE_PATHS = makeCapabilityId(TASK_STATE_PATHS_CAPABILITY_ID);
10
+ export {
11
+ TASK_STATE_PATHS_CAPABILITY_ID,
12
+ TASK_STATE_PATHS
13
+ };