@capybara-hq/plugin-sdk 0.1.0-rc.93 → 0.1.0-rc.95
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/agent-docs/extensions.md +1 -1
- package/api/plugin-sdk.api.md +45 -1
- package/dist/agents-ctx.d.ts +2 -0
- package/dist/ctx.d.ts +18 -0
- package/dist/device-site-access.d.ts +27 -0
- package/dist/device-site-access.js +7 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/permissions.d.ts +1 -0
- package/dist/permissions.js +4 -3
- package/dist/tool.d.ts +3 -0
- package/package.json +1 -1
package/agent-docs/extensions.md
CHANGED
|
@@ -117,7 +117,7 @@ ctx.setup.check("bot-token", {
|
|
|
117
117
|
an item the extension posted. Errors are `InboxError` (`invalid_item`, `org_disabled`, `not_found`).
|
|
118
118
|
- `ctx.agents.usableBy`, `ctx.conversations.bySubject` and `ctx.people.get` / `search` read org
|
|
119
119
|
facts for pages (`permissions.agents`, `conversations`, `people`; each call names an `orgId`, and
|
|
120
|
-
the extension must be enabled there). They return ids, names and avatars, never emails or
|
|
120
|
+
the extension must be enabled there). They return ids, names, titles and avatars, never emails or
|
|
121
121
|
conversation content.
|
|
122
122
|
- The `run.lifecycle` hook (`permissions.hooks`) tells the extension each phase of a run of a
|
|
123
123
|
conversation about its subject: `started`, `waiting` (on a person), `resumed` (that wait
|
package/api/plugin-sdk.api.md
CHANGED
|
@@ -1101,10 +1101,19 @@ export interface DeviceAccessCtx {
|
|
|
1101
1101
|
timeoutMs: number;
|
|
1102
1102
|
ifRunning?: boolean;
|
|
1103
1103
|
}): Promise<Uint8Array>;
|
|
1104
|
+
requestSiteAccess(call: ToolCallContext, ask: SiteAccessAsk): void;
|
|
1104
1105
|
revokeLoopbackPort(scope: DeviceAccessScope & {
|
|
1105
1106
|
service: string;
|
|
1106
1107
|
port: number;
|
|
1107
1108
|
}): Promise<void>;
|
|
1109
|
+
revokeSiteGrant(scope: DeviceAccessScope & {
|
|
1110
|
+
service: string;
|
|
1111
|
+
origin: string;
|
|
1112
|
+
action: SiteAccessAction;
|
|
1113
|
+
}): Promise<void>;
|
|
1114
|
+
siteGrants(scope: DeviceAccessScope & {
|
|
1115
|
+
service: string;
|
|
1116
|
+
}): Promise<SiteGrantView[]>;
|
|
1108
1117
|
streamTicket(scope: DeviceAccessScope & {
|
|
1109
1118
|
service: string;
|
|
1110
1119
|
}): Promise<{
|
|
@@ -1127,6 +1136,8 @@ export type DeviceAccessErrorCode = "no_device" | "provider_unavailable" | "capa
|
|
|
1127
1136
|
| "not_running"
|
|
1128
1137
|
/** A loopback port call from an extension without `permissions.deviceAccess.loopbackPorts`. */
|
|
1129
1138
|
| "loopback_not_declared"
|
|
1139
|
+
/** A site call from an extension without the approved site access permission. */
|
|
1140
|
+
| "site_access_not_declared"
|
|
1130
1141
|
/**
|
|
1131
1142
|
* A loopback port cannot be granted here: running outside the sandbox is off (platform, org,
|
|
1132
1143
|
* device or owner setting), the run is unattended, or the provider has no loopback support.
|
|
@@ -1983,6 +1994,7 @@ export interface ExtensionPermissions {
|
|
|
1983
1994
|
deviceAccess?: {
|
|
1984
1995
|
services: string[];
|
|
1985
1996
|
loopbackPorts?: boolean;
|
|
1997
|
+
siteAccess?: boolean;
|
|
1986
1998
|
};
|
|
1987
1999
|
dialIn?: {
|
|
1988
2000
|
protocol: string;
|
|
@@ -4427,7 +4439,7 @@ export function sanitizeThemeSvg(bytes: Uint8Array): {
|
|
|
4427
4439
|
};
|
|
4428
4440
|
|
|
4429
4441
|
// @public
|
|
4430
|
-
export const SDK_VERSION = "0.1.0-rc.
|
|
4442
|
+
export const SDK_VERSION = "0.1.0-rc.95";
|
|
4431
4443
|
|
|
4432
4444
|
// @public
|
|
4433
4445
|
export function secret<T extends z.ZodTypeAny>(schema: T): T;
|
|
@@ -4692,6 +4704,36 @@ export interface SignInCapabilityV1 {
|
|
|
4692
4704
|
start(): Promise<"signedIn" | "cancelled">;
|
|
4693
4705
|
}
|
|
4694
4706
|
|
|
4707
|
+
// @public
|
|
4708
|
+
export const SITE_ACCESS_ACTIONS: readonly ["evaluate", "storage-read", "storage-clear", "permission-grant"];
|
|
4709
|
+
|
|
4710
|
+
// @public
|
|
4711
|
+
export type SiteAccessAction = (typeof SITE_ACCESS_ACTIONS)[number];
|
|
4712
|
+
|
|
4713
|
+
// @public
|
|
4714
|
+
export interface SiteAccessApproval {
|
|
4715
|
+
action: SiteAccessAction;
|
|
4716
|
+
detailSha256: string;
|
|
4717
|
+
origin: string;
|
|
4718
|
+
source: "human" | "review-model" | "full-access";
|
|
4719
|
+
}
|
|
4720
|
+
|
|
4721
|
+
// @public
|
|
4722
|
+
export interface SiteAccessAsk {
|
|
4723
|
+
action: SiteAccessAction;
|
|
4724
|
+
detail: string;
|
|
4725
|
+
origin: string;
|
|
4726
|
+
service: string;
|
|
4727
|
+
}
|
|
4728
|
+
|
|
4729
|
+
// @public
|
|
4730
|
+
export interface SiteGrantView {
|
|
4731
|
+
action: SiteAccessAction;
|
|
4732
|
+
expiresAt: string;
|
|
4733
|
+
origin: string;
|
|
4734
|
+
source: "human";
|
|
4735
|
+
}
|
|
4736
|
+
|
|
4695
4737
|
// @public
|
|
4696
4738
|
export const SKILL_ENTRY_FILE = "SKILL.md";
|
|
4697
4739
|
|
|
@@ -4796,6 +4838,7 @@ export interface SubjectConversation {
|
|
|
4796
4838
|
lastActivityAt: string;
|
|
4797
4839
|
ownerAccountId: string;
|
|
4798
4840
|
state: SubjectConversationState;
|
|
4841
|
+
title: string | null;
|
|
4799
4842
|
}
|
|
4800
4843
|
|
|
4801
4844
|
// @public
|
|
@@ -5254,6 +5297,7 @@ export interface ToolCallContext {
|
|
|
5254
5297
|
role?: "owner" | "admin" | "member" | "guest";
|
|
5255
5298
|
rootConversationId: string;
|
|
5256
5299
|
signal: AbortSignal;
|
|
5300
|
+
siteAccess?: SiteAccessApproval;
|
|
5257
5301
|
source?: ConversationSource;
|
|
5258
5302
|
}
|
|
5259
5303
|
|
package/dist/agents-ctx.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export type SubjectConversationState = "idle" | "running" | "waiting";
|
|
|
50
50
|
/** A conversation serving a subject: metadata only, never its content. */
|
|
51
51
|
export interface SubjectConversation {
|
|
52
52
|
id: string;
|
|
53
|
+
/** The conversation's current title (generated or user-set), or null when untitled. */
|
|
54
|
+
title: string | null;
|
|
53
55
|
ownerAccountId: string;
|
|
54
56
|
agentId: string;
|
|
55
57
|
/** From the latest run: queued or running is `running`, waiting on something is `waiting`. */
|
package/dist/ctx.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Kysely } from "kysely";
|
|
2
2
|
import type { AgentsCtx, ConversationsCtx, PeopleCtx } from "./agents-ctx.js";
|
|
3
3
|
import type { DeviceServiceSpec, DeviceServiceStatus, ServiceBlockedHost } from "./device-provider.js";
|
|
4
|
+
import type { SiteAccessAction, SiteAccessAsk, SiteGrantView } from "./device-site-access.js";
|
|
4
5
|
import type { DevicesCtx, DialInChannel } from "./dial-in.js";
|
|
5
6
|
import type { ExtensionPointRef } from "./extension-point.js";
|
|
6
7
|
import type { AvailableHook, HookHandler, HookOptions } from "./hooks.js";
|
|
@@ -293,6 +294,21 @@ export interface DeviceAccessCtx {
|
|
|
293
294
|
loopbackPorts(scope: DeviceAccessScope & {
|
|
294
295
|
service: string;
|
|
295
296
|
}): Promise<LoopbackGrantView[]>;
|
|
297
|
+
/**
|
|
298
|
+
* Asks the kernel for a profile decision on one action on a non-loopback origin. A later report
|
|
299
|
+
* in the same call replaces the earlier one. Requires the approved siteAccess permission.
|
|
300
|
+
*/
|
|
301
|
+
requestSiteAccess(call: ToolCallContext, ask: SiteAccessAsk): void;
|
|
302
|
+
/** Lists the owner-approved grants held by this conversation's root. Empty when unattended. */
|
|
303
|
+
siteGrants(scope: DeviceAccessScope & {
|
|
304
|
+
service: string;
|
|
305
|
+
}): Promise<SiteGrantView[]>;
|
|
306
|
+
/** Removes the matching root grant. Only the owner can remove it. */
|
|
307
|
+
revokeSiteGrant(scope: DeviceAccessScope & {
|
|
308
|
+
service: string;
|
|
309
|
+
origin: string;
|
|
310
|
+
action: SiteAccessAction;
|
|
311
|
+
}): Promise<void>;
|
|
296
312
|
/**
|
|
297
313
|
* Answers the handoff question of this extension's tool call `callId` from the panel.
|
|
298
314
|
* `handoffConversationId` is the conversation whose tool call raised the handoff (the extension
|
|
@@ -329,6 +345,8 @@ export type DeviceAccessErrorCode = "no_device" | "provider_unavailable" | "capa
|
|
|
329
345
|
| "not_running"
|
|
330
346
|
/** A loopback port call from an extension without `permissions.deviceAccess.loopbackPorts`. */
|
|
331
347
|
| "loopback_not_declared"
|
|
348
|
+
/** A site call from an extension without the approved site access permission. */
|
|
349
|
+
| "site_access_not_declared"
|
|
332
350
|
/**
|
|
333
351
|
* A loopback port cannot be granted here: running outside the sandbox is off (platform, org,
|
|
334
352
|
* device or owner setting), the run is unattended, or the provider has no loopback support.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** The action classes have separate approvals and site grants. */
|
|
2
|
+
export declare const SITE_ACCESS_ACTIONS: readonly ["evaluate", "storage-read", "storage-clear", "permission-grant"];
|
|
3
|
+
export type SiteAccessAction = (typeof SITE_ACCESS_ACTIONS)[number];
|
|
4
|
+
/** A device service's request to act on a non-loopback site. */
|
|
5
|
+
export interface SiteAccessAsk {
|
|
6
|
+
service: string;
|
|
7
|
+
action: SiteAccessAction;
|
|
8
|
+
/** The canonical HTTP(S) origin, including a non-default port, at most 300 characters. */
|
|
9
|
+
origin: string;
|
|
10
|
+
/** The script or the site data or permission in question, at most 20,000 characters. */
|
|
11
|
+
detail: string;
|
|
12
|
+
}
|
|
13
|
+
/** Approval provided by the kernel to the same tool on its single re-run. */
|
|
14
|
+
export interface SiteAccessApproval {
|
|
15
|
+
action: SiteAccessAction;
|
|
16
|
+
origin: string;
|
|
17
|
+
detailSha256: string;
|
|
18
|
+
source: "human" | "review-model" | "full-access";
|
|
19
|
+
}
|
|
20
|
+
/** One live, person-approved site grant of this conversation's root and device service. */
|
|
21
|
+
export interface SiteGrantView {
|
|
22
|
+
origin: string;
|
|
23
|
+
action: SiteAccessAction;
|
|
24
|
+
source: "human";
|
|
25
|
+
/** ISO 8601 timestamp of the grant's expiry. */
|
|
26
|
+
expiresAt: string;
|
|
27
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.0-rc.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.0-rc.95";
|
|
2
2
|
export * from "./agent-template.js";
|
|
3
3
|
export * from "./agents-ctx.js";
|
|
4
4
|
export * from "./avatar-presets.js";
|
|
@@ -18,6 +18,7 @@ export { DEVICE_DEFAULT_STATE_PATH, DEVICE_DENIED_SECRET_PATHS } from "./device-
|
|
|
18
18
|
export * from "./device-operation.js";
|
|
19
19
|
export * from "./device-provider.js";
|
|
20
20
|
export * from "./device-service.js";
|
|
21
|
+
export * from "./device-site-access.js";
|
|
21
22
|
export * from "./dial-in.js";
|
|
22
23
|
export * from "./directory.js";
|
|
23
24
|
export * from "./extension-point.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.1.0-rc.
|
|
1
|
+
export const SDK_VERSION = "0.1.0-rc.95";
|
|
2
2
|
export * from "./agent-template.js";
|
|
3
3
|
export * from "./agents-ctx.js";
|
|
4
4
|
export * from "./avatar-presets.js";
|
|
@@ -18,6 +18,7 @@ export { DEVICE_DEFAULT_STATE_PATH, DEVICE_DENIED_SECRET_PATHS } from "./device-
|
|
|
18
18
|
export * from "./device-operation.js";
|
|
19
19
|
export * from "./device-provider.js";
|
|
20
20
|
export * from "./device-service.js";
|
|
21
|
+
export * from "./device-site-access.js";
|
|
21
22
|
export * from "./dial-in.js";
|
|
22
23
|
export * from "./directory.js";
|
|
23
24
|
export * from "./extension-point.js";
|
package/dist/permissions.d.ts
CHANGED
package/dist/permissions.js
CHANGED
|
@@ -237,10 +237,11 @@ export function validatePermissions(plugin, p, provides = []) {
|
|
|
237
237
|
}
|
|
238
238
|
if (p.deviceAccess !== undefined) {
|
|
239
239
|
if (!isObj(p.deviceAccess) ||
|
|
240
|
-
Object.keys(p.deviceAccess).some((k) => k !== "services" && k !== "loopbackPorts") ||
|
|
240
|
+
Object.keys(p.deviceAccess).some((k) => k !== "services" && k !== "loopbackPorts" && k !== "siteAccess") ||
|
|
241
241
|
(p.deviceAccess.loopbackPorts !== undefined &&
|
|
242
|
-
typeof p.deviceAccess.loopbackPorts !== "boolean")
|
|
243
|
-
|
|
242
|
+
typeof p.deviceAccess.loopbackPorts !== "boolean") ||
|
|
243
|
+
(p.deviceAccess.siteAccess !== undefined && typeof p.deviceAccess.siteAccess !== "boolean")) {
|
|
244
|
+
errs.push("permissions.deviceAccess must be { services: string[], loopbackPorts?: boolean, siteAccess?: boolean }");
|
|
244
245
|
}
|
|
245
246
|
else {
|
|
246
247
|
const names = strList("permissions.deviceAccess.services", p.deviceAccess.services, errs);
|
package/dist/tool.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SiteAccessApproval } from "./device-site-access.js";
|
|
1
2
|
import { type ParamSchema } from "./model-params.js";
|
|
2
3
|
import type { UiOpen } from "./ui.js";
|
|
3
4
|
/** Tool annotations (hints aligned with MCP, used to derive the default policy). */
|
|
@@ -296,6 +297,8 @@ export interface ToolCallContext {
|
|
|
296
297
|
*/
|
|
297
298
|
idempotencyKey?: string;
|
|
298
299
|
signal: AbortSignal;
|
|
300
|
+
/** The kernel-approved site action carried only by the same call's re-run. */
|
|
301
|
+
siteAccess?: SiteAccessApproval;
|
|
299
302
|
/**
|
|
300
303
|
* The previous input round's state and answer. `answer` is null unless the person answered.
|
|
301
304
|
* `outcome`: `answered` (the person answered), `woken` (a watched wait's watcher settled it, or
|