@h-rig/core 0.0.6-alpha.15 → 0.0.6-alpha.151

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.
@@ -0,0 +1,12 @@
1
+ import { EngineEvent, EngineReadModel, QueueEntry, RunSummary, TaskSummary } from "@rig/contracts";
2
+ type EngineApplyStatus = "applied" | "ignored" | "requires-resync";
3
+ export type ApplyStatus = EngineApplyStatus;
4
+ export interface EngineEventApplyResult {
5
+ readonly status: EngineApplyStatus;
6
+ readonly snapshot: EngineReadModel;
7
+ }
8
+ export declare function mapTaskStatusFromRunStatus(status: RunSummary["status"], fallback: TaskSummary["status"]): TaskSummary["status"];
9
+ export declare function applyEngineEvent(snapshot: EngineReadModel, event: EngineEvent): EngineEventApplyResult;
10
+ export declare function applyEngineEvents(snapshot: EngineReadModel, events: ReadonlyArray<EngineEvent>): EngineEventApplyResult;
11
+ export declare function pruneQueueEntries(snapshot: EngineReadModel): QueueEntry[];
12
+ export {};
@@ -10,6 +10,7 @@ import {
10
10
  WorkspaceId,
11
11
  WorktreeId
12
12
  } from "@rig/contracts";
13
+ var CANONICAL_RUNTIME_ADAPTER = "pi";
13
14
  function isRecord(value) {
14
15
  return typeof value === "object" && value !== null;
15
16
  }
@@ -149,7 +150,7 @@ function mapLegacySessionStatusToRunStatus(status) {
149
150
  case "error":
150
151
  return "failed";
151
152
  case "stopped":
152
- return "cancelled";
153
+ return "stopped";
153
154
  default:
154
155
  return "created";
155
156
  }
@@ -185,12 +186,15 @@ function mapTaskStatusFromRunStatus(status, fallback) {
185
186
  case "paused":
186
187
  return "in_progress";
187
188
  case "reviewing":
189
+ case "closing-out":
188
190
  return "under_review";
191
+ case "needs-attention":
192
+ return "blocked";
189
193
  case "completed":
190
194
  return "completed";
191
195
  case "failed":
192
196
  return "ready";
193
- case "cancelled":
197
+ case "stopped":
194
198
  return "cancelled";
195
199
  }
196
200
  }
