@frumu/tandem-client 0.3.28 → 0.4.3
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/README.md +23 -0
- package/dist/client.d.ts +421 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +881 -14
- package/dist/index.js +881 -14
- package/dist/normalize/index.d.ts +10 -2
- package/dist/normalize/index.d.ts.map +1 -1
- package/dist/public/index.d.ts +614 -2
- package/dist/public/index.d.ts.map +1 -1
- package/dist/wire/index.d.ts +419 -2
- package/dist/wire/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34,8 +34,15 @@ var jsonFallback = z.any().transform((val) => val);
|
|
|
34
34
|
var jsonObjectFallback = z.record(z.string(), z.any()).transform((val) => val);
|
|
35
35
|
var SystemHealthSchema = z.object({
|
|
36
36
|
ready: z.boolean().optional(),
|
|
37
|
-
phase: z.string().optional()
|
|
38
|
-
|
|
37
|
+
phase: z.string().optional(),
|
|
38
|
+
workspace_root: z.string().optional(),
|
|
39
|
+
workspaceRoot: z.string().optional()
|
|
40
|
+
}).passthrough().transform(
|
|
41
|
+
(val) => ({
|
|
42
|
+
...val,
|
|
43
|
+
workspaceRoot: val.workspace_root ?? val.workspaceRoot
|
|
44
|
+
})
|
|
45
|
+
);
|
|
39
46
|
var SessionRecordSchema = z.object({
|
|
40
47
|
id: z.string(),
|
|
41
48
|
title: z.string(),
|
|
@@ -339,13 +346,21 @@ var TandemClient = class {
|
|
|
339
346
|
this.providers = new Providers(req);
|
|
340
347
|
this.identity = new Identity(req);
|
|
341
348
|
this.channels = new Channels(req);
|
|
342
|
-
this.mcp = new Mcp(req);
|
|
343
|
-
|
|
344
|
-
this.
|
|
345
|
-
this.
|
|
349
|
+
this.mcp = new Mcp(req, this._requestText.bind(this));
|
|
350
|
+
const getToken = () => this.token;
|
|
351
|
+
this.routines = new Routines(this.baseUrl, getToken, req);
|
|
352
|
+
this.automations = new Automations(this.baseUrl, getToken, req);
|
|
353
|
+
this.automationsV2 = new AutomationsV2(this.baseUrl, getToken, req);
|
|
354
|
+
this.workflowPlans = new WorkflowPlans(req);
|
|
346
355
|
this.memory = new Memory(req);
|
|
347
356
|
this.skills = new Skills(req);
|
|
348
|
-
this.
|
|
357
|
+
this.packs = new Packs(req);
|
|
358
|
+
this.capabilities = new Capabilities(req);
|
|
359
|
+
this.resources = new Resources(this.baseUrl, getToken, req);
|
|
360
|
+
this.browser = new Browser(req);
|
|
361
|
+
this.workflows = new Workflows(this.baseUrl, getToken, req);
|
|
362
|
+
this.bugMonitor = new BugMonitor(req);
|
|
363
|
+
this.coder = new Coder(req);
|
|
349
364
|
this.agentTeams = new AgentTeams(req);
|
|
350
365
|
this.missions = new Missions(req);
|
|
351
366
|
}
|
|
@@ -460,6 +475,239 @@ var TandemClient = class {
|
|
|
460
475
|
}
|
|
461
476
|
return res.json();
|
|
462
477
|
}
|
|
478
|
+
async _requestText(path, init = {}) {
|
|
479
|
+
const controller = new AbortController();
|
|
480
|
+
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
481
|
+
let res;
|
|
482
|
+
try {
|
|
483
|
+
res = await fetch(`${this.baseUrl}${path}`, {
|
|
484
|
+
...init,
|
|
485
|
+
headers: {
|
|
486
|
+
Authorization: `Bearer ${this.token}`,
|
|
487
|
+
...init.headers ?? {}
|
|
488
|
+
},
|
|
489
|
+
signal: controller.signal
|
|
490
|
+
});
|
|
491
|
+
} catch (err) {
|
|
492
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
493
|
+
throw new Error(`Request timed out after ${this.timeoutMs}ms: ${path}`);
|
|
494
|
+
}
|
|
495
|
+
throw err;
|
|
496
|
+
} finally {
|
|
497
|
+
clearTimeout(timer);
|
|
498
|
+
}
|
|
499
|
+
if (!res.ok) {
|
|
500
|
+
const body = await res.text().catch(() => "");
|
|
501
|
+
throw new Error(`Request failed (${res.status} ${res.statusText}): ${body}`);
|
|
502
|
+
}
|
|
503
|
+
return res.text();
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
var Browser = class {
|
|
507
|
+
constructor(req) {
|
|
508
|
+
this.req = req;
|
|
509
|
+
}
|
|
510
|
+
async status() {
|
|
511
|
+
return this.req("/browser/status");
|
|
512
|
+
}
|
|
513
|
+
async install() {
|
|
514
|
+
return this.req("/browser/install", { method: "POST" });
|
|
515
|
+
}
|
|
516
|
+
async smokeTest(options) {
|
|
517
|
+
return this.req("/browser/smoke-test", {
|
|
518
|
+
method: "POST",
|
|
519
|
+
body: JSON.stringify(options ?? {})
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
var Workflows = class {
|
|
524
|
+
constructor(baseUrl, getToken, req) {
|
|
525
|
+
this.baseUrl = baseUrl;
|
|
526
|
+
this.getToken = getToken;
|
|
527
|
+
this.req = req;
|
|
528
|
+
}
|
|
529
|
+
async list() {
|
|
530
|
+
const raw = await this.req("/workflows");
|
|
531
|
+
const asObj = raw ?? {};
|
|
532
|
+
const workflows = Array.isArray(asObj.workflows) ? asObj.workflows : [];
|
|
533
|
+
return { workflows, count: typeof asObj.count === "number" ? asObj.count : workflows.length };
|
|
534
|
+
}
|
|
535
|
+
async get(id) {
|
|
536
|
+
const raw = await this.req(
|
|
537
|
+
`/workflows/${encodeURIComponent(id)}`
|
|
538
|
+
);
|
|
539
|
+
return raw.workflow ?? {};
|
|
540
|
+
}
|
|
541
|
+
async validate(payload) {
|
|
542
|
+
return this.req("/workflows/validate", {
|
|
543
|
+
method: "POST",
|
|
544
|
+
body: JSON.stringify(payload ?? {})
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
async simulate(payload) {
|
|
548
|
+
return this.req("/workflows/simulate", {
|
|
549
|
+
method: "POST",
|
|
550
|
+
body: JSON.stringify(payload)
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
events(options) {
|
|
554
|
+
const params = new URLSearchParams();
|
|
555
|
+
const workflowId = options?.workflow_id ?? options?.workflowId;
|
|
556
|
+
const runId = options?.run_id ?? options?.runId;
|
|
557
|
+
if (workflowId) params.set("workflow_id", workflowId);
|
|
558
|
+
if (runId) params.set("run_id", runId);
|
|
559
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
560
|
+
return streamSse(`${this.baseUrl}/workflows/events${qs}`, this.getToken(), {
|
|
561
|
+
signal: options?.signal
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
async listRuns(options) {
|
|
565
|
+
const params = new URLSearchParams();
|
|
566
|
+
const workflowId = options?.workflow_id ?? options?.workflowId;
|
|
567
|
+
if (workflowId) params.set("workflow_id", workflowId);
|
|
568
|
+
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
569
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
570
|
+
const raw = await this.req(`/workflows/runs${qs}`);
|
|
571
|
+
const asObj = raw ?? {};
|
|
572
|
+
const runs = Array.isArray(asObj.runs) ? asObj.runs : [];
|
|
573
|
+
return { runs, count: typeof asObj.count === "number" ? asObj.count : runs.length };
|
|
574
|
+
}
|
|
575
|
+
async getRun(id) {
|
|
576
|
+
const raw = await this.req(
|
|
577
|
+
`/workflows/runs/${encodeURIComponent(id)}`
|
|
578
|
+
);
|
|
579
|
+
return raw.run ?? {};
|
|
580
|
+
}
|
|
581
|
+
async run(id, payload) {
|
|
582
|
+
return this.req(`/workflows/${encodeURIComponent(id)}/run`, {
|
|
583
|
+
method: "POST",
|
|
584
|
+
body: JSON.stringify(payload ?? {})
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
async listHooks(options) {
|
|
588
|
+
const params = new URLSearchParams();
|
|
589
|
+
const workflowId = options?.workflow_id ?? options?.workflowId;
|
|
590
|
+
if (workflowId) params.set("workflow_id", workflowId);
|
|
591
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
592
|
+
const raw = await this.req(`/workflow-hooks${qs}`);
|
|
593
|
+
const asObj = raw ?? {};
|
|
594
|
+
const hooks = Array.isArray(asObj.hooks) ? asObj.hooks : [];
|
|
595
|
+
return { hooks, count: typeof asObj.count === "number" ? asObj.count : hooks.length };
|
|
596
|
+
}
|
|
597
|
+
async patchHook(id, patch) {
|
|
598
|
+
return this.req(`/workflow-hooks/${encodeURIComponent(id)}`, {
|
|
599
|
+
method: "PATCH",
|
|
600
|
+
body: JSON.stringify(patch)
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
var BugMonitor = class {
|
|
605
|
+
constructor(req) {
|
|
606
|
+
this.req = req;
|
|
607
|
+
}
|
|
608
|
+
async getConfig() {
|
|
609
|
+
return this.req("/config/bug-monitor");
|
|
610
|
+
}
|
|
611
|
+
async patchConfig(config) {
|
|
612
|
+
return this.req("/config/bug-monitor", {
|
|
613
|
+
method: "PATCH",
|
|
614
|
+
body: JSON.stringify(config)
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
async getStatus() {
|
|
618
|
+
return this.req("/bug-monitor/status");
|
|
619
|
+
}
|
|
620
|
+
async recomputeStatus() {
|
|
621
|
+
return this.req("/bug-monitor/status/recompute", {
|
|
622
|
+
method: "POST"
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
async pause() {
|
|
626
|
+
return this.req("/bug-monitor/pause", { method: "POST" });
|
|
627
|
+
}
|
|
628
|
+
async resume() {
|
|
629
|
+
return this.req("/bug-monitor/resume", { method: "POST" });
|
|
630
|
+
}
|
|
631
|
+
async debug() {
|
|
632
|
+
return this.req("/bug-monitor/debug");
|
|
633
|
+
}
|
|
634
|
+
async listIncidents(options) {
|
|
635
|
+
const qs = options?.limit !== void 0 ? `?limit=${options.limit}` : "";
|
|
636
|
+
return this.req(`/bug-monitor/incidents${qs}`);
|
|
637
|
+
}
|
|
638
|
+
async getIncident(id) {
|
|
639
|
+
const raw = await this.req(
|
|
640
|
+
`/bug-monitor/incidents/${encodeURIComponent(id)}`
|
|
641
|
+
);
|
|
642
|
+
return raw.incident ?? {};
|
|
643
|
+
}
|
|
644
|
+
async replayIncident(id, payload) {
|
|
645
|
+
return this.req(`/bug-monitor/incidents/${encodeURIComponent(id)}/replay`, {
|
|
646
|
+
method: "POST",
|
|
647
|
+
body: JSON.stringify(payload ?? {})
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
async listDrafts(options) {
|
|
651
|
+
const qs = options?.limit !== void 0 ? `?limit=${options.limit}` : "";
|
|
652
|
+
return this.req(`/bug-monitor/drafts${qs}`);
|
|
653
|
+
}
|
|
654
|
+
async listPosts(options) {
|
|
655
|
+
const qs = options?.limit !== void 0 ? `?limit=${options.limit}` : "";
|
|
656
|
+
return this.req(`/bug-monitor/posts${qs}`);
|
|
657
|
+
}
|
|
658
|
+
async getDraft(id) {
|
|
659
|
+
const raw = await this.req(
|
|
660
|
+
`/bug-monitor/drafts/${encodeURIComponent(id)}`
|
|
661
|
+
);
|
|
662
|
+
return raw.draft ?? {};
|
|
663
|
+
}
|
|
664
|
+
async approveDraft(id, reason) {
|
|
665
|
+
return this.req(`/bug-monitor/drafts/${encodeURIComponent(id)}/approve`, {
|
|
666
|
+
method: "POST",
|
|
667
|
+
body: JSON.stringify({ reason })
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
async denyDraft(id, reason) {
|
|
671
|
+
return this.req(`/bug-monitor/drafts/${encodeURIComponent(id)}/deny`, {
|
|
672
|
+
method: "POST",
|
|
673
|
+
body: JSON.stringify({ reason })
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
async report(payload) {
|
|
677
|
+
return this.req("/bug-monitor/report", {
|
|
678
|
+
method: "POST",
|
|
679
|
+
body: JSON.stringify(payload)
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
async createTriageRun(id) {
|
|
683
|
+
return this.req(`/bug-monitor/drafts/${encodeURIComponent(id)}/triage-run`, {
|
|
684
|
+
method: "POST"
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
async createTriageSummary(id, payload) {
|
|
688
|
+
return this.req(`/bug-monitor/drafts/${encodeURIComponent(id)}/triage-summary`, {
|
|
689
|
+
method: "POST",
|
|
690
|
+
body: JSON.stringify(payload)
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
async createIssueDraft(id, payload) {
|
|
694
|
+
return this.req(`/bug-monitor/drafts/${encodeURIComponent(id)}/issue-draft`, {
|
|
695
|
+
method: "POST",
|
|
696
|
+
body: JSON.stringify(payload ?? {})
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
async publishDraft(id, payload) {
|
|
700
|
+
return this.req(`/bug-monitor/drafts/${encodeURIComponent(id)}/publish`, {
|
|
701
|
+
method: "POST",
|
|
702
|
+
body: JSON.stringify(payload ?? {})
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
async recheckMatch(id, payload) {
|
|
706
|
+
return this.req(`/bug-monitor/drafts/${encodeURIComponent(id)}/recheck-match`, {
|
|
707
|
+
method: "POST",
|
|
708
|
+
body: JSON.stringify(payload ?? {})
|
|
709
|
+
});
|
|
710
|
+
}
|
|
463
711
|
};
|
|
464
712
|
var Sessions = class {
|
|
465
713
|
constructor(baseUrl, token, timeoutMs, req) {
|
|
@@ -823,8 +1071,9 @@ var Channels = class {
|
|
|
823
1071
|
}
|
|
824
1072
|
};
|
|
825
1073
|
var Mcp = class {
|
|
826
|
-
constructor(req) {
|
|
1074
|
+
constructor(req, reqText) {
|
|
827
1075
|
this.req = req;
|
|
1076
|
+
this.reqText = reqText;
|
|
828
1077
|
}
|
|
829
1078
|
/** List registered MCP servers. */
|
|
830
1079
|
async list() {
|
|
@@ -879,6 +1128,38 @@ var Mcp = class {
|
|
|
879
1128
|
body: JSON.stringify({ enabled })
|
|
880
1129
|
});
|
|
881
1130
|
}
|
|
1131
|
+
async delete(name) {
|
|
1132
|
+
return this.req(`/mcp/${encodeURIComponent(name)}`, {
|
|
1133
|
+
method: "DELETE"
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
async auth(name, payload) {
|
|
1137
|
+
return this.req(`/mcp/${encodeURIComponent(name)}/auth`, {
|
|
1138
|
+
method: "POST",
|
|
1139
|
+
body: JSON.stringify(payload ?? {})
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
async deleteAuth(name) {
|
|
1143
|
+
return this.req(`/mcp/${encodeURIComponent(name)}/auth`, {
|
|
1144
|
+
method: "DELETE"
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
async authCallback(name, payload) {
|
|
1148
|
+
return this.req(`/mcp/${encodeURIComponent(name)}/auth/callback`, {
|
|
1149
|
+
method: "POST",
|
|
1150
|
+
body: JSON.stringify(payload)
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
async authenticate(name, payload) {
|
|
1154
|
+
return this.req(`/mcp/${encodeURIComponent(name)}/auth/authenticate`, {
|
|
1155
|
+
method: "POST",
|
|
1156
|
+
body: JSON.stringify(payload ?? {})
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
async catalogToml(slug) {
|
|
1160
|
+
if (!this.reqText) throw new Error("Text request helper unavailable");
|
|
1161
|
+
return this.reqText(`/mcp/catalog/${encodeURIComponent(slug)}/toml`);
|
|
1162
|
+
}
|
|
882
1163
|
};
|
|
883
1164
|
var Memory = class {
|
|
884
1165
|
constructor(req) {
|
|
@@ -982,16 +1263,30 @@ var Skills = class {
|
|
|
982
1263
|
}
|
|
983
1264
|
/** Import a skill from YAML content or a file path. */
|
|
984
1265
|
async import(options) {
|
|
1266
|
+
const payload = {
|
|
1267
|
+
content: options.content,
|
|
1268
|
+
file_or_path: options.file_or_path ?? options.fileOrPath,
|
|
1269
|
+
location: options.location,
|
|
1270
|
+
namespace: options.namespace,
|
|
1271
|
+
conflict_policy: options.conflict_policy ?? options.conflictPolicy
|
|
1272
|
+
};
|
|
985
1273
|
return this.req("/skills/import", {
|
|
986
1274
|
method: "POST",
|
|
987
|
-
body: JSON.stringify(
|
|
1275
|
+
body: JSON.stringify(payload)
|
|
988
1276
|
});
|
|
989
1277
|
}
|
|
990
1278
|
/** Preview a skill import (dry run). */
|
|
991
1279
|
async preview(options) {
|
|
1280
|
+
const payload = {
|
|
1281
|
+
content: options.content,
|
|
1282
|
+
file_or_path: options.file_or_path ?? options.fileOrPath,
|
|
1283
|
+
location: options.location,
|
|
1284
|
+
namespace: options.namespace,
|
|
1285
|
+
conflict_policy: options.conflict_policy ?? options.conflictPolicy
|
|
1286
|
+
};
|
|
992
1287
|
return this.req("/skills/import/preview", {
|
|
993
1288
|
method: "POST",
|
|
994
|
-
body: JSON.stringify(
|
|
1289
|
+
body: JSON.stringify(payload)
|
|
995
1290
|
});
|
|
996
1291
|
}
|
|
997
1292
|
/** List available skill templates shipped with the engine. */
|
|
@@ -1000,11 +1295,220 @@ var Skills = class {
|
|
|
1000
1295
|
if (Array.isArray(raw)) return { templates: raw, count: raw.length };
|
|
1001
1296
|
return raw;
|
|
1002
1297
|
}
|
|
1298
|
+
/** List enriched skill catalog records. */
|
|
1299
|
+
async catalog() {
|
|
1300
|
+
const raw = await this.req("/skills/catalog");
|
|
1301
|
+
const rows = Array.isArray(raw) ? raw : [];
|
|
1302
|
+
return { skills: rows, count: rows.length };
|
|
1303
|
+
}
|
|
1304
|
+
/** Validate SKILL.md content or a local path/zip. */
|
|
1305
|
+
async validate(options) {
|
|
1306
|
+
const payload = {
|
|
1307
|
+
content: options.content,
|
|
1308
|
+
file_or_path: options.file_or_path ?? options.fileOrPath
|
|
1309
|
+
};
|
|
1310
|
+
return this.req("/skills/validate", {
|
|
1311
|
+
method: "POST",
|
|
1312
|
+
body: JSON.stringify(payload)
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
/** Match a user goal to the best skill candidate. */
|
|
1316
|
+
async match(options) {
|
|
1317
|
+
const payload = {
|
|
1318
|
+
goal: options.goal,
|
|
1319
|
+
max_matches: options.max_matches ?? options.maxMatches,
|
|
1320
|
+
threshold: options.threshold
|
|
1321
|
+
};
|
|
1322
|
+
return this.req("/skills/router/match", {
|
|
1323
|
+
method: "POST",
|
|
1324
|
+
body: JSON.stringify(payload)
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
/** Evaluate routing against benchmark cases. */
|
|
1328
|
+
async evalBenchmark(options) {
|
|
1329
|
+
const payload = {
|
|
1330
|
+
threshold: options.threshold,
|
|
1331
|
+
cases: options.cases.map((row) => ({
|
|
1332
|
+
prompt: row.prompt,
|
|
1333
|
+
expected_skill: row.expected_skill ?? row.expectedSkill
|
|
1334
|
+
}))
|
|
1335
|
+
};
|
|
1336
|
+
return this.req("/skills/evals/benchmark", {
|
|
1337
|
+
method: "POST",
|
|
1338
|
+
body: JSON.stringify(payload)
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
/** Evaluate trigger quality for a single target skill. */
|
|
1342
|
+
async evalTriggers(options) {
|
|
1343
|
+
const payload = {
|
|
1344
|
+
skill_name: options.skill_name ?? options.skillName,
|
|
1345
|
+
prompts: options.prompts,
|
|
1346
|
+
threshold: options.threshold
|
|
1347
|
+
};
|
|
1348
|
+
return this.req("/skills/evals/triggers", {
|
|
1349
|
+
method: "POST",
|
|
1350
|
+
body: JSON.stringify(payload)
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
/** Compile a selected or routed skill into an execution summary. */
|
|
1354
|
+
async compile(options) {
|
|
1355
|
+
const payload = {
|
|
1356
|
+
skill_name: options.skill_name ?? options.skillName,
|
|
1357
|
+
goal: options.goal,
|
|
1358
|
+
threshold: options.threshold,
|
|
1359
|
+
max_matches: options.max_matches ?? options.maxMatches,
|
|
1360
|
+
schedule: options.schedule
|
|
1361
|
+
};
|
|
1362
|
+
return this.req("/skills/compile", {
|
|
1363
|
+
method: "POST",
|
|
1364
|
+
body: JSON.stringify(payload)
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1367
|
+
/** Generate scaffold skill artifacts from a natural-language prompt. */
|
|
1368
|
+
async generate(options) {
|
|
1369
|
+
return this.req("/skills/generate", {
|
|
1370
|
+
method: "POST",
|
|
1371
|
+
body: JSON.stringify(options)
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
/** Install generated or custom artifacts into local skills. */
|
|
1375
|
+
async generateInstall(options) {
|
|
1376
|
+
const payload = {
|
|
1377
|
+
prompt: options.prompt,
|
|
1378
|
+
threshold: options.threshold,
|
|
1379
|
+
location: options.location,
|
|
1380
|
+
conflict_policy: options.conflictPolicy,
|
|
1381
|
+
artifacts: options.artifacts ? {
|
|
1382
|
+
"SKILL.md": options.artifacts["SKILL.md"],
|
|
1383
|
+
"workflow.yaml": options.artifacts["workflow.yaml"],
|
|
1384
|
+
"automation.example.yaml": options.artifacts["automation.example.yaml"]
|
|
1385
|
+
} : void 0
|
|
1386
|
+
};
|
|
1387
|
+
return this.req("/skills/generate/install", {
|
|
1388
|
+
method: "POST",
|
|
1389
|
+
body: JSON.stringify(payload)
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1003
1392
|
};
|
|
1004
|
-
var
|
|
1393
|
+
var Packs = class {
|
|
1394
|
+
constructor(req) {
|
|
1395
|
+
this.req = req;
|
|
1396
|
+
}
|
|
1397
|
+
/** List installed tandem packs. */
|
|
1398
|
+
async list() {
|
|
1399
|
+
return this.req("/packs");
|
|
1400
|
+
}
|
|
1401
|
+
/** Inspect an installed pack by `pack_id` or `name`. */
|
|
1402
|
+
async inspect(selector) {
|
|
1403
|
+
return this.req(`/packs/${encodeURIComponent(selector)}`);
|
|
1404
|
+
}
|
|
1405
|
+
/** Install a pack from local path or URL. */
|
|
1406
|
+
async install(options) {
|
|
1407
|
+
return this.req("/packs/install", {
|
|
1408
|
+
method: "POST",
|
|
1409
|
+
body: JSON.stringify(options)
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
/** Install a pack from a downloaded attachment path. */
|
|
1413
|
+
async installFromAttachment(options) {
|
|
1414
|
+
return this.req("/packs/install_from_attachment", {
|
|
1415
|
+
method: "POST",
|
|
1416
|
+
body: JSON.stringify(options)
|
|
1417
|
+
});
|
|
1418
|
+
}
|
|
1419
|
+
/** Uninstall a pack by `pack_id` or `name` (+ optional version). */
|
|
1420
|
+
async uninstall(options) {
|
|
1421
|
+
return this.req("/packs/uninstall", {
|
|
1422
|
+
method: "POST",
|
|
1423
|
+
body: JSON.stringify(options)
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
/** Export an installed pack to zip. */
|
|
1427
|
+
async export(options) {
|
|
1428
|
+
return this.req("/packs/export", {
|
|
1429
|
+
method: "POST",
|
|
1430
|
+
body: JSON.stringify(options)
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
/** Detect `tandempack.yaml` marker in zip path. */
|
|
1434
|
+
async detect(options) {
|
|
1435
|
+
return this.req("/packs/detect", {
|
|
1436
|
+
method: "POST",
|
|
1437
|
+
body: JSON.stringify(options)
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
/** Check available updates for a pack (stub endpoint in v0.4.0). */
|
|
1441
|
+
async updates(selector) {
|
|
1442
|
+
const raw = await this.req(`/packs/${encodeURIComponent(selector)}/updates`);
|
|
1443
|
+
const asObj = raw || {};
|
|
1444
|
+
const updates = Array.isArray(asObj.updates) ? asObj.updates : [];
|
|
1445
|
+
return {
|
|
1446
|
+
pack_id: asString(asObj.pack_id) ?? void 0,
|
|
1447
|
+
name: asString(asObj.name) ?? void 0,
|
|
1448
|
+
current_version: asString(asObj.current_version) ?? void 0,
|
|
1449
|
+
updates
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
/** Apply a pack update (stub endpoint in v0.4.0). */
|
|
1453
|
+
async update(selector, options) {
|
|
1454
|
+
const raw = await this.req(`/packs/${encodeURIComponent(selector)}/update`, {
|
|
1455
|
+
method: "POST",
|
|
1456
|
+
body: JSON.stringify(options ?? {})
|
|
1457
|
+
});
|
|
1458
|
+
return {
|
|
1459
|
+
updated: Boolean(raw.updated),
|
|
1460
|
+
pack_id: asString(raw.pack_id) ?? void 0,
|
|
1461
|
+
name: asString(raw.name) ?? void 0,
|
|
1462
|
+
current_version: asString(raw.current_version) ?? void 0,
|
|
1463
|
+
target_version: asString(raw.target_version) ?? void 0,
|
|
1464
|
+
reason: asString(raw.reason) ?? void 0
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
};
|
|
1468
|
+
var Capabilities = class {
|
|
1005
1469
|
constructor(req) {
|
|
1006
1470
|
this.req = req;
|
|
1007
1471
|
}
|
|
1472
|
+
/** Get current capability bindings file. */
|
|
1473
|
+
async getBindings() {
|
|
1474
|
+
const raw = await this.req("/capabilities/bindings");
|
|
1475
|
+
return raw.bindings;
|
|
1476
|
+
}
|
|
1477
|
+
/** Replace capability bindings file. */
|
|
1478
|
+
async setBindings(bindings) {
|
|
1479
|
+
return this.req("/capabilities/bindings", {
|
|
1480
|
+
method: "PUT",
|
|
1481
|
+
body: JSON.stringify(bindings)
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
/** Discover provider tools available for resolution. */
|
|
1485
|
+
async discovery() {
|
|
1486
|
+
return this.req("/capabilities/discovery");
|
|
1487
|
+
}
|
|
1488
|
+
/**
|
|
1489
|
+
* Resolve capability IDs to provider tools.
|
|
1490
|
+
* Returns resolver payload on success; throws on HTTP errors (including 409 missing capability).
|
|
1491
|
+
*/
|
|
1492
|
+
async resolve(input) {
|
|
1493
|
+
return this.req("/capabilities/resolve", {
|
|
1494
|
+
method: "POST",
|
|
1495
|
+
body: JSON.stringify(input)
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
/** Evaluate runtime readiness for required capabilities and return blocking issues. */
|
|
1499
|
+
async readiness(input) {
|
|
1500
|
+
return this.req("/capabilities/readiness", {
|
|
1501
|
+
method: "POST",
|
|
1502
|
+
body: JSON.stringify(input)
|
|
1503
|
+
});
|
|
1504
|
+
}
|
|
1505
|
+
};
|
|
1506
|
+
var Resources = class {
|
|
1507
|
+
constructor(baseUrl, getToken, req) {
|
|
1508
|
+
this.baseUrl = baseUrl;
|
|
1509
|
+
this.getToken = getToken;
|
|
1510
|
+
this.req = req;
|
|
1511
|
+
}
|
|
1008
1512
|
/** List stored resource records. */
|
|
1009
1513
|
async list(options) {
|
|
1010
1514
|
const params = new URLSearchParams();
|
|
@@ -1031,6 +1535,24 @@ var Resources = class {
|
|
|
1031
1535
|
body: JSON.stringify(options)
|
|
1032
1536
|
});
|
|
1033
1537
|
}
|
|
1538
|
+
async get(key) {
|
|
1539
|
+
const raw = await this.req(`/resource/${encodeURIComponent(key)}`);
|
|
1540
|
+
return parseResponse(ResourceRecordSchema, raw, `/resource/${key}`, 200);
|
|
1541
|
+
}
|
|
1542
|
+
async putKey(key, value, options) {
|
|
1543
|
+
const raw = await this.req(`/resource/${encodeURIComponent(key)}`, {
|
|
1544
|
+
method: "PUT",
|
|
1545
|
+
body: JSON.stringify({ value, ...options ?? {} })
|
|
1546
|
+
});
|
|
1547
|
+
return parseResponse(ResourceWriteResponseSchema, raw, `/resource/${key}`, 200);
|
|
1548
|
+
}
|
|
1549
|
+
async patchKey(key, patch) {
|
|
1550
|
+
const raw = await this.req(`/resource/${encodeURIComponent(key)}`, {
|
|
1551
|
+
method: "PATCH",
|
|
1552
|
+
body: JSON.stringify(patch)
|
|
1553
|
+
});
|
|
1554
|
+
return parseResponse(ResourceWriteResponseSchema, raw, `/resource/${key}`, 200);
|
|
1555
|
+
}
|
|
1034
1556
|
/** Delete a resource entry. */
|
|
1035
1557
|
async delete(key, options) {
|
|
1036
1558
|
return this.req("/resource", {
|
|
@@ -1038,11 +1560,247 @@ var Resources = class {
|
|
|
1038
1560
|
body: JSON.stringify({ key, ...options })
|
|
1039
1561
|
});
|
|
1040
1562
|
}
|
|
1563
|
+
async deleteKey(key) {
|
|
1564
|
+
return this.req(`/resource/${encodeURIComponent(key)}`, {
|
|
1565
|
+
method: "DELETE"
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
events(options) {
|
|
1569
|
+
const params = new URLSearchParams();
|
|
1570
|
+
if (options?.sinceSeq !== void 0) params.set("since_seq", String(options.sinceSeq));
|
|
1571
|
+
if (options?.tail !== void 0) params.set("tail", String(options.tail));
|
|
1572
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
1573
|
+
return streamSse(`${this.baseUrl}/resource/events${qs}`, this.getToken());
|
|
1574
|
+
}
|
|
1041
1575
|
};
|
|
1042
|
-
var
|
|
1576
|
+
var Coder = class {
|
|
1043
1577
|
constructor(req) {
|
|
1044
1578
|
this.req = req;
|
|
1045
1579
|
}
|
|
1580
|
+
/** Create a coder workflow run. */
|
|
1581
|
+
async createRun(payload) {
|
|
1582
|
+
return this.req("/coder/runs", {
|
|
1583
|
+
method: "POST",
|
|
1584
|
+
body: JSON.stringify(payload)
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1587
|
+
/** List coder runs with optional filters. */
|
|
1588
|
+
async listRuns(options) {
|
|
1589
|
+
const params = new URLSearchParams();
|
|
1590
|
+
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
1591
|
+
const workflowMode = options?.workflow_mode ?? options?.workflowMode;
|
|
1592
|
+
const repoSlug = options?.repo_slug ?? options?.repoSlug;
|
|
1593
|
+
if (workflowMode) params.set("workflow_mode", workflowMode);
|
|
1594
|
+
if (repoSlug) params.set("repo_slug", repoSlug);
|
|
1595
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
1596
|
+
const raw = await this.req(`/coder/runs${qs}`);
|
|
1597
|
+
const asObj = raw ?? {};
|
|
1598
|
+
const runs = Array.isArray(asObj.runs) ? asObj.runs : [];
|
|
1599
|
+
return {
|
|
1600
|
+
runs,
|
|
1601
|
+
count: typeof asObj.count === "number" ? asObj.count : runs.length
|
|
1602
|
+
};
|
|
1603
|
+
}
|
|
1604
|
+
/** Get a single coder run plus linked context run details. */
|
|
1605
|
+
async getRun(runId) {
|
|
1606
|
+
const raw = await this.req(`/coder/runs/${encodeURIComponent(runId)}`);
|
|
1607
|
+
const asObj = raw ?? {};
|
|
1608
|
+
return {
|
|
1609
|
+
...asObj,
|
|
1610
|
+
coderRun: asObj.coder_run ?? void 0,
|
|
1611
|
+
coder_run: asObj.coder_run ?? void 0,
|
|
1612
|
+
run: asObj.run ?? void 0
|
|
1613
|
+
};
|
|
1614
|
+
}
|
|
1615
|
+
/** Execute the next runnable task in a coder workflow. */
|
|
1616
|
+
async executeNext(runId, payload) {
|
|
1617
|
+
return this.req(`/coder/runs/${encodeURIComponent(runId)}/execute-next`, {
|
|
1618
|
+
method: "POST",
|
|
1619
|
+
body: JSON.stringify(payload ?? {})
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1622
|
+
/** Continue executing runnable tasks until the run stops or completes. */
|
|
1623
|
+
async executeAll(runId, payload) {
|
|
1624
|
+
return this.req(`/coder/runs/${encodeURIComponent(runId)}/execute-all`, {
|
|
1625
|
+
method: "POST",
|
|
1626
|
+
body: JSON.stringify(payload ?? {})
|
|
1627
|
+
});
|
|
1628
|
+
}
|
|
1629
|
+
/** Spawn a follow-on coder workflow from an existing run. */
|
|
1630
|
+
async createFollowOnRun(runId, payload) {
|
|
1631
|
+
return this.req(`/coder/runs/${encodeURIComponent(runId)}/follow-on-run`, {
|
|
1632
|
+
method: "POST",
|
|
1633
|
+
body: JSON.stringify(payload)
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
/** Approve a coder run that is waiting on human review. */
|
|
1637
|
+
async approveRun(runId, reason) {
|
|
1638
|
+
return this.req(`/coder/runs/${encodeURIComponent(runId)}/approve`, {
|
|
1639
|
+
method: "POST",
|
|
1640
|
+
body: JSON.stringify({ reason })
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
/** Cancel a coder run. */
|
|
1644
|
+
async cancelRun(runId, reason) {
|
|
1645
|
+
return this.req(`/coder/runs/${encodeURIComponent(runId)}/cancel`, {
|
|
1646
|
+
method: "POST",
|
|
1647
|
+
body: JSON.stringify({ reason })
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
/** List artifacts emitted by a coder run. */
|
|
1651
|
+
async listArtifacts(runId) {
|
|
1652
|
+
const raw = await this.req(`/coder/runs/${encodeURIComponent(runId)}/artifacts`);
|
|
1653
|
+
const asObj = raw ?? {};
|
|
1654
|
+
const artifacts = Array.isArray(asObj.artifacts) ? asObj.artifacts : [];
|
|
1655
|
+
return {
|
|
1656
|
+
...asObj,
|
|
1657
|
+
artifacts,
|
|
1658
|
+
count: typeof asObj.count === "number" ? asObj.count : artifacts.length
|
|
1659
|
+
};
|
|
1660
|
+
}
|
|
1661
|
+
/** Inspect ranked memory hits for a coder run. */
|
|
1662
|
+
async getMemoryHits(runId, options) {
|
|
1663
|
+
const params = new URLSearchParams();
|
|
1664
|
+
if (options?.query) params.set("q", options.query);
|
|
1665
|
+
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
1666
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
1667
|
+
const raw = await this.req(
|
|
1668
|
+
`/coder/runs/${encodeURIComponent(runId)}/memory-hits${qs}`
|
|
1669
|
+
);
|
|
1670
|
+
const asObj = raw ?? {};
|
|
1671
|
+
const hits = Array.isArray(asObj.hits) ? asObj.hits : [];
|
|
1672
|
+
return {
|
|
1673
|
+
...asObj,
|
|
1674
|
+
hits,
|
|
1675
|
+
count: typeof asObj.count === "number" ? asObj.count : hits.length
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
/** Create a triage inspection report artifact. */
|
|
1679
|
+
async createTriageInspectionReport(runId, payload) {
|
|
1680
|
+
return this.req(
|
|
1681
|
+
`/coder/runs/${encodeURIComponent(runId)}/triage-inspection-report`,
|
|
1682
|
+
{
|
|
1683
|
+
method: "POST",
|
|
1684
|
+
body: JSON.stringify(payload)
|
|
1685
|
+
}
|
|
1686
|
+
);
|
|
1687
|
+
}
|
|
1688
|
+
/** Create a triage reproduction report artifact. */
|
|
1689
|
+
async createTriageReproductionReport(runId, payload) {
|
|
1690
|
+
return this.req(
|
|
1691
|
+
`/coder/runs/${encodeURIComponent(runId)}/triage-reproduction-report`,
|
|
1692
|
+
{
|
|
1693
|
+
method: "POST",
|
|
1694
|
+
body: JSON.stringify(payload)
|
|
1695
|
+
}
|
|
1696
|
+
);
|
|
1697
|
+
}
|
|
1698
|
+
/** Create a triage summary artifact. */
|
|
1699
|
+
async createTriageSummary(runId, payload) {
|
|
1700
|
+
return this.req(`/coder/runs/${encodeURIComponent(runId)}/triage-summary`, {
|
|
1701
|
+
method: "POST",
|
|
1702
|
+
body: JSON.stringify(payload)
|
|
1703
|
+
});
|
|
1704
|
+
}
|
|
1705
|
+
/** Create PR review evidence for a coder run. */
|
|
1706
|
+
async createPrReviewEvidence(runId, payload) {
|
|
1707
|
+
return this.req(`/coder/runs/${encodeURIComponent(runId)}/pr-review-evidence`, {
|
|
1708
|
+
method: "POST",
|
|
1709
|
+
body: JSON.stringify(payload)
|
|
1710
|
+
});
|
|
1711
|
+
}
|
|
1712
|
+
/** Create a PR review summary artifact. */
|
|
1713
|
+
async createPrReviewSummary(runId, payload) {
|
|
1714
|
+
return this.req(`/coder/runs/${encodeURIComponent(runId)}/pr-review-summary`, {
|
|
1715
|
+
method: "POST",
|
|
1716
|
+
body: JSON.stringify(payload)
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1719
|
+
/** Create an issue-fix validation report artifact. */
|
|
1720
|
+
async createIssueFixValidationReport(runId, payload) {
|
|
1721
|
+
return this.req(
|
|
1722
|
+
`/coder/runs/${encodeURIComponent(runId)}/issue-fix-validation-report`,
|
|
1723
|
+
{
|
|
1724
|
+
method: "POST",
|
|
1725
|
+
body: JSON.stringify(payload)
|
|
1726
|
+
}
|
|
1727
|
+
);
|
|
1728
|
+
}
|
|
1729
|
+
/** Create an issue-fix summary artifact. */
|
|
1730
|
+
async createIssueFixSummary(runId, payload) {
|
|
1731
|
+
return this.req(`/coder/runs/${encodeURIComponent(runId)}/issue-fix-summary`, {
|
|
1732
|
+
method: "POST",
|
|
1733
|
+
body: JSON.stringify(payload)
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
/** Draft a pull request for an issue-fix coder run. */
|
|
1737
|
+
async createPrDraft(runId, payload) {
|
|
1738
|
+
return this.req(`/coder/runs/${encodeURIComponent(runId)}/pr-draft`, {
|
|
1739
|
+
method: "POST",
|
|
1740
|
+
body: JSON.stringify(payload ?? {})
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1743
|
+
/** Submit a pull request for an issue-fix coder run. */
|
|
1744
|
+
async submitPr(runId, payload) {
|
|
1745
|
+
return this.req(`/coder/runs/${encodeURIComponent(runId)}/pr-submit`, {
|
|
1746
|
+
method: "POST",
|
|
1747
|
+
body: JSON.stringify(payload ?? {})
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
/** Create a merge readiness report artifact. */
|
|
1751
|
+
async createMergeReadinessReport(runId, payload) {
|
|
1752
|
+
return this.req(`/coder/runs/${encodeURIComponent(runId)}/merge-readiness-report`, {
|
|
1753
|
+
method: "POST",
|
|
1754
|
+
body: JSON.stringify(payload)
|
|
1755
|
+
});
|
|
1756
|
+
}
|
|
1757
|
+
/** Create a merge recommendation summary artifact. */
|
|
1758
|
+
async createMergeRecommendationSummary(runId, payload) {
|
|
1759
|
+
return this.req(
|
|
1760
|
+
`/coder/runs/${encodeURIComponent(runId)}/merge-recommendation-summary`,
|
|
1761
|
+
{
|
|
1762
|
+
method: "POST",
|
|
1763
|
+
body: JSON.stringify(payload)
|
|
1764
|
+
}
|
|
1765
|
+
);
|
|
1766
|
+
}
|
|
1767
|
+
/** List pending or emitted memory candidates for a coder run. */
|
|
1768
|
+
async listMemoryCandidates(runId) {
|
|
1769
|
+
const raw = await this.req(
|
|
1770
|
+
`/coder/runs/${encodeURIComponent(runId)}/memory-candidates`
|
|
1771
|
+
);
|
|
1772
|
+
const asObj = raw ?? {};
|
|
1773
|
+
const candidates = Array.isArray(asObj.candidates) ? asObj.candidates : [];
|
|
1774
|
+
return {
|
|
1775
|
+
...asObj,
|
|
1776
|
+
candidates,
|
|
1777
|
+
count: typeof asObj.count === "number" ? asObj.count : candidates.length
|
|
1778
|
+
};
|
|
1779
|
+
}
|
|
1780
|
+
/** Persist a memory candidate generated by a coder workflow. */
|
|
1781
|
+
async createMemoryCandidate(runId, payload) {
|
|
1782
|
+
return this.req(`/coder/runs/${encodeURIComponent(runId)}/memory-candidates`, {
|
|
1783
|
+
method: "POST",
|
|
1784
|
+
body: JSON.stringify(payload)
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
/** Promote a reviewed memory candidate into governed memory. */
|
|
1788
|
+
async promoteMemoryCandidate(runId, candidateId, payload) {
|
|
1789
|
+
return this.req(
|
|
1790
|
+
`/coder/runs/${encodeURIComponent(runId)}/memory-candidates/${encodeURIComponent(candidateId)}/promote`,
|
|
1791
|
+
{
|
|
1792
|
+
method: "POST",
|
|
1793
|
+
body: JSON.stringify(payload ?? {})
|
|
1794
|
+
}
|
|
1795
|
+
);
|
|
1796
|
+
}
|
|
1797
|
+
};
|
|
1798
|
+
var Routines = class {
|
|
1799
|
+
constructor(baseUrl, getToken, req) {
|
|
1800
|
+
this.baseUrl = baseUrl;
|
|
1801
|
+
this.getToken = getToken;
|
|
1802
|
+
this.req = req;
|
|
1803
|
+
}
|
|
1046
1804
|
/** List all scheduled routines. */
|
|
1047
1805
|
async list() {
|
|
1048
1806
|
return this.req("/routines");
|
|
@@ -1144,11 +1902,90 @@ var Routines = class {
|
|
|
1144
1902
|
if (Array.isArray(raw)) return { history: raw, count: raw.length };
|
|
1145
1903
|
return raw;
|
|
1146
1904
|
}
|
|
1905
|
+
events(options) {
|
|
1906
|
+
const params = new URLSearchParams();
|
|
1907
|
+
const routineId = options?.routine_id ?? options?.routineId;
|
|
1908
|
+
if (routineId) params.set("routine_id", routineId);
|
|
1909
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
1910
|
+
return streamSse(`${this.baseUrl}/routines/events${qs}`, this.getToken(), {
|
|
1911
|
+
signal: options?.signal
|
|
1912
|
+
});
|
|
1913
|
+
}
|
|
1914
|
+
addArtifact(runId, payload) {
|
|
1915
|
+
return this.req(`/routines/runs/${encodeURIComponent(runId)}/artifacts`, {
|
|
1916
|
+
method: "POST",
|
|
1917
|
+
body: JSON.stringify(payload)
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1147
1920
|
};
|
|
1148
|
-
var
|
|
1921
|
+
var WorkflowPlans = class {
|
|
1149
1922
|
constructor(req) {
|
|
1150
1923
|
this.req = req;
|
|
1151
1924
|
}
|
|
1925
|
+
async preview(options) {
|
|
1926
|
+
return this.req("/workflow-plans/preview", {
|
|
1927
|
+
method: "POST",
|
|
1928
|
+
body: JSON.stringify({
|
|
1929
|
+
prompt: options.prompt,
|
|
1930
|
+
schedule: options.schedule,
|
|
1931
|
+
plan_source: options.plan_source ?? options.planSource,
|
|
1932
|
+
allowed_mcp_servers: options.allowed_mcp_servers ?? options.allowedMcpServers,
|
|
1933
|
+
workspace_root: options.workspace_root ?? options.workspaceRoot,
|
|
1934
|
+
operator_preferences: options.operator_preferences ?? options.operatorPreferences
|
|
1935
|
+
})
|
|
1936
|
+
});
|
|
1937
|
+
}
|
|
1938
|
+
async apply(options) {
|
|
1939
|
+
return this.req("/workflow-plans/apply", {
|
|
1940
|
+
method: "POST",
|
|
1941
|
+
body: JSON.stringify({
|
|
1942
|
+
plan_id: options.plan_id ?? options.planId,
|
|
1943
|
+
plan: options.plan,
|
|
1944
|
+
creator_id: options.creator_id ?? options.creatorId,
|
|
1945
|
+
pack_builder_export: options.pack_builder_export ?? options.packBuilderExport
|
|
1946
|
+
})
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
async chatStart(options) {
|
|
1950
|
+
return this.req("/workflow-plans/chat/start", {
|
|
1951
|
+
method: "POST",
|
|
1952
|
+
body: JSON.stringify({
|
|
1953
|
+
prompt: options.prompt,
|
|
1954
|
+
schedule: options.schedule,
|
|
1955
|
+
plan_source: options.plan_source ?? options.planSource,
|
|
1956
|
+
allowed_mcp_servers: options.allowed_mcp_servers ?? options.allowedMcpServers,
|
|
1957
|
+
workspace_root: options.workspace_root ?? options.workspaceRoot,
|
|
1958
|
+
operator_preferences: options.operator_preferences ?? options.operatorPreferences
|
|
1959
|
+
})
|
|
1960
|
+
});
|
|
1961
|
+
}
|
|
1962
|
+
async get(planId) {
|
|
1963
|
+
return this.req(`/workflow-plans/${encodeURIComponent(planId)}`);
|
|
1964
|
+
}
|
|
1965
|
+
async chatMessage(options) {
|
|
1966
|
+
return this.req("/workflow-plans/chat/message", {
|
|
1967
|
+
method: "POST",
|
|
1968
|
+
body: JSON.stringify({
|
|
1969
|
+
plan_id: options.plan_id ?? options.planId,
|
|
1970
|
+
message: options.message
|
|
1971
|
+
})
|
|
1972
|
+
});
|
|
1973
|
+
}
|
|
1974
|
+
async chatReset(options) {
|
|
1975
|
+
return this.req("/workflow-plans/chat/reset", {
|
|
1976
|
+
method: "POST",
|
|
1977
|
+
body: JSON.stringify({
|
|
1978
|
+
plan_id: options.plan_id ?? options.planId
|
|
1979
|
+
})
|
|
1980
|
+
});
|
|
1981
|
+
}
|
|
1982
|
+
};
|
|
1983
|
+
var Automations = class {
|
|
1984
|
+
constructor(baseUrl, getToken, req) {
|
|
1985
|
+
this.baseUrl = baseUrl;
|
|
1986
|
+
this.getToken = getToken;
|
|
1987
|
+
this.req = req;
|
|
1988
|
+
}
|
|
1152
1989
|
/** List all automations. */
|
|
1153
1990
|
async list() {
|
|
1154
1991
|
return this.req("/automations");
|
|
@@ -1255,9 +2092,28 @@ var Automations = class {
|
|
|
1255
2092
|
if (Array.isArray(raw)) return { history: raw, count: raw.length };
|
|
1256
2093
|
return raw;
|
|
1257
2094
|
}
|
|
2095
|
+
events(options) {
|
|
2096
|
+
const params = new URLSearchParams();
|
|
2097
|
+
const automationId = options?.automation_id ?? options?.automationId;
|
|
2098
|
+
const runId = options?.run_id ?? options?.runId;
|
|
2099
|
+
if (automationId) params.set("automation_id", automationId);
|
|
2100
|
+
if (runId) params.set("run_id", runId);
|
|
2101
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
2102
|
+
return streamSse(`${this.baseUrl}/automations/events${qs}`, this.getToken(), {
|
|
2103
|
+
signal: options?.signal
|
|
2104
|
+
});
|
|
2105
|
+
}
|
|
2106
|
+
addArtifact(runId, payload) {
|
|
2107
|
+
return this.req(`/automations/runs/${encodeURIComponent(runId)}/artifacts`, {
|
|
2108
|
+
method: "POST",
|
|
2109
|
+
body: JSON.stringify(payload)
|
|
2110
|
+
});
|
|
2111
|
+
}
|
|
1258
2112
|
};
|
|
1259
2113
|
var AutomationsV2 = class {
|
|
1260
|
-
constructor(req) {
|
|
2114
|
+
constructor(baseUrl, getToken, req) {
|
|
2115
|
+
this.baseUrl = baseUrl;
|
|
2116
|
+
this.getToken = getToken;
|
|
1261
2117
|
this.req = req;
|
|
1262
2118
|
}
|
|
1263
2119
|
async create(spec) {
|
|
@@ -1330,6 +2186,17 @@ var AutomationsV2 = class {
|
|
|
1330
2186
|
{ method: "POST", body: JSON.stringify({ reason: reason ?? "" }) }
|
|
1331
2187
|
);
|
|
1332
2188
|
}
|
|
2189
|
+
events(options) {
|
|
2190
|
+
const params = new URLSearchParams();
|
|
2191
|
+
const automationId = options?.automation_id ?? options?.automationId;
|
|
2192
|
+
const runId = options?.run_id ?? options?.runId;
|
|
2193
|
+
if (automationId) params.set("automation_id", automationId);
|
|
2194
|
+
if (runId) params.set("run_id", runId);
|
|
2195
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
2196
|
+
return streamSse(`${this.baseUrl}/automations/v2/events${qs}`, this.getToken(), {
|
|
2197
|
+
signal: options?.signal
|
|
2198
|
+
});
|
|
2199
|
+
}
|
|
1333
2200
|
};
|
|
1334
2201
|
var AgentTeams = class {
|
|
1335
2202
|
constructor(req) {
|