@tangle-network/agent-app 0.51.16 → 0.52.1

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.
@@ -4,8 +4,8 @@ import {
4
4
  } from "../chunk-JWLKKF33.js";
5
5
  import "../chunk-FLQMHPTO.js";
6
6
  import "../chunk-3HUFJ5LO.js";
7
- import "../chunk-E4AY62T2.js";
8
7
  import "../chunk-FBVLEGEG.js";
8
+ import "../chunk-E4AY62T2.js";
9
9
  import "../chunk-ENLRJYVW.js";
10
10
  import "../chunk-GEYACSFW.js";
11
11
  import {
@@ -0,0 +1,4 @@
1
+ import type { ChatGPTConnectProps } from './index';
2
+ /** Display-only examples. These are not live enrollment or connection records. */
3
+ export declare const gtmExample: ChatGPTConnectProps;
4
+ export declare const creativeExample: ChatGPTConnectProps;
@@ -0,0 +1,37 @@
1
+ import type { AgentEnrollmentIdentity } from '../agent-enrollment/index';
2
+ /** The public display fields from chatgpt-agents-kit's AgentAppDescription. */
3
+ export interface ChatGPTAppMetadata {
4
+ name: string;
5
+ displayName: string;
6
+ description: string;
7
+ }
8
+ /** Supplied by the host from a real registered ChatGPT connection. Never derived from an endpoint. */
9
+ export interface ChatGPTRegisteredConnection {
10
+ id: string;
11
+ url: string;
12
+ }
13
+ /** Only the host can confirm connection state for its current authenticated user. */
14
+ export type ChatGPTConnectionState = {
15
+ status: 'not-connected';
16
+ } | {
17
+ status: 'checking';
18
+ } | {
19
+ status: 'connected';
20
+ } | {
21
+ status: 'error';
22
+ message: string;
23
+ };
24
+ export interface ChatGPTConnectProps {
25
+ app: ChatGPTAppMetadata;
26
+ /** Public MCP resource URL advertised by the app's existing kit endpoint. */
27
+ endpoint: string;
28
+ /** Existing authorized native enrollment; this component never provisions one. */
29
+ enrollment: AgentEnrollmentIdentity;
30
+ registeredConnection?: ChatGPTRegisteredConnection;
31
+ state: ChatGPTConnectionState;
32
+ /** Host refreshes state through its existing authenticated route. No check is inferred from opening a link. */
33
+ onCheck?: () => void;
34
+ className?: string;
35
+ }
36
+ /** Browser-only presentation: no enrollment, OAuth, connection discovery or local persistence. */
37
+ export declare function ChatGPTConnect(props: ChatGPTConnectProps): import("react").JSX.Element;
@@ -0,0 +1,148 @@
1
+ // src/chatgpt-react/index.tsx
2
+ import { useId, useState } from "react";
3
+ import { Button, Input } from "@tangle-network/ui/primitives";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ var pluginsUrl = "https://chatgpt.com/plugins";
6
+ var guideUrl = "https://developers.openai.com/plugins/deploy/connect-chatgpt";
7
+ function httpsUrl(value) {
8
+ try {
9
+ const url = new URL(value);
10
+ if (url.protocol === "https:" && !url.username && !url.password) return url;
11
+ } catch {
12
+ }
13
+ return void 0;
14
+ }
15
+ function ChatGPTConnect(props) {
16
+ const { enrollment, app, endpoint, registeredConnection } = props;
17
+ const key = JSON.stringify([
18
+ enrollment.enrollmentId,
19
+ enrollment.agentId,
20
+ enrollment.workspaceId,
21
+ enrollment.threadId,
22
+ app.name,
23
+ endpoint,
24
+ registeredConnection?.id,
25
+ registeredConnection?.url
26
+ ]);
27
+ return /* @__PURE__ */ jsx(ConnectSurface, { ...props }, key);
28
+ }
29
+ function ConnectSurface({ app, endpoint, enrollment, registeredConnection, state, onCheck, className }) {
30
+ const id = useId();
31
+ const [showSetup, setShowSetup] = useState(false);
32
+ const [copyNotice, setCopyNotice] = useState("");
33
+ const resourceUrl = httpsUrl(endpoint);
34
+ const resource = resourceUrl && !resourceUrl.search && !resourceUrl.hash;
35
+ const registeredUrl = registeredConnection?.id.trim() ? httpsUrl(registeredConnection.url) : void 0;
36
+ const connectionUrl = registeredUrl?.hostname === "chatgpt.com" && !registeredUrl.port ? registeredUrl.href : void 0;
37
+ const checking = state.status === "checking";
38
+ const connected = state.status === "connected";
39
+ const status = checking ? "Checking connection\u2026" : connected ? "Connected to ChatGPT" : state.status === "error" ? state.message : "Ready to connect";
40
+ async function copyEndpoint() {
41
+ try {
42
+ await navigator.clipboard.writeText(endpoint);
43
+ setCopyNotice("MCP URL copied");
44
+ } catch {
45
+ setCopyNotice("Select the MCP URL and copy it manually.");
46
+ }
47
+ }
48
+ return /* @__PURE__ */ jsxs("section", { className: `tangle-chatgpt ${className ?? ""}`, "aria-labelledby": `${id}-heading`, children: [
49
+ /* @__PURE__ */ jsxs("div", { className: "tangle-chatgpt__heading", children: [
50
+ /* @__PURE__ */ jsxs("div", { children: [
51
+ /* @__PURE__ */ jsx("span", { className: "tangle-chatgpt__eyebrow", children: app.displayName }),
52
+ /* @__PURE__ */ jsx("h2", { id: `${id}-heading`, children: "Your agent, in ChatGPT" })
53
+ ] }),
54
+ /* @__PURE__ */ jsx("span", { className: "tangle-chatgpt__badge", children: "ChatGPT" })
55
+ ] }),
56
+ /* @__PURE__ */ jsx("p", { className: "tangle-chatgpt__description", children: app.description }),
57
+ /* @__PURE__ */ jsx("p", { role: state.status === "error" ? "alert" : "status", "aria-busy": checking, className: "tangle-chatgpt__status", children: status }),
58
+ /* @__PURE__ */ jsxs("div", { className: "tangle-chatgpt__actions", children: [
59
+ connectionUrl || connected ? /* @__PURE__ */ jsx(Button, { asChild: true, className: "tangle-chatgpt__primary", children: /* @__PURE__ */ jsxs("a", { href: connectionUrl ?? pluginsUrl, target: "_blank", rel: "noopener noreferrer", children: [
60
+ connected ? connectionUrl ? "Open in ChatGPT" : "Open ChatGPT plugins" : "Connect to ChatGPT",
61
+ " ",
62
+ /* @__PURE__ */ jsx("span", { className: "tangle-chatgpt__sr-only", children: "(opens a new tab)" })
63
+ ] }) }) : /* @__PURE__ */ jsx(
64
+ Button,
65
+ {
66
+ type: "button",
67
+ className: "tangle-chatgpt__primary",
68
+ disabled: checking || !resource,
69
+ "aria-expanded": showSetup,
70
+ "aria-controls": `${id}-setup`,
71
+ onClick: () => setShowSetup(!showSetup),
72
+ children: "Connect to ChatGPT"
73
+ }
74
+ ),
75
+ onCheck && /* @__PURE__ */ jsx(
76
+ Button,
77
+ {
78
+ type: "button",
79
+ variant: "outline",
80
+ className: "tangle-chatgpt__secondary",
81
+ disabled: checking,
82
+ onClick: onCheck,
83
+ children: checking ? "Checking\u2026" : "Check connection"
84
+ }
85
+ )
86
+ ] }),
87
+ /* @__PURE__ */ jsxs("details", { className: "tangle-chatgpt__details", children: [
88
+ /* @__PURE__ */ jsx("summary", { children: "Connection details" }),
89
+ /* @__PURE__ */ jsxs("dl", { className: "tangle-chatgpt__identity", children: [
90
+ /* @__PURE__ */ jsxs("div", { children: [
91
+ /* @__PURE__ */ jsx("dt", { children: "Agent" }),
92
+ /* @__PURE__ */ jsx("dd", { children: enrollment.agentId })
93
+ ] }),
94
+ /* @__PURE__ */ jsxs("div", { children: [
95
+ /* @__PURE__ */ jsx("dt", { children: "Workspace" }),
96
+ /* @__PURE__ */ jsx("dd", { children: enrollment.workspaceId })
97
+ ] })
98
+ ] })
99
+ ] }),
100
+ !resource && /* @__PURE__ */ jsx("p", { role: "alert", children: "A public HTTPS MCP URL without credentials, query parameters or a fragment is required. Contact your app administrator." }),
101
+ resource && (connectionUrl || connected) && /* @__PURE__ */ jsx(
102
+ "button",
103
+ {
104
+ type: "button",
105
+ className: "tangle-chatgpt__text-action",
106
+ "aria-expanded": showSetup,
107
+ "aria-controls": `${id}-setup`,
108
+ onClick: () => setShowSetup(!showSetup),
109
+ children: "Connection setup"
110
+ }
111
+ ),
112
+ resource && showSetup && /* @__PURE__ */ jsxs("div", { id: `${id}-setup`, className: "tangle-chatgpt__setup", children: [
113
+ /* @__PURE__ */ jsxs("h3", { children: [
114
+ "Set up ",
115
+ app.displayName
116
+ ] }),
117
+ /* @__PURE__ */ jsxs("ol", { children: [
118
+ /* @__PURE__ */ jsxs("li", { children: [
119
+ "In ChatGPT settings, open ",
120
+ /* @__PURE__ */ jsx("strong", { children: "Security and login" }),
121
+ " and enable ",
122
+ /* @__PURE__ */ jsx("strong", { children: "Developer mode" }),
123
+ ". Availability depends on your account and workspace."
124
+ ] }),
125
+ /* @__PURE__ */ jsxs("li", { children: [
126
+ "Open ",
127
+ /* @__PURE__ */ jsx("a", { href: pluginsUrl, target: "_blank", rel: "noopener noreferrer", children: "ChatGPT Plugins (new tab)" }),
128
+ ", select the plus button, and enter this app\u2019s name, description and MCP URL."
129
+ ] }),
130
+ /* @__PURE__ */ jsx("li", { children: "Complete the sign-in and review the available tools. Start a new chat and select the connection from the tools menu." })
131
+ ] }),
132
+ /* @__PURE__ */ jsx("label", { htmlFor: `${id}-url`, children: "MCP URL" }),
133
+ /* @__PURE__ */ jsxs("div", { className: "tangle-chatgpt__endpoint", children: [
134
+ /* @__PURE__ */ jsx(Input, { id: `${id}-url`, readOnly: true, value: endpoint, onFocus: (event) => event.currentTarget.select() }),
135
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", className: "tangle-chatgpt__secondary", onClick: () => {
136
+ void copyEndpoint();
137
+ }, children: "Copy URL" })
138
+ ] }),
139
+ /* @__PURE__ */ jsx("p", { role: "status", className: "tangle-chatgpt__copy-notice", children: copyNotice }),
140
+ /* @__PURE__ */ jsx("p", { children: "Sign in with the account you use for this workspace." }),
141
+ /* @__PURE__ */ jsx("a", { href: guideUrl, target: "_blank", rel: "noopener noreferrer", children: "OpenAI setup guide (new tab)" })
142
+ ] })
143
+ ] });
144
+ }
145
+ export {
146
+ ChatGPTConnect
147
+ };
148
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/chatgpt-react/index.tsx"],"sourcesContent":["import { useId, useState } from 'react'\nimport { Button, Input } from '@tangle-network/ui/primitives'\nimport type { AgentEnrollmentIdentity } from '../agent-enrollment/index'\n\n/** The public display fields from chatgpt-agents-kit's AgentAppDescription. */\nexport interface ChatGPTAppMetadata {\n name: string\n displayName: string\n description: string\n}\n\n/** Supplied by the host from a real registered ChatGPT connection. Never derived from an endpoint. */\nexport interface ChatGPTRegisteredConnection {\n id: string\n url: string\n}\n\n/** Only the host can confirm connection state for its current authenticated user. */\nexport type ChatGPTConnectionState =\n | { status: 'not-connected' }\n | { status: 'checking' }\n | { status: 'connected' }\n | { status: 'error'; message: string }\n\nexport interface ChatGPTConnectProps {\n app: ChatGPTAppMetadata\n /** Public MCP resource URL advertised by the app's existing kit endpoint. */\n endpoint: string\n /** Existing authorized native enrollment; this component never provisions one. */\n enrollment: AgentEnrollmentIdentity\n registeredConnection?: ChatGPTRegisteredConnection\n state: ChatGPTConnectionState\n /** Host refreshes state through its existing authenticated route. No check is inferred from opening a link. */\n onCheck?: () => void\n className?: string\n}\n\nconst pluginsUrl = 'https://chatgpt.com/plugins'\nconst guideUrl = 'https://developers.openai.com/plugins/deploy/connect-chatgpt'\n\nfunction httpsUrl(value: string): URL | undefined {\n try {\n const url = new URL(value)\n if (url.protocol === 'https:' && !url.username && !url.password) return url\n } catch { /* Configuration errors render a recoverable setup message below. */ }\n return undefined\n}\n\n/** Browser-only presentation: no enrollment, OAuth, connection discovery or local persistence. */\nexport function ChatGPTConnect(props: ChatGPTConnectProps) {\n const { enrollment, app, endpoint, registeredConnection } = props\n // A workspace/agent/endpoint switch must not retain the previous setup or clipboard notice.\n const key = JSON.stringify([enrollment.enrollmentId, enrollment.agentId, enrollment.workspaceId,\n enrollment.threadId, app.name, endpoint, registeredConnection?.id, registeredConnection?.url])\n return <ConnectSurface key={key} {...props} />\n}\n\nfunction ConnectSurface({ app, endpoint, enrollment, registeredConnection, state, onCheck, className }: ChatGPTConnectProps) {\n const id = useId()\n const [showSetup, setShowSetup] = useState(false)\n const [copyNotice, setCopyNotice] = useState('')\n const resourceUrl = httpsUrl(endpoint)\n const resource = resourceUrl && !resourceUrl.search && !resourceUrl.hash\n const registeredUrl = registeredConnection?.id.trim() ? httpsUrl(registeredConnection.url) : undefined\n const connectionUrl = registeredUrl?.hostname === 'chatgpt.com' && !registeredUrl.port ? registeredUrl.href : undefined\n const checking = state.status === 'checking'\n const connected = state.status === 'connected'\n const status = checking ? 'Checking connection…' : connected ? 'Connected to ChatGPT'\n : state.status === 'error' ? state.message : 'Ready to connect'\n\n async function copyEndpoint() {\n try {\n await navigator.clipboard.writeText(endpoint)\n setCopyNotice('MCP URL copied')\n } catch {\n setCopyNotice('Select the MCP URL and copy it manually.')\n }\n }\n\n return <section className={`tangle-chatgpt ${className ?? ''}`} aria-labelledby={`${id}-heading`}>\n <div className=\"tangle-chatgpt__heading\">\n <div>\n <span className=\"tangle-chatgpt__eyebrow\">{app.displayName}</span>\n <h2 id={`${id}-heading`}>Your agent, in ChatGPT</h2>\n </div>\n <span className=\"tangle-chatgpt__badge\">ChatGPT</span>\n </div>\n <p className=\"tangle-chatgpt__description\">{app.description}</p>\n <p role={state.status === 'error' ? 'alert' : 'status'} aria-busy={checking} className=\"tangle-chatgpt__status\">{status}</p>\n <div className=\"tangle-chatgpt__actions\">\n {connectionUrl || connected ? <Button asChild className=\"tangle-chatgpt__primary\">\n <a href={connectionUrl ?? pluginsUrl} target=\"_blank\" rel=\"noopener noreferrer\">\n {connected ? (connectionUrl ? 'Open in ChatGPT' : 'Open ChatGPT plugins') : 'Connect to ChatGPT'}{' '}<span className=\"tangle-chatgpt__sr-only\">(opens a new tab)</span>\n </a>\n </Button> : <Button type=\"button\" className=\"tangle-chatgpt__primary\" disabled={checking || !resource}\n aria-expanded={showSetup} aria-controls={`${id}-setup`} onClick={() => setShowSetup(!showSetup)}>\n Connect to ChatGPT\n </Button>}\n {onCheck && <Button type=\"button\" variant=\"outline\" className=\"tangle-chatgpt__secondary\" disabled={checking}\n onClick={onCheck}>{checking ? 'Checking…' : 'Check connection'}</Button>}\n </div>\n <details className=\"tangle-chatgpt__details\">\n <summary>Connection details</summary>\n <dl className=\"tangle-chatgpt__identity\">\n <div><dt>Agent</dt><dd>{enrollment.agentId}</dd></div>\n <div><dt>Workspace</dt><dd>{enrollment.workspaceId}</dd></div>\n </dl>\n </details>\n {!resource && <p role=\"alert\">A public HTTPS MCP URL without credentials, query parameters or a fragment is required. Contact your app administrator.</p>}\n {resource && (connectionUrl || connected) && <button type=\"button\" className=\"tangle-chatgpt__text-action\"\n aria-expanded={showSetup} aria-controls={`${id}-setup`} onClick={() => setShowSetup(!showSetup)}>Connection setup</button>}\n {resource && showSetup && <div id={`${id}-setup`} className=\"tangle-chatgpt__setup\">\n <h3>Set up {app.displayName}</h3>\n <ol>\n <li>In ChatGPT settings, open <strong>Security and login</strong> and enable <strong>Developer mode</strong>. Availability depends on your account and workspace.</li>\n <li>Open <a href={pluginsUrl} target=\"_blank\" rel=\"noopener noreferrer\">ChatGPT Plugins (new tab)</a>, select the plus button, and enter this app’s name, description and MCP URL.</li>\n <li>Complete the sign-in and review the available tools. Start a new chat and select the connection from the tools menu.</li>\n </ol>\n <label htmlFor={`${id}-url`}>MCP URL</label>\n <div className=\"tangle-chatgpt__endpoint\">\n <Input id={`${id}-url`} readOnly value={endpoint} onFocus={event => event.currentTarget.select()} />\n <Button type=\"button\" variant=\"outline\" className=\"tangle-chatgpt__secondary\" onClick={() => { void copyEndpoint() }}>Copy URL</Button>\n </div>\n <p role=\"status\" className=\"tangle-chatgpt__copy-notice\">{copyNotice}</p>\n <p>Sign in with the account you use for this workspace.</p>\n <a href={guideUrl} target=\"_blank\" rel=\"noopener noreferrer\">OpenAI setup guide (new tab)</a>\n </div>}\n </section>\n}\n"],"mappings":";AAAA,SAAS,OAAO,gBAAgB;AAChC,SAAS,QAAQ,aAAa;AAqDrB,cA2BH,YA3BG;AAjBT,IAAM,aAAa;AACnB,IAAM,WAAW;AAEjB,SAAS,SAAS,OAAgC;AAChD,MAAI;AACF,UAAM,MAAM,IAAI,IAAI,KAAK;AACzB,QAAI,IAAI,aAAa,YAAY,CAAC,IAAI,YAAY,CAAC,IAAI,SAAU,QAAO;AAAA,EAC1E,QAAQ;AAAA,EAAuE;AAC/E,SAAO;AACT;AAGO,SAAS,eAAe,OAA4B;AACzD,QAAM,EAAE,YAAY,KAAK,UAAU,qBAAqB,IAAI;AAE5D,QAAM,MAAM,KAAK,UAAU;AAAA,IAAC,WAAW;AAAA,IAAc,WAAW;AAAA,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border: 1px solid hsl(var(--border)); border-radius: var(--radius, .75rem); padding: clamp(1.25rem, 4vw, 2rem); color: hsl(var(--foreground)); background: hsl(var(--card)); font-family: var(--font-sans, sans-serif); font-size: .9375rem; line-height: 1.5; }
2
+ .tangle-chatgpt * { box-sizing: border-box; }
3
+ .tangle-chatgpt h2, .tangle-chatgpt h3, .tangle-chatgpt p { margin: 0; }
4
+ .tangle-chatgpt h2 { margin-top: .25rem; font-size: clamp(1.375rem, 4vw, 1.75rem); line-height: 1.2; letter-spacing: -.025em; font-weight: 650; }
5
+ .tangle-chatgpt h3 { font-size: 1rem; font-weight: 650; }
6
+ .tangle-chatgpt__heading { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 1rem; }
7
+ .tangle-chatgpt__eyebrow, .tangle-chatgpt__identity dt { color: hsl(var(--muted-foreground)); font-size: .8125rem; }
8
+ .tangle-chatgpt__badge { padding: .25rem .6rem; background: hsl(var(--muted)); border-radius: .4rem; font-size: .8125rem; font-weight: 600; }
9
+ .tangle-chatgpt .tangle-chatgpt__description { margin-top: 1rem; color: hsl(var(--muted-foreground)); }
10
+ .tangle-chatgpt__identity { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1.5rem 0; padding: 1rem 0; border-block: 1px solid hsl(var(--border)); }
11
+ .tangle-chatgpt__identity dd { margin: .25rem 0 0; overflow-wrap: anywhere; font-size: .875rem; }
12
+ .tangle-chatgpt .tangle-chatgpt__status { margin: 1.25rem 0 .75rem; font-weight: 550; }
13
+ .tangle-chatgpt__actions, .tangle-chatgpt__endpoint { display: flex; flex-wrap: wrap; gap: .625rem; align-items: center; }
14
+ .tangle-chatgpt :is(button, input) { font: inherit; }
15
+ .tangle-chatgpt :is(.tangle-chatgpt__primary, .tangle-chatgpt__secondary) { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: .625rem 1rem; border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius, .75rem) - 2px); font-weight: 600; font-size: .875rem; text-decoration: none; cursor: pointer; }
16
+ .tangle-chatgpt .tangle-chatgpt__primary { color: hsl(var(--primary-foreground)); background: hsl(var(--primary)); border-color: transparent; }
17
+ .tangle-chatgpt .tangle-chatgpt__secondary { background: hsl(var(--card)); color: hsl(var(--foreground)); }
18
+ .tangle-chatgpt :is(button, a):disabled { opacity: .6; cursor: wait; }
19
+ .tangle-chatgpt :is(button, a, input):focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 3px; }
20
+ .tangle-chatgpt a { color: hsl(var(--foreground)); text-decoration: underline; text-underline-offset: .2em; }
21
+ .tangle-chatgpt__text-action { background: none; border: 0; padding: .75rem 0 0; color: hsl(var(--foreground)); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
22
+ .tangle-chatgpt__setup { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid hsl(var(--border)); }
23
+ .tangle-chatgpt__setup ol { padding-left: 1.3rem; margin: .875rem 0 1.25rem; }
24
+ .tangle-chatgpt__setup li + li { margin-top: .75rem; }
25
+ .tangle-chatgpt__setup label { display: block; margin-bottom: .5rem; font-weight: 600; font-size: .8125rem; }
26
+ .tangle-chatgpt__endpoint input { flex: 1; min-width: 10rem; width: 100%; min-height: 2.75rem; padding: .625rem .75rem; border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius, .75rem) - 2px); color: hsl(var(--foreground)); background: var(--bg-input); font-size: .8125rem; }
27
+ .tangle-chatgpt__setup p { margin: .75rem 0; color: hsl(var(--muted-foreground)); font-size: .8125rem; }
28
+ .tangle-chatgpt__copy-notice:empty { display: none; }
29
+ .tangle-chatgpt__sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
30
+ @media (max-width: 420px) { .tangle-chatgpt__actions > * { width: 100%; } .tangle-chatgpt__identity { grid-template-columns: 1fr; gap: .75rem; } }
31
+ .tangle-chatgpt__details { margin-top: .75rem; }
32
+ .tangle-chatgpt__details summary { min-height: 2.75rem; padding: .75rem 0; cursor: pointer; font-size: .8125rem; color: hsl(var(--muted-foreground)); }
33
+ .tangle-chatgpt__details summary:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 3px; }
34
+ .tangle-chatgpt__details .tangle-chatgpt__identity { margin: 0 0 1rem; }
@@ -0,0 +1,2 @@
1
+ /** Type marker for the optional ChatGPT connection stylesheet. */
2
+ export {};
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -11,4 +11,4 @@ export {
11
11
  DesignCanvasLazy,
12
12
  DesignCanvasChromeLazy
13
13
  };
