@astralform/js 1.0.0 → 1.1.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.cjs +43 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -1
- package/dist/index.d.ts +37 -1
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -1
- package/package.json +11 -10
package/dist/index.cjs
CHANGED
|
@@ -554,6 +554,49 @@ var AstralformClient = class {
|
|
|
554
554
|
async submitToolApproval(request) {
|
|
555
555
|
await this.post("/v1/tool-approval", request);
|
|
556
556
|
}
|
|
557
|
+
// --- End-user tool-permission self-service ---
|
|
558
|
+
/**
|
|
559
|
+
* List the current end user's own remembered tool-permission grants.
|
|
560
|
+
* Only `conversation`/`always` grants exist (`once` is never persisted).
|
|
561
|
+
* Paginated via `limit` (default 100, max 200) / `offset`; `total` lets you
|
|
562
|
+
* page through all of them.
|
|
563
|
+
*/
|
|
564
|
+
async getMyToolPermissions(options) {
|
|
565
|
+
const params = new URLSearchParams();
|
|
566
|
+
if (options?.limit != null) {
|
|
567
|
+
const safeLimit = Math.max(
|
|
568
|
+
1,
|
|
569
|
+
Math.min(200, Math.floor(Number(options.limit)))
|
|
570
|
+
);
|
|
571
|
+
params.set("limit", String(safeLimit));
|
|
572
|
+
}
|
|
573
|
+
if (options?.offset != null) {
|
|
574
|
+
const safeOffset = Math.max(0, Math.floor(Number(options.offset)));
|
|
575
|
+
params.set("offset", String(safeOffset));
|
|
576
|
+
}
|
|
577
|
+
const qs = params.toString();
|
|
578
|
+
const raw = await this.get(`/v1/me/tool-permissions${qs ? `?${qs}` : ""}`);
|
|
579
|
+
return {
|
|
580
|
+
grants: raw.grants.map((g) => ({
|
|
581
|
+
id: g.id,
|
|
582
|
+
toolName: g.tool_name,
|
|
583
|
+
decision: g.decision,
|
|
584
|
+
scope: g.scope,
|
|
585
|
+
conversationId: g.conversation_id,
|
|
586
|
+
createdAt: g.created_at
|
|
587
|
+
})),
|
|
588
|
+
total: raw.total,
|
|
589
|
+
limit: raw.limit,
|
|
590
|
+
offset: raw.offset
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Revoke one of the current end user's remembered grants by id. The agent
|
|
595
|
+
* will ask again the next time that tool is used.
|
|
596
|
+
*/
|
|
597
|
+
async revokeToolPermission(id) {
|
|
598
|
+
await this.del(`/v1/me/tool-permissions/${encodeURIComponent(id)}`);
|
|
599
|
+
}
|
|
557
600
|
// --- Conversation Assets ---
|
|
558
601
|
mapAsset(raw) {
|
|
559
602
|
return {
|