@cortexkit/opencode-anthropic-auth 2.1.2 → 2.2.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/dist/cli.js +36 -36
- package/dist/{index-x325vp4e.js → index-ccrq4mra.js} +13 -13
- package/dist/{index-53nnxq39.js → index-czyrqpxc.js} +1 -1
- package/dist/index-pden7a7y.js +2 -0
- package/dist/index.js +1 -1
- package/dist/sidebar-state.d.ts +1 -1
- package/dist/sidebar-state.js +1 -1
- package/dist/transform.d.ts +4 -0
- package/dist/tui/claude-sidebar.d.ts +94 -0
- package/dist/v2/menu-contract.d.ts +3 -0
- package/dist/v2/rpc.d.ts +9 -0
- package/dist/v2/server.js +4 -4
- package/dist/v2/sidebar.d.ts +13 -0
- package/dist/v2/source.d.ts +2 -0
- package/dist/v2/tui.d.ts +9 -1
- package/dist/v2/tui.js +2 -2
- package/dist/v2/wire.d.ts +4 -0
- package/package.json +5 -5
- package/src/sidebar-state.ts +8 -3
- package/src/tui/claude-sidebar.tsx +1075 -0
- package/src/tui/entry.mjs +15 -1
- package/src/tui-compiled/sidebar-state.ts +8 -3
- package/src/tui-compiled/tui/claude-sidebar.tsx +1253 -0
- package/src/tui-compiled/tui.tsx +46 -1137
- package/src/tui.tsx +15 -886
- package/dist/index-jexctf5w.js +0 -2
package/dist/v2/tui.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import type { Plugin as Tui } from '@opencode/plugin/tui';
|
|
2
|
+
import type { SidebarState } from '../sidebar-state';
|
|
3
|
+
/**
|
|
4
|
+
* Claims the quota sidebar. `entry.mjs` passes the precompiled renderer, so
|
|
5
|
+
* this bundle stays free of JSX and of the OpenCode 1 TUI.
|
|
6
|
+
*/
|
|
7
|
+
export type MountSidebar = (ctx: Tui.Context, read: (sessionID: string, signal: AbortSignal) => Promise<SidebarState>) => Promise<() => void>;
|
|
2
8
|
/**
|
|
3
9
|
* Shows the `claude` account menu in OpenCode 2 dialogs. The menu's sections,
|
|
4
10
|
* items and actions come from the plugin server over NATIVE_MENU_RPC, built by
|
|
5
11
|
* the same Core menu code that OpenCode 1 and Pi render, so every host shows
|
|
6
12
|
* the same menu.
|
|
7
13
|
*/
|
|
8
|
-
export declare function setupAnthropicTui(ctx: Tui.Context
|
|
14
|
+
export declare function setupAnthropicTui(ctx: Tui.Context, options?: {
|
|
15
|
+
readonly mountSidebar?: MountSidebar;
|
|
16
|
+
}): Promise<() => void>;
|
|
9
17
|
declare const _default: {
|
|
10
18
|
id: string;
|
|
11
19
|
setup: typeof setupAnthropicTui;
|
package/dist/v2/tui.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as
|
|
2
|
-
`),value:
|
|
1
|
+
import{t as P}from"../index-pden7a7y.js";import"../index-czyrqpxc.js";import"../index-f2ne65w4.js";async function T(D,R={}){let Y=D.client.rpc(P),L=!0,q=!1,O=new AbortController,Q=()=>{let z=D.ui.router.current();return z.type==="session"?z.sessionID:void 0};function U(z){return new Promise((K)=>{let j="",H=!1,W=D.keymap.mode.push("cortexkit-protected-entry"),J=(B,G=!0)=>{if(H)return;H=!0,D.renderer.keyInput.off("keypress",Z),D.renderer.keyInput.off("paste",$),O.signal.removeEventListener("abort",X),W();let C=B?j:void 0;if(j="",G)D.ui.dialog.clear();K(C)},X=()=>J(!1),Z=(B)=>{if(B.preventDefault(),B.stopPropagation(),B.name==="escape"||B.ctrl&&B.name==="c")return J(!1);if(B.name==="return"||B.name==="enter")return J(!0);if(B.name==="backspace"){j=Array.from(j).slice(0,-1).join("");return}if(!B.ctrl&&!B.meta&&!B.option&&Array.from(B.sequence).every((G)=>G.charCodeAt(0)>=32&&G.charCodeAt(0)!==127))j=(j+B.sequence).slice(0,4096)},$=(B)=>{B.preventDefault(),B.stopPropagation(),j=(j+Array.from(new TextDecoder().decode(B.bytes)).filter((G)=>G.charCodeAt(0)>=32&&G.charCodeAt(0)!==127).join("")).slice(0,4096)};if(D.renderer.keyInput.prependListener("keypress",Z),D.renderer.keyInput.prependListener("paste",$),O.signal.addEventListener("abort",X,{once:!0}),D.ui.dialog.alert({title:z,message:"Type or paste the value. Input is hidden. Enter accepts; Escape cancels."}).then(()=>J(!1,!1),()=>J(!1,!1)),O.signal.aborted)X()})}async function V(z){let K={};for(let j of z.knobs){if(!L)return;if(j.kind==="choice"){let H=await D.ui.dialog.select({title:j.label,options:j.choices.map((W)=>({title:W.label,value:W.value})),current:j.value});if(H===void 0)return;K[j.id]=H}else if(j.kind==="toggle"){let H=await D.ui.dialog.select({title:j.label,options:[{title:"On",value:!0},{title:"Off",value:!1}],current:j.value});if(H===void 0)return;K[j.id]=H}else{let H=j.kind==="text"&&j.masked?await U(j.label):await D.ui.dialog.prompt({title:j.label,value:j.value===void 0?void 0:String(j.value),placeholder:j.kind==="text"?j.placeholder:void 0});if(H===void 0)return;K[j.id]=H===""&&!j.required?null:j.kind==="number"?Number(H):H}}return K}async function F(z,K){if(!L||q||Q()!==z)return;q=!0;let j=K;try{while(L&&Q()===z){let H=await D.ui.dialog.select({title:j.menu.title,options:j.menu.sections.map((G)=>({title:G.title,description:G.lines.join(`
|
|
2
|
+
`),value:G}))});if(!H||!L||Q()!==z)return;let W=[...H.actions.map((G)=>({action:G,itemId:void 0})),...H.items.flatMap((G)=>G.actions.map((C)=>({action:C,itemId:G.id})))],J=await D.ui.dialog.select({title:H.title,options:W.map((G)=>({title:G.action.label,description:G.action.description,value:G}))});if(!J)continue;let X=await V(J.action);if(!X||!L||Q()!==z)return;let Z=J.action.confirm?await D.ui.dialog.confirm({title:J.action.label,message:J.action.confirm.message}):void 0;if(J.action.confirm&&Z!==!0)continue;if(!L||Q()!==z)return;let $={command:"claude",sectionId:H.id,itemId:J.itemId,actionId:J.action.id,sessionId:z,values:X,confirmed:Z},B=await Y.apply($,{signal:O.signal,location:D.location});if(!L||Q()!==z)return;await D.ui.dialog.alert({title:B.ok?"Claude":"Claude action refused",message:B.text}),j={command:B.command,menu:B.menu}}}finally{q=!1}}let w=Y.events.on("opened",(z)=>F(z.data.sessionId,z.data.payload),{signal:O.signal}),A=Y.events.on("notification",(z)=>{if(L&&Q()===z.data.sessionId)D.ui.toast.show({title:"Claude",sessionID:z.data.sessionId,message:z.data.message,variant:z.data.kind})},{signal:O.signal});D.keymap.layer(()=>({commands:[{id:"cortexkit.claude",title:"Claude",group:"Claude",palette:!0,slash:{name:"claude"},async run(){let z=Q();if(!z){await D.ui.dialog.alert({title:"Claude",message:"Open a session before using the Claude menu."});return}let K=await Y.open({sessionId:z},{signal:O.signal,location:D.location});await F(z,K)}}]}));let M;try{M=await R.mountSidebar?.(D,(z,K)=>Y.sidebar({sessionId:z},{signal:K,location:D.location}))}catch{}return()=>{L=!1,O.abort(),w(),A(),M?.()}}var E={id:"cortexkit-anthropic-auth",setup:T};export{T as setupAnthropicTui,E as default};
|
package/dist/v2/wire.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ export declare function createNativeWirePolicy(): {
|
|
|
17
17
|
fastModeEnabled: boolean;
|
|
18
18
|
thinkingPrefixMismatchBehavior: "account-default" | "drop_block" | "error" | undefined;
|
|
19
19
|
midConversationEffortEnabled: boolean;
|
|
20
|
+
turnEndNoteEnabled: boolean;
|
|
21
|
+
turnEndNote: {
|
|
22
|
+
tools: string[];
|
|
23
|
+
} | undefined;
|
|
20
24
|
serverSideFallbackEnabled: boolean;
|
|
21
25
|
laneStart: boolean;
|
|
22
26
|
billingLineage: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/opencode-anthropic-auth",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -77,18 +77,18 @@
|
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@clack/prompts": "^1.6.0",
|
|
80
|
-
"@cortexkit/anthropic-auth-core": "2.
|
|
80
|
+
"@cortexkit/anthropic-auth-core": "2.2.0",
|
|
81
81
|
"@cortexkit/claustrum-client": "0.12.0",
|
|
82
82
|
"@cortexkit/private-files": "0.2.1",
|
|
83
83
|
"@cortexkit/subc-client": "^0.22.0",
|
|
84
|
-
"@opentui/core": "0.6.
|
|
85
|
-
"@opentui/solid": "0.6.
|
|
84
|
+
"@opentui/core": "0.6.6",
|
|
85
|
+
"@opentui/solid": "0.6.6",
|
|
86
86
|
"jsonc-parser": "^3.3.1",
|
|
87
87
|
"solid-js": "1.9.12",
|
|
88
88
|
"xxhash-wasm": "^1.1.0"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@ai-sdk/anthropic": "4.0.77",
|
|
92
|
-
"@opencode/plugin": "2.0.
|
|
92
|
+
"@opencode/plugin": "2.0.32"
|
|
93
93
|
}
|
|
94
94
|
}
|
package/src/sidebar-state.ts
CHANGED
|
@@ -888,7 +888,10 @@ export function formatPrimeCost(value: number): string {
|
|
|
888
888
|
return value.toFixed(Math.min(6, Math.max(0, 4)))
|
|
889
889
|
}
|
|
890
890
|
|
|
891
|
-
export function formatPrimeAccountValue(
|
|
891
|
+
export function formatPrimeAccountValue(
|
|
892
|
+
account: PrimeSidebarAccountState,
|
|
893
|
+
now = Date.now(),
|
|
894
|
+
): {
|
|
892
895
|
text: string
|
|
893
896
|
hasError: boolean
|
|
894
897
|
} {
|
|
@@ -898,7 +901,7 @@ export function formatPrimeAccountValue(account: PrimeSidebarAccountState): {
|
|
|
898
901
|
if (account.lastResult === 'skipped') {
|
|
899
902
|
return { text: 'skip', hasError: false }
|
|
900
903
|
}
|
|
901
|
-
if (account.nextDueAt && account.nextDueAt >
|
|
904
|
+
if (account.nextDueAt && account.nextDueAt > now) {
|
|
902
905
|
return { text: formatPrimeTime(account.nextDueAt), hasError: false }
|
|
903
906
|
}
|
|
904
907
|
if (account.lastPrimedAt) {
|
|
@@ -994,7 +997,9 @@ export function getCollapsedAccounts(
|
|
|
994
997
|
state: SidebarState,
|
|
995
998
|
showFallbacks = true,
|
|
996
999
|
) {
|
|
997
|
-
|
|
1000
|
+
// Before any request no account is active; do not mark main as serving.
|
|
1001
|
+
const activeId =
|
|
1002
|
+
state.activeId === undefined ? undefined : resolveActiveAccount(state).id
|
|
998
1003
|
return [
|
|
999
1004
|
{
|
|
1000
1005
|
id: 'main',
|