@h-rig/standard-plugin 0.0.6-alpha.142 → 0.0.6-alpha.143

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,11 @@
1
+ export type RigProductCommandName = "launch" | "join" | "acp" | "models" | "mcp" | "update";
2
+ export type RunRigOmpProductCommandInput = {
3
+ readonly projectRoot: string;
4
+ readonly command: RigProductCommandName;
5
+ readonly args: readonly string[];
6
+ };
7
+ export declare function runRigOmpProductCommand(input: RunRigOmpProductCommandInput): Promise<{
8
+ ok: true;
9
+ group: string;
10
+ command: string;
11
+ }>;
@@ -0,0 +1,101 @@
1
+ // @bun
2
+ // packages/standard-plugin/src/product-entrypoint.ts
3
+ import { resolve } from "path";
4
+ import { runCli } from "@oh-my-pi/pi-coding-agent/cli";
5
+ import { parseArgs } from "@oh-my-pi/pi-coding-agent/cli/args";
6
+ import { resolveCliArgv } from "@oh-my-pi/pi-coding-agent/cli-commands";
7
+ import { prepareAcpTerminalAuthArgs } from "@oh-my-pi/pi-coding-agent/modes/acp/terminal-auth";
8
+ import { runRootCommand } from "@oh-my-pi/pi-coding-agent/main";
9
+ import { createAgentSession } from "@oh-my-pi/pi-coding-agent/sdk";
10
+ import { applyIdentityEnv, identityFilterFromEnv, reconcileRuns } from "@rig/client";
11
+ import rigExtension from "@rig/rig-extension";
12
+ import { resolveRigOmpConfigOverlayPath } from "@rig/runtime/control-plane/remote-config";
13
+ function withRigDefaultConfig(projectRoot, argv) {
14
+ return ["--config", resolveRigOmpConfigOverlayPath(projectRoot), ...argv];
15
+ }
16
+ function createRigAgentSession(options = {}) {
17
+ return createAgentSession({
18
+ ...options,
19
+ extensions: [(api) => rigExtension(api), ...options.extensions ?? []]
20
+ });
21
+ }
22
+ function productArgv(input) {
23
+ if (input.command === "launch" && input.args.length === 0)
24
+ return [];
25
+ if (input.command === "launch" && input.args[0]?.startsWith("-"))
26
+ return [...input.args];
27
+ return [input.command, ...input.args];
28
+ }
29
+ async function runRigOmpProductCommand(input) {
30
+ const projectRoot = resolve(input.projectRoot);
31
+ const previousProjectRoot = process.env.RIG_PROJECT_ROOT;
32
+ const previousCwd = process.cwd();
33
+ const restorePublicIdentityEnv = applyIdentityEnv(projectRoot);
34
+ process.env.RIG_PROJECT_ROOT = projectRoot;
35
+ process.chdir(projectRoot);
36
+ try {
37
+ const argv = productArgv(input);
38
+ if (argv[0]?.startsWith("__omp_worker_") || argv[0] === "--smoke-test") {
39
+ await runCli(argv);
40
+ return { ok: true, group: "product", command: input.command };
41
+ }
42
+ if (process.stdin.isTTY) {
43
+ const reconcile = await reconcileRuns({
44
+ workspaceRoot: projectRoot,
45
+ identityFilter: identityFilterFromEnv()
46
+ }).catch(() => ({ flipped: [], resumable: [] }));
47
+ globalThis.__RIG_RESUMABLE__ = reconcile.resumable;
48
+ }
49
+ const resolved = resolveCliArgv(argv);
50
+ if ("error" in resolved) {
51
+ process.stderr.write(`error: ${resolved.error}
52
+ `);
53
+ process.exitCode = 1;
54
+ return { ok: true, group: "product", command: input.command };
55
+ }
56
+ const [ompCommand, ...ompCommandArgs] = resolved.argv;
57
+ if (ompCommand === "launch") {
58
+ const args = withRigDefaultConfig(projectRoot, ompCommandArgs);
59
+ await runRootCommand(parseArgs(args), args, { createAgentSession: createRigAgentSession });
60
+ } else if (ompCommand === "acp") {
61
+ const { args: preparedArgs, terminalAuth } = prepareAcpTerminalAuthArgs(ompCommandArgs);
62
+ const args = withRigDefaultConfig(projectRoot, preparedArgs);
63
+ const parsed = parseArgs(args);
64
+ if (!terminalAuth)
65
+ parsed.mode = "acp";
66
+ await runRootCommand(parsed, args, { createAgentSession: createRigAgentSession });
67
+ } else if (ompCommand === "join") {
68
+ const link = ompCommandArgs[0]?.trim();
69
+ if (!link) {
70
+ process.stderr.write(`Usage: rig join <link>
71
+ `);
72
+ process.exitCode = 1;
73
+ return { ok: true, group: "product", command: input.command };
74
+ }
75
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
76
+ process.stderr.write(`rig join requires an interactive terminal
77
+ `);
78
+ process.exitCode = 1;
79
+ return { ok: true, group: "product", command: input.command };
80
+ }
81
+ const args = withRigDefaultConfig(projectRoot, []);
82
+ const parsed = parseArgs(args);
83
+ parsed.join = link;
84
+ await runRootCommand(parsed, args, { createAgentSession: createRigAgentSession });
85
+ } else {
86
+ await runCli(resolved.argv);
87
+ }
88
+ return { ok: true, group: "product", command: input.command };
89
+ } finally {
90
+ restorePublicIdentityEnv();
91
+ process.chdir(previousCwd);
92
+ if (previousProjectRoot === undefined) {
93
+ delete process.env.RIG_PROJECT_ROOT;
94
+ } else {
95
+ process.env.RIG_PROJECT_ROOT = previousProjectRoot;
96
+ }
97
+ }
98
+ }
99
+ export {
100
+ runRigOmpProductCommand
101
+ };
@@ -0,0 +1,15 @@
1
+ import type { PanelRegistration, RunJournalProjection } from "@rig/contracts";
2
+ import type { RigPluginWithRuntime, RuntimePanelProducer } from "@rig/core/config";
3
+ export declare const RIG_RUN_STOP_PANEL_ACTION = "rig-run:stop";
4
+ export declare const RIG_CAPABILITY_PANEL_SLOT = "capability";
5
+ export declare const RIG_SUPERVISOR_PANEL_ID = "supervisor";
6
+ export interface WorkerPanelProducerContext {
7
+ readonly projectRoot: string;
8
+ readonly runId: string;
9
+ readonly folded: RunJournalProjection;
10
+ readonly taskIdAtStart?: string | null;
11
+ readonly runDisplayTitle: string;
12
+ }
13
+ export declare const RUN_SUPERVISOR_PANEL_REGISTRATION: PanelRegistration;
14
+ export declare const RUN_SUPERVISOR_PANEL_PRODUCER: RuntimePanelProducer;
15
+ export declare const RUN_WORKER_PANEL_PLUGIN: RigPluginWithRuntime;
@@ -0,0 +1,53 @@
1
+ // @bun
2
+ // packages/standard-plugin/src/run-worker-panels.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
+ var RUN_SUPERVISOR_PANEL_REGISTRATION = {
7
+ id: RIG_SUPERVISOR_PANEL_ID,
8
+ slot: RIG_CAPABILITY_PANEL_SLOT,
9
+ title: "Supervisor",
10
+ capabilityId: "run.supervisor",
11
+ description: "Live run status, closeout progress, and operator stop control."
12
+ };
13
+ function buildSupervisorPanelPayload(context) {
14
+ const status = context.folded.status ?? "unknown";
15
+ const taskId = context.folded.record.taskId ?? context.taskIdAtStart;
16
+ const operatorActive = status === "running" || status === "validating" || status === "closing-out" || status === "needs-attention";
17
+ return {
18
+ status,
19
+ currentTask: taskId ? { id: taskId, title: context.runDisplayTitle } : null,
20
+ processed: context.folded.closeoutPhases.length,
21
+ succeeded: context.folded.closeoutPhases.filter((phase) => phase.outcome === "completed").length,
22
+ failed: context.folded.closeoutPhases.filter((phase) => phase.outcome === "failed").length,
23
+ skipped: 0,
24
+ plannedOrder: taskId ? [{ id: taskId, title: context.runDisplayTitle, status }] : [],
25
+ idleReason: operatorActive ? null : status,
26
+ stopActionId: operatorActive ? RIG_RUN_STOP_PANEL_ACTION : null,
27
+ closures: []
28
+ };
29
+ }
30
+ var RUN_SUPERVISOR_PANEL_PRODUCER = {
31
+ ...RUN_SUPERVISOR_PANEL_REGISTRATION,
32
+ produce(context) {
33
+ return buildSupervisorPanelPayload(context);
34
+ }
35
+ };
36
+ var RUN_WORKER_PANEL_PLUGIN = {
37
+ name: "@rig/standard-plugin:run-worker-panels",
38
+ version: "0.0.0-alpha.1",
39
+ contributes: {
40
+ panels: [RUN_SUPERVISOR_PANEL_REGISTRATION]
41
+ },
42
+ __runtime: {
43
+ panels: [RUN_SUPERVISOR_PANEL_PRODUCER]
44
+ }
45
+ };
46
+ export {
47
+ RUN_WORKER_PANEL_PLUGIN,
48
+ RUN_SUPERVISOR_PANEL_REGISTRATION,
49
+ RUN_SUPERVISOR_PANEL_PRODUCER,
50
+ RIG_SUPERVISOR_PANEL_ID,
51
+ RIG_RUN_STOP_PANEL_ACTION,
52
+ RIG_CAPABILITY_PANEL_SLOT
53
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/standard-plugin",
3
- "version": "0.0.6-alpha.142",
3
+ "version": "0.0.6-alpha.143",
4
4
  "type": "module",
5
5
  "description": "First-party contribution bundle for Rig's OMP extension plugin graph; not a standalone plugin runtime.",
6
6
  "license": "UNLICENSED",
@@ -21,6 +21,18 @@
21
21
  "types": "./dist/src/plugin.d.ts",
22
22
  "import": "./dist/src/plugin.js"
23
23
  },
