replicas-cli 0.2.503 → 0.2.505
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.mjs +113 -66
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7743,6 +7743,71 @@ function getCodingAgentDisplayNames() {
|
|
|
7743
7743
|
return VALID_CODING_AGENT_PROVIDERS.map((provider) => getProviderDisplayName(provider)).join(", ");
|
|
7744
7744
|
}
|
|
7745
7745
|
|
|
7746
|
+
// ../shared/src/credentials/types.ts
|
|
7747
|
+
var CREDENTIAL_SCOPE = {
|
|
7748
|
+
USER: "user",
|
|
7749
|
+
ORG: "org"
|
|
7750
|
+
};
|
|
7751
|
+
var CREDENTIAL_SCOPES = Object.values(CREDENTIAL_SCOPE);
|
|
7752
|
+
var CREDENTIAL_SCOPE_PRIORITY = [CREDENTIAL_SCOPE.USER, CREDENTIAL_SCOPE.ORG];
|
|
7753
|
+
|
|
7754
|
+
// ../shared/src/credentials/agents.ts
|
|
7755
|
+
var CREDENTIAL_METHOD = {
|
|
7756
|
+
OAUTH: "oauth",
|
|
7757
|
+
API_KEY: "api_key",
|
|
7758
|
+
FOUNDRY: "foundry",
|
|
7759
|
+
BEDROCK: "bedrock",
|
|
7760
|
+
OPENCODE_GO: "opencode-go",
|
|
7761
|
+
ASTER: "aster",
|
|
7762
|
+
OPENROUTER: "openrouter"
|
|
7763
|
+
};
|
|
7764
|
+
var CREDENTIAL_TYPE = {
|
|
7765
|
+
CLAUDE_OAUTH: "claude",
|
|
7766
|
+
ANTHROPIC_API_KEY: "claude_anthropic_api_key",
|
|
7767
|
+
CLAUDE_FOUNDRY: "claude_foundry",
|
|
7768
|
+
CLAUDE_BEDROCK: "claude_bedrock",
|
|
7769
|
+
CODEX_OAUTH: "codex",
|
|
7770
|
+
OPENAI_API_KEY: "openai_api_key",
|
|
7771
|
+
CODEX_FOUNDRY: "codex_foundry",
|
|
7772
|
+
CURSOR_API_KEY: "cursor_api_key",
|
|
7773
|
+
OPENCODE_GO_API_KEY: "opencode_go_api_key",
|
|
7774
|
+
ASTER_API_KEY: "aster_api_key",
|
|
7775
|
+
OPENROUTER_API_KEY: "openrouter_api_key"
|
|
7776
|
+
};
|
|
7777
|
+
var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
|
|
7778
|
+
[AGENT.CLAUDE]: [
|
|
7779
|
+
{ method: CREDENTIAL_METHOD.OAUTH, credentialType: CREDENTIAL_TYPE.CLAUDE_OAUTH },
|
|
7780
|
+
{ method: CREDENTIAL_METHOD.API_KEY, credentialType: CREDENTIAL_TYPE.ANTHROPIC_API_KEY },
|
|
7781
|
+
{ method: CREDENTIAL_METHOD.FOUNDRY, credentialType: CREDENTIAL_TYPE.CLAUDE_FOUNDRY },
|
|
7782
|
+
{ method: CREDENTIAL_METHOD.BEDROCK, credentialType: CREDENTIAL_TYPE.CLAUDE_BEDROCK }
|
|
7783
|
+
],
|
|
7784
|
+
[AGENT.CODEX]: [
|
|
7785
|
+
{ method: CREDENTIAL_METHOD.OAUTH, credentialType: CREDENTIAL_TYPE.CODEX_OAUTH },
|
|
7786
|
+
{ method: CREDENTIAL_METHOD.API_KEY, credentialType: CREDENTIAL_TYPE.OPENAI_API_KEY },
|
|
7787
|
+
{ method: CREDENTIAL_METHOD.FOUNDRY, credentialType: CREDENTIAL_TYPE.CODEX_FOUNDRY }
|
|
7788
|
+
],
|
|
7789
|
+
[AGENT.CURSOR]: [
|
|
7790
|
+
{ method: CREDENTIAL_METHOD.API_KEY, credentialType: CREDENTIAL_TYPE.CURSOR_API_KEY }
|
|
7791
|
+
],
|
|
7792
|
+
[AGENT.OPENCODE]: [
|
|
7793
|
+
{ method: CREDENTIAL_METHOD.OPENCODE_GO, credentialType: CREDENTIAL_TYPE.OPENCODE_GO_API_KEY },
|
|
7794
|
+
{ method: CREDENTIAL_METHOD.ASTER, credentialType: CREDENTIAL_TYPE.ASTER_API_KEY },
|
|
7795
|
+
{ method: CREDENTIAL_METHOD.OPENROUTER, credentialType: CREDENTIAL_TYPE.OPENROUTER_API_KEY }
|
|
7796
|
+
],
|
|
7797
|
+
[AGENT.PI]: [
|
|
7798
|
+
{ method: CREDENTIAL_METHOD.ASTER, credentialType: CREDENTIAL_TYPE.ASTER_API_KEY },
|
|
7799
|
+
{ method: CREDENTIAL_METHOD.OPENROUTER, credentialType: CREDENTIAL_TYPE.OPENROUTER_API_KEY }
|
|
7800
|
+
]
|
|
7801
|
+
};
|
|
7802
|
+
|
|
7803
|
+
// ../shared/src/analytics/types.ts
|
|
7804
|
+
function isAuthMethod(value) {
|
|
7805
|
+
return typeof value === "string" && Object.values(CREDENTIAL_METHOD).some((method) => method === value);
|
|
7806
|
+
}
|
|
7807
|
+
function isCredentialScope(value) {
|
|
7808
|
+
return typeof value === "string" && CREDENTIAL_SCOPES.some((scope) => scope === value);
|
|
7809
|
+
}
|
|
7810
|
+
|
|
7746
7811
|
// ../shared/src/event.ts
|
|
7747
7812
|
var CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE = "claude-partial-message";
|
|
7748
7813
|
function coerceClaudePartialMessagePayload(payload) {
|
|
@@ -7771,6 +7836,23 @@ var CODEX_ASP_TRANSCRIPT_UPDATED_EVENT_TYPE = "codex-asp-transcript-updated";
|
|
|
7771
7836
|
var CODEX_QUOTA_STATUS_EVENT_TYPE = "codex-quota-status";
|
|
7772
7837
|
var CHAT_INTERRUPTED_EVENT_TYPE = "replicas-interrupted";
|
|
7773
7838
|
var CHAT_GOAL_EVENT_TYPE = "chat-goal";
|
|
7839
|
+
var AUTH_FALLBACK_EVENT_TYPE = "auth-fallback";
|
|
7840
|
+
function coerceAuthFallbackPayload(payload) {
|
|
7841
|
+
const { provider, reason, exhaustedMethod, exhaustedScope, candidateMethod, candidateScope, status, detail } = payload;
|
|
7842
|
+
if (typeof provider !== "string" || !isValidCodingAgentProvider(provider) || reason !== "rate_limit" && reason !== "out_of_credits" || !isAuthMethod(exhaustedMethod) || !isAuthMethod(candidateMethod) || !isCredentialScope(candidateScope) || status !== "switched" && status !== "failed") {
|
|
7843
|
+
return null;
|
|
7844
|
+
}
|
|
7845
|
+
return {
|
|
7846
|
+
provider,
|
|
7847
|
+
reason,
|
|
7848
|
+
exhaustedMethod,
|
|
7849
|
+
...isCredentialScope(exhaustedScope) ? { exhaustedScope } : {},
|
|
7850
|
+
candidateMethod,
|
|
7851
|
+
candidateScope,
|
|
7852
|
+
status,
|
|
7853
|
+
...typeof detail === "string" && detail ? { detail } : {}
|
|
7854
|
+
};
|
|
7855
|
+
}
|
|
7774
7856
|
var CHAT_GOAL_STATUSES = [
|
|
7775
7857
|
"active",
|
|
7776
7858
|
"paused",
|
|
@@ -7810,63 +7892,6 @@ function coerceChatGoalPayload(payload) {
|
|
|
7810
7892
|
};
|
|
7811
7893
|
}
|
|
7812
7894
|
|
|
7813
|
-
// ../shared/src/credentials/types.ts
|
|
7814
|
-
var CREDENTIAL_SCOPE = {
|
|
7815
|
-
USER: "user",
|
|
7816
|
-
ORG: "org"
|
|
7817
|
-
};
|
|
7818
|
-
var CREDENTIAL_SCOPES = Object.values(CREDENTIAL_SCOPE);
|
|
7819
|
-
var CREDENTIAL_SCOPE_PRIORITY = [CREDENTIAL_SCOPE.USER, CREDENTIAL_SCOPE.ORG];
|
|
7820
|
-
|
|
7821
|
-
// ../shared/src/credentials/agents.ts
|
|
7822
|
-
var CREDENTIAL_METHOD = {
|
|
7823
|
-
OAUTH: "oauth",
|
|
7824
|
-
API_KEY: "api_key",
|
|
7825
|
-
FOUNDRY: "foundry",
|
|
7826
|
-
BEDROCK: "bedrock",
|
|
7827
|
-
OPENCODE_GO: "opencode-go",
|
|
7828
|
-
ASTER: "aster",
|
|
7829
|
-
OPENROUTER: "openrouter"
|
|
7830
|
-
};
|
|
7831
|
-
var CREDENTIAL_TYPE = {
|
|
7832
|
-
CLAUDE_OAUTH: "claude",
|
|
7833
|
-
ANTHROPIC_API_KEY: "claude_anthropic_api_key",
|
|
7834
|
-
CLAUDE_FOUNDRY: "claude_foundry",
|
|
7835
|
-
CLAUDE_BEDROCK: "claude_bedrock",
|
|
7836
|
-
CODEX_OAUTH: "codex",
|
|
7837
|
-
OPENAI_API_KEY: "openai_api_key",
|
|
7838
|
-
CODEX_FOUNDRY: "codex_foundry",
|
|
7839
|
-
CURSOR_API_KEY: "cursor_api_key",
|
|
7840
|
-
OPENCODE_GO_API_KEY: "opencode_go_api_key",
|
|
7841
|
-
ASTER_API_KEY: "aster_api_key",
|
|
7842
|
-
OPENROUTER_API_KEY: "openrouter_api_key"
|
|
7843
|
-
};
|
|
7844
|
-
var AGENT_CREDENTIAL_METHODS_IN_ORDER = {
|
|
7845
|
-
[AGENT.CLAUDE]: [
|
|
7846
|
-
{ method: CREDENTIAL_METHOD.OAUTH, credentialType: CREDENTIAL_TYPE.CLAUDE_OAUTH },
|
|
7847
|
-
{ method: CREDENTIAL_METHOD.API_KEY, credentialType: CREDENTIAL_TYPE.ANTHROPIC_API_KEY },
|
|
7848
|
-
{ method: CREDENTIAL_METHOD.FOUNDRY, credentialType: CREDENTIAL_TYPE.CLAUDE_FOUNDRY },
|
|
7849
|
-
{ method: CREDENTIAL_METHOD.BEDROCK, credentialType: CREDENTIAL_TYPE.CLAUDE_BEDROCK }
|
|
7850
|
-
],
|
|
7851
|
-
[AGENT.CODEX]: [
|
|
7852
|
-
{ method: CREDENTIAL_METHOD.OAUTH, credentialType: CREDENTIAL_TYPE.CODEX_OAUTH },
|
|
7853
|
-
{ method: CREDENTIAL_METHOD.API_KEY, credentialType: CREDENTIAL_TYPE.OPENAI_API_KEY },
|
|
7854
|
-
{ method: CREDENTIAL_METHOD.FOUNDRY, credentialType: CREDENTIAL_TYPE.CODEX_FOUNDRY }
|
|
7855
|
-
],
|
|
7856
|
-
[AGENT.CURSOR]: [
|
|
7857
|
-
{ method: CREDENTIAL_METHOD.API_KEY, credentialType: CREDENTIAL_TYPE.CURSOR_API_KEY }
|
|
7858
|
-
],
|
|
7859
|
-
[AGENT.OPENCODE]: [
|
|
7860
|
-
{ method: CREDENTIAL_METHOD.OPENCODE_GO, credentialType: CREDENTIAL_TYPE.OPENCODE_GO_API_KEY },
|
|
7861
|
-
{ method: CREDENTIAL_METHOD.ASTER, credentialType: CREDENTIAL_TYPE.ASTER_API_KEY },
|
|
7862
|
-
{ method: CREDENTIAL_METHOD.OPENROUTER, credentialType: CREDENTIAL_TYPE.OPENROUTER_API_KEY }
|
|
7863
|
-
],
|
|
7864
|
-
[AGENT.PI]: [
|
|
7865
|
-
{ method: CREDENTIAL_METHOD.ASTER, credentialType: CREDENTIAL_TYPE.ASTER_API_KEY },
|
|
7866
|
-
{ method: CREDENTIAL_METHOD.OPENROUTER, credentialType: CREDENTIAL_TYPE.OPENROUTER_API_KEY }
|
|
7867
|
-
]
|
|
7868
|
-
};
|
|
7869
|
-
|
|
7870
7895
|
// ../shared/src/aster.ts
|
|
7871
7896
|
var ASTER_MODELS = [
|
|
7872
7897
|
"kimi-k3",
|
|
@@ -9698,7 +9723,8 @@ var DEFAULT_USER_PREFERENCES = {
|
|
|
9698
9723
|
auto_draft_prs: false,
|
|
9699
9724
|
open_prs_in_graphite: false,
|
|
9700
9725
|
default_fast_mode: false,
|
|
9701
|
-
agent_defaults: { ...EMPTY_AGENT_DEFAULT_SETTINGS }
|
|
9726
|
+
agent_defaults: { ...EMPTY_AGENT_DEFAULT_SETTINGS },
|
|
9727
|
+
credential_priority: null
|
|
9702
9728
|
};
|
|
9703
9729
|
function defaultReplicasAgentAbilities() {
|
|
9704
9730
|
const abilities = {};
|
|
@@ -9763,7 +9789,7 @@ function formatTurnElapsed(ms) {
|
|
|
9763
9789
|
}
|
|
9764
9790
|
|
|
9765
9791
|
// ../shared/src/cli-version.ts
|
|
9766
|
-
var CLI_VERSION = "0.2.
|
|
9792
|
+
var CLI_VERSION = "0.2.505";
|
|
9767
9793
|
|
|
9768
9794
|
// ../shared/src/version.ts
|
|
9769
9795
|
function compareVersions(v1, v2) {
|
|
@@ -26513,21 +26539,24 @@ function parseDisplayMessages(events, agentType, codexAspTranscript, options = {
|
|
|
26513
26539
|
const shouldFilter = options.filter ?? true;
|
|
26514
26540
|
const parsedEvents = agentType === "claude" || agentType === "relay" ? parseClaudeEvents(events, options.parentToolUseId) : parseAgentEvents(events, agentType);
|
|
26515
26541
|
const legacyMessages = shouldFilter ? filterDisplayMessages(parsedEvents, agentType) : parsedEvents;
|
|
26542
|
+
const finalize2 = (messages) => shouldFilter ? applyAuthFallbackNotices(applyInterruptions(messages, events), events) : messages;
|
|
26516
26543
|
if (agentType !== "codex" || !codexAspTranscript) {
|
|
26517
|
-
return
|
|
26544
|
+
return finalize2(legacyMessages);
|
|
26518
26545
|
}
|
|
26519
26546
|
const nativeCodexMessages = shouldFilter ? filterDisplayMessages(parseCodexAspTranscript(codexAspTranscript), agentType) : parseCodexAspTranscript(codexAspTranscript);
|
|
26520
|
-
|
|
26521
|
-
|
|
26547
|
+
return finalize2(mergeCodexAspDisplayMessages(nativeCodexMessages, legacyMessages));
|
|
26548
|
+
}
|
|
26549
|
+
function insertByTimestamp(messages, message) {
|
|
26550
|
+
const messageMs = parseTimestampMs(message.timestamp);
|
|
26551
|
+
let index = messages.length;
|
|
26552
|
+
while (index > 0 && parseTimestampMs(messages[index - 1].timestamp) > messageMs) index--;
|
|
26553
|
+
messages.splice(index, 0, message);
|
|
26522
26554
|
}
|
|
26523
26555
|
function applyInterruptions(messages, events) {
|
|
26524
26556
|
const result = [...messages];
|
|
26525
26557
|
for (const event of events) {
|
|
26526
26558
|
if (event.type !== CHAT_INTERRUPTED_EVENT_TYPE) continue;
|
|
26527
|
-
|
|
26528
|
-
let index = result.length;
|
|
26529
|
-
while (index > 0 && parseTimestampMs(result[index - 1].timestamp) > eventMs) index--;
|
|
26530
|
-
result.splice(index, 0, {
|
|
26559
|
+
insertByTimestamp(result, {
|
|
26531
26560
|
id: `interruption-${event.timestamp}`,
|
|
26532
26561
|
type: "interruption",
|
|
26533
26562
|
timestamp: event.timestamp
|
|
@@ -26559,6 +26588,24 @@ function applyInterruptions(messages, events) {
|
|
|
26559
26588
|
}
|
|
26560
26589
|
return finalized;
|
|
26561
26590
|
}
|
|
26591
|
+
function applyAuthFallbackNotices(messages, events) {
|
|
26592
|
+
const notices = [];
|
|
26593
|
+
events.forEach((event, index) => {
|
|
26594
|
+
if (event.type !== AUTH_FALLBACK_EVENT_TYPE) return;
|
|
26595
|
+
const payload = coerceAuthFallbackPayload(event.payload);
|
|
26596
|
+
if (!payload) return;
|
|
26597
|
+
notices.push({
|
|
26598
|
+
...payload,
|
|
26599
|
+
id: `auth-fallback-${event.timestamp}-${index}`,
|
|
26600
|
+
type: "auth_fallback",
|
|
26601
|
+
timestamp: event.timestamp
|
|
26602
|
+
});
|
|
26603
|
+
});
|
|
26604
|
+
if (notices.length === 0) return messages;
|
|
26605
|
+
const result = [...messages];
|
|
26606
|
+
for (const notice of notices) insertByTimestamp(result, notice);
|
|
26607
|
+
return result;
|
|
26608
|
+
}
|
|
26562
26609
|
function isCodexInitializationPrompt(message) {
|
|
26563
26610
|
return message.type === "user" && removeReplicasInstructions(message.content).trim() === "Hello";
|
|
26564
26611
|
}
|