@alook/app 0.0.140 → 0.0.141
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 +50 -33
- 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/0eayyb8dzeuqj.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0hujq4gn1km2d.css +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{0pqa0bk3fnq2q.js → 15gpqusfs36cs.js} +2 -2
- package/bundled/web/.open-next/assets/_next/static/chunks/1wk6udc50axdg.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{1l3nq6kc3fbh-.js → 2aicu2qufs82c.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/2c9n34tpjgbko.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{1avrt94npx8p3.js → 2jgr6hdohnj5b.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{2qc57pol1-1f3.js → 348z6y6iea4gl.js} +3 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/447gx8byleobi.js +1 -0
- package/bundled/web/.open-next/cache/{WTLpHjXNd0wVnZOUBMJJz → n67RZ-dHYbiPuCBj-CPEs}/_global-error.cache +1 -1
- package/bundled/web/.open-next/cache/{WTLpHjXNd0wVnZOUBMJJz → n67RZ-dHYbiPuCBj-CPEs}/_not-found.cache +1 -1
- package/bundled/web/.open-next/cache/{WTLpHjXNd0wVnZOUBMJJz → n67RZ-dHYbiPuCBj-CPEs}/device.cache +1 -1
- package/bundled/web/.open-next/cache/{WTLpHjXNd0wVnZOUBMJJz → n67RZ-dHYbiPuCBj-CPEs}/privacy.cache +1 -1
- package/bundled/web/.open-next/cache/{WTLpHjXNd0wVnZOUBMJJz → n67RZ-dHYbiPuCBj-CPEs}/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/required-server-files.json +1 -1
- 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]/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]/traces/[traceId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/traces/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/api/daemon/tasks/[taskId]/complete/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/daemon/tasks/[taskId]/fail/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/daemon/tasks/[taskId]/start/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/daemon/tasks/[taskId]/supersede/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/device/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]__0aacn1t._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0aj228b._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0dvn7u2._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0pn6awg._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__12fz1lr._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/{[root-of-the-server]__11-5cy7._.js → [root-of-the-server]__134-7z_._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__155l597._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__1diut0w._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__1e9t6i6._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/{[root-of-the-server]__1lcw_r4._.js → [root-of-the-server]__1jq8zws._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/{[root-of-the-server]__0dnslqa._.js → [root-of-the-server]__1w9__7q._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__1xpwaca._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/{[root-of-the-server]__0j4ezcj._.js → [root-of-the-server]__20s9whj._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[turbopack]_runtime.js +16 -16
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0d2x7fl._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0guhu0i._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0n8pg0d._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0v95a0y._.js +11 -10
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_139j3zh._.js +11 -10
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_13jq647._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1a2lyoh._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1aztsqf._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1i4egv6._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1kt_xdj._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1nfaney._.js +11 -10
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__1e237f4._.js → [root-of-the-server]__1x1ppqv._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[turbopack]_runtime.js +16 -16
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_04ht2b1._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_19hsbaa._.js → _09dj89g._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_09v4-yk._.js +6 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0qgcnj5._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_0g_x3qh._.js → _16456wu._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_10-8eci._.js → _1twnk18._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0os8mdu._.js → node_modules__pnpm_00joh18._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_03t1_eh._.js → node_modules__pnpm_06u5s5x._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0pd1a42._.js → node_modules__pnpm_0_eee0q._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0b_f_5l._.js → node_modules__pnpm_0_muan4._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0-sy0jc._.js → node_modules__pnpm_0t9vloz._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_1tajvfi._.js → node_modules__pnpm_121t594._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0lmr_qu._.js → node_modules__pnpm_12zyy1_._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0z21f3h._.js → node_modules__pnpm_1m55ws1._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_0pwl5s4._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_lib_api_ts_1ffelwp._.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 +177 -173
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +282 -282
- package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +4 -4
- package/bundled/web/migrations/0043_machine_owner_id.sql +26 -0
- package/bundled/ws-do/index.js +50 -33
- package/dist/cli/index.js +2 -1
- package/dist/cli/session-runner.js +2 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0pydx20mmtmb-.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/11jejnuxkw5-s.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/29j2dlmefldk5.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/2usqt49xbpqd2.css +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/3pmxar-ugtky1.js +0 -1
- /package/bundled/web/.open-next/assets/_next/static/{WTLpHjXNd0wVnZOUBMJJz → n67RZ-dHYbiPuCBj-CPEs}/_buildManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{WTLpHjXNd0wVnZOUBMJJz → n67RZ-dHYbiPuCBj-CPEs}/_clientMiddlewareManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{WTLpHjXNd0wVnZOUBMJJz → n67RZ-dHYbiPuCBj-CPEs}/_ssgManifest.js +0 -0
- /package/bundled/web/.open-next/cache/{WTLpHjXNd0wVnZOUBMJJz → n67RZ-dHYbiPuCBj-CPEs}/robots.txt.cache +0 -0
|
@@ -24663,7 +24663,8 @@ var init_schema = __esm({
|
|
|
24663
24663
|
createdAt: text("created_at").notNull().$defaultFn(() => (/* @__PURE__ */ new Date()).toISOString()),
|
|
24664
24664
|
pendingUpdateVersion: text("pending_update_version"),
|
|
24665
24665
|
pendingRescan: integer2("pending_rescan", { mode: "boolean" }).default(false),
|
|
24666
|
-
updatedAt: text("updated_at").notNull().$defaultFn(() => (/* @__PURE__ */ new Date()).toISOString())
|
|
24666
|
+
updatedAt: text("updated_at").notNull().$defaultFn(() => (/* @__PURE__ */ new Date()).toISOString()),
|
|
24667
|
+
ownerId: text("owner_id").references(() => user.id, { onDelete: "set null" })
|
|
24667
24668
|
},
|
|
24668
24669
|
(t) => [primaryKey({ columns: [t.workspaceId, t.daemonId] })]
|
|
24669
24670
|
);
|
|
@@ -25529,7 +25530,9 @@ async function upsertAgentRuntime(db, data) {
|
|
|
25529
25530
|
}).returning();
|
|
25530
25531
|
return rows[0];
|
|
25531
25532
|
}
|
|
25532
|
-
async function listAgentRuntimes(db, workspaceId) {
|
|
25533
|
+
async function listAgentRuntimes(db, workspaceId, userId) {
|
|
25534
|
+
const conditions = [eq(agentRuntime.workspaceId, workspaceId)];
|
|
25535
|
+
if (userId) conditions.push(eq(machine.ownerId, userId));
|
|
25533
25536
|
return db.select({
|
|
25534
25537
|
id: agentRuntime.id,
|
|
25535
25538
|
workspaceId: agentRuntime.workspaceId,
|
|
@@ -25542,20 +25545,23 @@ async function listAgentRuntimes(db, workspaceId) {
|
|
|
25542
25545
|
updatedAt: agentRuntime.updatedAt,
|
|
25543
25546
|
machineLastSeenAt: machine.lastSeenAt,
|
|
25544
25547
|
pendingUpdateVersion: machine.pendingUpdateVersion,
|
|
25545
|
-
pendingRescan: machine.pendingRescan
|
|
25548
|
+
pendingRescan: machine.pendingRescan,
|
|
25549
|
+
machineOwnerId: machine.ownerId
|
|
25546
25550
|
}).from(agentRuntime).leftJoin(
|
|
25547
25551
|
machine,
|
|
25548
25552
|
and(
|
|
25549
25553
|
eq(machine.daemonId, agentRuntime.daemonId),
|
|
25550
25554
|
eq(machine.workspaceId, agentRuntime.workspaceId)
|
|
25551
25555
|
)
|
|
25552
|
-
).where(
|
|
25556
|
+
).where(and(...conditions)).orderBy(asc(agentRuntime.createdAt));
|
|
25553
25557
|
}
|
|
25554
25558
|
async function getAgentRuntime(db, id) {
|
|
25555
25559
|
const rows = await db.select().from(agentRuntime).where(eq(agentRuntime.id, id));
|
|
25556
25560
|
return rows[0] ?? null;
|
|
25557
25561
|
}
|
|
25558
|
-
async function getAgentRuntimeForWorkspace(db, id, workspaceId) {
|
|
25562
|
+
async function getAgentRuntimeForWorkspace(db, id, workspaceId, userId) {
|
|
25563
|
+
const conditions = [eq(agentRuntime.id, id), eq(agentRuntime.workspaceId, workspaceId)];
|
|
25564
|
+
if (userId) conditions.push(eq(machine.ownerId, userId));
|
|
25559
25565
|
const rows = await db.select({
|
|
25560
25566
|
id: agentRuntime.id,
|
|
25561
25567
|
workspaceId: agentRuntime.workspaceId,
|
|
@@ -25575,13 +25581,13 @@ async function getAgentRuntimeForWorkspace(db, id, workspaceId) {
|
|
|
25575
25581
|
eq(machine.daemonId, agentRuntime.daemonId),
|
|
25576
25582
|
eq(machine.workspaceId, agentRuntime.workspaceId)
|
|
25577
25583
|
)
|
|
25578
|
-
).where(
|
|
25579
|
-
and(eq(agentRuntime.id, id), eq(agentRuntime.workspaceId, workspaceId))
|
|
25580
|
-
);
|
|
25584
|
+
).where(and(...conditions));
|
|
25581
25585
|
return rows[0] ?? null;
|
|
25582
25586
|
}
|
|
25583
|
-
async function getAgentRuntimesForWorkspace(db, ids, workspaceId) {
|
|
25587
|
+
async function getAgentRuntimesForWorkspace(db, ids, workspaceId, userId) {
|
|
25584
25588
|
if (ids.length === 0) return [];
|
|
25589
|
+
const conditions = [inArray(agentRuntime.id, ids), eq(agentRuntime.workspaceId, workspaceId)];
|
|
25590
|
+
if (userId) conditions.push(eq(machine.ownerId, userId));
|
|
25585
25591
|
return db.select({
|
|
25586
25592
|
id: agentRuntime.id,
|
|
25587
25593
|
workspaceId: agentRuntime.workspaceId,
|
|
@@ -25601,9 +25607,7 @@ async function getAgentRuntimesForWorkspace(db, ids, workspaceId) {
|
|
|
25601
25607
|
eq(machine.daemonId, agentRuntime.daemonId),
|
|
25602
25608
|
eq(machine.workspaceId, agentRuntime.workspaceId)
|
|
25603
25609
|
)
|
|
25604
|
-
).where(
|
|
25605
|
-
and(inArray(agentRuntime.id, ids), eq(agentRuntime.workspaceId, workspaceId))
|
|
25606
|
-
);
|
|
25610
|
+
).where(and(...conditions));
|
|
25607
25611
|
}
|
|
25608
25612
|
async function deleteRuntimesByDaemonId(db, daemonId, workspaceId) {
|
|
25609
25613
|
const runtimes = await db.select({ id: agentRuntime.id }).from(agentRuntime).where(
|
|
@@ -26317,7 +26321,7 @@ async function countRunningTasks(db, agentId, workspaceId, excludeTaskId) {
|
|
|
26317
26321
|
const rows = await db.select({ value: count3() }).from(agentTaskQueue).where(and(...conditions));
|
|
26318
26322
|
return Number(rows[0]?.value ?? 0);
|
|
26319
26323
|
}
|
|
26320
|
-
async function listActiveTaskCountsByWorkspace(db, workspaceId, agentIds) {
|
|
26324
|
+
async function listActiveTaskCountsByWorkspace(db, workspaceId, agentIds, userId) {
|
|
26321
26325
|
const conditions = [
|
|
26322
26326
|
eq(agentTaskQueue.workspaceId, workspaceId),
|
|
26323
26327
|
inArray(agentTaskQueue.status, ["queued", "dispatched", "running"]),
|
|
@@ -26326,12 +26330,15 @@ async function listActiveTaskCountsByWorkspace(db, workspaceId, agentIds) {
|
|
|
26326
26330
|
if (agentIds && agentIds.length > 0) {
|
|
26327
26331
|
conditions.push(inArray(agentTaskQueue.agentId, agentIds));
|
|
26328
26332
|
}
|
|
26333
|
+
if (userId) {
|
|
26334
|
+
conditions.push(eq(conversation.userId, userId));
|
|
26335
|
+
}
|
|
26329
26336
|
return db.select({
|
|
26330
26337
|
agentId: agentTaskQueue.agentId,
|
|
26331
26338
|
count: count3()
|
|
26332
|
-
}).from(agentTaskQueue).where(and(...conditions)).groupBy(agentTaskQueue.agentId).limit(200);
|
|
26339
|
+
}).from(agentTaskQueue).innerJoin(conversation, eq(agentTaskQueue.conversationId, conversation.id)).where(and(...conditions)).groupBy(agentTaskQueue.agentId).limit(200);
|
|
26333
26340
|
}
|
|
26334
|
-
async function listActiveTasksByWorkspace(db, workspaceId, agentIds) {
|
|
26341
|
+
async function listActiveTasksByWorkspace(db, workspaceId, agentIds, userId) {
|
|
26335
26342
|
const conditions = [
|
|
26336
26343
|
eq(agentTaskQueue.workspaceId, workspaceId),
|
|
26337
26344
|
inArray(agentTaskQueue.status, ["queued", "dispatched", "running"]),
|
|
@@ -26340,6 +26347,9 @@ async function listActiveTasksByWorkspace(db, workspaceId, agentIds) {
|
|
|
26340
26347
|
if (agentIds && agentIds.length > 0) {
|
|
26341
26348
|
conditions.push(inArray(agentTaskQueue.agentId, agentIds));
|
|
26342
26349
|
}
|
|
26350
|
+
if (userId) {
|
|
26351
|
+
conditions.push(eq(conversation.userId, userId));
|
|
26352
|
+
}
|
|
26343
26353
|
return db.select({
|
|
26344
26354
|
id: agentTaskQueue.id,
|
|
26345
26355
|
agentId: agentTaskQueue.agentId,
|
|
@@ -26349,22 +26359,24 @@ async function listActiveTasksByWorkspace(db, workspaceId, agentIds) {
|
|
|
26349
26359
|
conversationId: agentTaskQueue.conversationId,
|
|
26350
26360
|
createdAt: agentTaskQueue.createdAt,
|
|
26351
26361
|
channel: conversation.channel
|
|
26352
|
-
}).from(agentTaskQueue).
|
|
26362
|
+
}).from(agentTaskQueue).innerJoin(conversation, eq(agentTaskQueue.conversationId, conversation.id)).where(and(...conditions)).orderBy(desc(agentTaskQueue.createdAt)).limit(50);
|
|
26353
26363
|
}
|
|
26354
|
-
async function listActiveTasksByAgent(db, agentId, workspaceId) {
|
|
26364
|
+
async function listActiveTasksByAgent(db, agentId, workspaceId, userId) {
|
|
26365
|
+
const conditions = [
|
|
26366
|
+
eq(agentTaskQueue.agentId, agentId),
|
|
26367
|
+
eq(agentTaskQueue.workspaceId, workspaceId),
|
|
26368
|
+
inArray(agentTaskQueue.status, ["queued", "dispatched", "running"]),
|
|
26369
|
+
ne(agentTaskQueue.type, TASK_TYPES.KILL_TASK)
|
|
26370
|
+
];
|
|
26371
|
+
if (userId) {
|
|
26372
|
+
conditions.push(eq(conversation.userId, userId));
|
|
26373
|
+
}
|
|
26355
26374
|
return db.select({
|
|
26356
26375
|
id: agentTaskQueue.id,
|
|
26357
26376
|
status: agentTaskQueue.status,
|
|
26358
26377
|
type: agentTaskQueue.type,
|
|
26359
26378
|
createdAt: agentTaskQueue.createdAt
|
|
26360
|
-
}).from(agentTaskQueue).where(
|
|
26361
|
-
and(
|
|
26362
|
-
eq(agentTaskQueue.agentId, agentId),
|
|
26363
|
-
eq(agentTaskQueue.workspaceId, workspaceId),
|
|
26364
|
-
inArray(agentTaskQueue.status, ["queued", "dispatched", "running"]),
|
|
26365
|
-
ne(agentTaskQueue.type, TASK_TYPES.KILL_TASK)
|
|
26366
|
-
)
|
|
26367
|
-
).orderBy(desc(agentTaskQueue.priority), asc(agentTaskQueue.createdAt)).limit(100);
|
|
26379
|
+
}).from(agentTaskQueue).innerJoin(conversation, eq(agentTaskQueue.conversationId, conversation.id)).where(and(...conditions)).orderBy(desc(agentTaskQueue.priority), asc(agentTaskQueue.createdAt)).limit(100);
|
|
26368
26380
|
}
|
|
26369
26381
|
async function getActiveTaskByConversation(db, conversationId, workspaceId) {
|
|
26370
26382
|
const rows = await db.select().from(agentTaskQueue).where(
|
|
@@ -26817,13 +26829,15 @@ async function upsertMachine(db, data) {
|
|
|
26817
26829
|
deviceInfo: data.deviceInfo,
|
|
26818
26830
|
lastSeenAt,
|
|
26819
26831
|
createdAt: now,
|
|
26820
|
-
updatedAt: now
|
|
26832
|
+
updatedAt: now,
|
|
26833
|
+
ownerId: data.ownerId
|
|
26821
26834
|
}).onConflictDoUpdate({
|
|
26822
26835
|
target: [machine.workspaceId, machine.daemonId],
|
|
26823
26836
|
set: {
|
|
26824
26837
|
deviceInfo: data.deviceInfo,
|
|
26825
26838
|
lastSeenAt,
|
|
26826
|
-
updatedAt: now
|
|
26839
|
+
updatedAt: now,
|
|
26840
|
+
ownerId: sql`COALESCE(${machine.ownerId}, ${data.ownerId ?? null})`
|
|
26827
26841
|
}
|
|
26828
26842
|
}).returning();
|
|
26829
26843
|
return rows[0];
|
|
@@ -26846,8 +26860,10 @@ async function getMachineByDaemon(db, daemonId, workspaceId) {
|
|
|
26846
26860
|
);
|
|
26847
26861
|
return rows[0] ?? null;
|
|
26848
26862
|
}
|
|
26849
|
-
async function listMachinesForWorkspace(db, workspaceId) {
|
|
26850
|
-
|
|
26863
|
+
async function listMachinesForWorkspace(db, workspaceId, userId) {
|
|
26864
|
+
const conditions = [eq(machine.workspaceId, workspaceId)];
|
|
26865
|
+
if (userId) conditions.push(eq(machine.ownerId, userId));
|
|
26866
|
+
return db.select().from(machine).where(and(...conditions));
|
|
26851
26867
|
}
|
|
26852
26868
|
async function deleteMachine(db, daemonId, workspaceId) {
|
|
26853
26869
|
await db.delete(machine).where(
|
|
@@ -28176,10 +28192,11 @@ async function getUnreadCount(db, userId, workspaceId, types) {
|
|
|
28176
28192
|
const typePlaceholders = sql.join(validTypes.map((t) => sql`${t}`), sql`, `);
|
|
28177
28193
|
const rows = await db.all(sql`
|
|
28178
28194
|
SELECT COUNT(*) AS count
|
|
28179
|
-
FROM inbox_unread
|
|
28180
|
-
|
|
28181
|
-
|
|
28182
|
-
AND
|
|
28195
|
+
FROM inbox_unread u
|
|
28196
|
+
INNER JOIN conversation c ON c.id = u.conversation_id
|
|
28197
|
+
WHERE u.user_id = ${userId}
|
|
28198
|
+
AND u.workspace_id = ${workspaceId}
|
|
28199
|
+
AND u.task_type IN (${typePlaceholders})
|
|
28183
28200
|
`);
|
|
28184
28201
|
return rows[0]?.count ?? 0;
|
|
28185
28202
|
}
|
|
@@ -156,7 +156,7 @@ var DOQueueHandler = class extends DurableObject {
|
|
|
156
156
|
method: "HEAD",
|
|
157
157
|
headers: {
|
|
158
158
|
// This is defined during build
|
|
159
|
-
"x-prerender-revalidate": "
|
|
159
|
+
"x-prerender-revalidate": "698776fdfc5178560c98717ac2a350e7",
|
|
160
160
|
"x-isr": "1"
|
|
161
161
|
},
|
|
162
162
|
// This one is kind of problematic, it will always show the wall time of the revalidation to `this.revalidationTimeout`
|
|
@@ -180,7 +180,7 @@ var DOQueueHandler = class extends DurableObject {
|
|
|
180
180
|
"INSERT OR REPLACE INTO sync (id, lastSuccess, buildId) VALUES (?, unixepoch(), ?)",
|
|
181
181
|
// We cannot use the deduplication id because it's not unique per route - every time a route is revalidated, the deduplication id is different.
|
|
182
182
|
`${host}${url}`,
|
|
183
|
-
"
|
|
183
|
+
"n67RZ-dHYbiPuCBj-CPEs"
|
|
184
184
|
);
|
|
185
185
|
}
|
|
186
186
|
this.routeInFailedState.delete(msg.MessageDeduplicationId);
|
|
@@ -232,7 +232,7 @@ var DOQueueHandler = class extends DurableObject {
|
|
|
232
232
|
}
|
|
233
233
|
this.routeInFailedState.set(msg.MessageDeduplicationId, updatedFailedState);
|
|
234
234
|
if (!this.disableSQLite) {
|
|
235
|
-
this.sql.exec("INSERT OR REPLACE INTO failed_state (id, data, buildId) VALUES (?, ?, ?)", msg.MessageDeduplicationId, JSON.stringify(updatedFailedState), "
|
|
235
|
+
this.sql.exec("INSERT OR REPLACE INTO failed_state (id, data, buildId) VALUES (?, ?, ?)", msg.MessageDeduplicationId, JSON.stringify(updatedFailedState), "n67RZ-dHYbiPuCBj-CPEs");
|
|
236
236
|
}
|
|
237
237
|
await this.addAlarm();
|
|
238
238
|
}
|
|
@@ -256,8 +256,8 @@ var DOQueueHandler = class extends DurableObject {
|
|
|
256
256
|
return;
|
|
257
257
|
this.sql.exec("CREATE TABLE IF NOT EXISTS failed_state (id TEXT PRIMARY KEY, data TEXT, buildId TEXT)");
|
|
258
258
|
this.sql.exec("CREATE TABLE IF NOT EXISTS sync (id TEXT PRIMARY KEY, lastSuccess INTEGER, buildId TEXT)");
|
|
259
|
-
this.sql.exec("DELETE FROM failed_state WHERE buildId != ?", "
|
|
260
|
-
this.sql.exec("DELETE FROM sync WHERE buildId != ?", "
|
|
259
|
+
this.sql.exec("DELETE FROM failed_state WHERE buildId != ?", "n67RZ-dHYbiPuCBj-CPEs");
|
|
260
|
+
this.sql.exec("DELETE FROM sync WHERE buildId != ?", "n67RZ-dHYbiPuCBj-CPEs");
|
|
261
261
|
const failedStateCursor = this.sql.exec("SELECT * FROM failed_state");
|
|
262
262
|
for (const row of failedStateCursor) {
|
|
263
263
|
this.routeInFailedState.set(row.id, JSON.parse(row.data));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
n67RZ-dHYbiPuCBj-CPEs
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,879486,384265,e=>{"use strict";e.i(811374);var t=e.i(511043),a=e.i(92615),i=e.i(298604),n=e.i(990966),s=e.i(372252),r=e.i(154680);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],384265),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()})}}],879486)},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(653772);e.i(811374);var a=e.i(511043),i=e.i(879486),n=e.i(695681);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)},126942,(e,t,a)=>{t.exports=e.r(871628)},222862,636557,e=>{"use strict";var t=e.i(811374);class a 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 i(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 n(e,t){let n;try{n=await fetch(""+e,{...t,credentials:"include",headers:{"Content-Type":"application/json",...t?.headers}})}catch(e){if(e instanceof TypeError)throw new a("Unable to connect — check your network",0);throw e}if(401===n.status)throw window.location.href="/sign-in",new a("Unauthorized",401);if(!n.ok){let e,t;try{let a=await n.json();e=a.error,t=a.details}catch{}if(429===n.status)throw new a("Please wait a moment before trying again",429);if(n.status>=500)throw new a(i(e,t)||"Something went wrong — please try again",n.status,t);throw new a(i(e,t)||"Something went wrong",n.status,t)}if(204!==n.status)return n.json()}function s(e,t){let a=new URLSearchParams({workspace_id:e,...t});return`?${a.toString()}`}e.s(["ApiError",0,a],636557),parseInt(t.default.env.NEXT_PUBLIC_MOCK_NETWORK_DELAY_MS||"300",10);let r=async(e,t,i,r,o)=>{let d;if(!r||0===r.length)return n(`/api/conversations/${e}/messages${s(i)}`,{method:"POST",body:JSON.stringify({content:t,...o?{metadata:o}:{}})});let l=new FormData;for(let e of(l.append("content",t),o&&l.append("metadata",JSON.stringify(o)),r))l.append("file",e.file);for(let e=0;e<r.length;e++){let t=r[e].thumbnailBlob;t&&l.append(`thumbnail:${e}`,t,"thumbnail.jpg")}try{d=await fetch(`/api/conversations/${e}/messages${s(i)}`,{method:"POST",credentials:"include",body:l})}catch(e){if(e instanceof TypeError)throw new a("Unable to connect — check your network",0);throw e}if(401===d.status)throw window.location.href="/sign-in",new a("Unauthorized",401);if(!d.ok){let e,t;try{let a=await d.json();e=a.error,t=a.details}catch{}if(429===d.status)throw new a("Please wait a moment before trying again",429);if(d.status>=500)throw new a(e||"Something went wrong — please try again",d.status,t);throw new a(e||"Something went wrong",d.status,t)}return d.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,t)=>{let i=new FormData;i.append("file",e);let n=await fetch(`/api/email/upload${s(t)}`,{method:"POST",credentials:"include",body:i});if(!n.ok)throw new a(await n.text().catch(()=>"Upload failed"),n.status);return n.json()},l=async(e,t)=>{let i;if(!t.files||0===t.files.length)return n(`/api/issues${s(e)}`,{method:"POST",body:JSON.stringify({agent_id:t.agent_id,title:t.title,description:t.description})});let r=new FormData;for(let e of(t.agent_id&&r.append("agent_id",t.agent_id),r.append("title",t.title),r.append("description",t.description??""),t.files))r.append("file",e);try{i=await fetch(`/api/issues${s(e)}`,{method:"POST",credentials:"include",body:r})}catch(e){if(e instanceof TypeError)throw new a("Unable to connect — check your network",0);throw e}if(401===i.status)throw window.location.href="/sign-in",new a("Unauthorized",401);if(!i.ok){let e,t;try{let a=await i.json();e=a.error,t=a.details}catch{}if(429===i.status)throw new a("Please wait a moment before trying again",429);if(i.status>=500)throw new a(e||"Something went wrong — please try again",i.status,t);throw new a(e||"Something went wrong",i.status,t)}return i.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=>n(`/api/invite/${e}`,{method:"POST"}),"addWhitelistEmail",0,(e,t,a)=>n(`/api/agents/${e}/whitelist${s(a)}`,{method:"POST",body:JSON.stringify({email:t})}),"approveMeeting",0,(e,t,a)=>n(`/api/agents/${e}/meetings/${t}/approve${s(a)}`,{method:"POST"}),"cancelActiveTask",0,(e,t)=>n(`/api/conversations/${e}/active-task${s(t)}`,{method:"DELETE"}),"chatInit",0,(e,t,a)=>n(`/api/agents/${e}/chat-init${s(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),n(`/api/conversations/check-fresh${s(t,a)}`)},"conversationInit",0,(e,t,a)=>{let i={};return a?.newestMessageId&&(i.newest_message_id=a.newestMessageId),a?.messageCount&&(i.message_count=String(a.messageCount)),n(`/api/conversations/${e}/init${s(t,i)}`)},"createAgent",0,(e,t)=>n(`/api/agents${s(t)}`,{method:"POST",body:JSON.stringify(e)}),"createAgentLink",0,(e,t)=>n(`/api/agent-links${s(t)}`,{method:"POST",body:JSON.stringify(e)}),"createCalendarEvent",0,(e,t)=>n(`/api/calendar${s(t)}`,{method:"POST",body:JSON.stringify(e)}),"createChannelApi",0,(e,t)=>n(`/api/channels${s(e)}`,{method:"POST",body:JSON.stringify({name:t})}),"createConversation",0,(e,t,a)=>n(`/api/conversations${s(t)}`,{method:"POST",body:JSON.stringify({agent_id:e,...a?{channel:a}:{}})}),"createEmailAccount",0,(e,t,a)=>n(`/api/agents/${e}/email-accounts${s(a)}`,{method:"POST",body:JSON.stringify(t)}),"createInvite",0,e=>n(`/api/workspaces/${e}/invites${s(e)}`,{method:"POST"}),"createIssue",0,l,"createMachineToken",0,(e,t)=>n(`/api/machine-tokens${t?s(t):""}`,{method:"POST",body:JSON.stringify({name:e||"default"})}),"createMeeting",0,(e,t,a)=>n(`/api/agents/${e}/meetings${s(t)}`,{method:"POST",body:JSON.stringify(a)}),"createThread",0,(e,t,a,i)=>n(`/api/conversations/${e}/threads${s(i)}`,{method:"POST",body:JSON.stringify({parent_message_id:t,content:a})}),"deleteAgent",0,(e,t)=>n(`/api/agents/${e}${s(t)}`,{method:"DELETE"}),"deleteAgentLink",0,(e,t)=>n(`/api/agent-links/${e}${s(t)}`,{method:"DELETE"}),"deleteCalendarEvent",0,(e,t,a)=>n(`/api/calendar/${e}${s(t)}`,{method:"DELETE",...a&&a.scope?{headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}:{}}),"deleteChannelApi",0,(e,t)=>n(`/api/channels/${e}${s(t)}`,{method:"DELETE"}),"deleteEmail",0,(e,t)=>n(`/api/email/${e}${s(t)}`,{method:"DELETE"}),"deleteEmailAccount",0,(e,t,a)=>n(`/api/agents/${e}/email-accounts/${t}${s(a)}`,{method:"DELETE"}),"deleteIssue",0,(e,t)=>n(`/api/issues/${t}${s(e)}`,{method:"DELETE"}),"deleteMachine",0,(e,t)=>n(`/api/runtimes/machine${s(t,{daemon_id:e})}`,{method:"DELETE"}),"deleteMeeting",0,(e,t,a)=>n(`/api/agents/${e}/meetings/${t}${s(a)}`,{method:"DELETE"}),"deleteWorkspace",0,(e,t)=>n(`/api/workspaces/${e}${s(e)}`,{method:"DELETE",body:JSON.stringify({confirm_name:t})}),"fetchLatestCliVersion",0,()=>n("/api/cli/latest-version"),"fetchModelOptions",0,()=>n("/api/config/model-options"),"flagMessage",0,(e,t)=>n(`/api/flags${s(e)}`,{method:"POST",body:JSON.stringify({messageId:t})}),"getActiveTask",0,(e,t)=>n(`/api/conversations/${e}/active-task${s(t)}`),"getAgentSkills",0,(e,t)=>n(`/api/agents/${e}/skills${s(t)}`),"getArtifactContent",0,c,"getCalendarEvent",0,(e,t)=>n(`/api/calendar/${e}${s(t)}`),"getEmail",0,(e,t)=>n(`/api/email/${e}${s(t)}`),"getEmailBody",0,o,"getEmailThread",0,(e,t)=>n(`/api/email/${e}/thread${s(t)}`),"getFlaggedCount",0,e=>n(`/api/flags/count${s(e)}`),"getInboxCount",0,(e,t)=>{let a={};return t?.types?.length&&(a.types=t.types.join(",")),n(`/api/inbox/count${s(e,a)}`)},"getInviteInfo",0,e=>n(`/api/invite/${e}`),"getIssue",0,(e,t)=>n(`/api/issues/${t}${s(e)}`),"getMemberMe",0,e=>n(`/api/members/me${s(e)}`),"getMinCliVersion",0,()=>n("/api/config/min-version"),"getTask",0,(e,t)=>n(`/api/tasks/${e}${s(t)}`),"getTaskMessages",0,(e,t,a)=>n(`/api/tasks/${e}/messages${s(t,a?{since:String(a)}:void 0)}`),"getThreadSummaries",0,(e,t)=>n(`/api/conversations/${e}/threads${s(t)}`),"getTrace",0,(e,t)=>n(`/api/traces/${e}${s(t)}`),"getWorkspaceOverview",0,e=>n(`/api/workspaces/${e}/overview${s(e)}`),"grantAgentAccess",0,(e,t,a)=>n(`/api/agents/${t}/access${s(e)}`,{method:"POST",body:JSON.stringify({user_id:a})}),"listAgentAccess",0,(e,t)=>n(`/api/agents/${t}/access${s(e)}`),"listAgentActiveTaskCounts",0,e=>n(`/api/agents/active-task-counts${s(e)}`),"listAgentActivity",0,(e,t,a)=>{let i={};return a?.limit&&(i.limit=String(a.limit)),a?.before&&(i.before=a.before),a?.beforeId&&(i.before_id=a.beforeId),a?.status&&(i.status=a.status),a?.type&&(i.type=a.type),n(`/api/agents/${e}/activity${s(t,i)}`)},"listAgentLinks",0,e=>n(`/api/agent-links${s(e)}`),"listAgentPins",0,e=>n(`/api/agents/pins${s(e)}`),"listAgents",0,e=>n(`/api/agents${s(e)}`),"listArtifacts",0,(e,t)=>n(`/api/artifacts${s(t,{conversation_id:e})}`),"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),n(`/api/calendar${s(e,a)}`)},"listChannels",0,e=>n(`/api/channels${s(e)}`),"listEmailAccounts",0,(e,t)=>n(`/api/agents/${e}/email-accounts${s(t)}`),"listEmails",0,(e,t,a,i)=>n(`/api/email${s(t,{agentId:e,...a?{folder:a}:{},...i?{address:i}:{}})}`),"listFlaggedItems",0,(e,t)=>{let a={};return t?.limit&&(a.limit=String(t.limit)),t?.before&&(a.before=t.before),n(`/api/flags${s(e,a)}`)},"listFlaggedMessageIds",0,(e,t)=>n(`/api/flags${s(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(",")),n(`/api/inbox${s(e,a)}`)},"listInvites",0,e=>n(`/api/workspaces/${e}/invites${s(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)),n(`/api/issues${s(e,a)}`)},"listMeetings",0,(e,t)=>n(`/api/agents/${e}/meetings${s(t)}`),"listMembers",0,e=>n(`/api/workspaces/${e}/members${s(e)}`),"listMessages",0,(e,t,a)=>{let i={};return a?.limit&&(i.limit=String(a.limit)),a?.before&&(i.before=a.before),a?.beforeId&&(i.before_id=a.beforeId),n(`/api/conversations/${e}/messages${s(t,i)}`)},"listMessagesAroundTask",0,(e,t,a)=>n(`/api/conversations/${e}/messages${s(t,{around_task:a})}`),"listPreviousConversations",0,(e,t,a)=>{let i={exclude:a.exclude,before:a.before};return a.channel&&(i.channel=a.channel),a.limit&&(i.limit=String(a.limit)),n(`/api/agents/${e}/conversations${s(t,i)}`)},"listRuntimes",0,e=>n(`/api/runtimes${s(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),n(`/api/traces${s(e,a)}`)},"listWhitelist",0,(e,t)=>n(`/api/agents/${e}/whitelist${s(t)}`),"listWorkspaceActiveTasks",0,e=>n(`/api/agents/active-tasks${s(e)}`),"listWorkspaces",0,()=>n("/api/workspaces"),"markAllInboxRead",0,e=>n(`/api/inbox/read-all${s(e)}`,{method:"POST"}),"markInboxRead",0,(e,t)=>n(`/api/inbox/read${s(t)}`,{method:"POST",body:JSON.stringify({conversationId:e})}),"pinAgent",0,(e,t)=>n(`/api/agents/${t}/pin${s(e)}`,{method:"POST"}),"removeMember",0,(e,t)=>n(`/api/workspaces/${e}/members/${t}${s(e)}`,{method:"DELETE"}),"removeWhitelistEmail",0,(e,t,a)=>n(`/api/agents/${e}/whitelist/${t}${s(a)}`,{method:"DELETE"}),"renameChannelApi",0,(e,t,a)=>n(`/api/channels/${e}${s(t)}`,{method:"PATCH",body:JSON.stringify({name:a})}),"reorderAgentPins",0,(e,t)=>n(`/api/agents/pins/reorder${s(e)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:t})}),"reorderChannelsApi",0,(e,t)=>n(`/api/channels/reorder${s(e)}`,{method:"PUT",body:JSON.stringify({ordered_channel_ids:t})}),"reorderUnpinnedAgents",0,(e,t)=>n(`/api/agents/sidebar/reorder${s(e)}`,{method:"PUT",body:JSON.stringify({ordered_agent_ids:t})}),"requestWorkspaceBrowse",0,(e,t,a,i)=>n(`/api/agents/${e}/workspace/browse${s(t)}`,{method:"POST",body:JSON.stringify({request_type:a,path:i})}),"retryTask",0,(e,t)=>n(`/api/tasks/${e}/retry${s(t)}`,{method:"POST"}),"revokeAgentAccess",0,(e,t,a,i=!1)=>n(`/api/agents/${t}/access/${a}${s(e)}${i?"&remove_whitelist=true":""}`,{method:"DELETE"}),"revokeInvite",0,(e,t)=>n(`/api/workspaces/${e}/invites/${t}${s(e)}`,{method:"DELETE"}),"sendEmail",0,(e,t,a,i,r,o,d,l)=>n(`/api/email/send${s(r)}`,{method:"POST",body:JSON.stringify({agentId:e,to:t,subject:a,htmlBody:i,attachments:o,...d,customAccountId:l})}),"sendMessage",0,r,"stopMeeting",0,(e,t,a)=>n(`/api/agents/${e}/meetings/${t}/stop${s(a)}`,{method:"POST"}),"syncEmailAccount",0,(e,t,a)=>n(`/api/agents/${e}/email-accounts/${t}/sync${s(a)}`,{method:"POST"}),"triggerRuntimeRescan",0,(e,t)=>n(`/api/runtimes/${e}/rescan${s(t)}`,{method:"POST"}),"triggerRuntimeUpdate",0,(e,t)=>n(`/api/runtimes/${e}/update${s(t)}`,{method:"POST"}),"trustEmail",0,(e,t)=>n(`/api/email/${e}/trust${s(t)}`,{method:"POST"}),"unflagMessage",0,(e,t)=>n(`/api/flags/${t}${s(e)}`,{method:"DELETE"}),"unpinAgent",0,(e,t)=>n(`/api/agents/${t}/pin${s(e)}`,{method:"DELETE"}),"updateAgent",0,(e,t,a)=>n(`/api/agents/${e}${s(a)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateAgentLink",0,(e,t,a)=>n(`/api/agent-links/${e}${s(a)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateCalendarEvent",0,(e,t,a)=>n(`/api/calendar/${e}${s(a)}`,{method:"PATCH",body:JSON.stringify(t)}),"updateEmailStatus",0,(e,t,a)=>n(`/api/email/${e}${s(t)}`,{method:"PATCH",body:JSON.stringify({status:a})}),"updateIssue",0,(e,t,a)=>n(`/api/issues/${t}${s(e)}`,{method:"PATCH",body:JSON.stringify(a)}),"updateMemberMe",0,(e,t)=>n(`/api/members/me${s(e)}`,{method:"PATCH",body:JSON.stringify({global_instruction:t})}),"updateWorkspace",0,(e,t)=>n(`/api/workspaces/${e}${s(e)}`,{method:"PATCH",body:JSON.stringify(t)}),"uploadEmailAttachment",0,d],222862)},728886,e=>{"use strict";var t=e.i(653772),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(653772),a=e.i(511043),i=e.i(126942),n=e.i(516266),s=e.i(222862),r=e.i(205189),o=e.i(186339),d=e.i(728886);e.s(["default",0,function(){let{token:e}=(0,i.useParams)(),l=(0,i.useRouter)(),[c,u]=(0,a.useState)("loading"),[p,g]=(0,a.useState)(null),[m,h]=(0,a.useState)("");(0,a.useEffect)(()=>{e&&(0,s.getInviteInfo)(e).then(e=>{g(e),u("ready")}).catch(e=>{h(e instanceof Error?e.message:"Invalid or expired invite link"),u("error")})},[e]);let f=async()=>{if(e){u("accepting");try{let t=await (0,s.acceptInvite)(e);(0,r.trackInviteAccepted)({workspace_id:t.workspace_id??""}),u("done"),n.toast.success(`Joined ${p?.workspace_name??"workspace"}`),l.replace(`/w/${t.workspace_slug}/home`)}catch(e){h(e instanceof Error?e.message:"Failed to join workspace"),u("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"===c&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(d.Skeleton,{className:"h-6 w-48 mx-auto"}),(0,t.jsx)(d.Skeleton,{className:"h-4 w-64 mx-auto"}),(0,t.jsx)(d.Skeleton,{className:"h-9 w-32 mx-auto"})]}),"ready"===c&&p&&(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:[p.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:p.workspace_name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Workspace"})]}),(0,t.jsx)(o.Button,{className:"w-full",onClick:f,children:"Join Workspace"})]}),"accepting"===c&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(d.Skeleton,{className:"h-6 w-48 mx-auto"}),(0,t.jsx)(d.Skeleton,{className:"h-4 w-64 mx-auto"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Joining workspace…"})]}),"error"===c&&(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:m})]}),(0,t.jsx)(o.Button,{variant:"outline",onClick:()=>l.replace("/workspaces"),children:"Go to workspaces"})]})]})})}])}]);
|