@ellipsis-dev/sdk 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -241,138 +241,6 @@ var Transport = class {
241
241
 
242
242
  // src/core/client.ts
243
243
  var enc = encodeURIComponent;
244
- var EllipsisAgentsConfigs = class {
245
- constructor(transport) {
246
- this.transport = transport;
247
- }
248
- transport;
249
- /**
250
- * Create Agent Config
251
- *
252
- * Create an agent config, managed through the API: no file, live
253
- * immediately. To put its definition in a repository instead, create
254
- * it here and then POST /v1/agents/configs/{config_id}/link.
255
- *
256
- * 409 when another live agent already holds the name.
257
- */
258
- async create(options) {
259
- const path = "/v1/agents/configs";
260
- const body = buildBody({ config: options.config });
261
- return await this.transport.request("POST", path, { body });
262
- }
263
- /**
264
- * Delete Agent Config
265
- *
266
- * Delete an agent, by id or by the agent's name.
267
- *
268
- * The agent stops running and its name is freed immediately; its
269
- * past sessions remain readable. Only for agents managed through
270
- * this API — delete the file to remove one defined by a
271
- * repository.
272
- */
273
- async delete(config_id) {
274
- const path = `/v1/agents/configs/${enc(config_id)}`;
275
- await this.transport.request("DELETE", path);
276
- }
277
- /**
278
- * Get Agent Config
279
- *
280
- * Return one saved agent config, by id or by the agent's name.
281
- */
282
- async get(config_id) {
283
- const path = `/v1/agents/configs/${enc(config_id)}`;
284
- return await this.transport.request("GET", path);
285
- }
286
- /**
287
- * Link Agent Config
288
- *
289
- * Move an agent into a repository, by id or by the agent's name.
290
- *
291
- * Opens a pull request adding the agent's config file. The agent
292
- * keeps running unchanged meanwhile; merging hands it over to the
293
- * file, after which the file is what changes it. Nothing happens
294
- * if the pull request is never merged.
295
- */
296
- async link(config_id, options) {
297
- const path = `/v1/agents/configs/${enc(config_id)}/link`;
298
- const body = buildBody({ path: options.path, repository: options.repository });
299
- return await this.transport.request("POST", path, { body });
300
- }
301
- /**
302
- * List Agent Configs
303
- *
304
- * List saved agent configs.
305
- */
306
- async list() {
307
- const path = "/v1/agents/configs";
308
- return await this.transport.request("GET", path);
309
- }
310
- /**
311
- * Unlink Agent Config
312
- *
313
- * Take over an agent from its file, by id or by the agent's name.
314
- *
315
- * The file stops governing the agent immediately and further
316
- * changes go through this API. The file is left in place, inert —
317
- * delete it whenever you like.
318
- */
319
- async unlink(config_id) {
320
- const path = `/v1/agents/configs/${enc(config_id)}/unlink`;
321
- return await this.transport.request("POST", path);
322
- }
323
- /**
324
- * Update Agent Config
325
- *
326
- * Replace an agent's definition, by id or by the agent's name.
327
- *
328
- * The whole definition is replaced, and the change is live at
329
- * once. Only for agents managed through this API: one defined by a
330
- * repository file is a 409, since the next push to that file would
331
- * revert the change — unlink it first to take ownership.
332
- */
333
- async update(config_id, options) {
334
- const path = `/v1/agents/configs/${enc(config_id)}`;
335
- const body = buildBody({ config: options.config });
336
- return await this.transport.request("PUT", path, { body });
337
- }
338
- };
339
- var EllipsisAgentsTemplates = class {
340
- constructor(transport) {
341
- this.transport = transport;
342
- }
343
- transport;
344
- /**
345
- * Get Agent Template
346
- *
347
- * Return one built-in agent template by slug.
348
- */
349
- async get(template_id) {
350
- const path = `/v1/agents/templates/${enc(template_id)}`;
351
- return await this.transport.request("GET", path);
352
- }
353
- /**
354
- * List Agent Templates
355
- *
356
- * List the built-in starter agent templates.
357
- *
358
- * Behind auth but not account-scoped — the data is static
359
- * product content shared by the dashboard, landing site, and CLI.
360
- */
361
- async list() {
362
- const path = "/v1/agents/templates";
363
- return await this.transport.request("GET", path);
364
- }
365
- };
366
- var EllipsisAgents = class {
367
- constructor(transport) {
368
- this.transport = transport;
369
- this.configs = new EllipsisAgentsConfigs(transport);
370
- this.templates = new EllipsisAgentsTemplates(transport);
371
- }
372
- transport;
373
- configs;
374
- templates;
375
- };
376
244
  var EllipsisAlerts = class {
377
245
  constructor(transport) {
378
246
  this.transport = transport;
@@ -450,11 +318,11 @@ var EllipsisAnalytics = class {
450
318
  * Return pull-request analytics.
451
319
  *
452
320
  * Windowing: pass explicit start/end, or days (default: the last
453
- * 30 days).
321
+ * 30 days). account_type in all|user|bot scopes the authors.
454
322
  */
455
323
  async pullRequests(options = {}) {
456
324
  const path = "/v1/analytics/pull-requests";
457
- const query = buildQuery({ days: options.days, start: options.start, end: options.end, account_type: options.account_type, repository_id: options.repository_id, author_id: options.author_id, status: options.status });
325
+ const query = buildQuery({ days: options.days, start: options.start, end: options.end, repo: options.repo, author: options.author, account_type: options.account_type, status: options.status });
458
326
  return await this.transport.request("GET", path, { query });
459
327
  }
460
328
  /**
@@ -512,6 +380,117 @@ var EllipsisAuth = class {
512
380
  transport;
513
381
  cli;
514
382
  };
383
+ var EllipsisAutomations = class {
384
+ constructor(transport) {
385
+ this.transport = transport;
386
+ }
387
+ transport;
388
+ /**
389
+ * Create Automation
390
+ *
391
+ * Create an automation, managed through the API: no file, live
392
+ * immediately. To put its definition in a repository instead, create
393
+ * it here and then POST /v1/automations/{automation_id}/link.
394
+ *
395
+ * 409 when another live automation already holds the name.
396
+ */
397
+ async create(options) {
398
+ const path = "/v1/automations";
399
+ const body = buildBody({ automation: options.automation });
400
+ return await this.transport.request("POST", path, { body });
401
+ }
402
+ /**
403
+ * Delete Automation
404
+ *
405
+ * Delete an automation, by id or by name.
406
+ *
407
+ * It stops running and its name is freed immediately; its past
408
+ * sessions remain readable. Only for automations managed through
409
+ * this API — delete the file to remove one defined by a repository.
410
+ */
411
+ async delete(automation_id) {
412
+ const path = `/v1/automations/${enc(automation_id)}`;
413
+ await this.transport.request("DELETE", path);
414
+ }
415
+ /**
416
+ * Get Automation
417
+ *
418
+ * Return one automation, by id or by name.
419
+ */
420
+ async get(automation_id) {
421
+ const path = `/v1/automations/${enc(automation_id)}`;
422
+ return await this.transport.request("GET", path);
423
+ }
424
+ /**
425
+ * Link Automation
426
+ *
427
+ * Move an automation into a repository, by id or by name.
428
+ *
429
+ * Opens a pull request adding its definition file. The automation
430
+ * keeps running unchanged meanwhile; merging hands it over to the
431
+ * file, after which the file is what changes it. Nothing happens
432
+ * if the pull request is never merged.
433
+ */
434
+ async link(automation_id, options) {
435
+ const path = `/v1/automations/${enc(automation_id)}/link`;
436
+ const body = buildBody({ path: options.path, repository: options.repository });
437
+ return await this.transport.request("POST", path, { body });
438
+ }
439
+ /**
440
+ * List Automations
441
+ *
442
+ * List automations.
443
+ */
444
+ async list() {
445
+ const path = "/v1/automations";
446
+ return await this.transport.request("GET", path);
447
+ }
448
+ /**
449
+ * Start Automation Session
450
+ *
451
+ * Invoke an automation.
452
+ *
453
+ * Runs the automation exactly as defined — its persona, model,
454
+ * environment, permissions, skills, and budget bind — and returns
455
+ * the session it started. The body carries only what a caller may
456
+ * supply: the typed `input` its schema demands, an optional tighter
457
+ * `budget`, and `metadata`. For a different persona or environment,
458
+ * start a raw session with POST /v1/sessions instead.
459
+ */
460
+ async run(automation_id, options = {}) {
461
+ const path = `/v1/automations/${enc(automation_id)}/sessions`;
462
+ const body = buildBody({ budget: options.budget, input: options.input, metadata: options.metadata });
463
+ return await this.transport.request("POST", path, { body });
464
+ }
465
+ /**
466
+ * Unlink Automation
467
+ *
468
+ * Take over an automation from its file, by id or by name.
469
+ *
470
+ * The file stops governing it immediately and further changes go
471
+ * through this API. The file is left in place, inert — delete it
472
+ * whenever you like.
473
+ */
474
+ async unlink(automation_id) {
475
+ const path = `/v1/automations/${enc(automation_id)}/unlink`;
476
+ return await this.transport.request("POST", path);
477
+ }
478
+ /**
479
+ * Update Automation
480
+ *
481
+ * Replace an automation's definition, by id or by name.
482
+ *
483
+ * The whole definition is replaced, and the change is live at
484
+ * once. Only for automations managed through this API: one defined
485
+ * by a repository file is a 409, since the next push to that file
486
+ * would revert the change — unlink it first to take ownership.
487
+ */
488
+ async update(automation_id, options) {
489
+ const path = `/v1/automations/${enc(automation_id)}`;
490
+ const body = buildBody({ automation: options.automation });
491
+ return await this.transport.request("PUT", path, { body });
492
+ }
493
+ };
515
494
  var EllipsisEnvironments = class {
516
495
  constructor(transport) {
517
496
  this.transport = transport;
@@ -758,7 +737,7 @@ var EllipsisIntegrations = class {
758
737
  *
759
738
  * A read-only view, so an agent authoring another agent's
760
739
  * config can learn which repositories, channels, teams, and
761
- * organizations it may name before POST /agents/configs.
740
+ * organizations it may name before POST /automations.
762
741
  *
763
742
  * Available to all credential types including sandbox tokens: the
764
743
  * responses never include OAuth tokens or any other secret.
@@ -1053,13 +1032,13 @@ var EllipsisSessions = class {
1053
1032
  *
1054
1033
  * List cloud agent sessions, newest first.
1055
1034
  *
1056
- * Optionally filtered by config (id or `ellipsis.name`), source, time
1035
+ * Optionally filtered by automation (id or name), source, time
1057
1036
  * window, attributed author, repository, and whether the session is
1058
1037
  * still going.
1059
1038
  */
1060
1039
  async list(options = {}) {
1061
1040
  const path = "/v1/sessions";
1062
- const query = buildQuery({ config_id: options.config_id, source: options.source, days: options.days, start: options.start, end: options.end, limit: options.limit, cursor: options.cursor, author_id: options.author_id, repo: options.repo, unfinished: options.unfinished });
1041
+ const query = buildQuery({ automation: options.automation, source: options.source, days: options.days, start: options.start, end: options.end, limit: options.limit, cursor: options.cursor, author_id: options.author_id, repo: options.repo, unfinished: options.unfinished });
1063
1042
  const response = await this.transport.request("GET", path, { query });
1064
1043
  return new Page(
1065
1044
  response,
@@ -1141,18 +1120,19 @@ var EllipsisSessions = class {
1141
1120
  *
1142
1121
  * Start a cloud agent session.
1143
1122
  *
1144
- * The base is `from_config_id` (an id or an agent name) or, omitted,
1145
- * the bare ad-hoc config; every AgentConfig key on the request
1146
- * deep-merges on top, so the body is both the pointer and the
1147
- * per-session override. `prompt` is the first message; omit it and
1148
- * the session starts idle, waiting for one. 400 when
1149
- * ellipsis.interactive=false and there is no prompt or input. 422
1150
- * when the agent declares an input schema and the request's input
1151
- * is absent or invalid.
1123
+ * The daily driver: a prompt, optionally where to run it
1124
+ * (`environment`) and the run's own settings, in the AgentConfig
1125
+ * vocabulary. Anything omitted comes from the organization's
1126
+ * settings — default model, default environment, budget — so
1127
+ * `{"prompt": "..."}` alone is a complete request. `prompt` is the
1128
+ * first message; omit it and the session starts idle, waiting for
1129
+ * one. 400 when `interactive` is false and there is no prompt, or
1130
+ * when `budget` exceeds the organization's per-session ceiling. To
1131
+ * run a saved automation, use POST /v1/automations/{automation_id}/sessions.
1152
1132
  */
1153
1133
  async start(options = {}) {
1154
1134
  const path = "/v1/sessions";
1155
- const body = buildBody({ budget: options.budget, claude: options.claude, codex: options.codex, ellipsis: options.ellipsis, environment: options.environment, from_config_id: options.from_config_id, input: options.input, output: options.output, permissions: options.permissions, prompt: options.prompt, skills: options.skills });
1135
+ const body = buildBody({ budget: options.budget, claude: options.claude, codex: options.codex, environment: options.environment, force_rebuild: options.force_rebuild, interactive: options.interactive, metadata: options.metadata, output: options.output, permissions: options.permissions, prompt: options.prompt, skills: options.skills });
1156
1136
  return await this.transport.request("POST", path, { body });
1157
1137
  }
1158
1138
  /**
@@ -1179,53 +1159,83 @@ var EllipsisSessions = class {
1179
1159
  return new SessionHandle(this, response.session);
1180
1160
  }
1181
1161
  };
1182
- var EllipsisSettingsSessions = class {
1162
+ var EllipsisSettingsOrganization = class {
1183
1163
  constructor(transport) {
1184
1164
  this.transport = transport;
1185
1165
  }
1186
1166
  transport;
1187
1167
  /**
1188
- * Get Session Defaults
1168
+ * Get Organization Settings
1189
1169
  *
1190
- * Get the account-wide session defaults.
1170
+ * Get the organization settings.
1191
1171
  *
1192
- * Today one setting: the default model every session falls back to
1193
- * when neither its request nor its agent config names one.
1172
+ * The default model and default environment every session falls
1173
+ * back to when neither its request nor its automation names one,
1174
+ * and the per-session budget ceiling no session may exceed.
1194
1175
  */
1195
- async getDefaults() {
1196
- const path = "/v1/settings/sessions/defaults";
1176
+ async get() {
1177
+ const path = "/v1/settings/organization";
1197
1178
  return await this.transport.request("GET", path);
1198
1179
  }
1199
1180
  /**
1200
- * Set Session Defaults
1181
+ * Set Organization Settings
1201
1182
  *
1202
- * Set the account-wide session defaults.
1183
+ * Set the organization settings.
1203
1184
  *
1204
- * `model` accepts an alias or canonical id and is stored canonical;
1205
- * null clears it (sessions then fall back to the platform default).
1185
+ * Replaces all three: `default_model` accepts an alias or canonical
1186
+ * id and is stored canonical; `default_environment` accepts a name
1187
+ * or `env_` id and is stored as the id; `budget_ceiling.session` is
1188
+ * in US dollars, at most the platform ceiling. Null clears each.
1206
1189
  * Refused for sandbox tokens (potentially prompt-injected code must
1207
- * not repoint the account's default model).
1190
+ * not repoint the organization's defaults).
1208
1191
  */
1209
- async setDefaults(options = {}) {
1210
- const path = "/v1/settings/sessions/defaults";
1211
- const body = buildBody({ model: options.model });
1192
+ async set(options = {}) {
1193
+ const path = "/v1/settings/organization";
1194
+ const body = buildBody({ budget_ceiling: options.budget_ceiling, default_environment: options.default_environment, default_model: options.default_model });
1212
1195
  return await this.transport.request("PUT", path, { body });
1213
1196
  }
1214
1197
  };
1215
1198
  var EllipsisSettings = class {
1216
1199
  constructor(transport) {
1217
1200
  this.transport = transport;
1218
- this.sessions = new EllipsisSettingsSessions(transport);
1201
+ this.organization = new EllipsisSettingsOrganization(transport);
1219
1202
  }
1220
1203
  transport;
1221
- sessions;
1204
+ organization;
1205
+ };
1206
+ var EllipsisTemplates = class {
1207
+ constructor(transport) {
1208
+ this.transport = transport;
1209
+ }
1210
+ transport;
1211
+ /**
1212
+ * Get Agent Template
1213
+ *
1214
+ * Return one built-in agent template by slug.
1215
+ */
1216
+ async get(template_id) {
1217
+ const path = `/v1/templates/${enc(template_id)}`;
1218
+ return await this.transport.request("GET", path);
1219
+ }
1220
+ /**
1221
+ * List Agent Templates
1222
+ *
1223
+ * List the built-in starter agent templates.
1224
+ *
1225
+ * Behind auth but not account-scoped — the data is static
1226
+ * product content shared by the dashboard, landing site, and CLI.
1227
+ */
1228
+ async list() {
1229
+ const path = "/v1/templates";
1230
+ return await this.transport.request("GET", path);
1231
+ }
1222
1232
  };
1223
1233
  var Ellipsis = class {
1224
1234
  transport;
1225
- agents;
1226
1235
  alerts;
1227
1236
  analytics;
1228
1237
  auth;
1238
+ automations;
1229
1239
  environments;
1230
1240
  files;
1231
1241
  integrations;
@@ -1235,12 +1245,13 @@ var Ellipsis = class {
1235
1245
  secrets;
1236
1246
  sessions;
1237
1247
  settings;
1248
+ templates;
1238
1249
  constructor(options) {
1239
1250
  this.transport = new Transport(options);
1240
- this.agents = new EllipsisAgents(this.transport);
1241
1251
  this.alerts = new EllipsisAlerts(this.transport);
1242
1252
  this.analytics = new EllipsisAnalytics(this.transport);
1243
1253
  this.auth = new EllipsisAuth(this.transport);
1254
+ this.automations = new EllipsisAutomations(this.transport);
1244
1255
  this.environments = new EllipsisEnvironments(this.transport);
1245
1256
  this.files = new EllipsisFiles(this.transport);
1246
1257
  this.integrations = new EllipsisIntegrations(this.transport);
@@ -1250,6 +1261,7 @@ var Ellipsis = class {
1250
1261
  this.secrets = new EllipsisSecrets(this.transport);
1251
1262
  this.sessions = new EllipsisSessions(this.transport);
1252
1263
  this.settings = new EllipsisSettings(this.transport);
1264
+ this.templates = new EllipsisTemplates(this.transport);
1253
1265
  }
1254
1266
  /**
1255
1267
  * Get Budget
@@ -1,4 +1,4 @@
1
- import { Z as SessionRecord, aa as CodexFileChangeItem, b as CodexEvent, ab as CodexMcpToolCallItem, x as SdkRecord, K as Session, V as SessionMessage, a7 as StreamFrame } from '../types-BLSh1Px1.js';
1
+ import { Z as SessionRecord, aa as CodexFileChangeItem, b as CodexEvent, ab as CodexMcpToolCallItem, x as SdkRecord, K as Session, V as SessionMessage, a7 as StreamFrame } from '../types-D2YZTvgg.js';
2
2
 
3
3
  interface ChatToolNode {
4
4
  key: string;
@@ -82,13 +82,6 @@ declare function deriveSandboxState(records: readonly RecordSlice[], minFeedSeq:
82
82
  declare function sandboxSummary(sandbox: SandboxState | null): string;
83
83
  declare function lastLines(log: readonly SandboxLogLine[], max: number): SandboxLogLine[];
84
84
 
85
- declare function sandboxOutputStep(payload: Record<string, unknown>): string;
86
- declare function sandboxOutputLines(payload: Record<string, unknown>): string[];
87
- declare function sandboxOutputLine(payload: Record<string, unknown>): string | null;
88
- declare function cacheTierLabel(tier: unknown): string | null;
89
- declare function sandboxPhaseLabel(phase: unknown): string;
90
- declare function lifecycleText(recordType: string, payload: Record<string, unknown>): string | null;
91
-
92
85
  type ItemKind = 'assistant' | 'thinking' | 'tool' | 'tool_result' | 'summary' | 'system' | 'user' | 'notice' | 'error';
93
86
  interface TranscriptItem {
94
87
  key: string;
@@ -129,6 +122,34 @@ declare function foldCosts(events: SdkRecord[]): {
129
122
  };
130
123
  declare function statusActivityText(status: string): string | null;
131
124
 
125
+ declare const LIVE_GLYPH = "\u23FA";
126
+ declare const USER_BAR = "\u2503";
127
+ declare const BRANCH_GLYPH = "\u23BF";
128
+ declare function gutterFor(item: TranscriptItem): string;
129
+ declare function chatTurnsToItems(turns: readonly ChatTurn[]): TranscriptItem[];
130
+ declare function isToolFold(item: TranscriptItem): boolean;
131
+ declare function isToolActivity(item: TranscriptItem): boolean;
132
+ declare function isAgentSpeech(item: TranscriptItem): boolean;
133
+ type PlacedItem = {
134
+ item: TranscriptItem;
135
+ nested: boolean;
136
+ attach: boolean;
137
+ };
138
+ declare function layOutItems(items: readonly TranscriptItem[]): PlacedItem[];
139
+ declare function foldGutter(nested: boolean): string;
140
+ declare function tailLines(text: string, maxLines: number): {
141
+ body: string;
142
+ hidden: number;
143
+ };
144
+ declare function toolRunMembers(items: readonly TranscriptItem[]): Map<string, TranscriptItem[]>;
145
+
146
+ declare function sandboxOutputStep(payload: Record<string, unknown>): string;
147
+ declare function sandboxOutputLines(payload: Record<string, unknown>): string[];
148
+ declare function sandboxOutputLine(payload: Record<string, unknown>): string | null;
149
+ declare function cacheTierLabel(tier: unknown): string | null;
150
+ declare function sandboxPhaseLabel(phase: unknown): string;
151
+ declare function lifecycleText(recordType: string, payload: Record<string, unknown>): string | null;
152
+
132
153
  declare function isConversationOver(session: Session): boolean;
133
154
  interface SessionTranscriptSnapshot {
134
155
  session: Session | null;
@@ -165,4 +186,4 @@ declare class SessionTranscriptStore {
165
186
  ingest: (rawFrame: StreamFrame) => void;
166
187
  }
167
188
 
168
- export { type ChatNode, type ChatToolNode, type ChatTurn, type EventToItemsOptions, type ItemKind, type RecordSlice, type SandboxLogKind, type SandboxLogLine, type SandboxState, type SessionTranscriptSnapshot, SessionTranscriptStore, StreamFrame, type TranscriptItem, awaitingAgentPhase, cacheTierLabel, clampLines, codexChangedPaths, codexEventToItems, codexMcpToolName, collapseToolRuns, deliveredUnechoedSends, deriveSandboxState, emptySessionTranscriptSnapshot, eventToItems, foldCosts, formatDuration, groupRecordsToChatTurns, hookPhrase, humanDuration, isConnectVisibleRecord, isConversationOver, lastLines, lifecycleText, oneLine, pendingToolCalls, recordSlice, recordToItems, resultCostUsd, sandboxOutputLine, sandboxOutputLines, sandboxOutputStep, sandboxPhaseLabel, sandboxSummary, seedTranscriptStore, sessionLogText, statusActivityText, summarizeToolInput, toolResultText };
189
+ export { BRANCH_GLYPH, type ChatNode, type ChatToolNode, type ChatTurn, type EventToItemsOptions, type ItemKind, LIVE_GLYPH, type PlacedItem, type RecordSlice, type SandboxLogKind, type SandboxLogLine, type SandboxState, type SessionTranscriptSnapshot, SessionTranscriptStore, StreamFrame, type TranscriptItem, USER_BAR, awaitingAgentPhase, cacheTierLabel, chatTurnsToItems, clampLines, codexChangedPaths, codexEventToItems, codexMcpToolName, collapseToolRuns, deliveredUnechoedSends, deriveSandboxState, emptySessionTranscriptSnapshot, eventToItems, foldCosts, foldGutter, formatDuration, groupRecordsToChatTurns, gutterFor, hookPhrase, humanDuration, isAgentSpeech, isConnectVisibleRecord, isConversationOver, isToolActivity, isToolFold, lastLines, layOutItems, lifecycleText, oneLine, pendingToolCalls, recordSlice, recordToItems, resultCostUsd, sandboxOutputLine, sandboxOutputLines, sandboxOutputStep, sandboxPhaseLabel, sandboxSummary, seedTranscriptStore, sessionLogText, statusActivityText, summarizeToolInput, tailLines, toolResultText, toolRunMembers };