@cursor/sdk 1.0.18 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/18.js +1 -0
- package/dist/cjs/19.js +1 -0
- package/dist/cjs/343.js +1 -0
- package/dist/cjs/400.js +1 -0
- package/dist/cjs/403.js +8 -0
- package/dist/cjs/{index.js.LICENSE.txt → 403.js.LICENSE.txt} +31 -0
- package/dist/cjs/656.js +1 -0
- package/dist/cjs/730.js +1 -0
- package/dist/cjs/796.js +1 -0
- package/dist/cjs/856.js +1 -0
- package/dist/cjs/88.js +1 -0
- package/dist/cjs/914.js +1 -0
- package/dist/cjs/986.js +1 -0
- package/dist/cjs/996.js +1 -0
- package/dist/cjs/agent/options.d.ts +242 -0
- package/dist/cjs/agent/options.d.ts.map +1 -0
- package/dist/cjs/agent/run-event-notifier-api.d.ts +120 -0
- package/dist/cjs/agent/run-event-notifier-api.d.ts.map +1 -0
- package/dist/cjs/agent/run-store-public-types.d.ts +178 -0
- package/dist/cjs/agent/run-store-public-types.d.ts.map +1 -0
- package/dist/cjs/agent/store/local-agent-record-conversion.d.ts +7 -0
- package/dist/cjs/agent/store/local-agent-record-conversion.d.ts.map +1 -0
- package/dist/cjs/agent/store/local-agent-store.d.ts +289 -0
- package/dist/cjs/agent/store/local-agent-store.d.ts.map +1 -0
- package/dist/cjs/agent/store/sdk-state-root.d.ts +6 -0
- package/dist/cjs/agent/store/sdk-state-root.d.ts.map +1 -0
- package/dist/cjs/agent/store/sqlite-local-agent-store.d.ts +30 -0
- package/dist/cjs/agent/store/sqlite-local-agent-store.d.ts.map +1 -0
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/local-executor.d.ts +1 -0
- package/dist/cjs/local-executor.d.ts.map +1 -1
- package/dist/cjs/options.d.ts +9 -3
- package/dist/cjs/options.d.ts.map +1 -1
- package/dist/cjs/platform.d.ts +1 -0
- package/dist/cjs/platform.d.ts.map +1 -1
- package/dist/cjs/public-api.d.ts +2 -2
- package/dist/cjs/public-api.d.ts.map +1 -1
- package/dist/cjs/safe-connect-transport.d.ts +9 -0
- package/dist/cjs/safe-connect-transport.d.ts.map +1 -0
- package/dist/cjs/safe-node-http-client.d.ts +11 -0
- package/dist/cjs/safe-node-http-client.d.ts.map +1 -0
- package/dist/cjs/sdk-config.d.ts +2 -1
- package/dist/cjs/sdk-config.d.ts.map +1 -1
- package/dist/cjs/sqlite.d.ts +8 -0
- package/dist/cjs/sqlite.d.ts.map +1 -0
- package/dist/cjs/sqlite.js +1 -0
- package/dist/cjs/store/index.d.ts +1 -2
- package/dist/cjs/store/index.d.ts.map +1 -1
- package/dist/cjs/store/open-default-local-agent-store.d.ts +4 -0
- package/dist/cjs/store/open-default-local-agent-store.d.ts.map +1 -0
- package/dist/cjs/store/sqlite-local-agent-store.d.ts.map +1 -1
- package/dist/cjs/store/sqlite-storage-unavailable.d.ts +6 -0
- package/dist/cjs/store/sqlite-storage-unavailable.d.ts.map +1 -0
- package/dist/cjs/transport.d.ts +47 -0
- package/dist/cjs/transport.d.ts.map +1 -0
- package/dist/esm/18.js +1 -0
- package/dist/esm/19.js +1 -0
- package/dist/esm/343.js +1 -0
- package/dist/esm/357.js +1 -0
- package/dist/esm/400.js +1 -0
- package/dist/esm/403.js +8 -0
- package/dist/esm/{index.js.LICENSE.txt → 403.js.LICENSE.txt} +31 -0
- package/dist/esm/656.js +1 -0
- package/dist/esm/730.js +1 -0
- package/dist/esm/856.js +1 -0
- package/dist/esm/914.js +1 -0
- package/dist/esm/986.js +1 -0
- package/dist/esm/988.js +1 -0
- package/dist/esm/996.js +1 -0
- package/dist/esm/agent/options.d.ts +242 -0
- package/dist/esm/agent/options.d.ts.map +1 -0
- package/dist/esm/agent/run-event-notifier-api.d.ts +120 -0
- package/dist/esm/agent/run-event-notifier-api.d.ts.map +1 -0
- package/dist/esm/agent/run-store-public-types.d.ts +178 -0
- package/dist/esm/agent/run-store-public-types.d.ts.map +1 -0
- package/dist/esm/agent/store/local-agent-record-conversion.d.ts +7 -0
- package/dist/esm/agent/store/local-agent-record-conversion.d.ts.map +1 -0
- package/dist/esm/agent/store/local-agent-store.d.ts +289 -0
- package/dist/esm/agent/store/local-agent-store.d.ts.map +1 -0
- package/dist/esm/agent/store/sdk-state-root.d.ts +6 -0
- package/dist/esm/agent/store/sdk-state-root.d.ts.map +1 -0
- package/dist/esm/agent/store/sqlite-local-agent-store.d.ts +30 -0
- package/dist/esm/agent/store/sqlite-local-agent-store.d.ts.map +1 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/local-executor.d.ts +1 -0
- package/dist/esm/local-executor.d.ts.map +1 -1
- package/dist/esm/options.d.ts +9 -3
- package/dist/esm/options.d.ts.map +1 -1
- package/dist/esm/platform.d.ts +1 -0
- package/dist/esm/platform.d.ts.map +1 -1
- package/dist/esm/public-api.d.ts +2 -2
- package/dist/esm/public-api.d.ts.map +1 -1
- package/dist/esm/safe-connect-transport.d.ts +9 -0
- package/dist/esm/safe-connect-transport.d.ts.map +1 -0
- package/dist/esm/safe-node-http-client.d.ts +11 -0
- package/dist/esm/safe-node-http-client.d.ts.map +1 -0
- package/dist/esm/sdk-config.d.ts +2 -1
- package/dist/esm/sdk-config.d.ts.map +1 -1
- package/dist/esm/sqlite.d.ts +8 -0
- package/dist/esm/sqlite.d.ts.map +1 -0
- package/dist/esm/sqlite.js +1 -0
- package/dist/esm/store/index.d.ts +1 -2
- package/dist/esm/store/index.d.ts.map +1 -1
- package/dist/esm/store/open-default-local-agent-store.d.ts +4 -0
- package/dist/esm/store/open-default-local-agent-store.d.ts.map +1 -0
- package/dist/esm/store/sqlite-local-agent-store.d.ts.map +1 -1
- package/dist/esm/store/sqlite-storage-unavailable.d.ts +6 -0
- package/dist/esm/store/sqlite-storage-unavailable.d.ts.map +1 -0
- package/dist/esm/transport.d.ts +47 -0
- package/dist/esm/transport.d.ts.map +1 -0
- package/package.json +20 -13
- package/dist/cjs/429.index.js +0 -1
- package/dist/cjs/745.index.js +0 -8
- package/dist/cjs/745.index.js.LICENSE.txt +0 -30
- package/dist/esm/429.index.js +0 -1
- package/dist/esm/745.index.js +0 -8
- package/dist/esm/745.index.js.LICENSE.txt +0 -30
- /package/dist/cjs/{642.index.js → 642.js} +0 -0
- /package/dist/esm/{642.index.js → 642.js} +0 -0
package/dist/cjs/914.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.id=914,exports.ids=[914],exports.modules={"../cursor-sdk-local-runtime/dist/run-store/sqlite/bun-sqlite-driver.js"(e,t,s){s.d(t,{openBunSqliteDriver:()=>i});var r=s("bun:sqlite");class n{db;statements=new Map;constructor(e){this.db=e}exec(e){this.db.run(e)}run(e,t=[]){const{changes:s}=this.prepare(e).run(...t);return{changes:Number(s)}}get(e,t=[]){const s=this.prepare(e).get(...t);return null!=s?s:void 0}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 i(e){return new n(new r.Database(e,{create:!0}))}}};
|
package/dist/cjs/986.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.id=986,exports.ids=[986],exports.modules={"./src/agent/store/sqlite-local-agent-store.ts"(e,t,n){n.r(t),n.d(t,{SqliteLocalAgentStore:()=>f});var o=n("../agent-kv/dist/index.js"),r=n("../context/dist/index.js"),i=n("./src/agent/store/local-agent-record-conversion.ts"),d=n("./src/agent/store/local-agent-store.ts"),l=n("./src/agent/store/sdk-state-root.ts"),s=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function d(e){try{s(o.next(e))}catch(e){i(e)}}function l(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(d,l)}s((o=o.apply(e,t||[])).next())}))};function u(e){var t,n,o;return{runId:e.runId,seq:e.seq,offset:e.offset,eventType:e.eventType,payload:null!==(t=e.payload)&&void 0!==t?t:null,payloadRef:null!==(n=e.payloadRef)&&void 0!==n?n:null,idempotencyKey:null!==(o=e.idempotencyKey)&&void 0!==o?o:null,createdAt:e.createdAt.getTime()}}function a(e){return s(this,void 0,void 0,(function*(){return(yield e.listAllAgentRecords()).map((e=>e.agentId))}))}function c(e,t){return s(this,void 0,void 0,(function*(){return(yield e.runStore.listAllRunRecords([t])).map((e=>e.runId))}))}class f{static open(e){return s(this,void 0,void 0,(function*(){var t;const o=null!==(t=e.stateRoot)&&void 0!==t?t:(0,l.V)(e.workspaceRef),{createDefaultLocalAgentStores:r}=yield n.e(19).then(n.bind(n,"../cursor-sdk-local-runtime/dist/run-store/default-local-agent-stores.js")),i=yield r({stateRoot:o,workspaceRef:e.workspaceRef}),d=i.store,s=i.eventStore,u=i.checkpointStore;return function(e,t,n){if("function"!=typeof e.upsertAgentRecord)throw new Error("SqliteLocalAgentStore requires SqliteAgentRunStore from local runtime");if("function"!=typeof n.appendRunEvent)throw new Error("SqliteLocalAgentStore requires SqliteRunEventStore from local runtime");if("function"!=typeof t.listCheckpointBlobIds)throw new Error("SqliteLocalAgentStore requires LocalAgentCheckpointStore from local runtime")}(d,u,s),new f({stateRoot:o,workspaceRef:e.workspaceRef,runStore:d,checkpointStore:u,eventStore:s})}))}constructor(e){this.stateRoot=e.stateRoot,this.workspaceRef=e.workspaceRef,this.deps={runStore:e.runStore,checkpointStore:e.checkpointStore,eventStore:e.eventStore},this.agents=function(e){return{get:t=>s(this,[t],void 0,(function*({agentId:t}){const n=yield e.runStore.getAgent(t);return n?(0,i.EB)(n):null})),create:t=>s(this,[t],void 0,(function*({agent:t}){if(yield e.runStore.getAgent(t.agentId))throw new Error(`Agent ${t.agentId} already exists`);yield e.runStore.upsertAgentRecord((0,i.UY)(t));const n=yield e.runStore.getAgent(t.agentId);if(!n)throw new Error(`Failed to create agent ${t.agentId}`);return(0,i.EB)(n)})),update:t=>s(this,[t],void 0,(function*({agent:t}){if(!(yield e.runStore.getAgent(t.agentId)))throw new Error(`Agent ${t.agentId} not found`);yield e.runStore.upsertAgentRecord((0,i.UY)(t));const n=yield e.runStore.getAgent(t.agentId);if(!n)throw new Error(`Failed to update agent ${t.agentId}`);return(0,i.EB)(n)})),delete:t=>s(this,[t],void 0,(function*({filter:t}){const n=(yield e.runStore.listAllAgentRecords()).map(i.EB).filter((e=>(0,d.HL)(e,t)));if(0===n.length)throw new Error("No agents matched delete filter");for(const t of n){const n=yield c(e,t.agentId);for(const t of n)yield e.eventStore.deleteRunEvents({runId:t});yield e.checkpointStore.deleteAgent(t.agentId),yield e.runStore.deleteAgent(t.agentId)}})),list:t=>s(this,void 0,void 0,(function*(){const n=(yield e.runStore.listAllAgentRecords()).map(i.EB);return(0,d.tg)(n,null==t?void 0:t.filter)}))}}(this.deps),this.checkpoints=function(e){const t=(0,r.q6)();return{get:n=>s(this,[n],void 0,(function*({agentId:n,blobId:r}){const i=yield e.checkpointStore.getBlobStore(n),d=yield i.getBlob(t,(0,o.aD)(r));return d?function(e){const t=new Uint8Array(e.length);return t.set(e),t}(d):null})),create:n=>s(this,[n],void 0,(function*({agentId:n,blobId:r,data:i}){const d=yield e.checkpointStore.getBlobStore(n);if(yield d.getBlob(t,(0,o.aD)(r)))throw new Error(`Checkpoint blob ${r} already exists for agent ${n}`);yield d.setBlob(t,(0,o.aD)(r),i)})),update:n=>s(this,[n],void 0,(function*({agentId:n,blobId:r,data:i}){const d=yield e.checkpointStore.getBlobStore(n);if(!(yield d.getBlob(t,(0,o.aD)(r))))throw new Error(`Checkpoint blob ${r} not found for agent ${n}`);yield d.setBlob(t,(0,o.aD)(r),i)})),delete:t=>s(this,void 0,void 0,(function*(){const n=t.filter.agentIds&&t.filter.agentIds.length>0?t.filter.agentIds:yield a(e.runStore),o=t.filter.blobIds;for(const t of n)if(null==o?void 0:o.length){const n=yield e.checkpointStore.getBlobStore(t);for(const e of o)yield n.deleteBlob(e)}else yield e.checkpointStore.deleteAgent(t)})),list:t=>s(this,void 0,void 0,(function*(){const n=null==t?void 0:t.filter,o=(null==n?void 0:n.agentIds)&&n.agentIds.length>0?n.agentIds:yield a(e.runStore),r=[];for(const t of o){const o=yield e.checkpointStore.listCheckpointBlobIds(t);for(const e of o)(0,d.S$)({agentId:t,blobId:e},n)&&r.push(e)}return(0,d.Jg)(r,n)}))}}(this.deps),this.runs=function(e){return{get:t=>s(this,[t],void 0,(function*({agentId:t,runId:n}){const o=yield e.runStore.getRun(t,n);return o?(0,i.xu)(o):null})),create:t=>s(this,[t],void 0,(function*({run:t}){if(yield e.runStore.getRun(t.agentId,t.runId))throw new Error(`Run ${t.runId} already exists for agent ${t.agentId}`);yield e.runStore.upsertRunRecord((0,i.R)(t));const n=yield e.runStore.getRun(t.agentId,t.runId);if(!n)throw new Error(`Failed to create run ${t.runId} for agent ${t.agentId}`);return(0,i.xu)(n)})),update:t=>s(this,[t],void 0,(function*({run:t}){if(!(yield e.runStore.getRun(t.agentId,t.runId)))throw new Error(`Run ${t.runId} not found for agent ${t.agentId}`);yield e.runStore.upsertRunRecord((0,i.R)(t));const n=yield e.runStore.getRun(t.agentId,t.runId);if(!n)throw new Error(`Failed to update run ${t.runId} for agent ${t.agentId}`);return(0,i.xu)(n)})),delete:t=>s(this,void 0,void 0,(function*(){const n=t.filter,o=(null==n?void 0:n.agentIds)&&n.agentIds.length>0?n.agentIds:void 0,r=(yield e.runStore.listAllRunRecords(o)).map(i.xu).filter((e=>(0,d.hA)(e,n)));if(0!==r.length){for(const t of r)yield e.eventStore.deleteRunEvents({runId:t.runId});yield e.runStore.deleteRunRecordsByKeys(r.map((e=>({agentId:e.agentId,runId:e.runId}))))}})),list:t=>s(this,void 0,void 0,(function*(){const n=null==t?void 0:t.filter,o=(yield e.runStore.listAllRunRecords(null==n?void 0:n.agentIds)).map(i.xu).filter((e=>(0,d.hA)(e,n)));return(0,d.f1)(o,n)}))}}(this.deps),this.runEvents=function(e){return{append:t=>s(this,void 0,void 0,(function*(){return u(yield e.appendRunEvent({runId:t.runId,eventType:t.eventType,payload:t.payload,payloadRef:t.payloadRef,idempotencyKey:t.idempotencyKey}))})),list:t=>s(this,void 0,void 0,(function*(){var n;const o=yield e.listRunEvents({runId:t.runId,afterOffset:null!==(n=t.afterOffset)&&void 0!==n?n:void 0,limit:t.limit});return Object.assign({items:o.events.map(u)},void 0!==o.nextOffset?{nextOffset:o.nextOffset}:{})})),delete:t=>s(this,void 0,void 0,(function*(){var n;const o=null!==(n=t.filter.runIds)&&void 0!==n?n:[];for(const t of o)yield e.deleteRunEvents({runId:t})}))}}(e.eventStore)}dispose(){return s(this,void 0,void 0,(function*(){yield Promise.all([this.deps.runStore.dispose(),this.deps.eventStore.dispose(),this.deps.checkpointStore.dispose()])}))}}}};
|
package/dist/cjs/996.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.id=996,exports.ids=[996],exports.modules={"../../node_modules/.pnpm/@connectrpc+connect@1.6.1_patch_hash=a4b9a5e69295313832387f25b708426bcf53041a2f50bc7b95_d0a2f6c9e28298af3d10922a7e4db69f/node_modules/@connectrpc/connect/dist/esm/protocol-connect/transport.js"(e,n,t){t.d(n,{o:()=>U});var r=t("@bufbuild/protobuf");const o="Content-Type",a="Content-Length",s="Content-Encoding",c="Connect-Content-Encoding",i="Accept-Encoding",d="Connect-Protocol-Version",u=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$|^text\/event-stream$/i;function l(e,n,t,a,u,l,f){const p=function(e,n,t,a,s){const c=new Headers(null!=a?a:{});return void 0!==t&&c.set("Connect-Timeout-Ms",`${t}`),c.set(o,e==r.MethodKind.Unary?n?"application/proto":"application/json":n?"application/connect+proto":"application/connect+json"),c.set(d,"1"),s&&c.set("User-Agent","connect-es/1.6.1"),c}(e,n,t,a,f);if(null!=l){const n=e==r.MethodKind.Unary?s:c;p.set(n,l.name)}if(u.length>0){const n=e==r.MethodKind.Unary?i:"Connect-Accept-Encoding";p.set(n,u.map((e=>e.name)).join(","))}return p}var f=t("../../node_modules/.pnpm/@connectrpc+connect@1.6.1_patch_hash=a4b9a5e69295313832387f25b708426bcf53041a2f50bc7b95_d0a2f6c9e28298af3d10922a7e4db69f/node_modules/@connectrpc/connect/dist/esm/code.js"),p=t("../../node_modules/.pnpm/@connectrpc+connect@1.6.1_patch_hash=a4b9a5e69295313832387f25b708426bcf53041a2f50bc7b95_d0a2f6c9e28298af3d10922a7e4db69f/node_modules/@connectrpc/connect/dist/esm/connect-error.js");function m(e,n,t,a,i){let d;const l=i.get(e==r.MethodKind.Unary?s:c);if(null!=l&&"identity"!==l.toLowerCase()&&(d=n.find((e=>e.name===l)),!d))throw new p.T(`unsupported response encoding "${l}"`,f.C.Internal,i);return Object.assign({compression:d},function(e,n,t,a){const s=a.get(o),c=function(e){if("text/event-stream"===e)return{stream:!0,binary:!0};const n=null==e?void 0:e.match(u);return n?{stream:!!n[1],binary:!!n[3]}:void 0}(s);if(200!==t){const n=new p.T(`HTTP ${t}`,function(e){switch(e){case 400:return f.C.Internal;case 401:return f.C.Unauthenticated;case 403:return f.C.PermissionDenied;case 404:return f.C.Unimplemented;case 429:case 502:case 503:case 504:return f.C.Unavailable;default:return f.C.Unknown}}(t),a);if(e==r.MethodKind.Unary&&c&&!c.binary)return{isUnaryError:!0,unaryError:n};throw n}const i=n,d=e!==r.MethodKind.Unary;if((null==c?void 0:c.binary)!==i||c.stream!==d)throw new p.T(`unsupported content type ${s}`,void 0===c?f.C.Unknown:f.C.Internal,a);return{isUnaryError:!1}}(e,t,a,i))}var h=t("../../node_modules/.pnpm/@connectrpc+connect@1.6.1_patch_hash=a4b9a5e69295313832387f25b708426bcf53041a2f50bc7b95_d0a2f6c9e28298af3d10922a7e4db69f/node_modules/@connectrpc/connect/dist/esm/protocol-connect/code-string.js");function y(e,n,t){var o;if(n&&new Headers(n).forEach(((e,n)=>t.metadata.append(n,e))),"object"!=typeof e||null==e||Array.isArray(e))throw t;let a=t.code;"code"in e&&"string"==typeof e.code&&(a=null!==(o=(0,h.X)(e.code))&&void 0!==o?o:a);const s=e.message;if(null!=s&&"string"!=typeof s)throw t;const c=new p.T(null!=s?s:"",a,n);if("details"in e&&Array.isArray(e.details))for(const n of e.details){if(null===n||"object"!=typeof n||Array.isArray(n)||"string"!=typeof n.type||"string"!=typeof n.value)throw t;try{c.details.push({type:n.type,value:r.protoBase64.dec(n.value),debug:n.debug})}catch(e){throw t}}return c}function g(e,n){const t={code:(0,h.s)(e.code)};return e.rawMessage.length>0&&(t.message=e.rawMessage),e.details.length>0&&(t.details=e.details.map((e=>{if("getType"in e){const t={type:e.getType().typeName,value:e.toBinary()};try{t.debug=e.toJson(n)}catch(e){}return t}return e})).map((e=>{var{value:n}=e,t=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(e,["value"]);return Object.assign(Object.assign({},t),{value:r.protoBase64.enc(n).replace(/=+$/,"")})}))),t}function b(...e){const n=new Headers;for(const t of e)t.forEach(((e,t)=>{n.append(t,e)}));return n}var v=t("../../node_modules/.pnpm/@connectrpc+connect@1.6.1_patch_hash=a4b9a5e69295313832387f25b708426bcf53041a2f50bc7b95_d0a2f6c9e28298af3d10922a7e4db69f/node_modules/@connectrpc/connect/dist/esm/protocol/async-iterable.js");function w(e,n,t){const r="string"==typeof n?n:n.typeName,o="string"==typeof t?t:t.name;return e.toString().replace(/\/?$/,`/${r}/${o}`)}function C(e,n){var t;return null!==(t=null==n?void 0:n.concat().reverse().reduce(((e,n)=>n(e)),e))&&void 0!==t?t:e}function O(e){if(!e.aborted)return;if(void 0!==e.reason)return e.reason;const n=new Error("This operation was aborted");return n.name="AbortError",n}function E(e,n){return n instanceof e?n:new e(n)}function T(e,n){function t(n){return!0===n.done?n:{done:n.done,value:E(e,n.value)}}return{[Symbol.asyncIterator](){const e=n[Symbol.asyncIterator](),r={next:()=>e.next().then(t)};return void 0!==e.throw&&(r.throw=n=>e.throw(n).then(t)),void 0!==e.return&&(r.return=n=>e.return(n).then(t)),r}}}function j(e){const{signal:n,cleanup:t}=function(e){const n=new AbortController,t=()=>{n.abort(new p.T("the operation timed out",f.C.DeadlineExceeded))};let r;return void 0!==e&&(e<=0?t():r=setTimeout(t,e)),{signal:n.signal,cleanup:()=>clearTimeout(r)}}(e.timeoutMs),r=function(...e){const n=new AbortController,t=e.filter((e=>void 0!==e)).concat(n.signal);for(const e of t){if(e.aborted){r.apply(e);break}e.addEventListener("abort",r)}function r(){n.signal.aborted||n.abort(O(this));for(const e of t)e.removeEventListener("abort",r)}return n}(e.signal,n);return[r.signal,function(e){const o=p.T.from(n.aborted?O(n):e);return r.abort(o),t(),Promise.reject(o)},function(){t(),r.abort()}]}var x=t("../../node_modules/.pnpm/@connectrpc+connect@1.6.1_patch_hash=a4b9a5e69295313832387f25b708426bcf53041a2f50bc7b95_d0a2f6c9e28298af3d10922a7e4db69f/node_modules/@connectrpc/connect/dist/esm/protocol/limit-io.js");function S(e,n,t,r){const o=I(_(e.I,n),r),a=I(M(e.I,t),r),s=I(_(e.O,n),r),c=I(M(e.O,t),r);return{getI:e=>e?o:a,getO:e=>e?s:c}}function I(e,n){return{serialize(t){const r=e.serialize(t);return(0,x.Tw)(n.writeMaxBytes,r.byteLength),r},parse:t=>((0,x.kk)(n.readMaxBytes,t.byteLength,!0),e.parse(t))}}function _(e,n){return{parse(t){try{return e.fromBinary(t,n)}catch(e){const n=e instanceof Error?e.message:String(e);throw new p.T(`parse binary: ${n}`,f.C.Internal)}},serialize(e){try{return e.toBinary(n)}catch(e){const n=e instanceof Error?e.message:String(e);throw new p.T(`serialize binary: ${n}`,f.C.Internal)}}}}function M(e,n){var t,r;const o=null!==(t=null==n?void 0:n.textEncoder)&&void 0!==t?t:new TextEncoder,a=null!==(r=null==n?void 0:n.textDecoder)&&void 0!==r?r:new TextDecoder,s=function(e){var n;const t=Object.assign({},e);return null!==(n=t.ignoreUnknownFields)&&void 0!==n||(t.ignoreUnknownFields=!0),t}(n);return{parse(n){try{const t=a.decode(n);return e.fromJsonString(t,s)}catch(e){throw p.T.from(e,f.C.InvalidArgument)}},serialize(e){try{const n=e.toJsonString(s);return o.encode(n)}catch(e){throw p.T.from(e,f.C.Internal)}}}}function A(){return{get(e){return e.id in this?this[e.id]:e.defaultValue},set(e,n){return this[e.id]=n,this},delete(e){return delete this[e.id],this}}}var B=function(e){return this instanceof B?(this.v=e,this):new B(e)};function U(e){return{async unary(n,t,c,u,f,p,h){const g=S(t,e.binaryOptions,e.jsonOptions,e);return u=void 0===u?e.defaultTimeoutMs:u<=0?void 0:u,await function(e){const n=C(e.next,e.interceptors),[t,r,o]=j(e);return n(Object.assign(Object.assign({},e.req),{message:E(e.req.method.I,e.req.message),signal:t})).then((e=>(o(),e)),r)}({interceptors:e.interceptors,signal:c,timeoutMs:u,req:{stream:!1,service:n,method:t,url:w(e.baseUrl,n,t),init:{},header:l(t.kind,e.useBinaryFormat,u,f,e.acceptCompression,e.sendCompression,!0),contextValues:null!=h?h:A(),message:p},next:async c=>{var u;let l,f=g.getI(e.useBinaryFormat).serialize(c.message);e.sendCompression&&f.byteLength>e.compressMinBytes?(f=await e.sendCompression.compress(f),c.header.set(s,e.sendCompression.name)):c.header.delete(s),!0===e.useHttpGet&&t.idempotency===r.MethodIdempotency.NoSideEffects?c=function(e,n,t){let c="?connect=v1";const u=e.header.get(o);0===(null==u?void 0:u.indexOf("application/"))&&(c+="&encoding="+encodeURIComponent(u.slice(12)));const l=e.header.get(s);null!==l&&"identity"!==l&&(c+="&compression="+encodeURIComponent(l),t=!0),t&&(c+="&base64=1"),c+="&message="+function(e,n){return n?r.protoBase64.enc(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent((new TextDecoder).decode(e))}(n,t);const f=e.url+c,p=new Headers(e.header);return[d,o,a,s,i].forEach((e=>p.delete(e))),Object.assign(Object.assign({},e),{init:Object.assign(Object.assign({},e.init),{method:"GET"}),url:f,header:p})}(c,f,e.useBinaryFormat):(l=(0,v.T$)([f]),0===f.length&&c.header.set("Content-Length","0"));const p=await e.httpClient({url:c.url,method:null!==(u=c.init.method)&&void 0!==u?u:"POST",header:c.header,signal:c.signal,body:l}),{compression:h,isUnaryError:w,unaryError:C}=m(t.kind,e.acceptCompression,e.useBinaryFormat,p.status,p.header),[O,E]=function(e){const n=new Headers,t=new Headers;return e.forEach(((e,r)=>{r.toLowerCase().startsWith("trailer-")?t.append(r.substring(8),e):n.append(r,e)})),[n,t]}(p.header);let T=await(0,v.WK)(p.body,(0,v.SM)(e.readMaxBytes,p.header.get(a)),{propagateDownStreamError:!1});if(h&&(T=await h.decompress(T,e.readMaxBytes)),w)throw function(e,n,t){let r;try{r=JSON.parse((new TextDecoder).decode(e))}catch(e){throw t}return y(r,n,t)}(T,b(O,E),C);return{stream:!1,service:n,method:t,header:O,message:g.getO(e.useBinaryFormat).parse(T),trailer:E}}})},async stream(n,t,r,o,a,s,c){const i=S(t,e.binaryOptions,e.jsonOptions,e),d=function(e){const n=new TextEncoder;return{serialize(t){try{const r=function(e,n,t){const r={};void 0!==n&&(r.error=g(n,t),e=b(e,n.metadata));let o=!1;const a={};return e.forEach(((e,n)=>{o=!0,a[n]=[e]})),o&&(r.metadata=a),r}(t.metadata,t.error,e),o=JSON.stringify(r);return n.encode(o)}catch(e){const n=e instanceof Error?e.message:String(e);throw new p.T(`failed to serialize EndStreamResponse: ${n}`,f.C.Internal)}},parse(e){try{return function(e){const n=new p.T("invalid end stream",f.C.Unknown);let t;try{t=JSON.parse("string"==typeof e?e:(new TextDecoder).decode(e))}catch(e){throw n}if("object"!=typeof t||null==t||Array.isArray(t))throw n;const r=new Headers;if("metadata"in t){if("object"!=typeof t.metadata||null==t.metadata||Array.isArray(t.metadata))throw n;for(const[e,o]of Object.entries(t.metadata)){if(!Array.isArray(o)||o.some((e=>"string"!=typeof e)))throw n;for(const n of o)r.append(e,n)}}return{metadata:r,error:"error"in t&&null!=t.error?y(t.error,r,n):void 0}}(e)}catch(e){const n=e instanceof Error?e.message:String(e);throw new p.T(`failed to parse EndStreamResponse: ${n}`,f.C.InvalidArgument)}}}}(e.jsonOptions);return o=void 0===o?e.defaultTimeoutMs:o<=0?void 0:o,function(e){const n=C(e.next,e.interceptors),[t,r,o]=j(e),a=Object.assign(Object.assign({},e.req),{message:T(e.req.method.I,e.req.message),signal:t});let s=!1;return t.addEventListener("abort",(function(){var n,t;const r=e.req.message[Symbol.asyncIterator]();s||null===(n=r.throw)||void 0===n||n.call(r,this.reason).catch((()=>{})),null===(t=r.return)||void 0===t||t.call(r).catch((()=>{}))})),n(a).then((e=>Object.assign(Object.assign({},e),{message:{[Symbol.asyncIterator](){const n=e.message[Symbol.asyncIterator]();return{next:()=>n.next().then((e=>(1==e.done&&(s=!0,o()),e)),r)}}}})),r)}({interceptors:e.interceptors,signal:r,timeoutMs:o,req:{stream:!0,service:n,method:t,url:w(e.baseUrl,n,t),init:{method:"POST",redirect:"error",mode:"cors"},header:l(t.kind,e.useBinaryFormat,o,a,e.acceptCompression,e.sendCompression,!0),contextValues:null!=c?c:A(),message:s},next:async n=>{const r=await e.httpClient({url:n.url,method:"POST",header:n.header,signal:n.signal,body:(0,v.Fs)(n.message,(0,v.XO)(i.getI(e.useBinaryFormat)),(0,v.fM)(e.sendCompression,e.compressMinBytes),(0,v.yQ)(),{propagateDownStreamError:!0})}),{compression:o}=m(t.kind,e.acceptCompression,e.useBinaryFormat,r.status,r.header),a=Object.assign(Object.assign({},n),{header:r.header,trailer:new Headers,message:(0,v.Fs)(r.body,(0,v.pY)(e.readMaxBytes),(0,v.ew)(null!=o?o:null,e.readMaxBytes),(0,v.uv)(i.getO(e.useBinaryFormat),2,d),(function(e){return function(e,n,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=t.apply(e,n||[]),a=[];return r={},s("next"),s("throw"),s("return",(function(e){return function(n){return Promise.resolve(n).then(e,d)}})),r[Symbol.asyncIterator]=function(){return this},r;function s(e,n){o[e]&&(r[e]=function(n){return new Promise((function(t,r){a.push([e,n,t,r])>1||c(e,n)}))},n&&(r[e]=n(r[e])))}function c(e,n){try{(t=o[e](n)).value instanceof B?Promise.resolve(t.value.v).then(i,d):u(a[0][2],t)}catch(e){u(a[0][3],e)}var t}function i(e){c("next",e)}function d(e){c("throw",e)}function u(e,n){e(n),a.shift(),a.length&&c(a[0][0],a[0][1])}}(this,arguments,(function*(){var n,t,o,s;let c=!1;try{for(var i,d=!0,u=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,t=e[Symbol.asyncIterator];return t?t.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise((function(r,o){!function(e,n,t,r){Promise.resolve(r).then((function(n){e({value:n,done:t})}),n)}(r,o,(n=e[t](n)).done,n.value)}))}}}(e);!(n=(i=yield B(u.next())).done);d=!0){s=i.value,d=!1;const e=s;if(e.end){if(c)throw new p.T("protocol error: received extra EndStreamResponse",f.C.InvalidArgument);if(c=!0,e.value.error){const n=e.value.error;throw r.header.forEach(((e,t)=>{n.metadata.append(t,e)})),n}e.value.metadata.forEach(((e,n)=>a.trailer.set(n,e)))}else{if(c)throw new p.T("protocol error: received extra message after EndStreamResponse",f.C.InvalidArgument);yield yield B(e.value)}}}catch(e){t={error:e}}finally{try{d||n||!(o=u.return)||(yield B(o.call(u)))}finally{if(t)throw t.error}}if(!c)throw new p.T("protocol error: missing EndStreamResponse",f.C.InvalidArgument)}))}),{propagateDownStreamError:!0})});return a}})}}}}};
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import type { AgentCheckpointStore, AgentRunStore, RunEventNotifier, RunEventStore } from "./run-store-public-types.js";
|
|
2
|
+
import type { LocalAgentStore } from "./store/local-agent-store.js";
|
|
3
|
+
/** Conversation mode for agent runs. */
|
|
4
|
+
export type AgentModeOption = "agent" | "plan";
|
|
5
|
+
export interface SDKImageDimension {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export type SDKImage = {
|
|
10
|
+
url: string;
|
|
11
|
+
dimension?: SDKImageDimension;
|
|
12
|
+
} | {
|
|
13
|
+
data: string;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
dimension?: SDKImageDimension;
|
|
16
|
+
};
|
|
17
|
+
export interface SDKUserMessage {
|
|
18
|
+
text: string;
|
|
19
|
+
images?: SDKImage[];
|
|
20
|
+
}
|
|
21
|
+
export type McpServerConfig = {
|
|
22
|
+
type?: "stdio";
|
|
23
|
+
command: string;
|
|
24
|
+
args?: string[];
|
|
25
|
+
env?: Record<string, string>;
|
|
26
|
+
cwd?: string;
|
|
27
|
+
} | {
|
|
28
|
+
type?: "http" | "sse";
|
|
29
|
+
url: string;
|
|
30
|
+
headers?: Record<string, string>;
|
|
31
|
+
auth?: {
|
|
32
|
+
CLIENT_ID: string;
|
|
33
|
+
CLIENT_SECRET?: string;
|
|
34
|
+
scopes?: string[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export type SettingSource = "project" | "user" | "team" | "mdm" | "plugins" | "all";
|
|
38
|
+
export type SDKJsonPrimitive = string | number | boolean | null;
|
|
39
|
+
export type SDKJsonValue = SDKJsonPrimitive | {
|
|
40
|
+
[key: string]: SDKJsonValue;
|
|
41
|
+
} | SDKJsonValue[];
|
|
42
|
+
export type SDKCustomToolContent = {
|
|
43
|
+
type: "text";
|
|
44
|
+
text: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: "image";
|
|
47
|
+
data: string;
|
|
48
|
+
mimeType?: string;
|
|
49
|
+
};
|
|
50
|
+
export type SDKCustomToolResult = string | SDKJsonValue | {
|
|
51
|
+
content: SDKCustomToolContent[];
|
|
52
|
+
isError?: boolean;
|
|
53
|
+
structuredContent?: Record<string, SDKJsonValue>;
|
|
54
|
+
};
|
|
55
|
+
export interface SDKCustomToolContext {
|
|
56
|
+
toolCallId?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface SDKCustomTool {
|
|
59
|
+
description?: string;
|
|
60
|
+
inputSchema?: Record<string, SDKJsonValue>;
|
|
61
|
+
execute: (args: Record<string, SDKJsonValue>, context: SDKCustomToolContext) => SDKCustomToolResult | Promise<SDKCustomToolResult>;
|
|
62
|
+
}
|
|
63
|
+
export interface SandboxOptions {
|
|
64
|
+
enabled: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface ModelParameterValue {
|
|
67
|
+
id: string;
|
|
68
|
+
value: string;
|
|
69
|
+
}
|
|
70
|
+
export interface ModelSelection {
|
|
71
|
+
id: string;
|
|
72
|
+
params?: ModelParameterValue[];
|
|
73
|
+
}
|
|
74
|
+
export interface ModelParameterDefinition {
|
|
75
|
+
id: string;
|
|
76
|
+
displayName?: string;
|
|
77
|
+
values: Array<{
|
|
78
|
+
value: string;
|
|
79
|
+
displayName?: string;
|
|
80
|
+
}>;
|
|
81
|
+
}
|
|
82
|
+
export interface ModelVariant {
|
|
83
|
+
params: ModelParameterValue[];
|
|
84
|
+
displayName: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
isDefault?: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface ModelListItem {
|
|
89
|
+
id: string;
|
|
90
|
+
displayName: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
aliases?: string[];
|
|
93
|
+
parameters?: ModelParameterDefinition[];
|
|
94
|
+
variants?: ModelVariant[];
|
|
95
|
+
}
|
|
96
|
+
export interface AgentDefinition {
|
|
97
|
+
description: string;
|
|
98
|
+
prompt: string;
|
|
99
|
+
model?: ModelSelection | "inherit";
|
|
100
|
+
mcpServers?: Array<string | Record<string, McpServerConfig>>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Options that only apply to local agents. Exported as a standalone type so
|
|
104
|
+
* users can reference it directly (e.g. `Partial<LocalAgentOptions>`) instead
|
|
105
|
+
* of having to unwrap the optional `local` field on `AgentOptions` with
|
|
106
|
+
* `Partial<NonNullable<AgentOptions["local"]>>`.
|
|
107
|
+
*/
|
|
108
|
+
export interface LocalAgentOptions {
|
|
109
|
+
cwd?: string | string[];
|
|
110
|
+
/**
|
|
111
|
+
* Enable Cursor's Auto-review for local tool calls. When this is true,
|
|
112
|
+
* local runs select the classifier-backed Auto mode whenever the connected
|
|
113
|
+
* backend has the Auto-review classifier feature enabled.
|
|
114
|
+
*/
|
|
115
|
+
autoReview?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Custom {@link LocalAgentStore} for this call. When omitted, uses
|
|
118
|
+
* `Cursor.configure({ local: { store } })` if set; otherwise the default
|
|
119
|
+
* SQLite backend when `sqlite3` is installed (`@cursor/sdk/sqlite`), or
|
|
120
|
+
* {@link JsonlLocalAgentStore} when running without native SQLite.
|
|
121
|
+
* Agent rows hold a slim checkpoint ref (`latestCheckpoint.rootBlobId`);
|
|
122
|
+
* blob bytes live on `store.checkpoints`.
|
|
123
|
+
*/
|
|
124
|
+
store?: LocalAgentStore;
|
|
125
|
+
/**
|
|
126
|
+
* Ambient Cursor settings layers to load from the local filesystem.
|
|
127
|
+
* Local agents only. On cloud, `project` / `team` / `plugins` are
|
|
128
|
+
* always on and `user` / `mdm` / `local` have no VM equivalent, so
|
|
129
|
+
* this field is gated to the local shape.
|
|
130
|
+
*/
|
|
131
|
+
settingSources?: SettingSource[];
|
|
132
|
+
sandboxOptions?: SandboxOptions;
|
|
133
|
+
/**
|
|
134
|
+
* In-process callback tools for this agent, exposed as the
|
|
135
|
+
* `custom-user-tools` MCP server (`GetMcpTools` / `CallMcpTool`). Applied on
|
|
136
|
+
* every `send` unless overridden by {@link LocalSendOptions.customTools}.
|
|
137
|
+
* Local agents only; not supported on cloud agents.
|
|
138
|
+
*/
|
|
139
|
+
customTools?: Record<string, SDKCustomTool>;
|
|
140
|
+
/**
|
|
141
|
+
* Enable transport and stall auto-retry for local agent runs. Defaults to
|
|
142
|
+
* true for headless embedders; set false to surface transport errors on the
|
|
143
|
+
* first failure (legacy SDK behavior).
|
|
144
|
+
*/
|
|
145
|
+
enableAgentRetries?: boolean;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Per-send local overrides. Use with `Agent.send(..., { local })`. Agent-level
|
|
149
|
+
* defaults live on {@link LocalAgentOptions} (`Agent.create({ local })`).
|
|
150
|
+
*/
|
|
151
|
+
export interface LocalSendOptions {
|
|
152
|
+
/**
|
|
153
|
+
* Expire the currently active persisted run, if any, before starting this
|
|
154
|
+
* message as a new follow-up run. Recovery path for local agents left wedged
|
|
155
|
+
* after a crashed CLI process.
|
|
156
|
+
*/
|
|
157
|
+
force?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Custom tools for this send only. When set, replaces
|
|
160
|
+
* {@link LocalAgentOptions.customTools} for that run.
|
|
161
|
+
*/
|
|
162
|
+
customTools?: Record<string, SDKCustomTool>;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Options that only apply to cloud agents. Exported as a standalone type so
|
|
166
|
+
* users can reference it directly (e.g. `Partial<CloudAgentOptions>`) instead
|
|
167
|
+
* of having to unwrap the optional `cloud` field on `AgentOptions` with
|
|
168
|
+
* `Partial<NonNullable<AgentOptions["cloud"]>>`.
|
|
169
|
+
*/
|
|
170
|
+
export interface CloudAgentOptions {
|
|
171
|
+
env?: {
|
|
172
|
+
type: "cloud";
|
|
173
|
+
name?: string;
|
|
174
|
+
} | {
|
|
175
|
+
type: "pool";
|
|
176
|
+
name?: string;
|
|
177
|
+
} | {
|
|
178
|
+
type: "machine";
|
|
179
|
+
name?: string;
|
|
180
|
+
};
|
|
181
|
+
repos?: Array<{
|
|
182
|
+
url: string;
|
|
183
|
+
startingRef?: string;
|
|
184
|
+
prUrl?: string;
|
|
185
|
+
}>;
|
|
186
|
+
workOnCurrentBranch?: boolean;
|
|
187
|
+
autoCreatePR?: boolean;
|
|
188
|
+
skipReviewerRequest?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Per-session env vars injected into the cloud agent's shell, e.g. for
|
|
191
|
+
* caller-minted credentials. Encrypted at rest; deleted with the agent.
|
|
192
|
+
*/
|
|
193
|
+
envVars?: Record<string, string>;
|
|
194
|
+
}
|
|
195
|
+
export interface CursorAgentPlatformOptions {
|
|
196
|
+
/**
|
|
197
|
+
* Custom {@link LocalAgentStore}. Prefer `local.store` on `Agent.create` /
|
|
198
|
+
* `Agent.resume` unless constructing a platform directly. When omitted, the
|
|
199
|
+
* platform uses built-in SQLite under `stateRoot` — implement
|
|
200
|
+
* {@link LocalAgentStore} only to replace that default path.
|
|
201
|
+
*/
|
|
202
|
+
localStore?: LocalAgentStore;
|
|
203
|
+
stateRoot?: string;
|
|
204
|
+
workspaceRef?: string;
|
|
205
|
+
/**
|
|
206
|
+
* When set, custom-store reads filter to agents whose `cwd` matches. Populated
|
|
207
|
+
* from an explicit caller `cwd`; omitted when the caller did not pass one.
|
|
208
|
+
*/
|
|
209
|
+
scopedWorkspaceRef?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Internal storage hooks retained for existing advanced callers.
|
|
212
|
+
*/
|
|
213
|
+
store?: AgentRunStore;
|
|
214
|
+
checkpointStore?: AgentCheckpointStore;
|
|
215
|
+
eventStore?: RunEventStore;
|
|
216
|
+
eventNotifier?: RunEventNotifier;
|
|
217
|
+
}
|
|
218
|
+
export interface AgentOptions {
|
|
219
|
+
/**
|
|
220
|
+
* Model selection (`{ id, params? }`). Required for local agents; optional
|
|
221
|
+
* for cloud (the server resolves the caller's configured default when
|
|
222
|
+
* omitted). Use `Cursor.models.list()` to discover valid selections.
|
|
223
|
+
*/
|
|
224
|
+
model?: ModelSelection;
|
|
225
|
+
apiKey?: string;
|
|
226
|
+
/**
|
|
227
|
+
* Optional human-readable name for the agent, surfaced as the `title` in
|
|
228
|
+
* `Agent.list()` / `Agent.get()`. Cloud agents auto-generate a name from
|
|
229
|
+
* the first prompt when this is omitted; local agents fall back to a
|
|
230
|
+
* generic default.
|
|
231
|
+
*/
|
|
232
|
+
name?: string;
|
|
233
|
+
local?: LocalAgentOptions;
|
|
234
|
+
cloud?: CloudAgentOptions;
|
|
235
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
236
|
+
agents?: Record<string, AgentDefinition>;
|
|
237
|
+
agentId?: string;
|
|
238
|
+
idempotencyKey?: string;
|
|
239
|
+
/** Initial conversation mode for this agent. */
|
|
240
|
+
mode?: AgentModeOption;
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/agent/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACd,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,wCAAwC;AACxC,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,QAAQ,GAChB;IACE,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B,CAAC;AAEN,MAAM,WAAW,cAAc;IAC7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AAI,CAAC,EAAE,eAAe,CAAC;CACxB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types and implementations for run event notifiers.
|
|
3
|
+
*
|
|
4
|
+
* These types are inlined to avoid leaking internal runtime package types
|
|
5
|
+
* in the published SDK declaration files.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Opaque resume token for a run event stream.
|
|
9
|
+
*
|
|
10
|
+
* Stores own the format of this token. The default local SQLite and in-memory
|
|
11
|
+
* stores use numeric sequence strings, but SDK callers and custom backends
|
|
12
|
+
* must only persist and pass the token back as an exclusive `afterOffset`.
|
|
13
|
+
*/
|
|
14
|
+
export type RunEventOffset = string;
|
|
15
|
+
/**
|
|
16
|
+
* Hint that a run's event log may have new events.
|
|
17
|
+
*/
|
|
18
|
+
export interface RunEventHint {
|
|
19
|
+
/**
|
|
20
|
+
* Run whose durable event log may have advanced.
|
|
21
|
+
*/
|
|
22
|
+
runId: string;
|
|
23
|
+
/**
|
|
24
|
+
* Latest appended offset known to the publisher. Hints are wakeups only:
|
|
25
|
+
* subscribers must always re-read the durable RunEventStore and must not
|
|
26
|
+
* assume every offset hint arrives exactly once.
|
|
27
|
+
*/
|
|
28
|
+
offset: RunEventOffset;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Input for subscribing to run event hints.
|
|
32
|
+
*/
|
|
33
|
+
export interface WatchRunEventsInput {
|
|
34
|
+
runId: string;
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Subscription to run event hints.
|
|
39
|
+
*/
|
|
40
|
+
export interface RunEventSubscription extends AsyncIterable<RunEventHint> {
|
|
41
|
+
readonly ready?: Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Notifier for publishing and subscribing to run event hints.
|
|
45
|
+
*/
|
|
46
|
+
export interface RunEventNotifier {
|
|
47
|
+
/**
|
|
48
|
+
* Publishes a best-effort wakeup after a durable run event append. Notifiers
|
|
49
|
+
* may drop, duplicate, coalesce, or delay hints; correctness must come from
|
|
50
|
+
* replaying the RunEventStore.
|
|
51
|
+
*/
|
|
52
|
+
publishRunEventAppended(input: RunEventHint): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Subscribes to best-effort wakeups for one run. Consumers must tolerate
|
|
55
|
+
* missed hints and use each hint only as a prompt to list durable events.
|
|
56
|
+
* When `ready` is present on the returned subscription, it resolves after
|
|
57
|
+
* the subscription is armed server-side.
|
|
58
|
+
*/
|
|
59
|
+
subscribeRunEvents(input: WatchRunEventsInput): RunEventSubscription;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Options for creating a local run event notifier client.
|
|
63
|
+
*/
|
|
64
|
+
export interface LocalRunEventNotifierOptions {
|
|
65
|
+
socketPath: string;
|
|
66
|
+
connectTimeoutMs?: number;
|
|
67
|
+
requestTimeoutMs?: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Options for starting a local run event notifier server.
|
|
71
|
+
*/
|
|
72
|
+
export interface LocalRunEventNotifierServerOptions {
|
|
73
|
+
socketPath: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Local run event notifier client that connects to a notifier server via Unix socket.
|
|
77
|
+
*
|
|
78
|
+
* This wrapper class ensures the public API doesn't leak internal implementation types.
|
|
79
|
+
*/
|
|
80
|
+
export declare class LocalRunEventNotifier implements RunEventNotifier {
|
|
81
|
+
private readonly impl;
|
|
82
|
+
constructor(options: LocalRunEventNotifierOptions);
|
|
83
|
+
publishRunEventAppended(input: RunEventHint): Promise<void>;
|
|
84
|
+
subscribeRunEvents(input: WatchRunEventsInput): RunEventSubscription;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Local run event notifier server that listens on a Unix socket.
|
|
88
|
+
*
|
|
89
|
+
* This wrapper class ensures the public API doesn't leak internal implementation types.
|
|
90
|
+
*/
|
|
91
|
+
export declare class LocalRunEventNotifierServer {
|
|
92
|
+
private readonly impl;
|
|
93
|
+
private constructor();
|
|
94
|
+
static listen(options: LocalRunEventNotifierServerOptions): Promise<LocalRunEventNotifierServer>;
|
|
95
|
+
close(): Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* In-memory run event notifier for testing and development.
|
|
99
|
+
*
|
|
100
|
+
* This wrapper class ensures the public API doesn't leak internal implementation types.
|
|
101
|
+
*/
|
|
102
|
+
export declare class InMemoryRunEventNotifier implements RunEventNotifier {
|
|
103
|
+
private readonly impl;
|
|
104
|
+
constructor();
|
|
105
|
+
publishRunEventAppended(input: RunEventHint): Promise<void>;
|
|
106
|
+
subscribeRunEvents(input: WatchRunEventsInput): RunEventSubscription;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Creates a local run event notifier client.
|
|
110
|
+
*/
|
|
111
|
+
export declare function createLocalRunEventNotifier(options: LocalRunEventNotifierOptions): RunEventNotifier;
|
|
112
|
+
/**
|
|
113
|
+
* Starts a local run event notifier server.
|
|
114
|
+
*/
|
|
115
|
+
export declare function startLocalRunEventNotifierServer(options: LocalRunEventNotifierServerOptions): Promise<LocalRunEventNotifierServer>;
|
|
116
|
+
/**
|
|
117
|
+
* Creates an in-memory run event notifier for testing and development.
|
|
118
|
+
*/
|
|
119
|
+
export declare function createInMemoryRunEventNotifier(): RunEventNotifier;
|
|
120
|
+
//# sourceMappingURL=run-event-notifier-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-event-notifier-api.d.ts","sourceRoot":"","sources":["../../../src/agent/run-event-notifier-api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,EAAE,cAAc,CAAC;CAC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,QAAQ,CAAC,IAAI,CAA+B;;IAM9C,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjE,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB;CAGrE;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,4BAA4B,GACpC,gBAAgB,CAElB;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,2BAA2B,CAAC,CAEtC;AAED;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,gBAAgB,CAEjE"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { RunEventNotifier } from "./run-event-notifier-api.js";
|
|
2
|
+
export type { RunEventNotifier } from "./run-event-notifier-api.js";
|
|
3
|
+
/** Custom subagent definition passed to the local agent runtime. */
|
|
4
|
+
export interface RuntimeCustomSubagentDefinition {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
readonly prompt: string;
|
|
8
|
+
readonly model: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Public run-store shapes for published SDK declarations.
|
|
12
|
+
*
|
|
13
|
+
* Mirrors ../run-store-public-types.js types without
|
|
14
|
+
* referencing unpublished workspace packages in .d.ts output.
|
|
15
|
+
*/
|
|
16
|
+
export type RunLifecycleStatus = "QUEUED" | "CREATING" | "RUNNING" | "FINISHED" | "ERROR" | "CANCELLED" | "EXPIRED";
|
|
17
|
+
export type AgentLifecycleStatus = "IDLE" | "RUNNING" | "ARCHIVED" | "ERROR";
|
|
18
|
+
export interface CheckpointRef {
|
|
19
|
+
blobId: string;
|
|
20
|
+
storeKind: string;
|
|
21
|
+
}
|
|
22
|
+
export interface StoredModelParameterValue {
|
|
23
|
+
id: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}
|
|
26
|
+
export interface StoredModelSelection {
|
|
27
|
+
id: string;
|
|
28
|
+
params?: StoredModelParameterValue[];
|
|
29
|
+
}
|
|
30
|
+
export interface AgentRecord {
|
|
31
|
+
agentId: string;
|
|
32
|
+
workspaceRef: string;
|
|
33
|
+
status: AgentLifecycleStatus;
|
|
34
|
+
activeRunId: string | null;
|
|
35
|
+
latestCheckpointRef: CheckpointRef | null;
|
|
36
|
+
name: string | null;
|
|
37
|
+
createdAt: Date;
|
|
38
|
+
updatedAt: Date;
|
|
39
|
+
metadata: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
export interface RunRecord {
|
|
42
|
+
runId: string;
|
|
43
|
+
requestId?: string | null;
|
|
44
|
+
agentId: string;
|
|
45
|
+
turnNumber: number;
|
|
46
|
+
status: RunLifecycleStatus;
|
|
47
|
+
model: StoredModelSelection | null;
|
|
48
|
+
startCheckpointRef: CheckpointRef | null;
|
|
49
|
+
latestCheckpointRef: CheckpointRef | null;
|
|
50
|
+
errorCode: string | null;
|
|
51
|
+
result: string | null;
|
|
52
|
+
usageRef: string | null;
|
|
53
|
+
createdAt: Date;
|
|
54
|
+
updatedAt: Date;
|
|
55
|
+
startedAt: Date | null;
|
|
56
|
+
finishedAt: Date | null;
|
|
57
|
+
cancelledAt: Date | null;
|
|
58
|
+
expiredAt: Date | null;
|
|
59
|
+
}
|
|
60
|
+
export interface CreateAgentInput {
|
|
61
|
+
agentId?: string;
|
|
62
|
+
requestId?: string | null;
|
|
63
|
+
workspaceRef: string;
|
|
64
|
+
name?: string | null;
|
|
65
|
+
model?: StoredModelSelection | null;
|
|
66
|
+
metadata?: Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
export interface CreateFollowUpRunInput {
|
|
69
|
+
requestId?: string | null;
|
|
70
|
+
model?: StoredModelSelection | null;
|
|
71
|
+
metadata?: Record<string, unknown>;
|
|
72
|
+
}
|
|
73
|
+
export interface ListOptions {
|
|
74
|
+
cursor?: string;
|
|
75
|
+
limit?: number;
|
|
76
|
+
}
|
|
77
|
+
export interface ListResult<T> {
|
|
78
|
+
items: T[];
|
|
79
|
+
nextCursor?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface RunTerminalPatch {
|
|
82
|
+
status: Extract<RunLifecycleStatus, "FINISHED" | "ERROR" | "CANCELLED" | "EXPIRED">;
|
|
83
|
+
errorCode?: string | null;
|
|
84
|
+
result?: string | null;
|
|
85
|
+
usageRef?: string | null;
|
|
86
|
+
}
|
|
87
|
+
export interface AppendRunEventInput {
|
|
88
|
+
runId: string;
|
|
89
|
+
eventType: string;
|
|
90
|
+
payload?: unknown;
|
|
91
|
+
payloadRef?: string | null;
|
|
92
|
+
idempotencyKey?: string | null;
|
|
93
|
+
}
|
|
94
|
+
export interface RunEventRecord {
|
|
95
|
+
runId: string;
|
|
96
|
+
seq: number;
|
|
97
|
+
offset: string;
|
|
98
|
+
eventType: string;
|
|
99
|
+
payload: unknown;
|
|
100
|
+
payloadRef: string | null;
|
|
101
|
+
idempotencyKey: string | null;
|
|
102
|
+
createdAt: Date;
|
|
103
|
+
}
|
|
104
|
+
export interface ListRunEventsInput {
|
|
105
|
+
runId: string;
|
|
106
|
+
afterOffset?: string | null;
|
|
107
|
+
limit?: number;
|
|
108
|
+
}
|
|
109
|
+
export interface ListRunEventsResult {
|
|
110
|
+
events: RunEventRecord[];
|
|
111
|
+
nextOffset?: string;
|
|
112
|
+
}
|
|
113
|
+
export interface RunEventStore {
|
|
114
|
+
appendRunEvent(input: AppendRunEventInput): Promise<RunEventRecord>;
|
|
115
|
+
listRunEvents(input: ListRunEventsInput): Promise<ListRunEventsResult>;
|
|
116
|
+
deleteRunEvents?(input: {
|
|
117
|
+
runId: string;
|
|
118
|
+
}): Promise<void>;
|
|
119
|
+
}
|
|
120
|
+
export interface AttachRunEventsInput {
|
|
121
|
+
runId: string;
|
|
122
|
+
afterOffset?: string | null;
|
|
123
|
+
signal?: AbortSignal;
|
|
124
|
+
}
|
|
125
|
+
export interface RunEventStreamStore extends RunEventStore {
|
|
126
|
+
attachRunEvents(input: AttachRunEventsInput): AsyncIterable<RunEventRecord>;
|
|
127
|
+
}
|
|
128
|
+
export interface WatchableRunEventStore extends RunEventStore {
|
|
129
|
+
watchRunEvents(input: {
|
|
130
|
+
runId: string;
|
|
131
|
+
signal?: AbortSignal;
|
|
132
|
+
}): AsyncIterable<{
|
|
133
|
+
runId: string;
|
|
134
|
+
offset: string;
|
|
135
|
+
}>;
|
|
136
|
+
}
|
|
137
|
+
export interface AgentRunStore {
|
|
138
|
+
createAgent(input: CreateAgentInput): Promise<{
|
|
139
|
+
agent: AgentRecord;
|
|
140
|
+
run: RunRecord;
|
|
141
|
+
}>;
|
|
142
|
+
createFollowUpRun(agentId: string, input: CreateFollowUpRunInput): Promise<RunRecord>;
|
|
143
|
+
listAgents(opts?: ListOptions): Promise<ListResult<AgentRecord>>;
|
|
144
|
+
getAgent(agentId: string): Promise<AgentRecord | null>;
|
|
145
|
+
listRuns(agentId: string, opts?: ListOptions): Promise<ListResult<RunRecord>>;
|
|
146
|
+
getRun(agentId: string, runId: string): Promise<RunRecord | null>;
|
|
147
|
+
markRunStarting(agentId: string, runId: string, input?: {
|
|
148
|
+
requestId?: string | null;
|
|
149
|
+
}): Promise<void>;
|
|
150
|
+
patchCheckpoint(agentId: string, runId: string, checkpointRef: CheckpointRef): Promise<void>;
|
|
151
|
+
markRunTerminal(agentId: string, runId: string, terminal: RunTerminalPatch): Promise<void>;
|
|
152
|
+
cancelRun(agentId: string, runId: string): Promise<void>;
|
|
153
|
+
archiveAgent(agentId: string): Promise<void>;
|
|
154
|
+
unarchiveAgent(agentId: string): Promise<void>;
|
|
155
|
+
deleteAgent(agentId: string): Promise<void>;
|
|
156
|
+
}
|
|
157
|
+
/** Opaque checkpoint payload in the published SDK surface. */
|
|
158
|
+
export type SdkConversationStateStructure = unknown;
|
|
159
|
+
/** Opaque conversation payload in the published SDK surface. */
|
|
160
|
+
export type SdkConversationState = unknown;
|
|
161
|
+
/** Opaque blob store handle in the published SDK surface. */
|
|
162
|
+
export type SdkBlobStore = unknown;
|
|
163
|
+
export interface AgentCheckpointStore {
|
|
164
|
+
loadLatest(agentId: string): Promise<SdkConversationStateStructure | null>;
|
|
165
|
+
saveCheckpoint(agentId: string, checkpoint: SdkConversationStateStructure): Promise<CheckpointRef>;
|
|
166
|
+
getBlobStore(agentId: string): Promise<SdkBlobStore>;
|
|
167
|
+
getFullConversation(agentId: string): Promise<SdkConversationState>;
|
|
168
|
+
deleteAgent?(agentId: string): Promise<void>;
|
|
169
|
+
}
|
|
170
|
+
export interface CursorAgentPlatformOptions {
|
|
171
|
+
store?: AgentRunStore;
|
|
172
|
+
checkpointStore?: AgentCheckpointStore;
|
|
173
|
+
eventStore?: RunEventStore;
|
|
174
|
+
eventNotifier?: RunEventNotifier;
|
|
175
|
+
stateRoot?: string;
|
|
176
|
+
workspaceRef?: string;
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=run-store-public-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-store-public-types.d.ts","sourceRoot":"","sources":["../../../src/agent/run-store-public-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,oEAAoE;AACpE,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AAEH,MAAM,MAAM,kBAAkB,GAC1B,QAAQ,GACR,UAAU,GACV,SAAS,GACT,UAAU,GACV,OAAO,GACP,WAAW,GACX,SAAS,CAAC;AAEd,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;AAE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C;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AgentRecord, RunRecord } from "../../run-store-public-types.js";
|
|
2
|
+
import type { LocalAgentDocument, LocalAgentRunDocument } from "./local-agent-store.js";
|
|
3
|
+
export declare function localAgentDocumentFromAgentRecord(record: AgentRecord): LocalAgentDocument;
|
|
4
|
+
export declare function localAgentRunDocumentFromRunRecord(record: RunRecord): LocalAgentRunDocument;
|
|
5
|
+
export declare function agentRecordFromLocalAgentDocument(document: LocalAgentDocument): AgentRecord;
|
|
6
|
+
export declare function runRecordFromLocalAgentRunDocument(run: LocalAgentRunDocument): RunRecord;
|
|
7
|
+
//# sourceMappingURL=local-agent-record-conversion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-agent-record-conversion.d.ts","sourceRoot":"","sources":["../../../../src/agent/store/local-agent-record-conversion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAGX,SAAS,EACV,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EAEV,kBAAkB,EAClB,qBAAqB,EAGtB,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,WAAW,GAClB,kBAAkB,CAcpB;AAED,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,SAAS,GAChB,qBAAqB,CA2BvB;AAED,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,kBAAkB,GAC3B,WAAW,CAcb;AAED,wBAAgB,kCAAkC,CAChD,GAAG,EAAE,qBAAqB,GACzB,SAAS,CA0BX"}
|