@h-rig/contracts 0.0.6-alpha.90 → 0.0.6-alpha.92

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 (42) hide show
  1. package/dist/index.cjs +563 -2
  2. package/dist/index.mjs +565 -2
  3. package/dist/src/artifact.js +3 -0
  4. package/dist/src/baseSchemas.d.ts +6 -0
  5. package/dist/src/baseSchemas.js +6 -0
  6. package/dist/src/cli-output.d.ts +90 -0
  7. package/dist/src/cli-output.js +38 -2
  8. package/dist/src/conversation.js +3 -0
  9. package/dist/src/editor.js +3 -0
  10. package/dist/src/engine.js +3 -0
  11. package/dist/src/git.js +3 -0
  12. package/dist/src/graph.js +3 -0
  13. package/dist/src/help-catalog.d.ts +30 -0
  14. package/dist/src/help-catalog.js +351 -0
  15. package/dist/src/index.d.ts +4 -0
  16. package/dist/src/index.js +565 -2
  17. package/dist/src/ipc.d.ts +2 -1
  18. package/dist/src/keybindings.js +3 -0
  19. package/dist/src/orchestration.js +3 -0
  20. package/dist/src/policy.js +3 -0
  21. package/dist/src/project.js +3 -0
  22. package/dist/src/provider.js +3 -0
  23. package/dist/src/providerRuntime.js +3 -0
  24. package/dist/src/remote.js +3 -0
  25. package/dist/src/review.js +3 -0
  26. package/dist/src/rig.d.ts +30 -0
  27. package/dist/src/rig.js +26 -0
  28. package/dist/src/run-journal.d.ts +4 -4
  29. package/dist/src/run-journal.js +3 -0
  30. package/dist/src/run-session-journal.d.ts +53 -0
  31. package/dist/src/run-session-journal.js +1582 -0
  32. package/dist/src/run-status.d.ts +12 -0
  33. package/dist/src/run-status.js +38 -0
  34. package/dist/src/runtime.js +3 -0
  35. package/dist/src/server.js +3 -0
  36. package/dist/src/serviceFabric.js +3 -0
  37. package/dist/src/terminal.js +3 -0
  38. package/dist/src/validation.js +3 -0
  39. package/dist/src/workspace.js +3 -0
  40. package/dist/src/ws.d.ts +14 -0
  41. package/dist/src/ws.js +25 -0
  42. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  // @bun
2
+ // packages/contracts/src/index.ts
3
+ import { Schema as Schema30 } from "effect";
4
+
2
5
  // packages/contracts/src/baseSchemas.ts
3
6
  import { Schema } from "effect";
4
7
  var TrimmedString = Schema.Trim;
@@ -13,6 +16,9 @@ var WorkspaceId = makeEntityId("WorkspaceId");
13
16
  var GraphId = makeEntityId("GraphId");
14
17
  var TaskId = makeEntityId("TaskId");
15
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"));
16
22
  var EngineRuntimeId = makeEntityId("EngineRuntimeId");
17
23
  var ConversationId = makeEntityId("ConversationId");
18
24
  var ActionId = makeEntityId("ActionId");
@@ -1701,6 +1707,127 @@ function reduceRunJournal(events) {
1701
1707
  anomalies
1702
1708
  };
1703
1709
  }
