elanous 0.3.3 → 0.3.4
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/apps/pwa/out/404/index.html +1 -1
- package/apps/pwa/out/404.html +1 -1
- package/apps/pwa/out/_next/static/chunks/{280-53fe7ab5dbd19607.js → 280-66f2ebc166517702.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/approvals/{page-c9e997416c86c8dd.js → page-538c811d4da4d7b8.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/autopilot/{page-4e24912975188223.js → page-32cb397d044bb5aa.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/board/page-02d148f66a3da6bb.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/botlab/page-42b7211f972c6001.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/bots/page-46bac74d4ce82733.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ceo/page-10e7ee66dc7c3d8a.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/chat/page-391a9ecbfb541e68.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/consult/{page-f68c84b50dee9796.js → page-6b69baa42370ba35.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/control/page-58960a34c0fa8f97.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/decisions/{page-79f9d6ae042c07b4.js → page-9b16ae10bbe63997.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/design-check/page-417a7b86f7eceeea.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/editor/page-09f86a64836617b7.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/exec/{page-6f6b157c52869db0.js → page-cb640bac3150eb4c.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/field/page-e80fc997e0c589d5.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/inside/{page-6a634383e6247c6b.js → page-173d296c2127560a.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/intake/page-358c3e0c2ce7184c.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/{layout-fda2f39e4d21744c.js → layout-09c6e6033ddb1605.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/live/{page-a6fd7cb710d80092.js → page-11a4763fe20fe116.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/live-run/{page-2a7c714e7f65229d.js → page-e7e02e459ca54062.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/loops/page-b0c21fcb45c049d0.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/market/page-f331955e0ca9bf84.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/missions/[id]/{page-7f38deb0998488bf.js → page-c4c4b4333b24e505.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/morning/{page-7e80f3b354be205e.js → page-7cab7257602fe967.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/not-found-a0dc43b385fba1b5.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/observatory/page-65ecf674fc5e9d19.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ops/checklist/page-d34cea406f837407.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ops/release/page-7d69cc10c33882b7.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ops/resources/{page-5a518950f4136aad.js → page-c2b69a4da710ccee.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/seats/{page-d9e070e009e1a521.js → page-80adac335abc5070.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/outputs/page-10b7dbd205510a67.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/page-5f3c9b795a225d8c.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/reflection/{page-a5bcd883385064d4.js → page-68ece02272941b6c.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/scheduler/{page-f9ef43f59ba98937.js → page-21d4e1472f806b1e.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/sessions/{page-43c5d7004582f888.js → page-1156870631db0555.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/settings/devices/{page-20dfe2b5bca855eb.js → page-4fc726c790e6a7bf.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/settings/{page-7c022f7edf3203d5.js → page-e0dc9ec9ac537906.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/setup/done/{page-adc6daed842128e6.js → page-83138c236444d7d5.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/setup/{page-683c175da53e9ec3.js → page-61133c103b342d2b.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/share/page-40cac04d8f4822c6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/showroom/{page-376f3a03f4d31706.js → page-ecb7be39ce14845a.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/tasks/{page-256d83e84ed55191.js → page-a288059ee8ed73fb.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/term/{page-5e1fb7a8e0927cf6.js → page-31ed388024d4f660.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/today/{page-95994b2b507ee120.js → page-29d28b05a7ddede3.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/trace/page-b39bdb4ce095ccfc.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/vault/{page-0159591688c45cae.js → page-ecbc7b9f31d195b7.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/{page-e640489e459c2789.js → page-059b94e88f91e73f.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/workflows/{page-89c00bebfb27b5d5.js → page-ca29c405228c72b9.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/workspace/page-ff99da4e3ff50503.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/worktrees/{page-2f2bd38085305ef0.js → page-2aa0c6cdb2ef7ea8.js} +1 -1
- package/apps/pwa/out/approvals/index.html +1 -1
- package/apps/pwa/out/approvals/index.txt +13 -13
- package/apps/pwa/out/autopilot/index.html +1 -1
- package/apps/pwa/out/autopilot/index.txt +13 -13
- package/apps/pwa/out/board/index.html +1 -1
- package/apps/pwa/out/board/index.txt +13 -13
- package/apps/pwa/out/botlab/index.html +1 -1
- package/apps/pwa/out/botlab/index.txt +13 -13
- package/apps/pwa/out/bots/index.html +1 -1
- package/apps/pwa/out/bots/index.txt +13 -13
- package/apps/pwa/out/ceo/index.html +1 -1
- package/apps/pwa/out/ceo/index.txt +13 -13
- package/apps/pwa/out/chat/index.html +1 -1
- package/apps/pwa/out/chat/index.txt +13 -13
- package/apps/pwa/out/consult/index.html +1 -1
- package/apps/pwa/out/consult/index.txt +13 -13
- package/apps/pwa/out/control/index.html +1 -1
- package/apps/pwa/out/control/index.txt +13 -13
- package/apps/pwa/out/decisions/index.html +1 -1
- package/apps/pwa/out/decisions/index.txt +13 -13
- package/apps/pwa/out/design-check/index.html +1 -1
- package/apps/pwa/out/design-check/index.txt +13 -13
- package/apps/pwa/out/editor/index.html +1 -1
- package/apps/pwa/out/editor/index.txt +13 -13
- package/apps/pwa/out/exec/index.html +1 -1
- package/apps/pwa/out/exec/index.txt +13 -13
- package/apps/pwa/out/field/index.html +1 -1
- package/apps/pwa/out/field/index.txt +13 -13
- package/apps/pwa/out/healthz +1 -1
- package/apps/pwa/out/index.html +1 -1
- package/apps/pwa/out/index.txt +13 -13
- package/apps/pwa/out/inside/index.html +1 -1
- package/apps/pwa/out/inside/index.txt +13 -13
- package/apps/pwa/out/intake/index.html +1 -1
- package/apps/pwa/out/intake/index.txt +13 -13
- package/apps/pwa/out/live/index.html +1 -1
- package/apps/pwa/out/live/index.txt +13 -13
- package/apps/pwa/out/live-run/index.html +1 -1
- package/apps/pwa/out/live-run/index.txt +13 -13
- package/apps/pwa/out/loops/index.html +1 -1
- package/apps/pwa/out/loops/index.txt +13 -13
- package/apps/pwa/out/market/index.html +1 -1
- package/apps/pwa/out/market/index.txt +13 -13
- package/apps/pwa/out/missions/placeholder/index.html +1 -1
- package/apps/pwa/out/missions/placeholder/index.txt +13 -13
- package/apps/pwa/out/morning/index.html +1 -1
- package/apps/pwa/out/morning/index.txt +13 -13
- package/apps/pwa/out/observatory/index.html +1 -1
- package/apps/pwa/out/observatory/index.txt +13 -13
- package/apps/pwa/out/ops/checklist/index.html +1 -1
- package/apps/pwa/out/ops/checklist/index.txt +13 -13
- package/apps/pwa/out/ops/release/index.html +1 -1
- package/apps/pwa/out/ops/release/index.txt +13 -13
- package/apps/pwa/out/ops/resources/index.html +1 -1
- package/apps/pwa/out/ops/resources/index.txt +13 -13
- package/apps/pwa/out/ops/seats/index.html +1 -1
- package/apps/pwa/out/ops/seats/index.txt +13 -13
- package/apps/pwa/out/outputs/index.html +1 -1
- package/apps/pwa/out/outputs/index.txt +13 -13
- package/apps/pwa/out/reflection/index.html +1 -1
- package/apps/pwa/out/reflection/index.txt +14 -14
- package/apps/pwa/out/scheduler/index.html +1 -1
- package/apps/pwa/out/scheduler/index.txt +13 -13
- package/apps/pwa/out/sessions/index.html +1 -1
- package/apps/pwa/out/sessions/index.txt +13 -13
- package/apps/pwa/out/settings/devices/index.html +1 -1
- package/apps/pwa/out/settings/devices/index.txt +13 -13
- package/apps/pwa/out/settings/index.html +1 -1
- package/apps/pwa/out/settings/index.txt +13 -13
- package/apps/pwa/out/setup/done/index.html +1 -1
- package/apps/pwa/out/setup/done/index.txt +13 -13
- package/apps/pwa/out/setup/index.html +1 -1
- package/apps/pwa/out/setup/index.txt +13 -13
- package/apps/pwa/out/share/index.html +1 -1
- package/apps/pwa/out/share/index.txt +13 -13
- package/apps/pwa/out/showroom/index.html +1 -1
- package/apps/pwa/out/showroom/index.txt +13 -13
- package/apps/pwa/out/tasks/index.html +1 -1
- package/apps/pwa/out/tasks/index.txt +13 -13
- package/apps/pwa/out/term/index.html +1 -1
- package/apps/pwa/out/term/index.txt +13 -13
- package/apps/pwa/out/today/index.html +1 -1
- package/apps/pwa/out/today/index.txt +13 -13
- package/apps/pwa/out/trace/index.html +1 -1
- package/apps/pwa/out/trace/index.txt +13 -13
- package/apps/pwa/out/vault/index.html +1 -1
- package/apps/pwa/out/vault/index.txt +13 -13
- package/apps/pwa/out/workflows/chat-ui/index.html +1 -1
- package/apps/pwa/out/workflows/chat-ui/index.txt +13 -13
- package/apps/pwa/out/workflows/index.html +1 -1
- package/apps/pwa/out/workflows/index.txt +13 -13
- package/apps/pwa/out/workspace/index.html +1 -1
- package/apps/pwa/out/workspace/index.txt +13 -13
- package/apps/pwa/out/worktrees/index.html +1 -1
- package/apps/pwa/out/worktrees/index.txt +13 -13
- package/package.json +1 -1
- package/src/acp/core-turn-bridge.ts +5 -0
- package/src/nexus/api/harness-api.ts +17 -2
- package/src/nexus/api/harness-traversal.ts +11 -1
- package/src/plugins/core/host.ts +12 -0
- package/src/self-implement/orchestrator.ts +13 -0
- package/src/tool-runtime/browser-hand-runtime.ts +19 -9
- package/src/tool-runtime/elanous-linear-issue-runtime.ts +13 -3
- package/src/version/packed-revision.json +1 -1
- package/apps/pwa/out/_next/static/chunks/app/board/page-b117b7ee316afe86.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/botlab/page-a447a17fd887c68e.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/bots/page-2b3e0df385eba76f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ceo/page-409ed1d2f2c5f706.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/chat/page-1e90543da0a66b63.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/control/page-afefb7fac0047855.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/design-check/page-9726864cd21303a2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/editor/page-ab0febcc6695f4e4.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/field/page-78aef36734ddd588.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/intake/page-66f0dc569bce5230.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/loops/page-a71ad5f5b075be8d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/market/page-df7f2d252ff836b5.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/not-found-5ea0e042882e87de.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/observatory/page-f3df76408c930b99.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/checklist/page-88996ccc31edf06c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/release/page-d95db9df4a907fe1.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/outputs/page-167c44a8ff378706.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/page-4763cf1b0e52e28b.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/share/page-a91d9cbaf50cc8b4.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/trace/page-486b1d3605dbd5f3.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/workspace/page-edf90eaa6d354fee.js +0 -1
- /package/apps/pwa/out/_next/static/{K-ckEB9hu9tXQ6iqnl27L → v4GHQkFrQs8lzZY_KFv9_}/_buildManifest.js +0 -0
- /package/apps/pwa/out/_next/static/{K-ckEB9hu9tXQ6iqnl27L → v4GHQkFrQs8lzZY_KFv9_}/_ssgManifest.js +0 -0
|
@@ -109,7 +109,7 @@ function blockedKind(value: string | undefined): 'login' | 'paywall' | undefined
|
|
|
109
109
|
function isBrowserSessionUnavailableError(error: unknown): boolean {
|
|
110
110
|
if (!(error instanceof Error)) return false;
|
|
111
111
|
if (['CdpUnavailable', 'AsideSessionUnavailableError', 'BrowserSessionUnavailableError'].includes(error.name)) return true;
|
|
112
|
-
return /^aside\s+session\
|
|
112
|
+
return /^aside\s+session\s+(?:is\s+)?(?:unavailable|disconnected|closed|refused|timed?\s*out)\b/i.test(error.message);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
function failureBlockKind(action: BrowserActionResult): 'login' | 'paywall' | 'session' | undefined {
|
|
@@ -157,6 +157,7 @@ function recordRepairNode(node: BrowserHandRepairNode, deps: BrowserHandDeps): v
|
|
|
157
157
|
|
|
158
158
|
function createRepairNode(input: {
|
|
159
159
|
block: 'login' | 'paywall' | 'session';
|
|
160
|
+
failureReason?: string;
|
|
160
161
|
sourceUrl: string;
|
|
161
162
|
detourUrl: string;
|
|
162
163
|
outcome: 'detoured' | 'detour-failed';
|
|
@@ -174,7 +175,7 @@ function createRepairNode(input: {
|
|
|
174
175
|
kind: 'hand' as const,
|
|
175
176
|
decider: 'browser-hand' as const,
|
|
176
177
|
reason: input.block === 'session'
|
|
177
|
-
?
|
|
178
|
+
? `browser session unavailable${input.failureReason ? ` (${input.failureReason})` : ''}; one alternate source checked`
|
|
178
179
|
: `${input.block} blocked source; one alternate source checked`,
|
|
179
180
|
who: 'Elanous' as const,
|
|
180
181
|
what: input.outcome === 'detoured' ? `Continue browser work from ${input.detourUrl}` : 'Stop after blocked browser source',
|
|
@@ -273,7 +274,9 @@ export async function dispatchBrowserHand(args: BrowserHandArgs, _ctx?: ToolRunt
|
|
|
273
274
|
url: actionUrl,
|
|
274
275
|
target,
|
|
275
276
|
reason: sessionUnavailable ? 'load-unavailable' as const : 'execution-failed' as const,
|
|
276
|
-
error: sessionUnavailable
|
|
277
|
+
error: sessionUnavailable
|
|
278
|
+
? (error instanceof Error ? error.message : String(error))
|
|
279
|
+
: 'browser action failed',
|
|
277
280
|
};
|
|
278
281
|
}
|
|
279
282
|
};
|
|
@@ -307,17 +310,24 @@ export async function dispatchBrowserHand(args: BrowserHandArgs, _ctx?: ToolRunt
|
|
|
307
310
|
let action = await runBrowserAction(actionUrl);
|
|
308
311
|
if (!action.ok && !blocked) {
|
|
309
312
|
block = failureBlockKind(action);
|
|
313
|
+
const failureReason = block === 'session' ? action.reason : undefined;
|
|
310
314
|
const alternate = args.alternateUrl?.trim() ?? '';
|
|
311
315
|
let alternateParsed: URL | undefined;
|
|
312
316
|
try { alternateParsed = new URL(alternate); } catch { /* no valid fallback */ }
|
|
313
317
|
let alternateText: string | undefined;
|
|
314
|
-
|
|
315
|
-
&& decideActionBoundary({ hosts: persona.actionHosts, url: alternate, href: null }).allowed
|
|
318
|
+
const alternateAllowed = !!block && !!alternateParsed && ['http:', 'https:'].includes(alternateParsed.protocol)
|
|
319
|
+
&& decideActionBoundary({ hosts: persona.actionHosts, url: alternate, href: null }).allowed;
|
|
320
|
+
if (alternateAllowed) {
|
|
316
321
|
try { alternateText = await inspect(alternate, pagePort); } catch { /* unknown is allowed after an explicit login/paywall error */ }
|
|
317
322
|
}
|
|
318
|
-
if (block &&
|
|
319
|
-
|
|
320
|
-
|
|
323
|
+
if (block === 'session' && alternateAllowed && !blockedKind(alternateText)) {
|
|
324
|
+
// A session loss selects the production hand adapter (BrowserHand on the
|
|
325
|
+
// explicitly allowlisted alternate); ordinary action errors never enter here.
|
|
326
|
+
action = await runBrowserAction(alternate);
|
|
327
|
+
blocked = true;
|
|
328
|
+
actionUrl = alternate;
|
|
329
|
+
detoured = true;
|
|
330
|
+
} else if (block && alternateAllowed && !blockedKind(alternateText)) {
|
|
321
331
|
blocked = true;
|
|
322
332
|
actionUrl = alternate;
|
|
323
333
|
action = await runBrowserAction(actionUrl);
|
|
@@ -326,7 +336,7 @@ export async function dispatchBrowserHand(args: BrowserHandArgs, _ctx?: ToolRunt
|
|
|
326
336
|
blocked = true;
|
|
327
337
|
}
|
|
328
338
|
if (block) {
|
|
329
|
-
repairNode = createRepairNode({ block, sourceUrl: url, detourUrl: detoured ? alternate : '', outcome: detoured && action.ok ? 'detoured' : 'detour-failed', issueId, deps });
|
|
339
|
+
repairNode = createRepairNode({ block, ...(failureReason ? { failureReason } : {}), sourceUrl: url, detourUrl: detoured ? alternate : '', outcome: detoured && action.ok ? 'detoured' : 'detour-failed', issueId, deps });
|
|
330
340
|
recordRepairNode(repairNode, deps);
|
|
331
341
|
}
|
|
332
342
|
}
|
|
@@ -2,16 +2,18 @@ import { debug } from '../debug/log.js';
|
|
|
2
2
|
import { commentLinearIssue, createLinearTeamIssue, moveLinearIssueToStateType } from '../connectors/linear.js';
|
|
3
3
|
import { getSecretAsync } from '../nexus/config/secrets/index.js';
|
|
4
4
|
import type { LLMToolSpec } from '../llm.js';
|
|
5
|
+
import { getUserConfig } from '../user-config.js';
|
|
5
6
|
import type { ToolRuntime, ToolRuntimeContext } from './types.js';
|
|
6
7
|
|
|
7
8
|
export type ElanousLinearIssueArgs =
|
|
8
|
-
| { action: 'create'; teamKey
|
|
9
|
+
| { action: 'create'; teamKey?: string; title: string; description?: string }
|
|
9
10
|
| { action: 'comment'; issueId: string; body: string }
|
|
10
11
|
| { action: 'complete'; issueId: string };
|
|
11
12
|
export interface ElanousLinearIssueResult extends Record<string, unknown> { ok: boolean; output: string }
|
|
12
13
|
|
|
13
14
|
type Deps = {
|
|
14
15
|
getApiKey?: (id: string) => Promise<string | undefined>;
|
|
16
|
+
getConfig?: () => Record<string, unknown>;
|
|
15
17
|
create?: typeof createLinearTeamIssue;
|
|
16
18
|
comment?: typeof commentLinearIssue;
|
|
17
19
|
complete?: typeof moveLinearIssueToStateType;
|
|
@@ -29,7 +31,7 @@ export function createElanousLinearIssueRuntime(deps: Deps = {}): ToolRuntime<El
|
|
|
29
31
|
type: 'object',
|
|
30
32
|
properties: {
|
|
31
33
|
action: { type: 'string', enum: ['create', 'comment', 'complete'] },
|
|
32
|
-
teamKey: { type: 'string', description: '
|
|
34
|
+
teamKey: { type: 'string', description: 'Optional for create; defaults to connector.linear.team or connector.linear.teamKey.' },
|
|
33
35
|
title: { type: 'string', description: 'Required only for create.' },
|
|
34
36
|
description: { type: 'string', description: 'Optional create description.' },
|
|
35
37
|
issueId: { type: 'string', description: 'Required for comment and complete.' },
|
|
@@ -45,7 +47,15 @@ export function createElanousLinearIssueRuntime(deps: Deps = {}): ToolRuntime<El
|
|
|
45
47
|
const fetch = deps.fetch ?? globalThis.fetch;
|
|
46
48
|
try {
|
|
47
49
|
if (args?.action === 'create') {
|
|
48
|
-
const
|
|
50
|
+
const connector = (deps.getConfig ?? (() => getUserConfig().raw))().connector;
|
|
51
|
+
const linear = connector && typeof connector === 'object'
|
|
52
|
+
? (connector as Record<string, unknown>).linear
|
|
53
|
+
: undefined;
|
|
54
|
+
const linearConfig = linear && typeof linear === 'object' ? linear as Record<string, unknown> : {};
|
|
55
|
+
const configuredTeam = [linearConfig.team, linearConfig.teamKey]
|
|
56
|
+
.find((value): value is string => typeof value === 'string' && value.trim().length > 0);
|
|
57
|
+
const explicitTeam = typeof args.teamKey === 'string' ? args.teamKey.trim() : '';
|
|
58
|
+
const teamKey = explicitTeam || (typeof configuredTeam === 'string' ? configuredTeam.trim() : '');
|
|
49
59
|
const title = typeof args.title === 'string' ? args.title.trim() : '';
|
|
50
60
|
if (!teamKey || !title) return { ok: false, output: 'Linear issue 생성에는 teamKey와 title이 필요합니다.' };
|
|
51
61
|
const issueId = await (deps.create ?? createLinearTeamIssue)({ apiKey, teamKey, title,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"commit":"
|
|
1
|
+
{"commit":"fb4111875f6ae16361ff44914d03019b669a4b3a"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7081],{15249:(e,t,s)=>{"use strict";s.d(t,{Zr:()=>l,f6:()=>r,oD:()=>n});let a="elanous.daemon.sessionId";function r(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"s-".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,10))}function n(){let e=function(){let e=new URLSearchParams(window.location.search).get("session");return e?(localStorage.setItem(a,e),e):localStorage.getItem(a)}();if(e)return e;let t=r();return localStorage.setItem(a,t),t}function l(){let e=r();return localStorage.setItem(a,e),e}},22244:(e,t,s)=>{"use strict";s.d(t,{Er:()=>r,cj:()=>c,dc:()=>l,yR:()=>i});let a=/^(oauth\.|harness\.decision|llm\.router)/;function r(e){let t=[],s=e=>{"string"==typeof e&&e.trim()&&!t.includes(e.trim())&&t.push(e.trim())};for(let t of e){var r;let e=null!=(r=t.data)?r:{};if(t.category.startsWith("oauth.")){for(let t of["from","to","name","account"])s(e[t]);if(Array.isArray(e.usage))for(let t of e.usage)s(null==t?void 0:t.name);continue}if(a.test(t.category))for(let t of(s(e.account),["what","why","reason"])){let a=e[t];if("string"==typeof a)for(let e of a.matchAll(/계정\s+([A-Za-z0-9][\w.-]*)/g))s(e[1])}}return t}function n(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function l(e){let t=new Map(e.map((e,t)=>[e,"account-".concat(t+1)])),s=e.length?RegExp("(^|[^\\w-])(".concat(e.map(n).sort((e,t)=>t.length-e.length).join("|"),")(?![\\w-])"),"g"):null,a=new Map;return(e,r)=>{let n=e.replace(/\b[a-z0-9-]+\.tail[0-9a-f]+\.ts\.net\b/gi,"tailnet-host").replace(/\bmsb\d+\b/gi,e=>(e=>{let t=e.toLowerCase();a.has(t)||a.set(t,"remote-".concat(a.size+1));let s=a.get(t);return e===e.toUpperCase()?s.toUpperCase():s})(e)).replace(/\bmbp\b/gi,e=>e===e.toUpperCase()?"LOCAL":"local").replace(/\/Users\/[^/\s"']+/g,"~").replace(/(크레딧|credits?|💳)(\s*[:=]?\s*)[\d][\d,.]*/gi,"$1$2•••").replace(/[\d][\d,.]*(\s*)(크레딧|credits?)/gi,"•••$1$2").replace(/\$\s?[\d][\d,.]*/g,"$•••").replace(/(잔량?|remaining|left)(\s*[:=]?\s*)(?:[A-Za-z0-9][\w.-]*\s+)?\d+(?:\.\d+)?\s?%/gi,"$1$2•••");return r&&s&&(n=n.replace(s,(e,s,a)=>{var r;return"".concat(s).concat(null!=(r=t.get(a))?r:"account")})),n}}function o(e,t){if("string"==typeof e)return t(e);if(Array.isArray(e))return e.map(e=>o(e,t));if(e&&"object"==typeof e){let s={};for(let[a,r]of Object.entries(e))"apiEquivalentUsd"===a||"usd"===a||/credit(s|Balance)?$/i.test(a)||(s[a]=o(r,t));return s}return e}function i(e){let t=l(r(e));return e.map(e=>{let s=a.test(e.category);return{...e,event:t(e.event,!1),data:e.data?o(e.data,e=>t(e,s)):e.data}})}function c(e,t){let s=l(t);return o(e,e=>s(e,!0))}},38723:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>k});var a=s(17594),r=s(22244);function n(e){return e.map(e=>({...(0,r.cj)(e,[]),taskId:e.taskId,...e.wishReply?{wishReply:{surface:e.wishReply.surface,address:null}}:{}}))}var l=s(48082),o=s(87691);function i(e){var t;for(let t of[e.sections.triage,e.sections.intake]){let e=null==t?void 0:t.data.title;if("string"==typeof e&&e.trim())return e.trim()}return(null==(t=e.apiTitle)?void 0:t.trim())||e.taskId}var c=s(67307);let d={green:"순항",yellow:"진행 중",red:"막힘",done:"완료"},u=["intake","triage","gates","relations","memory","workspace","run","landing","release"];function m(e){return null==e?"—":"string"==typeof e?e:JSON.stringify(e)}function p(e){let{entry:t}=e;return(0,a.jsxs)("details",{className:"mt-2 text-xs",children:[(0,a.jsx)("summary",{className:"cursor-pointer text-muted-foreground",children:"JSON"}),(0,a.jsx)("pre",{className:"mt-2 max-h-64 overflow-auto rounded-lg bg-muted p-2 text-xs whitespace-pre-wrap break-all",children:JSON.stringify(t.data,null,2)})]})}function f(e){let{entry:t}=e,s=new Date(t.ts).toISOString();return(0,a.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[(0,a.jsxs)("span",{children:["Owner: ",t.owner]}),(0,a.jsx)("time",{dateTime:s,children:s})]})}function h(e){var t,s,r;let{card:n,placements:o,onClose:c,publicCapture:h=!1}=e,[x,g]=(0,l.useState)(""),[b,y]=(0,l.useState)(!1),[w,k]=(0,l.useState)(null),v=async e=>{if(e.preventDefault(),!(!c||!x.trim()||/[\r\n]/.test(x))&&!b){y(!0),k(null);try{await c(x.trim())}catch(e){k(e instanceof Error?e.message:String(e))}finally{y(!1)}}},j=null==(t=n.sections.gates)?void 0:t.data;return(0,a.jsxs)("section",{"aria-label":"Task card detail",className:"min-w-0 space-y-4 rounded-2xl border border-border bg-card p-4",children:[(0,a.jsxs)("header",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:i(n)}),(0,a.jsx)("p",{className:"break-all text-xs text-muted-foreground",children:n.taskId}),"closed"===n.status?(0,a.jsxs)("p",{role:"status",children:["닫힘 \xb7 ",null!=(s=n.closedReason)?s:"사유 없음"]}):!h&&c?(0,a.jsxs)("form",{onSubmit:v,className:"mt-3 flex flex-wrap items-end gap-2",children:[(0,a.jsxs)("label",{className:"text-sm",children:["닫기 사유 (한 줄)",(0,a.jsx)("input",{type:"text",required:!0,value:x,onChange:e=>g(e.target.value),className:"block rounded-md border border-border bg-background px-2 py-1"})]}),(0,a.jsx)("button",{type:"submit",disabled:b||!x.trim()||/[\r\n]/.test(x),className:"rounded-md border border-border px-3 py-1 text-sm",children:b?"닫는 중…":"닫기"}),w&&(0,a.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:w})]}):null]}),void 0!==n.wishReply&&(0,a.jsxs)("section",{"aria-label":"Wish reply destination",className:"rounded-xl border border-border p-3 text-sm",children:[(0,a.jsx)("h3",{className:"mb-1 font-semibold",children:"어디로 회신하나"}),(0,a.jsx)("p",{className:"break-all",children:n.wishReply?"".concat(null!=(r=({telegram:"텔레그램 대화",pwa:"PWA",tui:"TUI",linear:"Linear"})[n.wishReply.surface])?r:n.wishReply.surface).concat(n.wishReply.address?" \xb7 ".concat(n.wishReply.address):""):"회신 주소 없음"})]}),void 0!==n.wishReply&&(0,a.jsxs)("section",{"aria-label":"Wish reply history",className:"rounded-xl border border-border p-3 text-sm",children:[(0,a.jsx)("h3",{className:"mb-1 font-semibold",children:"회신 이력"}),(0,a.jsx)("p",{className:"text-muted-foreground",children:"카드 원장에는 회신 발송 이력이 기록되지 않습니다"})]}),o&&(0,a.jsxs)("p",{className:"overflow-x-auto whitespace-nowrap text-sm","aria-label":"Wish placement and progress",children:["배치 \xb7 ",o.length?o.map(e=>{let{cellId:t,cellTitle:s,version:a,status:r}=e;return"".concat(t," ").concat(s," \xb7 ").concat(a,"판 \xb7 ").concat(d[r])}).join(" / "):"아직 배치되지 않음"]}),j&&(0,a.jsxs)("p",{className:"overflow-x-auto whitespace-nowrap text-sm","aria-label":"Gate decisions",children:["Gate \xb7 budget: ",m(j.budget)," \xb7 location: ",m(j.location)]}),u.map(e=>{let t=n.sections[e];return t?(0,a.jsxs)("section",{"aria-label":"".concat(e," section"),className:"rounded-xl border border-border p-3",children:[(0,a.jsx)("h3",{className:"mb-1 text-sm font-semibold capitalize",children:e}),(0,a.jsx)(f,{entry:t}),(0,a.jsx)(p,{entry:t})]},e):null}),(0,a.jsxs)("section",{"aria-label":"Incidents",className:"space-y-2",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold",children:["Incidents (",n.incidents.length,")"]}),n.incidents.length?(0,a.jsx)("ol",{className:"space-y-2",children:n.incidents.map(e=>(0,a.jsxs)("li",{className:"rounded-xl border border-border p-3",children:[(0,a.jsx)(f,{entry:e}),(0,a.jsx)(p,{entry:e})]},e.key))}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"No incidents."})]})]})}let x=["steward","execution","landing","release","done"],g=new Set(["intake","triage","gates","relations","memory","workspace","run","landing","release","incidents"]);function b(e){let t=[],s=Date.parse(e.createdAt),a=e.sections.find(e=>"intake:reply:0"===e.key),r=null;if(a)try{let e=JSON.parse(a.content);if(e&&"object"==typeof e&&!Array.isArray(e)){let{surface:t,address:s}=e;"string"==typeof t&&("string"==typeof s||null===s)&&(r={surface:t,address:s})}}catch(e){}for(let a of e.sections){let r;if(!g.has(a.key))continue;try{let e=JSON.parse(a.content);r=e&&"object"==typeof e&&!Array.isArray(e)?e:{content:a.content}}catch(e){r={content:a.content}}let n=Date.parse(a.createdAt);t.push({taskId:e.id,section:a.key,key:"".concat(a.key,":").concat(a.createdAt,":").concat(t.length),owner:a.owner,ts:Number.isFinite(n)?n:s,data:r,..."string"==typeof r.runId?{runId:r.runId}:{}})}if(0===t.length&&t.push({taskId:e.id,section:"triage",key:"api:title",owner:"task-card API",ts:s,data:{title:e.title}}),"closed"===e.status){let a=t.filter(e=>"release"===e.section).sort((e,t)=>t.ts-e.ts)[0];t.push({taskId:e.id,section:"release",key:"api:closed",owner:"task-card API",ts:Math.max(s,...t.map(e=>e.ts)),data:{...null==a?void 0:a.data,status:"done"}})}return{...function(e){let t,s=e[0];if(!s)return null;let a={},r=[],n=new Set,l=s.ts,o=-1/0;for(let i of e)if(!(i.taskId!==s.taskId||n.has(i.key)))if(n.add(i.key),l=Math.max(l,i.ts),i.runId&&i.ts>=o&&(t=i.runId,o=i.ts),"incidents"===i.section)r.push(i);else{let e=a[i.section];(!e||i.ts>=e.ts)&&(a[i.section]=i)}return{taskId:s.taskId,sections:a,incidents:r,updatedAt:l,...t?{runId:t}:{}}}(t),apiTitle:e.title,status:e.status,...void 0===e.closedReason?{}:{closedReason:e.closedReason},...e.goalId.startsWith("wish:")?{wishReply:r}:{}}}function y(e){let{cards:t,selectedId:s,onSelect:r,selectedCard:n,detailError:l,placements:o,onCloseCard:c,publicCapture:d}=e,u=(null==n?void 0:n.taskId)===s?n:null;return(0,a.jsxs)("div",{className:"space-y-4 p-4",children:[(0,a.jsx)("h1",{className:"text-xl font-semibold",children:"보드"}),(0,a.jsx)("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-5",children:x.map(e=>(0,a.jsxs)("section",{"aria-label":"".concat(e," column"),className:"min-w-0 space-y-2 rounded-xl border border-border p-3",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold capitalize",children:e}),t.filter(t=>(function(e){var t;let s=null==(t=e.sections.release)?void 0:t.data;return(null==s?void 0:s.status)==="done"||(null==s?void 0:s.status)==="completed"?"done":s?"release":e.sections.landing?"landing":e.sections.run||e.sections.workspace||e.sections.gates||e.sections.relations||e.sections.memory?"execution":"steward"})(t)===e).map(e=>{var t,n;return(0,a.jsxs)("button",{type:"button",onClick:()=>r(e.taskId),"aria-pressed":s===e.taskId,className:"w-full rounded-lg border border-border bg-card p-3 text-left text-sm hover:bg-accent/40",children:[(0,a.jsx)("span",{className:"block font-medium",children:i(e)}),(0,a.jsx)("span",{className:"block text-xs text-muted-foreground",children:(0,a.jsx)("time",{dateTime:new Date(e.updatedAt).toISOString(),title:new Date(e.updatedAt).toLocaleString(),children:(t=function(e){let t=new Map;for(let a of e.incidents){var s;let e=null!=(s=a.data.incidentId)?s:a.data.id,r="string"==typeof e&&e.trim()?e:a.key,n=t.get(r);(!n||a.ts>=n.ts)&&t.set(r,a)}return Array.from(t.values()).filter(e=>"closed"!==e.data.status&&"resolved"!==e.data.status).length}(e),n=Date.now(),[...t>0?["사고 ".concat(t)]:[],...e.runId?["런 ".concat(e.runId.replace(/^run-/,"").slice(0,8))]:[],function(e,t,s){let a=Math.floor((t-e)/6e4);if(!Number.isFinite(a)||a<1)return"방금";if(a<60)return"".concat(a,"분 전");if(a<1440)return"".concat(Math.floor(a/60),"시간 전");let r=new Intl.DateTimeFormat("ko-KR",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1,...s?{timeZone:s}:{}}).formatToParts(new Date(e)),n=e=>{var t,s;return null!=(s=null==(t=r.find(t=>t.type===e))?void 0:t.value)?s:""};return"".concat(n("month"),"/").concat(n("day")," ").concat(n("hour"),":").concat(n("minute"))}(e.updatedAt,n,void 0)]).join(" \xb7 ")})})]},e.taskId)})]},e))}),s&&(0,a.jsxs)("aside",{className:"max-w-3xl space-y-2","aria-label":"Selected card",children:[(0,a.jsx)("button",{type:"button",onClick:()=>r(null),"aria-label":"Close card detail",className:"text-sm text-muted-foreground",children:"Close"}),u?(0,a.jsx)(h,{card:u,placements:o,onClose:c,publicCapture:d}):(0,a.jsx)("p",{role:"status",children:null!=l?l:"Loading card detail…"})]})]})}function w(){let{config:e}=(0,o.Q)(),t=(0,l.useMemo)(()=>e.baseUrl?(0,c.xX)({baseUrl:e.baseUrl,...e.token?{token:e.token}:{}}):null,[e.baseUrl,e.token]),[s,i]=(0,l.useState)([]),[d,u]=(0,l.useState)(null),[m,p]=(0,l.useState)(null),[f,h]=(0,l.useState)(void 0),[x,g]=(0,l.useState)(null),[w,k]=(0,l.useState)(null),[v,j]=(0,l.useState)(!1);(0,l.useEffect)(()=>{"public"===new URLSearchParams(window.location.search).get("capture")&&j(!0)},[]);let N=(0,l.useMemo)(()=>v?n(s):s,[s,v]),I=v&&m?n([m])[0]:m,S=v&&f?(0,r.cj)(f,[]):f;(0,l.useEffect)(()=>{let e=!1;if(i([]),u(null),p(null),h(void 0),g(null),!t)return void k("Connect to NEXUS to load task cards.");k(null);let s=()=>t.getTaskCards().then(t=>{let{cards:s}=t;e||(i(s.map(b)),k(null))}).catch(t=>{e||k(t instanceof c.Iu&&404===t.status?"Task cards are not available yet (pre-E1).":t instanceof Error?t.message:String(t))});s();let a=setInterval(()=>{s()},1e4);return()=>{e=!0,clearInterval(a)}},[t]),(0,l.useEffect)(()=>{if(!t||!d)return;let e=!1;return p(null),h(void 0),g(null),t.getTaskCard(d).then(t=>{let{card:s,placements:a}=t;e||(h(a),p(b(s)))}).catch(t=>{e||g(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[t,d]);let C=async e=>{if(!t||!d||v)throw Error("Card close unavailable");let{card:s}=await t.closeTaskCard(d,e);p(e=>(null==e?void 0:e.taskId)===d?b(s):e),i(e=>e.map(e=>e.taskId===s.id?b(s):e))};return(0,a.jsxs)(a.Fragment,{children:[w&&(0,a.jsx)("p",{role:"status",className:"p-4 text-sm text-muted-foreground",children:w}),(0,a.jsx)(y,{cards:N,selectedId:d,selectedCard:I,detailError:x,placements:S,onSelect:e=>{(null===e||d!==e)&&(p(null),h(void 0),g(null),u(e))},onCloseCard:C,publicCapture:v})]})}function k(){return(0,a.jsx)(w,{})}},46195:(e,t,s)=>{Promise.resolve().then(s.bind(s,38723))},87691:(e,t,s)=>{"use strict";s.d(t,{C:()=>c,DaemonProvider:()=>d,Q:()=>u});var a=s(17594),r=s(48082),n=s(87338),l=s(15249),o=s(47648),i=s(91659);let c=(0,r.createContext)(null);function d(e){let{children:t}=e,s={baseUrl:"",token:"",provider:""},[d,u]=(0,r.useState)(s),[m,p]=(0,r.useState)(""),[f]=(0,r.useState)(()=>new o.ki(s));(0,r.useEffect)(()=>{let e=(0,n.Fp)();u(e),f.updateConfig(e),p((0,l.oD)()),(0,i.cY)("webterm.provider.daemon.init",{baseUrl:e.baseUrl,hasToken:!!e.token})},[f]),(0,r.useEffect)(()=>{let e=e=>{if("elanous.daemon.token"===e.key||"elanous.nexus.baseUrl"===e.key){let t=(0,n.Fp)();f.updateConfig(t),u(t),(0,i.cY)("webterm.provider.daemon.config-cross-tab",{key:e.key,hasToken:!!t.token});return}"elanous.daemon.sessionId"===e.key&&e.newValue&&p(t=>t===e.newValue?t:((0,i.cY)("webterm.provider.daemon.session-cross-tab",{previous:t||"(empty)",next:e.newValue}),e.newValue))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[f]);let h=e=>{u(t=>{let s={...t,...e};return(0,n.Qc)(e),f.updateConfig(s),(0,i.cY)("webterm.provider.daemon.config-update",{keys:Object.keys(e)}),s})},x=e=>{p(e),localStorage.setItem("elanous.daemon.sessionId",e),(0,i.cY)("webterm.provider.daemon.session-set",{sessionId:e})},g=(0,r.useMemo)(()=>({config:d,setConfig:h,client:f,sessionId:m,setSessionId:x}),[d,f,m]);return(0,a.jsx)(c.Provider,{value:g,children:t})}function u(){let e=(0,r.useContext)(c);if(!e)throw Error("useDaemon must be used inside <DaemonProvider>");return e}}},e=>{e.O(0,[7648,7307,4306,3702,7358],()=>e(e.s=46195)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7955],{72567:(e,t,s)=>{Promise.resolve().then(s.bind(s,97638))},97638:(e,t,s)=>{"use strict";s.d(t,{BotlabPageContent:()=>h});var r,l=s(17594),a=s(48082);let o=(null!=(r=s(30047).env.NEXT_PUBLIC_ELANOUS_BOTLAB_HOST)?r:"").trim(),n="elanous.botlab.wallHost",d=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;function i(e){return e.length>0&&e.length<=253&&d.test(e)}function c(e){var t;let{search:s,remembered:r=null}=e,d=(0,a.useMemo)(()=>(function(e){var t,s;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,l=null;try{l=new URLSearchParams(e).get("host")}catch(e){l=null}let a=null!=(t=null==l?void 0:l.trim())?t:"";if(""!==a&&i(a))return{host:a,source:"query",rejected:null};let n=""===a?null:a,d=null!=(s=null==r?void 0:r.trim())?s:"";return""!==d&&i(d)?{host:d,source:"remembered",rejected:n}:""!==o&&i(o)?{host:o,source:"default",rejected:n}:{host:"",source:"unset",rejected:n}})(s,r),[s,r]),c="unset"===d.source?null:(t=d.host,"https://".concat(t).concat("/bot3/bot-wall.html"));return(0,a.useEffect)(()=>{if("query"===d.source)try{window.localStorage.setItem(n,d.host)}catch(e){}},[d.source,d.host]),(0,l.jsxs)("main",{className:"mx-auto flex w-full max-w-6xl flex-col gap-6 px-6 py-10 sm:px-10","data-testid":"botlab-panel",children:[(0,l.jsxs)("header",{children:[(0,l.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Bot screens"}),(0,l.jsx)("h1",{className:"mt-2 text-3xl font-bold",children:"Botlab"}),(0,l.jsxs)("p",{className:"mt-2 max-w-3xl text-sm text-muted-foreground",children:["Live noVNC screens for the bots, served through Tailscale. One document holds all four sessions, so the VNC password is asked ",(0,l.jsx)("strong",{children:"once"}),", not four times."]}),(0,l.jsx)("p",{className:"mt-2 max-w-3xl text-sm text-muted-foreground",children:"View-only by default. This surface cannot send commands or control the bots."})]}),(0,l.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4","aria-label":"Wall address",children:[(0,l.jsx)("h2",{className:"text-sm font-semibold",children:"Wall address"}),(0,l.jsx)("p",{className:"mt-1 break-all font-mono text-xs text-muted-foreground","data-testid":"botlab-wall-url",children:null!=c?c:"(no host configured)"}),(0,l.jsx)("p",{className:"mt-2 text-xs text-muted-foreground","data-testid":"botlab-host-source",children:"query"===d.source?"Host came from the ?host= query parameter (remembered on this device).":"remembered"===d.source?"Host is the one remembered on this device; override it with ?host=<tailnet-name>.":"default"===d.source?"Host is the build default (NEXT_PUBLIC_ELANOUS_BOTLAB_HOST); override it with ?host=<tailnet-name>.":"No wall host is configured. Open this page once with ?host=<the VM tailnet name> — it is remembered on this device."}),null!==d.rejected&&(0,l.jsxs)("p",{role:"alert",className:"mt-2 text-xs text-destructive","data-testid":"botlab-host-rejected",children:["Ignored ?host=",d.rejected," — not a valid hostname."]}),null!==c&&(0,l.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground",children:[(0,l.jsx)("a",{className:"underline",href:c,target:"_blank",rel:"noreferrer","data-testid":"botlab-open-tab",children:"Open the wall in a new tab"})," — ","use this if the embedded frame stays blank."]})]}),null!==c&&(0,l.jsx)("section",{"aria-label":"Bot screen wall",children:(0,l.jsx)("iframe",{src:c,title:"Bot screen wall","data-testid":"botlab-wall-frame",className:"h-[70vh] w-full rounded-xl border border-border bg-background"})}),(0,l.jsxs)("section",{className:"rounded-xl border border-border bg-card p-5","aria-label":"If the wall is blank",children:[(0,l.jsx)("h2",{className:"text-sm font-semibold",children:"If the wall stays blank"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"A blank frame is not necessarily a broken bot. There are three separate reasons, with different fixes:"}),(0,l.jsxs)("ol",{className:"mt-3 list-decimal space-y-2 pl-5 text-sm text-muted-foreground",children:[(0,l.jsxs)("li",{children:[(0,l.jsx)("strong",{children:"This device is outside the tailnet."})," The address simply does not exist here. Join the tailnet, or view the screens from a device that is on it."]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("strong",{children:"Tailscale serve is not published."})," Re-run"," ",(0,l.jsx)("code",{className:"font-mono text-xs",children:"bash scripts/botlab/deploy-bot-wall.sh"}),", which re-publishes the paths and then verifies each one returns 200."]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("strong",{children:"The wall loaded but did not connect."})," That is a VNC-level failure, not a page failure — the wall itself reports connected/failed counts once you enter the password."]})]}),(0,l.jsx)("p",{className:"mt-3 text-xs text-muted-foreground",children:"The VNC password is deliberately not carried in this page or in the URL: any page a bot browser opens could otherwise reach the local websocket, and websockets have no CORS."})]}),(0,l.jsxs)("section",{className:"rounded-xl border border-dashed border-border p-5","aria-label":"Not wired yet",children:[(0,l.jsx)("h2",{className:"text-sm font-semibold",children:"Not wired yet"}),(0,l.jsxs)("ul",{className:"mt-2 list-disc space-y-1 pl-5 text-sm text-muted-foreground",children:[(0,l.jsxs)("li",{children:["Per-bot cell headers (name \xb7 last round verdict \xb7 whether CDP is alive) need"," ",(0,l.jsx)("code",{className:"font-mono text-xs",children:"browserPort"})," and round results on the daemon's persona route. That route is owned by another track and is not published today."]}),(0,l.jsx)("li",{children:"Running a command from this surface needs a POST route that does not exist yet."})]})]})]})}function h(){let e=window.location.search,t=null;try{t=window.localStorage.getItem(n)}catch(e){t=null}return(0,l.jsx)(c,{search:e,remembered:t})}}},e=>{e.O(0,[4306,3702,7358],()=>e(e.s=72567)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2885],{15249:(e,t,n)=>{"use strict";n.d(t,{Zr:()=>a,f6:()=>l,oD:()=>s});let r="elanous.daemon.sessionId";function l(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"s-".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,10))}function s(){let e=function(){let e=new URLSearchParams(window.location.search).get("session");return e?(localStorage.setItem(r,e),e):localStorage.getItem(r)}();if(e)return e;let t=l();return localStorage.setItem(r,t),t}function a(){let e=l();return localStorage.setItem(r,e),e}},28993:(e,t,n)=>{Promise.resolve().then(n.bind(n,40733))},40733:(e,t,n)=>{"use strict";n.d(t,{BotsPageContent:()=>D});var r=n(17594),l=n(48082),s=n(87691),a=n(67452);function o(e){if(null==e)return null;let t=e.replace(/[,%\s]/g,"").replace(/\*/g,"").trim();if(""===t||"-"===t||"N/A"===t)return null;let n=Number(t);return Number.isFinite(n)?n:null}let i=e=>"string"==typeof e&&""!==e?e:null,d=e=>"number"==typeof e&&Number.isFinite(e)?e:null,u=e=>"boolean"==typeof e?e:null;function c(e){var t,n,r,l,s;let a=[],c=[];for(let t of null!=(n=e.artifacts)?n:[]){let e=null!=(r=i(null==t?void 0:t.name))?r:"(이름 없음)",n=i(null==t?void 0:t.text);if(null===n){c.push(e);continue}a.push(function(e,t){var n;let r=function(e){let t=e.split("\n").filter(e=>""!==e.trim()&&!e.includes("━")),n=t.slice(0,3).join(" / ").slice(0,160),r=t.slice(0,3).join("\n");return/^Traceback \(most recent call last\):/m.test(r)?{kindOf:"파이썬 예외(Traceback)",head:n}:/^⛔\s*.*(실패|failed|error)/mi.test(r)?{kindOf:"스킬이 \xab실패\xbb라고 말했다",head:n}:/^(Error|error):/m.test(r)?{kindOf:"오류",head:n}:/^\s*command not found|No such file or directory/m.test(r)?{kindOf:"명령\xb7파일이 \xab없다\xbb",head:n}:null}(t);if(null!==r)return{kind:"failure",name:e,kindOf:r.kindOf,head:r.head};let l=function(e){var t,n,r,l;let s=null!=(l=null!=(r=null==(t=/^대상:\s*(\S+)/m.exec(e))?void 0:t[1])?r:null==(n=/^##\s+(\S+)\s+Real-Time Quote/m.exec(e))?void 0:n[1])?l:null;if(null===s)return null;let a=t=>{var n,r;return null!=(r=null==(n=RegExp("\\*\\*".concat(t,":\\*\\*\\s*([-+0-9.,]+)"),"i").exec(e))?void 0:n[1])?r:null},i=/\*\*Change:\*\*\s*([-+0-9.,]+)\s*\(([-+0-9.]+)%\)/i.exec(e),d={symbol:s,close:o(a("Close")),change:i?o(i[1]):o(a("Change")),changePct:i?o(i[2]):null,open:o(a("Open")),high:o(a("High")),low:o(a("Low")),volume:o(a("Volume")),prevClose:o(a("Prev Close"))};return[d.close,d.change,d.open,d.high,d.low,d.volume,d.prevClose].some(e=>null!==e)?d:null}(t);if(null!==l)return{kind:"quote",name:e,quote:l};let s=null!=(n=function(e){var t,n,r,l,s,a,i,d;let u=e.split("\n"),c=u.findIndex(e=>e.includes("|")&&e.includes("외국인")&&e.includes("기관")&&e.includes("개인"));if(c<0)return null;let m=e=>e.split("|").map(e=>e.trim()).filter((e,t,n)=>""!==e||0!==t&&t!==n.length-1),x=m(u[c]),f=e=>x.findIndex(t=>t.includes(e)),[h,g,p,b]=[0,f("외국인"),f("기관"),f("개인")];if(g<0||p<0||b<0)return null;let j=[];for(let e=c+1;e<u.length;e+=1){let t=u[e];if(!t.includes("|")){if(j.length>0)break;continue}if(/^\s*\|?[\s:|-]+\|?\s*$/.test(t))continue;let n=m(t);if(n.length<=Math.max(g,p,b))continue;let r=(null!=(l=n[h])?l:"").trim();""!==r&&j.push({key:r,foreign:o(n[g]),institution:o(n[p]),individual:o(n[b])})}if(0===j.length)return null;let y="";for(let e=c;e>=0;e-=1){let t=/^#{2,3}\s+(.+)$/.exec((null!=(s=u[e])?s:"").trim());if(t){y=t[1];break}}return""===y&&(y=null!=(a=null==(t=u.find(e=>""!==e.trim()&&!e.includes("━")))?void 0:t.trim())?a:"(제목 없음)"),{title:y,unit:null!=(d=null==(n=/\((백만|천|억)\)/.exec(x.join(" ")))?void 0:n[1])?d:null!=(i=null==(r=/\(([^)]*원[^)]*)\)/.exec(x.join(" ")))?void 0:r[1])?i:null,rows:j}}(t))?n:function(e){let t,n=e.trimStart();if(!n.startsWith("{"))return null;try{t=JSON.parse(n)}catch(e){return null}let r=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(let t of n){let n=e[t];if("number"==typeof n&&Number.isFinite(n))return n}return null},l=[],s=t.periods;if("object"==typeof s&&null!==s&&!Array.isArray(s))for(let[e,t]of Object.entries(s))"object"==typeof t&&null!==t&&l.push({key:e,foreign:r(t,"frgn_net_shares","frgn_net_amount_million"),institution:r(t,"inst_net_shares","inst_net_amount_million"),individual:r(t,"prsn_net_shares","prsn_net_amount_million")});if(0===l.length&&Array.isArray(t.rows))for(let e of t.rows){if("object"!=typeof e||null===e)continue;let t="string"==typeof e.date?e.date:null;null!==t&&l.push({key:t,foreign:r(e,"frgn_net_shares","frgn_net_amount_million"),institution:r(e,"inst_net_shares","inst_net_amount_million"),individual:r(e,"prsn_net_shares","prsn_net_amount_million")})}if(0===l.length)return null;let a="string"==typeof t.ticker?t.ticker:null,o="string"==typeof t.name&&t.name!==a?t.name:null;return{title:null!==o&&null!==a?"".concat(o,"(").concat(a,") 투자자 수급"):null!==a?"".concat(a," 투자자 수급"):"투자자 수급",unit:"주",rows:l}}(t);if(null!==s)return{kind:"flow",name:e,flow:s};let a=function(e){let t,n=e.split("\n"),r=n.findIndex(e=>"---BEGIN_OMNI_CRAWL_JSON---"===e);if(r<0)return{news:null,why:null,fenced:!1};let l=n.findIndex((e,t)=>t>r&&"---END_OMNI_CRAWL_JSON---"===e);if(l<0)return{news:null,why:"Omni crawl JSON 끝 울타리를 \xab못 찾았다\xbb",fenced:!0};try{t=JSON.parse(n.slice(r+1,l).join("\n"))}catch(e){return{news:null,why:"Omni crawl 울타리 안 JSON을 \xab못 읽었다\xbb",fenced:!0}}if("object"!=typeof t||null===t||Array.isArray(t))return{news:null,why:"Omni crawl JSON 최상위가 객체가 아니다",fenced:!0};let s=t;if(!Array.isArray(s.results))return{news:null,why:"Omni crawl JSON에 results 배열이 없다",fenced:!0};let a=[];for(let e of s.results){if("object"!=typeof e||null===e||Array.isArray(e))continue;let t=e.items;if(Array.isArray(t))for(let e of t)"object"!=typeof e||null===e||Array.isArray(e)||a.push({title:"string"==typeof e.title?e.title:null,url:"string"==typeof e.url?e.url:null,date:"string"==typeof e.date?e.date:null})}return{news:{query:"string"==typeof s.query?s.query:null,items:a},why:null,fenced:!0}}(t);if(null!==a.news)return{kind:"news",name:e,news:a.news};let i=t.split("\n").filter(e=>""!==e.trim()&&!e.includes("━")).slice(0,2).join(" / ").slice(0,120);if(a.fenced)return{kind:"unparsed",name:e,why:a.why,head:i};let d=function(e){let t=e.split("\n").filter(e=>""!==e.trim()&&!e.includes("━"));if(t.length<2)return null;let n=[];for(let e of t.slice(1)){let t=/^\s{1,}(\S[^:]*?)\s+:\s+(.+?)\s*$/.exec(e);if(null===t)continue;let r=t[1].trim(),l=t[2].trim();""===r||""===l||r.includes("//")||n.push({label:r,value:l,num:o(l)})}return 0===n.length?null:{title:t[0].trim(),entries:n}}(t);return null!==d?{kind:"keyed",name:e,keyed:d}:{kind:"unparsed",name:e,why:"아는 꼴이 \xab아니다\xbb(시세\xb7수급표\xb7뉴스\xb7라벨:값 넷 다 아님)",head:i}}(e,n))}return{personaId:null!=(l=i(e.personaId))?l:"unknown",runId:i(e.runId),atUtc:i(e.atUtc),ok:u(e.ok),steps:d(e.steps),failed:d(e.failed),source:null!=(s=i(e.source))?s:"unknown",delivered:u(null==(t=e.delivery)?void 0:t.sent),artifacts:a,textless:c}}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null===e)return"—";let n=Math.abs(e)>=1e3?e.toLocaleString("en-US"):String(e);return!0===t.sign&&e>0?"+".concat(n):n}async function x(e,t,n){try{var r,l,s=await e.fetchJson("/v1/bots/rounds?persona=".concat(encodeURIComponent(t),"&limit=").concat(n));if("object"!=typeof s||null===s)return{kind:"error",reason:"라우트 응답을 \xab못 읽었다\xbb(객체가 아니다)"};if(!Array.isArray(s.rounds))return{kind:"error",reason:"`rounds` 가 \xab배열이 아니다\xbb — 「0건」과 \xab다른 값\xbb이다"};let a=s.unreadableBy,o=void 0===a?null:Object.entries(a).filter(e=>{let[t]=e;return"result-missing"!==t}).reduce((e,t)=>{var n;let[,r]=t;return e+(null!=(n=d(r))?n:0)},0);return{kind:"ready",rounds:s.rounds.map(c),unreadable:null!=(r=d(s.unreadable))?r:0,unreadableNow:null!=o?o:null!=(l=d(s.unreadable))?l:0}}catch(e){return{kind:"error",reason:e instanceof Error&&e.message?e.message:String(e)}}}function f(e){let{a:t}=e,n=t.quote,l=null!==n.changePct&&n.changePct>0,s=null!==n.changePct&&n.changePct<0;return(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-3","data-testid":"quote-".concat(n.symbol),children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-3",children:[(0,r.jsx)("h4",{className:"font-mono text-sm font-semibold",children:n.symbol}),(0,r.jsx)("span",{className:"text-lg font-bold tabular-nums",children:m(n.close)}),(0,r.jsxs)("span",{className:"text-sm font-semibold tabular-nums ".concat(l?"text-emerald-600":s?"text-rose-600":"text-muted-foreground"),children:[m(n.change,{sign:!0}),null!==n.changePct&&" (".concat(m(n.changePct,{sign:!0}),"%)")]})]}),(0,r.jsx)("dl",{className:"mt-2 grid grid-cols-2 gap-x-4 gap-y-1 text-xs text-muted-foreground sm:grid-cols-4",children:[["시가",n.open],["고가",n.high],["저가",n.low],["전일",n.prevClose]].map(e=>{let[t,n]=e;return(0,r.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,r.jsx)("dt",{children:t}),(0,r.jsx)("dd",{className:"tabular-nums text-foreground",children:m(n)})]},t)})})]})}function h(e){let{a:t}=e,n=t.flow;return(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-3","data-testid":"flow-block",children:[(0,r.jsx)("h4",{className:"text-sm font-semibold",children:n.title}),null!==n.unit&&(0,r.jsxs)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["단위: ",n.unit]}),(0,r.jsx)("div",{className:"mt-2 overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full min-w-[22rem] text-xs",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"text-muted-foreground",children:[(0,r.jsx)("th",{className:"py-1 text-left font-medium",children:"기간"}),["외국인","기관","개인"].map(e=>(0,r.jsx)("th",{className:"py-1 text-right font-medium",children:e},e))]})}),(0,r.jsx)("tbody",{children:n.rows.slice(0,6).map(e=>(0,r.jsxs)("tr",{className:"border-t border-border/60",children:[(0,r.jsx)("td",{className:"py-1 font-mono",children:e.key}),[e.foreign,e.institution,e.individual].map((e,t)=>(0,r.jsx)("td",{className:"py-1 text-right tabular-nums ".concat(null===e?"text-muted-foreground":e>0?"text-emerald-600":e<0?"text-rose-600":""),children:m(e,{sign:!0})},t))]},e.key))})]})}),n.rows.length>6&&(0,r.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:["…",n.rows.length-6,"줄 더 (전체는 회차 원본에)"]})]})}function g(e){let{a:t}=e,n=t.keyed;return(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-3","data-testid":"keyed-block",children:[(0,r.jsx)("h4",{className:"text-sm font-semibold",children:n.title}),(0,r.jsx)("dl",{className:"mt-2 grid gap-1 sm:grid-cols-2",children:n.entries.map(e=>(0,r.jsxs)("div",{className:"flex items-baseline justify-between gap-3 text-sm",children:[(0,r.jsx)("dt",{className:"text-muted-foreground",children:e.label}),(0,r.jsx)("dd",{className:"font-semibold tabular-nums",children:e.value})]},e.label))})]})}function p(e){let{a:t}=e;return(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-3","data-testid":"news-block",children:[(0,r.jsx)("h4",{className:"text-sm font-semibold",children:null===t.news.query?"뉴스":"뉴스: ".concat(t.news.query)}),0===t.news.items.length?(0,r.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"수집된 기사가 0건이다."}):(0,r.jsx)("ul",{className:"mt-2 space-y-2",children:t.news.items.map((e,t)=>{var n,l,s,a;return(0,r.jsxs)("li",{className:"text-sm",children:[null===e.url?null!=(n=e.title)?n:"(제목 없음)":(0,r.jsx)("a",{className:"font-medium underline underline-offset-2",href:e.url,children:null!=(l=e.title)?l:e.url}),null!==e.date&&(0,r.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:e.date})]},"".concat(null!=(a=null!=(s=e.url)?s:e.title)?a:"article","-").concat(t))})})]})}function b(e){let{a:t}=e;return(0,r.jsxs)("div",{className:"rounded-lg border border-rose-500/40 bg-rose-500/5 p-3","data-testid":"failure-block",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-baseline gap-2",children:[(0,r.jsx)("h4",{className:"font-mono text-sm font-semibold",children:t.name}),(0,r.jsx)("span",{className:"rounded bg-rose-500/15 px-2 py-0.5 text-xs font-medium text-rose-700",children:"이 단계가 \xab실패\xbb했다"})]}),(0,r.jsx)("p",{className:"mt-1 text-xs text-rose-700",children:t.kindOf}),(0,r.jsx)("p",{className:"mt-1 break-words font-mono text-xs text-muted-foreground",children:t.head})]})}function j(e){let{a:t}=e;return(0,r.jsxs)("div",{className:"rounded-lg border border-dashed border-border bg-background/40 p-3","data-testid":"unparsed-block",children:[(0,r.jsx)("h4",{className:"font-mono text-sm",children:t.name}),(0,r.jsxs)("p",{className:"mt-1 text-xs text-amber-600",children:["⚠️ 이 산출을 \xab못 읽었다\xbb — ",t.why]}),(0,r.jsx)("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:t.head})]})}function y(e){var t;let{round:n}=e,l=null!==n.failed&&n.failed>0;return(0,r.jsxs)("article",{className:"rounded-xl border border-border bg-card p-5","data-testid":"round-".concat(null!=(t=n.runId)?t:"unknown"),children:[(0,r.jsxs)("header",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Asia/Seoul";if(null===e)return"시각 \xab모름\xbb";let n=new Date(e);if(Number.isNaN(n.getTime()))return"시각을 \xab못 읽었다\xbb(".concat(e.slice(0,24),")");let r=new Intl.DateTimeFormat("ko-KR",{timeZone:t,month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1});return"".concat(r.format(n)," KST")}(n.atUtc)}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(0,r.jsx)("span",{className:"rounded px-2 py-0.5 font-medium ".concat("cron"===n.source?"bg-emerald-500/15 text-emerald-700":"bg-muted text-muted-foreground"),children:"cron"===n.source?"무인(cron)":"manual"===n.source?"손":"출처 \xab모름\xbb"}),(0,r.jsxs)("span",{className:"rounded px-2 py-0.5 font-medium ".concat(l?"bg-rose-500/15 text-rose-700":"bg-muted text-muted-foreground"),children:[null===n.steps?"단계 \xab모름\xbb":"".concat(n.steps,"단계"),l&&" \xb7 실패 ".concat(n.failed)]}),(0,r.jsx)("span",{className:"rounded px-2 py-0.5 font-medium ".concat(!0===n.delivered?"bg-sky-500/15 text-sky-700":"bg-muted text-muted-foreground"),children:null===n.delivered?"배달 \xab모름\xbb":n.delivered?"폰에 갔다":"안 갔다"})]})]}),(0,r.jsxs)("div",{className:"mt-4 space-y-3",children:[n.artifacts.map((e,t)=>"quote"===e.kind?(0,r.jsx)(f,{a:e},t):"flow"===e.kind?(0,r.jsx)(h,{a:e},t):"news"===e.kind?(0,r.jsx)(p,{a:e},t):"keyed"===e.kind?(0,r.jsx)(g,{a:e},t):"failure"===e.kind?(0,r.jsx)(b,{a:e},t):(0,r.jsx)(j,{a:e},t)),0===n.artifacts.length&&0===n.textless.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"이 회차에 산출이 \xab없다\xbb."}),n.textless.length>0&&(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["본문을 \xab안 받은\xbb 산출 ",n.textless.length,"건: ",n.textless.join(" \xb7 ")]})]})]})}function N(e){let{client:t,persona:n,title:s,subtitle:a,limit:o=3}=e,[i,d]=(0,l.useState)({kind:"loading"});return(0,l.useEffect)(()=>{let e=!0;return d({kind:"loading"}),x(t,n,o).then(t=>{e&&d(t)}),()=>{e=!1}},[t,n,o]),(0,r.jsxs)("section",{className:"flex flex-col gap-4","aria-label":"".concat(n," rounds"),"data-testid":"rounds-".concat(n),children:[(0,r.jsxs)("header",{children:[(0,r.jsx)("h2",{className:"text-xl font-bold",children:s}),(0,r.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:a})]}),"loading"===i.kind&&(0,r.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"투자 회차를 불러오는 중…"}),"error"===i.kind&&(0,r.jsxs)("div",{role:"alert",className:"rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-destructive",children:"회차를 \xab못 받았다\xbb."}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:i.reason}),(0,r.jsxs)("p",{className:"mt-2 text-xs text-muted-foreground",children:["⚠️ 라우트 ",(0,r.jsx)("code",{className:"font-mono",children:"/v1/bots/rounds"})," 가 아직 \xab없을 수\xbb 있다(\uD83C\uDD63 축). 그때는 이 자리가 비는 것이 \xab맞다\xbb — 화면이 그것을 말하고 있다."]})]}),"ready"===i.kind&&0===i.rounds.length&&(0,r.jsxs)("p",{className:"text-sm text-muted-foreground",children:["회차가 \xab0건\xbb이다.",i.unreadable>0&&" (못 읽은 자리 ".concat(i.unreadable,"곳 — 「없다」가 아니다)")]}),"ready"===i.kind&&i.rounds.length>0&&(0,r.jsxs)(r.Fragment,{children:[i.unreadableNow>0?(0,r.jsxs)("p",{role:"alert",className:"text-xs text-amber-600",children:["⚠️ ***지금 못 읽는 자리 ",i.unreadableNow,"곳*** — 아래 수는 \xab과소\xbb다."]}):i.unreadable>0?(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["못 읽은 자리 ",i.unreadable,"곳(옛 회차) — 「지금 깨진 것」은 \xab없다\xbb."]}):null,(0,r.jsx)("div",{className:"flex flex-col gap-4",children:i.rounds.map(e=>{var t,n;return(0,r.jsx)(y,{round:e},null!=(n=null!=(t=e.runId)?t:e.atUtc)?n:Math.random())})})]})]})}function w(e){let{client:t,limit:n=3}=e;return(0,r.jsx)(N,{client:t,persona:"investor",limit:n,title:"\uD83D\uDCC8 투자 회차",subtitle:"봇이 \xab실제로 낸\xbb 산출이다. ⛔ 차트는 \xab일부러\xbb 안 그린다 — 글만 낸다."})}function v(e){let{client:t,limit:n=2}=e;return(0,r.jsx)(N,{client:t,persona:"assistant",limit:n,title:"\uD83D\uDDD3️ 비서 회차",subtitle:"안 읽은 메일\xb7앞으로의 일정. ⛔ 「0」도 \xab잰 값\xbb이라 그대로 보여 준다."})}function k(e){let{client:t,limit:n=2}=e;return(0,r.jsx)(N,{client:t,persona:"newsbot",limit:n,title:"\uD83D\uDCF0 뉴스 회차",subtitle:"⚠️ 이 봇의 산출은 꼴이 여럿이다 — 못 읽은 것은 \xab이름을 대고\xbb 남는다."})}async function _(e){try{let t=await e.fetchJson("/v1/bots/commands");return{kind:"ready",commands:t}}catch(e){return{kind:"error",reason:e instanceof Error&&e.message?e.message:"string"==typeof e&&e?e:"Unknown error"}}}function S(e){let{client:t}=e,n=(0,a.v)(t),[s,o]=(0,l.useState)({kind:"loading"});(0,l.useEffect)(()=>{let e=!0;return o({kind:"loading"}),_(t).then(t=>{e&&o(t)}),()=>{e=!1}},[t]);let i=n.error,d="error"===s.kind?s.reason:null,u=null!==i||null!==d,c=!u&&(n.loading||"loading"===s.kind),m="ready"===s.kind?s.commands:[],x=!c&&!u;return(0,r.jsxs)("main",{className:"mx-auto flex w-full max-w-5xl flex-col gap-6 px-6 py-10 sm:px-10","data-testid":"bots-panel",children:[(0,r.jsxs)("header",{children:[(0,r.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Bot directory"}),(0,r.jsx)("h1",{className:"mt-2 text-3xl font-bold",children:"Bots"}),(0,r.jsx)("p",{className:"mt-2 max-w-3xl text-sm text-muted-foreground",children:"Commands are global: every bot exposes the same catalog."}),(0,r.jsx)("p",{className:"mt-2 max-w-3xl text-sm text-muted-foreground",children:"This surface cannot send commands yet; it only shows what you can ask bots to do."})]}),c&&(0,r.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading bot identities and command catalog…"}),i&&(0,r.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Unable to load bot identities: ",i]}),d&&(0,r.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Unable to load bot catalog: ",d]}),x&&0===n.personas.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No bots are configured."}),x&&n.personas.length>0&&0===m.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No bot commands are available."}),(0,r.jsx)(w,{client:t}),(0,r.jsx)(v,{client:t}),(0,r.jsx)(k,{client:t}),x&&n.personas.length>0&&m.length>0&&(0,r.jsx)("section",{className:"grid gap-4 md:grid-cols-2","aria-label":"Bot identities",children:n.personas.map(e=>{var t;return(0,r.jsxs)("article",{className:"rounded-xl border border-border bg-card p-5","data-testid":"bot-card-".concat(e.personaId),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:e.displayName}),(0,r.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:null!=(t=e.description)?t:"No description provided."}),(0,r.jsx)("h3",{className:"mt-5 text-sm font-semibold",children:"Available commands"}),(0,r.jsx)("ul",{className:"mt-3 space-y-3","aria-label":"Available bot commands",children:m.map(e=>(0,r.jsxs)("li",{className:"rounded-lg border border-border bg-background/60 p-3",children:[(0,r.jsx)("h4",{className:"font-mono text-sm font-semibold",children:e.name}),(0,r.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:e.description}),e.arguments.length>0?(0,r.jsx)("ul",{className:"mt-2 space-y-1","aria-label":"".concat(e.name," arguments"),children:e.arguments.map(e=>(0,r.jsxs)("li",{className:"text-xs text-muted-foreground",children:[(0,r.jsx)("code",{className:"font-semibold text-foreground",children:e.name}),e.required?" (required)":" (optional)"," — ",e.description]},e.name))}):(0,r.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"No arguments."})]},e.name))})]},e.personaId)})})]})}function D(){let{client:e}=(0,s.Q)();return(0,r.jsx)(S,{client:e})}},67452:(e,t,n)=>{"use strict";n.d(t,{v:()=>a});var r=n(48082),l=n(91659);let s=null;function a(e){let[t,n]=(0,r.useState)(()=>s&&Date.now()-s.at<6e4?s.data:[]),[a,o]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null),u=(0,r.useCallback)(async()=>{o(!0),d(null);try{let t=await e.listPersonas();s={at:Date.now(),data:t.personas},n(t.personas)}catch(e){d(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e]);(0,r.useEffect)(()=>{if(s&&Date.now()-s.at<6e4)return void n(s.data);u()},[u]);let c=(0,r.useCallback)(async()=>{s=null,await u()},[u]);return(0,r.useEffect)(()=>{let t=e.personasEventsUrl();if(!t)return;let n=null;try{n=new EventSource(t)}catch(e){(0,l.cY)("showroom.personas.sse.construct-error",{error:String(e)});return}let r=e=>()=>{"hello"!==e&&((0,l.cY)("showroom.personas.sse.event",{kind:e}),s=null,u())};return n.addEventListener("hello",r("hello")),n.addEventListener("load-dir",r("load-dir")),n.addEventListener("reload-all",r("reload-all")),n.addEventListener("upsert",r("upsert")),n.addEventListener("remove",r("remove")),n.onerror=e=>{(0,l.cY)("showroom.personas.sse.error",{type:e.type})},()=>{try{null==n||n.close()}catch(e){}}},[e,u]),{personas:t,loading:a,error:i,reload:c}}},87691:(e,t,n)=>{"use strict";n.d(t,{C:()=>d,DaemonProvider:()=>u,Q:()=>c});var r=n(17594),l=n(48082),s=n(87338),a=n(15249),o=n(47648),i=n(91659);let d=(0,l.createContext)(null);function u(e){let{children:t}=e,n={baseUrl:"",token:"",provider:""},[u,c]=(0,l.useState)(n),[m,x]=(0,l.useState)(""),[f]=(0,l.useState)(()=>new o.ki(n));(0,l.useEffect)(()=>{let e=(0,s.Fp)();c(e),f.updateConfig(e),x((0,a.oD)()),(0,i.cY)("webterm.provider.daemon.init",{baseUrl:e.baseUrl,hasToken:!!e.token})},[f]),(0,l.useEffect)(()=>{let e=e=>{if("elanous.daemon.token"===e.key||"elanous.nexus.baseUrl"===e.key){let t=(0,s.Fp)();f.updateConfig(t),c(t),(0,i.cY)("webterm.provider.daemon.config-cross-tab",{key:e.key,hasToken:!!t.token});return}"elanous.daemon.sessionId"===e.key&&e.newValue&&x(t=>t===e.newValue?t:((0,i.cY)("webterm.provider.daemon.session-cross-tab",{previous:t||"(empty)",next:e.newValue}),e.newValue))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[f]);let h=e=>{c(t=>{let n={...t,...e};return(0,s.Qc)(e),f.updateConfig(n),(0,i.cY)("webterm.provider.daemon.config-update",{keys:Object.keys(e)}),n})},g=e=>{x(e),localStorage.setItem("elanous.daemon.sessionId",e),(0,i.cY)("webterm.provider.daemon.session-set",{sessionId:e})},p=(0,l.useMemo)(()=>({config:u,setConfig:h,client:f,sessionId:m,setSessionId:g}),[u,f,m]);return(0,r.jsx)(d.Provider,{value:p,children:t})}function c(){let e=(0,l.useContext)(d);if(!e)throw Error("useDaemon must be used inside <DaemonProvider>");return e}}},e=>{e.O(0,[7648,4306,3702,7358],()=>e(e.s=28993)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9084],{478:(e,t,s)=>{"use strict";s.d(t,{QK:()=>a,i6:()=>n,Pz:()=>o,Em:()=>i,Yy:()=>d});var r=s(42510);let l={alive:"살아 있음",late:"늦음",failed:"실패",off:"꺼짐"},n="/v1/schedules?includeOff=1",a="/v1/dashboard/loops";async function i(e,t){var s,i,o,c,u,m,p,f;let[h,x]=await Promise.allSettled([e(n),e(a)]),b="fulfilled"===h.status?null==(s=h.value)?void 0:s.schedules:null,v="fulfilled"===x.status?null==(o=x.value)||null==(i=o.loops)?void 0:i.loops:null;if(!Array.isArray(b)&&!Array.isArray(v))throw Error("loop registries unavailable");if(!Array.isArray(b))throw Error("스케줄 레지스트리 조회 실패");if(!Array.isArray(v))throw Error("루프 레지스트리 조회 실패");let g=d(b,t).map(e=>({...e,id:"schedule:".concat(e.id)}));for(let e of v){let s=e.last?Date.parse(e.last.at):NaN,n=(0,r.u)({enabled:!1!==e.armed,lastRunAt:null!=(m=null==(c=e.last)?void 0:c.at)?m:null,lastStatus:null!=(p=null==(u=e.last)?void 0:u.status.toLowerCase())?p:null,intervalMs:null},t);g.push({id:"loop:".concat(e.name),name:e.label,layer:null!=(f=e.category)?f:"루프",owner:"미지정",mode:null===e.armed?"관측":e.armed?"armed":"off",lastRun:Number.isFinite(s)?e.last.at:null,verdict:"alive"===n?"판정 불가":l[n]})}return g}function o(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now,r=0,l=!0;return{async refresh(){let n=++r;try{let a=await i(e,s());l&&n===r&&t({rows:a,state:"ready"})}catch(e){l&&n===r&&t({rows:[],state:"error"})}},dispose(){l=!1}}}function d(e,t){return e.map(e=>{var s,n,a,i,o,d,c;let u=e.lastRun?Date.parse(e.lastRun.at):NaN,m=(0,r.u)({enabled:"off"!==e.state,lastRunAt:null!=(d=null==(s=e.lastRun)?void 0:s.at)?d:null,lastStatus:(null==(n=e.lastRun)?void 0:n.exit)!=null&&0!==e.lastRun.exit?"failed":(null==(a=e.lastRun)?void 0:a.status)==null||["ok","success","completed"].includes(e.lastRun.status.toLowerCase())?null!=(c=null==(o=e.lastRun)||null==(i=o.status)?void 0:i.toLowerCase())?c:null:"failed",intervalMs:e.cron?null:e.intervalMs,...e.cron?{scheduleState:e.state}:{}},t),p=!e.cron&&!(e.intervalMs&&e.intervalMs>0),f="alive"===m&&(!Number.isFinite(u)||p)?"판정 불가":l[m];return{id:e.id,name:e.name,layer:e.domain||e.category||e.source,owner:"미지정",mode:e.runVia||e.source,lastRun:Number.isFinite(u)?e.lastRun.at:null,verdict:f}})}},5010:(e,t,s)=>{"use strict";s.d(t,{D:()=>r,F:()=>l});let r="/loops?view=interact";function l(e){return(null==e?void 0:e.get("view"))==="resources"?"resources":(null==e?void 0:e.get("view"))==="interact"?"interact":"status"}},42510:(e,t,s)=>{"use strict";function r(e,t){if(!e.enabled||"off"===e.scheduleState)return"off";if("failed"===e.lastStatus||"error"===e.lastStatus||"failure"===e.lastStatus||"abandoned"===e.lastStatus||"expired"===e.lastStatus)return"failed";if("stale"===e.scheduleState)return"late";let s=null===e.lastRunAt?NaN:Date.parse(e.lastRunAt);if(void 0!==e.secondDueAt){let r=null===e.secondDueAt?NaN:Date.parse(e.secondDueAt);return Number.isFinite(s)&&Number.isFinite(t)&&Number.isFinite(r)&&r>s&&t>r?"late":"alive"}return Number.isFinite(t)&&Number.isFinite(s)&&null!==e.intervalMs&&Number.isFinite(e.intervalMs)&&e.intervalMs>0&&t-s>2*e.intervalMs?"late":"alive"}s.d(t,{u:()=>r})},47764:(e,t,s)=>{Promise.resolve().then(s.bind(s,84122))},53974:(e,t,s)=>{"use strict";async function r(e){let t=await e.fetchResponse("/v1/ops-board/notices");if(!t.ok)throw Error("notices list failed: ".concat(t.status));return(await t.json()).notices}async function l(e,t,s){let r=await e.fetchResponse("/v1/ops-board/notices",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({noticeId:t,body:s})});if(!r.ok)throw Error("notice reply failed: ".concat(r.status));return(await r.json()).reply}async function n(e){let t=await e.fetchResponse("/v1/decisions?status=open");if(!t.ok)throw Error("decisions list failed: ".concat(t.status));return(await t.json()).decisions}async function a(e,t,s,r){let l=await e.fetchResponse("/v1/decisions/".concat(encodeURIComponent(t),"/decide"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({choice:s,...void 0===r?{}:{note:r}})});if(!l.ok)throw Error("decision failed: ".concat(l.status));return l.json()}s.d(t,{LD:()=>a,aj:()=>l,kh:()=>r,qK:()=>n})},84122:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>E});var r=s(17594),l=s(51596),n=s.n(l),a=s(48082),i=s(87691);let o="못 잼",d="불러오는 중…";var c=s(478),u=s(5010),m=s(53974),p=s(65989);let f=e=>!!e&&"object"==typeof e&&!Array.isArray(e),h=e=>Number.isInteger(e)&&e>=0,x=e=>null===e||"number"==typeof e&&Number.isFinite(e);async function b(e){try{let r,l=await e.fetchResponse("/v1/drafts/metrics");if(!l.ok)return{kind:"unavailable",reason:null};var t,s=await l.json();if(!f(s))return{kind:"unavailable",reason:null};let n="string"==typeof s.reason?s.reason:null;if("measuring"===s.state)return{kind:"measuring"};if("unavailable"===s.state)return{kind:"unavailable",reason:n};let a=s.metrics;return"ready"===s.state&&f(a)&&"string"==typeof s.measuredAt&&Number.isFinite(Date.parse(s.measuredAt))&&h(a.inventory)&&h(a.needsOwner)&&h(a.converted48h)&&h(a.cohort48h)&&x(a.oldestAgeHours)&&x(a.conversion48h)?{kind:"ready",measuredAt:s.measuredAt,refreshError:n,metrics:{inventory:a.inventory,oldestAgeHours:a.oldestAgeHours,needsOwner:a.needsOwner,converted48h:a.converted48h,cohort48h:a.cohort48h,conversion48h:a.conversion48h,overlap:(t=a.overlap,f(t)?["launches24h","launched","unmeasured","linked","autoLanded","salvaged","salvageUnmeasured"].every(e=>null===t[e]||h(t[e]))&&"boolean"==typeof t.sourceIncomplete&&(null===t[r="secondSiblingMedianHours"]||x(t[r])&&t[r]>=0)&&(null===t.autoRate||x(t.autoRate)&&t.autoRate>=0&&t.autoRate<=1)?t:null:null)}}:{kind:"unavailable",reason:null}}catch(e){return{kind:"unavailable",reason:null}}}function v(e){var t,s,l;let{value:n}=e,a="draft 재고";return(0,r.jsxs)("section",{"aria-label":a,className:"col-span-2 min-w-0 rounded-xl border border-border bg-card p-3 sm:p-4",children:[(0,r.jsx)("h2",{className:"text-xs font-medium text-muted-foreground sm:text-sm",children:a}),"loading"===n.kind?(0,r.jsx)("p",{className:"mt-2 text-sm",children:"불러오는 중…"}):"measuring"===n.kind?(0,r.jsx)("p",{className:"mt-2 text-sm",children:"측정 중"}):"unavailable"===n.kind?(0,r.jsx)("p",{className:"mt-2 text-sm",title:null!=(t=n.reason)?t:void 0,children:"못 읽음"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("dl",{className:"mt-2 grid grid-cols-2 gap-x-3 gap-y-1 text-xs sm:grid-cols-4 sm:text-sm",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("dt",{className:"text-muted-foreground",children:"열린 draft"}),(0,r.jsx)("dd",{className:"text-lg font-semibold tabular-nums sm:text-xl",children:n.metrics.inventory})]}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("dt",{className:"text-muted-foreground",children:"최장 나이"}),(0,r.jsx)("dd",{className:"text-lg font-semibold tabular-nums sm:text-xl",children:null===(s=n.metrics.oldestAgeHours)?"해당 없음":s>=48?"".concat((s/24).toFixed(1),"일"):"".concat(s.toFixed(1),"시간")})]}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("dt",{className:"text-muted-foreground",children:"주인 표식 없는 draft"}),(0,r.jsx)("dd",{className:"text-lg font-semibold tabular-nums sm:text-xl",children:n.metrics.needsOwner}),n.metrics.inventory>0&&n.metrics.needsOwner===n.metrics.inventory&&(0,r.jsx)("dd",{className:"text-muted-foreground",children:"처리 중 표식 0건"})]}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("dt",{className:"text-muted-foreground",children:"48h 전환율"}),(0,r.jsx)("dd",{className:"text-lg font-semibold tabular-nums sm:text-xl",children:null===n.metrics.conversion48h?"표본 없음":"".concat((100*n.metrics.conversion48h).toFixed(1),"%")}),null!==n.metrics.conversion48h&&(0,r.jsxs)("dd",{className:"text-muted-foreground tabular-nums",children:[n.metrics.converted48h,"/",n.metrics.cohort48h]})]})]}),n.metrics.overlap&&(0,r.jsxs)("p",{className:"mt-2 text-xs text-muted-foreground tabular-nums",children:["겹침 발사 24h ",null===n.metrics.overlap.launches24h?"못 잼":n.metrics.overlap.launches24h," \xb7 자동 착지 ",null===n.metrics.overlap.autoRate?"못 잼":"".concat((100*n.metrics.overlap.autoRate).toFixed(1),"%")," (",null===n.metrics.overlap.autoLanded?"못 잼":n.metrics.overlap.autoLanded,"/",null===n.metrics.overlap.linked?"못 잼":n.metrics.overlap.linked,")"," \xb7 둘째 형제 착지 중앙값 ",null===n.metrics.overlap.secondSiblingMedianHours?"못 잼":"".concat(n.metrics.overlap.secondSiblingMedianHours.toFixed(1),"h"),(n.metrics.overlap.sourceIncomplete||null===n.metrics.overlap.unmeasured||n.metrics.overlap.unmeasured>0)&&" \xb7 부분 측정"]}),(0,r.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:[(0,r.jsx)("time",{dateTime:n.measuredAt,children:(l=n.measuredAt,new Intl.DateTimeFormat("ko-KR",{timeZone:"Asia/Seoul",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(l)))})," 측정",n.refreshError&&(0,r.jsx)("span",{className:"ml-1 text-amber-700",title:n.refreshError,children:"\xb7 갱신 실패 — 이전 값"})]})]})]})}let g={unobservable:"관측 불가",blocked:"막힘","loop-down":"루프 정지",saturated:"자원 포화","supply-empty":"공급 부족",degraded:"흐름 저하",flowing:"흐름 정상"},y={flow:void 0,release:void 0,loops:void 0,decisions:void 0,decisionTitles:void 0,merged:void 0,risks:void 0,grid:void 0,drafts:{kind:"loading"}},j=e=>"string"==typeof e&&Number.isFinite(Date.parse(e)),w=e=>!!e&&"object"==typeof e&&!Array.isArray(e);async function N(e){try{let t=await e.fetchResponse("/v1/ops/overview");if(!t.ok)return null;return function(e){if(!(e&&"object"==typeof e&&!Array.isArray(e))||!Object.hasOwn(e,"verdict")||!Object.hasOwn(e,"reasons"))return null;let t=e.verdict;if("string"!=typeof t||!Object.hasOwn(g,t))return null;let s=e.reasons;if(!Array.isArray(s)||!s.every(e=>"string"==typeof e))return null;let r=s[0]?s[0]:null,l=Object.hasOwn(e,"cacheAgeMs")?e.cacheAgeMs:void 0;return"number"!=typeof l||!Number.isFinite(l)||l<0?null:{verdict:t,label:g[t],reason:r,stale:l>=1e4}}(await t.json())}catch(e){return null}}function k(e){return null!==e&&"object"==typeof e&&"string"==typeof e.id&&"string"==typeof e.name&&"string"==typeof e.source&&(null===e.category||"string"==typeof e.category)&&(null===e.domain||"string"==typeof e.domain)&&(null===e.runVia||"string"==typeof e.runVia)&&["live","firing","stale","off"].includes(e.state)&&(null===e.cron||"string"==typeof e.cron)&&(null===e.intervalMs||"number"==typeof e.intervalMs&&Number.isFinite(e.intervalMs))&&Array.isArray(e.next)&&e.next.every(e=>"string"==typeof e)&&(null===e.lastRun||"object"==typeof e.lastRun&&null!==e.lastRun&&"string"==typeof e.lastRun.at&&(null===e.lastRun.status||"string"==typeof e.lastRun.status)&&(null===e.lastRun.exit||"number"==typeof e.lastRun.exit))}async function A(e){try{var t;let s=await e.fetchResponse(c.i6);if(!s.ok)return null;let r=await s.json();if(null===r||"object"!=typeof r||!("schedules"in r))return null;let l=r.schedules;if(!Array.isArray(l)||!l.every(k))return null;let n=(0,c.Yy)(l,Date.now()),a={};for(let e of n)a[e.verdict]=(null!=(t=a[e.verdict])?t:0)+1;let i=n.flatMap((e,t)=>"실패"===e.verdict&&j(e.lastRun)?[{id:"loop:".concat(e.id),kind:"실패 루프",title:e.name,at:l[t].lastRun.at}]:[]);return{summary:a,risks:i}}catch(e){return null}}async function R(e){try{let t=await e.fetchResponse(c.QK);if(!t.ok)return null;let s=await t.json();if(!w(s)||!w(s.loops)||!Array.isArray(s.loops.loops))return null;let r=s.loops.loops;if(!r.every(e=>w(e)&&"string"==typeof e.name&&"string"==typeof e.label&&(null===e.last||w(e.last)&&j(e.last.at)&&"string"==typeof e.last.status)))return null;return r.flatMap(e=>e.last&&["error","failed","failure","abandoned"].includes(e.last.status.toLowerCase())?[{id:"loop:".concat(e.name),kind:"실패 루프",title:e.label,at:e.last.at}]:[])}catch(e){return null}}async function F(e,t){try{let s=await e.fetchResponse("/v1/harness/runs?finishedSince=".concat(t)),r=s.ok?await s.json():null,l=w(r)?r.landed:null;return w(r)&&(void 0===r.landedTruncated||!1===r.landedTruncated)&&null==r.landedError&&Array.isArray(l)&&l.every(e=>w(e)&&"number"==typeof e.number&&j(e.mergedAt))?new Set(l.filter(e=>Date.parse(e.mergedAt)>=t).map(e=>e.number)).size:null}catch(e){return null}}async function S(e,t){try{let s=await e.fetchResponse("/v1/harness/runs?finishedSince=".concat(t-6048e5)),r=s.ok?await s.json():null;if(!w(r))return null;let l=r.finished,n=r.entries;return"complete"===r.completeness&&Array.isArray(l)&&Array.isArray(n)&&w(r.finishedObservation)&&Number.isInteger(r.finishedObservation.skippedFiles)&&0===r.finishedObservation.skippedFiles&&l.every(e=>w(e)&&"string"==typeof e.runId&&"string"==typeof e.status&&j(e.endedAt))&&n.every(e=>w(e)&&"string"==typeof e.runId&&"string"==typeof e.status)?[...l.filter(e=>"human-stop"===e.status||"failed"===e.status||"parked"===e.status||"cancelled"===e.status&&"soft-stopped"===e.stage).map(e=>({id:"run:".concat(e.runId),kind:"멈춘 하니스 런",title:"string"==typeof e.objective&&e.objective?e.objective:e.runId,at:e.endedAt})),...n.filter(e=>"ended-unclosed"===e.status&&j(e.lastActivityTimestamp)&&!l.some(t=>t.runId===e.runId)).map(e=>({id:"run:".concat(e.runId),kind:"멈춘 하니스 런",title:"string"==typeof e.objective&&e.objective?e.objective:e.runId,at:e.lastActivityTimestamp}))]:null}catch(e){return null}}async function M(e,t){try{let s=await (0,m.qK)(e);if(!Array.isArray(s)||!s.every(e=>w(e)&&"string"==typeof e.id))return null;return{count:s.length,titles:s.map(e=>"string"==typeof e.title&&e.title.trim()?e.title.trim():e.id),risks:s.flatMap(e=>j(e.dueAt)&&Date.parse(e.dueAt)<t?[{id:"decision:".concat(e.id),kind:"기한 지난 결정",title:"string"==typeof e.title?e.title:e.id,at:e.dueAt}]:[])}}catch(e){return null}}async function D(e){try{let t=await e.fetchResponse("/v1/grid");if(!t.ok)return null;let s=await t.json();if(!w(s)||!w(s.hq)||!Array.isArray(s.members)||null!==s.poolReason&&"string"!=typeof s.poolReason)return null;let r=s.hq;if(null!==r.record&&(!w(r.record)||"string"!=typeof r.record.holder)||null!==r.ageSeconds&&("number"!=typeof r.ageSeconds||!Number.isFinite(r.ageSeconds))||null!==r.expired&&"boolean"!=typeof r.expired||null!==r.reason&&"string"!=typeof r.reason||!s.members.every(e=>w(e)&&"string"==typeof e.context&&"number"==typeof e.capacity&&Number.isFinite(e.capacity)&&(null===e.occupied||"number"==typeof e.occupied&&Number.isFinite(e.occupied))))return null;return s}catch(e){return null}}function O(e,t){return new Promise(s=>{let r=setTimeout(()=>s(t),15e3);e.then(e=>{clearTimeout(r),s(e)},()=>{clearTimeout(r),s(t)})})}function T(e){let{title:t,children:s}=e;return(0,r.jsxs)("section",{"aria-label":t,className:"min-w-0 rounded-xl border border-border bg-card p-3 sm:p-4",children:[(0,r.jsx)("h2",{className:"text-xs font-medium text-muted-foreground sm:text-sm",children:t}),(0,r.jsx)("div",{className:"mt-2 text-lg font-semibold leading-snug tabular-nums sm:text-xl",children:s})]})}function E(){var e,t,s,l,c;let{client:m}=(0,i.Q)(),[f,h]=(0,a.useState)(y);(0,a.useEffect)(()=>{let e=!0;return h(y),!function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0,r=Date.now(),l=function(e){let t=new Intl.DateTimeFormat("sv-SE",{timeZone:"Asia/Seoul"}).format(e);return Date.parse("".concat(t,"T00:00:00+09:00"))}(new Date(r)),n=O(N(e),null),a=O((0,p.Nn)(e),{kind:"error",status:0}),i=O(A(e),null),o=O(R(e),null),d=O(M(e,r),null),c=O(F(e,l),null),u=O(S(e,l),null),m=O(D(e),null);!function e(t,s,r){let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;O(b(t),{kind:"unavailable",reason:null}).then(n=>{r()&&(s({drafts:n}),"measuring"===n.kind&&l>0&&setTimeout(()=>{r()&&e(t,s,r,l-1)},1e4))})}(e,t,s),n.then(e=>t({flow:e})),a.then(e=>{var s;return t({release:"ready"===e.kind?4!==(s=e.data).seats.length||s.seats.some(e=>null===e.checklist)?null:{green:s.seats.reduce((e,t)=>e+t.checklist.green,0),yellow:s.seats.reduce((e,t)=>e+t.checklist.yellow,0)}:null})}),i.then(e=>{var s;return t({loops:null!=(s=null==e?void 0:e.summary)?s:null})}),d.then(e=>{var s;return t({decisions:null!=(s=null==e?void 0:e.count)?s:null,decisionTitles:e?e.titles:null})}),c.then(e=>t({merged:e})),m.then(e=>t({grid:e})),Promise.all([i,o,d,u]).then(e=>{let[s,r,l,n]=e;t({risks:s&&r&&l&&n?[...new Map([...s.risks,...r,...l.risks,...n].sort((e,t)=>Date.parse(e.at)-Date.parse(t.at)).map(e=>[e.id,e])).values()].sort((e,t)=>Date.parse(t.at)-Date.parse(e.at)||e.id.localeCompare(t.id)).slice(0,5):null})})}(m,t=>{e&&h(e=>({...e,...t}))},()=>e),()=>{e=!1}},[m]);let x=void 0===f.flow?"불러오는 중…":null===f.flow?"못 잼":"".concat(f.flow.label," \xb7 ").concat(null!=(s=f.flow.reason)?s:"사유 없음").concat(f.flow.stale?" \xb7 낡음":""),g=(null==(e=f.flow)?void 0:e.verdict)==="loop-down"||(null==(t=f.flow)?void 0:t.verdict)==="blocked"?"/loops?view=map":"/ops/resources",j=function(e){var t,s,r;let l=void 0===e.flow?d:null===e.flow?o:"".concat(e.flow.label).concat(e.flow.reason?" \xb7 ".concat(e.flow.reason):""),n=void 0===e.risks?d:null===e.risks?o:0===e.risks.length?"해당 없음":"".concat(e.risks[0].kind," \xb7 ").concat(e.risks[0].title),a=void 0===e.grid||!(r=e.grid)||r.poolReason||0===r.members.length||r.members.some(e=>null===e.occupied)?null:r.members.reduce((e,t)=>e+Math.max(0,t.capacity-t.occupied),0);return{blocked:"".concat(l," / 톱 ").concat(n),decide:void 0===e.decisions?d:null===e.decisions?o:"결정 대기 ".concat(e.decisions,"건").concat((null==(t=e.decisionTitles)?void 0:t[0])?" \xb7 ".concat(e.decisionTitles[0]):""),landed:void 0===e.merged?d:null===e.merged?o:"".concat(e.merged,"건"),spare:void 0===e.grid?d:null===a?o:"".concat(a,"칸"),heartbeat:void 0===e.grid?d:function(e){if(null==e||!Number.isFinite(e)||e<0)return o;let t=Math.round(e);return t<60?"".concat(t,"초 전"):"".concat(Math.floor(t/60),"분 전")}(null==(s=e.grid)?void 0:s.hq.ageSeconds),release:void 0===e.release?d:null===e.release?o:"green ".concat(e.release.green," \xb7 노랑 ").concat(e.release.yellow)}}({flow:f.flow,release:f.release,decisions:f.decisions,decisionTitles:f.decisionTitles,merged:f.merged,risks:f.risks,grid:f.grid});return(0,r.jsxs)("main",{className:"mx-auto w-full min-w-0 max-w-3xl px-3 py-4 text-foreground sm:px-6",children:[(0,r.jsxs)("header",{className:"mb-4",children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"운영 \xb7 오늘"}),(0,r.jsx)("h1",{className:"text-xl font-semibold",children:"대표 조망판"})]}),(0,r.jsx)("p",{"aria-label":"흐름 판정",className:"mb-3 min-w-0 truncate rounded-xl border border-border bg-card px-3 py-2 text-sm",children:void 0===f.flow||null===f.flow?x:(0,r.jsx)(n(),{href:g,className:"rounded underline-offset-4 hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:x})}),(0,r.jsxs)("div",{role:"region","aria-label":"한 화면 답",className:"mb-3 grid min-w-0 grid-cols-2 gap-2 text-xs sm:grid-cols-3 sm:gap-3",children:[(0,r.jsxs)("p",{className:"min-w-0 rounded-xl border border-border bg-card px-3 py-2",children:[(0,r.jsx)("span",{className:"block text-muted-foreground",children:"지금 막힘"}),(0,r.jsx)("span",{className:"block min-w-0 break-words font-semibold",children:j.blocked})]}),(0,r.jsxs)("p",{className:"min-w-0 rounded-xl border border-border bg-card px-3 py-2",children:[(0,r.jsx)("span",{className:"block text-muted-foreground",children:"결정해야 함"}),(0,r.jsx)("span",{className:"block font-semibold tabular-nums",children:j.decide}),(0,r.jsx)(n(),{href:"/decisions",className:"mt-1 block min-w-0 break-words rounded text-[11px] text-muted-foreground underline underline-offset-4 hover:text-foreground",children:"결정 카드 열기 →"})]}),(0,r.jsxs)("p",{className:"min-w-0 rounded-xl border border-border bg-card px-3 py-2",children:[(0,r.jsx)("span",{className:"block text-muted-foreground",children:"오늘 착지"}),(0,r.jsx)("span",{className:"block font-semibold tabular-nums",children:j.landed})]}),(0,r.jsxs)("p",{className:"min-w-0 rounded-xl border border-border bg-card px-3 py-2",children:[(0,r.jsx)("span",{className:"block text-muted-foreground",children:"예비\xb7하트비트"}),(0,r.jsxs)("span",{className:"block min-w-0 break-words font-semibold tabular-nums",children:["예비 ",j.spare," \xb7 하트비트 ",j.heartbeat]})]}),(0,r.jsxs)("p",{className:"min-w-0 rounded-xl border border-border bg-card px-3 py-2",children:[(0,r.jsx)("span",{className:"block text-muted-foreground",children:"판"}),(0,r.jsx)("span",{className:"block font-semibold tabular-nums",children:j.release}),(0,r.jsx)(n(),{href:"/ops/release",className:"mt-1 block rounded text-[11px] text-muted-foreground underline underline-offset-4 hover:text-foreground",children:"컷\xb7발행 현황 →"})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2 sm:gap-4","aria-label":"대표 조망 카드",children:[(0,r.jsxs)(T,{title:"릴리스 판 진행",children:[void 0===f.release?"불러오는 중…":f.release?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{className:"text-emerald-600",children:["green ",f.release.green]}),(0,r.jsxs)("span",{className:"block text-amber-600",children:["노랑 ",f.release.yellow]})]}):"못 읽음",(0,r.jsx)(n(),{href:"/ops/release",className:"mt-1 block rounded text-xs font-medium text-primary underline underline-offset-4 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary","aria-label":"발행 현황 보기 — 운영 › 릴리스",children:"발행 현황 보기 →"})]}),(0,r.jsxs)(T,{title:"루프 판정",children:[void 0===f.loops?"불러오는 중…":null===f.loops?"못 읽음":0===Object.keys(f.loops).length?"등록된 일정 0":(0,r.jsx)("div",{className:"flex flex-wrap gap-1 text-xs font-medium",children:Object.entries(f.loops).map(e=>{let[t,s]=e;return(0,r.jsxs)("span",{className:"rounded-full bg-muted px-2 py-1",children:[t," ",s]},t)})}),(0,r.jsx)(n(),{href:u.D,className:"mt-1 block rounded text-xs font-medium text-primary underline underline-offset-4 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary","aria-label":"루프 상호작용 보기 — 운영 › 루프 상호작용",children:"루프 상호작용 보기 →"})]}),(0,r.jsx)(T,{title:"결정 대기 카드",children:(0,r.jsx)(n(),{href:"/decisions",className:"rounded underline underline-offset-4 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary","aria-label":"결정 대기 카드 보기",children:void 0===f.decisions?"불러오는 중…":null===f.decisions?"못 읽음":0===f.decisions?"0":(0,r.jsxs)("span",{className:"block space-y-1 text-sm font-medium",children:[(0,r.jsx)("span",{className:"block tabular-nums",children:f.decisions}),(null!=(l=f.decisionTitles)?l:[]).map(e=>(0,r.jsx)("span",{className:"block min-w-0 truncate rounded-lg bg-muted px-2 py-1",title:e,children:e},e))]})})}),(0,r.jsx)(T,{title:"오늘 병합 PR",children:void 0===f.merged?"불러오는 중…":null!=(c=f.merged)?c:"못 읽음"})]}),(0,r.jsxs)("div",{className:"mt-2 grid min-w-0 grid-cols-2 gap-2 sm:mt-4 sm:gap-4","aria-label":"위험과 그리드 카드",children:[(0,r.jsxs)("section",{"aria-label":"위험\xb7막힘 톱 5",className:"min-w-0 rounded-xl border border-border bg-card p-2 sm:p-4",children:[(0,r.jsx)("h2",{className:"text-xs font-medium text-muted-foreground sm:text-sm",children:"위험\xb7막힘 톱 5"}),void 0===f.risks?(0,r.jsx)("p",{className:"mt-2 text-sm",children:"불러오는 중…"}):null===f.risks?(0,r.jsx)("p",{className:"mt-2 text-sm",children:"못 읽음"}):0===f.risks.length?(0,r.jsx)("p",{className:"mt-2 text-sm",children:"해당 없음"}):(0,r.jsx)("ol",{className:"mt-2 space-y-1 text-xs",children:f.risks.map(e=>(0,r.jsxs)("li",{className:"min-w-0 border-b border-border pb-1 last:border-0",children:[(0,r.jsxs)("span",{className:"block text-muted-foreground",children:[e.kind," \xb7 ",(0,r.jsx)("time",{dateTime:e.at,children:e.at.slice(0,16).replace("T"," ")})]}),(0,r.jsx)("span",{className:"block truncate",title:e.title,children:e.title})]},e.id))})]}),(0,r.jsxs)("section",{"aria-label":"그리드",className:"min-w-0 rounded-xl border border-border bg-card p-2 sm:p-4",children:[(0,r.jsx)("h2",{className:"text-xs font-medium text-muted-foreground sm:text-sm",children:"그리드"}),void 0===f.grid?(0,r.jsx)("p",{className:"mt-2 text-sm",children:"불러오는 중…"}):null===f.grid?(0,r.jsx)("p",{className:"mt-2 text-sm",children:"못 읽음"}):(0,r.jsxs)("div",{className:"mt-2 space-y-2 text-xs",children:[(0,r.jsxs)("p",{className:"min-w-0 break-words",children:["본부 \xb7 ",f.grid.hq.reason?"본부 못 읽음":f.grid.hq.record?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{title:f.grid.hq.record.holder,children:f.grid.hq.record.holder}),null!==f.grid.hq.ageSeconds&&(0,r.jsxs)(r.Fragment,{children:[" \xb7 ",Math.floor(f.grid.hq.ageSeconds/60),"분 전"]}),f.grid.hq.expired&&(0,r.jsx)("span",{className:"ml-1 font-semibold text-red-600",children:"만료"})]}):"임대 없음"]}),f.grid.poolReason&&(0,r.jsxs)("p",{className:"break-words text-amber-700",title:f.grid.poolReason,children:["풀 못 읽음 \xb7 ",f.grid.poolReason.slice(0,40)]}),(0,r.jsx)("ul",{className:"space-y-1",children:f.grid.members.map(e=>{var t;return(0,r.jsxs)("li",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-1",children:[(0,r.jsx)("span",{className:"min-w-0 truncate",title:e.context,children:e.context}),(0,r.jsx)("span",{className:"shrink-0 tabular-nums",children:null===e.occupied?"측정 불가":"".concat(e.occupied,"/").concat(e.capacity)})]}),(0,r.jsx)("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",role:"meter","aria-label":"".concat(e.context," 칸 사용"),"aria-valuemin":0,"aria-valuemax":Math.max(e.capacity,null!=(t=e.occupied)?t:0,1),...null===e.occupied?{}:{"aria-valuenow":e.occupied},children:null!==e.occupied&&(0,r.jsx)("div",{className:"h-full rounded-full bg-emerald-600",style:{width:"".concat(e.capacity>0?Math.min(100,Math.max(0,e.occupied/e.capacity*100)):0,"%")}})})]},e.context)})}),(0,r.jsxs)("p",{className:"font-medium tabular-nums",children:["칸 사용 ",f.grid.poolReason||f.grid.members.some(e=>null===e.occupied)?"측정 불가":f.grid.members.reduce((e,t)=>e+t.occupied,0),"/",f.grid.members.reduce((e,t)=>e+t.capacity,0)]})]})]}),(0,r.jsx)(v,{value:f.drafts})]})]})}}},e=>{e.O(0,[1596,7648,8987,4306,3702,7358],()=>e(e.s=47764)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8457],{13586:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(89570).A)("hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]])},24169:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(89570).A)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]])},26496:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(89570).A)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]])},40336:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(89570).A)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]])},44227:(e,t,r)=>{Promise.resolve().then(r.bind(r,33461))},58402:(e,t,r)=>{"use strict";r.d(t,{p:()=>n});var i=r(17594);r(48082);var l=r(17051),a=r(273);function n(e){let{className:t,type:r,...n}=e;return(0,i.jsx)(l.p,{type:r,"data-slot":"input",className:(0,a.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...n})}},58813:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(89570).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},59884:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(89570).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},84977:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(89570).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},89570:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var i=r(48082);let l=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()},a=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,i.createContext)({}),d=(0,i.forwardRef)((e,t)=>{var r,a,d;let{color:c,size:u,strokeWidth:o,absoluteStrokeWidth:h,className:p="",children:y,iconNode:k,...f}=e,{size:v=24,strokeWidth:g=2,absoluteStrokeWidth:b=!1,color:m="currentColor",className:x=""}=null!=(r=(0,i.useContext)(s))?r:{},w=(null!=h?h:b)?24*Number(null!=o?o:g)/Number(null!=u?u:v):null!=o?o:g;return(0,i.createElement)("svg",{ref:t,...n,width:null!=(a=null!=u?u:v)?a:n.width,height:null!=(d=null!=u?u:v)?d:n.height,stroke:null!=c?c:m,strokeWidth:w,className:l("lucide",x,p),...!y&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(f)&&{"aria-hidden":"true"},...f},[...k.map(e=>{let[t,r]=e;return(0,i.createElement)(t,r)}),...Array.isArray(y)?y:[y]])}),c=(e,t)=>{let r=(0,i.forwardRef)((r,n)=>{let{className:s,...c}=r;return(0,i.createElement)(d,{ref:n,iconNode:t,className:l("lucide-".concat(a(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),"lucide-".concat(e),s),...c})});return r.displayName=a(e),r}}},e=>{e.O(0,[1695,8414,1596,5457,7051,1226,5017,7648,8987,3135,2785,6761,4450,5927,3461,4306,3702,7358],()=>e(e.s=44227)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2580],{273:(e,t,r)=>{"use strict";r.d(t,{cn:()=>s});var a=r(86922),n=r(34558);function s(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.QP)((0,a.$)(t))}},6640:(e,t,r)=>{Promise.resolve().then(r.bind(r,99213))},15249:(e,t,r)=>{"use strict";r.d(t,{Zr:()=>o,f6:()=>n,oD:()=>s});let a="elanous.daemon.sessionId";function n(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"s-".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,10))}function s(){let e=function(){let e=new URLSearchParams(window.location.search).get("session");return e?(localStorage.setItem(a,e),e):localStorage.getItem(a)}();if(e)return e;let t=n();return localStorage.setItem(a,t),t}function o(){let e=n();return localStorage.setItem(a,e),e}},58274:(e,t,r)=>{"use strict";r.d(t,{$:()=>l});var a=r(17594),n=r(39515),s=r(34796),o=r(273);let i=(0,s.F)("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"}});function l(e){let{className:t,variant:r="default",size:s="default",...l}=e;return(0,a.jsx)(n.$,{"data-slot":"button",className:(0,o.cn)(i({variant:r,size:s,className:t})),...l})}},58402:(e,t,r)=>{"use strict";r.d(t,{p:()=>o});var a=r(17594);r(48082);var n=r(17051),s=r(273);function o(e){let{className:t,type:r,...o}=e;return(0,a.jsx)(n.p,{type:r,"data-slot":"input",className:(0,s.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...o})}},87691:(e,t,r)=>{"use strict";r.d(t,{C:()=>d,DaemonProvider:()=>c,Q:()=>u});var a=r(17594),n=r(48082),s=r(87338),o=r(15249),i=r(47648),l=r(91659);let d=(0,n.createContext)(null);function c(e){let{children:t}=e,r={baseUrl:"",token:"",provider:""},[c,u]=(0,n.useState)(r),[p,m]=(0,n.useState)(""),[g]=(0,n.useState)(()=>new i.ki(r));(0,n.useEffect)(()=>{let e=(0,s.Fp)();u(e),g.updateConfig(e),m((0,o.oD)()),(0,l.cY)("webterm.provider.daemon.init",{baseUrl:e.baseUrl,hasToken:!!e.token})},[g]),(0,n.useEffect)(()=>{let e=e=>{if("elanous.daemon.token"===e.key||"elanous.nexus.baseUrl"===e.key){let t=(0,s.Fp)();g.updateConfig(t),u(t),(0,l.cY)("webterm.provider.daemon.config-cross-tab",{key:e.key,hasToken:!!t.token});return}"elanous.daemon.sessionId"===e.key&&e.newValue&&m(t=>t===e.newValue?t:((0,l.cY)("webterm.provider.daemon.session-cross-tab",{previous:t||"(empty)",next:e.newValue}),e.newValue))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[g]);let x=e=>{u(t=>{let r={...t,...e};return(0,s.Qc)(e),g.updateConfig(r),(0,l.cY)("webterm.provider.daemon.config-update",{keys:Object.keys(e)}),r})},v=e=>{m(e),localStorage.setItem("elanous.daemon.sessionId",e),(0,l.cY)("webterm.provider.daemon.session-set",{sessionId:e})},f=(0,n.useMemo)(()=>({config:c,setConfig:x,client:g,sessionId:p,setSessionId:v}),[c,g,p]);return(0,a.jsx)(d.Provider,{value:f,children:t})}function u(){let e=(0,n.useContext)(d);if(!e)throw Error("useDaemon must be used inside <DaemonProvider>");return e}},91293:(e,t,r)=>{"use strict";r.d(t,{U:()=>m});var a=r(17594),n=r(48082),s=r(87691),o=r(58274),i=r(58402);function l(e){let{items:t}=e;return 0===t.length?(0,a.jsx)("div",{className:"rounded-lg border border-dashed border-border p-6 text-center text-sm text-muted-foreground",children:"No control signals matched the current filter."}):(0,a.jsx)("ul",{className:"space-y-2",children:t.map((e,t)=>{var r,n,s,o,i;let l=[(null==(r=e.scope)?void 0:r.surface)&&"surface=".concat(e.scope.surface),(null==(n=e.scope)?void 0:n.channel)&&"channel=".concat(e.scope.channel),(null==(s=e.scope)?void 0:s.sessionId)&&"session=".concat(e.scope.sessionId)].filter(Boolean).join(" \xb7 ")||"unscoped";return(0,a.jsxs)("li",{className:"rounded-lg border border-border bg-card p-3 shadow-sm",children:[(0,a.jsxs)("div",{className:"text-sm font-medium",children:[e.kind," \xb7 ",e.urgency]}),(0,a.jsxs)("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground",children:[function(e){let t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?"".concat(Math.floor(t/6e4),"m ago"):t<864e5?"".concat(Math.floor(t/36e5),"h ago"):"".concat(Math.floor(t/864e5),"d ago")}(e.createdAt)," \xb7 ",null!=(o=e.source)?o:"unknown"," \xb7 ",l]}),(0,a.jsx)("pre",{className:"mt-2 overflow-x-auto rounded-md bg-muted p-2 text-[11px]",children:JSON.stringify(null!=(i=e.payload)?i:{},null,2)})]},t)})})}let d=["background","quick-pass","normal","priority","critical"];class c{async list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new URLSearchParams;Object.entries(e).forEach(e=>{let[r,a]=e;a&&t.set(r,a)});let r=t.toString();return this.client.fetchJson("/v1/control-signals".concat(r?"?".concat(r):""))}emit(e){return this.client.fetchJson("/v1/control-signals",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})}constructor(e){this.client=e}}var u=r(95457),p=r(91659);function m(){var e,t,r,m;let{client:g}=(0,s.Q)(),x=(0,n.useMemo)(()=>new c(g),[g]),[v,f]=(0,n.useState)({items:[]}),[b,h]=(0,n.useState)(!1),[y,w]=(0,n.useState)(""),[k,j]=(0,n.useState)(""),[N,S]=(0,n.useState)(""),[C,z]=(0,n.useState)(""),[I,E]=(0,n.useState)(""),[U,D]=(0,n.useState)(""),[_,O]=(0,n.useState)("normal"),[P,J]=(0,n.useState)("operator"),[R,Y]=(0,n.useState)(""),[M,V]=(0,n.useState)(""),[$,F]=(0,n.useState)(""),[L,Q]=(0,n.useState)(""),[T,q]=(0,n.useState)(!1),A=(0,n.useCallback)(async()=>{(0,p.cY)("webterm.control.list.refresh",{kind:y,surface:k,minUrgency:N,sessionId:C,limit:I}),h(!0);try{let e=await x.list({kind:y||void 0,surface:k||void 0,minUrgency:N||void 0,sessionId:C||void 0,limit:I||void 0});f(e)}catch(e){u.oR.error("signals list failed: ".concat(e instanceof Error?e.message:e))}finally{h(!1)}},[x,y,k,N,C,I]);(0,n.useEffect)(()=>{A()},[A]);let B=async e=>{if(e.preventDefault(),!U.trim())return void u.oR.error("kind required");let t={};if(L.trim())try{t=JSON.parse(L)}catch(e){u.oR.error("payload must be valid JSON");return}let r={kind:U.trim(),urgency:_,source:P.trim()||"operator",mayPreempt:T,payload:t,scope:{...R?{surface:R}:{},...M?{channel:M}:{},...$?{sessionId:$}:{}}};(0,p.cY)("webterm.control.emit",{kind:r.kind,urgency:r.urgency});try{h(!0),await x.emit(r),u.oR.success("signal emitted"),Q(""),await A()}catch(e){u.oR.error("emit failed: ".concat(e instanceof Error?e.message:e))}finally{h(!1)}},K=null!=(e=v.countsByKind)?e:{};return(0,a.jsxs)("div",{className:"mx-auto max-w-5xl space-y-4 p-4",children:[(0,a.jsxs)("header",{className:"space-y-2",children:[(0,a.jsx)("h1",{className:"text-xl font-semibold tracking-tight",children:"Control signals"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 text-[11px] text-muted-foreground",children:[(0,a.jsxs)("span",{className:"rounded-full border border-border px-2 py-0.5",children:["total ",null!=(t=v.total)?t:0]}),(0,a.jsxs)("span",{className:"rounded-full border border-border px-2 py-0.5",children:["latest ",null!=(r=v.latest)?r:"-"]}),Object.entries(K).map(e=>{let[t,r]=e;return(0,a.jsxs)("span",{className:"rounded-full border border-border px-2 py-0.5",children:[t," ",r]},t)})]})]}),(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),A()},className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-card p-3 shadow-sm",children:[(0,a.jsx)(i.p,{value:y,onChange:e=>w(e.target.value),placeholder:"kind",className:"flex-1 min-w-[140px]"}),(0,a.jsx)(i.p,{value:k,onChange:e=>j(e.target.value),placeholder:"surface",className:"flex-1 min-w-[140px]"}),(0,a.jsxs)("select",{value:N,onChange:e=>S(e.target.value),className:"h-9 flex-1 min-w-[170px] rounded-md border border-input bg-background px-2 text-sm",children:[(0,a.jsx)("option",{value:"",children:"min urgency (any)"}),d.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),(0,a.jsx)(i.p,{value:C,onChange:e=>z(e.target.value),placeholder:"session id",className:"flex-1 min-w-[140px]"}),(0,a.jsx)(i.p,{value:I,onChange:e=>E(e.target.value),placeholder:"limit",type:"number",className:"w-[100px]"}),(0,a.jsx)(o.$,{type:"submit",size:"sm",disabled:b,children:"Filter"})]}),(0,a.jsxs)("form",{onSubmit:B,className:"space-y-2 rounded-lg border border-border bg-card p-3 shadow-sm",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"Emit a signal"}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(i.p,{value:U,onChange:e=>D(e.target.value),placeholder:"kind (required)",className:"flex-1 min-w-[140px]"}),(0,a.jsx)("select",{value:_,onChange:e=>{let t=e.target.value;"string"==typeof t&&d.includes(t)&&O(t)},className:"h-9 rounded-md border border-input bg-background px-2 text-sm",children:d.map(e=>(0,a.jsx)("option",{value:e,children:e},e))}),(0,a.jsx)(i.p,{value:P,onChange:e=>J(e.target.value),placeholder:"source",className:"flex-1 min-w-[120px]"}),(0,a.jsx)(i.p,{value:R,onChange:e=>Y(e.target.value),placeholder:"scope.surface",className:"flex-1 min-w-[120px]"}),(0,a.jsx)(i.p,{value:M,onChange:e=>V(e.target.value),placeholder:"scope.channel",className:"flex-1 min-w-[120px]"}),(0,a.jsx)(i.p,{value:$,onChange:e=>F(e.target.value),placeholder:"scope.session",className:"flex-1 min-w-[120px]"}),(0,a.jsxs)("label",{className:"flex items-center gap-1.5 text-xs",children:[(0,a.jsx)("input",{type:"checkbox",checked:T,onChange:e=>q(e.target.checked)}),"mayPreempt"]})]}),(0,a.jsx)("textarea",{value:L,onChange:e=>Q(e.target.value),placeholder:'payload JSON (optional, e.g. {"reason":"manual"})',rows:3,className:"w-full resize-y rounded-md border border-input bg-background px-3 py-2 font-mono text-xs"}),(0,a.jsx)(o.$,{type:"submit",size:"sm",disabled:b,children:"Emit"})]}),(0,a.jsx)(l,{items:null!=(m=v.items)?m:[]})]})}},99213:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>s});var a=r(17594),n=r(91293);function s(){return(0,a.jsx)(n.U,{})}}},e=>{e.O(0,[1695,8414,5457,7051,7648,4306,3702,7358],()=>e(e.s=6640)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6348],{3060:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(89570).A)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},17650:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(89570).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},27486:(e,t,s)=>{"use strict";s.d(t,{AF:()=>r});let r={all:["nexus"],health:()=>[...r.all,"health"],snapshot:()=>[...r.all,"snapshot"],tabs:e=>e?[...r.all,"tabs",{kind:e}]:[...r.all,"tabs"],tab:e=>[...r.all,"tab",e],templates:()=>[...r.all,"templates"],template:e=>[...r.all,"template",e],config:()=>[...r.all,"config"],switches:()=>[...r.all,"switches"],switch:e=>[...r.all,"switch",e],secrets:()=>[...r.all,"secrets"],bindingChannels:()=>[...r.all,"bindings","channels"],bindings:e=>[...r.all,"bindings",e],binding:(e,t)=>[...r.all,"binding",e,t],logsTail:(e,t)=>t?[...r.all,"logs",e,{lines:t}]:[...r.all,"logs",e],workflows:()=>[...r.all,"workflows"],workflow:e=>[...r.all,"workflow",e],workflowRun:e=>[...r.all,"workflow-run",e],workflowRuns:()=>[...r.all,"workflow-runs"],pendingApprovals:()=>[...r.all,"workflow-pending-approvals"],platforms:()=>[...r.all,"platforms"],providers:()=>[...r.all,"providers"],worktrees:()=>[...r.all,"worktrees"],designCheck:()=>[...r.all,"design-check"],designPreviews:()=>[...r.all,"design-previews"],designPreview:e=>[...r.all,"design-preview",e],registryCatalog:()=>[...r.all,"registry-catalog"],resolvedView:()=>[...r.all,"resolved-view"]};r.snapshot(),r.tabs(),r.health(),r.snapshot(),r.config(),r.switches()},41192:(e,t,s)=>{Promise.resolve().then(s.bind(s,92554))},44928:(e,t,s)=>{"use strict";s.d(t,{Qb:()=>a,SI:()=>o,dJ:()=>l});let r="elanous:auth-required",n=null,i=!1;function a(e){null===n&&(n=e,window.dispatchEvent(new CustomEvent(r,{detail:{path:e}})))}function l(e){let t=window,s=t=>e(t.detail);return t.addEventListener(r,s),null===n||i||e({path:n}),()=>t.removeEventListener(r,s)}function o(){i=!0}},46982:(e,t,s)=>{"use strict";s.d(t,{M1:()=>c,Qj:()=>d,tI:()=>o});var r=s(17594),n=s(48082),i=s(67384),a=s(34585);let l=(0,n.createContext)(null);function o(e){let{client:t,queryClient:s,defaultStaleTimeMs:o,children:c}=e,d=(0,n.useMemo)(()=>null!=s?s:new i.E({defaultOptions:{queries:{staleTime:null!=o?o:2e3,refetchOnWindowFocus:!1}}}),[s,o]);return(0,r.jsx)(l.Provider,{value:t,children:(0,r.jsx)(a.Ht,{client:d,children:c})})}function c(){let e=(0,n.useContext)(l);if(!e)throw Error("useNexusClient must be used within <NexusProvider>");return e}function d(){return(0,n.useContext)(l)}},49758:(e,t,s)=>{"use strict";s.d(t,{n:()=>d});var r=s(48082),n=s(29790),i=s(8879),a=s(84440),l=s(73906),o=class extends a.Q{#e;#t=void 0;#s;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,l.f8)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,l.EN)(t.mutationKey)!==(0,l.EN)(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(e){this.#n(),this.#i(e)}getCurrentResult(){return this.#t}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#n(),this.#i()}mutate(e,t){return this.#r=t,this.#s?.removeObserver(this),this.#s=this.#e.getMutationCache().build(this.#e,this.options),this.#s.addObserver(this),this.#s.execute(e)}#n(){let e=this.#s?.state??(0,n.$)();this.#t={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#i(e){i.jG.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,s=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#r.onSuccess?.(e.data,t,s,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,s,r)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#r.onError?.(e.error,t,s,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,s,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},c=s(34585);function d(e,t){let s=(0,c.jE)(t),[n]=r.useState(()=>new o(s,e));r.useEffect(()=>{n.setOptions(e)},[n,e]);let a=r.useSyncExternalStore(r.useCallback(e=>n.subscribe(i.jG.batchCalls(e)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),d=r.useCallback((e,t)=>{n.mutate(e,t).catch(l.lQ)},[n]);if(a.error&&(0,l.GU)(n.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:d,mutateAsync:a.mutate}}},65661:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(89570).A)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},68557:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(89570).A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},89570:(e,t,s)=>{"use strict";s.d(t,{A:()=>c});var r=s(48082);let n=function(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return t.filter((e,t,s)=>!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim()},i=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,s)=>s?s.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,r.createContext)({}),o=(0,r.forwardRef)((e,t)=>{var s,i,o;let{color:c,size:d,strokeWidth:u,absoluteStrokeWidth:h,className:m="",children:p,iconNode:f,...g}=e,{size:x=24,strokeWidth:b=2,absoluteStrokeWidth:y=!1,color:v="currentColor",className:w=""}=null!=(s=(0,r.useContext)(l))?s:{},k=(null!=h?h:y)?24*Number(null!=u?u:b)/Number(null!=d?d:x):null!=u?u:b;return(0,r.createElement)("svg",{ref:t,...a,width:null!=(i=null!=d?d:x)?i:a.width,height:null!=(o=null!=d?d:x)?o:a.height,stroke:null!=c?c:v,strokeWidth:k,className:n("lucide",w,m),...!p&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(g)&&{"aria-hidden":"true"},...g},[...f.map(e=>{let[t,s]=e;return(0,r.createElement)(t,s)}),...Array.isArray(p)?p:[p]])}),c=(e,t)=>{let s=(0,r.forwardRef)((s,a)=>{let{className:l,...c}=s;return(0,r.createElement)(o,{ref:a,iconNode:t,className:n("lucide-".concat(i(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),"lucide-".concat(e),l),...c})});return s.displayName=i(e),s}},91659:(e,t,s)=>{"use strict";let r;s.d(t,{cY:()=>d,x8:()=>l});let n={debug:0,info:1,warn:2,error:3},i="/v1/debug-logs/batch",a=null;function l(e){a=e}class o{health(){return{pending:this.queue.length,consecutiveFailures:this.consecutiveFailures,lastOkAt:this.lastOkAt,droppedByCap:this.droppedByCap,fallbackBatches:this.fallbackBatches}}push(e){if(!(n[function(e){let t=e.slice(e.lastIndexOf(".")+1).toLowerCase();return/^(error|exception|crash|fail|failed)$/.test(t)?"error":/^(warn|degraded|timeout)$/.test(t)?"warn":/^(boot|ready|start|begin|open|ok|done|resolve|end|stop|close)$/.test(t)?"info":"debug"}(e.category)]<n[this.minLevel])){if(this.queue.push(e),this.queue.length>500){let e=this.queue.length-500;this.droppedByCap+=e,this.queue.splice(0,e)}if(this.queue.length>=100&&!this.inFlight){null!==this.timer&&(clearTimeout(this.timer),this.timer=null),this.flush();return}null===this.timer&&(this.timer=setTimeout(()=>{this.flush()},this.flushMs))}}async flush(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.inFlight||0===this.queue.length)return;let e=this.queue.slice(0,100);this.inFlight=!0;let t=!1,s=JSON.stringify({records:e});try{var r,n;t=await (r=this.fetchFn(s),n=this.postTimeoutMs,new Promise((e,t)=>{let s=setTimeout(()=>t(Error("debug-forward timeout after ".concat(n,"ms"))),n);r.then(t=>{clearTimeout(s),e(t)},e=>{clearTimeout(s),t(e)})}))}catch(e){t=!1}finally{this.inFlight=!1}if(!t){if(this.consecutiveFailures+=1,this.consecutiveFailures>=2&&a)try{await a(JSON.stringify({records:[...e,this.blockedNotice()]}))&&(this.fallbackBatches+=1)}catch(e){}this.wasFailing=!0,this.scheduleRetry();return}let i=this.lastOkAt;this.lastOkAt=Date.now();let l=this.consecutiveFailures;this.consecutiveFailures=0,this.queue.splice(0,e.length),this.wasFailing&&(this.wasFailing=!1,this.queue.push({ts:new Date().toISOString(),category:"pwa.debug-forwarder.recovered",event:"recovered",data:{consecutiveFailures:l,droppedByCap:this.droppedByCap,fallbackBatches:this.fallbackBatches,pending:this.queue.length,previousOkAt:i},source:{platform:"pwa"}})),this.queue.length>0&&null===this.timer&&(this.timer=setTimeout(()=>{this.flush()},this.flushMs))}scheduleRetry(){if(null!==this.timer||0===this.queue.length)return;let e=Math.min(this.flushMs*2**this.consecutiveFailures,3e4);this.timer=setTimeout(()=>{this.flush()},e)}blockedNotice(){return{ts:new Date().toISOString(),category:"pwa.debug-forwarder.http-blocked",event:"http-blocked",data:{consecutiveFailures:this.consecutiveFailures,pending:this.queue.length,droppedByCap:this.droppedByCap,lastOkAt:this.lastOkAt,via:"acp-fallback"},source:{platform:"pwa"}}}beaconFlush(){if(0!==this.queue.length)try{if("undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon){let e=this.queue.slice(0,100),t=new Blob([JSON.stringify({records:e})],{type:"application/json"});navigator.sendBeacon(i,t)&&this.queue.splice(0,e.length)}}catch(e){}}get pending(){return this.queue.length}constructor(e=c,t="debug",s=1e4,r=100){this.fetchFn=e,this.minLevel=t,this.postTimeoutMs=s,this.flushMs=r,this.queue=[],this.timer=null,this.inFlight=!1,this.consecutiveFailures=0,this.lastOkAt=null,this.droppedByCap=0,this.fallbackBatches=0,this.wasFailing=!1}}async function c(e){return(await fetch(i,{method:"POST",headers:{"content-type":"application/json"},body:e,keepalive:!0,..."undefined"!=typeof AbortSignal&&"function"==typeof AbortSignal.timeout?{signal:AbortSignal.timeout(1e4)}:{}})).ok}function d(e,t){if("undefined"==typeof console)return;let s=new Date().toISOString();if(void 0!==t){let r="";try{let e=new WeakSet;r=JSON.stringify(t,(t,s)=>{if("bigint"==typeof s)return"".concat(s.toString(),"n");if("function"==typeof s)return"[fn ".concat(s.name||"anon","]");if(s&&"object"==typeof s){if(e.has(s))return"[circular]";e.add(s)}return s})}catch(e){r="[unserializable: ".concat(String(e),"]")}r&&r.length>800&&(r=r.slice(0,797)+"..."),console.debug("[".concat(s,"] ").concat(e," ").concat(r),t),u(s,e,r)}else console.debug("[".concat(s,"] ").concat(e)),u(s,e,void 0)}function u(e,t,s){let n,i=function(){if(void 0!==r)return r;let e=function(){try{let e="off"!==window.localStorage.getItem("elanous.pwa.debug.forward"),t=window.localStorage.getItem("elanous.pwa.debug.forwardLevel");return{forward:e,level:"info"===t||"warn"===t||"error"===t?t:"debug"}}catch(e){return{forward:!0,level:"debug"}}}();if(!e.forward)return r=null,null;let t=new o(c,e.level,1e4,1500);try{window.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&t.beaconFlush()})}catch(e){}return r=t,t}();if(!i)return;let a=t.slice(t.lastIndexOf(".")+1)||t;if(void 0!==s&&""!==s)try{n=JSON.parse(s)}catch(e){n=s}i.push({ts:e,category:t,event:a,...void 0!==n?{data:n}:{},source:{platform:"pwa"}})}},92554:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>E});var r=s(17594),n=s(3060),i=s(17650);let a=(0,s(89570).A)("circle-dashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]);var l=s(65661),o=s(68557),c=s(48082),d=s(46982),u=s(74055),h=s(34585),m=s(49758),p=s(27486),f=s(67307);function g(e){let{available:t,declared:s,onPick:n,pendingId:i,previews:a,onPreview:l}=e,{systems:o,themes:c}=function(e){let t=[],s=[];for(let r of e)("design-system"===r.source?t:s).push(r);return{systems:t,themes:s}}(t);return(0,r.jsxs)("div",{className:"space-y-4",children:[o.length>0&&(0,r.jsx)(x,{title:"Design systems",hint:"Web \xb7 copies tokens.css and DESIGN.md into design/system/",items:o,declared:s,onPick:n,pendingId:i,previews:a,onPreview:l}),c.length>0&&(0,r.jsx)(x,{title:"Terminal themes",hint:"One line in DESIGN.md",items:c,declared:s,onPick:n,pendingId:i,previews:a,onPreview:l})]})}function x(e){let{title:t,hint:s,items:n,declared:i,onPick:a,pendingId:l,previews:o,onPreview:c}=e;return(0,r.jsxs)("section",{className:"space-y-2","aria-label":t,children:[(0,r.jsxs)("h3",{className:"flex items-baseline gap-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:[t,(0,r.jsxs)("span",{className:"normal-case tracking-normal",children:[n.length," \xb7 ",s]})]}),(0,r.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:n.map(e=>(0,r.jsx)(b,{direction:e,chosen:e.id===i,onPick:a,pending:l===e.id,busy:null!==l,hasPreview:(null==o?void 0:o.has(e.id))===!0&&void 0!==c,onPreview:c},e.id))})]})}function b(e){var t,s,n,a,l,o,c,d,u;let{direction:h,chosen:m,onPick:p,pending:f,busy:g,hasPreview:x,onPreview:b}=e,y=null!=(n=h.swatch.bg)?n:h.isDark?"#111111":"#ffffff",v=null!=(a=h.swatch.fg)?a:h.swatch.text,w=null!=(o=null!=(l=null==(t=h.typography)?void 0:t.display)?l:null==(s=h.typography)?void 0:s.body)?o:null;return(0,r.jsxs)("li",{"data-direction":h.id,"data-direction-id":h.id,className:"flex flex-col gap-2 rounded-md border p-3 text-sm ".concat(m?"border-primary ring-1 ring-primary":""),children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5","aria-hidden":!0,children:[[y,v,h.swatch.accent].map((e,t)=>(0,r.jsx)("span",{className:"h-5 w-5 rounded-full border",style:{backgroundColor:e,borderColor:h.swatch.muted}},t)),h.category&&(0,r.jsx)("span",{className:"ml-auto truncate text-[11px] text-muted-foreground",children:h.category})]}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("p",{className:"truncate font-medium",children:null!=(c=h.label)?c:h.id}),(0,r.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[(0,r.jsx)("code",{children:h.id}),w?" \xb7 ".concat(w):""]}),(0,r.jsx)("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:h.mood})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,r.jsx)("button",{type:"button",onClick:()=>null==b?void 0:b(h.id),className:"self-start rounded-md border px-2.5 py-1 text-xs hover:bg-muted","aria-label":"Preview ".concat(null!=(d=h.label)?d:h.id),children:"Preview"}),m?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-primary",children:[(0,r.jsx)(i.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Selected"]}):(0,r.jsx)("button",{type:"button",disabled:g,onClick:()=>p(h.id),className:"self-start rounded-md border px-2.5 py-1 text-xs hover:bg-muted disabled:opacity-50","aria-label":"Select ".concat(null!=(u=h.label)?u:h.id),children:f?"Selecting…":"Select"})]})]})}let y=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function v(e){return e.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean)}function w(e,t){if("undefined"==typeof document)return t;let s=document.getElementById(e);return s&&"value"in s&&"string"==typeof s.value?s.value:t}function k(e){let{onCreate:t,onSelect:s,pending:n,result:i,error:a}=e,[l,o]=(0,c.useState)("url"),[d,u]=(0,c.useState)(""),[h,m]=(0,c.useState)(""),[p,f]=(0,c.useState)(""),g=v(h).filter(e=>y.test(e)),x=v(h).length,b=x>=2&&x<=6&&p.trim().length>0&&g.length===x;return(0,r.jsxs)("section",{className:"rounded-md border p-3","aria-label":"Make my system","data-make-my-system":"",children:[(0,r.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,r.jsx)("h3",{className:"text-sm font-medium",children:"Make my system"}),(0,r.jsxs)("div",{className:"flex gap-1",role:"tablist",children:[(0,r.jsx)("button",{type:"button",role:"tab","aria-selected":"url"===l,className:"rounded-md px-2 py-1 text-xs ".concat("url"===l?"bg-muted":""),onClick:()=>o("url"),children:"From a website"}),(0,r.jsx)("button",{type:"button",role:"tab","aria-selected":"colors"===l,className:"rounded-md px-2 py-1 text-xs ".concat("colors"===l?"bg-muted":""),onClick:()=>o("colors"),children:"From colors"})]})]}),(0,r.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"Reference, not a copy — logos, names, images and text are not taken."}),"url"===l?(0,r.jsxs)("form",{className:"mt-2 flex flex-col gap-2 sm:flex-row",onSubmit:e=>{e.preventDefault();let s=d.trim();s&&!n&&t({kind:"url",url:s})},children:[(0,r.jsx)("label",{className:"sr-only",htmlFor:"make-system-url",children:"Website URL"}),(0,r.jsx)("input",{id:"make-system-url",type:"url",value:d,disabled:n,placeholder:"https://example.com",onChange:e=>u(e.target.value),className:"min-w-0 flex-1 rounded-md border bg-transparent px-2 py-1.5 text-sm"}),(0,r.jsx)("button",{type:"button",disabled:n,onClick:()=>{let e=w("make-system-url",d).trim();e&&!n&&t({kind:"url",url:e})},className:"rounded-md border px-3 py-1.5 text-sm hover:bg-muted disabled:opacity-50",children:n?"Measuring…":"Make it"})]}):(0,r.jsxs)("form",{className:"mt-2 space-y-2",onSubmit:e=>{e.preventDefault(),b&&!n&&t({kind:"palette",colors:g,id:p.trim()})},children:[(0,r.jsx)("label",{className:"block text-xs text-muted-foreground",htmlFor:"make-system-colors",children:"2–6 colors"}),(0,r.jsx)("input",{id:"make-system-colors",value:h,disabled:n,placeholder:"#f4efe6, #1f3a2e, #c8553d",onChange:e=>m(e.target.value),className:"w-full rounded-md border bg-transparent px-2 py-1.5 text-sm"}),g.length>0&&(0,r.jsx)("ul",{className:"flex gap-1","aria-label":"Color preview",children:g.map(e=>(0,r.jsx)("li",{className:"h-6 w-6 rounded-sm border",style:{backgroundColor:e},title:e},e))}),(0,r.jsx)("label",{className:"block text-xs text-muted-foreground",htmlFor:"make-system-id",children:"id"}),(0,r.jsx)("input",{id:"make-system-id",value:p,disabled:n,placeholder:"stumptowncoffee",onChange:e=>f(e.target.value),className:"w-full rounded-md border bg-transparent px-2 py-1.5 text-sm"}),(0,r.jsx)("button",{type:"button",disabled:n,onClick:()=>{let e=v(w("make-system-colors",h)).filter(e=>y.test(e)),s=w("make-system-id",p).trim();n||e.length<2||e.length>6||0===s.length||t({kind:"palette",colors:e,id:s})},className:"rounded-md border px-3 py-1.5 text-sm hover:bg-muted disabled:opacity-50",children:n?"Measuring…":"Make it"})]}),n&&(0,r.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Measuring…"}),a&&(0,r.jsx)("p",{className:"mt-2 text-sm text-error",role:"alert",children:a}),i&&(0,r.jsxs)("div",{className:"mt-2 space-y-1 text-sm",children:[(0,r.jsxs)("p",{children:["Made ",i.id," — ",i.tokens.length," tokens \xb7 ",i.unread," unread"]}),i.warnings.map(e=>(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:e},e)),(0,r.jsx)("button",{type:"button",onClick:()=>s(i.id),className:"rounded-md border px-2.5 py-1 text-xs hover:bg-muted",children:"Select it"})]})]})}let j={missing:"Missing",declared:"Declared",available:"Not declared"},N={missing:"bg-error/10 text-error",declared:"bg-green-600/10 text-green-700",available:"bg-muted text-muted-foreground"},S={missing:n.A,declared:i.A,available:a};function C(){return(0,d.Qj)()?(0,r.jsx)(M,{}):(0,r.jsxs)("div",{className:"mx-auto max-w-2xl space-y-2 p-6",children:[(0,r.jsx)("h1",{className:"text-xl font-semibold tracking-tight",children:"Design check"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Connect to a NEXUS daemon to see this repository's craft rulebooks."})]})}function M(){let{data:e,isLoading:t,error:s,refetch:i,isFetching:a}=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=(0,d.M1)();return(0,u.I)({queryKey:p.AF.designCheck(),queryFn:()=>s.getDesignCheck(),enabled:null==(e=t.enabled)||e,refetchInterval:3e4})}();return(0,r.jsxs)("div",{className:"mx-auto max-w-3xl space-y-4 p-6",children:[(0,r.jsxs)("header",{className:"flex items-start justify-between gap-4",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)("h1",{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[(0,r.jsx)(l.A,{className:"h-5 w-5","aria-hidden":!0}),"Design check"]}),(0,r.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Craft rulebooks declared by this repository's ",(0,r.jsx)("code",{children:"DESIGN.md"}),"."]})]}),(0,r.jsxs)("button",{type:"button",onClick:()=>void i(),className:"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm hover:bg-muted","aria-label":"Refresh design check",children:[(0,r.jsx)(o.A,{className:"h-4 w-4 ".concat(a?"animate-spin":""),"aria-hidden":!0}),"Refresh"]})]}),t&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading…"}),s&&(0,r.jsxs)("p",{className:"rounded-md bg-error/10 p-3 text-sm text-error",children:["Could not reach the daemon: ",s instanceof Error?s.message:String(s)]}),e&&!1===e.ok&&(0,r.jsxs)("div",{className:"space-y-2 rounded-md border border-warning/40 bg-warning/5 p-4",children:[(0,r.jsxs)("p",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,r.jsx)(n.A,{className:"h-4 w-4 text-warning","aria-hidden":!0}),"Design check blocked"]}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:function(e,t){switch(e){case"no-repository":return"The daemon is not running inside a git checkout, so there is no DESIGN.md to check.";case"craft-directory":return"elanous's craft rulebook directory could not be read: ".concat(null!=t?t:"(unknown path)");case"design-document":return"This repository has no readable DESIGN.md: ".concat(null!=t?t:"(unknown path)");default:return"The design check is blocked (".concat(e,").")}}(e.blockedOn,e.path)})]}),e&&!0===e.ok&&(0,r.jsx)(A,{data:e})]})}function A(e){let{data:t}=e,s=function(e){let t=new Set(e.unavailableRulebooks),s=new Map;for(let t of e.availableRulebooks)s.set(t,"available");for(let r of e.declaredRulebooks)s.set(r,t.has(r)?"missing":"declared");let r={missing:0,declared:1,available:2};return[...s.entries()].map(e=>{let[t,s]=e;return{name:t,status:s}}).sort((e,t)=>r[e.status]-r[t.status]||e.name.localeCompare(t.name))}(t),n=t.unavailableRulebooks.length;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"rounded-md p-3 text-sm ".concat(n?"bg-error/10 text-error":"bg-green-600/10 text-green-700"),children:n?"".concat(n," declared rulebook").concat(1===n?"":"s"," could not be found."):"All ".concat(t.declaredRulebooks.length," declared rulebook").concat(1===t.declaredRulebooks.length?"":"s"," resolve.")}),(0,r.jsxs)("dl",{className:"grid grid-cols-1 gap-1 text-xs text-muted-foreground sm:grid-cols-2",children:[(0,r.jsxs)("div",{className:"truncate sm:col-span-2",children:[(0,r.jsx)("dt",{className:"inline font-medium",children:"Repository: "}),(0,r.jsxs)("dd",{className:"inline",children:[(0,r.jsx)("code",{children:t.repoRoot}),t.repoSource&&(0,r.jsxs)("span",{className:"ml-1",children:["(","config"===t.repoSource?"harness.defaultRepo":"daemon folder",")"]})]})]}),(0,r.jsxs)("div",{className:"truncate",children:[(0,r.jsx)("dt",{className:"inline font-medium",children:"Document: "}),(0,r.jsx)("dd",{className:"inline",children:(0,r.jsx)("code",{children:t.documentPath})})]}),(0,r.jsxs)("div",{className:"truncate",children:[(0,r.jsx)("dt",{className:"inline font-medium",children:"Rulebooks: "}),(0,r.jsx)("dd",{className:"inline",children:(0,r.jsx)("code",{children:t.craftDirectory})})]})]}),(0,r.jsx)(O,{data:t}),0===s.length?(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"elanous ships no craft rulebooks and this document declares none."}):(0,r.jsx)("ul",{className:"divide-y rounded-md border",children:s.map(e=>{let t=S[e.status];return(0,r.jsxs)("li",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)(t,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),(0,r.jsx)("code",{children:e.name})]}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-xs ".concat(N[e.status]),children:j[e.status]})]},e.name)})})]})}function O(e){var t,s,n,i;let{data:a}=e,l=function(){let e=(0,d.M1)(),t=(0,h.jE)();return(0,m.n)({mutationFn:t=>e.setDesignDirection(t),onSuccess:()=>t.invalidateQueries({queryKey:p.AF.designCheck()})})}(),o=function(){let e=(0,d.M1)(),t=(0,h.jE)();return(0,m.n)({mutationFn:t=>e.createDesignSystem(t),onSuccess:()=>t.invalidateQueries({queryKey:p.AF.designCheck()})})}(),x=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=(0,d.M1)();return(0,u.I)({queryKey:p.AF.designPreviews(),queryFn:()=>s.listDesignPreviews(),enabled:null==(e=t.enabled)||e,refetchInterval:3e4})}(),[b,y]=(0,c.useState)(null),[v,w]=(0,c.useState)(null),j=a.directions;if((0,c.useEffect)(()=>{if(!v||!j)return;let e=document.querySelector('[data-direction-id="'.concat(v.replace(/"/g,""),'"]'));null==e||e.scrollIntoView({block:"nearest"})},[v,j]),!j)return null;let N=l.isPending&&null!=(s=l.variables)?s:null;return(0,r.jsxs)("section",{className:"space-y-2",children:[(0,r.jsx)("h2",{className:"text-sm font-medium",children:"Design direction"}),(0,r.jsx)(k,{pending:o.isPending,result:null!=(n=o.data)?n:null,error:o.isError?function(e){switch(e instanceof f.Iu&&e.body&&"object"==typeof e.body?e.body.reason:void 0){case"bad-url":return"That address is not an http or https URL.";case"bad-id":return"The id may only use lowercase letters, digits, and hyphens.";case"id-taken":return"That id is already taken.";case"extract-failed":return"The page could not be measured.";case"no-colors":return"Give between 2 and 6 colors.";case"busy":return"Another system is being made — wait for it to finish.";default:if(e instanceof f.Iu&&401===e.status)return"Only the owner can make a system — sign in first.";return"Could not make the system: ".concat(e instanceof Error?e.message:String(e))}}(o.error):null,onCreate:e=>{o.mutate(e,{onSuccess:e=>w(e.id)})},onSelect:e=>{w(e),l.mutate(e)}}),j.unavailable&&(0,r.jsxs)("p",{className:"rounded-md bg-error/10 p-2 text-sm text-error",children:["Declared direction ",(0,r.jsx)("code",{children:j.unavailable})," is not registered."]}),null===j.declared&&!j.unavailable&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"None declared — pick one below."}),l.isError&&(0,r.jsx)("p",{className:"rounded-md bg-error/10 p-2 text-sm text-error",children:function(e){switch(e instanceof f.Iu&&e.body&&"object"==typeof e.body?e.body.reason:void 0){case"unknown-direction":return"The daemon does not know this direction.";case"no-repository":return"The daemon has no repository to write to (set harness.defaultRepo).";case"conflicting-system-file":return"design/system/ already holds a file the daemon will not overwrite.";case"cannot-read":return"The DESIGN.md could not be read.";case"cannot-write":return"The DESIGN.md could not be written.";default:if(e instanceof f.Iu&&401===e.status)return"Only the owner can pick a direction — sign in first.";return"Could not set the direction: ".concat(e instanceof Error?e.message:String(e))}}(l.error)}),b&&(0,r.jsx)(F,{system:b,onClose:()=>y(null),onSelect:()=>l.mutate(b),selecting:N===b,busy:null!==N,alreadySelected:j.declared===b}),(0,r.jsx)(g,{available:j.available,declared:j.declared,pendingId:N,previews:new Set((null!=(i=null==(t=x.data)?void 0:t.previews)?i:[]).map(e=>e.system)),onPreview:e=>y(e),onPick:e=>l.mutate(e)})]})}function F(e){let{system:t,onClose:s,onSelect:n,selecting:i,busy:a,alreadySelected:l}=e,o=function(e){let t=(0,d.M1)();return(0,u.I)({queryKey:p.AF.designPreview(null!=e?e:""),queryFn:()=>t.getDesignPreview(e),enabled:null!==e&&""!==e})}(t);return(0,r.jsxs)("div",{className:"space-y-2 rounded-md border p-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("p",{className:"text-sm font-medium",children:["Preview \xb7 ",(0,r.jsx)("code",{children:t})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[l?(0,r.jsx)("span",{className:"text-xs text-primary",children:"Selected"}):(0,r.jsx)("button",{type:"button",disabled:a,onClick:n,className:"rounded-md border px-2.5 py-1 text-xs hover:bg-muted disabled:opacity-50","aria-label":"Select ".concat(t),children:i?"Selecting…":"Select"}),(0,r.jsx)("button",{type:"button",onClick:s,className:"rounded-md border px-2.5 py-1 text-xs hover:bg-muted","aria-label":"Close preview",children:"Close"})]})]}),o.isLoading&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading preview…"}),o.isError&&(0,r.jsxs)("p",{className:"text-sm text-error",children:["Could not load the preview: ",o.error instanceof Error?o.error.message:String(o.error)]}),o.data&&(0,r.jsx)("iframe",{sandbox:"",srcDoc:o.data.html,title:"Preview \xb7 ".concat(t),className:"h-80 w-full rounded-md border bg-white"})]})}function E(){return(0,r.jsx)(C,{})}}},e=>{e.O(0,[5616,4055,7307,4306,3702,7358],()=>e(e.s=41192)),_N_E=e.O()}]);
|