replicas-cli 0.2.815 → 0.2.816
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/index.cjs +437 -408
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3706,22 +3706,22 @@ var require_errors = __commonJS({
|
|
|
3706
3706
|
"../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/errors.js"(exports2) {
|
|
3707
3707
|
"use strict";
|
|
3708
3708
|
var YAMLError = class extends Error {
|
|
3709
|
-
constructor(name, pos, code,
|
|
3709
|
+
constructor(name, pos, code, message2) {
|
|
3710
3710
|
super();
|
|
3711
3711
|
this.name = name;
|
|
3712
3712
|
this.code = code;
|
|
3713
|
-
this.message =
|
|
3713
|
+
this.message = message2;
|
|
3714
3714
|
this.pos = pos;
|
|
3715
3715
|
}
|
|
3716
3716
|
};
|
|
3717
3717
|
var YAMLParseError = class extends YAMLError {
|
|
3718
|
-
constructor(pos, code,
|
|
3719
|
-
super("YAMLParseError", pos, code,
|
|
3718
|
+
constructor(pos, code, message2) {
|
|
3719
|
+
super("YAMLParseError", pos, code, message2);
|
|
3720
3720
|
}
|
|
3721
3721
|
};
|
|
3722
3722
|
var YAMLWarning = class extends YAMLError {
|
|
3723
|
-
constructor(pos, code,
|
|
3724
|
-
super("YAMLWarning", pos, code,
|
|
3723
|
+
constructor(pos, code, message2) {
|
|
3724
|
+
super("YAMLWarning", pos, code, message2);
|
|
3725
3725
|
}
|
|
3726
3726
|
};
|
|
3727
3727
|
var prettifyError2 = (src, lc) => (error51) => {
|
|
@@ -4401,8 +4401,8 @@ var require_compose_collection = __commonJS({
|
|
|
4401
4401
|
const { anchor, newlineAfterProp: nl } = props;
|
|
4402
4402
|
const lastProp = anchor && tagToken ? anchor.offset > tagToken.offset ? anchor : tagToken : anchor ?? tagToken;
|
|
4403
4403
|
if (lastProp && (!nl || nl.offset < lastProp.offset)) {
|
|
4404
|
-
const
|
|
4405
|
-
onError(lastProp, "MISSING_CHAR",
|
|
4404
|
+
const message2 = "Missing newline after block sequence props";
|
|
4405
|
+
onError(lastProp, "MISSING_CHAR", message2);
|
|
4406
4406
|
}
|
|
4407
4407
|
}
|
|
4408
4408
|
const expType = token.type === "block-map" ? "map" : token.type === "block-seq" ? "seq" : token.start.source === "{" ? "map" : "seq";
|
|
@@ -4474,15 +4474,15 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
4474
4474
|
trimIndent = indent.length;
|
|
4475
4475
|
} else {
|
|
4476
4476
|
if (indent.length < trimIndent) {
|
|
4477
|
-
const
|
|
4478
|
-
onError(offset + indent.length, "MISSING_CHAR",
|
|
4477
|
+
const message2 = "Block scalars with more-indented leading empty lines must use an explicit indentation indicator";
|
|
4478
|
+
onError(offset + indent.length, "MISSING_CHAR", message2);
|
|
4479
4479
|
}
|
|
4480
4480
|
if (header.indent === 0)
|
|
4481
4481
|
trimIndent = indent.length;
|
|
4482
4482
|
contentStart = i;
|
|
4483
4483
|
if (trimIndent === 0 && !ctx.atRoot) {
|
|
4484
|
-
const
|
|
4485
|
-
onError(offset, "BAD_INDENT",
|
|
4484
|
+
const message2 = "Block scalar values in collections must be indented";
|
|
4485
|
+
onError(offset, "BAD_INDENT", message2);
|
|
4486
4486
|
}
|
|
4487
4487
|
break;
|
|
4488
4488
|
}
|
|
@@ -4505,8 +4505,8 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
4505
4505
|
content = content.slice(0, -1);
|
|
4506
4506
|
if (content && indent.length < trimIndent) {
|
|
4507
4507
|
const src = header.indent ? "explicit indentation indicator" : "first line";
|
|
4508
|
-
const
|
|
4509
|
-
onError(offset - content.length - (crlf ? 2 : 1), "BAD_INDENT",
|
|
4508
|
+
const message2 = `Block scalar lines must not be less indented than their ${src}`;
|
|
4509
|
+
onError(offset - content.length - (crlf ? 2 : 1), "BAD_INDENT", message2);
|
|
4510
4510
|
indent = "";
|
|
4511
4511
|
}
|
|
4512
4512
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
@@ -4584,8 +4584,8 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
4584
4584
|
break;
|
|
4585
4585
|
case "comment":
|
|
4586
4586
|
if (strict && !hasSpace) {
|
|
4587
|
-
const
|
|
4588
|
-
onError(token, "MISSING_CHAR",
|
|
4587
|
+
const message2 = "Comments must be separated from other tokens by white space characters";
|
|
4588
|
+
onError(token, "MISSING_CHAR", message2);
|
|
4589
4589
|
}
|
|
4590
4590
|
length += token.source.length;
|
|
4591
4591
|
comment = token.source.substring(1);
|
|
@@ -4596,8 +4596,8 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
4596
4596
|
break;
|
|
4597
4597
|
/* istanbul ignore next should not happen */
|
|
4598
4598
|
default: {
|
|
4599
|
-
const
|
|
4600
|
-
onError(token, "UNEXPECTED_TOKEN",
|
|
4599
|
+
const message2 = `Unexpected token in block scalar header: ${token.type}`;
|
|
4600
|
+
onError(token, "UNEXPECTED_TOKEN", message2);
|
|
4601
4601
|
const ts = token.source;
|
|
4602
4602
|
if (ts && typeof ts === "string")
|
|
4603
4603
|
length += ts.length;
|
|
@@ -4989,13 +4989,13 @@ var require_compose_node = __commonJS({
|
|
|
4989
4989
|
if (anchor)
|
|
4990
4990
|
node.anchor = anchor.source.substring(1);
|
|
4991
4991
|
} catch (error51) {
|
|
4992
|
-
const
|
|
4993
|
-
onError(token, "RESOURCE_EXHAUSTION",
|
|
4992
|
+
const message2 = error51 instanceof Error ? error51.message : String(error51);
|
|
4993
|
+
onError(token, "RESOURCE_EXHAUSTION", message2);
|
|
4994
4994
|
}
|
|
4995
4995
|
break;
|
|
4996
4996
|
default: {
|
|
4997
|
-
const
|
|
4998
|
-
onError(token, "UNEXPECTED_TOKEN",
|
|
4997
|
+
const message2 = token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`;
|
|
4998
|
+
onError(token, "UNEXPECTED_TOKEN", message2);
|
|
4999
4999
|
isSrcToken = false;
|
|
5000
5000
|
}
|
|
5001
5001
|
}
|
|
@@ -5151,12 +5151,12 @@ var require_composer = __commonJS({
|
|
|
5151
5151
|
this.prelude = [];
|
|
5152
5152
|
this.errors = [];
|
|
5153
5153
|
this.warnings = [];
|
|
5154
|
-
this.onError = (source, code,
|
|
5154
|
+
this.onError = (source, code, message2, warning) => {
|
|
5155
5155
|
const pos = getErrorPos(source);
|
|
5156
5156
|
if (warning)
|
|
5157
|
-
this.warnings.push(new errors.YAMLWarning(pos, code,
|
|
5157
|
+
this.warnings.push(new errors.YAMLWarning(pos, code, message2));
|
|
5158
5158
|
else
|
|
5159
|
-
this.errors.push(new errors.YAMLParseError(pos, code,
|
|
5159
|
+
this.errors.push(new errors.YAMLParseError(pos, code, message2));
|
|
5160
5160
|
};
|
|
5161
5161
|
this.directives = new directives.Directives({ version: options.version || "1.2" });
|
|
5162
5162
|
this.options = options;
|
|
@@ -5226,10 +5226,10 @@ ${cb}` : comment;
|
|
|
5226
5226
|
console.dir(token, { depth: null });
|
|
5227
5227
|
switch (token.type) {
|
|
5228
5228
|
case "directive":
|
|
5229
|
-
this.directives.add(token.source, (offset,
|
|
5229
|
+
this.directives.add(token.source, (offset, message2, warning) => {
|
|
5230
5230
|
const pos = getErrorPos(token);
|
|
5231
5231
|
pos[0] += offset;
|
|
5232
|
-
this.onError(pos, "BAD_DIRECTIVE",
|
|
5232
|
+
this.onError(pos, "BAD_DIRECTIVE", message2, warning);
|
|
5233
5233
|
});
|
|
5234
5234
|
this.prelude.push(token.source);
|
|
5235
5235
|
this.atDirectives = true;
|
|
@@ -5318,12 +5318,12 @@ var require_cst_scalar = __commonJS({
|
|
|
5318
5318
|
var stringifyString = require_stringifyString();
|
|
5319
5319
|
function resolveAsScalar(token, strict = true, onError) {
|
|
5320
5320
|
if (token) {
|
|
5321
|
-
const _onError = (pos, code,
|
|
5321
|
+
const _onError = (pos, code, message2) => {
|
|
5322
5322
|
const offset = typeof pos === "number" ? pos : Array.isArray(pos) ? pos[0] : pos.offset;
|
|
5323
5323
|
if (onError)
|
|
5324
|
-
onError(offset, code,
|
|
5324
|
+
onError(offset, code, message2);
|
|
5325
5325
|
else
|
|
5326
|
-
throw new errors.YAMLParseError([offset, offset + 1], code,
|
|
5326
|
+
throw new errors.YAMLParseError([offset, offset + 1], code, message2);
|
|
5327
5327
|
};
|
|
5328
5328
|
switch (token.type) {
|
|
5329
5329
|
case "scalar":
|
|
@@ -6483,8 +6483,8 @@ var require_parser = __commonJS({
|
|
|
6483
6483
|
}
|
|
6484
6484
|
const type = cst.tokenType(source);
|
|
6485
6485
|
if (!type) {
|
|
6486
|
-
const
|
|
6487
|
-
yield* this.pop({ type: "error", offset: this.offset, message, source });
|
|
6486
|
+
const message2 = `Not a YAML token: ${source}`;
|
|
6487
|
+
yield* this.pop({ type: "error", offset: this.offset, message: message2, source });
|
|
6488
6488
|
this.offset += source.length;
|
|
6489
6489
|
} else if (type === "scalar") {
|
|
6490
6490
|
this.atNewLine = false;
|
|
@@ -6574,8 +6574,8 @@ var require_parser = __commonJS({
|
|
|
6574
6574
|
*pop(error51) {
|
|
6575
6575
|
const token = error51 ?? this.stack.pop();
|
|
6576
6576
|
if (!token) {
|
|
6577
|
-
const
|
|
6578
|
-
yield { type: "error", offset: this.offset, source: "", message };
|
|
6577
|
+
const message2 = "Tried to pop an empty stack";
|
|
6578
|
+
yield { type: "error", offset: this.offset, source: "", message: message2 };
|
|
6579
6579
|
} else if (this.stack.length === 0) {
|
|
6580
6580
|
yield token;
|
|
6581
6581
|
} else {
|
|
@@ -7671,8 +7671,8 @@ var THINKING_LEVELS_BY_AGENT = {
|
|
|
7671
7671
|
opencode: STANDARD_THINKING_LEVELS,
|
|
7672
7672
|
pi: STANDARD_THINKING_LEVELS
|
|
7673
7673
|
};
|
|
7674
|
-
function getThinkingLevelOptions(
|
|
7675
|
-
return
|
|
7674
|
+
function getThinkingLevelOptions(provider2) {
|
|
7675
|
+
return provider2 ? THINKING_LEVELS_BY_AGENT[provider2] : VALID_THINKING_LEVELS;
|
|
7676
7676
|
}
|
|
7677
7677
|
function isValidThinkingLevel(value) {
|
|
7678
7678
|
return VALID_THINKING_LEVELS.some((l) => l === value);
|
|
@@ -7680,8 +7680,8 @@ function isValidThinkingLevel(value) {
|
|
|
7680
7680
|
function isProviderSpecificThinkingLevel(value) {
|
|
7681
7681
|
return value === "ultra" || value === "ultracode";
|
|
7682
7682
|
}
|
|
7683
|
-
function getProviderDisplayName(
|
|
7684
|
-
switch (
|
|
7683
|
+
function getProviderDisplayName(provider2, variant = "short") {
|
|
7684
|
+
switch (provider2) {
|
|
7685
7685
|
case "codex":
|
|
7686
7686
|
return "Codex";
|
|
7687
7687
|
case "cursor":
|
|
@@ -7697,7 +7697,7 @@ function getProviderDisplayName(provider, variant = "short") {
|
|
|
7697
7697
|
}
|
|
7698
7698
|
}
|
|
7699
7699
|
function getCodingAgentDisplayNames() {
|
|
7700
|
-
return VALID_AGENT_PROVIDERS.map((
|
|
7700
|
+
return VALID_AGENT_PROVIDERS.map((provider2) => getProviderDisplayName(provider2)).join(", ");
|
|
7701
7701
|
}
|
|
7702
7702
|
|
|
7703
7703
|
// ../shared/src/credentials/types.ts
|
|
@@ -8976,14 +8976,14 @@ function prefixIssues(path7, issues) {
|
|
|
8976
8976
|
return iss;
|
|
8977
8977
|
});
|
|
8978
8978
|
}
|
|
8979
|
-
function unwrapMessage(
|
|
8980
|
-
return typeof
|
|
8979
|
+
function unwrapMessage(message2) {
|
|
8980
|
+
return typeof message2 === "string" ? message2 : message2?.message;
|
|
8981
8981
|
}
|
|
8982
8982
|
function finalizeIssue(iss, ctx, config3) {
|
|
8983
|
-
const
|
|
8983
|
+
const message2 = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config3.customError?.(iss)) ?? unwrapMessage(config3.localeError?.(iss)) ?? "Invalid input";
|
|
8984
8984
|
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
|
|
8985
8985
|
rest.path ?? (rest.path = []);
|
|
8986
|
-
rest.message =
|
|
8986
|
+
rest.message = message2;
|
|
8987
8987
|
if (ctx?.reportInput) {
|
|
8988
8988
|
rest.input = _input;
|
|
8989
8989
|
}
|
|
@@ -22415,12 +22415,12 @@ var workspaceCredentialProviderSchema = external_exports.enum(WORKSPACE_CREDENTI
|
|
|
22415
22415
|
var workspaceCredentialSelectionSchema = agentCredentialSnapshotSchema.omit({ revision: true, account: true, credentialId: true });
|
|
22416
22416
|
var createWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend({
|
|
22417
22417
|
provider: external_exports.enum(VALID_AGENT_PROVIDERS)
|
|
22418
|
-
}).refine(({ provider, method }) => agentCredentialMethods(
|
|
22418
|
+
}).refine(({ provider: provider2, method }) => agentCredentialMethods(provider2).includes(method), {
|
|
22419
22419
|
message: "This inference provider is not supported by this agent"
|
|
22420
22420
|
});
|
|
22421
22421
|
var switchWorkspaceCredentialSchema = workspaceCredentialSelectionSchema.extend({
|
|
22422
22422
|
provider: workspaceCredentialProviderSchema
|
|
22423
|
-
}).refine(({ provider, method }) => agentCredentialMethods(
|
|
22423
|
+
}).refine(({ provider: provider2, method }) => agentCredentialMethods(provider2).includes(method), {
|
|
22424
22424
|
message: "This authentication method is not supported by this agent"
|
|
22425
22425
|
});
|
|
22426
22426
|
|
|
@@ -22522,20 +22522,20 @@ var OPENROUTER_MODELS = [
|
|
|
22522
22522
|
"minimax/minimax-m3",
|
|
22523
22523
|
"meta/muse-spark-1.3"
|
|
22524
22524
|
];
|
|
22525
|
-
function normalizeClaudeModel(
|
|
22526
|
-
if (
|
|
22525
|
+
function normalizeClaudeModel(model2) {
|
|
22526
|
+
if (model2 === "opus" || model2 === CLAUDE_OPUS_1M_MODEL || model2 === LEGACY_CLAUDE_OPUS_1M_MODEL) {
|
|
22527
22527
|
return DEFAULT_CLAUDE_MODEL;
|
|
22528
22528
|
}
|
|
22529
|
-
if (
|
|
22529
|
+
if (model2 === "fable") {
|
|
22530
22530
|
return CLAUDE_FABLE_5_1_MODEL;
|
|
22531
22531
|
}
|
|
22532
|
-
if (
|
|
22532
|
+
if (model2 === "sonnet") {
|
|
22533
22533
|
return CLAUDE_SONNET_5_MODEL;
|
|
22534
22534
|
}
|
|
22535
|
-
if (
|
|
22535
|
+
if (model2 === "haiku") {
|
|
22536
22536
|
return CLAUDE_HAIKU_4_5_MODEL;
|
|
22537
22537
|
}
|
|
22538
|
-
return
|
|
22538
|
+
return model2;
|
|
22539
22539
|
}
|
|
22540
22540
|
var CLAUDE_MODEL_CONTEXT_WINDOWS = {
|
|
22541
22541
|
[CLAUDE_FABLE_5_1_MODEL]: 1e6,
|
|
@@ -22654,18 +22654,18 @@ var HIDDEN_BY_DEFAULT_MODELS = /* @__PURE__ */ new Set([
|
|
|
22654
22654
|
"grok-4.3",
|
|
22655
22655
|
"kimi-k2.5"
|
|
22656
22656
|
]);
|
|
22657
|
-
var withoutHiddenByDefault = (models) => models.filter((
|
|
22657
|
+
var withoutHiddenByDefault = (models) => models.filter((model2) => !HIDDEN_BY_DEFAULT_MODELS.has(model2));
|
|
22658
22658
|
var DEFAULT_STATIC_AGENT_MODELS = {
|
|
22659
22659
|
claude: withoutHiddenByDefault(AGENT_MODELS.claude),
|
|
22660
22660
|
codex: withoutHiddenByDefault(AGENT_MODELS.codex)
|
|
22661
22661
|
};
|
|
22662
22662
|
var DEFAULT_CURSOR_MODELS = withoutHiddenByDefault(AGENT_MODELS.cursor);
|
|
22663
|
-
function getAgentModelOptions(
|
|
22664
|
-
const override = overrides?.[
|
|
22663
|
+
function getAgentModelOptions(provider2, overrides) {
|
|
22664
|
+
const override = overrides?.[provider2];
|
|
22665
22665
|
if (override?.length) return override;
|
|
22666
|
-
if (
|
|
22667
|
-
if (
|
|
22668
|
-
return AGENT_MODELS[
|
|
22666
|
+
if (provider2 === "claude" || provider2 === "codex") return DEFAULT_STATIC_AGENT_MODELS[provider2];
|
|
22667
|
+
if (provider2 === "cursor") return DEFAULT_CURSOR_MODELS;
|
|
22668
|
+
return AGENT_MODELS[provider2] ?? [];
|
|
22669
22669
|
}
|
|
22670
22670
|
var SANDBOX_IMAGE_MODEL_FALLBACKS = {
|
|
22671
22671
|
[CLAUDE_OPUS_5_5_MODEL]: CLAUDE_OPUS_5_MODEL,
|
|
@@ -22676,8 +22676,8 @@ var SANDBOX_IMAGE_MODEL_FALLBACKS = {
|
|
|
22676
22676
|
[GPT_6_ASTRA_MODEL]: GPT_5_6_TERRA_MODEL,
|
|
22677
22677
|
[GPT_6_LUNA_MODEL]: GPT_5_6_LUNA_MODEL
|
|
22678
22678
|
};
|
|
22679
|
-
function isAgentModelAllowed(
|
|
22680
|
-
return overrides?.[
|
|
22679
|
+
function isAgentModelAllowed(provider2, model2, overrides) {
|
|
22680
|
+
return overrides?.[provider2] === null || getAgentModelOptions(provider2, overrides).includes(model2);
|
|
22681
22681
|
}
|
|
22682
22682
|
var MODEL_LABELS = {
|
|
22683
22683
|
fable: "Fable 5.1",
|
|
@@ -22858,14 +22858,14 @@ var CODEX_QUOTA_STATUS_EVENT_TYPE = "codex-quota-status";
|
|
|
22858
22858
|
var CHAT_INTERRUPTED_EVENT_TYPE = "replicas-interrupted";
|
|
22859
22859
|
var AUTH_FALLBACK_EVENT_TYPE = "auth-fallback";
|
|
22860
22860
|
function coerceAuthFallbackPayload(payload) {
|
|
22861
|
-
const { provider, reason, exhaustedMethod, exhaustedScope, candidateMethod, candidateScope, status, detail } = payload;
|
|
22861
|
+
const { provider: provider2, reason, exhaustedMethod, exhaustedScope, candidateMethod, candidateScope, status, detail } = payload;
|
|
22862
22862
|
const exhaustedAccount = credentialAccountSchema.safeParse(payload.exhaustedAccount).data;
|
|
22863
22863
|
const candidateAccount = credentialAccountSchema.safeParse(payload.candidateAccount).data;
|
|
22864
|
-
if (typeof
|
|
22864
|
+
if (typeof provider2 !== "string" || !isValidAgentProvider(provider2) || reason !== "rate_limit" && reason !== "out_of_credits" || !isAuthMethod(exhaustedMethod) || !isAuthMethod(candidateMethod) || !isCredentialScope(candidateScope) || status !== "switched" && status !== "failed") {
|
|
22865
22865
|
return null;
|
|
22866
22866
|
}
|
|
22867
22867
|
return {
|
|
22868
|
-
provider,
|
|
22868
|
+
provider: provider2,
|
|
22869
22869
|
reason,
|
|
22870
22870
|
exhaustedMethod,
|
|
22871
22871
|
...isCredentialScope(exhaustedScope) ? { exhaustedScope } : {},
|
|
@@ -23427,13 +23427,13 @@ function stringifyDisplayValue(value) {
|
|
|
23427
23427
|
return String(value);
|
|
23428
23428
|
}
|
|
23429
23429
|
}
|
|
23430
|
-
function upsertDisplayMessage(messages,
|
|
23431
|
-
const index = messages.findIndex((candidate) => candidate.id ===
|
|
23432
|
-
if (index === -1) messages.push(
|
|
23433
|
-
else messages[index] =
|
|
23434
|
-
return
|
|
23430
|
+
function upsertDisplayMessage(messages, message2) {
|
|
23431
|
+
const index = messages.findIndex((candidate) => candidate.id === message2.id);
|
|
23432
|
+
if (index === -1) messages.push(message2);
|
|
23433
|
+
else messages[index] = message2;
|
|
23434
|
+
return message2;
|
|
23435
23435
|
}
|
|
23436
|
-
function applyToolInputEvent(event, messages,
|
|
23436
|
+
function applyToolInputEvent(event, messages, provider2, state, questionFilter) {
|
|
23437
23437
|
if (event.type === "replicas-tool-input-request" && typeof event.payload.toolUseId === "string" && typeof event.payload.requestId === "string" && (Array.isArray(event.payload.options) || Array.isArray(event.payload.questions))) {
|
|
23438
23438
|
const previous = state.resolutions.get(event.payload.toolUseId);
|
|
23439
23439
|
const resolved = previous && (!previous.requestId || previous.requestId === event.payload.requestId) ? previous : void 0;
|
|
@@ -23446,8 +23446,8 @@ function applyToolInputEvent(event, messages, provider, state, questionFilter) {
|
|
|
23446
23446
|
...resolved?.selectionSummary ? { selectionSummary: resolved.selectionSummary } : {}
|
|
23447
23447
|
};
|
|
23448
23448
|
state.requests.set(event.payload.toolUseId, inputRequest);
|
|
23449
|
-
const
|
|
23450
|
-
if (
|
|
23449
|
+
const message2 = messages.find((candidate) => candidate.type === "tool_call" && candidate.id === `${provider2}-tool-${event.payload.toolUseId}`);
|
|
23450
|
+
if (message2) message2.inputRequest = inputRequest;
|
|
23451
23451
|
return true;
|
|
23452
23452
|
}
|
|
23453
23453
|
if (event.type === "replicas-tool-input-resolved" && typeof event.payload.toolUseId === "string" && typeof event.payload.selectionId === "string") {
|
|
@@ -23506,23 +23506,23 @@ function skillNameFromToolCall(tool, input) {
|
|
|
23506
23506
|
if (typeof tool !== "string" || !["read", "read_file", "readfile"].includes(tool.toLowerCase())) return null;
|
|
23507
23507
|
return parseSkillFilePath(input);
|
|
23508
23508
|
}
|
|
23509
|
-
function createCallDisplayMessage(
|
|
23510
|
-
if (
|
|
23511
|
-
const skillName =
|
|
23512
|
-
if (skillName === null) return { ...
|
|
23509
|
+
function createCallDisplayMessage(message2) {
|
|
23510
|
+
if (message2.inputRequest) return { ...message2, type: "tool_call" };
|
|
23511
|
+
const skillName = message2.server.toLowerCase() === "skills" ? message2.tool : skillNameFromToolCall(message2.tool, message2.input);
|
|
23512
|
+
if (skillName === null) return { ...message2, type: "tool_call" };
|
|
23513
23513
|
return {
|
|
23514
|
-
id:
|
|
23514
|
+
id: message2.id,
|
|
23515
23515
|
type: "skill",
|
|
23516
23516
|
skillName,
|
|
23517
|
-
status:
|
|
23518
|
-
timestamp:
|
|
23517
|
+
status: message2.status,
|
|
23518
|
+
timestamp: message2.timestamp
|
|
23519
23519
|
};
|
|
23520
23520
|
}
|
|
23521
|
-
function insertDisplayMessageByTimestamp(messages,
|
|
23522
|
-
const messageMs = parseTimestampMs(
|
|
23521
|
+
function insertDisplayMessageByTimestamp(messages, message2) {
|
|
23522
|
+
const messageMs = parseTimestampMs(message2.timestamp);
|
|
23523
23523
|
let index = messages.length;
|
|
23524
23524
|
while (index > 0 && parseTimestampMs(messages[index - 1].timestamp) > messageMs) index--;
|
|
23525
|
-
messages.splice(index, 0,
|
|
23525
|
+
messages.splice(index, 0, message2);
|
|
23526
23526
|
}
|
|
23527
23527
|
|
|
23528
23528
|
// ../shared/src/display-message/format.ts
|
|
@@ -23590,32 +23590,78 @@ var automationTriggerSchema = external_exports.discriminatedUnion("type", [
|
|
|
23590
23590
|
external_exports.object({ type: external_exports.literal("custom"), config: external_exports.object({}) })
|
|
23591
23591
|
]);
|
|
23592
23592
|
|
|
23593
|
-
// ../shared/src/
|
|
23594
|
-
var
|
|
23595
|
-
|
|
23596
|
-
|
|
23597
|
-
|
|
23598
|
-
|
|
23599
|
-
|
|
23600
|
-
|
|
23601
|
-
listChannelSettings: "list_channel_settings",
|
|
23602
|
-
saveChannelPreset: "save_channel_preset",
|
|
23603
|
-
updateChannelSettings: "update_channel_settings",
|
|
23604
|
-
spawnSubagent: "spawn_subagent",
|
|
23605
|
-
messageSubagent: "message_subagent",
|
|
23606
|
-
listSubagents: "list_subagents",
|
|
23607
|
-
readSubagent: "read_subagent",
|
|
23608
|
-
archiveSubagent: "archive_subagent"
|
|
23593
|
+
// ../shared/src/subagent-mcp.ts
|
|
23594
|
+
var SUBAGENT_MCP_TOOLS = {
|
|
23595
|
+
getProviders: "get_providers",
|
|
23596
|
+
spawnAgent: "spawn_agent",
|
|
23597
|
+
getAgent: "get_agent",
|
|
23598
|
+
waitAgent: "wait_agent",
|
|
23599
|
+
messageAgent: "message_agent",
|
|
23600
|
+
deleteAgent: "delete_agent"
|
|
23609
23601
|
};
|
|
23610
|
-
var
|
|
23611
|
-
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
|
|
23616
|
-
|
|
23617
|
-
|
|
23602
|
+
var SUBAGENT_MCP_TOOL_NAMES = Object.values(SUBAGENT_MCP_TOOLS);
|
|
23603
|
+
|
|
23604
|
+
// ../shared/src/workspace-identity.ts
|
|
23605
|
+
var AWS_SOURCE_IDENTITY_CLAIM = "https://aws.amazon.com/source_identity";
|
|
23606
|
+
var WORKSPACE_TOKEN_TTL_SECONDS = 15 * 60;
|
|
23607
|
+
var IDENTITY_PROXY_PORT = 17323;
|
|
23608
|
+
var IDENTITY_TOKEN_PATH = "/token";
|
|
23609
|
+
var WORKSPACE_TOKEN_ENV = {
|
|
23610
|
+
TOKEN: "REPLICAS_WORKSPACE_TOKEN",
|
|
23611
|
+
AUDIENCE: "REPLICAS_WORKSPACE_TOKEN_AUDIENCE"
|
|
23612
|
+
};
|
|
23613
|
+
var workspaceAudienceSchema = external_exports.string().min(1).max(255).regex(/^[\x21-\x7e]+$/, "Audience must be a single printable token without spaces");
|
|
23614
|
+
var workspaceTokenRequestSchema = external_exports.object({
|
|
23615
|
+
audience: workspaceAudienceSchema.optional(),
|
|
23616
|
+
aws_source_identity: external_exports.boolean().optional()
|
|
23617
|
+
});
|
|
23618
|
+
var workspaceTokenClaimsSchema = external_exports.object({
|
|
23619
|
+
iss: external_exports.string(),
|
|
23620
|
+
sub: external_exports.string(),
|
|
23621
|
+
aud: external_exports.string(),
|
|
23622
|
+
iat: external_exports.number().int(),
|
|
23623
|
+
nbf: external_exports.number().int(),
|
|
23624
|
+
exp: external_exports.number().int(),
|
|
23625
|
+
jti: external_exports.string(),
|
|
23626
|
+
organization_id: external_exports.string().uuid(),
|
|
23627
|
+
workspace_id: external_exports.string().uuid(),
|
|
23628
|
+
environment_id: external_exports.string().uuid(),
|
|
23629
|
+
creator_id: external_exports.string().uuid().nullable(),
|
|
23630
|
+
creator_email: external_exports.string().nullable().default(null),
|
|
23631
|
+
[AWS_SOURCE_IDENTITY_CLAIM]: external_exports.string().uuid().optional()
|
|
23632
|
+
}).passthrough();
|
|
23633
|
+
var workspaceTokenResponseSchema = external_exports.object({
|
|
23634
|
+
issuer: external_exports.string(),
|
|
23635
|
+
audience: external_exports.string(),
|
|
23636
|
+
token: external_exports.string(),
|
|
23637
|
+
expires_at: external_exports.string()
|
|
23638
|
+
});
|
|
23639
|
+
var legacyWorkspaceTokenBundleSchema = external_exports.object({
|
|
23640
|
+
version: external_exports.literal(1),
|
|
23641
|
+
issuer: external_exports.string(),
|
|
23642
|
+
default_audience: external_exports.string(),
|
|
23643
|
+
tokens: external_exports.record(external_exports.string(), external_exports.object({ token: external_exports.string(), expires_at: external_exports.string() }))
|
|
23644
|
+
});
|
|
23645
|
+
var mcpWorkloadAuthSchema = external_exports.strictObject({
|
|
23646
|
+
type: external_exports.literal("workspace_identity"),
|
|
23647
|
+
audience: workspaceAudienceSchema
|
|
23618
23648
|
});
|
|
23649
|
+
function identityTokenUrl() {
|
|
23650
|
+
return `http://127.0.0.1:${IDENTITY_PROXY_PORT}${IDENTITY_TOKEN_PATH}`;
|
|
23651
|
+
}
|
|
23652
|
+
|
|
23653
|
+
// ../shared/src/routes/environment.ts
|
|
23654
|
+
var ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
|
|
23655
|
+
var stringMap = external_exports.record(external_exports.string(), external_exports.string());
|
|
23656
|
+
var createEnvironmentMcpRequestSchema = external_exports.object({
|
|
23657
|
+
name: external_exports.string(),
|
|
23658
|
+
transport: external_exports.enum(ENVIRONMENT_MCP_TRANSPORTS),
|
|
23659
|
+
config: external_exports.union([
|
|
23660
|
+
external_exports.object({ command: external_exports.string().min(1), args: external_exports.array(external_exports.string()).optional(), env: stringMap.optional() }),
|
|
23661
|
+
external_exports.object({ url: external_exports.url(), headers: stringMap.optional(), auth: mcpWorkloadAuthSchema.optional() })
|
|
23662
|
+
]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
|
|
23663
|
+
});
|
|
23664
|
+
var updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
|
|
23619
23665
|
|
|
23620
23666
|
// ../shared/src/default-skills/replicas-agent/abilities/computer.ts
|
|
23621
23667
|
var SECTION = `### Computer use (Linux desktop control)
|
|
@@ -25758,6 +25804,118 @@ var REPLICAS_AGENT_ABILITIES = Object.keys(
|
|
|
25758
25804
|
REPLICAS_AGENT_ABILITY_REGISTRY
|
|
25759
25805
|
);
|
|
25760
25806
|
|
|
25807
|
+
// ../shared/src/routes/workspaces.ts
|
|
25808
|
+
var WORKSPACE_STATUSES = ["active", "sleeping", "archived", "preparing", "error"];
|
|
25809
|
+
var STALE_PREPARING_MS = 10 * 6e4;
|
|
25810
|
+
function isWorkspaceSuspendedStatus(status) {
|
|
25811
|
+
return status === "sleeping" || status === "archived";
|
|
25812
|
+
}
|
|
25813
|
+
var VALID_LIFECYCLE_POLICIES = ["default", "archive_when_done", "sleep_when_done", "delete_after_inactivity"];
|
|
25814
|
+
function workspaceConfigWithCapabilities(config3, capabilities = {}) {
|
|
25815
|
+
const mergedCapabilities = {
|
|
25816
|
+
...config3?.capabilities,
|
|
25817
|
+
...capabilities
|
|
25818
|
+
};
|
|
25819
|
+
return {
|
|
25820
|
+
...config3,
|
|
25821
|
+
capabilities: {
|
|
25822
|
+
...mergedCapabilities,
|
|
25823
|
+
pr_followups: mergedCapabilities.pr_followups === true
|
|
25824
|
+
}
|
|
25825
|
+
};
|
|
25826
|
+
}
|
|
25827
|
+
function workspaceConfigWithPrFollowups(config3, prFollowups = config3?.capabilities?.pr_followups === true) {
|
|
25828
|
+
return workspaceConfigWithCapabilities(config3, { pr_followups: prFollowups });
|
|
25829
|
+
}
|
|
25830
|
+
var WORKSPACE_STATUS_FILTERS = WORKSPACE_STATUSES.map((status) => status === "error" ? "failed" : status);
|
|
25831
|
+
var WORKSPACE_SORT_CHOICES = [
|
|
25832
|
+
["manual", "Custom"],
|
|
25833
|
+
["activity", "Last activity"],
|
|
25834
|
+
["created", "Created date"]
|
|
25835
|
+
];
|
|
25836
|
+
var WORKSPACE_SORT_OPTIONS = WORKSPACE_SORT_CHOICES.map(([option]) => option);
|
|
25837
|
+
var WORKSPACE_SORT_LABELS = Object.fromEntries(WORKSPACE_SORT_CHOICES);
|
|
25838
|
+
var WORKSPACE_SIDEBAR_ORGANIZATION_CHOICES = [
|
|
25839
|
+
["chronological", "Chronological"],
|
|
25840
|
+
["environments", "Environments"],
|
|
25841
|
+
["recent", "Recent environments"]
|
|
25842
|
+
];
|
|
25843
|
+
var WORKSPACE_SIDEBAR_ORGANIZATIONS = WORKSPACE_SIDEBAR_ORGANIZATION_CHOICES.map(([organization]) => organization);
|
|
25844
|
+
var WORKSPACE_SIDEBAR_ORGANIZATION_LABELS = Object.fromEntries(WORKSPACE_SIDEBAR_ORGANIZATION_CHOICES);
|
|
25845
|
+
var DEFAULT_STATUS_FILTERS = [...WORKSPACE_STATUS_FILTERS];
|
|
25846
|
+
var DEFAULT_WORKSPACE_FILTERS = {
|
|
25847
|
+
statuses: [...DEFAULT_STATUS_FILTERS],
|
|
25848
|
+
ownerIds: [],
|
|
25849
|
+
activity: "any"
|
|
25850
|
+
};
|
|
25851
|
+
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
25852
|
+
var workspaceExecRequestSchema = external_exports.object({
|
|
25853
|
+
command: external_exports.string().regex(/\S/, "command is required"),
|
|
25854
|
+
timeout_seconds: external_exports.number().int().min(1).max(50).optional().describe("Default: 30")
|
|
25855
|
+
});
|
|
25856
|
+
var terminalRtcCandidateSchema = external_exports.object({ type: external_exports.literal("rtc-candidate"), candidate: external_exports.string(), mid: external_exports.string() });
|
|
25857
|
+
var terminalSocketServerMessageSchema = external_exports.discriminatedUnion("type", [
|
|
25858
|
+
external_exports.object({ type: external_exports.literal("output"), data: external_exports.string() }),
|
|
25859
|
+
external_exports.object({ type: external_exports.literal("rtc-answer"), sdp: external_exports.string() }),
|
|
25860
|
+
terminalRtcCandidateSchema,
|
|
25861
|
+
external_exports.object({ type: external_exports.literal("rtc-switch") })
|
|
25862
|
+
]);
|
|
25863
|
+
|
|
25864
|
+
// ../shared/src/replicas-mcp.ts
|
|
25865
|
+
var REPLICAS_MCP_TOOLS = {
|
|
25866
|
+
listEnvironments: "list_environments",
|
|
25867
|
+
createAutomation: "create_automation",
|
|
25868
|
+
spawn: "spawn_workspace",
|
|
25869
|
+
relay: "relay_to_workspace",
|
|
25870
|
+
linearStart: "start_linear_session",
|
|
25871
|
+
linearSessionIntent: "register_linear_session_intent",
|
|
25872
|
+
listChannelSettings: "list_channel_settings",
|
|
25873
|
+
saveChannelPreset: "save_channel_preset",
|
|
25874
|
+
updateChannelSettings: "update_channel_settings",
|
|
25875
|
+
spawnSubagent: "spawn_subagent",
|
|
25876
|
+
messageSubagent: "message_subagent",
|
|
25877
|
+
listSubagents: "list_subagents",
|
|
25878
|
+
readSubagent: "read_subagent",
|
|
25879
|
+
archiveSubagent: "archive_subagent"
|
|
25880
|
+
};
|
|
25881
|
+
var automationToolInputSchema = external_exports.object({
|
|
25882
|
+
name: external_exports.string().describe("Short automation name."),
|
|
25883
|
+
prompt: external_exports.string().describe("Prompt each automation run starts with."),
|
|
25884
|
+
environment_id: external_exports.string().describe(`Environment id from \`${REPLICAS_MCP_TOOLS.listEnvironments}\`.`),
|
|
25885
|
+
triggers: external_exports.array(automationTriggerSchema).min(1).describe(
|
|
25886
|
+
'One or more triggers. Cron: `{ "type": "cron", "config": { "schedule": "0 9 * * 1", "timezone": "America/New_York" } }`. GitHub: `{ "type": "github", "config": { "event": "pull_request.opened", "repository_ids": ["<repository uuid>"] } }`.'
|
|
25887
|
+
),
|
|
25888
|
+
description: external_exports.string().optional().describe("One-line summary shown in the dashboard."),
|
|
25889
|
+
plan_mode: external_exports.boolean().optional(),
|
|
25890
|
+
goal_mode: external_exports.boolean().optional(),
|
|
25891
|
+
fast_mode: external_exports.boolean().optional()
|
|
25892
|
+
});
|
|
25893
|
+
var automationCreateToolInputSchema = automationToolInputSchema.extend({
|
|
25894
|
+
scope: external_exports.enum(["org", "user"]).optional().describe("`org` (default) or `user` for a personal automation, which needs a personal API key.")
|
|
25895
|
+
});
|
|
25896
|
+
var automationUpdateToolInputSchema = automationToolInputSchema.partial().extend({
|
|
25897
|
+
automation_id: external_exports.string().describe("Automation ID"),
|
|
25898
|
+
enabled: external_exports.boolean().optional(),
|
|
25899
|
+
agent_provider: external_exports.enum(AGENT).nullable().optional(),
|
|
25900
|
+
model: external_exports.string().nullable().optional(),
|
|
25901
|
+
thinking_level: external_exports.enum(VALID_THINKING_LEVELS).nullable().optional(),
|
|
25902
|
+
workspace_lifecycle_policy: external_exports.enum(VALID_LIFECYCLE_POLICIES).optional(),
|
|
25903
|
+
workspace_size: external_exports.enum(WORKSPACE_SIZES).optional()
|
|
25904
|
+
});
|
|
25905
|
+
var chatPath = { id: external_exports.string().describe("Workspace ID"), chat_id: external_exports.string().describe("Chat ID") };
|
|
25906
|
+
var { provider, model, thinkingLevel, title, message } = forkChatRequestSchema.shape;
|
|
25907
|
+
var createChatToolInputSchema = external_exports.object({ id: chatPath.id, provider, title: createChatRequestSchema.shape.title });
|
|
25908
|
+
var forkChatToolInputSchema = external_exports.object({ ...chatPath, provider, model, thinkingLevel, title, message });
|
|
25909
|
+
var renameChatToolInputSchema = external_exports.object({ ...chatPath, ...updateChatDisplayNameRequestSchema.shape });
|
|
25910
|
+
var runCommandToolInputSchema = external_exports.object({ id: chatPath.id, ...workspaceExecRequestSchema.shape });
|
|
25911
|
+
var environmentMcpPath = { environment_id: external_exports.string().describe("Environment ID") };
|
|
25912
|
+
var createEnvironmentMcpToolInputSchema = external_exports.object({ ...environmentMcpPath, ...createEnvironmentMcpRequestSchema.shape });
|
|
25913
|
+
var updateEnvironmentMcpToolInputSchema = external_exports.object({
|
|
25914
|
+
...environmentMcpPath,
|
|
25915
|
+
mcp_id: external_exports.string().describe("MCP ID"),
|
|
25916
|
+
...updateEnvironmentMcpRequestSchema.shape
|
|
25917
|
+
});
|
|
25918
|
+
|
|
25761
25919
|
// ../shared/src/routes/preferences.ts
|
|
25762
25920
|
var EMPTY_AGENT_DEFAULT_SETTINGS = {
|
|
25763
25921
|
agent_provider: null,
|
|
@@ -25899,8 +26057,8 @@ function messagesForCodexTurn(turn) {
|
|
|
25899
26057
|
coalesced.splice(responseIndex, 0, ...coalesced.splice(reasoningIndex, 1));
|
|
25900
26058
|
}
|
|
25901
26059
|
const messages = coalesced.flatMap((item) => {
|
|
25902
|
-
const
|
|
25903
|
-
return [...
|
|
26060
|
+
const message2 = messageForItem(item);
|
|
26061
|
+
return [...message2 ? [message2] : [], ...skillMessagesForItem(item)];
|
|
25904
26062
|
});
|
|
25905
26063
|
if (turn.error) {
|
|
25906
26064
|
messages.push({
|
|
@@ -26177,11 +26335,11 @@ function parseCodexEvents(events) {
|
|
|
26177
26335
|
return;
|
|
26178
26336
|
}
|
|
26179
26337
|
if (event.type === "event_msg" && event.payload?.type === "user_message") {
|
|
26180
|
-
const
|
|
26338
|
+
const message2 = getPayloadString(event, "message");
|
|
26181
26339
|
messages.push({
|
|
26182
26340
|
id: displayId(event, eventIndex, "user"),
|
|
26183
26341
|
type: "user",
|
|
26184
|
-
content:
|
|
26342
|
+
content: message2 ?? "",
|
|
26185
26343
|
images: userMessageImages(event.payload.images),
|
|
26186
26344
|
timestamp: event.timestamp
|
|
26187
26345
|
});
|
|
@@ -26317,34 +26475,34 @@ function parseCodexEvents(events) {
|
|
|
26317
26475
|
}
|
|
26318
26476
|
});
|
|
26319
26477
|
const recordedPrompts = /* @__PURE__ */ new Map();
|
|
26320
|
-
messages.forEach((
|
|
26321
|
-
if (
|
|
26322
|
-
const prompts7 = recordedPrompts.get(
|
|
26323
|
-
prompts7.push({ message, index, timestampMs: parseTimestampMs(
|
|
26324
|
-
recordedPrompts.set(
|
|
26478
|
+
messages.forEach((message2, index) => {
|
|
26479
|
+
if (message2.type !== "user") return;
|
|
26480
|
+
const prompts7 = recordedPrompts.get(message2.content) ?? [];
|
|
26481
|
+
prompts7.push({ message: message2, index, timestampMs: parseTimestampMs(message2.timestamp) });
|
|
26482
|
+
recordedPrompts.set(message2.content, prompts7);
|
|
26325
26483
|
});
|
|
26326
26484
|
const claimedPrompts = /* @__PURE__ */ new Set();
|
|
26327
26485
|
for (const { index, turnId } of turnInsertions.reverse()) {
|
|
26328
26486
|
const turn = turns.get(turnId);
|
|
26329
26487
|
if (!turn) continue;
|
|
26330
26488
|
const kept = [];
|
|
26331
|
-
for (const
|
|
26332
|
-
if (
|
|
26333
|
-
kept.push(
|
|
26489
|
+
for (const message2 of messagesForCodexTurn(turn)) {
|
|
26490
|
+
if (message2.type !== "user") {
|
|
26491
|
+
kept.push(message2);
|
|
26334
26492
|
continue;
|
|
26335
26493
|
}
|
|
26336
|
-
const prompts7 = recordedPrompts.get(
|
|
26337
|
-
const recorded = prompts7 && takeRecordedPrompt(prompts7,
|
|
26494
|
+
const prompts7 = recordedPrompts.get(message2.content);
|
|
26495
|
+
const recorded = prompts7 && takeRecordedPrompt(prompts7, message2, index);
|
|
26338
26496
|
if (!recorded) {
|
|
26339
|
-
kept.push(
|
|
26497
|
+
kept.push(message2);
|
|
26340
26498
|
continue;
|
|
26341
26499
|
}
|
|
26342
26500
|
claimedPrompts.add(recorded);
|
|
26343
|
-
kept.push({ ...recorded, images: recorded.images ??
|
|
26501
|
+
kept.push({ ...recorded, images: recorded.images ?? message2.images });
|
|
26344
26502
|
}
|
|
26345
26503
|
messages.splice(index, 0, ...kept);
|
|
26346
26504
|
}
|
|
26347
|
-
return messages.filter((
|
|
26505
|
+
return messages.filter((message2) => !claimedPrompts.has(message2));
|
|
26348
26506
|
}
|
|
26349
26507
|
|
|
26350
26508
|
// ../shared/src/display-message/parsers/cursor-parser.ts
|
|
@@ -26360,24 +26518,24 @@ function cursorRunId(event) {
|
|
|
26360
26518
|
return typeof runId === "string" ? runId : "unknown-run";
|
|
26361
26519
|
}
|
|
26362
26520
|
function getCursorAssistantText(event) {
|
|
26363
|
-
const
|
|
26364
|
-
return getTextContent(
|
|
26521
|
+
const message2 = isRecord(event.payload.message) ? event.payload.message : null;
|
|
26522
|
+
return getTextContent(message2?.content);
|
|
26365
26523
|
}
|
|
26366
26524
|
function getCursorThinkingText(event) {
|
|
26367
26525
|
const text2 = event.payload.text;
|
|
26368
26526
|
if (typeof text2 === "string") return text2;
|
|
26369
|
-
const
|
|
26370
|
-
return typeof
|
|
26527
|
+
const message2 = isRecord(event.payload.message) ? event.payload.message : null;
|
|
26528
|
+
return typeof message2?.text === "string" ? message2.text : "";
|
|
26371
26529
|
}
|
|
26372
26530
|
function isTerminalStatus(status) {
|
|
26373
26531
|
return status === "FINISHED" || status === "ERROR" || status === "CANCELLED" || status === "EXPIRED";
|
|
26374
26532
|
}
|
|
26375
26533
|
function finalizeOpenCalls(messages, callIndexes, status) {
|
|
26376
26534
|
for (const index of callIndexes.values()) {
|
|
26377
|
-
const
|
|
26378
|
-
if ((
|
|
26535
|
+
const message2 = messages[index];
|
|
26536
|
+
if ((message2?.type === "tool_call" || message2?.type === "skill") && message2.status === "in_progress") {
|
|
26379
26537
|
messages[index] = {
|
|
26380
|
-
...
|
|
26538
|
+
...message2,
|
|
26381
26539
|
status
|
|
26382
26540
|
};
|
|
26383
26541
|
}
|
|
@@ -26392,10 +26550,10 @@ function parseCursorEvents(events) {
|
|
|
26392
26550
|
let activeThinking = null;
|
|
26393
26551
|
const finalizeActiveThinking = (status) => {
|
|
26394
26552
|
if (!activeThinking) return;
|
|
26395
|
-
const
|
|
26396
|
-
if (
|
|
26553
|
+
const message2 = messages[activeThinking.index];
|
|
26554
|
+
if (message2?.type === "reasoning") {
|
|
26397
26555
|
messages[activeThinking.index] = {
|
|
26398
|
-
...
|
|
26556
|
+
...message2,
|
|
26399
26557
|
status
|
|
26400
26558
|
};
|
|
26401
26559
|
}
|
|
@@ -26404,12 +26562,12 @@ function parseCursorEvents(events) {
|
|
|
26404
26562
|
if (event.type === "event_msg" && event.payload.type === "user_message") {
|
|
26405
26563
|
activeAssistant = null;
|
|
26406
26564
|
activeThinking = null;
|
|
26407
|
-
const
|
|
26408
|
-
if (typeof
|
|
26565
|
+
const message2 = event.payload.message;
|
|
26566
|
+
if (typeof message2 === "string" && message2.trim()) {
|
|
26409
26567
|
messages.push({
|
|
26410
26568
|
id: getUserMessageId(event) ?? `cursor-user-${event.timestamp}-${messages.length}`,
|
|
26411
26569
|
type: "user",
|
|
26412
|
-
content:
|
|
26570
|
+
content: message2,
|
|
26413
26571
|
timestamp: event.timestamp
|
|
26414
26572
|
});
|
|
26415
26573
|
}
|
|
@@ -26432,11 +26590,11 @@ function parseCursorEvents(events) {
|
|
|
26432
26590
|
}) - 1
|
|
26433
26591
|
};
|
|
26434
26592
|
}
|
|
26435
|
-
const
|
|
26436
|
-
if (
|
|
26593
|
+
const message2 = messages[activeAssistant.index];
|
|
26594
|
+
if (message2?.type === "agent") {
|
|
26437
26595
|
messages[activeAssistant.index] = {
|
|
26438
|
-
...
|
|
26439
|
-
content: `${
|
|
26596
|
+
...message2,
|
|
26597
|
+
content: `${message2.content}${text2}`
|
|
26440
26598
|
};
|
|
26441
26599
|
}
|
|
26442
26600
|
}
|
|
@@ -26460,11 +26618,11 @@ function parseCursorEvents(events) {
|
|
|
26460
26618
|
}) - 1
|
|
26461
26619
|
};
|
|
26462
26620
|
}
|
|
26463
|
-
const
|
|
26464
|
-
if (
|
|
26621
|
+
const message2 = messages[activeThinking.index];
|
|
26622
|
+
if (message2?.type === "reasoning") {
|
|
26465
26623
|
messages[activeThinking.index] = {
|
|
26466
|
-
...
|
|
26467
|
-
content: `${
|
|
26624
|
+
...message2,
|
|
26625
|
+
content: `${message2.content}${text2}`,
|
|
26468
26626
|
status: "in_progress"
|
|
26469
26627
|
};
|
|
26470
26628
|
}
|
|
@@ -26523,11 +26681,11 @@ function parseCursorEvents(events) {
|
|
|
26523
26681
|
finalizeOpenCalls(messages, callIndexes, "failed");
|
|
26524
26682
|
activeAssistant = null;
|
|
26525
26683
|
activeThinking = null;
|
|
26526
|
-
const
|
|
26684
|
+
const message2 = typeof event.payload.message === "string" ? event.payload.message : "Cursor run failed";
|
|
26527
26685
|
messages.push({
|
|
26528
26686
|
id: `cursor-error-${event.timestamp}-${messages.length}`,
|
|
26529
26687
|
type: "error",
|
|
26530
|
-
message,
|
|
26688
|
+
message: message2,
|
|
26531
26689
|
timestamp: event.timestamp
|
|
26532
26690
|
});
|
|
26533
26691
|
}
|
|
@@ -26578,16 +26736,16 @@ var TRANSIENT_HTTP_STATUSES = [408, 429, 500, 502, 503, 504, 529];
|
|
|
26578
26736
|
var SERVER_ERROR_TEXT_PATTERN = /internal ?server ?error|server ?error|service unavailable|bad gateway|gateway timeout|overloaded|too many requests/i;
|
|
26579
26737
|
var INFERENCE_ERROR_DETAIL_MAX = 600;
|
|
26580
26738
|
var INFERENCE_ERROR_RETRY_HINT = "This is usually temporary \u2014 retry the message.";
|
|
26581
|
-
function formatInferenceError(
|
|
26739
|
+
function formatInferenceError(message2, context = {}) {
|
|
26582
26740
|
const label = context.provider ? INFERENCE_PROVIDER_LABELS[context.provider] ?? context.provider : null;
|
|
26583
26741
|
const source = label ? `${label}${context.model ? ` (${context.model})` : ""} request failed${typeof context.status === "number" ? ` with HTTP ${context.status}` : ""}` : null;
|
|
26584
|
-
let body = source ?
|
|
26742
|
+
let body = source ? message2 ? `${source}: ${message2}` : `${source}.` : message2;
|
|
26585
26743
|
const detail = context.detail?.trim();
|
|
26586
26744
|
if (detail && !body.includes(detail)) {
|
|
26587
26745
|
body = `${body}
|
|
26588
26746
|
${detail.length > INFERENCE_ERROR_DETAIL_MAX ? `${detail.slice(0, INFERENCE_ERROR_DETAIL_MAX)}\u2026` : detail}`;
|
|
26589
26747
|
}
|
|
26590
|
-
const sniffText = `${
|
|
26748
|
+
const sniffText = `${message2}
|
|
26591
26749
|
${detail ?? ""}`;
|
|
26592
26750
|
const transient = context.retryable ?? (typeof context.status === "number" ? TRANSIENT_HTTP_STATUSES.includes(context.status) || context.status >= 500 : isTransientErrorText(sniffText, { httpStatuses: TRANSIENT_HTTP_STATUSES, includeRateLimit: true }) || SERVER_ERROR_TEXT_PATTERN.test(sniffText));
|
|
26593
26751
|
return transient ? `${body}
|
|
@@ -26607,9 +26765,9 @@ function toolStatus(status) {
|
|
|
26607
26765
|
function assistantError(info) {
|
|
26608
26766
|
if (!isRecord(info) || !isRecord(info.error)) return null;
|
|
26609
26767
|
const data = isRecord(info.error.data) ? info.error.data : null;
|
|
26610
|
-
const
|
|
26611
|
-
if (info.error.name === "MessageAbortedError") return
|
|
26612
|
-
return formatInferenceError(
|
|
26768
|
+
const message2 = typeof data?.message === "string" ? data.message : typeof info.error.message === "string" ? info.error.message : stringifyDisplayValue(info.error) ?? "Opencode run failed";
|
|
26769
|
+
if (info.error.name === "MessageAbortedError") return message2;
|
|
26770
|
+
return formatInferenceError(message2, {
|
|
26613
26771
|
...typeof info.providerID === "string" ? { provider: info.providerID } : {},
|
|
26614
26772
|
...typeof info.modelID === "string" ? { model: info.modelID } : {},
|
|
26615
26773
|
...typeof data?.statusCode === "number" ? { status: data.statusCode } : {},
|
|
@@ -26621,13 +26779,13 @@ function parseOpencodeEvents(events) {
|
|
|
26621
26779
|
const messages = [];
|
|
26622
26780
|
for (const event of events) {
|
|
26623
26781
|
if (event.type === "event_msg" && event.payload.type === "user_message") {
|
|
26624
|
-
const
|
|
26625
|
-
if (typeof
|
|
26782
|
+
const message2 = event.payload.message;
|
|
26783
|
+
if (typeof message2 === "string" && message2.trim()) {
|
|
26626
26784
|
const messageId = event.payload[USER_MESSAGE_ID_PAYLOAD_KEY];
|
|
26627
26785
|
messages.push({
|
|
26628
26786
|
id: typeof messageId === "string" ? messageId : `opencode-user-${event.timestamp}`,
|
|
26629
26787
|
type: "user",
|
|
26630
|
-
content:
|
|
26788
|
+
content: message2,
|
|
26631
26789
|
timestamp: event.timestamp
|
|
26632
26790
|
});
|
|
26633
26791
|
}
|
|
@@ -26646,11 +26804,11 @@ function parseOpencodeEvents(events) {
|
|
|
26646
26804
|
continue;
|
|
26647
26805
|
}
|
|
26648
26806
|
if (event.type === "opencode-error") {
|
|
26649
|
-
const
|
|
26807
|
+
const message2 = typeof event.payload.message === "string" ? event.payload.message : "Opencode run failed";
|
|
26650
26808
|
messages.push({
|
|
26651
26809
|
id: `opencode-${event.type}-${event.timestamp}`,
|
|
26652
26810
|
type: "error",
|
|
26653
|
-
message: formatInferenceError(
|
|
26811
|
+
message: formatInferenceError(message2, {
|
|
26654
26812
|
...typeof event.payload.status === "number" ? { status: event.payload.status } : {}
|
|
26655
26813
|
}),
|
|
26656
26814
|
timestamp: event.timestamp
|
|
@@ -26832,7 +26990,7 @@ function parseMuseEvents(events) {
|
|
|
26832
26990
|
} catch {
|
|
26833
26991
|
}
|
|
26834
26992
|
}
|
|
26835
|
-
const
|
|
26993
|
+
const message2 = createCallDisplayMessage({
|
|
26836
26994
|
id: `muse-tool-${item.itemId}`,
|
|
26837
26995
|
server: "muse",
|
|
26838
26996
|
tool: typeof item.tool === "string" ? item.tool : "tool",
|
|
@@ -26842,7 +27000,7 @@ function parseMuseEvents(events) {
|
|
|
26842
27000
|
status: item.status === "failed" || item.status === "rejected" ? "failed" : terminal ? "completed" : "in_progress",
|
|
26843
27001
|
timestamp: typeof item.recordedAt === "string" ? item.recordedAt : event.timestamp
|
|
26844
27002
|
});
|
|
26845
|
-
upsertDisplayMessage(messages,
|
|
27003
|
+
upsertDisplayMessage(messages, message2);
|
|
26846
27004
|
}
|
|
26847
27005
|
}
|
|
26848
27006
|
return messages;
|
|
@@ -26857,8 +27015,8 @@ function toolStatus2(value) {
|
|
|
26857
27015
|
}
|
|
26858
27016
|
function assistantErrorMessage(value) {
|
|
26859
27017
|
if (!isRecord(value) || value.role !== "assistant" || value.stopReason !== "error") return null;
|
|
26860
|
-
const
|
|
26861
|
-
return formatInferenceError(
|
|
27018
|
+
const message2 = typeof value.errorMessage === "string" && value.errorMessage ? value.errorMessage : "Pi run failed";
|
|
27019
|
+
return formatInferenceError(message2, {
|
|
26862
27020
|
...typeof value.provider === "string" ? { provider: value.provider } : {},
|
|
26863
27021
|
...typeof value.model === "string" ? { model: value.model } : {}
|
|
26864
27022
|
});
|
|
@@ -26905,8 +27063,8 @@ function parsePiEvents(events) {
|
|
|
26905
27063
|
continue;
|
|
26906
27064
|
}
|
|
26907
27065
|
if (event.type === "pi-message_start") {
|
|
26908
|
-
const
|
|
26909
|
-
activeMessageId = typeof
|
|
27066
|
+
const message2 = isRecord(event.payload.message) ? event.payload.message : null;
|
|
27067
|
+
activeMessageId = typeof message2?.id === "string" ? message2.id : `assistant-${event.timestamp}`;
|
|
26910
27068
|
continue;
|
|
26911
27069
|
}
|
|
26912
27070
|
if (event.type === "pi-tool_execution_start" || event.type === "pi-tool_execution_update" || event.type === "pi-tool_execution_end") {
|
|
@@ -27107,8 +27265,8 @@ function fileOrCommandMessage(toolName, toolUseId, input, timestamp) {
|
|
|
27107
27265
|
};
|
|
27108
27266
|
}
|
|
27109
27267
|
function createSubagentMessage(messageIndex, timestamp, fields) {
|
|
27110
|
-
const { id = `subagent-${timestamp}-${messageIndex}`, ...
|
|
27111
|
-
return { id, type: "subagent", ...
|
|
27268
|
+
const { id = `subagent-${timestamp}-${messageIndex}`, ...message2 } = fields;
|
|
27269
|
+
return { id, type: "subagent", ...message2, timestamp };
|
|
27112
27270
|
}
|
|
27113
27271
|
function collectNestedEvents(events, toolUseId) {
|
|
27114
27272
|
return events.filter((e) => e.payload.parent_tool_use_id === toolUseId).map(({ timestamp, type, payload }) => ({ timestamp, type, payload }));
|
|
@@ -27165,12 +27323,12 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
27165
27323
|
const supersededUserMessageIndexes = /* @__PURE__ */ new Set();
|
|
27166
27324
|
const findMatchingUserMessageIndex = (indexes, content, timestamp, messageId) => {
|
|
27167
27325
|
if (typeof messageId === "string") {
|
|
27168
|
-
const byId = messages.findIndex((
|
|
27326
|
+
const byId = messages.findIndex((message2, index) => message2.type === "user" && message2.id === messageId && !supersededUserMessageIndexes.has(index));
|
|
27169
27327
|
if (byId !== -1) return byId;
|
|
27170
27328
|
}
|
|
27171
27329
|
return [...indexes].find((index) => {
|
|
27172
|
-
const
|
|
27173
|
-
return
|
|
27330
|
+
const message2 = messages[index];
|
|
27331
|
+
return message2?.type === "user" && areUserMessagesWithinMatchWindow(message2, { content, timestamp });
|
|
27174
27332
|
});
|
|
27175
27333
|
};
|
|
27176
27334
|
const taskAccumulator = new TaskAccumulator();
|
|
@@ -27187,7 +27345,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
27187
27345
|
const messageId = event.payload[USER_MESSAGE_ID_PAYLOAD_KEY];
|
|
27188
27346
|
const canonicalIndex = findMatchingUserMessageIndex(canonicalUserMessageIndexes, content, event.timestamp, messageId);
|
|
27189
27347
|
const canonical = canonicalIndex === void 0 ? void 0 : messages[canonicalIndex];
|
|
27190
|
-
const
|
|
27348
|
+
const message2 = {
|
|
27191
27349
|
id: typeof messageId === "string" ? messageId : `user-${event.timestamp}`,
|
|
27192
27350
|
type: "user",
|
|
27193
27351
|
content,
|
|
@@ -27195,9 +27353,9 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
27195
27353
|
timestamp: event.timestamp
|
|
27196
27354
|
};
|
|
27197
27355
|
if (canonicalIndex === void 0) {
|
|
27198
|
-
acceptedUserMessageIndexes.add(messages.push(
|
|
27356
|
+
acceptedUserMessageIndexes.add(messages.push(message2) - 1);
|
|
27199
27357
|
} else {
|
|
27200
|
-
messages[canonicalIndex] =
|
|
27358
|
+
messages[canonicalIndex] = message2;
|
|
27201
27359
|
canonicalUserMessageIndexes.delete(canonicalIndex);
|
|
27202
27360
|
}
|
|
27203
27361
|
}
|
|
@@ -27269,7 +27427,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
27269
27427
|
stampedId
|
|
27270
27428
|
);
|
|
27271
27429
|
const accepted = acceptedIndex === void 0 ? void 0 : messages[acceptedIndex];
|
|
27272
|
-
const
|
|
27430
|
+
const message2 = {
|
|
27273
27431
|
id: accepted?.id ?? (typeof stampedId === "string" ? stampedId : `user-${event.timestamp}`),
|
|
27274
27432
|
type: "user",
|
|
27275
27433
|
content: textContent || (images.length > 0 ? `[${images.length} image${images.length > 1 ? "s" : ""} attached]` : ""),
|
|
@@ -27277,13 +27435,13 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
27277
27435
|
timestamp: event.timestamp
|
|
27278
27436
|
};
|
|
27279
27437
|
if (acceptedIndex === void 0) {
|
|
27280
|
-
canonicalUserMessageIndexes.add(messages.push(
|
|
27438
|
+
canonicalUserMessageIndexes.add(messages.push(message2) - 1);
|
|
27281
27439
|
} else if (acceptedUserMessageIndexes.has(acceptedIndex)) {
|
|
27282
27440
|
supersededUserMessageIndexes.add(acceptedIndex);
|
|
27283
27441
|
acceptedUserMessageIndexes.delete(acceptedIndex);
|
|
27284
|
-
canonicalUserMessageIndexes.add(messages.push(
|
|
27442
|
+
canonicalUserMessageIndexes.add(messages.push(message2) - 1);
|
|
27285
27443
|
} else {
|
|
27286
|
-
messages[acceptedIndex] =
|
|
27444
|
+
messages[acceptedIndex] = message2;
|
|
27287
27445
|
}
|
|
27288
27446
|
}
|
|
27289
27447
|
}
|
|
@@ -27507,9 +27665,9 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
27507
27665
|
if (!Array.isArray(payload.options) && !Array.isArray(payload.questions)) return;
|
|
27508
27666
|
const toolInfo = toolCallMap.get(payload.toolUseId);
|
|
27509
27667
|
if (!toolInfo) return;
|
|
27510
|
-
const
|
|
27511
|
-
if (!
|
|
27512
|
-
|
|
27668
|
+
const message2 = messages[toolInfo.messageIndex];
|
|
27669
|
+
if (!message2 || message2.type !== "tool_call") return;
|
|
27670
|
+
message2.inputRequest = {
|
|
27513
27671
|
requestId: payload.requestId,
|
|
27514
27672
|
status: "pending",
|
|
27515
27673
|
options: payload.options,
|
|
@@ -27521,10 +27679,10 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
27521
27679
|
if (!payload.toolUseId || !payload.selectionId) return;
|
|
27522
27680
|
const toolInfo = toolCallMap.get(payload.toolUseId);
|
|
27523
27681
|
if (!toolInfo) return;
|
|
27524
|
-
const
|
|
27525
|
-
if (!
|
|
27526
|
-
|
|
27527
|
-
...
|
|
27682
|
+
const message2 = messages[toolInfo.messageIndex];
|
|
27683
|
+
if (!message2 || message2.type !== "tool_call" || !message2.inputRequest) return;
|
|
27684
|
+
message2.inputRequest = {
|
|
27685
|
+
...message2.inputRequest,
|
|
27528
27686
|
status: payload.selectionId === "aborted" ? "aborted" : "resolved",
|
|
27529
27687
|
selectionId: payload.selectionId,
|
|
27530
27688
|
selectionSummary: payload.selectionSummary
|
|
@@ -27546,39 +27704,39 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
27546
27704
|
if (toolInfo.toolName === "TaskCreate" && !isError) {
|
|
27547
27705
|
taskAccumulator.processContentBlock(toolResult);
|
|
27548
27706
|
}
|
|
27549
|
-
const
|
|
27550
|
-
if (!
|
|
27551
|
-
if (
|
|
27552
|
-
|
|
27553
|
-
|
|
27707
|
+
const message2 = messages[toolInfo.messageIndex];
|
|
27708
|
+
if (!message2) return;
|
|
27709
|
+
if (message2.type === "command") {
|
|
27710
|
+
message2.output = resultContent;
|
|
27711
|
+
message2.status = status;
|
|
27554
27712
|
const exitCodeMatch = resultContent.match(/exit code:?\s*(\d+)/i);
|
|
27555
27713
|
if (exitCodeMatch) {
|
|
27556
|
-
|
|
27714
|
+
message2.exitCode = parseInt(exitCodeMatch[1], 10);
|
|
27557
27715
|
} else {
|
|
27558
|
-
|
|
27559
|
-
}
|
|
27560
|
-
} else if (
|
|
27561
|
-
|
|
27562
|
-
} else if (
|
|
27563
|
-
|
|
27564
|
-
} else if (
|
|
27565
|
-
|
|
27566
|
-
|
|
27567
|
-
} else if (
|
|
27568
|
-
|
|
27569
|
-
} else if (
|
|
27570
|
-
|
|
27571
|
-
|
|
27572
|
-
}
|
|
27573
|
-
});
|
|
27574
|
-
for (const
|
|
27575
|
-
if (
|
|
27576
|
-
const toolInfo = toolCallMap.get(
|
|
27716
|
+
message2.exitCode = isError ? 1 : 0;
|
|
27717
|
+
}
|
|
27718
|
+
} else if (message2.type === "patch") {
|
|
27719
|
+
message2.status = status;
|
|
27720
|
+
} else if (message2.type === "web_search") {
|
|
27721
|
+
message2.status = status;
|
|
27722
|
+
} else if (message2.type === "tool_call") {
|
|
27723
|
+
message2.output = resultContent;
|
|
27724
|
+
message2.status = status;
|
|
27725
|
+
} else if (message2.type === "skill") {
|
|
27726
|
+
message2.status = status;
|
|
27727
|
+
} else if (message2.type === "subagent") {
|
|
27728
|
+
message2.output = resultContent;
|
|
27729
|
+
message2.status = status;
|
|
27730
|
+
}
|
|
27731
|
+
});
|
|
27732
|
+
for (const message2 of messages) {
|
|
27733
|
+
if (message2.type === "background_task" && message2.toolUseId) {
|
|
27734
|
+
const toolInfo = toolCallMap.get(message2.toolUseId);
|
|
27577
27735
|
const toolMessage = toolInfo ? messages[toolInfo.messageIndex] : void 0;
|
|
27578
|
-
if (toolMessage?.type === "command")
|
|
27736
|
+
if (toolMessage?.type === "command") message2.command = toolMessage.command;
|
|
27579
27737
|
if (toolMessage?.type === "subagent") {
|
|
27580
|
-
|
|
27581
|
-
|
|
27738
|
+
message2.prompt ?? (message2.prompt = toolMessage.prompt);
|
|
27739
|
+
message2.subagentType ?? (message2.subagentType = toolMessage.subagentType);
|
|
27582
27740
|
}
|
|
27583
27741
|
}
|
|
27584
27742
|
}
|
|
@@ -27617,9 +27775,9 @@ function parseDisplayMessages(events, agentType, options = {}) {
|
|
|
27617
27775
|
events = excludeQueuedAcceptedEvents(events, []);
|
|
27618
27776
|
const parsedEvents = agentType === "claude" ? parseClaudeEvents(events, options.parentToolUseId) : parseAgentEvents(events, agentType);
|
|
27619
27777
|
const reconciledEvents = [];
|
|
27620
|
-
for (const
|
|
27621
|
-
if (
|
|
27622
|
-
else reconciledEvents.push(
|
|
27778
|
+
for (const message2 of parsedEvents) {
|
|
27779
|
+
if (message2.type === "user") upsertDisplayMessage(reconciledEvents, message2);
|
|
27780
|
+
else reconciledEvents.push(message2);
|
|
27623
27781
|
}
|
|
27624
27782
|
if (options.filter === false) return reconciledEvents;
|
|
27625
27783
|
return applyAuthFallbackNotices(
|
|
@@ -27681,12 +27839,12 @@ function applyAuthFallbackNotices(messages, events) {
|
|
|
27681
27839
|
for (const notice of notices) insertDisplayMessageByTimestamp(result, notice);
|
|
27682
27840
|
return result;
|
|
27683
27841
|
}
|
|
27684
|
-
function isCodexInitializationPrompt(
|
|
27685
|
-
return
|
|
27842
|
+
function isCodexInitializationPrompt(message2) {
|
|
27843
|
+
return message2.type === "user" && removeReplicasInstructions(message2.content).trim() === "Hello";
|
|
27686
27844
|
}
|
|
27687
|
-
function filterDisplayMessages(messages,
|
|
27845
|
+
function filterDisplayMessages(messages, provider2) {
|
|
27688
27846
|
let result = messages;
|
|
27689
|
-
if (
|
|
27847
|
+
if (provider2 === "codex") {
|
|
27690
27848
|
const userMessages = result.map((msg, index) => ({ msg, index })).filter(({ msg }) => msg.type === "user");
|
|
27691
27849
|
if (userMessages.length >= 2 && isCodexInitializationPrompt(userMessages[0].msg)) {
|
|
27692
27850
|
result = result.slice(userMessages[1].index);
|
|
@@ -27727,7 +27885,7 @@ function getRemovedMessageIds(event) {
|
|
|
27727
27885
|
return messageId ? [messageId] : [];
|
|
27728
27886
|
}
|
|
27729
27887
|
function excludeQueuedAcceptedEvents(events, queue, removedMessageIds = []) {
|
|
27730
|
-
const queuedMessageIds = /* @__PURE__ */ new Set([...queue.map((
|
|
27888
|
+
const queuedMessageIds = /* @__PURE__ */ new Set([...queue.map((message2) => message2.id), ...removedMessageIds]);
|
|
27731
27889
|
for (const event of events) {
|
|
27732
27890
|
for (const messageId of getRemovedMessageIds(event)) queuedMessageIds.add(messageId);
|
|
27733
27891
|
}
|
|
@@ -27993,17 +28151,6 @@ var HOOK_EXEC_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
|
|
|
27993
28151
|
// ../shared/src/replicas-config.ts
|
|
27994
28152
|
var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
|
|
27995
28153
|
|
|
27996
|
-
// ../shared/src/subagent-mcp.ts
|
|
27997
|
-
var SUBAGENT_MCP_TOOLS = {
|
|
27998
|
-
getProviders: "get_providers",
|
|
27999
|
-
spawnAgent: "spawn_agent",
|
|
28000
|
-
getAgent: "get_agent",
|
|
28001
|
-
waitAgent: "wait_agent",
|
|
28002
|
-
messageAgent: "message_agent",
|
|
28003
|
-
deleteAgent: "delete_agent"
|
|
28004
|
-
};
|
|
28005
|
-
var SUBAGENT_MCP_TOOL_NAMES = Object.values(SUBAGENT_MCP_TOOLS);
|
|
28006
|
-
|
|
28007
28154
|
// ../shared/src/headless-agent.ts
|
|
28008
28155
|
var headlessAgentRequestSchema = external_exports.object({
|
|
28009
28156
|
mode: external_exports.literal("structured"),
|
|
@@ -28019,7 +28166,7 @@ var headlessAgentRequestSchema = external_exports.object({
|
|
|
28019
28166
|
});
|
|
28020
28167
|
|
|
28021
28168
|
// ../shared/src/cli-version.ts
|
|
28022
|
-
var CLI_VERSION = "0.2.
|
|
28169
|
+
var CLI_VERSION = "0.2.816";
|
|
28023
28170
|
|
|
28024
28171
|
// ../shared/src/version.ts
|
|
28025
28172
|
function compareVersions(v1, v2) {
|
|
@@ -28464,62 +28611,6 @@ var workspaceLastViewedAtClientStateKey = orgUserClientStateKey(WORKSPACE_LAST_V
|
|
|
28464
28611
|
var workspaceAttentionDoneClientStateKey = orgUserClientStateKey(WORKSPACE_ATTENTION_DONE_CLIENT_STATE_KEY_PREFIX);
|
|
28465
28612
|
var workspaceStagesClientStateKey = orgUserClientStateKey(WORKSPACE_STAGES_CLIENT_STATE_KEY_PREFIX);
|
|
28466
28613
|
|
|
28467
|
-
// ../shared/src/routes/workspaces.ts
|
|
28468
|
-
var WORKSPACE_STATUSES = ["active", "sleeping", "archived", "preparing", "error"];
|
|
28469
|
-
var STALE_PREPARING_MS = 10 * 6e4;
|
|
28470
|
-
function isWorkspaceSuspendedStatus(status) {
|
|
28471
|
-
return status === "sleeping" || status === "archived";
|
|
28472
|
-
}
|
|
28473
|
-
function workspaceConfigWithCapabilities(config3, capabilities = {}) {
|
|
28474
|
-
const mergedCapabilities = {
|
|
28475
|
-
...config3?.capabilities,
|
|
28476
|
-
...capabilities
|
|
28477
|
-
};
|
|
28478
|
-
return {
|
|
28479
|
-
...config3,
|
|
28480
|
-
capabilities: {
|
|
28481
|
-
...mergedCapabilities,
|
|
28482
|
-
pr_followups: mergedCapabilities.pr_followups === true
|
|
28483
|
-
}
|
|
28484
|
-
};
|
|
28485
|
-
}
|
|
28486
|
-
function workspaceConfigWithPrFollowups(config3, prFollowups = config3?.capabilities?.pr_followups === true) {
|
|
28487
|
-
return workspaceConfigWithCapabilities(config3, { pr_followups: prFollowups });
|
|
28488
|
-
}
|
|
28489
|
-
var WORKSPACE_STATUS_FILTERS = WORKSPACE_STATUSES.map((status) => status === "error" ? "failed" : status);
|
|
28490
|
-
var WORKSPACE_SORT_CHOICES = [
|
|
28491
|
-
["manual", "Custom"],
|
|
28492
|
-
["activity", "Last activity"],
|
|
28493
|
-
["created", "Created date"]
|
|
28494
|
-
];
|
|
28495
|
-
var WORKSPACE_SORT_OPTIONS = WORKSPACE_SORT_CHOICES.map(([option]) => option);
|
|
28496
|
-
var WORKSPACE_SORT_LABELS = Object.fromEntries(WORKSPACE_SORT_CHOICES);
|
|
28497
|
-
var WORKSPACE_SIDEBAR_ORGANIZATION_CHOICES = [
|
|
28498
|
-
["chronological", "Chronological"],
|
|
28499
|
-
["environments", "Environments"],
|
|
28500
|
-
["recent", "Recent environments"]
|
|
28501
|
-
];
|
|
28502
|
-
var WORKSPACE_SIDEBAR_ORGANIZATIONS = WORKSPACE_SIDEBAR_ORGANIZATION_CHOICES.map(([organization]) => organization);
|
|
28503
|
-
var WORKSPACE_SIDEBAR_ORGANIZATION_LABELS = Object.fromEntries(WORKSPACE_SIDEBAR_ORGANIZATION_CHOICES);
|
|
28504
|
-
var DEFAULT_STATUS_FILTERS = [...WORKSPACE_STATUS_FILTERS];
|
|
28505
|
-
var DEFAULT_WORKSPACE_FILTERS = {
|
|
28506
|
-
statuses: [...DEFAULT_STATUS_FILTERS],
|
|
28507
|
-
ownerIds: [],
|
|
28508
|
-
activity: "any"
|
|
28509
|
-
};
|
|
28510
|
-
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
28511
|
-
var workspaceExecRequestSchema = external_exports.object({
|
|
28512
|
-
command: external_exports.string().regex(/\S/, "command is required"),
|
|
28513
|
-
timeout_seconds: external_exports.number().int().min(1).max(50).optional().describe("Default: 30")
|
|
28514
|
-
});
|
|
28515
|
-
var terminalRtcCandidateSchema = external_exports.object({ type: external_exports.literal("rtc-candidate"), candidate: external_exports.string(), mid: external_exports.string() });
|
|
28516
|
-
var terminalSocketServerMessageSchema = external_exports.discriminatedUnion("type", [
|
|
28517
|
-
external_exports.object({ type: external_exports.literal("output"), data: external_exports.string() }),
|
|
28518
|
-
external_exports.object({ type: external_exports.literal("rtc-answer"), sdp: external_exports.string() }),
|
|
28519
|
-
terminalRtcCandidateSchema,
|
|
28520
|
-
external_exports.object({ type: external_exports.literal("rtc-switch") })
|
|
28521
|
-
]);
|
|
28522
|
-
|
|
28523
28614
|
// ../shared/src/routes/workspace-events.ts
|
|
28524
28615
|
var workspaceChangedEventSchema = external_exports.discriminatedUnion("type", [
|
|
28525
28616
|
external_exports.object({
|
|
@@ -28603,37 +28694,37 @@ function validateAgentSelection(body, existing, modelCatalogs = {}) {
|
|
|
28603
28694
|
}
|
|
28604
28695
|
const executionAgent = agentProvider !== void 0 ? agentProvider : existing.agentProvider;
|
|
28605
28696
|
const agentChanged = agentProvider !== void 0 && agentProvider !== existing.agentProvider;
|
|
28606
|
-
let
|
|
28607
|
-
if (agentChanged &&
|
|
28608
|
-
|
|
28697
|
+
let model2 = body.model;
|
|
28698
|
+
if (agentChanged && model2 === void 0 && existing.model) {
|
|
28699
|
+
model2 = null;
|
|
28609
28700
|
}
|
|
28610
|
-
let
|
|
28611
|
-
if (agentChanged &&
|
|
28612
|
-
|
|
28701
|
+
let thinkingLevel2 = body.thinking_level;
|
|
28702
|
+
if (agentChanged && thinkingLevel2 === void 0 && existing.thinkingLevel && executionAgent && !getThinkingLevelOptions(executionAgent).includes(existing.thinkingLevel)) {
|
|
28703
|
+
thinkingLevel2 = null;
|
|
28613
28704
|
}
|
|
28614
|
-
if (
|
|
28615
|
-
if (typeof
|
|
28705
|
+
if (model2 !== void 0 && model2 !== null) {
|
|
28706
|
+
if (typeof model2 !== "string" || model2.trim().length === 0) {
|
|
28616
28707
|
return createErrorResult({ message: "model must be a non-empty string" });
|
|
28617
28708
|
}
|
|
28618
|
-
|
|
28709
|
+
model2 = normalizeClaudeModel(model2) ?? model2;
|
|
28619
28710
|
if (!executionAgent) {
|
|
28620
28711
|
return createErrorResult({ message: "Cannot set model without an agent_provider (the model would be applied against the org default agent and may not be valid for it)" });
|
|
28621
28712
|
}
|
|
28622
28713
|
const allowed = getAgentModelOptions(executionAgent, modelCatalogs);
|
|
28623
|
-
if (!isAgentModelAllowed(executionAgent,
|
|
28624
|
-
return createErrorResult({ message: `Invalid model "${
|
|
28714
|
+
if (!isAgentModelAllowed(executionAgent, model2, modelCatalogs)) {
|
|
28715
|
+
return createErrorResult({ message: `Invalid model "${model2}" for agent ${executionAgent}. Valid models: ${allowed.join(", ")}` });
|
|
28625
28716
|
}
|
|
28626
28717
|
}
|
|
28627
|
-
if (
|
|
28628
|
-
if (!executionAgent && isProviderSpecificThinkingLevel(
|
|
28629
|
-
return createErrorResult({ message: `Cannot set ${
|
|
28718
|
+
if (thinkingLevel2 !== void 0 && thinkingLevel2 !== null) {
|
|
28719
|
+
if (!executionAgent && isProviderSpecificThinkingLevel(thinkingLevel2)) {
|
|
28720
|
+
return createErrorResult({ message: `Cannot set ${thinkingLevel2} without an agent_provider` });
|
|
28630
28721
|
}
|
|
28631
|
-
if (!isValidThinkingLevel(
|
|
28722
|
+
if (!isValidThinkingLevel(thinkingLevel2) || executionAgent && !getThinkingLevelOptions(executionAgent).includes(thinkingLevel2)) {
|
|
28632
28723
|
const validLevels = executionAgent ? getThinkingLevelOptions(executionAgent) : VALID_THINKING_LEVELS;
|
|
28633
28724
|
return createErrorResult({ message: `Invalid thinking_level: must be one of ${validLevels.join(", ")}` });
|
|
28634
28725
|
}
|
|
28635
28726
|
}
|
|
28636
|
-
return createSuccessResult({ agentProvider, model, thinkingLevel });
|
|
28727
|
+
return createSuccessResult({ agentProvider, model: model2, thinkingLevel: thinkingLevel2 });
|
|
28637
28728
|
}
|
|
28638
28729
|
|
|
28639
28730
|
// ../shared/src/automations/github/index.ts
|
|
@@ -28702,68 +28793,6 @@ var MAX_REPO_FILE_CONTENT_BYTES = 256 * 1024;
|
|
|
28702
28793
|
var WEBHOOK_PROVIDERS = ["linear", "github", "gitlab", "slack", "e2b", "stripe", "sentry"];
|
|
28703
28794
|
var WEBHOOK_PROVIDER_SET = new Set(WEBHOOK_PROVIDERS);
|
|
28704
28795
|
|
|
28705
|
-
// ../shared/src/workspace-identity.ts
|
|
28706
|
-
var AWS_SOURCE_IDENTITY_CLAIM = "https://aws.amazon.com/source_identity";
|
|
28707
|
-
var WORKSPACE_TOKEN_TTL_SECONDS = 15 * 60;
|
|
28708
|
-
var IDENTITY_PROXY_PORT = 17323;
|
|
28709
|
-
var IDENTITY_TOKEN_PATH = "/token";
|
|
28710
|
-
var WORKSPACE_TOKEN_ENV = {
|
|
28711
|
-
TOKEN: "REPLICAS_WORKSPACE_TOKEN",
|
|
28712
|
-
AUDIENCE: "REPLICAS_WORKSPACE_TOKEN_AUDIENCE"
|
|
28713
|
-
};
|
|
28714
|
-
var workspaceAudienceSchema = external_exports.string().min(1).max(255).regex(/^[\x21-\x7e]+$/, "Audience must be a single printable token without spaces");
|
|
28715
|
-
var workspaceTokenRequestSchema = external_exports.object({
|
|
28716
|
-
audience: workspaceAudienceSchema.optional(),
|
|
28717
|
-
aws_source_identity: external_exports.boolean().optional()
|
|
28718
|
-
});
|
|
28719
|
-
var workspaceTokenClaimsSchema = external_exports.object({
|
|
28720
|
-
iss: external_exports.string(),
|
|
28721
|
-
sub: external_exports.string(),
|
|
28722
|
-
aud: external_exports.string(),
|
|
28723
|
-
iat: external_exports.number().int(),
|
|
28724
|
-
nbf: external_exports.number().int(),
|
|
28725
|
-
exp: external_exports.number().int(),
|
|
28726
|
-
jti: external_exports.string(),
|
|
28727
|
-
organization_id: external_exports.string().uuid(),
|
|
28728
|
-
workspace_id: external_exports.string().uuid(),
|
|
28729
|
-
environment_id: external_exports.string().uuid(),
|
|
28730
|
-
creator_id: external_exports.string().uuid().nullable(),
|
|
28731
|
-
creator_email: external_exports.string().nullable().default(null),
|
|
28732
|
-
[AWS_SOURCE_IDENTITY_CLAIM]: external_exports.string().uuid().optional()
|
|
28733
|
-
}).passthrough();
|
|
28734
|
-
var workspaceTokenResponseSchema = external_exports.object({
|
|
28735
|
-
issuer: external_exports.string(),
|
|
28736
|
-
audience: external_exports.string(),
|
|
28737
|
-
token: external_exports.string(),
|
|
28738
|
-
expires_at: external_exports.string()
|
|
28739
|
-
});
|
|
28740
|
-
var legacyWorkspaceTokenBundleSchema = external_exports.object({
|
|
28741
|
-
version: external_exports.literal(1),
|
|
28742
|
-
issuer: external_exports.string(),
|
|
28743
|
-
default_audience: external_exports.string(),
|
|
28744
|
-
tokens: external_exports.record(external_exports.string(), external_exports.object({ token: external_exports.string(), expires_at: external_exports.string() }))
|
|
28745
|
-
});
|
|
28746
|
-
var mcpWorkloadAuthSchema = external_exports.strictObject({
|
|
28747
|
-
type: external_exports.literal("workspace_identity"),
|
|
28748
|
-
audience: workspaceAudienceSchema
|
|
28749
|
-
});
|
|
28750
|
-
function identityTokenUrl() {
|
|
28751
|
-
return `http://127.0.0.1:${IDENTITY_PROXY_PORT}${IDENTITY_TOKEN_PATH}`;
|
|
28752
|
-
}
|
|
28753
|
-
|
|
28754
|
-
// ../shared/src/routes/environment.ts
|
|
28755
|
-
var ENVIRONMENT_MCP_TRANSPORTS = ["stdio", "http", "sse"];
|
|
28756
|
-
var stringMap = external_exports.record(external_exports.string(), external_exports.string());
|
|
28757
|
-
var createEnvironmentMcpRequestSchema = external_exports.object({
|
|
28758
|
-
name: external_exports.string(),
|
|
28759
|
-
transport: external_exports.enum(ENVIRONMENT_MCP_TRANSPORTS),
|
|
28760
|
-
config: external_exports.union([
|
|
28761
|
-
external_exports.object({ command: external_exports.string().min(1), args: external_exports.array(external_exports.string()).optional(), env: stringMap.optional() }),
|
|
28762
|
-
external_exports.object({ url: external_exports.url(), headers: stringMap.optional(), auth: mcpWorkloadAuthSchema.optional() })
|
|
28763
|
-
]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
|
|
28764
|
-
});
|
|
28765
|
-
var updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
|
|
28766
|
-
|
|
28767
28796
|
// ../shared/src/workspace-sidebar-state.ts
|
|
28768
28797
|
var FIRST_BOOT_GRACE_MS = 15 * 6e4;
|
|
28769
28798
|
var SLOW_ENGINE_GRACE_MS = 10 * 6e4;
|
|
@@ -28876,14 +28905,14 @@ var supabase = (0, import_supabase_js.createClient)(supabaseUrl, supabaseAnonKey
|
|
|
28876
28905
|
|
|
28877
28906
|
// src/lib/auth.ts
|
|
28878
28907
|
var AuthRefreshError = class extends Error {
|
|
28879
|
-
constructor(
|
|
28880
|
-
super(
|
|
28908
|
+
constructor(message2 = 'Failed to refresh token. Please run "replicas login" again.') {
|
|
28909
|
+
super(message2);
|
|
28881
28910
|
this.name = "AuthRefreshError";
|
|
28882
28911
|
}
|
|
28883
28912
|
};
|
|
28884
28913
|
var NotAuthenticatedError = class extends Error {
|
|
28885
|
-
constructor(
|
|
28886
|
-
super(
|
|
28914
|
+
constructor(message2 = 'Not authenticated. Please run "replicas login"') {
|
|
28915
|
+
super(message2);
|
|
28887
28916
|
this.name = "NotAuthenticatedError";
|
|
28888
28917
|
}
|
|
28889
28918
|
};
|
|
@@ -28955,8 +28984,8 @@ var MONOLITH_URL = process.env.REPLICAS_MONOLITH_URL || process.env.MONOLITH_URL
|
|
|
28955
28984
|
|
|
28956
28985
|
// src/lib/authenticated-api.ts
|
|
28957
28986
|
var ApiError = class extends Error {
|
|
28958
|
-
constructor(
|
|
28959
|
-
super(
|
|
28987
|
+
constructor(message2, status) {
|
|
28988
|
+
super(message2);
|
|
28960
28989
|
this.name = "ApiError";
|
|
28961
28990
|
this.status = status;
|
|
28962
28991
|
}
|
|
@@ -29223,9 +29252,9 @@ async function verifyAuthFlowTarget(target, assumeYes) {
|
|
|
29223
29252
|
}
|
|
29224
29253
|
return true;
|
|
29225
29254
|
}
|
|
29226
|
-
function renderAuthFlowStep(step, total,
|
|
29255
|
+
function renderAuthFlowStep(step, total, title2) {
|
|
29227
29256
|
console.log(import_chalk.default.bold(`
|
|
29228
|
-
${step}/${total} ${
|
|
29257
|
+
${step}/${total} ${title2}`));
|
|
29229
29258
|
}
|
|
29230
29259
|
function renderAuthFlowDetail(text2) {
|
|
29231
29260
|
console.log(import_chalk.default.gray(` ${text2}`));
|
|
@@ -30309,9 +30338,9 @@ async function withAuthRecovery(operation, afterReauthentication) {
|
|
|
30309
30338
|
if (isAgentMode() || !isReplicasAuthError(error51)) {
|
|
30310
30339
|
throw error51;
|
|
30311
30340
|
}
|
|
30312
|
-
const
|
|
30341
|
+
const message2 = error51 instanceof NotAuthenticatedError ? "You're not signed in to Replicas. Signing in..." : "Your Replicas session expired. Re-authenticating...";
|
|
30313
30342
|
console.log(import_chalk12.default.yellow(`
|
|
30314
|
-
${
|
|
30343
|
+
${message2}`));
|
|
30315
30344
|
await loginCommand();
|
|
30316
30345
|
await afterReauthentication?.();
|
|
30317
30346
|
console.log(import_chalk12.default.gray(" Retrying..."));
|
|
@@ -30780,40 +30809,40 @@ function truncate(text2, maxLength) {
|
|
|
30780
30809
|
if (text2.length <= maxLength) return text2;
|
|
30781
30810
|
return text2.substring(0, maxLength) + "...";
|
|
30782
30811
|
}
|
|
30783
|
-
function formatDisplayMessage(
|
|
30784
|
-
const time3 = new Date(
|
|
30785
|
-
switch (
|
|
30812
|
+
function formatDisplayMessage(message2) {
|
|
30813
|
+
const time3 = new Date(message2.timestamp).toLocaleTimeString();
|
|
30814
|
+
switch (message2.type) {
|
|
30786
30815
|
case "user":
|
|
30787
30816
|
console.log(import_chalk16.default.blue(`
|
|
30788
30817
|
[${time3}] USER:`));
|
|
30789
|
-
console.log(import_chalk16.default.white(` ${truncate(
|
|
30818
|
+
console.log(import_chalk16.default.white(` ${truncate(message2.content, 500)}`));
|
|
30790
30819
|
break;
|
|
30791
30820
|
case "agent":
|
|
30792
30821
|
console.log(import_chalk16.default.green(`
|
|
30793
30822
|
[${time3}] ASSISTANT:`));
|
|
30794
|
-
console.log(import_chalk16.default.white(` ${truncate(
|
|
30823
|
+
console.log(import_chalk16.default.white(` ${truncate(message2.content, 500)}`));
|
|
30795
30824
|
break;
|
|
30796
30825
|
case "reasoning":
|
|
30797
30826
|
console.log(import_chalk16.default.gray(`
|
|
30798
30827
|
[${time3}] THINKING:`));
|
|
30799
|
-
console.log(import_chalk16.default.gray(` ${truncate(
|
|
30828
|
+
console.log(import_chalk16.default.gray(` ${truncate(message2.content, 300)}`));
|
|
30800
30829
|
break;
|
|
30801
30830
|
case "command":
|
|
30802
30831
|
console.log(import_chalk16.default.magenta(`
|
|
30803
30832
|
[${time3}] COMMAND:`));
|
|
30804
|
-
console.log(import_chalk16.default.white(` $ ${
|
|
30805
|
-
if (
|
|
30806
|
-
console.log(import_chalk16.default.gray(` ${truncate(
|
|
30833
|
+
console.log(import_chalk16.default.white(` $ ${message2.command}`));
|
|
30834
|
+
if (message2.output) {
|
|
30835
|
+
console.log(import_chalk16.default.gray(` ${truncate(message2.output, 200)}`));
|
|
30807
30836
|
}
|
|
30808
|
-
if (
|
|
30809
|
-
const exitColor =
|
|
30810
|
-
console.log(exitColor(` Exit code: ${
|
|
30837
|
+
if (message2.exitCode !== void 0) {
|
|
30838
|
+
const exitColor = message2.exitCode === 0 ? import_chalk16.default.green : import_chalk16.default.red;
|
|
30839
|
+
console.log(exitColor(` Exit code: ${message2.exitCode}`));
|
|
30811
30840
|
}
|
|
30812
30841
|
break;
|
|
30813
30842
|
case "file_change":
|
|
30814
30843
|
console.log(import_chalk16.default.yellow(`
|
|
30815
30844
|
[${time3}] FILE CHANGES:`));
|
|
30816
|
-
for (const change of
|
|
30845
|
+
for (const change of message2.changes) {
|
|
30817
30846
|
const icon = change.kind === "add" ? "+" : change.kind === "delete" ? "-" : "~";
|
|
30818
30847
|
const color = change.kind === "add" ? import_chalk16.default.green : change.kind === "delete" ? import_chalk16.default.red : import_chalk16.default.yellow;
|
|
30819
30848
|
console.log(color(` ${icon} ${change.path}`));
|
|
@@ -30822,7 +30851,7 @@ function formatDisplayMessage(message) {
|
|
|
30822
30851
|
case "patch":
|
|
30823
30852
|
console.log(import_chalk16.default.yellow(`
|
|
30824
30853
|
[${time3}] PATCH:`));
|
|
30825
|
-
for (const op of
|
|
30854
|
+
for (const op of message2.operations) {
|
|
30826
30855
|
const icon = op.action === "add" ? "+" : op.action === "delete" ? "-" : "~";
|
|
30827
30856
|
const color = op.action === "add" ? import_chalk16.default.green : op.action === "delete" ? import_chalk16.default.red : import_chalk16.default.yellow;
|
|
30828
30857
|
console.log(color(` ${icon} ${op.path}`));
|
|
@@ -30830,35 +30859,35 @@ function formatDisplayMessage(message) {
|
|
|
30830
30859
|
break;
|
|
30831
30860
|
case "tool_call":
|
|
30832
30861
|
console.log(import_chalk16.default.cyan(`
|
|
30833
|
-
[${time3}] TOOL: ${
|
|
30834
|
-
if (
|
|
30835
|
-
console.log(import_chalk16.default.gray(` ${truncate(
|
|
30862
|
+
[${time3}] TOOL: ${message2.tool}`));
|
|
30863
|
+
if (message2.output) {
|
|
30864
|
+
console.log(import_chalk16.default.gray(` ${truncate(message2.output, 200)}`));
|
|
30836
30865
|
}
|
|
30837
30866
|
break;
|
|
30838
30867
|
case "web_search":
|
|
30839
30868
|
console.log(import_chalk16.default.cyan(`
|
|
30840
30869
|
[${time3}] WEB SEARCH:`));
|
|
30841
|
-
console.log(import_chalk16.default.white(` "${
|
|
30870
|
+
console.log(import_chalk16.default.white(` "${message2.query}"`));
|
|
30842
30871
|
break;
|
|
30843
30872
|
case "todo_list":
|
|
30844
30873
|
console.log(import_chalk16.default.blue(`
|
|
30845
30874
|
[${time3}] PLAN:`));
|
|
30846
|
-
for (const item of
|
|
30875
|
+
for (const item of message2.items) {
|
|
30847
30876
|
const icon = item.completed ? import_chalk16.default.green("[x]") : import_chalk16.default.gray("[ ]");
|
|
30848
30877
|
console.log(` ${icon} ${item.text}`);
|
|
30849
30878
|
}
|
|
30850
30879
|
break;
|
|
30851
30880
|
case "subagent":
|
|
30852
30881
|
console.log(import_chalk16.default.magenta(`
|
|
30853
|
-
[${time3}] SUBAGENT: ${
|
|
30854
|
-
if (
|
|
30855
|
-
console.log(import_chalk16.default.gray(` ${truncate(
|
|
30882
|
+
[${time3}] SUBAGENT: ${message2.description}`));
|
|
30883
|
+
if (message2.output) {
|
|
30884
|
+
console.log(import_chalk16.default.gray(` ${truncate(message2.output, 200)}`));
|
|
30856
30885
|
}
|
|
30857
30886
|
break;
|
|
30858
30887
|
case "error":
|
|
30859
30888
|
console.log(import_chalk16.default.red(`
|
|
30860
30889
|
[${time3}] ERROR:`));
|
|
30861
|
-
console.log(import_chalk16.default.red(` ${
|
|
30890
|
+
console.log(import_chalk16.default.red(` ${message2.message}`));
|
|
30862
30891
|
break;
|
|
30863
30892
|
}
|
|
30864
30893
|
}
|
|
@@ -30955,7 +30984,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
30955
30984
|
process.exit(1);
|
|
30956
30985
|
}
|
|
30957
30986
|
let replicaName = name;
|
|
30958
|
-
let
|
|
30987
|
+
let message2 = options.message;
|
|
30959
30988
|
let selectedEnvironmentId = options.environment?.trim();
|
|
30960
30989
|
let codingAgent = parseReplicaAgent(options.agent);
|
|
30961
30990
|
if (replicaName && /\s/.test(replicaName)) {
|
|
@@ -30996,7 +31025,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
30996
31025
|
}
|
|
30997
31026
|
selectedEnvironmentId = response2.environment;
|
|
30998
31027
|
}
|
|
30999
|
-
if (!
|
|
31028
|
+
if (!message2) {
|
|
31000
31029
|
const response2 = await (0, import_prompts7.default)({
|
|
31001
31030
|
type: "text",
|
|
31002
31031
|
name: "message",
|
|
@@ -31007,7 +31036,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
31007
31036
|
console.log(import_chalk16.default.yellow("\nCancelled."));
|
|
31008
31037
|
return;
|
|
31009
31038
|
}
|
|
31010
|
-
|
|
31039
|
+
message2 = response2.message;
|
|
31011
31040
|
}
|
|
31012
31041
|
if (!codingAgent) {
|
|
31013
31042
|
const response2 = await (0, import_prompts7.default)({
|
|
@@ -31025,7 +31054,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
31025
31054
|
}
|
|
31026
31055
|
const body = {
|
|
31027
31056
|
name: replicaName,
|
|
31028
|
-
message,
|
|
31057
|
+
message: message2,
|
|
31029
31058
|
environment_id: selectedEnvironmentId,
|
|
31030
31059
|
coding_agent: codingAgent
|
|
31031
31060
|
};
|
|
@@ -31054,8 +31083,8 @@ async function replicaSendCommand(id, options) {
|
|
|
31054
31083
|
process.exit(1);
|
|
31055
31084
|
}
|
|
31056
31085
|
try {
|
|
31057
|
-
let
|
|
31058
|
-
if (!
|
|
31086
|
+
let message2 = options.message;
|
|
31087
|
+
if (!message2) {
|
|
31059
31088
|
const response2 = await (0, import_prompts7.default)({
|
|
31060
31089
|
type: "text",
|
|
31061
31090
|
name: "message",
|
|
@@ -31066,10 +31095,10 @@ async function replicaSendCommand(id, options) {
|
|
|
31066
31095
|
console.log(import_chalk16.default.yellow("\nCancelled."));
|
|
31067
31096
|
return;
|
|
31068
31097
|
}
|
|
31069
|
-
|
|
31098
|
+
message2 = response2.message;
|
|
31070
31099
|
}
|
|
31071
31100
|
const body = {
|
|
31072
|
-
message
|
|
31101
|
+
message: message2
|
|
31073
31102
|
};
|
|
31074
31103
|
if (options.agent) {
|
|
31075
31104
|
body.coding_agent = parseReplicaAgent(options.agent);
|
|
@@ -31157,8 +31186,8 @@ Conversation History
|
|
|
31157
31186
|
console.log(import_chalk16.default.gray("-".repeat(60)));
|
|
31158
31187
|
const agentType = response.coding_agent || "claude";
|
|
31159
31188
|
const displayMessages = parseDisplayMessages(response.events, agentType);
|
|
31160
|
-
for (const
|
|
31161
|
-
formatDisplayMessage(
|
|
31189
|
+
for (const message2 of displayMessages) {
|
|
31190
|
+
formatDisplayMessage(message2);
|
|
31162
31191
|
}
|
|
31163
31192
|
console.log(import_chalk16.default.gray("\n" + "-".repeat(60)));
|
|
31164
31193
|
console.log();
|
|
@@ -31522,15 +31551,15 @@ function formatTrigger(trigger) {
|
|
|
31522
31551
|
}
|
|
31523
31552
|
return `${trigger.type}`;
|
|
31524
31553
|
}
|
|
31525
|
-
function resolveTriggerRepositoryIds(repositories, repoNamesInput,
|
|
31554
|
+
function resolveTriggerRepositoryIds(repositories, repoNamesInput, provider2) {
|
|
31526
31555
|
if (!repoNamesInput) return void 0;
|
|
31527
31556
|
const repoIds = [];
|
|
31528
|
-
const providerRepos = repositories.filter((repo) => !repo.provider || repo.provider ===
|
|
31557
|
+
const providerRepos = repositories.filter((repo) => !repo.provider || repo.provider === provider2);
|
|
31529
31558
|
const repoNames = repoNamesInput.split(",").map((r) => r.trim()).filter(Boolean);
|
|
31530
31559
|
for (const repoName of repoNames) {
|
|
31531
31560
|
const repo = providerRepos.find((r) => r.name === repoName);
|
|
31532
31561
|
if (!repo) {
|
|
31533
|
-
console.log(import_chalk20.default.red(`Repository not found for ${
|
|
31562
|
+
console.log(import_chalk20.default.red(`Repository not found for ${provider2} trigger filter: ${repoName}`));
|
|
31534
31563
|
console.log(import_chalk20.default.gray(`Available: ${providerRepos.map((r) => r.name).join(", ")}`));
|
|
31535
31564
|
process.exit(1);
|
|
31536
31565
|
}
|