@tangle-network/agent-app 0.53.17 → 0.54.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/dist/assistant/index.js +3 -3
- package/dist/design-canvas-react/index.js +4 -4
- package/dist/teams-react/index.d.ts +1 -2
- package/dist/teams-react/index.js +618 -10
- package/dist/teams-react/index.js.map +1 -1
- package/dist/web-react/index.js +6 -6
- package/package.json +1 -31
- package/dist/InvitationsPanel-OFCYVSAE.js +0 -9
- package/dist/InvitationsPanel-OFCYVSAE.js.map +0 -1
- package/dist/InviteAcceptPage-BDOO4JSE.js +0 -7
- package/dist/InviteAcceptPage-BDOO4JSE.js.map +0 -1
- package/dist/MembersPanel-3ZK2GCMC.js +0 -9
- package/dist/MembersPanel-3ZK2GCMC.js.map +0 -1
- package/dist/chunk-5MI2SKQH.js +0 -211
- package/dist/chunk-5MI2SKQH.js.map +0 -1
- package/dist/chunk-AULM4X7U.js +0 -77
- package/dist/chunk-AULM4X7U.js.map +0 -1
- package/dist/chunk-GRDLGQ6A.js +0 -164
- package/dist/chunk-GRDLGQ6A.js.map +0 -1
- package/dist/chunk-W7P5KV6O.js +0 -192
- package/dist/chunk-W7P5KV6O.js.map +0 -1
- package/dist/run/index.d.ts +0 -63
- package/dist/run/index.js +0 -30
- package/dist/run/index.js.map +0 -1
- package/dist/tangle/index.d.ts +0 -94
- package/dist/tangle/index.js +0 -33
- package/dist/tangle/index.js.map +0 -1
- package/dist/teams/resend.d.ts +0 -27
- package/dist/teams/resend.js +0 -38
- package/dist/teams/resend.js.map +0 -1
- package/dist/teams-react/lazy.d.ts +0 -14
- package/dist/teams-react/lazy.js +0 -17
- package/dist/teams-react/lazy.js.map +0 -1
- package/dist/web-react/inert.d.ts +0 -39
- package/dist/web-react/session-gateway.d.ts +0 -140
- package/dist/web-react/session-gateway.js +0 -187
- package/dist/web-react/session-gateway.js.map +0 -1
package/dist/chunk-GRDLGQ6A.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RoleSelect
|
|
3
|
-
} from "./chunk-AULM4X7U.js";
|
|
4
|
-
import {
|
|
5
|
-
hasWorkspaceRole
|
|
6
|
-
} from "./chunk-6XIAPIW6.js";
|
|
7
|
-
|
|
8
|
-
// src/teams-react/components/MembersPanel.tsx
|
|
9
|
-
import { useState } from "react";
|
|
10
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
function MembersPanel({
|
|
12
|
-
members,
|
|
13
|
-
currentRole,
|
|
14
|
-
onInvite,
|
|
15
|
-
onChangeRole,
|
|
16
|
-
onRemove,
|
|
17
|
-
onNotice,
|
|
18
|
-
showInviteForm = true
|
|
19
|
-
}) {
|
|
20
|
-
const [inviteEmail, setInviteEmail] = useState("");
|
|
21
|
-
const [inviteRole, setInviteRole] = useState("editor");
|
|
22
|
-
const [inviting, setInviting] = useState(false);
|
|
23
|
-
const canManage = hasWorkspaceRole(currentRole, "admin");
|
|
24
|
-
function notify(kind, message) {
|
|
25
|
-
onNotice?.({ kind, message });
|
|
26
|
-
}
|
|
27
|
-
async function submitInvite() {
|
|
28
|
-
const email = inviteEmail.trim();
|
|
29
|
-
if (!email || inviting) return;
|
|
30
|
-
setInviting(true);
|
|
31
|
-
try {
|
|
32
|
-
const result = await onInvite({ email, role: inviteRole });
|
|
33
|
-
if (result && "inviteUrl" in result && result.inviteUrl) {
|
|
34
|
-
notify("success", `Invite link ready for ${email}`);
|
|
35
|
-
} else {
|
|
36
|
-
notify("success", `Invited ${email}`);
|
|
37
|
-
}
|
|
38
|
-
setInviteEmail("");
|
|
39
|
-
} catch (err) {
|
|
40
|
-
notify("error", err instanceof Error ? err.message : "Failed to invite");
|
|
41
|
-
} finally {
|
|
42
|
-
setInviting(false);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async function changeRole(memberId, role) {
|
|
46
|
-
try {
|
|
47
|
-
await onChangeRole({ memberId, role });
|
|
48
|
-
notify("success", "Role updated");
|
|
49
|
-
} catch (err) {
|
|
50
|
-
notify("error", err instanceof Error ? err.message : "Failed to update role");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async function remove(memberId) {
|
|
54
|
-
try {
|
|
55
|
-
await onRemove({ memberId });
|
|
56
|
-
notify("success", "Member removed");
|
|
57
|
-
} catch (err) {
|
|
58
|
-
notify("error", err instanceof Error ? err.message : "Failed to remove member");
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-4", children: [
|
|
62
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
63
|
-
/* @__PURE__ */ jsx("h4", { className: "text-xs font-semibold text-[var(--text-primary)]", children: "Members" }),
|
|
64
|
-
/* @__PURE__ */ jsxs("span", { className: "text-xs text-[var(--text-muted)]", children: [
|
|
65
|
-
members.length,
|
|
66
|
-
" total"
|
|
67
|
-
] })
|
|
68
|
-
] }),
|
|
69
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
70
|
-
members.map((member) => /* @__PURE__ */ jsx(
|
|
71
|
-
MemberRow,
|
|
72
|
-
{
|
|
73
|
-
member,
|
|
74
|
-
canManage,
|
|
75
|
-
onChangeRole: changeRole,
|
|
76
|
-
onRemove: remove
|
|
77
|
-
},
|
|
78
|
-
member.id
|
|
79
|
-
)),
|
|
80
|
-
members.length === 0 && /* @__PURE__ */ jsx("p", { className: "text-sm text-[var(--text-muted)]", children: "No team members yet." })
|
|
81
|
-
] }),
|
|
82
|
-
canManage && showInviteForm && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5 border-t border-[var(--border-default)] pt-3", children: [
|
|
83
|
-
/* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-[var(--text-muted)]", children: "Invite member" }),
|
|
84
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
85
|
-
/* @__PURE__ */ jsx(
|
|
86
|
-
"input",
|
|
87
|
-
{
|
|
88
|
-
type: "email",
|
|
89
|
-
placeholder: "Email address",
|
|
90
|
-
value: inviteEmail,
|
|
91
|
-
"aria-label": "Invite email address",
|
|
92
|
-
onChange: (event) => setInviteEmail(event.target.value),
|
|
93
|
-
onKeyDown: (event) => {
|
|
94
|
-
if (event.key === "Enter") void submitInvite();
|
|
95
|
-
},
|
|
96
|
-
className: "flex-1 rounded border border-[var(--border-default)] bg-[var(--bg-input)] px-3 py-1.5 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)]"
|
|
97
|
-
}
|
|
98
|
-
),
|
|
99
|
-
/* @__PURE__ */ jsx(
|
|
100
|
-
RoleSelect,
|
|
101
|
-
{
|
|
102
|
-
value: inviteRole,
|
|
103
|
-
ariaLabel: "Invite role",
|
|
104
|
-
onChange: setInviteRole
|
|
105
|
-
}
|
|
106
|
-
),
|
|
107
|
-
/* @__PURE__ */ jsx(
|
|
108
|
-
"button",
|
|
109
|
-
{
|
|
110
|
-
type: "button",
|
|
111
|
-
onClick: () => void submitInvite(),
|
|
112
|
-
disabled: inviting || !inviteEmail.trim(),
|
|
113
|
-
className: "rounded bg-[var(--brand-primary)] px-3 py-1.5 text-sm text-[hsl(var(--primary-foreground))] disabled:opacity-50",
|
|
114
|
-
children: inviting ? "Inviting\u2026" : "Invite"
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
] })
|
|
118
|
-
] })
|
|
119
|
-
] });
|
|
120
|
-
}
|
|
121
|
-
function MemberRow({ member, canManage, onChangeRole, onRemove }) {
|
|
122
|
-
const pending = member.acceptedAt == null;
|
|
123
|
-
const label = member.name ?? member.email ?? "Unknown";
|
|
124
|
-
const initial = (member.name?.[0] ?? member.email?.[0] ?? "?").toUpperCase();
|
|
125
|
-
const isOwner = member.role === "owner";
|
|
126
|
-
const editable = canManage && !isOwner && !member.inherited;
|
|
127
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-[var(--border-default)] py-2 last:border-0", children: [
|
|
128
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
129
|
-
/* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-[var(--bg-input)] text-xs font-semibold text-[var(--text-secondary)]", children: initial }),
|
|
130
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
131
|
-
/* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2 text-sm font-medium text-[var(--text-primary)]", children: [
|
|
132
|
-
label,
|
|
133
|
-
pending && /* @__PURE__ */ jsx("span", { className: "rounded border border-[var(--border-default)] px-1.5 py-0.5 text-xs font-semibold uppercase tracking-[0.05em] text-[var(--text-muted)]", children: "Pending" })
|
|
134
|
-
] }),
|
|
135
|
-
member.name && member.email && /* @__PURE__ */ jsx("p", { className: "text-xs text-[var(--text-muted)]", children: member.email })
|
|
136
|
-
] })
|
|
137
|
-
] }),
|
|
138
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: isOwner ? /* @__PURE__ */ jsx("span", { className: "rounded border border-[var(--border-default)] px-2 py-0.5 text-xs text-[var(--text-secondary)]", children: member.inherited ? "Org Admin" : "Owner" }) : editable ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
139
|
-
/* @__PURE__ */ jsx(
|
|
140
|
-
RoleSelect,
|
|
141
|
-
{
|
|
142
|
-
value: member.role,
|
|
143
|
-
ariaLabel: `Role for ${label}`,
|
|
144
|
-
onChange: (role) => onChangeRole(member.id, role)
|
|
145
|
-
}
|
|
146
|
-
),
|
|
147
|
-
/* @__PURE__ */ jsx(
|
|
148
|
-
"button",
|
|
149
|
-
{
|
|
150
|
-
type: "button",
|
|
151
|
-
"aria-label": `Remove ${label}`,
|
|
152
|
-
onClick: () => onRemove(member.id),
|
|
153
|
-
className: "rounded px-2 py-1 text-xs text-[var(--text-danger)] hover:bg-[var(--border-default)]",
|
|
154
|
-
children: "Remove"
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
] }) : /* @__PURE__ */ jsx("span", { className: "rounded border border-[var(--border-default)] px-2 py-0.5 text-xs capitalize text-[var(--text-secondary)]", children: member.role }) })
|
|
158
|
-
] });
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export {
|
|
162
|
-
MembersPanel
|
|
163
|
-
};
|
|
164
|
-
//# sourceMappingURL=chunk-GRDLGQ6A.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/teams-react/components/MembersPanel.tsx"],"sourcesContent":["/**\n * Workspace members panel: list members, invite by email + role, change a\n * member's role, remove a member. Fully callback-driven — the host supplies the\n * data and the async `onInvite`/`onChangeRole`/`onRemove` callbacks (backed by\n * `./teams/members-api`), so this imports no app router, fetch client, or toast.\n * Styled with the shipped Tangle Quiet tokens (`var(--*)`).\n *\n * Role gating mirrors the API: only admins/owners see role selects and the\n * remove control; inherited org owners and explicit owners are not editable\n * here (org-level concern). The invite role select offers `admin` only to\n * admins/owners.\n */\n\nimport { useState } from 'react'\nimport type { WorkspaceRole } from '../../teams/roles'\nimport { hasWorkspaceRole } from '../../teams/roles'\nimport type { MemberView, MembersPanelProps } from '../contracts'\nimport { RoleSelect } from './RoleSelect'\n\nexport function MembersPanel({\n members,\n currentRole,\n onInvite,\n onChangeRole,\n onRemove,\n onNotice,\n showInviteForm = true,\n}: MembersPanelProps) {\n const [inviteEmail, setInviteEmail] = useState('')\n const [inviteRole, setInviteRole] = useState<WorkspaceRole>('editor')\n const [inviting, setInviting] = useState(false)\n\n const canManage = hasWorkspaceRole(currentRole, 'admin')\n\n function notify(kind: 'success' | 'error', message: string) {\n onNotice?.({ kind, message })\n }\n\n async function submitInvite() {\n const email = inviteEmail.trim()\n if (!email || inviting) return\n setInviting(true)\n try {\n const result = await onInvite({ email, role: inviteRole })\n if (result && 'inviteUrl' in result && result.inviteUrl) {\n notify('success', `Invite link ready for ${email}`)\n } else {\n notify('success', `Invited ${email}`)\n }\n setInviteEmail('')\n } catch (err) {\n notify('error', err instanceof Error ? err.message : 'Failed to invite')\n } finally {\n setInviting(false)\n }\n }\n\n async function changeRole(memberId: string, role: WorkspaceRole) {\n try {\n await onChangeRole({ memberId, role })\n notify('success', 'Role updated')\n } catch (err) {\n notify('error', err instanceof Error ? err.message : 'Failed to update role')\n }\n }\n\n async function remove(memberId: string) {\n try {\n await onRemove({ memberId })\n notify('success', 'Member removed')\n } catch (err) {\n notify('error', err instanceof Error ? err.message : 'Failed to remove member')\n }\n }\n\n return (\n <section className=\"flex flex-col gap-4\">\n <div className=\"flex items-center justify-between\">\n <h4 className=\"text-xs font-semibold text-[var(--text-primary)]\">Members</h4>\n <span className=\"text-xs text-[var(--text-muted)]\">{members.length} total</span>\n </div>\n <div className=\"flex flex-col gap-2\">\n {members.map((member) => (\n <MemberRow\n key={member.id}\n member={member}\n canManage={canManage}\n onChangeRole={changeRole}\n onRemove={remove}\n />\n ))}\n {members.length === 0 && (\n <p className=\"text-sm text-[var(--text-muted)]\">No team members yet.</p>\n )}\n </div>\n\n {canManage && showInviteForm && (\n <div className=\"flex flex-col gap-1.5 border-t border-[var(--border-default)] pt-3\">\n <label className=\"text-xs font-medium text-[var(--text-muted)]\">Invite member</label>\n <div className=\"flex gap-2\">\n <input\n type=\"email\"\n placeholder=\"Email address\"\n value={inviteEmail}\n aria-label=\"Invite email address\"\n onChange={(event) => setInviteEmail(event.target.value)}\n onKeyDown={(event) => { if (event.key === 'Enter') void submitInvite() }}\n className=\"flex-1 rounded border border-[var(--border-default)] bg-[var(--bg-input)] px-3 py-1.5 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)]\"\n />\n <RoleSelect\n value={inviteRole}\n ariaLabel=\"Invite role\"\n onChange={setInviteRole}\n />\n <button\n type=\"button\"\n onClick={() => void submitInvite()}\n disabled={inviting || !inviteEmail.trim()}\n className=\"rounded bg-[var(--brand-primary)] px-3 py-1.5 text-sm text-[hsl(var(--primary-foreground))] disabled:opacity-50\"\n >\n {inviting ? 'Inviting…' : 'Invite'}\n </button>\n </div>\n </div>\n )}\n </section>\n )\n}\n\ninterface MemberRowProps {\n member: MemberView\n canManage: boolean\n onChangeRole(memberId: string, role: WorkspaceRole): void\n onRemove(memberId: string): void\n}\n\nfunction MemberRow({ member, canManage, onChangeRole, onRemove }: MemberRowProps) {\n const pending = member.acceptedAt == null\n const label = member.name ?? member.email ?? 'Unknown'\n const initial = (member.name?.[0] ?? member.email?.[0] ?? '?').toUpperCase()\n const isOwner = member.role === 'owner'\n const editable = canManage && !isOwner && !member.inherited\n\n return (\n <div className=\"flex items-center justify-between border-b border-[var(--border-default)] py-2 last:border-0\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex h-8 w-8 items-center justify-center rounded-full bg-[var(--bg-input)] text-xs font-semibold text-[var(--text-secondary)]\">\n {initial}\n </div>\n <div>\n <p className=\"flex items-center gap-2 text-sm font-medium text-[var(--text-primary)]\">\n {label}\n {pending && (\n <span className=\"rounded border border-[var(--border-default)] px-1.5 py-0.5 text-xs font-semibold uppercase tracking-[0.05em] text-[var(--text-muted)]\">\n Pending\n </span>\n )}\n </p>\n {member.name && member.email && (\n <p className=\"text-xs text-[var(--text-muted)]\">{member.email}</p>\n )}\n </div>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {isOwner ? (\n <span className=\"rounded border border-[var(--border-default)] px-2 py-0.5 text-xs text-[var(--text-secondary)]\">\n {member.inherited ? 'Org Admin' : 'Owner'}\n </span>\n ) : editable ? (\n <>\n <RoleSelect\n value={member.role}\n ariaLabel={`Role for ${label}`}\n onChange={(role) => onChangeRole(member.id, role)}\n />\n <button\n type=\"button\"\n aria-label={`Remove ${label}`}\n onClick={() => onRemove(member.id)}\n className=\"rounded px-2 py-1 text-xs text-[var(--text-danger)] hover:bg-[var(--border-default)]\"\n >\n Remove\n </button>\n </>\n ) : (\n <span className=\"rounded border border-[var(--border-default)] px-2 py-0.5 text-xs capitalize text-[var(--text-secondary)]\">\n {member.role}\n </span>\n )}\n </div>\n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KV6O.js
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
// src/teams-react/components/InviteAcceptPage.tsx
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
|
|
4
|
-
// src/teams-react/components/BrandMark.tsx
|
|
5
|
-
import { lazy, Suspense } from "react";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
function MarkSpacer({ size }) {
|
|
8
|
-
return /* @__PURE__ */ jsx("span", { "aria-hidden": true, style: { display: "inline-block", width: size, height: size } });
|
|
9
|
-
}
|
|
10
|
-
var LazyKnot = lazy(async () => {
|
|
11
|
-
try {
|
|
12
|
-
const mod = await import("./brand/index.js");
|
|
13
|
-
return { default: mod.TangleKnot };
|
|
14
|
-
} catch {
|
|
15
|
-
return { default: MarkSpacer };
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
function BrandMark({ size, className }) {
|
|
19
|
-
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(MarkSpacer, { size }), children: /* @__PURE__ */ jsx(LazyKnot, { size, className }) });
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// src/teams-react/components/InviteAcceptPage.tsx
|
|
23
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
24
|
-
function InviteAcceptPage({ details, onAccept, onNavigate, onResendVerification }) {
|
|
25
|
-
const [accepting, setAccepting] = useState(false);
|
|
26
|
-
const [acceptError, setAcceptError] = useState(null);
|
|
27
|
-
const [accepted, setAccepted] = useState(false);
|
|
28
|
-
const [resendingVerification, setResendingVerification] = useState(false);
|
|
29
|
-
const [verificationSent, setVerificationSent] = useState(false);
|
|
30
|
-
if (details.status === "invalid") {
|
|
31
|
-
return /* @__PURE__ */ jsx2(Shell, { title: "Invalid invitation", body: "This link is invalid or already used. Ask the workspace admin to send a new one.", children: /* @__PURE__ */ jsx2(PrimaryButton, { onClick: () => onNavigate({ kind: "sign-in" }), children: "Go to sign in" }) });
|
|
32
|
-
}
|
|
33
|
-
if (details.status === "already-accepted") {
|
|
34
|
-
return /* @__PURE__ */ jsx2(Shell, { title: "Already accepted", body: "This invitation has already been accepted.", children: /* @__PURE__ */ jsx2(PrimaryButton, { onClick: () => onNavigate({ kind: "open-app" }), children: "Open workspace" }) });
|
|
35
|
-
}
|
|
36
|
-
if (details.status === "expired") {
|
|
37
|
-
return /* @__PURE__ */ jsx2(Shell, { title: "Invitation expired", body: "This invitation has expired. Ask the workspace admin to send a new one.", children: /* @__PURE__ */ jsx2(PrimaryButton, { onClick: () => onNavigate({ kind: "sign-in" }), children: "Go to sign in" }) });
|
|
38
|
-
}
|
|
39
|
-
if (details.status === "revoked") {
|
|
40
|
-
return /* @__PURE__ */ jsx2(Shell, { title: "Invitation revoked", body: "This invitation has been revoked. Ask the workspace admin to send a new one.", children: /* @__PURE__ */ jsx2(PrimaryButton, { onClick: () => onNavigate({ kind: "sign-in" }), children: "Go to sign in" }) });
|
|
41
|
-
}
|
|
42
|
-
const workspaceName = details.workspaceName ?? "a workspace";
|
|
43
|
-
const inviterPrefix = details.inviterName ? `${details.inviterName} invited you` : "You've been invited";
|
|
44
|
-
const roleSuffix = details.role ? ` as ${details.role}` : "";
|
|
45
|
-
if (!details.currentUserEmail) {
|
|
46
|
-
return /* @__PURE__ */ jsxs(Shell, { title: "You've been invited", children: [
|
|
47
|
-
/* @__PURE__ */ jsxs("p", { className: "mb-4 text-sm text-[var(--text-secondary)]", children: [
|
|
48
|
-
inviterPrefix,
|
|
49
|
-
" to join ",
|
|
50
|
-
/* @__PURE__ */ jsx2("span", { className: "font-medium text-[var(--text-primary)]", children: workspaceName }),
|
|
51
|
-
roleSuffix,
|
|
52
|
-
"."
|
|
53
|
-
] }),
|
|
54
|
-
details.inviteEmail && /* @__PURE__ */ jsxs("p", { className: "mb-6 text-sm text-[var(--text-secondary)]", children: [
|
|
55
|
-
"Sign in or create an account with",
|
|
56
|
-
" ",
|
|
57
|
-
/* @__PURE__ */ jsx2("span", { className: "font-medium text-[var(--text-primary)]", children: details.inviteEmail }),
|
|
58
|
-
" to accept."
|
|
59
|
-
] }),
|
|
60
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
61
|
-
/* @__PURE__ */ jsx2(PrimaryButton, { onClick: () => onNavigate({ kind: "sign-in" }), children: "Sign in" }),
|
|
62
|
-
/* @__PURE__ */ jsx2(SecondaryButton, { onClick: () => onNavigate({ kind: "sign-up" }), children: "Create account" })
|
|
63
|
-
] })
|
|
64
|
-
] });
|
|
65
|
-
}
|
|
66
|
-
if (accepted) {
|
|
67
|
-
return /* @__PURE__ */ jsx2(Shell, { title: "Welcome!", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-[var(--text-secondary)]", children: [
|
|
68
|
-
"You've joined ",
|
|
69
|
-
/* @__PURE__ */ jsx2("span", { className: "font-medium text-[var(--text-primary)]", children: workspaceName }),
|
|
70
|
-
"."
|
|
71
|
-
] }) });
|
|
72
|
-
}
|
|
73
|
-
const emailMismatch = Boolean(
|
|
74
|
-
details.inviteEmail && details.inviteEmail.toLowerCase() !== details.currentUserEmail.toLowerCase()
|
|
75
|
-
);
|
|
76
|
-
const needsVerification = Boolean(details.needsEmailVerification) && !emailMismatch;
|
|
77
|
-
const expiryLabel = details.expiresAt != null ? new Date(details.expiresAt).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : null;
|
|
78
|
-
async function handleAccept() {
|
|
79
|
-
setAccepting(true);
|
|
80
|
-
setAcceptError(null);
|
|
81
|
-
try {
|
|
82
|
-
const result = await onAccept();
|
|
83
|
-
setAccepted(true);
|
|
84
|
-
if (result && "workspaceId" in result && result.workspaceId) {
|
|
85
|
-
onNavigate({ kind: "open-app", workspaceId: result.workspaceId });
|
|
86
|
-
}
|
|
87
|
-
} catch (err) {
|
|
88
|
-
setAcceptError(err instanceof Error ? err.message : "Failed to accept invitation");
|
|
89
|
-
} finally {
|
|
90
|
-
setAccepting(false);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
async function handleResendVerification() {
|
|
94
|
-
if (!onResendVerification || resendingVerification) return;
|
|
95
|
-
setResendingVerification(true);
|
|
96
|
-
try {
|
|
97
|
-
await onResendVerification();
|
|
98
|
-
setVerificationSent(true);
|
|
99
|
-
} finally {
|
|
100
|
-
setResendingVerification(false);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return /* @__PURE__ */ jsxs(Shell, { title: "Join workspace", children: [
|
|
104
|
-
/* @__PURE__ */ jsxs("p", { className: "mb-4 text-sm text-[var(--text-secondary)]", children: [
|
|
105
|
-
inviterPrefix,
|
|
106
|
-
" to join ",
|
|
107
|
-
/* @__PURE__ */ jsx2("span", { className: "font-medium text-[var(--text-primary)]", children: workspaceName }),
|
|
108
|
-
roleSuffix,
|
|
109
|
-
"."
|
|
110
|
-
] }),
|
|
111
|
-
/* @__PURE__ */ jsxs("p", { className: "mb-4 text-sm text-[var(--text-secondary)]", children: [
|
|
112
|
-
"Signed in as ",
|
|
113
|
-
/* @__PURE__ */ jsx2("span", { className: "font-medium text-[var(--text-primary)]", children: details.currentUserEmail })
|
|
114
|
-
] }),
|
|
115
|
-
expiryLabel && /* @__PURE__ */ jsxs("p", { className: "mb-4 text-xs text-[var(--text-muted)]", children: [
|
|
116
|
-
"This invitation expires on ",
|
|
117
|
-
expiryLabel,
|
|
118
|
-
"."
|
|
119
|
-
] }),
|
|
120
|
-
emailMismatch && /* @__PURE__ */ jsxs(
|
|
121
|
-
"div",
|
|
122
|
-
{
|
|
123
|
-
role: "alert",
|
|
124
|
-
className: "mb-4 rounded-md border border-[var(--border-default)] px-4 py-2 text-sm text-[var(--text-warning)]",
|
|
125
|
-
children: [
|
|
126
|
-
"This invitation was sent to ",
|
|
127
|
-
/* @__PURE__ */ jsx2("span", { className: "font-medium", children: details.inviteEmail }),
|
|
128
|
-
". Switch to that account to accept it."
|
|
129
|
-
]
|
|
130
|
-
}
|
|
131
|
-
),
|
|
132
|
-
needsVerification && /* @__PURE__ */ jsx2(
|
|
133
|
-
"div",
|
|
134
|
-
{
|
|
135
|
-
role: "alert",
|
|
136
|
-
className: "mb-4 rounded-md border border-[var(--border-default)] px-4 py-2 text-sm text-[var(--text-warning)]",
|
|
137
|
-
children: verificationSent ? "Verification email sent \u2014 check your inbox, then refresh this page to accept." : "Verify your email address before you can accept this invitation."
|
|
138
|
-
}
|
|
139
|
-
),
|
|
140
|
-
acceptError && /* @__PURE__ */ jsx2("p", { role: "alert", className: "mb-4 text-sm text-[var(--text-danger)]", children: acceptError }),
|
|
141
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
142
|
-
emailMismatch ? /* @__PURE__ */ jsx2(PrimaryButton, { onClick: () => onNavigate({ kind: "switch-account" }), children: "Switch account" }) : needsVerification ? onResendVerification ? /* @__PURE__ */ jsx2(
|
|
143
|
-
PrimaryButton,
|
|
144
|
-
{
|
|
145
|
-
onClick: () => void handleResendVerification(),
|
|
146
|
-
disabled: resendingVerification || verificationSent,
|
|
147
|
-
children: verificationSent ? "Verification sent" : resendingVerification ? "Sending\u2026" : "Resend verification email"
|
|
148
|
-
}
|
|
149
|
-
) : /* @__PURE__ */ jsx2(PrimaryButton, { onClick: () => onNavigate({ kind: "open-app" }), children: "Open app" }) : /* @__PURE__ */ jsx2(PrimaryButton, { onClick: () => void handleAccept(), disabled: accepting, children: accepting ? "Accepting\u2026" : "Accept invitation" }),
|
|
150
|
-
/* @__PURE__ */ jsx2(SecondaryButton, { onClick: () => onNavigate({ kind: "open-app" }), children: "Not now" })
|
|
151
|
-
] })
|
|
152
|
-
] });
|
|
153
|
-
}
|
|
154
|
-
function Shell({ title, body, children }) {
|
|
155
|
-
return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex w-full max-w-sm flex-col", children: [
|
|
156
|
-
/* @__PURE__ */ jsxs("span", { className: "mb-4 flex items-center gap-2 text-[var(--text-muted)]", children: [
|
|
157
|
-
/* @__PURE__ */ jsx2(BrandMark, { size: 22, className: "shrink-0" }),
|
|
158
|
-
/* @__PURE__ */ jsx2("span", { className: "text-xs font-semibold uppercase tracking-[0.05em]", children: "Tangle Teams" })
|
|
159
|
-
] }),
|
|
160
|
-
/* @__PURE__ */ jsx2("h1", { className: "mb-1 text-xl font-semibold tracking-tight text-[var(--text-primary)]", children: title }),
|
|
161
|
-
body && /* @__PURE__ */ jsx2("p", { className: "mb-6 text-sm text-[var(--text-secondary)]", children: body }),
|
|
162
|
-
children
|
|
163
|
-
] });
|
|
164
|
-
}
|
|
165
|
-
function PrimaryButton({ children, onClick, disabled }) {
|
|
166
|
-
return /* @__PURE__ */ jsx2(
|
|
167
|
-
"button",
|
|
168
|
-
{
|
|
169
|
-
type: "button",
|
|
170
|
-
onClick,
|
|
171
|
-
disabled,
|
|
172
|
-
className: "flex-1 rounded bg-[var(--brand-primary)] px-4 py-2 text-sm text-[hsl(var(--primary-foreground))] disabled:opacity-50",
|
|
173
|
-
children
|
|
174
|
-
}
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
function SecondaryButton({ children, onClick }) {
|
|
178
|
-
return /* @__PURE__ */ jsx2(
|
|
179
|
-
"button",
|
|
180
|
-
{
|
|
181
|
-
type: "button",
|
|
182
|
-
onClick,
|
|
183
|
-
className: "flex-1 rounded border border-[var(--border-default)] px-4 py-2 text-sm text-[var(--text-secondary)] hover:text-[var(--text-primary)]",
|
|
184
|
-
children
|
|
185
|
-
}
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export {
|
|
190
|
-
InviteAcceptPage
|
|
191
|
-
};
|
|
192
|
-
//# sourceMappingURL=chunk-W7P5KV6O.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/teams-react/components/InviteAcceptPage.tsx","../src/teams-react/components/BrandMark.tsx"],"sourcesContent":["/**\n * Invite-accept surface for `/invite/:token`. Renders the invite state (valid /\n * invalid / already-accepted), handles the signed-out path (sign in or create\n * an account with the invited email), the email-mismatch path (switch account),\n * and the accept action. Callback-driven: the host supplies the resolved\n * `details` and `onAccept` / `onNavigate`, so this imports no app router or\n * fetch client. Styled with the shipped Tangle Quiet tokens (`var(--*)`).\n */\n\nimport { useState } from 'react'\nimport type { InviteAcceptPageProps } from '../contracts'\nimport { BrandMark } from './BrandMark'\n\nexport function InviteAcceptPage({ details, onAccept, onNavigate, onResendVerification }: InviteAcceptPageProps) {\n const [accepting, setAccepting] = useState(false)\n const [acceptError, setAcceptError] = useState<string | null>(null)\n const [accepted, setAccepted] = useState(false)\n const [resendingVerification, setResendingVerification] = useState(false)\n const [verificationSent, setVerificationSent] = useState(false)\n\n if (details.status === 'invalid') {\n return (\n <Shell title=\"Invalid invitation\" body=\"This link is invalid or already used. Ask the workspace admin to send a new one.\">\n <PrimaryButton onClick={() => onNavigate({ kind: 'sign-in' })}>Go to sign in</PrimaryButton>\n </Shell>\n )\n }\n\n if (details.status === 'already-accepted') {\n return (\n <Shell title=\"Already accepted\" body=\"This invitation has already been accepted.\">\n <PrimaryButton onClick={() => onNavigate({ kind: 'open-app' })}>Open workspace</PrimaryButton>\n </Shell>\n )\n }\n\n if (details.status === 'expired') {\n return (\n <Shell title=\"Invitation expired\" body=\"This invitation has expired. Ask the workspace admin to send a new one.\">\n <PrimaryButton onClick={() => onNavigate({ kind: 'sign-in' })}>Go to sign in</PrimaryButton>\n </Shell>\n )\n }\n\n if (details.status === 'revoked') {\n return (\n <Shell title=\"Invitation revoked\" body=\"This invitation has been revoked. Ask the workspace admin to send a new one.\">\n <PrimaryButton onClick={() => onNavigate({ kind: 'sign-in' })}>Go to sign in</PrimaryButton>\n </Shell>\n )\n }\n\n const workspaceName = details.workspaceName ?? 'a workspace'\n const inviterPrefix = details.inviterName ? `${details.inviterName} invited you` : \"You've been invited\"\n const roleSuffix = details.role ? ` as ${details.role}` : ''\n\n if (!details.currentUserEmail) {\n return (\n <Shell title=\"You've been invited\">\n <p className=\"mb-4 text-sm text-[var(--text-secondary)]\">\n {inviterPrefix} to join <span className=\"font-medium text-[var(--text-primary)]\">{workspaceName}</span>{roleSuffix}.\n </p>\n {details.inviteEmail && (\n <p className=\"mb-6 text-sm text-[var(--text-secondary)]\">\n Sign in or create an account with{' '}\n <span className=\"font-medium text-[var(--text-primary)]\">{details.inviteEmail}</span> to accept.\n </p>\n )}\n <div className=\"flex gap-2\">\n <PrimaryButton onClick={() => onNavigate({ kind: 'sign-in' })}>Sign in</PrimaryButton>\n <SecondaryButton onClick={() => onNavigate({ kind: 'sign-up' })}>Create account</SecondaryButton>\n </div>\n </Shell>\n )\n }\n\n if (accepted) {\n return (\n <Shell title=\"Welcome!\">\n <p className=\"text-sm text-[var(--text-secondary)]\">\n You've joined <span className=\"font-medium text-[var(--text-primary)]\">{workspaceName}</span>.\n </p>\n </Shell>\n )\n }\n\n const emailMismatch = Boolean(\n details.inviteEmail &&\n details.inviteEmail.toLowerCase() !== details.currentUserEmail.toLowerCase(),\n )\n const needsVerification = Boolean(details.needsEmailVerification) && !emailMismatch\n const expiryLabel = details.expiresAt != null\n ? new Date(details.expiresAt).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })\n : null\n\n async function handleAccept() {\n setAccepting(true)\n setAcceptError(null)\n try {\n const result = await onAccept()\n setAccepted(true)\n if (result && 'workspaceId' in result && result.workspaceId) {\n onNavigate({ kind: 'open-app', workspaceId: result.workspaceId })\n }\n } catch (err) {\n setAcceptError(err instanceof Error ? err.message : 'Failed to accept invitation')\n } finally {\n setAccepting(false)\n }\n }\n\n async function handleResendVerification() {\n if (!onResendVerification || resendingVerification) return\n setResendingVerification(true)\n try {\n await onResendVerification()\n setVerificationSent(true)\n } finally {\n setResendingVerification(false)\n }\n }\n\n return (\n <Shell title=\"Join workspace\">\n <p className=\"mb-4 text-sm text-[var(--text-secondary)]\">\n {inviterPrefix} to join <span className=\"font-medium text-[var(--text-primary)]\">{workspaceName}</span>{roleSuffix}.\n </p>\n <p className=\"mb-4 text-sm text-[var(--text-secondary)]\">\n Signed in as <span className=\"font-medium text-[var(--text-primary)]\">{details.currentUserEmail}</span>\n </p>\n {expiryLabel && (\n <p className=\"mb-4 text-xs text-[var(--text-muted)]\">This invitation expires on {expiryLabel}.</p>\n )}\n {emailMismatch && (\n <div\n role=\"alert\"\n className=\"mb-4 rounded-md border border-[var(--border-default)] px-4 py-2 text-sm text-[var(--text-warning)]\"\n >\n This invitation was sent to <span className=\"font-medium\">{details.inviteEmail}</span>. Switch to that account to accept it.\n </div>\n )}\n {needsVerification && (\n <div\n role=\"alert\"\n className=\"mb-4 rounded-md border border-[var(--border-default)] px-4 py-2 text-sm text-[var(--text-warning)]\"\n >\n {verificationSent\n ? 'Verification email sent — check your inbox, then refresh this page to accept.'\n : 'Verify your email address before you can accept this invitation.'}\n </div>\n )}\n {acceptError && (\n <p role=\"alert\" className=\"mb-4 text-sm text-[var(--text-danger)]\">{acceptError}</p>\n )}\n <div className=\"flex gap-2\">\n {emailMismatch ? (\n <PrimaryButton onClick={() => onNavigate({ kind: 'switch-account' })}>Switch account</PrimaryButton>\n ) : needsVerification ? (\n onResendVerification ? (\n <PrimaryButton\n onClick={() => void handleResendVerification()}\n disabled={resendingVerification || verificationSent}\n >\n {verificationSent ? 'Verification sent' : resendingVerification ? 'Sending…' : 'Resend verification email'}\n </PrimaryButton>\n ) : (\n <PrimaryButton onClick={() => onNavigate({ kind: 'open-app' })}>Open app</PrimaryButton>\n )\n ) : (\n <PrimaryButton onClick={() => void handleAccept()} disabled={accepting}>\n {accepting ? 'Accepting…' : 'Accept invitation'}\n </PrimaryButton>\n )}\n <SecondaryButton onClick={() => onNavigate({ kind: 'open-app' })}>Not now</SecondaryButton>\n </div>\n </Shell>\n )\n}\n\nfunction Shell({ title, body, children }: { title: string; body?: string; children: React.ReactNode }) {\n return (\n <div className=\"mx-auto flex w-full max-w-sm flex-col\">\n <span className=\"mb-4 flex items-center gap-2 text-[var(--text-muted)]\">\n <BrandMark size={22} className=\"shrink-0\" />\n <span className=\"text-xs font-semibold uppercase tracking-[0.05em]\">Tangle Teams</span>\n </span>\n <h1 className=\"mb-1 text-xl font-semibold tracking-tight text-[var(--text-primary)]\">{title}</h1>\n {body && <p className=\"mb-6 text-sm text-[var(--text-secondary)]\">{body}</p>}\n {children}\n </div>\n )\n}\n\nfunction PrimaryButton({ children, onClick, disabled }: { children: React.ReactNode; onClick(): void; disabled?: boolean }) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className=\"flex-1 rounded bg-[var(--brand-primary)] px-4 py-2 text-sm text-[hsl(var(--primary-foreground))] disabled:opacity-50\"\n >\n {children}\n </button>\n )\n}\n\nfunction SecondaryButton({ children, onClick }: { children: React.ReactNode; onClick(): void }) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className=\"flex-1 rounded border border-[var(--border-default)] px-4 py-2 text-sm text-[var(--text-secondary)] hover:text-[var(--text-primary)]\"\n >\n {children}\n </button>\n )\n}\n","/**\n * Load the canonical Tangle knot only when a teams surface renders it.\n * `/brand` imports the optional `@tangle-network/brand` peer, so a failed load\n * renders a fixed-size spacer instead of crashing the panel.\n */\n\nimport { lazy, Suspense } from 'react'\nimport type { ComponentType } from 'react'\n\nexport interface BrandMarkProps {\n size: number\n className?: string\n}\n\n/** Preserve the mark's footprint while its optional package loads or is absent. */\nfunction MarkSpacer({ size }: { size: number }) {\n return <span aria-hidden style={{ display: 'inline-block', width: size, height: size }} />\n}\n\nconst LazyKnot = lazy(async () => {\n try {\n const mod = await import('../../brand')\n return { default: mod.TangleKnot as ComponentType<BrandMarkProps> }\n } catch {\n return { default: MarkSpacer as ComponentType<BrandMarkProps> }\n }\n})\n\nexport function BrandMark({ size, className }: BrandMarkProps) {\n return (\n <Suspense fallback={<MarkSpacer size={size} />}>\n <LazyKnot size={size} className={className} />\n </Suspense>\n )\n}\n"],"mappings":";AASA,SAAS,gBAAgB;;;ACHzB,SAAS,MAAM,gBAAgB;AAUtB;AADT,SAAS,WAAW,EAAE,KAAK,GAAqB;AAC9C,SAAO,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,IACA,gBAAAA,KAAC,QAAG,WAAU,wEAAwE,iBAAM;AAAA,IAC3F,QAAQ,gBAAAA,KAAC,OAAE,WAAU,6CAA6C,gBAAK;AAAA,IACvE;AAAA,KACH;AAEJ;AAEA,SAAS,cAAc,EAAE,UAAU,SAAS,SAAS,GAAuE;AAC1H,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,WAAU;AAAA,MAET;AAAA;AAAA,EACH;AAEJ;AAEA,SAAS,gBAAgB,EAAE,UAAU,QAAQ,GAAmD;AAC9F,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA,WAAU;AAAA,MAET;AAAA;AAAA,EACH;AAEJ;","names":["jsx"]}
|
package/dist/run/index.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Execution-mode dispatch — the shell entry that infers *how* to run an agent
|
|
3
|
-
* from its profile's harness, so a product hands over one profile and the
|
|
4
|
-
* framework routes to the router tool loop or a sandbox without separate wiring.
|
|
5
|
-
*
|
|
6
|
-
* The discriminator is the harness: absent / null / 'router' => the router tool
|
|
7
|
-
* agent (`@tangle-network/agent-app/runtime`); any member of `KNOWN_HARNESSES`
|
|
8
|
-
* (opencode, claude-code, …) => a sandbox (`@tangle-network/agent-app/sandbox`).
|
|
9
|
-
* `KNOWN_HARNESSES` is exactly the set of sandbox backends; the *absence* of a
|
|
10
|
-
* harness is the router signal.
|
|
11
|
-
*
|
|
12
|
-
* `runAgent` owns the inference + routing; the two branch runners are injected,
|
|
13
|
-
* because their inputs and event shapes legitimately differ (the router loop
|
|
14
|
-
* yields `LoopEvent`s, the sandbox yields its own events). A product supplies a
|
|
15
|
-
* `router`/`sandbox` thunk and can lazy-import the sandbox driver inside its own
|
|
16
|
-
* thunk, so a router-only app never resolves `@tangle-network/sandbox`.
|
|
17
|
-
*/
|
|
18
|
-
import { type Harness } from '../harness/index';
|
|
19
|
-
/** Define execution mode as either router or sandbox */
|
|
20
|
-
export type ExecutionMode = 'router' | 'sandbox';
|
|
21
|
-
/** The router pseudo-harness — the absence of a sandbox backend. Not a member
|
|
22
|
-
* of `KNOWN_HARNESSES`; callers may pass it explicitly instead of null. */
|
|
23
|
-
export declare const ROUTER_HARNESS: 'router';
|
|
24
|
-
/** Provide a type alias for the ROUTER_HARNESS constant to enable consistent router harness usage */
|
|
25
|
-
export type RouterHarness = typeof ROUTER_HARNESS;
|
|
26
|
-
/** Resolve a ProfileHarness as a Harness, RouterHarness, null, or undefined value */
|
|
27
|
-
export type ProfileHarness = Harness | RouterHarness | null | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* Infer the execution mode from a profile's harness. Absent / null / 'router'
|
|
30
|
-
* => 'router'; a known sandbox harness => 'sandbox'. An unrecognized non-null
|
|
31
|
-
* string is treated as a sandbox backend (the box installs all harnesses, so an
|
|
32
|
-
* unknown id is a sandbox the runtime resolves, not a router) — callers that
|
|
33
|
-
* want strictness can validate against `KNOWN_HARNESSES` first.
|
|
34
|
-
*/
|
|
35
|
-
export declare function resolveExecutionMode(harness: ProfileHarness): ExecutionMode;
|
|
36
|
-
/** True when `harness` names a sandbox backend the SDK knows about. */
|
|
37
|
-
export declare function isKnownSandboxHarness(harness: ProfileHarness): harness is Harness;
|
|
38
|
-
/**
|
|
39
|
-
* The superset the dispatch reads: the SDK `AgentProfile` plus the harness
|
|
40
|
-
* discriminator. Intentionally pins only `harness` — the rest of the profile is
|
|
41
|
-
* carried opaquely so this module stays free of the SDK type (router-only apps
|
|
42
|
-
* import it without `@tangle-network/sandbox`).
|
|
43
|
-
*/
|
|
44
|
-
export interface ShellProfile {
|
|
45
|
-
harness?: ProfileHarness;
|
|
46
|
-
}
|
|
47
|
-
/** Execution mode for a profile — `harness` omitted/null => router. */
|
|
48
|
-
export declare function executionModeForProfile(profile: ShellProfile): ExecutionMode;
|
|
49
|
-
/** The two branch runners. Each returns (or resolves to) an async iterable of
|
|
50
|
-
* the product's own event type — the shapes differ, so the product owns them.
|
|
51
|
-
* A `sandbox` thunk can `await import('@tangle-network/agent-app/sandbox')`
|
|
52
|
-
* internally so the SDK is pulled only on the sandbox path. */
|
|
53
|
-
export interface RunAgentBranches<T> {
|
|
54
|
-
router: () => AsyncIterable<T> | Promise<AsyncIterable<T>>;
|
|
55
|
-
sandbox: () => AsyncIterable<T> | Promise<AsyncIterable<T>>;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Route a turn to the branch the harness selects and stream its events through.
|
|
59
|
-
* The shell does the inference; the product supplies how each branch runs. The
|
|
60
|
-
* unselected branch's thunk is never invoked — so its dependencies (e.g. the
|
|
61
|
-
* sandbox SDK) are never loaded on the other path.
|
|
62
|
-
*/
|
|
63
|
-
export declare function runAgent<T>(harness: ProfileHarness, branches: RunAgentBranches<T>): AsyncGenerator<T>;
|
package/dist/run/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
KNOWN_HARNESSES
|
|
3
|
-
} from "../chunk-MCYJON3F.js";
|
|
4
|
-
|
|
5
|
-
// src/run/index.ts
|
|
6
|
-
var ROUTER_HARNESS = "router";
|
|
7
|
-
function resolveExecutionMode(harness) {
|
|
8
|
-
if (harness == null || harness === ROUTER_HARNESS) return "router";
|
|
9
|
-
return "sandbox";
|
|
10
|
-
}
|
|
11
|
-
function isKnownSandboxHarness(harness) {
|
|
12
|
-
return harness != null && harness !== ROUTER_HARNESS && KNOWN_HARNESSES.includes(harness);
|
|
13
|
-
}
|
|
14
|
-
function executionModeForProfile(profile) {
|
|
15
|
-
return resolveExecutionMode(profile.harness);
|
|
16
|
-
}
|
|
17
|
-
async function* runAgent(harness, branches) {
|
|
18
|
-
const mode = resolveExecutionMode(harness);
|
|
19
|
-
const source = mode === "sandbox" ? branches.sandbox() : branches.router();
|
|
20
|
-
const iterable = await source;
|
|
21
|
-
for await (const event of iterable) yield event;
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
ROUTER_HARNESS,
|
|
25
|
-
executionModeForProfile,
|
|
26
|
-
isKnownSandboxHarness,
|
|
27
|
-
resolveExecutionMode,
|
|
28
|
-
runAgent
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
package/dist/run/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/run/index.ts"],"sourcesContent":["/**\n * Execution-mode dispatch — the shell entry that infers *how* to run an agent\n * from its profile's harness, so a product hands over one profile and the\n * framework routes to the router tool loop or a sandbox without separate wiring.\n *\n * The discriminator is the harness: absent / null / 'router' => the router tool\n * agent (`@tangle-network/agent-app/runtime`); any member of `KNOWN_HARNESSES`\n * (opencode, claude-code, …) => a sandbox (`@tangle-network/agent-app/sandbox`).\n * `KNOWN_HARNESSES` is exactly the set of sandbox backends; the *absence* of a\n * harness is the router signal.\n *\n * `runAgent` owns the inference + routing; the two branch runners are injected,\n * because their inputs and event shapes legitimately differ (the router loop\n * yields `LoopEvent`s, the sandbox yields its own events). A product supplies a\n * `router`/`sandbox` thunk and can lazy-import the sandbox driver inside its own\n * thunk, so a router-only app never resolves `@tangle-network/sandbox`.\n */\n\nimport { KNOWN_HARNESSES, type Harness } from '../harness/index'\n\n/** Define execution mode as either router or sandbox */\nexport type ExecutionMode = 'router' | 'sandbox'\n\n/** The router pseudo-harness — the absence of a sandbox backend. Not a member\n * of `KNOWN_HARNESSES`; callers may pass it explicitly instead of null. */\nexport const ROUTER_HARNESS = 'router' as const\n/** Provide a type alias for the ROUTER_HARNESS constant to enable consistent router harness usage */\nexport type RouterHarness = typeof ROUTER_HARNESS\n\n/** Resolve a ProfileHarness as a Harness, RouterHarness, null, or undefined value */\nexport type ProfileHarness = Harness | RouterHarness | null | undefined\n\n/**\n * Infer the execution mode from a profile's harness. Absent / null / 'router'\n * => 'router'; a known sandbox harness => 'sandbox'. An unrecognized non-null\n * string is treated as a sandbox backend (the box installs all harnesses, so an\n * unknown id is a sandbox the runtime resolves, not a router) — callers that\n * want strictness can validate against `KNOWN_HARNESSES` first.\n */\nexport function resolveExecutionMode(harness: ProfileHarness): ExecutionMode {\n if (harness == null || harness === ROUTER_HARNESS) return 'router'\n return 'sandbox'\n}\n\n/** True when `harness` names a sandbox backend the SDK knows about. */\nexport function isKnownSandboxHarness(harness: ProfileHarness): harness is Harness {\n return harness != null && harness !== ROUTER_HARNESS && (KNOWN_HARNESSES as readonly string[]).includes(harness)\n}\n\n/**\n * The superset the dispatch reads: the SDK `AgentProfile` plus the harness\n * discriminator. Intentionally pins only `harness` — the rest of the profile is\n * carried opaquely so this module stays free of the SDK type (router-only apps\n * import it without `@tangle-network/sandbox`).\n */\nexport interface ShellProfile {\n harness?: ProfileHarness\n}\n\n/** Execution mode for a profile — `harness` omitted/null => router. */\nexport function executionModeForProfile(profile: ShellProfile): ExecutionMode {\n return resolveExecutionMode(profile.harness)\n}\n\n/** The two branch runners. Each returns (or resolves to) an async iterable of\n * the product's own event type — the shapes differ, so the product owns them.\n * A `sandbox` thunk can `await import('@tangle-network/agent-app/sandbox')`\n * internally so the SDK is pulled only on the sandbox path. */\nexport interface RunAgentBranches<T> {\n router: () => AsyncIterable<T> | Promise<AsyncIterable<T>>\n sandbox: () => AsyncIterable<T> | Promise<AsyncIterable<T>>\n}\n\n/**\n * Route a turn to the branch the harness selects and stream its events through.\n * The shell does the inference; the product supplies how each branch runs. The\n * unselected branch's thunk is never invoked — so its dependencies (e.g. the\n * sandbox SDK) are never loaded on the other path.\n */\nexport async function* runAgent<T>(\n harness: ProfileHarness,\n branches: RunAgentBranches<T>,\n): AsyncGenerator<T> {\n const mode = resolveExecutionMode(harness)\n const source = mode === 'sandbox' ? branches.sandbox() : branches.router()\n const iterable = await source\n for await (const event of iterable) yield event\n}\n"],"mappings":";;;;;AAyBO,IAAM,iBAAiB;AAcvB,SAAS,qBAAqB,SAAwC;AAC3E,MAAI,WAAW,QAAQ,YAAY,eAAgB,QAAO;AAC1D,SAAO;AACT;AAGO,SAAS,sBAAsB,SAA6C;AACjF,SAAO,WAAW,QAAQ,YAAY,kBAAmB,gBAAsC,SAAS,OAAO;AACjH;AAaO,SAAS,wBAAwB,SAAsC;AAC5E,SAAO,qBAAqB,QAAQ,OAAO;AAC7C;AAiBA,gBAAuB,SACrB,SACA,UACmB;AACnB,QAAM,OAAO,qBAAqB,OAAO;AACzC,QAAM,SAAS,SAAS,YAAY,SAAS,QAAQ,IAAI,SAAS,OAAO;AACzE,QAAM,WAAW,MAAM;AACvB,mBAAiB,SAAS,SAAU,OAAM;AAC5C;","names":[]}
|
package/dist/tangle/index.d.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tangle login + the developer self-service app-registration → broker-token
|
|
3
|
-
* flow, for apps built on agent-app.
|
|
4
|
-
*
|
|
5
|
-
* The platform (agent-dev-container integration hub) lets a developer register
|
|
6
|
-
* their client app and obtain a `sk-tan-broker-` bearer to call `/v1/hub/exec`
|
|
7
|
-
* on a user's connected integrations — WITHOUT being a hard-coded "trusted app".
|
|
8
|
-
* The wire client (`TangleAppsClient` — registerApp / exchangeAuthCode /
|
|
9
|
-
* mintBrokerToken) lives in `@tangle-network/agent-integrations`; this module is
|
|
10
|
-
* the app-shell layer on top, and is intentionally **structural**: it depends on
|
|
11
|
-
* the minter CONTRACT, not the concrete client, so it installs without the
|
|
12
|
-
* agent-integrations publish and is trivially testable. A consumer constructs
|
|
13
|
-
* the real client and passes it in.
|
|
14
|
-
*
|
|
15
|
-
* 1. {@link buildConsentUrl} — send the user through the ONE-TIME consent
|
|
16
|
-
* (their Tangle session authorizes the app for a connection + scopes).
|
|
17
|
-
* 2. On the callback, the consumer's client `exchangeAuthCode`s the `agc_`
|
|
18
|
-
* code into the first broker token + a durable grant.
|
|
19
|
-
* 3. {@link createBrokerTokenProvider} — the runtime path: each request mints
|
|
20
|
-
* a fresh single-use broker token from the durable grant using only app
|
|
21
|
-
* credentials (no user session). Neither tokens nor in-flight mint
|
|
22
|
-
* promises may be shared between execution attempts.
|
|
23
|
-
*/
|
|
24
|
-
/** A single-use hub bearer minted from a durable grant — mirrors
|
|
25
|
-
* `@tangle-network/agent-integrations`'s `BrokerToken`. */
|
|
26
|
-
export interface BrokerToken {
|
|
27
|
-
/** The `sk-tan-broker-…` bearer for a single `/v1/hub/exec` call. */
|
|
28
|
-
accessToken: string;
|
|
29
|
-
/** Seconds until expiry. */
|
|
30
|
-
expiresIn: number;
|
|
31
|
-
scope: string;
|
|
32
|
-
connectionId?: string;
|
|
33
|
-
}
|
|
34
|
-
/** The one method the provider needs — `TangleAppsClient` satisfies it
|
|
35
|
-
* structurally, so `createBrokerTokenProvider({ client: tangleAppsClient, … })`
|
|
36
|
-
* type-checks without importing the concrete class. */
|
|
37
|
-
export interface BrokerTokenMinter {
|
|
38
|
-
mintBrokerToken(input: {
|
|
39
|
-
clientId: string;
|
|
40
|
-
clientSecret: string;
|
|
41
|
-
grantId: string;
|
|
42
|
-
ttlSeconds?: number;
|
|
43
|
-
}): Promise<BrokerToken>;
|
|
44
|
-
}
|
|
45
|
-
/** Define input parameters required to generate a consent URL for OAuth authorization */
|
|
46
|
-
export interface ConsentUrlInput {
|
|
47
|
-
/** Platform base URL (e.g. https://id.tangle.tools). */
|
|
48
|
-
endpoint: string;
|
|
49
|
-
clientId: string;
|
|
50
|
-
/** Must match one of the app's registered redirect URIs. */
|
|
51
|
-
redirectUri: string;
|
|
52
|
-
/** Scopes the app is requesting for this connection (e.g. ['gmail.read']). */
|
|
53
|
-
scopes: string[];
|
|
54
|
-
/** Opaque CSRF/state value the callback echoes back — verify it on return. */
|
|
55
|
-
state: string;
|
|
56
|
-
/** Optionally pre-select a specific connection to authorize. */
|
|
57
|
-
connectionId?: string;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Build the URL to send the user to for the one-time app-consent. The user's
|
|
61
|
-
* Tangle session (not the app's credentials) authorizes it; on approval the
|
|
62
|
-
* platform redirects to `redirectUri?code=agc_…&state=…`.
|
|
63
|
-
*/
|
|
64
|
-
export declare function buildConsentUrl(input: ConsentUrlInput): string;
|
|
65
|
-
/** Define options for configuring a broker token provider including client credentials and token management settings */
|
|
66
|
-
export interface BrokerTokenProviderOptions {
|
|
67
|
-
client: BrokerTokenMinter;
|
|
68
|
-
clientId: string;
|
|
69
|
-
clientSecret: string;
|
|
70
|
-
/** The durable grant id from the consent exchange. */
|
|
71
|
-
grantId: string;
|
|
72
|
-
/** Requested token TTL (seconds). */
|
|
73
|
-
ttlSeconds?: number;
|
|
74
|
-
/** @deprecated Retained for source compatibility. Single-use tokens are
|
|
75
|
-
* never cached, so refresh skew is ignored. */
|
|
76
|
-
refreshSkewMs?: number;
|
|
77
|
-
/** @deprecated Retained for source compatibility; no local expiry cache. */
|
|
78
|
-
now?: () => number;
|
|
79
|
-
}
|
|
80
|
-
/** Mint a separate single-use bearer for each execution attempt. */
|
|
81
|
-
export interface BrokerTokenProvider {
|
|
82
|
-
/** Mint a fresh bearer for exactly one Hub execution; never cache or share it. */
|
|
83
|
-
getToken(): Promise<string>;
|
|
84
|
-
/** Compatibility no-op: no bearer is cached. Does not revoke Hub grants or
|
|
85
|
-
* already-issued tokens; revocation belongs to the authoritative Hub. */
|
|
86
|
-
invalidate(): void;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Mint a fresh broker token for every call, including concurrent calls.
|
|
90
|
-
* A broker bearer is consumed by one Hub execution even when its TTL has not
|
|
91
|
-
* expired. Cache the durable grant, never the bearer or an in-flight mint.
|
|
92
|
-
* Mint failures propagate; this helper never retries an external action.
|
|
93
|
-
*/
|
|
94
|
-
export declare function createBrokerTokenProvider(opts: BrokerTokenProviderOptions): BrokerTokenProvider;
|