24
+ "./lifecycle-closeout": {
25
+ "types": "./dist/src/lifecycle-closeout.d.ts",
26
+ "import": "./dist/src/lifecycle-closeout.js"
27
+ },
28
+ "./run-worker-panels": {
29
+ "types": "./dist/src/run-worker-panels.d.ts",
30
+ "import": "./dist/src/run-worker-panels.js"
31
+ },
32
+ "./cli-surface": {
33
+ "types": "./dist/src/cli-surface.d.ts",
34
+ "import": "./dist/src/cli-surface.js"
35
+ },
24
36
  "./drift": {
25
37
  "types": "./dist/src/drift/plugin.d.ts",
26
38
  "import": "./dist/src/drift/plugin.js"
@@ -37,13 +49,17 @@
37
49
  "module": "./dist/src/index.js",
38
50
  "types": "./dist/src/index.d.ts",
39
51
  "dependencies": {
40
- "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.142",
41
- "@rig/blocker-classifier-plugin": "npm:@h-rig/blocker-classifier-plugin@0.0.6-alpha.142",
42
- "@rig/bundle-default-lifecycle": "npm:@h-rig/bundle-default-lifecycle@0.0.6-alpha.142",
43
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.142",
44
- "@rig/dependency-graph-plugin": "npm:@h-rig/dependency-graph-plugin@0.0.6-alpha.142",
45
- "@rig/planning-plugin": "npm:@h-rig/planning-plugin@0.0.6-alpha.142",
46
- "@rig/supervisor-plugin": "npm:@h-rig/supervisor-plugin@0.0.6-alpha.142",
52
+ "@oh-my-pi/pi-coding-agent": "16.0.4",
53
+ "@rig/blocker-classifier-plugin": "npm:@h-rig/blocker-classifier-plugin@0.0.6-alpha.143",
54
+ "@rig/bundle-default-lifecycle": "npm:@h-rig/bundle-default-lifecycle@0.0.6-alpha.143",
55
+ "@rig/client": "npm:@h-rig/client@0.0.6-alpha.143",
56
+ "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.143",
57
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.143",
58
+ "@rig/dependency-graph-plugin": "npm:@h-rig/dependency-graph-plugin@0.0.6-alpha.143",
59
+ "@rig/planning-plugin": "npm:@h-rig/planning-plugin@0.0.6-alpha.143",
60
+ "@rig/rig-extension": "npm:@h-rig/rig-extension@0.0.6-alpha.143",
61
+ "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.143",
62
+ "@rig/supervisor-plugin": "npm:@h-rig/supervisor-plugin@0.0.6-alpha.143",
47
63
  "effect": "4.0.0-beta.90"
48
64
  }
49
65
  }