14
- //# sourceMappingURL=chunk-KGUC7S72.js.map
14
+ //# sourceMappingURL=chunk-4S74YVLU.js.map
@@ -88,7 +88,7 @@ import {
88
88
  import {
89
89
  DesignCanvasChromeLazy,
90
90
  DesignCanvasLazy
91
- } from "../chunk-KGUC7S72.js";
91
+ } from "../chunk-4S74YVLU.js";
92
92
  import {
93
93
  assertSceneMediaSrc,
94
94
  bleedAwareExportBounds,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DesignCanvasChromeLazy,
3
3
  DesignCanvasLazy
4
- } from "../chunk-KGUC7S72.js";
4
+ } from "../chunk-4S74YVLU.js";
5
5
  export {
6
6
  DesignCanvasChromeLazy,
7
7
  DesignCanvasLazy
@@ -1,8 +1,3 @@
1
- import {
2
- generateInviteToken,
3
- isInviteTokenShape,
4
- validateInviteToken
5
- } from "../chunk-DJ4VJIH5.js";
6
1
  import {
7
2
  INVITATION_EXPIRY_DAYS,
8
3
  generateInvitationToken,
@@ -12,6 +7,11 @@ import {
12
7
  parseInvitationPermission,
13
8
  renderInvitationEmail
14
9
  } from "../chunk-2DRYTJHI.js";
10
+ import {
11
+ generateInviteToken,
12
+ isInviteTokenShape,
13
+ validateInviteToken
14
+ } from "../chunk-DJ4VJIH5.js";
15
15
  import {
16
16
  ASSIGNABLE_WORKSPACE_ROLES,
17
17
  ORGANIZATION_ROLES,
@@ -1,7 +1,3 @@
1
- import {
2
- SeatLimitError
3
- } from "../chunk-MEUNTJL5.js";
4
- import "../chunk-DJ4VJIH5.js";
5
1
  import {
6
2
  generateInvitationToken,
7
3
  getInvitationExpiresAt,
@@ -9,6 +5,10 @@ import {
9
5
  normalizeInvitationEmail,
10
6
  parseInvitationPermission
11
7
  } from "../chunk-2DRYTJHI.js";
8
+ import {
9
+ SeatLimitError
10
+ } from "../chunk-MEUNTJL5.js";
11
+ import "../chunk-DJ4VJIH5.js";
12
12
  import {
13
13
  hasWorkspaceRole
14
14
  } from "../chunk-6XIAPIW6.js";
@@ -1,32 +1,8 @@
1
1
  /**
2
- * Worker-side adapters over {@link TurnStreamDO}: the concrete implementations
3
- * of the chat vertical's `turnStore` and `turnLock` seams, the WebSocket
4
- * upgrade forwarder, the best-effort broadcast helpers, and an in-process
5
- * memory harness for tests and keyless local dev.
6
- *
7
- * Everything takes the namespace STRUCTURALLY ({@link TurnStreamNamespaceLike}
8
- * — Cloudflare's `DurableObjectNamespace` satisfies it), so nothing here
9
- * imports Cloudflare types and the same adapters run against the memory
10
- * harness in vitest.
11
- *
12
- * Live fanout is deliberately NOT a side effect of the turn-event store: the
13
- * store is keyed by turnId/scopeId while viewer sockets live on the
14
- * `${workspaceId}:${threadId}` channel, and only the product's per-turn
15
- * context knows both. Products wire the workspace signal helpers into
16
- * `createChatTurnRoutes`' `onEvent`.
17
- *
18
- * Which adapters are still the right answer (see `./core`'s header for the
19
- * production measurement behind this split):
20
- *
21
- * | adapter | status |
22
- * | ------------------------------------ | --------------------------------- |
23
- * | {@link createDurableTurnLock} | KEPT — no SDK equivalent |
24
- * | {@link reconcileStaleDurableTurnLock}| KEPT — no SDK equivalent |
25
- * | {@link createDurableObjectTurnEventStore} | KEPT — the DETACHED lane |
26
- * | {@link broadcastWorkspaceActivity} | KEPT — workspace signal |
27
- * | {@link broadcastThreadCreated} | KEPT — workspace signal |
28
- * | {@link createTurnStreamUpgradeHandler} | KEPT for the workspace channel |
29
- * | {@link broadcastTurnStreamEvent} | `@deprecated` for sandbox turns |
2
+ * Worker adapters for durable turn storage, single-flight locks, and workspace signals.
3
+ * Namespace interfaces remain structural so Cloudflare bindings and the memory harness
4
+ * run the same authenticated request path.
5
+ * Products provide workspace authorization and their binding's TURN_STREAM_AUTH_SECRET.
30
6
  */
31
7
  import { type ReconcileStaleTurnLockOptions } from '../chat-routes/stale-turn-lock';
32
8
  import type { TurnEventStore } from '../stream/turn-buffer';
@@ -40,24 +16,20 @@ export interface TurnStreamNamespaceLike {
40
16
  idFromName(name: string): unknown;
41
17
  get(id: unknown): TurnStreamStubLike;
42
18
  }
19
+ /** The HMAC secret shared between this worker and its `TurnStreamDO` binding.
20
+ * Every adapter call mints a channel-bound capability token from it; the DO
21
+ * refuses requests without one (issue #746). Products pass the same value
22
+ * the DO resolves — `env.TURN_STREAM_AUTH_SECRET`. */
23
+ export interface TurnStreamAuth {
24
+ secret: string;
25
+ }
43
26
  /**
44
- * A {@link TurnEventStore} backed by {@link TurnStreamDO} storage — the
45
- * production implementation of `createChatTurnRoutes`' `turnStore` seam for
46
- * apps that don't run D1 for turn events (or want replay co-located with the
47
- * live channel). Each buffered turn lives on its own `turn:<turnId>` DO
48
- * instance; `listRunning` reconnect discovery rides a per-scope index
49
- * instance. Drops in wherever `createD1TurnEventStore(env.DB)` would.
50
- *
51
- * KEPT and load-bearing for AUTONOMOUS work. A detached run driven through
52
- * `dispatchPrompt({ detach: true })` or `streamPrompt` executes on the sandbox
53
- * run/stream lane, which publishes nothing to the session event bus on the
54
- * measured path (0 of 71 / 0 of 527 / 0 of 408 across three session-id
55
- * strategies). Sandbox 0.37 `driveTurn` uses the session message lane and is
56
- * gateway-visible by SDK contract. A browser tailing a stream/dispatch run
57
- * needs these durable rows plus `runDetachedTurn` (`/chat-routes`). Nothing
58
- * here is deprecated.
27
+ * Optional Durable Object backend for {@link TurnEventStore}.
28
+ * Each turn has its own named instance; a per-scope index tracks running turns.
29
+ * Products choose this adapter or the D1 backend independently of their lock
30
+ * and workspace-signal transport.
59
31
  */
60
- export declare function createDurableObjectTurnEventStore(namespace: TurnStreamNamespaceLike): TurnEventStore;
32
+ export declare function createDurableObjectTurnEventStore(namespace: TurnStreamNamespaceLike, auth: TurnStreamAuth): TurnEventStore;
61
33
  /** Define input parameters required to acquire a durable turn lock in a workspace thread context */
62
34
  export interface AcquireDurableTurnLockInput {
63
35
  workspaceId: string;
@@ -69,9 +41,9 @@ export interface AcquireDurableTurnLockInput {
69
41
  lockId?: string;
70
42
  }
71
43
  /** Acquire a durable turn lock in the specified namespace with given input parameters */
72
- export declare function acquireDurableTurnLock(namespace: TurnStreamNamespaceLike, input: AcquireDurableTurnLockInput): Promise<TurnLockAcquireResult>;
44
+ export declare function acquireDurableTurnLock(namespace: TurnStreamNamespaceLike, input: AcquireDurableTurnLockInput, auth: TurnStreamAuth): Promise<TurnLockAcquireResult>;
73
45
  /** Release a durable turn lock and indicate if the release was successful or deferred */
74
- export declare function releaseDurableTurnLock(namespace: TurnStreamNamespaceLike, input: TurnLockReleaseInput): Promise<{
46
+ export declare function releaseDurableTurnLock(namespace: TurnStreamNamespaceLike, input: TurnLockReleaseInput, auth: TurnStreamAuth): Promise<{
75
47
  released: boolean;
76
48
  deferred?: boolean;
77
49
  }>;
@@ -88,10 +60,11 @@ export interface ReleaseInterruptedDurableTurnLockInput {
88
60
  /** Fenced out-of-band release — the DO refuses a successor lock (started
89
61
  * after `interruptedAt`) and a turnId mismatch. Returns whether any scope
90
62
  * released. */
91
- export declare function releaseInterruptedDurableTurnLock(namespace: TurnStreamNamespaceLike, input: ReleaseInterruptedDurableTurnLockInput): Promise<boolean>;
63
+ export declare function releaseInterruptedDurableTurnLock(namespace: TurnStreamNamespaceLike, input: ReleaseInterruptedDurableTurnLockInput, auth: TurnStreamAuth): Promise<boolean>;
92
64
  /** Define options to reconcile stale durable turn locks with context, namespace, workspace, and active lock details */
93
65
  export interface ReconcileStaleDurableTurnLockOptions extends Pick<ReconcileStaleTurnLockOptions, 'probeSandbox' | 'probeSession' | 'graceMs' | 'terminalGraceMs' | 'context' | 'log' | 'now'> {
94
66
  namespace: TurnStreamNamespaceLike;
67
+ auth: TurnStreamAuth;
95
68
  workspaceId: string;
96
69
  threadId: string;
97
70
  /** The lock the acquire attempt was refused on. */
@@ -133,6 +106,9 @@ export type TurnLockSeamResult = {
133
106
  /** Define options for creating a durable turn lock with customizable scope and identification methods */
134
107
  export interface CreateDurableTurnLockOptions<TContext> {
135
108
  namespace: TurnStreamNamespaceLike;
109
+ /** Capability tokens for the DO; pass the worker's
110
+ * `env.TURN_STREAM_AUTH_SECRET`. The DO validates every request. */
111
+ auth: TurnStreamAuth;
136
112
  /** Which lane serializes this turn: `'workspace'` (shared sandbox — one
137
113
  * turn per workspace) or `'thread'` (router lane — one turn per thread). */
138
114
  scopeOf(args: TurnLockSeamArgs<TContext>): TurnLockScope;
@@ -167,56 +143,15 @@ export declare function createDurableTurnLock<TContext>(options: CreateDurableTu
167
143
  acquire(args: TurnLockSeamArgs<TContext>): Promise<TurnLockSeamResult>;
168
144
  release(handle: unknown): Promise<void>;
169
145
  };
170
- /**
171
- * DEPRECATED for sandbox-backed interactive turns (drive on the session-message
172
- * lane + `SessionGatewayClient` instead) — fan a turn event out to the
173
- * per-thread channel. `executionId` groups events
174
- * into a per-turn segment with a monotonic seq, so a reconnecting client
175
- * replays only the active turn and resumes from a cursor. Callers MUST await
176
- * (the DO assigns seq on arrival — emission order matters); failures are
177
- * swallowed (fanout is best-effort and never breaks chat delivery).
178
- *
179
- * @deprecated For a SANDBOX-backed interactive turn this re-broadcasts events
180
- * the sandbox platform already fans out, at the cost of a worker hop. Drive
181
- * the turn on the session-MESSAGE lane instead —
182
- * `box.createSession({ sessionId, backend })` then
183
- * `box.session(id).sendMessage({ parts: [{ type: 'text', text }] })` — and let
184
- * the tab attach with `box.mintScopedToken({ scope: 'session', sessionId,
185
- * runtimeSessionId })` + `SessionGatewayClient`
186
- * (`@tangle-network/sandbox/session-gateway`). Measured on production
187
- * (4 arms, SDK 0.12.0): turns driven with `box.streamPrompt()` delivered
188
- * 0 of 71 / 0 of 527 / 0 of 408 turn events to a gateway client, because
189
- * `POST /agents/run/stream` publishes nothing to the session event bus;
190
- * the message lane delivered 297 of 297.
191
- *
192
- * Two things this deprecation does NOT cover, both still supported:
193
- * stream/dispatch DETACHED runs (keep `runDetachedTurn` over the durable
194
- * turn-event rows) and the per-workspace signals
195
- * ({@link broadcastWorkspaceActivity} / {@link broadcastThreadCreated}).
196
- * A SANDBOX-FREE copilot that wants a second viewer should use `/stream`'s
197
- * `replayTurnEvents` (`GET /chat/stream/:turnId`), which follows a running
198
- * turn from a cursor without a second broadcast fabric.
199
- *
200
- * Kept for back-compat; removal is a major-version change.
201
- */
202
- export declare function broadcastTurnStreamEvent(namespace: TurnStreamNamespaceLike, input: {
203
- workspaceId: string;
204
- threadId: string;
205
- executionId: string;
206
- event: {
207
- type: string;
208
- data?: Record<string, unknown>;
209
- };
210
- }): Promise<void>;
211
146
  /** Coarse per-workspace marker that a thread's turn started / ended — drives
212
147
  * a sidebar "agent responding" indicator subscribed once per workspace. */
213
- export declare function broadcastWorkspaceActivity(namespace: TurnStreamNamespaceLike, workspaceId: string, threadId: string, phase: 'start' | 'end'): Promise<void>;
148
+ export declare function broadcastWorkspaceActivity(namespace: TurnStreamNamespaceLike, workspaceId: string, threadId: string, phase: 'start' | 'end', auth: TurnStreamAuth): Promise<void>;
214
149
  /** Per-workspace marker that a new thread was created, so an already-open
215
150
  * history list prepends it without a reload. */
216
151
  export declare function broadcastThreadCreated(namespace: TurnStreamNamespaceLike, workspaceId: string, thread: {
217
152
  threadId: string;
218
153
  title: string;
219
- }): Promise<void>;
154
+ }, auth: TurnStreamAuth): Promise<void>;
220
155
  /** Represent success or failure of a TURN stream upgrade authorization with optional response data */
221
156
  export type TurnStreamUpgradeAuthorization = {
222
157
  ok: true;
@@ -227,31 +162,32 @@ export type TurnStreamUpgradeAuthorization = {
227
162
  /** Define options for creating a TURN stream upgrade handler including namespace, path, and authorization logic */
228
163
  export interface CreateTurnStreamUpgradeHandlerOptions {
229
164
  namespace: TurnStreamNamespaceLike;
165
+ /** HMAC secret shared with the DO binding (`env.TURN_STREAM_AUTH_SECRET`).
166
+ * After the product `authorize` passes, the handler mints a channel-bound
167
+ * capability token and the DO verifies it — the browser never holds it. */
168
+ authSecret: string;
230
169
  /** The worker route serving the stream. Default `/api/session-stream`. */
231
170
  path?: string;
232
171
  /** Viewer access check (session cookie → workspace membership). */
233
172
  authorize(request: Request, target: {
234
173
  workspaceId: string;
235
- threadId: string | null;
236
174
  }): Promise<TurnStreamUpgradeAuthorization>;
237
175
  }
238
176
  /**
239
- * The worker-entry WebSocket forwarder. Call BEFORE the app router (a router
240
- * loader cannot return a 101); returns `null` for requests that are not a
241
- * WebSocket upgrade on the configured path.
177
+ * The worker-entry WebSocket forwarder — WORKSPACE channel only (the
178
+ * per-thread variant went with the deprecated rebroadcast lane; a thread's
179
+ * live turn replay is the sandbox session gateway's job). Call BEFORE the
180
+ * app router (a router loader cannot return a 101); returns `null` for
181
+ * requests that are not a WebSocket upgrade on the configured path.
242
182
  *
243
- * GET {path}?workspaceId=... → workspace channel (sidebar)
244
- * GET {path}?workspaceId=...&threadId=… → thread channel (turn resume)
183
+ * GET {path}?workspaceId=... → workspace channel (sidebar signals)
245
184
  *
246
- * After the 101, the client sends `{type:'sync', afterSeq}` and receives the
247
- * replay-then-live stream (see {@link TurnStreamDO.webSocketMessage}).
185
+ * After the 101, the client sends `{type:'sync'}` and receives the
186
+ * current-activity + recent-threads snapshot, then live signals.
248
187
  *
249
- * NOT deprecated — the workspace variant (no `threadId`) is the canonical
250
- * transport for the per-workspace signals, which the session gateway cannot
251
- * carry (it is per-session and read-only). The THREAD variant is the
252
- * deprecated half: for a sandbox-backed interactive turn the tab should
253
- * attach to the session gateway directly instead of to this socket. See
254
- * {@link broadcastTurnStreamEvent} for the measurement and the replacement
255
- * wiring.
188
+ * Security: the product's `authorize` decides whether THIS caller may see the
189
+ * workspace's signals; the channel-bound token this handler then mints is
190
+ * what the DO itself verifies — two independent gates, and the browser never
191
+ * learns the token (it rides the forwarded upgrade request only).
256
192
  */
257
193
  export declare function createTurnStreamUpgradeHandler(options: CreateTurnStreamUpgradeHandlerOptions): (request: Request) => Promise<Response | null>;