@cursor/sdk 1.0.19 → 1.0.21

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.
@@ -3,14 +3,15 @@ import type { Interceptor, Transport } from "@connectrpc/connect";
3
3
  * Runtime-agnostic Connect transport seam.
4
4
  *
5
5
  * The SDK's RPC layer must not statically import `@connectrpc/connect-node`,
6
- * because that couples the whole load path to Node and forces Bun/Deno to
7
- * resolve a Node-only package at import time. This module is the single place
8
- * that decides which Connect transport implementation to use and loads it
9
- * dynamically:
6
+ * because that couples the whole load path to Node and forces fetch-only
7
+ * runtimes to resolve a Node-only package at import time. This module is the
8
+ * single place that decides which Connect transport implementation to use and
9
+ * loads it dynamically:
10
10
  *
11
- * - **Node** → `@connectrpc/connect-node` (unchanged behavior, including the
12
- * HTTP/1.1 vs HTTP/2 `httpVersion` selection the callers already compute).
13
- * - **Bun / Deno** → `@connectrpc/connect-web` (fetch-based; no HTTP/2 tuning).
11
+ * - **Node / Bun** → `@connectrpc/connect-node` (native HTTP/2 bidi, including
12
+ * the HTTP/1.1 vs HTTP/2 `httpVersion` selection the callers already compute).
13
+ * Bun implements `node:http2`, so it uses the same path as Node.
14
+ * - **Deno / other fetch-only runtimes** → `@connectrpc/connect-web` (fetch).
14
15
  * - **Embedder override** → whatever `setConnectTransportFactory` installs.
15
16
  *
16
17
  * Call sites keep their synchronous shape via {@link createLazyConnectTransport}:
