happy-imou-cloud 2.1.41 → 2.1.43
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/dist/{BaseReasoningProcessor-Dica2zdX.mjs → BaseReasoningProcessor-CWCPAVJ3.mjs} +4 -2
- package/dist/{BaseReasoningProcessor-DAPsauUX.cjs → BaseReasoningProcessor-D6itItnT.cjs} +4 -2
- package/dist/{ProviderSelectionHandler-4nuTd8AP.cjs → ProviderSelectionHandler-CXwqOJpC.cjs} +2 -2
- package/dist/{ProviderSelectionHandler-CmeZ92yO.mjs → ProviderSelectionHandler-CYUH1U8F.mjs} +2 -2
- package/dist/{api-CwNEbJBM.mjs → api-B89O-SC-.mjs} +398 -43
- package/dist/{api-C_Tnx4UG.cjs → api-zMic8QXq.cjs} +399 -42
- package/dist/{command-D0FxDynx.mjs → command-W01qXC9C.mjs} +2 -2
- package/dist/{command-C3RwwPVD.cjs → command-_qNFoJ-l.cjs} +2 -2
- package/dist/{index-D5m2Duxd.mjs → index-CiHiCC31.mjs} +31 -16
- package/dist/{index-Dh0qGrEd.cjs → index-DVVbyQGZ.cjs} +34 -19
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +1041 -214
- package/dist/lib.d.mts +1041 -214
- package/dist/lib.mjs +1 -1
- package/dist/{registerKillSessionHandler-6JloVYkb.mjs → registerKillSessionHandler-BnS3ozFX.mjs} +274 -101
- package/dist/{registerKillSessionHandler-Bkh8uLhC.cjs → registerKillSessionHandler-CDYAY5Ev.cjs} +274 -101
- package/dist/{runClaude-Bng_IsE7.mjs → runClaude-0U7kV07_.mjs} +13 -4
- package/dist/{runClaude-mIFO7YxF.cjs → runClaude-C1xfptKt.cjs} +14 -5
- package/dist/{runCodex-cNuxGshy.cjs → runCodex-BBgKpYLO.cjs} +20 -6
- package/dist/{runCodex-DAc6flez.mjs → runCodex-DnDmHm7E.mjs} +19 -5
- package/dist/{runGemini-DsRFV8WN.cjs → runGemini-CUwQHJ9y.cjs} +21 -5
- package/dist/{runGemini-DdXj8ltI.mjs → runGemini-DcsIBQSc.mjs} +20 -4
- package/package.json +1 -1
package/dist/{registerKillSessionHandler-Bkh8uLhC.cjs → registerKillSessionHandler-CDYAY5Ev.cjs}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var persistence = require('./api-
|
|
3
|
+
var index = require('./index-DVVbyQGZ.cjs');
|
|
4
|
+
var persistence = require('./api-zMic8QXq.cjs');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
6
|
var path = require('node:path');
|
|
7
|
-
var crypto = require('crypto');
|
|
8
7
|
require('axios');
|
|
9
8
|
require('node:events');
|
|
10
9
|
require('node:fs/promises');
|
|
11
10
|
require('socket.io-client');
|
|
12
11
|
require('tweetnacl');
|
|
13
12
|
require('fs/promises');
|
|
13
|
+
require('crypto');
|
|
14
14
|
require('path');
|
|
15
15
|
require('node:child_process');
|
|
16
16
|
require('chalk');
|
|
@@ -117,11 +117,11 @@ function renderTerminalOutputPreview(value, opts) {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
const DISPLAY_FRIENDLY_TOOL_FIELDS = ["stdout", "stderr", "output", "text", "message", "detail", "reason", "data"];
|
|
120
|
-
function isRecord$
|
|
120
|
+
function isRecord$2(value) {
|
|
121
121
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
122
122
|
}
|
|
123
123
|
function stripInternalToolMeta(value) {
|
|
124
|
-
if (!isRecord$
|
|
124
|
+
if (!isRecord$2(value)) {
|
|
125
125
|
return value;
|
|
126
126
|
}
|
|
127
127
|
const {
|
|
@@ -142,7 +142,7 @@ function extractNestedTextContent(value) {
|
|
|
142
142
|
const parts = value.map((item) => extractNestedTextContent(item)).filter((item) => typeof item === "string" && item.length > 0);
|
|
143
143
|
return parts.length > 0 ? parts.join("\n") : null;
|
|
144
144
|
}
|
|
145
|
-
if (!isRecord$
|
|
145
|
+
if (!isRecord$2(value)) {
|
|
146
146
|
return null;
|
|
147
147
|
}
|
|
148
148
|
if (typeof value.text === "string" && value.text.trim().length > 0) {
|
|
@@ -162,7 +162,7 @@ function humanizeToolLabel(rawToolName) {
|
|
|
162
162
|
return spaced.charAt(0).toUpperCase() + spaced.slice(1).toLowerCase();
|
|
163
163
|
}
|
|
164
164
|
function isToolLifecycleResult(value) {
|
|
165
|
-
if (!isRecord$
|
|
165
|
+
if (!isRecord$2(value)) {
|
|
166
166
|
return false;
|
|
167
167
|
}
|
|
168
168
|
return typeof value.state === "string" && ("messages" in value || "description" in value || "createdAt" in value || "startedAt" in value || "completedAt" in value);
|
|
@@ -211,7 +211,7 @@ function normalizeCodexToolOutput(rawToolName, value) {
|
|
|
211
211
|
if (index.isTerminalReferenceOnlyPayload(normalizedLifecyclePayload)) {
|
|
212
212
|
return void 0;
|
|
213
213
|
}
|
|
214
|
-
if (!isRecord$
|
|
214
|
+
if (!isRecord$2(normalizedLifecyclePayload)) {
|
|
215
215
|
return normalizedLifecyclePayload;
|
|
216
216
|
}
|
|
217
217
|
const hasDisplayFriendlyField = DISPLAY_FRIENDLY_TOOL_FIELDS.some((field) => field in normalizedLifecyclePayload);
|
|
@@ -238,7 +238,7 @@ function truncateProviderOutputValue(value, label, seen = /* @__PURE__ */ new We
|
|
|
238
238
|
if (Array.isArray(value)) {
|
|
239
239
|
return renderOutputPreview(value, label);
|
|
240
240
|
}
|
|
241
|
-
if (!isRecord$
|
|
241
|
+
if (!isRecord$2(value)) {
|
|
242
242
|
return value;
|
|
243
243
|
}
|
|
244
244
|
if (seen.has(value)) {
|
|
@@ -309,7 +309,7 @@ function hasDisplayPayload(value) {
|
|
|
309
309
|
if (Array.isArray(sanitized)) {
|
|
310
310
|
return sanitized.length > 0;
|
|
311
311
|
}
|
|
312
|
-
if (isRecord$
|
|
312
|
+
if (isRecord$2(sanitized)) {
|
|
313
313
|
return Object.keys(sanitized).length > 0;
|
|
314
314
|
}
|
|
315
315
|
return true;
|
|
@@ -509,7 +509,7 @@ async function syncControlledByUserState(sessionClient, controlledByUser) {
|
|
|
509
509
|
const SESSION_LABEL_MAX_LENGTH = 60;
|
|
510
510
|
const TITLE_MAX_LENGTH = 80;
|
|
511
511
|
const BODY_MAX_LENGTH = 140;
|
|
512
|
-
function isRecord(value) {
|
|
512
|
+
function isRecord$1(value) {
|
|
513
513
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
514
514
|
}
|
|
515
515
|
function normalizeText(value) {
|
|
@@ -660,7 +660,7 @@ function humanizeToolName(toolName) {
|
|
|
660
660
|
return normalized.replace(/[_-]+/g, " ");
|
|
661
661
|
}
|
|
662
662
|
function extractPermissionRequestPushContext(message) {
|
|
663
|
-
const payload = isRecord(message.payload) ? message.payload : null;
|
|
663
|
+
const payload = isRecord$1(message.payload) ? message.payload : null;
|
|
664
664
|
const toolName = normalizeText(payload?.toolName) ?? normalizeText(message.reason);
|
|
665
665
|
const payloadDescription = normalizeText(payload?.description);
|
|
666
666
|
const reasonDescription = normalizeText(message.reason);
|
|
@@ -1616,7 +1616,7 @@ function normalizeTurnReportDraft(draft) {
|
|
|
1616
1616
|
interventionType: inferInterventionType(draft),
|
|
1617
1617
|
blockerCode: normalizeOptionalText(draft?.blockerCode),
|
|
1618
1618
|
decisionNeeded: normalizeOptionalText(draft?.decisionNeeded),
|
|
1619
|
-
targetArtifact:
|
|
1619
|
+
targetArtifact: persistence.normalizePreviewableArtifactTarget(draft?.targetArtifact),
|
|
1620
1620
|
accessChannelState: normalizeAccessChannelState(draft?.accessChannelState)
|
|
1621
1621
|
};
|
|
1622
1622
|
}
|
|
@@ -1648,7 +1648,7 @@ function extractTaggedTurnReport(text) {
|
|
|
1648
1648
|
interventionType: normalizeOptionalText(parsed.interventionType),
|
|
1649
1649
|
blockerCode: normalizeOptionalText(parsed.blockerCode),
|
|
1650
1650
|
decisionNeeded: normalizeOptionalText(parsed.decisionNeeded),
|
|
1651
|
-
targetArtifact:
|
|
1651
|
+
targetArtifact: persistence.normalizePreviewableArtifactTarget(parsed.targetArtifact),
|
|
1652
1652
|
accessChannelState: normalizeAccessChannelState(parsed.accessChannelState)
|
|
1653
1653
|
};
|
|
1654
1654
|
} catch {
|
|
@@ -1778,6 +1778,8 @@ function buildHappyOrgTurnPrompt(prompt, turn) {
|
|
|
1778
1778
|
"Use turnStatus=task_complete only when you believe the assigned task is finished and ready for CEO acceptance.",
|
|
1779
1779
|
"If turnStatus=task_complete, the task will wait for CEO close; do not treat it as automatically closed.",
|
|
1780
1780
|
"If turnStatus=task_complete, interventionType must be review_needed.",
|
|
1781
|
+
"targetArtifact must be null or a concrete previewable file target. Use a repo-relative path, absolute path, file:// URL, or https:// URL when you actually produced a material or artifact the client should open directly.",
|
|
1782
|
+
"Do not use abstract labels like release-checklist-template or completion-board-template in targetArtifact.",
|
|
1781
1783
|
`summary must fit on a one-line CEO card or task-board card: short, actionable, no long process logs, max ${persistence.HAPPY_ORG_SUMMARY_MAX_LENGTH} characters.`,
|
|
1782
1784
|
"Use blocker only for problems the organization may still solve internally.",
|
|
1783
1785
|
"Use decision_needed only when a CEO or user decision is required.",
|
|
@@ -2181,6 +2183,263 @@ class MessageBuffer {
|
|
|
2181
2183
|
}
|
|
2182
2184
|
}
|
|
2183
2185
|
|
|
2186
|
+
function isRecord(value) {
|
|
2187
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2188
|
+
}
|
|
2189
|
+
function hasClaudeCompatibilityShadow(value) {
|
|
2190
|
+
if (!isRecord(value)) {
|
|
2191
|
+
return false;
|
|
2192
|
+
}
|
|
2193
|
+
if (typeof value.happyCompatibilityShadow === "string" && value.happyCompatibilityShadow.trim()) {
|
|
2194
|
+
return true;
|
|
2195
|
+
}
|
|
2196
|
+
const message = value.message;
|
|
2197
|
+
if (!isRecord(message) || !Array.isArray(message.content)) {
|
|
2198
|
+
return false;
|
|
2199
|
+
}
|
|
2200
|
+
return message.content.some((block) => isRecord(block) && typeof block.happyCompatibilityShadow === "string" && block.happyCompatibilityShadow.trim().length > 0);
|
|
2201
|
+
}
|
|
2202
|
+
function createSessionTranscriptInkRenderer(opts) {
|
|
2203
|
+
const streamedAssistantMessages = /* @__PURE__ */ new Map();
|
|
2204
|
+
const renderBufferedText = (text, type, streamMetadata) => {
|
|
2205
|
+
const normalizedText = text.trim();
|
|
2206
|
+
if (!normalizedText) {
|
|
2207
|
+
return;
|
|
2208
|
+
}
|
|
2209
|
+
const streamKey = typeof streamMetadata?.messageId === "string" ? streamMetadata.messageId : typeof streamMetadata?.id === "string" ? streamMetadata.id : null;
|
|
2210
|
+
const phase = typeof streamMetadata?.phase === "string" ? streamMetadata.phase : null;
|
|
2211
|
+
const updateMode = streamMetadata?.mode === "replace" || phase === "commit" ? "replace" : "append";
|
|
2212
|
+
if (phase === "abort") {
|
|
2213
|
+
if (streamKey) {
|
|
2214
|
+
const bufferedId = streamedAssistantMessages.get(streamKey);
|
|
2215
|
+
if (bufferedId) {
|
|
2216
|
+
opts.messageBuffer.removeMessage(bufferedId);
|
|
2217
|
+
streamedAssistantMessages.delete(streamKey);
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
return;
|
|
2221
|
+
}
|
|
2222
|
+
if (!streamKey) {
|
|
2223
|
+
opts.messageBuffer.addMessage(normalizedText, type);
|
|
2224
|
+
return;
|
|
2225
|
+
}
|
|
2226
|
+
const existingBufferedId = streamedAssistantMessages.get(streamKey);
|
|
2227
|
+
if (!existingBufferedId) {
|
|
2228
|
+
const nextBufferedId = opts.messageBuffer.addMessage(normalizedText, type);
|
|
2229
|
+
if (phase !== "commit") {
|
|
2230
|
+
streamedAssistantMessages.set(streamKey, nextBufferedId);
|
|
2231
|
+
}
|
|
2232
|
+
return;
|
|
2233
|
+
}
|
|
2234
|
+
const updated = opts.messageBuffer.updateMessage(existingBufferedId, normalizedText, {
|
|
2235
|
+
mode: updateMode
|
|
2236
|
+
});
|
|
2237
|
+
if (!updated) {
|
|
2238
|
+
const nextBufferedId = opts.messageBuffer.addMessage(normalizedText, type);
|
|
2239
|
+
if (phase !== "commit") {
|
|
2240
|
+
streamedAssistantMessages.set(streamKey, nextBufferedId);
|
|
2241
|
+
}
|
|
2242
|
+
return;
|
|
2243
|
+
}
|
|
2244
|
+
if (phase === "commit") {
|
|
2245
|
+
streamedAssistantMessages.delete(streamKey);
|
|
2246
|
+
}
|
|
2247
|
+
};
|
|
2248
|
+
const renderStructuredAgentPayload = (payload) => {
|
|
2249
|
+
if (!isRecord(payload) || typeof payload.type !== "string") {
|
|
2250
|
+
return;
|
|
2251
|
+
}
|
|
2252
|
+
switch (payload.type) {
|
|
2253
|
+
case "message":
|
|
2254
|
+
case "reasoning": {
|
|
2255
|
+
if (typeof payload.message !== "string") {
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
renderBufferedText(
|
|
2259
|
+
payload.message,
|
|
2260
|
+
payload.type === "reasoning" ? "status" : "assistant",
|
|
2261
|
+
payload
|
|
2262
|
+
);
|
|
2263
|
+
return;
|
|
2264
|
+
}
|
|
2265
|
+
case "thinking": {
|
|
2266
|
+
if (typeof payload.text === "string" && payload.text.trim()) {
|
|
2267
|
+
opts.messageBuffer.addMessage(`[Thinking] ${payload.text.trim()}`, "status");
|
|
2268
|
+
}
|
|
2269
|
+
return;
|
|
2270
|
+
}
|
|
2271
|
+
case "tool-call": {
|
|
2272
|
+
const name = typeof payload.name === "string" ? payload.name : typeof payload.toolName === "string" ? payload.toolName : "tool";
|
|
2273
|
+
const inputPreview = index.truncateDisplayMessage(
|
|
2274
|
+
isRecord(payload.input) || Array.isArray(payload.input) ? JSON.stringify(payload.input) : payload.input,
|
|
2275
|
+
120
|
|
2276
|
+
);
|
|
2277
|
+
opts.messageBuffer.addMessage(
|
|
2278
|
+
`Executing: ${name}${inputPreview ? ` ${inputPreview}` : ""}`,
|
|
2279
|
+
"tool"
|
|
2280
|
+
);
|
|
2281
|
+
return;
|
|
2282
|
+
}
|
|
2283
|
+
case "tool-result":
|
|
2284
|
+
case "tool-call-result": {
|
|
2285
|
+
const resultValue = Object.prototype.hasOwnProperty.call(payload, "output") ? payload.output : payload.result;
|
|
2286
|
+
const resultPreview = index.truncateDisplayMessage(resultValue, 200);
|
|
2287
|
+
const prefix = payload.isError ? "Error:" : "Result:";
|
|
2288
|
+
opts.messageBuffer.addMessage(
|
|
2289
|
+
resultPreview ? `${prefix} ${resultPreview}` : "Tool completed",
|
|
2290
|
+
payload.isError ? "status" : "result"
|
|
2291
|
+
);
|
|
2292
|
+
return;
|
|
2293
|
+
}
|
|
2294
|
+
case "file-edit":
|
|
2295
|
+
case "fs-edit": {
|
|
2296
|
+
const description = typeof payload.description === "string" ? payload.description : "File edit";
|
|
2297
|
+
opts.messageBuffer.addMessage(`File edit: ${description}`, "tool");
|
|
2298
|
+
return;
|
|
2299
|
+
}
|
|
2300
|
+
case "terminal-output": {
|
|
2301
|
+
if (typeof payload.data !== "string") {
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
const preview = renderTerminalOutputPreview(payload.data);
|
|
2305
|
+
if (preview) {
|
|
2306
|
+
opts.messageBuffer.addMessage(preview, "result");
|
|
2307
|
+
}
|
|
2308
|
+
return;
|
|
2309
|
+
}
|
|
2310
|
+
case "permission-request": {
|
|
2311
|
+
const toolName = typeof payload.toolName === "string" ? payload.toolName : "tool";
|
|
2312
|
+
opts.messageBuffer.addMessage(`Permission requested: ${toolName}`, "status");
|
|
2313
|
+
return;
|
|
2314
|
+
}
|
|
2315
|
+
case "exec-approval-request": {
|
|
2316
|
+
opts.messageBuffer.addMessage("Exec approval requested", "status");
|
|
2317
|
+
return;
|
|
2318
|
+
}
|
|
2319
|
+
case "patch-apply-begin": {
|
|
2320
|
+
opts.messageBuffer.addMessage("Applying patch...", "tool");
|
|
2321
|
+
return;
|
|
2322
|
+
}
|
|
2323
|
+
case "patch-apply-end": {
|
|
2324
|
+
const completionMessage = payload.success === false ? index.truncateDisplayMessage(payload.stderr, 200) || "Patch failed" : index.truncateDisplayMessage(payload.stdout, 200) || "Patch applied";
|
|
2325
|
+
opts.messageBuffer.addMessage(completionMessage, payload.success === false ? "status" : "result");
|
|
2326
|
+
return;
|
|
2327
|
+
}
|
|
2328
|
+
case "event": {
|
|
2329
|
+
if (payload.name === "thinking" && isRecord(payload.payload) && typeof payload.payload.text === "string" && payload.payload.text.trim()) {
|
|
2330
|
+
opts.messageBuffer.addMessage(`[Thinking] ${payload.payload.text.trim()}`, "status");
|
|
2331
|
+
}
|
|
2332
|
+
return;
|
|
2333
|
+
}
|
|
2334
|
+
case "task_started":
|
|
2335
|
+
case "task_complete":
|
|
2336
|
+
case "turn_aborted":
|
|
2337
|
+
case "turn-report":
|
|
2338
|
+
case "token_count":
|
|
2339
|
+
case "token-count":
|
|
2340
|
+
return;
|
|
2341
|
+
default:
|
|
2342
|
+
return;
|
|
2343
|
+
}
|
|
2344
|
+
};
|
|
2345
|
+
const renderLegacyClaudeOutput = (payload) => {
|
|
2346
|
+
if (!isRecord(payload) || hasClaudeCompatibilityShadow(payload)) {
|
|
2347
|
+
return;
|
|
2348
|
+
}
|
|
2349
|
+
if (payload.type === "summary" && typeof payload.summary === "string" && payload.summary.trim()) {
|
|
2350
|
+
opts.messageBuffer.addMessage(payload.summary.trim(), "result");
|
|
2351
|
+
return;
|
|
2352
|
+
}
|
|
2353
|
+
if (payload.type !== "assistant") {
|
|
2354
|
+
return;
|
|
2355
|
+
}
|
|
2356
|
+
const message = isRecord(payload.message) ? payload.message : null;
|
|
2357
|
+
const content = message?.content;
|
|
2358
|
+
if (typeof content === "string" && content.trim()) {
|
|
2359
|
+
opts.messageBuffer.addMessage(content.trim(), "assistant");
|
|
2360
|
+
return;
|
|
2361
|
+
}
|
|
2362
|
+
if (!Array.isArray(content)) {
|
|
2363
|
+
return;
|
|
2364
|
+
}
|
|
2365
|
+
for (const block of content) {
|
|
2366
|
+
if (!isRecord(block) || typeof block.type !== "string") {
|
|
2367
|
+
continue;
|
|
2368
|
+
}
|
|
2369
|
+
if (block.type === "thinking" && typeof block.thinking === "string" && block.thinking.trim()) {
|
|
2370
|
+
opts.messageBuffer.addMessage(`[Thinking] ${block.thinking.trim()}`, "status");
|
|
2371
|
+
continue;
|
|
2372
|
+
}
|
|
2373
|
+
if (block.type === "text" && typeof block.text === "string" && block.text.trim()) {
|
|
2374
|
+
opts.messageBuffer.addMessage(block.text.trim(), "assistant");
|
|
2375
|
+
continue;
|
|
2376
|
+
}
|
|
2377
|
+
if (block.type === "tool_use") {
|
|
2378
|
+
const toolName = typeof block.name === "string" ? block.name : "tool";
|
|
2379
|
+
const inputPreview = index.truncateDisplayMessage(
|
|
2380
|
+
isRecord(block.input) || Array.isArray(block.input) ? JSON.stringify(block.input) : block.input,
|
|
2381
|
+
120
|
|
2382
|
+
);
|
|
2383
|
+
opts.messageBuffer.addMessage(
|
|
2384
|
+
`Executing: ${toolName}${inputPreview ? ` ${inputPreview}` : ""}`,
|
|
2385
|
+
"tool"
|
|
2386
|
+
);
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
};
|
|
2390
|
+
const renderSessionEvent = (payload) => {
|
|
2391
|
+
if (!isRecord(payload) || typeof payload.type !== "string") {
|
|
2392
|
+
return;
|
|
2393
|
+
}
|
|
2394
|
+
switch (payload.type) {
|
|
2395
|
+
case "message":
|
|
2396
|
+
if (typeof payload.message === "string" && payload.message.trim()) {
|
|
2397
|
+
opts.messageBuffer.addMessage(payload.message.trim(), "status");
|
|
2398
|
+
}
|
|
2399
|
+
return;
|
|
2400
|
+
case "switch":
|
|
2401
|
+
if (payload.mode === "local" || payload.mode === "remote") {
|
|
2402
|
+
opts.messageBuffer.addMessage(`Mode switched to ${payload.mode}`, "status");
|
|
2403
|
+
}
|
|
2404
|
+
return;
|
|
2405
|
+
case "permission-mode-changed":
|
|
2406
|
+
if (typeof payload.mode === "string" && payload.mode.trim()) {
|
|
2407
|
+
opts.messageBuffer.addMessage(`Permission mode: ${payload.mode}`, "status");
|
|
2408
|
+
}
|
|
2409
|
+
return;
|
|
2410
|
+
case "ready":
|
|
2411
|
+
return;
|
|
2412
|
+
default:
|
|
2413
|
+
return;
|
|
2414
|
+
}
|
|
2415
|
+
};
|
|
2416
|
+
return (transcriptMessage) => {
|
|
2417
|
+
if (transcriptMessage.message.role === "user") {
|
|
2418
|
+
const text = transcriptMessage.message.content.text.trim();
|
|
2419
|
+
if (text) {
|
|
2420
|
+
opts.messageBuffer.addMessage(text, "user");
|
|
2421
|
+
}
|
|
2422
|
+
return;
|
|
2423
|
+
}
|
|
2424
|
+
switch (transcriptMessage.message.content.type) {
|
|
2425
|
+
case "output":
|
|
2426
|
+
renderLegacyClaudeOutput(transcriptMessage.message.content.data);
|
|
2427
|
+
return;
|
|
2428
|
+
case "codex":
|
|
2429
|
+
renderStructuredAgentPayload(transcriptMessage.message.content.data);
|
|
2430
|
+
return;
|
|
2431
|
+
case "acp":
|
|
2432
|
+
renderStructuredAgentPayload(transcriptMessage.message.content.data);
|
|
2433
|
+
return;
|
|
2434
|
+
case "event":
|
|
2435
|
+
renderSessionEvent(transcriptMessage.message.content.data);
|
|
2436
|
+
return;
|
|
2437
|
+
default:
|
|
2438
|
+
opts.messageBuffer.addMessage(index.formatDisplayMessage(transcriptMessage.message), "status");
|
|
2439
|
+
}
|
|
2440
|
+
};
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2184
2443
|
let ConversationHistory$1 = class ConversationHistory {
|
|
2185
2444
|
messages = [];
|
|
2186
2445
|
maxMessages;
|
|
@@ -2752,92 +3011,6 @@ class MessageQueue2 {
|
|
|
2752
3011
|
}
|
|
2753
3012
|
}
|
|
2754
3013
|
|
|
2755
|
-
function deterministicStringify(obj, options = {}) {
|
|
2756
|
-
const {
|
|
2757
|
-
undefinedBehavior = "omit",
|
|
2758
|
-
sortArrays = false,
|
|
2759
|
-
replacer,
|
|
2760
|
-
includeSymbols = false
|
|
2761
|
-
} = options;
|
|
2762
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
2763
|
-
function processValue(value, key) {
|
|
2764
|
-
if (replacer && key !== void 0) {
|
|
2765
|
-
value = replacer(key, value);
|
|
2766
|
-
}
|
|
2767
|
-
if (value === null) return null;
|
|
2768
|
-
if (value === void 0) {
|
|
2769
|
-
switch (undefinedBehavior) {
|
|
2770
|
-
case "omit":
|
|
2771
|
-
return void 0;
|
|
2772
|
-
case "null":
|
|
2773
|
-
return null;
|
|
2774
|
-
case "throw":
|
|
2775
|
-
throw new Error(`Undefined value at key: ${key}`);
|
|
2776
|
-
}
|
|
2777
|
-
}
|
|
2778
|
-
if (typeof value === "boolean" || typeof value === "number" || typeof value === "string") {
|
|
2779
|
-
return value;
|
|
2780
|
-
}
|
|
2781
|
-
if (value instanceof Date) {
|
|
2782
|
-
return value.toISOString();
|
|
2783
|
-
}
|
|
2784
|
-
if (value instanceof RegExp) {
|
|
2785
|
-
return value.toString();
|
|
2786
|
-
}
|
|
2787
|
-
if (typeof value === "function") {
|
|
2788
|
-
return void 0;
|
|
2789
|
-
}
|
|
2790
|
-
if (typeof value === "symbol") {
|
|
2791
|
-
return includeSymbols ? value.toString() : void 0;
|
|
2792
|
-
}
|
|
2793
|
-
if (typeof value === "bigint") {
|
|
2794
|
-
return value.toString() + "n";
|
|
2795
|
-
}
|
|
2796
|
-
if (seen.has(value)) {
|
|
2797
|
-
throw new Error("Circular reference detected");
|
|
2798
|
-
}
|
|
2799
|
-
seen.add(value);
|
|
2800
|
-
if (Array.isArray(value)) {
|
|
2801
|
-
const processed2 = value.map((item, index) => processValue(item, String(index))).filter((item) => item !== void 0);
|
|
2802
|
-
if (sortArrays) {
|
|
2803
|
-
processed2.sort((a, b) => {
|
|
2804
|
-
const aStr = JSON.stringify(processValue(a));
|
|
2805
|
-
const bStr = JSON.stringify(processValue(b));
|
|
2806
|
-
return aStr.localeCompare(bStr);
|
|
2807
|
-
});
|
|
2808
|
-
}
|
|
2809
|
-
seen.delete(value);
|
|
2810
|
-
return processed2;
|
|
2811
|
-
}
|
|
2812
|
-
if (value.constructor === Object || value.constructor === void 0) {
|
|
2813
|
-
const processed2 = {};
|
|
2814
|
-
const keys = Object.keys(value).sort();
|
|
2815
|
-
for (const k of keys) {
|
|
2816
|
-
const processedValue = processValue(value[k], k);
|
|
2817
|
-
if (processedValue !== void 0) {
|
|
2818
|
-
processed2[k] = processedValue;
|
|
2819
|
-
}
|
|
2820
|
-
}
|
|
2821
|
-
seen.delete(value);
|
|
2822
|
-
return processed2;
|
|
2823
|
-
}
|
|
2824
|
-
try {
|
|
2825
|
-
const plain = { ...value };
|
|
2826
|
-
seen.delete(value);
|
|
2827
|
-
return processValue(plain, key);
|
|
2828
|
-
} catch {
|
|
2829
|
-
seen.delete(value);
|
|
2830
|
-
return String(value);
|
|
2831
|
-
}
|
|
2832
|
-
}
|
|
2833
|
-
const processed = processValue(obj);
|
|
2834
|
-
return JSON.stringify(processed);
|
|
2835
|
-
}
|
|
2836
|
-
function hashObject(obj, options, encoding = "hex") {
|
|
2837
|
-
const jsonString = deterministicStringify(obj, options);
|
|
2838
|
-
return crypto.createHash("sha256").update(jsonString).digest(encoding);
|
|
2839
|
-
}
|
|
2840
|
-
|
|
2841
3014
|
function registerKillSessionHandler(rpcHandlerManager, killThisHappy) {
|
|
2842
3015
|
rpcHandlerManager.registerHandler("killSession", async () => {
|
|
2843
3016
|
persistence.logger.debug("Kill session request received");
|
|
@@ -2860,12 +3033,12 @@ exports.buildHappyOrgTurnPrompt = buildHappyOrgTurnPrompt;
|
|
|
2860
3033
|
exports.buildPermissionPushNotification = buildPermissionPushNotification;
|
|
2861
3034
|
exports.buildReadyPushNotification = buildReadyPushNotification;
|
|
2862
3035
|
exports.buildTurnResultPushNotification = buildTurnResultPushNotification;
|
|
3036
|
+
exports.createSessionTranscriptInkRenderer = createSessionTranscriptInkRenderer;
|
|
2863
3037
|
exports.ensureManagedProviderMachine = ensureManagedProviderMachine;
|
|
2864
3038
|
exports.extractPermissionRequestPushContext = extractPermissionRequestPushContext;
|
|
2865
3039
|
exports.finalizeHappyOrgTurnWithBusinessAck = finalizeHappyOrgTurnWithBusinessAck;
|
|
2866
3040
|
exports.forwardAgentMessageToProviderSession = forwardAgentMessageToProviderSession;
|
|
2867
3041
|
exports.getPendingInteractionTimeoutMs = getPendingInteractionTimeoutMs;
|
|
2868
|
-
exports.hashObject = hashObject;
|
|
2869
3042
|
exports.inferToolResultError = inferToolResultError;
|
|
2870
3043
|
exports.launchRuntimeHandleWithFactoryResult = launchRuntimeHandleWithFactoryResult;
|
|
2871
3044
|
exports.registerKillSessionHandler = registerKillSessionHandler;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { l as logger,
|
|
2
|
+
import { l as logger, k as backoff, m as delay, d as AssistantMessageStream, o as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError, h as hashObject } from './api-B89O-SC-.mjs';
|
|
3
3
|
import 'cross-spawn';
|
|
4
4
|
import '@agentclientprotocol/sdk';
|
|
5
|
-
import { n as getProjectPath, F as Future, o as claudeLocal, E as ExitCodeError, q as trimIdent, u as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, w as claudeCheckSession, x as projectPath, y as mapToClaudeMode, P as PushableAsyncIterable, z as query, A as AbortError, e as stopCaffeinate, p as publishSessionRegistration, B as getEnvironmentInfo, a as createSessionMetadata, C as startCaffeinate, b as closeProviderSession } from './index-
|
|
5
|
+
import { n as getProjectPath, F as Future, o as claudeLocal, E as ExitCodeError, q as trimIdent, u as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, w as claudeCheckSession, x as projectPath, y as mapToClaudeMode, P as PushableAsyncIterable, z as query, A as AbortError, e as stopCaffeinate, p as publishSessionRegistration, B as getEnvironmentInfo, a as createSessionMetadata, C as startCaffeinate, b as closeProviderSession } from './index-CiHiCC31.mjs';
|
|
6
6
|
import 'ps-list';
|
|
7
7
|
import 'fs';
|
|
8
8
|
import 'path';
|
|
@@ -23,9 +23,9 @@ import 'tweetnacl';
|
|
|
23
23
|
import 'open';
|
|
24
24
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
25
25
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
26
|
-
import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-
|
|
26
|
+
import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-CYUH1U8F.mjs';
|
|
27
27
|
import { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
|
|
28
|
-
import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort,
|
|
28
|
+
import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, h as finalizeHappyOrgTurnWithBusinessAck, i as buildTurnResultPushNotification, q as createSessionTranscriptInkRenderer, j as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, n as renderTerminalOutputPreview, p as forwardAgentMessageToProviderSession, m as buildPermissionPushNotification, s as syncControlledByUserState, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, c as registerKillSessionHandler } from './registerKillSessionHandler-BnS3ozFX.mjs';
|
|
29
29
|
import 'socket.io-client';
|
|
30
30
|
import 'expo-server-sdk';
|
|
31
31
|
import { isDeepStrictEqual } from 'node:util';
|
|
@@ -989,6 +989,7 @@ const CLAUDE_ACP_LEGACY_FINAL_MESSAGE_SHADOW = "claude-acp-final-message-shadow"
|
|
|
989
989
|
async function claudeAcpRemoteLauncher(session) {
|
|
990
990
|
const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
|
|
991
991
|
const messageBuffer = new MessageBuffer({ enabled: hasTTY });
|
|
992
|
+
const renderSessionTranscript = createSessionTranscriptInkRenderer({ messageBuffer });
|
|
992
993
|
let inkInstance = null;
|
|
993
994
|
let shouldExit = false;
|
|
994
995
|
let abortController = new AbortController();
|
|
@@ -1416,6 +1417,14 @@ ${systemPrompt}` : systemPrompt,
|
|
|
1416
1417
|
logger.debug("[ClaudeACP] Abort requested - stopping current task");
|
|
1417
1418
|
await abortActiveTurn();
|
|
1418
1419
|
};
|
|
1420
|
+
if (typeof session.client.onSessionMessage === "function") {
|
|
1421
|
+
session.client.onSessionMessage((transcriptMessage) => {
|
|
1422
|
+
if (transcriptMessage.source !== "snapshot" || transcriptMessage.queuesPendingInput) {
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
renderSessionTranscript(transcriptMessage);
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1419
1428
|
if (hasTTY) {
|
|
1420
1429
|
console.clear();
|
|
1421
1430
|
inkInstance = render(React.createElement(RemoteModeDisplay, {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var node_crypto = require('node:crypto');
|
|
4
|
-
var persistence = require('./api-
|
|
4
|
+
var persistence = require('./api-zMic8QXq.cjs');
|
|
5
5
|
require('cross-spawn');
|
|
6
6
|
require('@agentclientprotocol/sdk');
|
|
7
|
-
var index = require('./index-
|
|
7
|
+
var index = require('./index-DVVbyQGZ.cjs');
|
|
8
8
|
require('ps-list');
|
|
9
9
|
require('fs');
|
|
10
10
|
require('path');
|
|
@@ -25,9 +25,9 @@ require('tweetnacl');
|
|
|
25
25
|
require('open');
|
|
26
26
|
var React = require('react');
|
|
27
27
|
var ink = require('ink');
|
|
28
|
-
var ProviderSelectionHandler = require('./ProviderSelectionHandler-
|
|
28
|
+
var ProviderSelectionHandler = require('./ProviderSelectionHandler-CXwqOJpC.cjs');
|
|
29
29
|
var types = require('./types-DVk3crez.cjs');
|
|
30
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
30
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-CDYAY5Ev.cjs');
|
|
31
31
|
require('socket.io-client');
|
|
32
32
|
require('expo-server-sdk');
|
|
33
33
|
var node_util = require('node:util');
|
|
@@ -991,6 +991,7 @@ const CLAUDE_ACP_LEGACY_FINAL_MESSAGE_SHADOW = "claude-acp-final-message-shadow"
|
|
|
991
991
|
async function claudeAcpRemoteLauncher(session) {
|
|
992
992
|
const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
|
|
993
993
|
const messageBuffer = new registerKillSessionHandler.MessageBuffer({ enabled: hasTTY });
|
|
994
|
+
const renderSessionTranscript = registerKillSessionHandler.createSessionTranscriptInkRenderer({ messageBuffer });
|
|
994
995
|
let inkInstance = null;
|
|
995
996
|
let shouldExit = false;
|
|
996
997
|
let abortController = new AbortController();
|
|
@@ -1418,6 +1419,14 @@ ${systemPrompt}` : systemPrompt,
|
|
|
1418
1419
|
persistence.logger.debug("[ClaudeACP] Abort requested - stopping current task");
|
|
1419
1420
|
await abortActiveTurn();
|
|
1420
1421
|
};
|
|
1422
|
+
if (typeof session.client.onSessionMessage === "function") {
|
|
1423
|
+
session.client.onSessionMessage((transcriptMessage) => {
|
|
1424
|
+
if (transcriptMessage.source !== "snapshot" || transcriptMessage.queuesPendingInput) {
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1427
|
+
renderSessionTranscript(transcriptMessage);
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1421
1430
|
if (hasTTY) {
|
|
1422
1431
|
console.clear();
|
|
1423
1432
|
inkInstance = ink.render(React.createElement(RemoteModeDisplay, {
|
|
@@ -3502,7 +3511,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
3502
3511
|
if (caffeinateStarted) {
|
|
3503
3512
|
persistence.logger.infoDeveloper("Sleep prevention enabled (macOS)");
|
|
3504
3513
|
}
|
|
3505
|
-
const messageQueue = new registerKillSessionHandler.MessageQueue2((mode) =>
|
|
3514
|
+
const messageQueue = new registerKillSessionHandler.MessageQueue2((mode) => persistence.hashObject({
|
|
3506
3515
|
isPlan: mode.permissionMode === "plan",
|
|
3507
3516
|
model: mode.model,
|
|
3508
3517
|
fallbackModel: mode.fallbackModel,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var persistence = require('./api-
|
|
4
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
5
|
-
var index = require('./index-
|
|
3
|
+
var persistence = require('./api-zMic8QXq.cjs');
|
|
4
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-CDYAY5Ev.cjs');
|
|
5
|
+
var index = require('./index-DVVbyQGZ.cjs');
|
|
6
6
|
require('cross-spawn');
|
|
7
7
|
require('@agentclientprotocol/sdk');
|
|
8
8
|
var node_crypto = require('node:crypto');
|
|
@@ -26,8 +26,8 @@ require('tweetnacl');
|
|
|
26
26
|
require('open');
|
|
27
27
|
var React = require('react');
|
|
28
28
|
var ink = require('ink');
|
|
29
|
-
var ProviderSelectionHandler = require('./ProviderSelectionHandler-
|
|
30
|
-
var BaseReasoningProcessor = require('./BaseReasoningProcessor-
|
|
29
|
+
var ProviderSelectionHandler = require('./ProviderSelectionHandler-CXwqOJpC.cjs');
|
|
30
|
+
var BaseReasoningProcessor = require('./BaseReasoningProcessor-D6itItnT.cjs');
|
|
31
31
|
require('zod');
|
|
32
32
|
require('socket.io-client');
|
|
33
33
|
require('expo-server-sdk');
|
|
@@ -489,7 +489,7 @@ function resolveCodexAcpExecutionMode(mode) {
|
|
|
489
489
|
};
|
|
490
490
|
}
|
|
491
491
|
function getCodexExecutionFingerprint(mode) {
|
|
492
|
-
return
|
|
492
|
+
return persistence.hashObject({
|
|
493
493
|
...resolveCodexAcpExecutionMode(mode),
|
|
494
494
|
happyOrg: mode.happyOrg ? {
|
|
495
495
|
taskId: mode.happyOrg.context.taskId,
|
|
@@ -697,6 +697,7 @@ function registerCodexRemoteRpcHandlers(clientSession, handlers) {
|
|
|
697
697
|
async function codexRemoteLauncher(session) {
|
|
698
698
|
const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
|
|
699
699
|
const messageBuffer = new registerKillSessionHandler.MessageBuffer({ enabled: hasTTY });
|
|
700
|
+
const renderSessionTranscript = registerKillSessionHandler.createSessionTranscriptInkRenderer({ messageBuffer });
|
|
700
701
|
let inkInstance = null;
|
|
701
702
|
let shouldExit = false;
|
|
702
703
|
let abortController = new AbortController();
|
|
@@ -1144,7 +1145,20 @@ async function codexRemoteLauncher(session) {
|
|
|
1144
1145
|
handleSwitchToLocal,
|
|
1145
1146
|
handleKillSession
|
|
1146
1147
|
});
|
|
1148
|
+
bindSessionTranscriptHistory(clientSession);
|
|
1147
1149
|
};
|
|
1150
|
+
const bindSessionTranscriptHistory = (clientSession) => {
|
|
1151
|
+
if (typeof clientSession.onSessionMessage !== "function") {
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
1154
|
+
clientSession.onSessionMessage((transcriptMessage) => {
|
|
1155
|
+
if (transcriptMessage.source !== "snapshot" || transcriptMessage.queuesPendingInput) {
|
|
1156
|
+
return;
|
|
1157
|
+
}
|
|
1158
|
+
renderSessionTranscript(transcriptMessage);
|
|
1159
|
+
});
|
|
1160
|
+
};
|
|
1161
|
+
bindSessionTranscriptHistory(session.client);
|
|
1148
1162
|
session.addClientSwapCallback(handleClientSwap);
|
|
1149
1163
|
if (hasTTY) {
|
|
1150
1164
|
console.clear();
|