@alisio/sdk 0.5.2 → 0.6.0

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 +129 -3
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1848,6 +1848,8 @@ export interface InflightState {
1848
1848
  startedAt: number;
1849
1849
  /** Latest progress output, bounded. */
1850
1850
  tail: string;
1851
+ /** Latest `ForgeProgress` of a `js_run`/`python_run` call; never part of `tail`. */
1852
+ forge?: ForgeProgress;
1851
1853
  }>;
1852
1854
  }
1853
1855
  /** An approval waiting for a decision from a web client. */
@@ -1871,8 +1873,11 @@ export interface PendingApproval {
1871
1873
  capability?: AnalysisCapability;
1872
1874
  /** A short preview for capability approvals (the first 40 lines of the script). */
1873
1875
  preview?: string;
1874
- /** Capability approvals: `managed` (not sandboxed) or `oci` (container). */
1875
- runtime?: "managed" | "oci";
1876
+ /**
1877
+ * Capability approvals: `managed` (not sandboxed), `oci` (container), `wasm` (Pyodide in a
1878
+ * restricted process) or `auto` (the most isolated backend that is ready, decided at run time).
1879
+ */
1880
+ runtime?: "auto" | "managed" | "oci" | "wasm";
1876
1881
  /** `analysis.install` approvals: only `once` and `deny` are offered. */
1877
1882
  install?: InstallPreview;
1878
1883
  }
