replicas-engine 0.1.1012 → 0.1.1014
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-D5Z3SVAD.js → asp-host-6YAIMBG2.js} +5 -5
- package/dist/src/{chunk-H4XZMWVS.js → chunk-6UW2SECH.js} +3 -3
- package/dist/src/{chunk-A3G52T2Q.js → chunk-7SUUDOZB.js} +6 -6
- package/dist/src/{chunk-RRKTSN4S.js → chunk-ARKYATUE.js} +1 -1
- package/dist/src/{chunk-KVUOP6ID.js → chunk-BOS5XATR.js} +3 -3
- package/dist/src/{chunk-GU4OGSPA.js → chunk-FO6FOZVV.js} +27 -1
- package/dist/src/{chunk-DKM5SKZL.js → chunk-IRZH6C2B.js} +1 -1
- package/dist/src/{chunk-U7VFQQV4.js → chunk-UT2HOSDY.js} +3 -3
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +3 -3
- package/dist/src/index.js +49 -23
- 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-7SUUDOZB.js";
|
|
9
|
+
import "./chunk-UT2HOSDY.js";
|
|
10
|
+
import "./chunk-BOS5XATR.js";
|
|
11
|
+
import "./chunk-ARKYATUE.js";
|
|
12
12
|
import "./chunk-UZSNFLDQ.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-FO6FOZVV.js";
|
|
14
14
|
import "./chunk-VEQXQN22.js";
|
|
15
15
|
export {
|
|
16
16
|
getCodexAspHost,
|
|
@@ -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-UT2HOSDY.js";
|
|
7
7
|
import {
|
|
8
8
|
SUBPROCESS_MAX_BUFFER,
|
|
9
9
|
execFileAsync
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ARKYATUE.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-FO6FOZVV.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-UT2HOSDY.js";
|
|
9
9
|
import {
|
|
10
10
|
AppServerProcess,
|
|
11
11
|
buildCodexAgentEnv
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BOS5XATR.js";
|
|
13
13
|
import {
|
|
14
14
|
SUBPROCESS_MAX_BUFFER,
|
|
15
15
|
execFileAsync
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ARKYATUE.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-FO6FOZVV.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-6YAIMBG2.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-6YAIMBG2.js");
|
|
289
289
|
await restartCodexAspHostIfRunning2();
|
|
290
290
|
}
|
|
291
291
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -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-FO6FOZVV.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -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-ARKYATUE.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FO6FOZVV.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.1014";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -8690,10 +8690,18 @@ var PROFILE_AVATAR_MAX_SIZE_BYTES = 5 * 1024 * 1024;
|
|
|
8690
8690
|
// ../shared/src/routes/client-state.ts
|
|
8691
8691
|
var MAX_CLIENT_STATE_REQUEST_BYTES = 5 * 1024 * 1024;
|
|
8692
8692
|
var MAX_CLIENT_STATE_BYTES_PER_USER = 10 * 1024 * 1024;
|
|
8693
|
+
var WORKSPACE_LAST_VIEWED_AT_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-last-viewed-at-";
|
|
8694
|
+
var WORKSPACE_ATTENTION_DONE_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-attention-done-";
|
|
8695
|
+
var WORKSPACE_STAGES_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-stages-";
|
|
8696
|
+
var orgUserClientStateKey = (prefix) => (organizationId, userId) => `${prefix}${organizationId}-${userId}`;
|
|
8697
|
+
var workspaceLastViewedAtClientStateKey = orgUserClientStateKey(WORKSPACE_LAST_VIEWED_AT_CLIENT_STATE_KEY_PREFIX);
|
|
8698
|
+
var workspaceAttentionDoneClientStateKey = orgUserClientStateKey(WORKSPACE_ATTENTION_DONE_CLIENT_STATE_KEY_PREFIX);
|
|
8699
|
+
var workspaceStagesClientStateKey = orgUserClientStateKey(WORKSPACE_STAGES_CLIENT_STATE_KEY_PREFIX);
|
|
8693
8700
|
|
|
8694
8701
|
// ../shared/src/routes/workspaces.ts
|
|
8695
8702
|
import { z as z17 } from "zod";
|
|
8696
8703
|
var WORKSPACE_STATUSES = ["active", "sleeping", "archived", "preparing", "error"];
|
|
8704
|
+
var STALE_PREPARING_MS = 10 * 6e4;
|
|
8697
8705
|
var WORKSPACE_STATUS_FILTERS = WORKSPACE_STATUSES.map((status) => status === "error" ? "failed" : status);
|
|
8698
8706
|
var WORKSPACE_SORT_CHOICES = [
|
|
8699
8707
|
["manual", "Custom"],
|
|
@@ -8756,7 +8764,6 @@ var workspaceChangedEventSchema = z18.discriminatedUnion("type", [
|
|
|
8756
8764
|
import { z as z19 } from "zod";
|
|
8757
8765
|
var presenceStatusSchema = z19.enum(["online", "typing"]);
|
|
8758
8766
|
var presenceLocationSchema = z19.object({
|
|
8759
|
-
environmentId: z19.string().optional(),
|
|
8760
8767
|
workspaceId: z19.string().optional()
|
|
8761
8768
|
});
|
|
8762
8769
|
var presenceEntrySchema = z19.object({
|
|
@@ -8894,6 +8901,24 @@ ${CLOSE_MARKER}
|
|
|
8894
8901
|
${message}`;
|
|
8895
8902
|
}
|
|
8896
8903
|
|
|
8904
|
+
// ../shared/src/workspace-sidebar-state.ts
|
|
8905
|
+
var FIRST_BOOT_GRACE_MS = 15 * 6e4;
|
|
8906
|
+
var SLOW_ENGINE_GRACE_MS = 10 * 6e4;
|
|
8907
|
+
var WORKSPACE_STAGES = ["progress", "review", "backlog", "done"];
|
|
8908
|
+
var WORKSPACE_STAGE_LABELS = {
|
|
8909
|
+
progress: "In progress",
|
|
8910
|
+
review: "In review",
|
|
8911
|
+
backlog: "Backlog",
|
|
8912
|
+
done: "Done"
|
|
8913
|
+
};
|
|
8914
|
+
var IDLE_BACKLOG_MS = 3 * 24 * 60 * 6e4;
|
|
8915
|
+
var WORKSPACE_LIST_SECTIONS = ["needs", "pinned", ...WORKSPACE_STAGES];
|
|
8916
|
+
var WORKSPACE_LIST_SECTION_LABELS = {
|
|
8917
|
+
needs: "Needs you",
|
|
8918
|
+
pinned: "Pinned",
|
|
8919
|
+
...WORKSPACE_STAGE_LABELS
|
|
8920
|
+
};
|
|
8921
|
+
|
|
8897
8922
|
// ../shared/src/onboarding-emails.ts
|
|
8898
8923
|
var EMAIL_KEYS = [
|
|
8899
8924
|
"welcome",
|
|
@@ -9209,6 +9234,7 @@ export {
|
|
|
9209
9234
|
USER_MESSAGE_ID_PAYLOAD_KEY,
|
|
9210
9235
|
CODEX_ASP_ITEM_ID_PAYLOAD_KEY,
|
|
9211
9236
|
CODEX_ITEM_EVENT_TYPE,
|
|
9237
|
+
CODEX_ITEM_PARTIAL_EVENT_TYPE,
|
|
9212
9238
|
CODEX_HISTORY_FORMAT_EVENT_TYPE,
|
|
9213
9239
|
getEventStreamId,
|
|
9214
9240
|
CODEX_QUOTA_STATUS_EVENT_TYPE,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
isValidAgentProvider,
|
|
15
15
|
parsePosixEnvFile,
|
|
16
16
|
readReplicasRuntimeEnv
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FO6FOZVV.js";
|
|
18
18
|
|
|
19
19
|
// src/runtime-env-loader.ts
|
|
20
20
|
import { readFileSync } from "fs";
|
|
@@ -233,12 +233,12 @@ var MonolithService = class {
|
|
|
233
233
|
return createErrorResult({ message: error instanceof Error ? error.message : String(error), code: "unavailable" });
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
async sendEvent(event) {
|
|
236
|
+
async sendEvent(event, signal) {
|
|
237
237
|
if (!ENGINE_ENV.REPLICAS_WORKSPACE_ID) {
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
240
|
try {
|
|
241
|
-
const response = await monolithRequest("/v1/engine/webhook", { body: event });
|
|
241
|
+
const response = await monolithRequest("/v1/engine/webhook", { body: event, signal });
|
|
242
242
|
if (!response.ok) {
|
|
243
243
|
const errorText = await response.text();
|
|
244
244
|
console.error(`[MonolithService] Failed to send event: ${response.status} ${errorText}`);
|
|
@@ -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-6UW2SECH.js";
|
|
7
|
+
import "./chunk-UT2HOSDY.js";
|
|
8
|
+
import "./chunk-ARKYATUE.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-FO6FOZVV.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-BOS5XATR.js";
|
|
11
|
+
import "./chunk-ARKYATUE.js";
|
|
12
12
|
import {
|
|
13
13
|
AGENT,
|
|
14
14
|
headlessAgentRequestSchema
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FO6FOZVV.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-6UW2SECH.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-IRZH6C2B.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-7SUUDOZB.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-UT2HOSDY.js";
|
|
83
83
|
import {
|
|
84
84
|
AspClient,
|
|
85
85
|
getCodexModelProvider
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-BOS5XATR.js";
|
|
87
87
|
import {
|
|
88
88
|
SUBPROCESS_MAX_BUFFER,
|
|
89
89
|
execAsync,
|
|
90
90
|
execFileAsync
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-ARKYATUE.js";
|
|
92
92
|
import {
|
|
93
93
|
isRecord as isRecord2
|
|
94
94
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -117,6 +117,7 @@ import {
|
|
|
117
117
|
CODEX_ASP_ITEM_ID_PAYLOAD_KEY,
|
|
118
118
|
CODEX_HISTORY_FORMAT_EVENT_TYPE,
|
|
119
119
|
CODEX_ITEM_EVENT_TYPE,
|
|
120
|
+
CODEX_ITEM_PARTIAL_EVENT_TYPE,
|
|
120
121
|
CODEX_QUOTA_STATUS_EVENT_TYPE,
|
|
121
122
|
CONTEXT_USAGE_EVENT_TYPE,
|
|
122
123
|
CREDENTIAL_METHOD,
|
|
@@ -315,7 +316,7 @@ import {
|
|
|
315
316
|
workspaceCredentialProviderSchema,
|
|
316
317
|
workspaceTokenRequestSchema,
|
|
317
318
|
workspaceTokenResponseSchema
|
|
318
|
-
} from "./chunk-
|
|
319
|
+
} from "./chunk-FO6FOZVV.js";
|
|
319
320
|
import {
|
|
320
321
|
cloneMcpConfig,
|
|
321
322
|
ensureCompatibilityImports,
|
|
@@ -60539,6 +60540,7 @@ function terminalErrorsFromEvent(event, provider) {
|
|
|
60539
60540
|
return errors.length > 0 ? errors : void 0;
|
|
60540
60541
|
}
|
|
60541
60542
|
var LAST_MESSAGE_PREVIEW_MAX = 200;
|
|
60543
|
+
var FINAL_MESSAGE_MAX = 6e3;
|
|
60542
60544
|
var MAX_ACCEPTED_SEND_RESPONSES = 50;
|
|
60543
60545
|
var MAX_REMOVED_MESSAGE_IDS = 6e3;
|
|
60544
60546
|
var SUBAGENT_POLL_INTERVAL_MS = 2e3;
|
|
@@ -61007,6 +61009,7 @@ var ChatService = class {
|
|
|
61007
61009
|
chat.activeMessageId = null;
|
|
61008
61010
|
chat.pendingMessageIds = [];
|
|
61009
61011
|
chat.acceptedUserEvents.clear();
|
|
61012
|
+
chat.turnAnswer = null;
|
|
61010
61013
|
this.touch(chat);
|
|
61011
61014
|
await this.publish({
|
|
61012
61015
|
type: "chat.interrupted",
|
|
@@ -61029,6 +61032,7 @@ var ChatService = class {
|
|
|
61029
61032
|
chat.activeMessageId = null;
|
|
61030
61033
|
chat.pendingMessageIds = [];
|
|
61031
61034
|
chat.acceptedUserEvents.clear();
|
|
61035
|
+
chat.turnAnswer = null;
|
|
61032
61036
|
const goal = await chat.provider.clearGoal(chat.persisted.model);
|
|
61033
61037
|
this.touch(chat);
|
|
61034
61038
|
await this.publish({
|
|
@@ -61611,6 +61615,8 @@ var ChatService = class {
|
|
|
61611
61615
|
hasActiveTurn: false,
|
|
61612
61616
|
observedBranchesByRepo: /* @__PURE__ */ new Map(),
|
|
61613
61617
|
lastTurnErrors: null,
|
|
61618
|
+
turnRequest: null,
|
|
61619
|
+
turnAnswer: null,
|
|
61614
61620
|
settledProcessing: null,
|
|
61615
61621
|
errorNotificationTargets: /* @__PURE__ */ new Map(),
|
|
61616
61622
|
activeErrorNotificationTargets: [],
|
|
@@ -61656,6 +61662,9 @@ var ChatService = class {
|
|
|
61656
61662
|
activateTurn(chat, messageId) {
|
|
61657
61663
|
chat.hasActiveTurn = true;
|
|
61658
61664
|
chat.activeMessageId = messageId;
|
|
61665
|
+
const request = chat.acceptedUserEvents.get(messageId)?.payload.message;
|
|
61666
|
+
chat.turnRequest = typeof request === "string" ? request.trim().slice(0, LAST_MESSAGE_PREVIEW_MAX) : null;
|
|
61667
|
+
chat.turnAnswer = null;
|
|
61659
61668
|
chat.settledProcessing = null;
|
|
61660
61669
|
const context = this.agentChatActivityTrackerService.noteTurnStarted(
|
|
61661
61670
|
chat.persisted.id,
|
|
@@ -61714,14 +61723,19 @@ var ChatService = class {
|
|
|
61714
61723
|
});
|
|
61715
61724
|
}
|
|
61716
61725
|
this.agentTokenUsageTracker.noteAgentEvent(chatId, event);
|
|
61717
|
-
|
|
61718
|
-
|
|
61719
|
-
|
|
61720
|
-
|
|
61721
|
-
|
|
61722
|
-
|
|
61723
|
-
|
|
61724
|
-
|
|
61726
|
+
const parentToolUseId = typeof event.payload.parent_tool_use_id === "string" ? event.payload.parent_tool_use_id : null;
|
|
61727
|
+
const messages = parseDisplayMessages([event], chat.persisted.provider, { filter: false, parentToolUseId });
|
|
61728
|
+
if (chat.hasActiveTurn) this.agentChatActivityTrackerService.noteSkillMcpCalls(chatId, messages);
|
|
61729
|
+
if (!parentToolUseId && event.type !== CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE && event.type !== CODEX_ITEM_PARTIAL_EVENT_TYPE) {
|
|
61730
|
+
for (const message of messages) {
|
|
61731
|
+
if (message.type === "agent") {
|
|
61732
|
+
if (message.content.trim()) chat.turnAnswer = `${chat.turnAnswer ? `${chat.turnAnswer}
|
|
61733
|
+
|
|
61734
|
+
` : ""}${message.content}`.slice(-FINAL_MESSAGE_MAX);
|
|
61735
|
+
} else if (message.type !== "reasoning" && message.type !== "background_task") {
|
|
61736
|
+
chat.turnAnswer = null;
|
|
61737
|
+
}
|
|
61738
|
+
}
|
|
61725
61739
|
}
|
|
61726
61740
|
const terminalErrors = terminalErrorsFromEvent(event, chat.persisted.provider);
|
|
61727
61741
|
if (terminalErrors !== void 0) {
|
|
@@ -61791,7 +61805,8 @@ var ChatService = class {
|
|
|
61791
61805
|
if (!chat) {
|
|
61792
61806
|
return;
|
|
61793
61807
|
}
|
|
61794
|
-
|
|
61808
|
+
const userTurn = chat.hasActiveTurn;
|
|
61809
|
+
if (!userTurn) {
|
|
61795
61810
|
const queuedMessageIds = new Set(chat.provider.getQueue().map((message) => message.id));
|
|
61796
61811
|
const completedMessageId = chat.pendingMessageIds.find((messageId) => !queuedMessageIds.has(messageId));
|
|
61797
61812
|
chat.pendingMessageIds = chat.pendingMessageIds.filter((messageId) => messageId !== completedMessageId);
|
|
@@ -61814,11 +61829,13 @@ var ChatService = class {
|
|
|
61814
61829
|
}
|
|
61815
61830
|
const stillProcessing = processing || forked;
|
|
61816
61831
|
chat.settledProcessing = stillProcessing;
|
|
61817
|
-
|
|
61818
|
-
|
|
61832
|
+
const answer = chat.turnAnswer;
|
|
61833
|
+
chat.turnAnswer = null;
|
|
61834
|
+
const responseComplete = this.publishTurnCompleted(chat, completedAt, stillProcessing, answer, userTurn);
|
|
61835
|
+
await this.publishAgentTurnCompleteWebhook(chat, completedAt, stillProcessing, forked ? null : exhaustion, responseComplete);
|
|
61819
61836
|
this.notifyWorkspaceAgentIdle();
|
|
61820
61837
|
}
|
|
61821
|
-
publishTurnCompleted(chat, completedAt, processing) {
|
|
61838
|
+
async publishTurnCompleted(chat, completedAt, processing, answer, userTurn) {
|
|
61822
61839
|
if (chat.persisted.parentChatId) {
|
|
61823
61840
|
this.publish({ type: "chat.updated", payload: { chat: this.toSummary(chat) } }).catch(() => {
|
|
61824
61841
|
});
|
|
@@ -61834,8 +61851,15 @@ var ChatService = class {
|
|
|
61834
61851
|
}
|
|
61835
61852
|
}).catch(() => {
|
|
61836
61853
|
});
|
|
61837
|
-
monolithService.sendEvent({
|
|
61838
|
-
|
|
61854
|
+
await monolithService.sendEvent({
|
|
61855
|
+
type: "agent_response_complete",
|
|
61856
|
+
payload: {
|
|
61857
|
+
completedAt,
|
|
61858
|
+
processing,
|
|
61859
|
+
...userTurn || answer ? { chatId: chat.persisted.id } : {},
|
|
61860
|
+
...answer ? { finalMessage: answer, ...chat.turnRequest ? { request: chat.turnRequest } : {} } : {}
|
|
61861
|
+
}
|
|
61862
|
+
}, AbortSignal.timeout(1e4));
|
|
61839
61863
|
}
|
|
61840
61864
|
notifyWorkspaceAgentIdle() {
|
|
61841
61865
|
if (this.getProcessingCount() > 0) return;
|
|
@@ -61928,7 +61952,7 @@ var ChatService = class {
|
|
|
61928
61952
|
} catch {
|
|
61929
61953
|
}
|
|
61930
61954
|
}
|
|
61931
|
-
async publishAgentTurnCompleteWebhook(chat, completedAt, processing
|
|
61955
|
+
async publishAgentTurnCompleteWebhook(chat, completedAt, processing, quotaExhaustion, responseComplete) {
|
|
61932
61956
|
const linearSessionId = ENGINE_ENV.REPLICAS_LINEAR_SESSION_ID;
|
|
61933
61957
|
const errors = chat.persisted.parentChatId === null ? chat.lastTurnErrors : null;
|
|
61934
61958
|
chat.lastTurnErrors = null;
|
|
@@ -61936,6 +61960,7 @@ var ChatService = class {
|
|
|
61936
61960
|
chat.activeErrorNotificationTargets = [];
|
|
61937
61961
|
const refreshedRepoStatuses = await this.refreshTurnRepos(chat);
|
|
61938
61962
|
const repoStatuses = refreshedRepoStatuses ?? [];
|
|
61963
|
+
await responseComplete;
|
|
61939
61964
|
if (chat.persisted.parentChatId) return;
|
|
61940
61965
|
const unlinkedPullRequestUrls = refreshedRepoStatuses ? pullRequestCheckService.takeUnlinkedPublishedUrls(
|
|
61941
61966
|
[chat.persisted.id, ...this.listChildChats(chat.persisted.id).map((child) => child.id)],
|
|
@@ -61944,8 +61969,9 @@ var ChatService = class {
|
|
|
61944
61969
|
try {
|
|
61945
61970
|
const payload = {
|
|
61946
61971
|
...linearSessionId ? { linearSessionId } : {},
|
|
61947
|
-
|
|
61972
|
+
completedAt,
|
|
61948
61973
|
processing,
|
|
61974
|
+
chatId: chat.persisted.id,
|
|
61949
61975
|
repoStatuses,
|
|
61950
61976
|
...unlinkedPullRequestUrls.length > 0 ? { unlinkedPullRequestUrls } : {},
|
|
61951
61977
|
...errors?.length ? { errors } : {},
|
|
@@ -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-IRZH6C2B.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-FO6FOZVV.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