replicas-engine 0.1.1727 → 0.1.1731
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-TWRX3YXW.js → asp-host-BNCBYTIZ.js} +6 -6
- package/dist/src/{chunk-GBVHK7GR.js → chunk-5K5WQE7A.js} +184 -108
- package/dist/src/{chunk-OY6X5AUJ.js → chunk-5Z7VROBY.js} +2 -2
- package/dist/src/{chunk-YKUHRKKX.js → chunk-6AKAVTQV.js} +2 -2
- package/dist/src/{chunk-NTSUADYM.js → chunk-DFLWLV43.js} +1 -1
- package/dist/src/{chunk-OAFO4KYM.js → chunk-IPZDXC3Q.js} +8 -8
- package/dist/src/{chunk-F2YDU3AP.js → chunk-MMNI5WIA.js} +3 -3
- package/dist/src/{chunk-2X4SV2H7.js → chunk-PI3F53DJ.js} +1 -1
- package/dist/src/{chunk-QN5PAZSN.js → chunk-Q4GZ2R6Y.js} +2 -2
- package/dist/src/{chunk-M6ELG3GK.js → chunk-SKAYIAKC.js} +1 -1
- package/dist/src/{chunk-LWHGKKNM.js → chunk-WQX56KJG.js} +1 -1
- package/dist/src/codemode-mcp.js +3 -3
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +4 -4
- package/dist/src/index.js +154 -54
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
listCodexModelsForDetails,
|
|
9
9
|
restartCodexAspHost,
|
|
10
10
|
restartCodexAspHostIfRunning
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-IPZDXC3Q.js";
|
|
12
|
+
import "./chunk-SKAYIAKC.js";
|
|
13
|
+
import "./chunk-5Z7VROBY.js";
|
|
14
|
+
import "./chunk-MMNI5WIA.js";
|
|
15
|
+
import "./chunk-DFLWLV43.js";
|
|
16
16
|
import "./chunk-UZSNFLDQ.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-5K5WQE7A.js";
|
|
18
18
|
import "./chunk-VEQXQN22.js";
|
|
19
19
|
export {
|
|
20
20
|
CODEX_ULTRAFAST_SERVICE_TIER,
|
|
@@ -1116,17 +1116,17 @@ var require_luxon = __commonJS({
|
|
|
1116
1116
|
constructor(dt, intl, opts) {
|
|
1117
1117
|
this.opts = opts;
|
|
1118
1118
|
this.originalZone = void 0;
|
|
1119
|
-
let
|
|
1119
|
+
let z49 = void 0;
|
|
1120
1120
|
if (this.opts.timeZone) {
|
|
1121
1121
|
this.dt = dt;
|
|
1122
1122
|
} else if (dt.zone.type === "fixed") {
|
|
1123
1123
|
const gmtOffset = -1 * (dt.offset / 60);
|
|
1124
1124
|
const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
|
|
1125
1125
|
if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {
|
|
1126
|
-
|
|
1126
|
+
z49 = offsetZ;
|
|
1127
1127
|
this.dt = dt;
|
|
1128
1128
|
} else {
|
|
1129
|
-
|
|
1129
|
+
z49 = "UTC";
|
|
1130
1130
|
this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({
|
|
1131
1131
|
minutes: dt.offset
|
|
1132
1132
|
});
|
|
@@ -1136,9 +1136,9 @@ var require_luxon = __commonJS({
|
|
|
1136
1136
|
this.dt = dt;
|
|
1137
1137
|
} else if (dt.zone.type === "iana") {
|
|
1138
1138
|
this.dt = dt;
|
|
1139
|
-
|
|
1139
|
+
z49 = dt.zone.name;
|
|
1140
1140
|
} else {
|
|
1141
|
-
|
|
1141
|
+
z49 = "UTC";
|
|
1142
1142
|
this.dt = dt.setZone("UTC").plus({
|
|
1143
1143
|
minutes: dt.offset
|
|
1144
1144
|
});
|
|
@@ -1147,7 +1147,7 @@ var require_luxon = __commonJS({
|
|
|
1147
1147
|
const intlOpts = {
|
|
1148
1148
|
...this.opts
|
|
1149
1149
|
};
|
|
1150
|
-
intlOpts.timeZone = intlOpts.timeZone ||
|
|
1150
|
+
intlOpts.timeZone = intlOpts.timeZone || z49;
|
|
1151
1151
|
this.dtf = getCachedDTF(intl, intlOpts);
|
|
1152
1152
|
}
|
|
1153
1153
|
format() {
|
|
@@ -9519,6 +9519,7 @@ var plain = {
|
|
|
9519
9519
|
teal: "#14b8a6",
|
|
9520
9520
|
lime: "#84cc16"
|
|
9521
9521
|
};
|
|
9522
|
+
var THEME_PREFERENCES = ["system", "light", "dark"];
|
|
9522
9523
|
var PALETTE_PRESETS = {
|
|
9523
9524
|
dark: ["default", "slate", "stone", "black", "high-contrast"],
|
|
9524
9525
|
light: ["default", "slate", "stone", "neutral", "high-contrast"]
|
|
@@ -9620,6 +9621,14 @@ var mix = (from, to, amount) => {
|
|
|
9620
9621
|
const target = channels(to);
|
|
9621
9622
|
return `#${channels(from).map((channel, index) => Math.round(channel + (target[index] - channel) * amount).toString(16).padStart(2, "0")).join("")}`;
|
|
9622
9623
|
};
|
|
9624
|
+
var linearChannels = (hex) => channels(hex).map((channel) => channel / 255).map((channel) => channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4);
|
|
9625
|
+
var luminance = (hex) => {
|
|
9626
|
+
const [r, g, b] = linearChannels(hex);
|
|
9627
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
9628
|
+
};
|
|
9629
|
+
var isHex = (value) => typeof value === "string" && /^#[0-9a-f]{6}$/i.test(value);
|
|
9630
|
+
var isCustomTheme = (value) => isRecord(value) && [value.background, value.foreground, value.accent].every(isHex);
|
|
9631
|
+
var customMode = ({ background, foreground }) => luminance(background) < luminance(foreground) ? "dark" : "light";
|
|
9623
9632
|
var DEFAULT_THEME = {
|
|
9624
9633
|
palette: "default",
|
|
9625
9634
|
accent: "green",
|
|
@@ -15266,9 +15275,10 @@ replicas theme set --theme dark --color-theme slate
|
|
|
15266
15275
|
replicas theme set --accent purple
|
|
15267
15276
|
replicas theme set --accent ff5500
|
|
15268
15277
|
replicas theme set --code 0d1117,e6ecf4,ff5500
|
|
15278
|
+
replicas theme publish --name "Ocean" --code 0b1622,e6f0f8,f2b94b --wallpaper ./ocean.webp --effect dither
|
|
15269
15279
|
\`\`\`
|
|
15270
15280
|
|
|
15271
|
-
A color theme always goes with \`--theme light\` or \`--theme dark\`. An accent is a preset name or any hex color. A theme code is three hex colors: background, text, accent. Write hex colors without the \`#\`, which the shell reads as a comment. \`replicas theme set --help\`
|
|
15281
|
+
A color theme always goes with \`--theme light\` or \`--theme dark\`. An accent is a preset name or any hex color. A theme code is three hex colors: background, text, accent. Write hex colors without the \`#\`, which the shell reads as a comment. \`replicas theme set --help\` and \`replicas theme publish --help\` list the options. For a look the presets don't cover, choose the three colors yourself and pass them as \`--code\`; the text has to read clearly on the background, or it is refused. \`replicas theme publish\` publishes to the Replicas gallery under the workspace writer's account (with optional \`--description\`, \`--wallpaper\`, \`--effect\`, and font flags).
|
|
15272
15282
|
|
|
15273
15283
|
It changes the theme of the one person who has written in this workspace, and prints their email. You cannot pick someone else. When several people have written here, or nobody has yet (a workspace started by an automation, another agent, the API or the CLI, until its person sends a message in it), it refuses: tell them they can change their own under **Themes** in the account menu. A workspace created before this command existed answers \`unknown command\`: say the same.
|
|
15274
15284
|
|
|
@@ -15681,6 +15691,10 @@ var ALERT_SOUND_FAMILIES = {
|
|
|
15681
15691
|
wood: ["ready", "pluck", "knock", "bloom", "steps"]
|
|
15682
15692
|
};
|
|
15683
15693
|
var ALERT_SOUNDS = [...ALERT_SOUND_FAMILIES.glass, ...ALERT_SOUND_FAMILIES.wood];
|
|
15694
|
+
var CHAT_TEXT_SIZES = ["small", "default", "large", "larger"];
|
|
15695
|
+
var APP_FONTS = ["inter", "system", "atkinson", "geist", "ibm-plex-sans", "source-sans", "lexend"];
|
|
15696
|
+
var CODE_FONTS = ["geist-mono", "system", "atkinson-mono", "jetbrains-mono", "fira-code", "source-code-pro", "ibm-plex-mono"];
|
|
15697
|
+
var WALLPAPER_EFFECTS = ["soft", "duotone", "dither", "none"];
|
|
15684
15698
|
var WALLPAPER_VIDEO_MAX_BYTES = 16 * 1024 * 1024;
|
|
15685
15699
|
var PUSH_WHEN_ACTIVE_COPY = {
|
|
15686
15700
|
wait: `Wait ${PUSH_HOLD_MINUTES} minutes`,
|
|
@@ -21806,6 +21820,9 @@ function percentage(tokens, maxTokens) {
|
|
|
21806
21820
|
if (!maxTokens || maxTokens <= 0) return 0;
|
|
21807
21821
|
return clampPercentage(tokens / maxTokens * 100);
|
|
21808
21822
|
}
|
|
21823
|
+
function providerContextUsage(usage) {
|
|
21824
|
+
return { ...usage, source: "provider_usage", percentage: percentage(usage.totalTokens, usage.maxTokens), categories: [], updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
21825
|
+
}
|
|
21809
21826
|
function autoCompactThresholdField(autoCompactThreshold) {
|
|
21810
21827
|
return typeof autoCompactThreshold === "number" && Number.isFinite(autoCompactThreshold) ? { autoCompactThreshold } : {};
|
|
21811
21828
|
}
|
|
@@ -21977,7 +21994,7 @@ async function withRetry(label, fn, options) {
|
|
|
21977
21994
|
}
|
|
21978
21995
|
|
|
21979
21996
|
// ../shared/src/tensorlake.ts
|
|
21980
|
-
var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-22-
|
|
21997
|
+
var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-22-v8495";
|
|
21981
21998
|
var TENSORLAKE_DISK_MB = 100 * 1024;
|
|
21982
21999
|
|
|
21983
22000
|
// ../shared/src/egress.ts
|
|
@@ -23421,8 +23438,65 @@ var webAuthRedeemResponseSchema = z41.object({
|
|
|
23421
23438
|
});
|
|
23422
23439
|
|
|
23423
23440
|
// ../shared/src/routes/themes.ts
|
|
23441
|
+
import { z as z43 } from "zod";
|
|
23442
|
+
|
|
23443
|
+
// ../shared/src/routes/marketplace.ts
|
|
23424
23444
|
import { z as z42 } from "zod";
|
|
23425
|
-
var
|
|
23445
|
+
var MARKETPLACE_NAME_MAX_LENGTH = 40;
|
|
23446
|
+
var MARKETPLACE_DESCRIPTION_MAX_LENGTH = 200;
|
|
23447
|
+
var MARKETPLACE_REPORT_MAX_LENGTH = 500;
|
|
23448
|
+
var themeColorsSchema = z42.object({
|
|
23449
|
+
palette: z42.custom((value) => PALETTES.some((palette) => palette === value)),
|
|
23450
|
+
accent: z42.custom((value) => ACCENTS.some((accent) => accent === value)),
|
|
23451
|
+
custom: z42.custom(isCustomTheme)
|
|
23452
|
+
});
|
|
23453
|
+
var wallpaperSchema = z42.object({ key: z42.string(), effect: z42.enum(WALLPAPER_EFFECTS) });
|
|
23454
|
+
function themeModes({ palette, custom }) {
|
|
23455
|
+
return palette === "custom" ? [customMode(custom)] : ["light", "dark"].filter((mode) => PALETTE_PRESETS[mode].some((name) => name === palette));
|
|
23456
|
+
}
|
|
23457
|
+
function themeMode(colors, mode) {
|
|
23458
|
+
const modes = themeModes(colors);
|
|
23459
|
+
if (modes.length === 1) return modes[0];
|
|
23460
|
+
return mode ?? "system";
|
|
23461
|
+
}
|
|
23462
|
+
var themeSettingsShape = {
|
|
23463
|
+
colors: themeColorsSchema,
|
|
23464
|
+
mode: z42.enum(THEME_PREFERENCES),
|
|
23465
|
+
chat_text_size: z42.enum(CHAT_TEXT_SIZES),
|
|
23466
|
+
app_font: z42.enum(APP_FONTS),
|
|
23467
|
+
code_font: z42.enum(CODE_FONTS)
|
|
23468
|
+
};
|
|
23469
|
+
var themeContentSchema = z42.object({
|
|
23470
|
+
...themeSettingsShape,
|
|
23471
|
+
mode: themeSettingsShape.mode.optional(),
|
|
23472
|
+
chat_text_size: themeSettingsShape.chat_text_size.default(DEFAULT_USER_PREFERENCES.chat_text_size),
|
|
23473
|
+
app_font: themeSettingsShape.app_font.default(DEFAULT_USER_PREFERENCES.app_font),
|
|
23474
|
+
code_font: themeSettingsShape.code_font.default(DEFAULT_USER_PREFERENCES.code_font),
|
|
23475
|
+
wallpaper: wallpaperSchema.nullable()
|
|
23476
|
+
}).transform((content) => ({ ...content, mode: themeMode(content.colors, content.mode) }));
|
|
23477
|
+
var publishBase = {
|
|
23478
|
+
name: z42.string().trim().min(1).max(MARKETPLACE_NAME_MAX_LENGTH),
|
|
23479
|
+
description: z42.string().trim().max(MARKETPLACE_DESCRIPTION_MAX_LENGTH).nullable()
|
|
23480
|
+
};
|
|
23481
|
+
var themeFields = { ...publishBase, ...themeSettingsShape, wallpaper: z42.object({ key: z42.string().nullable(), effect: z42.enum(WALLPAPER_EFFECTS) }).nullable() };
|
|
23482
|
+
var updateMarketplaceThemeSchema = z42.object(themeFields);
|
|
23483
|
+
var publishMarketplaceItemSchema = z42.discriminatedUnion("kind", [
|
|
23484
|
+
z42.object({ kind: z42.literal("theme"), ...themeFields }),
|
|
23485
|
+
z42.object({ kind: z42.literal("avatar"), ...publishBase, workspace_id: z42.string().uuid() })
|
|
23486
|
+
]);
|
|
23487
|
+
var reportMarketplaceItemSchema = z42.object({ reason: z42.string().trim().min(1).max(MARKETPLACE_REPORT_MAX_LENGTH) });
|
|
23488
|
+
var adminUpdateMarketplaceItemSchema = z42.object({ hidden: z42.boolean() });
|
|
23489
|
+
|
|
23490
|
+
// ../shared/src/routes/themes.ts
|
|
23491
|
+
var updateThemeRequestSchema = z43.object({ theme: z43.string(), palette: z43.string(), accent: z43.string(), code: z43.string() }).partial();
|
|
23492
|
+
var publishThemeRequestSchema = updateThemeRequestSchema.extend({
|
|
23493
|
+
name: z43.string().trim().min(1).max(MARKETPLACE_NAME_MAX_LENGTH),
|
|
23494
|
+
description: z43.string().trim().max(MARKETPLACE_DESCRIPTION_MAX_LENGTH).nullable().optional(),
|
|
23495
|
+
effect: z43.enum(WALLPAPER_EFFECTS).optional(),
|
|
23496
|
+
app_font: z43.enum(APP_FONTS).optional(),
|
|
23497
|
+
code_font: z43.enum(CODE_FONTS).optional(),
|
|
23498
|
+
chat_text_size: z43.enum(CHAT_TEXT_SIZES).optional()
|
|
23499
|
+
});
|
|
23426
23500
|
|
|
23427
23501
|
// ../shared/src/routes/client-state.ts
|
|
23428
23502
|
var MAX_CLIENT_STATE_REQUEST_BYTES = 5 * 1024 * 1024;
|
|
@@ -23448,107 +23522,107 @@ var promptHistoryClientStateKey = orgUserClientStateKey(PROMPT_HISTORY_CLIENT_ST
|
|
|
23448
23522
|
var workspaceSearchOpensClientStateKey = orgUserClientStateKey(WORKSPACE_SEARCH_OPENS_CLIENT_STATE_KEY_PREFIX);
|
|
23449
23523
|
|
|
23450
23524
|
// ../shared/src/routes/workspace-events.ts
|
|
23451
|
-
import { z as
|
|
23525
|
+
import { z as z45 } from "zod";
|
|
23452
23526
|
|
|
23453
23527
|
// ../shared/src/routes/presence.ts
|
|
23454
|
-
import { z as
|
|
23455
|
-
var presenceStatusSchema =
|
|
23456
|
-
var presenceLocationSchema =
|
|
23457
|
-
workspaceId:
|
|
23528
|
+
import { z as z44 } from "zod";
|
|
23529
|
+
var presenceStatusSchema = z44.enum(["online", "typing"]);
|
|
23530
|
+
var presenceLocationSchema = z44.object({
|
|
23531
|
+
workspaceId: z44.string().optional()
|
|
23458
23532
|
});
|
|
23459
|
-
var presenceEntrySchema =
|
|
23460
|
-
userId:
|
|
23533
|
+
var presenceEntrySchema = z44.object({
|
|
23534
|
+
userId: z44.string(),
|
|
23461
23535
|
status: presenceStatusSchema,
|
|
23462
23536
|
location: presenceLocationSchema,
|
|
23463
|
-
ts:
|
|
23537
|
+
ts: z44.string()
|
|
23464
23538
|
});
|
|
23465
|
-
var updatePresenceRequestSchema =
|
|
23539
|
+
var updatePresenceRequestSchema = z44.object({
|
|
23466
23540
|
status: presenceStatusSchema,
|
|
23467
23541
|
location: presenceLocationSchema.optional()
|
|
23468
23542
|
});
|
|
23469
23543
|
|
|
23470
23544
|
// ../shared/src/routes/workspace-events.ts
|
|
23471
|
-
var workspaceTurnCompletionSchema =
|
|
23472
|
-
workspaceName:
|
|
23473
|
-
completedAt:
|
|
23474
|
-
processing:
|
|
23475
|
-
pullRequestFeedback:
|
|
23476
|
-
attention:
|
|
23545
|
+
var workspaceTurnCompletionSchema = z45.object({
|
|
23546
|
+
workspaceName: z45.string(),
|
|
23547
|
+
completedAt: z45.string(),
|
|
23548
|
+
processing: z45.boolean().optional(),
|
|
23549
|
+
pullRequestFeedback: z45.boolean().optional(),
|
|
23550
|
+
attention: z45.object({ reason: z45.enum(CHAT_ATTENTION_REASONS), userId: z45.string() }).optional()
|
|
23477
23551
|
});
|
|
23478
|
-
var inputRequestRaisedSchema =
|
|
23479
|
-
var workspaceEventSchemaByType =
|
|
23480
|
-
|
|
23481
|
-
type:
|
|
23482
|
-
workspaceId:
|
|
23483
|
-
accessChangedFor:
|
|
23484
|
-
accessChangedForOrg:
|
|
23485
|
-
workspace:
|
|
23486
|
-
name:
|
|
23552
|
+
var inputRequestRaisedSchema = z45.object({ reason: z45.enum(INPUT_REQUEST_REASONS), userId: z45.string(), chatId: z45.string(), since: z45.string() });
|
|
23553
|
+
var workspaceEventSchemaByType = z45.discriminatedUnion("type", [
|
|
23554
|
+
z45.object({
|
|
23555
|
+
type: z45.literal("workspace.changed"),
|
|
23556
|
+
workspaceId: z45.string(),
|
|
23557
|
+
accessChangedFor: z45.string().optional(),
|
|
23558
|
+
accessChangedForOrg: z45.literal(true).optional(),
|
|
23559
|
+
workspace: z45.object({ status: z45.enum(WORKSPACE_STATUSES), last_activity_at: z45.string().nullable() }).optional(),
|
|
23560
|
+
name: z45.string().optional(),
|
|
23487
23561
|
completion: workspaceTurnCompletionSchema.optional(),
|
|
23488
|
-
ts:
|
|
23562
|
+
ts: z45.string()
|
|
23489
23563
|
}),
|
|
23490
|
-
|
|
23491
|
-
type:
|
|
23492
|
-
workspaceId:
|
|
23493
|
-
chatId:
|
|
23494
|
-
ts:
|
|
23564
|
+
z45.object({
|
|
23565
|
+
type: z45.literal("workspace.chat.changed"),
|
|
23566
|
+
workspaceId: z45.string(),
|
|
23567
|
+
chatId: z45.string(),
|
|
23568
|
+
ts: z45.string()
|
|
23495
23569
|
}),
|
|
23496
|
-
|
|
23497
|
-
type:
|
|
23498
|
-
workspaceId:
|
|
23499
|
-
chatId:
|
|
23500
|
-
afterCursor:
|
|
23501
|
-
processing:
|
|
23502
|
-
ts:
|
|
23570
|
+
z45.object({
|
|
23571
|
+
type: z45.literal("workspace.chat.advanced"),
|
|
23572
|
+
workspaceId: z45.string(),
|
|
23573
|
+
chatId: z45.string(),
|
|
23574
|
+
afterCursor: z45.string().optional(),
|
|
23575
|
+
processing: z45.boolean(),
|
|
23576
|
+
ts: z45.string()
|
|
23503
23577
|
}),
|
|
23504
|
-
|
|
23505
|
-
type:
|
|
23506
|
-
workspaceId:
|
|
23507
|
-
ts:
|
|
23578
|
+
z45.object({
|
|
23579
|
+
type: z45.literal("mobile-testing.changed"),
|
|
23580
|
+
workspaceId: z45.string(),
|
|
23581
|
+
ts: z45.string()
|
|
23508
23582
|
}),
|
|
23509
|
-
|
|
23510
|
-
type:
|
|
23511
|
-
workspaceId:
|
|
23512
|
-
ts:
|
|
23583
|
+
z45.object({
|
|
23584
|
+
type: z45.literal("variable-request.changed"),
|
|
23585
|
+
workspaceId: z45.string(),
|
|
23586
|
+
ts: z45.string()
|
|
23513
23587
|
}),
|
|
23514
|
-
|
|
23515
|
-
type:
|
|
23516
|
-
workspaceId:
|
|
23517
|
-
ts:
|
|
23588
|
+
z45.object({
|
|
23589
|
+
type: z45.literal("local-control-request.changed"),
|
|
23590
|
+
workspaceId: z45.string(),
|
|
23591
|
+
ts: z45.string()
|
|
23518
23592
|
}),
|
|
23519
|
-
|
|
23520
|
-
type:
|
|
23521
|
-
prUrl:
|
|
23522
|
-
ts:
|
|
23593
|
+
z45.object({
|
|
23594
|
+
type: z45.literal("pull-request.changed"),
|
|
23595
|
+
prUrl: z45.string(),
|
|
23596
|
+
ts: z45.string()
|
|
23523
23597
|
}),
|
|
23524
|
-
|
|
23525
|
-
type:
|
|
23526
|
-
workspaceId:
|
|
23527
|
-
subagent:
|
|
23528
|
-
ts:
|
|
23598
|
+
z45.object({
|
|
23599
|
+
type: z45.enum(["manager.subagent.changed", "mothership.subagent.changed"]),
|
|
23600
|
+
workspaceId: z45.string(),
|
|
23601
|
+
subagent: z45.object({ id: z45.string(), name: z45.string(), prUrl: z45.string().nullable() }),
|
|
23602
|
+
ts: z45.string()
|
|
23529
23603
|
}),
|
|
23530
|
-
|
|
23531
|
-
|
|
23532
|
-
|
|
23533
|
-
|
|
23534
|
-
type:
|
|
23535
|
-
workspaceId:
|
|
23536
|
-
workspaceName:
|
|
23537
|
-
sharedWithUserId:
|
|
23538
|
-
sharedByName:
|
|
23539
|
-
ts:
|
|
23604
|
+
z45.object({ type: z45.enum(["manager.board.changed", "mothership.board.changed"]), workspaceId: z45.string(), ts: z45.string() }),
|
|
23605
|
+
z45.object({ type: z45.literal("issues.synced"), syncId: z45.number(), ts: z45.string() }),
|
|
23606
|
+
z45.object({ type: z45.literal("needs-you.changed"), workspaceId: z45.string().nullable(), userId: z45.string().optional(), request: inputRequestRaisedSchema.optional(), ts: z45.string() }),
|
|
23607
|
+
z45.object({
|
|
23608
|
+
type: z45.literal("workspace.shared"),
|
|
23609
|
+
workspaceId: z45.string(),
|
|
23610
|
+
workspaceName: z45.string(),
|
|
23611
|
+
sharedWithUserId: z45.string(),
|
|
23612
|
+
sharedByName: z45.string(),
|
|
23613
|
+
ts: z45.string()
|
|
23540
23614
|
}),
|
|
23541
|
-
|
|
23615
|
+
z45.object({ type: z45.literal("client-state.changed"), userId: z45.string(), keys: z45.array(z45.string()), ts: z45.string() })
|
|
23542
23616
|
]);
|
|
23543
|
-
var workspaceChangedEventSchema =
|
|
23617
|
+
var workspaceChangedEventSchema = z45.union([
|
|
23544
23618
|
workspaceEventSchemaByType,
|
|
23545
|
-
|
|
23546
|
-
|
|
23619
|
+
z45.object({ type: z45.literal("presence.changed"), userId: z45.string(), entry: presenceEntrySchema.nullable(), ts: z45.string() }),
|
|
23620
|
+
z45.object({ type: z45.literal("presence.changed"), ts: z45.string() })
|
|
23547
23621
|
]);
|
|
23548
23622
|
|
|
23549
23623
|
// ../shared/src/routes/review-messages.ts
|
|
23550
|
-
import { z as
|
|
23551
|
-
var sendPullRequestReviewMessageRequestSchema =
|
|
23624
|
+
import { z as z46 } from "zod";
|
|
23625
|
+
var sendPullRequestReviewMessageRequestSchema = z46.object({
|
|
23552
23626
|
...sendChatMessageRequestSchema.pick({
|
|
23553
23627
|
message: true,
|
|
23554
23628
|
messageId: true,
|
|
@@ -23561,8 +23635,8 @@ var sendPullRequestReviewMessageRequestSchema = z45.object({
|
|
|
23561
23635
|
ultrafastMode: true
|
|
23562
23636
|
}).shape,
|
|
23563
23637
|
/** Starts a new chat instead of continuing the PR's review chat. The provider only applies to a new chat. */
|
|
23564
|
-
newChat:
|
|
23565
|
-
provider:
|
|
23638
|
+
newChat: z46.boolean().optional(),
|
|
23639
|
+
provider: z46.enum(VALID_AGENT_PROVIDERS).optional()
|
|
23566
23640
|
});
|
|
23567
23641
|
|
|
23568
23642
|
// ../shared/src/audit-log.ts
|
|
@@ -24284,40 +24358,40 @@ function isSkillRegistryManifest(value) {
|
|
|
24284
24358
|
}
|
|
24285
24359
|
|
|
24286
24360
|
// ../shared/src/routes/variable-requests.ts
|
|
24287
|
-
import { z as
|
|
24361
|
+
import { z as z47 } from "zod";
|
|
24288
24362
|
var VARIABLE_REQUEST_WAIT = { defaultMs: 10 * 6e4, maxMs: 30 * 6e4, pollMs: 3e3, waiterStaleMs: 15e3 };
|
|
24289
24363
|
var VARIABLE_REQUEST_DESTINATIONS = ["environment", "workspace"];
|
|
24290
|
-
var requestedVariableSchema =
|
|
24291
|
-
key:
|
|
24292
|
-
required:
|
|
24293
|
-
replace:
|
|
24364
|
+
var requestedVariableSchema = z47.object({
|
|
24365
|
+
key: z47.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(ENVIRONMENT_SETUP_LIMITS.variableKeyChars),
|
|
24366
|
+
required: z47.boolean(),
|
|
24367
|
+
replace: z47.boolean().optional()
|
|
24294
24368
|
});
|
|
24295
|
-
var requestedVariablesSchema =
|
|
24296
|
-
var createVariableRequestSchema =
|
|
24369
|
+
var requestedVariablesSchema = z47.array(requestedVariableSchema).min(1, "must not be empty").max(ENVIRONMENT_SETUP_LIMITS.variables).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys");
|
|
24370
|
+
var createVariableRequestSchema = z47.object({
|
|
24297
24371
|
variables: requestedVariablesSchema,
|
|
24298
|
-
reason:
|
|
24299
|
-
wait:
|
|
24372
|
+
reason: z47.string().trim().max(500).nullish().transform((value) => value || null),
|
|
24373
|
+
wait: z47.boolean().default(true)
|
|
24300
24374
|
});
|
|
24301
|
-
var respondVariableRequestSchema =
|
|
24302
|
-
|
|
24303
|
-
action:
|
|
24304
|
-
destination:
|
|
24375
|
+
var respondVariableRequestSchema = z47.discriminatedUnion("action", [
|
|
24376
|
+
z47.object({
|
|
24377
|
+
action: z47.literal("provide"),
|
|
24378
|
+
destination: z47.enum(VARIABLE_REQUEST_DESTINATIONS),
|
|
24305
24379
|
/** Defaults to the workspace's environment, so older clients keep saving there. */
|
|
24306
|
-
environment_ids:
|
|
24307
|
-
overwrite:
|
|
24308
|
-
values:
|
|
24380
|
+
environment_ids: z47.array(z47.string().uuid()).optional(),
|
|
24381
|
+
overwrite: z47.boolean().optional(),
|
|
24382
|
+
values: z47.record(z47.string().regex(VARIABLE_KEY_RE), z47.string())
|
|
24309
24383
|
}),
|
|
24310
|
-
|
|
24384
|
+
z47.object({ action: z47.literal("skip") })
|
|
24311
24385
|
]);
|
|
24312
24386
|
|
|
24313
24387
|
// ../shared/src/routes/local-control-requests.ts
|
|
24314
|
-
import { z as
|
|
24315
|
-
var createLocalControlRequestSchema =
|
|
24316
|
-
reason:
|
|
24317
|
-
wait:
|
|
24388
|
+
import { z as z48 } from "zod";
|
|
24389
|
+
var createLocalControlRequestSchema = z48.object({
|
|
24390
|
+
reason: z48.string().trim().max(500).optional().transform((value) => value || null),
|
|
24391
|
+
wait: z48.boolean().default(true)
|
|
24318
24392
|
});
|
|
24319
|
-
var respondLocalControlRequestSchema =
|
|
24320
|
-
var setLocalControlSchema =
|
|
24393
|
+
var respondLocalControlRequestSchema = z48.object({ action: z48.enum(["allow", "dismiss"]) });
|
|
24394
|
+
var setLocalControlSchema = z48.object({ enabled: z48.boolean() });
|
|
24321
24395
|
|
|
24322
24396
|
export {
|
|
24323
24397
|
ENGINE_SEND_MESSAGE_FAILED_ERROR,
|
|
@@ -24583,6 +24657,7 @@ export {
|
|
|
24583
24657
|
canonicalizeChatTranscriptBlocks,
|
|
24584
24658
|
lastUserBlockText,
|
|
24585
24659
|
percentage,
|
|
24660
|
+
providerContextUsage,
|
|
24586
24661
|
autoCompactThresholdField,
|
|
24587
24662
|
normalizeAutoCompactThreshold,
|
|
24588
24663
|
clampTokensToWindow,
|
|
@@ -24616,6 +24691,7 @@ export {
|
|
|
24616
24691
|
parseProxyRouteCheck,
|
|
24617
24692
|
headlessAgentRequestSchema,
|
|
24618
24693
|
headlessAgentUsagePath,
|
|
24694
|
+
isAuthenticationErrorText,
|
|
24619
24695
|
isClaudeAuthErrorText,
|
|
24620
24696
|
isCodexAuthError,
|
|
24621
24697
|
serializeMuseAuthFile,
|
|
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
SUBPROCESS_MAX_BUFFER,
|
|
6
6
|
execFileAsync
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DFLWLV43.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
provisionedDeviceSchema,
|
|
22
22
|
readReplicasRuntimeEnv,
|
|
23
23
|
serializePosixEnvFile
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-5K5WQE7A.js";
|
|
25
25
|
|
|
26
26
|
// src/runtime-env-loader.ts
|
|
27
27
|
import { readFileSync } from "fs";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
ENGINE_ENV,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
runGitCommand
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5Z7VROBY.js";
|
|
9
9
|
import {
|
|
10
10
|
COMMAND_PROTECTION_MAX_MESSAGE_FILE_BYTES,
|
|
11
11
|
COMMAND_PROTECTION_REPO_GIT_ARGS,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
parseCommandProtectionRequest,
|
|
19
19
|
toCommandProtectionRepoState,
|
|
20
20
|
withRetry
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-5K5WQE7A.js";
|
|
22
22
|
|
|
23
23
|
// src/services/command-protection-service.ts
|
|
24
24
|
import { readFile, stat } from "fs/promises";
|
|
@@ -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-5K5WQE7A.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
subagentCodexMcpConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SKAYIAKC.js";
|
|
7
7
|
import {
|
|
8
8
|
ENGINE_ENV,
|
|
9
9
|
UNQUOTED_PATHS_CONFIG,
|
|
@@ -15,15 +15,15 @@ import {
|
|
|
15
15
|
resolveDiffBase,
|
|
16
16
|
runGitCommand,
|
|
17
17
|
setAgentCredentialSnapshot
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-5Z7VROBY.js";
|
|
19
19
|
import {
|
|
20
20
|
AppServerProcess,
|
|
21
21
|
buildCodexAgentEnv
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-MMNI5WIA.js";
|
|
23
23
|
import {
|
|
24
24
|
SUBPROCESS_MAX_BUFFER,
|
|
25
25
|
execFileAsync
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-DFLWLV43.js";
|
|
27
27
|
import {
|
|
28
28
|
isRecord
|
|
29
29
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
shrunkImageSize,
|
|
69
69
|
splitManagerInstructions,
|
|
70
70
|
withTimeout
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-5K5WQE7A.js";
|
|
72
72
|
|
|
73
73
|
// src/managers/codex-token-manager.ts
|
|
74
74
|
import { promises as fs } from "fs";
|
|
@@ -340,7 +340,7 @@ async function withdrawAgentLogin(provider, { envKeys, files }) {
|
|
|
340
340
|
{ ...persisted.values, REPLICAS_AGENT_CREDENTIALS: JSON.stringify(remaining) },
|
|
341
341
|
/* @__PURE__ */ new Set([...persisted.unsetKeys, ...envKeys])
|
|
342
342
|
));
|
|
343
|
-
if (provider === "codex") await (await import("./asp-host-
|
|
343
|
+
if (provider === "codex") await (await import("./asp-host-BNCBYTIZ.js")).restartCodexAspHostIfRunning();
|
|
344
344
|
return true;
|
|
345
345
|
}
|
|
346
346
|
|
|
@@ -498,7 +498,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
498
498
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
499
499
|
await this.applyCredentialsResponse(data);
|
|
500
500
|
setAgentCredentialSnapshot("codex", data);
|
|
501
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
501
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-BNCBYTIZ.js");
|
|
502
502
|
await restartCodexAspHostIfRunning2();
|
|
503
503
|
});
|
|
504
504
|
await this.start(true);
|
|
@@ -524,7 +524,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
524
524
|
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
525
525
|
await this.applyCredentialsResponse(data);
|
|
526
526
|
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
527
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
527
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-BNCBYTIZ.js");
|
|
528
528
|
await restartCodexAspHostIfRunning2();
|
|
529
529
|
}
|
|
530
530
|
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-DFLWLV43.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5K5WQE7A.js";
|
|
10
10
|
|
|
11
11
|
// src/utils/codex-agent-env.ts
|
|
12
12
|
function buildCodexAgentEnv(source = process.env) {
|
|
@@ -244,7 +244,7 @@ function getCodexModelProvider(method) {
|
|
|
244
244
|
if (method === "foundry") return "azure";
|
|
245
245
|
return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
|
|
246
246
|
}
|
|
247
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
247
|
+
var ENGINE_PACKAGE_VERSION = "0.1.1730";
|
|
248
248
|
var INITIALIZE_METHOD = "initialize";
|
|
249
249
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
250
250
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-XCFPXSY4.js";
|
|
7
7
|
import {
|
|
8
8
|
AspClient
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MMNI5WIA.js";
|
|
10
10
|
import {
|
|
11
11
|
ASTER_BASE_URL,
|
|
12
12
|
ASTER_PROVIDER,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
isRecord,
|
|
19
19
|
readOllamaAuthEnv,
|
|
20
20
|
readOpenAICompatibleAuthEnv
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-5K5WQE7A.js";
|
|
22
22
|
|
|
23
23
|
// src/managers/codex-asp/notification-dispatch.ts
|
|
24
24
|
var TURN_STARTED_METHOD = "turn/started";
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
SUBAGENT_MCP_TOOL_NAMES
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5K5WQE7A.js";
|
|
7
7
|
|
|
8
8
|
// src/managers/subagent-mcp-config.ts
|
|
9
9
|
import { existsSync } from "fs";
|
package/dist/src/codemode-mcp.js
CHANGED
|
@@ -4,15 +4,15 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
getManagedPiMcpServers,
|
|
6
6
|
managedMcpServerProcess
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PI3F53DJ.js";
|
|
8
8
|
import "./chunk-XCFPXSY4.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-SKAYIAKC.js";
|
|
10
10
|
import {
|
|
11
11
|
isRecord
|
|
12
12
|
} from "./chunk-UZSNFLDQ.js";
|
|
13
13
|
import {
|
|
14
14
|
rankToolsByQuery
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5K5WQE7A.js";
|
|
16
16
|
import "./chunk-VEQXQN22.js";
|
|
17
17
|
|
|
18
18
|
// src/codemode-mcp.ts
|
|
@@ -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-6AKAVTQV.js";
|
|
7
|
+
import "./chunk-5Z7VROBY.js";
|
|
8
|
+
import "./chunk-DFLWLV43.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-5K5WQE7A.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|
|
@@ -18,13 +18,13 @@ import {
|
|
|
18
18
|
spawnMuseMsp,
|
|
19
19
|
startGeminiSession,
|
|
20
20
|
startMuseSession
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-Q4GZ2R6Y.js";
|
|
22
22
|
import "./chunk-XCFPXSY4.js";
|
|
23
23
|
import {
|
|
24
24
|
AppServerProcess,
|
|
25
25
|
buildCodexAgentEnv
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-MMNI5WIA.js";
|
|
27
|
+
import "./chunk-DFLWLV43.js";
|
|
28
28
|
import {
|
|
29
29
|
AGENT,
|
|
30
30
|
OPENCODE_GO_PROVIDER,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
headlessAgentUsagePath,
|
|
35
35
|
isRecord,
|
|
36
36
|
withTimeout
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-5K5WQE7A.js";
|
|
38
38
|
import "./chunk-VEQXQN22.js";
|
|
39
39
|
|
|
40
40
|
// src/headless-agent.ts
|
package/dist/src/index.js
CHANGED
|
@@ -90,12 +90,12 @@ import {
|
|
|
90
90
|
import {
|
|
91
91
|
getManagedPiMcpServers,
|
|
92
92
|
managedMcpServerProcess
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-PI3F53DJ.js";
|
|
94
94
|
import {
|
|
95
95
|
evaluateCommandProtection,
|
|
96
96
|
extractToolCommand,
|
|
97
97
|
reportCommandProtectionBlock
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-6AKAVTQV.js";
|
|
99
99
|
import {
|
|
100
100
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
101
101
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -135,7 +135,7 @@ import {
|
|
|
135
135
|
startMuseSession,
|
|
136
136
|
thinkingVariant,
|
|
137
137
|
uuidV7
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-Q4GZ2R6Y.js";
|
|
139
139
|
import {
|
|
140
140
|
GEMINI_AUTH_PATH,
|
|
141
141
|
GEMINI_CLI_PATH,
|
|
@@ -145,7 +145,7 @@ import {
|
|
|
145
145
|
} from "./chunk-XCFPXSY4.js";
|
|
146
146
|
import {
|
|
147
147
|
publishedPullRequestUrls
|
|
148
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-WQX56KJG.js";
|
|
149
149
|
import {
|
|
150
150
|
ACCOUNT_RATE_LIMITS_READ_METHOD,
|
|
151
151
|
AsyncLock,
|
|
@@ -225,12 +225,12 @@ import {
|
|
|
225
225
|
upsertCredentialFileLines,
|
|
226
226
|
withdrawAgentLogin,
|
|
227
227
|
writeSecureCredentialFile
|
|
228
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-IPZDXC3Q.js";
|
|
229
229
|
import {
|
|
230
230
|
SUBAGENT_MCP_TOOL_TIMEOUT_MS,
|
|
231
231
|
engineScriptProcess,
|
|
232
232
|
subagentMcpProcessConfig
|
|
233
|
-
} from "./chunk-
|
|
233
|
+
} from "./chunk-SKAYIAKC.js";
|
|
234
234
|
import {
|
|
235
235
|
ENGINE_ENV,
|
|
236
236
|
UNQUOTED_PATHS_CONFIG,
|
|
@@ -241,18 +241,18 @@ import {
|
|
|
241
241
|
resolveDiffBase,
|
|
242
242
|
setAgentCredentialSnapshot,
|
|
243
243
|
setLinearSessionId
|
|
244
|
-
} from "./chunk-
|
|
244
|
+
} from "./chunk-5Z7VROBY.js";
|
|
245
245
|
import {
|
|
246
246
|
AspRequestTimeoutError,
|
|
247
247
|
AspResponseError,
|
|
248
248
|
buildCodexAgentEnv,
|
|
249
249
|
getCodexModelProvider
|
|
250
|
-
} from "./chunk-
|
|
250
|
+
} from "./chunk-MMNI5WIA.js";
|
|
251
251
|
import {
|
|
252
252
|
SUBPROCESS_MAX_BUFFER,
|
|
253
253
|
execAsync,
|
|
254
254
|
execFileAsync
|
|
255
|
-
} from "./chunk-
|
|
255
|
+
} from "./chunk-DFLWLV43.js";
|
|
256
256
|
import {
|
|
257
257
|
isRecord
|
|
258
258
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -463,6 +463,7 @@ import {
|
|
|
463
463
|
isAgentChatMcpActivityRecord,
|
|
464
464
|
isAgentChatSkillActivityRecord,
|
|
465
465
|
isAgentChatTurnActivityRecord,
|
|
466
|
+
isAuthenticationErrorText,
|
|
466
467
|
isCanvasTextKind,
|
|
467
468
|
isChatMessageSender,
|
|
468
469
|
isClaudeAuthErrorText,
|
|
@@ -514,6 +515,7 @@ import {
|
|
|
514
515
|
parseProxyRouteCheck,
|
|
515
516
|
parseReplicasConfigString,
|
|
516
517
|
percentage,
|
|
518
|
+
providerContextUsage,
|
|
517
519
|
proxyRouteCheckScript,
|
|
518
520
|
raceWithTimeout,
|
|
519
521
|
readChatHistoryAppended,
|
|
@@ -554,7 +556,7 @@ import {
|
|
|
554
556
|
workspaceTokenRequestSchema,
|
|
555
557
|
workspaceTokenResponseSchema,
|
|
556
558
|
wrapInTag
|
|
557
|
-
} from "./chunk-
|
|
559
|
+
} from "./chunk-5K5WQE7A.js";
|
|
558
560
|
import {
|
|
559
561
|
__commonJS,
|
|
560
562
|
__export,
|
|
@@ -10121,6 +10123,7 @@ var EnvironmentDetailsService = class {
|
|
|
10121
10123
|
details.supportsMidTurnSteering = true;
|
|
10122
10124
|
details.supportsClaudeMidTurnSteering = true;
|
|
10123
10125
|
details.supportsCursorMidTurnSteering = true;
|
|
10126
|
+
details.supportsPiMidTurnSteering = true;
|
|
10124
10127
|
details.supportsSendNow = true;
|
|
10125
10128
|
details.supportsClaudeGoals = true;
|
|
10126
10129
|
details.supportsGoalUpdates = true;
|
|
@@ -11378,6 +11381,7 @@ function insertChronologically(existing, additions) {
|
|
|
11378
11381
|
}
|
|
11379
11382
|
function canSteerMessage(provider, request) {
|
|
11380
11383
|
if (provider === "cursor") return !request.images?.length;
|
|
11384
|
+
if (provider === "pi") return !request.message.trimStart().startsWith("/");
|
|
11381
11385
|
if (provider !== "claude" && provider !== "codex") return false;
|
|
11382
11386
|
return !getGoalCommand(request.message, request.goalMode) && !(provider === "codex" && isCompactCommand(request.message));
|
|
11383
11387
|
}
|
|
@@ -11462,22 +11466,23 @@ var GeminiTokenManager = class extends BaseRefreshManager {
|
|
|
11462
11466
|
};
|
|
11463
11467
|
var geminiTokenManager = new GeminiTokenManager();
|
|
11464
11468
|
|
|
11465
|
-
// src/managers/
|
|
11466
|
-
var
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11469
|
+
// src/managers/api-key-token-manager.ts
|
|
11470
|
+
var ApiKeyTokenManager = class extends BaseRefreshManager {
|
|
11471
|
+
constructor(agent) {
|
|
11472
|
+
super(`${getProviderDisplayName(agent)}TokenManager`);
|
|
11473
|
+
this.agent = agent;
|
|
11470
11474
|
}
|
|
11475
|
+
agent;
|
|
11471
11476
|
doRefresh() {
|
|
11472
11477
|
return Promise.resolve();
|
|
11473
11478
|
}
|
|
11474
|
-
async fetchFreshCredentials(failureReason, failureKind = "exhausted", failedCredential = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.
|
|
11475
|
-
const failedMethod = AGENT_CREDENTIAL_METHODS_IN_ORDER.
|
|
11479
|
+
async fetchFreshCredentials(failureReason, failureKind = "exhausted", failedCredential = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS[this.agent], allowedMethods, resetsAt) {
|
|
11480
|
+
const failedMethod = AGENT_CREDENTIAL_METHODS_IN_ORDER[this.agent].find(({ method }) => method === failedCredential?.method)?.method;
|
|
11476
11481
|
if (!failedMethod || allowedMethods && !allowedMethods.includes(failedMethod)) {
|
|
11477
|
-
return createErrorResult({ message:
|
|
11482
|
+
return createErrorResult({ message: `${getProviderDisplayName(this.agent)} only switches between keys of the same provider`, code: "no_credentials" });
|
|
11478
11483
|
}
|
|
11479
11484
|
return this.swapCredentials({
|
|
11480
|
-
provider:
|
|
11485
|
+
provider: this.agent,
|
|
11481
11486
|
failureKind,
|
|
11482
11487
|
allowedMethods: [failedMethod],
|
|
11483
11488
|
refresh: async (exclusions) => {
|
|
@@ -11489,26 +11494,27 @@ var OpencodeTokenManager = class extends BaseRefreshManager {
|
|
|
11489
11494
|
...resetsAt ? { resetsAt } : {},
|
|
11490
11495
|
...exclusions
|
|
11491
11496
|
};
|
|
11492
|
-
const response = await monolithRequest(
|
|
11497
|
+
const response = await monolithRequest(`/v1/engine/${this.agent}/refresh-credentials`, { body: request, signal: AbortSignal.timeout(12e4) });
|
|
11493
11498
|
if (!response.ok) {
|
|
11494
11499
|
const error = new Error(`Credentials refresh failed: ${response.status} ${await response.text()}`);
|
|
11495
11500
|
const revocation = refreshRevocation(error);
|
|
11496
|
-
if (revocation) await withdrawAgentLogin(
|
|
11501
|
+
if (revocation) await withdrawAgentLogin(this.agent, revocation);
|
|
11497
11502
|
throw error;
|
|
11498
11503
|
}
|
|
11499
11504
|
const data = await response.json();
|
|
11500
11505
|
for (const file of data.auth.files ?? []) {
|
|
11501
11506
|
await writeSecureCredentialFile(file.path, file.contents, { ensureParentDir: true });
|
|
11502
11507
|
}
|
|
11503
|
-
for (const key of
|
|
11508
|
+
for (const key of [...ollamaAuthEnvKeys(this.agent), ...openAICompatibleAuthEnvKeys(this.agent)]) delete process.env[key];
|
|
11504
11509
|
Object.assign(process.env, data.auth.env);
|
|
11505
|
-
setAgentCredentialSnapshot(
|
|
11510
|
+
setAgentCredentialSnapshot(this.agent, data);
|
|
11506
11511
|
},
|
|
11507
11512
|
keepRefreshing: () => false
|
|
11508
11513
|
});
|
|
11509
11514
|
}
|
|
11510
11515
|
};
|
|
11511
|
-
var opencodeTokenManager = new
|
|
11516
|
+
var opencodeTokenManager = new ApiKeyTokenManager("opencode");
|
|
11517
|
+
var piTokenManager = new ApiKeyTokenManager("pi");
|
|
11512
11518
|
|
|
11513
11519
|
// src/managers/auth-fallback.ts
|
|
11514
11520
|
var SWAPPABLE_AGENTS = {
|
|
@@ -11516,8 +11522,10 @@ var SWAPPABLE_AGENTS = {
|
|
|
11516
11522
|
codex: codexTokenManager,
|
|
11517
11523
|
gemini: geminiTokenManager,
|
|
11518
11524
|
muse: museTokenManager,
|
|
11519
|
-
opencode: opencodeTokenManager
|
|
11525
|
+
opencode: opencodeTokenManager,
|
|
11526
|
+
pi: piTokenManager
|
|
11520
11527
|
};
|
|
11528
|
+
var SWITCHED_CREDENTIAL_PROMPT = "Your previous turn stopped at a usage limit or a rejected credential. Continue from where you left off: first check what is already done, and do not repeat commands, edits, or messages you already completed.";
|
|
11521
11529
|
var QUOTA_STOP_NEXT_STEP = {
|
|
11522
11530
|
failed: "The next credential in the fallback chain could not be used. Check it in Settings \u2192 Fallbacks and try again.",
|
|
11523
11531
|
not_configured: "Nothing further is configured in the fallback chain. Add a credential or harness in Settings \u2192 Fallbacks, or try again once the limit resets.",
|
|
@@ -12795,6 +12803,28 @@ function convertOpencodePart(part, linearSessionId) {
|
|
|
12795
12803
|
}
|
|
12796
12804
|
return null;
|
|
12797
12805
|
}
|
|
12806
|
+
function convertPiEvent(event, linearSessionId) {
|
|
12807
|
+
if (event.type === "message_end" && event.message.role === "assistant") {
|
|
12808
|
+
const { content } = event.message;
|
|
12809
|
+
const text = content.flatMap((block) => block.type === "text" ? [block.text] : []).join("\n").trim();
|
|
12810
|
+
const body = text || content.flatMap((block) => block.type === "thinking" ? [block.thinking] : []).join("\n").trim();
|
|
12811
|
+
return body ? { linearSessionId, content: { type: "thought", body } } : null;
|
|
12812
|
+
}
|
|
12813
|
+
if (event.type === "tool_execution_start" || event.type === "tool_execution_end") {
|
|
12814
|
+
const output = event.type === "tool_execution_end" && isRecord2(event.result) ? extractToolResultText(event.result.content) : "";
|
|
12815
|
+
const result = event.type !== "tool_execution_end" ? void 0 : event.isError ? `Error: ${output || "Tool failed"}` : output || "Done";
|
|
12816
|
+
return {
|
|
12817
|
+
linearSessionId,
|
|
12818
|
+
content: {
|
|
12819
|
+
type: "action",
|
|
12820
|
+
action: toolAction(event.toolName),
|
|
12821
|
+
parameter: event.type === "tool_execution_start" ? summarizeInput(event.args) : "",
|
|
12822
|
+
...result ? { result } : {}
|
|
12823
|
+
}
|
|
12824
|
+
};
|
|
12825
|
+
}
|
|
12826
|
+
return null;
|
|
12827
|
+
}
|
|
12798
12828
|
function mapTodoStatus(status) {
|
|
12799
12829
|
if (status === "in_progress") {
|
|
12800
12830
|
return "inProgress";
|
|
@@ -17806,16 +17836,7 @@ ${typeof pending.subject.command === "string" ? pending.subject.command : JSON.s
|
|
|
17806
17836
|
} else if (frame.method === "session/contextUsage") {
|
|
17807
17837
|
const used = typeof frame.params.usedTokens === "number" ? frame.params.usedTokens : 0;
|
|
17808
17838
|
const size = typeof frame.params.windowTokens === "number" ? frame.params.windowTokens : 0;
|
|
17809
|
-
this.recordContextUsage({
|
|
17810
|
-
provider: "muse",
|
|
17811
|
-
source: "provider_usage",
|
|
17812
|
-
model: DEFAULT_MUSE_MODEL,
|
|
17813
|
-
totalTokens: used,
|
|
17814
|
-
maxTokens: size,
|
|
17815
|
-
percentage: size > 0 ? used / size * 100 : 0,
|
|
17816
|
-
categories: [],
|
|
17817
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
17818
|
-
});
|
|
17839
|
+
this.recordContextUsage(providerContextUsage({ provider: "muse", model: DEFAULT_MUSE_MODEL, totalTokens: used, maxTokens: size }));
|
|
17819
17840
|
} else if (frame.method === "userInput/requested" && typeof frame.params.userInputId === "string") {
|
|
17820
17841
|
const questions = Array.isArray(frame.params.questions) ? frame.params.questions.filter(isPendingQuestion) : [];
|
|
17821
17842
|
this.pendingInput = {
|
|
@@ -18207,16 +18228,12 @@ var GeminiManager = class extends CodingAgentManager {
|
|
|
18207
18228
|
return;
|
|
18208
18229
|
}
|
|
18209
18230
|
if (kind === "usage_update" && typeof update.used === "number" && typeof update.size === "number") {
|
|
18210
|
-
this.recordContextUsage({
|
|
18231
|
+
this.recordContextUsage(providerContextUsage({
|
|
18211
18232
|
provider: "gemini",
|
|
18212
|
-
source: "provider_usage",
|
|
18213
18233
|
model: this.session ? geminiSelectOption(this.session.configOptions, "model")?.currentValue ?? null : null,
|
|
18214
18234
|
totalTokens: update.used,
|
|
18215
|
-
maxTokens: update.size
|
|
18216
|
-
|
|
18217
|
-
categories: [],
|
|
18218
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
18219
|
-
});
|
|
18235
|
+
maxTokens: update.size
|
|
18236
|
+
}));
|
|
18220
18237
|
return;
|
|
18221
18238
|
}
|
|
18222
18239
|
if (kind === "current_mode_update" || kind === "session_info_update") return;
|
|
@@ -18457,7 +18474,6 @@ var OPENCODE_SLASH_COMMANDS_CACHE_MS = 3e4;
|
|
|
18457
18474
|
var OPENCODE_HEARTBEAT_TIMEOUT_MS = 6e4;
|
|
18458
18475
|
var OPENCODE_ABORT_TIMEOUT_MS = 5e3;
|
|
18459
18476
|
var OPENCODE_SERVER_GONE = "exited or dropped its connection";
|
|
18460
|
-
var OPENCODE_SWITCHED_CREDENTIAL_PROMPT = "Your previous turn stopped at a usage limit. Continue from where you left off: first check what is already done, and do not repeat commands, edits, or messages you already completed.";
|
|
18461
18477
|
async function getDefaultOpencodeModel(provider) {
|
|
18462
18478
|
const ollama = readOllamaAuthEnv("opencode", process.env);
|
|
18463
18479
|
if (provider === "ollama" && ollama) {
|
|
@@ -18908,7 +18924,7 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
18908
18924
|
question: Boolean(request.enableInteractiveTools),
|
|
18909
18925
|
...this.subagentMcpParentChatId() ? { task: false } : {}
|
|
18910
18926
|
},
|
|
18911
|
-
parts: [{ type: "text", text: retry ?
|
|
18927
|
+
parts: [{ type: "text", text: retry ? SWITCHED_CREDENTIAL_PROMPT : request.message }]
|
|
18912
18928
|
}, { signal: controller.signal, throwOnError: true });
|
|
18913
18929
|
this.recordHistoryEvent("opencode-message.updated", { info: result.data.info });
|
|
18914
18930
|
for (const part of result.data.parts) this.recordOpencodePart(part);
|
|
@@ -60029,16 +60045,30 @@ var PiManager = class extends CodingAgentManager {
|
|
|
60029
60045
|
activeSessionFile = null;
|
|
60030
60046
|
sessionSubagentMcpParentChatId;
|
|
60031
60047
|
sessionInstructions;
|
|
60048
|
+
sessionCredential;
|
|
60032
60049
|
providerId = "openrouter";
|
|
60033
60050
|
providerApiKey = null;
|
|
60034
60051
|
modelRuntime = null;
|
|
60052
|
+
linearForwarder = null;
|
|
60053
|
+
// Held until the turn ends: a call Pi retried or Replicas moved to another credential is not the turn's failure.
|
|
60054
|
+
failedCall = null;
|
|
60055
|
+
steers = [];
|
|
60035
60056
|
constructor(options) {
|
|
60036
60057
|
super(options);
|
|
60037
60058
|
this.initializeManager(this.processMessageInternal.bind(this));
|
|
60038
60059
|
}
|
|
60039
60060
|
async interruptActiveTurn() {
|
|
60061
|
+
this.session?.clearQueue();
|
|
60040
60062
|
await this.session?.abort();
|
|
60041
60063
|
}
|
|
60064
|
+
async steerRequest(request) {
|
|
60065
|
+
if (!this.session?.isStreaming || !canSteerMessage("pi", request)) return false;
|
|
60066
|
+
const images = await this.toPiImages(request);
|
|
60067
|
+
if (!this.session?.isStreaming || this.isSteerWithdrawn(request)) return false;
|
|
60068
|
+
this.steers.push(request);
|
|
60069
|
+
await this.session.steer(request.message, images);
|
|
60070
|
+
return true;
|
|
60071
|
+
}
|
|
60042
60072
|
async getHistory(page2 = {}) {
|
|
60043
60073
|
await this.historyFile.flush();
|
|
60044
60074
|
const history = await this.historyFile.loadEventsPage(page2);
|
|
@@ -60072,7 +60102,7 @@ var PiManager = class extends CodingAgentManager {
|
|
|
60072
60102
|
const subagentMcpParentChatId = this.subagentMcpParentChatId();
|
|
60073
60103
|
const instructions = this.buildCombinedInstructions(request.customInstructions) ?? "";
|
|
60074
60104
|
let retainedModel;
|
|
60075
|
-
if (this.session && (this.sessionSubagentMcpParentChatId !== subagentMcpParentChatId || this.sessionInstructions !== instructions)) {
|
|
60105
|
+
if (this.session && (this.sessionSubagentMcpParentChatId !== subagentMcpParentChatId || this.sessionInstructions !== instructions || this.sessionCredential !== ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.pi)) {
|
|
60076
60106
|
retainedModel = this.session.model?.id;
|
|
60077
60107
|
await this.dispose();
|
|
60078
60108
|
}
|
|
@@ -60097,6 +60127,7 @@ var PiManager = class extends CodingAgentManager {
|
|
|
60097
60127
|
return this.session;
|
|
60098
60128
|
}
|
|
60099
60129
|
const modelRuntime = await this.getModelRuntime();
|
|
60130
|
+
const credential = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.pi;
|
|
60100
60131
|
const credentialResult = await getPiProviderCredentials();
|
|
60101
60132
|
if (!credentialResult.ok) throw new Error("OpenCode Go, Aster, OpenRouter, or OpenAI-compatible credentials are not configured for Pi.");
|
|
60102
60133
|
const credentials = credentialResult.data;
|
|
@@ -60219,6 +60250,7 @@ var PiManager = class extends CodingAgentManager {
|
|
|
60219
60250
|
this.session = result.session;
|
|
60220
60251
|
this.sessionSubagentMcpParentChatId = subagentMcpParentChatId;
|
|
60221
60252
|
this.sessionInstructions = instructions;
|
|
60253
|
+
this.sessionCredential = credential;
|
|
60222
60254
|
if (request.thinkingLevel) {
|
|
60223
60255
|
this.session.setThinkingLevel(piThinkingLevel(request.thinkingLevel));
|
|
60224
60256
|
}
|
|
@@ -60233,29 +60265,97 @@ var PiManager = class extends CodingAgentManager {
|
|
|
60233
60265
|
return this.modelRuntime;
|
|
60234
60266
|
}
|
|
60235
60267
|
handleEvent(event) {
|
|
60268
|
+
if (event.type === "agent_start") void this.deliverEarlySteers();
|
|
60269
|
+
if (event.type === "message_start" && event.message.role === "user" && Array.isArray(event.message.content)) {
|
|
60270
|
+
const [first] = event.message.content;
|
|
60271
|
+
const index = first?.type === "text" ? this.steers.findIndex(({ message }) => message === first.text) : -1;
|
|
60272
|
+
if (index !== -1) {
|
|
60273
|
+
const steer = this.markSteerRead(this.steers.splice(index, 1)[0].id);
|
|
60274
|
+
if (steer) this.recordUserMessageHistoryEvent(steer);
|
|
60275
|
+
}
|
|
60276
|
+
}
|
|
60236
60277
|
if (event.type === "message_end") this.onUsageUpdate(event, (/* @__PURE__ */ new Date()).toISOString());
|
|
60237
|
-
const
|
|
60238
|
-
|
|
60278
|
+
const usage = event.type === "message_end" && event.message.role === "assistant" ? this.session?.getContextUsage() : void 0;
|
|
60279
|
+
if (usage?.tokens != null) {
|
|
60280
|
+
this.recordContextUsage(providerContextUsage({
|
|
60281
|
+
provider: "pi",
|
|
60282
|
+
model: this.session?.model?.id ?? null,
|
|
60283
|
+
totalTokens: usage.tokens,
|
|
60284
|
+
maxTokens: usage.contextWindow,
|
|
60285
|
+
compactsAutomatically: this.session?.autoCompactionEnabled
|
|
60286
|
+
}));
|
|
60287
|
+
}
|
|
60288
|
+
if (event.type === "message_end" && event.message.role === "assistant") {
|
|
60289
|
+
this.failedCall = event.message.stopReason === "error" ? event : null;
|
|
60290
|
+
if (this.failedCall) return;
|
|
60291
|
+
}
|
|
60292
|
+
this.recordHistoryEvent(`pi-${event.type}`, eventPayload(event));
|
|
60293
|
+
const linearSessionId = this.linearSessionId;
|
|
60294
|
+
if (linearSessionId) this.linearForwarder?.sendEvent(convertPiEvent(event, linearSessionId));
|
|
60239
60295
|
}
|
|
60240
60296
|
recordUserMessage(session, request) {
|
|
60241
60297
|
const skillName = explicitSkillName(session, request.message);
|
|
60242
60298
|
this.recordUserMessageHistoryEvent(request, skillName ? { skillName } : {}, this.turnBeganAt);
|
|
60243
60299
|
}
|
|
60300
|
+
async toPiImages(request) {
|
|
60301
|
+
if (!request.images?.length) return void 0;
|
|
60302
|
+
return (await normalizeImages(request.images)).map((image) => ({
|
|
60303
|
+
type: "image",
|
|
60304
|
+
data: image.source.data,
|
|
60305
|
+
mimeType: image.source.media_type
|
|
60306
|
+
}));
|
|
60307
|
+
}
|
|
60244
60308
|
async processMessageInternal(request, signal) {
|
|
60309
|
+
this.linearForwarder = new LinearEventForwarder(() => this.linearSessionId);
|
|
60245
60310
|
try {
|
|
60246
|
-
|
|
60247
|
-
const images =
|
|
60248
|
-
type: "image",
|
|
60249
|
-
data: image.source.data,
|
|
60250
|
-
mimeType: image.source.media_type
|
|
60251
|
-
})) : void 0;
|
|
60311
|
+
let session = await this.ensureSession(request);
|
|
60312
|
+
const images = await this.toPiImages(request);
|
|
60252
60313
|
if (!this.deliver(signal)) return;
|
|
60253
60314
|
this.recordUserMessage(session, request);
|
|
60254
|
-
|
|
60315
|
+
let retry = false;
|
|
60316
|
+
let limit;
|
|
60317
|
+
while (true) {
|
|
60318
|
+
const attempted = this.sessionCredential;
|
|
60319
|
+
const thrown = await session.prompt(retry ? SWITCHED_CREDENTIAL_PROMPT : request.message, images && !retry ? { images } : void 0).then(() => null, (error) => error);
|
|
60320
|
+
const failedCall = this.failedCall;
|
|
60321
|
+
this.failedCall = null;
|
|
60322
|
+
const detail = thrown ? thrown instanceof Error ? thrown.message : String(thrown) : failedCall?.message.role === "assistant" ? failedCall.message.errorMessage ?? "Pi run failed" : null;
|
|
60323
|
+
if (detail === null) break;
|
|
60324
|
+
const quota = detectAgentQuotaLimit(detail);
|
|
60325
|
+
const authFailed = !quota && isAuthenticationErrorText(detail, [/\b401\b/]);
|
|
60326
|
+
const fallback = !signal.aborted && (quota || authFailed) ? await this.fallBackCredential(quota ?? "auth_failed", detail, attempted, void 0, !!limit) : null;
|
|
60327
|
+
limit ??= quota ?? void 0;
|
|
60328
|
+
if (fallback?.outcome === "switched") {
|
|
60329
|
+
if (signal.aborted) break;
|
|
60330
|
+
const model = fallback.model ?? session.model?.id;
|
|
60331
|
+
await this.dispose();
|
|
60332
|
+
session = await this.ensureSession({ ...request, ...model ? { model } : {} });
|
|
60333
|
+
if (signal.aborted) break;
|
|
60334
|
+
retry = true;
|
|
60335
|
+
continue;
|
|
60336
|
+
}
|
|
60337
|
+
const notice = fallback && limit ? describeQuotaExhaustion("pi", limit, attempted, fallback) : authFailed ? describeLoginFailure("pi", attempted, void 0, false) : null;
|
|
60338
|
+
if (notice) this.recordHistoryEvent("pi-error", { message: notice });
|
|
60339
|
+
else if (failedCall) this.recordHistoryEvent("pi-message_end", eventPayload(failedCall));
|
|
60340
|
+
if (fallback && limit) {
|
|
60341
|
+
this.emitQuotaExhausted({
|
|
60342
|
+
provider: "pi",
|
|
60343
|
+
reason: limit,
|
|
60344
|
+
detail,
|
|
60345
|
+
...fallback.outcome === "fork" ? { forkTo: fallback.target } : {}
|
|
60346
|
+
});
|
|
60347
|
+
}
|
|
60348
|
+
if (thrown && !notice) throw thrown;
|
|
60349
|
+
break;
|
|
60350
|
+
}
|
|
60351
|
+
this.linearForwarder.flushThoughtAsResponse();
|
|
60255
60352
|
} catch (error) {
|
|
60256
60353
|
this.recordHistoryEvent("pi-error", { message: error instanceof Error ? error.message : String(error) });
|
|
60257
60354
|
throw error;
|
|
60258
60355
|
} finally {
|
|
60356
|
+
this.linearForwarder = null;
|
|
60357
|
+
this.session?.clearQueue();
|
|
60358
|
+
this.steers = [];
|
|
60259
60359
|
await this.historyFile.flush();
|
|
60260
60360
|
await this.onTurnComplete();
|
|
60261
60361
|
}
|
|
@@ -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-WQX56KJG.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-5K5WQE7A.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