@@ -20,9 +21,8 @@ import type { Interceptor, Transport } from "@connectrpc/connect";
20
21
  export interface ConnectTransportSeamOptions {
21
22
  baseUrl: string;
22
23
  /**
23
- * Only consumed by the Node (`connect-node`) transport. The fetch-based
24
- * transport used on Bun/Deno always speaks HTTP/1.1-style fetch and ignores
25
- * this; it is retained on the seam so the Node path is byte-for-byte unchanged.
24
+ * Consumed by the connect-node transport (Node and Bun). The fetch-based
25
+ * transport used on Deno/browser ignores it.
26
26
  */
27
27
  httpVersion: "1.1" | "2";
28
28
  interceptors?: Interceptor[];
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/agent/transport.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,WAAW,EAEX,SAAS,EAEV,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,WAAW,EAAE,KAAK,GAAG,GAAG,CAAC;IACzB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;CAC9B;AAED,MAAM,MAAM,uBAAuB,GAAG,CACpC,OAAO,EAAE,2BAA2B,KACjC,OAAO,CAAC,SAAS,CAAC,CAAC;AAIxB;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,uBAAuB,GAAG,SAAS,GAC3C,IAAI,CAEN;AAoCD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,SAAS,CAAC,CAEpB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,2BAA2B,GACnC,SAAS,CAsDX"}
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/agent/transport.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,WAAW,EAEX,SAAS,EAEV,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,WAAW,EAAE,KAAK,GAAG,GAAG,CAAC;IACzB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;CAC9B;AAED,MAAM,MAAM,uBAAuB,GAAG,CACpC,OAAO,EAAE,2BAA2B,KACjC,OAAO,CAAC,SAAS,CAAC,CAAC;AAIxB;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,uBAAuB,GAAG,SAAS,GAC3C,IAAI,CAEN;AAiCD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,SAAS,CAAC,CAEpB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,2BAA2B,GACnC,SAAS,CAsDX"}
package/dist/esm/18.js CHANGED
@@ -1 +1 @@
1
- export const __webpack_esm_id__=18;export const __webpack_esm_ids__=[18];export const __webpack_esm_modules__={"../cursor-sdk-local-runtime/dist/run-store/sqlite-blob-store.js"(e,t,s){s.d(t,{SQLiteBlobStoreWithMetadata:()=>l});var i=s("node:fs"),r=s("node:path"),n=s("../agent-kv/dist/index.js"),o=s("../utils/dist/index.js"),a=s("../cursor-sdk-local-runtime/dist/run-store/sqlite/open-sqlite-driver.js");const d=new n.aY;class l extends o.jG{dbPath;driverPromise;driver;metadata;listeners={agentId:new Set,latestRootBlobId:new Set,name:new Set,createdAt:new Set,mode:new Set,isRunEverything:new Set,lastUsedModel:new Set,lastDebugServerPort:new Set,currentPlanUri:new Set};persistScheduled=!1;isDisposing=!1;disposePromise;static async initAndLoad(e){const t=new l(e);return await t.getDriver(),t}constructor(e){super(),this.dbPath=e;const t=(0,r.basename)((0,r.dirname)(this.dbPath));this.metadata=(0,n.sh)(t)}async getDriver(){if(this.driverPromise)return this.driverPromise;const e=(async()=>{const e=(0,r.dirname)(this.dbPath);(0,i.existsSync)(e)||(0,i.mkdirSync)(e,{recursive:!0});const t=await(0,a.d)(this.dbPath);try{this.initializeDriver(t)}catch(e){throw t.close(),e}return this.driver=t,t})().catch((t=>{throw this.driverPromise===e&&(this.driverPromise=void 0),t}));return this.driverPromise=e,e}initializeDriver(e){e.exec("PRAGMA journal_mode = WAL;\n PRAGMA synchronous = NORMAL;\n PRAGMA busy_timeout = 5000;\n PRAGMA user_version = 1;\n CREATE TABLE IF NOT EXISTS blobs (id TEXT PRIMARY KEY, data BLOB);\n CREATE TABLE IF NOT EXISTS meta (key TEXT PRIMARY KEY, value TEXT);");const t=e.get("SELECT value FROM meta WHERE key = ?",["0"]);if(null==t?void 0:t.value){const e=(0,n.aD)(t.value);return void(this.metadata=d.deserialize(e))}const s=d.serialize(this.metadata);e.run("INSERT OR REPLACE INTO meta (key, value) VALUES (?, ?)",["0",(0,n.nj)(s)])}async getBlob(e,t){if(this.isDisposing)return;const s=(0,n.nj)(t),i=(await this.getDriver()).get("SELECT data FROM blobs WHERE id = ?",[s]);return null==(null==i?void 0:i.data)?void 0:new Uint8Array(i.data)}async listBlobIds(){return this.isDisposing?[]:(await this.getDriver()).all("SELECT id FROM blobs ORDER BY id ASC").map((e=>e.id))}async deleteBlob(e){this.isDisposing||(await this.getDriver()).run("DELETE FROM blobs WHERE id = ?",[e])}async setBlob(e,t,s){if(this.isDisposing)return;const i=(0,n.nj)(t),r=Buffer.from(s);(await this.getDriver()).run("INSERT OR REPLACE INTO blobs (id, data) VALUES (?, ?)",[i,r])}async setBlobLocallyOnly(e,t,s){return Promise.resolve()}async flush(e){return Promise.resolve()}get(e){return this.metadata[e]}valuesEqual(e,t,s){if("latestRootBlobId"===e){const e=t,i=s;if(e===i)return!0;if(!e||!i)return!1;if(e.length!==i.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==i[t])return!1;return!0}return t===s}schedulePersist(){!this.isDisposing&&this.driver&&(this.persistScheduled||(this.persistScheduled=!0,queueMicrotask((()=>{this.persistScheduled=!1,!this.isDisposing&&this.driver&&this.persistMetadata()}))))}set(e,t){const s=this.metadata[e];if(this.valuesEqual(e,s,t))return;this.metadata=Object.assign(Object.assign({},this.metadata),{[e]:t}),this.driver&&this.schedulePersist();const i=this.listeners[e];i&&i.size>0&&queueMicrotask((()=>{i.forEach((e=>{e()}))}))}persistMetadata(){const e=this.driver;if(!e)return;const t=d.serialize(this.metadata);e.run("INSERT OR REPLACE INTO meta (key, value) VALUES (?, ?)",["0",(0,n.nj)(t)])}subscribe(e,t){const s=this.listeners[e];return s?(s.add(t),()=>s.delete(t)):()=>{}}async dispose(){return this.disposePromise?this.disposePromise:this.driverPromise?(this.disposePromise=this.cleanup().then((()=>{this.driverPromise=void 0,this.driver=void 0})),this.disposePromise):void 0}async cleanup(){var e;if(!this.driverPromise)return;const t=await this.driverPromise.catch((()=>{}));if(!t)return this.driverPromise=void 0,void(this.driver=void 0);this.persistScheduled=!1,this.persistMetadata(),this.isDisposing=!0;const s=t.get("SELECT value FROM meta WHERE key = ?",["0"]);let o=0;if(null==s?void 0:s.value){const e=(0,n.aD)(s.value);o=d.deserialize(e).latestRootBlobId.length}const a=t.get("SELECT COUNT(*) AS count FROM blobs"),l=Number(null!==(e=null==a?void 0:a.count)&&void 0!==e?e:0);if(t.close(),0===o&&0===l){this.driverPromise=void 0,this.driver=void 0;const e=(0,r.dirname)(this.dbPath);try{(0,i.rmSync)(e,{recursive:!0,force:!0})}catch(e){}}}}},"../cursor-sdk-local-runtime/dist/run-store/sqlite/open-sqlite-driver.js"(e,t,s){s.d(t,{d:()=>r});class i extends Error{constructor(e,t){super(e,t),this.name="NoSqliteDriverError"}}async function r(e){if(void 0!==globalThis.Bun)return(await s.e(914).then(s.bind(s,"../cursor-sdk-local-runtime/dist/run-store/sqlite/bun-sqlite-driver.js"))).openBunSqliteDriver(e);let t;try{t=await s.e(343).then(s.bind(s,"../cursor-sdk-local-runtime/dist/run-store/sqlite/node-sqlite-driver.js"))}catch(e){if(function(e){return"ERR_UNKNOWN_BUILTIN_MODULE"===("object"==typeof e&&null!==e&&"code"in e&&"string"==typeof e.code?e.code:void 0)||(e instanceof Error?e.message.toLowerCase():String(e).toLowerCase()).includes("node:sqlite")}(e))throw new i("node:sqlite is not available in this runtime. The default local agent store requires Node >= 22.13 (or another runtime that implements node:sqlite). Configure a JsonlLocalAgentStore instead.",{cause:e});throw e}return t.openNodeSqliteDriver(e)}}};
1
+ export const __webpack_esm_id__=18;export const __webpack_esm_ids__=[18];export const __webpack_esm_modules__={"../cursor-sdk-local-runtime/dist/run-store/sqlite-blob-store.js"(e,t,s){s.d(t,{SQLiteBlobStoreWithMetadata:()=>l});var i=s("node:fs"),r=s("node:path"),n=s("../agent-kv/dist/index.js"),o=s("../utils/dist/index.js"),a=s("../cursor-sdk-local-runtime/dist/run-store/sqlite/open-sqlite-driver.js");const d=new n.aY;class l extends o.jG{dbPath;driverPromise;driver;metadata;listeners={agentId:new Set,latestRootBlobId:new Set,name:new Set,createdAt:new Set,mode:new Set,isRunEverything:new Set,approvalMode:new Set,lastUsedModel:new Set,lastDebugServerPort:new Set,currentPlanUri:new Set};persistScheduled=!1;isDisposing=!1;disposePromise;static async initAndLoad(e){const t=new l(e);return await t.getDriver(),t}constructor(e){super(),this.dbPath=e;const t=(0,r.basename)((0,r.dirname)(this.dbPath));this.metadata=(0,n.sh)(t)}async getDriver(){if(this.driverPromise)return this.driverPromise;const e=(async()=>{const e=(0,r.dirname)(this.dbPath);(0,i.existsSync)(e)||(0,i.mkdirSync)(e,{recursive:!0});const t=await(0,a.d)(this.dbPath);try{this.initializeDriver(t)}catch(e){throw t.close(),e}return this.driver=t,t})().catch((t=>{throw this.driverPromise===e&&(this.driverPromise=void 0),t}));return this.driverPromise=e,e}initializeDriver(e){e.exec("PRAGMA journal_mode = WAL;\n PRAGMA synchronous = NORMAL;\n PRAGMA busy_timeout = 5000;\n PRAGMA user_version = 1;\n CREATE TABLE IF NOT EXISTS blobs (id TEXT PRIMARY KEY, data BLOB);\n CREATE TABLE IF NOT EXISTS meta (key TEXT PRIMARY KEY, value TEXT);");const t=e.get("SELECT value FROM meta WHERE key = ?",["0"]);if(null==t?void 0:t.value){const e=(0,n.aD)(t.value);return void(this.metadata=d.deserialize(e))}const s=d.serialize(this.metadata);e.run("INSERT OR REPLACE INTO meta (key, value) VALUES (?, ?)",["0",(0,n.nj)(s)])}async getBlob(e,t){if(this.isDisposing)return;const s=(0,n.nj)(t),i=(await this.getDriver()).get("SELECT data FROM blobs WHERE id = ?",[s]);return null==(null==i?void 0:i.data)?void 0:new Uint8Array(i.data)}async listBlobIds(){return this.isDisposing?[]:(await this.getDriver()).all("SELECT id FROM blobs ORDER BY id ASC").map((e=>e.id))}async deleteBlob(e){this.isDisposing||(await this.getDriver()).run("DELETE FROM blobs WHERE id = ?",[e])}async setBlob(e,t,s){if(this.isDisposing)return;const i=(0,n.nj)(t),r=Buffer.from(s);(await this.getDriver()).run("INSERT OR REPLACE INTO blobs (id, data) VALUES (?, ?)",[i,r])}async setBlobLocallyOnly(e,t,s){return Promise.resolve()}async flush(e){return Promise.resolve()}get(e){return this.metadata[e]}valuesEqual(e,t,s){if("latestRootBlobId"===e){const e=t,i=s;if(e===i)return!0;if(!e||!i)return!1;if(e.length!==i.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==i[t])return!1;return!0}return t===s}schedulePersist(){!this.isDisposing&&this.driver&&(this.persistScheduled||(this.persistScheduled=!0,queueMicrotask((()=>{this.persistScheduled=!1,!this.isDisposing&&this.driver&&this.persistMetadata()}))))}set(e,t){const s=this.metadata[e];if(this.valuesEqual(e,s,t))return;this.metadata=Object.assign(Object.assign({},this.metadata),{[e]:t}),this.driver&&this.schedulePersist();const i=this.listeners[e];i&&i.size>0&&queueMicrotask((()=>{i.forEach((e=>{e()}))}))}persistMetadata(){const e=this.driver;if(!e)return;const t=d.serialize(this.metadata);e.run("INSERT OR REPLACE INTO meta (key, value) VALUES (?, ?)",["0",(0,n.nj)(t)])}subscribe(e,t){const s=this.listeners[e];return s?(s.add(t),()=>s.delete(t)):()=>{}}async dispose(){return this.disposePromise?this.disposePromise:this.driverPromise?(this.disposePromise=this.cleanup().then((()=>{this.driverPromise=void 0,this.driver=void 0})),this.disposePromise):void 0}async cleanup(){var e;if(!this.driverPromise)return;const t=await this.driverPromise.catch((()=>{}));if(!t)return this.driverPromise=void 0,void(this.driver=void 0);this.persistScheduled=!1,this.persistMetadata(),this.isDisposing=!0;const s=t.get("SELECT value FROM meta WHERE key = ?",["0"]);let o=0;if(null==s?void 0:s.value){const e=(0,n.aD)(s.value);o=d.deserialize(e).latestRootBlobId.length}const a=t.get("SELECT COUNT(*) AS count FROM blobs"),l=Number(null!==(e=null==a?void 0:a.count)&&void 0!==e?e:0);if(t.close(),0===o&&0===l){this.driverPromise=void 0,this.driver=void 0;const e=(0,r.dirname)(this.dbPath);try{(0,i.rmSync)(e,{recursive:!0,force:!0})}catch(e){}}}}},"../cursor-sdk-local-runtime/dist/run-store/sqlite/open-sqlite-driver.js"(e,t,s){s.d(t,{d:()=>r});class i extends Error{constructor(e,t){super(e,t),this.name="NoSqliteDriverError"}}async function r(e){if(void 0!==globalThis.Bun)return(await s.e(914).then(s.bind(s,"../cursor-sdk-local-runtime/dist/run-store/sqlite/bun-sqlite-driver.js"))).openBunSqliteDriver(e);let t;try{t=await s.e(343).then(s.bind(s,"../cursor-sdk-local-runtime/dist/run-store/sqlite/node-sqlite-driver.js"))}catch(e){if(function(e){return"ERR_UNKNOWN_BUILTIN_MODULE"===("object"==typeof e&&null!==e&&"code"in e&&"string"==typeof e.code?e.code:void 0)||(e instanceof Error?e.message.toLowerCase():String(e).toLowerCase()).includes("node:sqlite")}(e))throw new i("node:sqlite is not available in this runtime. The default local agent store requires Node >= 22.13 (or another runtime that implements node:sqlite). Configure a JsonlLocalAgentStore instead.",{cause:e});throw e}return t.openNodeSqliteDriver(e)}}};
package/dist/esm/343.js CHANGED
@@ -1 +1 @@
1
- export const __webpack_esm_id__=343;export const __webpack_esm_ids__=[343];export const __webpack_esm_modules__={"../cursor-sdk-local-runtime/dist/run-store/sqlite/node-sqlite-driver.js"(e,t,s){s.r(t),s.d(t,{openNodeSqliteDriver:()=>a});var r=s("node:sqlite");class n{db;statements=new Map;constructor(e){this.db=e}exec(e){this.db.exec(e)}run(e,t=[]){const s=this.prepare(e).run(...t);return{changes:Number(s.changes)}}get(e,t=[]){return this.prepare(e).get(...t)}all(e,t=[]){return this.prepare(e).all(...t)}close(){this.statements.clear(),this.db.close()}prepare(e){let t=this.statements.get(e);return t||(t=this.db.prepare(e),this.statements.set(e,t)),t}}function a(e){return new n(new r.DatabaseSync(e))}}};
1
+ export const __webpack_esm_id__=343;export const __webpack_esm_ids__=[343];export const __webpack_esm_modules__={"../cursor-sdk-local-runtime/dist/run-store/sqlite/node-sqlite-driver.js"(e,t,s){s.a(e,(async(e,r)=>{try{s.r(t),s.d(t,{openNodeSqliteDriver:()=>o});var n=s("node:sqlite"),a=e([n]),c=a.then?(await a)():a;n=c[0];class i{db;statements=new Map;constructor(e){this.db=e}exec(e){this.db.exec(e)}run(e,t=[]){const s=this.prepare(e).run(...t);return{changes:Number(s.changes)}}get(e,t=[]){return this.prepare(e).get(...t)}all(e,t=[]){return this.prepare(e).all(...t)}close(){this.statements.clear(),this.db.close()}prepare(e){let t=this.statements.get(e);return t||(t=this.db.prepare(e),this.statements.set(e,t)),t}}function o(e){return new i(new n.DatabaseSync(e))}r()}catch(p){r(p)}}))}};