@h-rig/product-entrypoint-plugin 0.0.6-alpha.150 → 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.
Files changed (2) hide show
  1. package/dist/src/plugin.js +6 -121
  2. package/package.json +5 -5
@@ -1,123 +1,4 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
- // packages/product-entrypoint-plugin/src/product-entrypoint.ts
19
- var exports_product_entrypoint = {};
20
- __export(exports_product_entrypoint, {
21
- runRigOmpProductCommand: () => runRigOmpProductCommand
22
- });
23
- import { resolve } from "path";
24
- import { runCli } from "@oh-my-pi/pi-coding-agent/cli";
25
- import { parseArgs } from "@oh-my-pi/pi-coding-agent/cli/args";
26
- import { resolveCliArgv } from "@oh-my-pi/pi-coding-agent/cli-commands";
27
- import { prepareAcpTerminalAuthArgs } from "@oh-my-pi/pi-coding-agent/modes/acp/terminal-auth";
28
- import { runRootCommand } from "@oh-my-pi/pi-coding-agent/main";
29
- import { createAgentSession } from "@oh-my-pi/pi-coding-agent/sdk";
30
- import { applyIdentityEnv, identityFilterFromEnv, reconcileRuns } from "@rig/client";
31
- import rigExtension from "@rig/rig-extension";
32
- import { resolveRigOmpConfigOverlayPath } from "@rig/runtime/control-plane/remote-config";
33
- function withRigDefaultConfig(projectRoot, argv) {
34
- return ["--config", resolveRigOmpConfigOverlayPath(projectRoot), ...argv];
35
- }
36
- function createRigAgentSession(options = {}) {
37
- return createAgentSession({
38
- ...options,
39
- extensions: [(api) => rigExtension(api), ...options.extensions ?? []]
40
- });
41
- }
42
- function productArgv(input) {
43
- if (input.command === "launch" && input.args.length === 0)
44
- return [];
45
- if (input.command === "launch" && input.args[0]?.startsWith("-"))
46
- return [...input.args];
47
- return [input.command, ...input.args];
48
- }
49
- async function runRigOmpProductCommand(input) {
50
- const projectRoot = resolve(input.projectRoot);
51
- const previousProjectRoot = process.env.RIG_PROJECT_ROOT;
52
- const previousCwd = process.cwd();
53
- const restorePublicIdentityEnv = applyIdentityEnv(projectRoot);
54
- process.env.RIG_PROJECT_ROOT = projectRoot;
55
- process.chdir(projectRoot);
56
- try {
57
- const argv = productArgv(input);
58
- if (argv[0]?.startsWith("__omp_worker_") || argv[0] === "--smoke-test") {
59
- await runCli(argv);
60
- return { ok: true, group: "product", command: input.command };
61
- }
62
- if (process.stdin.isTTY) {
63
- const reconcile = await reconcileRuns({
64
- workspaceRoot: projectRoot,
65
- identityFilter: identityFilterFromEnv()
66
- }).catch(() => ({ flipped: [], resumable: [] }));
67
- globalThis.__RIG_RESUMABLE__ = reconcile.resumable;
68
- }
69
- const resolved = resolveCliArgv(argv);
70
- if ("error" in resolved) {
71
- process.stderr.write(`error: ${resolved.error}
72
- `);
73
- process.exitCode = 1;
74
- return { ok: true, group: "product", command: input.command };
75
- }
76
- const [ompCommand, ...ompCommandArgs] = resolved.argv;
77
- if (ompCommand === "launch") {
78
- const args = withRigDefaultConfig(projectRoot, ompCommandArgs);
79
- await runRootCommand(parseArgs(args), args, { createAgentSession: createRigAgentSession });
80
- } else if (ompCommand === "acp") {
81
- const { args: preparedArgs, terminalAuth } = prepareAcpTerminalAuthArgs(ompCommandArgs);
82
- const args = withRigDefaultConfig(projectRoot, preparedArgs);
83
- const parsed = parseArgs(args);
84
- if (!terminalAuth)
85
- parsed.mode = "acp";
86
- await runRootCommand(parsed, args, { createAgentSession: createRigAgentSession });
87
- } else if (ompCommand === "join") {
88
- const link = ompCommandArgs[0]?.trim();
89
- if (!link) {
90
- process.stderr.write(`Usage: rig join <link>
91
- `);
92
- process.exitCode = 1;
93
- return { ok: true, group: "product", command: input.command };
94
- }
95
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
96
- process.stderr.write(`rig join requires an interactive terminal
97
- `);
98
- process.exitCode = 1;
99
- return { ok: true, group: "product", command: input.command };
100
- }
101
- const args = withRigDefaultConfig(projectRoot, []);
102
- const parsed = parseArgs(args);
103
- parsed.join = link;
104
- await runRootCommand(parsed, args, { createAgentSession: createRigAgentSession });
105
- } else {
106
- await runCli(resolved.argv);
107
- }
108
- return { ok: true, group: "product", command: input.command };
109
- } finally {
110
- restorePublicIdentityEnv();
111
- process.chdir(previousCwd);
112
- if (previousProjectRoot === undefined) {
113
- delete process.env.RIG_PROJECT_ROOT;
114
- } else {
115
- process.env.RIG_PROJECT_ROOT = previousProjectRoot;
116
- }
117
- }
118
- }
119
- var init_product_entrypoint = () => {};
120
-
121
2
  // packages/product-entrypoint-plugin/src/plugin.ts
122
3
  import { definePlugin } from "@rig/core/config";
123
4
 
@@ -144,12 +25,16 @@ function standardProductCliCommandMetadata(descriptor) {
144
25
  }
145
26
 
146
27
  // packages/product-entrypoint-plugin/src/plugin.ts
28
+ async function importProductEntrypoint() {
29
+ const specifier = ["./product", "-entrypoint"].join("");
30
+ return await import(specifier);
31
+ }
147
32
  function createStandardProductCliCommand(descriptor) {
148
33
  return {
149
34
  ...standardProductCliCommandMetadata(descriptor),
150
35
  run: async (context, args) => {
151
- const { runRigOmpProductCommand: runRigOmpProductCommand2 } = await Promise.resolve().then(() => (init_product_entrypoint(), exports_product_entrypoint));
152
- return runRigOmpProductCommand2({
36
+ const { runRigOmpProductCommand } = await importProductEntrypoint();
37
+ return runRigOmpProductCommand({
153
38
  projectRoot: context.projectRoot,
154
39
  command: descriptor.command,
155
40
  args
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/product-entrypoint-plugin",
3
- "version": "0.0.6-alpha.150",
3
+ "version": "0.0.6-alpha.151",
4
4
  "type": "module",
5
5
  "description": "Standard Rig product entrypoint plugin boundary for OMP-backed product commands.",
6
6
  "license": "UNLICENSED",
@@ -31,9 +31,9 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@oh-my-pi/pi-coding-agent": "16.0.4",
34
- "@rig/client": "npm:@h-rig/client@0.0.6-alpha.150",
35
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.150",
36
- "@rig/rig-extension": "npm:@h-rig/rig-extension@0.0.6-alpha.150",
37
- "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.150"
34
+ "@rig/client": "npm:@h-rig/client@0.0.6-alpha.151",
35
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.151",
36
+ "@rig/rig-extension": "npm:@h-rig/rig-extension@0.0.6-alpha.151",
37
+ "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.151"
38
38
  }
39
39
  }