1710
+ // packages/contracts/src/run-session-journal.ts
1711
+ var RIG_RUN_STATUS_CHANGED = "rig.run.status-changed";
1712
+ var RIG_RUN_RECORD_PATCH = "rig.run.record-patch";
1713
+ var RIG_RUN_TIMELINE_ENTRY = "rig.run.timeline-entry";
1714
+ var RIG_RUN_LOG_ENTRY = "rig.run.log-entry";
1715
+ var RIG_RUN_APPROVAL_REQUESTED = "rig.run.approval-requested";
1716
+ var RIG_RUN_APPROVAL_RESOLVED = "rig.run.approval-resolved";
1717
+ var RIG_RUN_INPUT_REQUESTED = "rig.run.input-requested";
1718
+ var RIG_RUN_INPUT_RESOLVED = "rig.run.input-resolved";
1719
+ var RIG_RUN_STEERING = "rig.run.steering";
1720
+ var RIG_RUN_ADOPTED = "rig.run.adopted";
1721
+ var RIG_RUN_STALL_DETECTED = "rig.run.stall-detected";
1722
+ var RIG_RUN_CLOSEOUT_PHASE = "rig.run.closeout-phase";
1723
+ var RIG_STOP_SENTINEL = "<<RIG_STOP";
1724
+ var RIG_STOP_SENTINEL_END = ">>";
1725
+ function buildStopSentinel(runId, reason, requestedBy = "rig") {
1726
+ const cleanReason = reason?.replace(/[>\n\r]/g, " ").trim();
1727
+ return `${RIG_STOP_SENTINEL} runId=${runId} requestedBy=${requestedBy}${cleanReason ? ` reason=${cleanReason}` : ""}${RIG_STOP_SENTINEL_END}`;
1728
+ }
1729
+ function parseStopSentinel(text, expectedRunId) {
1730
+ const start = text.indexOf(RIG_STOP_SENTINEL);
1731
+ if (start < 0)
1732
+ return null;
1733
+ const end = text.indexOf(RIG_STOP_SENTINEL_END, start);
1734
+ const body = text.slice(start + RIG_STOP_SENTINEL.length, end >= 0 ? end : undefined).trim();
1735
+ const runId = body.match(/(?:^|\s)runId=([^\s>]+)/)?.[1] ?? "";
1736
+ if (runId && runId !== expectedRunId)
1737
+ return null;
1738
+ const reason = body.match(/(?:^|\s)reason=(.+)$/)?.[1]?.trim() ?? null;
1739
+ return { reason };
1740
+ }
1741
+ function sessionIdFromSessionFile(sessionPath) {
1742
+ if (!sessionPath)
1743
+ return null;
1744
+ const file = sessionPath.split(/[\\/]/).pop() ?? "";
1745
+ const match = file.match(/_([0-9a-fA-F][0-9a-fA-F-]{7,})\.jsonl$/);
1746
+ return match?.[1] ?? null;
1747
+ }
1748
+ var CUSTOM_TYPE_FOR = {
1749
+ "status-changed": RIG_RUN_STATUS_CHANGED,
1750
+ "record-patch": RIG_RUN_RECORD_PATCH,
1751
+ "timeline-entry": RIG_RUN_TIMELINE_ENTRY,
1752
+ "log-entry": RIG_RUN_LOG_ENTRY,
1753
+ "approval-requested": RIG_RUN_APPROVAL_REQUESTED,
1754
+ "approval-resolved": RIG_RUN_APPROVAL_RESOLVED,
1755
+ "input-requested": RIG_RUN_INPUT_REQUESTED,
1756
+ "input-resolved": RIG_RUN_INPUT_RESOLVED,
1757
+ steering: RIG_RUN_STEERING,
1758
+ adopted: RIG_RUN_ADOPTED,
1759
+ "stall-detected": RIG_RUN_STALL_DETECTED,
1760
+ "closeout-phase": RIG_RUN_CLOSEOUT_PHASE
1761
+ };
1762
+ var TYPE_FOR_CUSTOM = {
1763
+ [RIG_RUN_STATUS_CHANGED]: "status-changed",
1764
+ [RIG_RUN_RECORD_PATCH]: "record-patch",
1765
+ [RIG_RUN_TIMELINE_ENTRY]: "timeline-entry",
1766
+ [RIG_RUN_LOG_ENTRY]: "log-entry",
1767
+ [RIG_RUN_APPROVAL_REQUESTED]: "approval-requested",
1768
+ [RIG_RUN_APPROVAL_RESOLVED]: "approval-resolved",
1769
+ [RIG_RUN_INPUT_REQUESTED]: "input-requested",
1770
+ [RIG_RUN_INPUT_RESOLVED]: "input-resolved",
1771
+ [RIG_RUN_STEERING]: "steering",
1772
+ [RIG_RUN_ADOPTED]: "adopted",
1773
+ [RIG_RUN_STALL_DETECTED]: "stall-detected",
1774
+ [RIG_RUN_CLOSEOUT_PHASE]: "closeout-phase"
1775
+ };
1776
+ function isRunSessionCustomType(customType) {
1777
+ return customType !== undefined && Object.hasOwn(TYPE_FOR_CUSTOM, customType);
1778
+ }
1779
+ function foldRunSessionEntries(entries, runId) {
1780
+ const events = [];
1781
+ entries.forEach((entry, index) => {
1782
+ if (entry.type !== "custom" || !isRunSessionCustomType(entry.customType))
1783
+ return;
1784
+ const data = entry.data !== null && typeof entry.data === "object" ? entry.data : {};
1785
+ const stamped = {
1786
+ v: 1,
1787
+ seq: index + 1,
1788
+ at: typeof data.at === "string" ? data.at : new Date(0).toISOString(),
1789
+ runId,
1790
+ ...data,
1791
+ type: TYPE_FOR_CUSTOM[entry.customType]
1792
+ };
1793
+ try {
1794
+ events.push(decodeRunJournalEvent(stamped));
1795
+ } catch {}
1796
+ });
1797
+ return reduceRunJournal(events);
1798
+ }
1799
+ // packages/contracts/src/run-status.ts
1800
+ var OPERATOR_INACTIVE_RUN_STATUSES = new Set([
1801
+ "completed",
1802
+ "complete",
1803
+ "done",
1804
+ "success",
1805
+ "succeeded",
1806
+ "passed",
1807
+ "failed",
1808
+ "failure",
1809
+ "error",
1810
+ "errored",
1811
+ "stopped",
1812
+ "cancelled",
1813
+ "canceled",
1814
+ "aborted",
1815
+ "abort",
1816
+ "merged",
1817
+ "closed",
1818
+ "skipped",
1819
+ "needs-attention",
1820
+ "needs_attention"
1821
+ ]);
1822
+ function normalizeRunStatusToken(status) {
1823
+ return String(status ?? "").trim().toLowerCase().replace(/\s+/g, "-");
1824
+ }
1825
+ function isOperatorActiveRunStatus(status) {
1826
+ const normalized = normalizeRunStatusToken(status);
1827
+ if (!normalized)
1828
+ return false;
1829
+ return !OPERATOR_INACTIVE_RUN_STATUSES.has(normalized);
1830
+ }
1704
1831
  // packages/contracts/src/conversation.ts
1705
1832
  import { Schema as Schema8 } from "effect";
1706
1833
  var EngineMessageRole = Schema8.Literals(["user", "assistant", "system"]);
