@h-rig/omp-extension-plugin 0.0.6-alpha.186
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/src/cockpit/board-views.d.ts +100 -0
- package/dist/src/cockpit/board-views.js +298 -0
- package/dist/src/cockpit/cockpit-product.d.ts +12 -0
- package/dist/src/cockpit/cockpit-product.js +55 -0
- package/dist/src/cockpit/drone-preloader.d.ts +11 -0
- package/dist/src/cockpit/drone-preloader.js +220 -0
- package/dist/src/cockpit/extension.d.ts +85 -0
- package/dist/src/cockpit/extension.js +2222 -0
- package/dist/src/cockpit/plugin.d.ts +14 -0
- package/dist/src/cockpit/plugin.js +2277 -0
- package/dist/src/cockpit/screen-catalog.d.ts +55 -0
- package/dist/src/cockpit/screen-catalog.js +65 -0
- package/dist/src/plugin.d.ts +4 -0
- package/dist/src/plugin.js +2596 -0
- package/dist/src/product-entrypoint/contributions.d.ts +3 -0
- package/dist/src/product-entrypoint/contributions.js +215 -0
- package/dist/src/product-entrypoint/metadata.d.ts +17 -0
- package/dist/src/product-entrypoint/metadata.js +29 -0
- package/dist/src/product-entrypoint/plugin.d.ts +4 -0
- package/dist/src/product-entrypoint/plugin.js +300 -0
- package/dist/src/product-entrypoint/product-entrypoint.d.ts +14 -0
- package/dist/src/product-entrypoint/product-entrypoint.js +136 -0
- package/dist/src/product-entrypoint/product-help.d.ts +6 -0
- package/dist/src/product-entrypoint/product-help.js +57 -0
- package/package.json +39 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/omp-extension-plugin/src/product-entrypoint/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 { defineCapability } from "@rig/core/capability";
|
|
11
|
+
import { loadCapabilityForRoot } from "@rig/core/capability-loaders";
|
|
12
|
+
import { resolvePluginHost } from "@rig/core/project-plugins";
|
|
13
|
+
import { RUN_IDENTITY_ENV, RUN_READ_MODEL, TRANSPORT_CONFIG } from "@rig/contracts";
|
|
14
|
+
var RunIdentityEnvCap = defineCapability(RUN_IDENTITY_ENV);
|
|
15
|
+
var TransportConfigCap = defineCapability(TRANSPORT_CONFIG);
|
|
16
|
+
var RunReadModelCap = defineCapability(RUN_READ_MODEL);
|
|
17
|
+
async function withRigDefaultConfig(projectRoot, argv) {
|
|
18
|
+
const transportConfig = await loadCapabilityForRoot(projectRoot, TransportConfigCap);
|
|
19
|
+
if (!transportConfig)
|
|
20
|
+
throw new Error("TRANSPORT_CONFIG capability unavailable: load @rig/transport-plugin before launching OMP.");
|
|
21
|
+
return ["--config", transportConfig.resolveRigOmpConfigOverlayPath({ projectRoot }), ...argv];
|
|
22
|
+
}
|
|
23
|
+
async function createRigAgentSession(projectRoot, options = {}) {
|
|
24
|
+
const { host } = await resolvePluginHost(projectRoot);
|
|
25
|
+
const sessionExtensions = host.listSessionExtensions();
|
|
26
|
+
return createAgentSession({
|
|
27
|
+
...options,
|
|
28
|
+
extensions: [...sessionExtensions.map((entry) => (api) => entry.install(api, { panels: host.listPanels() })), ...options.extensions ?? []]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function productArgv(input) {
|
|
32
|
+
if (input.command === "launch" && input.args.length === 0)
|
|
33
|
+
return [];
|
|
34
|
+
if (input.command === "launch" && input.args[0]?.startsWith("-"))
|
|
35
|
+
return [...input.args];
|
|
36
|
+
return [input.command, ...input.args];
|
|
37
|
+
}
|
|
38
|
+
async function joinRigOmpProductSession(input) {
|
|
39
|
+
const projectRoot = resolve(input.projectRoot);
|
|
40
|
+
const link = input.link.trim();
|
|
41
|
+
const previousProjectRoot = process.env.RIG_PROJECT_ROOT;
|
|
42
|
+
const previousCwd = process.cwd();
|
|
43
|
+
const identityEnv = await loadCapabilityForRoot(projectRoot, RunIdentityEnvCap);
|
|
44
|
+
const restorePublicIdentityEnv = identityEnv?.applyIdentityEnv(projectRoot) ?? (() => {});
|
|
45
|
+
process.env.RIG_PROJECT_ROOT = projectRoot;
|
|
46
|
+
process.chdir(projectRoot);
|
|
47
|
+
try {
|
|
48
|
+
const args = await withRigDefaultConfig(projectRoot, []);
|
|
49
|
+
const parsed = parseArgs(args);
|
|
50
|
+
parsed.join = link;
|
|
51
|
+
await runRootCommand(parsed, args, { createAgentSession: (options) => createRigAgentSession(projectRoot, options) });
|
|
52
|
+
return { ok: true, group: "product", command: "join" };
|
|
53
|
+
} finally {
|
|
54
|
+
restorePublicIdentityEnv();
|
|
55
|
+
process.chdir(previousCwd);
|
|
56
|
+
if (previousProjectRoot === undefined) {
|
|
57
|
+
delete process.env.RIG_PROJECT_ROOT;
|
|
58
|
+
} else {
|
|
59
|
+
process.env.RIG_PROJECT_ROOT = previousProjectRoot;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function runRigOmpProductCommand(input) {
|
|
64
|
+
const projectRoot = resolve(input.projectRoot);
|
|
65
|
+
const previousProjectRoot = process.env.RIG_PROJECT_ROOT;
|
|
66
|
+
const previousCwd = process.cwd();
|
|
67
|
+
const identityEnv = await loadCapabilityForRoot(projectRoot, RunIdentityEnvCap);
|
|
68
|
+
const restorePublicIdentityEnv = identityEnv?.applyIdentityEnv(projectRoot) ?? (() => {});
|
|
69
|
+
process.env.RIG_PROJECT_ROOT = projectRoot;
|
|
70
|
+
process.chdir(projectRoot);
|
|
71
|
+
try {
|
|
72
|
+
const argv = productArgv(input);
|
|
73
|
+
if (argv[0]?.startsWith("__omp_worker_") || argv[0] === "--smoke-test") {
|
|
74
|
+
await runCli(argv);
|
|
75
|
+
return { ok: true, group: "product", command: input.command };
|
|
76
|
+
}
|
|
77
|
+
if (process.stdin.isTTY) {
|
|
78
|
+
const readModel = await loadCapabilityForRoot(projectRoot, RunReadModelCap);
|
|
79
|
+
if (readModel) {
|
|
80
|
+
await readModel.reconcileActiveRuns({
|
|
81
|
+
workspaceRoot: projectRoot,
|
|
82
|
+
identityFilter: identityEnv?.identityFilterFromEnv() ?? {}
|
|
83
|
+
}).catch(() => ({ flipped: [], resumable: [] }));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const resolved = resolveCliArgv(argv);
|
|
87
|
+
if ("error" in resolved) {
|
|
88
|
+
process.stderr.write(`error: ${resolved.error}
|
|
89
|
+
`);
|
|
90
|
+
process.exitCode = 1;
|
|
91
|
+
return { ok: true, group: "product", command: input.command };
|
|
92
|
+
}
|
|
93
|
+
const [ompCommand, ...ompCommandArgs] = resolved.argv;
|
|
94
|
+
if (ompCommand === "launch") {
|
|
95
|
+
const args = await withRigDefaultConfig(projectRoot, ompCommandArgs);
|
|
96
|
+
await runRootCommand(parseArgs(args), args, { createAgentSession: (options) => createRigAgentSession(projectRoot, options) });
|
|
97
|
+
} else if (ompCommand === "acp") {
|
|
98
|
+
const { args: preparedArgs, terminalAuth } = prepareAcpTerminalAuthArgs(ompCommandArgs);
|
|
99
|
+
const args = await withRigDefaultConfig(projectRoot, preparedArgs);
|
|
100
|
+
const parsed = parseArgs(args);
|
|
101
|
+
if (!terminalAuth)
|
|
102
|
+
parsed.mode = "acp";
|
|
103
|
+
await runRootCommand(parsed, args, { createAgentSession: (options) => createRigAgentSession(projectRoot, options) });
|
|
104
|
+
} else if (ompCommand === "join") {
|
|
105
|
+
const link = ompCommandArgs[0]?.trim();
|
|
106
|
+
if (!link) {
|
|
107
|
+
process.stderr.write(`Usage: rig join <link>
|
|
108
|
+
`);
|
|
109
|
+
process.exitCode = 1;
|
|
110
|
+
return { ok: true, group: "product", command: input.command };
|
|
111
|
+
}
|
|
112
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
113
|
+
process.stderr.write(`rig join requires an interactive terminal
|
|
114
|
+
`);
|
|
115
|
+
process.exitCode = 1;
|
|
116
|
+
return { ok: true, group: "product", command: input.command };
|
|
117
|
+
}
|
|
118
|
+
await joinRigOmpProductSession({ projectRoot, link });
|
|
119
|
+
} else {
|
|
120
|
+
await runCli(resolved.argv);
|
|
121
|
+
}
|
|
122
|
+
return { ok: true, group: "product", command: input.command };
|
|
123
|
+
} finally {
|
|
124
|
+
restorePublicIdentityEnv();
|
|
125
|
+
process.chdir(previousCwd);
|
|
126
|
+
if (previousProjectRoot === undefined) {
|
|
127
|
+
delete process.env.RIG_PROJECT_ROOT;
|
|
128
|
+
} else {
|
|
129
|
+
process.env.RIG_PROJECT_ROOT = previousProjectRoot;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export {
|
|
134
|
+
runRigOmpProductCommand,
|
|
135
|
+
joinRigOmpProductSession
|
|
136
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HelpCatalog, HelpGroup } from "@rig/contracts";
|
|
2
|
+
/** Assemble the help catalog from the host's contributed commands' helpDoc. */
|
|
3
|
+
export declare function assembleHelpCatalog(commands: readonly {
|
|
4
|
+
readonly family?: string;
|
|
5
|
+
readonly helpDoc?: HelpGroup;
|
|
6
|
+
}[]): HelpCatalog;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/omp-extension-plugin/src/product-entrypoint/product-help.ts
|
|
3
|
+
var TOP_LEVEL_SECTIONS = [
|
|
4
|
+
{
|
|
5
|
+
title: "Open Rig",
|
|
6
|
+
subtitle: "the cockpit \u2014 bare rig opens the Rig Cockpit inside an OMP collab session",
|
|
7
|
+
commands: [
|
|
8
|
+
{
|
|
9
|
+
command: "rig",
|
|
10
|
+
description: "Open the Rig Cockpit (OMP collaboration substrate) for the current workspace.",
|
|
11
|
+
usecase: "Day-to-day entry point: drive everything (tasks, runs, inbox) from the board.",
|
|
12
|
+
examples: ["cd my-project && rig", "rig # in a repo with rig.config.ts"]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
command: "rig --workspace <path>",
|
|
16
|
+
description: "Open the cockpit for another workspace instead of the current dir.",
|
|
17
|
+
usecase: "Operate a project without cd-ing into it.",
|
|
18
|
+
examples: ["rig --workspace ~/work/humanwork", "rig --workspace ../other-repo"]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
command: "rig join <link>",
|
|
22
|
+
description: "Join an encrypted OMP collaborative session from another operator.",
|
|
23
|
+
usecase: "Pair on a teammate's live run from the join link they shared.",
|
|
24
|
+
examples: ["rig join where.rig-does.work/r/AbC123\u2026"]
|
|
25
|
+
},
|
|
26
|
+
{ command: "/rig", description: "From inside an OMP session, (re)open the Rig Cockpit screen.", usecase: "Jump back to the board after dropping into the raw agent session." },
|
|
27
|
+
{ command: "rig --version", description: "Print the installed Rig CLI version.", examples: ["rig --version"] }
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
var ADVANCED_COMMANDS = [
|
|
32
|
+
{ command: "rig server task-run ...", description: "Internal legacy server-owned task execution entry point." },
|
|
33
|
+
{ command: "rig server notify-test [--event <type>]", description: "Internal diagnostic event notification smoke command." },
|
|
34
|
+
{ command: "rig run start|start-serial|start-parallel", description: "Legacy/internal queue starters; not the Rig Cockpit task-detail dispatch path." },
|
|
35
|
+
{ command: "rig remote orchestrate-*", description: "Legacy automation-only remote orchestration commands." }
|
|
36
|
+
];
|
|
37
|
+
function assembleHelpCatalog(commands) {
|
|
38
|
+
const seen = new Set;
|
|
39
|
+
const groups = [];
|
|
40
|
+
for (const command of commands) {
|
|
41
|
+
const helpDoc = command.helpDoc;
|
|
42
|
+
if (!helpDoc || seen.has(helpDoc.name))
|
|
43
|
+
continue;
|
|
44
|
+
seen.add(helpDoc.name);
|
|
45
|
+
groups.push(helpDoc);
|
|
46
|
+
}
|
|
47
|
+
const advancedGroupNames = groups.filter((group) => group.advancedOnly).map((group) => group.name);
|
|
48
|
+
return {
|
|
49
|
+
sections: TOP_LEVEL_SECTIONS,
|
|
50
|
+
groups,
|
|
51
|
+
advancedCommands: ADVANCED_COMMANDS,
|
|
52
|
+
advancedGroupNames
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
assembleHelpCatalog
|
|
57
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@h-rig/omp-extension-plugin",
|
|
3
|
+
"version": "0.0.6-alpha.186",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "The single home for Rig's OMP session-extension surfaces: cockpit shell host + product entrypoint.",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/src/cockpit/extension.d.ts",
|
|
14
|
+
"import": "./dist/src/cockpit/extension.js"
|
|
15
|
+
},
|
|
16
|
+
"./plugin": {
|
|
17
|
+
"types": "./dist/src/plugin.d.ts",
|
|
18
|
+
"import": "./dist/src/plugin.js"
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"bun": ">=1.3.11"
|
|
24
|
+
},
|
|
25
|
+
"omp": {
|
|
26
|
+
"extensions": [
|
|
27
|
+
"./dist/src/cockpit/extension.js"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@oh-my-pi/pi-coding-agent": "16.2.4",
|
|
32
|
+
"@oh-my-pi/pi-tui": "16.2.4",
|
|
33
|
+
"@oh-my-pi/pi-utils": "16.2.4",
|
|
34
|
+
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.186",
|
|
35
|
+
"@rig/core": "npm:@h-rig/core@0.0.6-alpha.186",
|
|
36
|
+
"@rig/std-shared": "npm:@h-rig/std-shared@0.0.6-alpha.186",
|
|
37
|
+
"effect": "4.0.0-beta.90"
|
|
38
|
+
}
|
|
39
|
+
}
|