@streamoid/agent 0.2.5 → 0.2.7

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/README.md CHANGED
@@ -23,19 +23,6 @@ import "@streamoid/agent/style.css";
23
23
  - **API base:** use a relative base and proxy `/stream-agent/api/v1` to the agent
24
24
  backend from the host (same-origin → cookies flow, no CORS).
25
25
 
26
- ## ⚠️ This package is a prebuilt bundle — do not edit `dist/` here
27
-
28
- The source and build live in the **stream-agent** repo (the chat shell is
29
- ~14,700 lines and is bundled from there). This package only **ships** the built
30
- artifact. To update:
31
-
32
- ```bash
33
- # in stream-agent
34
- cd frontend && npm run build:lib # produces frontend/dist-lib/
35
-
36
- # copy the build into this package, then bump version + publish
37
- cp frontend/dist-lib/{index.js,style.css,index.d.ts} <npm-components>/packages/agent/dist/
38
- cd <npm-components>/packages/agent && npm version <x.y.z> && npm publish
39
- ```
40
-
41
- (Superseded the iframe-backed `0.1.0`; that build's source remains in git history.)
26
+ > This is the **built** package, committed for publish provenance. It is generated
27
+ > from the stream-agent frontend via `npm run build:lib` — do not hand-edit.
28
+ > Rebuild and `npm publish` from this directory.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, ReactElement } from 'react';
1
+ import type { CSSProperties, ReactElement, ReactNode } from 'react';
2
2
 
3
3
  /* Public types for the native @streamoid/agent package.
4
4
  *
@@ -48,6 +48,43 @@ export interface AgentChatShellAdapters {
48
48
  /** Backend recovered after an outage — host decides what to do (must NOT
49
49
  * reload the host window). */
50
50
  onBackendRecovered?: () => void;
51
+ /**
52
+ * Supply the canvas as a component and the Dreamer panel drops its iframe:
53
+ * no embedded page, so no cross-origin auth, no postMessage handshake, no
54
+ * allowed-origins config per environment.
55
+ *
56
+ * The host owns the implementation because it must — the Artifax canvas is
57
+ * consumed cross-repo as SOURCE (a submodule compiled by the host's own Vite,
58
+ * with a forked PixiJS + shader loader), which this prebuilt package cannot
59
+ * import.
60
+ *
61
+ * `projectId` is often the literal `_`, Artifax's "resolve the default
62
+ * project" placeholder. Pass it through verbatim — Artifax's own canvas route
63
+ * does the same.
64
+ *
65
+ * Omit this and the iframe path runs unchanged; it is purely additive.
66
+ */
67
+ canvas?: HostCanvasContextValue;
68
+ }
69
+
70
+ export interface HostCanvasContextValue {
71
+ render(context: {
72
+ workspaceId: string;
73
+ projectId: string;
74
+ documentId: string;
75
+ sessionId: string;
76
+ threadId?: string;
77
+ /** External-session token under the `bridge` prompt transport; the canvas
78
+ * needs it to run the Dreamer agent that executes the chat's commands.
79
+ * Absent under `a2a`, where the Dreamer runs server-side. */
80
+ sessionToken?: string;
81
+ /** Call once the canvas is live and its external-session bridge can receive
82
+ * work. Prompts are HELD until this fires — the backend drives the existing
83
+ * browser session through Artifax A2A and assumes a listener is already
84
+ * subscribed; sending early makes Artifax close the stream and the chat
85
+ * hang. Replaces the iframe's `artifax:iframe-ready` postMessage. */
86
+ onCanvasReady(): void;
87
+ }): ReactNode;
51
88
  }
52
89
 
53
90
  export type AgentPanelAdapters = AgentChatShellAdapters;