@@ -374,7 +378,7 @@ function applySyntheticRuntimePreparation(snapshot, event) {
374
378
  ...existingRun,
375
379
  taskId: existingRun.taskId ?? nextTaskId,
376
380
  runKind: existingRun.runKind === "adhoc" && nextTaskId ? "task" : existingRun.runKind,
377
- runtimeAdapter: "rig-native",
381
+ runtimeAdapter: CANONICAL_RUNTIME_ADAPTER,
378
382
  initialPrompt: existingRun.initialPrompt ?? null,
379
383
  executionTarget: existingRun.executionTarget ?? "local",
380
384
  remoteHostId: existingRun.remoteHostId ?? null,
@@ -390,7 +394,7 @@ function applySyntheticRuntimePreparation(snapshot, event) {
390
394
  ...runtimeBase,
391
395
  workspaceId: nextWorkspaceId,
392
396
  runId: runtimeRunId,
393
- adapterKind: "rig-native",
397
+ adapterKind: CANONICAL_RUNTIME_ADAPTER,
394
398
  executionTarget: existingRun.executionTarget ?? "local",
395
399
  remoteHostId: existingRun.remoteHostId ?? null,
396
400
  status: failed ? "failed" : finished ? "prepared" : "starting",
@@ -439,7 +443,7 @@ function applySyntheticRuntimePrepared(snapshot, event) {
439
443
  ...snapshot.runtimes.find((runtime) => runtime.runId === runId) ?? makeRuntimeFromRun(existingRun, event.createdAt),
440
444
  workspaceId: nextWorkspaceId,
441
445
  runId: runtimeRunId,
442
- adapterKind: "rig-native",
446
+ adapterKind: CANONICAL_RUNTIME_ADAPTER,
443
447
  executionTarget: existingRun.executionTarget ?? "local",
444
448
  remoteHostId: existingRun.remoteHostId ?? null,
445
449
  status: "prepared",
@@ -482,7 +486,7 @@ function applyLegacyProjectEvent(snapshot, event) {
482
486
  title,
483
487
  rootPath,
484
488
  sourceKind: "native",
485
- defaultRuntimeAdapter: "codex-app-server",
489
+ defaultRuntimeAdapter: CANONICAL_RUNTIME_ADAPTER,
486
490
  defaultModel: readNullableString(payload, "defaultModel") ?? null,
487
491
  createdAt,
488
492
  updatedAt
@@ -577,7 +581,7 @@ function applyLegacyThreadEvent(snapshot, event) {
577
581
  runtimeMode: "full-access",
578
582
  interactionMode: "default",
579
583
  status: "created",
580
- runtimeAdapter: "codex-app-server",
584
+ runtimeAdapter: CANONICAL_RUNTIME_ADAPTER,
581
585
  model,
582
586
  initialPrompt: null,
583
587
  activeRuntimeId: null,
@@ -761,7 +765,7 @@ function applyLegacyThreadEvent(snapshot, event) {
761
765
  const providerName = readNullableString(session, "providerName");
762
766
  const nextRun = {
763
767
  ...existingRun,
764
- runtimeAdapter: providerName ?? existingRun.runtimeAdapter,
768
+ runtimeAdapter: CANONICAL_RUNTIME_ADAPTER,
765
769
  initialPrompt: existingRun.initialPrompt ?? null,
766
770
  activeRuntimeId: runtimeIdFromRunId(asRunId(runId)),
767
771
  status: mapLegacySessionStatusToRunStatus(readString(session, "status")),
@@ -774,7 +778,7 @@ function applyLegacyThreadEvent(snapshot, event) {
774
778
  ...snapshot.runtimes.find((runtime) => runtime.runId === runId) ?? makeRuntimeFromRun(nextRun, sessionUpdatedAt),
775
779
  workspaceId: existingRun.workspaceId,
776
780
  runId: asRunId(runId),
777
- adapterKind: providerName ?? existingRun.runtimeAdapter,
781
+ adapterKind: CANONICAL_RUNTIME_ADAPTER,
778
782
  status: mapLegacySessionStatusToRuntimeStatus(readString(session, "status")),
779
783
  workspaceDir: existingRun.worktreePath,
780
784
  isolationMode: existingRun.worktreePath ? "worktree" : "env",
@@ -1008,7 +1012,7 @@ function applyEngineEvent(snapshot, event) {
1008
1012
  runtimeMode: payload.runtimeMode,
1009
1013
  interactionMode: payload.interactionMode,
1010
1014
  status: "created",
1011
- runtimeAdapter: payload.runtimeAdapter,
1015
+ runtimeAdapter: CANONICAL_RUNTIME_ADAPTER,
1012
1016
  model: payload.model ?? null,
1013
1017
  initialPrompt: payload.initialPrompt ?? null,
1014
1018
  executionTarget: payload.executionTarget ?? (payload.remoteHostId ? "remote" : "local"),
@@ -1040,7 +1044,7 @@ function applyEngineEvent(snapshot, event) {
1040
1044
  ...base,
1041
1045
  runs: patchById(base.runs, payload.runId, (run) => ({
1042
1046
  ...run,
1043
- status: "cancelled",
1047
+ status: "stopped",
1044
1048
  updatedAt: payload.createdAt,
1045
1049
  completedAt: payload.createdAt
1046
1050
  }))
@@ -1704,7 +1708,7 @@ function applyEngineEvent(snapshot, event) {
1704
1708
  runtimeMode: "full-access",
1705
1709
  interactionMode: "default",
1706
1710
  status: "created",
1707
- runtimeAdapter: "rig-native",
1711
+ runtimeAdapter: CANONICAL_RUNTIME_ADAPTER,
1708
1712
  model: null,
1709
1713
  initialPrompt: null,
1710
1714
  activeRuntimeId: runtimeIdFromRunId(asRunId(runId)),
@@ -1724,7 +1728,7 @@ function applyEngineEvent(snapshot, event) {
1724
1728
  workspaceId: asWorkspaceId(workspaceId),
1725
1729
  taskId: asTaskId(taskId),
1726
1730
  runKind: "task",
1727
- runtimeAdapter: "rig-native",
1731
+ runtimeAdapter: CANONICAL_RUNTIME_ADAPTER,
1728
1732
  activeRuntimeId: runtimeIdFromRunId(asRunId(runId)),
1729
1733
  updatedAt: event.createdAt
1730
1734
  });
@@ -0,0 +1,16 @@
1
+ export declare const RIG_CORE_PACKAGE = "@rig/core";
2
+ export { definePlugin } from "./define-plugin";
3
+ export { defineConfig } from "./define-config";
4
+ export { createPluginHost } from "./plugin-host";
5
+ export type { PluginHost } from "./plugin-host";
6
+ export { buildRigInitConfigSource, type RigInitConfigInput, } from "./rig-init-builder";
7
+ export type { RegisteredValidator, RigPluginRuntime, RigPluginWithRuntime, TaskSourceFactoryContext, RuntimeCliCommand, RuntimeCliContext, RuntimePanelProducer, TaskSourceFactoryEntry, ValidatorContext, ValidatorResult, } from "./plugin-runtime";
8
+ export { applyEngineEvent, applyEngineEvents, applyEngineEvent as applyRigEvent, pruneQueueEntries, type ApplyStatus, type EngineEventApplyResult, type EngineEventApplyResult as RigEventApplyResult, } from "./engineReadModelReducer";
9
+ export { pickDefaultWorkspaceId, projectRunStatusForTaskGrouping, projectTaskStatusForGrouping, projectTaskStatusWithSessions, normalizeTaskAssigneeFilter, readTaskAssigneeLogins, selectAdhocRuns, selectAdhocRunsForWorkspace, selectApprovalsForRun, selectApprovalsForWorkspace, selectGraphsForWorkspace, selectPendingApprovals, selectPrimaryWorkspace, selectQueueForWorkspace, selectRun, selectRunsByTask, selectRunsForTask, selectRunsForWorkspace, selectTask, selectTasksByStatus, selectTasksByWorkspace, selectTasksForWorkspace, selectTasksGroupedByStatus, selectTasksAssignedTo, selectTasksAssignedToMe, selectUserInputsForRun, selectUserInputsForWorkspace, selectWorkspace, selectWorkspaces, type RigTaskSessionProjection, type RigTaskStatusGroup, type RigTaskStatusGroupingInput, } from "./rigSelectors";
10
+ export { buildTaskReferenceIndex, computeTaskBlockingDepths, computeTaskDependencyBadges, disjointScope, isTaskTerminalStatus, rankReadyTasks, readTaskBlockingDependencyRefs, readTaskDependencyRefs, readTaskMetadataStringList, readTaskScope, readTaskSourceIssueId, resolveTaskReference, selectNextReadyTaskByPriority, selectRankedReadyTasks, type RankedReadyTask, type RankedReadyTaskOptions, type ReadyTaskSelectionMode, type TaskDependencyBadge, type TaskDependencyBadgeKind, type TaskDependencyBadgeSummary, type TaskDependencyProjection, type TaskScopeInput, } from "./taskGraph";
11
+ export { extractTaskCode, extractTaskGroupKey, stripTaskCode, } from "./taskGraphCodes";
12
+ export { buildTaskGraphLayout, type TaskGraphEdge, type TaskGraphLane, type TaskGraphLayout, type TaskGraphNode, type TaskGraphStage, } from "./taskGraphLayout";
13
+ export { PipelineUnresolvableError, resolveStagePipeline, type DroppedStageAnchor, type ResolvableStage, type ResolvedStagePipeline, type ResolveStagePipelineInput, type StageKind, type StageMutation, type StageMutationOp, type StageResolutionRecordEntry, type StageWrapper, } from "./stageResolve";
14
+ export { rankTasks, scoreTask, type RankedTask, type TaskCriticality, type TaskScoreInput, } from "./taskScore";
15
+ export { buildDependencyGraphModel, type BuildDependencyGraphModelOptions, type DependencyEdge, type DependencyEdgeType, type DependencyGraphModel, type DependencyNode, } from "./dependencyGraph";
16
+ export { rollupByAssignee, rollupByEpic, type AssigneeRollup, type BlockerClass, type EpicRollup, } from "./rollups";