@rubytech/create-maxy-code 0.1.434 → 0.1.435
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/embed-client/dist/index.d.ts +1 -1
- package/payload/platform/lib/embed-client/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/embed-client/dist/index.js +73 -25
- package/payload/platform/lib/embed-client/dist/index.js.map +1 -1
- package/payload/platform/lib/embed-client/src/index.ts +77 -25
- package/payload/platform/plugins/admin/PLUGIN.md +1 -0
- package/payload/platform/plugins/admin/hooks/__tests__/askuserquestion-channel-carrier-gate.test.sh +175 -0
- package/payload/platform/plugins/admin/hooks/askuserquestion-channel-carrier-gate.sh +137 -0
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +2 -2
- package/payload/platform/plugins/docs/references/internals.md +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/embed-throughput.test.js +161 -19
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/embed-throughput.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/embed-timeout.test.js +11 -9
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/embed-timeout.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/embeddings-cap.test.js +9 -5
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/embeddings-cap.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-own-preference-selfheal.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-own-preference-selfheal.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-own-preference-selfheal.test.js +113 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-own-preference-selfheal.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-reconcile.test.js +6 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-reconcile.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.js +47 -4
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.js.map +1 -1
- package/payload/platform/scripts/lib/provision-account-dir.sh +2 -1
- package/payload/platform/services/claude-session-manager/dist/index.js +20 -0
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/interactive-wedge.d.ts +42 -0
- package/payload/platform/services/claude-session-manager/dist/interactive-wedge.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/interactive-wedge.js +149 -0
- package/payload/platform/services/claude-session-manager/dist/interactive-wedge.js.map +1 -0
- package/payload/server/{chunk-UUG6ZSO5.js → chunk-DAYMXQG2.js} +28 -0
- package/payload/server/maxy-edge.js +1 -1
- package/payload/server/server.js +6 -5
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// Task 1552 — interactive-wedge classifier (pure) + standing check.
|
|
2
|
+
//
|
|
3
|
+
// A native-channel session can wedge on an un-carried interactive tool. The
|
|
4
|
+
// channel protocol carries only the two permission methods; AskUserQuestion
|
|
5
|
+
// (and any future elicitation tool) has no carrier, so its tool_use blocks the
|
|
6
|
+
// turn awaiting a verdict that never arrives. The askuserquestion-channel-
|
|
7
|
+
// carrier-gate hook blocks AskUserQuestion deterministically on channel
|
|
8
|
+
// sessions — but a *blocked* call carries a tool_result (the exit-2 denial), so
|
|
9
|
+
// it is "resolved" and never reaches this check. This standing check is the
|
|
10
|
+
// residual net: it flags a channel session whose latest interactive tool_use is
|
|
11
|
+
// still UNRESOLVED (no matching tool_result), catching a recurrence from a new
|
|
12
|
+
// un-carried tool, or from this tool if the hook were absent. A wedged turn
|
|
13
|
+
// otherwise emits no distinct signal (the busy poll looks identical to work),
|
|
14
|
+
// so this is the missing instrumentation the incident had no event for.
|
|
15
|
+
//
|
|
16
|
+
// `classifyInteractiveWedge` is pure over a tail of records;
|
|
17
|
+
// `createInteractiveWedgeWatch` runs it on a timer against live channel
|
|
18
|
+
// sessions and logs a lifeline. It never recycles — this is observability, not
|
|
19
|
+
// recovery.
|
|
20
|
+
import { readJsonlTailRecords } from './stuck-turn.js';
|
|
21
|
+
/** Interactive harness tools the native channel protocol cannot carry. A future
|
|
22
|
+
* un-carried elicitation tool is a one-line addition here. */
|
|
23
|
+
const NON_CARRIED_INTERACTIVE_TOOLS = new Set(['AskUserQuestion']);
|
|
24
|
+
function assistantInteractiveToolUses(rec) {
|
|
25
|
+
if (rec.type !== 'assistant')
|
|
26
|
+
return [];
|
|
27
|
+
const msg = rec.message;
|
|
28
|
+
if (!msg || typeof msg !== 'object' || Array.isArray(msg))
|
|
29
|
+
return [];
|
|
30
|
+
const content = msg.content;
|
|
31
|
+
if (!Array.isArray(content))
|
|
32
|
+
return [];
|
|
33
|
+
const out = [];
|
|
34
|
+
for (const b of content) {
|
|
35
|
+
if (!b || typeof b !== 'object')
|
|
36
|
+
continue;
|
|
37
|
+
const block = b;
|
|
38
|
+
if (block.type !== 'tool_use')
|
|
39
|
+
continue;
|
|
40
|
+
const name = block.name;
|
|
41
|
+
const id = block.id;
|
|
42
|
+
if (typeof name === 'string' && typeof id === 'string' && NON_CARRIED_INTERACTIVE_TOOLS.has(name)) {
|
|
43
|
+
out.push({ id, name });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
function toolResultIds(rec) {
|
|
49
|
+
if (rec.type !== 'user')
|
|
50
|
+
return [];
|
|
51
|
+
const msg = rec.message;
|
|
52
|
+
if (!msg || typeof msg !== 'object' || Array.isArray(msg))
|
|
53
|
+
return [];
|
|
54
|
+
const content = msg.content;
|
|
55
|
+
if (!Array.isArray(content))
|
|
56
|
+
return [];
|
|
57
|
+
const out = [];
|
|
58
|
+
for (const b of content) {
|
|
59
|
+
if (!b || typeof b !== 'object')
|
|
60
|
+
continue;
|
|
61
|
+
const block = b;
|
|
62
|
+
if (block.type === 'tool_result' && typeof block.tool_use_id === 'string') {
|
|
63
|
+
out.push(block.tool_use_id);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
function isEnqueue(rec) {
|
|
69
|
+
return rec.type === 'queue-operation' && rec.operation === 'enqueue';
|
|
70
|
+
}
|
|
71
|
+
/** Pure classifier. Finds the LAST non-carried interactive tool_use; reports it
|
|
72
|
+
* wedged when no later record carries a tool_result with that tool_use's id. */
|
|
73
|
+
export function classifyInteractiveWedge(records) {
|
|
74
|
+
let lastIdx = -1;
|
|
75
|
+
let lastId = null;
|
|
76
|
+
let lastName = null;
|
|
77
|
+
for (let i = 0; i < records.length; i++) {
|
|
78
|
+
const uses = assistantInteractiveToolUses(records[i]);
|
|
79
|
+
if (uses.length > 0) {
|
|
80
|
+
// The last such block in the last such record.
|
|
81
|
+
const u = uses[uses.length - 1];
|
|
82
|
+
lastIdx = i;
|
|
83
|
+
lastId = u.id;
|
|
84
|
+
lastName = u.name;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (lastIdx === -1 || lastId === null) {
|
|
88
|
+
return { wedged: false, tool: null, pendingInbound: 0 };
|
|
89
|
+
}
|
|
90
|
+
let resolved = false;
|
|
91
|
+
let pendingInbound = 0;
|
|
92
|
+
for (let i = lastIdx + 1; i < records.length; i++) {
|
|
93
|
+
if (toolResultIds(records[i]).includes(lastId))
|
|
94
|
+
resolved = true;
|
|
95
|
+
if (isEnqueue(records[i]))
|
|
96
|
+
pendingInbound += 1;
|
|
97
|
+
}
|
|
98
|
+
if (resolved) {
|
|
99
|
+
return { wedged: false, tool: lastName, pendingInbound: 0 };
|
|
100
|
+
}
|
|
101
|
+
return { wedged: true, tool: lastName, pendingInbound };
|
|
102
|
+
}
|
|
103
|
+
export function createInteractiveWedgeWatch(deps) {
|
|
104
|
+
const readTail = deps.readTail ?? ((p) => readJsonlTailRecords(p));
|
|
105
|
+
let timer = null;
|
|
106
|
+
let started = false;
|
|
107
|
+
function tickOnce() {
|
|
108
|
+
let scanned = 0;
|
|
109
|
+
let wedged = 0;
|
|
110
|
+
try {
|
|
111
|
+
const candidates = deps.candidates();
|
|
112
|
+
scanned = candidates.length;
|
|
113
|
+
for (const cand of candidates) {
|
|
114
|
+
const records = readTail(cand.jsonlPath);
|
|
115
|
+
const v = classifyInteractiveWedge(records);
|
|
116
|
+
if (!v.wedged)
|
|
117
|
+
continue;
|
|
118
|
+
wedged += 1;
|
|
119
|
+
deps.logger(`[interactive-wedge] op=interactive-wedge sessionId=${cand.sessionId.slice(0, 8)} tool=${v.tool} turns=${v.pendingInbound}`);
|
|
120
|
+
}
|
|
121
|
+
deps.logger(`[interactive-wedge] tick scanned=${scanned} wedged=${wedged}`);
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
deps.logger(`[interactive-wedge] tick-failed message=${JSON.stringify(err instanceof Error ? err.message : String(err))}`);
|
|
125
|
+
}
|
|
126
|
+
return { scanned, wedged };
|
|
127
|
+
}
|
|
128
|
+
function start() {
|
|
129
|
+
if (started)
|
|
130
|
+
return;
|
|
131
|
+
started = true;
|
|
132
|
+
timer = setInterval(tickOnce, deps.intervalMs);
|
|
133
|
+
if (typeof timer.unref === 'function')
|
|
134
|
+
timer.unref();
|
|
135
|
+
deps.logger(`[interactive-wedge] started intervalMs=${deps.intervalMs}`);
|
|
136
|
+
}
|
|
137
|
+
function stop() {
|
|
138
|
+
if (!started)
|
|
139
|
+
return;
|
|
140
|
+
if (timer) {
|
|
141
|
+
clearInterval(timer);
|
|
142
|
+
timer = null;
|
|
143
|
+
}
|
|
144
|
+
started = false;
|
|
145
|
+
deps.logger(`[interactive-wedge] stopped`);
|
|
146
|
+
}
|
|
147
|
+
return { start, stop, tickOnce };
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=interactive-wedge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactive-wed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AK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAC9G,CAAA;QACH,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;IAC5B,CAAC;IAED,SAAS,KAAK;QACZ,IAAI,OAAO;YAAE,OAAM;QACnB,OAAO,GAAG,IAAI,CAAA;QACd,KAAK,GAAG,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;QAC9C,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU;YAAE,KAAK,CAAC,KAAK,EAAE,CAAA;QACpD,IAAI,CAAC,MAAM,CAAC,0CAA0C,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;IAC1E,CAAC;IAED,SAAS,IAAI;QACX,IAAI,CAAC,OAAO;YAAE,OAAM;QACpB,IAAI,KAAK,EAAE,CAAC;YAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAAC,KAAK,GAAG,IAAI,CAAA;QAAC,CAAC;QACjD,OAAO,GAAG,KAAK,CAAA;QACf,IAAI,CAAC,MAAM,CAAC,6BAA6B,CAAC,CAAA;IAC5C,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;AAClC,CAAC"}
|
|
@@ -5137,6 +5137,33 @@ async function loadAdminUserName(accountId, userId) {
|
|
|
5137
5137
|
await session.close();
|
|
5138
5138
|
}
|
|
5139
5139
|
}
|
|
5140
|
+
async function loadAdminDisplayIdentity(accountId, userId) {
|
|
5141
|
+
const session = getSession();
|
|
5142
|
+
try {
|
|
5143
|
+
const result = await session.run(
|
|
5144
|
+
`MATCH (au:AdminUser {userId: $userId})
|
|
5145
|
+
OPTIONAL MATCH (au)-[:OWNS]->(p:Person {accountId: $accountId})
|
|
5146
|
+
RETURN au.name AS name, p.avatar AS avatar
|
|
5147
|
+
LIMIT 1`,
|
|
5148
|
+
{ accountId, userId }
|
|
5149
|
+
);
|
|
5150
|
+
if (result.records.length === 0) {
|
|
5151
|
+
return { source: "fallback", reason: "no-admin-user" };
|
|
5152
|
+
}
|
|
5153
|
+
const name = result.records[0].get("name");
|
|
5154
|
+
const avatar = result.records[0].get("avatar");
|
|
5155
|
+
if (!name || name.trim().length === 0) {
|
|
5156
|
+
return { source: "fallback", reason: "no-name" };
|
|
5157
|
+
}
|
|
5158
|
+
const trimmedAvatar = avatar && avatar.trim().length > 0 ? avatar.trim() : null;
|
|
5159
|
+
return { source: "admin-user", name: name.trim(), avatar: trimmedAvatar };
|
|
5160
|
+
} catch (err) {
|
|
5161
|
+
console.error(`[admin-identity] loadAdminDisplayIdentity failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
5162
|
+
return { source: "fallback", reason: "neo4j-unreachable" };
|
|
5163
|
+
} finally {
|
|
5164
|
+
await session.close();
|
|
5165
|
+
}
|
|
5166
|
+
}
|
|
5140
5167
|
async function loadPersonNameByElementId(accountId, personId) {
|
|
5141
5168
|
const session = getSession();
|
|
5142
5169
|
try {
|
|
@@ -5988,6 +6015,7 @@ export {
|
|
|
5988
6015
|
renameConversation,
|
|
5989
6016
|
getUserTimezone,
|
|
5990
6017
|
loadAdminUserName,
|
|
6018
|
+
loadAdminDisplayIdentity,
|
|
5991
6019
|
loadPersonNameByElementId,
|
|
5992
6020
|
writeAdminUserAndPerson,
|
|
5993
6021
|
loadUserProfile,
|
package/payload/server/server.js
CHANGED
|
@@ -70,6 +70,7 @@ import {
|
|
|
70
70
|
linkConversationTranscript,
|
|
71
71
|
listAdminSessions,
|
|
72
72
|
listValidAccounts,
|
|
73
|
+
loadAdminDisplayIdentity,
|
|
73
74
|
loadAdminUserName,
|
|
74
75
|
loadPersonNameByElementId,
|
|
75
76
|
loadUserProfile,
|
|
@@ -111,7 +112,7 @@ import {
|
|
|
111
112
|
vncLog,
|
|
112
113
|
walkPremiumBundles,
|
|
113
114
|
writeAdminUserAndPerson
|
|
114
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-DAYMXQG2.js";
|
|
115
116
|
import {
|
|
116
117
|
__commonJS,
|
|
117
118
|
__toESM
|
|
@@ -12163,10 +12164,10 @@ var client_error_default = app10;
|
|
|
12163
12164
|
// server/routes/admin/session.ts
|
|
12164
12165
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
12165
12166
|
async function resolveUserIdentity(accountId, userId) {
|
|
12166
|
-
const result = await
|
|
12167
|
-
if (result.source === "
|
|
12168
|
-
console.log(`[admin-identity] userName-source=
|
|
12169
|
-
return { userName: result.
|
|
12167
|
+
const result = await loadAdminDisplayIdentity(accountId, userId);
|
|
12168
|
+
if (result.source === "admin-user") {
|
|
12169
|
+
console.log(`[admin-identity] userName-source=admin-user userId=${userId.slice(0, 8)} accountId=${accountId.slice(0, 8)} name=${result.name} avatar=${result.avatar ? "present" : "absent"}`);
|
|
12170
|
+
return { userName: result.name, avatar: result.avatar };
|
|
12170
12171
|
}
|
|
12171
12172
|
console.log(`[admin-identity] userName-source=fallback reason=${result.reason} userId=${userId.slice(0, 8)} accountId=${accountId.slice(0, 8)}`);
|
|
12172
12173
|
const userName = result.reason === "neo4j-unreachable" ? "Owner" : void 0;
|