@intentic/extension-api 1.326.0 → 1.327.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.
package/src/stream.ts CHANGED
@@ -1,64 +1,13 @@
1
- // Reads a daemon SSE/ndjson stream: reframes blank-line-separated `data: <JSON>` frames and parses each. Pure
2
- // (ReadableStream in, async records out), no deps.
1
+ import { sseData, sseFrames } from "@intentic/sandbox-contract";
3
2
 
4
- // A live daemon heartbeats over the stream at least this often; no bytes for this long means the connection is dead.
5
- const SSE_IDLE_MS = 120_000;
6
-
7
- // Yields each raw SSE frame, reassembling frames split across chunks; ends (cancelling the reader) after SSE_IDLE_MS of
8
- // silence.
9
- async function* sseFrames(body: ReadableStream<Uint8Array>): AsyncGenerator<string> {
10
- const reader = body.getReader();
11
- const decoder = new TextDecoder();
12
- let buffer = "";
13
- try {
14
- for (;;) {
15
- let timer: ReturnType<typeof setTimeout>;
16
- const idle = new Promise<"idle">((resolve) => {
17
- timer = setTimeout(() => resolve("idle"), SSE_IDLE_MS);
18
- });
19
- const result = await Promise.race([reader.read(), idle]);
20
- clearTimeout(timer!);
21
- if (result === "idle") {
22
- return; // daemon went silent past the heartbeat window: end rather than hang
23
- }
24
- const { done, value } = result;
25
- if (done) {
26
- break;
27
- }
28
- buffer += decoder.decode(value, { stream: true });
29
- let separator = buffer.indexOf("\n\n");
30
- while (separator !== -1) {
31
- yield buffer.slice(0, separator);
32
- buffer = buffer.slice(separator + 2);
33
- separator = buffer.indexOf("\n\n");
34
- }
35
- }
36
- } finally {
37
- await reader.cancel().catch(() => {});
38
- }
39
- }
40
-
41
- const dataOf = (frame: string): unknown => {
42
- const line = frame.split("\n").find((entry) => entry.startsWith("data:"));
43
- if (line === undefined) {
44
- return undefined;
45
- }
46
- const payload = line.slice(5).trim();
47
- if (payload.length === 0) {
48
- return undefined;
49
- }
50
- try {
51
- return JSON.parse(payload);
52
- } catch {
53
- return undefined;
54
- }
55
- };
3
+ // Reads a daemon SSE/ndjson stream: reframes blank-line-separated `data: <JSON>` frames and parses each, through the
4
+ // contract's one SSE reader, which ends a stream silent past its heartbeat window rather than hanging on it.
56
5
 
57
6
  // Reads a daemon stream as parsed ndjson records. An `event: error` frame becomes a `{ kind: "error", message }`
58
7
  // record; malformed frames are skipped.
