@gendigital/sage-opencode 0.13.0 → 0.15.0
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 +14 -2
- package/dist/extractors.d.ts +7 -0
- package/dist/extractors.d.ts.map +1 -1
- package/dist/extractors.js +89 -16
- package/dist/extractors.js.map +1 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -320
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.cjs +425 -98
- package/dist/mcp-server.cjs.map +4 -4
- package/dist/plugin-discovery.d.ts +7 -0
- package/dist/plugin-discovery.d.ts.map +1 -1
- package/dist/plugin-discovery.js +46 -11
- package/dist/plugin-discovery.js.map +1 -1
- package/dist/shared.d.ts +63 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +352 -0
- package/dist/shared.js.map +1 -0
- package/dist/tool-handler.d.ts +6 -0
- package/dist/tool-handler.d.ts.map +1 -1
- package/dist/tool-handler.js +22 -4
- package/dist/tool-handler.js.map +1 -1
- package/dist/v2-types.d.ts +95 -0
- package/dist/v2-types.d.ts.map +1 -0
- package/dist/v2-types.js +10 -0
- package/dist/v2-types.js.map +1 -0
- package/dist/v2.d.ts +24 -0
- package/dist/v2.d.ts.map +1 -0
- package/dist/v2.js +151 -0
- package/dist/v2.js.map +1 -0
- package/index.js +3 -0
- package/package.json +4 -3
- package/resources/threats/credentials.yaml +1 -1
- package/resources/threats/dummy.yaml +37 -4
- package/resources/threats/prompt-injection.yaml +13 -0
package/dist/index.js
CHANGED
|
@@ -1,324 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sage OpenCode plugin.
|
|
3
3
|
* Intercepts tool calls and uses @gendigital/sage-core to enforce security verdicts.
|
|
4
|
-
*/
|
|
5
|
-
import { mkdirSync, watchFile } from "node:fs";
|
|
6
|
-
import { dirname, join } from "node:path";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
8
|
-
import { ApprovalStore, approveAction, checkAllowlistMigration, createOperationalLogger, foreignSourceRuntime, formatAllowlistMigrationWarning, formatConfigurationWarnings, formatNoticeById, getConfigurationWarnings, loadConfig, loadSkillVerdictCache, resolveBranding, resolvePath, } from "@gendigital/sage-core";
|
|
9
|
-
import { tool } from "@opencode-ai/plugin/tool";
|
|
10
|
-
import { getBundledDataDirs } from "./bundled-dirs.js";
|
|
11
|
-
import { createSessionScanHandler } from "./startup-scan.js";
|
|
12
|
-
import { createToolHandlers } from "./tool-handler.js";
|
|
13
|
-
const APPROVAL_STORE_CLEANUP_INTERVAL_MS = 5 * 60 * 1000; // 5 minutes
|
|
14
|
-
const DEFAULT_TOAST_DURATION_MS = 5000;
|
|
15
|
-
// The startup security summary lists every risky skill, so it's shown longer to
|
|
16
|
-
// give the user time to read the list before it dismisses.
|
|
17
|
-
const STARTUP_SUMMARY_DURATION_MS = 10_000;
|
|
18
|
-
// Module-scoped so repeated SagePlugin instantiations (OpenCode may load the
|
|
19
|
-
// plugin more than once) share a single watcher and one notified-set, instead
|
|
20
|
-
// of each instance attaching its own watcher and toasting the same verdict.
|
|
21
|
-
const notifiedSkillVerdicts = new Set();
|
|
22
|
-
let skillWatcherAttached = false;
|
|
23
|
-
// One scan per session, shared across instances: the entry guards against
|
|
24
|
-
// re-running the scan when session.updated fires repeatedly or on more than one
|
|
25
|
-
// plugin instance.
|
|
26
|
-
const sessionScanPromises = new Map();
|
|
27
|
-
const toastQueue = [];
|
|
28
|
-
let toastPumpRunning = false;
|
|
29
|
-
// Bound to a live client's showToast by the first instance (see SagePlugin).
|
|
30
|
-
let displayToast;
|
|
31
|
-
async function pumpToasts() {
|
|
32
|
-
if (toastPumpRunning)
|
|
33
|
-
return;
|
|
34
|
-
toastPumpRunning = true;
|
|
35
|
-
try {
|
|
36
|
-
while (toastQueue.length > 0) {
|
|
37
|
-
const next = toastQueue[0];
|
|
38
|
-
// No client bound yet — leave the item queued; a later enqueue resumes.
|
|
39
|
-
if (!displayToast || !next)
|
|
40
|
-
break;
|
|
41
|
-
displayToast(next.message, next.variant, next.durationMs);
|
|
42
|
-
toastQueue.shift();
|
|
43
|
-
// Hold the slot for this toast's full duration before showing the next,
|
|
44
|
-
// so a following toast can't replace it early (showToast overwrites).
|
|
45
|
-
await new Promise((resolve) => setTimeout(resolve, next.durationMs));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
finally {
|
|
49
|
-
toastPumpRunning = false;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function enqueueToast(message, variant, durationMs = DEFAULT_TOAST_DURATION_MS) {
|
|
53
|
-
toastQueue.push({ message, variant, durationMs });
|
|
54
|
-
void pumpToasts();
|
|
55
|
-
}
|
|
56
|
-
// Shared dedup key across the two surfacing paths: the scan-findings popup keys
|
|
57
|
-
// on `finding.artifact` (which is `skillId.slice(0, 16)`), and the cache watcher
|
|
58
|
-
// keys on the full skillId — so both reduce to this 16-char content-hash prefix
|
|
59
|
-
// and `notifiedSkillVerdicts` never double-announces the same skill version.
|
|
60
|
-
function shortSkillId(skillId) {
|
|
61
|
-
return skillId.slice(0, 16);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Read `~/.sage/skill_verdict_cache.json` and return every HIGH/CRITICAL verdict
|
|
65
|
-
* relevant to this runtime — one per cache entry, NOT deduped, since dedup is
|
|
66
|
-
* caller-specific (the popup keys on current content, the toast queue on
|
|
67
|
-
* skillId). HIGH maps to the "WARNING" label. Verdicts sourced only from other
|
|
68
|
-
* agent runtimes are skipped so one host doesn't echo another's finds.
|
|
69
|
-
*/
|
|
70
|
-
async function collectRiskySkills(agentRuntime) {
|
|
71
|
-
const cache = await loadSkillVerdictCache();
|
|
72
|
-
const out = [];
|
|
73
|
-
for (const [skillId, verdict] of Object.entries(cache.entries)) {
|
|
74
|
-
const risk = (verdict.verdict ?? "").toUpperCase();
|
|
75
|
-
if (risk !== "HIGH" && risk !== "CRITICAL")
|
|
76
|
-
continue;
|
|
77
|
-
if (foreignSourceRuntime(verdict.sources, agentRuntime))
|
|
78
|
-
continue;
|
|
79
|
-
const key = verdict.sources?.find((s) => s.containerKey)?.containerKey ||
|
|
80
|
-
verdict.skillName ||
|
|
81
|
-
skillId.slice(0, 16);
|
|
82
|
-
out.push({
|
|
83
|
-
skillId,
|
|
84
|
-
key,
|
|
85
|
-
severity: risk === "CRITICAL" ? "CRITICAL" : "WARNING",
|
|
86
|
-
summary: verdict.summary?.trim(),
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
return out;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Watch `~/.sage/skill_verdict_cache.json` and queue one toast per verdict the
|
|
93
|
-
* upload worker writes mid-session (it writes asynchronously, ~one session after
|
|
94
|
-
* discovery). The serial queue shows them one at a time so two skills finishing
|
|
95
|
-
* together are both seen.
|
|
96
4
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
5
|
+
* One entry point serves both OpenCode generations:
|
|
6
|
+
* - v1 (`opencode` 1.x) reads `default.server` (the `{ id, server }` module
|
|
7
|
+
* shape) and calls it with `(input, options)`.
|
|
8
|
+
* - v2 (opencode2 / `@opencode-ai/core`) decodes `default` as `{ id, setup }`
|
|
9
|
+
* and calls `setup(context)`; extra keys are ignored by both loaders.
|
|
102
10
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
11
|
+
* The default export must stay a plain object: v2 rejects a function there.
|
|
12
|
+
* Keep every other export a v1 plugin function — legacy v1 loaders call each
|
|
13
|
+
* module export as a plugin and throw on anything else.
|
|
106
14
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
for (const s of await collectRiskySkills(agentRuntime)) {
|
|
114
|
-
notifiedSkillVerdicts.add(shortSkillId(s.skillId));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
catch (e) {
|
|
118
|
-
logger.debug("Skill verdict seed failed", { error: String(e) });
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
// Mid-session: queue one toast per newly written (not-yet-notified) verdict.
|
|
122
|
-
const announceNew = async () => {
|
|
123
|
-
try {
|
|
124
|
-
for (const s of await collectRiskySkills(agentRuntime)) {
|
|
125
|
-
const short = shortSkillId(s.skillId);
|
|
126
|
-
if (notifiedSkillVerdicts.has(short))
|
|
127
|
-
continue;
|
|
128
|
-
notifiedSkillVerdicts.add(short);
|
|
129
|
-
const detail = s.summary ? `${s.key} — ${s.summary}` : `${s.key} detected`;
|
|
130
|
-
logger.debug("Skill finding toast queued", { key: s.key, severity: s.severity });
|
|
131
|
-
enqueueToast(`${detail} (${s.severity})`, s.severity === "CRITICAL" ? "error" : "warning");
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
catch (e) {
|
|
135
|
-
logger.debug("Skill verdict watcher scan failed", { error: String(e) });
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
try {
|
|
139
|
-
mkdirSync(sageDir, { recursive: true });
|
|
140
|
-
void seedNotified();
|
|
141
|
-
// Poll the cache file with watchFile rather than watch() the directory.
|
|
142
|
-
// On Windows, fs.watch aborts the whole process (an uncatchable libuv
|
|
143
|
-
// assertion in fs-event.c) when the watched path is an 8.3 short name
|
|
144
|
-
// (e.g. an os.tmpdir() like C:\Users\FOO~1.BAR\...) or symlinked home.
|
|
145
|
-
// watchFile is stat-based polling — immune to that. A few seconds of
|
|
146
|
-
// latency for mid-session verdicts is fine (matches the statusline poll
|
|
147
|
-
// cadence used elsewhere). Handles a not-yet-existent file (polls until
|
|
148
|
-
// it appears).
|
|
149
|
-
const cacheFile = join(sageDir, "skill_verdict_cache.json");
|
|
150
|
-
const watcher = watchFile(cacheFile, { interval: 3000 }, (curr, prev) => {
|
|
151
|
-
if (curr.mtimeMs !== prev.mtimeMs)
|
|
152
|
-
void announceNew();
|
|
153
|
-
});
|
|
154
|
-
watcher.unref?.();
|
|
155
|
-
skillWatcherAttached = true;
|
|
156
|
-
logger.debug("Skill findings watcher attached", { cacheFile });
|
|
157
|
-
}
|
|
158
|
-
catch (e) {
|
|
159
|
-
// ~/.sage/ may be unwritable — no watcher, no notifications (fail-open).
|
|
160
|
-
logger.debug("Skill findings watcher setup failed", { error: String(e) });
|
|
161
|
-
}
|
|
162
|
-
}
|
|
15
|
+
import { tool } from "@opencode-ai/plugin/tool";
|
|
16
|
+
import { approvalPatterns, createSageController, SAGE_MCP_SERVER_NAME, SAGE_PLUGIN_ID, sageMcpServerConfig, } from "./shared.js";
|
|
17
|
+
import { setupV2 } from "./v2.js";
|
|
18
|
+
const DEFAULT_TOAST_DURATION_MS = 5000;
|
|
19
|
+
/** OpenCode v1 plugin function (`(input, options) => Hooks`). */
|
|
163
20
|
export const SagePlugin = async ({ client, directory }) => {
|
|
164
|
-
const
|
|
165
|
-
const operationalLogger = createOperationalLogger(config.operational_logging, "opencode");
|
|
166
|
-
const logger = operationalLogger.forComponent("plugin");
|
|
167
|
-
const toolLogger = operationalLogger.forComponent("tool-handler");
|
|
168
|
-
const scanLogger = operationalLogger.forComponent("startup-scan");
|
|
169
|
-
const branding = resolveBranding(config.brand_key, logger);
|
|
170
|
-
const showToast = (msg, variant, durationMs = DEFAULT_TOAST_DURATION_MS) => {
|
|
171
|
-
client.tui
|
|
172
|
-
.showToast({
|
|
173
|
-
body: { title: branding.name, message: msg, variant, duration: durationMs },
|
|
174
|
-
})
|
|
175
|
-
.catch(() => { });
|
|
176
|
-
};
|
|
177
|
-
// Bind the module-scoped skill-toast queue to this (first) instance's client.
|
|
178
|
-
// The queue passes each item's own duration, which showToast honors.
|
|
179
|
-
displayToast ??= showToast;
|
|
180
|
-
const warningMessage = formatConfigurationWarnings(await getConfigurationWarnings(undefined, logger), branding);
|
|
181
|
-
if (warningMessage) {
|
|
182
|
-
client.tui
|
|
183
|
-
.showToast({
|
|
184
|
-
body: {
|
|
185
|
-
title: branding.name,
|
|
186
|
-
message: warningMessage,
|
|
187
|
-
variant: "warning",
|
|
188
|
-
duration: DEFAULT_TOAST_DURATION_MS,
|
|
189
|
-
},
|
|
190
|
-
})
|
|
191
|
-
.catch(() => { });
|
|
192
|
-
}
|
|
193
|
-
const allowlistMigration = await checkAllowlistMigration();
|
|
194
|
-
if (allowlistMigration.needed) {
|
|
21
|
+
const createNotifier = (branding) => (msg, variant, durationMs = DEFAULT_TOAST_DURATION_MS) => {
|
|
195
22
|
client.tui
|
|
196
|
-
.showToast({
|
|
197
|
-
body: {
|
|
198
|
-
title: branding.name,
|
|
199
|
-
message: formatAllowlistMigrationWarning(allowlistMigration.entryTypes, branding),
|
|
200
|
-
variant: "warning",
|
|
201
|
-
duration: 8000,
|
|
202
|
-
},
|
|
203
|
-
})
|
|
23
|
+
.showToast({ body: { title: branding.name, message: msg, variant, duration: durationMs } })
|
|
204
24
|
.catch(() => { });
|
|
205
|
-
}
|
|
206
|
-
const { threatsDir, trustedDomainsDir } = getBundledDataDirs();
|
|
207
|
-
const approvalStore = new ApprovalStore();
|
|
208
|
-
// Watch for verdicts the upload worker writes mid-session (queued toasts).
|
|
209
|
-
// Verdicts cached by earlier sessions are surfaced by surfaceStartupSummary.
|
|
210
|
-
setupSkillFindingsWatcher(logger, "opencode");
|
|
211
|
-
// Surface the scan's structured findings after the scan (TUI ready). Findings
|
|
212
|
-
// are install- and content-accurate: the scan hashes current on-disk content
|
|
213
|
-
// and looks up its verdict, so a deleted skill isn't discovered and an edited
|
|
214
|
-
// skill is matched by its new hash — no cache re-derivation needed.
|
|
215
|
-
//
|
|
216
|
-
// Single startup surface: one summary toast listing every risky skill from
|
|
217
|
-
// this scan. Summarized skills are marked notified so the cache watcher does
|
|
218
|
-
// not also announce them per-skill; verdicts that land *after* the scan
|
|
219
|
-
// (worker uploads) are still surfaced individually by the watcher.
|
|
220
|
-
const surfaceStartupSummary = (scanResults) => {
|
|
221
|
-
try {
|
|
222
|
-
const skills = [];
|
|
223
|
-
const seen = new Set();
|
|
224
|
-
for (const result of scanResults) {
|
|
225
|
-
for (const finding of result.findings) {
|
|
226
|
-
if (finding.threatId !== "SKILL_CHECK")
|
|
227
|
-
continue;
|
|
228
|
-
if (finding.severity !== "critical" && finding.severity !== "warning")
|
|
229
|
-
continue;
|
|
230
|
-
if (seen.has(result.plugin.key))
|
|
231
|
-
continue;
|
|
232
|
-
seen.add(result.plugin.key);
|
|
233
|
-
skills.push({
|
|
234
|
-
key: result.plugin.key,
|
|
235
|
-
severity: finding.severity === "critical" ? "CRITICAL" : "WARNING",
|
|
236
|
-
finding,
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
if (skills.length === 0)
|
|
241
|
-
return;
|
|
242
|
-
// Mark every summarized skill as notified so the cache watcher doesn't
|
|
243
|
-
// also announce it per-skill. `finding.artifact` is the 16-char short
|
|
244
|
-
// hash — the same key the watcher dedups on. Verdicts that land after
|
|
245
|
-
// this scan (worker uploads) are still surfaced individually.
|
|
246
|
-
for (const s of skills) {
|
|
247
|
-
if (s.finding.artifact)
|
|
248
|
-
notifiedSkillVerdicts.add(s.finding.artifact);
|
|
249
|
-
}
|
|
250
|
-
// The summary: a single toast listing every risky skill, shown longer.
|
|
251
|
-
const hasCritical = skills.some((s) => s.severity === "CRITICAL");
|
|
252
|
-
const body = skills.map((s) => `${s.key} (${s.severity})`).join("\n");
|
|
253
|
-
enqueueToast(`${branding.name} detected ${skills.length} malicious/suspicious skill(s):\n${body}`, hasCritical ? "error" : "warning", STARTUP_SUMMARY_DURATION_MS);
|
|
254
|
-
}
|
|
255
|
-
catch (e) {
|
|
256
|
-
logger.debug("Skill summary popup failed", { error: String(e) });
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
// Set up the cron job that cleans up the approval store.
|
|
260
|
-
const interval = setInterval(() => {
|
|
261
|
-
approvalStore.cleanup();
|
|
262
|
-
}, APPROVAL_STORE_CLEANUP_INTERVAL_MS);
|
|
263
|
-
interval.unref?.();
|
|
264
|
-
const toolHandlers = createToolHandlers(toolLogger, approvalStore, threatsDir, trustedDomainsDir, { showToast }, branding);
|
|
265
|
-
/**
|
|
266
|
-
* Run the session scan exactly once per session and cache the promise. The
|
|
267
|
-
* cached promise is the dedupe guard — a second call (repeated
|
|
268
|
-
* `session.updated`, or another plugin instance) returns the same
|
|
269
|
-
* in-flight/settled promise instead of re-scanning. The scan's structured
|
|
270
|
-
* findings drive the summary popup (see `surfaceStartupSummary`).
|
|
271
|
-
*/
|
|
272
|
-
const scanSession = (sessionID) => {
|
|
273
|
-
if (sessionID === "unknown")
|
|
274
|
-
return Promise.resolve();
|
|
275
|
-
const existing = sessionScanPromises.get(sessionID);
|
|
276
|
-
if (existing)
|
|
277
|
-
return existing;
|
|
278
|
-
const promise = (async () => {
|
|
279
|
-
logger.debug(`${branding.name}: starting session scan`, { sessionID });
|
|
280
|
-
const scanHandler = createSessionScanHandler(scanLogger, directory,
|
|
281
|
-
// After the scan (TUI ready): summary popup from the structured findings.
|
|
282
|
-
surfaceStartupSummary, branding,
|
|
283
|
-
// One-time notices (e.g. skill-upload consent) as info toasts.
|
|
284
|
-
(noticeIds) => {
|
|
285
|
-
for (const id of noticeIds) {
|
|
286
|
-
const text = formatNoticeById(id, branding);
|
|
287
|
-
if (text)
|
|
288
|
-
enqueueToast(text, "info", STARTUP_SUMMARY_DURATION_MS);
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
await scanHandler();
|
|
292
|
-
})();
|
|
293
|
-
sessionScanPromises.set(sessionID, promise);
|
|
294
|
-
return promise;
|
|
295
25
|
};
|
|
26
|
+
const sage = await createSageController({ directory, createNotifier, host: "v1" });
|
|
296
27
|
return {
|
|
297
28
|
/**
|
|
298
29
|
* Register the Sage MCP server so sage_report_false_positive /
|
|
299
30
|
* sage_list_audit_entries are available as agent tools. OpenCode runs
|
|
300
31
|
* config hooks before MCP init, so mutating cfg.mcp here is sufficient.
|
|
301
|
-
*
|
|
32
|
+
* A user-supplied `sage` entry in opencode.json is never clobbered.
|
|
302
33
|
*/
|
|
303
34
|
config: async (cfg) => {
|
|
304
|
-
const dir = dirname(fileURLToPath(import.meta.url));
|
|
305
|
-
const serverPath = join(dir, "mcp-server.cjs");
|
|
306
35
|
// biome-ignore lint/suspicious/noExplicitAny: OpenCode Config.mcp types not exported
|
|
307
36
|
const mcp = cfg.mcp;
|
|
308
|
-
if (mcp?.
|
|
37
|
+
if (mcp?.[SAGE_MCP_SERVER_NAME])
|
|
309
38
|
return;
|
|
310
39
|
// biome-ignore lint/suspicious/noExplicitAny: assigning McpLocalConfig without importing its type
|
|
311
40
|
cfg.mcp = {
|
|
312
41
|
...mcp,
|
|
313
|
-
|
|
314
|
-
type: "local",
|
|
315
|
-
command: [process.execPath, serverPath],
|
|
316
|
-
environment: { BUN_BE_BUN: "1", SAGE_AGENT_RUNTIME: "opencode" },
|
|
317
|
-
enabled: true,
|
|
318
|
-
},
|
|
42
|
+
[SAGE_MCP_SERVER_NAME]: { ...sageMcpServerConfig(), enabled: true },
|
|
319
43
|
};
|
|
320
44
|
},
|
|
321
|
-
"tool.execute.before":
|
|
45
|
+
"tool.execute.before": sage.beforeToolUse,
|
|
322
46
|
// Run the session scan on the first session.updated event. It discovers
|
|
323
47
|
// skills, populates the verdict cache, and (post-scan, once the TUI is up)
|
|
324
48
|
// shows the summary popup. OpenCode >=1.3 replaced session.created with
|
|
@@ -329,46 +53,38 @@ export const SagePlugin = async ({ client, directory }) => {
|
|
|
329
53
|
// biome-ignore lint/suspicious/noExplicitAny: Event types from SDK not fully typed
|
|
330
54
|
const props = event.properties;
|
|
331
55
|
const sessionID = props?.sessionID ?? props?.info?.id ?? "unknown";
|
|
332
|
-
await scanSession(sessionID);
|
|
56
|
+
await sage.scanSession(sessionID);
|
|
333
57
|
},
|
|
334
58
|
tool: {
|
|
335
59
|
sage_approve: tool({
|
|
336
|
-
description:
|
|
60
|
+
description: sage.approveToolDescription,
|
|
337
61
|
args: {
|
|
338
|
-
actionId: tool.schema
|
|
339
|
-
.string()
|
|
340
|
-
.describe(`Action ID from ${branding.name} flagged message`),
|
|
62
|
+
actionId: tool.schema.string().describe(sage.approveArgDescription),
|
|
341
63
|
},
|
|
342
64
|
async execute(args, context) {
|
|
343
|
-
|
|
344
|
-
if (!pending) {
|
|
345
|
-
return `No pending ${branding.name} approval found for this action ID.`;
|
|
346
|
-
}
|
|
347
|
-
try {
|
|
65
|
+
return sage.resolveApproval(args.actionId, async (pending) => {
|
|
348
66
|
// "doom_loop" is the only permission OpenCode always gates with an ask dialog,
|
|
349
67
|
// bypassing wildcard `*: allow` defaults. If OpenCode changes this, the dialog silently stops appearing.
|
|
350
68
|
await context.ask({
|
|
351
69
|
permission: "doom_loop",
|
|
352
|
-
patterns: pending
|
|
70
|
+
patterns: approvalPatterns(pending),
|
|
353
71
|
always: [],
|
|
354
72
|
metadata: {},
|
|
355
73
|
});
|
|
356
|
-
}
|
|
357
|
-
catch (error) {
|
|
358
|
-
logger.debug(`${branding.name}: approval dialog failed`, {
|
|
359
|
-
actionId: args.actionId,
|
|
360
|
-
error: String(error),
|
|
361
|
-
});
|
|
362
|
-
approvalStore.deletePending(args.actionId);
|
|
363
|
-
logger.debug("OpenCode approval rejected", { actionId: args.actionId });
|
|
364
|
-
return "Rejected by user.";
|
|
365
|
-
}
|
|
366
|
-
logger.info("OpenCode approval accepted", { actionId: args.actionId });
|
|
367
|
-
return approveAction(approvalStore, args.actionId, branding);
|
|
74
|
+
});
|
|
368
75
|
},
|
|
369
76
|
}),
|
|
370
77
|
},
|
|
371
78
|
};
|
|
372
79
|
};
|
|
373
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Dual-host plugin definition: `server` for OpenCode v1, `setup` for v2,
|
|
82
|
+
* both behind the same stable `id`.
|
|
83
|
+
*/
|
|
84
|
+
const sagePluginModule = {
|
|
85
|
+
id: SAGE_PLUGIN_ID,
|
|
86
|
+
server: SagePlugin,
|
|
87
|
+
setup: setupV2,
|
|
88
|
+
};
|
|
89
|
+
export default sagePluginModule;
|
|
374
90
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAEN,aAAa,EACb,aAAa,EACb,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,+BAA+B,EAC/B,2BAA2B,EAC3B,gBAAgB,EAChB,wBAAwB,EAExB,UAAU,EACV,qBAAqB,EAGrB,eAAe,EACf,WAAW,GACX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,kCAAkC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;AAKtE,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAEvC,gFAAgF;AAChF,2DAA2D;AAC3D,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAE3C,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAU,CAAC;AAChD,IAAI,oBAAoB,GAAG,KAAK,CAAC;AAEjC,0EAA0E;AAC1E,gFAAgF;AAChF,mBAAmB;AACnB,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAyB,CAAC;AAO7D,MAAM,UAAU,GAAkB,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