@@ -2951,6 +3078,7 @@ var RIG_WS_METHODS = {
2951
3078
  enqueueTask: "rig.enqueueTask",
2952
3079
  resumeRun: "rig.resumeRun",
2953
3080
  submitRunMessage: "rig.submitRunMessage",
3081
+ queueRunSteering: "rig.queueRunSteering",
2954
3082
  interruptRun: "rig.interruptRun",
2955
3083
  stopRun: "rig.stopRun",
2956
3084
  resolveApproval: "rig.resolveApproval",
@@ -3036,6 +3164,9 @@ var RigCreateAdhocRunInput = Schema18.Struct({
3036
3164
  executionTarget: Schema18.optional(RunExecutionTarget),
3037
3165
  remoteHostId: Schema18.optional(Schema18.String),
3038
3166
  initialPrompt: Schema18.optional(Schema18.String),
3167
+ baselineMode: Schema18.optional(Schema18.Literals(["head", "dirty-snapshot"])),
3168
+ prMode: Schema18.optional(Schema18.Literals(["auto", "ask", "off"])),
3169
+ initiatedBy: Schema18.optional(Schema18.String),
3039
3170
  createdAt: IsoDateTime
3040
3171
  });
3041
3172
  var RigCreateTaskRunInput = Schema18.Struct({
@@ -3049,6 +3180,10 @@ var RigCreateTaskRunInput = Schema18.Struct({
3049
3180
  interactionMode: ProviderInteractionMode.pipe(Schema18.withDecodingDefault(() => DEFAULT_PROVIDER_INTERACTION_MODE)),
3050
3181
  executionTarget: Schema18.optional(RunExecutionTarget),
3051
3182
  remoteHostId: Schema18.optional(Schema18.String),
3183
+ initialPrompt: Schema18.optional(Schema18.String),
3184
+ baselineMode: Schema18.optional(Schema18.Literals(["head", "dirty-snapshot"])),
3185
+ prMode: Schema18.optional(Schema18.Literals(["auto", "ask", "off"])),
3186
+ initiatedBy: Schema18.optional(Schema18.String),
3052
3187
  createdAt: IsoDateTime
3053
3188
  });
3054
3189
  var RigEnqueueTaskInput = Schema18.Struct({
@@ -3077,6 +3212,19 @@ var RigSubmitRunMessageInput = Schema18.Struct({
3077
3212
  attachments: Schema18.optional(Schema18.Array(Schema18.Unknown)),
3078
3213
  createdAt: IsoDateTime
3079
3214
  });
3215
+ var RigQueueRunSteeringInput = Schema18.Struct({
3216
+ commandId: CommandId,
3217
+ runId: RunId,
3218
+ message: TrimmedNonEmptyString,
3219
+ actor: Schema18.optional(Schema18.String),
3220
+ createdAt: IsoDateTime
3221
+ });
3222
+ var RigQueueRunSteeringResult = Schema18.Struct({
3223
+ sequence: NonNegativeInt,
3224
+ runId: RunId,
3225
+ queued: Schema18.Boolean,
3226
+ message: RigQueuedRunSteeringMessage
3227
+ });
3080
3228
  var RigInterruptRunInput = Schema18.Struct({
3081
3229
  commandId: CommandId,
3082
3230
  runId: RunId,
@@ -4369,6 +4517,7 @@ var WebSocketRequestBody = Schema26.Union([
4369
4517
  tagRequestBody(RIG_WS_METHODS.enqueueTask, RigEnqueueTaskInput),
4370
4518
  tagRequestBody(RIG_WS_METHODS.resumeRun, RigResumeRunInput),
4371
4519
  tagRequestBody(RIG_WS_METHODS.submitRunMessage, RigSubmitRunMessageInput),
4520
+ tagRequestBody(RIG_WS_METHODS.queueRunSteering, RigQueueRunSteeringInput),
4372
4521
  tagRequestBody(RIG_WS_METHODS.interruptRun, RigInterruptRunInput),
4373
4522
  tagRequestBody(RIG_WS_METHODS.stopRun, RigStopRunInput),
4374
4523
  tagRequestBody(RIG_WS_METHODS.resolveApproval, RigResolveApprovalInput),
@@ -4665,7 +4814,25 @@ var CliRepoConnectionState = Schema29.Struct({
4665
4814
  selected: Schema29.String,
4666
4815
  project: Schema29.optional(Schema29.String),
4667
4816
  linkedAt: Schema29.optional(Schema29.String),
4668
- serverProjectRoot: Schema29.optional(Schema29.String)
4817
+ serverProjectRoot: Schema29.optional(Schema29.String),
4818
+ serverProjectRootAlias: Schema29.optional(Schema29.String),
4819
+ serverProjectRootBaseUrl: Schema29.optional(Schema29.String)
4820
+ });
4821
+ var CliRemoteProjectLink = Schema29.Struct({
4822
+ ok: Schema29.Boolean,
4823
+ status: Schema29.String,
4824
+ alias: Schema29.optional(Schema29.String),
4825
+ baseUrl: Schema29.optional(Schema29.String),
4826
+ repoSlug: Schema29.optional(Schema29.String),
4827
+ serverProjectRoot: Schema29.optional(Schema29.String),
4828
+ source: Schema29.optional(Schema29.String),
4829
+ prepared: Schema29.optional(Schema29.Boolean),
4830
+ validated: Schema29.optional(Schema29.Boolean),
4831
+ statusCode: Schema29.optional(Schema29.Number),
4832
+ message: Schema29.String,
4833
+ hint: Schema29.String,
4834
+ next: Schema29.optional(Schema29.String),
4835
+ skippedCandidates: Schema29.optional(Schema29.Array(Schema29.String))
4669
4836
  });
4670
4837
  var RigTaskListOutput = Schema29.Struct({
4671
4838
  v: Schema29.Literal(1),
@@ -4698,15 +4865,30 @@ var RigRunShowOutput = Schema29.Struct({
4698
4865
  command: Schema29.Literal("run show"),
4699
4866
  data: CliRunRecord
4700
4867
  });
4868
+ var RigServerUseOutput = Schema29.Struct({
4869
+ v: Schema29.Literal(1),
4870
+ command: Schema29.Literal("server use"),
4871
+ data: Schema29.Struct({
4872
+ selected: Schema29.String,
4873
+ repo: Schema29.NullOr(CliRepoConnectionState),
4874
+ remoteProjectLink: Schema29.NullOr(CliRemoteProjectLink)
4875
+ })
4876
+ });
4701
4877
  var RigServerStatusOutput = Schema29.Struct({
4702
4878
  v: Schema29.Literal(1),
4703
4879
  command: Schema29.Literal("server status"),
4704
4880
  data: Schema29.Struct({
4705
4881
  selected: Schema29.String,
4706
4882
  repo: Schema29.NullOr(CliRepoConnectionState),
4707
- connections: Schema29.Record(Schema29.String, CliServerConnection)
4883
+ connections: Schema29.Record(Schema29.String, CliServerConnection),
4884
+ remoteProjectLink: Schema29.NullOr(CliRemoteProjectLink)
4708
4885
  })
4709
4886
  });
4887
+ var RigServerRepairLinkOutput = Schema29.Struct({
4888
+ v: Schema29.Literal(1),
4889
+ command: Schema29.Literal("server repair-link"),
4890
+ data: CliRemoteProjectLink
4891
+ });
4710
4892
  var RigInboxApprovalsOutput = Schema29.Struct({
4711
4893
  v: Schema29.Literal(1),
4712
4894
  command: Schema29.Literal("inbox approvals"),
@@ -4755,12 +4937,362 @@ var RigStatsOutput = Schema29.Struct({
4755
4937
  });
4756
4938
  // packages/contracts/src/protocol-version.ts
4757
4939
  var RIG_PROTOCOL_VERSION = 1;
4940
+ // packages/contracts/src/help-catalog.ts
4941
+ function helpCatalog() {
4942
+ return { sections: TOP_LEVEL_SECTIONS, groups: ALL_GROUPS };
4943
+ }
4944
+ var TOP_LEVEL_SECTIONS = [
4945
+ {
4946
+ title: "Open Rig",
4947
+ subtitle: "normal UX \u2014 bare rig opens the bundled Rig Cockpit inside OMP",
4948
+ commands: [
4949
+ { command: "rig", description: "Open Rig Cockpit with OMP collaboration substrate for the current workspace." },
4950
+ { command: "rig --workspace <path>", description: "Open Rig Cockpit for another workspace." },
4951
+ { command: "/rig", description: "Inside OMP, reopen the Rig Cockpit." },
4952
+ { command: "rig join <link>", description: "Join an encrypted OMP collaborative session from another operator." }
4953
+ ]
4954
+ },
4955
+ {
4956
+ title: "Server",
4957
+ subtitle: "select execution placement before reading or dispatching work",
4958
+ commands: [
4959
+ { command: "Cockpit Server", description: "Show the selected local or remote server target and project-root link." },
4960
+ { command: "Server target \u2192 Local", description: "Use local execution placement for the selected project." },
4961
+ { command: "Server target \u2192 Remote", description: "Use remote execution placement with the server-host project root preserved." }
4962
+ ]
4963
+ },
4964
+ {
4965
+ title: "Tasks",
4966
+ subtitle: "configured task source on the selected target feeds task detail",
4967
+ commands: [
4968
+ { command: "Cockpit Tasks", description: "List tasks from the selected server target's configured task source." },
4969
+ { command: "Task detail", description: "Review task id, title, body, source status, labels, and issue URL before dispatch." },
4970
+ { command: "Task detail \u2192 Dispatch", description: "Submit the selected task run through the selected target, then attach the collaborative OMP session." },
4971
+ { command: "rig triage", description: "Run the configured issueAnalysis pass once; use cron/launchd/CI to schedule continuous triage." }
4972
+ ]
4973
+ },
4974
+ {
4975
+ title: "Runs",
4976
+ subtitle: "dispatched Rig runs attach through collaborative OMP sessions",
4977
+ commands: [
4978
+ { command: "OMP Runs screen", description: "Open dispatched runs, collaboration links, cwd, identity, status, and inbox counts." },
4979
+ { command: "rig join <link>", description: "Join a shared OMP session without changing execution placement." },
4980
+ { command: "OMP collab guest view", description: "Watch the shared transcript live; write links can prompt the originating session." }
4981
+ ]
4982
+ },
4983
+ {
4984
+ title: "Inbox + Doctor",
4985
+ subtitle: "approvals, user prompts, and health checks live inside Rig/OMP",
4986
+ commands: [
4987
+ { command: "OMP Inbox screen", description: "Review and answer pending approval/user-input workflow entries." },
4988
+ { command: "/rig inbox", description: "Open the inbox screen from inside OMP." },
4989
+ { command: "OMP Doctor screen", description: "Probe session discovery, collaboration registry, selected target, and workflow-entry health." }
4990
+ ]
4991
+ },
4992
+ {
4993
+ title: "Extend",
4994
+ subtitle: "plugins and OMP extensions shape the worker environment",
4995
+ commands: [
4996
+ { command: "rig.config.ts plugins", description: "Register task sources, validators, hooks, skills, roles, and workflow metadata." },
4997
+ { command: "runtime.pi.packages", description: "Declare team-wide OMP/Pi extension packages for sessions and workers." }
4998
+ ]
4999
+ }
5000
+ ];
5001
+ var PRIMARY_GROUPS = [
5002
+ {
5003
+ name: "server",
5004
+ summary: "Compatibility server selector; the product Server target screen lives in Rig Cockpit.",
5005
+ usage: ["rig server <status|list|add|use|repair-link|start> [options]"],
5006
+ commands: [
5007
+ { command: "status", description: "Legacy automation-only: show the selected server and project-root link.", primary: true },
5008
+ { command: "use local", description: "Legacy automation-only: switch this repo to local execution placement.", primary: true },
5009
+ { command: "add <alias> <url>", description: "Legacy automation-only: save a remote server URL.", primary: true },
5010
+ { command: "use <alias>", description: "Legacy automation-only: select a remote execution target alias.", primary: true },
5011
+ { command: "repair-link [--prepare|--backfill-only] [--repo owner/repo]", description: "Legacy automation-only: repair a server-host checkout link.", primary: true },
5012
+ { command: "list", description: "Legacy automation-only: list saved local/remote server aliases.", primary: true },
5013
+ { command: "start [--host <host>] [--port <n>]", description: "Legacy diagnostic-only: start a local rig-server process." }
5014
+ ],
5015
+ examples: [
5016
+ "rig server status # legacy automation only",
5017
+ "rig server use local # legacy automation only"
5018
+ ],
5019
+ next: ["For normal UX, run bare `rig`, open Cockpit Server, then continue to Tasks."]
5020
+ },
5021
+ {
5022
+ name: "task",
5023
+ summary: "Legacy automation-only task-source inspection and dispatch helpers.",
5024
+ usage: ["rig task <list|next|show|run> [options]"],
5025
+ commands: [
5026
+ { command: "list [--assignee <login|me|@me>] [--state open|closed]", description: "Legacy automation-only: list tasks from the configured source.", primary: true },
5027
+ { command: "next [filters]", description: "Legacy automation-only: render the next matching task card.", primary: true },
5028
+ { command: "show <id>|--task <id> [--raw]", description: "Legacy automation-only: show a task payload for scripts.", primary: true },
5029
+ { command: "run [#<issue>|<task-id>|--task <id>]", description: "Legacy/fenced: dispatch through the old task-run CLI path; not the task-detail dispatch path.", primary: true },
5030
+ { command: "ready", description: "Legacy automation-only: list task IDs that old dispatch can run now." },
5031
+ { command: "validate|verify [--task <id>]", description: "Legacy automation-only: run configured task checks/review gates." },
5032
+ { command: "details --task <id>", description: "Legacy automation-only: show full task info from the configured source." },
5033
+ { command: "reopen [--task <id> | --all] [--reason <text>]", description: "Legacy automation-only: reopen closed task(s) in the configured source." },
5034
+ { command: "artifacts|artifact-dir|artifact-write", description: "Legacy automation-only: inspect or write task artifacts." }
5035
+ ],
5036
+ examples: [
5037
+ "rig task list --assignee @me --limit 20 # legacy automation only",
5038
+ "rig task show 123 --raw # legacy automation only",
5039
+ "rig task run #123 --runtime-adapter pi # explicit legacy dispatch only"
5040
+ ],
5041
+ next: ["For normal UX, run bare `rig`, use Cockpit Server/Tasks, then dispatch from Task detail."]
5042
+ },
5043
+ {
5044
+ name: "run",
5045
+ summary: "Legacy automation-only run-record inspection; OMP Runs/collab is the live surface.",
5046
+ usage: ["rig run <list|status|show|steer|stop|resume|restart> [options]"],
5047
+ commands: [
5048
+ { command: "list", description: "Legacy automation-only: list old run records from selected server/local state.", primary: true },
5049
+ { command: "status", description: "Legacy automation-only: render old active/recent run-record groups; not live OMP status.", primary: true },
5050
+ { command: "show <id>|--run <id> [--raw]", description: "Legacy automation-only: show an old run-record payload for scripts.", primary: true },
5051
+ { command: "attach <run-id>|--run <id>", description: "Legacy/fenced: not the Rig Cockpit attach path; use OMP Runs or `rig join <link>`.", primary: true },
5052
+ { command: "steer <run-id> --message <text>", description: "Legacy automation-only: queue steering into an old live worker.", primary: true },
5053
+ { command: "stop [<run-id>|--run <id>]", description: "Legacy automation-only: request stop for old run records.", primary: true },
5054
+ { command: "resume [<run-id>]", description: "Legacy automation-only: resume an interrupted old run record." },
5055
+ { command: "restart [<run-id>]", description: "Legacy automation-only: re-dispatch an old run from a clean runtime." },
5056
+ { command: "timeline --run <id> [--follow]", description: "Legacy automation-only: stream raw old timeline events." },
5057
+ { command: "replay <run-id>|--run <id> [--with-session]", description: "Legacy automation-only: print an old consolidated run timeline." },
5058
+ { command: "delete|cleanup", description: "Legacy automation-only: remove completed old run records/artifacts." }
5059
+ ],
5060
+ examples: [
5061
+ "rig run list # legacy automation only",
5062
+ "rig run show <run-id> # legacy automation only",
5063
+ "rig run stop <run-id> # legacy automation only"
5064
+ ],
5065
+ next: [
5066
+ "For live sessions, use bare `rig`, the OMP Runs screen, or `rig join <collab-link>`.",
5067
+ "Use `--json` only for scripts that still consume legacy compatibility records."
5068
+ ]
5069
+ },
5070
+ {
5071
+ name: "inbox",
5072
+ summary: "Legacy automation-only request view; normal UX is the OMP Inbox screen.",
5073
+ usage: ["rig inbox <approvals|approve|inputs|respond> [options]"],
5074
+ commands: [
5075
+ { command: "approvals [--run <id>] [--task <id>]", description: "Legacy automation-only: list pending approval records.", primary: true },
5076
+ { command: "inputs [--run <id>] [--task <id>]", description: "Legacy automation-only: list pending user-input records.", primary: true },
5077
+ { command: "approve --run <id> --request <id> --decision approve|reject", description: "Legacy automation-only: resolve an approval record." },
5078
+ { command: "respond --run <id> --request <id> --answer key=value", description: "Legacy automation-only: answer a user-input record." }
5079
+ ],
5080
+ examples: [
5081
+ "rig inbox approvals # legacy automation only"
5082
+ ],
5083
+ next: ["For normal UX, use bare `rig`, then the OMP Inbox screen."]
5084
+ },
5085
+ {
5086
+ name: "stats",
5087
+ summary: "Legacy automation-only metrics over old run records; not the OMP live UX.",
5088
+ usage: ["rig stats [show] [--since <7d|30d|ISO date>]"],
5089
+ commands: [
5090
+ { command: "show [--since <window>]", description: "Legacy automation-only: totals, completion/failure rates, run time, steering, stalls, approvals.", primary: true }
5091
+ ],
5092
+ examples: [
5093
+ "rig stats --json # legacy automation only"
5094
+ ],
5095
+ next: ["For normal UX, use the OMP Runs screen."]
5096
+ },
5097
+ {
5098
+ name: "inspect",
5099
+ summary: "Legacy automation-only artifact/log inspection; normal UX is OMP session history.",
5100
+ usage: ["rig inspect <logs|artifacts|failures|graph|audit> --task <id>"],
5101
+ commands: [
5102
+ { command: "logs --task <id>", description: "Legacy automation-only: latest old run log for a task.", primary: true },
5103
+ { command: "artifacts --task <id>", description: "Legacy automation-only: list completion artifacts.", primary: true },
5104
+ { command: "failures --task <id>", description: "Legacy automation-only: recorded failures for a task.", primary: true },
5105
+ { command: "graph", description: "Legacy automation-only: task dependency graph." },
5106
+ { command: "audit", description: "Legacy automation-only: controlled-command audit trail." }
5107
+ ],
5108
+ examples: ["rig inspect logs --task <id> # legacy automation only"],
5109
+ next: ["For normal UX, use the OMP Runs screen and OMP session history."]
5110
+ },
5111
+ {
5112
+ name: "repo",
5113
+ summary: "Repository sync/baseline helpers for the Rig-managed checkout.",
5114
+ usage: ["rig repo <sync|reset-baseline>"],
5115
+ commands: [
5116
+ { command: "sync", description: "Sync project repository state.", primary: true },
5117
+ { command: "reset-baseline", description: "Reset the managed baseline for the repo." }
5118
+ ],
5119
+ examples: ["rig repo sync"]
5120
+ },
5121
+ {
5122
+ name: "plugin",
5123
+ summary: "Plugin listing, validation, and plugin-contributed commands.",
5124
+ usage: ["rig plugin <list|validate|run> [options]"],
5125
+ commands: [
5126
+ { command: "list", description: "List plugins declared in rig.config.ts and their contributions.", primary: true },
5127
+ { command: "validate --task <id>", description: "Run plugin-contributed validators for a task.", primary: true },
5128
+ { command: "run <command-id> [args...]", description: "Execute a plugin-contributed CLI command (also callable as `rig <command-id>`)." }
5129
+ ],
5130
+ examples: ["rig plugin list", "rig plugin run <command-id>"]
5131
+ },
5132
+ {
5133
+ name: "init",
5134
+ summary: "Legacy automation-only config bootstrap/repair helper; not root onboarding.",
5135
+ usage: ["rig init [--yes] [--server local|remote] [--repo owner/repo] [--remote-url <url>]"],
5136
+ commands: [
5137
+ { command: "init", description: "Legacy/fenced setup wizard for compatibility projects; not onboarding.", primary: true },
5138
+ { command: "init --demo", description: "Legacy/fenced offline demo project for compatibility tests.", primary: true },
5139
+ { command: "init --yes", description: "Legacy/fenced non-interactive setup for old automation.", primary: true },
5140
+ { command: "init --server remote --remote-url <url>", description: "Legacy/fenced remote server link setup.", primary: true },
5141
+ { command: "init --repair", description: "Legacy/fenced repair of missing private compatibility state." }
5142
+ ],
5143
+ examples: [
5144
+ "rig init --demo # legacy compatibility only",
5145
+ "rig init --repair # legacy compatibility only"
5146
+ ],
5147
+ next: ["For onboarding and normal UX, run bare `rig`, then use Cockpit Server/Tasks and dispatch from Task detail."]
5148
+ },
5149
+ {
5150
+ name: "doctor",
5151
+ summary: "Diagnostic-only compatibility checks; normal health lives in the OMP Doctor screen.",
5152
+ usage: ["rig doctor"],
5153
+ commands: [
5154
+ { command: "doctor", description: "Diagnostic/legacy-only: check compatibility setup/runtime state; not onboarding.", primary: true },
5155
+ { command: "check", description: "Diagnostic/legacy-only spelling for compatibility checks." }
5156
+ ],
5157
+ examples: ["rig doctor --json # legacy diagnostic automation only"],
5158
+ next: ["For normal UX, use the OMP Doctor screen."]
5159
+ },
5160
+ {
5161
+ name: "github",
5162
+ summary: "Legacy automation-only GitHub auth helpers for selected compatibility servers.",
5163
+ usage: ["rig github auth <status|import-gh|token>"],
5164
+ commands: [
5165
+ { command: "auth status", description: "Legacy automation-only: show GitHub auth state.", primary: true },
5166
+ { command: "auth import-gh", description: "Legacy automation-only: import the current `gh` token into the selected server." },
5167
+ { command: "auth token --token <token>", description: "Legacy automation-only: store a token on the selected server." }
5168
+ ],
5169
+ examples: ["rig github auth status # legacy automation only"],
5170
+ next: ["For normal UX, use bare `rig` and the OMP extension cockpit."]
5171
+ }
5172
+ ];
5173
+ var ADVANCED_GROUPS = [
5174
+ {
5175
+ name: "setup",
5176
+ summary: "Legacy automation-only setup bootstrap/check helpers.",
5177
+ usage: ["rig setup <bootstrap|check|preflight>"],
5178
+ commands: [
5179
+ { command: "bootstrap", description: "Legacy automation-only: bootstrap local setup dependencies.", primary: true },
5180
+ { command: "check", description: "Legacy automation-only: check local setup state (toolchain, deps, config).", primary: true },
5181
+ { command: "preflight", description: "Legacy automation-only: run preflight checks before an old run.", primary: true }
5182
+ ]
5183
+ },
5184
+ {
5185
+ name: "profile",
5186
+ summary: "Runtime profile/model defaults.",
5187
+ usage: ["rig profile <show|set>"],
5188
+ commands: [
5189
+ { command: "show", description: "Show the active execution profile.", primary: true },
5190
+ { command: "set [--model <model>] [--runtime <runtime>] [--plugin <plugin>]", description: "Set model/runtime/plugin profile defaults.", primary: true }
5191
+ ]
5192
+ },
5193
+ {
5194
+ name: "review",
5195
+ summary: "Inspect or change completion review gate policy.",
5196
+ usage: ["rig review <show|set>"],
5197
+ commands: [
5198
+ { command: "show", description: "Show current review gate settings." },
5199
+ { command: "set <off|advisory|required> [--provider <provider>]", description: "Change review strictness/provider (e.g. --provider greptile)." }
5200
+ ],
5201
+ examples: ["rig review show", "rig review set required --provider greptile"],
5202
+ next: ["For normal workflow handoffs, use the OMP Inbox screen."]
5203
+ },
5204
+ {
5205
+ name: "pi",
5206
+ summary: "Manage Pi extension packages for this project (community extensions from npm/git).",
5207
+ usage: ["rig pi <list|add|remove|search> [args]"],
5208
+ commands: [
5209
+ { command: "list", description: "Show project and user Pi extension packages." },
5210
+ { command: "add <source>", description: "Add an npm/git Pi extension to .pi/settings.json (auto-installs at next session)." },
5211
+ { command: "remove <source>", description: "Remove an operator-added Pi extension." },
5212
+ { command: "search [term]", description: "Discover Pi extension packages on the npm registry." }
5213
+ ],
5214
+ examples: ["rig pi search subagents", "rig pi add pi-subagents", "rig pi list"],
5215
+ next: ["Config-managed extensions: declare `runtime: { pi: { packages: [...] } }` in rig.config.ts \u2014 workers pick them up automatically."]
5216
+ },
5217
+ {
5218
+ name: "queue",
5219
+ summary: "Run task queues locally.",
5220
+ usage: ["rig queue run [--workers <n>] [--max-tasks <n>] [--action validate|verify|pipeline] [--isolation off|worktree] [--no-runtime-reuse] [--fail-fast] [--skip-project-sync]"],
5221
+ commands: [
5222
+ { command: "run [--workers <n>] [--max-tasks <n>] [--action validate|verify|pipeline] [--isolation off|worktree] [--no-runtime-reuse] [--fail-fast] [--skip-project-sync]", description: "Process queue work: drain matching tasks with N workers, optional per-task action and isolation.", primary: true }
5223
+ ]
5224
+ },
5225
+ {
5226
+ name: "agent",
5227
+ summary: "Runtime agent workspace helpers.",
5228
+ usage: ["rig agent <list|prepare|run|cleanup>"],
5229
+ commands: [
5230
+ { command: "list", description: "List prepared agent runtimes.", primary: true },
5231
+ { command: "prepare [--id <id>] [--mode <mode>] [--task <task>]", description: "Prepare an isolated agent runtime workspace.", primary: true },
5232
+ { command: "run [--id <id>] [--mode <mode>] [--task <task>] [--skip-project-sync]", description: "Prepare (if needed) and run an agent in its workspace.", primary: true },
5233
+ { command: "cleanup [--all] [--id <id>]", description: "Remove prepared agent workspaces.", primary: true }
5234
+ ]
5235
+ },
5236
+ { name: "inspector", summary: "Event stream and drift scanners.", usage: ["rig inspector <stream|scan-upstream-drift>"], commands: [{ command: "stream", description: "Stream events." }] },
5237
+ {
5238
+ name: "dist",
5239
+ summary: "Build/install packaged Rig CLI.",
5240
+ usage: ["rig dist <build|install|doctor|rebuild-agent>"],
5241
+ commands: [
5242
+ { command: "build [--output-dir <dir>]", description: "Build the distributable Rig CLI.", primary: true },
5243
+ { command: "install [--scope <scope>] [--path <path>]", description: "Install the built CLI to a scope/path.", primary: true },
5244
+ { command: "doctor", description: "Diagnose the dist toolchain and install state.", primary: true },
5245
+ { command: "rebuild-agent", description: "Rebuild the agent runtime image, pruning stale images.", primary: true }
5246
+ ]
5247
+ },
5248
+ { name: "workspace", summary: "Workspace topology/service helpers.", usage: ["rig workspace <summary|topology|remote-hosts>"], commands: [{ command: "summary", description: "Show workspace summary." }] },
5249
+ {
5250
+ name: "remote",
5251
+ summary: "Legacy automation-only remote orchestration controls.",
5252
+ usage: ["rig remote <status|tasks|watch|pause|resume|continue|stop|refresh|add-iterations|remove-iterations|endpoint ...>"],
5253
+ commands: [
5254
+ { command: "status [--remote <alias>]", description: "Legacy automation-only: show old remote orchestration state.", primary: true },
5255
+ { command: "tasks [--remote <alias>]", description: "Legacy automation-only: list the old remote's tracked tasks.", primary: true },
5256
+ { command: "watch [--remote <alias>] [--seconds <n>] [--event <type>]", description: "Legacy automation-only: stream old remote orchestration events.", primary: true },
5257
+ { command: "pause [--remote <alias>]", description: "Legacy automation-only: pause old remote orchestration.", primary: true },
5258
+ { command: "resume [--remote <alias>] [--max-workers <n>] [--max-iterations <n>] [--direct-merge]", description: "Legacy automation-only: resume old remote orchestration with optional tuning.", primary: true },
5259
+ { command: "continue [--remote <alias>]", description: "Legacy automation-only: continue a paused old remote.", primary: true },
5260
+ { command: "stop [--remote <alias>]", description: "Legacy automation-only: stop old remote orchestration.", primary: true },
5261
+ { command: "refresh [--remote <alias>]", description: "Legacy automation-only: refresh old remote state.", primary: true },
5262
+ { command: "add-iterations [--count <n>] [--remote <alias>]", description: "Legacy automation-only: grant an old remote more iterations.", primary: true },
5263
+ { command: "remove-iterations [--count <n>] [--remote <alias>]", description: "Legacy automation-only: reduce an old remote's iteration budget.", primary: true },
5264
+ { command: "endpoint list", description: "Legacy automation-only: list configured remote endpoints.", primary: true },
5265
+ { command: "endpoint add --alias <alias> --host <host> --port <n> [--token <token>]", description: "Legacy automation-only: register a remote endpoint.", primary: true },
5266
+ { command: "endpoint remove --alias <alias>", description: "Legacy automation-only: remove a remote endpoint.", primary: true },
5267
+ { command: "endpoint test [--alias <alias>]", description: "Legacy diagnostic-only: test connectivity to a remote endpoint.", primary: true },
5268
+ { command: "endpoint doctor", description: "Legacy diagnostic-only: diagnose remote endpoint configuration.", primary: true }
5269
+ ]
5270
+ },
5271
+ { name: "git", summary: "Pass through to Rig git-flow helper.", usage: ["rig git <args...>"], commands: [{ command: "<args...>", description: "Advanced git flow operations." }] },
5272
+ { name: "harness", summary: "Pass through to runtime harness CLI.", usage: ["rig harness <args...>"], commands: [{ command: "<args...>", description: "Advanced harness operations." }] },
5273
+ { name: "test", summary: "Project test wrappers.", usage: ["rig test <unit|e2e|all>"], commands: [{ command: "all", description: "Run configured project tests." }] }
5274
+ ];
5275
+ var ADVANCED_COMMANDS = [
5276
+ { command: "rig server task-run ...", description: "Internal legacy server-owned task execution entry point." },
5277
+ { command: "rig server notify-test [--event <type>]", description: "Internal diagnostic event notification smoke command." },
5278
+ { command: "rig run start|start-serial|start-parallel", description: "Legacy/internal queue starters; not the Rig Cockpit task-detail dispatch path." },
5279
+ { command: "rig remote orchestrate-*", description: "Legacy automation-only remote orchestration commands." }
5280
+ ];
5281
+ var ALL_GROUPS = [...PRIMARY_GROUPS, ...ADVANCED_GROUPS];
4758
5282
  export {
5283
+ sessionIdFromSessionFile,
4759
5284
  reduceRunJournal,
5285
+ parseStopSentinel,
5286
+ normalizeRunStatusToken,
4760
5287
  isTerminalRunStatus,
5288
+ isRunSessionCustomType,
5289
+ isOperatorActiveRunStatus,
4761
5290
  isActiveRunStatus,
5291
+ helpCatalog,
5292
+ foldRunSessionEntries,
4762
5293
  decodeRunJournalEvent,
4763
5294
  canTransitionRunStatus,
5295
+ buildStopSentinel,
4764
5296
  assertRunStatusTransition,
4765
5297
  WsWelcomePayload,
4766
5298
  WsResponse,
@@ -4844,6 +5376,8 @@ export {
4844
5376
  TaskId,
4845
5377
  TaskFieldExtension,
4846
5378
  TaskEnqueueCommand,
5379
+ TYPE_FOR_CUSTOM,
5380
+ TOP_LEVEL_SECTIONS,
4847
5381
  TERMINAL_RUN_STATUSES,
4848
5382
  SkillRegistration,
4849
5383
  ServiceFabricWorkspaceInput,
@@ -4859,6 +5393,10 @@ export {
4859
5393
  ServerConfig,
4860
5394
  ScopeSearchPrefix,
4861
5395
  ScopeNormalizationRules,
5396
+ Schema30 as Schema,
5397
+ SafeRunId,
5398
+ SafePathSegment,
5399
+ SafeGitRefComponent,
4862
5400
  SCRIPT_RUN_COMMAND_PATTERN,
4863
5401
  RuntimeUpdateMetadataCommand,
4864
5402
  RuntimeTaskId,
@@ -4932,7 +5470,9 @@ export {
4932
5470
  RigStatsData,
4933
5471
  RigSnapshotInvalidatedPayload,
4934
5472
  RigSnapshot,
5473
+ RigServerUseOutput,
4935
5474
  RigServerStatusOutput,
5475
+ RigServerRepairLinkOutput,
4936
5476
  RigRuntimeMode,
4937
5477
  RigRunSteeringQueuedPayload,
4938
5478
  RigRunShowOutput,
@@ -4945,6 +5485,8 @@ export {
4945
5485
  RigReplayEventsInput,
4946
5486
  RigRawRunLogEntry,
4947
5487
  RigQueuedRunSteeringMessage,
5488
+ RigQueueRunSteeringResult,
5489
+ RigQueueRunSteeringInput,
4948
5490
  RigPlugin,
4949
5491
  RigMutationResult,
4950
5492
  RigListWorkspacesResult,
@@ -5027,6 +5569,20 @@ export {
5027
5569
  RUN_STATUS_TRANSITIONS,
5028
5570
  RIG_WS_METHODS,
5029
5571
  RIG_WS_CHANNELS,
5572
+ RIG_STOP_SENTINEL_END,
5573
+ RIG_STOP_SENTINEL,
5574
+ RIG_RUN_TIMELINE_ENTRY,
5575
+ RIG_RUN_STEERING,
5576
+ RIG_RUN_STATUS_CHANGED,
5577
+ RIG_RUN_STALL_DETECTED,
5578
+ RIG_RUN_RECORD_PATCH,
5579
+ RIG_RUN_LOG_ENTRY,
5580
+ RIG_RUN_INPUT_RESOLVED,
5581
+ RIG_RUN_INPUT_REQUESTED,
5582
+ RIG_RUN_CLOSEOUT_PHASE,
5583
+ RIG_RUN_APPROVAL_RESOLVED,
5584
+ RIG_RUN_APPROVAL_REQUESTED,
5585
+ RIG_RUN_ADOPTED,
5030
5586
  RIG_PROTOCOL_VERSION,
5031
5587
  REASONING_EFFORT_OPTIONS_BY_PROVIDER,
5032
5588
  QueueEntry,
@@ -5085,6 +5641,7 @@ export {
5085
5641
  PROVIDER_SEND_TURN_MAX_IMAGE_BYTES,
5086
5642
  PROVIDER_SEND_TURN_MAX_ATTACHMENTS,
5087
5643
  PROJECT_READ_FILE_MAX_BYTES_VALUE,
5644
+ PRIMARY_GROUPS,
5088
5645
  OrchestrationThreadActivityTone,
5089
5646
  OrchestrationThreadActivity,
5090
5647
  OrchestrationThread,
@@ -5118,6 +5675,7 @@ export {
5118
5675
  OpenInEditorInput,
5119
5676
  ORCHESTRATION_WS_METHODS,
5120
5677
  ORCHESTRATION_WS_CHANNELS,
5678
+ OPERATOR_INACTIVE_RUN_STATUSES,
5121
5679
  NonNegativeInt,
5122
5680
  MessageId,
5123
5681
  MergeConfig,
@@ -5209,6 +5767,7 @@ export {
5209
5767
  CliServerConnection,
5210
5768
  CliRunRecord,
5211
5769
  CliRepoConnectionState,
5770
+ CliRemoteProjectLink,
5212
5771
  CliInboxRecord,
5213
5772
  CliDoctorCheck,
5214
5773
  CliCommandRegistration,
@@ -5218,6 +5777,7 @@ export {
5218
5777
  ChatAttachment,
5219
5778
  CanonicalRequestType,
5220
5779
  CanonicalItemType,
5780
+ CUSTOM_TYPE_FOR,
5221
5781
  CODEX_REASONING_EFFORT_OPTIONS,
5222
5782
  CLI_OUTPUT_VERSION,
5223
5783
  AutomationConfig,
@@ -5230,5 +5790,8 @@ export {
5230
5790
  ApprovalDecision,
5231
5791
  AgentRoleRegistration,
5232
5792
  ActionId,
5793
+ ALL_GROUPS,
5794
+ ADVANCED_GROUPS,
5795
+ ADVANCED_COMMANDS,
5233
5796
  ACTIVE_RUN_STATUSES
5234
5797
  };