thepopebot 1.2.76-beta.24 → 1.2.76-beta.25
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agent-job-tools
|
|
3
|
-
description: Use when
|
|
3
|
+
description: Use when you need to access agent secrets, API keys, or create and manage background jobs. Supports listing keys and retrieving values, with OAuth credentials auto-refreshed. Also handles requests to "create a background job," "spawn a job," or "kick off an agent job."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## Usage
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: agent-job-secrets
|
|
3
|
-
description: List and retrieve agent secrets. Plain secrets are also available as env vars. OAuth credentials are auto-refreshed on every get call.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Usage
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
# List available secret keys (fetches current list from server)
|
|
10
|
-
node skills/agent-job-secrets/agent-job-secrets.js
|
|
11
|
-
|
|
12
|
-
# Get a secret value (OAuth credentials are auto-refreshed)
|
|
13
|
-
node skills/agent-job-secrets/agent-job-secrets.js get MY_CREDENTIALS
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Notes
|
|
17
|
-
|
|
18
|
-
- `AGENT_JOB_TOKEN` and `APP_URL` are injected automatically — no setup required
|
|
19
|
-
- Plain (non-OAuth) secrets are also available directly as env vars (e.g. `echo $MY_KEY`)
|
|
20
|
-
- OAuth credentials must be fetched via `get` — they are not available as env vars
|
|
21
|
-
- `get` on an OAuth credential refreshes it server-side and returns a fresh access token
|
|
22
|
-
- If a fetched credential stops working (expired token, 401 error), call `get` again to obtain a fresh one
|
|
23
|
-
- `list` always fetches from the server, so it reflects secrets added after the container started
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const [cmd, key] = process.argv.slice(2);
|
|
4
|
-
|
|
5
|
-
const apiKey = process.env.AGENT_JOB_TOKEN;
|
|
6
|
-
const appUrl = process.env.APP_URL;
|
|
7
|
-
|
|
8
|
-
// Default to list
|
|
9
|
-
if (!cmd || cmd === 'list') {
|
|
10
|
-
if (!apiKey || !appUrl) {
|
|
11
|
-
console.log('No agent secrets available (missing AGENT_JOB_TOKEN or APP_URL).');
|
|
12
|
-
process.exit(0);
|
|
13
|
-
}
|
|
14
|
-
const url = `${appUrl}/api/agent-job-list-secrets`;
|
|
15
|
-
const res = await fetch(url, {
|
|
16
|
-
headers: { 'x-api-key': apiKey },
|
|
17
|
-
});
|
|
18
|
-
if (!res.ok) {
|
|
19
|
-
const body = await res.text();
|
|
20
|
-
console.error(`GET ${url} → ${res.status} ${body}`);
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
const json = await res.json();
|
|
24
|
-
const secrets = json.secrets;
|
|
25
|
-
if (!secrets || secrets.length === 0) {
|
|
26
|
-
console.log('No agent secrets configured.');
|
|
27
|
-
} else {
|
|
28
|
-
console.log('Available secrets:');
|
|
29
|
-
secrets.forEach(s => {
|
|
30
|
-
const hint = s.secretType === 'oauth2' ? ' (OAuth — use get to fetch access token)'
|
|
31
|
-
: s.secretType === 'oauth_token' ? ' (OAuth token — use get to fetch)'
|
|
32
|
-
: '';
|
|
33
|
-
console.log(` - ${s.key}${hint}`);
|
|
34
|
-
});
|
|
35
|
-
console.log('\nUse: agent-job-secrets get KEY_NAME');
|
|
36
|
-
console.log('If a fetched value stops working, call get again for a fresh one.');
|
|
37
|
-
}
|
|
38
|
-
process.exit(0);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (!apiKey) { console.error('AGENT_JOB_TOKEN not available'); process.exit(1); }
|
|
42
|
-
if (!appUrl) { console.error('APP_URL not available'); process.exit(1); }
|
|
43
|
-
|
|
44
|
-
if (cmd === 'get') {
|
|
45
|
-
if (!key) { console.error('Usage: agent-job-secrets get KEY_NAME'); process.exit(1); }
|
|
46
|
-
const url = `${appUrl}/api/get-agent-job-secret?key=${encodeURIComponent(key)}`;
|
|
47
|
-
const res = await fetch(url, {
|
|
48
|
-
headers: { 'x-api-key': apiKey },
|
|
49
|
-
});
|
|
50
|
-
if (!res.ok) {
|
|
51
|
-
const body = await res.text();
|
|
52
|
-
console.error(`GET ${url} → ${res.status} ${body}`);
|
|
53
|
-
process.exit(1);
|
|
54
|
-
}
|
|
55
|
-
const json = await res.json();
|
|
56
|
-
console.log(json.value);
|
|
57
|
-
process.exit(0);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
console.error(`Unknown command: ${cmd}`);
|
|
61
|
-
console.error('Available commands: list, get');
|
|
62
|
-
process.exit(1);
|