@alisio/sdk 0.4.1 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +27 -1
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1423,6 +1423,24 @@ export interface DashboardProvenance {
1423
1423
  /** Human-readable, metadata only (for example "widget sales-trend dropped: query timeout"). */
1424
1424
  fallbacks: string[];
1425
1425
  }
1426
+ /**
1427
+ * Outcome of `api.decisions.activate`:
1428
+ * - `activated`: the user confirmed; the host saved `decisions.provider` and applied it live.
1429
+ * - `already_active`: `decisions.provider` already names this provider; nothing changed.
1430
+ * - `other_provider_active`: another provider is configured (`active`); never overwritten.
1431
+ * - `declined`: the user answered no (or dismissed the question); nothing changed.
1432
+ * - `needs_confirmation`: there is no interactive surface to ask (headless); nothing changed.
1433
+ * - `disabled`: `decisions.enabled` is false; nothing changed.
1434
+ * - `unavailable`: the id is not registered by this plugin, or saving failed (see `message`).
1435
+ */
1436
+ export type DecisionActivationStatus = "activated" | "already_active" | "other_provider_active" | "declined" | "needs_confirmation" | "disabled" | "unavailable";
1437
+ export interface DecisionActivationResult {
1438
+ status: DecisionActivationStatus;
1439
+ /** The provider id that is (or, for `other_provider_active`, already was) configured. */
1440
+ active?: string;
1441
+ /** Short, path-free explanation for `unavailable`. */
1442
+ message?: string;
1443
+ }
1426
1444
  export interface DecisionsApi {
1427
1445
  /** Registers a provider (does NOT activate it; activation is `decisions.provider` in config). */
1428
1446
  registerProvider(provider: DecisionProvider): () => void;
@@ -1432,6 +1450,14 @@ export interface DecisionsApi {
1432
1450
  id: string;
1433
1451
  name: string;
1434
1452
  } | null;
1453
+ /**
1454
+ * Optional, feature-detected (`api.decisions?.activate?.(id)`): asks the HOST to make a provider
1455
+ * this plugin registered the active one. Installing a plugin never activates it; this is for a
1456
+ * user-initiated step (for example a setup command). The host mediates consent (one
1457
+ * confirmation question) and persists `decisions.provider` in the user's global configuration;
1458
+ * it never overwrites a different configured provider. Never throws for expected outcomes.
1459
+ */
1460
+ activate?(providerId: string): Promise<DecisionActivationResult>;
1435
1461
  /**
1436
1462
  * Never throws for infrastructure problems: resolves null (disabled, no provider, timeout,
1437
1463
  * provider error, circuit open, or every answer rejected). Throws `DecisionRequestError` (a
@@ -1440,7 +1466,7 @@ export interface DecisionsApi {
1440
1466
  tryDecide(request: DecisionRequest, options?: DecisionOptions): Promise<DecisionResponse | null>;
1441
1467
  }
1442
1468
  /** What a tool receives in `ToolContext.decisions`: the consumer side, bound to the run. */
1443
- export type ToolDecisions = Omit<DecisionsApi, "registerProvider">;
1469
+ export type ToolDecisions = Omit<DecisionsApi, "registerProvider" | "activate">;
1444
1470
  export interface DecisionProvider {
1445
1471
  /** `^[a-z0-9][a-z0-9.-]{0,63}$`, unique among registered providers. */
1446
1472
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alisio/sdk",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Typed plugin SDK for Alisio: the stable contract for tools, commands, context, compaction and session hooks, model completions and storage. Types only plus tiny helpers; zero runtime dependencies.",
5
5
  "author": "Gustavo Gutiérrez",
6
6
  "license": "MIT",