pi-cursor-inference 0.0.0 → 0.0.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # pi-cursor-inference
2
+
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Correct the pi.dev gallery preview with a native 4K 16:9 composition and make the README's implementation links resolve from npm and pi.dev ([`3f525e6`](https://github.com/victor-software-house/pi-cursor/commit/3f525e6393f3eff23f16cd4aa0f21004db2dfbe4)).
8
+
9
+ ## 0.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Add the first functional Cursor managed-inference provider with native OAuth, dynamic models, Pi-owned tool execution, thinking-safe final reconciliation, and `/cursor` usage and settings panes ([`f7f7d76`](https://github.com/victor-software-house/pi-cursor/commit/f7f7d762fd07e9f2e898552f2819fad77016d6c5)).
14
+
15
+ ## 0.0.0
16
+
17
+ Reserved the package name. The provider is not implemented in this version.
package/README.md CHANGED
@@ -1,5 +1,134 @@
1
- # pi-cursor
1
+ # pi-cursor-inference
2
2
 
3
- Cursor as a plain inference provider for Pi, over `aiserver.v1.InferenceService/RunInference`.
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="docs/banner-dark.svg">
5
+ <img src="docs/banner.svg" alt="pi-cursor — /cursor in Pi · unofficial routed Cursor inference">
6
+ </picture>
4
7
 
