@getpaseo/plugin 0.16.0-beta.1 → 0.16.0-beta.2
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/contracts.d.ts
CHANGED
|
@@ -60,6 +60,12 @@ export interface PluginAgentSnapshot {
|
|
|
60
60
|
readonly workspaceId: string;
|
|
61
61
|
readonly provider: string;
|
|
62
62
|
readonly status: "initializing" | "idle" | "running" | "error" | "closed";
|
|
63
|
+
/** Shells and monitors the agent left running after its turn. 0 when none are live. */
|
|
64
|
+
readonly backgroundWork: {
|
|
65
|
+
readonly count: number;
|
|
66
|
+
};
|
|
67
|
+
/** A helper hidden from tabs, lists and attention. Fixed at creation. */
|
|
68
|
+
readonly background: boolean;
|
|
63
69
|
readonly createdAt: string;
|
|
64
70
|
readonly updatedAt: string;
|
|
65
71
|
readonly lastActivityAt: string;
|
|
@@ -336,6 +336,7 @@ class AcpRuntime {
|
|
|
336
336
|
this.notificationLane = Promise.resolve();
|
|
337
337
|
this.promptLane = Promise.resolve();
|
|
338
338
|
this.activePrompt = null;
|
|
339
|
+
this.lastUsage = {};
|
|
339
340
|
this.child = child;
|
|
340
341
|
this.closeConnector = closeConnector;
|
|
341
342
|
this.emit = options.emit;
|
|
@@ -486,6 +487,20 @@ class AcpRuntime {
|
|
|
486
487
|
// while earlier session updates are still queued. Apply them before the turn ends.
|
|
487
488
|
const settled = this.call(this.connection.prompt({ sessionId: this.nativeSessionId, prompt })).then(async (response) => {
|
|
488
489
|
await this.drainNotifications();
|
|
490
|
+
if (response.usage) {
|
|
491
|
+
this.lastUsage = {
|
|
492
|
+
...this.lastUsage,
|
|
493
|
+
inputTokens: response.usage.inputTokens,
|
|
494
|
+
outputTokens: response.usage.outputTokens,
|
|
495
|
+
cachedInputTokens: response.usage.cachedReadTokens ?? undefined,
|
|
496
|
+
};
|
|
497
|
+
this.emit({
|
|
498
|
+
type: "session.usage",
|
|
499
|
+
sessionId: this.options.boundarySessionId,
|
|
500
|
+
turnId,
|
|
501
|
+
usage: this.lastUsage,
|
|
502
|
+
});
|
|
503
|
+
}
|
|
489
504
|
const state = response.stopReason === "cancelled" ? "canceled" : "completed";
|
|
490
505
|
this.fallbackChunkIds.clear();
|
|
491
506
|
this.terminalizeTransientItems(state);
|
|
@@ -892,14 +907,16 @@ class AcpRuntime {
|
|
|
892
907
|
return;
|
|
893
908
|
}
|
|
894
909
|
if (update.sessionUpdate === "usage_update") {
|
|
910
|
+
this.lastUsage = {
|
|
911
|
+
...this.lastUsage,
|
|
912
|
+
contextWindowUsedTokens: update.used,
|
|
913
|
+
contextWindowMaxTokens: update.size,
|
|
914
|
+
totalCostUsd: update.cost?.currency === "USD" ? update.cost.amount : undefined,
|
|
915
|
+
};
|
|
895
916
|
this.emit({
|
|
896
917
|
type: "session.usage",
|
|
897
918
|
sessionId: this.options.boundarySessionId,
|
|
898
|
-
usage:
|
|
899
|
-
contextWindowUsedTokens: update.used,
|
|
900
|
-
contextWindowMaxTokens: update.size,
|
|
901
|
-
totalCostUsd: update.cost?.currency === "USD" ? update.cost.amount : undefined,
|
|
902
|
-
},
|
|
919
|
+
usage: this.lastUsage,
|
|
903
920
|
});
|
|
904
921
|
return;
|
|
905
922
|
}
|
|
@@ -66,6 +66,8 @@ export interface PluginHookAgent {
|
|
|
66
66
|
provider: string;
|
|
67
67
|
cwd: string;
|
|
68
68
|
title: string | null;
|
|
69
|
+
/** A helper hidden from tabs, lists and attention. Fixed at creation. */
|
|
70
|
+
readonly background: boolean;
|
|
69
71
|
/** Data plugins stored on the agent. Paseo never reads a key. */
|
|
70
72
|
metadata: Record<string, JsonValue>;
|
|
71
73
|
}
|
|
@@ -77,6 +79,8 @@ export interface PluginSessionOpenRequest {
|
|
|
77
79
|
reason: "create" | "resume" | "refresh" | "import";
|
|
78
80
|
purpose: "interactive" | "history";
|
|
79
81
|
readonly title: string | null;
|
|
82
|
+
/** A helper hidden from tabs, lists and attention. Fixed at creation. */
|
|
83
|
+
readonly background: boolean;
|
|
80
84
|
readonly labels: Readonly<Record<string, string>>;
|
|
81
85
|
readonly metadata: Readonly<Record<string, JsonValue>>;
|
|
82
86
|
tools: AgentToolDefinition[];
|
|
@@ -149,7 +153,8 @@ export interface PluginHookRequests {
|
|
|
149
153
|
}
|
|
150
154
|
/** What a hook may return. An omitted `metadata` stays as it was. */
|
|
151
155
|
type PluginHookRequestResults = Omit<PluginHookRequests, "agent.open.before"> & {
|
|
152
|
-
"agent.open.before": Omit<PluginSessionOpenRequest, "metadata"> & {
|
|
156
|
+
"agent.open.before": Omit<PluginSessionOpenRequest, "metadata" | "background"> & {
|
|
157
|
+
readonly background?: boolean;
|
|
153
158
|
metadata?: Readonly<Record<string, JsonValue>>;
|
|
154
159
|
};
|
|
155
160
|
};
|
|
@@ -193,7 +198,7 @@ export interface PluginLifecycleRegistration {
|
|
|
193
198
|
/** @deprecated Use addHook with the renamed hook. Removed after 2027-04-30. */
|
|
194
199
|
before<Name extends keyof PluginBeforeRequests>(name: Name, handler: (input: {
|
|
195
200
|
request: PluginBeforeRequests[Name];
|
|
196
|
-
}, context: PluginHookContext) =>
|
|
201
|
+
}, context: PluginHookContext) => PluginBeforeResults[Name] | void | Promise<PluginBeforeResults[Name] | void>): () => void;
|
|
197
202
|
}
|
|
198
203
|
/** @internal Lifecycle policy shared by the daemon and plugin process. */
|
|
199
204
|
export declare const pluginHookRegistry: {
|
|
@@ -262,6 +267,9 @@ export type PluginLifecycleEvents = {
|
|
|
262
267
|
export type PluginBeforeRequests = {
|
|
263
268
|
[Name in keyof typeof legacyRequests]: PluginHookRequests[(typeof legacyRequests)[Name]];
|
|
264
269
|
};
|
|
270
|
+
type PluginBeforeResults = {
|
|
271
|
+
[Name in keyof typeof legacyRequests]: PluginHookRequestResults[(typeof legacyRequests)[Name]];
|
|
272
|
+
};
|
|
265
273
|
/** @internal SDK adapter for the daemon's hook registry. */
|
|
266
274
|
export declare function createLifecycleRegistration(register: (name: keyof PluginHooks, handler: (input: never, context: PluginHookContext) => unknown) => () => void): PluginLifecycleRegistration;
|
|
267
275
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpaseo/plugin",
|
|
3
|
-
"version": "0.16.0-beta.
|
|
3
|
+
"version": "0.16.0-beta.2",
|
|
4
4
|
"description": "Paseo plugin SDK package",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": [
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"use-sync-external-store": "^1.6.0"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@getpaseo/client": "0.16.0-beta.
|
|
82
|
-
"@getpaseo/protocol": "0.16.0-beta.
|
|
81
|
+
"@getpaseo/client": "0.16.0-beta.2",
|
|
82
|
+
"@getpaseo/protocol": "0.16.0-beta.2",
|
|
83
83
|
"@types/node": "^20.9.0",
|
|
84
84
|
"@types/react": "~19.2.0",
|
|
85
85
|
"react": "19.2.3",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"zod": "^4.4.3"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
|
-
"@getpaseo/client": "0.16.0-beta.
|
|
93
|
-
"@getpaseo/protocol": "0.16.0-beta.
|
|
92
|
+
"@getpaseo/client": "0.16.0-beta.2",
|
|
93
|
+
"@getpaseo/protocol": "0.16.0-beta.2",
|
|
94
94
|
"react": ">=19.1.0 <20",
|
|
95
95
|
"react-native": ">=0.81.5",
|
|
96
96
|
"zod": "^4.4.3"
|