@getpaseo/plugin 0.11.0-beta.3 → 0.11.0-beta.4

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.
@@ -103,6 +103,11 @@ interface PluginClientContextAliases {
103
103
  addSidebarItem(contribution: PluginSidebarContribution): PluginCleanup;
104
104
  }
105
105
  export interface PluginClientContext extends PluginCommandCapabilities, PluginClientContextAliases {
106
+ /** Play a base64-encoded audio file on this client; resolves when playback ends. */
107
+ playAudio(source: {
108
+ base64: string;
109
+ mimeType: string;
110
+ }): Promise<void>;
106
111
  addSettingsScreen(contribution: PluginSettingsScreenContribution): PluginCleanup;
107
112
  addScreen(contribution: PluginScreenContribution): PluginCleanup;
108
113
  addSidebarHeaderItem(contribution: PluginSidebarItemContribution): PluginCleanup;
@@ -68,6 +68,9 @@ export interface PluginLifecycleEvents {
68
68
  "agent.created": {
69
69
  agent: PluginHookAgent;
70
70
  };
71
+ "agent.closed": {
72
+ agent: PluginHookAgent;
73
+ };
71
74
  "workspace.created": {
72
75
  workspace: PluginHookWorkspace;
73
76
  };
@@ -1,4 +1,4 @@
1
- import type { ZodType } from "zod";
1
+ import { z, type ZodType } from "zod";
2
2
  import type { JsonValue } from "@getpaseo/protocol/agent-types";
3
3
  export interface UsageWindow {
4
4
  id: string;
@@ -65,13 +65,22 @@ export interface UsageAccount {
65
65
  /** Store locator, opaque to the daemon. */
66
66
  input: JsonValue;
67
67
  }
68
+ export declare const UsageScopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
69
+ kind: z.ZodLiteral<"global">;
70
+ }, z.core.$strip>, z.ZodObject<{
71
+ kind: z.ZodLiteral<"session">;
72
+ provider: z.ZodString;
73
+ model: z.ZodOptional<z.ZodString>;
74
+ env: z.ZodRecord<z.ZodString, z.ZodString>;
75
+ }, z.core.$strip>], "kind">;
76
+ export type UsageScope = z.infer<typeof UsageScopeSchema>;
68
77
  export interface UsageSourceRegistration {
69
78
  id: string;
70
79
  label: string;
71
80
  icon?: string;
72
81
  input: ZodType;
73
- /** Every account whose login exists on this machine. Empty when none. */
74
- discover(): Promise<UsageAccount[]>;
82
+ /** Accounts for this scope only. The same key in any scope identifies the same account. */
83
+ discover(scope: UsageScope): Promise<UsageAccount[]>;
75
84
  /** Re-reads the login store; never writes it. */
76
85
  fetch(input: unknown): Promise<UsageReport>;
77
86
  }
@@ -84,6 +93,29 @@ export declare function windowFromUsedPct(input: {
84
93
  resetsAt?: string | null;
85
94
  tone?: UsageWindow["tone"];
86
95
  }): UsageWindow;
96
+ /**
97
+ * Numeric provider windows have one identity and vocabulary, independent of response slots.
98
+ * Pass null when the provider omits the duration; reset countdowns are not window lengths.
99
+ * Named API fields (weekly, monthly, etc.) use windowFromUsedPct instead.
100
+ */
101
+ export declare function windowFromReportedDuration(input: {
102
+ durationSeconds: number | null;
103
+ /** Stable quota identity and provider name for a model- or feature-scoped limit. */
104
+ scope?: {
105
+ id: string;
106
+ label: string;
107
+ };
108
+ /** Neutral identity and names when the provider does not report a positive duration. */
109
+ unknown: {
110
+ id: string;
111
+ label: string;
112
+ shortLabel: string;
113
+ };
114
+ utilizationPct: number | null | undefined;
115
+ resetsAt?: string | null;
116
+ summary?: boolean;
117
+ tone?: UsageWindow["tone"];
118
+ }): UsageWindow;
87
119
  /**
88
120
  * The tone scale for anything measured against a known limit, windows and balances alike.
89
121
  *
@@ -1,4 +1,14 @@
1
1
  import { createHash } from "node:crypto";
2
+ import { z } from "zod";
3
+ export const UsageScopeSchema = z.discriminatedUnion("kind", [
4
+ z.object({ kind: z.literal("global") }),
5
+ z.object({
6
+ kind: z.literal("session"),
7
+ provider: z.string(),
8
+ model: z.string().optional(),
9
+ env: z.record(z.string(), z.string()),
10
+ }),
11
+ ]);
2
12
  export function windowFromUsedPct(input) {
3
13
  const usedPct = typeof input.utilizationPct === "number" ? input.utilizationPct : null;
4
14
  const window = {
@@ -16,6 +26,43 @@ export function windowFromUsedPct(input) {
16
26
  window.tone = input.tone;
17
27
  return window;
18
28
  }
29
+ /**
30
+ * Numeric provider windows have one identity and vocabulary, independent of response slots.
31
+ * Pass null when the provider omits the duration; reset countdowns are not window lengths.
32
+ * Named API fields (weekly, monthly, etc.) use windowFromUsedPct instead.
33
+ */
34
+ export function windowFromReportedDuration(input) {
35
+ const duration = input.durationSeconds;
36
+ const name = duration !== null && Number.isFinite(duration) && duration > 0
37
+ ? durationWindowName(duration)
38
+ : input.unknown;
39
+ const scope = input.scope;
40
+ return windowFromUsedPct({
41
+ id: scope ? `${scope.id}:${name.id}` : name.id,
42
+ label: scope ? `${scope.label} · ${name.label}` : name.label,
43
+ shortLabel: scope
44
+ ? `${scope.label}${name.shortLabel ? ` ${name.shortLabel}` : ""}`
45
+ : name.shortLabel,
46
+ utilizationPct: input.utilizationPct,
47
+ resetsAt: input.resetsAt,
48
+ summary: input.summary,
49
+ tone: input.tone,
50
+ });
51
+ }
52
+ function durationWindowName(seconds) {
53
+ if (seconds === 604800)
54
+ return { id: "weekly", label: "Weekly", shortLabel: "wk" };
55
+ const id = seconds === 18000 ? "five_hour" : `${seconds}s`;
56
+ const units = [
57
+ [86400, "day", "d"],
58
+ [3600, "hour", "h"],
59
+ [60, "minute", "m"],
60
+ [1, "second", "s"],
61
+ ];
62
+ const unit = units.find(([size]) => seconds % size === 0) ?? units[units.length - 1];
63
+ const amount = seconds / unit[0];
64
+ return { id, label: `${amount}-${unit[1]}`, shortLabel: `${amount}${unit[2]}` };
65
+ }
19
66
  /**
20
67
  * The tone scale for anything measured against a known limit, windows and balances alike.
21
68
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/plugin",
3
- "version": "0.11.0-beta.3",
3
+ "version": "0.11.0-beta.4",
4
4
  "description": "Paseo plugin SDK package",
5
5
  "files": [
6
6
  "dist",
@@ -70,8 +70,8 @@
70
70
  "use-sync-external-store": "^1.6.0"
71
71
  },
72
72
  "devDependencies": {
73
- "@getpaseo/client": "0.11.0-beta.3",
74
- "@getpaseo/protocol": "0.11.0-beta.3",
73
+ "@getpaseo/client": "0.11.0-beta.4",
74
+ "@getpaseo/protocol": "0.11.0-beta.4",
75
75
  "@types/node": "^20.9.0",
76
76
  "@types/react": "~19.2.0",
77
77
  "react": "19.1.0",
@@ -81,8 +81,8 @@
81
81
  "zod": "^4.4.3"
82
82
  },
83
83
  "peerDependencies": {
84
- "@getpaseo/client": "0.11.0-beta.3",
85
- "@getpaseo/protocol": "0.11.0-beta.3",
84
+ "@getpaseo/client": "0.11.0-beta.4",
85
+ "@getpaseo/protocol": "0.11.0-beta.4",
86
86
  "react": "~19.1.0",
87
87
  "react-native": ">=0.81.5",
88
88
  "zod": "^4.4.3"