@@ -2359,7 +2364,12 @@ export interface AnalysisStatus {
2359
2364
  /** `analysis.enabled` and not `--read-only`: python_run is registered. */
2360
2365
  enabled: boolean;
2361
2366
  readOnly: boolean;
2362
- mode: "managed" | "oci";
2367
+ /** `analysis.runtime`: `auto` picks the most isolated backend that is ready. */
2368
+ mode: "auto" | "managed" | "oci" | "wasm";
2369
+ /** `analysis.isolation`: what `auto` may fall back to. */
2370
+ isolation?: "preferred" | "required" | "strict";
2371
+ /** The Python backends with their live state (isolation, ready, profiles, reason). */
2372
+ backends?: EngineDescriptor[];
2363
2373
  /** The discovered (or `--python`) interpreter and the extras environment. */
2364
2374
  python: {
2365
2375
  found: true;
@@ -2649,4 +2659,120 @@ export declare const textResult: (text: string, isError?: boolean) => ToolResult
2649
2659
  * raw bytes or structured blocks never reach the model prompt.
2650
2660
  */
2651
2661
  export declare function textProjection(result: ToolResult): ToolResult;
2662
+ /** The language a Forja engine runs. */
2663
+ export type EngineLanguage = "javascript" | "python";
2664
+ /** Stable identifier of a Forja execution engine. */
2665
+ export type EngineId = "javascript-quickjs" | "python-managed" | "python-oci" | "python-wasm";
2666
+ /** Isolation an engine declares and has verified, ordered from the strongest guarantee to none. */
2667
+ export type IsolationLevel = "os-container" | "wasm-isolate" | "wasm-process" | "none";
2668
+ /** What an engine reports about itself. An engine that is not `ready` never runs code. */
2669
+ export interface EngineDescriptor {
2670
+ id: EngineId;
2671
+ language: EngineLanguage;
2672
+ /** Engine build, e.g. `quickjs-wasi@3.6.2` or `cpython-3.12.4`. */
2673
+ version: string;
2674
+ isolation: IsolationLevel;
2675
+ ready: boolean;
2676
+ /** Actionable reason the engine is not ready. */
2677
+ reason?: string;
2678
+ capabilities: {
2679
+ cooperativeInterrupt: boolean;
2680
+ /** The host can terminate the guest without its cooperation. */
2681
+ hardTermination: boolean;
2682
+ hardMemoryLimit: boolean;
2683
+ networkDeniedByOS: boolean;
2684
+ /** The guest can call core tools. */
2685
+ toolCalls: boolean;
2686
+ };
2687
+ /** Package profiles available (Python). */
2688
+ profiles?: string[];
2689
+ }
2690
+ /**
2691
+ * `GET /api/forge`: the Forja engines with their live state. `engines` lists the JavaScript engine
2692
+ * first and then the Python backends (`python-oci`, `python-wasm`, `python-managed`), each with its
2693
+ * isolation, readiness, reason and capabilities (`networkDeniedByOS` comes from a self-probe).
2694
+ */
2695
+ export interface ForgeOverview {
2696
+ engines: EngineDescriptor[];
2697
+ javascript: {
2698
+ verified: boolean;
2699
+ verification?: string;
2700
+ enabled: boolean;
2701
+ host: "worker" | "process";
2702
+ hostSetting: "auto" | "worker" | "process";
2703
+ wasmSha256: string;
2704
+ version: string;
2705
+ limits: {
2706
+ maxSourceBytes: number;
2707
+ timeoutMs: number;
2708
+ memoryBytes: number;
2709
+ stackBytes: number;
2710
+ maxToolCalls: number;
2711
+ maxConcurrency: number;
2712
+ maxCallInputBytes: number;
2713
+ maxCallResponseBytes: number;
2714
+ maxRetainedOutputBytes: number;
2715
+ maxOutputChars: number;
2716
+ };
2717
+ };
2718
+ /** The scratchpad settings (`forge.scratch.*`); the folder is a host path and never listed. */
2719
+ scratch: {
2720
+ enabled: boolean;
2721
+ retentionDays: number;
2722
+ maxBytes: number;
2723
+ };
2724
+ state: {
2725
+ enabled: boolean;
2726
+ };
2727
+ guides: {
2728
+ enabled: boolean;
2729
+ };
2730
+ /** Python settings only the user decides, read only: `analysis.runtime` and `analysis.isolation`. */
2731
+ python?: {
2732
+ runtime: "auto" | "managed" | "oci" | "wasm";
2733
+ isolation: "preferred" | "required" | "strict";
2734
+ };
2735
+ }
2736
+ /** One file of a session's scratchpad (`GET /api/sessions/:sid/scratch`); never an absolute path. */
2737
+ export interface ScratchFile {
2738
+ /** Path relative to the scratchpad, `/`-separated; also the tail of the download URL. */
2739
+ name: string;
2740
+ /** Bytes. */
2741
+ size: number;
2742
+ /** Last modification, ms epoch. */
2743
+ mtime: number;
2744
+ }
2745
+ /** Answer of `GET /api/sessions/:sid/scratch`. */
2746
+ export interface ScratchListing {
2747
+ /** False while Forja's JavaScript engine or its scratchpad is off: there is nothing to list. */
2748
+ available: boolean;
2749
+ files: ScratchFile[];
2750
+ /** Bytes the quota counts (`forge.scratch.maxBytes`), symlinks as links. */
2751
+ usedBytes: number;
2752
+ quotaBytes: number;
2753
+ /** The list was cut at 2 000 files; `usedBytes` still counts all of them. */
2754
+ truncated?: boolean;
2755
+ }
2756
+ /** Answer of `DELETE /api/sessions/:sid/scratch`. */
2757
+ export interface ScratchClearResult {
2758
+ /** Files (and links) removed. */
2759
+ removed: number;
2760
+ freedBytes: number;
2761
+ }
2762
+ /** Typed payload of a `tool_progress` event emitted by a Forja execution. */
2763
+ export interface ForgeProgress {
2764
+ kind: "forge";
2765
+ executionId: string;
2766
+ engine: EngineId;
2767
+ phase: "preparing" | "running" | "call" | "collecting";
2768
+ message?: string;
2769
+ completed?: number;
2770
+ total?: number;
2771
+ call?: {
2772
+ callId: number;
2773
+ tool: string;
2774
+ status: "started" | "succeeded" | "failed" | "denied";
2775
+ durationMs?: number;
2776
+ };
2777
+ }
2652
2778
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alisio/sdk",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
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",