@alook/app 0.0.99 → 0.0.100
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/bundled/email-worker/index.js +18 -6
- package/bundled/web/.open-next/.build/durable-objects/queue.js +5 -5
- package/bundled/web/.open-next/assets/BUILD_ID +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{0-grycx2tn0o4.js → 0.9oyh86wn1fd.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0.wmvlzzu_8e0.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/04-19vra169mj.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{16_j-kl72ldc4.js → 07ju9-jia-17m.js} +2 -2
- package/bundled/web/.open-next/assets/_next/static/chunks/0ecg50a33jlsr.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{07mm2xbk2l5.8.js → 0rt6~o9u6663h.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{0fuk9p58--.z9.js → 0uayv05d6mntr.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0x2fen2lqx6j3.js +1 -0
- package/bundled/web/.open-next/cache/{GDrv2wl3f0uavEhQh6kAN → stPDLxY2tICyNcpCDMCz4}/_global-error.cache +1 -1
- package/bundled/web/.open-next/cache/{GDrv2wl3f0uavEhQh6kAN → stPDLxY2tICyNcpCDMCz4}/_not-found.cache +1 -1
- package/bundled/web/.open-next/cache/{GDrv2wl3f0uavEhQh6kAN → stPDLxY2tICyNcpCDMCz4}/privacy.cache +1 -1
- package/bundled/web/.open-next/cache/{GDrv2wl3f0uavEhQh6kAN → stPDLxY2tICyNcpCDMCz4}/sitemap.xml.cache +1 -1
- package/bundled/web/.open-next/cloudflare/cache-assets-manifest.sql +1 -1
- package/bundled/web/.open-next/cloudflare/init.js +1 -1
- package/bundled/web/.open-next/dynamodb-provider/dynamodb-cache.json +1 -1
- package/bundled/web/.open-next/middleware/handler.mjs +5 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/BUILD_ID +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/build-manifest.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/prerender-manifest.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/invite/[token]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/studio/new/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/activity/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/[convId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/email/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/files/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/meetings/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/new/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/calendar/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/flags/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/help/email-setup/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/home/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/issues/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/runtimes/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/settings/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/threads/[traceId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/threads/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/unread/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/workspaces/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(auth)/sign-in/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/privacy/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/[id]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__11hxiyn._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0i4u2y-._.js +6 -6
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0iw.~u_._.js +6 -6
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0j3ag~p._.js +6 -6
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0j_~vur._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0mk4o2l._.js +6 -6
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0ow_nxn._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0s~hhx-._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__07of89~._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0_.06ux._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0u~xh2v._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_12yhe5_._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_13__3im._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_0stugv_._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_lib_api_ts_0uf2r1p._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-build-manifest.js +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-manifest.json +5 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs +40 -40
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +52 -52
- package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +3 -3
- package/bundled/web/migrations/0034_agent_skill_daemon_id.sql +9 -0
- package/bundled/web/wrangler.toml +1 -1
- package/bundled/ws-do/index.js +18 -6
- package/dist/cli/index.js +193 -233
- package/dist/cli/session-runner.js +17 -4
- package/dist/index.js +43 -19
- package/package.json +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0aw17s_pfw2u1.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0slwbsjlzqxt6.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0svwh_nhh5rxk.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/14byu.0wtroj8.js +0 -1
- /package/bundled/web/.open-next/assets/_next/static/{GDrv2wl3f0uavEhQh6kAN → stPDLxY2tICyNcpCDMCz4}/_buildManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{GDrv2wl3f0uavEhQh6kAN → stPDLxY2tICyNcpCDMCz4}/_clientMiddlewareManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{GDrv2wl3f0uavEhQh6kAN → stPDLxY2tICyNcpCDMCz4}/_ssgManifest.js +0 -0
- /package/bundled/web/.open-next/cache/{GDrv2wl3f0uavEhQh6kAN → stPDLxY2tICyNcpCDMCz4}/robots.txt.cache +0 -0
|
@@ -14802,6 +14802,7 @@ var SkillItemSchema = exports_external.object({
|
|
|
14802
14802
|
var SkillSyncRequestSchema = exports_external.object({
|
|
14803
14803
|
scope: exports_external.enum(["global", "agent"]),
|
|
14804
14804
|
agent_id: exports_external.string().min(1).optional(),
|
|
14805
|
+
daemon_id: exports_external.string().min(1).optional(),
|
|
14805
14806
|
runtime: exports_external.enum(["claude", "codex", "opencode"]),
|
|
14806
14807
|
skills: exports_external.array(SkillItemSchema)
|
|
14807
14808
|
});
|
|
@@ -16701,12 +16702,13 @@ var agentSkill = sqliteTable("agent_skill", {
|
|
|
16701
16702
|
id: text("id").primaryKey().$defaultFn(() => "as_" + nanoid3()),
|
|
16702
16703
|
workspaceId: text("workspace_id").notNull().references(() => workspace.id, { onDelete: "cascade" }),
|
|
16703
16704
|
agentId: text("agent_id"),
|
|
16705
|
+
daemonId: text("daemon_id"),
|
|
16704
16706
|
runtime: text("runtime").notNull(),
|
|
16705
16707
|
name: text("name").notNull(),
|
|
16706
16708
|
description: text("description").notNull().default(""),
|
|
16707
16709
|
syncedAt: text("synced_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
16708
16710
|
}, (t) => [
|
|
16709
|
-
unique("
|
|
16711
|
+
unique("agent_skill_ws_runtime_name_agent_daemon").on(t.workspaceId, t.runtime, t.name, t.agentId, t.daemonId),
|
|
16710
16712
|
index("idx_as_workspace_runtime").on(t.workspaceId, t.runtime),
|
|
16711
16713
|
index("idx_as_agent_runtime").on(t.agentId, t.runtime),
|
|
16712
16714
|
foreignKey({
|
|
@@ -18066,6 +18068,10 @@ ${task.agent.instructions}
|
|
|
18066
18068
|
`;
|
|
18067
18069
|
}
|
|
18068
18070
|
content += `
|
|
18071
|
+
**Isolated workspaces:**
|
|
18072
|
+
- Each agent runs in its own isolated workspace directory. Colleagues CANNOT read your local files — even in the same workspace.
|
|
18073
|
+
- When sending plans, code, or any file to a colleague, you MUST attach the file to the email (use --attachment). Never reference local file paths expecting them to read it.
|
|
18074
|
+
|
|
18069
18075
|
**Email threading rules:**
|
|
18070
18076
|
- When communicating with a colleague on the **same topic** as an existing email thread, reply to that thread (use --in-reply-to) to keep context together.
|
|
18071
18077
|
- **When starting a NEW topic or task that is unrelated to any previous email thread, you MUST compose a brand new email (do NOT use --in-reply-to). Never hijack an unrelated thread just because you recently emailed that colleague.** Judge by topic/task relevance, not by recency of communication.
|
|
@@ -18091,7 +18097,10 @@ ${lines.join(`
|
|
|
18091
18097
|
|
|
18092
18098
|
### Emails
|
|
18093
18099
|
---
|
|
18094
|
-
|
|
18100
|
+
When your task prompt includes an \`email_id\` field, fetch ONLY that specific email:
|
|
18101
|
+
- Run '${cmdPrefix()} email pull --email_id <EMAIL_ID>' (uses the email_id from the prompt)
|
|
18102
|
+
When no \`email_id\` is present, fall back to listing unread:
|
|
18103
|
+
- Run '${cmdPrefix()} email pull --status unread' to download unread emails from inbox to '${tempDir("alook-emails")}/${task.workspaceId}/${task.agentId}/'.
|
|
18095
18104
|
---
|
|
18096
18105
|
To download sent emails, add '--folder sent': '${cmdPrefix()} email pull --folder sent'
|
|
18097
18106
|
Valid folders: inbox (default), sent, untrust.
|
|
@@ -18278,7 +18287,8 @@ function prepare(config2, task) {
|
|
|
18278
18287
|
ALOOK_CONVERSATION_ID: task.conversationId,
|
|
18279
18288
|
ALOOK_TRACE_ID: task.traceId ?? "",
|
|
18280
18289
|
ALOOK_CHANNEL: task.channel ?? "default",
|
|
18281
|
-
ALOOK_HEALTH_PORT: process.env.ALOOK_HEALTH_PORT || "19514"
|
|
18290
|
+
ALOOK_HEALTH_PORT: process.env.ALOOK_HEALTH_PORT || "19514",
|
|
18291
|
+
...config2.token ? { ALOOK_TOKEN: config2.token } : {}
|
|
18282
18292
|
};
|
|
18283
18293
|
return { workDir, timelineDir, env };
|
|
18284
18294
|
}
|
|
@@ -18651,6 +18661,9 @@ function buildPrompt(task, attachments) {
|
|
|
18651
18661
|
} else {
|
|
18652
18662
|
obj.notice = EMAIL_NOTICE;
|
|
18653
18663
|
}
|
|
18664
|
+
if (ctx?.emailId != null) {
|
|
18665
|
+
obj.email_id = ctx.emailId;
|
|
18666
|
+
}
|
|
18654
18667
|
}
|
|
18655
18668
|
if (task.type === "calendar_event") {
|
|
18656
18669
|
obj.notice = CALENDAR_NOTICE;
|
|
@@ -18798,7 +18811,7 @@ async function runSession(input) {
|
|
|
18798
18811
|
const timelineDir = path.join(agentBaseDir, ".context_timeline").replace(/\\/g, "/");
|
|
18799
18812
|
mkdirSync4(timelineDir, { recursive: true });
|
|
18800
18813
|
await initEntryAsync(timelineDir, createTimelineEntry(task.id, task.prompt, task.type, undefined, process.pid, provider, task.contextKey, input.logFilePath));
|
|
18801
|
-
const { workDir, env } = prepare({ workspacesRoot }, task);
|
|
18814
|
+
const { workDir, env } = prepare({ workspacesRoot, token }, task);
|
|
18802
18815
|
let killed = false;
|
|
18803
18816
|
const earlyOnKill = async () => {
|
|
18804
18817
|
if (killed)
|
package/dist/index.js
CHANGED
|
@@ -19,8 +19,8 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
19
19
|
// src/index.ts
|
|
20
20
|
import { Command as Command6 } from "commander";
|
|
21
21
|
import { readFileSync as readFileSync4 } from "fs";
|
|
22
|
-
import { join as
|
|
23
|
-
import { fileURLToPath as
|
|
22
|
+
import { join as join12, dirname as dirname7 } from "path";
|
|
23
|
+
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
24
24
|
|
|
25
25
|
// src/commands/onboard.ts
|
|
26
26
|
import { Command } from "commander";
|
|
@@ -14993,6 +14993,7 @@ var SkillItemSchema = exports_external.object({
|
|
|
14993
14993
|
var SkillSyncRequestSchema = exports_external.object({
|
|
14994
14994
|
scope: exports_external.enum(["global", "agent"]),
|
|
14995
14995
|
agent_id: exports_external.string().min(1).optional(),
|
|
14996
|
+
daemon_id: exports_external.string().min(1).optional(),
|
|
14996
14997
|
runtime: exports_external.enum(["claude", "codex", "opencode"]),
|
|
14997
14998
|
skills: exports_external.array(SkillItemSchema)
|
|
14998
14999
|
});
|
|
@@ -16892,12 +16893,13 @@ var agentSkill = sqliteTable("agent_skill", {
|
|
|
16892
16893
|
id: text("id").primaryKey().$defaultFn(() => "as_" + nanoid3()),
|
|
16893
16894
|
workspaceId: text("workspace_id").notNull().references(() => workspace.id, { onDelete: "cascade" }),
|
|
16894
16895
|
agentId: text("agent_id"),
|
|
16896
|
+
daemonId: text("daemon_id"),
|
|
16895
16897
|
runtime: text("runtime").notNull(),
|
|
16896
16898
|
name: text("name").notNull(),
|
|
16897
16899
|
description: text("description").notNull().default(""),
|
|
16898
16900
|
syncedAt: text("synced_at").notNull().$defaultFn(() => new Date().toISOString())
|
|
16899
16901
|
}, (t) => [
|
|
16900
|
-
unique("
|
|
16902
|
+
unique("agent_skill_ws_runtime_name_agent_daemon").on(t.workspaceId, t.runtime, t.name, t.agentId, t.daemonId),
|
|
16901
16903
|
index("idx_as_workspace_runtime").on(t.workspaceId, t.runtime),
|
|
16902
16904
|
index("idx_as_agent_runtime").on(t.agentId, t.runtime),
|
|
16903
16905
|
foreignKey({
|
|
@@ -17501,10 +17503,32 @@ Dashboard: ${WEB_URL(ports.web)}`);
|
|
|
17501
17503
|
|
|
17502
17504
|
// src/commands/stop.ts
|
|
17503
17505
|
import { Command as Command3 } from "commander";
|
|
17506
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
17507
|
+
import { dirname as dirname4, join as join9 } from "path";
|
|
17508
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
17509
|
+
var __dirname4 = dirname4(fileURLToPath3(import.meta.url));
|
|
17510
|
+
function cliEntry() {
|
|
17511
|
+
return join9(__dirname4, "cli", "index.js");
|
|
17512
|
+
}
|
|
17513
|
+
function stopDaemon() {
|
|
17514
|
+
const status = spawnSync2("node", [cliEntry(), "daemon", "status"], {
|
|
17515
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
17516
|
+
env: buildCliEnv()
|
|
17517
|
+
});
|
|
17518
|
+
const running = (status.stdout?.toString() ?? "").includes("running (pid=");
|
|
17519
|
+
if (!running)
|
|
17520
|
+
return false;
|
|
17521
|
+
spawnSync2("node", [cliEntry(), "daemon", "stop"], {
|
|
17522
|
+
stdio: "inherit",
|
|
17523
|
+
env: buildCliEnv()
|
|
17524
|
+
});
|
|
17525
|
+
return true;
|
|
17526
|
+
}
|
|
17504
17527
|
function stopCommand() {
|
|
17505
17528
|
return new Command3("stop").description("Stop all Alook services").action(() => {
|
|
17506
|
-
console.log("Stopping Alook services...");
|
|
17529
|
+
console.log("Stopping Alook services and daemon...");
|
|
17507
17530
|
stopServices();
|
|
17531
|
+
stopDaemon();
|
|
17508
17532
|
console.log(`
|
|
17509
17533
|
All services stopped.`);
|
|
17510
17534
|
});
|
|
@@ -17512,15 +17536,15 @@ All services stopped.`);
|
|
|
17512
17536
|
|
|
17513
17537
|
// src/commands/update.ts
|
|
17514
17538
|
import { Command as Command4 } from "commander";
|
|
17515
|
-
import { spawnSync as
|
|
17516
|
-
import { dirname as
|
|
17517
|
-
import { fileURLToPath as
|
|
17518
|
-
var
|
|
17519
|
-
function
|
|
17520
|
-
return
|
|
17539
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
17540
|
+
import { dirname as dirname5, join as join10 } from "path";
|
|
17541
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
17542
|
+
var __dirname5 = dirname5(fileURLToPath4(import.meta.url));
|
|
17543
|
+
function cliEntry2() {
|
|
17544
|
+
return join10(__dirname5, "cli", "index.js");
|
|
17521
17545
|
}
|
|
17522
17546
|
function runDaemon(args, quiet = false) {
|
|
17523
|
-
const result =
|
|
17547
|
+
const result = spawnSync3("node", [cliEntry2(), "daemon", ...args], {
|
|
17524
17548
|
stdio: quiet ? ["pipe", "pipe", "pipe"] : "inherit",
|
|
17525
17549
|
env: buildCliEnv()
|
|
17526
17550
|
});
|
|
@@ -17569,15 +17593,15 @@ function updateCommand() {
|
|
|
17569
17593
|
|
|
17570
17594
|
// src/commands/cli.ts
|
|
17571
17595
|
import { Command as Command5 } from "commander";
|
|
17572
|
-
import { spawnSync as
|
|
17573
|
-
import { dirname as
|
|
17574
|
-
import { fileURLToPath as
|
|
17575
|
-
var
|
|
17596
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
17597
|
+
import { dirname as dirname6, join as join11 } from "path";
|
|
17598
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
17599
|
+
var __dirname6 = dirname6(fileURLToPath5(import.meta.url));
|
|
17576
17600
|
function findCliEntry() {
|
|
17577
|
-
return
|
|
17601
|
+
return join11(__dirname6, "cli", "index.js");
|
|
17578
17602
|
}
|
|
17579
17603
|
function runCli(args) {
|
|
17580
|
-
const result =
|
|
17604
|
+
const result = spawnSync4("node", [findCliEntry(), ...args], {
|
|
17581
17605
|
stdio: "inherit",
|
|
17582
17606
|
env: buildCliEnv()
|
|
17583
17607
|
});
|
|
@@ -17609,8 +17633,8 @@ function cliPassthroughCommand() {
|
|
|
17609
17633
|
|
|
17610
17634
|
// src/index.ts
|
|
17611
17635
|
function getVersion() {
|
|
17612
|
-
const
|
|
17613
|
-
for (const candidate of [
|
|
17636
|
+
const __dirname7 = dirname7(fileURLToPath6(import.meta.url));
|
|
17637
|
+
for (const candidate of [join12(__dirname7, "..", "package.json"), join12(__dirname7, "..", "..", "package.json")]) {
|
|
17614
17638
|
try {
|
|
17615
17639
|
const pkg = JSON.parse(readFileSync4(candidate, "utf-8"));
|
|
17616
17640
|
if (pkg.version)
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,500324,e=>{"use strict";var t=e.i(368075),n=e.i(298699);let r=(0,n.createContext)(null);e.s(["WorkspaceProvider",0,function({workspaceId:e,slug:a,children:s}){return(0,n.useEffect)(()=>{try{localStorage.setItem("lastWorkspace",a)}catch{}},[a]),(0,t.jsx)(r.Provider,{value:{workspaceId:e,slug:a},children:s})},"useWorkspace",0,function(){let e=(0,n.useContext)(r);if(!e)throw Error("useWorkspace must be used within WorkspaceProvider");return e}])},222862,636557,e=>{"use strict";class t extends Error{status;details;constructor(e,t,n){super(e),this.name="ApiError",this.status=t,this.details=n}get isNetworkError(){return 0===this.status}get isRateLimit(){return 429===this.status}get isUnauthorized(){return 401===this.status}}function n(e,t){return"validation error"===e&&t?.length?function(e){let[t,...n]=e.split(":"),r=n.join(":").trim();if(!r)return e;let a=t.trim(),s=a.trim().replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase()),i=r.replace(/^required$/i,"is required"),o=i.toLowerCase().replace(/[_-]+/g," "),l=a.toLowerCase().replace(/[_-]+/g," ");return l&&o.startsWith(`${l} `)&&(i=i.slice(a.length).trimStart()),s?`${s} ${i}`:i}(t[0]):e}async function r(e,r){let a;try{a=await fetch(""+e,{...r,credentials:"include",headers:{"Content-Type":"application/json",...r?.headers}})}catch(e){if(e instanceof TypeError)throw new t("Unable to connect — check your network",0);throw e}if(401===a.status)throw window.location.href="/sign-in",new t("Unauthorized",401);if(!a.ok){let e,r;try{let t=await a.json();e=t.error,r=t.details}catch{}if(429===a.status)throw new t("Please wait a moment before trying again",429);if(a.status>=500)throw new t(n(e,r)||"Something went wrong — please try again",a.status,r);throw new t(n(e,r)||"Something went wrong",a.status,r)}if(204!==a.status)return a.json()}function a(e,t){let n=new URLSearchParams({workspace_id:e,...t});return`?${n.toString()}`}e.s(["ApiError",0,t],636557);let s=async(e,n,s,i)=>{let o;if(!i||0===i.length)return r(`/api/conversations/${e}/messages${a(s)}`,{method:"POST",body:JSON.stringify({content:n})});let l=new FormData;for(let e of(l.append("content",n),i))l.append("file",e);try{o=await fetch(`/api/conversations/${e}/messages${a(s)}`,{method:"POST",credentials:"include",body:l})}catch(e){if(e instanceof TypeError)throw new t("Unable to connect — check your network",0);throw e}if(401===o.status)throw window.location.href="/sign-in",new t("Unauthorized",401);if(!o.ok){let e,n;try{let t=await o.json();e=t.error,n=t.details}catch{}if(429===o.status)throw new t("Please wait a moment before trying again",429);if(o.status>=500)throw new t(e||"Something went wrong — please try again",o.status,n);throw new t(e||"Something went wrong",o.status,n)}return o.json()},i=async(e,n,s,i)=>{let o;if(!i||0===i.length)return r(`/api/conversations/${e}/buffered-messages${a(s)}`,{method:"POST",body:JSON.stringify({content:n})});let l=new FormData;for(let e of(l.append("content",n),i))l.append("file",e);try{o=await fetch(`/api/conversations/${e}/buffered-messages${a(s)}`,{method:"POST",credentials:"include",body:l})}catch(e){if(e instanceof TypeError)throw new t("Unable to connect — check your network",0);throw e}if(401===o.status)throw window.location.href="/sign-in",new t("Unauthorized",401);if(!o.ok){let e,n;try{let t=await o.json();e=t.error,n=t.details}catch{}if(429===o.status)throw new t(e||"Maximum follow-ups reached",429);if(o.status>=500)throw new t(e||"Something went wrong — please try again",o.status,n);throw new t(e||"Something went wrong",o.status,n)}return o.json()},o=async(e,t)=>{let n=new URLSearchParams({workspace_id:t}),r=await fetch(`/api/email/${e}/body?${n}`,{credentials:"include"});if(!r.ok)return{content:"(body not available)",isHtml:!1};let a=r.headers.get("Content-Type")??"";return{content:await r.text(),isHtml:a.includes("text/html")}},l=async(e,n)=>{let r=new FormData;r.append("file",e);let s=await fetch(`/api/email/upload${a(n)}`,{method:"POST",credentials:"include",body:r});if(!s.ok)throw new t(await s.text().catch(()=>"Upload failed"),s.status);return s.json()},c=async(e,n)=>{let s;if(!n.files||0===n.files.length)return r(`/api/issues${a(e)}`,{method:"POST",body:JSON.stringify({agent_id:n.agent_id,title:n.title,description:n.description})});let i=new FormData;for(let e of(n.agent_id&&i.append("agent_id",n.agent_id),i.append("title",n.title),i.append("description",n.description??""),n.files))i.append("file",e);try{s=await fetch(`/api/issues${a(e)}`,{method:"POST",credentials:"include",body:i})}catch(e){if(e instanceof TypeError)throw new t("Unable to connect — check your network",0);throw e}if(401===s.status)throw window.location.href="/sign-in",new t("Unauthorized",401);if(!s.ok){let e,n;try{let t=await s.json();e=t.error,n=t.details}catch{}if(429===s.status)throw new t("Please wait a moment before trying again",429);if(s.status>=500)throw new t(e||"Something went wrong — please try again",s.status,n);throw new t(e||"Something went wrong",s.status,n)}return s.json()},d=async(e,t)=>{let n=new URLSearchParams({workspace_id:t}),r=await fetch(`/api/artifacts/${e}/content?${n}`,{credentials:"include"});return r.ok?r.text():"(content not available)"};e.s(["acceptInvite",0,e=>r(`/api/invite/${e}`,{method:"POST"}),"addWhitelistEmail",0,(e,t,n)=>r(`/api/agents/${e}/whitelist${a(n)}`,{method:"POST",body:JSON.stringify({email:t})}),"approveMeeting",0,(e,t,n)=>r(`/api/agents/${e}/meetings/${t}/approve${a(n)}`,{method:"POST"}),"cancelActiveTask",0,(e,t)=>r(`/api/conversations/${e}/active-task${a(t)}`,{method:"DELETE"}),"chatInit",0,(e,t,n)=>r(`/api/agents/${e}/chat-init${a(t)}`,{method:"POST",body:JSON.stringify({...n?{channel:n}:{}})}),"checkFreshness",0,(e,t)=>{let n={};return e.conversationId&&(n.conversation_id=e.conversationId),e.agentId&&(n.agent_id=e.agentId),e.channel&&(n.channel=e.channel),r(`/api/conversations/check-fresh${a(t,n)}`)},"conversationInit",0,(e,t,n)=>{let s={};return n?.newestMessageId&&(s.newest_message_id=n.newestMessageId),r(`/api/conversations/${e}/init${a(t,s)}`)},"createAgent",0,(e,t)=>r(`/api/agents${a(t)}`,{method:"POST",body:JSON.stringify(e)}),"createAgentLink",0,(e,t)=>r(`/api/agent-links${a(t)}`,{method:"POST",body:JSON.stringify(e)}),"createBufferedMessage",0,i,"createCalendarEvent",0,(e,t)=>r(`/api/calendar${a(t)}`,{method:"POST",body:JSON.stringify(e)}),"createChannelApi",0,(e,t)=>r(`/api/channels${a(e)}`,{method:"POST",body:JSON.stringify({name:t})}),"createConversation",0,(e,t,n)=>r(`/api/conversations${a(t)}`,{method:"POST",body:JSON.stringify({agent_id:e,...n?{channel:n}:{}})}),"createEmailAccount",0,(e,t,n)=>r(`/api/agents/${e}/email-accounts${a(n)}`,{method:"POST",body:JSON.stringify(t)}),"createInvite",0,e=>r(`/api/workspaces/${e}/invites${a(e)}`,{method:"POST"}),"createIssue",0,c,"createMachineToken",0,(e,t)=>r(`/api/machine-tokens${t?a(t):""}`,{method:"POST",body:JSON.stringify({name:e||"default"})}),"createMeeting",0,(e,t,n)=>r(`/api/agents/${e}/meetings${a(t)}`,{method:"POST",body:JSON.stringify(n)}),"deleteAgent",0,(e,t)=>r(`/api/agents/${e}${a(t)}`,{method:"DELETE"}),"deleteAgentLink",0,(e,t)=>r(`/api/agent-links/${e}${a(t)}`,{method:"DELETE"}),"deleteBufferedMessage",0,(e,t,n)=>r(`/api/conversations/${e}/buffered-messages/${t}${a(n)}`,{method:"DELETE"}),"deleteCalendarEvent",0,(e,t,n)=>r(`/api/calendar/${e}${a(t)}`,{method:"DELETE",...n&&n.scope?{headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}:{}}),"deleteChannelApi",0,(e,t)=>r(`/api/channels/${e}${a(t)}`,{method:"DELETE"}),"deleteEmail",0,(e,t)=>r(`/api/email/${e}${a(t)}`,{method:"DELETE"}),"deleteEmailAccount",0,(e,t,n)=>r(`/api/agents/${e}/email-accounts/${t}${a(n)}`,{method:"DELETE"}),"deleteIssue",0,(e,t)=>r(`/api/issues/${t}${a(e)}`,{method:"DELETE"}),"deleteMachine",0,(e,t)=>r(`/api/runtimes/machine${a(t,{daemon_id:e})}`,{method:"DELETE"}),"deleteMeeting",0,(e,t,n)=>r(`/api/agents/${e}/meetings/${t}${a(n)}`,{method:"DELETE"}),"deleteWorkspace",0,(e,t)=>r(`/api/workspaces/${e}${a(e)}`,{method:"DELETE",body:JSON.stringify({confirm_name:t})}),"fetchLatestCliVersion",0,()=>r("/api/cli/latest-version"),"fetchModelOptions",0,()=>r("/api/config/model-options"),"flagMessage",0,(e,t)=>r(`/api/flags${a(e)}`,{method:"POST",body:JSON.stringify({messageId:t})}),"getActiveTask",0,(e,t)=>r(`/api/conversations/${e}/active-task${a(t)}`),"getAgentSkills",0,(e,t)=>r(`/api/agents/${e}/skills${a(t)}`),"getArtifactContent",0,d,"getCalendarEvent",0,(e,t)=>r(`/api/calendar/${e}${a(t)}`),"getEmail",0,(e,t)=>r(`/api/email/${e}${a(t)}`),"getEmailBody",0,o,"getEmailThread",0,(e,t)=>r(`/api/email/${e}/thread${a(t)}`),"getFlaggedCount",0,e=>r(`/api/flags/count${a(e)}`),"getInboxCount",0,(e,t)=>{let n={};return t?.types?.length&&(n.types=t.types.join(",")),r(`/api/inbox/count${a(e,n)}`)},"getInviteInfo",0,e=>r(`/api/invite/${e}`),"getIssue",0,(e,t)=>r(`/api/issues/${t}${a(e)}`),"getMemberMe",0,e=>r(`/api/members/me${a(e)}`),"getMinCliVersion",0,()=>r("/api/config/min-version"),"getTask",0,(e,t)=>r(`/api/tasks/${e}${a(t)}`),"getTaskMessages",0,(e,t,n)=>r(`/api/tasks/${e}/messages${a(t,n?{since:String(n)}:void 0)}`),"getTrace",0,(e,t)=>r(`/api/traces/${e}${a(t)}`),"getWorkspaceOverview",0,e=>r(`/api/workspaces/${e}/overview${a(e)}`),"grantAgentAccess",0,(e,t,n)=>r(`/api/agents/${t}/access${a(e)}`,{method:"POST",body:JSON.stringify({user_id:n})}),"listAgentAccess",0,(e,t)=>r(`/api/agents/${t}/access${a(e)}`),"listAgentActiveTaskCounts",0,e=>r(`/api/agents/active-task-counts${a(e)}`),"listAgentActivity",0,(e,t,n)=>{let s={};return n?.limit&&(s.limit=String(n.limit)),n?.before&&(s.before=n.before),n?.beforeId&&(s.before_id=n.beforeId),n?.status&&(s.status=n.status),n?.type&&(s.type=n.type),r(`/api/agents/${e}/activity${a(t,s)}`)},"listAgentLinks",0,e=>r(`/api/agent-links${a(e)}`),"listAgentPins",0,e=>r(`/api/agents/pins${a(e)}`),"listAgents",0,e=>r(`/api/agents${a(e)}`),"listArtifacts",0,(e,t)=>r(`/api/artifacts${a(t,{conversation_id:e})}`),"listBufferedMessages",0,(e,t)=>r(`/api/conversations/${e}/buffered-messages${a(t)}`),"listCalendarEvents",0,(e,t)=>{let n={};return t?.agentId&&(n.agentId=t.agentId),t?.from&&(n.from=t.from),t?.to&&(n.to=t.to),r(`/api/calendar${a(e,n)}`)},"listChannels",0,e=>r(`/api/channels${a(e)}`),"listEmailAccounts",0,(e,t)=>r(`/api/agents/${e}/email-accounts${a(t)}`),"listEmails",0,(e,t,n,s)=>r(`/api/email${a(t,{agentId:e,...n?{folder:n}:{},...s?{address:s}:{}})}`),"listFlaggedItems",0,(e,t)=>{let n={};return t?.limit&&(n.limit=String(t.limit)),t?.before&&(n.before=t.before),r(`/api/flags${a(e,n)}`)},"listFlaggedMessageIds",0,(e,t)=>r(`/api/flags${a(e,{conversation_id:t,ids_only:"true"})}`),"listInboxItems",0,(e,t)=>{let n={};return t?.limit&&(n.limit=String(t.limit)),t?.before&&(n.before=t.before),t?.types?.length&&(n.types=t.types.join(",")),r(`/api/inbox${a(e,n)}`)},"listInvites",0,e=>r(`/api/workspaces/${e}/invites${a(e)}`),"listIssues",0,(e,t)=>{let n={};return t?.agentId&&(n.agentId=t.agentId),t?.status&&(n.status=t.status),t?.terminal!==void 0&&(n.terminal=String(t.terminal)),r(`/api/issues${a(e,n)}`)},"listMeetings",0,(e,t)=>r(`/api/agents/${e}/meetings${a(t)}`),"listMembers",0,e=>r(`/api/workspaces/${e}/members${a(e)}`),"listMessages",0,(e,t,n)=>{let s={};return n?.limit&&(s.limit=String(n.limit)),n?.before&&(s.before=n.before),n?.beforeId&&(s.before_id=n.beforeId),r(`/api/conversations/${e}/messages${a(t,s)}`)},"listMessagesAroundTask",0,(e,t,n)=>r(`/api/conversations/${e}/messages${a(t,{around_task:n})}`),"listPreviousConversations",0,(e,t,n)=>{let s={exclude:n.exclude,before:n.before};return n.channel&&(s.channel=n.channel),n.limit&&(s.limit=String(n.limit)),r(`/api/agents/${e}/conversations${a(t,s)}`)},"listRuntimes",0,e=>r(`/api/runtimes${a(e)}`),"listTraces",0,(e,t)=>{let n={};return t?.limit&&(n.limit=String(t.limit)),t?.before&&(n.before=t.before),t?.status&&(n.status=t.status),t?.multiAgent&&(n.multiAgent="true"),t?.agentId&&(n.agentId=t.agentId),t?.channel&&(n.channel=t.channel),r(`/api/traces${a(e,n)}`)},"listWhitelist",0,(e,t)=>r(`/api/agents/${e}/whitelist${a(t)}`),"listWorkspaceActiveTasks",0,e=>r(`/api/agents/active-tasks${a(e)}`),"listWorkspaces",0,()=>r("/api/workspaces"),"markAllInboxRead",0,e=>r(`/api/inbox/read-all${a(e)}`,{method:"POST"}),"markInboxRead",0,(e,t)=>r(`/api/inbox/read${a(t)}`,{method:"POST",body:JSON.stringify({conversationId:e})}),"pinAgent",0,(e,t)=>r(`/api/agents/${t}/pin${a(e)}`,{method:"POST"}),"removeMember",0,(e,t)=>r(`/api/workspaces/${e}/members/${t}${a(e)}`,{method:"DELETE"}),"removeWhitelistEmail",0,(e,t,n)=>r(`/api/agents/${e}/whitelist/${t}${a(n)}`,{method:"DELETE"}),"renameChannelApi",0,(e,t,n)=>r(`/api/channels/${e}${a(t)}`,{method:"PATCH",body:JSON.stringify({name:n})}),"reorderAgentPins",0,(e,t)=>r(`/api/agents/pins/reorder${a(e)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:t})}),"reorderChannelsApi",0,(e,t)=>r(`/api/channels/reorder${a(e)}`,{method:"PUT",body:JSON.stringify({ordered_channel_ids:t})}),"reorderUnpinnedAgents",0,(e,t)=>r(`/api/agents/sidebar/reorder${a(e)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:t})}),"requestWorkspaceBrowse",0,(e,t,n,s)=>r(`/api/agents/${e}/workspace/browse${a(t)}`,{method:"POST",body:JSON.stringify({request_type:n,path:s})}),"retryTask",0,(e,t)=>r(`/api/tasks/${e}/retry${a(t)}`,{method:"POST"}),"revokeAgentAccess",0,(e,t,n,s=!1)=>r(`/api/agents/${t}/access/${n}${a(e)}${s?"&remove_whitelist=true":""}`,{method:"DELETE"}),"revokeInvite",0,(e,t)=>r(`/api/workspaces/${e}/invites/${t}${a(e)}`,{method:"DELETE"}),"sendEmail",0,(e,t,n,s,i,o,l,c)=>r(`/api/email/send${a(i)}`,{method:"POST",body:JSON.stringify({agentId:e,to:t,subject:n,htmlBody:s,attachments:o,...l,customAccountId:c})}),"sendMessage",0,s,"stopMeeting",0,(e,t,n)=>r(`/api/agents/${e}/meetings/${t}/stop${a(n)}`,{method:"POST"}),"syncEmailAccount",0,(e,t,n)=>r(`/api/agents/${e}/email-accounts/${t}/sync${a(n)}`,{method:"POST"}),"triggerRuntimeRescan",0,(e,t)=>r(`/api/runtimes/${e}/rescan${a(t)}`,{method:"POST"}),"triggerRuntimeUpdate",0,(e,t)=>r(`/api/runtimes/${e}/update${a(t)}`,{method:"POST"}),"unflagMessage",0,(e,t)=>r(`/api/flags/${t}${a(e)}`,{method:"DELETE"}),"unpinAgent",0,(e,t)=>r(`/api/agents/${t}/pin${a(e)}`,{method:"DELETE"}),"updateAgent",0,(e,t,n)=>r(`/api/agents/${e}${a(n)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateAgentLink",0,(e,t,n)=>r(`/api/agent-links/${e}${a(n)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateCalendarEvent",0,(e,t,n)=>r(`/api/calendar/${e}${a(n)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateEmailStatus",0,(e,t,n)=>r(`/api/email/${e}${a(t)}`,{method:"PATCH",body:JSON.stringify({status:n})}),"updateIssue",0,(e,t,n)=>r(`/api/issues/${t}${a(e)}`,{method:"PATCH",body:JSON.stringify(n)}),"updateMemberMe",0,(e,t)=>r(`/api/members/me${a(e)}`,{method:"PATCH",body:JSON.stringify({global_instruction:t})}),"updateWorkspace",0,(e,t)=>r(`/api/workspaces/${e}${a(e)}`,{method:"PATCH",body:JSON.stringify(t)}),"uploadEmailAttachment",0,l],222862)},728886,e=>{"use strict";var t=e.i(368075),n=e.i(613349);e.s(["Skeleton",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"skeleton",className:(0,n.cn)("animate-pulse rounded-md bg-muted",e),...r})}])},996718,e=>{"use strict";var t=e.i(298699);e.s(["useIsMobile",0,function(){let[e,n]=t.useState(void 0);return t.useEffect(()=>{let e=window.matchMedia("(max-width: 639px)"),t=()=>{n(window.innerWidth<640)};return e.addEventListener("change",t),n(window.innerWidth<640),()=>e.removeEventListener("change",t)},[]),!!e}])},400175,126366,819748,108772,261819,e=>{"use strict";var t=e.i(368075),n=e.i(298699);let r="#27272a",a={fill:"rgba(255,255,255,0.92)",stroke:"rgba(255,255,255,0.95)",strokeWidth:3.5},s=[{name:"Purple",value:"#a855f7",gradient:["#c084fc","#a855f7","#7c3aed"],faceColor:"#2e1065"},{name:"Teal",value:"#14b8a6",gradient:["#5eead4","#14b8a6","#0d9488"],faceColor:"#134e4a"},{name:"Orange",value:"#f97316",gradient:["#fdba74","#f97316","#c2410c"],faceColor:"#7c2d12"},{name:"Blue",value:"#3b82f6",gradient:["#93c5fd","#3b82f6","#1d4ed8"],faceColor:"#1e3a5f"},{name:"Pink",value:"#f472b6",gradient:["#fda4af","#f472b6","#be185d"],faceColor:"#831843"},{name:"Yellow",value:"#eab308",gradient:["#fde047","#eab308","#a16207"],faceColor:"#713f12"},{name:"Green",value:"#22c55e",gradient:["#86efac","#22c55e","#15803d"],faceColor:"#14532d"},{name:"Beige",value:"#d6ccb8",gradient:["#e8e0d4","#d6ccb8","#b8a990"],faceColor:"#57534e"},{name:"Red",value:"#ef4444",gradient:["#fca5a5","#ef4444","#991b1b"],faceColor:"#7f1d1d"},{name:"Lake Blue",value:"#6366f1",gradient:["#a5b4fc","#6366f1","#3730a3"],faceColor:"#312e81"},{name:"Gray",value:"#9ca3af",gradient:["#d4d4d8","#9ca3af","#6b7280"],faceColor:"#374151"},{name:"Deep Purple",value:"#8b5cf6",gradient:["#c4b5fd","#8b5cf6","#5b21b6"],faceColor:"#3b0764"}],i={circle:{name:"Circle",face:{cx:100,cy:100,w:80},render:()=>(0,t.jsx)("circle",{cx:"100",cy:"100",r:"66",...a})},rounded:{name:"Rounded",face:{cx:100,cy:100,w:90},render:()=>(0,t.jsx)("rect",{x:"30",y:"30",width:"140",height:"140",rx:"32",...a})},hexagon:{name:"Hexagon",face:{cx:100,cy:100,w:86},render:()=>(0,t.jsx)("path",{d:"M100 32 C108 32 114 35 120 39 L155 60 C161 64 165 70 165 78 L165 122 C165 130 161 136 155 140 L120 161 C114 165 108 168 100 168 C92 168 86 165 80 161 L45 140 C39 136 35 130 35 122 L35 78 C35 70 39 64 45 60 L80 39 C86 35 92 32 100 32 Z",...a})},task:{name:"Task",face:{cx:100,cy:100,w:80},render:()=>(0,t.jsx)("rect",{x:"34",y:"34",width:"132",height:"132",rx:"24",...a})},book:{name:"Book",face:{cx:100,cy:100,w:80},render:()=>(0,t.jsx)("path",{d:"M42 162 L42 88 C42 54 68 34 100 34 C132 34 158 54 158 88 L158 162 C158 166 154 170 150 170 L50 170 C46 170 42 166 42 162 Z",...a})},mail:{name:"Mail",face:{cx:100,cy:100,w:86},render:()=>(0,t.jsx)("rect",{x:"28",y:"54",width:"144",height:"92",rx:"46",...a})},calendar:{name:"Calendar",face:{cx:100,cy:100,w:80},render:()=>(0,t.jsx)("path",{d:"M100 34 C138 34 166 52 166 80 C166 94 158 106 158 118 C158 148 138 166 100 166 C62 166 42 148 42 118 C42 106 34 94 34 80 C34 52 62 34 100 34 Z",...a})},bulb:{name:"Bulb",face:{cx:100,cy:104,w:76},render:()=>(0,t.jsx)("ellipse",{cx:"100",cy:"104",rx:"58",ry:"66",...a})},folder:{name:"Folder",face:{cx:102,cy:108,w:80},render:()=>(0,t.jsx)("path",{d:"M62 144 C40 144 32 128 36 116 C32 104 40 90 54 88 C56 72 70 60 88 62 C100 50 118 50 132 58 C144 52 162 60 162 76 C172 82 174 98 166 108 C172 120 164 136 150 140 Z",...a})},mountain:{name:"Mountain",face:{cx:100,cy:100,w:76},render:()=>(0,t.jsx)("path",{d:"M92 36 C120 32 156 48 164 78 C172 108 156 148 124 160 C92 172 48 156 38 124 C28 92 62 40 92 36 Z",...a})}},o=Object.keys(i),l={dot:{name:"Dot",render:(e=r)=>(0,t.jsx)("circle",{cx:"0",cy:"0",r:"4.5",fill:e})},dash:{name:"Dash",render:(e=r)=>(0,t.jsx)("line",{x1:"-10",y1:"0",x2:"10",y2:"0",stroke:e,strokeWidth:"5",strokeLinecap:"round"})},hookL:{name:"Hook",render:(e=r)=>(0,t.jsx)("path",{d:"M-11 0 Q-5.5 7 0 1.5 Q5.5 7 11 0",fill:"none",stroke:e,strokeWidth:"4.5",strokeLinecap:"round",strokeLinejoin:"round"})},smile:{name:"Smile",render:(e=r)=>(0,t.jsx)("path",{d:"M-11 0 Q0 11 11 0",fill:"none",stroke:e,strokeWidth:"5",strokeLinecap:"round"})},caret:{name:"Caret",render:(e=r)=>(0,t.jsxs)("g",{children:[(0,t.jsx)("path",{d:"M-10 0 Q0 8 10 0",fill:"none",stroke:e,strokeWidth:"4.5",strokeLinecap:"round"}),(0,t.jsx)("ellipse",{cx:"3",cy:"6",rx:"4",ry:"4.5",fill:"#f472b6"})]})},arrow:{name:"Arrow",render:(e=r)=>(0,t.jsx)("ellipse",{cx:"0",cy:"0",rx:"6",ry:"7.5",fill:e})},oh:{name:"o",render:(e=r)=>(0,t.jsx)("ellipse",{cx:"0",cy:"0",rx:"7",ry:"7.5",fill:"none",stroke:e,strokeWidth:"4.5"})}},c=Object.keys(l),d=(e,n)=>{let a=n??e,s=(n,s=r)=>(0,t.jsxs)("g",{children:[(0,t.jsx)("g",{transform:`translate(${-n}, 0)`,children:e(s)}),(0,t.jsx)("g",{transform:`translate(${n}, 0)`,children:a(s)})]});return s.displayName="EyePair",s},h={dots:{name:"Dots",render:d(e=>(0,t.jsx)("circle",{cx:"0",cy:"0",r:"7",fill:e}))},big:{name:"Big",render:d(e=>(0,t.jsxs)("g",{children:[(0,t.jsx)("circle",{cx:"0",cy:"0",r:"10",fill:e}),(0,t.jsx)("circle",{cx:"2.5",cy:"-3",r:"3.5",fill:"rgba(255,255,255,0.9)"})]}))},rings:{name:"Rings",render:d(e=>(0,t.jsx)("ellipse",{cx:"0",cy:"0",rx:"8.5",ry:"9.5",fill:"none",stroke:e,strokeWidth:"4.5"}))},arches:{name:"Arches",render:d(e=>(0,t.jsx)("path",{d:"M-10 2 Q0 -9 10 2",fill:"none",stroke:e,strokeWidth:"5",strokeLinecap:"round"}))},lines:{name:"Lines",render:d(e=>(0,t.jsx)("path",{d:"M-10 0 Q0 -6 10 0",fill:"none",stroke:e,strokeWidth:"5",strokeLinecap:"round"}))},happy:{name:"Happy",render:d(e=>(0,t.jsx)("path",{d:"M-10 5 Q0 -11 10 5",fill:"none",stroke:e,strokeWidth:"5",strokeLinecap:"round"}))},sleepy:{name:"Sleepy",render:d(e=>(0,t.jsx)("path",{d:"M-10 -2 Q0 8 10 -2",fill:"none",stroke:e,strokeWidth:"5",strokeLinecap:"round"}))},shy:{name:"Shy",render:d(e=>(0,t.jsx)("ellipse",{cx:"0",cy:"0",rx:"8.5",ry:"9.5",fill:e}))},wink:{name:"Wink",render:(e,n=r)=>(0,t.jsxs)("g",{children:[(0,t.jsx)("g",{transform:`translate(${-e}, 0)`,children:(0,t.jsx)("circle",{cx:"0",cy:"0",r:"7",fill:n})}),(0,t.jsx)("g",{transform:`translate(${e}, 0)`,children:(0,t.jsx)("path",{d:"M-10 2 Q0 -9 10 2",fill:"none",stroke:n,strokeWidth:"5",strokeLinecap:"round"})})]})}},g=Object.keys(h),u={shape:"book",eye:"happy",nose:"dash",bg:1},m=[{name:"Task",config:{shape:"task",nose:"dot",eye:"dots",bg:0}},{name:"Notes",config:{shape:"book",nose:"dash",eye:"happy",bg:1}},{name:"Mail",config:{shape:"mail",nose:"smile",eye:"dots",bg:3}},{name:"Schedule",config:{shape:"calendar",nose:"dot",eye:"dots",bg:4}},{name:"Idea",config:{shape:"bulb",nose:"oh",eye:"rings",bg:5}},{name:"Project",config:{shape:"folder",nose:"dash",eye:"lines",bg:7}},{name:"Goal",config:{shape:"mountain",nose:"caret",eye:"arches",bg:8}},{name:"Dream",config:{shape:"circle",nose:"smile",eye:"shy",bg:11}},{name:"Organize",config:{shape:"rounded",nose:"dot",eye:"sleepy",bg:6}},{name:"Explore",config:{shape:"hexagon",nose:"hookL",eye:"wink",bg:9}},{name:"Focus",config:{shape:"task",nose:"caret",eye:"lines",bg:2}},{name:"Collect",config:{shape:"book",nose:"oh",eye:"rings",bg:10}}];function p(e){return e[Math.floor(Math.random()*e.length)]}function f(){return{shape:p(o),eye:p(g),nose:p(c),bg:Math.floor(Math.random()*s.length)}}function x({config:e,size:r=200,className:a}){let o=(0,n.useId)().replace(/:/g,""),c=i[e.shape]??i.book,d=h[e.eye],g=l[e.nose],u=s[e.bg]??s[0],[m,p,f]=u.gradient,y=u.faceColor,{cx:b,cy:$,w}=c.face,k=Math.max(13,.24*w),v=$-Math.max(12,.16*w);return(0,t.jsxs)("svg",{viewBox:"0 0 200 200",width:r,height:r,className:a,style:{display:"block"},children:[(0,t.jsxs)("defs",{children:[(0,t.jsxs)("linearGradient",{id:`bg-${o}`,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,t.jsx)("stop",{offset:"0%",stopColor:m}),(0,t.jsx)("stop",{offset:"50%",stopColor:p}),(0,t.jsx)("stop",{offset:"100%",stopColor:f})]}),(0,t.jsxs)("radialGradient",{id:`gl-${o}`,cx:"30%",cy:"25%",r:"60%",children:[(0,t.jsx)("stop",{offset:"0%",stopColor:"rgba(255,255,255,0.32)"}),(0,t.jsx)("stop",{offset:"100%",stopColor:"rgba(255,255,255,0)"})]}),(0,t.jsx)("filter",{id:`sh-${o}`,x:"-10%",y:"-5%",width:"120%",height:"130%",children:(0,t.jsx)("feDropShadow",{dx:"0",dy:"3",stdDeviation:"4",floodColor:"rgba(0,0,0,0.18)"})})]}),(0,t.jsx)("rect",{x:"0",y:"0",width:"200",height:"200",rx:"56",fill:`url(#bg-${o})`}),(0,t.jsx)("rect",{x:"0",y:"0",width:"200",height:"200",rx:"56",fill:`url(#gl-${o})`}),(0,t.jsxs)("g",{transform:"translate(100,100) scale(0.8) translate(-100,-100)",children:[(0,t.jsx)("g",{"data-avatar-shape":"",filter:`url(#sh-${o})`,children:c.render()}),d&&(0,t.jsx)("g",{transform:`translate(${b}, ${v})`,children:(0,t.jsx)("g",{"data-avatar-eyes":"",children:d.render(k,y)})}),g&&(0,t.jsx)("g",{transform:`translate(${b}, ${$+7})`,children:(0,t.jsx)("g",{"data-avatar-nose":"",children:g.render(y)})})]})]})}let y="avatar:";function b(e){if(!e||!e.startsWith(y))return null;try{let t=JSON.parse(e.slice(y.length));if("object"==typeof t&&null!==t&&"string"==typeof t.shape&&"string"==typeof t.eye&&"string"==typeof t.nose&&"number"==typeof t.bg)return t;if("object"==typeof t&&null!==t&&"outline"in t)return u;return null}catch{return null}}e.s(["AvatarRenderer",0,x,"BG_COLORS",0,s,"DEFAULT_CONFIG",0,u,"EYE_KEYS",0,g,"Eyes",0,h,"NOSE_KEYS",0,c,"Noses",0,l,"PRESETS",0,m,"SHAPE_KEYS",0,o,"Shapes",0,i,"parseAvatarUrl",0,b,"randomConfig",0,f,"serializeAvatarConfig",0,function(e){return y+JSON.stringify(e)}],126366);let $=["avatar-anim-shape-bounce","avatar-anim-head-tilt","avatar-anim-shake","avatar-anim-wobble","avatar-anim-pulse","avatar-anim-spin","avatar-anim-jelly","avatar-anim-float","avatar-anim-nod"];e.s(["AnimatedAvatar",0,function({config:e,size:r,className:a,isHovered:s,isWorking:i}){let[o,l]=(0,n.useState)(null),c=(0,n.useRef)(-1);function d(){let e=Math.floor(Math.random()*$.length);return e===c.current&&(e=(e+1)%$.length),c.current=e,$[e]}return(0,n.useEffect)(()=>{s?l(d()):i||l(null)},[s,i]),(0,n.useEffect)(()=>{if(!i){s||l(null);return}l(d());let e=setInterval(()=>{l(d())},4e3);return()=>clearInterval(e)},[s,i]),(0,t.jsx)("div",{className:o??void 0,children:(0,t.jsx)(x,{config:e,size:r,className:a})})}],819748);var w=e.i(613349),k=e.i(329686);function v({label:e,keys:n,value:r,onChange:a,renderThumb:s,mobile:i=!1}){let o=n.indexOf(r),l=e=>a(n[(o+e+n.length)%n.length]),c=n[(o-1+n.length)%n.length],d=n[(o+1)%n.length];return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"w-12 text-xs font-medium text-muted-foreground shrink-0",children:e}),(0,t.jsx)("button",{type:"button",onClick:()=>l(-1),className:(0,w.cn)("flex items-center justify-center rounded-md hover:bg-accent transition-colors",i?"size-10":"size-7"),children:(0,t.jsx)("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:(0,t.jsx)("path",{d:"M15 5 L8 12 L15 19",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-1 justify-center",children:[(0,t.jsx)("button",{type:"button",onClick:()=>l(-1),className:"opacity-30 hover:opacity-60 transition-opacity",tabIndex:-1,children:s(c)}),(0,t.jsx)("button",{type:"button",onClick:()=>l(1),className:"border-2 border-primary rounded-lg p-0.5",children:s(r)}),(0,t.jsx)("button",{type:"button",onClick:()=>l(1),className:"opacity-30 hover:opacity-60 transition-opacity",tabIndex:-1,children:s(d)})]}),(0,t.jsx)("button",{type:"button",onClick:()=>l(1),className:(0,w.cn)("flex items-center justify-center rounded-md hover:bg-accent transition-colors",i?"size-10":"size-7"),children:(0,t.jsx)("svg",{viewBox:"0 0 24 24",width:"16",height:"16",children:(0,t.jsx)("path",{d:"M9 5 L16 12 L9 19",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function j({config:e,onChange:r,layout:a="vertical",mobile:d=!1}){let[u,p]=(0,n.useState)("presets"),y=(0,n.useCallback)((t,n)=>{r({...e,[t]:n})},[e,r]),[b,$]=(0,n.useState)(!1),C=(0,n.useRef)(e);(0,n.useEffect)(()=>{if(C.current.shape!==e.shape||C.current.eye!==e.eye||C.current.nose!==e.nose||C.current.bg!==e.bg){$(!0);let t=setTimeout(()=>$(!1),450);return C.current=e,()=>clearTimeout(t)}},[e]),(0,n.useEffect)(()=>{if("horizontal"!==a)return;let e=e=>{"Space"===e.code&&e.target===document.body&&(e.preventDefault(),r(f()))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a,r]);let S="horizontal"===a,E=S?220:d?120:160,T=(0,t.jsxs)("div",{className:(0,w.cn)("flex flex-col items-center gap-3 rounded-2xl bg-muted/30",d?"p-3":"p-4",S?"w-70 shrink-0 justify-center":""),children:[(0,t.jsx)("div",{className:(0,w.cn)("rounded-2xl",b&&"animate-[shake_0.45s_cubic-bezier(.36,.07,.19,.97)]"),children:(0,t.jsx)(x,{config:e,size:E})}),(0,t.jsxs)("button",{type:"button",onClick:()=>r(f()),className:"inline-flex items-center gap-2 rounded-full bg-foreground px-4 py-1.5 text-sm font-medium text-background hover:bg-foreground/80 transition-colors",children:[(0,t.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"2",y:"2",width:"20",height:"20",rx:"3"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"16",cy:"8",r:"1.5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"8",cy:"16",r:"1.5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"16",cy:"16",r:"1.5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor"})]}),"Random",S&&(0,t.jsx)("kbd",{className:"ml-1 rounded bg-background/20 px-1.5 py-0.5 text-[10px] font-mono",children:"Space"})]})]}),O=(0,t.jsxs)("div",{className:(0,w.cn)("flex flex-col gap-3 flex-1 min-w-0",S&&"rounded-2xl bg-muted/30 p-4 h-95"),children:[(0,t.jsxs)("div",{className:"flex border-b border-border",children:[(0,t.jsx)("button",{type:"button",onClick:()=>p("presets"),className:(0,w.cn)("flex-1 pb-2 text-sm font-medium text-center transition-colors border-b-2","presets"===u?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"★ Presets"}),(0,t.jsx)("button",{type:"button",onClick:()=>p("custom"),className:(0,w.cn)("flex-1 pb-2 text-sm font-medium text-center transition-colors border-b-2","custom"===u?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"⚙ Custom"})]}),(0,t.jsxs)("div",{className:(0,w.cn)("flex-1 min-h-0",S&&"overflow-y-auto thin-scrollbar"),children:["presets"===u&&(0,t.jsx)("div",{className:(0,w.cn)("grid gap-2",d?"grid-cols-3":"grid-cols-4"),children:m.map(n=>{let a=n.config.shape===e.shape&&n.config.eye===e.eye&&n.config.nose===e.nose&&n.config.bg===e.bg;return(0,t.jsx)("button",{type:"button",onClick:()=>r(n.config),className:(0,w.cn)("flex items-center justify-center rounded-xl border p-2 transition-all",a?"border-primary border-2 bg-primary/5 shadow-sm":"border-border bg-background hover:border-primary/40"),children:(0,t.jsx)(x,{config:n.config,size:56})},n.name)})}),"custom"===u&&(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)(v,{label:"Shape",keys:o,value:e.shape,onChange:e=>y("shape",e),renderThumb:e=>(0,t.jsxs)("svg",{viewBox:"0 0 200 200",width:"40",height:"40",children:[(0,t.jsx)("rect",{width:"200",height:"200",rx:"56",fill:"hsl(var(--muted))"}),(0,t.jsx)("g",{transform:"translate(100,100) scale(0.8) translate(-100,-100)",children:i[e]?.render()})]}),mobile:d}),(0,t.jsx)(v,{label:"Nose",keys:c,value:e.nose,onChange:e=>y("nose",e),renderThumb:e=>(0,t.jsx)("svg",{viewBox:"-14 -10 28 20",width:"36",height:"24",children:l[e]?.render("currentColor")}),mobile:d}),(0,t.jsx)(v,{label:"Eyes",keys:g,value:e.eye,onChange:e=>y("eye",e),renderThumb:e=>(0,t.jsx)("svg",{viewBox:"-18 -10 36 20",width:"44",height:"24",children:h[e]?.render(8,"currentColor")}),mobile:d}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Color"}),(0,t.jsx)("div",{className:(0,w.cn)("flex flex-wrap p-1",d?"gap-3":"gap-2"),children:s.map((n,r)=>(0,t.jsxs)(k.Tooltip,{children:[(0,t.jsx)(k.TooltipTrigger,{render:(0,t.jsx)("button",{type:"button",onClick:()=>y("bg",r),className:(0,w.cn)("rounded-full transition-shadow",d?"size-8":"size-7",e.bg===r?"ring-2 ring-primary ring-offset-2":"ring-1 ring-border"),style:{background:`linear-gradient(135deg, ${n.gradient[0]}, ${n.gradient[1]}, ${n.gradient[2]})`}})}),(0,t.jsx)(k.TooltipContent,{children:n.name})]},n.value))})]})]})]})]});return S?(0,t.jsxs)("div",{className:"flex gap-4",children:[T,O]}):(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[T,O]})}var C=e.i(779646),S=e.i(996718);e.s(["AvatarPickerDialog",0,function({config:e,onChange:r}){let[a,s]=(0,n.useState)(!1),[i,o]=(0,n.useState)(e),l=(0,S.useIsMobile)();return(0,t.jsxs)(C.Dialog,{open:a,onOpenChange:t=>{t&&o(e),s(t)},children:[(0,t.jsx)("div",{className:"flex justify-center",children:(0,t.jsx)(C.DialogTrigger,{render:(0,t.jsx)("button",{type:"button",className:"rounded-2xl bg-background p-1.5 shadow-sm border border-border hover:border-primary/40 transition-colors cursor-pointer"}),children:(0,t.jsx)(x,{config:e,size:80})})}),(0,t.jsxs)(C.DialogContent,{className:l?"top-auto left-0 translate-x-0 translate-y-0 bottom-0 max-w-full sm:max-w-full w-full rounded-b-none rounded-t-xl max-h-[85dvh] overflow-y-auto pb-[env(safe-area-inset-bottom)]":"sm:max-w-180",children:[(0,t.jsx)(C.DialogHeader,{children:(0,t.jsx)(C.DialogTitle,{children:"Choose Avatar"})}),(0,t.jsx)(j,{config:i,layout:l?"vertical":"horizontal",onChange:e=>{o(e),r(e)},mobile:l}),l&&(0,t.jsx)("button",{type:"button",onClick:()=>s(!1),className:"w-full rounded-xl bg-primary py-3 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:"Done"})]})]})}],108772),e.s(["AgentAvatar",0,function({name:e,avatarUrl:n,size:r=32}){let a=b(n);return a?(0,t.jsx)(x,{config:a,size:r,className:"rounded-full shrink-0"}):(0,t.jsx)("span",{className:"flex items-center justify-center rounded-full bg-secondary text-xs font-medium shrink-0",style:{width:r,height:r},children:(e??"?").charAt(0).toUpperCase()})}],261819),e.s([],400175)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,222862,636557,e=>{"use strict";class t extends Error{status;details;constructor(e,t,n){super(e),this.name="ApiError",this.status=t,this.details=n}get isNetworkError(){return 0===this.status}get isRateLimit(){return 429===this.status}get isUnauthorized(){return 401===this.status}}function n(e,t){return"validation error"===e&&t?.length?function(e){let[t,...n]=e.split(":"),r=n.join(":").trim();if(!r)return e;let o=t.trim(),i=o.trim().replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase()),a=r.replace(/^required$/i,"is required"),s=a.toLowerCase().replace(/[_-]+/g," "),l=o.toLowerCase().replace(/[_-]+/g," ");return l&&s.startsWith(`${l} `)&&(a=a.slice(o.length).trimStart()),i?`${i} ${a}`:a}(t[0]):e}async function r(e,r){let o;try{o=await fetch(""+e,{...r,credentials:"include",headers:{"Content-Type":"application/json",...r?.headers}})}catch(e){if(e instanceof TypeError)throw new t("Unable to connect — check your network",0);throw e}if(401===o.status)throw window.location.href="/sign-in",new t("Unauthorized",401);if(!o.ok){let e,r;try{let t=await o.json();e=t.error,r=t.details}catch{}if(429===o.status)throw new t("Please wait a moment before trying again",429);if(o.status>=500)throw new t(n(e,r)||"Something went wrong — please try again",o.status,r);throw new t(n(e,r)||"Something went wrong",o.status,r)}if(204!==o.status)return o.json()}function o(e,t){let n=new URLSearchParams({workspace_id:e,...t});return`?${n.toString()}`}e.s(["ApiError",0,t],636557);let i=async(e,n,i,a)=>{let s;if(!a||0===a.length)return r(`/api/conversations/${e}/messages${o(i)}`,{method:"POST",body:JSON.stringify({content:n})});let l=new FormData;for(let e of(l.append("content",n),a))l.append("file",e);try{s=await fetch(`/api/conversations/${e}/messages${o(i)}`,{method:"POST",credentials:"include",body:l})}catch(e){if(e instanceof TypeError)throw new t("Unable to connect — check your network",0);throw e}if(401===s.status)throw window.location.href="/sign-in",new t("Unauthorized",401);if(!s.ok){let e,n;try{let t=await s.json();e=t.error,n=t.details}catch{}if(429===s.status)throw new t("Please wait a moment before trying again",429);if(s.status>=500)throw new t(e||"Something went wrong — please try again",s.status,n);throw new t(e||"Something went wrong",s.status,n)}return s.json()},a=async(e,n,i,a)=>{let s;if(!a||0===a.length)return r(`/api/conversations/${e}/buffered-messages${o(i)}`,{method:"POST",body:JSON.stringify({content:n})});let l=new FormData;for(let e of(l.append("content",n),a))l.append("file",e);try{s=await fetch(`/api/conversations/${e}/buffered-messages${o(i)}`,{method:"POST",credentials:"include",body:l})}catch(e){if(e instanceof TypeError)throw new t("Unable to connect — check your network",0);throw e}if(401===s.status)throw window.location.href="/sign-in",new t("Unauthorized",401);if(!s.ok){let e,n;try{let t=await s.json();e=t.error,n=t.details}catch{}if(429===s.status)throw new t(e||"Maximum follow-ups reached",429);if(s.status>=500)throw new t(e||"Something went wrong — please try again",s.status,n);throw new t(e||"Something went wrong",s.status,n)}return s.json()},s=async(e,t)=>{let n=new URLSearchParams({workspace_id:t}),r=await fetch(`/api/email/${e}/body?${n}`,{credentials:"include"});if(!r.ok)return{content:"(body not available)",isHtml:!1};let o=r.headers.get("Content-Type")??"";return{content:await r.text(),isHtml:o.includes("text/html")}},l=async(e,n)=>{let r=new FormData;r.append("file",e);let i=await fetch(`/api/email/upload${o(n)}`,{method:"POST",credentials:"include",body:r});if(!i.ok)throw new t(await i.text().catch(()=>"Upload failed"),i.status);return i.json()},c=async(e,n)=>{let i;if(!n.files||0===n.files.length)return r(`/api/issues${o(e)}`,{method:"POST",body:JSON.stringify({agent_id:n.agent_id,title:n.title,description:n.description})});let a=new FormData;for(let e of(n.agent_id&&a.append("agent_id",n.agent_id),a.append("title",n.title),a.append("description",n.description??""),n.files))a.append("file",e);try{i=await fetch(`/api/issues${o(e)}`,{method:"POST",credentials:"include",body:a})}catch(e){if(e instanceof TypeError)throw new t("Unable to connect — check your network",0);throw e}if(401===i.status)throw window.location.href="/sign-in",new t("Unauthorized",401);if(!i.ok){let e,n;try{let t=await i.json();e=t.error,n=t.details}catch{}if(429===i.status)throw new t("Please wait a moment before trying again",429);if(i.status>=500)throw new t(e||"Something went wrong — please try again",i.status,n);throw new t(e||"Something went wrong",i.status,n)}return i.json()},u=async(e,t)=>{let n=new URLSearchParams({workspace_id:t}),r=await fetch(`/api/artifacts/${e}/content?${n}`,{credentials:"include"});return r.ok?r.text():"(content not available)"};e.s(["acceptInvite",0,e=>r(`/api/invite/${e}`,{method:"POST"}),"addWhitelistEmail",0,(e,t,n)=>r(`/api/agents/${e}/whitelist${o(n)}`,{method:"POST",body:JSON.stringify({email:t})}),"approveMeeting",0,(e,t,n)=>r(`/api/agents/${e}/meetings/${t}/approve${o(n)}`,{method:"POST"}),"cancelActiveTask",0,(e,t)=>r(`/api/conversations/${e}/active-task${o(t)}`,{method:"DELETE"}),"chatInit",0,(e,t,n)=>r(`/api/agents/${e}/chat-init${o(t)}`,{method:"POST",body:JSON.stringify({...n?{channel:n}:{}})}),"checkFreshness",0,(e,t)=>{let n={};return e.conversationId&&(n.conversation_id=e.conversationId),e.agentId&&(n.agent_id=e.agentId),e.channel&&(n.channel=e.channel),r(`/api/conversations/check-fresh${o(t,n)}`)},"conversationInit",0,(e,t,n)=>{let i={};return n?.newestMessageId&&(i.newest_message_id=n.newestMessageId),r(`/api/conversations/${e}/init${o(t,i)}`)},"createAgent",0,(e,t)=>r(`/api/agents${o(t)}`,{method:"POST",body:JSON.stringify(e)}),"createAgentLink",0,(e,t)=>r(`/api/agent-links${o(t)}`,{method:"POST",body:JSON.stringify(e)}),"createBufferedMessage",0,a,"createCalendarEvent",0,(e,t)=>r(`/api/calendar${o(t)}`,{method:"POST",body:JSON.stringify(e)}),"createChannelApi",0,(e,t)=>r(`/api/channels${o(e)}`,{method:"POST",body:JSON.stringify({name:t})}),"createConversation",0,(e,t,n)=>r(`/api/conversations${o(t)}`,{method:"POST",body:JSON.stringify({agent_id:e,...n?{channel:n}:{}})}),"createEmailAccount",0,(e,t,n)=>r(`/api/agents/${e}/email-accounts${o(n)}`,{method:"POST",body:JSON.stringify(t)}),"createInvite",0,e=>r(`/api/workspaces/${e}/invites${o(e)}`,{method:"POST"}),"createIssue",0,c,"createMachineToken",0,(e,t)=>r(`/api/machine-tokens${t?o(t):""}`,{method:"POST",body:JSON.stringify({name:e||"default"})}),"createMeeting",0,(e,t,n)=>r(`/api/agents/${e}/meetings${o(t)}`,{method:"POST",body:JSON.stringify(n)}),"deleteAgent",0,(e,t)=>r(`/api/agents/${e}${o(t)}`,{method:"DELETE"}),"deleteAgentLink",0,(e,t)=>r(`/api/agent-links/${e}${o(t)}`,{method:"DELETE"}),"deleteBufferedMessage",0,(e,t,n)=>r(`/api/conversations/${e}/buffered-messages/${t}${o(n)}`,{method:"DELETE"}),"deleteCalendarEvent",0,(e,t,n)=>r(`/api/calendar/${e}${o(t)}`,{method:"DELETE",...n&&n.scope?{headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}:{}}),"deleteChannelApi",0,(e,t)=>r(`/api/channels/${e}${o(t)}`,{method:"DELETE"}),"deleteEmail",0,(e,t)=>r(`/api/email/${e}${o(t)}`,{method:"DELETE"}),"deleteEmailAccount",0,(e,t,n)=>r(`/api/agents/${e}/email-accounts/${t}${o(n)}`,{method:"DELETE"}),"deleteIssue",0,(e,t)=>r(`/api/issues/${t}${o(e)}`,{method:"DELETE"}),"deleteMachine",0,(e,t)=>r(`/api/runtimes/machine${o(t,{daemon_id:e})}`,{method:"DELETE"}),"deleteMeeting",0,(e,t,n)=>r(`/api/agents/${e}/meetings/${t}${o(n)}`,{method:"DELETE"}),"deleteWorkspace",0,(e,t)=>r(`/api/workspaces/${e}${o(e)}`,{method:"DELETE",body:JSON.stringify({confirm_name:t})}),"fetchLatestCliVersion",0,()=>r("/api/cli/latest-version"),"fetchModelOptions",0,()=>r("/api/config/model-options"),"flagMessage",0,(e,t)=>r(`/api/flags${o(e)}`,{method:"POST",body:JSON.stringify({messageId:t})}),"getActiveTask",0,(e,t)=>r(`/api/conversations/${e}/active-task${o(t)}`),"getAgentSkills",0,(e,t)=>r(`/api/agents/${e}/skills${o(t)}`),"getArtifactContent",0,u,"getCalendarEvent",0,(e,t)=>r(`/api/calendar/${e}${o(t)}`),"getEmail",0,(e,t)=>r(`/api/email/${e}${o(t)}`),"getEmailBody",0,s,"getEmailThread",0,(e,t)=>r(`/api/email/${e}/thread${o(t)}`),"getFlaggedCount",0,e=>r(`/api/flags/count${o(e)}`),"getInboxCount",0,(e,t)=>{let n={};return t?.types?.length&&(n.types=t.types.join(",")),r(`/api/inbox/count${o(e,n)}`)},"getInviteInfo",0,e=>r(`/api/invite/${e}`),"getIssue",0,(e,t)=>r(`/api/issues/${t}${o(e)}`),"getMemberMe",0,e=>r(`/api/members/me${o(e)}`),"getMinCliVersion",0,()=>r("/api/config/min-version"),"getTask",0,(e,t)=>r(`/api/tasks/${e}${o(t)}`),"getTaskMessages",0,(e,t,n)=>r(`/api/tasks/${e}/messages${o(t,n?{since:String(n)}:void 0)}`),"getTrace",0,(e,t)=>r(`/api/traces/${e}${o(t)}`),"getWorkspaceOverview",0,e=>r(`/api/workspaces/${e}/overview${o(e)}`),"grantAgentAccess",0,(e,t,n)=>r(`/api/agents/${t}/access${o(e)}`,{method:"POST",body:JSON.stringify({user_id:n})}),"listAgentAccess",0,(e,t)=>r(`/api/agents/${t}/access${o(e)}`),"listAgentActiveTaskCounts",0,e=>r(`/api/agents/active-task-counts${o(e)}`),"listAgentActivity",0,(e,t,n)=>{let i={};return n?.limit&&(i.limit=String(n.limit)),n?.before&&(i.before=n.before),n?.beforeId&&(i.before_id=n.beforeId),n?.status&&(i.status=n.status),n?.type&&(i.type=n.type),r(`/api/agents/${e}/activity${o(t,i)}`)},"listAgentLinks",0,e=>r(`/api/agent-links${o(e)}`),"listAgentPins",0,e=>r(`/api/agents/pins${o(e)}`),"listAgents",0,e=>r(`/api/agents${o(e)}`),"listArtifacts",0,(e,t)=>r(`/api/artifacts${o(t,{conversation_id:e})}`),"listBufferedMessages",0,(e,t)=>r(`/api/conversations/${e}/buffered-messages${o(t)}`),"listCalendarEvents",0,(e,t)=>{let n={};return t?.agentId&&(n.agentId=t.agentId),t?.from&&(n.from=t.from),t?.to&&(n.to=t.to),r(`/api/calendar${o(e,n)}`)},"listChannels",0,e=>r(`/api/channels${o(e)}`),"listEmailAccounts",0,(e,t)=>r(`/api/agents/${e}/email-accounts${o(t)}`),"listEmails",0,(e,t,n,i)=>r(`/api/email${o(t,{agentId:e,...n?{folder:n}:{},...i?{address:i}:{}})}`),"listFlaggedItems",0,(e,t)=>{let n={};return t?.limit&&(n.limit=String(t.limit)),t?.before&&(n.before=t.before),r(`/api/flags${o(e,n)}`)},"listFlaggedMessageIds",0,(e,t)=>r(`/api/flags${o(e,{conversation_id:t,ids_only:"true"})}`),"listInboxItems",0,(e,t)=>{let n={};return t?.limit&&(n.limit=String(t.limit)),t?.before&&(n.before=t.before),t?.types?.length&&(n.types=t.types.join(",")),r(`/api/inbox${o(e,n)}`)},"listInvites",0,e=>r(`/api/workspaces/${e}/invites${o(e)}`),"listIssues",0,(e,t)=>{let n={};return t?.agentId&&(n.agentId=t.agentId),t?.status&&(n.status=t.status),t?.terminal!==void 0&&(n.terminal=String(t.terminal)),r(`/api/issues${o(e,n)}`)},"listMeetings",0,(e,t)=>r(`/api/agents/${e}/meetings${o(t)}`),"listMembers",0,e=>r(`/api/workspaces/${e}/members${o(e)}`),"listMessages",0,(e,t,n)=>{let i={};return n?.limit&&(i.limit=String(n.limit)),n?.before&&(i.before=n.before),n?.beforeId&&(i.before_id=n.beforeId),r(`/api/conversations/${e}/messages${o(t,i)}`)},"listMessagesAroundTask",0,(e,t,n)=>r(`/api/conversations/${e}/messages${o(t,{around_task:n})}`),"listPreviousConversations",0,(e,t,n)=>{let i={exclude:n.exclude,before:n.before};return n.channel&&(i.channel=n.channel),n.limit&&(i.limit=String(n.limit)),r(`/api/agents/${e}/conversations${o(t,i)}`)},"listRuntimes",0,e=>r(`/api/runtimes${o(e)}`),"listTraces",0,(e,t)=>{let n={};return t?.limit&&(n.limit=String(t.limit)),t?.before&&(n.before=t.before),t?.status&&(n.status=t.status),t?.multiAgent&&(n.multiAgent="true"),t?.agentId&&(n.agentId=t.agentId),t?.channel&&(n.channel=t.channel),r(`/api/traces${o(e,n)}`)},"listWhitelist",0,(e,t)=>r(`/api/agents/${e}/whitelist${o(t)}`),"listWorkspaceActiveTasks",0,e=>r(`/api/agents/active-tasks${o(e)}`),"listWorkspaces",0,()=>r("/api/workspaces"),"markAllInboxRead",0,e=>r(`/api/inbox/read-all${o(e)}`,{method:"POST"}),"markInboxRead",0,(e,t)=>r(`/api/inbox/read${o(t)}`,{method:"POST",body:JSON.stringify({conversationId:e})}),"pinAgent",0,(e,t)=>r(`/api/agents/${t}/pin${o(e)}`,{method:"POST"}),"removeMember",0,(e,t)=>r(`/api/workspaces/${e}/members/${t}${o(e)}`,{method:"DELETE"}),"removeWhitelistEmail",0,(e,t,n)=>r(`/api/agents/${e}/whitelist/${t}${o(n)}`,{method:"DELETE"}),"renameChannelApi",0,(e,t,n)=>r(`/api/channels/${e}${o(t)}`,{method:"PATCH",body:JSON.stringify({name:n})}),"reorderAgentPins",0,(e,t)=>r(`/api/agents/pins/reorder${o(e)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:t})}),"reorderChannelsApi",0,(e,t)=>r(`/api/channels/reorder${o(e)}`,{method:"PUT",body:JSON.stringify({ordered_channel_ids:t})}),"reorderUnpinnedAgents",0,(e,t)=>r(`/api/agents/sidebar/reorder${o(e)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:t})}),"requestWorkspaceBrowse",0,(e,t,n,i)=>r(`/api/agents/${e}/workspace/browse${o(t)}`,{method:"POST",body:JSON.stringify({request_type:n,path:i})}),"retryTask",0,(e,t)=>r(`/api/tasks/${e}/retry${o(t)}`,{method:"POST"}),"revokeAgentAccess",0,(e,t,n,i=!1)=>r(`/api/agents/${t}/access/${n}${o(e)}${i?"&remove_whitelist=true":""}`,{method:"DELETE"}),"revokeInvite",0,(e,t)=>r(`/api/workspaces/${e}/invites/${t}${o(e)}`,{method:"DELETE"}),"sendEmail",0,(e,t,n,i,a,s,l,c)=>r(`/api/email/send${o(a)}`,{method:"POST",body:JSON.stringify({agentId:e,to:t,subject:n,htmlBody:i,attachments:s,...l,customAccountId:c})}),"sendMessage",0,i,"stopMeeting",0,(e,t,n)=>r(`/api/agents/${e}/meetings/${t}/stop${o(n)}`,{method:"POST"}),"syncEmailAccount",0,(e,t,n)=>r(`/api/agents/${e}/email-accounts/${t}/sync${o(n)}`,{method:"POST"}),"triggerRuntimeRescan",0,(e,t)=>r(`/api/runtimes/${e}/rescan${o(t)}`,{method:"POST"}),"triggerRuntimeUpdate",0,(e,t)=>r(`/api/runtimes/${e}/update${o(t)}`,{method:"POST"}),"unflagMessage",0,(e,t)=>r(`/api/flags/${t}${o(e)}`,{method:"DELETE"}),"unpinAgent",0,(e,t)=>r(`/api/agents/${t}/pin${o(e)}`,{method:"DELETE"}),"updateAgent",0,(e,t,n)=>r(`/api/agents/${e}${o(n)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateAgentLink",0,(e,t,n)=>r(`/api/agent-links/${e}${o(n)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateCalendarEvent",0,(e,t,n)=>r(`/api/calendar/${e}${o(n)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateEmailStatus",0,(e,t,n)=>r(`/api/email/${e}${o(t)}`,{method:"PATCH",body:JSON.stringify({status:n})}),"updateIssue",0,(e,t,n)=>r(`/api/issues/${t}${o(e)}`,{method:"PATCH",body:JSON.stringify(n)}),"updateMemberMe",0,(e,t)=>r(`/api/members/me${o(e)}`,{method:"PATCH",body:JSON.stringify({global_instruction:t})}),"updateWorkspace",0,(e,t)=>r(`/api/workspaces/${e}${o(e)}`,{method:"PATCH",body:JSON.stringify(t)}),"uploadEmailAttachment",0,l],222862)},500324,e=>{"use strict";var t=e.i(368075),n=e.i(298699);let r=(0,n.createContext)(null);e.s(["WorkspaceProvider",0,function({workspaceId:e,slug:o,children:i}){return(0,n.useEffect)(()=>{try{localStorage.setItem("lastWorkspace",o)}catch{}},[o]),(0,t.jsx)(r.Provider,{value:{workspaceId:e,slug:o},children:i})},"useWorkspace",0,function(){let e=(0,n.useContext)(r);if(!e)throw Error("useWorkspace must be used within WorkspaceProvider");return e}])},642342,e=>{"use strict";var t=e.i(459119),n=e.i(298699);let r=(0,e.i(613349).isLocalMode)(),o=Number(t.default.env.NEXT_PUBLIC_WS_DO_PORT)||8789,i=Number(t.default.env.NEXT_PUBLIC_WS_RECONNECT_DELAY_MS)||1e3,a=Number(t.default.env.NEXT_PUBLIC_WS_RECONNECT_MAX_DELAY_MS)||3e4;e.s(["useUserWs",0,function(e,t){let s=(0,n.useRef)(null),l=(0,n.useRef)(i),c=(0,n.useRef)(e),u=(0,n.useRef)(t?.onReconnect),d=(0,n.useRef)(null),f=(0,n.useRef)(!1),m=(0,n.useRef)(0),p=(0,n.useRef)(null),g=(0,n.useRef)(null);(0,n.useEffect)(()=>{c.current=e},[e]),(0,n.useEffect)(()=>{u.current=t?.onReconnect},[t?.onReconnect]);let _=(0,n.useRef)(null),h=(0,n.useCallback)(()=>{let e=Math.min(l.current,a);l.current=Math.min(2*e,a),d.current=setTimeout(()=>{_.current?.()},e+500*Math.random())},[]),E=(0,n.useCallback)(async()=>{let e,t,n,a=o;try{let n=await fetch("/api/ws/token");if(!n.ok){console.warn("[ws] token fetch failed:",n.status),h();return}let r=await n.json();e=r.userId,t=r.token,r.wsPort&&(a=r.wsPort)}catch(e){console.warn("[ws] token fetch error:",e),h();return}let d=r?`ws://localhost:${a}/?userId=${e}`:`${location.origin.replace("http","ws")}/api/ws/user?userId=${e}`;try{n=new WebSocket(d)}catch(e){console.warn("[ws] WebSocket creation failed:",e),h();return}s.current=n,n.onopen=()=>{l.current=i,n.send(JSON.stringify({type:"auth",token:t})),f.current&&u.current?.(),f.current=!0,m.current=Date.now(),p.current=setInterval(()=>{n.readyState===WebSocket.OPEN&&n.send("ping")},25e3),g.current=setInterval(()=>{Date.now()-m.current>3e4&&n.close()},5e3)},n.onmessage=e=>{m.current=Date.now();try{let t=JSON.parse(e.data);if("auth.ok"===t.type)return;c.current(t)}catch{}},n.onerror=()=>{},n.onclose=()=>{n===s.current&&(p.current&&(clearInterval(p.current),p.current=null),g.current&&(clearInterval(g.current),g.current=null),h())}},[h]);(0,n.useEffect)(()=>{_.current=E},[E]),(0,n.useEffect)(()=>(E(),()=>{null!==d.current&&(clearTimeout(d.current),d.current=null),p.current&&(clearInterval(p.current),p.current=null),g.current&&(clearInterval(g.current),g.current=null);let e=s.current;s.current=null,e?.close()}),[E])}])},355578,e=>{"use strict";var t=e.i(368075),n=e.i(298699),r=e.i(222862),o=e.i(880932),i=e.i(642342);let a=(0,n.createContext)(null);e.s(["AgentProvider",0,function({workspaceId:e,children:s}){let[l,c]=(0,n.useState)([]),[u,d]=(0,n.useState)([]),[f,m]=(0,n.useState)(!0),[p,g]=(0,n.useState)({}),[_,h]=(0,n.useState)([]),E=(0,n.useRef)(!1),[C,w]=(0,n.useState)([]),[S,y]=(0,n.useState)(new Map),[T,k]=(0,n.useState)(new Map),O=(0,n.useRef)(!1),v=(0,n.useRef)(new Set),b=(0,n.useRef)(!0),M=(0,n.useRef)(!1),$=(0,n.useCallback)(e=>(v.current.add(e),()=>{v.current.delete(e)}),[]),I=(0,n.useRef)(!1),P=(0,n.useCallback)(async()=>{if(!I.current){I.current=!0;try{if(E.current){let t=await (0,r.listWorkspaceActiveTasks)(e);if(!b.current)return;h(t.tasks);let n={};for(let e of t.tasks)n[e.agent_id]=(n[e.agent_id]??0)+1;g(n),E.current=t.tasks.length>0}else{let t=await (0,r.listAgentActiveTaskCounts)(e);if(!b.current)return;if(g(t.counts),Object.values(t.counts).some(e=>e>0)){E.current=!0;let t=await (0,r.listWorkspaceActiveTasks)(e);b.current&&h(t.tasks)}else h([])}}catch{}finally{I.current=!1}}},[e]);(0,n.useEffect)(()=>{b.current=!0,P();let e=setInterval(P,15e3);return()=>{b.current=!1,clearInterval(e)}},[P]);let N=(0,n.useCallback)(async()=>{try{let[t,n,o,i]=await Promise.all([(0,r.listAgents)(e),(0,r.listRuntimes)(e),(0,r.listAgentPins)(e),(0,r.listAgentLinks)(e)]);c(t),d(n),w(i),y(new Map(o.pins.map(e=>[e.agent_id,{created_at:e.created_at,position:e.position}]))),k(new Map(o.sidebar_order.map(e=>[e.agent_id,e.position])))}catch(e){o.toast.error(e instanceof Error?e.message:"Failed to load data")}finally{m(!1),O.current=!0}},[e]),A=(0,n.useCallback)(async()=>{if(!M.current){M.current=!0;try{let t=await (0,r.listRuntimes)(e);d(t)}catch{}finally{M.current=!1}}},[e]);(0,n.useEffect)(()=>{N()},[N]),(0,n.useEffect)(()=>{let e=null,t=setInterval(()=>{"visible"===document.visibilityState&&A()},3e4),n=()=>{"visible"===document.visibilityState&&(e=setTimeout(()=>A(),2e3*Math.random()))};return document.addEventListener("visibilitychange",n),()=>{clearInterval(t),e&&clearTimeout(e),document.removeEventListener("visibilitychange",n)}},[A]);let D=(0,n.useCallback)(t=>{for(let e of v.current)e(t);switch(t.type){case"runtime.registered":if(t.workspaceId!==e)break;N();break;case"runtime.deleted":N();break;case"runtime.status":if(t.workspaceId!==e)break;A();break;case"task.updated":P()}},[N,A,P,e]);(0,i.useUserWs)(D,{onReconnect:A});let R=(0,n.useCallback)(async t=>{try{let n=await (0,r.createAgent)(t,e);return await N(),n}catch(e){return o.toast.error(e instanceof Error?e.message:"Failed to create agent"),null}},[N,e]),x=(0,n.useCallback)(async(t,n)=>{try{return await (0,r.updateAgent)(t,n,e),await N(),!0}catch(e){return o.toast.error(e instanceof Error?e.message:"Failed to update agent"),!1}},[N,e]),L=(0,n.useCallback)(async t=>{try{return await (0,r.deleteAgent)(t,e),await N(),!0}catch(e){return o.toast.error(e instanceof Error?e.message:"Failed to remove agent"),!1}},[N,e]),U=(0,n.useCallback)(async t=>{y(e=>{let n=Math.max(-1,...[...e.values()].map(e=>e.position));return new Map(e).set(t,{created_at:new Date().toISOString(),position:n+1})});try{await (0,r.pinAgent)(e,t)}catch{y(e=>{let n=new Map(e);return n.delete(t),n}),o.toast.error("Failed to pin agent")}},[e]),q=(0,n.useCallback)(async t=>{let n;y(e=>{n=e.get(t);let r=new Map(e);return r.delete(t),r});try{await (0,r.unpinAgent)(e,t)}catch{void 0!==n&&y(e=>new Map(e).set(t,n)),o.toast.error("Failed to unpin agent")}},[e]),W=(0,n.useCallback)(async t=>{let n=new Map(S);y(e=>{let n=new Map(e);return t.forEach((e,t)=>{let r=n.get(e);r&&n.set(e,{...r,position:t})}),n});try{await (0,r.reorderAgentPins)(e,t)}catch{y(n),o.toast.error("Failed to reorder pins")}},[e,S]),F=(0,n.useCallback)(async t=>{let n=new Map(T);k(new Map(t.map((e,t)=>[e,t])));try{await (0,r.reorderUnpinnedAgents)(e,t)}catch{k(n),o.toast.error("Failed to reorder agents")}},[e,T]),j=(0,n.useCallback)(()=>{let e=u.find(e=>"online"===e.status);return e?.id??""},[u]),J=(0,n.useCallback)(async()=>{try{return(await (0,r.createMachineToken)("cli",e)).token}catch(e){return o.toast.error(e instanceof Error?e.message:"Failed to generate token"),null}},[e]),V=(0,n.useCallback)(async t=>{try{return await (0,r.deleteMachine)(t,e),await N(),!0}catch(e){return o.toast.error(e instanceof Error?e.message:"Failed to remove machine"),!1}},[N,e]);return(0,t.jsx)(a.Provider,{value:{workspaceId:e,agents:l,agentLinks:C,runtimes:u,loading:f,activeTaskCounts:p,activeTaskDetails:_,pins:S,reload:N,subscribeWs:$,handleCreateAgent:R,handleUpdateAgent:x,handleDeleteAgent:L,handlePinAgent:U,handleUnpinAgent:q,handleReorderPins:W,unpinnedOrder:T,handleReorderUnpinned:F,getFirstOnlineRuntimeId:j,handleGenerateToken:J,handleDeleteMachine:V},children:s})},"useAgentContext",0,function(){let e=(0,n.useContext)(a);if(!e)throw Error("useAgentContext must be used within AgentProvider");return e},"useAgentContextSafe",0,function(){return(0,n.useContext)(a)}])},980630,e=>{"use strict";let t="browser-notification-enabled",n="browser-notification-events",r=["completed","failed"],o={completed:"Task Completed",failed:"Task Failed"};function i(){return"Notification"in window}function a(){return"true"===localStorage.getItem(t)}function s(){try{let e=localStorage.getItem(n);if(e)return JSON.parse(e)}catch{}return[...r]}async function l(){return!!i()&&("granted"===Notification.permission||"denied"!==Notification.permission&&"granted"===await Notification.requestPermission())}e.s(["NOTIFICATION_EVENTS",0,r,"NOTIFICATION_EVENT_LABELS",0,o,"getNotificationEnabled",0,a,"getNotificationEvents",0,s,"isNotificationSupported",0,i,"requestNotificationPermission",0,l,"sendTaskNotification",0,function(e,t,n){if(!i()||"granted"!==Notification.permission||!a()||!s().includes(e))return;let r=o[e]??`Task ${e}`;new Notification(t?`${t} — ${r}`:r,{body:n??"",icon:"/alook.svg"})},"setNotificationEnabled",0,function(e){localStorage.setItem(t,String(e))},"setNotificationEvents",0,function(e){localStorage.setItem(n,JSON.stringify(e))}])},875494,685835,e=>{"use strict";var t=e.i(368075),n=e.i(298699),r=e.i(222862),o=e.i(355578),i=e.i(500324),a=e.i(980630);let s="inbox-filter-types",l=["user_dm_message","calendar_event","email_notification"],c=["user_dm_message"],u=["user_dm_message"];function d(){try{let e=localStorage.getItem(s);if(!e)return c;let t=JSON.parse(e).filter(e=>l.includes(e));if(0===t.length)return c;for(let e of u)t.includes(e)||t.unshift(e);return t}catch{return c}}e.s(["INBOX_FILTER_LABELS",0,{user_dm_message:"DM",calendar_event:"Calendar",email_notification:"Email"},"INBOX_FILTER_TYPES",0,l,"MANDATORY_INBOX_TYPES",0,u,"getInboxFilterTypes",0,d,"setInboxFilterTypes",0,function(e){let t=[...e];for(let e of u)t.includes(e)||t.unshift(e);localStorage.setItem(s,JSON.stringify(t))}],685835);let f=(0,n.createContext)(null),m={count:0,notificationToken:0,refresh:()=>{},decrement:()=>{}};e.s(["InboxCountProvider",0,function({children:e}){let{workspaceId:s}=(0,i.useWorkspace)(),{subscribeWs:l,agents:c}=(0,o.useAgentContext)(),[u,m]=(0,n.useState)(0),[p,g]=(0,n.useState)(0),_=(0,n.useRef)(null),h=(0,n.useRef)(null),E=(0,n.useRef)(c);(0,n.useEffect)(()=>{E.current=c});let C=(0,n.useCallback)(()=>{let e=d();(0,r.getInboxCount)(s,{types:e}).then(e=>{let t=_.current;if(_.current=e.count,m(e.count),null!==t&&e.count>t){g(e=>e+1);let e=h.current?E.current.find(e=>e.id===h.current):void 0;(0,a.sendTaskNotification)("completed",e?.name)}h.current=null}).catch(()=>{})},[s]),w=(0,n.useCallback)(()=>{m(e=>{let t=Math.max(0,e-1);return _.current=t,t})},[]);return(0,n.useEffect)(()=>{C()},[C]),(0,n.useEffect)(()=>l(e=>{"task.updated"===e.type&&("completed"===e.status||"failed"===e.status)&&(h.current=e.agentId,C())}),[l,C]),(0,n.useEffect)(()=>{let e=setInterval(C,6e4);return()=>clearInterval(e)},[C]),(0,t.jsx)(f.Provider,{value:{count:u,notificationToken:p,refresh:C,decrement:w},children:e})},"useInboxCount",0,function(){return(0,n.useContext)(f)??m}],875494)},192935,e=>{e.v({button:"cloud-code-monster-pet-module__wqv_bq__button","cloud-code-monster-bell-alert":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-bell-alert","cloud-code-monster-breathe":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-breathe","cloud-code-monster-faint":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-faint","cloud-code-monster-footprint":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-footprint","cloud-code-monster-keytap":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-keytap","cloud-code-monster-left-foot":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-left-foot","cloud-code-monster-peek":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-peek","cloud-code-monster-phone":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-phone","cloud-code-monster-phone-glow":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-phone-glow","cloud-code-monster-read":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-read","cloud-code-monster-right-foot":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-right-foot","cloud-code-monster-shaken":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-shaken","cloud-code-monster-shock-pixels":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-shock-pixels","cloud-code-monster-sleep":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-sleep","cloud-code-monster-sleep-pixels":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-sleep-pixels","cloud-code-monster-snack":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-snack","cloud-code-monster-startled":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-startled","cloud-code-monster-thought":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-thought","cloud-code-monster-walk":"cloud-code-monster-pet-module__wqv_bq__cloud-code-monster-walk",footprint:"cloud-code-monster-pet-module__wqv_bq__footprint",footsteps:"cloud-code-monster-pet-module__wqv_bq__footsteps",notificationBell:"cloud-code-monster-pet-module__wqv_bq__notificationBell",notificationBellPixel:"cloud-code-monster-pet-module__wqv_bq__notificationBellPixel",pet:"cloud-code-monster-pet-module__wqv_bq__pet",petLayer:"cloud-code-monster-pet-module__wqv_bq__petLayer"})},105583,e=>{"use strict";var t=e.i(368075),n=e.i(298699),r=e.i(355578),o=e.i(875494),i=e.i(192935),a=e.i(396328),s=e.i(434623),l=e.i(460520);function c(e,t){let n=t?.getBoundingClientRect();return{x:e.clientX-(n?.left??0),y:e.clientY-(n?.top??0)}}var u=e.i(961909),d=e.i(399561);let f=[];function m({boundaryRef:e,initialPosition:p,previewComebackToken:g=0,notificationToken:_=0,peekTargets:h=f}){let E,C,w,[S,y]=(0,n.useState)(null),[T,k]=(0,n.useState)(null),[O,v]=(0,n.useState)(!1),[b,M]=(0,n.useState)(!1),[$,I]=(0,n.useState)(!1),[P,N]=(0,n.useState)(!1),[A,D]=(0,n.useState)(!1),[R,x]=(0,n.useState)(!1),[L,U]=(0,n.useState)(!1),[q,W]=(0,n.useState)(d.CLOUD_CODE_MONSTER_PET_PRESETS[0].id),[F,j]=(0,n.useState)(1),[J,V]=(0,n.useState)("right"),[B,H]=(0,n.useState)([]),K=(0,n.useRef)(0),Y=(0,n.useRef)(null),Z=(0,n.useRef)(1),z=(0,n.useRef)("left"),X=(0,n.useRef)(null),G=(0,n.useRef)([]),Q=(0,n.useRef)(h),{clearAllPetTimers:ee,clearPetTimer:et,setPetTimer:en}=(E=(0,n.useRef)({reaction:null,shake:null,faint:null,autonomousWalk:null,peek:null,peekStop:null,notification:null,walkSettle:null,walkToTargetPeek:null}),C=(0,n.useCallback)(e=>{let t=E.current[e];null!==t&&(window.clearTimeout(t),E.current[e]=null)},[]),w=(0,n.useCallback)((e,t,n)=>{C(e),E.current[e]=window.setTimeout(()=>{E.current[e]=null,t()},n)},[C]),{clearAllPetTimers:(0,n.useCallback)(()=>{for(let e of Object.keys(E.current))C(e)},[C]),clearPetTimer:C,setPetTimer:w});(0,n.useEffect)(()=>{let e=e=>{W(e?(0,d.getCloudCodeMonsterPreset)(e).id:(0,d.readCloudCodeMonsterPetPresetId)())},t=t=>{e(t.detail?.presetId)},n=t=>{t.key===l.CLOUD_CODE_MONSTER_PRESET_STORAGE_KEY&&e(t.newValue)};return e(),window.addEventListener(l.CLOUD_CODE_MONSTER_PRESET_CHANGED_EVENT,t),window.addEventListener("storage",n),()=>{window.removeEventListener(l.CLOUD_CODE_MONSTER_PRESET_CHANGED_EVENT,t),window.removeEventListener("storage",n)}},[]),(0,n.useEffect)(()=>{let e=(0,a.resolveCloudCodeMonsterVisibleState)((0,a.readStoredActivity)());(0,a.writeStoredActivity)(e),y(e);let t=()=>{let e=Date.now();y(t=>{let n="hidden"===document.visibilityState?(0,a.createCloudCodeMonsterHiddenState)(t,e):(0,a.resolveCloudCodeMonsterVisibleState)(t??(0,a.readStoredActivity)(),e);return(0,a.writeStoredActivity)(n),n})};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[]),(0,n.useEffect)(()=>{if(g<=0)return;let e=(0,a.resolveCloudCodeMonsterPreviewComebackState)();(0,a.writeStoredActivity)(e),y(e)},[g]),(0,n.useEffect)(()=>{let t=()=>{let t=(0,a.getBounds)(e.current);k(e=>e?(0,a.clampPetPosition)(e,t,l.CLOUD_CODE_MONSTER_SIZE):(0,a.clampPetPosition)(p??{x:t.width-l.CLOUD_CODE_MONSTER_SIZE.width-112,y:Math.min(.48*t.height,t.height-l.CLOUD_CODE_MONSTER_SIZE.height-120)},t,l.CLOUD_CODE_MONSTER_SIZE))};return t(),window.addEventListener("resize",t),"u">typeof ResizeObserver&&e.current&&(X.current=new ResizeObserver(t),X.current.observe(e.current)),()=>{window.removeEventListener("resize",t),X.current?.disconnect(),X.current=null}},[e,p]),(0,n.useEffect)(()=>ee,[ee]);let er=(0,n.useMemo)(()=>S?.activityId?s.CLOUD_CODE_MONSTER_ACTIVITIES.find(e=>e.id===S.activityId):null,[S]),eo=(0,n.useMemo)(()=>(0,d.getCloudCodeMonsterPreset)(q),[q]),ei=O||b,ea=null!==T,es=h.length>0,el=(0,a.shouldCloudCodeMonsterAutoWalk)(S?.activityId??null);(0,n.useEffect)(()=>{Q.current=h},[h]);let{count:ec}=(0,o.useInboxCount)(),[eu,ed]=(0,n.useState)(!1),ef=(0,n.useRef)(null);(0,n.useEffect)(()=>(!(ec>0)||L||O?0===ec&&(null!==ef.current&&(window.clearTimeout(ef.current),ef.current=null),ed(!1)):null===ef.current&&(ef.current=window.setTimeout(()=>{ef.current=null,ed(!0)},300)),()=>{null!==ef.current&&(window.clearTimeout(ef.current),ef.current=null)}),[ec,L,O]);let em=(0,n.useCallback)((e,t)=>{j(t);let n=performance.now();if(n-K.current>=(0,a.getMonsterFootstepIntervalMs)(t)){let r=z.current;z.current="left"===r?"right":"left";let o="left"===r?25:52;H(n=>[...n.slice(-13),{id:Z.current++,x:e.x+o,y:e.y+l.CLOUD_CODE_MONSTER_SIZE.height-7,side:r,intensity:t}]),K.current=n}},[]),ep=function({boundaryRef:e,targetId:t,enabled:r,position:o,setPosition:i,onArrive:s,onStep:c}){let[u,d]=(0,n.useState)(!1),[f,m]=(0,n.useState)(!1),[p,g]=(0,n.useState)("left"),_=(0,n.useRef)(null),h=(0,n.useRef)(!1),E=(0,n.useRef)(r),C=(0,n.useRef)(o);(0,n.useEffect)(()=>{E.current=r},[r]),(0,n.useEffect)(()=>{C.current=o},[o]);let w=(0,n.useCallback)(()=>{null!==_.current&&(window.clearTimeout(_.current),_.current=null)},[]),S=(0,n.useCallback)(()=>{w(),d(!1),m(!1),h.current=!1},[w]);return(0,n.useEffect)(()=>{if(!r||!t||!o)return void S();if(h.current)return;d(!0),m(!1);let n=()=>{_.current=window.setTimeout(()=>{if(_.current=null,!E.current)return void d(!1);let r=function(e,t){if(!e)return null;let n=e.querySelector(`[data-pet-target-id="${t}"]`)??document.querySelector(`[data-pet-target-id="${t}"]`);if(!n)return null;let r=n.getBoundingClientRect(),o=(0,a.getBounds)(e),i=r.right+22,s=r.top+r.height/2-l.CLOUD_CODE_MONSTER_SIZE.height/2;return(0,a.clampPetPosition)({x:i,y:s},o,l.CLOUD_CODE_MONSTER_SIZE)}(e.current,t),o=C.current;if(!r||!o)return void n();if(10>Math.hypot(r.x-o.x,r.y-o.y)){h.current=!0,d(!1),m(!0),g("left"),i(()=>r),s();return}let u=(0,a.createWalkToTargetVelocity)(o,r,3.2);g(u.x>=0?"right":"left");let f=(0,a.clampPetPosition)({x:o.x+u.x,y:o.y+u.y},(0,a.getBounds)(e.current),l.CLOUD_CODE_MONSTER_SIZE);i(()=>f),c(f,1.45),n()},l.CLOUD_CODE_MONSTER_AUTO_WALK_STEP_MS)};return n(),()=>{w()}},[r,t,!!o,e,S,w,s,c,i]),{isWalking:u,isIdlingAtTarget:f,walkDirection:p}}({boundaryRef:e,targetId:eu?"inbox":null,enabled:eu&&!O&&!A&&!R&&!L,position:T,setPosition:k,onArrive:(0,n.useCallback)(()=>{I(!0),j(1),en("walkToTargetPeek",()=>{I(!1);let e=()=>{en("walkToTargetPeek",()=>{I(!0),en("peekStop",()=>{I(!1),e()},l.CLOUD_CODE_MONSTER_PEEK_MS)},l.CLOUD_CODE_MONSTER_PEEK_INTERVAL_MS)};e()},l.CLOUD_CODE_MONSTER_PEEK_MS)},[en]),onStep:em}),eg=ep.isWalking||ep.isIdlingAtTarget,e_=ei||ep.isWalking,eh=(0,n.useRef)(!1);(0,n.useEffect)(()=>{eh.current&&!eg&&(et("walkToTargetPeek"),I(!1)),eh.current=eg},[eg,et]);let eE=(0,r.useAgentContextSafe)(),eC=(eE?.activeTaskDetails.length??0)>0,ew=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(eC&&!eg){if(!ew.current){let e=["coding","thinking","reading"];ew.current=e[Math.floor(Math.random()*e.length)]}let e=ew.current;y(t=>{if(t?.activityId===e)return t;let n={activityId:e,updatedAt:Date.now(),hiddenAt:null};return(0,a.writeStoredActivity)(n),n})}else if(!eC&&ew.current){ew.current=null;let e=(0,a.createCloudCodeMonsterIdleState)();(0,a.writeStoredActivity)(e),y(e)}},[eC,eg]);let eS=(0,n.useCallback)((e,t)=>{let n=z.current;z.current="left"===n?"right":"left";let r="left"===n?25:52;H(o=>[...o.slice(-13),{id:Z.current++,x:e.x+r,y:e.y+l.CLOUD_CODE_MONSTER_SIZE.height-7,side:n,intensity:t}])},[]);(0,n.useEffect)(()=>{if(!ea||!S?.activityId||!el||O||A||R||L||$||eg){M(!1),j(1),Y.current=null;return}M(!0),Y.current??=(0,a.createCloudCodeMonsterWalkVelocity)();let t=()=>{en("autonomousWalk",()=>{let n=(0,a.getBounds)(e.current);j(1.45),k(e=>{let t=Y.current;if(!e||!t)return e;let r=(0,a.reflectCloudCodeMonsterWalk)(e,t,n,l.CLOUD_CODE_MONSTER_SIZE);Y.current=r.velocity,V(r.velocity.x>=0?"right":"left");let o=performance.now();return o-K.current>=(0,a.getMonsterFootstepIntervalMs)(1.45)&&(eS(r.position,1.45),K.current=o),r.position}),t()},l.CLOUD_CODE_MONSTER_AUTO_WALK_STEP_MS)};return en("autonomousWalk",t,l.CLOUD_CODE_MONSTER_AUTO_WALK_STEP_MS),()=>{et("autonomousWalk")}},[S?.activityId,e,L,ea,O,$,eg,A,et,eS,R,el,en]),(0,n.useEffect)(()=>{if(ea&&es&&!O&&!A&&!R&&!L&&!eg)return en("peek",()=>{let t=Q.current,n=t[Math.floor(Math.random()*t.length)]??t[0];if(!n)return;let r=(0,a.getBounds)(e.current),o=(0,a.resolveCloudCodeMonsterPeekPosition)(n,e.current,r);M(!1),Y.current=null,I(!0),j(1),k(o),en("peekStop",()=>{I(!1)},l.CLOUD_CODE_MONSTER_PEEK_MS)},l.CLOUD_CODE_MONSTER_PEEK_INTERVAL_MS+4e3*Math.random()),()=>{et("peek")}},[e,et,L,es,ea,O,eg,A,R,en]);let ey=(0,n.useCallback)(()=>{y(e=>{if(e&&!e.activityId&&null===e.hiddenAt)return e;let t=(0,a.createCloudCodeMonsterIdleState)();return(0,a.writeStoredActivity)(t),t})},[]),eT=(0,n.useCallback)(()=>{M(!1),I(!1),G.current=[],Y.current=null,et("autonomousWalk"),et("peek"),et("peekStop"),et("walkToTargetPeek")},[et]),ek=(0,n.useCallback)(()=>{D(!0),en("reaction",()=>{D(!1)},l.CLOUD_CODE_MONSTER_REACTION_MS)},[en]);(0,n.useEffect)(()=>{_<=0||(eT(),S?.activityId&&ey(),ek(),N(!0),en("notification",()=>{N(!1)},l.CLOUD_CODE_MONSTER_REACTION_MS+1500))},[S?.activityId,_,en,ek,eT,ey]);let eO=(0,n.useCallback)(()=>{L||(S?.activityId&&ey(),x(!0),en("shake",()=>{x(!1)},l.CLOUD_CODE_MONSTER_SHAKE_REACTION_MS))},[S?.activityId,L,en,ey]),ev=(0,n.useCallback)(()=>{et("faint"),et("reaction"),et("shake"),ey(),eT(),D(!1),x(!1),U(!0),j(1),en("faint",()=>{U(!1)},l.CLOUD_CODE_MONSTER_FAINT_MS)},[et,en,eT,ey]),{handlePetClick:eb,handlePointerDown:eM,handlePointerMove:e$,stopDragging:eI}=function({boundaryRef:e,initialPosition:t,position:r,isDragging:o,fainted:i,activityState:s,lastFootstepAtRef:u,violentDragEventsRef:d,setIsDragging:f,setNotificationActive:m,setFainted:p,setWalkDirection:g,setWalkIntensity:_,setPosition:h,clearPetTimer:E,setPetTimer:C,pushFootprint:w,stopTemporaryMotion:S,wakeMonsterToDefault:y,startShockReaction:T,startShakeReaction:k,startFaintReaction:O}){let v=(0,n.useRef)({x:0,y:0}),b=(0,n.useRef)(null),M=(0,n.useRef)(null),$=(0,n.useRef)(null),I=(0,n.useRef)(!1),P=(0,n.useCallback)(()=>{if(S(),m(!1),E("notification"),I.current){I.current=!1;return}o||(s?.activityId&&y(),i&&(p(!1),E("faint")),T())},[s?.activityId,E,i,o,p,m,T,S,y]),N=(0,n.useCallback)(n=>{if(0!==n.button)return;let o=(0,a.getBounds)(e.current),i=r??(0,a.clampPetPosition)(t??{x:o.width-l.CLOUD_CODE_MONSTER_SIZE.width-112,y:.48*o.height},o,l.CLOUD_CODE_MONSTER_SIZE),s=c(n,e.current),d=performance.now();v.current={x:s.x-i.x,y:s.y-i.y},b.current=s,M.current={point:s,time:d},$.current=null,u.current=d,I.current=!1,S(),f(!0),_(1.1),n.currentTarget.setPointerCapture(n.pointerId)},[e,t,u,r,f,_,S]);return{handlePetClick:P,handlePointerDown:N,handlePointerMove:(0,n.useCallback)(t=>{if(!o)return;let n=(0,a.getBounds)(e.current),r=c(t,e.current),s=performance.now(),f=M.current??{point:r,time:s},m=r.x-f.point.x,p=r.y-f.point.y,E={x:m,y:p},C=Math.hypot(m,p),S=Math.max(1,s-f.time),y=(0,a.calculateMonsterWalkIntensity)(C,S),T=(0,a.clampPetPosition)({x:r.x-v.current.x,y:r.y-v.current.y},n,l.CLOUD_CODE_MONSTER_SIZE),P=b.current??r,N=Math.abs(r.x-P.x),A=Math.abs(r.y-P.y);(N>3||A>3)&&(I.current=!0),Math.abs(m)>.5&&g(m>=0?"right":"left");let D=(0,a.hasViolentMonsterDirectionChange)($.current,E);(!i&&(0,a.isViolentMonsterDrag)(C,S,D)&&k(),!i&&(0,a.isMonsterFaintShakeEvent)(C,S,D)&&(d.current=[...d.current.filter(e=>s-e<=l.CLOUD_CODE_MONSTER_FAINT_EVENT_WINDOW_MS),s],(0,a.shouldFaintFromMonsterShake)(d.current,s)))?O():(_(y),h(T),M.current={point:r,time:s},C>.5&&($.current=E),C>1&&s-u.current>=(0,a.getMonsterFootstepIntervalMs)(y)&&(w(T,y),u.current=s))},[e,i,o,u,w,h,g,_,O,k,d]),stopDragging:(0,n.useCallback)(e=>{o&&(f(!1),d.current=[],b.current=null,M.current=null,$.current=null,C("walkSettle",()=>{_(1)},180),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[o,f,C,_,d])}}({activityState:S,boundaryRef:e,fainted:L,initialPosition:p,isDragging:O,lastFootstepAtRef:K,position:T,pushFootprint:eS,setFainted:U,setIsDragging:v,setNotificationActive:N,setPetTimer:en,setPosition:k,setWalkDirection:V,setWalkIntensity:j,clearPetTimer:et,startFaintReaction:ev,startShakeReaction:eO,startShockReaction:ek,stopTemporaryMotion:eT,violentDragEventsRef:G,wakeMonsterToDefault:ey});if(!T||!S)return null;let eP=$||L?null:er;return(0,t.jsxs)("div",{className:i.default.petLayer,children:[(0,t.jsx)("div",{className:i.default.footsteps,"aria-hidden":"true",children:B.map(e=>(0,t.jsx)("span",{className:i.default.footprint,"data-side":e.side,onAnimationEnd:()=>{H(t=>t.filter(t=>t.id!==e.id))},style:{"--monster-footprint-x":`${e.x}px`,"--monster-footprint-y":`${e.y}px`,"--monster-footprint-scale":String(Math.min(1.35,Math.max(.75,e.intensity/1.45)))}},e.id))}),(0,t.jsxs)("aside",{"aria-label":`${eo.name} pixel PET: ${L?"fainted":$?"peeking at work":eP?.label??"idle"}`,className:i.default.pet,"data-activity":eP?.id??"idle","data-dragging":O,"data-walking":e_,"data-direction":eg?ep.walkDirection:J,"data-reaction":R?"shake":A?"shock":"none","data-reacting":A,"data-shaken":R,"data-fainted":L,"data-peeking":$,"data-notifying":P,style:{"--cloud-code-monster-pet-x":`${T.x}px`,"--cloud-code-monster-pet-y":`${T.y}px`,"--monster-walk-duration":`${Math.round(360/Math.max(.75,F))}ms`,"--monster-walk-lift":`-${Math.round(2*Math.max(.75,F))}px`,"--monster-walk-intensity":String(F)},children:[P?(0,t.jsx)("span",{className:i.default.notificationBell,"aria-hidden":"true",children:(0,t.jsxs)("svg",{viewBox:"0 0 24 24",className:`${i.default.notificationBellPixel} size-6`,role:"img",shapeRendering:"crispEdges",children:[(0,t.jsx)("rect",{x:"10",y:"2",width:"4",height:"3",fill:"#2b2112"}),(0,t.jsx)("rect",{x:"8",y:"5",width:"8",height:"3",fill:"#2b2112"}),(0,t.jsx)("rect",{x:"6",y:"8",width:"12",height:"8",fill:"#2b2112"}),(0,t.jsx)("rect",{x:"4",y:"16",width:"16",height:"4",fill:"#2b2112"}),(0,t.jsx)("rect",{x:"9",y:"20",width:"6",height:"2",fill:"#2b2112"}),(0,t.jsx)("rect",{x:"10",y:"5",width:"4",height:"2",fill:"#ffe37a"}),(0,t.jsx)("rect",{x:"8",y:"8",width:"8",height:"8",fill:"#f4c84f"}),(0,t.jsx)("rect",{x:"6",y:"16",width:"12",height:"2",fill:"#f4c84f"}),(0,t.jsx)("rect",{x:"9",y:"9",width:"3",height:"7",fill:"#ffe37a"}),(0,t.jsx)("rect",{x:"13",y:"18",width:"3",height:"2",fill:"#c8922f"})]})}):null,(0,t.jsx)("button",{type:"button",className:i.default.button,"data-dragging":O,"data-fainted":L,onClick:eb,onPointerDown:eM,onPointerMove:e$,onPointerUp:eI,onPointerCancel:eI,onLostPointerCapture:eI,"aria-label":`Claude Code pixel monster is ${L?"fainted":$?"peeking at work":eP?.label??"idle"}. Click to ${eP||L||$?"interrupt it":"notice it"}, drag to make it walk.`,children:(0,t.jsx)(u.MonsterSvg,{activityId:eP?.id??null,preset:eo,reacting:A,shaken:R,fainted:L})})]})]})}e.s(["CloudCodeMonsterPet",0,m],626620),e.i(626620),e.s(["CLOUD_CODE_MONSTER_ACTIVITIES",()=>s.CLOUD_CODE_MONSTER_ACTIVITIES,"CLOUD_CODE_MONSTER_ACTIVITY_REFRESH_MS",()=>l.CLOUD_CODE_MONSTER_ACTIVITY_REFRESH_MS,"CLOUD_CODE_MONSTER_AUTOWALK_ACTIVITY_IDS",()=>s.CLOUD_CODE_MONSTER_AUTOWALK_ACTIVITY_IDS,"CLOUD_CODE_MONSTER_FAINT_MIN_EVENTS",()=>l.CLOUD_CODE_MONSTER_FAINT_MIN_EVENTS,"CLOUD_CODE_MONSTER_FAINT_MS",()=>l.CLOUD_CODE_MONSTER_FAINT_MS,"CLOUD_CODE_MONSTER_PET_PRESETS",()=>d.CLOUD_CODE_MONSTER_PET_PRESETS,"CLOUD_CODE_MONSTER_PRESET_CHANGED_EVENT",()=>l.CLOUD_CODE_MONSTER_PRESET_CHANGED_EVENT,"CLOUD_CODE_MONSTER_PRESET_STORAGE_KEY",()=>l.CLOUD_CODE_MONSTER_PRESET_STORAGE_KEY,"CloudCodeMonsterPet",0,m,"CloudCodeMonsterPresetPreview",()=>u.CloudCodeMonsterPresetPreview,"calculateMonsterWalkIntensity",()=>a.calculateMonsterWalkIntensity,"clampPetPosition",()=>a.clampPetPosition,"createCloudCodeMonsterHiddenState",()=>a.createCloudCodeMonsterHiddenState,"createCloudCodeMonsterIdleState",()=>a.createCloudCodeMonsterIdleState,"createCloudCodeMonsterPreviewAwayState",()=>a.createCloudCodeMonsterPreviewAwayState,"createCloudCodeMonsterWalkVelocity",()=>a.createCloudCodeMonsterWalkVelocity,"createWalkToTargetVelocity",()=>a.createWalkToTargetVelocity,"getCloudCodeMonsterExpression",()=>a.getCloudCodeMonsterExpression,"getCloudCodeMonsterPreset",()=>d.getCloudCodeMonsterPreset,"getMonsterFootstepIntervalMs",()=>a.getMonsterFootstepIntervalMs,"hasViolentMonsterDirectionChange",()=>a.hasViolentMonsterDirectionChange,"isMonsterFaintShakeEvent",()=>a.isMonsterFaintShakeEvent,"isViolentMonsterDrag",()=>a.isViolentMonsterDrag,"pickCloudCodeMonsterActivity",()=>a.pickCloudCodeMonsterActivity,"readCloudCodeMonsterPetPresetId",()=>d.readCloudCodeMonsterPetPresetId,"reflectCloudCodeMonsterWalk",()=>a.reflectCloudCodeMonsterWalk,"resolveCloudCodeMonsterActivityState",()=>a.resolveCloudCodeMonsterActivityState,"resolveCloudCodeMonsterPeekPosition",()=>a.resolveCloudCodeMonsterPeekPosition,"resolveCloudCodeMonsterPreviewComebackState",()=>a.resolveCloudCodeMonsterPreviewComebackState,"resolveCloudCodeMonsterVisibleState",()=>a.resolveCloudCodeMonsterVisibleState,"shouldCloudCodeMonsterAutoWalk",()=>a.shouldCloudCodeMonsterAutoWalk,"shouldFaintFromMonsterShake",()=>a.shouldFaintFromMonsterShake,"shouldRefreshCloudCodeMonsterActivity",()=>a.shouldRefreshCloudCodeMonsterActivity,"writeCloudCodeMonsterPetPresetId",()=>d.writeCloudCodeMonsterPetPresetId],105583)},928210,e=>{e.n(e.i(105583))},631822,e=>{e.v(t=>Promise.all(["static/chunks/0wjp8xrzix2_f.js"].map(t=>e.l(t))).then(()=>t(70725)))}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,208020,(e,t,a)=>{t.exports=e.r(170928)},931764,536460,e=>{"use strict";e.i(459119);var t=e.i(298699),a=e.i(92615),i=e.i(673664),n=e.i(893205),s=e.i(390072),r=e.i(240003);let o=t.createContext(void 0);function d(e=!1){let a=t.useContext(o);if(void 0===a&&!e)throw Error((0,r.default)(16));return a}function l(e){return(0,a.isHTMLElement)(e)&&"BUTTON"===e.tagName}e.s(["CompositeRootContext",0,o,"useCompositeRootContext",0,d],536460),e.s(["useButton",0,function(e={}){let{disabled:a=!1,focusableWhenDisabled:r,tabIndex:o=0,native:c=!0,composite:u}=e,p=t.useRef(null),g=d(!0),m=u??void 0!==g,{props:h}=function(e){let{focusableWhenDisabled:a,disabled:i,composite:n=!1,tabIndex:s=0,isNativeButton:r}=e,o=n&&!1!==a,d=n&&!1===a;return{props:t.useMemo(()=>{let e={onKeyDown(e){i&&a&&"Tab"!==e.key&&e.preventDefault()}};return n||(e.tabIndex=s,!r&&i&&(e.tabIndex=a?s:-1)),(r&&(a||o)||!r&&i)&&(e["aria-disabled"]=i),r&&(!a||d)&&(e.disabled=i),e},[n,i,a,o,d,r,s])}}({focusableWhenDisabled:r,disabled:a,composite:m,tabIndex:o,isNativeButton:c}),f=t.useCallback(()=>{let e=p.current;l(e)&&m&&a&&void 0===h.disabled&&e.disabled&&(e.disabled=!1)},[a,h.disabled,m]);return(0,n.useIsoLayoutEffect)(f,[f]),{getButtonProps:t.useCallback((e={})=>{let{onClick:t,onMouseDown:i,onKeyUp:n,onKeyDown:r,onPointerDown:o,...d}=e;return(0,s.mergeProps)({onClick(e){a?e.preventDefault():t?.(e)},onMouseDown(e){a||i?.(e)},onKeyDown(e){var i;if(a||((0,s.makeEventPreventable)(e),r?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,o=e.currentTarget,d=l(o),u=!c&&(i=o,!!(i?.tagName==="A"&&i?.href)),p=n&&(c?d:!u),g="Enter"===e.key,h=" "===e.key,f=o.getAttribute("role"),$=f?.startsWith("menuitem")||"option"===f||"gridcell"===f;if(n&&m&&h){if(e.defaultPrevented&&$)return;e.preventDefault(),u||c&&d?(o.click(),e.preventBaseUIHandler()):p&&(t?.(e),e.preventBaseUIHandler());return}p&&(!c&&(h||g)&&e.preventDefault(),!c&&g&&t?.(e))},onKeyUp(e){a||(((0,s.makeEventPreventable)(e),n?.(e),e.target===e.currentTarget&&c&&m&&l(e.currentTarget)&&" "===e.key)?e.preventDefault():!e.baseUIHandlerPrevented&&(e.target!==e.currentTarget||c||m||" "!==e.key||t?.(e)))},onPointerDown(e){a?e.preventDefault():o?.(e)}},c?{type:"button"}:{role:"button"},h,d)},[a,h,m,c]),buttonRef:(0,i.useStableCallback)(e=>{p.current=e,f()})}}],931764)},294237,e=>{"use strict";var t=e.i(7284);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,i=t.clsx;e.s(["cva",0,(e,t)=>n=>{var s;if((null==t?void 0:t.variants)==null)return i(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:r,defaultVariants:o}=t,d=Object.keys(r).map(e=>{let t=null==n?void 0:n[e],i=null==o?void 0:o[e];if(null===t)return null;let s=a(t)||a(i);return r[e][s]}),l=n&&Object.entries(n).reduce((e,t)=>{let[a,i]=t;return void 0===i||(e[a]=i),e},{});return i(e,d,null==t||null==(s=t.compoundVariants)?void 0:s.reduce((e,t)=>{let{class:a,className:i,...n}=t;return Object.entries(n).every(e=>{let[t,a]=e;return Array.isArray(a)?a.includes({...o,...l}[t]):({...o,...l})[t]===a})?[...e,a,i]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)}])},186339,e=>{"use strict";var t=e.i(368075);e.i(459119);var a=e.i(298699),i=e.i(931764),n=e.i(863764);let s=a.forwardRef(function(e,t){let{render:a,className:s,disabled:r=!1,focusableWhenDisabled:o=!1,nativeButton:d=!0,style:l,...c}=e,{getButtonProps:u,buttonRef:p}=(0,i.useButton)({disabled:r,focusableWhenDisabled:o,native:d});return(0,n.useRenderElement)("button",e,{state:{disabled:r},ref:[t,p],props:[c,u]})});var r=e.i(294237),o=e.i(613349);let d=(0,r.cva)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});e.s(["Button",0,function({className:e,variant:a="default",size:i="default",...n}){return(0,t.jsx)(s,{"data-slot":"button",className:(0,o.cn)(d({variant:a,size:i,className:e})),...n})},"buttonVariants",0,d],186339)},222862,636557,e=>{"use strict";class t extends Error{status;details;constructor(e,t,a){super(e),this.name="ApiError",this.status=t,this.details=a}get isNetworkError(){return 0===this.status}get isRateLimit(){return 429===this.status}get isUnauthorized(){return 401===this.status}}function a(e,t){return"validation error"===e&&t?.length?function(e){let[t,...a]=e.split(":"),i=a.join(":").trim();if(!i)return e;let n=t.trim(),s=n.trim().replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase()),r=i.replace(/^required$/i,"is required"),o=r.toLowerCase().replace(/[_-]+/g," "),d=n.toLowerCase().replace(/[_-]+/g," ");return d&&o.startsWith(`${d} `)&&(r=r.slice(n.length).trimStart()),s?`${s} ${r}`:r}(t[0]):e}async function i(e,i){let n;try{n=await fetch(""+e,{...i,credentials:"include",headers:{"Content-Type":"application/json",...i?.headers}})}catch(e){if(e instanceof TypeError)throw new t("Unable to connect — check your network",0);throw e}if(401===n.status)throw window.location.href="/sign-in",new t("Unauthorized",401);if(!n.ok){let e,i;try{let t=await n.json();e=t.error,i=t.details}catch{}if(429===n.status)throw new t("Please wait a moment before trying again",429);if(n.status>=500)throw new t(a(e,i)||"Something went wrong — please try again",n.status,i);throw new t(a(e,i)||"Something went wrong",n.status,i)}if(204!==n.status)return n.json()}function n(e,t){let a=new URLSearchParams({workspace_id:e,...t});return`?${a.toString()}`}e.s(["ApiError",0,t],636557);let s=async(e,a,s,r)=>{let o;if(!r||0===r.length)return i(`/api/conversations/${e}/messages${n(s)}`,{method:"POST",body:JSON.stringify({content:a})});let d=new FormData;for(let e of(d.append("content",a),r))d.append("file",e);try{o=await fetch(`/api/conversations/${e}/messages${n(s)}`,{method:"POST",credentials:"include",body:d})}catch(e){if(e instanceof TypeError)throw new t("Unable to connect — check your network",0);throw e}if(401===o.status)throw window.location.href="/sign-in",new t("Unauthorized",401);if(!o.ok){let e,a;try{let t=await o.json();e=t.error,a=t.details}catch{}if(429===o.status)throw new t("Please wait a moment before trying again",429);if(o.status>=500)throw new t(e||"Something went wrong — please try again",o.status,a);throw new t(e||"Something went wrong",o.status,a)}return o.json()},r=async(e,a,s,r)=>{let o;if(!r||0===r.length)return i(`/api/conversations/${e}/buffered-messages${n(s)}`,{method:"POST",body:JSON.stringify({content:a})});let d=new FormData;for(let e of(d.append("content",a),r))d.append("file",e);try{o=await fetch(`/api/conversations/${e}/buffered-messages${n(s)}`,{method:"POST",credentials:"include",body:d})}catch(e){if(e instanceof TypeError)throw new t("Unable to connect — check your network",0);throw e}if(401===o.status)throw window.location.href="/sign-in",new t("Unauthorized",401);if(!o.ok){let e,a;try{let t=await o.json();e=t.error,a=t.details}catch{}if(429===o.status)throw new t(e||"Maximum follow-ups reached",429);if(o.status>=500)throw new t(e||"Something went wrong — please try again",o.status,a);throw new t(e||"Something went wrong",o.status,a)}return o.json()},o=async(e,t)=>{let a=new URLSearchParams({workspace_id:t}),i=await fetch(`/api/email/${e}/body?${a}`,{credentials:"include"});if(!i.ok)return{content:"(body not available)",isHtml:!1};let n=i.headers.get("Content-Type")??"";return{content:await i.text(),isHtml:n.includes("text/html")}},d=async(e,a)=>{let i=new FormData;i.append("file",e);let s=await fetch(`/api/email/upload${n(a)}`,{method:"POST",credentials:"include",body:i});if(!s.ok)throw new t(await s.text().catch(()=>"Upload failed"),s.status);return s.json()},l=async(e,a)=>{let s;if(!a.files||0===a.files.length)return i(`/api/issues${n(e)}`,{method:"POST",body:JSON.stringify({agent_id:a.agent_id,title:a.title,description:a.description})});let r=new FormData;for(let e of(a.agent_id&&r.append("agent_id",a.agent_id),r.append("title",a.title),r.append("description",a.description??""),a.files))r.append("file",e);try{s=await fetch(`/api/issues${n(e)}`,{method:"POST",credentials:"include",body:r})}catch(e){if(e instanceof TypeError)throw new t("Unable to connect — check your network",0);throw e}if(401===s.status)throw window.location.href="/sign-in",new t("Unauthorized",401);if(!s.ok){let e,a;try{let t=await s.json();e=t.error,a=t.details}catch{}if(429===s.status)throw new t("Please wait a moment before trying again",429);if(s.status>=500)throw new t(e||"Something went wrong — please try again",s.status,a);throw new t(e||"Something went wrong",s.status,a)}return s.json()},c=async(e,t)=>{let a=new URLSearchParams({workspace_id:t}),i=await fetch(`/api/artifacts/${e}/content?${a}`,{credentials:"include"});return i.ok?i.text():"(content not available)"};e.s(["acceptInvite",0,e=>i(`/api/invite/${e}`,{method:"POST"}),"addWhitelistEmail",0,(e,t,a)=>i(`/api/agents/${e}/whitelist${n(a)}`,{method:"POST",body:JSON.stringify({email:t})}),"approveMeeting",0,(e,t,a)=>i(`/api/agents/${e}/meetings/${t}/approve${n(a)}`,{method:"POST"}),"cancelActiveTask",0,(e,t)=>i(`/api/conversations/${e}/active-task${n(t)}`,{method:"DELETE"}),"chatInit",0,(e,t,a)=>i(`/api/agents/${e}/chat-init${n(t)}`,{method:"POST",body:JSON.stringify({...a?{channel:a}:{}})}),"checkFreshness",0,(e,t)=>{let a={};return e.conversationId&&(a.conversation_id=e.conversationId),e.agentId&&(a.agent_id=e.agentId),e.channel&&(a.channel=e.channel),i(`/api/conversations/check-fresh${n(t,a)}`)},"conversationInit",0,(e,t,a)=>{let s={};return a?.newestMessageId&&(s.newest_message_id=a.newestMessageId),i(`/api/conversations/${e}/init${n(t,s)}`)},"createAgent",0,(e,t)=>i(`/api/agents${n(t)}`,{method:"POST",body:JSON.stringify(e)}),"createAgentLink",0,(e,t)=>i(`/api/agent-links${n(t)}`,{method:"POST",body:JSON.stringify(e)}),"createBufferedMessage",0,r,"createCalendarEvent",0,(e,t)=>i(`/api/calendar${n(t)}`,{method:"POST",body:JSON.stringify(e)}),"createChannelApi",0,(e,t)=>i(`/api/channels${n(e)}`,{method:"POST",body:JSON.stringify({name:t})}),"createConversation",0,(e,t,a)=>i(`/api/conversations${n(t)}`,{method:"POST",body:JSON.stringify({agent_id:e,...a?{channel:a}:{}})}),"createEmailAccount",0,(e,t,a)=>i(`/api/agents/${e}/email-accounts${n(a)}`,{method:"POST",body:JSON.stringify(t)}),"createInvite",0,e=>i(`/api/workspaces/${e}/invites${n(e)}`,{method:"POST"}),"createIssue",0,l,"createMachineToken",0,(e,t)=>i(`/api/machine-tokens${t?n(t):""}`,{method:"POST",body:JSON.stringify({name:e||"default"})}),"createMeeting",0,(e,t,a)=>i(`/api/agents/${e}/meetings${n(t)}`,{method:"POST",body:JSON.stringify(a)}),"deleteAgent",0,(e,t)=>i(`/api/agents/${e}${n(t)}`,{method:"DELETE"}),"deleteAgentLink",0,(e,t)=>i(`/api/agent-links/${e}${n(t)}`,{method:"DELETE"}),"deleteBufferedMessage",0,(e,t,a)=>i(`/api/conversations/${e}/buffered-messages/${t}${n(a)}`,{method:"DELETE"}),"deleteCalendarEvent",0,(e,t,a)=>i(`/api/calendar/${e}${n(t)}`,{method:"DELETE",...a&&a.scope?{headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}:{}}),"deleteChannelApi",0,(e,t)=>i(`/api/channels/${e}${n(t)}`,{method:"DELETE"}),"deleteEmail",0,(e,t)=>i(`/api/email/${e}${n(t)}`,{method:"DELETE"}),"deleteEmailAccount",0,(e,t,a)=>i(`/api/agents/${e}/email-accounts/${t}${n(a)}`,{method:"DELETE"}),"deleteIssue",0,(e,t)=>i(`/api/issues/${t}${n(e)}`,{method:"DELETE"}),"deleteMachine",0,(e,t)=>i(`/api/runtimes/machine${n(t,{daemon_id:e})}`,{method:"DELETE"}),"deleteMeeting",0,(e,t,a)=>i(`/api/agents/${e}/meetings/${t}${n(a)}`,{method:"DELETE"}),"deleteWorkspace",0,(e,t)=>i(`/api/workspaces/${e}${n(e)}`,{method:"DELETE",body:JSON.stringify({confirm_name:t})}),"fetchLatestCliVersion",0,()=>i("/api/cli/latest-version"),"fetchModelOptions",0,()=>i("/api/config/model-options"),"flagMessage",0,(e,t)=>i(`/api/flags${n(e)}`,{method:"POST",body:JSON.stringify({messageId:t})}),"getActiveTask",0,(e,t)=>i(`/api/conversations/${e}/active-task${n(t)}`),"getAgentSkills",0,(e,t)=>i(`/api/agents/${e}/skills${n(t)}`),"getArtifactContent",0,c,"getCalendarEvent",0,(e,t)=>i(`/api/calendar/${e}${n(t)}`),"getEmail",0,(e,t)=>i(`/api/email/${e}${n(t)}`),"getEmailBody",0,o,"getEmailThread",0,(e,t)=>i(`/api/email/${e}/thread${n(t)}`),"getFlaggedCount",0,e=>i(`/api/flags/count${n(e)}`),"getInboxCount",0,(e,t)=>{let a={};return t?.types?.length&&(a.types=t.types.join(",")),i(`/api/inbox/count${n(e,a)}`)},"getInviteInfo",0,e=>i(`/api/invite/${e}`),"getIssue",0,(e,t)=>i(`/api/issues/${t}${n(e)}`),"getMemberMe",0,e=>i(`/api/members/me${n(e)}`),"getMinCliVersion",0,()=>i("/api/config/min-version"),"getTask",0,(e,t)=>i(`/api/tasks/${e}${n(t)}`),"getTaskMessages",0,(e,t,a)=>i(`/api/tasks/${e}/messages${n(t,a?{since:String(a)}:void 0)}`),"getTrace",0,(e,t)=>i(`/api/traces/${e}${n(t)}`),"getWorkspaceOverview",0,e=>i(`/api/workspaces/${e}/overview${n(e)}`),"grantAgentAccess",0,(e,t,a)=>i(`/api/agents/${t}/access${n(e)}`,{method:"POST",body:JSON.stringify({user_id:a})}),"listAgentAccess",0,(e,t)=>i(`/api/agents/${t}/access${n(e)}`),"listAgentActiveTaskCounts",0,e=>i(`/api/agents/active-task-counts${n(e)}`),"listAgentActivity",0,(e,t,a)=>{let s={};return a?.limit&&(s.limit=String(a.limit)),a?.before&&(s.before=a.before),a?.beforeId&&(s.before_id=a.beforeId),a?.status&&(s.status=a.status),a?.type&&(s.type=a.type),i(`/api/agents/${e}/activity${n(t,s)}`)},"listAgentLinks",0,e=>i(`/api/agent-links${n(e)}`),"listAgentPins",0,e=>i(`/api/agents/pins${n(e)}`),"listAgents",0,e=>i(`/api/agents${n(e)}`),"listArtifacts",0,(e,t)=>i(`/api/artifacts${n(t,{conversation_id:e})}`),"listBufferedMessages",0,(e,t)=>i(`/api/conversations/${e}/buffered-messages${n(t)}`),"listCalendarEvents",0,(e,t)=>{let a={};return t?.agentId&&(a.agentId=t.agentId),t?.from&&(a.from=t.from),t?.to&&(a.to=t.to),i(`/api/calendar${n(e,a)}`)},"listChannels",0,e=>i(`/api/channels${n(e)}`),"listEmailAccounts",0,(e,t)=>i(`/api/agents/${e}/email-accounts${n(t)}`),"listEmails",0,(e,t,a,s)=>i(`/api/email${n(t,{agentId:e,...a?{folder:a}:{},...s?{address:s}:{}})}`),"listFlaggedItems",0,(e,t)=>{let a={};return t?.limit&&(a.limit=String(t.limit)),t?.before&&(a.before=t.before),i(`/api/flags${n(e,a)}`)},"listFlaggedMessageIds",0,(e,t)=>i(`/api/flags${n(e,{conversation_id:t,ids_only:"true"})}`),"listInboxItems",0,(e,t)=>{let a={};return t?.limit&&(a.limit=String(t.limit)),t?.before&&(a.before=t.before),t?.types?.length&&(a.types=t.types.join(",")),i(`/api/inbox${n(e,a)}`)},"listInvites",0,e=>i(`/api/workspaces/${e}/invites${n(e)}`),"listIssues",0,(e,t)=>{let a={};return t?.agentId&&(a.agentId=t.agentId),t?.status&&(a.status=t.status),t?.terminal!==void 0&&(a.terminal=String(t.terminal)),i(`/api/issues${n(e,a)}`)},"listMeetings",0,(e,t)=>i(`/api/agents/${e}/meetings${n(t)}`),"listMembers",0,e=>i(`/api/workspaces/${e}/members${n(e)}`),"listMessages",0,(e,t,a)=>{let s={};return a?.limit&&(s.limit=String(a.limit)),a?.before&&(s.before=a.before),a?.beforeId&&(s.before_id=a.beforeId),i(`/api/conversations/${e}/messages${n(t,s)}`)},"listMessagesAroundTask",0,(e,t,a)=>i(`/api/conversations/${e}/messages${n(t,{around_task:a})}`),"listPreviousConversations",0,(e,t,a)=>{let s={exclude:a.exclude,before:a.before};return a.channel&&(s.channel=a.channel),a.limit&&(s.limit=String(a.limit)),i(`/api/agents/${e}/conversations${n(t,s)}`)},"listRuntimes",0,e=>i(`/api/runtimes${n(e)}`),"listTraces",0,(e,t)=>{let a={};return t?.limit&&(a.limit=String(t.limit)),t?.before&&(a.before=t.before),t?.status&&(a.status=t.status),t?.multiAgent&&(a.multiAgent="true"),t?.agentId&&(a.agentId=t.agentId),t?.channel&&(a.channel=t.channel),i(`/api/traces${n(e,a)}`)},"listWhitelist",0,(e,t)=>i(`/api/agents/${e}/whitelist${n(t)}`),"listWorkspaceActiveTasks",0,e=>i(`/api/agents/active-tasks${n(e)}`),"listWorkspaces",0,()=>i("/api/workspaces"),"markAllInboxRead",0,e=>i(`/api/inbox/read-all${n(e)}`,{method:"POST"}),"markInboxRead",0,(e,t)=>i(`/api/inbox/read${n(t)}`,{method:"POST",body:JSON.stringify({conversationId:e})}),"pinAgent",0,(e,t)=>i(`/api/agents/${t}/pin${n(e)}`,{method:"POST"}),"removeMember",0,(e,t)=>i(`/api/workspaces/${e}/members/${t}${n(e)}`,{method:"DELETE"}),"removeWhitelistEmail",0,(e,t,a)=>i(`/api/agents/${e}/whitelist/${t}${n(a)}`,{method:"DELETE"}),"renameChannelApi",0,(e,t,a)=>i(`/api/channels/${e}${n(t)}`,{method:"PATCH",body:JSON.stringify({name:a})}),"reorderAgentPins",0,(e,t)=>i(`/api/agents/pins/reorder${n(e)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:t})}),"reorderChannelsApi",0,(e,t)=>i(`/api/channels/reorder${n(e)}`,{method:"PUT",body:JSON.stringify({ordered_channel_ids:t})}),"reorderUnpinnedAgents",0,(e,t)=>i(`/api/agents/sidebar/reorder${n(e)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:t})}),"requestWorkspaceBrowse",0,(e,t,a,s)=>i(`/api/agents/${e}/workspace/browse${n(t)}`,{method:"POST",body:JSON.stringify({request_type:a,path:s})}),"retryTask",0,(e,t)=>i(`/api/tasks/${e}/retry${n(t)}`,{method:"POST"}),"revokeAgentAccess",0,(e,t,a,s=!1)=>i(`/api/agents/${t}/access/${a}${n(e)}${s?"&remove_whitelist=true":""}`,{method:"DELETE"}),"revokeInvite",0,(e,t)=>i(`/api/workspaces/${e}/invites/${t}${n(e)}`,{method:"DELETE"}),"sendEmail",0,(e,t,a,s,r,o,d,l)=>i(`/api/email/send${n(r)}`,{method:"POST",body:JSON.stringify({agentId:e,to:t,subject:a,htmlBody:s,attachments:o,...d,customAccountId:l})}),"sendMessage",0,s,"stopMeeting",0,(e,t,a)=>i(`/api/agents/${e}/meetings/${t}/stop${n(a)}`,{method:"POST"}),"syncEmailAccount",0,(e,t,a)=>i(`/api/agents/${e}/email-accounts/${t}/sync${n(a)}`,{method:"POST"}),"triggerRuntimeRescan",0,(e,t)=>i(`/api/runtimes/${e}/rescan${n(t)}`,{method:"POST"}),"triggerRuntimeUpdate",0,(e,t)=>i(`/api/runtimes/${e}/update${n(t)}`,{method:"POST"}),"unflagMessage",0,(e,t)=>i(`/api/flags/${t}${n(e)}`,{method:"DELETE"}),"unpinAgent",0,(e,t)=>i(`/api/agents/${t}/pin${n(e)}`,{method:"DELETE"}),"updateAgent",0,(e,t,a)=>i(`/api/agents/${e}${n(a)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateAgentLink",0,(e,t,a)=>i(`/api/agent-links/${e}${n(a)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateCalendarEvent",0,(e,t,a)=>i(`/api/calendar/${e}${n(a)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateEmailStatus",0,(e,t,a)=>i(`/api/email/${e}${n(t)}`,{method:"PATCH",body:JSON.stringify({status:a})}),"updateIssue",0,(e,t,a)=>i(`/api/issues/${t}${n(e)}`,{method:"PATCH",body:JSON.stringify(a)}),"updateMemberMe",0,(e,t)=>i(`/api/members/me${n(e)}`,{method:"PATCH",body:JSON.stringify({global_instruction:t})}),"updateWorkspace",0,(e,t)=>i(`/api/workspaces/${e}${n(e)}`,{method:"PATCH",body:JSON.stringify(t)}),"uploadEmailAttachment",0,d],222862)},728886,e=>{"use strict";var t=e.i(368075),a=e.i(613349);e.s(["Skeleton",0,function({className:e,...i}){return(0,t.jsx)("div",{"data-slot":"skeleton",className:(0,a.cn)("animate-pulse rounded-md bg-muted",e),...i})}])},29437,e=>{"use strict";var t=e.i(368075),a=e.i(298699),i=e.i(208020),n=e.i(880932),s=e.i(222862),r=e.i(186339),o=e.i(728886);e.s(["default",0,function(){let{token:e}=(0,i.useParams)(),d=(0,i.useRouter)(),[l,c]=(0,a.useState)("loading"),[u,p]=(0,a.useState)(null),[g,m]=(0,a.useState)("");(0,a.useEffect)(()=>{e&&(0,s.getInviteInfo)(e).then(e=>{p(e),c("ready")}).catch(e=>{m(e instanceof Error?e.message:"Invalid or expired invite link"),c("error")})},[e]);let h=async()=>{if(e){c("accepting");try{let t=await (0,s.acceptInvite)(e);c("done"),n.toast.success(`Joined ${u?.workspace_name??"workspace"}`),d.replace(`/w/${t.workspace_slug}/home`)}catch(e){m(e instanceof Error?e.message:"Failed to join workspace"),c("error")}}};return(0,t.jsx)("div",{className:"min-h-screen flex items-center justify-center p-6",children:(0,t.jsxs)("div",{className:"w-full max-w-sm space-y-6 text-center",children:["loading"===l&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(o.Skeleton,{className:"h-6 w-48 mx-auto"}),(0,t.jsx)(o.Skeleton,{className:"h-4 w-64 mx-auto"}),(0,t.jsx)(o.Skeleton,{className:"h-9 w-32 mx-auto"})]}),"ready"===l&&u&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold",children:"You've been invited"}),(0,t.jsxs)("p",{className:"text-sm text-muted-foreground",children:[u.invited_by," invited you to join"]})]}),(0,t.jsxs)("div",{className:"rounded-md border border-border/50 px-4 py-3 text-left space-y-0.5",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:u.workspace_name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Workspace"})]}),(0,t.jsx)(r.Button,{className:"w-full",onClick:h,children:"Join Workspace"})]}),"accepting"===l&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(o.Skeleton,{className:"h-6 w-48 mx-auto"}),(0,t.jsx)(o.Skeleton,{className:"h-4 w-64 mx-auto"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Joining workspace…"})]}),"error"===l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold",children:"Invite unavailable"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:g})]}),(0,t.jsx)(r.Button,{variant:"outline",onClick:()=>d.replace("/workspaces"),children:"Go to workspaces"})]})]})})}])}]);
|