@capybara-hq/plugin-sdk 0.1.0-rc.94 → 0.1.0-rc.96
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 +20 -6
- package/dist/agents-ctx.d.ts +2 -0
- package/dist/device-operation.d.ts +5 -1
- package/dist/device-protocol.d.ts +4 -12
- package/dist/device-protocol.js +1 -25
- package/dist/device-provider.d.ts +0 -9
- package/dist/hooks.d.ts +18 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- 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
|
@@ -1235,10 +1235,6 @@ export interface DeviceProvider {
|
|
|
1235
1235
|
} | null>;
|
|
1236
1236
|
report(device: DeviceRef, signal: AbortSignal): Promise<DeviceReport>;
|
|
1237
1237
|
resume(h: SandboxHandle, signal: AbortSignal): Promise<"resumed" | "gone">;
|
|
1238
|
-
readonly retirement?: {
|
|
1239
|
-
generation(handle: SandboxHandle): string | null;
|
|
1240
|
-
attestRetired(deviceId: string, generation: string, signal: AbortSignal): Promise<boolean>;
|
|
1241
|
-
};
|
|
1242
1238
|
revokeOperation?(h: SandboxHandle, ref: SandboxOperationRef, signal: AbortSignal): Promise<void>;
|
|
1243
1239
|
scan?(h: SandboxHandle, base: string, opts: {
|
|
1244
1240
|
signal: AbortSignal;
|
|
@@ -3147,7 +3143,7 @@ export interface ModelRequest {
|
|
|
3147
3143
|
}
|
|
3148
3144
|
|
|
3149
3145
|
// @public
|
|
3150
|
-
export type ModelRequestHookPayload = ModelCallRequestHookPayload | EmbeddingRequestHookPayload | ImageRequestHookPayload;
|
|
3146
|
+
export type ModelRequestHookPayload = ModelCallRequestHookPayload | UnscopedModelCallRequestHookPayload | EmbeddingRequestHookPayload | ImageRequestHookPayload;
|
|
3151
3147
|
|
|
3152
3148
|
// @public
|
|
3153
3149
|
export interface ModelResponseHookPayload extends HookScope {
|
|
@@ -4439,7 +4435,7 @@ export function sanitizeThemeSvg(bytes: Uint8Array): {
|
|
|
4439
4435
|
};
|
|
4440
4436
|
|
|
4441
4437
|
// @public
|
|
4442
|
-
export const SDK_VERSION = "0.1.0-rc.
|
|
4438
|
+
export const SDK_VERSION = "0.1.0-rc.96";
|
|
4443
4439
|
|
|
4444
4440
|
// @public
|
|
4445
4441
|
export function secret<T extends z.ZodTypeAny>(schema: T): T;
|
|
@@ -4838,6 +4834,7 @@ export interface SubjectConversation {
|
|
|
4838
4834
|
lastActivityAt: string;
|
|
4839
4835
|
ownerAccountId: string;
|
|
4840
4836
|
state: SubjectConversationState;
|
|
4837
|
+
title: string | null;
|
|
4841
4838
|
}
|
|
4842
4839
|
|
|
4843
4840
|
// @public
|
|
@@ -5825,6 +5822,23 @@ export interface UiView {
|
|
|
5825
5822
|
open?: UiOpen;
|
|
5826
5823
|
}
|
|
5827
5824
|
|
|
5825
|
+
// @public
|
|
5826
|
+
export interface UnscopedModelCallRequestHookPayload {
|
|
5827
|
+
accountId?: undefined;
|
|
5828
|
+
agentId?: undefined;
|
|
5829
|
+
agentVersion?: undefined;
|
|
5830
|
+
attempt: number;
|
|
5831
|
+
conversationId?: undefined;
|
|
5832
|
+
model: string;
|
|
5833
|
+
orgId: string;
|
|
5834
|
+
parent?: undefined;
|
|
5835
|
+
provider: string;
|
|
5836
|
+
purpose: ModelCallRequestHookPayload["purpose"] | "eval";
|
|
5837
|
+
request: Readonly<HookModelRequest>;
|
|
5838
|
+
runId?: undefined;
|
|
5839
|
+
step: number;
|
|
5840
|
+
}
|
|
5841
|
+
|
|
5828
5842
|
// @public
|
|
5829
5843
|
export interface UsableAgent {
|
|
5830
5844
|
avatar: AvatarValue;
|
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`. */
|
|
@@ -324,7 +324,11 @@ export interface SandboxBackground {
|
|
|
324
324
|
} | {
|
|
325
325
|
unavailable: "lost" | "expired";
|
|
326
326
|
}>;
|
|
327
|
-
/**
|
|
327
|
+
/**
|
|
328
|
+
* The kernel may call this on a suspended instance before resuming it. If the stop cannot
|
|
329
|
+
* complete immediately, durably record the exact cancellation before returning
|
|
330
|
+
* `cancel-pending`, and apply it before resume can run any work from that execution.
|
|
331
|
+
*/
|
|
328
332
|
stop(h: SandboxHandle, ref: SandboxExecutionRef, opts: {
|
|
329
333
|
graceMs: number;
|
|
330
334
|
signal: AbortSignal;
|
|
@@ -24,9 +24,9 @@ export type DeviceOp = "create" | "exec" | "readFile" | "writeFile" | "stat" | "
|
|
|
24
24
|
* carry `network`; `projects` means the device serves `list` and `scan` (the provider never sends
|
|
25
25
|
* `list` or `scan` to a device that did not announce `projects`); `loopbackPorts` means the device
|
|
26
26
|
* accepts `service.ensure` `network.loopbackPorts` (the provider never sends that key to a device
|
|
27
|
-
* that did not announce it).
|
|
27
|
+
* that did not announce it).
|
|
28
28
|
*/
|
|
29
|
-
export type DeviceFeature = "networkReport" | "projects" | "loopbackPorts"
|
|
29
|
+
export type DeviceFeature = "networkReport" | "projects" | "loopbackPorts";
|
|
30
30
|
/**
|
|
31
31
|
* What a device knows of its local policy and reports (in the hello or a `policy` event). The owner
|
|
32
32
|
* ceiling travels separately, in the owner report ({@link DeviceOwnerCeiling}).
|
|
@@ -194,7 +194,7 @@ export declare function parseOpResult<Op extends DeviceOp>(op: Op, result: unkno
|
|
|
194
194
|
* of the machine's policy: the owner changes it on the machine and the device reports the change
|
|
195
195
|
* ({@link DevicePolicyChanged}).
|
|
196
196
|
*/
|
|
197
|
-
export type DeviceOperation = Exclude<DeviceOp, "killTagged" | "killAll"> | "prepareReadFile" | "prepareWriteFile" | "prepareStat" | "browseStat" | "browseList" | "browseScan" | "backgroundStart" | "backgroundStatus" | "backgroundTail" | "backgroundReadOutput" | "backgroundStop" | "revokeOperation" | "bindInstance"
|
|
197
|
+
export type DeviceOperation = Exclude<DeviceOp, "killTagged" | "killAll"> | "prepareReadFile" | "prepareWriteFile" | "prepareStat" | "browseStat" | "browseList" | "browseScan" | "backgroundStart" | "backgroundStatus" | "backgroundTail" | "backgroundReadOutput" | "backgroundStop" | "revokeOperation" | "bindInstance";
|
|
198
198
|
/**
|
|
199
199
|
* How far a connection's project paths reach: `machine` (any path the deny list leaves), `paths`
|
|
200
200
|
* (the listed project paths) or `workspace` (the connection's working directory only).
|
|
@@ -276,14 +276,6 @@ export interface BindInstanceResult {
|
|
|
276
276
|
permissionSupport: SandboxPermissionSupport;
|
|
277
277
|
ownerCeiling: DeviceOwnerCeiling;
|
|
278
278
|
}
|
|
279
|
-
/** Query the authenticated machine's durable proof for this exact local generation. */
|
|
280
|
-
export interface AttestRetiredRequest {
|
|
281
|
-
deviceId: string;
|
|
282
|
-
generation: string;
|
|
283
|
-
}
|
|
284
|
-
export interface AttestRetiredResult extends AttestRetiredRequest {
|
|
285
|
-
retired: boolean;
|
|
286
|
-
}
|
|
287
279
|
export interface BackgroundReadOutputRequest {
|
|
288
280
|
offset: number;
|
|
289
281
|
maxBytes: number;
|
|
@@ -360,4 +352,4 @@ export declare function parseOwnerCeilingReport(value: unknown): DeviceOwnerCeil
|
|
|
360
352
|
* before: `parseDialInMachineFrame` on the kernel, `parseDialInKernelFrame` on the machine.
|
|
361
353
|
*/
|
|
362
354
|
export declare function parseDeviceFrame<K extends keyof DeviceBodies>(body: unknown, kind: K): DeviceBodies[K];
|
|
363
|
-
export declare function parseOperationResult(op: DeviceOperation, result: unknown, request?: BackgroundReadOutputRequest | BindInstanceRequest
|
|
355
|
+
export declare function parseOperationResult(op: DeviceOperation, result: unknown, request?: BackgroundReadOutputRequest | BindInstanceRequest): unknown;
|
package/dist/device-protocol.js
CHANGED
|
@@ -17,12 +17,7 @@ export const DEVICE_PROTOCOL_VERSION = 6;
|
|
|
17
17
|
* this module's ({@link parseDeviceFrame}).
|
|
18
18
|
*/
|
|
19
19
|
export const DEVICE_DIAL_IN_PROTOCOL = `capybara-device/${DEVICE_PROTOCOL_VERSION}`;
|
|
20
|
-
const DEVICE_FEATURES = [
|
|
21
|
-
"networkReport",
|
|
22
|
-
"projects",
|
|
23
|
-
"loopbackPorts",
|
|
24
|
-
"retirementProof",
|
|
25
|
-
];
|
|
20
|
+
const DEVICE_FEATURES = ["networkReport", "projects", "loopbackPorts"];
|
|
26
21
|
/** The most project directories a policy summary's `sharedProjectRoots` lists. */
|
|
27
22
|
export const MAX_DEVICE_SHARED_PROJECT_ROOTS = 256;
|
|
28
23
|
/** The most blocked hosts an exec result reports; the parser cuts longer lists. */
|
|
@@ -646,12 +641,6 @@ function requestBody(value) {
|
|
|
646
641
|
keys(a, ["instanceId", "instanceGeneration", "bindingId", "expectedPreviousGeneration"]);
|
|
647
642
|
bindRequest(a);
|
|
648
643
|
}
|
|
649
|
-
else if (op === "attestRetired") {
|
|
650
|
-
keys(a, ["deviceId", "generation"]);
|
|
651
|
-
string(a.deviceId);
|
|
652
|
-
if (generation(a.generation).startsWith("0"))
|
|
653
|
-
throw new DeviceProtocolError("Expected a canonical positive instance generation");
|
|
654
|
-
}
|
|
655
644
|
else if (op === "revokeOperation") {
|
|
656
645
|
keys(a, ["ref"]);
|
|
657
646
|
a.ref = parseSandboxOperationRef(a.ref);
|
|
@@ -865,19 +854,6 @@ export function parseDeviceFrame(body, kind) {
|
|
|
865
854
|
}
|
|
866
855
|
}
|
|
867
856
|
export function parseOperationResult(op, result, request) {
|
|
868
|
-
if (op === "attestRetired") {
|
|
869
|
-
if (!request || !("deviceId" in request))
|
|
870
|
-
throw new DeviceProtocolError("Retirement validation requires the exact request");
|
|
871
|
-
const o = object(result);
|
|
872
|
-
keys(o, ["deviceId", "generation", "retired"]);
|
|
873
|
-
if (o.deviceId !== request.deviceId || o.generation !== request.generation)
|
|
874
|
-
throw new DeviceProtocolError("Retirement answer belongs to another device or generation");
|
|
875
|
-
return freeze({
|
|
876
|
-
deviceId: request.deviceId,
|
|
877
|
-
generation: request.generation,
|
|
878
|
-
retired: strictBoolean(o, "retired", "retirement answer"),
|
|
879
|
-
});
|
|
880
|
-
}
|
|
881
857
|
if (op === "bindInstance") {
|
|
882
858
|
if (!request || !("bindingId" in request))
|
|
883
859
|
throw new DeviceProtocolError("Binding validation requires the exact request");
|
|
@@ -498,15 +498,6 @@ export interface DeviceProvider {
|
|
|
498
498
|
* hands it the hellos and unsolicited frames of the machines serving its devices.
|
|
499
499
|
*/
|
|
500
500
|
readonly dialIn?: DialInHandler;
|
|
501
|
-
/**
|
|
502
|
-
* Optional exact retirement evidence for a dial-in device's earlier provider generation.
|
|
503
|
-
* The immutable identity comes from the supplied handle. A positive answer requires durable
|
|
504
|
-
* machine evidence for that exact device and generation.
|
|
505
|
-
*/
|
|
506
|
-
readonly retirement?: {
|
|
507
|
-
generation(handle: SandboxHandle): string | null;
|
|
508
|
-
attestRetired(deviceId: string, generation: string, signal: AbortSignal): Promise<boolean>;
|
|
509
|
-
};
|
|
510
501
|
/**
|
|
511
502
|
* Whether the provider isolates the sessions of one device from each other inside the
|
|
512
503
|
* instance (a declared capability; absent means false).
|
package/dist/hooks.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface HookParentScope {
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Who and where a model or tool hook fires for. Hooks fire in chat conversations and in
|
|
24
|
-
* sub-agents' conversations
|
|
24
|
+
* sub-agents' conversations.
|
|
25
25
|
*/
|
|
26
26
|
export interface HookScope {
|
|
27
27
|
orgId: string;
|
|
@@ -107,6 +107,22 @@ export interface ModelCallRequestHookPayload extends HookScope {
|
|
|
107
107
|
model: string;
|
|
108
108
|
request: Readonly<HookModelRequest>;
|
|
109
109
|
}
|
|
110
|
+
/** A chat model request outside a live conversation, including eval judges and replays. */
|
|
111
|
+
export interface UnscopedModelCallRequestHookPayload {
|
|
112
|
+
purpose: ModelCallRequestHookPayload["purpose"] | "eval";
|
|
113
|
+
orgId: string;
|
|
114
|
+
provider: string;
|
|
115
|
+
model: string;
|
|
116
|
+
step: number;
|
|
117
|
+
attempt: number;
|
|
118
|
+
request: Readonly<HookModelRequest>;
|
|
119
|
+
accountId?: undefined;
|
|
120
|
+
agentId?: undefined;
|
|
121
|
+
agentVersion?: undefined;
|
|
122
|
+
conversationId?: undefined;
|
|
123
|
+
runId?: undefined;
|
|
124
|
+
parent?: undefined;
|
|
125
|
+
}
|
|
110
126
|
/**
|
|
111
127
|
* `model.request` of an embedding call an extension made through `ctx.models.embed`
|
|
112
128
|
* (`purpose: "embedding"`): fired once per `embed` call, before the first batch is sent, with every
|
|
@@ -203,7 +219,7 @@ export interface ImageResponseHookPayload {
|
|
|
203
219
|
* `purpose`. Handlers must accept the absent conversation fields of an embedding call (a policy
|
|
204
220
|
* hook that throws on one denies the call). Payloads carry no media bytes.
|
|
205
221
|
*/
|
|
206
|
-
export type ModelRequestHookPayload = ModelCallRequestHookPayload | EmbeddingRequestHookPayload | ImageRequestHookPayload;
|
|
222
|
+
export type ModelRequestHookPayload = ModelCallRequestHookPayload | UnscopedModelCallRequestHookPayload | EmbeddingRequestHookPayload | ImageRequestHookPayload;
|
|
207
223
|
/**
|
|
208
224
|
* `model.response`: after a sent model call finished or failed, with its usage when known (step
|
|
209
225
|
* attempts, compaction, title and suggestion calls, see `purpose`). Not fired for a call the user
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED