@ngosangns/ns-bridge 0.1.4 → 0.1.5
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 +8 -0
- package/dist/agents.d.ts +28 -0
- package/dist/agents.js +168 -0
- package/dist/agents.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +63 -0
- package/dist/cli.js.map +1 -1
- package/dist/providers.d.ts +32 -0
- package/dist/providers.js +207 -0
- package/dist/providers.js.map +1 -0
- package/dist/refresh-entry.js +89 -77
- package/dist/selection.d.ts +32 -0
- package/dist/selection.js +87 -0
- package/dist/selection.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,10 @@ Mutating commands preview. `--apply` runs them. `--dry-run` is the default.
|
|
|
15
15
|
ns-bridge install [pi|omp|dsh|all] [--apply] [--profile <name>]
|
|
16
16
|
ns-bridge update [pi|omp|dsh|all] [--apply] [--profile <name>]
|
|
17
17
|
ns-bridge uninstall [pi|omp|dsh|all] [--apply] [--profile <name>]
|
|
18
|
+
ns-bridge providers status [pi|omp|dsh|all] [kiro|devin|grok] [--profile <name>]
|
|
19
|
+
ns-bridge providers enable|disable <pi|omp|dsh> <kiro|devin|grok> [--apply] [--profile <name>]
|
|
20
|
+
ns-bridge agents status omp [name]
|
|
21
|
+
ns-bridge agents enable|disable omp <name> [--apply]
|
|
18
22
|
ns-bridge models list [kiro|devin|grok|all]
|
|
19
23
|
ns-bridge models refresh [kiro|devin|grok|all] [--apply]
|
|
20
24
|
ns-bridge status
|
|
@@ -28,6 +32,10 @@ ns-bridge status
|
|
|
28
32
|
|
|
29
33
|
DSH requires `--profile`. Profile `desktop` is refused: the Electron app owns it. `install` and `update` without `--profile` skip DSH and still preview Pi and OMP.
|
|
30
34
|
|
|
35
|
+
`providers enable` and `providers disable` turn one of `kiro`, `devin`, or `grok` on or off. Pi and OMP share `~/.ns-bridge/providers.json` (`NS_BRIDGE_PROVIDERS` overrides the path); the extension reads it at launch. With no file, all three are on. `NS_OMP_PROVIDERS` replaces the file, `NS_OMP_PROVIDER_ENABLE` adds, and `NS_OMP_PROVIDER_DISABLE` removes. DSH writes `disabled: true` on that plugin's id in the profile's `cordis.patch.yml`. In OMP, `kiro` stays with `ns-omp-provider-kiro` while that plugin is installed, unless the file or an env list names it.
|
|
36
|
+
|
|
37
|
+
`agents enable` and `agents disable` edit OMP's `task.disabledAgents` in `~/.omp/agent/config.yml` (or `~/.omp/profiles/<OMP_PROFILE>/agent/config.yml`). Pi and DSH have no agent list, so those hosts are refused.
|
|
38
|
+
|
|
31
39
|
`models list` and `status` read the catalog files and do not import the provider cores:
|
|
32
40
|
|
|
33
41
|
- Kiro: `~/.ns-kiro-provider-models-cache.json`
|
package/dist/agents.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ns-bridge agents` — turn a coding agent on or off.
|
|
3
|
+
*
|
|
4
|
+
* OMP is the only host here with a list: `task.disabledAgents` in
|
|
5
|
+
* `~/.omp/agent/config.yml` (or the profile's agent dir). Pi's subagents are
|
|
6
|
+
* files, not a denylist. DSH has no agent list. Those hosts get an error
|
|
7
|
+
* instead of a guessed file write.
|
|
8
|
+
*/
|
|
9
|
+
export type AgentAction = "enable" | "disable" | "status";
|
|
10
|
+
export interface AgentStep {
|
|
11
|
+
line: string;
|
|
12
|
+
apply: () => string | {
|
|
13
|
+
error: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface AgentPlan {
|
|
17
|
+
steps: AgentStep[];
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function ompConfigPath(env?: NodeJS.ProcessEnv, home?: string): string;
|
|
21
|
+
export declare function planAgents(action: AgentAction, host: string | undefined, name: string | undefined, configPath: string): AgentPlan;
|
|
22
|
+
/** Names under `task.disabledAgents`, in file order. A missing key is empty. */
|
|
23
|
+
export declare function disabledNames(raw: string): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Replace the `task.disabledAgents` list. Other keys stay, comments included.
|
|
26
|
+
* An empty list drops the key. An empty `task:` block drops with it.
|
|
27
|
+
*/
|
|
28
|
+
export declare function renderDisabled(raw: string, names: readonly string[]): string;
|
package/dist/agents.js
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ns-bridge agents` — turn a coding agent on or off.
|
|
3
|
+
*
|
|
4
|
+
* OMP is the only host here with a list: `task.disabledAgents` in
|
|
5
|
+
* `~/.omp/agent/config.yml` (or the profile's agent dir). Pi's subagents are
|
|
6
|
+
* files, not a denylist. DSH has no agent list. Those hosts get an error
|
|
7
|
+
* instead of a guessed file write.
|
|
8
|
+
*/
|
|
9
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
10
|
+
import { homedir } from "node:os";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
const AGENT_NAME = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
|
|
13
|
+
export function ompConfigPath(env = process.env, home = homedir()) {
|
|
14
|
+
const profile = env.OMP_PROFILE ?? env.PI_PROFILE;
|
|
15
|
+
const root = profile ? join(home, ".omp", "profiles", profile, "agent") : join(home, ".omp", "agent");
|
|
16
|
+
return join(root, "config.yml");
|
|
17
|
+
}
|
|
18
|
+
export function planAgents(action, host, name, configPath) {
|
|
19
|
+
if (host !== "omp") {
|
|
20
|
+
return {
|
|
21
|
+
steps: [],
|
|
22
|
+
error: host
|
|
23
|
+
? `${host} has no coding-agent list ns-bridge can edit (only omp)`
|
|
24
|
+
: "usage: ns-bridge agents enable|disable|status omp [name]",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (action === "status") {
|
|
28
|
+
if (name && !AGENT_NAME.test(name))
|
|
29
|
+
return { steps: [], error: `invalid agent name ${name}` };
|
|
30
|
+
return {
|
|
31
|
+
steps: [
|
|
32
|
+
{
|
|
33
|
+
line: `omp agents ${configPath}`,
|
|
34
|
+
apply: () => formatAgentStatus(configPath, name),
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (!name || !AGENT_NAME.test(name)) {
|
|
40
|
+
return { steps: [], error: name ? `invalid agent name ${name}` : "enable and disable need an agent name" };
|
|
41
|
+
}
|
|
42
|
+
const enabled = action === "enable";
|
|
43
|
+
return {
|
|
44
|
+
steps: [
|
|
45
|
+
{
|
|
46
|
+
line: `omp config ${configPath}: task.disabledAgents ${enabled ? "drop" : "add"} ${name}`,
|
|
47
|
+
apply: () => writeAgent(configPath, name, enabled),
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function formatAgentStatus(configPath, name) {
|
|
53
|
+
const disabled = readDisabled(configPath);
|
|
54
|
+
if ("error" in disabled)
|
|
55
|
+
return disabled;
|
|
56
|
+
if (name)
|
|
57
|
+
return `${name} ${disabled.names.includes(name) ? "off" : "on"}`;
|
|
58
|
+
if (disabled.names.length === 0)
|
|
59
|
+
return "no agents disabled";
|
|
60
|
+
return disabled.names.map((agent) => `${agent} off`).join("\n");
|
|
61
|
+
}
|
|
62
|
+
function writeAgent(configPath, name, enabled) {
|
|
63
|
+
const current = readDisabled(configPath);
|
|
64
|
+
if ("error" in current)
|
|
65
|
+
return current;
|
|
66
|
+
const has = current.names.includes(name);
|
|
67
|
+
if (enabled && !has)
|
|
68
|
+
return `${name} already on`;
|
|
69
|
+
if (!enabled && has)
|
|
70
|
+
return `${name} already off`;
|
|
71
|
+
const next = enabled ? current.names.filter((agent) => agent !== name) : [...current.names, name];
|
|
72
|
+
writeFileSync(configPath, renderDisabled(current.raw, next), "utf8");
|
|
73
|
+
return `${name} ${enabled ? "on" : "off"}`;
|
|
74
|
+
}
|
|
75
|
+
function readDisabled(configPath) {
|
|
76
|
+
let raw;
|
|
77
|
+
try {
|
|
78
|
+
raw = readFileSync(configPath, "utf8");
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return { error: `omp config not found: ${configPath}` };
|
|
82
|
+
}
|
|
83
|
+
return { raw, names: disabledNames(raw) };
|
|
84
|
+
}
|
|
85
|
+
/** Names under `task.disabledAgents`, in file order. A missing key is empty. */
|
|
86
|
+
export function disabledNames(raw) {
|
|
87
|
+
const lines = raw.split("\n");
|
|
88
|
+
let inTask = false;
|
|
89
|
+
let inList = false;
|
|
90
|
+
const names = [];
|
|
91
|
+
for (const line of lines) {
|
|
92
|
+
if (!inTask) {
|
|
93
|
+
if (line === "task:")
|
|
94
|
+
inTask = true;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (line.length > 0 && !line.startsWith(" ") && !line.startsWith("#"))
|
|
98
|
+
break;
|
|
99
|
+
if (!inList) {
|
|
100
|
+
if (line === " disabledAgents:")
|
|
101
|
+
inList = true;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (line.startsWith(" - ")) {
|
|
105
|
+
const name = line.slice(" - ".length).trim();
|
|
106
|
+
if (AGENT_NAME.test(name))
|
|
107
|
+
names.push(name);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (line.trim() === "" || line.trim().startsWith("#"))
|
|
111
|
+
continue;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
return names;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Replace the `task.disabledAgents` list. Other keys stay, comments included.
|
|
118
|
+
* An empty list drops the key. An empty `task:` block drops with it.
|
|
119
|
+
*/
|
|
120
|
+
export function renderDisabled(raw, names) {
|
|
121
|
+
const newline = raw.endsWith("\n") || raw.length === 0;
|
|
122
|
+
const lines = raw.split("\n");
|
|
123
|
+
if (lines.at(-1) === "")
|
|
124
|
+
lines.pop();
|
|
125
|
+
const taskAt = lines.indexOf("task:");
|
|
126
|
+
if (taskAt === -1) {
|
|
127
|
+
if (names.length === 0)
|
|
128
|
+
return newline ? `${lines.join("\n")}${lines.length > 0 ? "\n" : ""}` : lines.join("\n");
|
|
129
|
+
const block = ["task:", " disabledAgents:", ...names.map((name) => ` - ${name}`)];
|
|
130
|
+
const body = lines.join("\n");
|
|
131
|
+
return `${body}${body.length > 0 ? "\n\n" : ""}${block.join("\n")}\n`;
|
|
132
|
+
}
|
|
133
|
+
const taskEnd = nextTopLevel(lines, taskAt + 1);
|
|
134
|
+
const listAt = lines.findIndex((line, index) => index > taskAt && index < taskEnd && line === " disabledAgents:");
|
|
135
|
+
const withoutList = listAt === -1
|
|
136
|
+
? lines.slice(taskAt + 1, taskEnd)
|
|
137
|
+
: [...lines.slice(taskAt + 1, listAt), ...lines.slice(listItemEnd(lines, listAt + 1, taskEnd), taskEnd)];
|
|
138
|
+
const taskKept = withoutList.some((line) => line.trim() !== "" && !line.trim().startsWith("#"));
|
|
139
|
+
const middle = [];
|
|
140
|
+
if (names.length > 0) {
|
|
141
|
+
middle.push("task:", ...withoutList, " disabledAgents:", ...names.map((name) => ` - ${name}`));
|
|
142
|
+
}
|
|
143
|
+
else if (taskKept) {
|
|
144
|
+
middle.push("task:", ...withoutList);
|
|
145
|
+
}
|
|
146
|
+
const next = [...lines.slice(0, taskAt), ...middle, ...lines.slice(taskEnd)];
|
|
147
|
+
if (next.length === 0)
|
|
148
|
+
return "";
|
|
149
|
+
return `${next.join("\n")}\n`;
|
|
150
|
+
}
|
|
151
|
+
function nextTopLevel(lines, from) {
|
|
152
|
+
for (let index = from; index < lines.length; index += 1) {
|
|
153
|
+
const line = lines[index] ?? "";
|
|
154
|
+
if (line.length > 0 && !line.startsWith(" ") && !line.startsWith("#"))
|
|
155
|
+
return index;
|
|
156
|
+
}
|
|
157
|
+
return lines.length;
|
|
158
|
+
}
|
|
159
|
+
function listItemEnd(lines, from, taskEnd) {
|
|
160
|
+
for (let index = from; index < taskEnd; index += 1) {
|
|
161
|
+
const line = lines[index] ?? "";
|
|
162
|
+
if (line.startsWith(" - ") || line.trim() === "" || line.trim().startsWith("#"))
|
|
163
|
+
continue;
|
|
164
|
+
return index;
|
|
165
|
+
}
|
|
166
|
+
return taskEnd;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,UAAU,GAAG,+BAA+B,CAAC;AAYnD,MAAM,UAAU,aAAa,CAAC,MAAyB,OAAO,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,EAAE;IAClF,MAAM,OAAO,GAAG,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,UAAU,CAAC;IAClD,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACtG,OAAO,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,MAAmB,EACnB,IAAwB,EACxB,IAAwB,EACxB,UAAkB;IAElB,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,OAAO;YACL,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,IAAI;gBACT,CAAC,CAAC,GAAG,IAAI,yDAAyD;gBAClE,CAAC,CAAC,0DAA0D;SAC/D,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACxB,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KA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AAChC,CAAC;AAED,SAAS,YAAY,CAAC,KAAwB,EAAE,IAAY;IAC1D,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAChC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;IACtF,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,CAAC;AACtB,CAAC;AAED,SAAS,WAAW,CAAC,KAAwB,EAAE,IAAY,EAAE,OAAe;IAC1E,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAChC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAC7F,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* is an explicit flag.
|
|
7
7
|
*/
|
|
8
8
|
import { type CatalogPaths } from "./catalog.js";
|
|
9
|
+
import { type ProviderPaths } from "./providers.js";
|
|
9
10
|
import { type ModelRefresh } from "./refresh.js";
|
|
10
11
|
export interface CommandResult {
|
|
11
12
|
code: number;
|
|
@@ -20,6 +21,8 @@ export interface RunOptions {
|
|
|
20
21
|
refreshers?: ModelRefresh;
|
|
21
22
|
paths?: CatalogPaths;
|
|
22
23
|
now?: number;
|
|
24
|
+
providerPaths?: ProviderPaths;
|
|
25
|
+
ompConfig?: string;
|
|
23
26
|
}
|
|
24
27
|
export declare function spawnRunner(): Runner;
|
|
25
28
|
export declare function run(argv: readonly string[], options?: RunOptions): Promise<number>;
|
package/dist/cli.js
CHANGED
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
* is an explicit flag.
|
|
7
7
|
*/
|
|
8
8
|
import { spawn } from "node:child_process";
|
|
9
|
+
import { ompConfigPath, planAgents } from "./agents.js";
|
|
9
10
|
import { catalogPaths, formatCatalog, parseVendors, readCatalogs } from "./catalog.js";
|
|
10
11
|
import { formatCommand, parseHosts, planHostCommands } from "./hosts.js";
|
|
12
|
+
import { formatProviderPlan, planProviders, providerPaths } from "./providers.js";
|
|
11
13
|
import { defaultModelRefresh, refreshLine } from "./refresh.js";
|
|
12
14
|
const HELP = `ns-bridge — install, update, and refresh providers outside Pi, OMP, and DSH.
|
|
13
15
|
|
|
@@ -18,6 +20,10 @@ Usage:
|
|
|
18
20
|
ns-bridge install [pi|omp|dsh|all] [--apply] [--profile <name>]
|
|
19
21
|
ns-bridge update [pi|omp|dsh|all] [--apply] [--profile <name>]
|
|
20
22
|
ns-bridge uninstall [pi|omp|dsh|all] [--apply] [--profile <name>]
|
|
23
|
+
ns-bridge providers status [pi|omp|dsh|all] [kiro|devin|grok] [--profile <name>]
|
|
24
|
+
ns-bridge providers enable|disable <pi|omp|dsh> <kiro|devin|grok> [--apply] [--profile <name>]
|
|
25
|
+
ns-bridge agents status omp [name]
|
|
26
|
+
ns-bridge agents enable|disable omp <name> [--apply]
|
|
21
27
|
ns-bridge models list [kiro|devin|grok|all]
|
|
22
28
|
ns-bridge models refresh [kiro|devin|grok|all] [--apply]
|
|
23
29
|
ns-bridge status
|
|
@@ -34,6 +40,11 @@ Hosts:
|
|
|
34
40
|
dsh plugin --profile <name> update …
|
|
35
41
|
dsh plugin --profile <name> remove …
|
|
36
42
|
|
|
43
|
+
providers enable/disable writes the host's own switch:
|
|
44
|
+
pi, omp ~/.ns-bridge/providers.json (the extension reads it at launch)
|
|
45
|
+
dsh disabled: true on the plugin id in the profile's cordis.patch.yml
|
|
46
|
+
agents enable/disable edits omp's task.disabledAgents. Pi and dsh have no such list.
|
|
47
|
+
|
|
37
48
|
DSH requires --profile. Profile "desktop" is refused: the Electron app owns it.
|
|
38
49
|
install/update without --profile skips DSH and still previews Pi and OMP.
|
|
39
50
|
These commands install the npm packages. A local Pi path stays until that install runs.
|
|
@@ -123,6 +134,9 @@ export async function run(argv, options = {}) {
|
|
|
123
134
|
}
|
|
124
135
|
return runHost(command, target, parsed, log, err, options);
|
|
125
136
|
}
|
|
137
|
+
if (command === "providers" || command === "agents") {
|
|
138
|
+
return runToggle(command, parsed, log, err, options);
|
|
139
|
+
}
|
|
126
140
|
err(`unknown command ${command}`);
|
|
127
141
|
err("run ns-bridge help");
|
|
128
142
|
return 1;
|
|
@@ -191,6 +205,55 @@ async function runHost(action, target, parsed, log, err, options) {
|
|
|
191
205
|
log("# dsh skipped: pass --profile <name>");
|
|
192
206
|
return 0;
|
|
193
207
|
}
|
|
208
|
+
async function runToggle(command, parsed, log, err, options) {
|
|
209
|
+
const action = parsed.positionals[1];
|
|
210
|
+
const host = parsed.positionals[2];
|
|
211
|
+
const name = parsed.positionals[3];
|
|
212
|
+
if (action !== "enable" && action !== "disable" && action !== "status") {
|
|
213
|
+
err(`usage: ns-bridge ${command} enable|disable|status …`);
|
|
214
|
+
return 1;
|
|
215
|
+
}
|
|
216
|
+
if (parsed.positionals.length > 4) {
|
|
217
|
+
err(`unexpected argument ${parsed.positionals[4]}`);
|
|
218
|
+
return 1;
|
|
219
|
+
}
|
|
220
|
+
if (command === "agents") {
|
|
221
|
+
const plan = planAgents(action, host, name, options.ompConfig ?? ompConfigPath());
|
|
222
|
+
if (plan.error) {
|
|
223
|
+
err(plan.error);
|
|
224
|
+
return 1;
|
|
225
|
+
}
|
|
226
|
+
if (!parsed.apply && action !== "status") {
|
|
227
|
+
log("# dry-run (pass --apply to run)");
|
|
228
|
+
for (const step of plan.steps)
|
|
229
|
+
log(step.line);
|
|
230
|
+
return 0;
|
|
231
|
+
}
|
|
232
|
+
return applySteps(plan.steps, log, err);
|
|
233
|
+
}
|
|
234
|
+
const plan = planProviders(action, host, name, parsed.profile, options.providerPaths ?? providerPaths());
|
|
235
|
+
if (plan.error) {
|
|
236
|
+
err(plan.error);
|
|
237
|
+
return 1;
|
|
238
|
+
}
|
|
239
|
+
if (!parsed.apply && action !== "status") {
|
|
240
|
+
for (const line of formatProviderPlan(plan, false))
|
|
241
|
+
log(line);
|
|
242
|
+
return 0;
|
|
243
|
+
}
|
|
244
|
+
return applySteps(plan.steps, log, err);
|
|
245
|
+
}
|
|
246
|
+
function applySteps(steps, log, err) {
|
|
247
|
+
for (const step of steps) {
|
|
248
|
+
const result = step.apply();
|
|
249
|
+
if (typeof result !== "string") {
|
|
250
|
+
err(result.error);
|
|
251
|
+
return 1;
|
|
252
|
+
}
|
|
253
|
+
log(result);
|
|
254
|
+
}
|
|
255
|
+
return 0;
|
|
256
|
+
}
|
|
194
257
|
function parseArgs(argv) {
|
|
195
258
|
const positionals = [];
|
|
196
259
|
let apply = false;
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAqB,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;AACvH,OAAO,EAAE,aAAa,EAAmB,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAqB,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src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AChB,SAAS;QACX,CAAC;QACD,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,GAAG,EAAE,EAAE,CAAC;QACjE,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ns-bridge providers` — turn kiro, devin, or grok on or off.
|
|
3
|
+
*
|
|
4
|
+
* Pi and OMP register from one file, `~/.ns-bridge/providers.json`. The
|
|
5
|
+
* extensions read it at launch; this command writes it. DSH has no such
|
|
6
|
+
* file: the profile patch carries `disabled: true` on the plugin id.
|
|
7
|
+
*/
|
|
8
|
+
import { type Host } from "./hosts.js";
|
|
9
|
+
import { type ProviderSelection } from "./selection.js";
|
|
10
|
+
export type ProviderAction = "enable" | "disable" | "status";
|
|
11
|
+
export interface ProviderStep {
|
|
12
|
+
host: Host;
|
|
13
|
+
/** What a dry-run prints. Apply runs the write this line describes. */
|
|
14
|
+
line: string;
|
|
15
|
+
apply: () => string | {
|
|
16
|
+
error: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface ProviderPlan {
|
|
20
|
+
steps: ProviderStep[];
|
|
21
|
+
skipDsh: boolean;
|
|
22
|
+
error?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ProviderPaths {
|
|
25
|
+
selection: string;
|
|
26
|
+
piSettings: string;
|
|
27
|
+
dshHome: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function providerPaths(env?: NodeJS.ProcessEnv, home?: string): ProviderPaths;
|
|
30
|
+
export declare function planProviders(action: ProviderAction, hostTarget: string | undefined, providerTarget: string | undefined, profile: string | undefined, paths: ProviderPaths): ProviderPlan;
|
|
31
|
+
export declare function formatProviderPlan(plan: ProviderPlan, apply: boolean): string[];
|
|
32
|
+
export type { ProviderSelection };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ns-bridge providers` — turn kiro, devin, or grok on or off.
|
|
3
|
+
*
|
|
4
|
+
* Pi and OMP register from one file, `~/.ns-bridge/providers.json`. The
|
|
5
|
+
* extensions read it at launch; this command writes it. DSH has no such
|
|
6
|
+
* file: the profile patch carries `disabled: true` on the plugin id.
|
|
7
|
+
*/
|
|
8
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { homedir } from "node:os";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { parseHosts } from "./hosts.js";
|
|
12
|
+
import { PROVIDERS, parseProvider, readSelectionFile, resolveSelection, selectionPath, writeProvider, } from "./selection.js";
|
|
13
|
+
const DSH_PLUGIN = {
|
|
14
|
+
kiro: "ns-dsh-llm-kiro",
|
|
15
|
+
devin: "ns-dsh-llm-devin",
|
|
16
|
+
grok: "ns-dsh-llm-grok",
|
|
17
|
+
};
|
|
18
|
+
const DSH_ID = {
|
|
19
|
+
kiro: "llm-kiro",
|
|
20
|
+
devin: "llm-devin",
|
|
21
|
+
grok: "llm-grok",
|
|
22
|
+
};
|
|
23
|
+
const PI_SOURCE = "npm:@ngosangns/ns-pi-provider";
|
|
24
|
+
export function providerPaths(env = process.env, home = homedir()) {
|
|
25
|
+
const piDir = env.PI_CODING_AGENT_DIR ?? join(home, ".pi", "agent");
|
|
26
|
+
return {
|
|
27
|
+
selection: selectionPath(env, home),
|
|
28
|
+
piSettings: join(piDir, "settings.json"),
|
|
29
|
+
dshHome: env.DSH_HOME ?? join(home, ".dsh"),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function planProviders(action, hostTarget, providerTarget, profile, paths) {
|
|
33
|
+
const hosts = parseHosts(hostTarget);
|
|
34
|
+
if ("error" in hosts)
|
|
35
|
+
return { steps: [], skipDsh: false, error: hosts.error };
|
|
36
|
+
if (action !== "status" && hosts.length !== 1) {
|
|
37
|
+
return { steps: [], skipDsh: false, error: "enable and disable need one host: pi, omp, or dsh" };
|
|
38
|
+
}
|
|
39
|
+
let provider;
|
|
40
|
+
if (providerTarget) {
|
|
41
|
+
const parsed = parseProvider(providerTarget);
|
|
42
|
+
if (typeof parsed !== "string")
|
|
43
|
+
return { steps: [], skipDsh: false, error: parsed.error };
|
|
44
|
+
provider = parsed;
|
|
45
|
+
}
|
|
46
|
+
else if (action !== "status") {
|
|
47
|
+
return { steps: [], skipDsh: false, error: "enable and disable need a provider: kiro, devin, or grok" };
|
|
48
|
+
}
|
|
49
|
+
const wantsDsh = hosts.includes("dsh");
|
|
50
|
+
if (wantsDsh && profile?.toLowerCase() === "desktop") {
|
|
51
|
+
return {
|
|
52
|
+
steps: [],
|
|
53
|
+
skipDsh: false,
|
|
54
|
+
error: 'profile "desktop" is managed by the DSH Electron app; pass another profile name',
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (wantsDsh && !profile && hosts.length === 1 && action !== "status") {
|
|
58
|
+
return { steps: [], skipDsh: false, error: "dsh needs --profile <name>" };
|
|
59
|
+
}
|
|
60
|
+
const steps = [];
|
|
61
|
+
for (const host of hosts) {
|
|
62
|
+
if (host === "dsh" && !profile)
|
|
63
|
+
continue;
|
|
64
|
+
if (action === "status") {
|
|
65
|
+
steps.push(statusStep(host, provider, profile, paths));
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const step = mutateStep(action, host, provider, profile, paths);
|
|
69
|
+
if (step)
|
|
70
|
+
steps.push(step);
|
|
71
|
+
}
|
|
72
|
+
return { steps, skipDsh: wantsDsh && !profile && action !== "status" };
|
|
73
|
+
}
|
|
74
|
+
function statusStep(host, provider, profile, paths) {
|
|
75
|
+
return {
|
|
76
|
+
host,
|
|
77
|
+
line: `${host} providers`,
|
|
78
|
+
apply: () => {
|
|
79
|
+
const names = provider ? [provider] : PROVIDERS;
|
|
80
|
+
return names
|
|
81
|
+
.map((name) => {
|
|
82
|
+
const state = readHostProvider(host, name, profile, paths);
|
|
83
|
+
const note = state.note ? ` (${state.note})` : "";
|
|
84
|
+
return `${host} ${name} ${state.on ? "on" : "off"}${note}`;
|
|
85
|
+
})
|
|
86
|
+
.join("\n");
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function readHostProvider(host, provider, profile, paths) {
|
|
91
|
+
if (host === "dsh")
|
|
92
|
+
return readDshProvider(provider, profile, paths.dshHome);
|
|
93
|
+
if (host === "pi" && !piPackageInstalled(paths.piSettings)) {
|
|
94
|
+
return { on: false, note: "package not installed" };
|
|
95
|
+
}
|
|
96
|
+
const on = resolveSelection(readSelectionFile(paths.selection))[provider];
|
|
97
|
+
return { on, note: on ? undefined : "not registered" };
|
|
98
|
+
}
|
|
99
|
+
function piPackageInstalled(settingsPath) {
|
|
100
|
+
let raw;
|
|
101
|
+
try {
|
|
102
|
+
raw = readFileSync(settingsPath, "utf8");
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
let parsed;
|
|
108
|
+
try {
|
|
109
|
+
parsed = JSON.parse(raw);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed) || !("packages" in parsed)) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
const packages = parsed.packages;
|
|
118
|
+
if (!Array.isArray(packages))
|
|
119
|
+
return false;
|
|
120
|
+
return packages.some((entry) => {
|
|
121
|
+
const source = typeof entry === "string" ? entry : sourceOf(entry);
|
|
122
|
+
return source === PI_SOURCE || source.endsWith("/pi-provider");
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function sourceOf(entry) {
|
|
126
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry) || !("source" in entry))
|
|
127
|
+
return "";
|
|
128
|
+
return typeof entry.source === "string" ? entry.source : "";
|
|
129
|
+
}
|
|
130
|
+
function mutateStep(action, host, provider, profile, paths) {
|
|
131
|
+
const enabled = action === "enable";
|
|
132
|
+
if (host === "dsh") {
|
|
133
|
+
if (!profile)
|
|
134
|
+
return undefined;
|
|
135
|
+
const patch = join(paths.dshHome, "profiles", profile, "cordis.patch.yml");
|
|
136
|
+
return {
|
|
137
|
+
host,
|
|
138
|
+
line: `dsh ${profile} ${DSH_ID[provider]} ${enabled ? "on" : "off"} (${patch})`,
|
|
139
|
+
apply: () => writeDshProvider(patch, provider, enabled),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
if (host === "pi" && !piPackageInstalled(paths.piSettings)) {
|
|
143
|
+
return {
|
|
144
|
+
host,
|
|
145
|
+
line: `pi ${provider} ${enabled ? "on" : "off"}`,
|
|
146
|
+
apply: () => ({ error: "pi package @ngosangns/ns-pi-provider is not installed" }),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
host,
|
|
151
|
+
line: `${host} ${paths.selection}: ${provider} ${enabled ? "on" : "off"}`,
|
|
152
|
+
apply: () => {
|
|
153
|
+
const next = writeProvider(paths.selection, provider, enabled);
|
|
154
|
+
return `${provider} ${next[provider] ? "on" : "off"}`;
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function readDshProvider(provider, profile, dshHome) {
|
|
159
|
+
if (!profile)
|
|
160
|
+
return { on: false, note: "needs --profile" };
|
|
161
|
+
const patch = join(dshHome, "profiles", profile, "cordis.patch.yml");
|
|
162
|
+
let raw;
|
|
163
|
+
try {
|
|
164
|
+
raw = readFileSync(patch, "utf8");
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
return { on: false, note: "patch missing" };
|
|
168
|
+
}
|
|
169
|
+
const block = pluginBlock(raw, provider);
|
|
170
|
+
if (!block)
|
|
171
|
+
return { on: false, note: "not installed" };
|
|
172
|
+
return { on: !/^\s*disabled:\s*true\s*$/m.test(block) };
|
|
173
|
+
}
|
|
174
|
+
function writeDshProvider(patch, provider, enabled) {
|
|
175
|
+
let raw;
|
|
176
|
+
try {
|
|
177
|
+
raw = readFileSync(patch, "utf8");
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
return { error: `dsh patch not found: ${patch}` };
|
|
181
|
+
}
|
|
182
|
+
const id = DSH_ID[provider];
|
|
183
|
+
const block = pluginBlock(raw, provider);
|
|
184
|
+
if (!block)
|
|
185
|
+
return { error: `${DSH_PLUGIN[provider]} is not in ${patch}` };
|
|
186
|
+
const disabled = /^\s*disabled:\s*true\s*$/m.test(block);
|
|
187
|
+
if (enabled === !disabled)
|
|
188
|
+
return `${id} already ${enabled ? "on" : "off"}`;
|
|
189
|
+
const nextBlock = enabled ? block.replace(/\n\s*disabled:\s*true\s*$/m, "") : `${block}\n disabled: true`;
|
|
190
|
+
writeFileSync(patch, raw.replace(block, nextBlock), "utf8");
|
|
191
|
+
return `${id} ${enabled ? "on" : "off"}`;
|
|
192
|
+
}
|
|
193
|
+
/** The insert entry for this provider, from its `id:` line through its indented body. */
|
|
194
|
+
function pluginBlock(raw, provider) {
|
|
195
|
+
const id = DSH_ID[provider];
|
|
196
|
+
const match = new RegExp(`^ - id: ${id}\\n(?:(?: [^\\n]*| disabled: true)\\n)*`, "m").exec(raw.endsWith("\n") ? raw : `${raw}\n`);
|
|
197
|
+
return match?.[0].replace(/\n$/, "");
|
|
198
|
+
}
|
|
199
|
+
export function formatProviderPlan(plan, apply) {
|
|
200
|
+
const lines = apply ? [] : ["# dry-run (pass --apply to run)"];
|
|
201
|
+
for (const step of plan.steps)
|
|
202
|
+
lines.push(step.line);
|
|
203
|
+
if (plan.skipDsh)
|
|
204
|
+
lines.push("# dsh skipped: pass --profile <name>");
|
|
205
|
+
return lines;
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../src/provid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GAAG,KAAK,oBAAoB,CAAC;IAC3G,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;IAC5D,OAAO,GAAG,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;AAC3C,CAAC;AAED,yFAAyF;AACzF,SAAS,WAAW,CAAC,GAAW,EAAE,QAAsB;IACtD,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5B,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,cAAc,EAAE,6CAA6C,EAAE,GAAG,CAAC,CAAC,IAAI,CAC/F,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CACtC,CAAC;IACF,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAkB,EAAE,KAAc;IACnE,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC;IAC/D,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrD,IAAI,IAAI,CAAC,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACrE,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/refresh-entry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @ngosangns/ns-bridge 0.1.
|
|
1
|
+
// @ngosangns/ns-bridge 0.1.5 — catalog refresh bundle.
|
|
2
2
|
import { createRequire as __nsBridgeCreateRequire } from 'node:module';
|
|
3
3
|
const require = __nsBridgeCreateRequire(import.meta.url);
|
|
4
4
|
var __create = Object.create;
|
|
@@ -92417,64 +92417,6 @@ var init_endpoints = __esm({
|
|
|
92417
92417
|
}
|
|
92418
92418
|
});
|
|
92419
92419
|
|
|
92420
|
-
// ../kiro-core/dist/kiro-ide.js
|
|
92421
|
-
import { existsSync as existsSync3, readFileSync as readFileSync5 } from "node:fs";
|
|
92422
|
-
import { homedir as homedir6 } from "node:os";
|
|
92423
|
-
import { join as join7 } from "node:path";
|
|
92424
|
-
function readKiroIdeToken(allowExpired) {
|
|
92425
|
-
try {
|
|
92426
|
-
if (!existsSync3(KIRO_IDE_TOKEN_PATH))
|
|
92427
|
-
return void 0;
|
|
92428
|
-
const tokenData = JSON.parse(readFileSync5(KIRO_IDE_TOKEN_PATH, "utf-8"));
|
|
92429
|
-
if (!tokenData.accessToken || !tokenData.refreshToken)
|
|
92430
|
-
return void 0;
|
|
92431
|
-
const expiresAt = new Date(tokenData.expiresAt).getTime();
|
|
92432
|
-
if (!allowExpired && Date.now() >= expiresAt - 2 * 60 * 1e3)
|
|
92433
|
-
return void 0;
|
|
92434
|
-
const region = tokenData.region ?? "us-east-1";
|
|
92435
|
-
let clientId = "";
|
|
92436
|
-
let clientSecret = "";
|
|
92437
|
-
if (tokenData.clientIdHash) {
|
|
92438
|
-
const regPath = join7(SSO_CACHE_DIR, `${tokenData.clientIdHash}.json`);
|
|
92439
|
-
if (existsSync3(regPath)) {
|
|
92440
|
-
try {
|
|
92441
|
-
const reg = JSON.parse(readFileSync5(regPath, "utf-8"));
|
|
92442
|
-
clientId = reg.clientId ?? "";
|
|
92443
|
-
clientSecret = reg.clientSecret ?? "";
|
|
92444
|
-
} catch {
|
|
92445
|
-
}
|
|
92446
|
-
}
|
|
92447
|
-
}
|
|
92448
|
-
return {
|
|
92449
|
-
// Pack into the same pipe-delimited format used by the rest of the refresh chain
|
|
92450
|
-
refresh: `${tokenData.refreshToken}|${clientId}|${clientSecret}|idc`,
|
|
92451
|
-
access: tokenData.accessToken,
|
|
92452
|
-
// Subtract 2-min buffer so we refresh before the actual AWS expiry
|
|
92453
|
-
expires: expiresAt - 2 * 60 * 1e3,
|
|
92454
|
-
clientId,
|
|
92455
|
-
clientSecret,
|
|
92456
|
-
region,
|
|
92457
|
-
authMethod: "idc"
|
|
92458
|
-
};
|
|
92459
|
-
} catch {
|
|
92460
|
-
return void 0;
|
|
92461
|
-
}
|
|
92462
|
-
}
|
|
92463
|
-
function getKiroIdeCredentials() {
|
|
92464
|
-
return readKiroIdeToken(false);
|
|
92465
|
-
}
|
|
92466
|
-
function getKiroIdeCredentialsAllowExpired() {
|
|
92467
|
-
return readKiroIdeToken(true);
|
|
92468
|
-
}
|
|
92469
|
-
var SSO_CACHE_DIR, KIRO_IDE_TOKEN_PATH;
|
|
92470
|
-
var init_kiro_ide = __esm({
|
|
92471
|
-
"../kiro-core/dist/kiro-ide.js"() {
|
|
92472
|
-
"use strict";
|
|
92473
|
-
SSO_CACHE_DIR = join7(homedir6(), ".aws", "sso", "cache");
|
|
92474
|
-
KIRO_IDE_TOKEN_PATH = join7(SSO_CACHE_DIR, "kiro-auth-token.json");
|
|
92475
|
-
}
|
|
92476
|
-
});
|
|
92477
|
-
|
|
92478
92420
|
// ../kiro-core/dist/kiro-cli.js
|
|
92479
92421
|
var kiro_cli_exports = {};
|
|
92480
92422
|
__export(kiro_cli_exports, {
|
|
@@ -92490,16 +92432,16 @@ __export(kiro_cli_exports, {
|
|
|
92490
92432
|
tryKiroCliToken: () => tryKiroCliToken
|
|
92491
92433
|
});
|
|
92492
92434
|
import { execFileSync as execFileSync3, execSync } from "node:child_process";
|
|
92493
|
-
import { existsSync as
|
|
92435
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
92494
92436
|
import { createRequire } from "node:module";
|
|
92495
|
-
import { homedir as
|
|
92496
|
-
import { join as
|
|
92437
|
+
import { homedir as homedir6, platform } from "node:os";
|
|
92438
|
+
import { join as join7 } from "node:path";
|
|
92497
92439
|
function getKiroCliDbPath() {
|
|
92498
92440
|
const p = platform();
|
|
92499
|
-
const localAppData = process.env.LOCALAPPDATA ||
|
|
92500
|
-
const roamingAppData = process.env.APPDATA ||
|
|
92501
|
-
const candidates = p === "win32" ? [
|
|
92502
|
-
return candidates.find((candidate) =>
|
|
92441
|
+
const localAppData = process.env.LOCALAPPDATA || join7(homedir6(), "AppData", "Local");
|
|
92442
|
+
const roamingAppData = process.env.APPDATA || join7(homedir6(), "AppData", "Roaming");
|
|
92443
|
+
const candidates = p === "win32" ? [join7(localAppData, "Kiro-Cli", "data.sqlite3"), join7(roamingAppData, "kiro-cli", "data.sqlite3")] : p === "darwin" ? [join7(homedir6(), "Library", "Application Support", "kiro-cli", "data.sqlite3")] : [join7(homedir6(), ".local", "share", "kiro-cli", "data.sqlite3")];
|
|
92444
|
+
return candidates.find((candidate) => existsSync3(candidate));
|
|
92503
92445
|
}
|
|
92504
92446
|
function getKiroCliExternalIdpCredentials() {
|
|
92505
92447
|
const dbPath = getKiroCliDbPath();
|
|
@@ -92790,6 +92732,64 @@ var init_kiro_cli = __esm({
|
|
|
92790
92732
|
}
|
|
92791
92733
|
});
|
|
92792
92734
|
|
|
92735
|
+
// ../kiro-core/dist/kiro-ide.js
|
|
92736
|
+
import { existsSync as existsSync4, readFileSync as readFileSync5 } from "node:fs";
|
|
92737
|
+
import { homedir as homedir7 } from "node:os";
|
|
92738
|
+
import { join as join8 } from "node:path";
|
|
92739
|
+
function readKiroIdeToken(allowExpired) {
|
|
92740
|
+
try {
|
|
92741
|
+
if (!existsSync4(KIRO_IDE_TOKEN_PATH))
|
|
92742
|
+
return void 0;
|
|
92743
|
+
const tokenData = JSON.parse(readFileSync5(KIRO_IDE_TOKEN_PATH, "utf-8"));
|
|
92744
|
+
if (!tokenData.accessToken || !tokenData.refreshToken)
|
|
92745
|
+
return void 0;
|
|
92746
|
+
const expiresAt = new Date(tokenData.expiresAt).getTime();
|
|
92747
|
+
if (!allowExpired && Date.now() >= expiresAt - 2 * 60 * 1e3)
|
|
92748
|
+
return void 0;
|
|
92749
|
+
const region = tokenData.region ?? "us-east-1";
|
|
92750
|
+
let clientId = "";
|
|
92751
|
+
let clientSecret = "";
|
|
92752
|
+
if (tokenData.clientIdHash) {
|
|
92753
|
+
const regPath = join8(SSO_CACHE_DIR, `${tokenData.clientIdHash}.json`);
|
|
92754
|
+
if (existsSync4(regPath)) {
|
|
92755
|
+
try {
|
|
92756
|
+
const reg = JSON.parse(readFileSync5(regPath, "utf-8"));
|
|
92757
|
+
clientId = reg.clientId ?? "";
|
|
92758
|
+
clientSecret = reg.clientSecret ?? "";
|
|
92759
|
+
} catch {
|
|
92760
|
+
}
|
|
92761
|
+
}
|
|
92762
|
+
}
|
|
92763
|
+
return {
|
|
92764
|
+
// Pack into the same pipe-delimited format used by the rest of the refresh chain
|
|
92765
|
+
refresh: `${tokenData.refreshToken}|${clientId}|${clientSecret}|idc`,
|
|
92766
|
+
access: tokenData.accessToken,
|
|
92767
|
+
// Subtract 2-min buffer so we refresh before the actual AWS expiry
|
|
92768
|
+
expires: expiresAt - 2 * 60 * 1e3,
|
|
92769
|
+
clientId,
|
|
92770
|
+
clientSecret,
|
|
92771
|
+
region,
|
|
92772
|
+
authMethod: "idc"
|
|
92773
|
+
};
|
|
92774
|
+
} catch {
|
|
92775
|
+
return void 0;
|
|
92776
|
+
}
|
|
92777
|
+
}
|
|
92778
|
+
function getKiroIdeCredentials() {
|
|
92779
|
+
return readKiroIdeToken(false);
|
|
92780
|
+
}
|
|
92781
|
+
function getKiroIdeCredentialsAllowExpired() {
|
|
92782
|
+
return readKiroIdeToken(true);
|
|
92783
|
+
}
|
|
92784
|
+
var SSO_CACHE_DIR, KIRO_IDE_TOKEN_PATH;
|
|
92785
|
+
var init_kiro_ide = __esm({
|
|
92786
|
+
"../kiro-core/dist/kiro-ide.js"() {
|
|
92787
|
+
"use strict";
|
|
92788
|
+
SSO_CACHE_DIR = join8(homedir7(), ".aws", "sso", "cache");
|
|
92789
|
+
KIRO_IDE_TOKEN_PATH = join8(SSO_CACHE_DIR, "kiro-auth-token.json");
|
|
92790
|
+
}
|
|
92791
|
+
});
|
|
92792
|
+
|
|
92793
92793
|
// ../kiro-core/dist/oauth.js
|
|
92794
92794
|
function resolveKiroAuthSource() {
|
|
92795
92795
|
const configured = process.env[AUTH_SOURCE_ENV]?.trim().toLowerCase();
|
|
@@ -93013,6 +93013,7 @@ var init_oauth = __esm({
|
|
|
93013
93013
|
"use strict";
|
|
93014
93014
|
init_debug();
|
|
93015
93015
|
init_endpoints();
|
|
93016
|
+
init_kiro_cli();
|
|
93016
93017
|
init_kiro_ide();
|
|
93017
93018
|
KIRO_DESKTOP_REFRESH_URL = "https://prod.{region}.auth.desktop.kiro.dev/refreshToken";
|
|
93018
93019
|
EXPIRES_BUFFER_MS = 5 * 60 * 1e3;
|
|
@@ -93351,6 +93352,11 @@ function lazyOAuth(input) {
|
|
|
93351
93352
|
// ../bridge-core/dist/types.js
|
|
93352
93353
|
var BRIDGE_EFFORT_ORDER = ["minimal", "low", "medium", "high", "xhigh", "max"];
|
|
93353
93354
|
|
|
93355
|
+
// ../bridge-core/dist/effort.js
|
|
93356
|
+
var EFFORTS = {};
|
|
93357
|
+
for (const level of BRIDGE_EFFORT_ORDER)
|
|
93358
|
+
EFFORTS[level] = true;
|
|
93359
|
+
|
|
93354
93360
|
// ../bridge-core/dist/pi/models.js
|
|
93355
93361
|
function toPiThinkingLevelMap(efforts) {
|
|
93356
93362
|
if (!efforts?.length)
|
|
@@ -93361,7 +93367,6 @@ function toPiThinkingLevelMap(efforts) {
|
|
|
93361
93367
|
map[level] = supported.has(level) ? level : null;
|
|
93362
93368
|
return map;
|
|
93363
93369
|
}
|
|
93364
|
-
var EFFORTS = new Set(BRIDGE_EFFORT_ORDER);
|
|
93365
93370
|
|
|
93366
93371
|
// ../devin-core/dist/util.js
|
|
93367
93372
|
function isRecord(value) {
|
|
@@ -95862,19 +95867,31 @@ function devinCredentialsPath() {
|
|
|
95862
95867
|
const dataHome = process.env.XDG_DATA_HOME ?? join(homedir(), ".local", "share");
|
|
95863
95868
|
return join(dataHome, "devin", "credentials.toml");
|
|
95864
95869
|
}
|
|
95870
|
+
var TOKEN_FIELDS = ["windsurf_api_key", "session_token", "access_token", "api_key", "token"];
|
|
95865
95871
|
function parseCredentialsToml(text) {
|
|
95866
95872
|
const out = {};
|
|
95867
95873
|
for (const line of text.split("\n")) {
|
|
95868
95874
|
const trimmed = line.trim();
|
|
95869
95875
|
if (!trimmed || trimmed.startsWith("#") || trimmed.startsWith("["))
|
|
95870
95876
|
continue;
|
|
95871
|
-
const match2 = /^([\w.-]+)\s*=\s*"(.*)"\s*$/.exec(trimmed);
|
|
95872
|
-
|
|
95877
|
+
const match2 = /^([\w.-]+)\s*=\s*(?:"(.*)"|'(.*)')\s*$/.exec(trimmed);
|
|
95878
|
+
const key = match2?.[1];
|
|
95879
|
+
const value = match2?.[2] ?? match2?.[3];
|
|
95880
|
+
if (!key || value === void 0)
|
|
95873
95881
|
continue;
|
|
95874
|
-
out[
|
|
95882
|
+
out[key] = value.replace(/\\(["\\])/g, "$1");
|
|
95875
95883
|
}
|
|
95876
95884
|
return out;
|
|
95877
95885
|
}
|
|
95886
|
+
function devinTokenFromToml(text) {
|
|
95887
|
+
const fields = parseCredentialsToml(text);
|
|
95888
|
+
for (const name of TOKEN_FIELDS) {
|
|
95889
|
+
const value = fields[name]?.trim();
|
|
95890
|
+
if (value)
|
|
95891
|
+
return value;
|
|
95892
|
+
}
|
|
95893
|
+
return void 0;
|
|
95894
|
+
}
|
|
95878
95895
|
function resolveDevinCredentials() {
|
|
95879
95896
|
let text;
|
|
95880
95897
|
try {
|
|
@@ -95883,7 +95900,7 @@ function resolveDevinCredentials() {
|
|
|
95883
95900
|
return void 0;
|
|
95884
95901
|
}
|
|
95885
95902
|
const fields = parseCredentialsToml(text);
|
|
95886
|
-
const apiKey =
|
|
95903
|
+
const apiKey = TOKEN_FIELDS.map((name) => fields[name]?.trim()).find((value) => value);
|
|
95887
95904
|
if (!apiKey)
|
|
95888
95905
|
return void 0;
|
|
95889
95906
|
const trimUrl = (value) => {
|
|
@@ -96331,11 +96348,6 @@ function toPiDevinModel(spec) {
|
|
|
96331
96348
|
...thinkingLevelMap ? { thinkingLevelMap } : {}
|
|
96332
96349
|
};
|
|
96333
96350
|
}
|
|
96334
|
-
var DEVIN_TOML_TOKEN_RE = /(?:windsurf_api_key|session_token|access_token|api_key|token)\s*=\s*(?:"([^"]+)"|'([^']+)')/i;
|
|
96335
|
-
function parseDevinCredentialsToml(text) {
|
|
96336
|
-
const match2 = text.match(DEVIN_TOML_TOKEN_RE);
|
|
96337
|
-
return match2?.[1] || match2?.[2] || void 0;
|
|
96338
|
-
}
|
|
96339
96351
|
function resolveDevinToken(env3 = process.env, options = {}) {
|
|
96340
96352
|
const fromEnv = env3.DEVIN_API_KEY?.trim() || env3.DEVIN_SESSION_TOKEN?.trim() || env3.WINDSURF_API_KEY?.trim();
|
|
96341
96353
|
if (fromEnv) return fromEnv;
|
|
@@ -96344,7 +96356,7 @@ function resolveDevinToken(env3 = process.env, options = {}) {
|
|
|
96344
96356
|
for (const path6 of options.paths) {
|
|
96345
96357
|
if (!existsSync(path6)) continue;
|
|
96346
96358
|
try {
|
|
96347
|
-
const token =
|
|
96359
|
+
const token = devinTokenFromToml(readFileSync3(path6, "utf8"));
|
|
96348
96360
|
if (token) return token;
|
|
96349
96361
|
} catch {
|
|
96350
96362
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which of kiro, devin, and grok a host registers.
|
|
3
|
+
*
|
|
4
|
+
* The file is the durable switch `ns-bridge providers` writes. Environment
|
|
5
|
+
* lists still win, so a one-off shell override does not need a rewrite.
|
|
6
|
+
* Absent file: kiro, devin, and grok on.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PROVIDERS: readonly ["kiro", "devin", "grok"];
|
|
9
|
+
export type ProviderName = (typeof PROVIDERS)[number];
|
|
10
|
+
export type ProviderSelection = Record<ProviderName, boolean>;
|
|
11
|
+
export declare const DEFAULT_SELECTION: ProviderSelection;
|
|
12
|
+
export interface SelectionEnv {
|
|
13
|
+
/** Allow-list. Naming kiro opts it in. */
|
|
14
|
+
NS_OMP_PROVIDERS?: string;
|
|
15
|
+
/** Opt-in on top of the file (or the allow-list). */
|
|
16
|
+
NS_OMP_PROVIDER_ENABLE?: string;
|
|
17
|
+
/** Deny-list, applied last. */
|
|
18
|
+
NS_OMP_PROVIDER_DISABLE?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function selectionPath(env?: NodeJS.ProcessEnv, home?: string): string;
|
|
21
|
+
export declare function parseProvider(value: string | undefined): ProviderName | {
|
|
22
|
+
error: string;
|
|
23
|
+
};
|
|
24
|
+
/** File values for known providers. Unknown keys and bad shapes are ignored. */
|
|
25
|
+
export declare function readSelectionFile(path: string): Partial<ProviderSelection>;
|
|
26
|
+
/**
|
|
27
|
+
* File, then env. `NS_OMP_PROVIDERS` replaces the file. Enable adds.
|
|
28
|
+
* Disable removes, and wins over both.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveSelection(file: Partial<ProviderSelection>, env?: SelectionEnv): ProviderSelection;
|
|
31
|
+
/** Write one provider. Other keys already in the file stay. */
|
|
32
|
+
export declare function writeProvider(path: string, provider: ProviderName, enabled: boolean): ProviderSelection;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which of kiro, devin, and grok a host registers.
|
|
3
|
+
*
|
|
4
|
+
* The file is the durable switch `ns-bridge providers` writes. Environment
|
|
5
|
+
* lists still win, so a one-off shell override does not need a rewrite.
|
|
6
|
+
* Absent file: kiro, devin, and grok on.
|
|
7
|
+
*/
|
|
8
|
+
import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { homedir } from "node:os";
|
|
10
|
+
import { dirname, join } from "node:path";
|
|
11
|
+
export const PROVIDERS = ["kiro", "devin", "grok"];
|
|
12
|
+
export const DEFAULT_SELECTION = { kiro: true, devin: true, grok: true };
|
|
13
|
+
export function selectionPath(env = process.env, home = homedir()) {
|
|
14
|
+
return env.NS_BRIDGE_PROVIDERS ?? join(home, ".ns-bridge", "providers.json");
|
|
15
|
+
}
|
|
16
|
+
export function parseProvider(value) {
|
|
17
|
+
const name = value?.trim().toLowerCase();
|
|
18
|
+
if (name === "kiro" || name === "devin" || name === "grok")
|
|
19
|
+
return name;
|
|
20
|
+
return { error: `unknown provider ${value ?? ""} (expected kiro, devin, or grok)` };
|
|
21
|
+
}
|
|
22
|
+
/** File values for known providers. Unknown keys and bad shapes are ignored. */
|
|
23
|
+
export function readSelectionFile(path) {
|
|
24
|
+
let raw;
|
|
25
|
+
try {
|
|
26
|
+
raw = readFileSync(path, "utf8");
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
let parsed;
|
|
32
|
+
try {
|
|
33
|
+
parsed = JSON.parse(raw);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
39
|
+
return {};
|
|
40
|
+
const record = {};
|
|
41
|
+
for (const [key, value] of Object.entries(parsed))
|
|
42
|
+
record[key] = value;
|
|
43
|
+
const selection = {};
|
|
44
|
+
for (const provider of PROVIDERS) {
|
|
45
|
+
if (typeof record[provider] === "boolean")
|
|
46
|
+
selection[provider] = record[provider];
|
|
47
|
+
}
|
|
48
|
+
return selection;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* File, then env. `NS_OMP_PROVIDERS` replaces the file. Enable adds.
|
|
52
|
+
* Disable removes, and wins over both.
|
|
53
|
+
*/
|
|
54
|
+
export function resolveSelection(file, env = {}) {
|
|
55
|
+
const allow = parseList(env.NS_OMP_PROVIDERS);
|
|
56
|
+
const enable = parseList(env.NS_OMP_PROVIDER_ENABLE);
|
|
57
|
+
const deny = parseList(env.NS_OMP_PROVIDER_DISABLE);
|
|
58
|
+
const selection = {};
|
|
59
|
+
for (const provider of PROVIDERS) {
|
|
60
|
+
const base = allow !== undefined ? allow[provider] === true : (file[provider] ?? DEFAULT_SELECTION[provider]);
|
|
61
|
+
selection[provider] = (base || enable?.[provider] === true) && deny?.[provider] !== true;
|
|
62
|
+
}
|
|
63
|
+
return selection;
|
|
64
|
+
}
|
|
65
|
+
/** Write one provider. Other keys already in the file stay. */
|
|
66
|
+
export function writeProvider(path, provider, enabled) {
|
|
67
|
+
const next = { ...DEFAULT_SELECTION, ...readSelectionFile(path), [provider]: enabled };
|
|
68
|
+
const dir = dirname(path);
|
|
69
|
+
mkdirSync(dir, { recursive: true });
|
|
70
|
+
const tmp = join(dir, `.providers.${process.pid}.tmp`);
|
|
71
|
+
writeFileSync(tmp, `${JSON.stringify(next, null, 2)}\n`, "utf8");
|
|
72
|
+
renameSync(tmp, path);
|
|
73
|
+
return next;
|
|
74
|
+
}
|
|
75
|
+
/** `undefined` means the env var was absent, so the file decides. */
|
|
76
|
+
function parseList(value) {
|
|
77
|
+
if (value === undefined || value.trim() === "")
|
|
78
|
+
return undefined;
|
|
79
|
+
const found = {};
|
|
80
|
+
for (const item of value.split(/[\s,]+/)) {
|
|
81
|
+
const name = item.trim().toLowerCase();
|
|
82
|
+
if (name === "kiro" || name === "devin" || name === "grok")
|
|
83
|
+
found[name] = true;
|
|
84
|
+
}
|
|
85
|
+
return found;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.js","sourceRoot":"","sources":["../src/selection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO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