59
8
  export async function* readDaemonStream(body: ReadableStream<Uint8Array>): AsyncGenerator<Record<string, unknown>> {
60
9
  for await (const frame of sseFrames(body)) {
61
- const parsed = dataOf(frame);
10
+ const parsed = sseData(frame);
62
11
  if (typeof parsed !== "object" || parsed === null) {
63
12
  continue;
64
13
  }
package/src/surface.json CHANGED
@@ -2276,5 +2276,487 @@
2276
2276
  "sandboxValue",
2277
2277
  "satisfiesEngines"
2278
2278
  ]
2279
+ },
2280
+ "2.24.0": {
2281
+ "manifest": [
2282
+ "$schema",
2283
+ "art",
2284
+ "category",
2285
+ "contributes",
2286
+ "engines",
2287
+ "entry",
2288
+ "icon",
2289
+ "logo",
2290
+ "name",
2291
+ "permissions",
2292
+ "publisher",
2293
+ "server",
2294
+ "version"
2295
+ ],
2296
+ "contributes": [
2297
+ "agent",
2298
+ "automationTemplates",
2299
+ "bin",
2300
+ "capabilities",
2301
+ "commands",
2302
+ "documents",
2303
+ "environment",
2304
+ "files",
2305
+ "listener",
2306
+ "processes",
2307
+ "settings",
2308
+ "sideViews",
2309
+ "tools",
2310
+ "viewers",
2311
+ "views"
2312
+ ],
2313
+ "api": [
2314
+ "apiVersion",
2315
+ "audience",
2316
+ "backend",
2317
+ "chat",
2318
+ "commands",
2319
+ "documents",
2320
+ "href",
2321
+ "models",
2322
+ "navigate",
2323
+ "processes",
2324
+ "route",
2325
+ "sandbox",
2326
+ "settings",
2327
+ "sideViews",
2328
+ "terminal",
2329
+ "theme",
2330
+ "viewers",
2331
+ "views",
2332
+ "workspace"
2333
+ ],
2334
+ "listener": [
2335
+ "automation",
2336
+ "events",
2337
+ "provider"
2338
+ ],
2339
+ "sandboxApi": [
2340
+ "fetch",
2341
+ "json",
2342
+ "key",
2343
+ "origin",
2344
+ "previewAddress",
2345
+ "reachable",
2346
+ "request",
2347
+ "role",
2348
+ "rpc"
2349
+ ],
2350
+ "workspaceApi": [
2351
+ "capabilities",
2352
+ "file",
2353
+ "fillDiff",
2354
+ "inProject",
2355
+ "onDidChange",
2356
+ "onDidChangeFiles",
2357
+ "onDidChangeProject",
2358
+ "onDidChangeRefs",
2359
+ "onDidChangeRepos",
2360
+ "openDiff",
2361
+ "project",
2362
+ "readJson",
2363
+ "repos",
2364
+ "setProject",
2365
+ "write"
2366
+ ],
2367
+ "chatApi": [
2368
+ "composeLoop",
2369
+ "composeWorkflow",
2370
+ "openAgent",
2371
+ "openSession"
2372
+ ],
2373
+ "daemonApi": [
2374
+ "json",
2375
+ "request",
2376
+ "rpc"
2377
+ ],
2378
+ "serverApi": [
2379
+ "apiVersion",
2380
+ "daemon",
2381
+ "extensionDir",
2382
+ "log",
2383
+ "routes",
2384
+ "tools",
2385
+ "workspaceRoot"
2386
+ ],
2387
+ "toolDefinition": [
2388
+ "call",
2389
+ "description",
2390
+ "effect",
2391
+ "inputSchema",
2392
+ "name"
2393
+ ],
2394
+ "sideViewsApi": [
2395
+ "open",
2396
+ "register"
2397
+ ],
2398
+ "sideViewRegistration": [
2399
+ "claim",
2400
+ "describe",
2401
+ "home",
2402
+ "id",
2403
+ "view"
2404
+ ],
2405
+ "viewRegistration": [
2406
+ "asks",
2407
+ "auxiliary",
2408
+ "badge",
2409
+ "detect",
2410
+ "fallback",
2411
+ "id",
2412
+ "label",
2413
+ "surface",
2414
+ "view",
2415
+ "warm"
2416
+ ],
2417
+ "manifestSchema": "935fea10d86aeae7414648f1720f2886c83d0dc504a5093c044930bfa2e51071",
2418
+ "moduleExports": [
2419
+ "conversions",
2420
+ "extensionApiVersion",
2421
+ "flattenQuery",
2422
+ "hostSlot",
2423
+ "mergeQuery",
2424
+ "readDaemonStream",
2425
+ "resetSandboxScope",
2426
+ "sandboxDocument",
2427
+ "sandboxLedger",
2428
+ "sandboxPoll",
2429
+ "sandboxRef",
2430
+ "sandboxScopeGuard",
2431
+ "sandboxShallowRef",
2432
+ "sandboxValue",
2433
+ "satisfiesEngines"
2434
+ ]
2435
+ },
2436
+ "2.25.0": {
2437
+ "manifest": [
2438
+ "$schema",
2439
+ "art",
2440
+ "category",
2441
+ "contributes",
2442
+ "engines",
2443
+ "entry",
2444
+ "icon",
2445
+ "logo",
2446
+ "name",
2447
+ "permissions",
2448
+ "publisher",
2449
+ "server",
2450
+ "version"
2451
+ ],
2452
+ "contributes": [
2453
+ "agent",
2454
+ "automationTemplates",
2455
+ "bin",
2456
+ "capabilities",
2457
+ "commands",
2458
+ "documents",
2459
+ "environment",
2460
+ "files",
2461
+ "listener",
2462
+ "processes",
2463
+ "settings",
2464
+ "sideViews",
2465
+ "tools",
2466
+ "viewers",
2467
+ "views"
2468
+ ],
2469
+ "api": [
2470
+ "apiVersion",
2471
+ "audience",
2472
+ "backend",
2473
+ "chat",
2474
+ "commands",
2475
+ "documents",
2476
+ "href",
2477
+ "models",
2478
+ "navigate",
2479
+ "processes",
2480
+ "route",
2481
+ "sandbox",
2482
+ "settings",
2483
+ "sideViews",
2484
+ "terminal",
2485
+ "theme",
2486
+ "viewers",
2487
+ "views",
2488
+ "workspace"
2489
+ ],
2490
+ "listener": [
2491
+ "automation",
2492
+ "events",
2493
+ "provider"
2494
+ ],
2495
+ "sandboxApi": [
2496
+ "fetch",
2497
+ "json",
2498
+ "key",
2499
+ "origin",
2500
+ "previewAddress",
2501
+ "reachable",
2502
+ "request",
2503
+ "role",
2504
+ "rpc"
2505
+ ],
2506
+ "workspaceApi": [
2507
+ "capabilities",
2508
+ "file",
2509
+ "fillDiff",
2510
+ "inProject",
2511
+ "onDidChange",
2512
+ "onDidChangeFiles",
2513
+ "onDidChangeProject",
2514
+ "onDidChangeRefs",
2515
+ "onDidChangeRepos",
2516
+ "openDiff",
2517
+ "project",
2518
+ "readJson",
2519
+ "repos",
2520
+ "setProject",
2521
+ "write"
2522
+ ],
2523
+ "chatApi": [
2524
+ "composeLoop",
2525
+ "composeWorkflow",
2526
+ "openAgent",
2527
+ "openSession"
2528
+ ],
2529
+ "daemonApi": [
2530
+ "json",
2531
+ "request",
2532
+ "rpc"
2533
+ ],
2534
+ "serverApi": [
2535
+ "apiVersion",
2536
+ "daemon",
2537
+ "extensionDir",
2538
+ "log",
2539
+ "routes",
2540
+ "tools",
2541
+ "workspaceRoot"
2542
+ ],
2543
+ "toolDefinition": [
2544
+ "call",
2545
+ "description",
2546
+ "effect",
2547
+ "inputSchema",
2548
+ "name"
2549
+ ],
2550
+ "sideViewsApi": [
2551
+ "open",
2552
+ "register"
2553
+ ],
2554
+ "sideViewRegistration": [
2555
+ "claim",
2556
+ "describe",
2557
+ "home",
2558
+ "id",
2559
+ "view"
2560
+ ],
2561
+ "viewRegistration": [
2562
+ "asks",
2563
+ "auxiliary",
2564
+ "badge",
2565
+ "detect",
2566
+ "fallback",
2567
+ "id",
2568
+ "label",
2569
+ "surface",
2570
+ "view",
2571
+ "warm"
2572
+ ],
2573
+ "manifestSchema": "752538b92724e78fe88bc4749fee773aa2c1a480053c42ea2643226a32b2181a",
2574
+ "moduleExports": [
2575
+ "conversions",
2576
+ "extensionApiVersion",
2577
+ "flattenQuery",
2578
+ "hostSlot",
2579
+ "mergeQuery",
2580
+ "readDaemonStream",
2581
+ "resetSandboxScope",
2582
+ "sandboxDocument",
2583
+ "sandboxLedger",
2584
+ "sandboxPoll",
2585
+ "sandboxRef",
2586
+ "sandboxScopeGuard",
2587
+ "sandboxShallowRef",
2588
+ "sandboxValue",
2589
+ "satisfiesEngines"
2590
+ ]
2591
+ },
2592
+ "2.26.0": {
2593
+ "manifest": [
2594
+ "$schema",
2595
+ "art",
2596
+ "category",
2597
+ "contributes",
2598
+ "engines",
2599
+ "entry",
2600
+ "icon",
2601
+ "logo",
2602
+ "name",
2603
+ "permissions",
2604
+ "publisher",
2605
+ "server",
2606
+ "version"
2607
+ ],
2608
+ "contributes": [
2609
+ "agent",
2610
+ "automationTemplates",
2611
+ "bin",
2612
+ "capabilities",
2613
+ "commands",
2614
+ "documents",
2615
+ "environment",
2616
+ "files",
2617
+ "listener",
2618
+ "processes",
2619
+ "settings",
2620
+ "sideViews",
2621
+ "tools",
2622
+ "viewers",
2623
+ "views"
2624
+ ],
2625
+ "api": [
2626
+ "apiVersion",
2627
+ "audience",
2628
+ "backend",
2629
+ "chat",
2630
+ "commands",
2631
+ "documents",
2632
+ "href",
2633
+ "models",
2634
+ "navigate",
2635
+ "processes",
2636
+ "route",
2637
+ "sandbox",
2638
+ "settings",
2639
+ "sideViews",
2640
+ "terminal",
2641
+ "theme",
2642
+ "viewers",
2643
+ "views",
2644
+ "workspace"
2645
+ ],
2646
+ "listener": [
2647
+ "automation",
2648
+ "events",
2649
+ "provider"
2650
+ ],
2651
+ "sandboxApi": [
2652
+ "fetch",
2653
+ "json",
2654
+ "key",
2655
+ "origin",
2656
+ "previewAddress",
2657
+ "reachable",
2658
+ "request",
2659
+ "role",
2660
+ "rpc"
2661
+ ],
2662
+ "workspaceApi": [
2663
+ "capabilities",
2664
+ "file",
2665
+ "fillDiff",
2666
+ "inProject",
2667
+ "onDidChange",
2668
+ "onDidChangeFiles",
2669
+ "onDidChangeProject",
2670
+ "onDidChangeRefs",
2671
+ "onDidChangeRepos",
2672
+ "openDiff",
2673
+ "project",
2674
+ "readJson",
2675
+ "repos",
2676
+ "setProject",
2677
+ "write"
2678
+ ],
2679
+ "chatApi": [
2680
+ "composeLoop",
2681
+ "composeWorkflow",
2682
+ "openAgent",
2683
+ "openSession"
2684
+ ],
2685
+ "daemonApi": [
2686
+ "json",
2687
+ "request",
2688
+ "rpc"
2689
+ ],
2690
+ "serverApi": [
2691
+ "apiVersion",
2692
+ "cacheDir",
2693
+ "daemon",
2694
+ "document",
2695
+ "extensionDir",
2696
+ "log",
2697
+ "routes",
2698
+ "settings",
2699
+ "stateDir",
2700
+ "tools",
2701
+ "workspace",
2702
+ "workspaceRoot"
2703
+ ],
2704
+ "toolDefinition": [
2705
+ "call",
2706
+ "description",
2707
+ "effect",
2708
+ "inputSchema",
2709
+ "name"
2710
+ ],
2711
+ "sideViewsApi": [
2712
+ "open",
2713
+ "register"
2714
+ ],
2715
+ "sideViewRegistration": [
2716
+ "claim",
2717
+ "describe",
2718
+ "home",
2719
+ "id",
2720
+ "view"
2721
+ ],
2722
+ "viewRegistration": [
2723
+ "asks",
2724
+ "auxiliary",
2725
+ "badge",
2726
+ "detect",
2727
+ "fallback",
2728
+ "id",
2729
+ "label",
2730
+ "surface",
2731
+ "view",
2732
+ "warm"
2733
+ ],
2734
+ "manifestSchema": "752538b92724e78fe88bc4749fee773aa2c1a480053c42ea2643226a32b2181a",
2735
+ "moduleExports": [
2736
+ "conversions",
2737
+ "extensionApiVersion",
2738
+ "flattenQuery",
2739
+ "hostSlot",
2740
+ "mergeQuery",
2741
+ "readDaemonStream",
2742
+ "resetSandboxScope",
2743
+ "sandboxDocument",
2744
+ "sandboxLedger",
2745
+ "sandboxPoll",
2746
+ "sandboxRef",
2747
+ "sandboxScopeGuard",
2748
+ "sandboxShallowRef",
2749
+ "sandboxValue",
2750
+ "satisfiesEngines"
2751
+ ],
2752
+ "serverSettingsApi": [
2753
+ "get",
2754
+ "onDidChange"
2755
+ ],
2756
+ "serverWorkspaceApi": [
2757
+ "onDidChangeFiles",
2758
+ "onDidChangeRefs",
2759
+ "onDidChangeRepos"
2760
+ ]
2279
2761
  }
2280
2762
  }