@app-vitals/agent-admin 1.97.0 → 1.98.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@app-vitals/agent-admin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.98.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/app-vitals/agent.git",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@anthropic-ai/sdk": "0.137.0",
|
|
47
|
-
"@app-vitals/agent-lib": "1.
|
|
47
|
+
"@app-vitals/agent-lib": "1.98.0",
|
|
48
48
|
"@hono/zod-openapi": "^1.0.0",
|
|
49
49
|
"@prisma/adapter-pg": "^7.10.0",
|
|
50
50
|
"@prisma/client": "^7.10.0",
|
package/src/admin-ui-pages.ts
CHANGED
|
@@ -530,6 +530,30 @@ export interface NewAgentTemplateItem {
|
|
|
530
530
|
scope: string;
|
|
531
531
|
}
|
|
532
532
|
|
|
533
|
+
/**
|
|
534
|
+
* Shared Slack config-token copy (SWI-18.1). When a stored token resolves, the
|
|
535
|
+
* pasted token is an optional override that can target a different Slack
|
|
536
|
+
* workspace; otherwise it is required. One source so every surface (create
|
|
537
|
+
* form, Sync Manifest, Connect later) cannot drift.
|
|
538
|
+
*/
|
|
539
|
+
function slackTokenCopy(stored: boolean): {
|
|
540
|
+
label: string;
|
|
541
|
+
placeholder: string;
|
|
542
|
+
help: string;
|
|
543
|
+
} {
|
|
544
|
+
return stored
|
|
545
|
+
? {
|
|
546
|
+
label: "Slack App Configuration Token (override, optional)",
|
|
547
|
+
placeholder: "xoxe.xoxp-... (optional override)",
|
|
548
|
+
help: 'Leave blank to use the stored Slack config token; paste a token (<span class="mono">xoxe.xoxp-</span>) only to create the app in a different Slack workspace.',
|
|
549
|
+
}
|
|
550
|
+
: {
|
|
551
|
+
label: "Slack App Configuration Token",
|
|
552
|
+
placeholder: "xoxe.xoxp-...",
|
|
553
|
+
help: 'Requires a Slack app configuration token (<span class="mono">xoxe.xoxp-</span>).',
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
|
|
533
557
|
export function renderNewLocalAgentPage(
|
|
534
558
|
userName: string,
|
|
535
559
|
types: SpecialtyOption[],
|
|
@@ -621,7 +645,7 @@ export function renderNewLocalAgentPage(
|
|
|
621
645
|
}
|
|
622
646
|
<p style="font-size:13px;color:var(--vos-text-muted);margin-bottom:4px">Have these ready before you start:</p>
|
|
623
647
|
<ul style="font-size:13px;color:var(--vos-text-muted);margin-left:20px">
|
|
624
|
-
<li>A Slack App Configuration Token</li>
|
|
648
|
+
${opts?.slackConfigTokenStored ? "" : "<li>A Slack App Configuration Token</li>"}
|
|
625
649
|
<li>A GitHub org with an App, or a personal access token (PAT)</li>
|
|
626
650
|
<li>A Claude API key or OAuth token</li>
|
|
627
651
|
</ul>
|
|
@@ -815,20 +839,16 @@ export function renderNewLocalAgentPage(
|
|
|
815
839
|
</div>
|
|
816
840
|
<div id="slack-fields" style="display:none;margin-top:12px">
|
|
817
841
|
<div class="form-group">
|
|
818
|
-
<label class="form-label" for="xoxpToken"
|
|
842
|
+
<label class="form-label" for="xoxpToken">${slackTokenCopy(opts?.slackConfigTokenStored === true).label}</label>
|
|
819
843
|
<input
|
|
820
844
|
id="xoxpToken"
|
|
821
845
|
name="xoxpToken"
|
|
822
846
|
type="password"
|
|
823
847
|
class="form-input"
|
|
824
|
-
placeholder="
|
|
848
|
+
placeholder="${slackTokenCopy(opts?.slackConfigTokenStored === true).placeholder}"
|
|
825
849
|
/>
|
|
826
850
|
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">
|
|
827
|
-
${
|
|
828
|
-
opts?.slackConfigTokenStored
|
|
829
|
-
? "Optional: a stored Slack config token is configured in Settings and is used when this is left blank. A token pasted here is used instead. "
|
|
830
|
-
: ""
|
|
831
|
-
}A pasted token is used once to create the Slack app manifest. It is not stored. After
|
|
851
|
+
${opts?.slackConfigTokenStored ? `${slackTokenCopy(true).help} ` : ""}A pasted token is used once to create the Slack app manifest. It is not stored. After
|
|
832
852
|
creating the agent you'll be redirected to authorize the Slack app.
|
|
833
853
|
</p>
|
|
834
854
|
</div>
|
|
@@ -1350,17 +1370,13 @@ export function renderAgentDetailPage(
|
|
|
1350
1370
|
{
|
|
1351
1371
|
envKey: "SLACK_APP_TOKEN",
|
|
1352
1372
|
label: "Connect Slack",
|
|
1353
|
-
description: slackStored
|
|
1354
|
-
? `Connects this agent to a Slack app. Optional: a stored Slack config token is used unless you paste a Slack app configuration token (<span class="mono">xoxe.xoxp-</span>).`
|
|
1355
|
-
: `Connects this agent to a Slack app. Requires a Slack app configuration token (<span class="mono">xoxe.xoxp-</span>).`,
|
|
1373
|
+
description: `Connects this agent to a Slack app. ${slackTokenCopy(slackStored).help}`,
|
|
1356
1374
|
action: `/admin/agents/${escapeHtml(agent.id)}/connect-slack`,
|
|
1357
1375
|
inputs: [
|
|
1358
1376
|
{
|
|
1359
1377
|
name: "xoxpToken",
|
|
1360
1378
|
type: "password",
|
|
1361
|
-
placeholder: slackStored
|
|
1362
|
-
? "xoxe.xoxp-... (optional)"
|
|
1363
|
-
: "xoxe.xoxp-...",
|
|
1379
|
+
placeholder: slackTokenCopy(slackStored).placeholder,
|
|
1364
1380
|
mono: true,
|
|
1365
1381
|
optional: slackStored,
|
|
1366
1382
|
},
|
|
@@ -2368,17 +2384,13 @@ export function renderAgentDetailPage(
|
|
|
2368
2384
|
<details>
|
|
2369
2385
|
<summary class="btn btn-secondary" style="cursor:pointer;font-size:12px;list-style:none">Sync Manifest</summary>
|
|
2370
2386
|
<div style="position:absolute;right:24px;margin-top:6px;background:var(--vos-surface);border:1px solid var(--vos-border);border-radius:6px;padding:12px;box-shadow:0 4px 12px rgba(0,0,0,0.08);z-index:10;min-width:320px">
|
|
2371
|
-
<p style="font-size:12px;color:var(--vos-text-muted);margin:0 0 10px">Syncs the current manifest to the provisioned Slack app. ${
|
|
2372
|
-
slackStored
|
|
2373
|
-
? 'Optional: a stored Slack config token is used unless you paste a Slack app configuration token (<span class="mono">xoxe.xoxp-</span>).'
|
|
2374
|
-
: 'Requires a Slack app configuration token (<span class="mono">xoxe.xoxp-</span>).'
|
|
2375
|
-
}</p>
|
|
2387
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin:0 0 10px">Syncs the current manifest to the provisioned Slack app. ${slackTokenCopy(slackStored).help}</p>
|
|
2376
2388
|
<form method="POST" action="/admin/agents/${escapeHtml(agent.id)}/sync-manifest" style="display:flex;flex-direction:column;gap:8px">
|
|
2377
2389
|
<input
|
|
2378
2390
|
name="xoxpToken"
|
|
2379
2391
|
type="password"
|
|
2380
2392
|
class="form-input mono"
|
|
2381
|
-
placeholder="
|
|
2393
|
+
placeholder="${slackTokenCopy(slackStored).placeholder}"
|
|
2382
2394
|
${slackStored ? "" : "required"}
|
|
2383
2395
|
style="font-size:12px"
|
|
2384
2396
|
/>
|
|
@@ -1192,7 +1192,10 @@ describe("renderAgentDetailPage — connect-later actions", () => {
|
|
|
1192
1192
|
{ timezone: "UTC", slackConfigTokenStored: true },
|
|
1193
1193
|
);
|
|
1194
1194
|
expect(field(stored)).not.toMatch(/required/);
|
|
1195
|
-
expect(stored).toContain(
|
|
1195
|
+
expect(stored).toContain(
|
|
1196
|
+
"Leave blank to use the stored Slack config token",
|
|
1197
|
+
);
|
|
1198
|
+
expect(stored).toContain("xoxe.xoxp-... (optional override)");
|
|
1196
1199
|
});
|
|
1197
1200
|
|
|
1198
1201
|
test("new-agent form hint says the token is optional when a stored token resolves", () => {
|
|
@@ -1201,11 +1204,70 @@ describe("renderAgentDetailPage — connect-later actions", () => {
|
|
|
1201
1204
|
canProvision: true,
|
|
1202
1205
|
slackConfigTokenStored: true,
|
|
1203
1206
|
});
|
|
1204
|
-
expect(withStored).toContain(
|
|
1207
|
+
expect(withStored).toContain(
|
|
1208
|
+
"Slack App Configuration Token (override, optional)",
|
|
1209
|
+
);
|
|
1210
|
+
expect(withStored).toContain(
|
|
1211
|
+
'placeholder="xoxe.xoxp-... (optional override)"',
|
|
1212
|
+
);
|
|
1213
|
+
expect(withStored).toContain(
|
|
1214
|
+
"Leave blank to use the stored Slack config token",
|
|
1215
|
+
);
|
|
1216
|
+
expect(withStored).toContain("different Slack workspace");
|
|
1205
1217
|
const without = renderNewLocalAgentPage(USER_NAME, [CODING_TYPE], {
|
|
1206
1218
|
canProvision: true,
|
|
1207
1219
|
});
|
|
1208
|
-
expect(without).not.toContain(
|
|
1220
|
+
expect(without).not.toContain(
|
|
1221
|
+
"Leave blank to use the stored Slack config token",
|
|
1222
|
+
);
|
|
1223
|
+
expect(without).not.toContain("override, optional");
|
|
1224
|
+
expect(without).toContain('placeholder="xoxe.xoxp-..."');
|
|
1225
|
+
});
|
|
1226
|
+
|
|
1227
|
+
test("Sync Manifest uses the override copy when stored, required copy otherwise", () => {
|
|
1228
|
+
const sync = (stored: boolean) =>
|
|
1229
|
+
renderAgentDetailPage(
|
|
1230
|
+
{ ...AGENT, slackId: "U123" },
|
|
1231
|
+
{},
|
|
1232
|
+
[],
|
|
1233
|
+
[],
|
|
1234
|
+
[],
|
|
1235
|
+
[],
|
|
1236
|
+
[],
|
|
1237
|
+
USER_NAME,
|
|
1238
|
+
true,
|
|
1239
|
+
{ timezone: "UTC", slackConfigTokenStored: stored },
|
|
1240
|
+
).match(
|
|
1241
|
+
/action="\/admin\/agents\/agent-123\/sync-manifest"[\s\S]*?<\/form>/,
|
|
1242
|
+
)?.[0] as string;
|
|
1243
|
+
expect(sync(true)).toContain(
|
|
1244
|
+
'placeholder="xoxe.xoxp-... (optional override)"',
|
|
1245
|
+
);
|
|
1246
|
+
expect(sync(true)).not.toMatch(/required/);
|
|
1247
|
+
expect(sync(false)).toContain('placeholder="xoxe.xoxp-..."');
|
|
1248
|
+
expect(sync(false)).toMatch(/required/);
|
|
1249
|
+
});
|
|
1250
|
+
|
|
1251
|
+
test("Connect-later copy differs for stored vs not stored", () => {
|
|
1252
|
+
const stored = renderAgentDetailPage(
|
|
1253
|
+
AGENT,
|
|
1254
|
+
{},
|
|
1255
|
+
[],
|
|
1256
|
+
[],
|
|
1257
|
+
[],
|
|
1258
|
+
[],
|
|
1259
|
+
[],
|
|
1260
|
+
USER_NAME,
|
|
1261
|
+
true,
|
|
1262
|
+
{
|
|
1263
|
+
timezone: "UTC",
|
|
1264
|
+
slackConfigTokenStored: true,
|
|
1265
|
+
},
|
|
1266
|
+
);
|
|
1267
|
+
expect(stored).toContain(
|
|
1268
|
+
"Leave blank to use the stored Slack config token",
|
|
1269
|
+
);
|
|
1270
|
+
expect(render({})).toContain("Requires a Slack app configuration token");
|
|
1209
1271
|
});
|
|
1210
1272
|
|
|
1211
1273
|
test("Connect Slack action is hidden once SLACK_APP_TOKEN is set", () => {
|
|
@@ -4261,11 +4323,20 @@ describe("renderNewLocalAgentPage — self-serve account user (SSP-4.2)", () =>
|
|
|
4261
4323
|
selfServe,
|
|
4262
4324
|
});
|
|
4263
4325
|
expect(html).toContain("2 of 3");
|
|
4264
|
-
expect(html).toContain("Slack App Configuration Token");
|
|
4326
|
+
expect(html).toContain("A Slack App Configuration Token</li>");
|
|
4265
4327
|
expect(html).toContain("GitHub");
|
|
4266
4328
|
expect(html).toContain("Claude API key");
|
|
4267
4329
|
});
|
|
4268
4330
|
|
|
4331
|
+
test("checklist drops the Slack token item when a stored token resolves", () => {
|
|
4332
|
+
const html = renderNewLocalAgentPage(USER_NAME, [CODING_TYPE], {
|
|
4333
|
+
selfServe,
|
|
4334
|
+
slackConfigTokenStored: true,
|
|
4335
|
+
});
|
|
4336
|
+
expect(html).not.toContain("A Slack App Configuration Token</li>");
|
|
4337
|
+
expect(html).toContain("Claude API key");
|
|
4338
|
+
});
|
|
4339
|
+
|
|
4269
4340
|
describe("hidden type input", () => {
|
|
4270
4341
|
const saved = {
|
|
4271
4342
|
selfServe: process.env.SHIPWRIGHT_SELF_SERVE_AGENT_TYPE,
|
|
@@ -341,6 +341,6 @@ describe("admin UI — stored Slack config token flows", () => {
|
|
|
341
341
|
expect(without).toMatch(/name="xoxpToken"[^>]*required/);
|
|
342
342
|
const withStored = await get(makeResolver([null]).resolver);
|
|
343
343
|
expect(withStored).not.toMatch(/name="xoxpToken"[^>]*required/);
|
|
344
|
-
expect(withStored).toContain("
|
|
344
|
+
expect(withStored).toContain("optional override");
|
|
345
345
|
});
|
|
346
346
|
});
|