@ellipsis-dev/sdk 0.36.0 → 0.38.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.d.ts +186 -510
- package/dist/index.js +90 -430
- package/dist/store/index.d.ts +11 -25
- package/dist/store/index.js +151 -284
- package/dist/stream/index.d.ts +2 -3
- package/dist/stream/index.js +11 -22
- package/dist/{types-CbePyY-S.d.ts → types-D4cLMGUn.d.ts} +1896 -4803
- package/package.json +1 -1
- package/schema/collection_frames.schema.json +442 -231
- package/schema/frames.schema.json +1089 -1521
- package/schema/lifecycle.schema.json +389 -150
- package/schema/openapi.v1.json +3972 -8663
- package/schema/trigger_fields.schema.json +6 -1
package/dist/index.js
CHANGED
|
@@ -29,14 +29,12 @@ var Page = class {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
// src/core/sessionHandle.ts
|
|
32
|
-
var
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"stopped",
|
|
36
|
-
"cancelled"
|
|
32
|
+
var SETTLED_SESSION_STATUSES = /* @__PURE__ */ new Set([
|
|
33
|
+
"idle",
|
|
34
|
+
"closed"
|
|
37
35
|
]);
|
|
38
|
-
function
|
|
39
|
-
return
|
|
36
|
+
function isSessionSettled(status) {
|
|
37
|
+
return SETTLED_SESSION_STATUSES.has(status);
|
|
40
38
|
}
|
|
41
39
|
var DEFAULT_POLL_INTERVAL_MS = 3e3;
|
|
42
40
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -45,50 +43,55 @@ var SessionHandle = class {
|
|
|
45
43
|
this.sessions = sessions;
|
|
46
44
|
this.id = session.id;
|
|
47
45
|
this.session = session;
|
|
48
|
-
this.turnId = session.turn?.id ?? null;
|
|
49
46
|
}
|
|
50
47
|
sessions;
|
|
51
48
|
id;
|
|
52
49
|
// The latest session snapshot this handle saw.
|
|
53
50
|
session;
|
|
54
|
-
// The
|
|
55
|
-
//
|
|
56
|
-
|
|
51
|
+
// The message `wait()` waits on: the last one sent through `send()`, else
|
|
52
|
+
// the session's latest message.
|
|
53
|
+
messageId = null;
|
|
57
54
|
async refresh() {
|
|
58
55
|
this.session = (await this.sessions.get(this.id)).session;
|
|
59
56
|
return this.session;
|
|
60
57
|
}
|
|
61
|
-
// Poll until the
|
|
62
|
-
//
|
|
63
|
-
//
|
|
58
|
+
// Poll until the session is idle or closed, then return how the awaited
|
|
59
|
+
// message ended: its `message_ended` record's payload. Null when the
|
|
60
|
+
// session has no message.
|
|
64
61
|
async wait(options = {}) {
|
|
65
62
|
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
66
63
|
const deadline = options.timeoutMs == null ? null : Date.now() + options.timeoutMs;
|
|
67
64
|
for (; ; ) {
|
|
68
65
|
const session = await this.refresh();
|
|
69
|
-
|
|
70
|
-
if (turnId == null) return null;
|
|
71
|
-
const turn = session.turn?.id === turnId ? session.turn : (await this.sessions.turns.get(this.id, turnId)).turn;
|
|
72
|
-
if (isTurnFinal(turn.status) || session.conversation.state === "closed")
|
|
73
|
-
return turn;
|
|
66
|
+
if (isSessionSettled(session.status)) break;
|
|
74
67
|
if (deadline != null && Date.now() >= deadline) {
|
|
75
68
|
throw new Error(
|
|
76
|
-
`
|
|
69
|
+
`session ${this.id} not settled after ${options.timeoutMs}ms`
|
|
77
70
|
);
|
|
78
71
|
}
|
|
79
72
|
await sleep(pollIntervalMs);
|
|
80
73
|
}
|
|
74
|
+
let ended = null;
|
|
75
|
+
const page = await this.sessions.records(this.id, {
|
|
76
|
+
message_id: this.messageId
|
|
77
|
+
});
|
|
78
|
+
for await (const record of page) {
|
|
79
|
+
if (record.kind !== "platform" || record.record_type !== "message_ended")
|
|
80
|
+
continue;
|
|
81
|
+
if (this.messageId == null || record.message_id === this.messageId)
|
|
82
|
+
ended = record.payload;
|
|
83
|
+
}
|
|
84
|
+
return ended;
|
|
81
85
|
}
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
// message as content blocks the model sees on that turn.
|
|
86
|
+
// Send a message to the session; `wait()` then waits for it to be
|
|
87
|
+
// answered. `images` ride the message as content blocks the model sees.
|
|
85
88
|
async send(message, options = {}) {
|
|
86
89
|
const response = await this.sessions.sendMessage(this.id, {
|
|
87
90
|
message,
|
|
88
91
|
images: options.images,
|
|
89
92
|
idempotency_key: options.idempotencyKey
|
|
90
93
|
});
|
|
91
|
-
this.
|
|
94
|
+
this.messageId = response.message.id;
|
|
92
95
|
return response;
|
|
93
96
|
}
|
|
94
97
|
async stop() {
|
|
@@ -305,6 +308,33 @@ var EllipsisAccountApiKeys = class {
|
|
|
305
308
|
return await this.transport.request("DELETE", path);
|
|
306
309
|
}
|
|
307
310
|
};
|
|
311
|
+
var EllipsisAccountApiRequests = class {
|
|
312
|
+
constructor(transport) {
|
|
313
|
+
this.transport = transport;
|
|
314
|
+
}
|
|
315
|
+
transport;
|
|
316
|
+
/**
|
|
317
|
+
* List Api Requests
|
|
318
|
+
*
|
|
319
|
+
* List requests made to the API with API keys, user tokens, and session tokens, newest first.
|
|
320
|
+
*
|
|
321
|
+
* Required permissions: read:account.
|
|
322
|
+
* API key: Supported.
|
|
323
|
+
* CLI user token: Supported.
|
|
324
|
+
* Session token: Not supported by session tokens, even with permissions.ellipsis enabled.
|
|
325
|
+
* Higher permission levels include lower levels: read < write < delete.
|
|
326
|
+
*/
|
|
327
|
+
async list(options = {}) {
|
|
328
|
+
const path = "/v1/account/api-requests";
|
|
329
|
+
const query = buildQuery({ start: options.start, end: options.end, operation: options.operation, status_code: options.status_code, credential_type: options.credential_type, credential_id: options.credential_id, limit: options.limit, cursor: options.cursor });
|
|
330
|
+
const response = await this.transport.request("GET", path, { query });
|
|
331
|
+
return new Page(
|
|
332
|
+
response,
|
|
333
|
+
"api_requests",
|
|
334
|
+
(cursor) => this.list({ ...options, cursor })
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
308
338
|
var EllipsisAccountBillingAutoRecharge = class {
|
|
309
339
|
constructor(transport) {
|
|
310
340
|
this.transport = transport;
|
|
@@ -328,28 +358,6 @@ var EllipsisAccountBillingAutoRecharge = class {
|
|
|
328
358
|
const path = "/v1/account/billing/auto-recharge";
|
|
329
359
|
return await this.transport.request("GET", path);
|
|
330
360
|
}
|
|
331
|
-
/**
|
|
332
|
-
* Update Auto Recharge
|
|
333
|
-
*
|
|
334
|
-
* Set your automatic credit recharge policy.
|
|
335
|
-
*
|
|
336
|
-
* Requires a human account administrator; API keys and session tokens
|
|
337
|
-
* cannot change this policy. Supply enabled explicitly. Saving amounts
|
|
338
|
-
* with enabled=false keeps recharge off; enabling requires a saved card.
|
|
339
|
-
* A recharge buys `amount` of credit and charges the platform fee in
|
|
340
|
-
* addition. Amounts and thresholds are millicents in whole cents.
|
|
341
|
-
*
|
|
342
|
-
* Required permissions: write:account.
|
|
343
|
-
* API key: Requires a CLI user token belonging to an account administrator.
|
|
344
|
-
* CLI user token: Requires an account administrator.
|
|
345
|
-
* Session token: Not supported by session tokens, even with permissions.ellipsis enabled.
|
|
346
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
347
|
-
*/
|
|
348
|
-
async set(options) {
|
|
349
|
-
const path = "/v1/account/billing/auto-recharge";
|
|
350
|
-
const body = buildBody({ amount: options.amount, enabled: options.enabled, threshold: options.threshold });
|
|
351
|
-
return await this.transport.request("PUT", path, { body });
|
|
352
|
-
}
|
|
353
361
|
};
|
|
354
362
|
var EllipsisAccountBilling = class {
|
|
355
363
|
constructor(transport) {
|
|
@@ -358,64 +366,6 @@ var EllipsisAccountBilling = class {
|
|
|
358
366
|
}
|
|
359
367
|
transport;
|
|
360
368
|
autoRecharge;
|
|
361
|
-
/**
|
|
362
|
-
* Create Card Setup Session
|
|
363
|
-
*
|
|
364
|
-
* Save a card through Stripe's hosted setup flow.
|
|
365
|
-
*
|
|
366
|
-
* Requires a human account administrator. Open the returned URL to
|
|
367
|
-
* finish setup and return to Billing. Saving a card does not enable
|
|
368
|
-
* auto-recharge or buy credit.
|
|
369
|
-
*
|
|
370
|
-
* Required permissions: write:account.
|
|
371
|
-
* API key: Requires a CLI user token belonging to an account administrator.
|
|
372
|
-
* CLI user token: Requires an account administrator.
|
|
373
|
-
* Session token: Not supported by session tokens, even with permissions.ellipsis enabled.
|
|
374
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
375
|
-
*/
|
|
376
|
-
async cardSetup() {
|
|
377
|
-
const path = "/v1/account/billing/card-setup";
|
|
378
|
-
return await this.transport.request("POST", path);
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Create Credit Checkout Session
|
|
382
|
-
*
|
|
383
|
-
* Buy prepaid credit through Stripe's hosted checkout.
|
|
384
|
-
*
|
|
385
|
-
* Requires a human account administrator. Open the returned URL to
|
|
386
|
-
* complete payment. Credit is granted only after payment succeeds;
|
|
387
|
-
* the platform fee is charged in addition to `amount`. Returning
|
|
388
|
-
* to Billing carries the checkout session ID for receipt lookup.
|
|
389
|
-
*
|
|
390
|
-
* Required permissions: write:account.
|
|
391
|
-
* API key: Requires a CLI user token belonging to an account administrator.
|
|
392
|
-
* CLI user token: Requires an account administrator.
|
|
393
|
-
* Session token: Not supported by session tokens, even with permissions.ellipsis enabled.
|
|
394
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
395
|
-
*/
|
|
396
|
-
async checkout(options) {
|
|
397
|
-
const path = "/v1/account/billing/checkout";
|
|
398
|
-
const body = buildBody({ amount: options.amount });
|
|
399
|
-
return await this.transport.request("POST", path, { body });
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* Claim Signup Credit
|
|
403
|
-
*
|
|
404
|
-
* The "Claim $100" button. Runs the same idempotent billing
|
|
405
|
-
* bootstrap that otherwise fires lazily at the first session (Stripe
|
|
406
|
-
* customer + usage subscription + the signup grant). A repeat call is
|
|
407
|
-
* a no-op that returns the current state.
|
|
408
|
-
*
|
|
409
|
-
* Required permissions: write:account.
|
|
410
|
-
* API key: Supported.
|
|
411
|
-
* CLI user token: Supported.
|
|
412
|
-
* Session token: Not supported by session tokens, even with permissions.ellipsis enabled.
|
|
413
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
414
|
-
*/
|
|
415
|
-
async claimSignupCredit() {
|
|
416
|
-
const path = "/v1/account/billing/claim-signup-credit";
|
|
417
|
-
return await this.transport.request("POST", path);
|
|
418
|
-
}
|
|
419
369
|
/**
|
|
420
370
|
* Get Fee Schedule
|
|
421
371
|
*
|
|
@@ -533,75 +483,6 @@ var EllipsisAccountModels = class {
|
|
|
533
483
|
return await this.transport.request("GET", path);
|
|
534
484
|
}
|
|
535
485
|
};
|
|
536
|
-
var EllipsisAccountNotifications = class {
|
|
537
|
-
constructor(transport) {
|
|
538
|
-
this.transport = transport;
|
|
539
|
-
}
|
|
540
|
-
transport;
|
|
541
|
-
/**
|
|
542
|
-
* Send Test Notification Email
|
|
543
|
-
*
|
|
544
|
-
* Send the alert email template to one address with sample data,
|
|
545
|
-
* so a typo'd finance alias is caught by a human instead of failing
|
|
546
|
-
* silently when a real alert fires.
|
|
547
|
-
*
|
|
548
|
-
* Required permissions: write:account.
|
|
549
|
-
* API key: Supported.
|
|
550
|
-
* CLI user token: Supported.
|
|
551
|
-
* Session token: Not supported by session tokens, even with permissions.ellipsis enabled.
|
|
552
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
553
|
-
*/
|
|
554
|
-
async testEmail(options) {
|
|
555
|
-
const path = "/v1/account/notifications/test-email";
|
|
556
|
-
const body = buildBody({ email: options.email });
|
|
557
|
-
return await this.transport.request("POST", path, { body });
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
var EllipsisAccountOnboarding = class {
|
|
561
|
-
constructor(transport) {
|
|
562
|
-
this.transport = transport;
|
|
563
|
-
}
|
|
564
|
-
transport;
|
|
565
|
-
/**
|
|
566
|
-
* Get Account Onboarding
|
|
567
|
-
*
|
|
568
|
-
* Read the account's saved onboarding answers, or null before setup.
|
|
569
|
-
*
|
|
570
|
-
* Required permissions: read:account.
|
|
571
|
-
* API key: Supported.
|
|
572
|
-
* CLI user token: Supported.
|
|
573
|
-
* Session token: Requires the ellipsis:api scope and the required grants in the token's permissions.ellipsis configuration.
|
|
574
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
575
|
-
*/
|
|
576
|
-
async get() {
|
|
577
|
-
const path = "/v1/account/onboarding";
|
|
578
|
-
return await this.transport.request("GET", path);
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* Update Account Onboarding
|
|
582
|
-
*
|
|
583
|
-
* Save supplied onboarding answers, preserving omitted answers.
|
|
584
|
-
*
|
|
585
|
-
* Organizations can save their work email before selecting use cases.
|
|
586
|
-
* Saving use cases requires a valid organization work email and at
|
|
587
|
-
* least one choice. When Other is the only choice, describe it.
|
|
588
|
-
* Personal accounts save a null work email. This does not change the
|
|
589
|
-
* billing contact email. Session tokens cannot update answers.
|
|
590
|
-
* Supplying an organization work email requires a human user and sends
|
|
591
|
-
* a Slack Connect invitation. Slack failures do not undo saved answers.
|
|
592
|
-
*
|
|
593
|
-
* Required permissions: write:account.
|
|
594
|
-
* API key: Supported.
|
|
595
|
-
* CLI user token: Supported.
|
|
596
|
-
* Session token: Not supported by session tokens, even with permissions.ellipsis enabled.
|
|
597
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
598
|
-
*/
|
|
599
|
-
async update(options = {}) {
|
|
600
|
-
const path = "/v1/account/onboarding";
|
|
601
|
-
const body = buildBody({ finished: options.finished, other_use_case: options.other_use_case, use_cases: options.use_cases, work_email: options.work_email });
|
|
602
|
-
return await this.transport.request("PATCH", path, { body });
|
|
603
|
-
}
|
|
604
|
-
};
|
|
605
486
|
var EllipsisAccountSettings = class {
|
|
606
487
|
constructor(transport) {
|
|
607
488
|
this.transport = transport;
|
|
@@ -670,18 +551,16 @@ var EllipsisAccount = class {
|
|
|
670
551
|
constructor(transport) {
|
|
671
552
|
this.transport = transport;
|
|
672
553
|
this.apiKeys = new EllipsisAccountApiKeys(transport);
|
|
554
|
+
this.apiRequests = new EllipsisAccountApiRequests(transport);
|
|
673
555
|
this.billing = new EllipsisAccountBilling(transport);
|
|
674
556
|
this.models = new EllipsisAccountModels(transport);
|
|
675
|
-
this.notifications = new EllipsisAccountNotifications(transport);
|
|
676
|
-
this.onboarding = new EllipsisAccountOnboarding(transport);
|
|
677
557
|
this.settings = new EllipsisAccountSettings(transport);
|
|
678
558
|
}
|
|
679
559
|
transport;
|
|
680
560
|
apiKeys;
|
|
561
|
+
apiRequests;
|
|
681
562
|
billing;
|
|
682
563
|
models;
|
|
683
|
-
notifications;
|
|
684
|
-
onboarding;
|
|
685
564
|
settings;
|
|
686
565
|
/**
|
|
687
566
|
* Get Customer Activity
|
|
@@ -897,13 +776,14 @@ var EllipsisAgents = class {
|
|
|
897
776
|
/**
|
|
898
777
|
* Get Agent Metrics
|
|
899
778
|
*
|
|
900
|
-
* Return an agent's session distribution
|
|
901
|
-
* by id or by name.
|
|
779
|
+
* Return an agent's session distribution, trailing spend, and
|
|
780
|
+
* usage over a window, by id or by name.
|
|
902
781
|
*
|
|
903
782
|
* `samples` carries one entry per finished session (duration, cost,
|
|
904
783
|
* tokens) for distributions; `spend_windows` carries what the
|
|
905
784
|
* agent's sessions cost over the last 1, 7, and 28 days against
|
|
906
|
-
* its budget for each window
|
|
785
|
+
* its budget for each window; `buckets` splits start to end by
|
|
786
|
+
* `interval`, chosen from the window's length.
|
|
907
787
|
*
|
|
908
788
|
* Required permissions: read:configs.
|
|
909
789
|
* API key: Supported.
|
|
@@ -912,9 +792,10 @@ var EllipsisAgents = class {
|
|
|
912
792
|
* Higher permission levels include lower levels: read < write < delete.
|
|
913
793
|
* Grant match patterns can further restrict access to individual resources.
|
|
914
794
|
*/
|
|
915
|
-
async metrics(id) {
|
|
795
|
+
async metrics(id, options) {
|
|
916
796
|
const path = `/v1/agents/${enc(id)}/metrics`;
|
|
917
|
-
|
|
797
|
+
const query = buildQuery({ start: options.start, end: options.end });
|
|
798
|
+
return await this.transport.request("GET", path, { query });
|
|
918
799
|
}
|
|
919
800
|
/**
|
|
920
801
|
* Start Agent Session
|
|
@@ -1068,80 +949,6 @@ var EllipsisAlerts = class {
|
|
|
1068
949
|
);
|
|
1069
950
|
}
|
|
1070
951
|
};
|
|
1071
|
-
var EllipsisAnalytics = class {
|
|
1072
|
-
constructor(transport) {
|
|
1073
|
-
this.transport = transport;
|
|
1074
|
-
}
|
|
1075
|
-
transport;
|
|
1076
|
-
/**
|
|
1077
|
-
* Get Analytics Metrics
|
|
1078
|
-
*
|
|
1079
|
-
* Return PR and review analytics metrics.
|
|
1080
|
-
*
|
|
1081
|
-
* The same data as the analytics dashboard.
|
|
1082
|
-
*
|
|
1083
|
-
* Windowing: pass explicit start/end, or days (default: the last
|
|
1084
|
-
* 30 days). `interval` names the width of each entry in `series`,
|
|
1085
|
-
* chosen from the window's length. account_type in all|user|bot
|
|
1086
|
-
* scopes the authors (bot = the apps/agents). Available to all
|
|
1087
|
-
* credential types: the responses expose the organization's own
|
|
1088
|
-
* GitHub PR/review activity, no secrets.
|
|
1089
|
-
*
|
|
1090
|
-
* Required permissions: read:account.
|
|
1091
|
-
* API key: Supported.
|
|
1092
|
-
* CLI user token: Supported.
|
|
1093
|
-
* Session token: Requires the ellipsis:api scope and the required grants in the token's permissions.ellipsis configuration.
|
|
1094
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
1095
|
-
*/
|
|
1096
|
-
async metrics(options = {}) {
|
|
1097
|
-
const path = "/v1/analytics/metrics";
|
|
1098
|
-
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 });
|
|
1099
|
-
return await this.transport.request("GET", path, { query });
|
|
1100
|
-
}
|
|
1101
|
-
/**
|
|
1102
|
-
* Get Analytics Pull Requests
|
|
1103
|
-
*
|
|
1104
|
-
* Return pull-request analytics.
|
|
1105
|
-
*
|
|
1106
|
-
* Windowing: pass explicit start/end, or days (default: the last
|
|
1107
|
-
* 30 days). `interval` names the width of each entry in `series`,
|
|
1108
|
-
* chosen from the window's length. account_type in all|user|bot
|
|
1109
|
-
* scopes the authors.
|
|
1110
|
-
*
|
|
1111
|
-
* Required permissions: read:account.
|
|
1112
|
-
* API key: Supported.
|
|
1113
|
-
* CLI user token: Supported.
|
|
1114
|
-
* Session token: Requires the ellipsis:api scope and the required grants in the token's permissions.ellipsis configuration.
|
|
1115
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
1116
|
-
*/
|
|
1117
|
-
async pullRequests(options = {}) {
|
|
1118
|
-
const path = "/v1/analytics/pull-requests";
|
|
1119
|
-
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 });
|
|
1120
|
-
return await this.transport.request("GET", path, { query });
|
|
1121
|
-
}
|
|
1122
|
-
/**
|
|
1123
|
-
* Get Analytics Reviews
|
|
1124
|
-
*
|
|
1125
|
-
* Return pull request review analytics.
|
|
1126
|
-
*
|
|
1127
|
-
* account_type scopes reviewers (bot|user|all) — e.g. "what apps
|
|
1128
|
-
* review the most PRs?" is the reviewer facets here with
|
|
1129
|
-
* account_type=bot. Windowing: pass explicit start/end, or days
|
|
1130
|
-
* (default: the last 30 days). `interval` names the width of each
|
|
1131
|
-
* entry in `series`, chosen from the window's length.
|
|
1132
|
-
*
|
|
1133
|
-
* Required permissions: read:account.
|
|
1134
|
-
* API key: Supported.
|
|
1135
|
-
* CLI user token: Supported.
|
|
1136
|
-
* Session token: Requires the ellipsis:api scope and the required grants in the token's permissions.ellipsis configuration.
|
|
1137
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
1138
|
-
*/
|
|
1139
|
-
async reviews(options = {}) {
|
|
1140
|
-
const path = "/v1/analytics/reviews";
|
|
1141
|
-
const query = buildQuery({ days: options.days, start: options.start, end: options.end, repo: options.repo, author: options.author, account_type: options.account_type, review_state: options.review_state });
|
|
1142
|
-
return await this.transport.request("GET", path, { query });
|
|
1143
|
-
}
|
|
1144
|
-
};
|
|
1145
952
|
var EllipsisAuthCli = class {
|
|
1146
953
|
constructor(transport) {
|
|
1147
954
|
this.transport = transport;
|
|
@@ -1317,8 +1124,8 @@ var EllipsisHandlers = class {
|
|
|
1317
1124
|
*
|
|
1318
1125
|
* Return session counts and accumulated spend for a saved handler.
|
|
1319
1126
|
*
|
|
1320
|
-
* Filters only by session creation time.
|
|
1321
|
-
*
|
|
1127
|
+
* Filters only by session creation time. `buckets` splits the window
|
|
1128
|
+
* by `interval`, chosen from the window's length. Counts use the current turn and conversation state, so an open
|
|
1322
1129
|
* conversation awaiting another message remains active. Spend includes the selected sessions' full
|
|
1323
1130
|
* accumulated cost, including activity after the creation-time window.
|
|
1324
1131
|
* Only sessions carrying this exact saved handler id are counted;
|
|
@@ -1339,7 +1146,7 @@ var EllipsisHandlers = class {
|
|
|
1339
1146
|
* Higher permission levels include lower levels: read < write < delete.
|
|
1340
1147
|
* Grant match patterns can further restrict access to individual resources.
|
|
1341
1148
|
*/
|
|
1342
|
-
async metrics(id, options
|
|
1149
|
+
async metrics(id, options) {
|
|
1343
1150
|
const path = `/v1/handlers/${enc(id)}/metrics`;
|
|
1344
1151
|
const query = buildQuery({ start: options.start, end: options.end });
|
|
1345
1152
|
return await this.transport.request("GET", path, { query });
|
|
@@ -1504,19 +1311,6 @@ var EllipsisIntegrationsSlack = class {
|
|
|
1504
1311
|
const path = "/v1/integrations/slack/channels";
|
|
1505
1312
|
return await this.transport.request("GET", path);
|
|
1506
1313
|
}
|
|
1507
|
-
/**
|
|
1508
|
-
* Create Operations Channel
|
|
1509
|
-
*
|
|
1510
|
-
* Required permissions: write:integrations.
|
|
1511
|
-
* API key: Supported.
|
|
1512
|
-
* CLI user token: Supported.
|
|
1513
|
-
* Session token: Not supported by session tokens, even with permissions.ellipsis enabled.
|
|
1514
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
1515
|
-
*/
|
|
1516
|
-
async createOperationsChannel() {
|
|
1517
|
-
const path = "/v1/integrations/slack/operations-channel";
|
|
1518
|
-
return await this.transport.request("POST", path);
|
|
1519
|
-
}
|
|
1520
1314
|
/**
|
|
1521
1315
|
* Delete Slack Integration
|
|
1522
1316
|
*
|
|
@@ -1714,58 +1508,11 @@ var EllipsisSecrets = class {
|
|
|
1714
1508
|
return await this.transport.request("PUT", path, { body });
|
|
1715
1509
|
}
|
|
1716
1510
|
};
|
|
1717
|
-
var EllipsisSessionsTurns = class {
|
|
1718
|
-
constructor(transport) {
|
|
1719
|
-
this.transport = transport;
|
|
1720
|
-
}
|
|
1721
|
-
transport;
|
|
1722
|
-
/**
|
|
1723
|
-
* Get Session Turn
|
|
1724
|
-
*
|
|
1725
|
-
* Return one turn.
|
|
1726
|
-
*
|
|
1727
|
-
* Poll this after sending a message: the message is answered when
|
|
1728
|
-
* the turn's status is completed, failed, stopped, or cancelled.
|
|
1729
|
-
*
|
|
1730
|
-
* Required permissions: read:sessions.
|
|
1731
|
-
* API key: Supported.
|
|
1732
|
-
* CLI user token: Supported.
|
|
1733
|
-
* Session token: Requires the ellipsis:api scope and the required grants in the token's permissions.ellipsis configuration.
|
|
1734
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
1735
|
-
* Grant match patterns can further restrict access to individual resources.
|
|
1736
|
-
*/
|
|
1737
|
-
async get(session_id, id) {
|
|
1738
|
-
const path = `/v1/sessions/${enc(session_id)}/turns/${enc(id)}`;
|
|
1739
|
-
return await this.transport.request("GET", path);
|
|
1740
|
-
}
|
|
1741
|
-
/**
|
|
1742
|
-
* Get Session Turns
|
|
1743
|
-
*
|
|
1744
|
-
* Return the session's turns and messages, oldest first.
|
|
1745
|
-
*
|
|
1746
|
-
* One turn per message: pending until the agent starts on it,
|
|
1747
|
-
* running while it works, then completed, failed, stopped, or
|
|
1748
|
-
* cancelled.
|
|
1749
|
-
*
|
|
1750
|
-
* Required permissions: read:sessions.
|
|
1751
|
-
* API key: Supported.
|
|
1752
|
-
* CLI user token: Supported.
|
|
1753
|
-
* Session token: Requires the ellipsis:api scope and the required grants in the token's permissions.ellipsis configuration.
|
|
1754
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
1755
|
-
* Grant match patterns can further restrict access to individual resources.
|
|
1756
|
-
*/
|
|
1757
|
-
async list(id) {
|
|
1758
|
-
const path = `/v1/sessions/${enc(id)}/turns`;
|
|
1759
|
-
return await this.transport.request("GET", path);
|
|
1760
|
-
}
|
|
1761
|
-
};
|
|
1762
1511
|
var EllipsisSessions = class {
|
|
1763
1512
|
constructor(transport) {
|
|
1764
1513
|
this.transport = transport;
|
|
1765
|
-
this.turns = new EllipsisSessionsTurns(transport);
|
|
1766
1514
|
}
|
|
1767
1515
|
transport;
|
|
1768
|
-
turns;
|
|
1769
1516
|
/**
|
|
1770
1517
|
* Get Session Analytics
|
|
1771
1518
|
*
|
|
@@ -1879,37 +1626,13 @@ var EllipsisSessions = class {
|
|
|
1879
1626
|
const path = `/v1/sessions/${enc(id)}/git`;
|
|
1880
1627
|
return await this.transport.request("GET", path);
|
|
1881
1628
|
}
|
|
1882
|
-
/**
|
|
1883
|
-
* Ingest Session Transcript
|
|
1884
|
-
*
|
|
1885
|
-
* Append transcript lines to a session's record.
|
|
1886
|
-
*
|
|
1887
|
-
* The transcript tailer running inside the session's environment, for
|
|
1888
|
-
* interactive sessions.
|
|
1889
|
-
*
|
|
1890
|
-
* A session token may only push its own session's transcript.
|
|
1891
|
-
* Idempotent by transcript line uuid; tolerant of malformed lines.
|
|
1892
|
-
*
|
|
1893
|
-
* Required permissions: write:sessions.
|
|
1894
|
-
* API key: Supported.
|
|
1895
|
-
* CLI user token: Supported.
|
|
1896
|
-
* Session token: Requires the ellipsis:api scope and the required grants in the token's permissions.ellipsis configuration. Only the token's own session.
|
|
1897
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
1898
|
-
* Grant match patterns can further restrict access to individual resources.
|
|
1899
|
-
*/
|
|
1900
|
-
async ingestTranscript(id, options) {
|
|
1901
|
-
const path = `/v1/sessions/${enc(id)}/transcript`;
|
|
1902
|
-
const body = buildBody({ lines: options.lines, offset: options.offset });
|
|
1903
|
-
return await this.transport.request("POST", path, { body });
|
|
1904
|
-
}
|
|
1905
1629
|
/**
|
|
1906
1630
|
* List Sessions
|
|
1907
1631
|
*
|
|
1908
1632
|
* List cloud agent sessions, newest first.
|
|
1909
1633
|
*
|
|
1910
1634
|
* Optionally filtered by agent (id or name), source, service, handler, time
|
|
1911
|
-
* window, attributed author, repository, and
|
|
1912
|
-
* still going.
|
|
1635
|
+
* window, attributed author, repository, and status.
|
|
1913
1636
|
*
|
|
1914
1637
|
* Required permissions: read:sessions.
|
|
1915
1638
|
* API key: Supported.
|
|
@@ -1920,7 +1643,7 @@ var EllipsisSessions = class {
|
|
|
1920
1643
|
*/
|
|
1921
1644
|
async list(options = {}) {
|
|
1922
1645
|
const path = "/v1/sessions";
|
|
1923
|
-
const query = buildQuery({ agent: options.agent, source: options.source, service: options.service, handler: options.handler, days: options.days, start: options.start, end: options.end, limit: options.limit, cursor: options.cursor, author_id: options.author_id, repo: options.repo,
|
|
1646
|
+
const query = buildQuery({ agent: options.agent, source: options.source, service: options.service, handler: options.handler, days: options.days, start: options.start, end: options.end, limit: options.limit, cursor: options.cursor, author_id: options.author_id, repo: options.repo, status: options.status });
|
|
1924
1647
|
const response = await this.transport.request("GET", path, { query });
|
|
1925
1648
|
return new Page(
|
|
1926
1649
|
response,
|
|
@@ -1967,7 +1690,7 @@ var EllipsisSessions = class {
|
|
|
1967
1690
|
*/
|
|
1968
1691
|
async records(id, options = {}) {
|
|
1969
1692
|
const path = `/v1/sessions/${enc(id)}/records`;
|
|
1970
|
-
const query = buildQuery({ cursor: options.cursor, limit: options.limit });
|
|
1693
|
+
const query = buildQuery({ cursor: options.cursor, limit: options.limit, message_id: options.message_id });
|
|
1971
1694
|
const response = await this.transport.request("GET", path, { query });
|
|
1972
1695
|
return new Page(
|
|
1973
1696
|
response,
|
|
@@ -1975,29 +1698,15 @@ var EllipsisSessions = class {
|
|
|
1975
1698
|
(cursor) => this.records(id, { ...options, cursor })
|
|
1976
1699
|
);
|
|
1977
1700
|
}
|
|
1978
|
-
/**
|
|
1979
|
-
* Search Sessions
|
|
1980
|
-
*
|
|
1981
|
-
* Required permissions: read:sessions.
|
|
1982
|
-
* API key: Supported.
|
|
1983
|
-
* CLI user token: Supported.
|
|
1984
|
-
* Session token: Requires the ellipsis:api scope and the required grants in the token's permissions.ellipsis configuration.
|
|
1985
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
1986
|
-
* Grant match patterns can further restrict access to individual resources.
|
|
1987
|
-
*/
|
|
1988
|
-
async search(options = {}) {
|
|
1989
|
-
const path = "/v1/sessions/search";
|
|
1990
|
-
const query = buildQuery({ q: options.q, scope: options.scope, source: options.source, service: options.service, handler: options.handler, author_id: options.author_id, agent_id: options.agent_id, session_ids: options.session_ids, repo: options.repo, status: options.status, start: options.start, end: options.end, limit: options.limit });
|
|
1991
|
-
return await this.transport.request("GET", path, { query });
|
|
1992
|
-
}
|
|
1993
1701
|
/**
|
|
1994
1702
|
* Send Session Message
|
|
1995
1703
|
*
|
|
1996
1704
|
* Send a message to a session.
|
|
1997
1705
|
*
|
|
1998
|
-
* 409 for mention, non-interactive, closed, and
|
|
1999
|
-
* sessions. Returns the created message
|
|
2000
|
-
*
|
|
1706
|
+
* 409 for mention, non-interactive, closed, archived, and
|
|
1707
|
+
* out-of-budget sessions. Returns the created message; a retried send with the
|
|
1708
|
+
* same idempotency_key returns the original one. The message is
|
|
1709
|
+
* answered once the session's status is `idle` or `closed`.
|
|
2001
1710
|
*
|
|
2002
1711
|
* Required permissions: write:sessions.
|
|
2003
1712
|
* API key: Supported.
|
|
@@ -2058,11 +1767,11 @@ var EllipsisSessions = class {
|
|
|
2058
1767
|
/**
|
|
2059
1768
|
* Stop Session
|
|
2060
1769
|
*
|
|
2061
|
-
* Stop the
|
|
1770
|
+
* Stop the session's work and return it.
|
|
2062
1771
|
*
|
|
2063
|
-
* The
|
|
2064
|
-
*
|
|
2065
|
-
* when the
|
|
1772
|
+
* The running message ends `stopped` and every queued message is
|
|
1773
|
+
* cancelled, so the session goes `idle` (or `closed` when it was
|
|
1774
|
+
* not interactive). 409 when the session is idle or closed already.
|
|
2066
1775
|
*
|
|
2067
1776
|
* Required permissions: write:sessions.
|
|
2068
1777
|
* API key: Supported.
|
|
@@ -2097,8 +1806,18 @@ var EllipsisSessions = class {
|
|
|
2097
1806
|
* Set archived to true to record the current server time and the
|
|
2098
1807
|
* authenticated GitHub user. API-key requests record no user.
|
|
2099
1808
|
* Repeated archive requests preserve the original time and user.
|
|
2100
|
-
*
|
|
2101
|
-
*
|
|
1809
|
+
* Archiving stops the message in progress. An archived session takes
|
|
1810
|
+
* no messages (409 `session_archived`), and a reply on the Slack
|
|
1811
|
+
* thread, pull request, issue, or Linear issue it answers starts a
|
|
1812
|
+
* new session. A session is also archived when it closes and after
|
|
1813
|
+
* the account's `archive_inactive_sessions_days` without a message.
|
|
1814
|
+
* When the account sets session log retention, the session's
|
|
1815
|
+
* records, messages, and prompt are deleted that many days after it
|
|
1816
|
+
* was archived (`archived.deletes_at`). The session itself stays.
|
|
1817
|
+
*
|
|
1818
|
+
* Set archived to false to clear both fields and let the session
|
|
1819
|
+
* take messages again. 409 `session_superseded` when a newer session
|
|
1820
|
+
* now answers the same thread.
|
|
2102
1821
|
*
|
|
2103
1822
|
* Changes are delivered to session and session-list streams.
|
|
2104
1823
|
*
|
|
@@ -2126,61 +1845,6 @@ var EllipsisSessions = class {
|
|
|
2126
1845
|
return new SessionHandle(this, response.session);
|
|
2127
1846
|
}
|
|
2128
1847
|
};
|
|
2129
|
-
var EllipsisSupportSlack = class {
|
|
2130
|
-
constructor(transport) {
|
|
2131
|
-
this.transport = transport;
|
|
2132
|
-
}
|
|
2133
|
-
transport;
|
|
2134
|
-
/**
|
|
2135
|
-
* Request Slack Help
|
|
2136
|
-
*
|
|
2137
|
-
* Required permissions: write:account.
|
|
2138
|
-
* API key: Requires a CLI user token.
|
|
2139
|
-
* CLI user token: Supported.
|
|
2140
|
-
* Session token: Not supported by session tokens, even with permissions.ellipsis enabled.
|
|
2141
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
2142
|
-
*/
|
|
2143
|
-
async create(options) {
|
|
2144
|
-
const path = "/v1/support/slack";
|
|
2145
|
-
const body = buildBody({ emails: options.emails, resend: options.resend });
|
|
2146
|
-
return await this.transport.request("POST", path, { body });
|
|
2147
|
-
}
|
|
2148
|
-
/**
|
|
2149
|
-
* Get Slack Help
|
|
2150
|
-
*
|
|
2151
|
-
* Required permissions: read:account.
|
|
2152
|
-
* API key: Supported.
|
|
2153
|
-
* CLI user token: Supported.
|
|
2154
|
-
* Session token: Requires the ellipsis:api scope and the required grants in the token's permissions.ellipsis configuration.
|
|
2155
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
2156
|
-
*/
|
|
2157
|
-
async get() {
|
|
2158
|
-
const path = "/v1/support/slack";
|
|
2159
|
-
await this.transport.request("GET", path);
|
|
2160
|
-
}
|
|
2161
|
-
/**
|
|
2162
|
-
* Invite To Slack Help
|
|
2163
|
-
*
|
|
2164
|
-
* Required permissions: write:account.
|
|
2165
|
-
* API key: Requires a CLI user token.
|
|
2166
|
-
* CLI user token: Supported.
|
|
2167
|
-
* Session token: Not supported by session tokens, even with permissions.ellipsis enabled.
|
|
2168
|
-
* Higher permission levels include lower levels: read < write < delete.
|
|
2169
|
-
*/
|
|
2170
|
-
async invite(options) {
|
|
2171
|
-
const path = "/v1/support/slack/invites";
|
|
2172
|
-
const body = buildBody({ emails: options.emails, resend: options.resend });
|
|
2173
|
-
return await this.transport.request("POST", path, { body });
|
|
2174
|
-
}
|
|
2175
|
-
};
|
|
2176
|
-
var EllipsisSupport = class {
|
|
2177
|
-
constructor(transport) {
|
|
2178
|
-
this.transport = transport;
|
|
2179
|
-
this.slack = new EllipsisSupportSlack(transport);
|
|
2180
|
-
}
|
|
2181
|
-
transport;
|
|
2182
|
-
slack;
|
|
2183
|
-
};
|
|
2184
1848
|
var EllipsisUserTokens = class {
|
|
2185
1849
|
constructor(transport) {
|
|
2186
1850
|
this.transport = transport;
|
|
@@ -2532,7 +2196,6 @@ var Ellipsis = class {
|
|
|
2532
2196
|
account;
|
|
2533
2197
|
agents;
|
|
2534
2198
|
alerts;
|
|
2535
|
-
analytics;
|
|
2536
2199
|
auth;
|
|
2537
2200
|
environments;
|
|
2538
2201
|
handlers;
|
|
@@ -2540,7 +2203,6 @@ var Ellipsis = class {
|
|
|
2540
2203
|
reviews;
|
|
2541
2204
|
secrets;
|
|
2542
2205
|
sessions;
|
|
2543
|
-
support;
|
|
2544
2206
|
user;
|
|
2545
2207
|
vmExecutions;
|
|
2546
2208
|
vmImages;
|
|
@@ -2551,7 +2213,6 @@ var Ellipsis = class {
|
|
|
2551
2213
|
this.account = new EllipsisAccount(this.transport);
|
|
2552
2214
|
this.agents = new EllipsisAgents(this.transport);
|
|
2553
2215
|
this.alerts = new EllipsisAlerts(this.transport);
|
|
2554
|
-
this.analytics = new EllipsisAnalytics(this.transport);
|
|
2555
2216
|
this.auth = new EllipsisAuth(this.transport);
|
|
2556
2217
|
this.environments = new EllipsisEnvironments(this.transport);
|
|
2557
2218
|
this.handlers = new EllipsisHandlers(this.transport);
|
|
@@ -2559,7 +2220,6 @@ var Ellipsis = class {
|
|
|
2559
2220
|
this.reviews = new EllipsisReviews(this.transport);
|
|
2560
2221
|
this.secrets = new EllipsisSecrets(this.transport);
|
|
2561
2222
|
this.sessions = new EllipsisSessions(this.transport);
|
|
2562
|
-
this.support = new EllipsisSupport(this.transport);
|
|
2563
2223
|
this.user = new EllipsisUser(this.transport);
|
|
2564
2224
|
this.vmExecutions = new EllipsisVmExecutions(this.transport);
|
|
2565
2225
|
this.vmImages = new EllipsisVmImages(this.transport);
|
|
@@ -2600,5 +2260,5 @@ export {
|
|
|
2600
2260
|
Transport,
|
|
2601
2261
|
TransportError,
|
|
2602
2262
|
UnprocessableError,
|
|
2603
|
-
|
|
2263
|
+
isSessionSettled
|
|
2604
2264
|
};
|