@rubytech/create-realagent-code 0.1.579 → 0.1.580
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 +1 -1
- package/payload/platform/lib/telegram-media/dist/index.d.ts +45 -0
- package/payload/platform/lib/telegram-media/dist/index.d.ts.map +1 -0
- package/payload/platform/lib/telegram-media/dist/index.js +89 -0
- package/payload/platform/lib/telegram-media/dist/index.js.map +1 -0
- package/payload/platform/lib/telegram-media/src/__tests__/telegram-media.test.ts +104 -0
- package/payload/platform/lib/telegram-media/src/index.ts +102 -0
- package/payload/platform/lib/telegram-media/tsconfig.json +9 -0
- package/payload/platform/lib/telegram-media/vitest.config.ts +9 -0
- package/payload/platform/package.json +2 -2
- package/payload/platform/plugins/admin/PLUGIN.md +2 -2
- package/payload/platform/plugins/admin/hooks/__tests__/archive-ingest-surface-gate.test.sh +22 -0
- package/payload/platform/plugins/admin/hooks/__tests__/fs-schema-guard.test.sh +34 -0
- package/payload/platform/plugins/admin/hooks/__tests__/quote-path-write-gate.test.sh +25 -0
- package/payload/platform/plugins/admin/hooks/archive-ingest-surface-gate.sh +11 -4
- package/payload/platform/plugins/admin/hooks/fs-schema-guard.sh +2 -2
- package/payload/platform/plugins/admin/hooks/quote-path-write-gate.sh +6 -3
- package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +7 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/portal-schema-shape.test.ts +23 -0
- package/payload/platform/plugins/cloudflare/mcp/__tests__/portal-visit-status-write.test.ts +175 -3
- package/payload/platform/plugins/cloudflare/mcp/__tests__/portal-visits-scope.test.ts +101 -0
- package/payload/platform/plugins/cloudflare/skills/data-portal/schema.sql +35 -1
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/visit-status.ts +73 -8
- package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/visits.ts +59 -8
- package/payload/platform/scripts/__tests__/hook-matcher-dispatch.test.sh +163 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +6 -1
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
- package/payload/platform/templates/specialists/agents/personal-assistant.md +1 -1
- package/payload/server/public/activity.html +6 -6
- package/payload/server/public/agents.html +5 -5
- package/payload/server/public/assets/{AdminLoginScreens-Bus-Y-rG.js → AdminLoginScreens-Dxv5t1YY.js} +1 -1
- package/payload/server/public/assets/AdminLoginScreens-Dxv5t1YY.js.br +0 -0
- package/payload/server/public/assets/AdminLoginScreens-Dxv5t1YY.js.gz +0 -0
- package/payload/server/public/assets/{AdminShell-Bsm7q3CW.js → AdminShell-BMslfZxN.js} +1 -1
- package/payload/server/public/assets/AdminShell-BMslfZxN.js.br +0 -0
- package/payload/server/public/assets/AdminShell-BMslfZxN.js.gz +0 -0
- package/payload/server/public/assets/{activity-BWqrCyYM.js → activity-kQ3w70LJ.js} +1 -1
- package/payload/server/public/assets/activity-kQ3w70LJ.js.br +0 -0
- package/payload/server/public/assets/activity-kQ3w70LJ.js.gz +0 -0
- package/payload/server/public/assets/{admin-zly7Y6EZ.js → admin-DapcMKCG.js} +1 -1
- package/payload/server/public/assets/admin-DapcMKCG.js.br +0 -0
- package/payload/server/public/assets/admin-DapcMKCG.js.gz +0 -0
- package/payload/server/public/assets/{agents-BsxGD1V1.js → agents-Cn_bZgnD.js} +1 -1
- package/payload/server/public/assets/agents-Cn_bZgnD.js.br +0 -0
- package/payload/server/public/assets/agents-Cn_bZgnD.js.gz +0 -0
- package/payload/server/public/assets/{browser-CRLxTaw2.js → browser-BE-GDk5-.js} +1 -1
- package/payload/server/public/assets/browser-BE-GDk5-.js.br +0 -0
- package/payload/server/public/assets/browser-BE-GDk5-.js.gz +0 -0
- package/payload/server/public/assets/{calendar-Bmp6qI_P.js → calendar-Di7BEHHN.js} +1 -1
- package/payload/server/public/assets/calendar-Di7BEHHN.js.br +0 -0
- package/payload/server/public/assets/calendar-Di7BEHHN.js.gz +0 -0
- package/payload/server/public/assets/chat-DLmikhie.js +1 -0
- package/payload/server/public/assets/chat-DLmikhie.js.br +1 -0
- package/payload/server/public/assets/chat-DLmikhie.js.gz +0 -0
- package/payload/server/public/assets/chevron-left-Id9VAZAz.js +1 -0
- package/payload/server/public/assets/chevron-left-Id9VAZAz.js.br +0 -0
- package/payload/server/public/assets/clock-DKpWWJbJ.js +1 -0
- package/payload/server/public/assets/clock-DKpWWJbJ.js.br +0 -0
- package/payload/server/public/assets/{copy-Bcjpxqzn.js → copy-nkxspu2J.js} +1 -1
- package/payload/server/public/assets/copy-nkxspu2J.js.br +0 -0
- package/payload/server/public/assets/copy-nkxspu2J.js.gz +0 -0
- package/payload/server/public/assets/data-C1_m9Xyf.js +1 -0
- package/payload/server/public/assets/data-C1_m9Xyf.js.br +0 -0
- package/payload/server/public/assets/data-C1_m9Xyf.js.gz +0 -0
- package/payload/server/public/assets/{field-ChKB2l_d.js → field-2rIXxGMt.js} +1 -1
- package/payload/server/public/assets/field-2rIXxGMt.js.br +0 -0
- package/payload/server/public/assets/field-2rIXxGMt.js.gz +0 -0
- package/payload/server/public/assets/{file-text-COZcf7mU.js → file-text-CdSqrscg.js} +1 -1
- package/payload/server/public/assets/file-text-CdSqrscg.js.br +0 -0
- package/payload/server/public/assets/file-text-CdSqrscg.js.gz +0 -0
- package/payload/server/public/assets/{graph-nnV47iqM.js → graph-BfBHHXaC.js} +1 -1
- package/payload/server/public/assets/graph-BfBHHXaC.js.br +0 -0
- package/payload/server/public/assets/graph-BfBHHXaC.js.gz +0 -0
- package/payload/server/public/assets/{graph-labels-x-1MT-3c.js → graph-labels-CHW2aBke.js} +1 -1
- package/payload/server/public/assets/graph-labels-CHW2aBke.js.br +0 -0
- package/payload/server/public/assets/graph-labels-CHW2aBke.js.gz +0 -0
- package/payload/server/public/assets/jsx-runtime-D43jgaWP.css +1 -0
- package/payload/server/public/assets/jsx-runtime-D43jgaWP.css.br +0 -0
- package/payload/server/public/assets/jsx-runtime-D43jgaWP.css.gz +0 -0
- package/payload/server/public/assets/{operator-BAO0-mjU.js → operator-BOiL8sxx.js} +1 -1
- package/payload/server/public/assets/operator-BOiL8sxx.js.br +0 -0
- package/payload/server/public/assets/operator-BOiL8sxx.js.gz +0 -0
- package/payload/server/public/assets/page-CZ6tyH8t.js +1 -0
- package/payload/server/public/assets/page-CZ6tyH8t.js.br +0 -0
- package/payload/server/public/assets/page-CZ6tyH8t.js.gz +0 -0
- package/payload/server/public/assets/{page-B-F08pod.js → page-Cd36Y0h6.js} +1 -1
- package/payload/server/public/assets/page-Cd36Y0h6.js.br +0 -0
- package/payload/server/public/assets/page-Cd36Y0h6.js.gz +0 -0
- package/payload/server/public/assets/play-7LTxCuLX.js +1 -0
- package/payload/server/public/assets/play-7LTxCuLX.js.br +0 -0
- package/payload/server/public/assets/play-7LTxCuLX.js.gz +0 -0
- package/payload/server/public/assets/{public-_HJsUohA.js → public-CVBav4FQ.js} +1 -1
- package/payload/server/public/assets/public-CVBav4FQ.js.br +0 -0
- package/payload/server/public/assets/public-CVBav4FQ.js.gz +0 -0
- package/payload/server/public/assets/{rotate-ccw-DJeAnYLQ.js → rotate-ccw-J9f-GWjm.js} +1 -1
- package/payload/server/public/assets/rotate-ccw-J9f-GWjm.js.br +0 -0
- package/payload/server/public/assets/rotate-ccw-J9f-GWjm.js.gz +0 -0
- package/payload/server/public/assets/{routines-CoIVXRCB.js → routines-C1AB-3FR.js} +1 -1
- package/payload/server/public/assets/routines-C1AB-3FR.js.br +0 -0
- package/payload/server/public/assets/routines-C1AB-3FR.js.gz +0 -0
- package/payload/server/public/assets/{skills-BjHt5lDG.js → skills-C4EfNKEx.js} +1 -1
- package/payload/server/public/assets/skills-C4EfNKEx.js.br +0 -0
- package/payload/server/public/assets/skills-C4EfNKEx.js.gz +0 -0
- package/payload/server/public/assets/{tasks-iUFfeA9_.js → tasks-DszD3aZl.js} +1 -1
- package/payload/server/public/assets/tasks-DszD3aZl.js.br +0 -0
- package/payload/server/public/assets/tasks-DszD3aZl.js.gz +0 -0
- package/payload/server/public/assets/{triangle-alert-Dwa986Gg.js → triangle-alert-B5WAyAkC.js} +1 -1
- package/payload/server/public/assets/triangle-alert-B5WAyAkC.js.br +4 -0
- package/payload/server/public/assets/triangle-alert-B5WAyAkC.js.gz +0 -0
- package/payload/server/public/assets/{useCopyFeedback-B1Jp6CsE.js → useCopyFeedback-B2nuNNJw.js} +1 -1
- package/payload/server/public/assets/useCopyFeedback-B2nuNNJw.js.br +0 -0
- package/payload/server/public/assets/useCopyFeedback-B2nuNNJw.js.gz +0 -0
- package/payload/server/public/assets/{useMediaQuery-CVZYjRf6.js → useMediaQuery-DUPJPHQt.js} +1 -1
- package/payload/server/public/assets/useMediaQuery-DUPJPHQt.js.br +0 -0
- package/payload/server/public/assets/useMediaQuery-DUPJPHQt.js.gz +0 -0
- package/payload/server/public/assets/{useVoiceRecorder-D5b4r4z0.js → useVoiceRecorder-BEgr0nHN.js} +1 -1
- package/payload/server/public/assets/useVoiceRecorder-BEgr0nHN.js.br +0 -0
- package/payload/server/public/assets/useVoiceRecorder-BEgr0nHN.js.gz +0 -0
- package/payload/server/public/assets/{wrench-BD7xwbV1.js → wrench-DZJZm17j.js} +1 -1
- package/payload/server/public/assets/wrench-DZJZm17j.js.br +0 -0
- package/payload/server/public/assets/wrench-DZJZm17j.js.gz +0 -0
- package/payload/server/public/browser.html +5 -5
- package/payload/server/public/calendar.html +8 -8
- package/payload/server/public/chat.html +14 -14
- package/payload/server/public/data.html +12 -12
- package/payload/server/public/field.html +3 -3
- package/payload/server/public/graph.html +10 -10
- package/payload/server/public/index.html +14 -14
- package/payload/server/public/operator.html +15 -15
- package/payload/server/public/public.html +14 -14
- package/payload/server/public/routines.html +8 -8
- package/payload/server/public/skills.html +6 -6
- package/payload/server/public/tasks.html +7 -7
- package/payload/server/server.js +965 -687
- package/payload/server/public/assets/AdminLoginScreens-Bus-Y-rG.js.br +0 -0
- package/payload/server/public/assets/AdminLoginScreens-Bus-Y-rG.js.gz +0 -0
- package/payload/server/public/assets/AdminShell-Bsm7q3CW.js.br +0 -0
- package/payload/server/public/assets/AdminShell-Bsm7q3CW.js.gz +0 -0
- package/payload/server/public/assets/activity-BWqrCyYM.js.br +0 -0
- package/payload/server/public/assets/activity-BWqrCyYM.js.gz +0 -0
- package/payload/server/public/assets/admin-zly7Y6EZ.js.br +0 -0
- package/payload/server/public/assets/admin-zly7Y6EZ.js.gz +0 -0
- package/payload/server/public/assets/agents-BsxGD1V1.js.br +0 -0
- package/payload/server/public/assets/agents-BsxGD1V1.js.gz +0 -0
- package/payload/server/public/assets/browser-CRLxTaw2.js.br +0 -0
- package/payload/server/public/assets/browser-CRLxTaw2.js.gz +0 -0
- package/payload/server/public/assets/calendar-Bmp6qI_P.js.br +0 -0
- package/payload/server/public/assets/calendar-Bmp6qI_P.js.gz +0 -0
- package/payload/server/public/assets/chat-ChObDKHy.js +0 -1
- package/payload/server/public/assets/chat-ChObDKHy.js.br +0 -0
- package/payload/server/public/assets/chat-ChObDKHy.js.gz +0 -0
- package/payload/server/public/assets/chevron-left-D2l4jMcd.js +0 -1
- package/payload/server/public/assets/chevron-left-D2l4jMcd.js.br +0 -0
- package/payload/server/public/assets/clock-CMdfsroW.js +0 -1
- package/payload/server/public/assets/clock-CMdfsroW.js.br +0 -0
- package/payload/server/public/assets/clock-CMdfsroW.js.gz +0 -0
- package/payload/server/public/assets/copy-Bcjpxqzn.js.br +0 -0
- package/payload/server/public/assets/copy-Bcjpxqzn.js.gz +0 -0
- package/payload/server/public/assets/data-CFB5Lgw-.js +0 -1
- package/payload/server/public/assets/data-CFB5Lgw-.js.br +0 -0
- package/payload/server/public/assets/data-CFB5Lgw-.js.gz +0 -0
- package/payload/server/public/assets/field-ChKB2l_d.js.br +0 -0
- package/payload/server/public/assets/field-ChKB2l_d.js.gz +0 -0
- package/payload/server/public/assets/file-text-COZcf7mU.js.br +0 -0
- package/payload/server/public/assets/file-text-COZcf7mU.js.gz +0 -0
- package/payload/server/public/assets/graph-labels-x-1MT-3c.js.br +0 -0
- package/payload/server/public/assets/graph-labels-x-1MT-3c.js.gz +0 -0
- package/payload/server/public/assets/graph-nnV47iqM.js.br +0 -0
- package/payload/server/public/assets/graph-nnV47iqM.js.gz +0 -0
- package/payload/server/public/assets/jsx-runtime-CeNZasfC.css +0 -1
- package/payload/server/public/assets/jsx-runtime-CeNZasfC.css.br +0 -0
- package/payload/server/public/assets/jsx-runtime-CeNZasfC.css.gz +0 -0
- package/payload/server/public/assets/operator-BAO0-mjU.js.br +0 -0
- package/payload/server/public/assets/operator-BAO0-mjU.js.gz +0 -0
- package/payload/server/public/assets/page-B-F08pod.js.br +0 -0
- package/payload/server/public/assets/page-B-F08pod.js.gz +0 -0
- package/payload/server/public/assets/page-BMOCy2aD.js +0 -1
- package/payload/server/public/assets/page-BMOCy2aD.js.br +0 -0
- package/payload/server/public/assets/page-BMOCy2aD.js.gz +0 -0
- package/payload/server/public/assets/play-DFtlk8Zs.js +0 -1
- package/payload/server/public/assets/play-DFtlk8Zs.js.br +0 -0
- package/payload/server/public/assets/play-DFtlk8Zs.js.gz +0 -0
- package/payload/server/public/assets/public-_HJsUohA.js.br +0 -0
- package/payload/server/public/assets/public-_HJsUohA.js.gz +0 -0
- package/payload/server/public/assets/rotate-ccw-DJeAnYLQ.js.br +0 -0
- package/payload/server/public/assets/rotate-ccw-DJeAnYLQ.js.gz +0 -0
- package/payload/server/public/assets/routines-CoIVXRCB.js.br +0 -0
- package/payload/server/public/assets/routines-CoIVXRCB.js.gz +0 -0
- package/payload/server/public/assets/skills-BjHt5lDG.js.br +0 -0
- package/payload/server/public/assets/skills-BjHt5lDG.js.gz +0 -0
- package/payload/server/public/assets/tasks-iUFfeA9_.js.br +0 -0
- package/payload/server/public/assets/tasks-iUFfeA9_.js.gz +0 -0
- package/payload/server/public/assets/triangle-alert-Dwa986Gg.js.br +0 -0
- package/payload/server/public/assets/triangle-alert-Dwa986Gg.js.gz +0 -0
- package/payload/server/public/assets/useCopyFeedback-B1Jp6CsE.js.br +0 -0
- package/payload/server/public/assets/useCopyFeedback-B1Jp6CsE.js.gz +0 -0
- package/payload/server/public/assets/useMediaQuery-CVZYjRf6.js.br +0 -0
- package/payload/server/public/assets/useMediaQuery-CVZYjRf6.js.gz +0 -0
- package/payload/server/public/assets/useVoiceRecorder-D5b4r4z0.js.br +0 -0
- package/payload/server/public/assets/useVoiceRecorder-D5b4r4z0.js.gz +0 -0
- package/payload/server/public/assets/wrench-BD7xwbV1.js.br +0 -0
- package/payload/server/public/assets/wrench-BD7xwbV1.js.gz +0 -0
- /package/payload/server/public/assets/{jsx-runtime-CjJ246F7.js → jsx-runtime-Cjug_Cyb.js} +0 -0
- /package/payload/server/public/assets/{jsx-runtime-CjJ246F7.js.br → jsx-runtime-Cjug_Cyb.js.br} +0 -0
- /package/payload/server/public/assets/{jsx-runtime-CjJ246F7.js.gz → jsx-runtime-Cjug_Cyb.js.gz} +0 -0
package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/visits.ts
CHANGED
|
@@ -3,14 +3,18 @@ import { readSessionCookie, resolveSession } from './_lib/session'
|
|
|
3
3
|
import { q } from './_lib/log'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* One published
|
|
6
|
+
* One published row: ONE VISIT, ONE ATTENDING WORKER (Task 2551).
|
|
7
|
+
*
|
|
8
|
+
* The `visits` table is keyed on the attendance, so a visit two workers share is
|
|
9
|
+
* two rows here. `processVisits` folds them into the `VisitRow` below; nothing
|
|
10
|
+
* outside this file sees this shape.
|
|
7
11
|
*
|
|
8
12
|
* The ontology's own fields (`schema-construction.md`) and the portal person the
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
13
|
+
* row is assigned to, and nothing else. A job sheet's contents are the account's
|
|
14
|
+
* to design, and they are files, which the Task 1910 exchange already carries —
|
|
15
|
+
* so nothing of theirs belongs in this shape.
|
|
12
16
|
*/
|
|
13
|
-
export interface
|
|
17
|
+
export interface VisitReadRow {
|
|
14
18
|
visitId: string
|
|
15
19
|
ownerId: string
|
|
16
20
|
jobId: string
|
|
@@ -38,6 +42,23 @@ export interface VisitRow {
|
|
|
38
42
|
signatures: number
|
|
39
43
|
}
|
|
40
44
|
|
|
45
|
+
/**
|
|
46
|
+
* One visit, as an account's own page renders it: one card naming every worker
|
|
47
|
+
* on it (Task 2551).
|
|
48
|
+
*
|
|
49
|
+
* `owners` is who is attending. It holds one id for an ordinary visit, two for a
|
|
50
|
+
* visit two workers share, and one empty string for a visit whose engineer
|
|
51
|
+
* carries no `portalOwnerId` — the unbound sentinel `visits.ownerId` has always
|
|
52
|
+
* used.
|
|
53
|
+
*
|
|
54
|
+
* `ownerId` is `owners[0]` and is DERIVED, not authoritative. It stays because
|
|
55
|
+
* the planner groups cards onto worker rows by it and that page is not this
|
|
56
|
+
* task's to change; `owners` is what says who is actually on the job.
|
|
57
|
+
*/
|
|
58
|
+
export interface VisitRow extends VisitReadRow {
|
|
59
|
+
owners: string[]
|
|
60
|
+
}
|
|
61
|
+
|
|
41
62
|
/**
|
|
42
63
|
* One candidate for one unallocated visit (Task 2511).
|
|
43
64
|
*
|
|
@@ -117,6 +138,33 @@ function parseJson<T>(raw: string, fallback: T): T {
|
|
|
117
138
|
}
|
|
118
139
|
}
|
|
119
140
|
|
|
141
|
+
/**
|
|
142
|
+
* The attendance rows for one visit, as one card (Task 2551).
|
|
143
|
+
*
|
|
144
|
+
* CALLED AFTER THE SQL FILTER, NEVER BEFORE. An own-scoped person's read already
|
|
145
|
+
* returned only their own attendance, so their card names them and nobody else.
|
|
146
|
+
* Folding first would hand them the colleague names the file drop deliberately
|
|
147
|
+
* withholds, which is the rule `processVisits` states below.
|
|
148
|
+
*
|
|
149
|
+
* The order of `owners` is the read's `ORDER BY`, so the same set always renders
|
|
150
|
+
* the same way rather than in whatever order D1 happened to answer in.
|
|
151
|
+
*/
|
|
152
|
+
export function foldOwners(rows: readonly VisitReadRow[]): VisitRow[] {
|
|
153
|
+
const out: VisitRow[] = []
|
|
154
|
+
const at = new Map<string, VisitRow>()
|
|
155
|
+
for (const r of rows) {
|
|
156
|
+
const held = at.get(r.visitId)
|
|
157
|
+
if (held) {
|
|
158
|
+
if (!held.owners.includes(r.ownerId)) held.owners.push(r.ownerId)
|
|
159
|
+
continue
|
|
160
|
+
}
|
|
161
|
+
const card: VisitRow = { ...r, owners: [r.ownerId] }
|
|
162
|
+
at.set(r.visitId, card)
|
|
163
|
+
out.push(card)
|
|
164
|
+
}
|
|
165
|
+
return out
|
|
166
|
+
}
|
|
167
|
+
|
|
120
168
|
/**
|
|
121
169
|
* The visits a signed-in person may read.
|
|
122
170
|
*
|
|
@@ -160,13 +208,16 @@ export async function processVisits(
|
|
|
160
208
|
ON s.accountId = v.accountId AND s.currentGeneration = v.generation
|
|
161
209
|
WHERE v.accountId = ?` +
|
|
162
210
|
(scoped ? ' AND v.ownerId = ?' : '') +
|
|
163
|
-
|
|
211
|
+
// ownerId joins the ORDER BY because the table is keyed on the attendance
|
|
212
|
+
// (Task 2551): the rows for one visit arrive together and in a fixed order,
|
|
213
|
+
// so the worker list on a shared card does not vary between reads.
|
|
214
|
+
' ORDER BY v.startDate ASC, v.visitId ASC, v.ownerId ASC'
|
|
164
215
|
const stmt = env.DB.prepare(sql)
|
|
165
216
|
const bound = scoped
|
|
166
217
|
? stmt.bind(env.PORTAL_ACCOUNT_ID, session.ownerId)
|
|
167
218
|
: stmt.bind(env.PORTAL_ACCOUNT_ID)
|
|
168
|
-
const rows = await bound.all<
|
|
169
|
-
const visits = rows.results ?? []
|
|
219
|
+
const rows = await bound.all<VisitReadRow>()
|
|
220
|
+
const visits = foldOwners(rows.results ?? [])
|
|
170
221
|
|
|
171
222
|
// THE SAME TWO FILTERS, and the owner one for the same reason: an own-scoped
|
|
172
223
|
// person may see their own row and no other, or this page becomes a way to
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Task 2545 — a hook registered on a literal tool-name matcher in
|
|
3
|
+
# account-settings.json must name that tool in its own dispatch.
|
|
4
|
+
#
|
|
5
|
+
# Three hooks were registered on a matcher they sent straight to a catch-all
|
|
6
|
+
# unread, so the fences they enforce were reachable by choosing the other write
|
|
7
|
+
# tool. The registration side cannot see it: the reconcile's hookRegistration
|
|
8
|
+
# audit checks that a hook IS registered for a matcher, never that it reads it.
|
|
9
|
+
#
|
|
10
|
+
# The rule: a hook that gates on an explicit set of LITERAL tool names must
|
|
11
|
+
# carry, in that set, every literal matcher it is registered on.
|
|
12
|
+
#
|
|
13
|
+
# - A matcher is literal when it is one tool name with no regex metacharacter.
|
|
14
|
+
# An alternation matcher is split on `|` and each literal part checked.
|
|
15
|
+
# Regex matchers and matcher-less entries name no tool, so they are skipped.
|
|
16
|
+
# - A hook's literal set is read from four constructs: bash
|
|
17
|
+
# `case "$TOOL_NAME" in <arms>`, bash `[ "$TOOL_NAME" = "X" ]` and `!=`,
|
|
18
|
+
# embedded-python `== "X"` / `!= "X"` against tool_name, and embedded-python
|
|
19
|
+
# `in` / `not in ("A", "B")`. A case arm carrying a glob is not a literal.
|
|
20
|
+
# - A hook whose set comes out empty gates on no literal set at all: it either
|
|
21
|
+
# matches by suffix or reads the name only to log it, so it acts on whatever
|
|
22
|
+
# it is registered for and there is nothing here to compare. Skipped.
|
|
23
|
+
#
|
|
24
|
+
# Comments are stripped before the scan. A tool name in a header paragraph is
|
|
25
|
+
# prose, not dispatch, and counting it would report green on a hook that still
|
|
26
|
+
# exits 0 unread.
|
|
27
|
+
#
|
|
28
|
+
# The pair count and the pin below exist because a check that passes on a zero
|
|
29
|
+
# count cannot tell healthy from not-measuring: a refactor that made every hook
|
|
30
|
+
# unparseable would otherwise report success having compared nothing.
|
|
31
|
+
set -uo pipefail
|
|
32
|
+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
33
|
+
PLATFORM="$DIR/../.."
|
|
34
|
+
SETTINGS="$PLATFORM/templates/account-settings.json"
|
|
35
|
+
[ -f "$SETTINGS" ] || { echo "FAIL: $SETTINGS is missing" >&2; exit 1; }
|
|
36
|
+
|
|
37
|
+
python3 - "$SETTINGS" "$PLATFORM" <<'PY'
|
|
38
|
+
import json, os, re, sys
|
|
39
|
+
|
|
40
|
+
settings_path, platform_root = sys.argv[1], sys.argv[2]
|
|
41
|
+
settings = json.load(open(settings_path, encoding="utf-8"))
|
|
42
|
+
|
|
43
|
+
LITERAL = re.compile(r"\A[A-Za-z0-9_-]+\Z")
|
|
44
|
+
# The one hook this check was written for. If a refactor makes its dispatch
|
|
45
|
+
# unreadable to the parser below, coverage is lost silently; this pin says so.
|
|
46
|
+
PINNED = "fs-schema-guard.sh"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def strip_comments(src):
|
|
50
|
+
keep = []
|
|
51
|
+
for line in src.splitlines():
|
|
52
|
+
s = line.lstrip()
|
|
53
|
+
keep.append("" if s.startswith("#") or s.startswith("//") else line)
|
|
54
|
+
return "\n".join(keep)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def tool_case_blocks(src):
|
|
58
|
+
"""Body text of every `case "$TOOL_NAME" in` block, depth-counted so a nested
|
|
59
|
+
case on a different variable cannot end the scan at the wrong esac."""
|
|
60
|
+
blocks = []
|
|
61
|
+
for m in re.finditer(r'case\s+"\$TOOL_NAME"\s+in', src):
|
|
62
|
+
start, depth, end = m.end(), 1, len(src)
|
|
63
|
+
for t in re.finditer(r"\bcase\b|\besac\b", src[start:]):
|
|
64
|
+
depth += 1 if t.group() == "case" else -1
|
|
65
|
+
if depth == 0:
|
|
66
|
+
end = start + t.start()
|
|
67
|
+
break
|
|
68
|
+
blocks.append(src[start:end])
|
|
69
|
+
return blocks
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def literal_tool_names(src):
|
|
73
|
+
"""Every literal tool name the source gates on. Empty means it gates on no
|
|
74
|
+
literal set."""
|
|
75
|
+
names = set()
|
|
76
|
+
|
|
77
|
+
def add(word):
|
|
78
|
+
w = word.strip().strip('"').strip("'")
|
|
79
|
+
if LITERAL.match(w):
|
|
80
|
+
names.add(w)
|
|
81
|
+
|
|
82
|
+
for block in tool_case_blocks(src):
|
|
83
|
+
for arm in re.finditer(r"(?:\A|;;)\s*\(?\s*([^()\n;]+?)\)", block):
|
|
84
|
+
for part in arm.group(1).split("|"):
|
|
85
|
+
add(part)
|
|
86
|
+
|
|
87
|
+
for m in re.finditer(r'"\$TOOL_NAME"\s*(?:!=|==|=)\s*"?([A-Za-z0-9_-]+)"?', src):
|
|
88
|
+
add(m.group(1))
|
|
89
|
+
|
|
90
|
+
for line in src.splitlines():
|
|
91
|
+
if "tool_name" not in line:
|
|
92
|
+
continue
|
|
93
|
+
for m in re.finditer(r'tool_name.*?(?:==|!=)\s*"([^"]+)"', line):
|
|
94
|
+
add(m.group(1))
|
|
95
|
+
for m in re.finditer(r"tool_name.*?\b(?:not\s+in|in)\s*\(([^)]*)\)", line):
|
|
96
|
+
for q in re.findall(r'"([^"]*)"', m.group(1)):
|
|
97
|
+
add(q)
|
|
98
|
+
return names
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def literal_matchers(matcher):
|
|
102
|
+
"""Literal tool names a matcher string names. A regex part names none."""
|
|
103
|
+
if not matcher:
|
|
104
|
+
return []
|
|
105
|
+
return [p for p in matcher.split("|") if LITERAL.match(p)]
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
sources = {}
|
|
109
|
+
pairs = 0
|
|
110
|
+
skipped_hooks = set()
|
|
111
|
+
failures = []
|
|
112
|
+
|
|
113
|
+
for event, entries in settings.get("hooks", {}).items():
|
|
114
|
+
for entry in entries:
|
|
115
|
+
tools = literal_matchers(entry.get("matcher", ""))
|
|
116
|
+
if not tools:
|
|
117
|
+
continue
|
|
118
|
+
for hook in entry.get("hooks", []):
|
|
119
|
+
cmd = hook.get("command", "")
|
|
120
|
+
m = re.search(r"\$PLATFORM_ROOT/(\S+)", cmd)
|
|
121
|
+
if not m:
|
|
122
|
+
continue
|
|
123
|
+
rel = m.group(1)
|
|
124
|
+
path = os.path.join(platform_root, rel)
|
|
125
|
+
name = os.path.basename(rel)
|
|
126
|
+
# Keyed on the path, not the basename: two plugins may each ship a
|
|
127
|
+
# hook of the same name, and reusing one's parsed set for the other
|
|
128
|
+
# would report on a file that was never read.
|
|
129
|
+
if rel not in sources:
|
|
130
|
+
try:
|
|
131
|
+
sources[rel] = literal_tool_names(
|
|
132
|
+
strip_comments(open(path, encoding="utf-8").read())
|
|
133
|
+
)
|
|
134
|
+
except OSError:
|
|
135
|
+
failures.append(f"{name}: registered in {event} but not readable at {path}")
|
|
136
|
+
sources[rel] = set()
|
|
137
|
+
gated = sources[rel]
|
|
138
|
+
if not gated:
|
|
139
|
+
skipped_hooks.add(rel)
|
|
140
|
+
continue
|
|
141
|
+
for tool in tools:
|
|
142
|
+
pairs += 1
|
|
143
|
+
if tool not in gated:
|
|
144
|
+
failures.append(
|
|
145
|
+
f"{name}: registered on {event} matcher '{tool}' but its dispatch "
|
|
146
|
+
f"names only {sorted(gated)} — every '{tool}' reaches the catch-all unread"
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
for f in failures:
|
|
150
|
+
print(f"FAIL: {f}", file=sys.stderr)
|
|
151
|
+
|
|
152
|
+
print(f"[hook-matcher-dispatch] pairs={pairs} literal-set-hooks={len(sources) - len(skipped_hooks)} "
|
|
153
|
+
f"skipped={len(skipped_hooks)} failures={len(failures)}")
|
|
154
|
+
|
|
155
|
+
if pairs == 0:
|
|
156
|
+
print("FAIL: no (hook, matcher) pair was compared — the parser reads nothing", file=sys.stderr)
|
|
157
|
+
sys.exit(1)
|
|
158
|
+
compared = {os.path.basename(r) for r in sources if r not in skipped_hooks}
|
|
159
|
+
if PINNED not in compared:
|
|
160
|
+
print(f"FAIL: {PINNED} was not compared against any matcher — coverage lost", file=sys.stderr)
|
|
161
|
+
sys.exit(1)
|
|
162
|
+
sys.exit(1 if failures else 0)
|
|
163
|
+
PY
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical-tool-names.generated.d.ts","sourceRoot":"","sources":["../src/canonical-tool-names.generated.ts"],"names":[],"mappings":"AAQA,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EA2B7C,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"canonical-tool-names.generated.d.ts","sourceRoot":"","sources":["../src/canonical-tool-names.generated.ts"],"names":[],"mappings":"AAQA,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EA2B7C,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAkXtD,CAAA"}
|
package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js
CHANGED
|
@@ -353,11 +353,16 @@ export const CANONICAL_MAXY_TOOL_NAMES = [
|
|
|
353
353
|
"mcp__plugin_storage-broker_storage-broker__storage-r2-object-get",
|
|
354
354
|
"mcp__plugin_storage-broker_storage-broker__storage-r2-object-list",
|
|
355
355
|
"mcp__plugin_storage-broker_storage-broker__storage-r2-object-put",
|
|
356
|
-
"mcp__plugin_telegram_telegram__message",
|
|
357
356
|
"mcp__plugin_telegram_telegram__message-history",
|
|
358
357
|
"mcp__plugin_telegram_telegram__telegram-api",
|
|
359
358
|
"mcp__plugin_telegram_telegram__telegram-api-census",
|
|
359
|
+
"mcp__plugin_telegram_telegram__telegram-ask",
|
|
360
|
+
"mcp__plugin_telegram_telegram__telegram-card",
|
|
361
|
+
"mcp__plugin_telegram_telegram__telegram-invoice",
|
|
362
|
+
"mcp__plugin_telegram_telegram__telegram-media-fetch",
|
|
363
|
+
"mcp__plugin_telegram_telegram__telegram-media-send",
|
|
360
364
|
"mcp__plugin_telegram_telegram__telegram-menu-button",
|
|
365
|
+
"mcp__plugin_telegram_telegram__telegram-thread",
|
|
361
366
|
"mcp__plugin_telegram_telegram__telegram-webhook-register",
|
|
362
367
|
"mcp__plugin_url-get_url-get__url-get",
|
|
363
368
|
"mcp__plugin_voice-mirror_voice-mirror__voice-distil-profile",
|
package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical-tool-names.generated.js","sourceRoot":"","sources":["../src/canonical-tool-names.generated.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,kEAAkE;AAClE,yDAAyD;AACzD,kFAAkF;AAClF,EAAE;AACF,yEAAyE;AACzE,6DAA6D;AAE7D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAsB;IACjD,OAAO;IACP,KAAK;IACL,SAAS;IACT,WAAW;IACX,UAAU;IACV,UAAU;IACV,OAAO;IACP,YAAY;IACZ,QAAQ;IACR,OAAO;IACP,cAAc;IACd,WAAW;IACX,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,SAAS;IACT,cAAc;IACd,UAAU;IACV,MAAM;IACN,WAAW;CACZ,CAAA;AAED,gEAAgE;AAChE,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,yCAAyC;IACzC,yCAAyC;IACzC,kDAAkD;IAClD,sDAAsD;IACtD,yCAAyC;IACzC,yCAAyC;IACzC,uCAAuC;IACvC,wCAAwC;IACxC,iDAAiD;IACjD,yCAAyC;IACzC,iDAAiD;IACjD,yCAAyC;IACzC,sCAAsC;IACtC,yCAAyC;IACzC,wCAAwC;IACxC,oCAAoC;IACpC,qCAAqC;IACrC,yCAAyC;IACzC,qCAAqC;IACrC,uCAAuC;IACvC,2CAA2C;IAC3C,4CAA4C;IAC5C,uCAAuC;IACvC,uCAAuC;IACvC,sCAAsC;IACtC,qCAAqC;IACrC,uCAAuC;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AC7D,2DAA2D;IAC3D,2DAA2D;IAC3D,+DAA+D;IAC/D,+DAA+D;IAC/D,+DAA+D;IAC/D,0DAA0D;IAC1D,6DAA6D;IAC7D,6DAA6D;IAC7D,8DAA8D;IAC9D,8DAA8D;IAC9D,8DAA8D;IAC9D,qDAAqD;IACrD,sDAAsD;IACtD,2DAA2D;IAC3D,iDAAiD;IACjD,sDAAsD;IACtD,uDAAuD;IACvD,yDAAyD;IACzD,oDAAoD;IACpD,iEAAiE;IACjE,mDAAmD;IACnD,wDAAwD;IACxD,iDAAiD;IACjD,wDAAwD;IACxD,kDAAkD;IAClD,kDAAkD;IAClD,oDAAoD;IACpD,oDAAoD;IACpD,iDAAiD;IACjD,8DAA8D;IAC9D,4DAA4D;IAC5D,6DAA6D;IAC7D,gEAAgE;IAChE,iEAAiE;IACjE,iEAAiE;IACjE,qEAAqE;IACrE,mEAAmE;IACnE,qEAAqE;IACrE,kEAAkE;IAClE,mEAAmE;IACnE,kEAAkE;IAClE,
|
|
1
|
+
{"version":3,"file":"canonical-tool-names.generated.js","sourceRoot":"","sources":["../src/canonical-tool-names.generated.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,kEAAkE;AAClE,yDAAyD;AACzD,kFAAkF;AAClF,EAAE;AACF,yEAAyE;AACzE,6DAA6D;AAE7D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAsB;IACjD,OAAO;IACP,KAAK;IACL,SAAS;IACT,WAAW;IACX,UAAU;IACV,UAAU;IACV,OAAO;IACP,YAAY;IACZ,QAAQ;IACR,OAAO;IACP,cAAc;IACd,WAAW;IACX,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,SAAS;IACT,cAAc;IACd,UAAU;IACV,MAAM;IACN,WAAW;CACZ,CAAA;AAED,gEAAgE;AAChE,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,yC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IACpE,0DAA0D;IAC1D,kDAAkD;IAClD,gDAAgD;IAChD,kEAAkE;IAClE,uDAAuD;IACvD,oDAAoD;IACpD,oDAAoD;IACpD,qDAAqD;IACrD,oDAAoD;IACpD,kDAAkD;IAClD,+CAA+C;IAC/C,oDAAoD;IACpD,gDAAgD;IAChD,yCAAyC;IACzC,uCAAuC;IACvC,oCAAoC;IACpC,qCAAqC;IACrC,uCAAuC;IACvC,qCAAqC;IACrC,yCAAyC;IACzC,qCAAqC;IACrC,sCAAsC;IACtC,oCAAoC;IACpC,iCAAiC;IACjC,kCAAkC;IAClC,mCAAmC;IACnC,oCAAoC;IACpC,oCAAoC;IACpC,kDAAkD;IAClD,kDAAkD;IAClD,mDAAmD;IACnD,+CAA+C;IAC/C,gDAAgD;IAChD,gDAAgD;IAChD,kDAAkD;IAClD,oDAAoD;CACrD,CAAA"}
|
|
@@ -3,7 +3,7 @@ name: personal-assistant
|
|
|
3
3
|
description: "Platform settings, messaging channels (Telegram, WhatsApp, email, Outlook), and browser automation, plus mechanical calendar subtasks you hand it with the facts already resolved (export these event IDs to .ics, parse this inbound .ics). Delegate when the work is configuring the platform, sending or reading messages, or driving a browser. Do not delegate calendar reasoning or an availability-affecting booking: only your admin session sees the connector-backed real calendar, so the specialist would answer from the internal scheduling store alone and miss it. You own what is on the calendar and what booking against it does."
|
|
4
4
|
summary: "Handles the operational tasks you'd give a personal assistant: scheduling meetings, managing your platform settings, connecting messaging channels, and completing browser-based tasks on your behalf."
|
|
5
5
|
model: claude-sonnet-5
|
|
6
|
-
tools: Skill, mcp__plugin_admin_admin__system-status, mcp__plugin_admin_admin__brand-settings, mcp__plugin_admin_admin__account-manage, mcp__plugin_admin_admin__account-update, mcp__plugin_admin_admin__logs-read, mcp__plugin_admin_admin__plugin-read, mcp__plugin_admin_admin__wifi, mcp__plugin_contacts_contacts__contact-create, mcp__plugin_contacts_contacts__contact-lookup, mcp__plugin_contacts_contacts__contact-update, mcp__plugin_contacts_contacts__contact-delete, mcp__plugin_contacts_contacts__contact-list, mcp__plugin_contacts_contacts__contact-export, mcp__plugin_contacts_contacts__contact-erase, mcp__plugin_contacts_contacts__group-create, mcp__plugin_contacts_contacts__group-manage,
|
|
6
|
+
tools: Skill, mcp__plugin_admin_admin__system-status, mcp__plugin_admin_admin__brand-settings, mcp__plugin_admin_admin__account-manage, mcp__plugin_admin_admin__account-update, mcp__plugin_admin_admin__logs-read, mcp__plugin_admin_admin__plugin-read, mcp__plugin_admin_admin__wifi, mcp__plugin_contacts_contacts__contact-create, mcp__plugin_contacts_contacts__contact-lookup, mcp__plugin_contacts_contacts__contact-update, mcp__plugin_contacts_contacts__contact-delete, mcp__plugin_contacts_contacts__contact-list, mcp__plugin_contacts_contacts__contact-export, mcp__plugin_contacts_contacts__contact-erase, mcp__plugin_contacts_contacts__group-create, mcp__plugin_contacts_contacts__group-manage, mcp__plugin_telegram_telegram__telegram-card, mcp__plugin_telegram_telegram__message-history, mcp__plugin_telegram_telegram__telegram-webhook-register, mcp__plugin_whatsapp_whatsapp__whatsapp-login-start, mcp__plugin_whatsapp_whatsapp__whatsapp-login-wait, mcp__plugin_whatsapp_whatsapp__whatsapp-status, mcp__plugin_whatsapp_whatsapp__whatsapp-disconnect, mcp__plugin_whatsapp_whatsapp__whatsapp-config, mcp__plugin_whatsapp_whatsapp__whatsapp-activity, mcp__plugin_whatsapp_whatsapp__whatsapp-conversations, mcp__plugin_whatsapp_whatsapp__whatsapp-messages, mcp__plugin_whatsapp_whatsapp__whatsapp-conversation-graph-state, mcp__plugin_whatsapp_whatsapp__whatsapp-group-info, mcp__plugin_whatsapp_whatsapp__whatsapp-send-admin, mcp__plugin_whatsapp_whatsapp__whatsapp-reply, mcp__plugin_email_email__email-provider-info, mcp__plugin_email_email__email-setup, mcp__plugin_email_email__email-signature-set, mcp__plugin_email_email__email-sending-identity-set, mcp__plugin_email_email__email-read, mcp__plugin_email_email__email-fetch-body, mcp__plugin_email_email__email-fetch-attachment, mcp__plugin_email_email__email-send, mcp__plugin_email_email__email-draft, mcp__plugin_email_email__email-draft-edit, mcp__plugin_email_email__email-draft-send, mcp__plugin_email_email__email-draft-list, mcp__plugin_email_email__email-reply, mcp__plugin_email_email__email-search, mcp__plugin_email_email__email-delete, mcp__plugin_email_email__email-graph-query, mcp__plugin_email_email__email-otp-extract, mcp__plugin_email_email__email-status, mcp__plugin_email_email__email-fetch, mcp__plugin_email_email__email-ingest, mcp__plugin_outlook_outlook__outlook-account-register, mcp__plugin_outlook_outlook__outlook-account-register-poll, mcp__plugin_outlook_outlook__outlook-mail-list, mcp__plugin_outlook_outlook__outlook-mail-search, mcp__plugin_outlook_outlook__outlook-mail-fetch-body, mcp__plugin_outlook_outlook__outlook-mail-attachment, mcp__plugin_outlook_outlook__outlook-mail-reply, mcp__plugin_outlook_outlook__outlook-mail-delete, mcp__plugin_outlook_outlook__outlook-mail-ingest, mcp__plugin_outlook_outlook__outlook-mail-otp-extract, mcp__plugin_outlook_outlook__outlook-mail-send, mcp__plugin_outlook_outlook__outlook-draft, mcp__plugin_outlook_outlook__outlook-draft-edit, mcp__plugin_outlook_outlook__outlook-draft-send, mcp__plugin_outlook_outlook__outlook-calendar-list, mcp__plugin_outlook_outlook__outlook-calendar-event, mcp__plugin_outlook_outlook__outlook-calendar-create, mcp__plugin_outlook_outlook__outlook-calendar-update, mcp__plugin_outlook_outlook__outlook-calendar-cancel, mcp__plugin_outlook_outlook__outlook-calendar-respond, mcp__plugin_outlook_outlook__outlook-calendar-freebusy, mcp__plugin_outlook_outlook__outlook-contacts-list, mcp__plugin_outlook_outlook__outlook-mailbox-info, mcp__plugin_outlook_outlook__outlook-mailbox-list, mcp__plugin_outlook_outlook__outlook-shared-mailbox-add, mcp__plugin_outlook_outlook__outlook-shared-mailbox-remove, mcp__plugin_google_google__google-account-register, mcp__plugin_google_google__google-account-register-poll, mcp__plugin_google_google__google-account-register-submit, mcp__plugin_google_google__google-calendar-list, mcp__plugin_google_google__google-calendar-event, mcp__plugin_google_google__google-calendar-create, mcp__plugin_google_google__google-calendar-update, mcp__plugin_google_google__google-calendar-cancel, mcp__plugin_google_google__google-calendar-respond, mcp__plugin_google_google__google-calendar-freebusy, mcp__plugin_google_google__google-account-info, mcp__plugin_google_google__google-account-list, mcp__plugin_scheduling_scheduling__schedule-event, mcp__plugin_scheduling_scheduling__schedule-list, mcp__plugin_scheduling_scheduling__schedule-get, mcp__plugin_scheduling_scheduling__schedule-runs, mcp__plugin_scheduling_scheduling__schedule-update, mcp__plugin_scheduling_scheduling__schedule-cancel, mcp__plugin_scheduling_scheduling__schedule-export-ics, mcp__plugin_scheduling_scheduling__schedule-import-ics, mcp__plugin_scheduling_scheduling__time-resolve, mcp__plugin_memory_memory__memory-search, mcp__plugin_memory_memory__profile-update, mcp__plugin_url-get_url-get__url-get, mcp__plugin_browser_browser__browser-render, mcp__plugin_browser_browser__browser-navigate, mcp__plugin_browser_browser__browser-snapshot, mcp__plugin_browser_browser__browser-click, mcp__plugin_browser_browser__browser-fill, mcp__plugin_browser_browser__browser-fill-form, mcp__plugin_browser_browser__browser-type, mcp__plugin_browser_browser__browser-press-key, mcp__plugin_browser_browser__browser-hover, mcp__plugin_browser_browser__browser-select-option, mcp__plugin_browser_browser__browser-wait-for, mcp__plugin_browser_browser__browser-handle-dialog, mcp__plugin_browser_browser__browser-evaluate, mcp__plugin_browser_browser__browser-console-messages, mcp__plugin_browser_browser__browser-tabs, mcp__plugin_browser_browser__browser-pdf-save, mcp__plugin_browser_browser__browser-screenshot, mcp__plugin_browser_browser__browser-resize
|
|
7
7
|
pattern_deliverable: false
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Activity — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/activity-
|
|
8
|
+
<script type="module" crossorigin src="/assets/activity-kQ3w70LJ.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-BycB0eMI.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/useMediaQuery-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/triangle-alert-
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/assets/jsx-runtime-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-Cjug_Cyb.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/useMediaQuery-DUPJPHQt.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-BMslfZxN.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/triangle-alert-B5WAyAkC.js">
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/assets/jsx-runtime-D43jgaWP.css">
|
|
15
15
|
<link rel="stylesheet" crossorigin href="/assets/useMediaQuery-DXAuc8G-.css">
|
|
16
16
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
17
17
|
</head>
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Agents — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/agents-
|
|
8
|
+
<script type="module" crossorigin src="/assets/agents-Cn_bZgnD.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-BycB0eMI.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/useMediaQuery-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/AdminShell-
|
|
13
|
-
<link rel="stylesheet" crossorigin href="/assets/jsx-runtime-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-Cjug_Cyb.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/useMediaQuery-DUPJPHQt.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/AdminShell-BMslfZxN.js">
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/jsx-runtime-D43jgaWP.css">
|
|
14
14
|
<link rel="stylesheet" crossorigin href="/assets/useMediaQuery-DXAuc8G-.css">
|
|
15
15
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
16
16
|
</head>
|
package/payload/server/public/assets/{AdminLoginScreens-Bus-Y-rG.js → AdminLoginScreens-Dxv5t1YY.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-BycB0eMI.js";import{i as t,t as n}from"./jsx-runtime-CjJ246F7.js";import{O as r,Q as i,et as a,rt as o}from"./useMediaQuery-CVZYjRf6.js";import{A as s}from"./useVoiceRecorder-D5b4r4z0.js";import{A as c,O as l,k as u,p as d}from"./AdminShell-Bsm7q3CW.js";var f=e(t(),1);function p(e=`admin`){let[t,n]=(0,f.useState)(`loading`),[r,i]=(0,f.useState)(``),[a,l]=(0,f.useState)(``),[u,d]=(0,f.useState)(``),[p,m]=(0,f.useState)(!1),[h,g]=(0,f.useState)(!1),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(!1),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(null),[D,O]=(0,f.useState)(void 0),[k,A]=(0,f.useState)(null),[j,M]=(0,f.useState)(void 0),[N,P]=(0,f.useState)(null),[F,I]=(0,f.useState)(null),[L,R]=(0,f.useState)(void 0),z=(0,f.useRef)(void 0),[B,V]=(0,f.useState)(!1),[H,U]=(0,f.useState)(!0);(0,f.useEffect)(()=>{typeof window>`u`||fetch(`/api/remote-auth/status`).then(e=>e.ok?e.json():null).then(e=>{e?.configured&&V(!0)}).catch(()=>{})},[]);let W=(0,f.useRef)(null),G=(0,f.useRef)(null);(0,f.useEffect)(()=>{async function e(){let e=null;try{e=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!e)return!1;try{let t=await fetch(`/api/admin/session?session_key=${encodeURIComponent(e)}`);if(t.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}return!1}if(!t.ok)return!1;let r=await t.json();w(r.session_key),I(r.sessionId??null),O(r.businessName),A(r.role??null),M(r.userName===void 0?null:r.userName),P(r.avatar??null);let i=s(r.thinkingView);return z.current=i,R(i),n(`chat`),!0}catch(e){return console.error(`[admin] session restore failed:`,e),!1}}async function t(r=2){try{let i=await fetch(`/api/health`);if(!i.ok){if(r>0)return await new Promise(e=>setTimeout(e,1500)),t(r-1);console.error(`[admin] health check returned ${i.status} after retries`),n(`set-pin`);return}let a=await i.json();if(!a.pin_configured){n(`set-pin`);return}U(!!a.claude_authenticated);let o=!1;try{o=new URLSearchParams(window.location.search).get(`connect`)===`claude`}catch{}if(o){try{let e=new URL(window.location.href);e.searchParams.delete(`connect`),window.history.replaceState(null,``,e.pathname+e.search+e.hash)}catch{}if(!a.claude_authenticated){n(`connect-claude`);return}}if(await e())return;n(`enter-pin`)}catch(e){if(r>0)return await new Promise(e=>setTimeout(e,1500)),t(r-1);console.error(`[admin] health check failed:`,e),n(`set-pin`)}}t()},[]),(0,f.useEffect)(()=>{t===`chat`&&C&&fetch(`/api/admin/claude-info?session_key=${encodeURIComponent(C)}`).then(e=>{if(e.ok)return e.json()}).then(e=>{e&&E(e)}).catch(()=>{})},[t,C]);let K=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(t!==`chat`)return;let e=setInterval(async()=>{try{let e=await fetch(`/api/health`);if(e.ok){let t=await e.json();U(t.auth_status!==`dead`&&t.auth_status!==`missing`)}}catch{}if(C)try{let e=await fetch(`/api/admin/session?session_key=${encodeURIComponent(C)}`);if(e.status!==401)return;let t=(await e.clone().json().catch(()=>null))?.code??`unknown-401`;if(t===`remote-auth-required`){o(`heartbeat`,`/api/admin/session`);return}console.warn(`[admin-auth] outcome=heartbeat-detected-expiry code=${t}`),K.current?.()}catch{}},300*1e3);return()=>clearInterval(e)},[t,C]),(0,f.useEffect)(()=>{t===`connect-claude`&&fetch(`/api/health`).then(e=>e.ok?e.json():null).then(e=>{e?.claude_authenticated&&(U(!0),n(`enter-pin`))}).catch(()=>{})},[t]);async function q(e,t){g(!0);try{let r=await fetch(`/api/admin/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pin:e,...t?{accountId:t}:{}})});if(!r.ok){let e=await r.json().catch(()=>({}));if(r.status===401&&e?.code===`remote-auth-required`){o(`enter-pin`,`/api/admin/session`);return}d(e.error||`Invalid PIN`);return}let a=await r.json();w(a.session_key),I(a.sessionId??null),O(a.businessName),A(a.role??null),M(a.userName===void 0?null:a.userName),P(a.avatar??null);let c=s(a.thinkingView);z.current=c,R(c);try{sessionStorage.setItem(`maxy-admin-session-key`,a.session_key)}catch{}i(``),n(`chat`)}catch(e){console.error(`[admin] connection error:`,e),d(`Could not connect.`)}finally{g(!1)}}let J=(0,f.useCallback)(async e=>{if(e.preventDefault(),h)return;d(``);let t=a.trim();if(!t){d(`Please enter your name.`);return}if(r.length<4){d(`PIN must be at least 4 characters.`);return}let s=r;g(!0);try{let e=await fetch(`/api/onboarding/set-pin`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pin:s,name:t})});if(!e.ok){let t=await e.json().catch(()=>({}));if(e.status===401&&t?.code===`remote-auth-required`){o(`set-pin`,`/api/onboarding/set-pin`);return}if(e.status===409){try{let e=await fetch(`/api/health`);if(e.ok){let r=await e.json();r.pin_configured&&r.claude_authenticated?n(`enter-pin`):r.pin_configured?n(`connect-claude`):d(t.error||`Failed to set PIN.`)}else n(`enter-pin`)}catch{n(`enter-pin`)}return}d(t.error||`Failed to set PIN.`);return}let r=await fetch(`/api/health`);if((r.ok?await r.json():null)?.claude_authenticated){await q(s);return}i(``),n(`connect-claude`)}catch(e){console.error(`[admin] connection error:`,e),d(`Could not connect.`)}finally{g(!1)}},[r,h,a]),Y=(0,f.useCallback)(async e=>{e.preventDefault(),d(``),await q(r)},[r]),X=(0,f.useCallback)(async()=>{S(!0);try{if(!await c())return console.warn(`[admin-ui] claude-disconnect not verified — credentials may persist; staying put`),!1;U(!1),w(null),A(null),M(void 0),P(null);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}return n(`connect-claude`),!0}finally{S(!1)}},[]),Z=(0,f.useCallback)(()=>{w(null),A(null),M(void 0),P(null);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}i(``),d(``),n(`enter-pin`)},[]);return(0,f.useEffect)(()=>{K.current=Z},[Z]),{appState:t,setAppState:n,pin:r,setPin:i,operatorName:a,setOperatorName:l,pinError:u,setPinError:d,showPin:p,setShowPin:m,pinLoading:h,authPolling:_,setAuthPolling:v,authLoading:y,setAuthLoading:b,disconnecting:x,cacheKey:C,setCacheKey:w,claudeInfo:T,setClaudeInfo:E,businessName:D,role:k,userName:j,userAvatar:N,sessionId:F,setSessionId:I,expandAll:L,setExpandAll:R,expandAllDefaultRef:z,remoteAuthEnabled:B,claudeConnected:H,pinInputRef:W,setPinFormRef:G,handleSetPin:J,handleLogin:Y,handleDisconnect:X,handleLogout:Z}}var m=n();function h({inputRef:e,value:t,onChange:n,onComplete:r,showPin:i,autoFocus:a}){let o=(0,f.useRef)([]);function s(e,r){r.key===`Backspace`?(r.preventDefault(),t[e]?n(t.slice(0,e)+t.slice(e+1)):e>0&&(n(t.slice(0,e-1)+t.slice(e)),o.current[e-1]?.focus())):r.key===`ArrowLeft`&&e>0?o.current[e-1]?.focus():r.key===`ArrowRight`&&e<5?o.current[e+1]?.focus():r.key===`Enter`&&(r.preventDefault(),r.currentTarget.form?.requestSubmit())}function c(e,i){let a=i.nativeEvent.data;if(!a||!/^\d$/.test(a))return;let s=t.split(``);for(s[e]=a;s.length<e;)s.push(``);let c=s.join(``).replace(/\D/g,``).slice(0,6);n(c),c.length===6?r?.(c):e<5&&o.current[e+1]?.focus()}function l(e){e.preventDefault();let t=e.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,6);t&&(n(t),t.length===6?r?.(t):o.current[t.length]?.focus())}return(0,m.jsx)(`div`,{className:`pin-field`,children:Array.from({length:6}).map((n,r)=>(0,m.jsx)(`input`,{ref:t=>{o.current[r]=t,r===0&&e&&(e.current=t)},type:`text`,inputMode:`numeric`,className:`pin-box${t[r]?` pin-box-filled`:``}`,value:t[r]?i?t[r]:`•`:``,onKeyDown:e=>s(r,e),onInput:e=>c(r,e),onPaste:l,onFocus:e=>e.target.select(),autoFocus:a&&r===0,autoComplete:`off`,maxLength:1,"aria-label":`PIN digit ${r+1}`},r))})}function g(e){let{pin:t,setPin:n,showPin:r,setShowPin:o,pinLoading:s,pinError:c,pinInputRef:d,setPinFormRef:f,onSubmit:p,operatorName:g,setOperatorName:_}=e;return(0,m.jsx)(`div`,{className:`connect-page`,children:(0,m.jsxs)(`div`,{className:`connect-content`,children:[(0,m.jsx)(`img`,{src:a,alt:i.productName,className:`connect-logo connect-logo--maxy`}),!i.logoContainsName&&(0,m.jsxs)(`h1`,{className:`connect-title`,children:[`Welcome to `,i.productName]}),(0,m.jsxs)(`p`,{className:`connect-subtitle`,children:[`Tell `,i.productName,` who you are, then choose a PIN.`]}),(0,m.jsxs)(`form`,{ref:f,onSubmit:p,className:`connect-pin-form`,children:[(0,m.jsxs)(`div`,{className:`pin-input-row`,children:[(0,m.jsx)(`input`,{type:`text`,className:`connect-name-input`,placeholder:`Your full name`,value:g,onChange:e=>_(e.target.value),autoComplete:`name`,autoFocus:!0,required:!0,"aria-label":`Your full name`}),(0,m.jsx)(`div`,{style:{width:38,flexShrink:0},"aria-hidden":`true`})]}),(0,m.jsxs)(`div`,{className:`pin-input-row`,children:[(0,m.jsx)(h,{inputRef:d,value:t,onChange:n,onComplete:()=>{},showPin:r}),(0,m.jsx)(l,{variant:`send`,type:`submit`,disabled:!t||!g.trim(),loading:s,"aria-label":`Set PIN`,children:(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,m.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,m.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,m.jsx)(u,{checked:r,onChange:()=>o(e=>!e),label:`Show PIN`})]}),c&&(0,m.jsx)(`p`,{className:`admin-pin-error`,children:c})]})})}function _(e){let{pin:t,setPin:n,showPin:r,setShowPin:o,pinLoading:s,pinError:c,pinInputRef:d,onSubmit:f,remoteAuthEnabled:p,onSignOutRemote:g}=e;return(0,m.jsxs)(`div`,{className:`connect-page`,children:[p&&g&&(0,m.jsx)(`button`,{type:`button`,className:`connect-signout`,onClick:g,children:`Sign out`}),(0,m.jsxs)(`div`,{className:`connect-content`,children:[(0,m.jsx)(`img`,{src:a,alt:i.productName,className:`connect-logo connect-logo--maxy`}),!i.logoContainsName&&(0,m.jsx)(`h1`,{className:`connect-title`,children:i.productName}),(0,m.jsxs)(`form`,{onSubmit:f,className:`connect-pin-form`,children:[(0,m.jsxs)(`div`,{className:`pin-input-row`,children:[(0,m.jsx)(h,{inputRef:d,value:t,onChange:n,onComplete:()=>{},showPin:r,autoFocus:!0}),(0,m.jsx)(l,{variant:`send`,type:`submit`,disabled:!t,loading:s,children:(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,m.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,m.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,m.jsx)(`div`,{className:`pin-options`,children:(0,m.jsx)(u,{checked:r,onChange:()=>o(e=>!e),label:`Show PIN`})})]}),c&&(0,m.jsx)(`p`,{className:`admin-pin-error`,children:c})]})]})}function v(e){let{authPolling:t,setAuthPolling:n,authLoading:r,setAuthLoading:o,pinError:s,setPinError:c,setAppState:u}=e,[p,h]=(0,f.useState)(!1),[g,_]=(0,f.useState)(!1),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(``),[S,C]=(0,f.useState)(``),[w,T]=(0,f.useState)(null),[E,D]=(0,f.useState)(null),[O,k]=(0,f.useState)(!1),A=(0,f.useRef)(0);(0,f.useEffect)(()=>{try{D(sessionStorage.getItem(`maxy-admin-session-key`))}catch{}k(!0)},[]);async function j(){C(``);try{let e=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`paste-code`,code:b})})).json();e.accepted?(C(`Code submitted. Finishing sign-in…`),x(``)):C(e.error||`Could not submit code.`)}catch(e){console.error(`[admin] paste-code error:`,e),C(`Could not submit code.`)}}async function M(){_(!0),c(``);try{let e=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`launch-browser`})})).json();e.launched?h(!0):e.error&&c(e.error)}catch(e){console.error(`[admin] browser launch error:`,e),c(`Could not launch browser.`)}_(!1)}async function N(){let e=++A.current;o(!0),c(``);try{let t=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`})).json();if(t.started){n(!0),h(!0),o(!1),y(t.transport||``);for(let t=0;t<120;t++){if(await new Promise(e=>setTimeout(e,2e3)),A.current!==e)return;let t=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`wait`})})).json();if(typeof t.authTargetId==`string`&&T(t.authTargetId),t.authenticated){await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`stop`})}),u(`enter-pin`);return}}c(`Timed out waiting for sign-in. Try again.`),n(!1)}else t.error&&c(t.error)}catch(e){console.error(`[admin] auth flow error:`,e),c(`Could not start auth flow.`)}o(!1)}async function P(){A.current++,await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`stop`})}),n(!1),c(``)}return t||p?(0,m.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100dvh`,overflow:`auto`},children:[(0,m.jsxs)(`header`,{className:`chat-header`,style:{paddingBottom:`12px`,flexShrink:0,position:`relative`,maxWidth:`680px`,width:`100%`,margin:`0 auto`,padding:`24px 20px 12px`},children:[t?(0,m.jsx)(`button`,{onClick:P,style:{position:`absolute`,top:`12px`,right:`12px`,background:`none`,border:`none`,color:`#999`,fontSize:`13px`,cursor:`pointer`,padding:`4px 8px`},"aria-label":`Cancel`,children:`✕`}):(0,m.jsx)(`button`,{onClick:()=>h(!1),style:{position:`absolute`,top:`12px`,right:`12px`,background:`none`,border:`none`,color:`#999`,fontSize:`13px`,cursor:`pointer`,padding:`4px 8px`},"aria-label":`Close browser`,children:`✕`}),(0,m.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`chat-logo`}),(0,m.jsx)(`h1`,{className:`chat-tagline`,children:`Connect Claude`}),(0,m.jsx)(`p`,{className:`chat-intro`,children:t?`Sign in and authorize in the browser below.`:`Open your email or prepare your accounts, then sign in.`}),!t&&(0,m.jsx)(`div`,{style:{marginTop:`12px`},children:(0,m.jsx)(l,{variant:`primary`,onClick:N,disabled:r,children:r?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`spin`,style:{display:`inline-block`},children:`✱`}),` Connecting…`]}):`Sign in to Claude`})}),t&&v===`native`&&(0,m.jsxs)(`div`,{style:{marginTop:`14px`,maxWidth:`420px`,margin:`14px auto 0`,display:`flex`,flexDirection:`column`,gap:`8px`},children:[(0,m.jsx)(`label`,{style:{fontSize:`12px`,color:`#999`,lineHeight:1.4},children:`If the browser didn't finish sign-in, paste the code or full redirect URL from Claude's page:`}),(0,m.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,m.jsx)(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:`Paste code or redirect URL`,style:{flex:1,padding:`8px 10px`,fontSize:`13px`,border:`1px solid #ccc`,borderRadius:`6px`}}),(0,m.jsx)(l,{variant:`primary`,onClick:j,disabled:!b.trim(),children:`Submit`})]}),S&&(0,m.jsx)(`p`,{style:{fontSize:`12px`,color:`#999`,margin:0},children:S})]})]}),(0,m.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0,gap:`10px`,padding:`0 0 16px`},children:O&&(0,m.jsx)(d,{preferTargetId:w,cacheKey:E,chrome:!1})}),s&&(0,m.jsx)(`p`,{className:`admin-pin-error`,style:{textAlign:`center`,padding:`0 20px 16px`},children:s})]}):(0,m.jsx)(`div`,{className:`connect-page`,children:(0,m.jsxs)(`div`,{className:`connect-content`,children:[(0,m.jsxs)(`div`,{className:`connect-logos`,children:[(0,m.jsx)(`div`,{className:`connect-logo-wrap`,children:(0,m.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`connect-logo`})}),(0,m.jsx)(`svg`,{className:`connect-arrow`,viewBox:`0 0 48 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,m.jsx)(`path`,{d:`M0 12h44m0 0l-8-8m8 8l-8 8`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,m.jsxs)(`div`,{className:`connect-logo-wrap`,children:[(0,m.jsx)(`img`,{src:a,alt:i.productName,className:`connect-logo connect-logo--maxy`}),!i.logoContainsName&&(0,m.jsx)(`span`,{className:`connect-logo-label`,children:i.productName})]})]}),(0,m.jsxs)(`h1`,{className:`connect-title`,children:[`Connect Claude to power `,i.productName]}),(0,m.jsx)(`p`,{className:`connect-subtitle`,children:`Sign in with your Anthropic account to get started.`}),(0,m.jsx)(l,{variant:`primary`,onClick:N,disabled:r,children:r?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`spin`,style:{display:`inline-block`},children:`✱`}),` Connecting…`]}):`Sign in to Claude`}),(0,m.jsx)(`p`,{style:{marginTop:`6px`,fontSize:`11px`,color:`#999`,maxWidth:`300px`,textAlign:`center`,lineHeight:`1.4`},children:`First time? You may need to sign into your email and Anthropic account in the browser before connecting.`}),(0,m.jsx)(`button`,{onClick:M,disabled:g,style:{marginTop:`12px`,background:`none`,border:`none`,color:`var(--color-primary, #666)`,fontSize:`13px`,cursor:`pointer`,textDecoration:`underline`,textUnderlineOffset:`3px`},children:g?`Launching…`:`Open browser first`}),s&&(0,m.jsx)(`p`,{className:`admin-pin-error`,children:s})]})})}function y({auth:e}){return e.appState===`loading`?(0,m.jsx)(r,{surface:`gate`}):e.appState===`set-pin`?(0,m.jsx)(g,{pin:e.pin,setPin:e.setPin,showPin:e.showPin,setShowPin:e.setShowPin,pinLoading:e.pinLoading,pinError:e.pinError,pinInputRef:e.pinInputRef,setPinFormRef:e.setPinFormRef,onSubmit:e.handleSetPin,operatorName:e.operatorName,setOperatorName:e.setOperatorName}):e.appState===`connect-claude`?(0,m.jsx)(v,{authPolling:e.authPolling,setAuthPolling:e.setAuthPolling,authLoading:e.authLoading,setAuthLoading:e.setAuthLoading,pinError:e.pinError,setPinError:e.setPinError,setAppState:e.setAppState}):e.appState===`enter-pin`?(0,m.jsx)(_,{pin:e.pin,setPin:e.setPin,showPin:e.showPin,setShowPin:e.setShowPin,pinLoading:e.pinLoading,pinError:e.pinError,pinInputRef:e.pinInputRef,onSubmit:e.handleLogin,remoteAuthEnabled:e.remoteAuthEnabled,onSignOutRemote:()=>{window.location.href=`/__remote-auth/logout`}}):null}export{p as n,y as t};
|
|
1
|
+
import{o as e}from"./chunk-BycB0eMI.js";import{i as t,t as n}from"./jsx-runtime-Cjug_Cyb.js";import{O as r,Q as i,et as a,rt as o}from"./useMediaQuery-DUPJPHQt.js";import{A as s}from"./useVoiceRecorder-BEgr0nHN.js";import{A as c,O as l,k as u,p as d}from"./AdminShell-BMslfZxN.js";var f=e(t(),1);function p(e=`admin`){let[t,n]=(0,f.useState)(`loading`),[r,i]=(0,f.useState)(``),[a,l]=(0,f.useState)(``),[u,d]=(0,f.useState)(``),[p,m]=(0,f.useState)(!1),[h,g]=(0,f.useState)(!1),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(!1),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(null),[D,O]=(0,f.useState)(void 0),[k,A]=(0,f.useState)(null),[j,M]=(0,f.useState)(void 0),[N,P]=(0,f.useState)(null),[F,I]=(0,f.useState)(null),[L,R]=(0,f.useState)(void 0),z=(0,f.useRef)(void 0),[B,V]=(0,f.useState)(!1),[H,U]=(0,f.useState)(!0);(0,f.useEffect)(()=>{typeof window>`u`||fetch(`/api/remote-auth/status`).then(e=>e.ok?e.json():null).then(e=>{e?.configured&&V(!0)}).catch(()=>{})},[]);let W=(0,f.useRef)(null),G=(0,f.useRef)(null);(0,f.useEffect)(()=>{async function e(){let e=null;try{e=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!e)return!1;try{let t=await fetch(`/api/admin/session?session_key=${encodeURIComponent(e)}`);if(t.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}return!1}if(!t.ok)return!1;let r=await t.json();w(r.session_key),I(r.sessionId??null),O(r.businessName),A(r.role??null),M(r.userName===void 0?null:r.userName),P(r.avatar??null);let i=s(r.thinkingView);return z.current=i,R(i),n(`chat`),!0}catch(e){return console.error(`[admin] session restore failed:`,e),!1}}async function t(r=2){try{let i=await fetch(`/api/health`);if(!i.ok){if(r>0)return await new Promise(e=>setTimeout(e,1500)),t(r-1);console.error(`[admin] health check returned ${i.status} after retries`),n(`set-pin`);return}let a=await i.json();if(!a.pin_configured){n(`set-pin`);return}U(!!a.claude_authenticated);let o=!1;try{o=new URLSearchParams(window.location.search).get(`connect`)===`claude`}catch{}if(o){try{let e=new URL(window.location.href);e.searchParams.delete(`connect`),window.history.replaceState(null,``,e.pathname+e.search+e.hash)}catch{}if(!a.claude_authenticated){n(`connect-claude`);return}}if(await e())return;n(`enter-pin`)}catch(e){if(r>0)return await new Promise(e=>setTimeout(e,1500)),t(r-1);console.error(`[admin] health check failed:`,e),n(`set-pin`)}}t()},[]),(0,f.useEffect)(()=>{t===`chat`&&C&&fetch(`/api/admin/claude-info?session_key=${encodeURIComponent(C)}`).then(e=>{if(e.ok)return e.json()}).then(e=>{e&&E(e)}).catch(()=>{})},[t,C]);let K=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(t!==`chat`)return;let e=setInterval(async()=>{try{let e=await fetch(`/api/health`);if(e.ok){let t=await e.json();U(t.auth_status!==`dead`&&t.auth_status!==`missing`)}}catch{}if(C)try{let e=await fetch(`/api/admin/session?session_key=${encodeURIComponent(C)}`);if(e.status!==401)return;let t=(await e.clone().json().catch(()=>null))?.code??`unknown-401`;if(t===`remote-auth-required`){o(`heartbeat`,`/api/admin/session`);return}console.warn(`[admin-auth] outcome=heartbeat-detected-expiry code=${t}`),K.current?.()}catch{}},300*1e3);return()=>clearInterval(e)},[t,C]),(0,f.useEffect)(()=>{t===`connect-claude`&&fetch(`/api/health`).then(e=>e.ok?e.json():null).then(e=>{e?.claude_authenticated&&(U(!0),n(`enter-pin`))}).catch(()=>{})},[t]);async function q(e,t){g(!0);try{let r=await fetch(`/api/admin/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pin:e,...t?{accountId:t}:{}})});if(!r.ok){let e=await r.json().catch(()=>({}));if(r.status===401&&e?.code===`remote-auth-required`){o(`enter-pin`,`/api/admin/session`);return}d(e.error||`Invalid PIN`);return}let a=await r.json();w(a.session_key),I(a.sessionId??null),O(a.businessName),A(a.role??null),M(a.userName===void 0?null:a.userName),P(a.avatar??null);let c=s(a.thinkingView);z.current=c,R(c);try{sessionStorage.setItem(`maxy-admin-session-key`,a.session_key)}catch{}i(``),n(`chat`)}catch(e){console.error(`[admin] connection error:`,e),d(`Could not connect.`)}finally{g(!1)}}let J=(0,f.useCallback)(async e=>{if(e.preventDefault(),h)return;d(``);let t=a.trim();if(!t){d(`Please enter your name.`);return}if(r.length<4){d(`PIN must be at least 4 characters.`);return}let s=r;g(!0);try{let e=await fetch(`/api/onboarding/set-pin`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pin:s,name:t})});if(!e.ok){let t=await e.json().catch(()=>({}));if(e.status===401&&t?.code===`remote-auth-required`){o(`set-pin`,`/api/onboarding/set-pin`);return}if(e.status===409){try{let e=await fetch(`/api/health`);if(e.ok){let r=await e.json();r.pin_configured&&r.claude_authenticated?n(`enter-pin`):r.pin_configured?n(`connect-claude`):d(t.error||`Failed to set PIN.`)}else n(`enter-pin`)}catch{n(`enter-pin`)}return}d(t.error||`Failed to set PIN.`);return}let r=await fetch(`/api/health`);if((r.ok?await r.json():null)?.claude_authenticated){await q(s);return}i(``),n(`connect-claude`)}catch(e){console.error(`[admin] connection error:`,e),d(`Could not connect.`)}finally{g(!1)}},[r,h,a]),Y=(0,f.useCallback)(async e=>{e.preventDefault(),d(``),await q(r)},[r]),X=(0,f.useCallback)(async()=>{S(!0);try{if(!await c())return console.warn(`[admin-ui] claude-disconnect not verified — credentials may persist; staying put`),!1;U(!1),w(null),A(null),M(void 0),P(null);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}return n(`connect-claude`),!0}finally{S(!1)}},[]),Z=(0,f.useCallback)(()=>{w(null),A(null),M(void 0),P(null);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}i(``),d(``),n(`enter-pin`)},[]);return(0,f.useEffect)(()=>{K.current=Z},[Z]),{appState:t,setAppState:n,pin:r,setPin:i,operatorName:a,setOperatorName:l,pinError:u,setPinError:d,showPin:p,setShowPin:m,pinLoading:h,authPolling:_,setAuthPolling:v,authLoading:y,setAuthLoading:b,disconnecting:x,cacheKey:C,setCacheKey:w,claudeInfo:T,setClaudeInfo:E,businessName:D,role:k,userName:j,userAvatar:N,sessionId:F,setSessionId:I,expandAll:L,setExpandAll:R,expandAllDefaultRef:z,remoteAuthEnabled:B,claudeConnected:H,pinInputRef:W,setPinFormRef:G,handleSetPin:J,handleLogin:Y,handleDisconnect:X,handleLogout:Z}}var m=n();function h({inputRef:e,value:t,onChange:n,onComplete:r,showPin:i,autoFocus:a}){let o=(0,f.useRef)([]);function s(e,r){r.key===`Backspace`?(r.preventDefault(),t[e]?n(t.slice(0,e)+t.slice(e+1)):e>0&&(n(t.slice(0,e-1)+t.slice(e)),o.current[e-1]?.focus())):r.key===`ArrowLeft`&&e>0?o.current[e-1]?.focus():r.key===`ArrowRight`&&e<5?o.current[e+1]?.focus():r.key===`Enter`&&(r.preventDefault(),r.currentTarget.form?.requestSubmit())}function c(e,i){let a=i.nativeEvent.data;if(!a||!/^\d$/.test(a))return;let s=t.split(``);for(s[e]=a;s.length<e;)s.push(``);let c=s.join(``).replace(/\D/g,``).slice(0,6);n(c),c.length===6?r?.(c):e<5&&o.current[e+1]?.focus()}function l(e){e.preventDefault();let t=e.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,6);t&&(n(t),t.length===6?r?.(t):o.current[t.length]?.focus())}return(0,m.jsx)(`div`,{className:`pin-field`,children:Array.from({length:6}).map((n,r)=>(0,m.jsx)(`input`,{ref:t=>{o.current[r]=t,r===0&&e&&(e.current=t)},type:`text`,inputMode:`numeric`,className:`pin-box${t[r]?` pin-box-filled`:``}`,value:t[r]?i?t[r]:`•`:``,onKeyDown:e=>s(r,e),onInput:e=>c(r,e),onPaste:l,onFocus:e=>e.target.select(),autoFocus:a&&r===0,autoComplete:`off`,maxLength:1,"aria-label":`PIN digit ${r+1}`},r))})}function g(e){let{pin:t,setPin:n,showPin:r,setShowPin:o,pinLoading:s,pinError:c,pinInputRef:d,setPinFormRef:f,onSubmit:p,operatorName:g,setOperatorName:_}=e;return(0,m.jsx)(`div`,{className:`connect-page`,children:(0,m.jsxs)(`div`,{className:`connect-content`,children:[(0,m.jsx)(`img`,{src:a,alt:i.productName,className:`connect-logo connect-logo--maxy`}),!i.logoContainsName&&(0,m.jsxs)(`h1`,{className:`connect-title`,children:[`Welcome to `,i.productName]}),(0,m.jsxs)(`p`,{className:`connect-subtitle`,children:[`Tell `,i.productName,` who you are, then choose a PIN.`]}),(0,m.jsxs)(`form`,{ref:f,onSubmit:p,className:`connect-pin-form`,children:[(0,m.jsxs)(`div`,{className:`pin-input-row`,children:[(0,m.jsx)(`input`,{type:`text`,className:`connect-name-input`,placeholder:`Your full name`,value:g,onChange:e=>_(e.target.value),autoComplete:`name`,autoFocus:!0,required:!0,"aria-label":`Your full name`}),(0,m.jsx)(`div`,{style:{width:38,flexShrink:0},"aria-hidden":`true`})]}),(0,m.jsxs)(`div`,{className:`pin-input-row`,children:[(0,m.jsx)(h,{inputRef:d,value:t,onChange:n,onComplete:()=>{},showPin:r}),(0,m.jsx)(l,{variant:`send`,type:`submit`,disabled:!t||!g.trim(),loading:s,"aria-label":`Set PIN`,children:(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,m.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,m.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,m.jsx)(u,{checked:r,onChange:()=>o(e=>!e),label:`Show PIN`})]}),c&&(0,m.jsx)(`p`,{className:`admin-pin-error`,children:c})]})})}function _(e){let{pin:t,setPin:n,showPin:r,setShowPin:o,pinLoading:s,pinError:c,pinInputRef:d,onSubmit:f,remoteAuthEnabled:p,onSignOutRemote:g}=e;return(0,m.jsxs)(`div`,{className:`connect-page`,children:[p&&g&&(0,m.jsx)(`button`,{type:`button`,className:`connect-signout`,onClick:g,children:`Sign out`}),(0,m.jsxs)(`div`,{className:`connect-content`,children:[(0,m.jsx)(`img`,{src:a,alt:i.productName,className:`connect-logo connect-logo--maxy`}),!i.logoContainsName&&(0,m.jsx)(`h1`,{className:`connect-title`,children:i.productName}),(0,m.jsxs)(`form`,{onSubmit:f,className:`connect-pin-form`,children:[(0,m.jsxs)(`div`,{className:`pin-input-row`,children:[(0,m.jsx)(h,{inputRef:d,value:t,onChange:n,onComplete:()=>{},showPin:r,autoFocus:!0}),(0,m.jsx)(l,{variant:`send`,type:`submit`,disabled:!t,loading:s,children:(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,m.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,m.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,m.jsx)(`div`,{className:`pin-options`,children:(0,m.jsx)(u,{checked:r,onChange:()=>o(e=>!e),label:`Show PIN`})})]}),c&&(0,m.jsx)(`p`,{className:`admin-pin-error`,children:c})]})]})}function v(e){let{authPolling:t,setAuthPolling:n,authLoading:r,setAuthLoading:o,pinError:s,setPinError:c,setAppState:u}=e,[p,h]=(0,f.useState)(!1),[g,_]=(0,f.useState)(!1),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(``),[S,C]=(0,f.useState)(``),[w,T]=(0,f.useState)(null),[E,D]=(0,f.useState)(null),[O,k]=(0,f.useState)(!1),A=(0,f.useRef)(0);(0,f.useEffect)(()=>{try{D(sessionStorage.getItem(`maxy-admin-session-key`))}catch{}k(!0)},[]);async function j(){C(``);try{let e=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`paste-code`,code:b})})).json();e.accepted?(C(`Code submitted. Finishing sign-in…`),x(``)):C(e.error||`Could not submit code.`)}catch(e){console.error(`[admin] paste-code error:`,e),C(`Could not submit code.`)}}async function M(){_(!0),c(``);try{let e=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`launch-browser`})})).json();e.launched?h(!0):e.error&&c(e.error)}catch(e){console.error(`[admin] browser launch error:`,e),c(`Could not launch browser.`)}_(!1)}async function N(){let e=++A.current;o(!0),c(``);try{let t=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`})).json();if(t.started){n(!0),h(!0),o(!1),y(t.transport||``);for(let t=0;t<120;t++){if(await new Promise(e=>setTimeout(e,2e3)),A.current!==e)return;let t=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`wait`})})).json();if(typeof t.authTargetId==`string`&&T(t.authTargetId),t.authenticated){await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`stop`})}),u(`enter-pin`);return}}c(`Timed out waiting for sign-in. Try again.`),n(!1)}else t.error&&c(t.error)}catch(e){console.error(`[admin] auth flow error:`,e),c(`Could not start auth flow.`)}o(!1)}async function P(){A.current++,await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`stop`})}),n(!1),c(``)}return t||p?(0,m.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100dvh`,overflow:`auto`},children:[(0,m.jsxs)(`header`,{className:`chat-header`,style:{paddingBottom:`12px`,flexShrink:0,position:`relative`,maxWidth:`680px`,width:`100%`,margin:`0 auto`,padding:`24px 20px 12px`},children:[t?(0,m.jsx)(`button`,{onClick:P,style:{position:`absolute`,top:`12px`,right:`12px`,background:`none`,border:`none`,color:`#999`,fontSize:`13px`,cursor:`pointer`,padding:`4px 8px`},"aria-label":`Cancel`,children:`✕`}):(0,m.jsx)(`button`,{onClick:()=>h(!1),style:{position:`absolute`,top:`12px`,right:`12px`,background:`none`,border:`none`,color:`#999`,fontSize:`13px`,cursor:`pointer`,padding:`4px 8px`},"aria-label":`Close browser`,children:`✕`}),(0,m.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`chat-logo`}),(0,m.jsx)(`h1`,{className:`chat-tagline`,children:`Connect Claude`}),(0,m.jsx)(`p`,{className:`chat-intro`,children:t?`Sign in and authorize in the browser below.`:`Open your email or prepare your accounts, then sign in.`}),!t&&(0,m.jsx)(`div`,{style:{marginTop:`12px`},children:(0,m.jsx)(l,{variant:`primary`,onClick:N,disabled:r,children:r?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`spin`,style:{display:`inline-block`},children:`✱`}),` Connecting…`]}):`Sign in to Claude`})}),t&&v===`native`&&(0,m.jsxs)(`div`,{style:{marginTop:`14px`,maxWidth:`420px`,margin:`14px auto 0`,display:`flex`,flexDirection:`column`,gap:`8px`},children:[(0,m.jsx)(`label`,{style:{fontSize:`12px`,color:`#999`,lineHeight:1.4},children:`If the browser didn't finish sign-in, paste the code or full redirect URL from Claude's page:`}),(0,m.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,m.jsx)(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:`Paste code or redirect URL`,style:{flex:1,padding:`8px 10px`,fontSize:`13px`,border:`1px solid #ccc`,borderRadius:`6px`}}),(0,m.jsx)(l,{variant:`primary`,onClick:j,disabled:!b.trim(),children:`Submit`})]}),S&&(0,m.jsx)(`p`,{style:{fontSize:`12px`,color:`#999`,margin:0},children:S})]})]}),(0,m.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0,gap:`10px`,padding:`0 0 16px`},children:O&&(0,m.jsx)(d,{preferTargetId:w,cacheKey:E,chrome:!1})}),s&&(0,m.jsx)(`p`,{className:`admin-pin-error`,style:{textAlign:`center`,padding:`0 20px 16px`},children:s})]}):(0,m.jsx)(`div`,{className:`connect-page`,children:(0,m.jsxs)(`div`,{className:`connect-content`,children:[(0,m.jsxs)(`div`,{className:`connect-logos`,children:[(0,m.jsx)(`div`,{className:`connect-logo-wrap`,children:(0,m.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`connect-logo`})}),(0,m.jsx)(`svg`,{className:`connect-arrow`,viewBox:`0 0 48 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,m.jsx)(`path`,{d:`M0 12h44m0 0l-8-8m8 8l-8 8`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,m.jsxs)(`div`,{className:`connect-logo-wrap`,children:[(0,m.jsx)(`img`,{src:a,alt:i.productName,className:`connect-logo connect-logo--maxy`}),!i.logoContainsName&&(0,m.jsx)(`span`,{className:`connect-logo-label`,children:i.productName})]})]}),(0,m.jsxs)(`h1`,{className:`connect-title`,children:[`Connect Claude to power `,i.productName]}),(0,m.jsx)(`p`,{className:`connect-subtitle`,children:`Sign in with your Anthropic account to get started.`}),(0,m.jsx)(l,{variant:`primary`,onClick:N,disabled:r,children:r?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`spin`,style:{display:`inline-block`},children:`✱`}),` Connecting…`]}):`Sign in to Claude`}),(0,m.jsx)(`p`,{style:{marginTop:`6px`,fontSize:`11px`,color:`#999`,maxWidth:`300px`,textAlign:`center`,lineHeight:`1.4`},children:`First time? You may need to sign into your email and Anthropic account in the browser before connecting.`}),(0,m.jsx)(`button`,{onClick:M,disabled:g,style:{marginTop:`12px`,background:`none`,border:`none`,color:`var(--color-primary, #666)`,fontSize:`13px`,cursor:`pointer`,textDecoration:`underline`,textUnderlineOffset:`3px`},children:g?`Launching…`:`Open browser first`}),s&&(0,m.jsx)(`p`,{className:`admin-pin-error`,children:s})]})})}function y({auth:e}){return e.appState===`loading`?(0,m.jsx)(r,{surface:`gate`}):e.appState===`set-pin`?(0,m.jsx)(g,{pin:e.pin,setPin:e.setPin,showPin:e.showPin,setShowPin:e.setShowPin,pinLoading:e.pinLoading,pinError:e.pinError,pinInputRef:e.pinInputRef,setPinFormRef:e.setPinFormRef,onSubmit:e.handleSetPin,operatorName:e.operatorName,setOperatorName:e.setOperatorName}):e.appState===`connect-claude`?(0,m.jsx)(v,{authPolling:e.authPolling,setAuthPolling:e.setAuthPolling,authLoading:e.authLoading,setAuthLoading:e.setAuthLoading,pinError:e.pinError,setPinError:e.setPinError,setAppState:e.setAppState}):e.appState===`enter-pin`?(0,m.jsx)(_,{pin:e.pin,setPin:e.setPin,showPin:e.showPin,setShowPin:e.setShowPin,pinLoading:e.pinLoading,pinError:e.pinError,pinInputRef:e.pinInputRef,onSubmit:e.handleLogin,remoteAuthEnabled:e.remoteAuthEnabled,onSignOutRemote:()=>{window.location.href=`/__remote-auth/logout`}}):null}export{p as n,y as t};
|
|
Binary file
|
|
Binary file
|