5
- Status: planning. See [docs/plan.md](docs/plan.md).
8
+ This package implements Cursor as an unofficial plain inference provider for
9
+ [Pi](https://github.com/earendil-works/pi-mono) over
10
+ `aiserver.v1.InferenceService/RunInference`. Cursor supplies inference while Pi owns the complete
11
+ conversation, arbitrary tool schemas, tool execution, branching, and transcript.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ pi install npm:pi-cursor-inference
17
+ ```
18
+
19
+ Then authenticate and select a Cursor model:
20
+
21
+ ```text
22
+ /login cursor
23
+ /model
24
+ ```
25
+
26
+ To evaluate the extension without adding it to settings:
27
+
28
+ ```sh
29
+ pi -e npm:pi-cursor-inference
30
+ ```
31
+
32
+ Pi packages execute with full local access. Review this repository before installation. The
33
+ [pre-publication privacy audit](https://github.com/victor-software-house/pi-cursor/blob/main/docs/public-history-audit-2026-09-03.md)
34
+ records the complete history review performed before the repository became public.
35
+
36
+ ## Features
37
+
38
+ - Native Pi OAuth through `/login cursor`, plus `PI_CURSOR_TOKEN` for headless use.
39
+ - Dynamic model discovery from `AvailableModels`, `GetUsableModels`, and
40
+ `GetDefaultModelForCli`.
41
+ - Catalog-backed context windows, image/thinking capabilities, and distinct Max Mode rows only
42
+ when Cursor advertises a meaningful variant difference.
43
+ - Streaming thinking text when the provider supplies it, opaque reasoning signatures, text,
44
+ usage, generic tool-call argument deltas, and tool continuations.
45
+ - Final response assembly always preserves routed thinking text when Cursor's final message carries
46
+ only redacted or signature-only reasoning metadata.
47
+ - Strict reconciliation defaults on: completed streamed and final tools must match by ID, name, and
48
+ deep-equal arguments before Pi can execute them. It can be disabled explicitly in settings.
49
+ - Multi-block reasoning metadata matches only by exact signature or exact text, with an unambiguous
50
+ one-to-one fallback; unmatched metadata stays separate instead of attaching by array index.
51
+ - Bare `/cursor` opens an action selector for the usage and settings panes.
52
+
53
+ ## Cursor command
54
+
55
+ Run `/cursor` in TUI mode to choose between **Usage** and **Settings**. Direct commands remain
56
+ available:
57
+
58
+ - `/cursor usage` — account usage with Summary and Models views;
59
+ - `/cursor settings` — strict reconciliation and persisted diagnostics;
60
+ - `/cursor help` — command shape.
61
+
62
+ Outside TUI mode, bare `/cursor` and `/cursor help` print the command shape because no selector can
63
+ be hosted.
64
+
65
+ ## Usage pane
66
+
67
+ Run `/cursor usage` to open the account usage pane. It shows the current plan and reset date,
68
+ included and on-demand usage for ordinary plans, or current/previous cumulative spend for
69
+ Enterprise plans. When the backend returns a per-model breakdown, **Tab** switches between
70
+ **Summary** and **Models**; `r` refreshes and `q`/Esc closes the pane.
71
+
72
+ The pane uses captured DashboardService calls and renderer-defined units. It does not infer prices
73
+ from model tokens or invent values for missing samples. Optional failed calls remain visible as
74
+ named misses while available usage still renders. Outside TUI mode, print writes plain text, JSON
75
+ emits a custom message event, and RPC uses a notification.
76
+
77
+ ## Configuration
78
+
79
+ `/cursor settings` persists two toggles in Pi's agent directory:
80
+
81
+ - **Strict reconciliation** defaults to **on**. When enabled, streamed and final response copies
82
+ must agree structurally; tool IDs, names, and arguments are checked before local execution. When
83
+ disabled, Cursor's final content is accepted without that cross-copy equality check. Local stream
84
+ validity, advertised-tool validation, and final-content parsing remain mandatory.
85
+ - **Persist diagnostics** defaults to **off**. When enabled, each assistant message carries a
86
+ `cursor-inference-response` diagnostic in session JSONL. Its reconciliation census is payload-free;
87
+ the same diagnostic can also retain provider metadata, image descriptions, and inference-extra
88
+ side-channel data. The current structural census is about 0.6 kB per assistant message (roughly
89
+ 56 kB per 100 turns); provider side channels can make it larger. When disabled, Cursor adds no
90
+ assistant-message diagnostic data.
91
+
92
+ The thinking-loss fix is not configurable. Empty, signature-only, or redacted final reasoning can
93
+ never erase non-empty streamed thinking, even when strict reconciliation is off.
94
+
95
+ Cursor Max Mode defaults to **off**, matching the IDE's ordinary composer model configuration.
96
+ Catalog entries with a distinct Max Mode appear as separate `-max` models and carry Cursor's
97
+ captured context parameter automatically. Advanced callers may override the Cursor-specific
98
+ `cursorMaxMode` and `cursorContext` sampling parameters per request.
99
+
100
+ ## Verification
101
+
102
+ `mise run verify` is the deterministic gate. It runs formatting/lint checks, TypeScript checking,
103
+ 105 unit tests, the minified build, publint, the package whitelist, Node and Bun imports of the
104
+ extracted tarball, and Pi's real extension loader. The loader proof requires the packed artifact to
105
+ register `/cursor` and exactly one native `cursor` provider. Packed CLI checks also require
106
+ `/cursor help` to emit plain text in print mode and a custom message event in JSON mode.
107
+
108
+ A fresh-account live proof on 2026-09-03 established:
109
+
110
+ - all three catalog surfaces decode and produce selectable models;
111
+ - DashboardService usage loads without exposing account values in test output;
112
+ - Composer 2.5 returns text through the production RunInference transport;
113
+ - the isolated Pi TUI renders both Summary and Models, switches with Tab, closes with `q`, and
114
+ displays optional aggregate timeouts as named partial misses.
115
+ - every live inference result explicitly enables and validates the payload-free
116
+ text/reasoning/tool reconciliation census inside its diagnostic;
117
+ - a paid arbitrary-tool turn proved streamed/final tool equality and continued with the local result.
118
+
119
+ The implementation is pinned to Cursor IDE 3.18.9 for managed inference and
120
+ `cursor-agent 2026.09.02-fa0c06e` for catalog/usage evidence. Darwin host identity is verified
121
+ against Cursor's algorithm. Linux and Windows identity branches have deterministic fixtures but
122
+ have not been host-verified. Packet-level HTTP/2 framing and future Cursor server compatibility are
123
+ not claimed.
124
+
125
+ ## Scope boundary
126
+
127
+ - No `AgentService/Run`, Cursor-native tools, MCP projection, or agent bridge.
128
+ - No multi-account database, keychain/1Password reader, or installed-IDE dependency.
129
+ - No invented Grok thinking summary: current RunInference measurements provide an opaque
130
+ continuation signature but no reasoning text for Grok 4.6.
131
+
132
+ See the
133
+ [implementation and verification record](https://github.com/victor-software-house/pi-cursor/blob/main/docs/plan.md)
134
+ and [protocol and scope decisions](https://github.com/victor-software-house/pi-cursor/blob/main/docs/decisions.md).
@@ -0,0 +1,6 @@
1
+ import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ //#region src/index.d.ts
3
+ /** Register Cursor as a native, dynamically discovered Pi inference provider. */
4
+ declare function cursorInference(pi: ExtensionAPI): Promise<void>;
5
+ //#endregion
6
+ export { cursorInference as default };
package/dist/index.mjs ADDED
@@ -0,0 +1,8 @@
1
+ import{arch as e,env as t,platform as n,stderr as r}from"node:process";import{DynamicBorder as i,getAgentDir as a,getSettingsListTheme as o}from"@earendil-works/pi-coding-agent";import{Container as s,Input as c,Loader as l,SettingsList as u,Spacer as d,Text as f,fuzzyFilter as p,matchesKey as m,truncateToWidth as h,visibleWidth as g}from"@earendil-works/pi-tui";import{P as _,match as v}from"ts-pattern";import{chmodSync as y,mkdirSync as ee,readFileSync as te,writeFileSync as ne}from"node:fs";import{dirname as re,join as ie}from"node:path";import{create as b,fromBinary as ae,fromJson as oe,toBinary as se}from"@bufbuild/protobuf";import{request as ce}from"node:https";import{brotliDecompressSync as le,gunzipSync as ue,gzipSync as de}from"node:zlib";import{fileDesc as x,messageDesc as S}from"@bufbuild/protobuf/codegenv2";import{execSync as fe}from"node:child_process";import{createHash as C,randomBytes as pe,randomUUID as me}from"node:crypto";import{mkdir as he,readFile as ge,writeFile as _e}from"node:fs/promises";import{networkInterfaces as ve}from"node:os";import{setTimeout as ye}from"node:timers/promises";import{ValueSchema as be,file_google_protobuf_struct as xe}from"@bufbuild/protobuf/wkt";import{isDeepStrictEqual as Se}from"node:util";import{calculateCost as Ce,createAssistantMessageEventStream as we,createProvider as Te,parseStreamingJson as Ee}from"@earendil-works/pi-ai";import{connect as De}from"node:http2";import{Buffer as Oe}from"node:buffer";var ke=class extends s{searchInput=new c;viewText;detailText;footerText;keybinds=new Map;selectedIndex=0;activeViewId;onSelect;onCancel;items;theme;keybindings;options;constructor(e,t,n,r){super(),this.items=e,this.theme=t,this.keybindings=n,this.options=r,this.activeViewId=r.defaultViewId??r.views?.[0]?.id,this.searchInput.focused=!0,this.viewText=new f(``,1,0),this.detailText=new f(``,1,0),this.footerText=new f(``,1,0),this.addChild(new i(e=>t.fg(`border`,e))),this.addChild(new d(1));let a=r.subtitle!==void 0&&r.subtitle!==``?`${t.fg(`accent`,` ${r.title}`)} ${t.fg(`dim`,r.subtitle)}`:t.fg(`accent`,` ${r.title}`);this.addChild(new f(a,1,0)),this.addChild(this.viewText),this.addChild(new d(1)),this.addChild(new f(this.theme.fg(`dim`,` ${r.searchLabel??`search`}:`),1,0)),this.addChild(this.searchInput),this.addChild(new d(1)),this.addChild({render:e=>this.renderRows(e),invalidate:()=>{}}),this.addChild(new d(1)),this.addChild(this.detailText),this.addChild(new d(1)),this.addChild(this.footerText),this.addChild(new d(1)),this.addChild(new i(e=>t.fg(`border`,e))),this.refresh()}addKeybind(e,t){this.keybinds.set(e,t)}handleInput(e){let t=this.keybinds.get(e);if(t){t();return}let n=this.options.views?.find(t=>t.key===e);if(n){this.activeViewId=n.id,this.selectedIndex=0,this.refresh();return}let r=this.filteredItems();if(this.keybindings.matches(e,`tui.select.up`))this.selectedIndex=r.length===0?0:this.selectedIndex===0?r.length-1:this.selectedIndex-1;else if(this.keybindings.matches(e,`tui.select.down`))this.selectedIndex=r.length===0||this.selectedIndex===r.length-1?0:this.selectedIndex+1;else if(this.keybindings.matches(e,`tui.select.confirm`)){let e=r[this.selectedIndex];e&&this.onSelect?.(e.value);return}else if(this.keybindings.matches(e,`tui.select.cancel`)){this.onCancel?.();return}else{let t=this.searchInput.getValue();this.searchInput.handleInput(e),this.searchInput.getValue()!==t&&(this.selectedIndex=0)}this.refresh()}activeView(){return this.options.views?.find(e=>e.id===this.activeViewId)}filteredItems(){let e=this.activeView(),t=e?this.items.filter(t=>e.predicate(t)):this.items,n=this.searchInput.getValue().trim();return n?p(t,n,e=>`${e.value} ${e.label} ${e.description} ${e.searchText??``}`):t}refresh(){let e=this.filteredItems();this.selectedIndex=Math.max(0,Math.min(this.selectedIndex,Math.max(0,e.length-1))),this.viewText.setText(this.renderViewLine(e.length));let t=e[this.selectedIndex];this.detailText.setText(t&&this.options.detail?this.options.detail(t,this.theme):``),this.footerText.setText(this.renderFooter())}renderViewLine(e){let t=this.options.views??[],n=this.activeView(),r=this.theme.fg(`dim`,`${e}/${this.items.length}`);return t.length===0?` ${r}`:` ${t.map(e=>{let t=e.key!==void 0&&e.key!==``?`${e.key} ${e.label}`:e.label;return e.id===n?.id?this.theme.fg(`accent`,t):this.theme.fg(`muted`,t)}).join(this.theme.fg(`dim`,` · `))} ${r}`}renderRows(e){let t=this.filteredItems();if(this.selectedIndex=Math.max(0,Math.min(this.selectedIndex,Math.max(0,t.length-1))),t.length===0)return[this.theme.fg(`muted`,` No matching commands`)];let n=this.options.maxVisible??12,r=Math.max(0,Math.min(this.selectedIndex-Math.floor(n/2),t.length-n)),i=Math.min(r+n,t.length),a=Math.min(this.options.maxLabelWidth??20,Math.max(this.options.minLabelWidth??10,...t.map(e=>g(e.label)+2))),o=[];for(let n=r;n<i;n++){let r=t[n];if(!r)continue;let i=n===this.selectedIndex,s=i?this.theme.fg(`accent`,`→ `):` `,c=h(r.label,a-2,``),l=c+` `.repeat(Math.max(1,a-g(c))),u=Math.max(0,e-g(s)-a-2),d=h(r.description,u,``),f=i?this.theme.fg(`accent`,l):r.tone?this.theme.fg(r.tone,l):l,p=i?this.theme.fg(`accent`,d):this.theme.fg(r.tone===`dim`?`dim`:`muted`,d);o.push(h(`${s}${f}${p}`,e))}return(r>0||i<t.length)&&o.push(this.theme.fg(`dim`,h(` (${this.selectedIndex+1}/${t.length})`,e))),o}renderFooter(){return` ${[`${this.theme.fg(`dim`,`type`)} ${this.theme.fg(`muted`,`search`)}`,`${this.theme.fg(`dim`,this.keyLabel(`tui.select.up`,`tui.select.down`))} ${this.theme.fg(`muted`,`navigate`)}`,`${this.theme.fg(`dim`,this.keyLabel(`tui.select.confirm`))} ${this.theme.fg(`muted`,`select`)}`,...(this.options.extraHints??[]).map(e=>`${this.theme.fg(`dim`,e.key)} ${this.theme.fg(`muted`,e.label)}`),`${this.theme.fg(`dim`,this.keyLabel(`tui.select.cancel`))} ${this.theme.fg(`muted`,`cancel`)}`].join(` `)}`}keyLabel(...e){return e.flatMap(e=>this.keybindings.getKeys(e)).filter((e,t,n)=>n.indexOf(e)===t).join(`/`)}};function Ae(e,t,n,r){let i=new s;i.addChild(new f(t.fg(`accent`,t.bold(r.title)),1,0)),r.configPath!==void 0&&i.addChild(new f(t.fg(`dim`,r.configPath),1,0));let a=new u(r.items,r.maxVisible??12,r.settingsListTheme,(t,n)=>{r.onChange(t,n),r.items.find(e=>e.id===t)!==void 0&&a.updateValue(t,n),e.requestRender()},()=>n(void 0),{enableSearch:!0});return i.addChild(a),i.addChild(new f(t.fg(`dim`,r.footerHint??`Esc: close | Arrow keys: navigate | Enter/Space: change`),1,0)),{render:e=>i.render(e),invalidate:()=>i.invalidate(),handleInput:t=>{a.handleInput?.(t),e.requestRender()}}}function je(e,t){let n=t[e.currentValue];n!==void 0&&(e.description=n)}const Me=[{value:`usage`,label:`Usage`,description:`Account limits, spend, and per-model usage`},{value:`settings`,label:`Settings`,description:`Reconciliation safety and persisted diagnostics`}];async function Ne(e){return e.custom((e,t,n,r)=>{let i=new ke([...Me],t,n,{title:`Cursor`,subtitle:`managed inference`,maxVisible:Me.length,minLabelWidth:12,maxLabelWidth:16,searchLabel:`action`});return i.onSelect=e=>{(e===`usage`||e===`settings`)&&r(e)},i.onCancel=()=>r(void 0),i})}function Pe(e){return Object.is(e,void 0)}function w(e){return typeof e!=`object`||!e?!1:Object.getPrototypeOf(e)===null||Object.getPrototypeOf(e)===Object.prototype}function Fe(e,t){return t===void 0?!0:t.only===void 0?!(t.except?.includes(e)??!1):t.only.includes(e)}function Ie(e,t){let n={...e};for(let[r,i]of Object.entries(n))t(i,r,e)&&delete n[r];return n}function Le(e,t,n){return Ie(e,(r,i)=>Fe(i,n)&&t(r,i,e))}function T(e,t){return Le(e,Pe,t)}function Re(e){return{ok:!0,value:e}}function E(e){return{ok:!1,error:e}}function D(e){return e instanceof Error?e.message:String(e)}const O={strictReconciliation:!0,diagnostics:!1};let ze={...O};function k(e=a()){return ie(e,`pi-cursor.json`)}function A(){return ze}function Be(e){return ze={...e},ze}function Ve(e){if(!w(e))throw Error(`settings must be a JSON object`);let t=e.strictReconciliation,n=e.diagnostics;if(t!==void 0&&typeof t!=`boolean`)throw Error(`strictReconciliation must be a boolean`);if(n!==void 0&&typeof n!=`boolean`)throw Error(`diagnostics must be a boolean`);return{strictReconciliation:t??O.strictReconciliation,diagnostics:n??O.diagnostics}}function He(e=k()){try{return{settings:Be(Ve(JSON.parse(te(e,`utf8`))))}}catch(t){let n=Be({...O});return t instanceof Error&&Reflect.get(t,`code`)===`ENOENT`?{settings:n}:{settings:n,warning:`Cursor ignored invalid settings at ${e}: ${t instanceof Error?t.message:String(t)}`}}}function Ue(e,t=k()){let n=Be(Ve(e));return ee(re(t),{recursive:!0}),ne(t,`${JSON.stringify(n,null,2)}\n`,{encoding:`utf8`,mode:384}),y(t,384),n}function We(e=A()){return[`strict reconciliation: ${e.strictReconciliation?`on`:`off`} — ${e.strictReconciliation?`fail when streamed and final response copies disagree`:`accept the final response without cross-copy equality checks`}`,`persist diagnostics: ${e.diagnostics?`on`:`off`} — ${e.diagnostics?`store response metadata and reconciliation census data in assistant session messages`:`add no Cursor diagnostics to assistant session messages`}`,`thinking preservation: always on — empty or redacted final reasoning cannot erase streamed thinking`].join(`
2
+ `)}const Ge={strictReconciliation:{on:`Fail before tool execution when streamed and final response copies disagree.`,off:`Accept final content without streamed/final equality checks; stream validity still applies.`},diagnostics:{on:`Persist response metadata and census data; about 0.6 kB baseline per turn, more with side channels.`,off:`Add no Cursor diagnostic data to assistant session messages.`}};function Ke(){let e=A();return[{id:`strictReconciliation`,label:`Strict reconciliation`,description:Ge.strictReconciliation[e.strictReconciliation?`on`:`off`],currentValue:e.strictReconciliation?`on`:`off`,values:[`on`,`off`]},{id:`diagnostics`,label:`Persist diagnostics`,description:Ge.diagnostics[e.diagnostics?`on`:`off`],currentValue:e.diagnostics?`on`:`off`,values:[`on`,`off`]}]}async function qe(e,t){if(e.mode!==`tui`){t(`${We()}\nconfig: ${k()}`,`info`);return}let n=Ke();await e.ui.custom((t,r,i,a)=>Ae(t,r,a,{title:`Cursor Settings`,configPath:k(),items:n,settingsListTheme:o(),onChange:(t,r)=>{let i=n.find(e=>e.id===t);if(!(i===void 0||t!==`strictReconciliation`&&t!==`diagnostics`)){i.currentValue=r,je(i,Ge[t]);try{Ue({...A(),[t]:r===`on`})}catch(t){e.ui.notify(`Failed to save Cursor settings: ${t instanceof Error?t.message:String(t)}`,`error`)}}}}))}function Je(e,t){let n={"accept-encoding":`gzip,br`,authorization:`Bearer ${e.token}`,"connect-protocol-version":`1`,"connect-timeout-ms":`10000`,"content-type":`application/proto`,"user-agent":`connect-es/1.6.1`,"x-cursor-client-type":`cli`,"x-cursor-client-version":`extension-unknown`,"x-ghost-mode":`false`,"x-request-id":crypto.randomUUID()};return t.length===0&&(n[`content-length`]=`0`),n}function Ye(e,t){return t===`gzip`?new Uint8Array(ue(e)):t===`br`?new Uint8Array(le(e)):e}function Xe(e,t,n){return new Promise((r,i)=>{if(t.signal?.aborted===!0){i(new DOMException(`Aborted`,`AbortError`));return}let a=(t.request??ce)({protocol:`https:`,host:e.hostname,port:e.port===``?443:e.port,path:e.pathname,method:`POST`,headers:Je(t,n)},e=>{let t=[],n=0;e.on(`data`,e=>{if(n+=e.length,n>4194304){a.destroy(),i(Error(`response exceeded 4194304 bytes`));return}t.push(e)}),e.on(`end`,()=>{try{r({status:e.statusCode??0,body:Ye(Buffer.concat(t),e.headers[`content-encoding`])})}catch(e){i(Error(D(e)))}}),e.on(`error`,i)});a.on(`error`,i),a.setTimeout(1e4,()=>{a.destroy(Error(`no response within 10000ms`))});let o=t.signal;if(o!==void 0){let e=()=>{a.destroy(),i(new DOMException(`Aborted`,`AbortError`))};o.addEventListener(`abort`,e,{once:!0}),a.on(`close`,()=>o.removeEventListener(`abort`,e))}n.length===0||a.write(n),a.end()})}function Ze(e){try{let t=JSON.parse(new TextDecoder().decode(e));if(typeof t==`object`&&t&&`message`in t){let{message:e}=t;if(typeof e==`string`&&e!==``)return e}}catch{return}}function Qe(e){return e===401||e===403?`auth`:e>=500?`transient`:`permanent`}async function j(e,t,n,r){if(r.token.includes(`\r`)||r.token.includes(`
3
+ `))return E({kind:`invalid`,method:e,message:`Cursor credential contains a line break`});let i=new URL(`https://api2.cursor.sh/aiserver.v1.DashboardService/${e}`),a=se(t.schema,t.message),o;try{o=await Xe(i,r,a)}catch(t){return t instanceof DOMException&&t.name===`AbortError`?E({kind:`transient`,method:e,message:`cancelled`}):E({kind:`transient`,method:e,message:D(t)})}if(o.status!==200){let t=Ze(o.body);return E({kind:Qe(o.status),method:e,message:`${String(o.status)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sYW5faW5mbxgBIAEoCzIpLmFpc2VydmVyLnYxLkdldFBsYW5JbmZvUmVzcG9uc2UuUGxhbkluZm9IAIgBARJHCgxuZXh0X3VwZ3JhZGUYAiABKAsyLC5haXNlcnZlci52MS5HZXRQbGFuSW5mb1Jlc3BvbnNlLk5leHRVcGdyYWRlSAGIAQEabAoLTmV4dFVwZ3JhZGUSDAoEdGllchgBIAEoCRIMCgRuYW1lGAIgASgJEh0KFWluY2x1ZGVkX2Ftb3VudF9jZW50cxgDIAEoBRINCgVwcmljZRgEIAEoCRITCgtkZXNjcmlwdGlvbhgFIAEoCRqvAgoIUGxhbkluZm8SEQoJcGxhbl9uYW1lGAEgASgJEh0KFWluY2x1ZGVkX2Ftb3VudF9jZW50cxgCIAEoBRISCgVwcmljZRgDIAEoCUgAiAEBEh4KEWJpbGxpbmdfY3ljbGVfZW5kGAQgASgDSAGIAQESRwoKcGxhbl9vd25lchgFIAEoDjIzLmFpc2VydmVyLnYxLkdldFBsYW5JbmZvUmVzcG9uc2UuUGxhbkluZm8uUGxhbk93bmVyIlQKCVBsYW5Pd25lchIaChZQTEFOX09XTkVSX1VOU1BFQ0lGSUVEEAASFQoRUExBTl9PV05FUl9TVFJJUEUQARIUChBQTEFOX09XTkVSX0FQUExFEAJCCAoGX3ByaWNlQhQKEl9iaWxsaW5nX2N5Y2xlX2VuZEIMCgpfcGxhbl9pbmZvQg8KDV9uZXh0X3VwZ3JhZGViBnByb3RvMw`),$e=S(M,0),et=S(M,1),tt=S(M,2),nt=S(M,3),rt=S(M,4),it=S(M,5),at=S(M,6),ot=S(M,7),st=S(M,8),ct=S(M,9),lt=S(M,10),ut=S(M,11);function dt(e){return E({kind:`permanent`,method:`GetCurrentPeriodUsage`,message:e})}function ft(e){let t=Number(e??0n);return t<=0?`Current period`:`Resets ${new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,timeZone:`UTC`}).format(new Date(t))}`}function pt(e){let t=Math.max(0,Math.min(100,e));return`${t>0&&t<1?1:Math.round(t)}%`}function mt(e){let t=Math.abs(e)/100,n=e<0?`-`:``;return t>0&&t<.01?`${n}<$0.01`:`${n}$${t.toFixed(2)}`}function N(e){return mt(e*100)}function ht(e,t,n){return e===void 0?n!==void 0&&n>0?(t??0)/n*100:0:e}function gt(e,t){let n=(e?.individualUsed??0)/100,r=e?.individualLimit,i=r===void 0?void 0:r>0?{kind:`fixed`,usedDollars:n,limitDollars:r/100}:{kind:`disabled`,usedDollars:n};return e?.limitType===`team`?i===void 0?t===void 0?(e.pooledLimit??0)>0?{kind:`unlimited`,usedDollars:n,scope:`team-member`}:{kind:`unavailable`,usedDollars:n}:t.noUsageBasedAllowed||t.hardLimit<=0?{kind:`disabled`,usedDollars:n}:{kind:`unlimited`,usedDollars:n,scope:`team-member`}:i:t===void 0?i??{kind:`unavailable`,usedDollars:n}:t.noUsageBasedAllowed?{kind:`disabled`,usedDollars:n}:t.hardLimit>=2147483647?{kind:`unlimited`,usedDollars:n,scope:`personal`}:t.hardLimit>0?{kind:`fixed`,usedDollars:n,limitDollars:t.hardLimit}:{kind:`disabled`,usedDollars:n}}function _t(e,t,n){let r=BigInt(Math.floor(n)),i=BigInt(Math.min(Number(t),Math.max(Number(e),Number(r))))-e;if(i<=0n)return[];let a=e-(t-e),o=[];for(let t=1;t<=5;t++){let n=i*BigInt(t)/BigInt(5);o.push({cycle:`current`,point:t,startDate:e,endDate:e+n},{cycle:`previous`,point:t,startDate:a,endDate:a+n})}return o}async function vt(e,t,n){let r=[],i=0,a=Array.from({length:Math.min(t,e.length)},async()=>{for(;;){let t=i;i+=1;let a=e[t];if(a===void 0)return;r[t]=await n(a)}});return await Promise.all(a),r}async function yt(e){let t={token:e.token,...e.signal===void 0?{}:{signal:e.signal},...e.request===void 0?{}:{request:e.request}},n=[],r=e=>{if(e.ok)return e.value;n.push(e.error)},[i,a,o]=await Promise.all([j(`GetCurrentPeriodUsage`,{schema:tt,message:b(tt)},nt,t),j(`GetHardLimit`,{schema:rt,message:b(rt)},it,t),j(`GetPlanInfo`,{schema:lt,message:b(lt)},ut,t)]);if(!i.ok)return E(i.error);let s=r(a),c=r(o)?.planInfo,l=e=>Re({model:e,misses:n}),u=i.value.planUsage;if(u!==void 0){let e=i.value.billingCycleEnd>0n?i.value.billingCycleEnd:c?.billingCycleEnd;return l({kind:`standard`,planName:c?.planName??`Current plan`,resetLabel:ft(e),includedTotalPercent:ht(u.totalPercentUsed,u.includedSpend,u.limit),includedAutoPercent:u.autoPercentUsed??0,includedApiPercent:u.apiPercentUsed??0,onDemand:gt(i.value.spendLimitUsage,s)})}let d=await j(`GetMe`,{schema:at,message:b(at)},ot,t);if(!d.ok)return E(d.error);if(d.value.isEnterpriseUser!==!0)return dt(`Usage details are not available for this plan.`);let{teamId:f,userId:p}=d.value;if(f===void 0||f===0||p===0)return dt(`Enterprise spend details are not available for this account.`);let m=await j(`GetMonthlyBillingCycle`,{schema:st,message:b(st)},ct,t);if(!m.ok)return E(m.error);let h=_t(m.value.startDateEpochMillis,m.value.endDateEpochMillis,e.nowMillis??Date.now()),g=Array.from({length:6}),_=Array.from({length:6});g[0]=0,_[0]=0;let y=[],ee=await vt(h,4,e=>j(`GetAggregatedUsageEvents`,{schema:$e,message:b($e,{teamId:f,userId:p,startDate:e.startDate,endDate:e.endDate})},et,t));for(let[e,t]of ee.entries()){let n=h[e];if(n===void 0)continue;let i=r(t);if(i===void 0)continue;let a=Math.max(0,i.totalCostCents)/100;v(n.cycle).with(`current`,()=>{g[n.point]=a,y=i.aggregations}).with(`previous`,()=>{_[n.point]=a}).exhaustive()}return l({kind:`spend`,planName:c?.planName??`Enterprise`,resetLabel:ft(m.value.endDateEpochMillis),currentCycle:g,previousPeriod:_,models:y})}const P=[`▁`,`▂`,`▃`,`▄`,`▅`,`▆`,`▇`,`█`];function F(e,t=28){let n=Math.min(100,Math.max(0,e)),r=Math.round(n/100*t),i=Math.min(t,n>0?Math.max(1,r):0);return`${`█`.repeat(i)}${`░`.repeat(t-i)}`}function bt(e){let t=[],n=0;for(let r of e)n=r??n,t.push(n);return t}function xt(e){return e.findLast(e=>e!==void 0)}function St(e,t,n=28){if(e.length===0)return P[0].repeat(n);let r=bt(e),i=P.length-1;return Array.from({length:n},(e,a)=>{let o=a/Math.max(n-1,1)*(r.length-1),s=Math.floor(o),c=Math.min(s+1,r.length-1),l=(r[s]??0)+((r[c]??0)-(r[s]??0))*(o-s),u=t>0?Math.max(0,Math.min(1,l/t)):0;return P[Math.round(u*i)]??P[0]}).join(``)}function Ct(e){return v(e).with({kind:`fixed`},e=>({title:`On-Demand`,bar:F(e.limitDollars>0?e.usedDollars/e.limitDollars*100:0),details:[`${N(e.usedDollars)} / ${N(e.limitDollars)}`,`${N(Math.max(e.limitDollars-e.usedDollars,0))} remaining`]})).with({kind:`unlimited`},e=>({title:`On-Demand`,bar:`·`.repeat(28),details:[N(e.usedDollars),e.scope===`team-member`?`no personal limit`:`no monthly limit`]})).with({kind:`disabled`},e=>({title:`On-Demand`,bar:`·`.repeat(28),details:[e.usedDollars>0?N(e.usedDollars):`disabled`,`on-demand usage is off`]})).with({kind:`unavailable`},e=>({title:`On-Demand`,bar:`·`.repeat(28),details:[e.usedDollars>0?N(e.usedDollars):`unavailable`,`on-demand limit unavailable`]})).exhaustive()}function wt(e){return[{title:`Included`,bar:F(e.includedTotalPercent),details:[`${pt(e.includedTotalPercent)} used`]},{title:` Auto`,bar:F(e.includedAutoPercent),details:[`${pt(e.includedAutoPercent)} used`]},{title:` API`,bar:F(e.includedApiPercent),details:[`${pt(e.includedApiPercent)} used`]},Ct(e.onDemand)]}function Tt(e){return Math.max(0,xt(e.currentCycle)??0,xt(e.previousPeriod)??0)}function Et(e){let t=e.slice(1),n=xt(t);if(n===void 0)return[`no sample answered`];let r=t.filter(e=>e===void 0).length;if(r===0)return[N(n)];let i=`${r} of ${t.length} samples missing`,a=t.at(-1)!==void 0;return[N(n),a?i:`at least — ${i}`]}function Dt(e){let t=Tt(e);return[{title:`Current cycle`,bar:St(e.currentCycle,t),details:Et(e.currentCycle)},{title:`Previous period`,bar:St(e.previousPeriod,t),details:Et(e.previousPeriod)}]}function Ot(e){let t=e.models.toSorted((e,t)=>t.totalCents-e.totalCents),n=Math.max(0,...t.map(e=>e.totalCents));return t.map(e=>({title:e.modelIntent,bar:F(n>0?e.totalCents/n*100:0),details:[mt(e.totalCents),`in ${I(e.inputTokens)}`,`out ${I(e.outputTokens)}`,`cache ${I(e.cacheReadTokens)}r/${I(e.cacheWriteTokens)}w`]}))}function I(e){let t=Number(e);return t>=1e9?`${(t/1e9).toFixed(2)}B`:t>=1e6?`${(t/1e6).toFixed(2)}M`:t>=1e3?`${(t/1e3).toFixed(2)}K`:String(e)}function L(e){return v(e.model).with({kind:`standard`},e=>[{id:`summary`,title:`Summary`,meters:wt(e)}]).with({kind:`spend`},e=>[{id:`summary`,title:`Summary`,meters:Dt(e)},...e.models.length>0?[{id:`models`,title:`Models`,meters:Ot(e)}]:[]]).exhaustive()}function kt(e){return`${e.model.planName} · ${e.model.resetLabel}`}function At(e,t=`summary`){let n=L(e),r=n.find(e=>e.id===t)??n[0],i=[kt(e)],a=r.meters.reduce((e,t)=>Math.max(e,t.title.length),0);for(let e of r.meters){let t=e.details.length===0?`no data`:e.details.join(` · `);i.push(` ● ${e.title.padEnd(a)} ${e.bar} ${t}`)}r.meters.length===0&&i.push(` no usage recorded in this period`);for(let t of e.misses)i.push(` ${t.method} failed: ${t.message}`);return i}function jt(e,t){if(t?.matches(e,`tui.select.cancel`)===!0||m(e,`escape`))return`close`;if(t?.matches(e,`tui.input.tab`)===!0||m(e,`tab`))return`next-tab`;if(e===`q`)return`close`;if(e===`r`)return`refetch`}function Mt(e){let t=e>1?[`tab switch view`]:[];return t.push(`r refresh`,`q/Esc close`),t.join(` `)}function Nt(e,t){return e.map(e=>({title:e.title,active:e.id===t}))}function Pt(e,t,n,r){let i=new Set(t.misses.map(e=>` ${e.method} failed: ${e.message}`)),a=kt(t),o=[``];for(let s of At(t,n)){let t=i.has(s)?e.fg(`error`,s):s===a?e.fg(`accent`,e.bold(s)):e.fg(`text`,s);o.push(h(` ${t}`,r))}return o}function Ft(e,t){let n=new AbortController,r;return{refresh:async()=>{if(n.signal.aborted)return;r?.abort(),r=new AbortController;let i=AbortSignal.any([n.signal,r.signal]);t({type:`loading`});let a=await e(i);i.aborted||t(v(a).with({ok:!0},e=>({type:`loaded`,usage:e.value})).with({ok:!1},e=>({type:`error`,message:`${e.error.method} failed: ${e.error.message}`})).exhaustive())},close:()=>{n.abort(),r?.abort()}}}var It=class{state={type:`loading`};loader=null;activeTabId=`summary`;theme;tui;keybindings;onClose;onRefetch;constructor(e,t,n,r,i){this.theme=e,this.tui=t,this.keybindings=n,this.onClose=r,this.onRefetch=i,this.startLoader()}setState(e){this.stopLoader(),this.state=e,v(e).with({type:`loading`},()=>{this.startLoader()}).with({type:`error`},()=>{}).with({type:`loaded`},e=>{let t=L(e.usage);t.some(e=>e.id===this.activeTabId)||(this.activeTabId=t[0].id)}).exhaustive()}handleInput(e){v(jt(e,this.keybindings)).with(`close`,()=>{this.onClose()}).with(`refetch`,()=>{this.onRefetch()}).with(`next-tab`,()=>{this.cycleTab()}).with(void 0,()=>{}).exhaustive()}render(e){let t=Math.max(20,e),n=new i(e=>this.theme.fg(`border`,e)),r=[...n.render(t)];r.push(h(` ${this.theme.fg(`accent`,this.theme.bold(`Cursor usage`))}`,t));let a=v(this.state).with({type:`loading`},()=>({tabCount:1,lines:this.loader?.render(t)??[this.theme.fg(`muted`,` Fetching usage…`)]})).with({type:`error`},e=>({tabCount:1,lines:[``,h(` ${this.theme.fg(`error`,e.message)}`,t)]})).with({type:`loaded`},e=>{let n=L(e.usage);return{tabCount:n.length,lines:[...n.length>1?[``,this.renderTabStrip(n,t)]:[],...Pt(this.theme,e.usage,this.activeTabId,t)]}}).exhaustive();return r.push(...a.lines,``),r.push(h(` ${this.theme.fg(`dim`,Mt(a.tabCount))}`,t)),r.push(...n.render(t)),r}invalidate(){}destroy(){this.stopLoader()}cycleTab(){if(this.state.type!==`loaded`)return;let e=L(this.state.usage);if(e.length<2)return;let t=e.findIndex(e=>e.id===this.activeTabId);this.activeTabId=e[(t+1)%e.length]?.id??e[0].id,this.tui.requestRender()}renderTabStrip(e,t){let n=Nt(e,this.activeTabId).map(e=>e.active?this.theme.fg(`accent`,this.theme.bold(e.title)):this.theme.fg(`dim`,e.title)).join(this.theme.fg(`dim`,` · `));return h(` ${n}`,t)}startLoader(){this.loader=new l(this.tui,e=>this.theme.fg(`accent`,e),e=>this.theme.fg(`muted`,e),`Fetching usage…`)}stopLoader(){this.loader?.stop(),this.loader=null}};const Lt=`Usage: /cursor [usage|settings|help]. No args opens the action menu.`,Rt=[{value:`usage`,label:`usage`,description:`open the Cursor usage pane`},{value:`settings`,label:`settings`,description:`configure reconciliation and diagnostics`},{value:`help`,label:`help`,description:`show command usage`}];function zt(e){let t=e.trimStart();if(/\s/u.test(t))return null;let n=Rt.filter(e=>e.value.startsWith(t));return n.length===0?null:n}function R(e,t,n){if(e.mode===`print`){e.writeOutput(`${t}\n`);return}if(e.mode===`json`){e.sendMessage({customType:`cursor-command-output`,content:t,display:!0,details:{level:n}});return}e.ui.notify(t,n)}async function Bt(e){try{let t=(await e.modelRegistry.getProviderAuth(`cursor`))?.auth.apiKey;if(t!==void 0&&t!==``)return t}catch(t){R(e,`Cursor authentication failed: ${t instanceof Error?t.message:String(t)}`,`error`);return}R(e,`Cursor is not signed in. Run /login cursor first.`,`warning`)}async function Vt(e,t){let n=await Bt(e);if(n===void 0)return;let r=t.loadUsage??yt;if(e.mode!==`tui`){let t=await r({token:n});if(!t.ok){R(e,`${t.error.method} failed: ${t.error.message}`,`error`);return}R(e,At(t.value).join(`
4
+ `),`info`);return}await e.ui.custom((e,t,i,a)=>{let o,s=new It(t,e,i,()=>{o.close(),a(null)},()=>{o.refresh()});return o=Ft(e=>r({token:n,signal:e}),t=>{s.setState(t),e.requestRender()}),o.refresh(),{render:e=>s.render(e),invalidate:()=>s.invalidate(),handleInput:e=>s.handleInput(e),dispose:()=>{o.close(),s.destroy()}}})}async function Ht(e,t,n={}){let r=t.trim().toLowerCase();if(r===``){if(e.mode!==`tui`){R(e,Lt,`info`);return}let t=await(n.openMenu??Ne)(e.ui);t!==void 0&&await Ht(e,t,n);return}if(r===`usage`){await Vt(e,n);return}if(r===`settings`){await(n.openSettings??qe)(e,(t,n)=>R(e,t,n));return}if(r===`help`){R(e,Lt,`info`);return}R(e,`Unknown /cursor subcommand: ${r}.\n${Lt}`,`error`)}function Ut(e){e.registerCommand(`cursor`,{description:`Open Cursor usage or configure reconciliation and diagnostics`,getArgumentCompletions:zt,handler:async(t,n)=>{await Ht({...n,sendMessage:e.sendMessage,writeOutput:e=>r.write(e)},t)}})}const Wt=new Set([`00:00:00:00:00:00`,`ff:ff:ff:ff:ff:ff`,`ac:de:48:00:11:22`]),Gt=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu,Kt={platform:n,arch:e,env:t,execute:e=>fe(e,{timeout:5e3}).toString(),interfaces:ve,createUuid:me};function qt(e,t,n){switch(e){case`darwin`:return`ioreg -rd1 -c IOPlatformExpertDevice`;case`win32`:return`${t===`ia32`&&Object.hasOwn(n,`PROCESSOR_ARCHITEW6432`)?`%windir%\\sysnative\\cmd.exe /c %windir%\\System32`:`%windir%\\System32`}\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`;case`linux`:return`( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :`;case`freebsd`:return`kenv -q smbios.system.uuid || sysctl -n kern.hostuuid`;default:throw Error(`Unsupported platform: ${e}`)}}function Jt(e,t){switch(e){case`darwin`:{let e=t.split(`IOPlatformUUID`)[1]?.split(`
5
+ `)[0];if(e===void 0)throw Error(`IOPlatformUUID is missing`);return e.replace(/=|\s+|"/giu,``).toLowerCase()}case`win32`:{let e=t.split(`REG_SZ`)[1];if(e===void 0)throw Error(`MachineGuid is missing`);return e.replace(/\r+|\n+|\s+/giu,``).toLowerCase()}case`linux`:case`freebsd`:return t.replace(/\r+|\n+|\s+/giu,``).toLowerCase();default:throw Error(`Unsupported platform: ${e}`)}}function Yt(e=Kt){let t=qt(e.platform,e.arch,e.env),n=Jt(e.platform,e.execute(t));return C(`sha256`).update(n,`utf8`).digest(`hex`)}function Xt(e){for(let t in e){let n=e[t];if(n!==void 0)for(let e of n){let t=e.mac.replace(/-/gu,`:`).toLowerCase();if(!Wt.has(t))return e.mac}}throw Error(`Unable to retrieve mac address (unexpected format)`)}function Zt(e=Kt){try{return C(`sha256`).update(Xt(e.interfaces()),`utf8`).digest(`hex`)}catch{return}}function Qt(e){return ie(e,`pi-cursor`,`identity.json`)}function $t(e){let t=JSON.parse(e);if(!w(t)||typeof t.machineId!=`string`||!Gt.test(t.machineId))throw Error(`Persisted Cursor fallback identity is invalid`);return t.machineId}function en(e,t){return typeof e==`object`&&!!e&&`code`in e&&e.code===t}async function tn(e,t){let n=Qt(e);try{return $t(await ge(n,`utf8`))}catch(e){if(!en(e,`ENOENT`))throw e}let r=t();if(!Gt.test(r))throw Error(`Generated Cursor fallback identity is invalid`);await he(ie(e,`pi-cursor`),{recursive:!0});try{return await _e(n,`${JSON.stringify({machineId:r})}\n`,{encoding:`utf8`,flag:`wx`,mode:384}),r}catch(e){if(!en(e,`EEXIST`))throw e;return $t(await ge(n,`utf8`))}}async function nn(e,t=Kt){let n,r;try{n=Yt(t),r=`host`}catch{n=await tn(e,t.createUuid),r=`fallback`}let i=Zt(t);return i===void 0?{machineId:n,machineIdSource:r}:{machineId:n,macMachineId:i,machineIdSource:r}}const rn=`x-cursor-client-type`,an={fetch,sleep:async(e,t)=>{await ye(e,void 0,{signal:t})},randomBytes:pe,randomUuid:me};function on(e){return Buffer.from(e).toString(`base64url`)}function sn(e=an){let t=e.randomBytes(32);if(t.byteLength!==32)throw Error(`Cursor login verifier must be 32 bytes`);let n=on(t),r=on(C(`sha256`).update(n,`utf8`).digest()),i=e.randomUuid();return{verifier:n,challenge:r,uuid:i,url:`https://cursor.com/loginDeepControl?${new URLSearchParams({challenge:r,uuid:i,mode:`login`,supportsSelectedTeamLogin:`true`,redirectTarget:`cli`}).toString()}`}}function cn(e){if(!w(e)||typeof e.accessToken!=`string`||e.accessToken===``||typeof e.refreshToken!=`string`||e.refreshToken===``)throw Error(`Cursor authentication response is missing tokens`);return{accessToken:e.accessToken,refreshToken:e.refreshToken}}function ln(e){if(!w(e)||typeof e.access_token!=`string`||e.access_token===``)throw Error(`Cursor refresh response is missing an access token`);return e.access_token}function un(e){let t=e.split(`.`)[1];if(t===void 0||t===``)throw Error(`Cursor access token is not a JWT`);let n;try{n=JSON.parse(Buffer.from(t,`base64url`).toString(`utf8`))}catch(e){throw Error(`Cursor access token has an invalid JWT payload`,{cause:e})}if(!w(n)||typeof n.exp!=`number`||!Number.isSafeInteger(n.exp))throw Error(`Cursor access token has no valid expiry`);return n.exp*1e3-3e5}function dn(){return{traceparent:`00-${pe(16).toString(`hex`)}-${pe(8).toString(`hex`)}-00`,"x-ghost-mode":`implicit-false`,"x-new-onboarding-completed":`false`,[rn]:`ide`}}var fn=class extends Error{constructor(e){super(`Cursor login denied by sign-in policy: ${e}`),this.name=`CursorSignInPolicyError`}};async function pn(e,t,n=an){let r=Date.now()+18e4;for(;!t.aborted&&Date.now()<r&&(await n.sleep(500,t),!t.aborted);)try{let r=new URL(`https://api2.cursor.sh/auth/poll`);r.search=new URLSearchParams(e).toString();let i=await n.fetch(r,{headers:dn(),signal:t});if(i.status===404)continue;if(i.status===403){let e=await i.json().catch(()=>void 0);if(w(e)&&typeof e.error==`string`)throw new fn(e.error)}if(!i.ok)throw Error(`Cursor login poll returned HTTP ${String(i.status)}`);let a=cn(await i.json());return{type:`oauth`,access:a.accessToken,refresh:a.refreshToken,expires:un(a.accessToken)}}catch(e){if(t.aborted||e instanceof fn)throw e}throw Error(`Cursor login polling timed out`)}async function mn(e,t,n=fetch){let r=new AbortController,i=setTimeout(()=>r.abort(),2e4),a=()=>r.abort();t.addEventListener(`abort`,a,{once:!0});try{let t=await n(`https://api2.cursor.sh/oauth/token`,{method:`POST`,headers:{"content-type":`application/json`,[rn]:`ide`},body:JSON.stringify({grant_type:`refresh_token`,client_id:`KbZUR41cY7W6zRSdpSUJ7I7mLYBKOCmB`,refresh_token:e.refresh}),signal:r.signal});if(!t.ok)throw Error(`Cursor token refresh returned HTTP ${String(t.status)}`);let i=await t.json();if(w(i)&&i.shouldLogout===!0)throw Error(`Cursor revoked this session; sign in again with /login cursor`);let a=ln(i);return{type:`oauth`,access:a,refresh:e.refresh,expires:un(a)}}finally{clearTimeout(i),t.removeEventListener(`abort`,a)}}function hn(e=an){return{name:`Cursor`,isSubscription:!0,loginLabel:`Sign in with Cursor`,login:async t=>{let n=sn(e);return t.notify({type:`auth_url`,url:n.url,instructions:`Complete Cursor sign-in in your browser.`}),t.notify({type:`progress`,message:`Waiting for Cursor sign-in…`}),await pn(n,t.signal,e)},refresh:async(t,n)=>await mn(t,n,e.fetch),toAuth:async e=>({apiKey:e.access})}}const z=x(`ChZhZ2VudC92MS9jYXRhbG9nLnByb3RvEghhZ2VudC52MSIRCg9UaGlua2luZ0RldGFpbHMiQgoOUmVxdWVzdGVkTW9kZWwaMAoTTW9kZWxQYXJhbWV0ZXJWYWx1ZRIKCgJpZBgBIAEoCRINCgV2YWx1ZRgCIAEoCSLwAQoMTW9kZWxEZXRhaWxzEhAKCG1vZGVsX2lkGAEgASgJEjgKEHRoaW5raW5nX2RldGFpbHMYAiABKAsyGS5hZ2VudC52MS5UaGlua2luZ0RldGFpbHNIAIgBARIYChBkaXNwbGF5X21vZGVsX2lkGAMgASgJEhQKDGRpc3BsYXlfbmFtZRgEIAEoCRIaChJkaXNwbGF5X25hbWVfc2hvcnQYBSABKAkSDwoHYWxpYXNlcxgGIAMoCRIVCghtYXhfbW9kZRgHIAEoC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S(bn,0),Sn=S(bn,1),Cn=/^(.*)-(none|minimal|low|medium|high|xhigh|extra-high|max)(-fast)?$/u,wn={none:`off`,minimal:`minimal`,low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`,"extra-high":`xhigh`,max:`max`},Tn=[`medium`,`high`,`low`,`minimal`,`xhigh`,`max`,`off`];let B;function En(e){let t;try{t=new URL(e)}catch(e){throw Error(`Cursor backend authority is invalid`,{cause:e})}if(t.protocol!==`https:`||t.username!==``||t.password!==``||t.pathname!==``&&t.pathname!==`/`||t.search!==``||t.hash!==``)throw Error(`Cursor backend authority must be an HTTPS origin`);return new URL(t.origin)}function Dn(e,t){return t===`gzip`?new Uint8Array(ue(e)):t===`br`?new Uint8Array(le(e)):e}function On(e,t,n,r){let i=En(r.backendUrl),a=se(t.schema,t.message);return new Promise((t,o)=>{if(r.signal?.aborted===!0){o(new DOMException(`Aborted`,`AbortError`));return}let s=(r.request??ce)({protocol:`https:`,host:i.hostname,port:i.port===``?443:i.port,path:`/aiserver.v1.AiService/${e}`,method:`POST`,headers:{"accept-encoding":`gzip,br`,authorization:`Bearer ${r.token}`,"connect-protocol-version":`1`,"content-type":`application/proto`,"user-agent":`connect-es/1.6.1`,"x-cursor-client-type":`cli`,"x-cursor-client-version":`cli-2026.09.02-fa0c06e-lab`,"x-ghost-mode":`false`,"x-request-id":crypto.randomUUID(),...a.length===0?{"content-length":`0`}:{}}},r=>{let i=[],a=0;r.on(`data`,e=>{if(a+=e.length,a>4194304){s.destroy(Error(`Cursor catalog response exceeded its size limit`));return}i.push(e)}),r.on(`end`,()=>{if(r.statusCode!==200){o(Error(`Cursor ${e} returned HTTP ${String(r.statusCode??0)}`));return}try{let e=Dn(Buffer.concat(i),r.headers[`content-encoding`]);t(ae(n,e))}catch(t){o(Error(`Cursor ${e} returned invalid protobuf: ${D(t)}`))}}),r.on(`error`,o)});s.on(`error`,o),s.setTimeout(1e4,()=>s.destroy(Error(`Cursor ${e} timed out`)));let c=r.signal;if(c!==void 0){let e=()=>{s.destroy(new DOMException(`Aborted`,`AbortError`))};c.addEventListener(`abort`,e,{once:!0}),s.on(`close`,()=>c.removeEventListener(`abort`,e))}a.length===0||s.write(a),s.end()})}function kn(e){let t=Cn.exec(e.modelId),n=t?.[1],r=t?.[2],i=t?.[3]===`-fast`,a=r===void 0?void 0:wn[r];return n===void 0||a===void 0?{id:e.modelId,level:`off`}:{id:`${n}${i?`-fast`:``}`,level:a}}function An(e){let t=new Map;for(let n of e){if(n.modelId===``)continue;let e=kn(n),r=t.get(e.id)??[];r.push({model:n,level:e.level}),t.set(e.id,r)}return[...t].map(([e,t])=>({id:e,members:t}))}function jn(e){return e.displayName||e.displayNameShort||e.displayModelId||e.modelId}function Mn(e,t){let n=new Set(e.members.map(({model:e})=>e.modelId));return t.find(t=>t.name===e.id||t.idAliases.includes(e.id)||t.legacySlugs.some(e=>n.has(e))||t.variants.some(e=>e.legacySlug!==void 0&&n.has(e.legacySlug)))}function Nn(e){return e===void 0?``:[e.primaryText,e.secondaryText,e.tertiaryText,e.markdownContent??``].join(`
6
+ `)}function Pn(e){if(e.supportsMaxMode!==!0)return!1;if(e.contextTokenLimitForMaxMode!==void 0&&e.contextTokenLimitForMaxMode!==e.contextTokenLimit||Nn(e.tooltipDataForMaxMode)!==Nn(e.tooltipData)||e.variants.some(e=>e.isMaxMode))return!0;let t=e.variants.find(e=>e.isDefaultNonMaxConfig===!0),n=e.variants.find(e=>e.isDefaultMaxConfig===!0);return t!==void 0&&n!==void 0&&t!==n}function Fn(e,t){return e.variants.find(e=>t?e.isDefaultMaxConfig===!0:e.isDefaultNonMaxConfig===!0)?.parameterValues.find(e=>e.id===`context`)?.value}function In(e,t){let n=t?e?.contextTokenLimitForMaxMode??e?.contextTokenLimit:e?.contextTokenLimit;return n!==void 0&&n>0?n:2e5}function Ln(e,t,n,r){let i=Tn.flatMap(t=>e.members.filter(e=>e.level===t))[0]??e.members[0];if(i===void 0)throw Error(`Cursor model family '${e.id}' is empty`);let a={};for(let t of e.members)a[t.level]=t.model.modelId;let o=Object.entries(a).some(([e,t])=>e!==`off`&&typeof t==`string`),s=n?.supportsThinking??o,c=n?.clientDisplayName===void 0||n.clientDisplayName===``?jn(i.model).replace(/ (?:None|Minimal|Low|Medium|High|Extra High|Max)(?= Fast$|$)/u,``):n.clientDisplayName,l=n===void 0?void 0:Fn(n,r),u={...r?{cursorMaxMode:!0}:{},...l===void 0?{}:{cursorContext:l}};return{id:`${e.id}${r?`-max`:``}`,name:`${c}${r?` Max`:``}`,provider:`cursor`,api:`cursor-inference`,baseUrl:t,reasoning:s,input:n?.supportsImages===!1?[`text`]:[`text`,`image`],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:In(n,r),maxTokens:64e3,...Object.keys(u).length===0?{}:{samplingParams:u},...s&&Object.keys(a).length>0?{thinkingLevelMap:a}:{}}}function Rn(e,t,n,r){if(e.models.length===0)throw Error(`Cursor AvailableModels returned no models`);let i=An(t.models).flatMap(t=>{let n=Mn(t,e.models);return[Ln(t,r,n,!1),...n!==void 0&&Pn(n)?[Ln(t,r,n,!0)]:[]]});if(i.length===0)throw Error(`Cursor GetUsableModels returned no models`);let a=n.model?.modelId;if(a!==void 0&&a!==``&&!new Set(t.models.map(({modelId:e})=>e)).has(a))throw Error(`Cursor default model '${a}' is not usable`);return i}async function zn(e){if(e.token.includes(`\r`)||e.token.includes(`
7
+ `))throw Error(`Cursor credential contains a line break`);let t=(e.now??Date.now)(),n=En(e.backendUrl).origin,r=`${n}:${await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e.token)).then(e=>Buffer.from(e).toString(`hex`))}`;if(e.force!==!0&&B?.key===r&&B.expiresAt>t)return B.models;let[i,a,o]=await Promise.all([On(`AvailableModels`,{schema:xn,message:b(xn,{useModelParameters:!0,doNotUseMarkdown:!0})},Sn,e),On(`GetUsableModels`,{schema:vn,message:b(vn)},yn,e),On(`GetDefaultModelForCli`,{schema:gn,message:b(gn)},_n,e)]),s=Rn(i,a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ElNSVQQBBIuCipJTkZFUkVOQ0VfU1RSRUFNX0VSUk9SX1RZUEVfQVVUSEVOVElDQVRJT04QBRIqCiZJTkZFUkVOQ0VfU1RSRUFNX0VSUk9SX1RZUEVfUEVSTUlTU0lPThAGEioKJklORkVSRU5DRV9TVFJFQU1fRVJST1JfVFlQRV9PVkVSTE9BREVEEAcSLgoqSU5GRVJFTkNFX1NUUkVBTV9FUlJPUl9UWVBFX0NPTlRFTlRfRklMVEVSEAgqlAEKF1J1bkluZmVyZW5jZVJvdXRpbmdSb2xlEioKJlJVTl9JTkZFUkVOQ0VfUk9VVElOR19ST0xFX1VOU1BFQ0lGSUVEEAASIwofUlVOX0lORkVSRU5DRV9ST1VUSU5HX1JPTEVfVVNFUhABEigKJFJVTl9JTkZFUkVOQ0VfUk9VVElOR19ST0xFX0FTU0lTVEFOVBACYgZwcm90bzM`,[xe]),Bn=S(V,0),Vn=S(V,3),Hn=S(V,4),H=S(V,5),Un=S(V,13),Wn=S(V,15),Gn=S(V,16),Kn=S(V,20),qn=S(V,21),Jn=S(V,26),Yn=S(V,28),Xn=S(V,33),Zn=S(V,35),Qn=S(V,36),$n=S(V,38),U=S(V,39),er=S(V,41),tr=S(V,46),nr=S(V,48),rr=S(V,50),ir=S(V,51),W={UNSPECIFIED:0,USER:1,ASSISTANT:2,TOOL:3,SYSTEM:4},ar={UNSPECIFIED:0,UNKNOWN:1,INPUT_TOKEN_LIMIT:2,OUTPUT_TOKEN_LIMIT:3,RATE_LIMIT:4,AUTHENTICATION:5,PERMISSION:6,OVERLOADED:7,CONTENT_FILTER:8},or={UNSPECIFIED:0,USER:1,ASSISTANT:2};function G(e,t){if(!Number.isSafeInteger(e)||!Number.isSafeInteger(t)||e<=0||t<=0)throw Error(`Cursor image has invalid dimensions`);return{width:e,height:t}}function sr(e){if(e===``||e.length%4!=0||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(e))throw Error(`Cursor image data is not valid base64`);let t=Buffer.from(e,`base64`);if(t.toString(`base64`)!==e)throw Error(`Cursor image data is not canonical base64`);return t}function cr(e){if(e.byteLength<24||!e.subarray(0,8).every((e,t)=>e===[137,80,78,71,13,10,26,10][t]))throw Error(`Cursor image MIME type does not match PNG bytes`);let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return G(t.getUint32(16),t.getUint32(20))}function lr(e){let t=new TextDecoder().decode(e.subarray(0,6));if(e.byteLength<10||t!==`GIF87a`&&t!==`GIF89a`)throw Error(`Cursor image MIME type does not match GIF bytes`);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);return G(n.getUint16(6,!0),n.getUint16(8,!0))}function ur(e){if(e.byteLength<26||e[0]!==66||e[1]!==77)throw Error(`Cursor image MIME type does not match BMP bytes`);let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return G(t.getInt32(18,!0),Math.abs(t.getInt32(22,!0)))}function dr(e){if(e.byteLength<4||e[0]!==255||e[1]!==216)throw Error(`Cursor image MIME type does not match JPEG bytes`);let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=2;for(;n+3<e.byteLength;){if(e[n]!==255){n+=1;continue}for(;e[n]===255;)n+=1;let r=e[n];if(n+=1,r===void 0||r===217||r===218)break;if(r===1||r>=208&&r<=215)continue;if(n+2>e.byteLength)break;let i=t.getUint16(n);if(i<2||n+i>e.byteLength)break;if(r>=192&&r<=195||r>=197&&r<=199||r>=201&&r<=203||r>=205&&r<=207){if(i<7)break;return G(t.getUint16(n+5),t.getUint16(n+3))}n+=i}throw Error(`Cursor JPEG image has no decodable dimensions`)}function fr(e,t,n){return new TextDecoder().decode(e.subarray(t,t+n))}function K(e,t){let n=e[t];if(n===void 0)throw Error(`Cursor image data is truncated`);return n}function pr(e){if(e.byteLength<30||fr(e,0,4)!==`RIFF`||fr(e,8,4)!==`WEBP`)throw Error(`Cursor image MIME type does not match WebP bytes`);let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=fr(e,12,4);if(n===`VP8X`)return G(1+K(e,24)+(K(e,25)<<8)+(K(e,26)<<16),1+K(e,27)+(K(e,28)<<8)+(K(e,29)<<16));if(n===`VP8 `){if(e[23]!==157||e[24]!==1||e[25]!==42)throw Error(`Cursor WebP VP8 frame header is malformed`);return G(t.getUint16(26,!0)&16383,t.getUint16(28,!0)&16383)}if(n===`VP8L`){if(e[20]!==47)throw Error(`Cursor WebP lossless header is malformed`);let n=t.getUint32(21,!0);return G((n&16383)+1,(n>>>14&16383)+1)}throw Error(`Cursor WebP chunk '${n}' is unsupported`)}function mr(e,t){switch(e){case`image/png`:return cr(t);case`image/jpeg`:return dr(t);case`image/gif`:return lr(t);case`image/webp`:return pr(t);case`image/bmp`:return ur(t);default:throw Error(`Cursor image MIME type '${e}' is unsupported`)}}function hr(e){if(e.mimeType!==e.mimeType.trim()||e.mimeType!==e.mimeType.toLowerCase())throw Error(`Cursor image MIME type '${e.mimeType}' is malformed`);let t=sr(e.data);return mr(e.mimeType,t),e}function q(e){if(e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`){if(typeof e==`number`&&!Number.isFinite(e))throw Error(`Cursor inference JSON contains a non-finite number`);return e}if(Array.isArray(e))return e.map(e=>q(e));if(w(e))return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>[e,q(t)]));throw Error(`Cursor inference value is not JSON-serializable`)}function gr(e){if(!w(e))return;let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=q(r));return t}function _r(e,t){let n=gr(e);if(n===void 0)throw Error(`${t} must be a JSON object`);return n}const vr=/^(.*)-(none|minimal|low|medium|high|xhigh|extra-high|max)(-fast)?$/u,yr=[`medium`,`high`,`low`,`minimal`,`xhigh`,`max`,`off`],br={"auto-smart":{modelId:`auto-smart`,parameters:[{id:`optimize_for`,value:`balanced`}]},"composer-2.5":{modelId:`composer-2.5`,parameters:[{id:`fast`,value:`false`}]},"cursor-grok-4.6-high":{modelId:`grok-4.6`,parameters:[{id:`effort`,value:`high`},{id:`fast`,value:`false`}]},"claude-opus-5-thinking-high":{modelId:`claude-opus-5`,parameters:[{id:`thinking`,value:`true`},{id:`context`,value:`300k`},{id:`effort`,value:`high`},{id:`fast`,value:`false`}]},"gemini-3.7-flash-high":{modelId:`gemini-3.7-flash`,parameters:[{id:`effort`,value:`high`}]}};function xr(e,t){let n=e.thinkingLevelMap;if(n===void 0)return e.id;if(t!==void 0&&t!==``){let e=Object.entries(n).find(([e])=>e===t)?.[1];if(typeof e==`string`&&e!==``)return e}for(let e of yr){let t=n[e];if(typeof t==`string`&&t!==``)return t}return e.id}function Sr(e){return/^(gpt-|o[1-9](?:-|$)|codex-)/u.test(e)}function Cr(e,t){if(t===void 0)return e;let n=e.filter(({id:e})=>e!==`context`);return[{id:`context`,value:t},...n]}function wr(e,t){let n=xr(e,t.reasoning),r=br[n];if(r!==void 0)return{...r,maxMode:t.maxMode,parameters:Cr(r.parameters,t.context)};let i=vr.exec(n),a=i?.[1],o=i?.[2],s=i?.[3]===`-fast`;return a===void 0||o===void 0||!Sr(a)?{modelId:n,maxMode:t.maxMode,parameters:[]}:{modelId:`${a}${s?`-fast`:``}`,maxMode:t.maxMode,parameters:[{id:`context`,value:t.context??`272k`},{id:`reasoning`,value:o},{id:`fast`,value:String(s)}]}}function Tr(e){return hr(e),b(Vn,{part:{case:`image`,value:b(Un,{data:e.data,mimeType:e.mimeType})}})}function Er(e){return b(Vn,{part:{case:`text`,value:b(Yn,{text:e})}})}function Dr(e){return typeof e==`string`?{case:`text`,value:e}:e.every(e=>e.type===`text`)?{case:`text`,value:e.map(e=>e.text).join(``)}:{case:`parts`,value:b(Hn,{parts:e.map(e=>e.type===`text`?Er(e.text):Tr(e))})}}function Or(e){let t=e.content.flatMap(e=>e.type===`text`?[e.text]:[]);return t.length===1?t[0]??``:t.map(e=>q({type:`text`,text:e}))}function kr(e){return e.content.some(e=>e.type===`image`)?e.content.map(e=>e.type===`text`?Er(e.text):Tr(e)):[]}function Ar(e){if(e.role===`user`)return b(H,{role:W.USER,content:Dr(e.content)});if(e.role===`assistant`){let t=[],n=[],r=[];for(let i of e.content)if(i.type===`text`)t.push(i.text);else if(i.type===`thinking`)n.push(b(Kn,T({isRedacted:i.redacted===!0,text:i.thinking,signature:i.redacted===!0?void 0:i.thinkingSignature,redactedData:i.redacted===!0?i.thinkingSignature:void 0,modelName:e.provider===`cursor`?e.responseModel:void 0})));else{let e=_r(i.arguments,`Cursor inference tool '${i.name}' arguments`);r.push(b(Xn,{toolCallId:i.id,toolName:i.name,args:e,rawToolCallArgs:JSON.stringify(e)}))}return b(H,T({role:W.ASSISTANT,content:t.length===0?void 0:{case:`text`,value:t.join(``)},reasoningParts:n,toolCalls:r,modelProviderMessageId:e.responseId}))}return b(H,{role:W.TOOL,content:{case:`toolContent`,value:b(Zn,{parts:[b(Qn,{toolCallId:e.toolCallId,toolName:e.toolName,result:oe(be,Or(e)),isError:e.isError,experimentalContent:kr(e)})]})}})}function jr(e){let t=_r(e.parameters,`Cursor inference tool '${e.name}' schema`);return b(Bn,{name:e.name,description:e.description,parameters:{jsonSchema:t}})}function Mr(e,t={}){let n=e.messages.map(Ar);e.systemPrompt!==void 0&&e.systemPrompt!==``&&n.unshift(b(H,{role:W.SYSTEM,content:{case:`text`,value:e.systemPrompt}}));let r=t.maxTokens===void 0&&t.temperature===void 0&&t.topP===void 0&&t.stopSequences===void 0?void 0:b(Wn,T({maxTokens:t.maxTokens,temperature:t.temperature,topP:t.topP,stopSequences:t.stopSequences===void 0?void 0:[...t.stopSequences]}));return b(Jn,T({messages:n,tools:e.tools?.map(jr)??[],modelConfig:r}))}function Nr(e){return e.role===`user`?typeof e.content==`string`?e.content:e.content.flatMap(e=>e.type===`text`?[e.text]:[]).join(``):e.role===`assistant`?e.content.flatMap(e=>e.type===`text`?[e.text]:[]).join(``):``}function Pr(e){return e.messages.flatMap(e=>{if(e.role===`toolResult`)return[];let t=Nr(e);return t===``?[]:[b(nr,{role:e.role===`user`?or.USER:or.ASSISTANT,text:t})]})}function Fr(e,t,n=!1,r){let i=wr(e,T({maxMode:n,reasoning:t,context:r}));return b(qn,{modelId:i.modelId,maxMode:i.maxMode,parameters:i.parameters.map(e=>b(Gn,e))})}function Ir(e,t,n=!1,r){let i=Fr(e,t,n,r);return JSON.stringify({modelId:i.modelId,maxMode:i.maxMode,parameters:i.parameters.map(({id:e,value:t})=>({id:e,value:t}))})}function Lr(e,t,n,r,i=!1,a){if(n===``)throw Error(`Cursor managed inference requires a stable Pi session id`);return b(rr,{conversationId:n,requestedModel:Fr(e,r,i,a),routingConversation:Pr(t),agentMode:`agent`})}function Rr(e){return e.filter(e=>e.type===`text`)}function zr(e){return e.filter(e=>e.type===`thinking`)}function Br(e){return e.filter(e=>e.type===`toolCall`)}function Vr(e){return e.map(({text:e})=>e).join(``)}function Hr(e){return e.map(({thinking:e})=>e).join(``)}function J(e){return e.thinkingSignature===void 0||e.thinkingSignature===``?void 0:e.thinkingSignature}function Y(e){return J(e)!==void 0||e.redacted===!0}function Ur(e,t){return{...e,...T({thinkingSignature:J(t)??J(e),redacted:t.redacted===!0||e.redacted===!0||void 0})}}function Wr(e){return{type:`thinking`,thinking:``,...T({thinkingSignature:J(e),redacted:e.redacted===!0||void 0})}}function Gr(e,t){return J(e)===J(t)&&e.redacted===t.redacted}function Kr(e,t){if(!Y(t))return!1;let n=Wr(t);return!e.some(e=>Gr(e,n))&&(e.push(n),!0)}function qr(e,t){if(t.some(({thinking:e})=>e.trim()!==``)){let n=t.map(e=>({...e})),r=0,i=0;for(let t of e.filter(Y)){let e=J(t),a=e===void 0?-1:n.findIndex(t=>J(t)===e);if(a<0&&t.thinking.trim()!==``&&(a=n.findIndex(e=>e.thinking===t.thinking)),a>=0){let e=n[a];e!==void 0&&(n[a]=Ur(e,t)),r+=1}else Kr(n,t)&&(i+=1)}return{blocks:n,source:`final`,mergedMetadata:r,unmatchedMetadata:i}}let n=e.map(e=>({...e})),r=[],i=0;for(let e of t.filter(Y)){let t=J(e),a=t===void 0?-1:n.findIndex(e=>J(e)===t);if(a>=0){let t=n[a];t!==void 0&&(n[a]=Ur(t,e)),i+=1}else r.push(e)}let a=n.map((e,t)=>({block:e,index:t})).filter(({block:e})=>e.thinking.trim()!==``&&!Y(e));if(r.length===1&&a.length===1){let e=a[0],t=r[0];e!==void 0&&t!==void 0&&(n[e.index]=Ur(e.block,t),i+=1,r.length=0)}let o=0;for(let e of r)Kr(n,e)&&(o+=1);return{blocks:n,source:n.some(({thinking:e})=>e.trim()!==``)?`stream`:n.length>0?`opaque-final`:`none`,mergedMetadata:i,unmatchedMetadata:o}}function X(e,t){let n=new Map;for(let r of e){if(n.has(r.id))throw Error(`Cursor ${t} response duplicated tool '${r.id}'`);n.set(r.id,r)}return n}function Jr(e,t){let n=X(e,`streamed`),r=X(t,`final`);if(n.size!==r.size)throw Error(`Cursor final response tool set disagrees with completed streamed tools`);for(let[e,t]of n){let n=r.get(e);if(n===void 0)throw Error(`Cursor final response tool set disagrees with completed streamed tools`);if(t.name!==n.name)throw Error(`Cursor final response changed the name of tool '${e}'`);if(!Se(t.arguments,n.arguments))throw Error(`Cursor final response changed the arguments of tool '${e}'`)}}function Yr(e,t,n={}){let r=n.strict??!0,i=Rr(e),a=t===void 0?[]:Rr(t),o=zr(e),s=t===void 0?[]:zr(t),c=Br(e),l=t===void 0?[]:Br(t);r&&t!==void 0&&c.length>0?Jr(c,l):(X(c,`streamed`),X(l,`final`));let u=a.length>0?`final`:i.length>0?`stream`:`none`,d=a.length>0?a:i,f=l.length>0?l:c,p=qr(o,s),m=a.length>0||l.length>0?t?.filter(e=>e.type!==`thinking`)??[]:e.filter(e=>e.type!==`thinking`),h=t===void 0?e:a.length===0&&l.length>0&&i.length>0?[...p.blocks,...d,...f]:[...p.blocks,...m],g=Vr(i),_=Vr(a),v=Hr(o),y=Hr(s),ee=c.length>0&&l.length>0?r?`exact`:`unchecked`:c.length>0?`stream-only`:l.length>0?`final-only`:`none`;return{content:h,summary:{responseInfo:t!==void 0,strict:r,text:{streamedBlocks:i.length,finalBlocks:a.length,streamedCharacters:g.length,finalCharacters:_.length,exact:i.length>0&&a.length>0?g===_:null,source:u},reasoning:{streamedBlocks:o.length,finalBlocks:s.length,streamedCharacters:v.length,finalCharacters:y.length,exact:o.some(({thinking:e})=>e.trim()!==``)&&s.some(({thinking:e})=>e.trim()!==``)?v===y:null,source:p.source,mergedMetadata:p.mergedMetadata,unmatchedMetadata:p.unmatchedMetadata},tools:{streamed:c.length,final:l.length,status:ee}}}}function Z(e,t){if(e===``)return t?{}:void 0;let n;try{n=t?JSON.parse(e):Ee(e)}catch{return}if(typeof n==`object`&&n&&!Array.isArray(n))return Object.fromEntries(Object.entries(n))}function Xr(e){if(e.args!==void 0)return Object.fromEntries(Object.entries(e.args));if(e.rawToolCallArgs===void 0||e.rawToolCallArgs===``)return{};let t;try{t=JSON.parse(e.rawToolCallArgs)}catch(t){throw Error(`Cursor final tool call '${e.toolCallId}' has invalid raw arguments`,{cause:t})}if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`Cursor final tool call '${e.toolCallId}' arguments are not an object`);return Object.fromEntries(Object.entries(t))}function Zr(e){return{tokenLogprobs:e.tokenLogprobs.map(({values:e})=>e),tokenIds:e.tokenIds.map(({values:e})=>e.map(Number)),promptTokenIds:e.promptTokenIds.map(({values:e})=>e.map(Number)),extraTokens:e.extraTokens.map(({values:e})=>e.map(Number)),extraLogprobs:e.extraLogprobs.map(({values:e})=>e),routingMatrix:e.routingMatrix.map(({values:e})=>e.map(e=>e===``?null:e))}}function Qr(e){return T({messageIndex:e.messageIndex,partIndex:e.partIndex,expContentIndex:e.expContentIndex,description:e.description})}function $r(e){return v(e).with(W.USER,()=>`user`).with(W.ASSISTANT,()=>`assistant`).with(W.TOOL,()=>`tool`).with(W.SYSTEM,()=>`system`).with(W.UNSPECIFIED,()=>`unspecified`).otherwise(e=>`unknown-${String(e)}`)}function ei(e){let t=e.message===``?e.code||`Cursor inference failed`:e.message;return e.isInputTokenLimitError||e.errorType===ar.INPUT_TOKEN_LIMIT?`context_length_exceeded: ${t}`:t}var ti=class{#e;#t;#n;#r;#i;#a;#o;#s=new Map;#c=new Set;#l=new Map;#u;#d;#f;#p=[];#m;constructor(e,t,n,r,i){this.#e=e,this.#t=t,this.#n=n,this.#r=r,this.#i=i}handle(e){if(e.message.case!==`invocationResponse`)throw Error(`Cursor mapper received outer arm '${e.message.case??`<unset>`}'`);let t=e.message.value.response;if(t===void 0)throw Error(`Cursor invocation response has no payload`);this.#h(t)}#h(e){let t=e.response.case;this.#l.set(t,(this.#l.get(t)??0)+1),v(e.response).with({case:`thinkingPart`},({value:e})=>{e.text!==``&&this.#_(e.text,e.signature),e.isFinal&&this.#S()}).with({case:`textPart`},({value:e})=>{e.text!==``&&this.#v(e.text),e.isFinal&&this.#x()}).with({case:`toolCallPart`},({value:e})=>this.#y(e)).with({case:`extendedUsage`},({value:e})=>{this.#t.usage.input=e.inputTokens,this.#t.usage.output=e.outputTokens,this.#t.usage.cacheRead=e.cacheReadTokens,this.#t.usage.cacheWrite=e.cacheWriteTokens,this.#b()}).with({case:`usage`},({value:e})=>{this.#l.has(`extendedUsage`)||(this.#t.usage.input=e.promptTokens,this.#t.usage.output=e.completionTokens,this.#t.usage.cacheRead=0,this.#t.usage.cacheWrite=0,this.#b())}).with({case:`responseInfo`},({value:e})=>{e.errorMessage!==void 0&&e.errorMessage!==``&&(this.#u={message:e.errorMessage,outputLimit:!1}),e.id!==``&&(this.#t.responseId=e.id),e.model!==``&&(this.#t.responseModel=e.model);let t=Number(e.createdAt);Number.isSafeInteger(t)&&t>0&&(this.#t.timestamp=t),this.#g(e)}).with({case:`error`},({value:e})=>{this.#u={message:ei(e),outputLimit:e.isOutputTokenLimitError||e.errorType===ar.OUTPUT_TOKEN_LIMIT}}).with({case:`invocationId`},({value:e})=>{if(e.invocationId!==this.#r)throw Error(`Cursor nested invocation identity disagrees with its outer envelope`)}).with({case:`providerMetadata`},({value:e})=>{this.#f=e.metadata}).with({case:`imageDescriptions`},({value:e})=>{this.#p.push(...e.descriptions.map(Qr))}).with({case:void 0},()=>{throw Error(`Cursor inference response has no arm`)}).exhaustive()}#g(e){let t=[],n={};for(let r of e.messages){let e=$r(r.role);if(n[e]=(n[e]??0)+1,r.role!==W.TOOL){for(let e of r.reasoningParts){let n=e.isRedacted?e.redactedData:e.signature;t.push(T({type:`thinking`,thinking:e.text,thinkingSignature:n,redacted:e.isRedacted?!0:void 0}))}r.content!==void 0&&r.content.trim()!==``&&t.push({type:`text`,text:r.content});for(let e of r.toolCalls){if(e.toolCallId===``||e.toolName===``)throw Error(`Cursor final response contains an unnamed tool call`);if(!this.#n.has(e.toolName))throw Error(`Cursor final response called unadvertised tool '${e.toolName}'`);t.push({type:`toolCall`,id:e.toolCallId,name:e.toolName,arguments:Xr(e)})}}}this.#d=t,this.#m=T({createdAt:e.createdAt.toString(),supportsSelfSummary:e.supportsSelfSummary,roleCounts:n,inferenceExtraData:e.inferenceExtraData===void 0?void 0:Zr(e.inferenceExtraData)})}#_(e,t){if(this.#x(),this.#o===void 0){let e={type:`thinking`,thinking:``,...T({thinkingSignature:t})};this.#t.content.push(e),this.#o={index:this.#t.content.length-1,block:e},this.#e.push({type:`thinking_start`,contentIndex:this.#o.index,partial:this.#t})}else if(t!==void 0&&this.#o.block.thinkingSignature!==void 0&&this.#o.block.thinkingSignature!==t)throw Error(`Cursor thinking signature changed within one block`);else t!==void 0&&(this.#o.block.thinkingSignature=t);this.#o.block.thinking+=e,this.#e.push({type:`thinking_delta`,contentIndex:this.#o.index,delta:e,partial:this.#t})}#v(e){if(this.#S(),this.#a===void 0){let e={type:`text`,text:``};this.#t.content.push(e),this.#a={index:this.#t.content.length-1,block:e},this.#e.push({type:`text_start`,contentIndex:this.#a.index,partial:this.#t})}this.#a.block.text+=e,this.#e.push({type:`text_delta`,contentIndex:this.#a.index,delta:e,partial:this.#t})}#y(e){if(e.toolCallId===``)throw Error(`Cursor tool call has no id`);if(this.#c.has(e.toolCallId))throw Error(`Cursor tool call '${e.toolCallId}' continued after completion`);let t=this.#s.get(e.toolCallId);if(t===void 0){if(e.toolName===``)throw Error(`Cursor tool call starts without a name`);if(!this.#n.has(e.toolName))throw Error(`Cursor called unadvertised tool '${e.toolName}'`);this.#x(),this.#S();let n={type:`toolCall`,id:e.toolCallId,name:e.toolName,arguments:{}};this.#t.content.push(n),t={index:this.#t.content.length-1,block:n,name:e.toolName,json:``,complete:!1,toolIndex:e.toolIndex},this.#s.set(e.toolCallId,t),this.#e.push({type:`toolcall_start`,contentIndex:t.index,partial:this.#t})}if(e.toolName!==``&&e.toolName!==t.name)throw Error(`Cursor tool call '${e.toolCallId}' changed name`);if(!e.isComplete){if(e.args===``)return;t.json+=e.args;let n=Z(t.json,!1);n!==void 0&&(t.block.arguments=n),this.#e.push({type:`toolcall_delta`,contentIndex:t.index,delta:e.args,partial:this.#t});return}let n=Z(e.args,!0);if(n===void 0)throw Error(`Cursor tool call '${e.toolCallId}' completed with invalid JSON arguments`);let r=Z(t.json,!0);if(t.json!==``&&(r===void 0||!Se(r,n)))throw Error(`Cursor tool call '${e.toolCallId}' argument stream disagrees with completion`);t.block.arguments=n,t.complete=!0,this.#e.push({type:`toolcall_end`,contentIndex:t.index,toolCall:t.block,partial:this.#t}),this.#s.delete(e.toolCallId),this.#c.add(e.toolCallId)}#b(){this.#t.usage.totalTokens=this.#t.usage.input+this.#t.usage.output+this.#t.usage.cacheRead+this.#t.usage.cacheWrite}#x(){this.#a!==void 0&&(this.#e.push({type:`text_end`,contentIndex:this.#a.index,content:this.#a.block.text,partial:this.#t}),this.#a=void 0)}#S(){this.#o!==void 0&&(this.#e.push({type:`thinking_end`,contentIndex:this.#o.index,content:this.#o.block.thinking,partial:this.#t}),this.#o=void 0)}finish(){if(this.#x(),this.#S(),this.#s.size>0)throw Error(`Cursor invocation ended with incomplete tool calls`);let e=Yr(this.#t.content,this.#d,{strict:this.#i.strictReconciliation});this.#t.content.splice(0,this.#t.content.length,...e.content);let t=this.#t.content.filter(({type:e})=>e===`toolCall`);if(this.#i.strictReconciliation&&this.#c.size>0&&t.length===0)throw Error(`Cursor toolUse completed without a finalized tool call`);if(this.#i.diagnostics){let t={arms:Object.fromEntries(this.#l),reconciliation:e.summary};this.#f!==void 0&&(t.providerMetadata=this.#f),this.#p.length>0&&(t.imageDescriptions=this.#p),this.#m!==void 0&&(t.responseInfo=this.#m),this.#t.diagnostics=[...this.#t.diagnostics??[],{type:`cursor-inference-response`,timestamp:Date.now(),details:t}]}return this.#u===void 0?{stopReason:t.length>0?`toolUse`:`stop`}:this.#u.outputLimit&&this.#t.content.length>0?{stopReason:`length`}:{stopReason:`error`,errorMessage:this.#u.message}}};function ni(e){return{role:`assistant`,content:[],api:e.api,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`pending`,timestamp:Date.now()}}function ri(e){return e instanceof Error?e.message:String(e)}function ii(e,t){let n=t?.samplingParams?.cursorMaxMode??e.samplingParams?.cursorMaxMode;return v(n).with(void 0,()=>!1).with(_.boolean,e=>e).otherwise(()=>{throw Error(`Cursor sampling parameter cursorMaxMode must be a boolean`)})}function ai(e,t){let n=t?.samplingParams?.cursorContext??e.samplingParams?.cursorContext;return v(n).with(void 0,()=>void 0).with(_.string,e=>e).otherwise(()=>{throw Error(`Cursor sampling parameter cursorContext must be a string`)})}function oi(e,t){return v(e).with(void 0,()=>void 0).with(_.when(e=>typeof e==`number`&&Number.isFinite(e)),e=>e).otherwise(()=>{throw Error(`Cursor sampling parameter ${t} must be a finite number`)})}function si(e,t){return v(e).with(void 0,()=>void 0).with(_.array(_.string),e=>e).otherwise(()=>{throw Error(`Cursor sampling parameter ${t} must be an array of strings`)})}function ci(e,t,n,r){let i=we(),a=ni(e),o=n.settings??A();return(async()=>{try{if(i.push({type:`start`,partial:a}),r?.apiKey===void 0||r.apiKey===``)throw Error(`Cursor credential is unavailable`);let s=r.sessionId;if(s===void 0||s===``)throw Error(`Cursor managed inference requires SimpleStreamOptions.sessionId`);let c=(n.createInvocationId??(()=>crypto.randomUUID()))(),l=typeof r.reasoning==`string`?r.reasoning:void 0,u=ii(e,r),d=ai(e,r),f=Mr(t,T({maxTokens:r.maxTokens,temperature:r.temperature,topP:oi(r.samplingParams?.topP,`topP`),stopSequences:si(r.samplingParams?.stopSequences,`stopSequences`)})),p=b(U,{message:{case:`runRequest`,value:Lr(e,t,s,l,u,d)}}),m=new ti(i,a,new Set(t.tools?.map(({name:e})=>e)??[]),c,o);await(typeof n.runtime==`function`?await n.runtime(r.apiKey):n.runtime).invoke(s,Ir(e,l,u,d),p,c,f,T({signal:r.signal,onResponse:e=>m.handle(e)}));let h=m.finish();if(a.stopReason=h.stopReason,h.errorMessage!==void 0&&(a.errorMessage=h.errorMessage),Ce(e,a.usage),a.stopReason===`error`)i.push({type:`error`,reason:`error`,error:a});else if(a.stopReason===`stop`||a.stopReason===`toolUse`||a.stopReason===`length`||a.stopReason===`deferred`)i.push({type:`done`,reason:a.stopReason,message:a});else throw Error(`Cursor mapper returned invalid terminal '${a.stopReason}'`);i.end()}catch(e){a.stopReason=r?.signal?.aborted===!0?`aborted`:`error`,a.errorMessage=ri(e),i.push({type:`error`,reason:a.stopReason,error:a}),i.end()}})(),i}function li(e,t=0){let n=new Uint8Array(5+e.length),r=new DataView(n.buffer);return r.setUint8(0,t),r.setUint32(1,e.length,!1),n.set(e,5),n}var ui=class{#e=new Uint8Array;#t=0;#n=0;get#r(){return this.#n-this.#t}#i(e){if(this.#n+e<=this.#e.length)return;let t=this.#r+e;if(t<=this.#e.length)this.#e.copyWithin(0,this.#t,this.#n);else{let e=Math.max(this.#e.length*2,65536);for(;e<t;)e*=2;let n=new Uint8Array(e);n.set(this.#e.subarray(this.#t,this.#n)),this.#e=n}this.#n=this.#r,this.#t=0}push(e){e.length>0&&(this.#i(e.length),this.#e.set(e,this.#n),this.#n+=e.length);let t=[];for(;!(this.#r<5);){let e=new DataView(this.#e.buffer,this.#e.byteOffset+this.#t,5),n=e.getUint8(0),r=e.getUint32(1,!1);if(r>16777216)throw Error(`Connect frame length ${String(r)} exceeds the 16777216 byte cap`);if(this.#r<5+r)break;let i=this.#t+5,a=this.#e.slice(i,i+r);this.#t=i+r;let o=!!(n&1);t.push({body:o?ue(a,{maxOutputLength:16777216}):a,compressed:o,endOfStream:!!(n&2)})}return this.#t===this.#n&&(this.#t=0,this.#n=0),t}end(){if(this.#r>0)throw Error(`Connect stream ended mid-frame with ${String(this.#r)} trailing bytes`)}get pending(){return this.#r}};const di=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;function Q(e,t){if(t.includes(`\r`)||t.includes(`
8
+ `))throw Error(`${e} contains a line break`)}function fi(e,t=Date.now()){let n=Math.floor(t/1e6),r=new Uint8Array([n>>40&255,n>>32&255,n>>24&255,n>>16&255,n>>8&255,n&255]),i=165;for(let e=0;e<r.length;e+=1){let t=r[e];if(t===void 0)throw Error(`Cursor checksum input is incomplete`);r[e]=(t^i)+e%256&255,i=r[e]??i}let a=Oe.from(r).toString(`base64`);return e.macMachineId===void 0?`${a}${e.machineId}`:`${a}${e.machineId}/${e.macMachineId}`}function pi(t){Q(`Cursor credential`,t.token),Q(`Cursor request id`,t.requestId),Q(`Cursor client key`,t.clientKey);let r=t.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone;if(Q(`Cursor timezone`,r),!/^[0-9a-f]{64}$/u.test(t.clientKey))throw Error(`Cursor client key must be 32-byte lowercase hex`);if(!di.test(t.requestId))throw Error(`Cursor request id must be a UUID`);return{":method":`POST`,":path":`/aiserver.v1.InferenceService/RunInference`,authorization:`Bearer ${t.token}`,cookie:`CursorCookie=Cookie-${t.token.slice(0,15)}`,"connect-accept-encoding":`gzip`,"connect-content-encoding":`gzip`,"connect-protocol-version":`1`,"content-type":`application/connect+proto`,"user-agent":`connect-es/1.6.1`,"x-amzn-trace-id":`Root=${t.requestId}`,"x-client-key":t.clientKey,"x-cursor-checksum":fi(t.identity,t.nowMs),"x-cursor-client-arch":t.arch??e,"x-cursor-client-commit":`2ba48ff3f7514cc4643c52ca9f7b3173d9b66130`,"x-cursor-client-device-type":`desktop`,"x-cursor-client-os":t.platform??n,"x-cursor-client-type":`ide`,"x-cursor-client-version":`3.18.9`,"x-cursor-streaming":`true`,"x-cursor-timezone":r,"x-ghost-mode":String(t.ghostMode),"x-new-onboarding-completed":`false`,"x-request-id":t.requestId}}const mi=2e3;function hi(e){return Buffer.from(crypto.getRandomValues(new Uint8Array(e))).toString(`hex`)}function gi(e){let t;try{t=new URL(e)}catch(e){throw Error(`Cursor backend authority is invalid`,{cause:e})}if(t.protocol!==`https:`||t.username!==``||t.password!==``||t.pathname!==``&&t.pathname!==`/`||t.search!==``||t.hash!==``)throw Error(`Cursor backend authority must be an HTTPS origin`);return new URL(t.origin)}function _i(e){let t=se(U,e);if(t.byteLength>16777216)throw Error(`Cursor RunInference client message exceeds the Connect frame limit`);return t.byteLength<1024?li(t):li(de(t),1)}function vi(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch(e){throw Error(`Cursor returned an invalid Connect end-of-stream trailer`,{cause:e})}if(!w(t))throw Error(`Cursor returned an invalid Connect end-of-stream trailer`);if(t.error===void 0)return{};if(!w(t.error)||typeof t.error.code!=`string`)throw Error(`Cursor returned an invalid Connect error trailer`);let n=t.error.code.trim(),r=t.error.message;if(n===``||r!==void 0&&typeof r!=`string`)throw Error(`Cursor returned an invalid Connect error trailer`);return{error:T({code:n,message:r})}}function yi(e){return e.message.trim()===``?`Cursor invocation error ${String(e.code)}`:e.message}function bi(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>i(Error(`${n} timed out`)),t);e.then(e=>(clearTimeout(a),r(e)),e=>(clearTimeout(a),i(e)))})}var xi=class{routeKey;ready;completion;#e;#t=new Map;#n=new Set;#r;#i;#a;#o;#s;#c=Promise.resolve();#l=Promise.resolve();#u=0;#d=0;#f;#p;#m;#h=new Set;constructor(e,t,n,r){this.routeKey=t,this.#r=r.responseTimeoutMs??65e3;let i,a;this.ready=new Promise((e,t)=>{i=e,a=t}),this.ready.catch(()=>void 0),this.#i=i,this.#a=a;let o,s;this.completion=new Promise((e,t)=>{o=e,s=t}),this.completion.catch(()=>void 0),this.#o=o,this.#s=s,this.#e=e.request(n),this.#g()}#g(){let e=new ui,t=0;this.#e.on(`response`,e=>{if(t=Number(e[`:status`]??0),t!==200){this.#v(Error(`Cursor RunInference returned HTTP ${String(t)}`));return}(e[`content-type`]??``).startsWith(`application/connect+proto`)||this.#v(Error(`Cursor RunInference returned an invalid content type`))}),this.#e.on(`data`,t=>{try{for(let n of e.push(t)){if(this.#p!==void 0)throw Error(`Cursor sent data after the Connect trailer`);if(n.endOfStream){if(this.#p=vi(n.body),this.#p.error!==void 0)throw Error(`Cursor RunInference failed: ${this.#p.error.code}${this.#p.error.message===void 0?``:` — ${this.#p.error.message}`}`);continue}let e=ae(ir,n.body);if(this.#u+=1,this.#d+=n.body.byteLength,this.#u>512||this.#d>8388608)throw Error(`Cursor RunInference response delivery exceeded its bound`);this.#l=this.#l.then(async()=>{try{await this.#_(e);return}finally{--this.#u,this.#d-=n.body.byteLength}}),this.#l.catch(e=>{this.#v(e)})}}catch(e){this.#v(e)}}),this.#e.on(`error`,e=>this.#v(e)),this.#e.on(`aborted`,()=>this.#v(Error(`Cursor RunInference stream aborted`))),this.#e.on(`end`,()=>{try{e.end()}catch(e){this.#v(e);return}this.#l.then(()=>{if(this.#m===void 0&&t===200){if(this.#p===void 0){this.#v(Error(`Cursor RunInference ended without a Connect trailer`));return}if(this.#t.size>0){this.#v(Error(`Cursor RunInference ended with pending invocations`));return}this.#o({trailer:this.#p})}})})}async#_(e){switch(e.message.case){case`heartbeat`:return;case`runReady`:if(this.#f!==void 0)throw Error(`Cursor sent duplicate runReady`);if(e.message.value.resolvedModel===void 0||e.message.value.resolvedModel.modelId===``)throw Error(`Cursor runReady has no resolved model`);this.#f=e.message.value,this.#i(e.message.value);return;case`invocationResponse`:{let{invocationId:t}=e.message.value;if(this.#n.has(t))return;let n=this.#t.get(t);if(n===void 0)throw Error(`Cursor response has unknown invocation '${t}'`);n.delivery=n.delivery.then(async()=>await n.onResponse(e)),await n.delivery;return}case`invocationEnd`:{let t=e.message.value;if(this.#n.delete(t.invocationId))return;let n=this.#t.get(t.invocationId);if(n===void 0)throw Error(`Cursor ended unknown invocation '${t.invocationId}'`);this.#t.delete(t.invocationId),n.signal?.removeEventListener(`abort`,n.abort),await n.delivery,t.error===void 0?n.resolve({invocationId:t.invocationId,end:t}):n.reject(Error(`Cursor invocation failed: ${yi(t.error)}`));return}case void 0:throw Error(`Cursor RunInference server message has no arm`)}}#v(e){if(this.#m===void 0){this.#m=e,this.#a(e);for(let t of this.#t.values())t.signal?.removeEventListener(`abort`,t.abort),t.reject(e);this.#t.clear(),this.#s(e),this.#e.destroy(e instanceof Error?e:Error(String(e)))}}async send(e){if(this.#m!==void 0)throw this.#m;let t=_i(e);this.#c=this.#c.then(async()=>await new Promise((e,n)=>{this.#e.write(t,t=>{t==null?e():n(t)})})),await this.#c}async waitUntilReady(){return await bi(this.ready,this.#r,`Cursor runReady`)}abort(e){this.#v(e)}async invoke(e,t,n){if(this.#h.has(`finishing`))throw Error(`Cursor RunInference run is finishing`);if(await this.waitUntilReady(),this.#t.size>=64)throw Error(`Cursor RunInference has too many pending invocations`);if(this.#t.has(e)||this.#n.has(e))throw Error(`Cursor invocation '${e}' already exists`);let r,i,a=new Promise((e,t)=>{r=e,i=t}),o=()=>{this.#t.get(e)!==void 0&&(this.#t.delete(e),this.#n.add(e),this.send(b(U,{message:{case:`cancelInvocation`,value:b($n,{invocationId:e})}})).then(()=>i(new DOMException(`Aborted`,`AbortError`)),e=>{i(e),this.#v(e)}))};if(this.#t.set(e,{onResponse:n.onResponse,resolve:r,reject:i,signal:n.signal,abort:o,delivery:Promise.resolve()}),n.signal?.aborted===!0?o():n.signal?.addEventListener(`abort`,o,{once:!0}),this.#n.has(e))return await a;try{await this.send(b(U,{message:{case:`invokeModel`,value:b(tr,{invocationId:e,request:t})}}))}catch(t){this.#t.delete(e),n.signal?.removeEventListener(`abort`,o),i(t)}return await a}async finish(e){if(this.#h.has(`finishing`)){await bi(this.completion,e,`Cursor RunInference shutdown`);return}this.#h.add(`finishing`);for(let[e,t]of this.#t)this.#t.delete(e),this.#n.add(e),t.signal?.removeEventListener(`abort`,t.abort),t.reject(Error(`Cursor RunInference closed before invocation completed`)),await this.send(b(U,{message:{case:`cancelInvocation`,value:b($n,{invocationId:e})}}));await this.send(b(U,{message:{case:`finishRun`,value:b(er)}})),this.#e.end(),await bi(this.completion,e,`Cursor RunInference shutdown`)}},Si=class{#e;#t;#n;#r=new Map;#i=new Map;#a;#o;#s=new Set;constructor(e){if(this.#t=gi(e.backendUrl),this.#e=e,this.#n=(e.createClientKey??(()=>hi(32)))(),!/^[0-9a-f]{64}$/u.test(this.#n))throw Error(`Cursor client key must be 32-byte lowercase hex`)}async#c(){if(this.#s.has(`closed`))throw Error(`Cursor managed-inference runtime is shut down`);return this.#a!==void 0&&!this.#a.destroyed&&!this.#a.closed?this.#a:(this.#o??=Promise.resolve((this.#e.connect??(e=>De(e)))(this.#t.origin)).catch(e=>{throw this.#o=void 0,e}).then(e=>(this.#a=e,this.#o=void 0,e.once(`goaway`,()=>{this.#a===e&&(this.#a=void 0)}),e.on(`error`,()=>{this.#a===e&&(this.#a=void 0)}),e.once(`close`,()=>{this.#a===e&&(this.#a=void 0)}),e)),await this.#o)}async#l(e,t){let n=(this.#e.createRequestId??(()=>crypto.randomUUID()))(),r=pi({token:this.#e.token,ghostMode:this.#e.ghostMode,identity:this.#e.identity,requestId:n,clientKey:this.#n,nowMs:(this.#e.now??Date.now)(),timezone:(this.#e.timezone??(()=>Intl.DateTimeFormat().resolvedOptions().timeZone))()}),i=new xi(await this.#c(),e,r,this.#e);try{return await i.send(t),await i.waitUntilReady(),i}catch(e){throw i.abort(e),e}}async runFor(e,t,n){if(e===``)throw Error(`Cursor managed inference requires a stable Pi session id`);let r=this.#i.get(e)??Promise.resolve(),i,a=new Promise(e=>{i=e}),o=r.then(async()=>await a);this.#i.set(e,o),await r;try{let r=this.#r.get(e);if(r?.routeKey===t)return r.run;r!==void 0&&(this.#r.delete(e),await r.run.finish(this.#e.shutdownTimeoutMs??mi));let i=await this.#l(t,n);this.#r.set(e,{routeKey:t,run:i});let a=()=>{this.#r.get(e)?.run===i&&this.#r.delete(e)};return i.completion.then(a,a),i}finally{i(),this.#i.get(e)===o&&this.#i.delete(e)}}async invoke(e,t,n,r,i,a){return await(await this.runFor(e,t,n)).invoke(r,i,a)}async finishSession(e){let t=this.#r.get(e);t!==void 0&&(this.#r.delete(e),await t.run.finish(this.#e.shutdownTimeoutMs??mi))}async shutdown(){if(this.#s.has(`closed`))return;this.#s.add(`closed`);let e=[...this.#r.values()];this.#r.clear(),await Promise.allSettled(e.map(async({run:e})=>await e.finish(this.#e.shutdownTimeoutMs??mi))),this.#a?.destroy(),this.#a=void 0}};const Ci=`https://api2.cursor.sh`,$=`PI_CURSOR_TOKEN`;function wi(e){return e?.type===`oauth`?e.access:e?.type===`api_key`?e.key:process.env[$]}function Ti(e){return C(`sha256`).update(e,`utf8`).digest(`hex`)}const Ei={discoverModels:zn};function Di(e,t=Ei){let n,r=[],i=async t=>{let r=Ti(t);if(n?.digest===r)return n.runtime;await n?.runtime.shutdown();let i=new Si({backendUrl:Ci,token:t,ghostMode:!1,identity:e});return n={digest:r,runtime:i},i},a=(e,t,n)=>ci(e,t,{runtime:i},n),o=async e=>{if(!e.allowNetwork||e.signal.aborted)return;let n=wi(e.credential);if(n===void 0||n===``)throw Error(`Cursor credential is unavailable`);try{let i=await t.discoverModels({backendUrl:Ci,token:n,signal:e.signal,...e.force===void 0?{}:{force:e.force}});if(e.signal.aborted)return;await e.publish({persist:{models:i,checkedAt:Date.now()},update:()=>{r=i}})}catch(t){throw e.signal.aborted||await e.publish({persist:null,update:()=>{r=[]}}),t}};return{provider:{...Te({id:`cursor`,name:`Cursor`,baseUrl:Ci,auth:{apiKey:{name:$,check:async({ctx:e,signal:t})=>(t.throwIfAborted(),await e.env($)===void 0?void 0:{type:`api_key`,source:$}),resolve:async({ctx:e,credential:t,signal:n})=>{n.throwIfAborted();let r=t?.key??await e.env($);return r===void 0||r===``?void 0:{auth:{apiKey:r},source:$}}},oauth:hn()},models:[],api:{stream:a,streamSimple:a}}),getModels:()=>r,refreshModels:o},shutdown:async()=>{await n?.runtime.shutdown(),n=void 0}}}async function Oi(e){let t=He(),n=await nn(a()),r=Di(n);e.registerProvider(r.provider),Ut(e),(n.machineIdSource===`fallback`||t.warning!==void 0)&&e.on(`session_start`,(e,r)=>{n.machineIdSource===`fallback`&&r.ui.notify(`Cursor could not derive the host machine id; using a persisted fallback identity.`,`warning`),t.warning!==void 0&&r.ui.notify(t.warning,`warning`)}),e.on(`session_shutdown`,async()=>{await r.shutdown()})}export{Oi as default};
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1200" height="240" viewBox="0 0 1200 240" role="img" aria-label="pi-cursor — /cursor in Pi · unofficial routed Cursor inference">
2
+ <rect width="1200" height="240" rx="24" fill="#101317"/>
3
+ <rect x="0.75" y="0.75" width="1198.5" height="238.5" rx="23.25" fill="none" stroke="#23272c" stroke-width="1.5"/>
4
+ <rect x="56" y="64" width="112" height="112" rx="21" fill="#ecedef"/>
5
+ <path d="M71.75 79.75h47.25v22.75h-47.25zM105 137.5h47.25v22.75h-47.25zM71.75 113h22.75v47.25h-22.75z" fill="#101317"/>
6
+ <path d="M129.5 79.75h22.75v47.25h-22.75z" fill="#c21e86"/>
7
+ <path d="M212.4 132H222.6V118.44C224.64 122.16 227.58 123.72 232.08 123.72C239.94 123.72 244.2 116.7 244.2 106.8C244.2 96.9 239.94 89.88 232.08 89.88C227.34 89.88 224.4 92.1 222.6 96L222.36 90.6H212.4ZM228.24 114.96C225.12 114.96 222.6 112.56 222.6 106.8C222.6 101.04 225.12 98.64 228.24 98.64C231.72 98.64 233.64 100.8 233.64 106.8C233.64 112.8 231.72 114.96 228.24 114.96ZM257.94 87.36H268.14V79.44H257.94ZM246.6 123H277.8V115.2H268.2V90.6H247.2V98.4H258V115.2H246.6ZM282.6 110.04H305.4V100.92H282.6ZM327.36 123.72C335.4 123.72 341.82 118.38 342.72 110.4L332.76 109.92C332.1 113.16 330.24 114.96 327.48 114.96C323.94 114.96 321.84 111.84 321.84 106.8C321.84 101.76 323.94 98.64 327.48 98.64C330.18 98.64 332.04 100.38 332.76 103.56L342.72 103.08C341.82 95.22 335.28 89.88 327.36 89.88C317.94 89.88 311.28 96.84 311.28 106.8C311.28 116.76 317.94 123.72 327.36 123.72ZM355.2 123.72C359.82 123.72 363.12 121.44 364.68 117.24L364.86 123H374.16V90.6H363.96V109.08C363.96 113.28 361.74 115.2 359.58 115.2C357.3 115.2 356.04 113.76 356.04 109.56V90.6H345.84V112.08C345.84 119.88 349.32 123.72 355.2 123.72ZM378.6 123H405.72V115.2H396.12V105C396.12 100.68 398.04 98.64 402.48 98.64H409.2V90.6H401.52C396.96 90.6 394.62 92.82 393.66 96.9L393.12 90.6H378.6V98.4H385.92V115.2H378.6ZM426.12 123.72C435.96 123.72 440.76 119.88 440.76 113.64C440.76 108.12 438.06 105.96 429.12 103.92C423.36 102.6 422.28 101.88 422.28 100.32C422.28 99.3 423.18 98.04 425.88 98.04C428.64 98.04 430.44 99.36 430.8 101.4L440.76 101.04C440.16 95.52 436.56 89.88 425.76 89.88C416.22 89.88 411.84 94.68 411.84 100.32C411.84 106.62 415.44 108.96 425.52 111.24C429.72 112.2 430.32 112.74 430.32 113.88C430.32 114.96 429.3 115.56 426.24 115.56C423 115.56 421.8 114.36 421.08 112.56L411.24 112.86C411.84 118.86 416.16 123.72 426.12 123.72ZM459 123.72C468.36 123.72 474.72 117.12 474.72 106.8C474.72 96.48 468.36 89.88 459 89.88C449.64 89.88 443.28 96.48 443.28 106.8C443.28 117.12 449.64 123.72 459 123.72ZM459 114.96C455.64 114.96 453.84 112.2 453.84 106.8C453.84 101.4 455.64 98.64 459 98.64C462.36 98.64 464.16 101.4 464.16 106.8C464.16 112.2 462.36 114.96 459 114.96ZM477.6 123H504.72V115.2H495.12V105C495.12 100.68 497.04 98.64 501.48 98.64H508.2V90.6H500.52C495.96 90.6 493.62 92.82 492.66 96.9L492.12 90.6H477.6V98.4H484.92V115.2H477.6Z" fill="#ecedef"/>
8
+ <path d="M211.72 158.87H213.35L218.48 144.25H216.85ZM225.5 157.2C227.58 157.2 229.11 155.86 229.45 153.8L227.7 153.7C227.44 154.98 226.59 155.62 225.52 155.62C223.99 155.62 223.07 154.43 223.07 152.48C223.07 150.52 223.99 149.33 225.52 149.33C226.59 149.33 227.37 149.98 227.65 151.12L229.4 151C229.06 148.96 227.56 147.75 225.5 147.75C222.97 147.75 221.29 149.62 221.29 152.48C221.29 155.33 222.97 157.2 225.5 157.2ZM234.72 157.2C236.03 157.2 236.98 156.59 237.45 155.49V157H239.07V147.96H237.35V153.29C237.35 154.82 236.54 155.71 235.28 155.71C234.12 155.71 233.56 154.99 233.56 153.36V147.96H231.84V153.8C231.84 155.96 232.97 157.2 234.72 157.2ZM242.03 157H248.86V155.56H246.04V151.63C246.04 150.2 246.72 149.45 248.03 149.45H249.88V147.96H247.96C246.8 147.96 246.07 148.53 245.78 149.72L245.68 147.96H242.03V149.4H244.32V155.56H242.03ZM256.04 157.2C258.23 157.2 259.72 156.22 259.72 154.59C259.72 153.09 258.98 152.38 256.24 151.9C254.61 151.59 254.06 151.34 254.06 150.52C254.06 149.84 254.59 149.3 255.81 149.3C256.95 149.3 257.65 149.93 257.84 150.79L259.59 150.69C259.33 149.13 258.21 147.75 255.81 147.75C253.5 147.75 252.3 148.94 252.3 150.52C252.3 152.05 253.13 152.82 255.8 153.31C257.6 153.63 257.97 153.92 257.97 154.6C257.97 155.32 257.28 155.66 256.05 155.66C254.73 155.66 254 155.06 253.83 154.06L252.07 154.16C252.21 155.86 253.6 157.2 256.04 157.2ZM266.1 157.2C268.62 157.2 270.28 155.37 270.28 152.48C270.28 149.59 268.62 147.75 266.1 147.75C263.57 147.75 261.92 149.59 261.92 152.48C261.92 155.37 263.57 157.2 266.1 157.2ZM266.1 155.62C264.57 155.62 263.72 154.45 263.72 152.48C263.72 150.51 264.57 149.33 266.1 149.33C267.61 149.33 268.48 150.51 268.48 152.48C268.48 154.45 267.61 155.62 266.1 155.62ZM272.63 157H279.46V155.56H276.64V151.63C276.64 150.2 277.32 149.45 278.63 149.45H280.48V147.96H278.56C277.4 147.96 276.67 148.53 276.38 149.72L276.28 147.96H272.63V149.4H274.92V155.56H272.63ZM296.33 146.65H298.09V144.86H296.33ZM292.89 157H301.19V155.56H298.16V147.96H293.06V149.4H296.43V155.56H292.89ZM303.16 157H304.88V151.65C304.88 150.08 305.86 149.25 307.12 149.25C308.33 149.25 308.92 150.05 308.92 151.61V157H310.64V151.17C310.64 149.23 309.64 147.75 307.61 147.75C306.36 147.75 305.25 148.33 304.77 149.59L304.74 147.96H303.16ZM323.66 157H325.45V152.43H327.4C329.92 152.43 331.58 151 331.58 148.69C331.58 146.36 329.92 144.93 327.4 144.93H323.66ZM325.45 150.74V146.61H327.21C328.93 146.61 329.73 147.34 329.73 148.69C329.73 150.03 328.93 150.74 327.21 150.74ZM337.13 146.65H338.89V144.86H337.13ZM333.69 157H341.99V155.56H338.96V147.96H333.86V149.4H337.23V155.56H333.69ZM356.74 152.95H359.06V150.73H356.74ZM377.52 157.2C378.83 157.2 379.78 156.59 380.25 155.49V157H381.87V147.96H380.15V153.29C380.15 154.82 379.34 155.71 378.08 155.71C376.92 155.71 376.36 154.99 376.36 153.36V147.96H374.64V153.8C374.64 155.96 375.77 157.2 377.52 157.2ZM384.76 157H386.48V151.65C386.48 150.08 387.46 149.25 388.72 149.25C389.93 149.25 390.52 150.05 390.52 151.61V157H392.24V151.17C392.24 149.23 391.24 147.75 389.21 147.75C387.96 147.75 386.85 148.33 386.37 149.59L386.34 147.96H384.76ZM398.7 157.2C401.22 157.2 402.88 155.37 402.88 152.48C402.88 149.59 401.22 147.75 398.7 147.75C396.17 147.75 394.52 149.59 394.52 152.48C394.52 155.37 396.17 157.2 398.7 157.2ZM398.7 155.62C397.17 155.62 396.32 154.45 396.32 152.48C396.32 150.51 397.17 149.33 398.7 149.33C400.21 149.33 401.08 150.51 401.08 152.48C401.08 154.45 400.21 155.62 398.7 155.62ZM407.34 157H409.05V149.4H412.71V147.96H409.05V147.5C409.05 146.8 409.39 146.38 410.09 146.38H412.84V144.93H409.92C408.15 144.93 407.34 145.81 407.34 147.48V147.96H404.96V149.4H407.34ZM417.54 157H419.25V149.4H422.91V147.96H419.25V147.5C419.25 146.8 419.59 146.38 420.29 146.38H423.04V144.93H420.12C418.35 144.93 417.54 145.81 417.54 147.48V147.96H415.16V149.4H417.54ZM428.93 146.65H430.69V144.86H428.93ZM425.49 157H433.79V155.56H430.76V147.96H425.66V149.4H429.03V155.56H425.49ZM439.7 157.2C441.78 157.2 443.31 155.86 443.65 153.8L441.9 153.7C441.64 154.98 440.79 155.62 439.72 155.62C438.19 155.62 437.27 154.43 437.27 152.48C437.27 150.52 438.19 149.33 439.72 149.33C440.79 149.33 441.57 149.98 441.85 151.12L443.6 151C443.26 148.96 441.76 147.75 439.7 147.75C437.17 147.75 435.49 149.62 435.49 152.48C435.49 155.33 437.17 157.2 439.7 157.2ZM449.33 146.65H451.09V144.86H449.33ZM445.89 157H454.19V155.56H451.16V147.96H446.06V149.4H449.43V155.56H445.89ZM458.68 157.2C459.98 157.2 461.09 156.59 461.55 155.71L461.57 155.74C461.77 156.63 462.38 157.05 463.4 157.05C463.71 157.05 464.05 157.02 464.18 157V155.59H463.67C463.32 155.59 463.15 155.45 463.15 155.03V151.46C463.15 149.15 461.91 147.75 459.59 147.75C457.52 147.75 456.16 148.91 455.82 150.64L457.62 150.76C457.86 149.83 458.45 149.28 459.59 149.28C460.82 149.28 461.43 150 461.43 151.39L458.51 152C456.6 152.38 455.67 153.19 455.67 154.72C455.67 156.22 456.98 157.2 458.68 157.2ZM458.93 155.79C458 155.79 457.45 155.35 457.45 154.59C457.45 153.87 457.83 153.48 458.91 153.26L461.43 152.75V153.45C461.43 154.86 460.58 155.79 458.93 155.79ZM465.95 157H474.25V155.56H471.2V147.58C471.2 145.83 470.3 144.93 468.55 144.93H466.29V146.38H468.37C469.08 146.38 469.49 146.78 469.49 147.5V155.56H465.95ZM486.83 157H493.66V155.56H490.84V151.63C490.84 150.2 491.52 149.45 492.83 149.45H494.68V147.96H492.76C491.6 147.96 490.87 148.53 490.58 149.72L490.48 147.96H486.83V149.4H489.12V155.56H486.83ZM500.7 157.2C503.22 157.2 504.88 155.37 504.88 152.48C504.88 149.59 503.22 147.75 500.7 147.75C498.17 147.75 496.52 149.59 496.52 152.48C496.52 155.37 498.17 157.2 500.7 157.2ZM500.7 155.62C499.17 155.62 498.32 154.45 498.32 152.48C498.32 150.51 499.17 149.33 500.7 149.33C502.21 149.33 503.08 150.51 503.08 152.48C503.08 154.45 502.21 155.62 500.7 155.62ZM510.12 157.2C511.43 157.2 512.38 156.59 512.85 155.49V157H514.47V147.96H512.75V153.29C512.75 154.82 511.94 155.71 510.68 155.71C509.52 155.71 508.96 154.99 508.96 153.36V147.96H507.24V153.8C507.24 155.96 508.37 157.2 510.12 157.2ZM522.39 157H524.91V155.56H522.58C521.78 155.56 521.39 155.16 521.39 154.31V149.4H524.91V147.96H521.39V145.83H519.67V147.96H516.82V149.4H519.67V154.4C519.67 156.17 520.56 157 522.39 157ZM531.38 157.2C533.34 157.2 534.73 156.08 535.24 154.37L533.46 154.25C533.17 155.08 532.46 155.62 531.4 155.62C529.97 155.62 529.07 154.72 528.97 152.99H535.41V152.51C535.41 149.52 533.73 147.75 531.33 147.75C528.82 147.75 527.19 149.62 527.19 152.48C527.19 155.35 528.83 157.2 531.38 157.2ZM528.99 151.61C529.19 150.12 530.04 149.33 531.32 149.33C532.54 149.33 533.42 150.06 533.54 151.61ZM540.79 157.2C542.06 157.2 543.05 156.59 543.56 155.62L543.61 157H545.21V144.93H543.49V149.23C543.05 148.43 542.06 147.75 540.79 147.75C538.47 147.75 537.01 149.55 537.01 152.48C537.01 155.4 538.47 157.2 540.79 157.2ZM541.07 155.62C539.65 155.62 538.81 154.43 538.81 152.48C538.81 150.49 539.65 149.33 541.04 149.33C542.57 149.33 543.49 150.51 543.49 152.48C543.49 154.43 542.55 155.62 541.07 155.62ZM561.95 157.27C564.26 157.27 565.86 155.64 566.29 152.89L564.43 152.8C564.13 154.64 563.19 155.61 561.95 155.61C560.2 155.61 559.26 153.94 559.26 150.98C559.26 148.01 560.2 146.32 561.95 146.32C563.09 146.32 564.01 147.21 564.35 148.89L566.22 148.79C565.72 146.17 564.14 144.66 561.95 144.66C559.04 144.66 557.41 147.09 557.41 150.98C557.41 154.86 559.04 157.27 561.95 157.27ZM571.32 157.2C572.63 157.2 573.58 156.59 574.05 155.49V157H575.67V147.96H573.95V153.29C573.95 154.82 573.14 155.71 571.88 155.71C570.72 155.71 570.16 154.99 570.16 153.36V147.96H568.44V153.8C568.44 155.96 569.57 157.2 571.32 157.2ZM578.63 157H585.46V155.56H582.64V151.63C582.64 150.2 583.32 149.45 584.63 149.45H586.48V147.96H584.56C583.4 147.96 582.67 148.53 582.38 149.72L582.28 147.96H578.63V149.4H580.92V155.56H578.63ZM592.64 157.2C594.83 157.2 596.32 156.22 596.32 154.59C596.32 153.09 595.58 152.38 592.84 151.9C591.21 151.59 590.66 151.34 590.66 150.52C590.66 149.84 591.19 149.3 592.41 149.3C593.55 149.3 594.25 149.93 594.44 150.79L596.19 150.69C595.93 149.13 594.81 147.75 592.41 147.75C590.1 147.75 588.9 148.94 588.9 150.52C588.9 152.05 589.73 152.82 592.4 153.31C594.2 153.63 594.57 153.92 594.57 154.6C594.57 155.32 593.88 155.66 592.65 155.66C591.33 155.66 590.6 155.06 590.43 154.06L588.67 154.16C588.81 155.86 590.2 157.2 592.64 157.2ZM602.7 157.2C605.22 157.2 606.88 155.37 606.88 152.48C606.88 149.59 605.22 147.75 602.7 147.75C600.17 147.75 598.52 149.59 598.52 152.48C598.52 155.37 600.17 157.2 602.7 157.2ZM602.7 155.62C601.17 155.62 600.32 154.45 600.32 152.48C600.32 150.51 601.17 149.33 602.7 149.33C604.21 149.33 605.08 150.51 605.08 152.48C605.08 154.45 604.21 155.62 602.7 155.62ZM609.23 157H616.06V155.56H613.24V151.63C613.24 150.2 613.92 149.45 615.23 149.45H617.08V147.96H615.16C614.01 147.96 613.27 148.53 612.99 149.72L612.88 147.96H609.23V149.4H611.52V155.56H609.23ZM632.93 146.65H634.69V144.86H632.93ZM629.49 157H637.79V155.56H634.76V147.96H629.66V149.4H633.03V155.56H629.49ZM639.76 157H641.48V151.65C641.48 150.08 642.46 149.25 643.72 149.25C644.93 149.25 645.52 150.05 645.52 151.61V157H647.24V151.17C647.24 149.23 646.24 147.75 644.21 147.75C642.96 147.75 641.85 148.33 641.38 149.59L641.34 147.96H639.76ZM652.14 157H653.85V149.4H657.51V147.96H653.85V147.5C653.85 146.8 654.19 146.38 654.89 146.38H657.64V144.93H654.72C652.95 144.93 652.14 145.81 652.14 147.48V147.96H649.76V149.4H652.14ZM663.99 157.2C665.94 157.2 667.33 156.08 667.84 154.37L666.06 154.25C665.77 155.08 665.06 155.62 664 155.62C662.57 155.62 661.67 154.72 661.57 152.99H668.01V152.51C668.01 149.52 666.33 147.75 663.93 147.75C661.42 147.75 659.79 149.62 659.79 152.48C659.79 155.35 661.44 157.2 663.99 157.2ZM661.59 151.61C661.79 150.12 662.64 149.33 663.92 149.33C665.14 149.33 666.03 150.06 666.14 151.61ZM670.43 157H677.26V155.56H674.44V151.63C674.44 150.2 675.12 149.45 676.43 149.45H678.28V147.96H676.36C675.21 147.96 674.47 148.53 674.19 149.72L674.08 147.96H670.43V149.4H672.72V155.56H670.43ZM684.39 157.2C686.34 157.2 687.73 156.08 688.24 154.37L686.46 154.25C686.17 155.08 685.46 155.62 684.4 155.62C682.97 155.62 682.07 154.72 681.97 152.99H688.41V152.51C688.41 149.52 686.73 147.75 684.33 147.75C681.82 147.75 680.19 149.62 680.19 152.48C680.19 155.35 681.84 157.2 684.39 157.2ZM681.99 151.61C682.19 150.12 683.04 149.33 684.32 149.33C685.54 149.33 686.43 150.06 686.54 151.61ZM690.76 157H692.48V151.65C692.48 150.08 693.46 149.25 694.72 149.25C695.93 149.25 696.52 150.05 696.52 151.61V157H698.24V151.17C698.24 149.23 697.24 147.75 695.21 147.75C693.96 147.75 692.85 148.33 692.38 149.59L692.34 147.96H690.76ZM704.9 157.2C706.98 157.2 708.51 155.86 708.85 153.8L707.1 153.7C706.84 154.98 705.99 155.62 704.92 155.62C703.39 155.62 702.47 154.43 702.47 152.48C702.47 150.52 703.39 149.33 704.92 149.33C705.99 149.33 706.77 149.98 707.05 151.12L708.8 151C708.46 148.96 706.96 147.75 704.9 147.75C702.37 147.75 700.69 149.62 700.69 152.48C700.69 155.33 702.37 157.2 704.9 157.2ZM714.99 157.2C716.94 157.2 718.33 156.08 718.84 154.37L717.06 154.25C716.77 155.08 716.06 155.62 715 155.62C713.57 155.62 712.67 154.72 712.57 152.99H719.01V152.51C719.01 149.52 717.33 147.75 714.93 147.75C712.42 147.75 710.79 149.62 710.79 152.48C710.79 155.35 712.44 157.2 714.99 157.2ZM712.59 151.61C712.79 150.12 713.64 149.33 714.92 149.33C716.14 149.33 717.03 150.06 717.14 151.61Z" fill="#8b9299"/>
9
+ <rect x="963" y="99" width="181" height="42" rx="10" fill="none" stroke="#8b9299" stroke-width="1.5"/>
10
+ <rect x="983" y="113" width="4" height="14" fill="#c21e86"/>
11
+ <path d="M1000.73 127.76H1002.01L1006.87 114H1005.59ZM1013.62 126.19C1015.51 126.19 1016.89 124.98 1017.24 123.09L1015.83 122.99C1015.58 124.27 1014.71 124.91 1013.62 124.91C1012.06 124.91 1011.13 123.73 1011.13 121.76C1011.13 119.79 1012.06 118.61 1013.62 118.61C1014.71 118.61 1015.51 119.25 1015.77 120.37L1017.18 120.27C1016.82 118.38 1015.51 117.33 1013.62 117.33C1011.26 117.33 1009.72 119.07 1009.72 121.76C1009.72 124.45 1011.26 126.19 1013.62 126.19ZM1022.41 126.19C1023.62 126.19 1024.52 125.63 1024.98 124.62V126H1026.26V117.52H1024.92V122.58C1024.92 124.1 1024.1 125.01 1022.78 125.01C1021.56 125.01 1020.98 124.26 1020.98 122.61V117.52H1019.64V122.98C1019.64 124.99 1020.73 126.19 1022.41 126.19ZM1029.24 126H1035.48V124.82H1032.79V120.88C1032.79 119.49 1033.46 118.74 1034.71 118.74H1036.44V117.52H1034.7C1033.64 117.52 1032.94 118.06 1032.66 119.17L1032.57 117.52H1029.24V118.7H1031.45V124.82H1029.24ZM1042.36 126.19C1044.28 126.19 1045.72 125.3 1045.72 123.79C1045.72 122.38 1045.02 121.7 1042.39 121.26C1040.86 121.01 1040.28 120.75 1040.28 119.89C1040.28 119.17 1040.86 118.61 1042.1 118.61C1043.26 118.61 1043.96 119.25 1044.15 120.14L1045.56 120.05C1045.3 118.58 1044.22 117.33 1042.12 117.33C1040.04 117.33 1038.9 118.42 1038.9 119.89C1038.9 121.26 1039.64 122.02 1042.1 122.45C1043.96 122.77 1044.34 123.06 1044.34 123.79C1044.34 124.56 1043.61 124.91 1042.36 124.91C1041.02 124.91 1040.25 124.29 1040.09 123.23L1038.68 123.33C1038.81 124.93 1040.15 126.19 1042.36 126.19ZM1051.8 126.19C1054.14 126.19 1055.67 124.46 1055.67 121.76C1055.67 119.06 1054.14 117.33 1051.8 117.33C1049.45 117.33 1047.93 119.06 1047.93 121.76C1047.93 124.46 1049.45 126.19 1051.8 126.19ZM1051.8 124.91C1050.23 124.91 1049.34 123.73 1049.34 121.76C1049.34 119.79 1050.23 118.61 1051.8 118.61C1053.35 118.61 1054.26 119.79 1054.26 121.76C1054.26 123.73 1053.35 124.91 1051.8 124.91ZM1058.04 126H1064.28V124.82H1061.59V120.88C1061.59 119.49 1062.26 118.74 1063.51 118.74H1065.24V117.52H1063.5C1062.44 117.52 1061.74 118.06 1061.46 119.17L1061.37 117.52H1058.04V118.7H1060.25V124.82H1058.04ZM1080.01 126.19C1081.22 126.19 1082.12 125.63 1082.58 124.62V126H1083.86V117.52H1082.52V122.58C1082.52 124.1 1081.7 125.01 1080.38 125.01C1079.16 125.01 1078.58 124.26 1078.58 122.61V117.52H1077.24V122.98C1077.24 124.99 1078.33 126.19 1080.01 126.19ZM1090.36 126.19C1092.28 126.19 1093.72 125.3 1093.72 123.79C1093.72 122.38 1093.02 121.7 1090.39 121.26C1088.86 121.01 1088.28 120.75 1088.28 119.89C1088.28 119.17 1088.86 118.61 1090.1 118.61C1091.26 118.61 1091.96 119.25 1092.15 120.14L1093.56 120.05C1093.3 118.58 1092.22 117.33 1090.12 117.33C1088.04 117.33 1086.9 118.42 1086.9 119.89C1086.9 121.26 1087.64 122.02 1090.1 122.45C1091.96 122.77 1092.34 123.06 1092.34 123.79C1092.34 124.56 1091.61 124.91 1090.36 124.91C1089.02 124.91 1088.25 124.29 1088.09 123.23L1086.68 123.33C1086.81 124.93 1088.15 126.19 1090.36 126.19ZM1098.68 126.19C1099.9 126.19 1100.98 125.63 1101.45 124.8L1101.46 124.88C1101.66 125.7 1102.2 126.03 1103.1 126.03C1103.35 126.03 1103.67 126.02 1103.8 126V124.82H1103.26C1102.9 124.82 1102.74 124.69 1102.74 124.3V120.78C1102.74 118.64 1101.56 117.33 1099.51 117.33C1097.59 117.33 1096.34 118.42 1096.02 120.02L1097.45 120.13C1097.7 119.15 1098.33 118.61 1099.51 118.61C1100.73 118.61 1101.4 119.31 1101.4 120.75L1098.55 121.33C1096.7 121.7 1095.86 122.45 1095.86 123.89C1095.86 125.26 1097.08 126.19 1098.68 126.19ZM1098.81 125.01C1097.85 125.01 1097.27 124.56 1097.27 123.76C1097.27 123.06 1097.66 122.64 1098.81 122.42L1101.4 121.9V122.64C1101.4 124.05 1100.54 125.01 1098.81 125.01ZM1109.35 128.59C1111.69 128.59 1113.08 127.41 1113.08 125.42V117.52H1111.8V118.86C1111.42 117.92 1110.38 117.33 1109.19 117.33C1107.06 117.33 1105.56 119.02 1105.56 121.44C1105.56 123.86 1107.1 125.55 1109.26 125.55C1110.36 125.55 1111.32 124.98 1111.74 124.08V125.46C1111.74 126.7 1110.89 127.31 1109.35 127.31C1108.04 127.31 1107.46 126.83 1107.21 126.03L1105.8 126.13C1106.15 127.62 1107.53 128.59 1109.35 128.59ZM1109.32 124.27C1107.86 124.27 1106.97 123.18 1106.97 121.44C1106.97 119.7 1107.83 118.61 1109.32 118.61C1110.79 118.61 1111.77 119.7 1111.74 121.44C1111.72 123.18 1110.78 124.27 1109.32 124.27ZM1119.1 126.19C1120.89 126.19 1122.2 125.12 1122.65 123.6L1121.21 123.49C1120.92 124.35 1120.2 124.91 1119.1 124.91C1117.62 124.91 1116.71 124 1116.62 122.18H1122.79V121.78C1122.79 118.93 1121.24 117.33 1119.03 117.33C1116.7 117.33 1115.21 119.07 1115.21 121.76C1115.21 124.45 1116.7 126.19 1119.1 126.19ZM1116.62 120.99C1116.84 119.42 1117.72 118.61 1119.03 118.61C1120.28 118.61 1121.19 119.36 1121.32 120.99Z" fill="#ecedef"/>
12
+ </svg>
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1200" height="240" viewBox="0 0 1200 240" role="img" aria-label="pi-cursor — /cursor in Pi · unofficial routed Cursor inference">
2
+ <rect width="1200" height="240" rx="24" fill="#ecedef"/>
3
+ <rect x="0.75" y="0.75" width="1198.5" height="238.5" rx="23.25" fill="none" stroke="#d9dbde" stroke-width="1.5"/>
4
+ <rect x="56" y="64" width="112" height="112" rx="21" fill="#101317"/>
5
+ <path d="M71.75 79.75h47.25v22.75h-47.25zM105 137.5h47.25v22.75h-47.25zM71.75 113h22.75v47.25h-22.75z" fill="#ecedef"/>
6
+ <path d="M129.5 79.75h22.75v47.25h-22.75z" fill="#c21e86"/>
7
+ <path d="M212.4 132H222.6V118.44C224.64 122.16 227.58 123.72 232.08 123.72C239.94 123.72 244.2 116.7 244.2 106.8C244.2 96.9 239.94 89.88 232.08 89.88C227.34 89.88 224.4 92.1 222.6 96L222.36 90.6H212.4ZM228.24 114.96C225.12 114.96 222.6 112.56 222.6 106.8C222.6 101.04 225.12 98.64 228.24 98.64C231.72 98.64 233.64 100.8 233.64 106.8C233.64 112.8 231.72 114.96 228.24 114.96ZM257.94 87.36H268.14V79.44H257.94ZM246.6 123H277.8V115.2H268.2V90.6H247.2V98.4H258V115.2H246.6ZM282.6 110.04H305.4V100.92H282.6ZM327.36 123.72C335.4 123.72 341.82 118.38 342.72 110.4L332.76 109.92C332.1 113.16 330.24 114.96 327.48 114.96C323.94 114.96 321.84 111.84 321.84 106.8C321.84 101.76 323.94 98.64 327.48 98.64C330.18 98.64 332.04 100.38 332.76 103.56L342.72 103.08C341.82 95.22 335.28 89.88 327.36 89.88C317.94 89.88 311.28 96.84 311.28 106.8C311.28 116.76 317.94 123.72 327.36 123.72ZM355.2 123.72C359.82 123.72 363.12 121.44 364.68 117.24L364.86 123H374.16V90.6H363.96V109.08C363.96 113.28 361.74 115.2 359.58 115.2C357.3 115.2 356.04 113.76 356.04 109.56V90.6H345.84V112.08C345.84 119.88 349.32 123.72 355.2 123.72ZM378.6 123H405.72V115.2H396.12V105C396.12 100.68 398.04 98.64 402.48 98.64H409.2V90.6H401.52C396.96 90.6 394.62 92.82 393.66 96.9L393.12 90.6H378.6V98.4H385.92V115.2H378.6ZM426.12 123.72C435.96 123.72 440.76 119.88 440.76 113.64C440.76 108.12 438.06 105.96 429.12 103.92C423.36 102.6 422.28 101.88 422.28 100.32C422.28 99.3 423.18 98.04 425.88 98.04C428.64 98.04 430.44 99.36 430.8 101.4L440.76 101.04C440.16 95.52 436.56 89.88 425.76 89.88C416.22 89.88 411.84 94.68 411.84 100.32C411.84 106.62 415.44 108.96 425.52 111.24C429.72 112.2 430.32 112.74 430.32 113.88C430.32 114.96 429.3 115.56 426.24 115.56C423 115.56 421.8 114.36 421.08 112.56L411.24 112.86C411.84 118.86 416.16 123.72 426.12 123.72ZM459 123.72C468.36 123.72 474.72 117.12 474.72 106.8C474.72 96.48 468.36 89.88 459 89.88C449.64 89.88 443.28 96.48 443.28 106.8C443.28 117.12 449.64 123.72 459 123.72ZM459 114.96C455.64 114.96 453.84 112.2 453.84 106.8C453.84 101.4 455.64 98.64 459 98.64C462.36 98.64 464.16 101.4 464.16 106.8C464.16 112.2 462.36 114.96 459 114.96ZM477.6 123H504.72V115.2H495.12V105C495.12 100.68 497.04 98.64 501.48 98.64H508.2V90.6H500.52C495.96 90.6 493.62 92.82 492.66 96.9L492.12 90.6H477.6V98.4H484.92V115.2H477.6Z" fill="#101317"/>
8
+ <path d="M211.72 158.87H213.35L218.48 144.25H216.85ZM225.5 157.2C227.58 157.2 229.11 155.86 229.45 153.8L227.7 153.7C227.44 154.98 226.59 155.62 225.52 155.62C223.99 155.62 223.07 154.43 223.07 152.48C223.07 150.52 223.99 149.33 225.52 149.33C226.59 149.33 227.37 149.98 227.65 151.12L229.4 151C229.06 148.96 227.56 147.75 225.5 147.75C222.97 147.75 221.29 149.62 221.29 152.48C221.29 155.33 222.97 157.2 225.5 157.2ZM234.72 157.2C236.03 157.2 236.98 156.59 237.45 155.49V157H239.07V147.96H237.35V153.29C237.35 154.82 236.54 155.71 235.28 155.71C234.12 155.71 233.56 154.99 233.56 153.36V147.96H231.84V153.8C231.84 155.96 232.97 157.2 234.72 157.2ZM242.03 157H248.86V155.56H246.04V151.63C246.04 150.2 246.72 149.45 248.03 149.45H249.88V147.96H247.96C246.8 147.96 246.07 148.53 245.78 149.72L245.68 147.96H242.03V149.4H244.32V155.56H242.03ZM256.04 157.2C258.23 157.2 259.72 156.22 259.72 154.59C259.72 153.09 258.98 152.38 256.24 151.9C254.61 151.59 254.06 151.34 254.06 150.52C254.06 149.84 254.59 149.3 255.81 149.3C256.95 149.3 257.65 149.93 257.84 150.79L259.59 150.69C259.33 149.13 258.21 147.75 255.81 147.75C253.5 147.75 252.3 148.94 252.3 150.52C252.3 152.05 253.13 152.82 255.8 153.31C257.6 153.63 257.97 153.92 257.97 154.6C257.97 155.32 257.28 155.66 256.05 155.66C254.73 155.66 254 155.06 253.83 154.06L252.07 154.16C252.21 155.86 253.6 157.2 256.04 157.2ZM266.1 157.2C268.62 157.2 270.28 155.37 270.28 152.48C270.28 149.59 268.62 147.75 266.1 147.75C263.57 147.75 261.92 149.59 261.92 152.48C261.92 155.37 263.57 157.2 266.1 157.2ZM266.1 155.62C264.57 155.62 263.72 154.45 263.72 152.48C263.72 150.51 264.57 149.33 266.1 149.33C267.61 149.33 268.48 150.51 268.48 152.48C268.48 154.45 267.61 155.62 266.1 155.62ZM272.63 157H279.46V155.56H276.64V151.63C276.64 150.2 277.32 149.45 278.63 149.45H280.48V147.96H278.56C277.4 147.96 276.67 148.53 276.38 149.72L276.28 147.96H272.63V149.4H274.92V155.56H272.63ZM296.33 146.65H298.09V144.86H296.33ZM292.89 157H301.19V155.56H298.16V147.96H293.06V149.4H296.43V155.56H292.89ZM303.16 157H304.88V151.65C304.88 150.08 305.86 149.25 307.12 149.25C308.33 149.25 308.92 150.05 308.92 151.61V157H310.64V151.17C310.64 149.23 309.64 147.75 307.61 147.75C306.36 147.75 305.25 148.33 304.77 149.59L304.74 147.96H303.16ZM323.66 157H325.45V152.43H327.4C329.92 152.43 331.58 151 331.58 148.69C331.58 146.36 329.92 144.93 327.4 144.93H323.66ZM325.45 150.74V146.61H327.21C328.93 146.61 329.73 147.34 329.73 148.69C329.73 150.03 328.93 150.74 327.21 150.74ZM337.13 146.65H338.89V144.86H337.13ZM333.69 157H341.99V155.56H338.96V147.96H333.86V149.4H337.23V155.56H333.69ZM356.74 152.95H359.06V150.73H356.74ZM377.52 157.2C378.83 157.2 379.78 156.59 380.25 155.49V157H381.87V147.96H380.15V153.29C380.15 154.82 379.34 155.71 378.08 155.71C376.92 155.71 376.36 154.99 376.36 153.36V147.96H374.64V153.8C374.64 155.96 375.77 157.2 377.52 157.2ZM384.76 157H386.48V151.65C386.48 150.08 387.46 149.25 388.72 149.25C389.93 149.25 390.52 150.05 390.52 151.61V157H392.24V151.17C392.24 149.23 391.24 147.75 389.21 147.75C387.96 147.75 386.85 148.33 386.37 149.59L386.34 147.96H384.76ZM398.7 157.2C401.22 157.2 402.88 155.37 402.88 152.48C402.88 149.59 401.22 147.75 398.7 147.75C396.17 147.75 394.52 149.59 394.52 152.48C394.52 155.37 396.17 157.2 398.7 157.2ZM398.7 155.62C397.17 155.62 396.32 154.45 396.32 152.48C396.32 150.51 397.17 149.33 398.7 149.33C400.21 149.33 401.08 150.51 401.08 152.48C401.08 154.45 400.21 155.62 398.7 155.62ZM407.34 157H409.05V149.4H412.71V147.96H409.05V147.5C409.05 146.8 409.39 146.38 410.09 146.38H412.84V144.93H409.92C408.15 144.93 407.34 145.81 407.34 147.48V147.96H404.96V149.4H407.34ZM417.54 157H419.25V149.4H422.91V147.96H419.25V147.5C419.25 146.8 419.59 146.38 420.29 146.38H423.04V144.93H420.12C418.35 144.93 417.54 145.81 417.54 147.48V147.96H415.16V149.4H417.54ZM428.93 146.65H430.69V144.86H428.93ZM425.49 157H433.79V155.56H430.76V147.96H425.66V149.4H429.03V155.56H425.49ZM439.7 157.2C441.78 157.2 443.31 155.86 443.65 153.8L441.9 153.7C441.64 154.98 440.79 155.62 439.72 155.62C438.19 155.62 437.27 154.43 437.27 152.48C437.27 150.52 438.19 149.33 439.72 149.33C440.79 149.33 441.57 149.98 441.85 151.12L443.6 151C443.26 148.96 441.76 147.75 439.7 147.75C437.17 147.75 435.49 149.62 435.49 152.48C435.49 155.33 437.17 157.2 439.7 157.2ZM449.33 146.65H451.09V144.86H449.33ZM445.89 157H454.19V155.56H451.16V147.96H446.06V149.4H449.43V155.56H445.89ZM458.68 157.2C459.98 157.2 461.09 156.59 461.55 155.71L461.57 155.74C461.77 156.63 462.38 157.05 463.4 157.05C463.71 157.05 464.05 157.02 464.18 157V155.59H463.67C463.32 155.59 463.15 155.45 463.15 155.03V151.46C463.15 149.15 461.91 147.75 459.59 147.75C457.52 147.75 456.16 148.91 455.82 150.64L457.62 150.76C457.86 149.83 458.45 149.28 459.59 149.28C460.82 149.28 461.43 150 461.43 151.39L458.51 152C456.6 152.38 455.67 153.19 455.67 154.72C455.67 156.22 456.98 157.2 458.68 157.2ZM458.93 155.79C458 155.79 457.45 155.35 457.45 154.59C457.45 153.87 457.83 153.48 458.91 153.26L461.43 152.75V153.45C461.43 154.86 460.58 155.79 458.93 155.79ZM465.95 157H474.25V155.56H471.2V147.58C471.2 145.83 470.3 144.93 468.55 144.93H466.29V146.38H468.37C469.08 146.38 469.49 146.78 469.49 147.5V155.56H465.95ZM486.83 157H493.66V155.56H490.84V151.63C490.84 150.2 491.52 149.45 492.83 149.45H494.68V147.96H492.76C491.6 147.96 490.87 148.53 490.58 149.72L490.48 147.96H486.83V149.4H489.12V155.56H486.83ZM500.7 157.2C503.22 157.2 504.88 155.37 504.88 152.48C504.88 149.59 503.22 147.75 500.7 147.75C498.17 147.75 496.52 149.59 496.52 152.48C496.52 155.37 498.17 157.2 500.7 157.2ZM500.7 155.62C499.17 155.62 498.32 154.45 498.32 152.48C498.32 150.51 499.17 149.33 500.7 149.33C502.21 149.33 503.08 150.51 503.08 152.48C503.08 154.45 502.21 155.62 500.7 155.62ZM510.12 157.2C511.43 157.2 512.38 156.59 512.85 155.49V157H514.47V147.96H512.75V153.29C512.75 154.82 511.94 155.71 510.68 155.71C509.52 155.71 508.96 154.99 508.96 153.36V147.96H507.24V153.8C507.24 155.96 508.37 157.2 510.12 157.2ZM522.39 157H524.91V155.56H522.58C521.78 155.56 521.39 155.16 521.39 154.31V149.4H524.91V147.96H521.39V145.83H519.67V147.96H516.82V149.4H519.67V154.4C519.67 156.17 520.56 157 522.39 157ZM531.38 157.2C533.34 157.2 534.73 156.08 535.24 154.37L533.46 154.25C533.17 155.08 532.46 155.62 531.4 155.62C529.97 155.62 529.07 154.72 528.97 152.99H535.41V152.51C535.41 149.52 533.73 147.75 531.33 147.75C528.82 147.75 527.19 149.62 527.19 152.48C527.19 155.35 528.83 157.2 531.38 157.2ZM528.99 151.61C529.19 150.12 530.04 149.33 531.32 149.33C532.54 149.33 533.42 150.06 533.54 151.61ZM540.79 157.2C542.06 157.2 543.05 156.59 543.56 155.62L543.61 157H545.21V144.93H543.49V149.23C543.05 148.43 542.06 147.75 540.79 147.75C538.47 147.75 537.01 149.55 537.01 152.48C537.01 155.4 538.47 157.2 540.79 157.2ZM541.07 155.62C539.65 155.62 538.81 154.43 538.81 152.48C538.81 150.49 539.65 149.33 541.04 149.33C542.57 149.33 543.49 150.51 543.49 152.48C543.49 154.43 542.55 155.62 541.07 155.62ZM561.95 157.27C564.26 157.27 565.86 155.64 566.29 152.89L564.43 152.8C564.13 154.64 563.19 155.61 561.95 155.61C560.2 155.61 559.26 153.94 559.26 150.98C559.26 148.01 560.2 146.32 561.95 146.32C563.09 146.32 564.01 147.21 564.35 148.89L566.22 148.79C565.72 146.17 564.14 144.66 561.95 144.66C559.04 144.66 557.41 147.09 557.41 150.98C557.41 154.86 559.04 157.27 561.95 157.27ZM571.32 157.2C572.63 157.2 573.58 156.59 574.05 155.49V157H575.67V147.96H573.95V153.29C573.95 154.82 573.14 155.71 571.88 155.71C570.72 155.71 570.16 154.99 570.16 153.36V147.96H568.44V153.8C568.44 155.96 569.57 157.2 571.32 157.2ZM578.63 157H585.46V155.56H582.64V151.63C582.64 150.2 583.32 149.45 584.63 149.45H586.48V147.96H584.56C583.4 147.96 582.67 148.53 582.38 149.72L582.28 147.96H578.63V149.4H580.92V155.56H578.63ZM592.64 157.2C594.83 157.2 596.32 156.22 596.32 154.59C596.32 153.09 595.58 152.38 592.84 151.9C591.21 151.59 590.66 151.34 590.66 150.52C590.66 149.84 591.19 149.3 592.41 149.3C593.55 149.3 594.25 149.93 594.44 150.79L596.19 150.69C595.93 149.13 594.81 147.75 592.41 147.75C590.1 147.75 588.9 148.94 588.9 150.52C588.9 152.05 589.73 152.82 592.4 153.31C594.2 153.63 594.57 153.92 594.57 154.6C594.57 155.32 593.88 155.66 592.65 155.66C591.33 155.66 590.6 155.06 590.43 154.06L588.67 154.16C588.81 155.86 590.2 157.2 592.64 157.2ZM602.7 157.2C605.22 157.2 606.88 155.37 606.88 152.48C606.88 149.59 605.22 147.75 602.7 147.75C600.17 147.75 598.52 149.59 598.52 152.48C598.52 155.37 600.17 157.2 602.7 157.2ZM602.7 155.62C601.17 155.62 600.32 154.45 600.32 152.48C600.32 150.51 601.17 149.33 602.7 149.33C604.21 149.33 605.08 150.51 605.08 152.48C605.08 154.45 604.21 155.62 602.7 155.62ZM609.23 157H616.06V155.56H613.24V151.63C613.24 150.2 613.92 149.45 615.23 149.45H617.08V147.96H615.16C614.01 147.96 613.27 148.53 612.99 149.72L612.88 147.96H609.23V149.4H611.52V155.56H609.23ZM632.93 146.65H634.69V144.86H632.93ZM629.49 157H637.79V155.56H634.76V147.96H629.66V149.4H633.03V155.56H629.49ZM639.76 157H641.48V151.65C641.48 150.08 642.46 149.25 643.72 149.25C644.93 149.25 645.52 150.05 645.52 151.61V157H647.24V151.17C647.24 149.23 646.24 147.75 644.21 147.75C642.96 147.75 641.85 148.33 641.38 149.59L641.34 147.96H639.76ZM652.14 157H653.85V149.4H657.51V147.96H653.85V147.5C653.85 146.8 654.19 146.38 654.89 146.38H657.64V144.93H654.72C652.95 144.93 652.14 145.81 652.14 147.48V147.96H649.76V149.4H652.14ZM663.99 157.2C665.94 157.2 667.33 156.08 667.84 154.37L666.06 154.25C665.77 155.08 665.06 155.62 664 155.62C662.57 155.62 661.67 154.72 661.57 152.99H668.01V152.51C668.01 149.52 666.33 147.75 663.93 147.75C661.42 147.75 659.79 149.62 659.79 152.48C659.79 155.35 661.44 157.2 663.99 157.2ZM661.59 151.61C661.79 150.12 662.64 149.33 663.92 149.33C665.14 149.33 666.03 150.06 666.14 151.61ZM670.43 157H677.26V155.56H674.44V151.63C674.44 150.2 675.12 149.45 676.43 149.45H678.28V147.96H676.36C675.21 147.96 674.47 148.53 674.19 149.72L674.08 147.96H670.43V149.4H672.72V155.56H670.43ZM684.39 157.2C686.34 157.2 687.73 156.08 688.24 154.37L686.46 154.25C686.17 155.08 685.46 155.62 684.4 155.62C682.97 155.62 682.07 154.72 681.97 152.99H688.41V152.51C688.41 149.52 686.73 147.75 684.33 147.75C681.82 147.75 680.19 149.62 680.19 152.48C680.19 155.35 681.84 157.2 684.39 157.2ZM681.99 151.61C682.19 150.12 683.04 149.33 684.32 149.33C685.54 149.33 686.43 150.06 686.54 151.61ZM690.76 157H692.48V151.65C692.48 150.08 693.46 149.25 694.72 149.25C695.93 149.25 696.52 150.05 696.52 151.61V157H698.24V151.17C698.24 149.23 697.24 147.75 695.21 147.75C693.96 147.75 692.85 148.33 692.38 149.59L692.34 147.96H690.76ZM704.9 157.2C706.98 157.2 708.51 155.86 708.85 153.8L707.1 153.7C706.84 154.98 705.99 155.62 704.92 155.62C703.39 155.62 702.47 154.43 702.47 152.48C702.47 150.52 703.39 149.33 704.92 149.33C705.99 149.33 706.77 149.98 707.05 151.12L708.8 151C708.46 148.96 706.96 147.75 704.9 147.75C702.37 147.75 700.69 149.62 700.69 152.48C700.69 155.33 702.37 157.2 704.9 157.2ZM714.99 157.2C716.94 157.2 718.33 156.08 718.84 154.37L717.06 154.25C716.77 155.08 716.06 155.62 715 155.62C713.57 155.62 712.67 154.72 712.57 152.99H719.01V152.51C719.01 149.52 717.33 147.75 714.93 147.75C712.42 147.75 710.79 149.62 710.79 152.48C710.79 155.35 712.44 157.2 714.99 157.2ZM712.59 151.61C712.79 150.12 713.64 149.33 714.92 149.33C716.14 149.33 717.03 150.06 717.14 151.61Z" fill="#5f6469"/>
9
+ <rect x="963" y="99" width="181" height="42" rx="10" fill="none" stroke="#5f6469" stroke-width="1.5"/>
10
+ <rect x="983" y="113" width="4" height="14" fill="#c21e86"/>
11
+ <path d="M1000.73 127.76H1002.01L1006.87 114H1005.59ZM1013.62 126.19C1015.51 126.19 1016.89 124.98 1017.24 123.09L1015.83 122.99C1015.58 124.27 1014.71 124.91 1013.62 124.91C1012.06 124.91 1011.13 123.73 1011.13 121.76C1011.13 119.79 1012.06 118.61 1013.62 118.61C1014.71 118.61 1015.51 119.25 1015.77 120.37L1017.18 120.27C1016.82 118.38 1015.51 117.33 1013.62 117.33C1011.26 117.33 1009.72 119.07 1009.72 121.76C1009.72 124.45 1011.26 126.19 1013.62 126.19ZM1022.41 126.19C1023.62 126.19 1024.52 125.63 1024.98 124.62V126H1026.26V117.52H1024.92V122.58C1024.92 124.1 1024.1 125.01 1022.78 125.01C1021.56 125.01 1020.98 124.26 1020.98 122.61V117.52H1019.64V122.98C1019.64 124.99 1020.73 126.19 1022.41 126.19ZM1029.24 126H1035.48V124.82H1032.79V120.88C1032.79 119.49 1033.46 118.74 1034.71 118.74H1036.44V117.52H1034.7C1033.64 117.52 1032.94 118.06 1032.66 119.17L1032.57 117.52H1029.24V118.7H1031.45V124.82H1029.24ZM1042.36 126.19C1044.28 126.19 1045.72 125.3 1045.72 123.79C1045.72 122.38 1045.02 121.7 1042.39 121.26C1040.86 121.01 1040.28 120.75 1040.28 119.89C1040.28 119.17 1040.86 118.61 1042.1 118.61C1043.26 118.61 1043.96 119.25 1044.15 120.14L1045.56 120.05C1045.3 118.58 1044.22 117.33 1042.12 117.33C1040.04 117.33 1038.9 118.42 1038.9 119.89C1038.9 121.26 1039.64 122.02 1042.1 122.45C1043.96 122.77 1044.34 123.06 1044.34 123.79C1044.34 124.56 1043.61 124.91 1042.36 124.91C1041.02 124.91 1040.25 124.29 1040.09 123.23L1038.68 123.33C1038.81 124.93 1040.15 126.19 1042.36 126.19ZM1051.8 126.19C1054.14 126.19 1055.67 124.46 1055.67 121.76C1055.67 119.06 1054.14 117.33 1051.8 117.33C1049.45 117.33 1047.93 119.06 1047.93 121.76C1047.93 124.46 1049.45 126.19 1051.8 126.19ZM1051.8 124.91C1050.23 124.91 1049.34 123.73 1049.34 121.76C1049.34 119.79 1050.23 118.61 1051.8 118.61C1053.35 118.61 1054.26 119.79 1054.26 121.76C1054.26 123.73 1053.35 124.91 1051.8 124.91ZM1058.04 126H1064.28V124.82H1061.59V120.88C1061.59 119.49 1062.26 118.74 1063.51 118.74H1065.24V117.52H1063.5C1062.44 117.52 1061.74 118.06 1061.46 119.17L1061.37 117.52H1058.04V118.7H1060.25V124.82H1058.04ZM1080.01 126.19C1081.22 126.19 1082.12 125.63 1082.58 124.62V126H1083.86V117.52H1082.52V122.58C1082.52 124.1 1081.7 125.01 1080.38 125.01C1079.16 125.01 1078.58 124.26 1078.58 122.61V117.52H1077.24V122.98C1077.24 124.99 1078.33 126.19 1080.01 126.19ZM1090.36 126.19C1092.28 126.19 1093.72 125.3 1093.72 123.79C1093.72 122.38 1093.02 121.7 1090.39 121.26C1088.86 121.01 1088.28 120.75 1088.28 119.89C1088.28 119.17 1088.86 118.61 1090.1 118.61C1091.26 118.61 1091.96 119.25 1092.15 120.14L1093.56 120.05C1093.3 118.58 1092.22 117.33 1090.12 117.33C1088.04 117.33 1086.9 118.42 1086.9 119.89C1086.9 121.26 1087.64 122.02 1090.1 122.45C1091.96 122.77 1092.34 123.06 1092.34 123.79C1092.34 124.56 1091.61 124.91 1090.36 124.91C1089.02 124.91 1088.25 124.29 1088.09 123.23L1086.68 123.33C1086.81 124.93 1088.15 126.19 1090.36 126.19ZM1098.68 126.19C1099.9 126.19 1100.98 125.63 1101.45 124.8L1101.46 124.88C1101.66 125.7 1102.2 126.03 1103.1 126.03C1103.35 126.03 1103.67 126.02 1103.8 126V124.82H1103.26C1102.9 124.82 1102.74 124.69 1102.74 124.3V120.78C1102.74 118.64 1101.56 117.33 1099.51 117.33C1097.59 117.33 1096.34 118.42 1096.02 120.02L1097.45 120.13C1097.7 119.15 1098.33 118.61 1099.51 118.61C1100.73 118.61 1101.4 119.31 1101.4 120.75L1098.55 121.33C1096.7 121.7 1095.86 122.45 1095.86 123.89C1095.86 125.26 1097.08 126.19 1098.68 126.19ZM1098.81 125.01C1097.85 125.01 1097.27 124.56 1097.27 123.76C1097.27 123.06 1097.66 122.64 1098.81 122.42L1101.4 121.9V122.64C1101.4 124.05 1100.54 125.01 1098.81 125.01ZM1109.35 128.59C1111.69 128.59 1113.08 127.41 1113.08 125.42V117.52H1111.8V118.86C1111.42 117.92 1110.38 117.33 1109.19 117.33C1107.06 117.33 1105.56 119.02 1105.56 121.44C1105.56 123.86 1107.1 125.55 1109.26 125.55C1110.36 125.55 1111.32 124.98 1111.74 124.08V125.46C1111.74 126.7 1110.89 127.31 1109.35 127.31C1108.04 127.31 1107.46 126.83 1107.21 126.03L1105.8 126.13C1106.15 127.62 1107.53 128.59 1109.35 128.59ZM1109.32 124.27C1107.86 124.27 1106.97 123.18 1106.97 121.44C1106.97 119.7 1107.83 118.61 1109.32 118.61C1110.79 118.61 1111.77 119.7 1111.74 121.44C1111.72 123.18 1110.78 124.27 1109.32 124.27ZM1119.1 126.19C1120.89 126.19 1122.2 125.12 1122.65 123.6L1121.21 123.49C1120.92 124.35 1120.2 124.91 1119.1 124.91C1117.62 124.91 1116.71 124 1116.62 122.18H1122.79V121.78C1122.79 118.93 1121.24 117.33 1119.03 117.33C1116.7 117.33 1115.21 119.07 1115.21 121.76C1115.21 124.45 1116.7 126.19 1119.1 126.19ZM1116.62 120.99C1116.84 119.42 1117.72 118.61 1119.03 118.61C1120.28 118.61 1121.19 119.36 1121.32 120.99Z" fill="#101317"/>
12
+ </svg>
package/docs/brand.md ADDED
@@ -0,0 +1,300 @@
1
+ # Mark
2
+
3
+ Four congruent slabs pinwheeled around the centre of the square: the four legs of one turn. Pi
4
+ assembles the context, Pi sends the request, **Cursor streams the routed inference**, Pi commits the
5
+ transcript. Three legs are ink, one is magenta, and the magenta leg is 25% of the figure by area, so
6
+ the ownership ratio is drawn rather than implied. The four gaps are the handoffs. The cross-shaped
7
+ void in the middle is the turn's own state, which never leaves Pi.
8
+
9
+ This is an unofficial provider. The mark borrows nothing from Cursor's own logo, letterforms, or
10
+ isometric geometry, and it must stay that way.
11
+
12
+ | File | Use |
13
+ |:--|:--|
14
+ | [`mark.svg`](mark.svg) | Square mark, paper field. Avatar, favicon, docs. |
15
+ | [`mark-dark.svg`](mark-dark.svg) | Same geometry, graphite field. |
16
+ | [`banner.svg`](banner.svg) | README header, 1200×240. |
17
+ | [`banner-dark.svg`](banner-dark.svg) | Same, graphite field. |
18
+ | `gallery.svg` | pi.dev package card, 3840×2160 on a 1200×675 design grid. Repository-only: it is **not** in the package `files` whitelist, so do not link to it from a packaged file — see [Gallery](#gallery). |
19
+ | [`gallery.png`](gallery.png) | The shipped card image, rendered 1:1 from `gallery.svg`. |
20
+
21
+ Pair the two fields with `<picture>` and `prefers-color-scheme`. **Never recolour a single file at
22
+ the call site**, and never scale the mark to supply padding — see [Construction](#construction).
23
+
24
+ ## Palette
25
+
26
+ | | Hex | Role |
27
+ |:--|:--|:--|
28
+ | Paper | `#ecedef` | Field, or figure on graphite |
29
+ | Graphite | `#101317` | Figure, or field |
30
+ | Magenta | `#c21e86` | The routed leg, and the same accent on the banner chip. One accent, never two |
31
+
32
+ Banner-only tints: `#5f6469` (muted on paper), `#8b9299` (muted on graphite), `#d9dbde` / `#23272c`
33
+ (hairline). The muted tone carries the tagline and the chip outline; the hairline carries nothing but
34
+ the 1.5-unit inset border.
35
+
36
+ The square mark has exactly one magenta shape. The banner repeats that magenta on the chip glyph so
37
+ the header matches the mark. It is the same accent, not a second role.
38
+
39
+ ### Measured contrast
40
+
41
+ | Pair | On paper | On graphite |
42
+ |:--|:--|:--|
43
+ | Wordmark | 15.90:1 | 15.90:1 |
44
+ | Tagline and chip outline (muted) | 5.10:1 | 5.91:1 |
45
+ | Magenta `#c21e86` | 4.69:1 | 3.39:1 |
46
+
47
+ Text clears 4.5:1 on both fields; the accent clears 3:1 for non-text on both. That is what lets one
48
+ magenta value serve light and dark without a second file.
49
+
50
+ **Before changing the accent hue**, check it against this pair: any replacement must have WCAG
51
+ relative luminance in **L ∈ [0.119, 0.249]** to clear 3:1 against both `#ecedef` and `#101317`.
52
+ Magenta sits at 0.141. A hue outside that band fails one field. The band is specific to this field
53
+ pair and does not transfer if the neutrals change.
54
+
55
+ ## Construction
56
+
57
+ A 32-unit square, corner radius 6. One slab is defined; the other three are that slab rotated.
58
+
59
+ Define the top slab as `4.5,4.5 13.5×6.5`. Under **90° rotation about `16,16`** —
60
+ `(x,y) → (32−y, x)` — the top slab maps exactly onto the right slab, the right onto the bottom, the
61
+ bottom onto the left, and the left back onto the top:
62
+
63
+ | Slab | Rect | Fill |
64
+ |:--|:--|:--|
65
+ | Top | `4.5,4.5 13.5×6.5` | Graphite |
66
+ | Right | `21,4.5 6.5×13.5` | **Magenta** |
67
+ | Bottom | `14,21 13.5×6.5` | Graphite |
68
+ | Left | `4.5,14 6.5×13.5` | Graphite |
69
+
70
+ **That rotation is the construction rule. Verify any edit by rotating one slab onto the next, never
71
+ by eye.** The figure spans `4.5–27.5` on both axes, so it is centred on the square and clears the
72
+ field by 4.5 units on every side.
73
+
74
+ Two numbers are load bearing.
75
+
76
+ **Every gap is 3 units** — one at each corner of the whirl: between the top slab's right end at
77
+ `x 18` and the right slab at `x 21`, and its three rotations. That is 1.5px at 16px, which holds.
78
+ Closing any gap turns the pinwheel into a closed ring, which is a different and much weaker mark.
79
+
80
+ **Slab thickness is 6.5 units, not 3.** At 3 units the same four-slab arrangement scatters into
81
+ unrelated dashes at 16px and the rotation stops reading. This was measured at 16px, not assumed, and
82
+ it is the reason the slabs are slabs.
83
+
84
+ Pad by moving geometry, never by scaling the figure inside the square: a scale takes the 3-unit gaps
85
+ down with it, and the gaps are the first thing to disappear at 16px — which is the size the mark is
86
+ checked at.
87
+
88
+ No two slabs touch. The magenta slab therefore abuts nothing, and no ink-to-accent antialias seam is
89
+ possible anywhere in the file. The three graphite slabs are subpaths of **one** `<path>` for the same
90
+ reason: as separate `<rect>`s each antialiases against the field, so a shared edge on a fractional
91
+ coordinate composites to roughly 75% coverage and shows as a grey hairline through the figure. One
92
+ path rasterises in one pass. Anything added to this mark goes in the same path.
93
+
94
+ ## Banner geometry
95
+
96
+ | Element | Geometry |
97
+ |:--|:--|
98
+ | Field | `0,0 1200×240`, rx 24 |
99
+ | Hairline | inset 0.75, rx 23.25, stroke 1.5 |
100
+ | Mark tile | `56,64 112×112`, rx 21, **inverted field** |
101
+ | Mark placement | `X = 56 + 3.5u`, `Y = 64 + 3.5u` — the 32-unit mark at 3.5× |
102
+ | Wordmark | pen origin `x 210`, baseline 123; ends at 507 |
103
+ | Tagline | pen origin `x 210`, baseline 157; ends at 720 |
104
+ | Chip | `963,99 181×42`, rx 10, outline 1.5; right edge **1144** |
105
+ | Chip glyph | `983,113 4×14`, magenta — one slab of the mark |
106
+ | Chip label | pen origin `x 999`, baseline 126; ends at 1123.8, right pad 20.2 |
107
+
108
+ The tile inverts the field, so the mark inside it is paper-on-graphite in `banner.svg` and
109
+ graphite-on-paper in `banner-dark.svg`. The magenta slab is identical in both.
110
+
111
+ ## Banner text
112
+
113
+ Wordmark `pi-cursor`. Tagline `/cursor in Pi · unofficial routed Cursor inference`. Chip
114
+ `/cursor usage`.
115
+
116
+ The wordmark is **`pi-cursor`, not `pi-cursor-inference`**. The public
117
+ `pi-cursor-inference@0.0.0` package is a blank name reservation that does not contain this provider,
118
+ so putting the package name on the banner would imply the published artifact is this code.
119
+ `pi-cursor` is the repository identity and carries no such claim. For the same reason the chip is the
120
+ operator surface and **not** an install command.
121
+
122
+ Set in [Geist Mono](https://github.com/vercel/geist-font) (OFL) 1.700 and converted to outlines:
123
+ wordmark **Black 60px with −3 tracking**, tagline **Medium 17px**, chip **Regular 16px**. Geist Mono
124
+ advances 600/1000 units per glyph at every weight and applies no kerning, so a run of `n` characters
125
+ at size `s` occupies `n · 0.6s` plus tracking — that is where the pen-end numbers in
126
+ [Banner geometry](#banner-geometry) come from.
127
+
128
+ **The shipped SVGs contain no `<text>`, no `font-family`, no `@font-face`, and no font file.** Do not
129
+ add one to change wording; reshape instead.
130
+
131
+ ### Regenerating the outlines
132
+
133
+ To change any of the three strings, re-shape it with HarfBuzz and re-extract the outlines. Save the
134
+ script below, put the Geist Mono OTFs in one directory, and run it with
135
+ `uv run outline.py --fonts <dir>`; `uv` resolves the inline dependencies itself.
136
+
137
+ ```python
138
+ # /// script
139
+ # requires-python = ">=3.11"
140
+ # dependencies = ["fonttools>=4.53", "uharfbuzz>=0.39"]
141
+ # ///
142
+ """Shape a string with HarfBuzz and emit SVG outline path data for the pi-cursor banner."""
143
+ import argparse, pathlib
144
+ import uharfbuzz as hb
145
+ from fontTools.misc.transform import Transform
146
+ from fontTools.pens.svgPathPen import SVGPathPen
147
+ from fontTools.pens.transformPen import TransformPen
148
+ from fontTools.ttLib import TTFont
149
+
150
+ def outline(fonts, text, weight, size, x, baseline, tracking=0.0):
151
+ path = pathlib.Path(fonts) / f"GeistMono-{weight}.otf"
152
+ face = hb.Face(hb.Blob.from_file_path(str(path)))
153
+ font = hb.Font(face)
154
+ upem = face.upem
155
+ font.scale = (upem, upem)
156
+ buf = hb.Buffer()
157
+ buf.add_str(text)
158
+ buf.guess_segment_properties()
159
+ hb.shape(font, buf, {"kern": True, "liga": True})
160
+ tt = TTFont(path)
161
+ order, gset = tt.getGlyphOrder(), tt.getGlyphSet()
162
+ s, pen_x, parts = size / upem, x, []
163
+ for info, pos in zip(buf.glyph_infos, buf.glyph_positions):
164
+ pen = SVGPathPen(gset, ntos=lambda v: f"{round(v, 2):g}")
165
+ gx, gy = pen_x + pos.x_offset * s, baseline - pos.y_offset * s
166
+ gset[order[info.codepoint]].draw(TransformPen(pen, Transform(s, 0, 0, -s, gx, gy)))
167
+ if d := pen.getCommands():
168
+ parts.append(d)
169
+ pen_x += pos.x_advance * s + tracking
170
+ return "".join(parts), pen_x
171
+
172
+ RUNS = [
173
+ ("wordmark", "pi-cursor", "Black", 60, 210, 123, -3),
174
+ ("tagline", "/cursor in Pi · unofficial routed Cursor inference", "Medium", 17, 210, 157, 0),
175
+ ("chip", "/cursor usage", "Regular", 16, 999, 126, 0),
176
+ ]
177
+
178
+ ap = argparse.ArgumentParser()
179
+ ap.add_argument("--fonts", required=True, help="directory holding the Geist Mono OTFs")
180
+ args = ap.parse_args()
181
+ for name, text, weight, size, x, baseline, tracking in RUNS:
182
+ d, end = outline(args.fonts, text, weight, size, x, baseline, tracking)
183
+ print(f"{name}: pen {x} -> {end}\n{d}\n")
184
+ ```
185
+
186
+ Each run becomes **one** `<path>` in the banner, in the fill its role requires: wordmark and chip
187
+ label take the figure colour, the tagline takes the muted tint. Coordinates are rounded to two
188
+ decimals. The transform `Transform(s, 0, 0, -s, pen_x, baseline)` is what flips the font's y-up
189
+ outlines into SVG's y-down space; the negative `s` is not optional.
190
+
191
+ Tracking is applied as extra advance **after** each glyph, so the pen origin is the left edge of the
192
+ first glyph's advance, not of its ink. The ink starts one left-side-bearing further right, which is
193
+ why the wordmark's first path coordinate is not 210.
194
+
195
+ ## Gallery
196
+
197
+ pi.dev renders package media in a **232×129.625** box with `object-fit: cover`, so the source must be
198
+ exactly 16:9 or the card crops it. `gallery.svg` and `gallery.png` are **3840×2160 (4K)**, with the
199
+ SVG retaining a `0 0 1200 675` design grid so the construction coordinates below stay readable.
200
+ Resolution is not the layout contract: 16:9 is. Never reduce the raster below 4K. The bordered card's
201
+ inner image box still trims about **2.26 design-grid units off the top and bottom**, so nothing may
202
+ sit at the vertical edges.
203
+
204
+ The card is **full bleed and opaque**: no outer corner radius, no inset hairline, no transparent
205
+ pixel. A radius here doubles against the card's own corners, a hairline loses its horizontal runs to
206
+ the trim and reads as a frame missing two sides, and transparent corners composite unpredictably
207
+ against a page field we do not control. There is one field only: pi.dev serves a single image URL, so
208
+ the gallery has no dark variant to pair.
209
+
210
+ This is not the banner cropped or rescaled. It is a centred vertical stack — mark tile, wordmark,
211
+ tagline, chip — sized for a thumbnail. The wordmark-to-tagline size ratio widens from the banner's
212
+ 3.53 to **4.33** so the wordmark still reads at 232px wide while the tagline stays one exact line.
213
+
214
+ ### Gallery geometry
215
+
216
+ | Element | Geometry |
217
+ |:--|:--|
218
+ | Field | `0,0 1200×675`, no radius, opaque `#ecedef` |
219
+ | Stack | centred on `x 600`; top `y 92`, bottom `y 582.24`; margins 92 top, 92.76 bottom |
220
+ | Mark tile | `496,92 208×208`, rx 39, **inverted field** |
221
+ | Mark placement | `X = 496 + 6.5u`, `Y = 92 + 6.5u` — the 32-unit mark at 6.5× |
222
+ | Wordmark | pen origin `x 339.48`, baseline 427.5; ink 343.64–856.36, pen end 854.28 |
223
+ | Tagline | pen origin `x 239.48`, baseline 483.1; ink 241.9–958.09, pen end 959.48 |
224
+ | Chip | `486.88,529.74 226.25×52.5`, rx 12.5; outline inset 0.94, stroke 1.88; right edge **713.13** |
225
+ | Chip glyph | `511.88,547.24 5×17.5`, magenta — one slab of the mark |
226
+ | Chip label | pen origin `x 531.88`, baseline 563.49; ends at 687.88, right pad 25.25 |
227
+
228
+ Three vertical gaps carry the grouping, measured **ink box to ink box**, not baseline to baseline:
229
+ tile bottom → wordmark ink top **52**, wordmark ink bottom → tagline ink top **22**, tagline ink
230
+ bottom → chip top **44**. Ink heights are 91.1 for the wordmark and 20.64 for the tagline.
231
+
232
+ **The tagline gap is exactly half the chip gap, and that ratio is load bearing.** At the card's
233
+ 0.19333× those three gaps become 10.1, 4.3 and 8.5 px. Equalise them and the card shows three
234
+ equidistant grey lines instead of a wordmark with its subtitle and a separate chip.
235
+
236
+ The mark tile is 208, not 200, because `u = 6.5` puts every half-unit coordinate of
237
+ [Construction](#construction) on an exact two-decimal value. At `u = 6.25` the slabs land on
238
+ `x.xx5` and the rotation check below fails on rounding alone.
239
+
240
+ The chip is the banner chip scaled by **1.25** (label 16 → 20px): box `181×42 rx 10` →
241
+ `226.25×52.5 rx 12.5`, glyph `+20,+14 4×14` → `+25,+17.5 5×17.5`, label pen `+36` → `+45`, label
242
+ baseline `+27` → `+33.75`. The 45 / 25.25 padding asymmetry is intentional — the magenta bar occupies
243
+ the left — so centre the **box** on `x 600`, never the label inside the box.
244
+
245
+ ### Regenerating the gallery outlines
246
+
247
+ Run the script in [Regenerating the outlines](#regenerating-the-outlines) with this `RUNS` instead.
248
+ Wordmark **Black 104px with −5.2 tracking** (the banner's −0.05 em), tagline **Medium 24px**, chip
249
+ label **Regular 20px**; the three strings are the banner's, unchanged.
250
+
251
+ ```python
252
+ RUNS = [
253
+ ("wordmark", "pi-cursor", "Black", 104, 339.48, 427.5, -5.2),
254
+ ("tagline", "/cursor in Pi · unofficial routed Cursor inference", "Medium", 24, 239.48, 483.1, 0),
255
+ ("chip", "/cursor usage", "Regular", 20, 531.88, 563.49, 0),
256
+ ]
257
+ ```
258
+
259
+ The mark slabs are baked at `496 + 6.5x, 92 + 6.5y`, exactly as the banner bakes them at 3.5×. The
260
+ file carries **no `transform` attribute anywhere**; a `translate … scale` wrapper makes every number
261
+ in the table above unverifiable.
262
+
263
+ ### Gallery verification
264
+
265
+ Anything that regenerates the two gallery files must still pass all of it:
266
+
267
+ 1. `xmllint --noout docs/gallery.svg`, intrinsic `width="3840" height="2160"`, a proportional
268
+ `viewBox="0 0 1200 675"`, and a non-empty `aria-label`.
269
+ 2. No `<text>`, `font-family`, `@font-face`, `base64`, `<image>`, `<script>`, `<metadata>`, comment,
270
+ editor namespace, or filesystem path. The file is one `<svg>`, four `<rect>` and five `<path>`,
271
+ and its only URL is the SVG namespace. Also no `transform` — that one is **gallery-only**, not an
272
+ omission from the shared list, because [Gallery geometry](#gallery-geometry) is stated in absolute
273
+ coordinates and a wrapper transform would make every number in it unverifiable.
274
+ 3. `magick identify -format '%w x %h %[opaque]' docs/gallery.png` → `3840 x 2160 True`. The raster
275
+ must remain 16:9 and at least 4K; higher resolutions are allowed. The PNG must equal the SVG
276
+ render: `magick compare -metric AE <render> docs/gallery.png null:` → `0`.
277
+ 4. Rotate each unit slab by `(x,y) → (32−y, x)` and confirm the set is closed, as in
278
+ [Construction](#construction). Never check the mark by eye.
279
+ 5. Simulate the card **from the PNG**, never by rendering the SVG small — pi.dev resamples a bitmap,
280
+ and a small SVG render is crisper than anything a visitor sees:
281
+ `magick docs/gallery.png -filter Lanczos -resize 232x131! -gravity center -crop 232x130+0+0 card.png`.
282
+ Look at it, and at 2× (`464x261` cropped to `464x260`). Every 3-unit gap in the mark must still be
283
+ open and the magenta slab must still be visible.
284
+ 6. Render with `FONTCONFIG_FILE` pointing at a config whose only `<dir>` is empty, and confirm the
285
+ output is pixel-identical to a normal render.
286
+
287
+ ## Verification
288
+
289
+ Anything that regenerates these files must still pass all of it:
290
+
291
+ 1. `xmllint --noout` on all four files.
292
+ 2. Both banners exactly `width="1200" height="240"` with a matching `viewBox`, both marks
293
+ `viewBox="0 0 32 32"`, and a non-empty `aria-label` on all four including the dark variants.
294
+ 3. No `<text>`, `font-family`, `@font-face`, `base64`, `<image>`, `<script>`, `<metadata>`, comment,
295
+ editor namespace, or filesystem path in any of the four files.
296
+ 4. Render each banner in **both** fields and look at it. Exit 0 is not evidence.
297
+ 5. Render both marks at **16px** and look at them. Every 3-unit gap must still be open and the
298
+ magenta slab must still be visible. This is the size that decides whether an edit is allowed.
299
+ 6. Rendering with fontconfig pointed at a directory containing no fonts must be pixel-identical to a
300
+ normal render. That is the proof there is no font dependency left, and it currently holds exactly.
Binary file
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32" role="img" aria-label="pi-cursor">
2
+ <rect width="32" height="32" rx="6" fill="#101317"/>
3
+ <path d="M4.5 4.5h13.5v6.5h-13.5zM14 21h13.5v6.5h-13.5zM4.5 14h6.5v13.5h-6.5z" fill="#ecedef"/>
4
+ <path d="M21 4.5h6.5v13.5h-6.5z" fill="#c21e86"/>
5
+ </svg>
package/docs/mark.svg ADDED
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32" role="img" aria-label="pi-cursor">
2
+ <rect width="32" height="32" rx="6" fill="#ecedef"/>
3
+ <path d="M4.5 4.5h13.5v6.5h-13.5zM14 21h13.5v6.5h-13.5zM4.5 14h6.5v13.5h-6.5z" fill="#101317"/>
4
+ <path d="M21 4.5h6.5v13.5h-6.5z" fill="#c21e86"/>
5
+ </svg>
package/package.json CHANGED
@@ -1,19 +1,108 @@
1
1
  {
2
2
  "name": "pi-cursor-inference",
3
- "version": "0.0.0",
4
- "description": "Cursor as a plain inference provider for Pi, over aiserver.v1.InferenceService/RunInference. Placeholder release; the provider is under development.",
3
+ "version": "0.0.2",
4
+ "description": "Unofficial Cursor managed inference provider for Pi with native OAuth, dynamic models, and Pi-owned tools.",
5
5
  "license": "MIT",
6
+ "sideEffects": false,
7
+ "author": {
8
+ "name": "Victor Araújo",
9
+ "email": "victor@victor-software-house.com"
10
+ },
6
11
  "type": "module",
12
+ "main": "./dist/index.mjs",
13
+ "types": "./dist/index.d.mts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.mts",
17
+ "import": "./dist/index.mjs"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "pi": {
22
+ "extensions": [
23
+ "./dist/index.mjs"
24
+ ],
25
+ "image": "https://raw.githubusercontent.com/victor-software-house/pi-cursor/main/docs/gallery.png"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "docs/banner.svg",
30
+ "docs/banner-dark.svg",
31
+ "docs/mark.svg",
32
+ "docs/mark-dark.svg",
33
+ "docs/brand.md",
34
+ "docs/gallery.png",
35
+ "README.md",
36
+ "CHANGELOG.md",
37
+ "LICENSE"
38
+ ],
39
+ "scripts": {
40
+ "prepublishOnly": "mise run verify"
41
+ },
42
+ "engines": {
43
+ "node": ">=24"
44
+ },
45
+ "packageManager": "bun@1.4.0",
46
+ "devEngines": {
47
+ "runtime": {
48
+ "name": "node",
49
+ "version": ">=24"
50
+ },
51
+ "packageManager": {
52
+ "name": "bun",
53
+ "version": ">=1.4.0 <2.0.0"
54
+ }
55
+ },
56
+ "publishConfig": {
57
+ "access": "public",
58
+ "registry": "https://registry.npmjs.org"
59
+ },
7
60
  "repository": {
8
61
  "type": "git",
9
62
  "url": "git+https://github.com/victor-software-house/pi-cursor.git"
10
63
  },
11
64
  "homepage": "https://github.com/victor-software-house/pi-cursor#readme",
12
- "bugs": "https://github.com/victor-software-house/pi-cursor/issues",
13
- "keywords": ["pi", "pi-package", "cursor", "provider", "inference"],
14
- "files": ["README.md", "LICENSE"],
15
- "publishConfig": {
16
- "registry": "https://registry.npmjs.org",
17
- "access": "public"
65
+ "bugs": {
66
+ "url": "https://github.com/victor-software-house/pi-cursor/issues"
67
+ },
68
+ "keywords": [
69
+ "pi",
70
+ "pi-package",
71
+ "pi-extension",
72
+ "cursor",
73
+ "provider",
74
+ "inference"
75
+ ],
76
+ "peerDependencies": {
77
+ "@earendil-works/pi-ai": "*",
78
+ "@earendil-works/pi-coding-agent": "*",
79
+ "@earendil-works/pi-tui": "*"
80
+ },
81
+ "dependencies": {
82
+ "@bufbuild/protobuf": "2.14.1",
83
+ "ts-pattern": "5.9.0"
84
+ },
85
+ "devDependencies": {
86
+ "@biomejs/biome": "2.5.11",
87
+ "@bufbuild/protoc-gen-es": "2.14.1",
88
+ "@changesets/cli": "3.0.1",
89
+ "@changesets/get-github-info": "0.8.0",
90
+ "@changesets/types": "7.0.0",
91
+ "@commitlint/cli": "21.2.2",
92
+ "@commitlint/config-conventional": "21.2.2",
93
+ "@earendil-works/pi-ai": "0.84.4",
94
+ "@earendil-works/pi-coding-agent": "0.84.4",
95
+ "@earendil-works/pi-tui": "0.84.4",
96
+ "@types/bun": "1.4.0",
97
+ "@types/node": "26.4.0",
98
+ "@victor-software-house/pi-components": "0.2.17",
99
+ "@victor-software-house/pi-type-kit": "0.0.5",
100
+ "bun-release": "0.0.3",
101
+ "liquidjs": "10.29.0",
102
+ "oxlint": "1.80.0",
103
+ "oxlint-tsgolint": "7.0.2001",
104
+ "publint": "0.3.22",
105
+ "tsdown": "0.22.14",
106
+ "typescript": "7.0.2"
18
107
  }
19
108
  }