@bitkyc08/opencodex 2.26.0 → 2.27.0
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/gui/dist/assets/{index-RL6b1bTV.js → index-7jlKgmJd.js} +14 -14
- package/gui/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/adapters/anthropic.ts +1 -1
- package/src/adapters/base.ts +14 -2
- package/src/adapters/command-code.ts +4 -3
- package/src/adapters/cursor/cursor-errors.ts +15 -0
- package/src/adapters/cursor/live-transport.ts +14 -1
- package/src/adapters/google.ts +1 -1
- package/src/adapters/openai-chat.ts +38 -6
- package/src/adapters/tool-catalog-nudge.ts +1 -1
- package/src/bridge.ts +11 -5
- package/src/cli/doctor.ts +76 -0
- package/src/cli/help.ts +2 -0
- package/src/cli/models.ts +13 -6
- package/src/codex/app-server-processes.ts +269 -37
- package/src/codex/auth-context.ts +53 -1
- package/src/codex/catalog/aggregation.ts +3 -0
- package/src/codex/catalog/parsing.ts +20 -3
- package/src/codex/catalog/provider-fetch.ts +8 -0
- package/src/codex/catalog/sync.ts +6 -4
- package/src/codex/log-guard/path-safety.ts +52 -3
- package/src/codex/native-profile-startup.ts +100 -2
- package/src/codex/user-identity.ts +21 -1
- package/src/config/provider-name.ts +24 -0
- package/src/config.ts +11 -24
- package/src/generated/compatibility-version.json +73 -45
- package/src/images/loop.ts +11 -4
- package/src/lib/state-store-registrations.ts +8 -2
- package/src/providers/antigravity-models.ts +70 -5
- package/src/providers/derive.ts +12 -2
- package/src/providers/registry.ts +46 -1
- package/src/providers/service-tier.ts +34 -7
- package/src/responses/parser.ts +56 -2
- package/src/responses/state.ts +162 -5
- package/src/router.ts +10 -3
- package/src/routing/compatibility/behavior.ts +3 -3
- package/src/routing/profile.ts +1 -1
- package/src/server/index.ts +5 -0
- package/src/server/management/shared.ts +3 -1
- package/src/server/responses/collaboration.ts +34 -9
- package/src/server/responses/core.ts +13 -4
- package/src/server/responses/input-admission.ts +7 -2
- package/src/service-manager-probe.ts +99 -0
- package/src/service.ts +86 -6
- package/src/tray/windows.ts +25 -5
- package/src/types/accounts.ts +37 -0
- package/src/types/config.ts +818 -0
- package/src/types/provider.ts +521 -0
- package/src/types/request.ts +358 -0
- package/src/types/tools.ts +131 -0
- package/src/types/wire.ts +80 -0
- package/src/types.ts +103 -1883
- package/src/usage/cost.ts +37 -1
- package/src/web-search/loop.ts +11 -4
package/src/usage/cost.ts
CHANGED
|
@@ -83,6 +83,8 @@ export interface AttemptCostEstimate {
|
|
|
83
83
|
estimated: boolean;
|
|
84
84
|
/** Applied OpenAI priority-tier multiplier (undefined or 1 = standard). */
|
|
85
85
|
priorityMultiplier?: number;
|
|
86
|
+
/** Standard-price estimate is a known floor for a confirmed, unpriced priority endpoint. */
|
|
87
|
+
priorityLowerBound?: boolean;
|
|
86
88
|
/** Set when the published long-context rate was applied (#908). */
|
|
87
89
|
contextTier?: ContextTierName;
|
|
88
90
|
}
|
|
@@ -95,6 +97,8 @@ export interface CostEstimate {
|
|
|
95
97
|
price?: MatchedPrice;
|
|
96
98
|
/** Applied OpenAI priority-tier multiplier (undefined or 1 = standard). */
|
|
97
99
|
priorityMultiplier?: number;
|
|
100
|
+
/** Standard-price estimate is a known floor for a confirmed, unpriced priority endpoint. */
|
|
101
|
+
priorityLowerBound?: boolean;
|
|
98
102
|
/** Set when any priced attempt used the published long-context rate (#908). */
|
|
99
103
|
contextTier?: ContextTierName;
|
|
100
104
|
}
|
|
@@ -350,7 +354,9 @@ export type ServiceTierInput = string | ServiceTierContext;
|
|
|
350
354
|
* and long-context exclusivity depends on that distinction.
|
|
351
355
|
*/
|
|
352
356
|
export function serviceTierContext(entry: ServiceTierContext): ServiceTierContext {
|
|
353
|
-
if (entry.tierOutcome)
|
|
357
|
+
if (entry.tierOutcome) {
|
|
358
|
+
return { ...serviceTierContextFromOutcome(entry.tierOutcome), tierOutcome: entry.tierOutcome };
|
|
359
|
+
}
|
|
354
360
|
return {
|
|
355
361
|
responseServiceTier: entry.responseServiceTier,
|
|
356
362
|
requestedServiceTier: entry.requestedServiceTier,
|
|
@@ -448,6 +454,28 @@ function applyPriorityMultiplier(
|
|
|
448
454
|
}, multiplier];
|
|
449
455
|
}
|
|
450
456
|
|
|
457
|
+
/**
|
|
458
|
+
* OpenRouter confirms the actual endpoint tier and documents priority as higher cost, but this
|
|
459
|
+
* branch does not bundle its provider-specific priority endpoint prices. A confirmed canonical
|
|
460
|
+
* priority result can therefore use the standard price only as a provable lower bound. Do not
|
|
461
|
+
* extend this to flex (cheaper) or to other providers without the same pricing contract.
|
|
462
|
+
*
|
|
463
|
+
* An ASSUMED priority attempt needs the same marker for a different reason. There the provider
|
|
464
|
+
* never echoed a tier at all, so the standard price is not merely a lower bound on a known
|
|
465
|
+
* premium — it is a floor under an outcome we did not observe. Returning it unmarked reports a
|
|
466
|
+
* definite standard cost for a request that may well have been billed as priority, which is the
|
|
467
|
+
* one thing a cost estimate must never do.
|
|
468
|
+
*/
|
|
469
|
+
function isOpenRouterPriorityLowerBound(
|
|
470
|
+
provider: string,
|
|
471
|
+
outcome: AttemptTierOutcome | undefined,
|
|
472
|
+
): boolean {
|
|
473
|
+
return baseProviderLabel(provider) === "openrouter"
|
|
474
|
+
&& outcome?.canonical === "priority"
|
|
475
|
+
&& outcome.fastOutcome === "applied"
|
|
476
|
+
&& (outcome.confirmation === "confirmed" || outcome.confirmation === "assumed");
|
|
477
|
+
}
|
|
478
|
+
|
|
451
479
|
/**
|
|
452
480
|
* Per-attempt cost estimate: tokens normalized, price resolved (user overlay →
|
|
453
481
|
* catalogs), priority/long-context tiers applied. Null when usage or price is
|
|
@@ -476,6 +504,7 @@ export function estimateAttemptCost(
|
|
|
476
504
|
const [effectiveCost4, multiplier] = contextTier
|
|
477
505
|
? [tieredCost4, 1] as const
|
|
478
506
|
: applyPriorityMultiplier(tieredCost4, attempt.provider, attempt.model, attemptServiceTier);
|
|
507
|
+
const priorityLowerBound = isOpenRouterPriorityLowerBound(attempt.provider, attempt.tierOutcome);
|
|
479
508
|
return {
|
|
480
509
|
ordinal: attempt.ordinal,
|
|
481
510
|
provider: attempt.provider,
|
|
@@ -485,6 +514,7 @@ export function estimateAttemptCost(
|
|
|
485
514
|
cost: calculateCost(tokens, effectiveCost4),
|
|
486
515
|
estimated: isEstimated(attempt.usage, attempt.usageStatus, price.status),
|
|
487
516
|
...(multiplier !== 1 ? { priorityMultiplier: multiplier } : {}),
|
|
517
|
+
...(priorityLowerBound ? { priorityLowerBound: true } : {}),
|
|
488
518
|
...(contextTier ? { contextTier } : {}),
|
|
489
519
|
};
|
|
490
520
|
}
|
|
@@ -527,6 +557,7 @@ export function estimateComboCost(
|
|
|
527
557
|
...(estimates.some(est => est.priorityMultiplier && est.priorityMultiplier !== 1)
|
|
528
558
|
? { priorityMultiplier: estimates.find(est => est.priorityMultiplier)?.priorityMultiplier }
|
|
529
559
|
: {}),
|
|
560
|
+
...(estimates.some(est => est.priorityLowerBound) ? { priorityLowerBound: true } : {}),
|
|
530
561
|
...(estimates.some(est => est.contextTier) ? { contextTier: "long" as const } : {}),
|
|
531
562
|
};
|
|
532
563
|
}
|
|
@@ -554,12 +585,17 @@ export function estimateRequestCost(
|
|
|
554
585
|
const [effectiveCost4, multiplier] = contextTier
|
|
555
586
|
? [tieredCost4, 1] as const
|
|
556
587
|
: applyPriorityMultiplier(tieredCost4, input.provider, input.model, input.serviceTier);
|
|
588
|
+
const priorityLowerBound = isOpenRouterPriorityLowerBound(
|
|
589
|
+
input.provider,
|
|
590
|
+
typeof input.serviceTier === "object" ? input.serviceTier.tierOutcome : undefined,
|
|
591
|
+
);
|
|
557
592
|
return {
|
|
558
593
|
tokens,
|
|
559
594
|
price,
|
|
560
595
|
cost: calculateCost(tokens, effectiveCost4),
|
|
561
596
|
estimated: isEstimated(input.usage, input.usageStatus, price.status),
|
|
562
597
|
...(multiplier !== 1 ? { priorityMultiplier: multiplier } : {}),
|
|
598
|
+
...(priorityLowerBound ? { priorityLowerBound: true } : {}),
|
|
563
599
|
...(contextTier ? { contextTier } : {}),
|
|
564
600
|
};
|
|
565
601
|
}
|
package/src/web-search/loop.ts
CHANGED
|
@@ -741,13 +741,20 @@ export async function runWithWebSearch(deps: WebSearchLoopDeps): Promise<Respons
|
|
|
741
741
|
throw e;
|
|
742
742
|
}
|
|
743
743
|
|
|
744
|
-
const toolNsMap = new Map<string, { namespace: string; name: string }>();
|
|
744
|
+
const toolNsMap = new Map<string, { namespace: string; name: string; freeform?: true }>();
|
|
745
745
|
const freeform = new Set<string>();
|
|
746
746
|
const toolSearch = new Set<string>();
|
|
747
|
-
const
|
|
748
|
-
|
|
747
|
+
const requestedTools = parsed.context.tools ?? [];
|
|
748
|
+
const toolAllowed = toolChoiceToolPredicate(parsed.options.toolChoice, requestedTools);
|
|
749
|
+
for (const t of requestedTools) {
|
|
749
750
|
if (!toolAllowed(t)) continue;
|
|
750
|
-
if (t.namespace)
|
|
751
|
+
if (t.namespace) {
|
|
752
|
+
toolNsMap.set(namespacedToolName(t.namespace, t.name), {
|
|
753
|
+
namespace: t.namespace,
|
|
754
|
+
name: t.name,
|
|
755
|
+
...(t.freeform ? { freeform: true } : {}),
|
|
756
|
+
});
|
|
757
|
+
}
|
|
751
758
|
if (t.freeform) freeform.add(t.name);
|
|
752
759
|
if (t.toolSearch) toolSearch.add(t.name);
|
|
753
760
|
}
|