@rubytech/create-maxy-code 0.1.573 → 0.1.574
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/admins-write/__tests__/index.test.ts +97 -0
- package/payload/platform/lib/admins-write/dist/index.d.ts +12 -0
- package/payload/platform/lib/admins-write/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/admins-write/dist/index.js +27 -5
- package/payload/platform/lib/admins-write/dist/index.js.map +1 -1
- package/payload/platform/lib/admins-write/src/index.ts +35 -5
- package/payload/platform/lib/admins-write/vitest.config.ts +14 -0
- package/payload/platform/lib/dispatch-read/dist/session.d.ts.map +1 -1
- package/payload/platform/lib/dispatch-read/dist/session.js +19 -4
- package/payload/platform/lib/dispatch-read/dist/session.js.map +1 -1
- package/payload/platform/lib/dispatch-read/src/__tests__/session.test.ts +91 -0
- package/payload/platform/lib/dispatch-read/src/session.ts +25 -6
- package/payload/platform/plugins/admin/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/admin/PLUGIN.md +8 -3
- package/payload/platform/plugins/admin/hooks/__tests__/html-structure-gate.test.sh +264 -0
- package/payload/platform/plugins/admin/hooks/__tests__/quote-render-pdf-conformance.test.sh +122 -24
- package/payload/platform/plugins/admin/hooks/__tests__/specialist-dispatch-gate.test.sh +158 -0
- package/payload/platform/plugins/admin/hooks/html-structure-gate.sh +165 -0
- package/payload/platform/plugins/admin/hooks/quote-render-pdf-conformance.sh +111 -19
- package/payload/platform/plugins/admin/hooks/specialist-dispatch-gate.sh +159 -0
- package/payload/platform/plugins/admin/mcp/dist/admin-bind-classify.d.ts +27 -0
- package/payload/platform/plugins/admin/mcp/dist/admin-bind-classify.d.ts.map +1 -0
- package/payload/platform/plugins/admin/mcp/dist/admin-bind-classify.js +29 -0
- package/payload/platform/plugins/admin/mcp/dist/admin-bind-classify.js.map +1 -0
- package/payload/platform/plugins/admin/mcp/dist/binding-validate.d.ts +11 -0
- package/payload/platform/plugins/admin/mcp/dist/binding-validate.d.ts.map +1 -0
- package/payload/platform/plugins/admin/mcp/dist/binding-validate.js +20 -0
- package/payload/platform/plugins/admin/mcp/dist/binding-validate.js.map +1 -0
- package/payload/platform/plugins/admin/mcp/dist/index.js +133 -1
- package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/admin/skills/admin-user-management/SKILL.md +32 -2
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +157 -46
- package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +8 -0
- package/payload/platform/plugins/docs/references/admin-ui.md +71 -31
- package/payload/platform/plugins/docs/references/channel-wake-and-prompt.md +38 -13
- package/payload/platform/plugins/docs/references/internals.md +6 -0
- package/payload/platform/plugins/docs/references/outlook-guide.md +31 -1
- package/payload/platform/plugins/docs/references/troubleshooting.md +10 -0
- package/payload/platform/plugins/outlook/PLUGIN.md +3 -1
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-ledger-write-sites.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-ledger-write-sites.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-ledger-write-sites.test.js +177 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-ledger-write-sites.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-ledger.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-ledger.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-ledger.test.js +130 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-ledger.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-reconcile.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-reconcile.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-reconcile.test.js +162 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-reconcile.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-state-fields.test.d.ts +2 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-state-fields.test.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-state-fields.test.js +168 -0
- package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-state-fields.test.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/draft-ledger.d.ts +64 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/draft-ledger.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/draft-ledger.js +110 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/draft-ledger.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/draft-reconcile.d.ts +119 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/draft-reconcile.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/draft-reconcile.js +0 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/draft-reconcile.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/scripts/draft-reconcile.d.ts +8 -0
- package/payload/platform/plugins/outlook/mcp/dist/scripts/draft-reconcile.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/scripts/draft-reconcile.js +247 -0
- package/payload/platform/plugins/outlook/mcp/dist/scripts/draft-reconcile.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-send.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-send.js +10 -0
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-send.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.js +21 -0
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.d.ts +16 -0
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.js +5 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-list.d.ts +4 -0
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-list.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-list.js +2 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-list.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.js +24 -0
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-search.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-search.js +2 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-search.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.js +29 -0
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/__tests__/draft-reconcile-throttle.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/__tests__/draft-reconcile-throttle.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/__tests__/draft-reconcile-throttle.test.js +21 -0
- package/payload/platform/plugins/scheduling/mcp/dist/__tests__/draft-reconcile-throttle.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/draft-reconcile-throttle.d.ts +13 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/draft-reconcile-throttle.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/draft-reconcile-throttle.js +10 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/draft-reconcile-throttle.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js +54 -0
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/authored-specialist-tools.d.ts +32 -0
- package/payload/platform/services/claude-session-manager/dist/authored-specialist-tools.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/authored-specialist-tools.js +144 -0
- package/payload/platform/services/claude-session-manager/dist/authored-specialist-tools.js.map +1 -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 +1 -0
- package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/html-structure-census.d.ts +44 -0
- package/payload/platform/services/claude-session-manager/dist/html-structure-census.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/html-structure-census.js +185 -0
- package/payload/platform/services/claude-session-manager/dist/html-structure-census.js.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/index.js +125 -0
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/quote-delivery-reconcile.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/quote-delivery-reconcile.js +7 -0
- package/payload/platform/services/claude-session-manager/dist/quote-delivery-reconcile.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/quote-print-census.d.ts +42 -0
- package/payload/platform/services/claude-session-manager/dist/quote-print-census.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/quote-print-census.js +254 -0
- package/payload/platform/services/claude-session-manager/dist/quote-print-census.js.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/specialist-census.d.ts +92 -0
- package/payload/platform/services/claude-session-manager/dist/specialist-census.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/specialist-census.js +227 -0
- package/payload/platform/services/claude-session-manager/dist/specialist-census.js.map +1 -0
- package/payload/platform/templates/account-settings.json +8 -4
- package/payload/server/server.js +465 -361
package/package.json
CHANGED
|
@@ -207,3 +207,100 @@ describe('users-audit target attribution (Task 1573)', () => {
|
|
|
207
207
|
expect(line).not.toContain('explicitUserId=')
|
|
208
208
|
})
|
|
209
209
|
})
|
|
210
|
+
|
|
211
|
+
describe('writeAdminEntry — channel bindings (Task 2531)', () => {
|
|
212
|
+
const rows = (usersFile: string) => JSON.parse(readFileSync(usersFile, 'utf-8')) as Array<Record<string, string>>
|
|
213
|
+
|
|
214
|
+
it('writes phone and telegram onto a new entry', () => {
|
|
215
|
+
const f = fixture({ users: [], admins: [] })
|
|
216
|
+
writeAdminEntry({
|
|
217
|
+
userId: 'bbbbbbbb-2', pin: 'hash', role: 'admin',
|
|
218
|
+
usersFile: f.usersFile, accountDir: f.accountDir, caller: 'admin-add',
|
|
219
|
+
audit: { actor: 'aaaaaaaa-1', logFile: f.logFile },
|
|
220
|
+
phone: '+447504472444', telegram: '1311221864',
|
|
221
|
+
})
|
|
222
|
+
const [row] = rows(f.usersFile)
|
|
223
|
+
expect(row.phone).toBe('+447504472444')
|
|
224
|
+
expect(row.telegram).toBe('1311221864')
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
it('sets one binding on an existing entry and leaves the other and the pin alone', () => {
|
|
228
|
+
const f = fixture({ users: [{ userId: 'bbbbbbbb-2', pin: 'h1' }], admins: [] })
|
|
229
|
+
writeAdminEntry({
|
|
230
|
+
userId: 'bbbbbbbb-2', pin: 'h1', role: 'admin',
|
|
231
|
+
usersFile: f.usersFile, accountDir: f.accountDir, caller: 'admin-bind',
|
|
232
|
+
audit: { actor: 'aaaaaaaa-1', logFile: f.logFile },
|
|
233
|
+
phone: '+447504472444', telegram: '1311221864',
|
|
234
|
+
})
|
|
235
|
+
writeAdminEntry({
|
|
236
|
+
userId: 'bbbbbbbb-2', pin: 'h1', role: 'admin',
|
|
237
|
+
usersFile: f.usersFile, accountDir: f.accountDir, caller: 'admin-bind',
|
|
238
|
+
audit: { actor: 'aaaaaaaa-1', logFile: f.logFile },
|
|
239
|
+
telegram: '9999',
|
|
240
|
+
})
|
|
241
|
+
const [row] = rows(f.usersFile)
|
|
242
|
+
expect(row.phone).toBe('+447504472444')
|
|
243
|
+
expect(row.telegram).toBe('9999')
|
|
244
|
+
expect(row.pin).toBe('h1')
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
it('audits a binding-only write as set-binding, never as a pin rotation', () => {
|
|
248
|
+
// admin-bind carries the EXISTING hash through so it rotates nothing. If the
|
|
249
|
+
// audit line still said action=set-pin the credential trail would record a
|
|
250
|
+
// rotation that did not happen, which is worse than no line at all.
|
|
251
|
+
const f = fixture({ users: [{ userId: 'bbbbbbbb-2', pin: 'h1' }], admins: [] })
|
|
252
|
+
writeAdminEntry({
|
|
253
|
+
userId: 'bbbbbbbb-2', pin: 'h1', role: 'admin',
|
|
254
|
+
usersFile: f.usersFile, accountDir: f.accountDir, caller: 'admin-bind',
|
|
255
|
+
audit: { actor: 'aaaaaaaa-1', logFile: f.logFile },
|
|
256
|
+
phone: '+447504472444',
|
|
257
|
+
})
|
|
258
|
+
const lines = readAudit(f.logFile)
|
|
259
|
+
expect(lines).toHaveLength(1)
|
|
260
|
+
expect(lines[0]).toContain('action=set-binding')
|
|
261
|
+
expect(lines[0]).toContain('field=phone')
|
|
262
|
+
expect(lines[0]).not.toContain('field=pin')
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
it('names both fields when both bindings are set at once', () => {
|
|
266
|
+
const f = fixture({ users: [{ userId: 'bbbbbbbb-2', pin: 'h1' }], admins: [] })
|
|
267
|
+
writeAdminEntry({
|
|
268
|
+
userId: 'bbbbbbbb-2', pin: 'h1', role: 'admin',
|
|
269
|
+
usersFile: f.usersFile, accountDir: f.accountDir, caller: 'admin-bind',
|
|
270
|
+
audit: { actor: 'aaaaaaaa-1', logFile: f.logFile },
|
|
271
|
+
phone: '+447504472444', telegram: '1311221864',
|
|
272
|
+
})
|
|
273
|
+
expect(readAudit(f.logFile)[0]).toContain('field=phone,telegram')
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
it('still audits a genuine pin rotation as set-pin even when a binding rides along', () => {
|
|
277
|
+
const f = fixture({ users: [{ userId: 'bbbbbbbb-2', pin: 'h1' }], admins: [] })
|
|
278
|
+
writeAdminEntry({
|
|
279
|
+
userId: 'bbbbbbbb-2', pin: 'h2', role: 'admin',
|
|
280
|
+
usersFile: f.usersFile, accountDir: f.accountDir, caller: 'test',
|
|
281
|
+
audit: { actor: 'aaaaaaaa-1', logFile: f.logFile },
|
|
282
|
+
phone: '+447504472444',
|
|
283
|
+
})
|
|
284
|
+
expect(readAudit(f.logFile)[0]).toContain('action=set-pin')
|
|
285
|
+
})
|
|
286
|
+
|
|
287
|
+
it('a write that supplies no binding does not erase an existing one', () => {
|
|
288
|
+
// The PIN-rotation path. Task 2531 requires that admin-update-pin can never
|
|
289
|
+
// silently clear a channel binding.
|
|
290
|
+
const f = fixture({ users: [{ userId: 'bbbbbbbb-2', pin: 'h1' }], admins: [] })
|
|
291
|
+
writeAdminEntry({
|
|
292
|
+
userId: 'bbbbbbbb-2', pin: 'h1', role: 'admin',
|
|
293
|
+
usersFile: f.usersFile, accountDir: f.accountDir, caller: 'admin-bind',
|
|
294
|
+
audit: { actor: 'aaaaaaaa-1', logFile: f.logFile },
|
|
295
|
+
phone: '+447504472444',
|
|
296
|
+
})
|
|
297
|
+
writeAdminEntry({
|
|
298
|
+
userId: 'bbbbbbbb-2', pin: 'h2', role: 'admin',
|
|
299
|
+
usersFile: f.usersFile, accountDir: f.accountDir, caller: 'admin-update-pin',
|
|
300
|
+
audit: { actor: 'aaaaaaaa-1', logFile: f.logFile },
|
|
301
|
+
})
|
|
302
|
+
const [row] = rows(f.usersFile)
|
|
303
|
+
expect(row.phone).toBe('+447504472444')
|
|
304
|
+
expect(row.pin).toBe('h2')
|
|
305
|
+
})
|
|
306
|
+
})
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export interface UserEntry {
|
|
2
2
|
userId: string;
|
|
3
3
|
pin: string;
|
|
4
|
+
/** Task 2531 — E.164 phone binding this person to their WhatsApp sender.
|
|
5
|
+
* Mirrors platform/ui/app/lib/admin-identity/pin-validator.ts, the record
|
|
6
|
+
* resolveAdminUserId actually reads. Its absence from THIS declaration is why
|
|
7
|
+
* the one writer could not set it and every admin was created unbound. */
|
|
8
|
+
phone?: string;
|
|
9
|
+
/** Task 2531 — the Telegram chat id, matched by exact string equality. */
|
|
10
|
+
telegram?: string;
|
|
4
11
|
}
|
|
5
12
|
/**
|
|
6
13
|
* Identity + destination for one credential-store audit line. The writer is
|
|
@@ -50,6 +57,11 @@ export interface AdminWriteInput {
|
|
|
50
57
|
accountDir: string;
|
|
51
58
|
caller: string;
|
|
52
59
|
audit: AuditContext;
|
|
60
|
+
/** Task 2531 — set when supplied; an unsupplied field is left untouched, so a
|
|
61
|
+
* PIN rotation can never erase a binding and binding one channel never
|
|
62
|
+
* clears the other. */
|
|
63
|
+
phone?: string;
|
|
64
|
+
telegram?: string;
|
|
53
65
|
}
|
|
54
66
|
export interface AdminWriteResult {
|
|
55
67
|
usersJsonResult: "ok" | "fail" | "noop";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IAC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,mBAAmB,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,+EAA+E;IAC/E,MAAM,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnD;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,gBAAgB,CAoE/G;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,CAiBxF"}
|
|
@@ -110,19 +110,41 @@ function writeAdminEntry(input) {
|
|
|
110
110
|
}
|
|
111
111
|
const rowsBefore = users.map(u => id8(u.userId)).join(",");
|
|
112
112
|
const existing = users.findIndex(u => u.userId === input.userId);
|
|
113
|
+
// Task 2531 — what this write actually changes, decided BEFORE the row is
|
|
114
|
+
// rewritten. admin-bind carries the existing hash through so it rotates
|
|
115
|
+
// nothing; auditing that as `set-pin` would record a credential rotation
|
|
116
|
+
// that did not happen, which is worse for an audit trail than no line.
|
|
117
|
+
const pinRotated = existing !== -1 && users[existing].pin !== input.pin;
|
|
118
|
+
const boundFields = [
|
|
119
|
+
input.phone !== undefined ? "phone" : null,
|
|
120
|
+
input.telegram !== undefined ? "telegram" : null,
|
|
121
|
+
].filter(Boolean);
|
|
113
122
|
if (existing === -1) {
|
|
114
|
-
|
|
123
|
+
const row = { userId: input.userId, pin: input.pin };
|
|
124
|
+
if (input.phone !== undefined)
|
|
125
|
+
row.phone = input.phone;
|
|
126
|
+
if (input.telegram !== undefined)
|
|
127
|
+
row.telegram = input.telegram;
|
|
128
|
+
users.push(row);
|
|
115
129
|
}
|
|
116
130
|
else {
|
|
117
131
|
// Preserve sibling fields other writers may have set; overwrite pin.
|
|
118
|
-
|
|
132
|
+
const row = { ...users[existing], pin: input.pin };
|
|
133
|
+
// Task 2531 — set only what this call supplied. An absent field is not an
|
|
134
|
+
// instruction to clear one.
|
|
135
|
+
if (input.phone !== undefined)
|
|
136
|
+
row.phone = input.phone;
|
|
137
|
+
if (input.telegram !== undefined)
|
|
138
|
+
row.telegram = input.telegram;
|
|
139
|
+
users[existing] = row;
|
|
119
140
|
}
|
|
120
141
|
writeFileAtomic(input.usersFile, JSON.stringify(users, null, 2) + "\n", 0o600);
|
|
121
142
|
result.usersJsonResult = "ok";
|
|
122
|
-
// A new userId is a row add
|
|
143
|
+
// A new userId is a row add. An existing userId is a pin rotation when the
|
|
144
|
+
// hash actually moved, and otherwise a binding write naming the fields set.
|
|
123
145
|
appendUsersAuditLine(input.audit, {
|
|
124
|
-
action: existing === -1 ? "add" : "set-pin",
|
|
125
|
-
field: existing === -1 ? "row" : "pin",
|
|
146
|
+
action: existing === -1 ? "add" : pinRotated ? "set-pin" : "set-binding",
|
|
147
|
+
field: existing === -1 ? "row" : pinRotated ? "pin" : boundFields.join(","),
|
|
126
148
|
rowsBefore,
|
|
127
149
|
rowsAfter: users.map(u => id8(u.userId)).join(","),
|
|
128
150
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,wEAAwE;AACxE,EAAE;AACF,oDAAoD;AACpD,+DAA+D;AAC/D,4EAA4E;AAC5E,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,qBAAqB;AACrB,EAAE;AACF,kEAAkE;AAClE,uEAAuE;AACvE,yEAAyE;AACzE,6EAA6E;AAC7E,+EAA+E;AAC/E,2EAA2E;AAC3E,mEAAmE;;AA0CnE,8CAEC;AAqCD,sCAKC;AAoDD,0CAiEC;AAoBD,wDAuCC;AAsCD,kEAoEC;AAUD,0DAiBC;AAzYD,qCAAgI;AAChI,yCAA0C;A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mB;KAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -25,6 +25,13 @@ import { dirname, join } from "node:path";
|
|
|
25
25
|
export interface UserEntry {
|
|
26
26
|
userId: string;
|
|
27
27
|
pin: string; // SHA-256 hash
|
|
28
|
+
/** Task 2531 — E.164 phone binding this person to their WhatsApp sender.
|
|
29
|
+
* Mirrors platform/ui/app/lib/admin-identity/pin-validator.ts, the record
|
|
30
|
+
* resolveAdminUserId actually reads. Its absence from THIS declaration is why
|
|
31
|
+
* the one writer could not set it and every admin was created unbound. */
|
|
32
|
+
phone?: string;
|
|
33
|
+
/** Task 2531 — the Telegram chat id, matched by exact string equality. */
|
|
34
|
+
telegram?: string;
|
|
28
35
|
}
|
|
29
36
|
|
|
30
37
|
/**
|
|
@@ -118,6 +125,11 @@ export interface AdminWriteInput {
|
|
|
118
125
|
accountDir: string; // absolute path to account dir (containing account.json)
|
|
119
126
|
caller: string; // identifier for the [admins-write] log line
|
|
120
127
|
audit: AuditContext; // actor/session/logFile for the [users-audit] line
|
|
128
|
+
/** Task 2531 — set when supplied; an unsupplied field is left untouched, so a
|
|
129
|
+
* PIN rotation can never erase a binding and binding one channel never
|
|
130
|
+
* clears the other. */
|
|
131
|
+
phone?: string;
|
|
132
|
+
telegram?: string;
|
|
121
133
|
}
|
|
122
134
|
|
|
123
135
|
export interface AdminWriteResult {
|
|
@@ -174,19 +186,37 @@ export function writeAdminEntry(input: AdminWriteInput): AdminWriteResult {
|
|
|
174
186
|
|
|
175
187
|
const rowsBefore = users.map(u => id8(u.userId)).join(",");
|
|
176
188
|
const existing = users.findIndex(u => u.userId === input.userId);
|
|
189
|
+
// Task 2531 — what this write actually changes, decided BEFORE the row is
|
|
190
|
+
// rewritten. admin-bind carries the existing hash through so it rotates
|
|
191
|
+
// nothing; auditing that as `set-pin` would record a credential rotation
|
|
192
|
+
// that did not happen, which is worse for an audit trail than no line.
|
|
193
|
+
const pinRotated = existing !== -1 && users[existing].pin !== input.pin;
|
|
194
|
+
const boundFields = [
|
|
195
|
+
input.phone !== undefined ? "phone" : null,
|
|
196
|
+
input.telegram !== undefined ? "telegram" : null,
|
|
197
|
+
].filter(Boolean) as string[];
|
|
177
198
|
if (existing === -1) {
|
|
178
|
-
|
|
199
|
+
const row: UserEntry = { userId: input.userId, pin: input.pin };
|
|
200
|
+
if (input.phone !== undefined) row.phone = input.phone;
|
|
201
|
+
if (input.telegram !== undefined) row.telegram = input.telegram;
|
|
202
|
+
users.push(row);
|
|
179
203
|
} else {
|
|
180
204
|
// Preserve sibling fields other writers may have set; overwrite pin.
|
|
181
|
-
|
|
205
|
+
const row: UserEntry = { ...users[existing], pin: input.pin };
|
|
206
|
+
// Task 2531 — set only what this call supplied. An absent field is not an
|
|
207
|
+
// instruction to clear one.
|
|
208
|
+
if (input.phone !== undefined) row.phone = input.phone;
|
|
209
|
+
if (input.telegram !== undefined) row.telegram = input.telegram;
|
|
210
|
+
users[existing] = row;
|
|
182
211
|
}
|
|
183
212
|
|
|
184
213
|
writeFileAtomic(input.usersFile, JSON.stringify(users, null, 2) + "\n", 0o600);
|
|
185
214
|
result.usersJsonResult = "ok";
|
|
186
|
-
// A new userId is a row add
|
|
215
|
+
// A new userId is a row add. An existing userId is a pin rotation when the
|
|
216
|
+
// hash actually moved, and otherwise a binding write naming the fields set.
|
|
187
217
|
appendUsersAuditLine(input.audit, {
|
|
188
|
-
action: existing === -1 ? "add" : "set-pin",
|
|
189
|
-
field: existing === -1 ? "row" : "pin",
|
|
218
|
+
action: existing === -1 ? "add" : pinRotated ? "set-pin" : "set-binding",
|
|
219
|
+
field: existing === -1 ? "row" : pinRotated ? "pin" : boundFields.join(","),
|
|
190
220
|
rowsBefore,
|
|
191
221
|
rowsAfter: users.map(u => id8(u.userId)).join(","),
|
|
192
222
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
|
|
3
|
+
// Task 2531 — this lib shipped a 210-line test file and no runner: the sibling
|
|
4
|
+
// libs' configs all include `src/__tests__/**`, and these tests live one level
|
|
5
|
+
// up at `__tests__/`, so no config matched them and nothing ever executed the
|
|
6
|
+
// credential-store chokepoint's coverage. The include below is the layout that
|
|
7
|
+
// is actually on disk.
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
test: {
|
|
10
|
+
environment: "node",
|
|
11
|
+
globals: false,
|
|
12
|
+
include: ["__tests__/**/*.test.ts"],
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAEA,OAAc,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAqDhE,kCAAkC;AAClC,wBAAsB,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAOrF;AAED,oEAAoE;AACpE,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAE1D"}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.withSession = withSession;
|
|
7
7
|
exports.__setDriverForTests = __setDriverForTests;
|
|
8
8
|
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
9
10
|
const neo4j_driver_1 = __importDefault(require("neo4j-driver"));
|
|
10
11
|
/**
|
|
11
12
|
* This package owns its Neo4j session.
|
|
@@ -18,10 +19,24 @@ let driver = null;
|
|
|
18
19
|
function password() {
|
|
19
20
|
if (process.env.NEO4J_PASSWORD)
|
|
20
21
|
return process.env.NEO4J_PASSWORD;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
// The platform root from env, never a path computed from this file. The
|
|
23
|
+
// correct segment count differs between src and dist, and this package is
|
|
24
|
+
// loaded from src by the admin server and from dist by the dispatch MCP.
|
|
25
|
+
// The two processes also disagree on the variable name, so both are read.
|
|
26
|
+
const root = process.env.MAXY_PLATFORM_ROOT ?? process.env.PLATFORM_ROOT;
|
|
27
|
+
if (!root) {
|
|
28
|
+
throw new Error("[dispatch-read] neither MAXY_PLATFORM_ROOT nor PLATFORM_ROOT is set — cannot locate config/.neo4j-password");
|
|
29
|
+
}
|
|
30
|
+
const passwordFile = (0, node_path_1.resolve)(root, "config/.neo4j-password");
|
|
31
|
+
try {
|
|
32
|
+
return (0, node_fs_1.readFileSync)(passwordFile, "utf-8").trim();
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
// The cause is carried, not swallowed. A permissions failure reported as
|
|
36
|
+
// "not found" sends the reader to a path where the file is plainly
|
|
37
|
+
// present, which is the misdirection this package's own outage was.
|
|
38
|
+
throw new Error(`[dispatch-read] Neo4j password not found. Expected at ${passwordFile}, or in NEO4J_PASSWORD. Read failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
39
|
+
}
|
|
25
40
|
}
|
|
26
41
|
function getDriver() {
|
|
27
42
|
if (driver)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":";;;;;AAwDA,kCAOC;AAGD,kDAEC;AApED,qCAAuC;AACvC,yCAAoC;AACpC,gEAAgE;AAEhE;;;;;;GAMG;AAEH,IAAI,MAAM,GAAkB,IAAI,CAAC;AAEjC,SAAS,QAAQ;IACf,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAClE,wEAAwE;IACxE,0EAA0E;IAC1E,yEAAyE;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,CAAC;QACH,OAAO,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC;AAED,oEAAoE;AACpE,SAAgB,mBAAmB,CAAC,CAAgB;IAClD,MAAM,GAAG,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
|
|
6
|
+
// `vi.mock` is hoisted above every `const` in this file, so the fakes it
|
|
7
|
+
// closes over must come from `vi.hoisted` or they are read before init.
|
|
8
|
+
const mocks = vi.hoisted(() => ({
|
|
9
|
+
basic: vi.fn((user: string, password: string) => ({ user, password })),
|
|
10
|
+
driver: vi.fn(() => ({
|
|
11
|
+
session: () => ({ close: async () => {} }),
|
|
12
|
+
close: async () => {},
|
|
13
|
+
})),
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
// `session.ts` imports neo4j-driver as a default import and takes only types
|
|
17
|
+
// from its named exports, so the default is the whole surface to fake.
|
|
18
|
+
vi.mock("neo4j-driver", () => ({
|
|
19
|
+
default: { driver: mocks.driver, auth: { basic: mocks.basic } },
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
import { __setDriverForTests, withSession } from "../session.js";
|
|
23
|
+
|
|
24
|
+
describe("Task 2525 — password resolution", () => {
|
|
25
|
+
let root = "";
|
|
26
|
+
const originalEnv = { ...process.env };
|
|
27
|
+
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
root = mkdtempSync(join(tmpdir(), "task2525-"));
|
|
30
|
+
mkdirSync(join(root, "config"), { recursive: true });
|
|
31
|
+
writeFileSync(join(root, "config", ".neo4j-password"), "file-secret\n");
|
|
32
|
+
delete process.env.NEO4J_PASSWORD;
|
|
33
|
+
delete process.env.NEO4J_PASSWORD_FILE;
|
|
34
|
+
delete process.env.MAXY_PLATFORM_ROOT;
|
|
35
|
+
delete process.env.PLATFORM_ROOT;
|
|
36
|
+
process.env.NEO4J_URI = "bolt://127.0.0.1:59999";
|
|
37
|
+
__setDriverForTests(null);
|
|
38
|
+
mocks.driver.mockClear();
|
|
39
|
+
mocks.basic.mockClear();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
afterEach(() => {
|
|
43
|
+
process.env = { ...originalEnv };
|
|
44
|
+
rmSync(root, { recursive: true, force: true });
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("reads <MAXY_PLATFORM_ROOT>/config/.neo4j-password, the name the admin server exports", async () => {
|
|
48
|
+
process.env.MAXY_PLATFORM_ROOT = root;
|
|
49
|
+
await withSession(async () => "ok");
|
|
50
|
+
expect(mocks.basic).toHaveBeenCalledWith("neo4j", "file-secret");
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("falls back to PLATFORM_ROOT, the name the dispatch MCP exports", async () => {
|
|
54
|
+
process.env.PLATFORM_ROOT = root;
|
|
55
|
+
await withSession(async () => "ok");
|
|
56
|
+
expect(mocks.basic).toHaveBeenCalledWith("neo4j", "file-secret");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("prefers NEO4J_PASSWORD over the file", async () => {
|
|
60
|
+
process.env.NEO4J_PASSWORD = "env-secret";
|
|
61
|
+
process.env.MAXY_PLATFORM_ROOT = root;
|
|
62
|
+
await withSession(async () => "ok");
|
|
63
|
+
expect(mocks.basic).toHaveBeenCalledWith("neo4j", "env-secret");
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("throws naming both root variables when neither is set", async () => {
|
|
67
|
+
await expect(withSession(async () => "ok")).rejects.toThrow(
|
|
68
|
+
/MAXY_PLATFORM_ROOT.*PLATFORM_ROOT/,
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("ignores NEO4J_PASSWORD_FILE, the variable nothing in the platform sets", async () => {
|
|
73
|
+
const decoy = join(root, "decoy-password");
|
|
74
|
+
writeFileSync(decoy, "decoy-secret\n");
|
|
75
|
+
process.env.NEO4J_PASSWORD_FILE = decoy;
|
|
76
|
+
process.env.MAXY_PLATFORM_ROOT = root;
|
|
77
|
+
await withSession(async () => "ok");
|
|
78
|
+
expect(mocks.basic).toHaveBeenCalledWith("neo4j", "file-secret");
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("throws naming the resolved path and carrying the read failure when the file is missing", async () => {
|
|
82
|
+
rmSync(join(root, "config", ".neo4j-password"));
|
|
83
|
+
process.env.MAXY_PLATFORM_ROOT = root;
|
|
84
|
+
// Both halves matter: the path tells the reader where to look, the cause
|
|
85
|
+
// distinguishes "absent" from "present but unreadable".
|
|
86
|
+
await expect(withSession(async () => "ok")).rejects.toThrow(
|
|
87
|
+
/config\/\.neo4j-password/,
|
|
88
|
+
);
|
|
89
|
+
await expect(withSession(async () => "ok")).rejects.toThrow(/ENOENT/);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
2
3
|
import neo4j, { type Driver, type Session } from "neo4j-driver";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -13,11 +14,29 @@ let driver: Driver | null = null;
|
|
|
13
14
|
|
|
14
15
|
function password(): string {
|
|
15
16
|
if (process.env.NEO4J_PASSWORD) return process.env.NEO4J_PASSWORD;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
// The platform root from env, never a path computed from this file. The
|
|
18
|
+
// correct segment count differs between src and dist, and this package is
|
|
19
|
+
// loaded from src by the admin server and from dist by the dispatch MCP.
|
|
20
|
+
// The two processes also disagree on the variable name, so both are read.
|
|
21
|
+
const root = process.env.MAXY_PLATFORM_ROOT ?? process.env.PLATFORM_ROOT;
|
|
22
|
+
if (!root) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
"[dispatch-read] neither MAXY_PLATFORM_ROOT nor PLATFORM_ROOT is set — cannot locate config/.neo4j-password",
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
const passwordFile = resolve(root, "config/.neo4j-password");
|
|
28
|
+
try {
|
|
29
|
+
return readFileSync(passwordFile, "utf-8").trim();
|
|
30
|
+
} catch (err) {
|
|
31
|
+
// The cause is carried, not swallowed. A permissions failure reported as
|
|
32
|
+
// "not found" sends the reader to a path where the file is plainly
|
|
33
|
+
// present, which is the misdirection this package's own outage was.
|
|
34
|
+
throw new Error(
|
|
35
|
+
`[dispatch-read] Neo4j password not found. Expected at ${passwordFile}, or in NEO4J_PASSWORD. Read failed: ${
|
|
36
|
+
err instanceof Error ? err.message : String(err)
|
|
37
|
+
}`,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
21
40
|
}
|
|
22
41
|
|
|
23
42
|
function getDriver(): Driver {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "admin",
|
|
3
|
-
"description": "Platform administration plugin. Provides system-status, public-hostname (deterministic Cloudflare public-URL resolver, single call returning the operator's canonical hostname so agents never guess property names on :CloudflareHostname nodes), admin-hostname (the admin-host twin of public-hostname — resolves the host that serves /calendar and the rest of the admin shell behind sign-in from the same ingress + alias + operator files, so agents point the operator at the admin /calendar URL instead of the public host that 404s it), publish-site (move an extracted static-site tree under <accountDir>/sites/<slug>/, emit one canonical path slug, and refresh llms.txt at the site root — typed refusal taxonomy replaces the prior skill-prose contract), brand-settings, account-manage, capabilities-here (deterministic install-introspection — returns enabledPlugins, tier, models, installed platform + premium specialists, registered Claude Code agent types, and the brand block as a single JSON object; the canonical tool for grounding any claim about what is enabled on the current account), linkedin-ingest-token (returns the account's durable LinkedIn ingest token — the one credential the Maxy LinkedIn Ingest Chrome extension needs in its options page; minted on first call then stable across restarts and new chat sessions, and never a conversation session key nor the admin browser's session_key, which the ingest route rejects; action='rotate' replaces it and invalidates every existing extension install), account-update, the multi-account managed-service lifecycle tools (account_list, account_create, account_delete, account_purge, account_channel_routing, account_channel_routing_set — one Rubytech operator hosting N client accounts on one house install; create/delete/purge are operator-only and purge is two-step with a typed confirmation; account_create requires the client business owner's real name (ownerName), refusing a blank or the placeholder \"Owner\" and seeding it onto the sub-account's owner AdminUser and owner Person, and requires the owner's IANA timezone (timezone) — refusing a blank or a non-IANA value — seeding it onto the owner UserProfile marked owner-set so scheduling reads the owner's real zone from the start rather than the box's server default, while a managing house admin (its userId) is optional — when supplied it is validated as a live house admin and recorded as the sub-account's managingAdminUserId, and when omitted the sub-account is unmanaged and its passive-intake tasks route to the install's primary admin; account_reassign_admin repoints a client sub-account's managing admin to another live house admin (the repair path for a dangling managingAdminUserId, or to record one on an unmanaged account); account_roster is the canonical per-account identity view — one row per sub-account giving business name, role, the managing house admin resolved to a name with status (assigned/absent/dangling), the business owner from the graph with status (named/nameless), and the WhatsApp account-manager binding if any, each field carrying what it means and does not (managing admin is the responsible house team member not the owner; account manager is WhatsApp routing only with no admin rights), so the agent never stitches admin-list + account.json + whatsapp-config; account_set_owner_name names (or corrects) a client sub-account's business owner by writing the owned Person — the canonical name source — refusing a blank or the placeholder \"Owner\", the guarded repair for a nameless owner (the standing identity-audit op=nameless-owned-person detector); account_channel_routing_set repoints the house-paired WhatsApp/Telegram inbound stream to a different sub-account, and does not affect a sub-account's own separately paired WhatsApp number), admin-add (refuses on a client sub-account, where admin access is already install-wide so a per-operator seat grants nothing — the sub-account's one identity, its business owner, is set at account creation; the house account, where operators hold PIN logins and admins[] rows, is unchanged), admin-remove (refuses to remove a house admin who still manages one or more client sub-accounts, naming them so the operator reassigns each with account_reassign_admin first — never silently orphans them), admin-list, admin-update-pin, agent-list, agent-config-read, the public-agent write tools (agent-create is the only supported way to create a public agent: it validates the slug against the same rule the router serves by, validates config.json against the servable schema, refuses an empty KNOWLEDGE, writes the four files with IDENTITY.md copied verbatim from the platform template, and projects the agent into the graph in the same call, reporting the verified projected count rather than assuming it; agent-update applies the same validation to a merged config, writes only the fields supplied, and re-projects, so the graph cannot fall behind the files; agent-delete removes the :Agent node and its owned knowledge projections before the directory and refuses the admin agent — writing these files by hand reaches none of those checks, which is what left an agent on disk and absent from the graph for a day), agent-image, plugin-toggle-enabled, premium-list, premium-deliver, skill-find, logs-read, cpu-triage-start and cpu-triage-read (the two-call device CPU diagnostic — start spawns a detached sampling run across at least one full 120s reconcile cycle and returns a run handle immediately, read returns running/complete/failed with the per-core distribution; no admin tool blocks through a sampling window, and no spot reading is obtainable), plugin-read, skill-load (one-call resolve+read for SKILL.md by skill name, the canonical primitive for loading a named skill; plugin-read remains the reader for references/* and PLUGIN.md), skill-search (free-text intent → skill resolver: ranks every plugin skill's SKILL.md name+description against a query and returns the top owners with their canonical skills/<slug>/ path, so intent→skill mapping survives the available-skills menu leaving context after a compaction), store-skill (deterministic write counterpart to plugin-read; persists operator-authored skills as plugin files under the active account), session-reset, session-resume, wifi, and action-approval tools (action-pending, action-approve, action-reject, action-edit) for managing the Maxy platform.",
|
|
3
|
+
"description": "Platform administration plugin. Provides system-status, public-hostname (deterministic Cloudflare public-URL resolver, single call returning the operator's canonical hostname so agents never guess property names on :CloudflareHostname nodes), admin-hostname (the admin-host twin of public-hostname — resolves the host that serves /calendar and the rest of the admin shell behind sign-in from the same ingress + alias + operator files, so agents point the operator at the admin /calendar URL instead of the public host that 404s it), publish-site (move an extracted static-site tree under <accountDir>/sites/<slug>/, emit one canonical path slug, and refresh llms.txt at the site root — typed refusal taxonomy replaces the prior skill-prose contract), brand-settings, account-manage, capabilities-here (deterministic install-introspection — returns enabledPlugins, tier, models, installed platform + premium specialists, registered Claude Code agent types, and the brand block as a single JSON object; the canonical tool for grounding any claim about what is enabled on the current account), linkedin-ingest-token (returns the account's durable LinkedIn ingest token — the one credential the Maxy LinkedIn Ingest Chrome extension needs in its options page; minted on first call then stable across restarts and new chat sessions, and never a conversation session key nor the admin browser's session_key, which the ingest route rejects; action='rotate' replaces it and invalidates every existing extension install), account-update, the multi-account managed-service lifecycle tools (account_list, account_create, account_delete, account_purge, account_channel_routing, account_channel_routing_set — one Rubytech operator hosting N client accounts on one house install; create/delete/purge are operator-only and purge is two-step with a typed confirmation; account_create requires the client business owner's real name (ownerName), refusing a blank or the placeholder \"Owner\" and seeding it onto the sub-account's owner AdminUser and owner Person, and requires the owner's IANA timezone (timezone) — refusing a blank or a non-IANA value — seeding it onto the owner UserProfile marked owner-set so scheduling reads the owner's real zone from the start rather than the box's server default, while a managing house admin (its userId) is optional — when supplied it is validated as a live house admin and recorded as the sub-account's managingAdminUserId, and when omitted the sub-account is unmanaged and its passive-intake tasks route to the install's primary admin; account_reassign_admin repoints a client sub-account's managing admin to another live house admin (the repair path for a dangling managingAdminUserId, or to record one on an unmanaged account); account_roster is the canonical per-account identity view — one row per sub-account giving business name, role, the managing house admin resolved to a name with status (assigned/absent/dangling), the business owner from the graph with status (named/nameless), and the WhatsApp account-manager binding if any, each field carrying what it means and does not (managing admin is the responsible house team member not the owner; account manager is WhatsApp routing only with no admin rights), so the agent never stitches admin-list + account.json + whatsapp-config; account_set_owner_name names (or corrects) a client sub-account's business owner by writing the owned Person — the canonical name source — refusing a blank or the placeholder \"Owner\", the guarded repair for a nameless owner (the standing identity-audit op=nameless-owned-person detector); account_channel_routing_set repoints the house-paired WhatsApp/Telegram inbound stream to a different sub-account, and does not affect a sub-account's own separately paired WhatsApp number), admin-add (refuses on a client sub-account, where admin access is already install-wide so a per-operator seat grants nothing — the sub-account's one identity, its business owner, is set at account creation; the house account, where operators hold PIN logins and admins[] rows, is unchanged), admin-remove (refuses to remove a house admin who still manages one or more client sub-accounts, naming them so the operator reassigns each with account_reassign_admin first — never silently orphans them), admin-list, admin-update-pin, admin-bind (sets the phone and/or Telegram chat id on an admin's users.json entry — the binding resolveAdminUserId reads; without it a channel turn from that person resolves to no admin and the answer reaches only the door it arrived on, while a new admin is born bound by passing the same fields to admin-add. Defaults to the calling admin and routes an explicit userId through the same cross-identity gate the PIN tools use, requiring confirm=true, because a binding decides whose identity an inbound resolves to), agent-list, agent-config-read, the public-agent write tools (agent-create is the only supported way to create a public agent: it validates the slug against the same rule the router serves by, validates config.json against the servable schema, refuses an empty KNOWLEDGE, writes the four files with IDENTITY.md copied verbatim from the platform template, and projects the agent into the graph in the same call, reporting the verified projected count rather than assuming it; agent-update applies the same validation to a merged config, writes only the fields supplied, and re-projects, so the graph cannot fall behind the files; agent-delete removes the :Agent node and its owned knowledge projections before the directory and refuses the admin agent — writing these files by hand reaches none of those checks, which is what left an agent on disk and absent from the graph for a day), agent-image, plugin-toggle-enabled, premium-list, premium-deliver, skill-find, logs-read, cpu-triage-start and cpu-triage-read (the two-call device CPU diagnostic — start spawns a detached sampling run across at least one full 120s reconcile cycle and returns a run handle immediately, read returns running/complete/failed with the per-core distribution; no admin tool blocks through a sampling window, and no spot reading is obtainable), plugin-read, skill-load (one-call resolve+read for SKILL.md by skill name, the canonical primitive for loading a named skill; plugin-read remains the reader for references/* and PLUGIN.md), skill-search (free-text intent → skill resolver: ranks every plugin skill's SKILL.md name+description against a query and returns the top owners with their canonical skills/<slug>/ path, so intent→skill mapping survives the available-skills menu leaving context after a compaction), store-skill (deterministic write counterpart to plugin-read; persists operator-authored skills as plugin files under the active account), session-reset, session-resume, wifi, and action-approval tools (action-pending, action-approve, action-reject, action-edit) for managing the Maxy platform.",
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Rubytech LLC"
|