replicas-engine 0.1.1029 → 0.1.1031
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/src/{asp-host-2QL3R5O5.js → asp-host-QBDCXAI6.js} +5 -5
- package/dist/src/{chunk-BOAIMJKK.js → chunk-5HLMUJTJ.js} +12 -1
- package/dist/src/{chunk-HIRAX6GE.js → chunk-7PXLG7IJ.js} +1 -1
- package/dist/src/{chunk-E35XSXJE.js → chunk-ABUMJRPU.js} +1 -1
- package/dist/src/{chunk-UMI7BLA3.js → chunk-ADUHQPYR.js} +3 -3
- package/dist/src/{chunk-DWWWY7HA.js → chunk-IEA3U7JP.js} +6 -6
- package/dist/src/{chunk-SMKDV5DS.js → chunk-K4DFY56I.js} +3 -3
- package/dist/src/{chunk-IPOU7CXA.js → chunk-RVXD24D4.js} +1 -1
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +3 -3
- package/dist/src/index.js +126 -10
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
getCodexAspHost,
|
|
6
6
|
restartCodexAspHost,
|
|
7
7
|
restartCodexAspHostIfRunning
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-IEA3U7JP.js";
|
|
9
|
+
import "./chunk-RVXD24D4.js";
|
|
10
|
+
import "./chunk-K4DFY56I.js";
|
|
11
|
+
import "./chunk-7PXLG7IJ.js";
|
|
12
12
|
import "./chunk-UZSNFLDQ.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-5HLMUJTJ.js";
|
|
14
14
|
import "./chunk-VEQXQN22.js";
|
|
15
15
|
export {
|
|
16
16
|
getCodexAspHost,
|
|
@@ -1258,7 +1258,8 @@ var sendChatMessageRequestSchema = z3.object({
|
|
|
1258
1258
|
senderDisplayName: z3.string().optional(),
|
|
1259
1259
|
senderAvatarUrl: z3.string().optional(),
|
|
1260
1260
|
errorNotificationTarget: integrationErrorNotificationTargetSchema.optional(),
|
|
1261
|
-
errorNotificationTargets: z3.array(integrationErrorNotificationTargetSchema).optional()
|
|
1261
|
+
errorNotificationTargets: z3.array(integrationErrorNotificationTargetSchema).optional(),
|
|
1262
|
+
streamSlackActivity: z3.boolean().optional()
|
|
1262
1263
|
}).passthrough();
|
|
1263
1264
|
function isChatMessageSender(value) {
|
|
1264
1265
|
return isRecord(value) && (value.messageId === void 0 || typeof value.messageId === "string") && typeof value.senderUserId === "string" && typeof value.senderEmail === "string" && typeof value.recordedAt === "string";
|
|
@@ -6484,6 +6485,11 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
6484
6485
|
const completedStreamIds = /* @__PURE__ */ new Set();
|
|
6485
6486
|
const supersededStreamIds = /* @__PURE__ */ new Set();
|
|
6486
6487
|
let liveStreamId = null;
|
|
6488
|
+
const endStreamingTools = (exceptStreamId) => {
|
|
6489
|
+
for (const streamId of streamingTools.keys()) {
|
|
6490
|
+
if (streamId !== exceptStreamId) streamingTools.delete(streamId);
|
|
6491
|
+
}
|
|
6492
|
+
};
|
|
6487
6493
|
let compaction;
|
|
6488
6494
|
const assistantThinking = /* @__PURE__ */ new Map();
|
|
6489
6495
|
const assistantTextCounts = /* @__PURE__ */ new Map();
|
|
@@ -6537,6 +6543,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
6537
6543
|
supersededStreamIds.add(liveStreamId);
|
|
6538
6544
|
}
|
|
6539
6545
|
liveStreamId = payload.streamId;
|
|
6546
|
+
endStreamingTools(payload.streamId);
|
|
6540
6547
|
const existing = partialIndexes.get(payload.streamId) ?? {};
|
|
6541
6548
|
if (payload.thinking && !assistantThinking.has(payload.streamId)) {
|
|
6542
6549
|
const reasoningMessage = {
|
|
@@ -6634,6 +6641,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
6634
6641
|
}
|
|
6635
6642
|
const streamRefs = messageId ? partialIndexes.get(messageId) : void 0;
|
|
6636
6643
|
if (messageId) {
|
|
6644
|
+
endStreamingTools(messageId);
|
|
6637
6645
|
if (liveStreamId !== null && liveStreamId !== messageId) {
|
|
6638
6646
|
supersededStreamIds.add(liveStreamId);
|
|
6639
6647
|
}
|
|
@@ -6748,6 +6756,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
6748
6756
|
}
|
|
6749
6757
|
});
|
|
6750
6758
|
}
|
|
6759
|
+
if (event.type === "claude-result" || event.type === CHAT_INTERRUPTED_EVENT_TYPE) endStreamingTools();
|
|
6751
6760
|
if (compaction && (event.type === "claude-result" || event.type === CHAT_INTERRUPTED_EVENT_TYPE)) {
|
|
6752
6761
|
compaction.status = "failed";
|
|
6753
6762
|
compaction.completedAt = event.timestamp;
|
|
@@ -9367,6 +9376,8 @@ export {
|
|
|
9367
9376
|
chatHistoryPageParamsFromQuery,
|
|
9368
9377
|
paginateChatHistory,
|
|
9369
9378
|
coerceBackgroundTaskPayload,
|
|
9379
|
+
planItemsFromMessage,
|
|
9380
|
+
getDisplayMessageActivity,
|
|
9370
9381
|
fileContentDiff,
|
|
9371
9382
|
skillNamesFromCommand,
|
|
9372
9383
|
areUserMessagesWithinMatchWindow,
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
HOOK_EXEC_MAX_BUFFER_BYTES
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5HLMUJTJ.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -3,18 +3,18 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
monolithRequest
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RVXD24D4.js";
|
|
7
7
|
import {
|
|
8
8
|
SUBPROCESS_MAX_BUFFER,
|
|
9
9
|
execFileAsync
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7PXLG7IJ.js";
|
|
11
11
|
import {
|
|
12
12
|
extractCommandProtectionCommandText,
|
|
13
13
|
findCommandProtectionGitLookups,
|
|
14
14
|
findGitCommitSignals,
|
|
15
15
|
findPrMergeSignals,
|
|
16
16
|
parseCommandProtectionRequest
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5HLMUJTJ.js";
|
|
18
18
|
|
|
19
19
|
// src/services/command-protection-service.ts
|
|
20
20
|
import { readFile, stat } from "fs/promises";
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
ENGINE_ENV,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
setAgentCredentialSnapshot
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RVXD24D4.js";
|
|
9
9
|
import {
|
|
10
10
|
AppServerProcess,
|
|
11
11
|
buildCodexAgentEnv
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-K4DFY56I.js";
|
|
13
13
|
import {
|
|
14
14
|
SUBPROCESS_MAX_BUFFER,
|
|
15
15
|
execFileAsync
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-7PXLG7IJ.js";
|
|
17
17
|
import {
|
|
18
18
|
isRecord
|
|
19
19
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
listOpenAICompatibleModels,
|
|
29
29
|
readOllamaAuthEnv,
|
|
30
30
|
resolveOpenAICompatibleModelsUrl
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-5HLMUJTJ.js";
|
|
32
32
|
|
|
33
33
|
// src/managers/codex-token-manager.ts
|
|
34
34
|
import { promises as fs } from "fs";
|
|
@@ -264,7 +264,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
264
264
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
265
265
|
await this.applyCredentialsResponse(data);
|
|
266
266
|
setAgentCredentialSnapshot("codex", data);
|
|
267
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
267
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-QBDCXAI6.js");
|
|
268
268
|
await restartCodexAspHostIfRunning2();
|
|
269
269
|
});
|
|
270
270
|
await this.start(true);
|
|
@@ -285,7 +285,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
285
285
|
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
286
286
|
await this.applyCredentialsResponse(data);
|
|
287
287
|
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
288
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
288
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-QBDCXAI6.js");
|
|
289
289
|
await restartCodexAspHostIfRunning2();
|
|
290
290
|
}
|
|
291
291
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
execFileAsync
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7PXLG7IJ.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5HLMUJTJ.js";
|
|
10
10
|
|
|
11
11
|
// src/utils/codex-agent-env.ts
|
|
12
12
|
function buildCodexAgentEnv(source = process.env) {
|
|
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
|
|
|
240
240
|
if (method === "foundry") return "azure";
|
|
241
241
|
return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
|
|
242
242
|
}
|
|
243
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
243
|
+
var ENGINE_PACKAGE_VERSION = "0.1.1031";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
evaluateCommandProtection
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-ADUHQPYR.js";
|
|
7
|
+
import "./chunk-RVXD24D4.js";
|
|
8
|
+
import "./chunk-7PXLG7IJ.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-5HLMUJTJ.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
AppServerProcess,
|
|
9
9
|
buildCodexAgentEnv
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-K4DFY56I.js";
|
|
11
|
+
import "./chunk-7PXLG7IJ.js";
|
|
12
12
|
import {
|
|
13
13
|
AGENT,
|
|
14
14
|
headlessAgentRequestSchema
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5HLMUJTJ.js";
|
|
16
16
|
import "./chunk-VEQXQN22.js";
|
|
17
17
|
|
|
18
18
|
// src/headless-agent.ts
|
package/dist/src/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
reportCommandProtectionBlock,
|
|
33
33
|
resolveDiffBase,
|
|
34
34
|
runGitCommand
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-ADUHQPYR.js";
|
|
36
36
|
import {
|
|
37
37
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
38
38
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
} from "./chunk-P73LGPQO.js";
|
|
58
58
|
import {
|
|
59
59
|
publishedPullRequestUrls
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-ABUMJRPU.js";
|
|
61
61
|
import {
|
|
62
62
|
BaseRefreshManager,
|
|
63
63
|
CodexAspAuthMethodChangedError,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
refreshDelayMs,
|
|
72
72
|
restartCodexAspHost,
|
|
73
73
|
routineRefreshRequest
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-IEA3U7JP.js";
|
|
75
75
|
import {
|
|
76
76
|
ENGINE_ENV,
|
|
77
77
|
monolithRequest,
|
|
@@ -79,16 +79,16 @@ import {
|
|
|
79
79
|
readRuntimeEnvFile,
|
|
80
80
|
reloadEngineEnv,
|
|
81
81
|
setAgentCredentialSnapshot
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-RVXD24D4.js";
|
|
83
83
|
import {
|
|
84
84
|
AspClient,
|
|
85
85
|
getCodexModelProvider
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-K4DFY56I.js";
|
|
87
87
|
import {
|
|
88
88
|
SUBPROCESS_MAX_BUFFER,
|
|
89
89
|
execAsync,
|
|
90
90
|
execFileAsync
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-7PXLG7IJ.js";
|
|
92
92
|
import {
|
|
93
93
|
isRecord as isRecord2
|
|
94
94
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -233,6 +233,7 @@ import {
|
|
|
233
233
|
getClaudeModelContextWindow,
|
|
234
234
|
getDefaultAgentModel,
|
|
235
235
|
getDefaultOllamaModel,
|
|
236
|
+
getDisplayMessageActivity,
|
|
236
237
|
getEventStreamId,
|
|
237
238
|
getEventTimestampMs,
|
|
238
239
|
getGitHubAccessToken,
|
|
@@ -294,6 +295,7 @@ import {
|
|
|
294
295
|
parseMcpToolName,
|
|
295
296
|
parseReplicasConfigString,
|
|
296
297
|
percentage,
|
|
298
|
+
planItemsFromMessage,
|
|
297
299
|
raceWithTimeout,
|
|
298
300
|
readJsonlPage,
|
|
299
301
|
readOllamaAuthEnv,
|
|
@@ -319,7 +321,7 @@ import {
|
|
|
319
321
|
workspaceTokenRequestSchema,
|
|
320
322
|
workspaceTokenResponseSchema,
|
|
321
323
|
wrapInTag
|
|
322
|
-
} from "./chunk-
|
|
324
|
+
} from "./chunk-5HLMUJTJ.js";
|
|
323
325
|
import {
|
|
324
326
|
cloneMcpConfig,
|
|
325
327
|
ensureCompatibilityImports,
|
|
@@ -53724,9 +53726,9 @@ function Clone2(value) {
|
|
|
53724
53726
|
// ../node_modules/.bun/typebox@1.3.7/node_modules/typebox/build/value/clean/from_union.mjs
|
|
53725
53727
|
function FromUnion9(context, type, value) {
|
|
53726
53728
|
for (const schema of type.anyOf) {
|
|
53727
|
-
const
|
|
53728
|
-
if (Check2(context, schema,
|
|
53729
|
-
return
|
|
53729
|
+
const clean2 = FromType19(context, schema, Clone2(value));
|
|
53730
|
+
if (Check2(context, schema, clean2))
|
|
53731
|
+
return clean2;
|
|
53730
53732
|
}
|
|
53731
53733
|
return value;
|
|
53732
53734
|
}
|
|
@@ -60632,6 +60634,106 @@ async function buildForkHandoff(input) {
|
|
|
60632
60634
|
};
|
|
60633
60635
|
}
|
|
60634
60636
|
|
|
60637
|
+
// src/services/chat/slack-activity-stream.ts
|
|
60638
|
+
var FLUSH_INTERVAL_MS = 3e3;
|
|
60639
|
+
var MAX_ACTIVITY_LENGTH = 300;
|
|
60640
|
+
var MAX_DONE_ATTEMPTS = 3;
|
|
60641
|
+
var sendQueue = Promise.resolve();
|
|
60642
|
+
var truncate = (text, max) => text.length > max ? `${text.slice(0, max - 1)}\u2026` : text;
|
|
60643
|
+
var clean = (text) => truncate(text.replace(/\s+/g, " ").trim(), MAX_ACTIVITY_LENGTH);
|
|
60644
|
+
function describeStep(message) {
|
|
60645
|
+
const plan = planItemsFromMessage(message);
|
|
60646
|
+
if (plan) {
|
|
60647
|
+
const current = plan.find((item) => item.status === "in_progress");
|
|
60648
|
+
return plan.length ? `Plan ${plan.filter((item) => item.status === "completed").length}/${plan.length}${current ? ` \xB7 ${current.text}` : ""}` : null;
|
|
60649
|
+
}
|
|
60650
|
+
if (message.type === "tool_call") {
|
|
60651
|
+
const input = summarizeInput(message.input);
|
|
60652
|
+
return input ? `${toolAction(message.tool)}: ${input}` : toolAction(message.tool);
|
|
60653
|
+
}
|
|
60654
|
+
const activity = getDisplayMessageActivity(message);
|
|
60655
|
+
if (!activity || activity.kind === "error") return null;
|
|
60656
|
+
return (activity.summary ? `${activity.title}: ${activity.summary}` : activity.title).trim().split("\n")[0];
|
|
60657
|
+
}
|
|
60658
|
+
var SlackActivityStream = class {
|
|
60659
|
+
constructor(turnId, provider) {
|
|
60660
|
+
this.turnId = turnId;
|
|
60661
|
+
this.provider = provider;
|
|
60662
|
+
this.timer = setInterval(() => this.enqueue(false), FLUSH_INTERVAL_MS);
|
|
60663
|
+
this.timer.unref?.();
|
|
60664
|
+
}
|
|
60665
|
+
turnId;
|
|
60666
|
+
provider;
|
|
60667
|
+
events = [];
|
|
60668
|
+
timer;
|
|
60669
|
+
sent = null;
|
|
60670
|
+
attempted = false;
|
|
60671
|
+
dirty = false;
|
|
60672
|
+
stopped = false;
|
|
60673
|
+
queued = false;
|
|
60674
|
+
noteEvent(event) {
|
|
60675
|
+
if (event.type === CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE) return;
|
|
60676
|
+
const partialType = event.type === CODEX_ITEM_PARTIAL_EVENT_TYPE ? codexItemFromEvent(event)?.item.type : void 0;
|
|
60677
|
+
if (partialType === "agentMessage" || partialType === "reasoning") return;
|
|
60678
|
+
const streamId = getEventStreamId(event);
|
|
60679
|
+
const index = streamId ? this.events.findLastIndex((previous) => getEventStreamId(previous) === streamId) : -1;
|
|
60680
|
+
if (index >= 0) this.events[index] = event;
|
|
60681
|
+
else this.events.push(event);
|
|
60682
|
+
this.dirty = true;
|
|
60683
|
+
}
|
|
60684
|
+
finish() {
|
|
60685
|
+
clearInterval(this.timer);
|
|
60686
|
+
this.enqueue(true);
|
|
60687
|
+
}
|
|
60688
|
+
enqueue(done) {
|
|
60689
|
+
if (!done && this.queued) return;
|
|
60690
|
+
this.queued = true;
|
|
60691
|
+
sendQueue = sendQueue.then(async () => {
|
|
60692
|
+
this.queued = false;
|
|
60693
|
+
for (let attempt = 1; !await this.flush(done) && done && attempt < MAX_DONE_ATTEMPTS; attempt++) {
|
|
60694
|
+
await new Promise((resolve7) => setTimeout(resolve7, FLUSH_INTERVAL_MS));
|
|
60695
|
+
}
|
|
60696
|
+
}).catch((error) => console.error("[SlackActivityStream] Flush failed:", error));
|
|
60697
|
+
}
|
|
60698
|
+
async flush(done) {
|
|
60699
|
+
if (this.stopped) return true;
|
|
60700
|
+
if (done && !this.attempted) {
|
|
60701
|
+
this.stopped = true;
|
|
60702
|
+
return true;
|
|
60703
|
+
}
|
|
60704
|
+
let activity = {};
|
|
60705
|
+
if (!done) {
|
|
60706
|
+
if (!this.dirty) return true;
|
|
60707
|
+
this.dirty = false;
|
|
60708
|
+
const messages = parseDisplayMessages(this.events, this.provider);
|
|
60709
|
+
const thought = messages.map((message) => message.type === "agent" || message.type === "reasoning" ? message.content : "").findLast((text) => text.trim());
|
|
60710
|
+
const step = messages.map(describeStep).findLast(Boolean);
|
|
60711
|
+
activity = {
|
|
60712
|
+
...thought ? { thought: clean(thought) } : {},
|
|
60713
|
+
...step ? { step: clean(step) } : {}
|
|
60714
|
+
};
|
|
60715
|
+
if (!activity.thought && !activity.step || JSON.stringify(activity) === this.sent) return true;
|
|
60716
|
+
}
|
|
60717
|
+
this.attempted = true;
|
|
60718
|
+
const event = {
|
|
60719
|
+
type: "slack_activity",
|
|
60720
|
+
payload: { turnId: this.turnId, ...done ? { done } : activity }
|
|
60721
|
+
};
|
|
60722
|
+
const response = await monolithRequest("/v1/engine/webhook", { body: event, signal: AbortSignal.timeout(15e3) }).catch(() => null);
|
|
60723
|
+
if (response?.status === 409) {
|
|
60724
|
+
this.stopped = true;
|
|
60725
|
+
return true;
|
|
60726
|
+
}
|
|
60727
|
+
if (!response?.ok) {
|
|
60728
|
+
this.dirty = true;
|
|
60729
|
+
return false;
|
|
60730
|
+
}
|
|
60731
|
+
this.sent = JSON.stringify(activity);
|
|
60732
|
+
if (done) this.stopped = true;
|
|
60733
|
+
return true;
|
|
60734
|
+
}
|
|
60735
|
+
};
|
|
60736
|
+
|
|
60635
60737
|
// src/services/chat/chat-service.ts
|
|
60636
60738
|
var CHATS_BACKUP_FILE = `${CHATS_FILE}.bak`;
|
|
60637
60739
|
function createTurnMetadata(message, messageId, recordedAt) {
|
|
@@ -61094,6 +61196,9 @@ var ChatService = class {
|
|
|
61094
61196
|
...request.errorNotificationTargets ?? [],
|
|
61095
61197
|
...request.errorNotificationTarget ? [request.errorNotificationTarget] : []
|
|
61096
61198
|
];
|
|
61199
|
+
if (request.streamSlackActivity && chat.persisted.parentChatId === null) {
|
|
61200
|
+
chat.slackActivityMessageIds.add(result.messageId);
|
|
61201
|
+
}
|
|
61097
61202
|
if (notificationTargets.length > 0) {
|
|
61098
61203
|
const existingTargets = chat.errorNotificationTargets.get(result.messageId) ?? [];
|
|
61099
61204
|
chat.errorNotificationTargets.set(result.messageId, [
|
|
@@ -61236,6 +61341,7 @@ var ChatService = class {
|
|
|
61236
61341
|
for (const messageId of removed) {
|
|
61237
61342
|
chat.acceptedUserEvents.delete(messageId);
|
|
61238
61343
|
chat.errorNotificationTargets.delete(messageId);
|
|
61344
|
+
chat.slackActivityMessageIds.delete(messageId);
|
|
61239
61345
|
}
|
|
61240
61346
|
await this.persistAllChats().catch((error) => {
|
|
61241
61347
|
console.error("[ChatService] Failed to persist queued-message removals:", error);
|
|
@@ -61341,6 +61447,9 @@ var ChatService = class {
|
|
|
61341
61447
|
target.pendingMessageIds = [];
|
|
61342
61448
|
target.acceptedUserEvents.clear();
|
|
61343
61449
|
}
|
|
61450
|
+
target.slackActivity?.finish();
|
|
61451
|
+
target.slackActivity = null;
|
|
61452
|
+
target.slackActivityMessageIds.clear();
|
|
61344
61453
|
if (hasChatStarted(this.toSummary(target))) {
|
|
61345
61454
|
target.persisted.deletedAt = deletedAt;
|
|
61346
61455
|
} else {
|
|
@@ -61762,6 +61871,8 @@ var ChatService = class {
|
|
|
61762
61871
|
settledProcessing: null,
|
|
61763
61872
|
errorNotificationTargets: /* @__PURE__ */ new Map(),
|
|
61764
61873
|
activeErrorNotificationTargets: [],
|
|
61874
|
+
slackActivityMessageIds: /* @__PURE__ */ new Set(),
|
|
61875
|
+
slackActivity: null,
|
|
61765
61876
|
quotaExhaustion: null,
|
|
61766
61877
|
lastSendRequest: null
|
|
61767
61878
|
};
|
|
@@ -61816,6 +61927,8 @@ var ChatService = class {
|
|
|
61816
61927
|
this.agentTokenUsageTracker.startTurn(context);
|
|
61817
61928
|
chat.activeErrorNotificationTargets = chat.errorNotificationTargets.get(messageId) ?? [];
|
|
61818
61929
|
chat.errorNotificationTargets.delete(messageId);
|
|
61930
|
+
chat.slackActivity?.finish();
|
|
61931
|
+
chat.slackActivity = chat.slackActivityMessageIds.delete(messageId) ? new SlackActivityStream(messageId, chat.persisted.provider) : null;
|
|
61819
61932
|
}
|
|
61820
61933
|
async handleTurnStarted(chatId, message) {
|
|
61821
61934
|
const chat = this.getRuntimeChat(chatId);
|
|
@@ -61865,6 +61978,7 @@ var ChatService = class {
|
|
|
61865
61978
|
});
|
|
61866
61979
|
}
|
|
61867
61980
|
this.agentTokenUsageTracker.noteAgentEvent(chatId, event);
|
|
61981
|
+
chat.slackActivity?.noteEvent(event);
|
|
61868
61982
|
const parentToolUseId = typeof event.payload.parent_tool_use_id === "string" ? event.payload.parent_tool_use_id : null;
|
|
61869
61983
|
const messages = parseDisplayMessages([event], chat.persisted.provider, { filter: false, parentToolUseId });
|
|
61870
61984
|
if (chat.hasActiveTurn) this.agentChatActivityTrackerService.noteSkillMcpCalls(chatId, messages);
|
|
@@ -61955,6 +62069,8 @@ var ChatService = class {
|
|
|
61955
62069
|
}
|
|
61956
62070
|
chat.hasActiveTurn = false;
|
|
61957
62071
|
chat.activeMessageId = null;
|
|
62072
|
+
chat.slackActivity?.finish();
|
|
62073
|
+
chat.slackActivity = null;
|
|
61958
62074
|
this.endTrackedTurn(chatId);
|
|
61959
62075
|
const completedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
61960
62076
|
const processing = chat.provider.getQueue().length > 0 || (chat.provider.hasActiveBackgroundTasks?.() ?? false);
|
|
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
publishedPullRequestUrls
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ABUMJRPU.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
9
|
} from "./chunk-UZSNFLDQ.js";
|
|
10
10
|
import {
|
|
11
11
|
shouldRefreshPullRequests
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-5HLMUJTJ.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/services/post-tool-pr-notifier.ts
|
package/dist/src/subagent-mcp.js
CHANGED