glimmervoid 0.48.2-next.319 → 0.48.2-next.321
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/glimmervoid.js +11 -6
- package/dist/chunks/{agent-api-cli-DD9EE5Ab.js → agent-api-cli-DGJ38W5Q.js} +68 -75
- package/dist/chunks/{agent-api-cli-Wsuo3vry.js → agent-api-cli-DIHuV81M.js} +1 -1
- package/dist/chunks/{agent-api-core-CRjUWPzJ.js → agent-api-core-CVleheDx.js} +262 -14
- package/dist/chunks/{git-version-jHhRrdeV.js → git-version-CkHaTbB0.js} +65 -48
- package/dist/chunks/{main-Dm7Kd9v3.js → main-jbvejCOW.js} +8 -4
- package/dist/chunks/{settings-cli-KJt7HSxn.js → settings-cli-Dzzh4V3t.js} +1 -1
- package/dist/chunks/{ssh-sign-cli-CCE8l4Ed.js → ssh-sign-cli-upCmSfR0.js} +1 -1
- package/dist/client/assets/{benchmark-panel-Wdv8tU38.js → benchmark-panel-DGErp-9P.js} +1 -1
- package/dist/client/assets/benchmark-panel-DGErp-9P.js.br +0 -0
- package/dist/client/assets/{boards-view-7AohGX7n.js → boards-view-zGGSvSeR.js} +1 -1
- package/dist/client/assets/boards-view-zGGSvSeR.js.br +0 -0
- package/dist/client/assets/{community-panel-sA24J0se.js → community-panel-7LNSI7f9.js} +1 -1
- package/dist/client/assets/community-panel-7LNSI7f9.js.br +0 -0
- package/dist/client/assets/{dialogs-CYJ3tkV7.js → dialogs-BAiB8PAI.js} +1 -1
- package/dist/client/assets/dialogs-BAiB8PAI.js.br +0 -0
- package/dist/client/assets/{doc-editor-ui-QbBEQHoU.js → doc-editor-ui-C8jXl10R.js} +1 -1
- package/dist/client/assets/doc-editor-ui-C8jXl10R.js.br +0 -0
- package/dist/client/assets/{feature-hint-Cnl_-8RL.js → feature-hint-e3hklcnu.js} +1 -1
- package/dist/client/assets/feature-hint-e3hklcnu.js.br +0 -0
- package/dist/client/assets/{first-run-checklist-DZajXPRH.js → first-run-checklist-DvbK1fFl.js} +1 -1
- package/dist/client/assets/first-run-checklist-DvbK1fFl.js.br +0 -0
- package/dist/client/assets/{hooks-panel-B39FlDo3.js → hooks-panel-BWOHyo2k.js} +1 -1
- package/dist/client/assets/hooks-panel-BWOHyo2k.js.br +0 -0
- package/dist/client/assets/{index-FZUUoDAZ.js → index-B1lOI6hU.js} +5 -5
- package/dist/client/assets/index-B1lOI6hU.js.br +0 -0
- package/dist/client/assets/{issues-panel-BdFWcBp_.js → issues-panel-DtNwqaue.js} +1 -1
- package/dist/client/assets/issues-panel-DtNwqaue.js.br +0 -0
- package/dist/client/assets/{my-prs-panel-CdHsqkOb.js → my-prs-panel-n4G0PNue.js} +1 -1
- package/dist/client/assets/my-prs-panel-n4G0PNue.js.br +0 -0
- package/dist/client/assets/{nyan-cat-B5LtopDo.js → nyan-cat-CP1vsKe1.js} +1 -1
- package/dist/client/assets/nyan-cat-CP1vsKe1.js.br +0 -0
- package/dist/client/assets/{phone-shell-CHDPKphU.js → phone-shell-BIkINQQQ.js} +1 -1
- package/dist/client/assets/phone-shell-BIkINQQQ.js.br +0 -0
- package/dist/client/assets/{plan-face-CbrfGKaG.js → plan-face-DnLDMJy6.js} +1 -1
- package/dist/client/assets/plan-face-DnLDMJy6.js.br +0 -0
- package/dist/client/assets/{plan-render-xKLXM2KK.js → plan-render-BkviPv-c.js} +1 -1
- package/dist/client/assets/plan-render-BkviPv-c.js.br +0 -0
- package/dist/client/assets/{pr-queue-columns-DxlMmK-E.js → pr-queue-columns-DOCENcbT.js} +1 -1
- package/dist/client/assets/pr-queue-columns-DOCENcbT.js.br +0 -0
- package/dist/client/assets/{radar-panel-BHZdn-EB.js → radar-panel-Btzp3-7Y.js} +1 -1
- package/dist/client/assets/radar-panel-Btzp3-7Y.js.br +0 -0
- package/dist/client/assets/{repo-roots-adder-nCQ5Aw6T.js → repo-roots-adder-2vUcylJi.js} +1 -1
- package/dist/client/assets/repo-roots-adder-2vUcylJi.js.br +0 -0
- package/dist/client/assets/{resume-dialog-Dqjq1R1R.js → resume-dialog-DWEQuftz.js} +1 -1
- package/dist/client/assets/resume-dialog-DWEQuftz.js.br +0 -0
- package/dist/client/assets/{review-queue-panel-Cuopnn4V.js → review-queue-panel-JpOe78JU.js} +1 -1
- package/dist/client/assets/review-queue-panel-JpOe78JU.js.br +0 -0
- package/dist/client/assets/{settings-panel-BHyHkmo3.js → settings-panel-BxnlEQP9.js} +2 -2
- package/dist/client/assets/settings-panel-BxnlEQP9.js.br +0 -0
- package/dist/client/assets/{shown-lightbox-DuTJXots.js → shown-lightbox-C_Lyt9bP.js} +1 -1
- package/dist/client/assets/shown-lightbox-C_Lyt9bP.js.br +0 -0
- package/dist/client/assets/{team-review-panel-Bwt02rzL.js → team-review-panel-COM1WLXF.js} +1 -1
- package/dist/client/assets/team-review-panel-COM1WLXF.js.br +0 -0
- package/dist/client/assets/{trace-panel-BRoVd6kg.js → trace-panel-CQ3QE8RY.js} +1 -1
- package/dist/client/assets/trace-panel-CQ3QE8RY.js.br +0 -0
- package/dist/client/assets/{usage-panel-fKKJoURq.js → usage-panel-OJJDj-iW.js} +1 -1
- package/dist/client/assets/usage-panel-OJJDj-iW.js.br +0 -0
- package/dist/client/assets/{your-day-tip-D4cAKqWt.js → your-day-tip-rN7N7ogp.js} +1 -1
- package/dist/client/assets/your-day-tip-rN7N7ogp.js.br +0 -0
- package/dist/client/index.html +1 -1
- package/dist/client/index.html.br +0 -0
- package/dist/server/index.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/benchmark-panel-Wdv8tU38.js.br +0 -0
- package/dist/client/assets/boards-view-7AohGX7n.js.br +0 -0
- package/dist/client/assets/community-panel-sA24J0se.js.br +0 -0
- package/dist/client/assets/dialogs-CYJ3tkV7.js.br +0 -0
- package/dist/client/assets/doc-editor-ui-QbBEQHoU.js.br +0 -0
- package/dist/client/assets/feature-hint-Cnl_-8RL.js.br +0 -0
- package/dist/client/assets/first-run-checklist-DZajXPRH.js.br +0 -0
- package/dist/client/assets/hooks-panel-B39FlDo3.js.br +0 -0
- package/dist/client/assets/index-FZUUoDAZ.js.br +0 -0
- package/dist/client/assets/issues-panel-BdFWcBp_.js.br +0 -0
- package/dist/client/assets/my-prs-panel-CdHsqkOb.js.br +0 -0
- package/dist/client/assets/nyan-cat-B5LtopDo.js.br +0 -0
- package/dist/client/assets/phone-shell-CHDPKphU.js.br +0 -0
- package/dist/client/assets/plan-face-CbrfGKaG.js.br +0 -0
- package/dist/client/assets/plan-render-xKLXM2KK.js.br +0 -0
- package/dist/client/assets/pr-queue-columns-DxlMmK-E.js.br +0 -0
- package/dist/client/assets/radar-panel-BHZdn-EB.js.br +0 -0
- package/dist/client/assets/repo-roots-adder-nCQ5Aw6T.js.br +0 -0
- package/dist/client/assets/resume-dialog-Dqjq1R1R.js.br +0 -0
- package/dist/client/assets/review-queue-panel-Cuopnn4V.js.br +0 -0
- package/dist/client/assets/settings-panel-BHyHkmo3.js.br +0 -0
- package/dist/client/assets/shown-lightbox-DuTJXots.js.br +0 -0
- package/dist/client/assets/team-review-panel-Bwt02rzL.js.br +0 -0
- package/dist/client/assets/trace-panel-BRoVd6kg.js.br +0 -0
- package/dist/client/assets/usage-panel-fKKJoURq.js.br +0 -0
- package/dist/client/assets/your-day-tip-D4cAKqWt.js.br +0 -0
|
@@ -1,64 +1,81 @@
|
|
|
1
|
-
import { t as AGENT_API_VERBS } from "./session-CcJLn3EZ.js";
|
|
2
1
|
import { i as execFileSync } from "./child-process-safe-BCOoKfxG.js";
|
|
2
|
+
import { parseArgs } from "node:util";
|
|
3
3
|
//#region server/core/command-line-core.ts
|
|
4
|
+
var GLOBAL_OPTIONS = {
|
|
5
|
+
config: { type: "string" },
|
|
6
|
+
port: { type: "string" },
|
|
7
|
+
help: {
|
|
8
|
+
type: "boolean",
|
|
9
|
+
short: "h"
|
|
10
|
+
},
|
|
11
|
+
version: { type: "boolean" },
|
|
12
|
+
doctor: { type: "boolean" },
|
|
13
|
+
"no-open": { type: "boolean" }
|
|
14
|
+
};
|
|
4
15
|
var SUBCOMMANDS_HONORING_TRAILING_GLOBAL_OPTIONS = /* @__PURE__ */ new Set(["doctor", "pair"]);
|
|
5
|
-
var AGENT_VERBS_HONORING_HELP_OR_VERSION = new Set(AGENT_API_VERBS);
|
|
6
16
|
var OPTIONS_TAKING_A_VALUE = {
|
|
7
17
|
"--config": "configPath",
|
|
8
18
|
"--port": "port"
|
|
9
19
|
};
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (token === "--doctor") state.wantsDoctor = true;
|
|
21
|
-
if (token === "--no-open") state.wantsNoOpen = true;
|
|
22
|
-
return index + 1;
|
|
20
|
+
function commandNameIndex(argv) {
|
|
21
|
+
const { tokens } = parseArgs({
|
|
22
|
+
args: [...argv],
|
|
23
|
+
options: GLOBAL_OPTIONS,
|
|
24
|
+
strict: false,
|
|
25
|
+
allowPositionals: true,
|
|
26
|
+
tokens: true
|
|
27
|
+
});
|
|
28
|
+
const firstPositional = tokens.find((token) => token.kind === "positional");
|
|
29
|
+
return firstPositional ? firstPositional.index : argv.length;
|
|
23
30
|
}
|
|
24
|
-
function scanTrailingGlobalOptions(subcommandArgs,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
index
|
|
31
|
+
function scanTrailingGlobalOptions(subcommandArgs, globalOptions) {
|
|
32
|
+
const scanned = { ...globalOptions };
|
|
33
|
+
for (let index = 0; index < subcommandArgs.length; index += 1) {
|
|
34
|
+
const valueKey = OPTIONS_TAKING_A_VALUE[subcommandArgs[index]];
|
|
35
|
+
const value = subcommandArgs[index + 1];
|
|
36
|
+
if (!valueKey || value === void 0) continue;
|
|
37
|
+
scanned[valueKey] = value;
|
|
38
|
+
index += 1;
|
|
32
39
|
}
|
|
40
|
+
return scanned;
|
|
33
41
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
function parseGlobalValues(leadingArgs) {
|
|
43
|
+
try {
|
|
44
|
+
return {
|
|
45
|
+
ok: true,
|
|
46
|
+
values: parseArgs({
|
|
47
|
+
args: leadingArgs,
|
|
48
|
+
options: GLOBAL_OPTIONS,
|
|
49
|
+
strict: true,
|
|
50
|
+
allowPositionals: false
|
|
51
|
+
}).values
|
|
52
|
+
};
|
|
53
|
+
} catch (error) {
|
|
54
|
+
return {
|
|
55
|
+
ok: false,
|
|
56
|
+
text: `glimmervoid: ${error instanceof Error ? error.message : String(error)}\nRun glimmervoid --help for the commands and options.`
|
|
57
|
+
};
|
|
58
|
+
}
|
|
39
59
|
}
|
|
40
60
|
function parseCommandLine(argv) {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
wantsDoctor: false,
|
|
47
|
-
wantsNoOpen: false
|
|
61
|
+
const nameIndex = commandNameIndex(argv);
|
|
62
|
+
const parsedGlobals = parseGlobalValues(argv.slice(0, nameIndex));
|
|
63
|
+
if (!parsedGlobals.ok) return {
|
|
64
|
+
kind: "refused",
|
|
65
|
+
text: parsedGlobals.text
|
|
48
66
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
configPath: state.configPath,
|
|
59
|
-
port: state.port
|
|
67
|
+
const { values } = parsedGlobals;
|
|
68
|
+
const name = argv[nameIndex];
|
|
69
|
+
const subcommandArgs = argv.slice(nameIndex + 1);
|
|
70
|
+
const honorsTrailingGlobalOptions = name !== void 0 && SUBCOMMANDS_HONORING_TRAILING_GLOBAL_OPTIONS.has(name);
|
|
71
|
+
if (values.help || honorsTrailingGlobalOptions && (subcommandArgs.includes("--help") || subcommandArgs.includes("-h"))) return { kind: "help" };
|
|
72
|
+
if (values.version || honorsTrailingGlobalOptions && subcommandArgs.includes("--version")) return { kind: "version" };
|
|
73
|
+
const leadingGlobalOptions = {
|
|
74
|
+
configPath: values.config ?? null,
|
|
75
|
+
port: values.port ?? null
|
|
60
76
|
};
|
|
61
|
-
|
|
77
|
+
const globalOptions = honorsTrailingGlobalOptions ? scanTrailingGlobalOptions(subcommandArgs, leadingGlobalOptions) : leadingGlobalOptions;
|
|
78
|
+
if (values.doctor) return {
|
|
62
79
|
kind: "subcommand",
|
|
63
80
|
name: "doctor",
|
|
64
81
|
subcommandArgs: [],
|
|
@@ -67,7 +84,7 @@ function parseCommandLine(argv) {
|
|
|
67
84
|
if (name === void 0) return {
|
|
68
85
|
kind: "server",
|
|
69
86
|
globalOptions,
|
|
70
|
-
isBrowserOpenSkipped:
|
|
87
|
+
isBrowserOpenSkipped: values["no-open"] === true
|
|
71
88
|
};
|
|
72
89
|
return {
|
|
73
90
|
kind: "subcommand",
|
|
@@ -5,10 +5,10 @@ import { n as glimmervoidHomeDir, r as isOperatorHomeUnderTest, t as decideConfi
|
|
|
5
5
|
import { $ as MyPrAutoRebase, $t as NODE_ID_RE, A as SIGN_URL_ENV, At as ReviewComment, Bt as TeamReviewStateEntry, Ct as FindingSeverity, D as SESSION_NAME_PATTERN, Dt as PostingPlan, Et as PostedReviewEvent, F as ShownFile, Ft as ReviewVerdict, G as Frame, Gt as canApproveAfterComment, H as BoardRecord, Ht as TeamReviewThreadCommentsResponse, It as TeamReviewActionRequest, J as WHITEBOARD_LIMITS, Jt as hasStandingViewerApproval, K as Note, Kt as decisionAsIfApprovalRequired, L as SshSignRequest, Mt as ReviewFinding, Nt as ReviewResult, O as SESSION_NAME_RULE_TEXT, Ot as PrDetail, Pt as ReviewThreadId, Q as MyPr, Qt as GH_SEGMENT, Rt as TeamReviewCompareFiles, S as ConversationQuestion, St as EarlierReview, T as SESSION_DOC_BODY_CAP_BYTES, Tt as GithubReviewState, Ut as TeamReviewThreadResult, Vt as TeamReviewStatus, W as Box, Wt as TeamReviewThreadsRepository, X as Wire, Xt as HEX_SHA_RE, Z as LinkedPr, Zt as shortSha, _ as COHERENCE_HOOKS_INACTIVE, at as MyPrMergeMethod, b as CONVERSATION_TOOL_RESULT_HOOK_EVENT, bt as CommitSha, cn as MERGEABLE_LIVE_STATES, ct as MyPrMergeStateResponse, en as REPO_SLUG_RE, et as MyPrCheckContext, ft as MyPrThreadNode, ht as MyPrsState, i as ASK_USER_QUESTION_TOOL_NAME, it as MyPrLaneEntry, j as SSH_SIGN_BODY_CAP_BYTES, jt as ReviewDraft, k as SHOWN_FILE_CAP_BYTES, ln as RESTARTABLE_STATES, lt as MyPrMergeWhenReadyRequest, mt as MyPrsSnapshot, nt as MyPrKeepMergeableRequest, on as BADGE_LABELS, ot as MyPrMergeRequest, pt as MyPrThreadsResponse, r as AGENT_URL_ENV, sn as KILLABLE_STATES, tn as repoParts, tt as MyPrCheckContextsResponse, un as STATES, v as CONVERSATION_APPROVAL_SUMMARY_MAX_CHARS, xt as DECIDING_REVIEW_STATES, y as CONVERSATION_PERMISSION_HOOK_EVENT, z as TaskTitle, zt as TeamReviewResolveResponse } from "./session-CcJLn3EZ.js";
|
|
6
6
|
import { c as spawn, i as execFileSync, n as execFile, r as execFileAsync, s as refuseLaunchesOf, t as assertLaunchable } from "./child-process-safe-BCOoKfxG.js";
|
|
7
7
|
import { $t as issuePullRequestStateFromGithub, A as HINT_VIEW_BY_FEATURE, At as SessionSetup, B as MergedPrListing, Bt as PLAN_RESULT_HOOK_EVENT, Ct as CommunityItem, D as pullRequestKeyFromReference, Et as DISCORD_CHANNEL_NAME_RE, F as BenchmarkJudgement, Ft as ChangeMap, G as GithubPrLightSearchNode, Gt as planTitle, H as PrCheckoutCaseInput, Ht as PlanDecision, I as BenchmarkRun, It as changeMapFactId, J as WorkflowCommentBody, Jt as IssueKey, K as GithubPrsFrame, Kt as GithubIssuePullRequestsRepository, L as BenchmarkStatus, Lt as PLAN_BODY_CAP_BYTES, M as BenchmarkActionRequest, Mt as TraceCheckpoint, N as BenchmarkCase, Nt as TraceRecord, O as FeatureHintState, P as BenchmarkId, Pt as CoherenceJournalOutput, Qt as IssuesStatus, R as BenchmarkSuite, Rt as PLAN_HOOK_EVENT, St as CommunityDraft, Tt as CommunityVerdict, U as GithubPrDetailNode, Ut as PlanRevision, V as MinedPrReviewData, Vt as PLAN_TOOL_NAME, W as GithubPrKey, Wt as parseExitPlanModeHookPayload, X as WorkflowsSettings, Xt as IssuesSearchResponse, Y as WorkflowLabelName, Yt as IssueUpdate, Z as WorkflowsState, Zt as IssuesState, _ as CLIENT_LOG_TEXT_MAX_CHARS, a as ConfigUpdate, c as SHELL_AGENT_ID, f as USAGE_COST_MODES, gt as USAGE_INTEGER_RANGES, h as CHANGES_POLL_INTERVAL_MS, jt as MAX_RAW_LINE_CHARS, k as HINT_FEATURES, kt as UpdateJournal, p as USAGE_VENDOR_KEYS, q as comparablePrKey, qt as GithubIssueResponse, r as BrowserConfig, rt as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, s as RUNTIME_CONFIG_SCALAR_KEYS, u as configIssueMessage, v as CONTROL_FRAME_MAX_BYTES, wt as CommunityState, x as GithubTeam, xt as CommunityActionRequest, y as ClientMessage, z as CommitComparison, zt as PLAN_HOOK_OUTPUT_MAX_CHARS } from "./config-BIVF12fQ.js";
|
|
8
|
+
import { A as parseRefinedSessionName, B as resumePromptFor, C as decideTaskTitleRefinement, D as extractPromptTaskTitle, E as extractOscTaskTitle, F as AUTO_CONTINUE_PROMPT, G as isAutoNameOf, H as claudeProjectsDir, I as RESUME_ID_RE, K as nextSuggestedName, L as isConversationReplacedAtStartup, M as resolveRefocusTaskTitle, N as resolveTaskTitle, O as isSelfWakePrompt, P as seedTaskTitleSources, R as pickAutoResume, S as cleanTaskPrompt, T as extractHookTaskTitle, U as listRepoConversations, V as shouldAdoptReportedResumeId, W as listRepoWorktreePaths, _ as projectReviewDetail, a as checkAgentReply, b as buildTaskTitleRefinementPrompt, c as deriveChildSessionName, d as describePushLanding, f as describeRoleRefusal, g as projectMyPrs, h as parseAgentVerb, j as parseRefinedTaskTitle, k as isSubstantivePrompt, l as describeChildEndNote, n as REFUSAL_REASON, o as decideAgentRequest, p as describeUnpushedCloseRefusal, s as decideSpawnAllowance, u as describeKeptChildAttention, v as projectReviews, w as extractAiTitle, x as chooseRefinedSessionName, y as buildPersistedTaskTitle, z as resolveResumeTarget } from "./agent-api-core-CVleheDx.js";
|
|
8
9
|
import { a as permitsHelpCommand, o as supervisionLine, r as describeSessionLimits } from "./session-routes-BGK07awr.js";
|
|
9
|
-
import { A as parseRefinedTaskTitle, B as shouldAdoptReportedResumeId, C as extractAiTitle, D as isSelfWakePrompt, E as extractPromptTaskTitle, F as RESUME_ID_RE, G as nextSuggestedName, H as listRepoConversations, I as isConversationReplacedAtStartup, L as pickAutoResume, M as resolveTaskTitle, N as seedTaskTitleSources, O as isSubstantivePrompt, P as AUTO_CONTINUE_PROMPT, R as resolveResumeTarget, S as decideTaskTitleRefinement, T as extractOscTaskTitle, U as listRepoWorktreePaths, V as claudeProjectsDir, W as isAutoNameOf, _ as projectReviews, a as decideAgentRequest, b as chooseRefinedSessionName, c as describeChildEndNote, d as describeRoleRefusal, f as describeUnpushedCloseRefusal, g as projectReviewDetail, h as projectMyPrs, i as checkAgentReply, j as resolveRefocusTaskTitle, k as parseRefinedSessionName, l as describeKeptChildAttention, m as parseAgentVerb, n as REFUSAL_REASON, o as decideSpawnAllowance, s as deriveChildSessionName, u as describePushLanding, v as buildPersistedTaskTitle, w as extractHookTaskTitle, x as cleanTaskPrompt, y as buildTaskTitleRefinementPrompt, z as resumePromptFor } from "./agent-api-core-CRjUWPzJ.js";
|
|
10
10
|
import { a as rawTextOr, i as positiveNumberOr, n as isRecord, o as textOr, r as numberOr, t as coercedNumberOr } from "./coerce-oz_Z_6E7.js";
|
|
11
|
-
import { i as parseCommandLine, n as warnWhenGitIsTooOld } from "./git-version-
|
|
11
|
+
import { i as parseCommandLine, n as warnWhenGitIsTooOld } from "./git-version-CkHaTbB0.js";
|
|
12
12
|
import { t as HOOK_URL_ENV } from "./hook-relay-core-DA_bz2KA.js";
|
|
13
13
|
import { r as refocusReplyFor, t as promptContextReplyOf } from "./refocus-core-zXihqRvU.js";
|
|
14
14
|
import { n as parseJsonRecord, t as parseJsonOrNull } from "./json-core-If8h-Qgy.js";
|
|
@@ -9003,6 +9003,7 @@ function buildReviewPrompt({ candidate, detail, tier, reasons, checkoutPath, rep
|
|
|
9003
9003
|
" <reviewer> is a short label for what found it, containing no | character;",
|
|
9004
9004
|
` <disposition> is one of ${oneOf(ReviewFinding.shape.disposition.unwrap().options)};`,
|
|
9005
9005
|
" <body> is the finding on that same single line, with no line breaks.",
|
|
9006
|
+
...priorReview ? [] : [" A claim in the title or body that the diff contradicts, or a change it says it makes that the diff does not make,", " is a finding of at least NIT, never only a GAPS line."],
|
|
9006
9007
|
" Write the single line (none) when there are no findings.",
|
|
9007
9008
|
"- then one blank line",
|
|
9008
9009
|
"The remaining sections are for the operator, who reads them to judge whether the review is right before anything",
|
|
@@ -9016,9 +9017,12 @@ function buildReviewPrompt({ candidate, detail, tier, reasons, checkoutPath, rep
|
|
|
9016
9017
|
"- then one to three sentences on what the pull request changes and which behavior that affects.",
|
|
9017
9018
|
"- then one blank line",
|
|
9018
9019
|
"- then one line: CHECKED:",
|
|
9019
|
-
"- then two
|
|
9020
|
+
"- then two or more lines, each in the form \"- <question the review asked of this change>: <answer>\", where the",
|
|
9020
9021
|
" answer cites the evidence as `path:line` in backticks. Cover the risks that decided the verdict, including the",
|
|
9021
|
-
" ones that turned out fine, so the operator can check the reasoning.",
|
|
9022
|
+
" ones that turned out fine, so the operator can check the reasoning. Include one line for each check, gate,",
|
|
9023
|
+
" allowlist or deny rule the change loosens, answering what input it now admits and what that input can reach, and",
|
|
9024
|
+
" one for each changed export, constant or shared text that other code reads, answering which other readers it",
|
|
9025
|
+
" reaches and whether the change is right for each.",
|
|
9022
9026
|
"- then one blank line",
|
|
9023
9027
|
"- then one line: GAPS:",
|
|
9024
9028
|
"- then one line starting \"- \" for each thing the review could not cover (a reviewer that failed, a file it did",
|
|
@@ -330,7 +330,7 @@ function processIo() {
|
|
|
330
330
|
async function runSettingsCli(commandArguments, io = processIo()) {
|
|
331
331
|
const serverRequest = settingsRequestForServer(commandArguments, process.env);
|
|
332
332
|
if (!serverRequest) return runSettingsCommand(commandArguments, io);
|
|
333
|
-
const { askAgentApi } = await import("./agent-api-cli-
|
|
333
|
+
const { askAgentApi } = await import("./agent-api-cli-DIHuV81M.js");
|
|
334
334
|
const reply = AgentSettingsReply.safeParse(await askAgentApi("settings", serverRequest).catch((error) => ({
|
|
335
335
|
ok: false,
|
|
336
336
|
error: errorMessage(error)
|
|
@@ -2,7 +2,7 @@ import { r as errorMessage } from "./text-DoirglWV.js";
|
|
|
2
2
|
import { A as SIGN_URL_ENV, I as SshSignReply } from "./session-CcJLn3EZ.js";
|
|
3
3
|
import { c as spawn, r as execFileAsync } from "./child-process-safe-BCOoKfxG.js";
|
|
4
4
|
import { a as isLoopbackHostname } from "./hook-relay-core-DA_bz2KA.js";
|
|
5
|
-
import { n as postToAgentIngress } from "./agent-api-cli-
|
|
5
|
+
import { n as postToAgentIngress } from "./agent-api-cli-DGJ38W5Q.js";
|
|
6
6
|
import { l as parseSshPublicKey } from "./ssh-signing-core-CRhVVWNW.js";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import fs from "node:fs/promises";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./updates-view-core-D9wi2i2r.js";import{n as e,r as t,s as n}from"./dom-helpers-DBbFg1c_.js";import{$ as r,Q as i,et as a}from"./index-
|
|
1
|
+
import"./updates-view-core-D9wi2i2r.js";import{n as e,r as t,s as n}from"./dom-helpers-DBbFg1c_.js";import{$ as r,Q as i,et as a}from"./index-B1lOI6hU.js";var o={mine:`Mine`,run:`Run`,cancel:`Cancel`},s=null;function c(e){return e===null?`n/a`:`${Math.round(e*100)}%`}function l(e){if(e===null)return`n/a`;let t=Math.round(e*100);return t>0?`+${t}`:String(t)}function u(e,t,i){let a=n(`button`,`bench-action-button`,o[t]);return a.type=`button`,a.disabled=i,a.addEventListener(`click`,()=>r(e.id,t)),a}function d(e,t){let n=e.inFlight;if(!n||n.suiteId!==t.id)return``;let r=n.caseId?`case ${n.caseId}, `:``;return`Cell ${n.cellIndex+1} of ${n.cellCount}: ${r}arm ${n.armId}, trial ${n.trial}, ${n.phase}.`}function f(e){let t=n(`td`,`bench-score`,c(e?.recall??null));return e&&e.invalid>0&&(t.title=`${e.invalid} invalid or failed cell(s)`),e&&e.degraded>0&&(t.dataset.degraded=`true`),t}function p(e){let t=e.armIds.filter(t=>t!==e.baselineArm),r=n(`table`,`bench-table`),i=n(`tr`);i.append(n(`th`,null,`Case`),...e.armIds.map(t=>n(`th`,null,t===e.baselineArm?`${t} (baseline)`:t))),i.append(...t.map(e=>n(`th`,null,`${e} vs baseline`))),r.append(i);for(let i of e.rows){let a=n(`tr`);a.append(n(`td`,`bench-case`,i.caseId),...e.armIds.map(e=>f(i.arms[e]))),a.append(...t.map(e=>n(`td`,`bench-delta`,l(i.deltaVsBaseline[e]??null)))),r.append(a)}let a=[...new Set(e.armIds.flatMap(t=>Object.keys(e.totals[t]?.recallByTag??{})))].sort(),o=n(`tr`,`bench-total`);o.append(n(`td`,`bench-case`,`Paired recall`),...e.armIds.map(t=>f(e.totals[t]))),r.append(o);for(let t of a){let i=n(`tr`,`bench-total`);i.append(n(`td`,`bench-case`,`Recall, ${t}`),...e.armIds.map(r=>n(`td`,`bench-score`,c(e.totals[r]?.recallByTag[t]??null)))),r.append(i)}return r}function m(e,r){let{isServerConnected:a,pendingActionBySuite:o,outcomeBySuite:s}=i(),c=n(`div`,`bench-suite`),l=e.inFlight?.suiteId===r.id,f=!!e.inFlight&&!l,m=o.has(r.id)||!a,h=n(`div`,`bench-summary`);h.append(n(`span`,`bench-suite-title`,r.title),t(`bench`,r.caseCount===1?`case`:`cases`,String(r.caseCount)),t(`bench`,r.candidateCount===1?`candidate`:`candidates`,String(r.candidateCount)),t(`bench`,`arms`,String(r.armIds.length))),c.append(h);let g=n(`div`,`bench-controls`),_=e.configured===!0&&r.error===null;g.append(u(r,`mine`,!_||m||l),u(r,`run`,!_||m||l||f||r.caseCount===0),u(r,`cancel`,m||!l));let v=n(`span`,`bench-status`,(a?``:`Not connected to the server. Reconnecting.`)||d(e,r)||s.get(r.id)||``);if(v.setAttribute(`role`,`status`),g.append(v),c.append(g),r.error)return c.append(n(`p`,`bench-error`,r.error)),c;let y=r.latestReport;return y?(c.append(n(`p`,`bench-run-line`,`Latest run ${y.runId}: ${y.status}. Only cases every arm scored count toward paired recall.`)),y.rows.length>0&&c.append(p(y)),c):(c.append(n(`p`,`bench-empty`,r.caseCount===0?`Move approved candidates into the cases folder, then choose Run.`:`No run yet.`)),c)}function h(){if(!s)return;s.textContent=``;let{status:t}=i(),r=e(`bench`,`Benchmarks`,`Suites from the benchmarks folder of the Glimmervoid home, one run at a time.`);if(s.append(r),!t)s.append(n(`p`,`bench-empty`,`Waiting for the server.`));else if(!t.configured)s.append(n(`p`,`bench-empty`,t.reason||`Benchmarks are off.`));else if(t.suites.length===0)s.append(n(`p`,`bench-empty`,`No suites yet. Create a folder holding suite.json under benchmarks in the Glimmervoid home.`));else for(let e of t.suites)s.append(m(t,e))}function g(e){s||(s=n(`div`,`bench-content`),e.append(s),a(h),h())}var _={mount:g};export{_ as view};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{yt as e}from"./updates-view-core-D9wi2i2r.js";import{s as t}from"./dom-helpers-DBbFg1c_.js";import{a as n,r}from"./card-registry-KOEOaX0K.js";import{i}from"./action-status-DN4P3ZYj.js";import{a,n as o}from"./modal-USMHOKBI.js";import{ai as s,bi as c,ci as l,ei as u,ii as d,li as f,ni as p,oi as m,ri as h,si as g,ti as _,xi as v,yi as y}from"./index-FZUUoDAZ.js";var b=4,ee=200,te=2e4,ne=1.1,re=[`wire`,`note`,`frame`,`box`];function x(e){let t=Math.random().toString(36).slice(2,8);return`${e}-${Date.now().toString(36)}${t}`}function S(){return document.documentElement.dataset.layout===`phone`}function ie(e){let{svg:n,canvas:r,renderer:i}=e,a=new Map,o=new Set,s={x:0,y:0,width:1e3,height:600},c=null,l=null;function u(){n.setAttribute(`viewBox`,`${s.x} ${s.y} ${s.width} ${s.height}`)}function d(){let e=i.layout();if(!e)return;let{bounds:t}=e,r=n.clientWidth,a=n.clientHeight;if(r===0||a===0){s={...t},u();return}let o=Math.max(1,t.width/r,t.height/a),c=r*o;s={x:t.x-(c-t.width)/2,y:t.y,width:c,height:a*o},u()}function f(e,t){let r=n.getScreenCTM();if(!r)return{x:e,y:t};let i=new DOMPoint(e,t).matrixTransform(r.inverse());return{x:i.x,y:i.y}}function p(){let e=n.clientWidth||1,t=n.clientHeight||1;return Math.max(s.width/e,s.height/t)}function m(e,t){let n=Math.min(te,Math.max(ee,s.width*t)),r=n/s.width;s={x:e.x-(e.x-s.x)*r,y:e.y-(e.y-s.y)*r,width:n,height:s.height*r},u()}function h(e,t){let n=p();s={...s,x:s.x-e*n,y:s.y-t*n},u()}function g(t){o=t,i.setSelection(o),e.onSelectionChange(o)}function _(e,t){if(!t){g(o.has(e)&&o.size===1?new Set:new Set([e]));return}let n=new Set(o);n.delete(e)||n.add(e),g(n)}function v(e){let t=new Set([...o].filter(t=>e?.elements[t]));t.size!==o.size&&g(t)}function y(e){let t=i.layout()?.elements.find(t=>t.id===e);return t?.kind===`box`?t:null}function x(){let[e,t]=[...a.values()];return!e||!t?0:Math.hypot(e.x-t.x,e.y-t.y)}function ie(){c={kind:`pinch`,distance:x(),viewWidth:s.width}}function C(e){if(e.button!==0||l)return;if(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),n.setPointerCapture(e.pointerId),a.size===2){ie();return}let t=i.elementFromTarget(e.target),r=t?.kind===`box`&&!S()?y(t.id):null;if(t&&r){c={kind:`drag`,pointerId:e.pointerId,boxId:t.id,origin:f(e.clientX,e.clientY),start:r,hasMoved:!1,isAdditive:e.shiftKey};return}if(t&&!S()){_(t.id,e.shiftKey);return}let o=t?.kind===`box`?t.id:null;c={kind:`pan`,pointerId:e.pointerId,lastClient:{x:e.clientX,y:e.clientY},hasMoved:!1,tappedBoxId:o}}function w(e,t){let n=f(t.clientX,t.clientY),r=n.x-e.origin.x,a=n.y-e.origin.y;!e.hasMoved&&Math.hypot(r,a)<b*p()||(e.hasMoved=!0,i.nodeOf(e.boxId)?.setAttribute(`transform`,`translate(${r} ${a})`))}function T(e,t){let n=t.clientX-e.lastClient.x,r=t.clientY-e.lastClient.y;!e.hasMoved&&Math.hypot(n,r)<b||(e.hasMoved=!0,e.lastClient={x:t.clientX,y:t.clientY},h(n,r))}function ae(e){let t=x();if(t<=0||e.distance<=0)return;let n=[...a.values()];m(f(n.reduce((e,t)=>e+t.x,0)/n.length,n.reduce((e,t)=>e+t.y,0)/n.length),e.viewWidth*(e.distance/t)/s.width)}function oe(e){a.has(e.pointerId)&&(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),c?.kind===`pinch`?ae(c):c?.kind===`drag`&&c.pointerId===e.pointerId?w(c,e):c?.kind===`pan`&&c.pointerId===e.pointerId&&T(c,e))}async function se(t,n){if(!t.hasMoved){_(t.boxId,t.isAdditive);return}let r=f(n.clientX,n.clientY),a={x:Math.round(t.start.x+r.x-t.origin.x),y:Math.round(t.start.y+r.y-t.origin.y)};await e.sendOps([{op:`set`,id:t.boxId,fields:{at:a}}])||i.nodeOf(t.boxId)?.removeAttribute(`transform`)}function ce(t){if(!a.delete(t.pointerId))return;let n=c;n?.kind===`pinch`?c=null:(c=null,n?.kind===`drag`&&n.pointerId===t.pointerId?se(n,t):n?.kind!==`pan`||n.hasMoved||(n.tappedBoxId&&S()?e.onPhoneTapBox(n.tappedBoxId):n.tappedBoxId||g(new Set)))}function le(e){a.delete(e.pointerId),c?.kind===`drag`&&i.nodeOf(c.boxId)?.removeAttribute(`transform`),c=null}function E(e){e.preventDefault(),e.ctrlKey||e.metaKey?m(f(e.clientX,e.clientY),e.deltaY>0?ne:1/ne):h(-e.deltaX,-e.deltaY)}function D(){let e=l;l=null,e?.remove()}function ue(a){let o=e.currentBoard()?.elements[a],s=i.nodeOf(a);if(o?.kind!==`box`||!s)return;D();let c=r.getBoundingClientRect(),u=s.getBoundingClientRect(),d=t(`input`,`wb-title-input`);d.type=`text`,d.value=o.title,d.maxLength=80,d.setAttribute(`aria-label`,`Box title`),d.style.left=`${u.left-c.left}px`,d.style.top=`${u.top-c.top}px`,d.style.width=`${Math.max(160,u.width)}px`,l=d,r.append(d),d.addEventListener(`keydown`,t=>{if(t.key===`Escape`){t.preventDefault(),D(),n.focus();return}if(t.key!==`Enter`)return;t.preventDefault();let r=d.value.trim();D(),n.focus(),r&&r!==o.title&&e.sendOps([{op:`set`,id:a,fields:{title:r}}])}),d.addEventListener(`blur`,D),d.focus(),d.select()}function de(e){if(S())return;let t=i.elementFromTarget(document.elementFromPoint(e.clientX,e.clientY));t?.kind===`box`&&ue(t.id)}function fe(){let t=e.currentBoard();if(!t||o.size===0)return;let n=[...o].flatMap(e=>t.elements[e]??[]),r=re.flatMap(e=>n.filter(t=>t.kind===e)).map(e=>({op:`remove`,id:e.id}));g(new Set),e.sendOps(r)}function pe(e){e.target===n&&(e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),fe()):e.key===`Escape`&&g(new Set))}return n.tabIndex=0,n.addEventListener(`pointerdown`,C),n.addEventListener(`pointermove`,oe),n.addEventListener(`pointerup`,ce),n.addEventListener(`pointercancel`,le),n.addEventListener(`wheel`,E,{passive:!1}),n.addEventListener(`dblclick`,de),n.addEventListener(`keydown`,pe),{fit:d,selectedIds:()=>o,clearSelection:()=>g(new Set),pruneSelection:v,closeTitleInput:D}}var C=40,w=220,T=90,ae=30,oe=20,se=18,ce=20,le=26,E=18,D=26,ue=170,de=21,fe=17,pe=10,O=22,me=24,he=16,ge=24,_e=8,ve=Object.freeze({blue:`#60a5fa`,green:`#4ade80`,orange:`#fb923c`,pink:`#f472b6`,cyan:`#22d3ee`,yellow:`#facc15`});function k(e,t){let n=e.split(/\s+/).filter(Boolean),r=[],i=``;for(let e of n){let n=e.match(RegExp(`.{1,${t}}`,`g`))??[e];for(let e of n){let n=i?`${i} ${e}`:e;n.length<=t?i=n:(r.push(i),i=e)}}return i&&r.push(i),r.length>0?r:[``]}function ye(e,t){let n=e.lanes.find(e=>e.id===t.lane);return n?{label:n.label||n.id,hex:ve[n.color]}:null}function be(e,t){let n=k(t.title,ce),r=t.lines.flatMap(e=>k(e.text,le-(e.muted?2:0)).map(t=>({text:t,muted:e.muted}))),i=ye(e,t);return{titleLines:n,bodyLines:r,lane:i,height:24+n.length*oe+r.length*se+(i?26:0)}}function A(e,t){return Object.values(e.elements).filter(e=>e.kind===t)}function xe(e){let t=k(e.text,de);return{lines:t,height:24+(t.length+1)*fe}}function Se(e){let t=new Map;for(let n of A(e,`note`)){let e=t.get(n.on),r=xe(n).height;t.set(n.on,e===void 0?r:e+pe+r)}return t}function Ce(e){return e.columns.map(e=>e.title?k(e.title,me):[])}function we(e){return(Math.max(1,...e.map(e=>e.length))-1)*he}function Te(e,t){let n=new Set(A(e,`box`).filter(e=>!e.at&&t.has(e.id)).map(e=>e.column)),r=[],i=C;for(let t of e.columns)r.push(i),i+=w+(n.has(t.id)?Math.max(T,186):T);return r}function Ee(e){let t=new Map;for(let n of A(e,`frame`))for(let e of n.contains)t.has(e)||t.set(e,n.id);return t}function De(e,t){return e===t?0:(e?E:0)+(t?44:0)}function Oe(e,t,n,r){let i=new Map,a=new Map,o=new Map,s=Ee(e),c=A(e,`box`).map((e,t)=>({box:e,index:t})).sort((e,t)=>e.box.order-t.box.order||e.index-t.index);for(let{box:l}of c){let c=Math.max(0,e.columns.findIndex(e=>e.id===l.column)),u=be(e,l),d=s.get(l.id)??null,f=(a.get(l.column)??n)+De(o.get(l.column)??null,d),p=l.at??{x:t[c]??C,y:f};if(!l.at){let e=(r.get(l.id)??0)-_e;a.set(l.column,f+Math.max(u.height,e)+ae),o.set(l.column,d)}i.set(l.id,{kind:`box`,id:l.id,x:p.x,y:p.y,width:w,height:u.height,titleLines:u.titleLines,bodyLines:u.bodyLines,lane:u.lane,isGhost:l.ghost})}return i}function ke(e){if(e.length===0)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+e.width)),i=Math.max(...e.map(e=>e.y+e.height));return{x:t,y:n,width:r-t,height:i-n}}function Ae(e,t){return A(e,`frame`).flatMap(e=>{let n=ke(e.contains.flatMap(e=>t.get(e)??[]));return n?[{kind:`frame`,id:e.id,title:e.title,x:n.x-E,y:n.y-E-D,width:n.width+36,height:n.height+36+D}]:[]})}function je(e,t){let n=e.x+e.width/2,r=t.x+t.width/2;if(Math.abs(r-n)>e.width/2){let i=r>n,a={x:i?e.x+e.width:e.x,y:e.y+Math.min(e.height/2,40)},o={x:i?t.x:t.x+t.width,y:t.y+Math.min(t.height/2,40)},s=(o.x-a.x)/2;return{start:a,end:o,path:`M ${a.x} ${a.y} C ${a.x+s} ${a.y}, ${o.x-s} ${o.y}, ${o.x} ${o.y}`}}let i=t.y>e.y,a={x:n,y:i?e.y+e.height:e.y},o={x:r,y:i?t.y:t.y+t.height},s=(o.y-a.y)/2;return{start:a,end:o,path:`M ${a.x} ${a.y} C ${a.x} ${a.y+s}, ${o.x} ${o.y-s}, ${o.x} ${o.y}`}}function Me(e,t){return A(e,`wire`).flatMap(e=>{let n=t.get(e.from),r=t.get(e.to);if(!n||!r)return[];let i=je(n,r);return[{kind:`wire`,id:e.id,path:i.path,start:i.start,end:i.end,label:e.label,labelAt:{x:(i.start.x+i.end.x)/2,y:(i.start.y+i.end.y)/2-6},isDashed:e.dashed,tone:e.tone,strokeHex:e.tone===`lane`?n.lane?.hex??null:null}]})}function Ne(e){return e.resolvedBy?`resolved by ${e.resolvedBy}`:e.author?`from ${e.author}`:``}function Pe(e,t){let n=new Map;return A(e,`note`).flatMap(e=>{let r=t.get(e.on);if(!r)return[];let{lines:i,height:a}=xe(e),o=n.get(e.on)??r.y-_e;return n.set(e.on,o+a+pe),[{kind:`note`,id:e.id,x:r.x+r.width-ge,y:o,width:ue,height:a,lines:i,byline:Ne(e),isResolved:e.resolvedBy!==null}]})}function Fe(e,t,n){let r=e.flatMap(e=>e.kind===`wire`?[]:[e]),i=(t.at(-1)??C)+w,a=ke([...r,{x:0,y:0,width:i,height:n}]);return a?{x:Math.min(0,a.x-C),y:Math.min(0,a.y-C),width:a.width+80,height:a.height+80}:{x:0,y:0,width:i+C,height:80}}function Ie(e){let t=Se(e),n=Te(e,t),r=Ce(e),i=we(r),a=84+i,o=Oe(e,n,a,t),s=[...Ae(e,o),...Me(e,o),...o.values(),...Pe(e,o)],c=Fe(s,n,a),l=c.y+c.height,u=e.lanes.map((e,t)=>({label:e.label||e.id,hex:ve[e.color],x:C,y:l+t*O})),d=l+u.length*O+(u.length>0?12:0),f=e.caption?{text:e.caption,x:C,y:d}:null,p=u.length*O+(f?30:0)+(u.length>0?12:0);return{columns:e.columns.map((e,t)=>({id:e.id,titleLines:r[t]??[],titleBaselineY:56,ruleY:66+i,x:n[t]??C,width:w})),elements:s,legend:u,caption:f,bounds:{...c,height:c.height+p}}}function Le(e){return JSON.stringify(e)}var Re=`http://www.w3.org/2000/svg`,j=12,ze=26,Be=20,Ve=18,He=17,Ue=14,We=16;function M(e,t={},n=``){let r=document.createElementNS(Re,e);for(let[e,n]of Object.entries(t))r.setAttribute(e,String(n));return n&&r.setAttribute(`class`,n),r}function N(e,t,n,r){let i=M(`text`,{x:t,y:n},r);return i.textContent=e,i}function P(e,t){let n=M(`g`,{},`wb-element ${t}`);return n.dataset.elementId=e.id,n.dataset.elementKind=e.kind,n}function Ge(e){let t=P(e,e.isGhost?`wb-box wb-ghost`:`wb-box`),n=M(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8},`wb-box-outline`);e.lane&&(n.style.stroke=e.lane.hex),t.append(n),e.titleLines.forEach((n,r)=>{t.append(N(n,e.x+j,e.y+ze+r*Be,`wb-box-title`))});let r=e.y+ze+e.titleLines.length*Be;if(e.bodyLines.forEach((n,i)=>{let a=e.x+j+(n.muted?Ue:0);t.append(N(n.text,a,r+i*Ve,n.muted?`wb-box-line wb-muted`:`wb-box-line`))}),!e.lane)return t;let i=e.y+e.height-28,a=Math.min(e.width-24,16+e.lane.label.length*8),o=M(`rect`,{x:e.x+j,y:i,width:a,height:18,rx:9},`wb-lane-pill`);o.style.stroke=e.lane.hex;let s=N(e.lane.label,e.x+j+8,i+13,`wb-lane-pill-text`);return s.style.fill=e.lane.hex,t.append(o,s),t}function Ke(e){let t=P(e,`wb-frame`);return t.append(M(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:12},`wb-frame-outline`),N(e.title,e.x+14,e.y+18,`wb-frame-title`)),t}function qe(e){let t=P(e,`wb-wire wb-tone-${e.tone}`),n=M(`path`,{d:e.path},`wb-wire-hit`),r=M(`path`,{d:e.path,"marker-end":`url(#wb-arrow)`},e.isDashed?`wb-wire-line wb-dashed`:`wb-wire-line`);return e.strokeHex&&(r.style.stroke=e.strokeHex),t.append(n,r,M(`circle`,{cx:e.start.x,cy:e.start.y,r:3},`wb-wire-dot`)),e.label&&t.append(N(e.label,e.labelAt.x,e.labelAt.y,`wb-wire-label`)),t}function Je(e){let t=P(e,e.isResolved?`wb-note wb-resolved`:`wb-note`);return t.append(M(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:4},`wb-note-card`)),e.lines.forEach((n,r)=>{t.append(N(n,e.x+10,e.y+22+r*He,`wb-note-text`))}),e.byline&&t.append(N(e.byline,e.x+10,e.y+22+e.lines.length*He,`wb-note-byline`)),t}var Ye={frame:`frames`,wire:`wires`,box:`boxes`,note:`notes`},Xe=[`box`,`frame`,`wire`,`note`];function Ze(e){switch(e.kind){case`box`:return Ge(e);case`frame`:return Ke(e);case`wire`:return qe(e);case`note`:return Je(e)}}function Qe(e){let t=M(`g`,{},`wb-chrome`);for(let n of e.columns)n.titleLines.length!==0&&(n.titleLines.forEach((e,r)=>{t.append(N(e,n.x,n.titleBaselineY+r*We,`wb-column-title`))}),t.append(M(`line`,{x1:n.x,y1:n.ruleY,x2:n.x+n.width,y2:n.ruleY},`wb-column-rule`)));for(let n of e.legend){let e=M(`rect`,{x:n.x,y:n.y,width:14,height:14,rx:3},`wb-legend-swatch`);e.style.fill=n.hex,t.append(e,N(n.label,n.x+22,n.y+12,`wb-legend-text`))}return e.caption&&t.append(N(e.caption.text,e.caption.x,e.caption.y+16,`wb-caption`)),t}function $e(){let e=M(`defs`),t=M(`marker`,{id:`wb-arrow`,viewBox:`0 0 10 10`,refX:9,refY:5,markerWidth:8,markerHeight:8,orient:`auto-start-reverse`});return t.append(M(`path`,{d:`M 0 1 L 10 5 L 0 9 z`,fill:`context-stroke`})),e.append(t),e}function et(e){let t={frames:M(`g`,{},`wb-layer`),wires:M(`g`,{},`wb-layer`),boxes:M(`g`,{},`wb-layer`),notes:M(`g`,{},`wb-layer`)},n=M(`g`);e.replaceChildren($e(),n,t.frames,t.wires,t.boxes,t.notes);let r=new Map,i=null,a=new Set;function o(e,t){t.classList.toggle(`is-selected`,a.has(e))}function s(e){let a=Ie(e),s=Qe(a);n.replaceWith(s),n=s;let c=new Set;for(let e of a.elements){c.add(e.id);let n=Le(e),i=r.get(e.id);if(i?.signature===n)continue;let a=Ze(e);o(e.id,a),i&&i.node.replaceWith(a),i||t[Ye[e.kind]].append(a),r.set(e.id,{signature:n,node:a})}for(let[e,t]of r)c.has(e)||(t.node.remove(),r.delete(e));return i=a,a}function c(e){if(!(e instanceof Element))return null;let t=e.closest(`.wb-element`),n=t?.dataset.elementId,r=Xe.find(e=>e===t?.dataset.elementKind);return!n||!r?null:{id:n,kind:r}}function l(e){a=e;for(let[e,t]of r)o(e,t.node)}function u(){for(let e of r.values())e.node.remove();r.clear();let e=M(`g`);n.replaceWith(e),n=e,i=null}return{render:s,layout:()=>i,elementFromTarget:c,nodeOf:e=>r.get(e)?.node??null,setSelection:l,clear:u}}var tt=`http://www.w3.org/2000/svg`,nt=`No boards yet. Make one here, or have an agent run glimmervoid whiteboard new <title>.`,rt=`Pick a board above.`,F=null,I=null,L=null,R=null,it=!0,z=null,B=i(`action-status wb-status`),V=i(`action-status wb-status`);function H(e){let{dialog:n,close:r,actions:i,btnCancel:a}=o({title:e.title}),s=t(`input`,`dialog-input`);s.type=`text`,s.placeholder=e.placeholder,s.maxLength=e.maxLength,s.value=e.initialValue??``,s.autocomplete=`off`,s.setAttribute(`aria-label`,e.label);let c=t(`div`,`dialog-error`);c.setAttribute(`role`,`alert`);let l=e.choices?t(`select`,`dialog-input wb-dialog-select`):null;if(l&&e.choices){l.setAttribute(`aria-label`,e.choices.label);for(let n of e.choices.options){let e=t(`option`,null,n.text);e.value=n.value,l.append(e)}}let u=t(`button`,`btn-dialog btn-dialog-confirm`,e.confirmLabel);u.type=`button`,i.append(u),n.append(t(`label`,`dialog-label`,e.label),s,...l?[l]:[],c,i);async function d(){let t=s.value.trim();if(!t){c.textContent=`${e.label} is empty.`;return}u.disabled=!0;let n=await e.onSubmit(t,l?.value??null);u.disabled=!1,n?c.textContent=n:r()}a.addEventListener(`click`,r),u.addEventListener(`click`,()=>void d()),s.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),d())}),requestAnimationFrame(()=>s.focus())}function U(){return F?g(F):null}function W(){return u().find(e=>e.id===F)??null}async function at(e){if(!F||e.length===0)return!1;let t=await l(F,e);return t.ok?(B.clear(),!0):(B.show(`error`,t.error),!1)}async function G(e){if(!F)return`No board is open.`;let t=await l(F,e);return t.ok?null:t.error}function K(e){let t=r(e);return t?n(t):`closed session`}function q(e){let t=U();return[...R?.selectedIds()??new Set].flatMap(e=>t?.elements[e]??[]).filter(t=>t.kind===e)}function J(){if(!I)return;let e=U(),t=q(`box`).length,n=R?.selectedIds().size??0;I.buttons.box.disabled=!e,I.buttons.wire.disabled=t!==2,I.buttons.note.disabled=t!==1,I.buttons.frame.disabled=t===0,I.buttons.fit.disabled=!e,I.buttons.remove.disabled=!e,I.toolbar.dataset.selectedCount=String(n)}function Y(){if(!I)return;let e=u();F&&!e.some(e=>e.id===F)&&(F=null),!F&&e[0]&&Q(e[0].id),I.list.replaceChildren(...e.map(e=>{let n=t(`button`,`wb-board-tab`,e.title);return n.type=`button`,n.setAttribute(`aria-pressed`,String(e.id===F)),e.connectedSessionIds.length>0&&n.append(t(`span`,`wb-board-tab-count`,String(e.connectedSessionIds.length))),n.addEventListener(`click`,()=>Q(e.id)),n})),ot()}function ot(){if(!I)return;let e=W(),n=u().length>0;I.boardHead.hidden=!e,I.canvas.hidden=!e,I.empty.hidden=!!e,I.empty.textContent=n?rt:nt,e&&(I.boardTitle.textContent=e.title,I.boardMeta.textContent=`v${e.version}`,I.presence.replaceChildren(...e.connectedSessionIds.map(e=>t(`span`,`wb-presence-pill`,K(e)))),e.connectedSessionIds.length===0&&I.presence.append(t(`span`,`wb-presence-none`,`no sessions connected`)),J(),X())}function st(e,t){let n=K(t);if(!e?.connectedSessionIds.includes(t))return`${n} is not connected to this board`;let r=e.queuedBySessionId[t]??0;return r===0?`${n} has read every change`:`${r} board ${r===1?`edit`:`edits`} queued for ${n}`}function X(){if(!I||!z)return;let e=W();I.dockQueued.textContent=st(e,z),I.sendToAgent.disabled=!e?.connectedSessionIds.includes(z)}async function ct(){if(!I||!F||!z)return;I.sendToAgent.disabled=!0,V.show(`busy`,`sending`);let e=await h(F,z);X(),e.ok?V.show(`ok`,`sent; the agent reads the board when it is ready`):V.show(`error`,e.error)}function Z(){if(!L)return;let e=U();e?(L.render(e),R?.pruneSelection(e),it&&=(R?.fit(),!1),J()):L.clear()}function Q(e){F!==e&&(F=e,it=!0,R?.clearSelection(),R?.closeTitleInput(),L?.clear(),B.clear(),Y(),m(e).then(Z))}function lt(){let t=U();if(!t)return;let n=q(`box`)[0],r=t.columns.map(e=>({value:e.id,text:e.title||e.id})),i=n?.column;i&&r.sort((e,t)=>Number(t.value===i)-Number(e.value===i)),H({title:`Add a box`,label:`Box title`,placeholder:`parse the feed`,maxLength:e.title,confirmLabel:`Add box`,choices:r.length>1?{label:`Column`,options:r}:void 0,onSubmit:(e,t)=>G([{op:`add`,element:{kind:`box`,id:x(`box`),title:e,column:t??r[0]?.value??`main`,lines:[],lane:null,ghost:!1,order:0,at:null}}])})}function ut(t){H({title:`Pin a note`,label:`Note`,placeholder:`what about retries?`,maxLength:e.noteText,confirmLabel:`Pin note`,onSubmit:e=>G([{op:`add`,element:{kind:`note`,id:x(`note`),on:t,text:e,author:``,resolvedBy:null}}])})}function dt(){let[e,t]=q(`box`);e&&t&&(R?.clearSelection(),at([{op:`add`,element:{kind:`wire`,id:x(`wire`),from:e.id,to:t.id,dashed:!1,tone:`plain`,label:null}}]))}function ft(){let t=q(`box`).map(e=>e.id);t.length!==0&&H({title:`Frame the selected boxes`,label:`Frame title`,placeholder:`intake`,maxLength:e.title,confirmLabel:`Add frame`,onSubmit:async e=>{let n=await G([{op:`add`,element:{kind:`frame`,id:x(`frame`),title:e,contains:t}}]);return n||R?.clearSelection(),n}})}function pt(){let e=W();if(!e)return;let t=e.connectedSessionIds.map(K),n=t.length>0?` ${t.join(`, `)} ${t.length===1?`is`:`are`} connected and will lose it.`:``;a({title:`Delete board`,message:`Delete "${e.title}" for good?${n}`,confirmLabel:`Delete board`,danger:!0,onConfirm:()=>{p(e.id).then(e=>{e.ok||B.show(`error`,e.error)})}})}function mt(){H({title:`New board`,label:`Board title`,placeholder:`knowledge writer`,maxLength:e.title,confirmLabel:`Create board`,onSubmit:async e=>{let t=await _(e);return t.ok?(Q(t.boardId),null):t.error}})}function $(e,n,r=``){let i=t(`button`,`wb-button ${r}`.trim(),e);return i.type=`button`,i.addEventListener(`click`,n),i}function ht(e){let n=t(`div`,`wb-top`),r=t(`div`,`wb-board-list`);r.setAttribute(`aria-label`,`Boards`),n.append(r,$(`new board`,mt));let i=t(`div`,`wb-board-head`),a=t(`div`,`wb-title-row`),o=t(`h2`,`wb-board-title`),c=t(`span`,`wb-board-meta`),l=t(`div`,`wb-presence`);a.append(o,c,l);let u=t(`div`,`wb-toolbar`),f={box:$(`box`,lt),wire:$(`wire`,dt),note:$(`note`,()=>{let[e]=q(`box`);e&&ut(e.id)}),frame:$(`frame`,ft),fit:$(`fit`,()=>R?.fit()),remove:$(`delete board`,pt,`wb-button-danger`)};f.fit.dataset.phoneVisible=``,u.append(f.box,f.wire,f.note,f.frame,f.fit,f.remove,B.element),i.append(a,u);let p=t(`div`,`wb-canvas`),m=document.createElementNS(tt,`svg`);m.setAttribute(`class`,`wb-svg`),m.setAttribute(`role`,`img`),m.setAttribute(`aria-label`,`Whiteboard`),m.setAttribute(`preserveAspectRatio`,`xMidYMin meet`),p.append(m);let h=t(`p`,`wb-empty`,nt),g=t(`div`,`wb-dock`);g.hidden=!0;let _=t(`span`,`wb-dock-queued`),v=$(`send to agent`,()=>void ct()),y=t(`div`,`wb-dock-bar`);y.append(_,v,V.element),g.append(y),e.replaceChildren(n,i,p,h,g),I={list:r,boardHead:i,boardTitle:o,boardMeta:c,presence:l,toolbar:u,canvas:p,empty:h,dock:g,dockQueued:_,sendToAgent:v,buttons:f};let b=et(m);L=b,R=ie({svg:m,canvas:p,renderer:b,currentBoard:U,sendOps:at,onSelectionChange:J,onPhoneTapBox:ut}),s(Y),d(e=>{e===F&&Z()}),Y()}function gt(){return document.documentElement.dataset.layout===`phone`}function _t(){z&&c()===z&&v(),z=null,I&&(I.dock.hidden=!0)}function vt(e){if(!I||gt())return;let t=r(e);t&&(z=e,I.dock.hidden=!1,V.clear(),X(),y(t,e,I.dock,{className:`wb-docked-card`}))}function yt(){let e=f();e&&(Q(e.boardId),e.dockSessionId&&vt(e.dockSessionId)),Y(),F&&m(F).then(Z)}var bt={mount:ht,refresh:yt,deactivate:_t};export{bt as view};
|
|
1
|
+
import{yt as e}from"./updates-view-core-D9wi2i2r.js";import{s as t}from"./dom-helpers-DBbFg1c_.js";import{a as n,r}from"./card-registry-KOEOaX0K.js";import{i}from"./action-status-DN4P3ZYj.js";import{a,n as o}from"./modal-USMHOKBI.js";import{ai as s,bi as c,ci as l,ei as u,ii as d,li as f,ni as p,oi as m,ri as h,si as g,ti as _,xi as v,yi as y}from"./index-B1lOI6hU.js";var b=4,ee=200,te=2e4,ne=1.1,re=[`wire`,`note`,`frame`,`box`];function x(e){let t=Math.random().toString(36).slice(2,8);return`${e}-${Date.now().toString(36)}${t}`}function S(){return document.documentElement.dataset.layout===`phone`}function ie(e){let{svg:n,canvas:r,renderer:i}=e,a=new Map,o=new Set,s={x:0,y:0,width:1e3,height:600},c=null,l=null;function u(){n.setAttribute(`viewBox`,`${s.x} ${s.y} ${s.width} ${s.height}`)}function d(){let e=i.layout();if(!e)return;let{bounds:t}=e,r=n.clientWidth,a=n.clientHeight;if(r===0||a===0){s={...t},u();return}let o=Math.max(1,t.width/r,t.height/a),c=r*o;s={x:t.x-(c-t.width)/2,y:t.y,width:c,height:a*o},u()}function f(e,t){let r=n.getScreenCTM();if(!r)return{x:e,y:t};let i=new DOMPoint(e,t).matrixTransform(r.inverse());return{x:i.x,y:i.y}}function p(){let e=n.clientWidth||1,t=n.clientHeight||1;return Math.max(s.width/e,s.height/t)}function m(e,t){let n=Math.min(te,Math.max(ee,s.width*t)),r=n/s.width;s={x:e.x-(e.x-s.x)*r,y:e.y-(e.y-s.y)*r,width:n,height:s.height*r},u()}function h(e,t){let n=p();s={...s,x:s.x-e*n,y:s.y-t*n},u()}function g(t){o=t,i.setSelection(o),e.onSelectionChange(o)}function _(e,t){if(!t){g(o.has(e)&&o.size===1?new Set:new Set([e]));return}let n=new Set(o);n.delete(e)||n.add(e),g(n)}function v(e){let t=new Set([...o].filter(t=>e?.elements[t]));t.size!==o.size&&g(t)}function y(e){let t=i.layout()?.elements.find(t=>t.id===e);return t?.kind===`box`?t:null}function x(){let[e,t]=[...a.values()];return!e||!t?0:Math.hypot(e.x-t.x,e.y-t.y)}function ie(){c={kind:`pinch`,distance:x(),viewWidth:s.width}}function C(e){if(e.button!==0||l)return;if(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),n.setPointerCapture(e.pointerId),a.size===2){ie();return}let t=i.elementFromTarget(e.target),r=t?.kind===`box`&&!S()?y(t.id):null;if(t&&r){c={kind:`drag`,pointerId:e.pointerId,boxId:t.id,origin:f(e.clientX,e.clientY),start:r,hasMoved:!1,isAdditive:e.shiftKey};return}if(t&&!S()){_(t.id,e.shiftKey);return}let o=t?.kind===`box`?t.id:null;c={kind:`pan`,pointerId:e.pointerId,lastClient:{x:e.clientX,y:e.clientY},hasMoved:!1,tappedBoxId:o}}function w(e,t){let n=f(t.clientX,t.clientY),r=n.x-e.origin.x,a=n.y-e.origin.y;!e.hasMoved&&Math.hypot(r,a)<b*p()||(e.hasMoved=!0,i.nodeOf(e.boxId)?.setAttribute(`transform`,`translate(${r} ${a})`))}function T(e,t){let n=t.clientX-e.lastClient.x,r=t.clientY-e.lastClient.y;!e.hasMoved&&Math.hypot(n,r)<b||(e.hasMoved=!0,e.lastClient={x:t.clientX,y:t.clientY},h(n,r))}function ae(e){let t=x();if(t<=0||e.distance<=0)return;let n=[...a.values()];m(f(n.reduce((e,t)=>e+t.x,0)/n.length,n.reduce((e,t)=>e+t.y,0)/n.length),e.viewWidth*(e.distance/t)/s.width)}function oe(e){a.has(e.pointerId)&&(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),c?.kind===`pinch`?ae(c):c?.kind===`drag`&&c.pointerId===e.pointerId?w(c,e):c?.kind===`pan`&&c.pointerId===e.pointerId&&T(c,e))}async function se(t,n){if(!t.hasMoved){_(t.boxId,t.isAdditive);return}let r=f(n.clientX,n.clientY),a={x:Math.round(t.start.x+r.x-t.origin.x),y:Math.round(t.start.y+r.y-t.origin.y)};await e.sendOps([{op:`set`,id:t.boxId,fields:{at:a}}])||i.nodeOf(t.boxId)?.removeAttribute(`transform`)}function ce(t){if(!a.delete(t.pointerId))return;let n=c;n?.kind===`pinch`?c=null:(c=null,n?.kind===`drag`&&n.pointerId===t.pointerId?se(n,t):n?.kind!==`pan`||n.hasMoved||(n.tappedBoxId&&S()?e.onPhoneTapBox(n.tappedBoxId):n.tappedBoxId||g(new Set)))}function le(e){a.delete(e.pointerId),c?.kind===`drag`&&i.nodeOf(c.boxId)?.removeAttribute(`transform`),c=null}function E(e){e.preventDefault(),e.ctrlKey||e.metaKey?m(f(e.clientX,e.clientY),e.deltaY>0?ne:1/ne):h(-e.deltaX,-e.deltaY)}function D(){let e=l;l=null,e?.remove()}function ue(a){let o=e.currentBoard()?.elements[a],s=i.nodeOf(a);if(o?.kind!==`box`||!s)return;D();let c=r.getBoundingClientRect(),u=s.getBoundingClientRect(),d=t(`input`,`wb-title-input`);d.type=`text`,d.value=o.title,d.maxLength=80,d.setAttribute(`aria-label`,`Box title`),d.style.left=`${u.left-c.left}px`,d.style.top=`${u.top-c.top}px`,d.style.width=`${Math.max(160,u.width)}px`,l=d,r.append(d),d.addEventListener(`keydown`,t=>{if(t.key===`Escape`){t.preventDefault(),D(),n.focus();return}if(t.key!==`Enter`)return;t.preventDefault();let r=d.value.trim();D(),n.focus(),r&&r!==o.title&&e.sendOps([{op:`set`,id:a,fields:{title:r}}])}),d.addEventListener(`blur`,D),d.focus(),d.select()}function de(e){if(S())return;let t=i.elementFromTarget(document.elementFromPoint(e.clientX,e.clientY));t?.kind===`box`&&ue(t.id)}function fe(){let t=e.currentBoard();if(!t||o.size===0)return;let n=[...o].flatMap(e=>t.elements[e]??[]),r=re.flatMap(e=>n.filter(t=>t.kind===e)).map(e=>({op:`remove`,id:e.id}));g(new Set),e.sendOps(r)}function pe(e){e.target===n&&(e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),fe()):e.key===`Escape`&&g(new Set))}return n.tabIndex=0,n.addEventListener(`pointerdown`,C),n.addEventListener(`pointermove`,oe),n.addEventListener(`pointerup`,ce),n.addEventListener(`pointercancel`,le),n.addEventListener(`wheel`,E,{passive:!1}),n.addEventListener(`dblclick`,de),n.addEventListener(`keydown`,pe),{fit:d,selectedIds:()=>o,clearSelection:()=>g(new Set),pruneSelection:v,closeTitleInput:D}}var C=40,w=220,T=90,ae=30,oe=20,se=18,ce=20,le=26,E=18,D=26,ue=170,de=21,fe=17,pe=10,O=22,me=24,he=16,ge=24,_e=8,ve=Object.freeze({blue:`#60a5fa`,green:`#4ade80`,orange:`#fb923c`,pink:`#f472b6`,cyan:`#22d3ee`,yellow:`#facc15`});function k(e,t){let n=e.split(/\s+/).filter(Boolean),r=[],i=``;for(let e of n){let n=e.match(RegExp(`.{1,${t}}`,`g`))??[e];for(let e of n){let n=i?`${i} ${e}`:e;n.length<=t?i=n:(r.push(i),i=e)}}return i&&r.push(i),r.length>0?r:[``]}function ye(e,t){let n=e.lanes.find(e=>e.id===t.lane);return n?{label:n.label||n.id,hex:ve[n.color]}:null}function be(e,t){let n=k(t.title,ce),r=t.lines.flatMap(e=>k(e.text,le-(e.muted?2:0)).map(t=>({text:t,muted:e.muted}))),i=ye(e,t);return{titleLines:n,bodyLines:r,lane:i,height:24+n.length*oe+r.length*se+(i?26:0)}}function A(e,t){return Object.values(e.elements).filter(e=>e.kind===t)}function xe(e){let t=k(e.text,de);return{lines:t,height:24+(t.length+1)*fe}}function Se(e){let t=new Map;for(let n of A(e,`note`)){let e=t.get(n.on),r=xe(n).height;t.set(n.on,e===void 0?r:e+pe+r)}return t}function Ce(e){return e.columns.map(e=>e.title?k(e.title,me):[])}function we(e){return(Math.max(1,...e.map(e=>e.length))-1)*he}function Te(e,t){let n=new Set(A(e,`box`).filter(e=>!e.at&&t.has(e.id)).map(e=>e.column)),r=[],i=C;for(let t of e.columns)r.push(i),i+=w+(n.has(t.id)?Math.max(T,186):T);return r}function Ee(e){let t=new Map;for(let n of A(e,`frame`))for(let e of n.contains)t.has(e)||t.set(e,n.id);return t}function De(e,t){return e===t?0:(e?E:0)+(t?44:0)}function Oe(e,t,n,r){let i=new Map,a=new Map,o=new Map,s=Ee(e),c=A(e,`box`).map((e,t)=>({box:e,index:t})).sort((e,t)=>e.box.order-t.box.order||e.index-t.index);for(let{box:l}of c){let c=Math.max(0,e.columns.findIndex(e=>e.id===l.column)),u=be(e,l),d=s.get(l.id)??null,f=(a.get(l.column)??n)+De(o.get(l.column)??null,d),p=l.at??{x:t[c]??C,y:f};if(!l.at){let e=(r.get(l.id)??0)-_e;a.set(l.column,f+Math.max(u.height,e)+ae),o.set(l.column,d)}i.set(l.id,{kind:`box`,id:l.id,x:p.x,y:p.y,width:w,height:u.height,titleLines:u.titleLines,bodyLines:u.bodyLines,lane:u.lane,isGhost:l.ghost})}return i}function ke(e){if(e.length===0)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+e.width)),i=Math.max(...e.map(e=>e.y+e.height));return{x:t,y:n,width:r-t,height:i-n}}function Ae(e,t){return A(e,`frame`).flatMap(e=>{let n=ke(e.contains.flatMap(e=>t.get(e)??[]));return n?[{kind:`frame`,id:e.id,title:e.title,x:n.x-E,y:n.y-E-D,width:n.width+36,height:n.height+36+D}]:[]})}function je(e,t){let n=e.x+e.width/2,r=t.x+t.width/2;if(Math.abs(r-n)>e.width/2){let i=r>n,a={x:i?e.x+e.width:e.x,y:e.y+Math.min(e.height/2,40)},o={x:i?t.x:t.x+t.width,y:t.y+Math.min(t.height/2,40)},s=(o.x-a.x)/2;return{start:a,end:o,path:`M ${a.x} ${a.y} C ${a.x+s} ${a.y}, ${o.x-s} ${o.y}, ${o.x} ${o.y}`}}let i=t.y>e.y,a={x:n,y:i?e.y+e.height:e.y},o={x:r,y:i?t.y:t.y+t.height},s=(o.y-a.y)/2;return{start:a,end:o,path:`M ${a.x} ${a.y} C ${a.x} ${a.y+s}, ${o.x} ${o.y-s}, ${o.x} ${o.y}`}}function Me(e,t){return A(e,`wire`).flatMap(e=>{let n=t.get(e.from),r=t.get(e.to);if(!n||!r)return[];let i=je(n,r);return[{kind:`wire`,id:e.id,path:i.path,start:i.start,end:i.end,label:e.label,labelAt:{x:(i.start.x+i.end.x)/2,y:(i.start.y+i.end.y)/2-6},isDashed:e.dashed,tone:e.tone,strokeHex:e.tone===`lane`?n.lane?.hex??null:null}]})}function Ne(e){return e.resolvedBy?`resolved by ${e.resolvedBy}`:e.author?`from ${e.author}`:``}function Pe(e,t){let n=new Map;return A(e,`note`).flatMap(e=>{let r=t.get(e.on);if(!r)return[];let{lines:i,height:a}=xe(e),o=n.get(e.on)??r.y-_e;return n.set(e.on,o+a+pe),[{kind:`note`,id:e.id,x:r.x+r.width-ge,y:o,width:ue,height:a,lines:i,byline:Ne(e),isResolved:e.resolvedBy!==null}]})}function Fe(e,t,n){let r=e.flatMap(e=>e.kind===`wire`?[]:[e]),i=(t.at(-1)??C)+w,a=ke([...r,{x:0,y:0,width:i,height:n}]);return a?{x:Math.min(0,a.x-C),y:Math.min(0,a.y-C),width:a.width+80,height:a.height+80}:{x:0,y:0,width:i+C,height:80}}function Ie(e){let t=Se(e),n=Te(e,t),r=Ce(e),i=we(r),a=84+i,o=Oe(e,n,a,t),s=[...Ae(e,o),...Me(e,o),...o.values(),...Pe(e,o)],c=Fe(s,n,a),l=c.y+c.height,u=e.lanes.map((e,t)=>({label:e.label||e.id,hex:ve[e.color],x:C,y:l+t*O})),d=l+u.length*O+(u.length>0?12:0),f=e.caption?{text:e.caption,x:C,y:d}:null,p=u.length*O+(f?30:0)+(u.length>0?12:0);return{columns:e.columns.map((e,t)=>({id:e.id,titleLines:r[t]??[],titleBaselineY:56,ruleY:66+i,x:n[t]??C,width:w})),elements:s,legend:u,caption:f,bounds:{...c,height:c.height+p}}}function Le(e){return JSON.stringify(e)}var Re=`http://www.w3.org/2000/svg`,j=12,ze=26,Be=20,Ve=18,He=17,Ue=14,We=16;function M(e,t={},n=``){let r=document.createElementNS(Re,e);for(let[e,n]of Object.entries(t))r.setAttribute(e,String(n));return n&&r.setAttribute(`class`,n),r}function N(e,t,n,r){let i=M(`text`,{x:t,y:n},r);return i.textContent=e,i}function P(e,t){let n=M(`g`,{},`wb-element ${t}`);return n.dataset.elementId=e.id,n.dataset.elementKind=e.kind,n}function Ge(e){let t=P(e,e.isGhost?`wb-box wb-ghost`:`wb-box`),n=M(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8},`wb-box-outline`);e.lane&&(n.style.stroke=e.lane.hex),t.append(n),e.titleLines.forEach((n,r)=>{t.append(N(n,e.x+j,e.y+ze+r*Be,`wb-box-title`))});let r=e.y+ze+e.titleLines.length*Be;if(e.bodyLines.forEach((n,i)=>{let a=e.x+j+(n.muted?Ue:0);t.append(N(n.text,a,r+i*Ve,n.muted?`wb-box-line wb-muted`:`wb-box-line`))}),!e.lane)return t;let i=e.y+e.height-28,a=Math.min(e.width-24,16+e.lane.label.length*8),o=M(`rect`,{x:e.x+j,y:i,width:a,height:18,rx:9},`wb-lane-pill`);o.style.stroke=e.lane.hex;let s=N(e.lane.label,e.x+j+8,i+13,`wb-lane-pill-text`);return s.style.fill=e.lane.hex,t.append(o,s),t}function Ke(e){let t=P(e,`wb-frame`);return t.append(M(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:12},`wb-frame-outline`),N(e.title,e.x+14,e.y+18,`wb-frame-title`)),t}function qe(e){let t=P(e,`wb-wire wb-tone-${e.tone}`),n=M(`path`,{d:e.path},`wb-wire-hit`),r=M(`path`,{d:e.path,"marker-end":`url(#wb-arrow)`},e.isDashed?`wb-wire-line wb-dashed`:`wb-wire-line`);return e.strokeHex&&(r.style.stroke=e.strokeHex),t.append(n,r,M(`circle`,{cx:e.start.x,cy:e.start.y,r:3},`wb-wire-dot`)),e.label&&t.append(N(e.label,e.labelAt.x,e.labelAt.y,`wb-wire-label`)),t}function Je(e){let t=P(e,e.isResolved?`wb-note wb-resolved`:`wb-note`);return t.append(M(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:4},`wb-note-card`)),e.lines.forEach((n,r)=>{t.append(N(n,e.x+10,e.y+22+r*He,`wb-note-text`))}),e.byline&&t.append(N(e.byline,e.x+10,e.y+22+e.lines.length*He,`wb-note-byline`)),t}var Ye={frame:`frames`,wire:`wires`,box:`boxes`,note:`notes`},Xe=[`box`,`frame`,`wire`,`note`];function Ze(e){switch(e.kind){case`box`:return Ge(e);case`frame`:return Ke(e);case`wire`:return qe(e);case`note`:return Je(e)}}function Qe(e){let t=M(`g`,{},`wb-chrome`);for(let n of e.columns)n.titleLines.length!==0&&(n.titleLines.forEach((e,r)=>{t.append(N(e,n.x,n.titleBaselineY+r*We,`wb-column-title`))}),t.append(M(`line`,{x1:n.x,y1:n.ruleY,x2:n.x+n.width,y2:n.ruleY},`wb-column-rule`)));for(let n of e.legend){let e=M(`rect`,{x:n.x,y:n.y,width:14,height:14,rx:3},`wb-legend-swatch`);e.style.fill=n.hex,t.append(e,N(n.label,n.x+22,n.y+12,`wb-legend-text`))}return e.caption&&t.append(N(e.caption.text,e.caption.x,e.caption.y+16,`wb-caption`)),t}function $e(){let e=M(`defs`),t=M(`marker`,{id:`wb-arrow`,viewBox:`0 0 10 10`,refX:9,refY:5,markerWidth:8,markerHeight:8,orient:`auto-start-reverse`});return t.append(M(`path`,{d:`M 0 1 L 10 5 L 0 9 z`,fill:`context-stroke`})),e.append(t),e}function et(e){let t={frames:M(`g`,{},`wb-layer`),wires:M(`g`,{},`wb-layer`),boxes:M(`g`,{},`wb-layer`),notes:M(`g`,{},`wb-layer`)},n=M(`g`);e.replaceChildren($e(),n,t.frames,t.wires,t.boxes,t.notes);let r=new Map,i=null,a=new Set;function o(e,t){t.classList.toggle(`is-selected`,a.has(e))}function s(e){let a=Ie(e),s=Qe(a);n.replaceWith(s),n=s;let c=new Set;for(let e of a.elements){c.add(e.id);let n=Le(e),i=r.get(e.id);if(i?.signature===n)continue;let a=Ze(e);o(e.id,a),i&&i.node.replaceWith(a),i||t[Ye[e.kind]].append(a),r.set(e.id,{signature:n,node:a})}for(let[e,t]of r)c.has(e)||(t.node.remove(),r.delete(e));return i=a,a}function c(e){if(!(e instanceof Element))return null;let t=e.closest(`.wb-element`),n=t?.dataset.elementId,r=Xe.find(e=>e===t?.dataset.elementKind);return!n||!r?null:{id:n,kind:r}}function l(e){a=e;for(let[e,t]of r)o(e,t.node)}function u(){for(let e of r.values())e.node.remove();r.clear();let e=M(`g`);n.replaceWith(e),n=e,i=null}return{render:s,layout:()=>i,elementFromTarget:c,nodeOf:e=>r.get(e)?.node??null,setSelection:l,clear:u}}var tt=`http://www.w3.org/2000/svg`,nt=`No boards yet. Make one here, or have an agent run glimmervoid whiteboard new <title>.`,rt=`Pick a board above.`,F=null,I=null,L=null,R=null,it=!0,z=null,B=i(`action-status wb-status`),V=i(`action-status wb-status`);function H(e){let{dialog:n,close:r,actions:i,btnCancel:a}=o({title:e.title}),s=t(`input`,`dialog-input`);s.type=`text`,s.placeholder=e.placeholder,s.maxLength=e.maxLength,s.value=e.initialValue??``,s.autocomplete=`off`,s.setAttribute(`aria-label`,e.label);let c=t(`div`,`dialog-error`);c.setAttribute(`role`,`alert`);let l=e.choices?t(`select`,`dialog-input wb-dialog-select`):null;if(l&&e.choices){l.setAttribute(`aria-label`,e.choices.label);for(let n of e.choices.options){let e=t(`option`,null,n.text);e.value=n.value,l.append(e)}}let u=t(`button`,`btn-dialog btn-dialog-confirm`,e.confirmLabel);u.type=`button`,i.append(u),n.append(t(`label`,`dialog-label`,e.label),s,...l?[l]:[],c,i);async function d(){let t=s.value.trim();if(!t){c.textContent=`${e.label} is empty.`;return}u.disabled=!0;let n=await e.onSubmit(t,l?.value??null);u.disabled=!1,n?c.textContent=n:r()}a.addEventListener(`click`,r),u.addEventListener(`click`,()=>void d()),s.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),d())}),requestAnimationFrame(()=>s.focus())}function U(){return F?g(F):null}function W(){return u().find(e=>e.id===F)??null}async function at(e){if(!F||e.length===0)return!1;let t=await l(F,e);return t.ok?(B.clear(),!0):(B.show(`error`,t.error),!1)}async function G(e){if(!F)return`No board is open.`;let t=await l(F,e);return t.ok?null:t.error}function K(e){let t=r(e);return t?n(t):`closed session`}function q(e){let t=U();return[...R?.selectedIds()??new Set].flatMap(e=>t?.elements[e]??[]).filter(t=>t.kind===e)}function J(){if(!I)return;let e=U(),t=q(`box`).length,n=R?.selectedIds().size??0;I.buttons.box.disabled=!e,I.buttons.wire.disabled=t!==2,I.buttons.note.disabled=t!==1,I.buttons.frame.disabled=t===0,I.buttons.fit.disabled=!e,I.buttons.remove.disabled=!e,I.toolbar.dataset.selectedCount=String(n)}function Y(){if(!I)return;let e=u();F&&!e.some(e=>e.id===F)&&(F=null),!F&&e[0]&&Q(e[0].id),I.list.replaceChildren(...e.map(e=>{let n=t(`button`,`wb-board-tab`,e.title);return n.type=`button`,n.setAttribute(`aria-pressed`,String(e.id===F)),e.connectedSessionIds.length>0&&n.append(t(`span`,`wb-board-tab-count`,String(e.connectedSessionIds.length))),n.addEventListener(`click`,()=>Q(e.id)),n})),ot()}function ot(){if(!I)return;let e=W(),n=u().length>0;I.boardHead.hidden=!e,I.canvas.hidden=!e,I.empty.hidden=!!e,I.empty.textContent=n?rt:nt,e&&(I.boardTitle.textContent=e.title,I.boardMeta.textContent=`v${e.version}`,I.presence.replaceChildren(...e.connectedSessionIds.map(e=>t(`span`,`wb-presence-pill`,K(e)))),e.connectedSessionIds.length===0&&I.presence.append(t(`span`,`wb-presence-none`,`no sessions connected`)),J(),X())}function st(e,t){let n=K(t);if(!e?.connectedSessionIds.includes(t))return`${n} is not connected to this board`;let r=e.queuedBySessionId[t]??0;return r===0?`${n} has read every change`:`${r} board ${r===1?`edit`:`edits`} queued for ${n}`}function X(){if(!I||!z)return;let e=W();I.dockQueued.textContent=st(e,z),I.sendToAgent.disabled=!e?.connectedSessionIds.includes(z)}async function ct(){if(!I||!F||!z)return;I.sendToAgent.disabled=!0,V.show(`busy`,`sending`);let e=await h(F,z);X(),e.ok?V.show(`ok`,`sent; the agent reads the board when it is ready`):V.show(`error`,e.error)}function Z(){if(!L)return;let e=U();e?(L.render(e),R?.pruneSelection(e),it&&=(R?.fit(),!1),J()):L.clear()}function Q(e){F!==e&&(F=e,it=!0,R?.clearSelection(),R?.closeTitleInput(),L?.clear(),B.clear(),Y(),m(e).then(Z))}function lt(){let t=U();if(!t)return;let n=q(`box`)[0],r=t.columns.map(e=>({value:e.id,text:e.title||e.id})),i=n?.column;i&&r.sort((e,t)=>Number(t.value===i)-Number(e.value===i)),H({title:`Add a box`,label:`Box title`,placeholder:`parse the feed`,maxLength:e.title,confirmLabel:`Add box`,choices:r.length>1?{label:`Column`,options:r}:void 0,onSubmit:(e,t)=>G([{op:`add`,element:{kind:`box`,id:x(`box`),title:e,column:t??r[0]?.value??`main`,lines:[],lane:null,ghost:!1,order:0,at:null}}])})}function ut(t){H({title:`Pin a note`,label:`Note`,placeholder:`what about retries?`,maxLength:e.noteText,confirmLabel:`Pin note`,onSubmit:e=>G([{op:`add`,element:{kind:`note`,id:x(`note`),on:t,text:e,author:``,resolvedBy:null}}])})}function dt(){let[e,t]=q(`box`);e&&t&&(R?.clearSelection(),at([{op:`add`,element:{kind:`wire`,id:x(`wire`),from:e.id,to:t.id,dashed:!1,tone:`plain`,label:null}}]))}function ft(){let t=q(`box`).map(e=>e.id);t.length!==0&&H({title:`Frame the selected boxes`,label:`Frame title`,placeholder:`intake`,maxLength:e.title,confirmLabel:`Add frame`,onSubmit:async e=>{let n=await G([{op:`add`,element:{kind:`frame`,id:x(`frame`),title:e,contains:t}}]);return n||R?.clearSelection(),n}})}function pt(){let e=W();if(!e)return;let t=e.connectedSessionIds.map(K),n=t.length>0?` ${t.join(`, `)} ${t.length===1?`is`:`are`} connected and will lose it.`:``;a({title:`Delete board`,message:`Delete "${e.title}" for good?${n}`,confirmLabel:`Delete board`,danger:!0,onConfirm:()=>{p(e.id).then(e=>{e.ok||B.show(`error`,e.error)})}})}function mt(){H({title:`New board`,label:`Board title`,placeholder:`knowledge writer`,maxLength:e.title,confirmLabel:`Create board`,onSubmit:async e=>{let t=await _(e);return t.ok?(Q(t.boardId),null):t.error}})}function $(e,n,r=``){let i=t(`button`,`wb-button ${r}`.trim(),e);return i.type=`button`,i.addEventListener(`click`,n),i}function ht(e){let n=t(`div`,`wb-top`),r=t(`div`,`wb-board-list`);r.setAttribute(`aria-label`,`Boards`),n.append(r,$(`new board`,mt));let i=t(`div`,`wb-board-head`),a=t(`div`,`wb-title-row`),o=t(`h2`,`wb-board-title`),c=t(`span`,`wb-board-meta`),l=t(`div`,`wb-presence`);a.append(o,c,l);let u=t(`div`,`wb-toolbar`),f={box:$(`box`,lt),wire:$(`wire`,dt),note:$(`note`,()=>{let[e]=q(`box`);e&&ut(e.id)}),frame:$(`frame`,ft),fit:$(`fit`,()=>R?.fit()),remove:$(`delete board`,pt,`wb-button-danger`)};f.fit.dataset.phoneVisible=``,u.append(f.box,f.wire,f.note,f.frame,f.fit,f.remove,B.element),i.append(a,u);let p=t(`div`,`wb-canvas`),m=document.createElementNS(tt,`svg`);m.setAttribute(`class`,`wb-svg`),m.setAttribute(`role`,`img`),m.setAttribute(`aria-label`,`Whiteboard`),m.setAttribute(`preserveAspectRatio`,`xMidYMin meet`),p.append(m);let h=t(`p`,`wb-empty`,nt),g=t(`div`,`wb-dock`);g.hidden=!0;let _=t(`span`,`wb-dock-queued`),v=$(`send to agent`,()=>void ct()),y=t(`div`,`wb-dock-bar`);y.append(_,v,V.element),g.append(y),e.replaceChildren(n,i,p,h,g),I={list:r,boardHead:i,boardTitle:o,boardMeta:c,presence:l,toolbar:u,canvas:p,empty:h,dock:g,dockQueued:_,sendToAgent:v,buttons:f};let b=et(m);L=b,R=ie({svg:m,canvas:p,renderer:b,currentBoard:U,sendOps:at,onSelectionChange:J,onPhoneTapBox:ut}),s(Y),d(e=>{e===F&&Z()}),Y()}function gt(){return document.documentElement.dataset.layout===`phone`}function _t(){z&&c()===z&&v(),z=null,I&&(I.dock.hidden=!0)}function vt(e){if(!I||gt())return;let t=r(e);t&&(z=e,I.dock.hidden=!1,V.clear(),X(),y(t,e,I.dock,{className:`wb-docked-card`}))}function yt(){let e=f();e&&(Q(e.boardId),e.dockSessionId&&vt(e.dockSessionId)),Y(),F&&m(F).then(Z)}var bt={mount:ht,refresh:yt,deactivate:_t};export{bt as view};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e,d as t,f as n,s as r}from"./dom-helpers-DBbFg1c_.js";import{o as i}from"./card-registry-KOEOaX0K.js";import{c as a,i as o}from"./action-status-DN4P3ZYj.js";import{i as ee}from"./modal-USMHOKBI.js";import{Bt as te,Ct as s,Dt as c,Lt as l,Nt as u,Pt as d,Qr as f,Rt as p,St as m,Vt as h,Zr as ne,bt as g,dn as re,fn as ie,jt as ae,lt as oe,m as se,vt as _,wt as v,xt as y,yt as b}from"./index-
|
|
1
|
+
import{b as e,d as t,f as n,s as r}from"./dom-helpers-DBbFg1c_.js";import{o as i}from"./card-registry-KOEOaX0K.js";import{c as a,i as o}from"./action-status-DN4P3ZYj.js";import{i as ee}from"./modal-USMHOKBI.js";import{Bt as te,Ct as s,Dt as c,Lt as l,Nt as u,Pt as d,Qr as f,Rt as p,St as m,Vt as h,Zr as ne,bt as g,dn as re,fn as ie,jt as ae,lt as oe,m as se,vt as _,wt as v,xt as y,yt as b}from"./index-B1lOI6hU.js";import{t as x}from"./team-review-panel-COM1WLXF.js";import{t as S}from"./pr-queue-columns-DOCENcbT.js";var C={HIGH:`High confidence`,MEDIUM:`Medium confidence`,LOW:`Low confidence`},ce={HIGH:`ok`,MEDIUM:`warn`,LOW:`muted`},w={queued:`Waiting to be researched`,running:`Researching`,error:`Research failed`,aside:`Set aside`},le={forum:`Forum`,discord:`Discord`};function T(e){return e.status===`ready`&&e.verdict?{text:C[e.verdict],tone:ce[e.verdict]}:e.status===`ready`?{text:`Researched`,tone:`muted`}:e.status===`error`?{text:w.error,tone:`danger`}:{text:w[e.status],tone:`muted`}}function E(e){let t=le[e.item.source];return e.item.channel?`${t} #${e.item.channel}`:t}function D(e){return e.entry.item.title||`Untitled question`}function ue(e){return e.status!==`running`&&e.status!==`queued`}function O(e){return e.status!==`aside`}function k(e){let t=e.find(e=>e.id===`working`)?.items.length??0;return t===0?`No community question needs you right now.`:`No community question needs you right now. ${t} ${t===1?`question is`:`questions are`} being researched.`}function A(e){return e?e.configured===!1?e.reason??`The community lane is not set up yet.`:`No community questions yet. New ones asked after you turned this on show up here.`:`Waiting for the community lane to report.`}function j(e){return e.filter(e=>!e.isWorkspace&&!e.isEphemeral).map(({id:e,name:t})=>({id:e,name:t})).toSorted((e,t)=>e.name.localeCompare(t.name))}var M=null,N=null,P=null,F=null,I=[],L=null,R=!1,z=null,B=null,V=``,H=new Map;function U(){return j([...i].map(([e,t])=>({id:e,name:t.nameEl.textContent??e,isWorkspace:t.card.dataset.workspace!==void 0,isEphemeral:t.card.dataset.ephemeral!==void 0})))}function W(e,t){let n=r(`button`,`pr-action pr-action-ghost`,e);return n.type=`button`,n.disabled=!f(t),n.addEventListener(`click`,()=>ne(t)),n}function G(e,t,n){let i=r(`button`,`pr-action`,e);return i.type=`button`,i.disabled=!t,i.addEventListener(`click`,n),i}function K(e,t,n){let i=r(`ul`,e);i.setAttribute(`aria-label`,t);for(let e of n)i.append(r(`li`,null,e));return i}function de(e){let t=r(`div`,`pr-detail-heading`),n=r(`div`,`pr-detail-title`);n.append(r(`h2`,null,e.item.title||`Untitled question`));let i=r(`div`,`pr-detail-meta`),a=Date.parse(e.item.createdAt);return i.append(r(`span`,null,e.item.author),r(`span`,null,E(e))),Number.isNaN(a)||i.append(r(`span`,null,`Asked ${se(a)}`)),t.append(n,i),t}function fe(e){let t=r(`section`,`community-question`);return t.setAttribute(`aria-label`,`Question as asked`),t.append(r(`h3`,`pr-section-heading`,`Question as asked`),r(`p`,`community-question-body`,e.item.body)),t}function pe(e){let t=r(`section`,`pr-verdict-box`);t.setAttribute(`aria-label`,`Research`);let n=T(e),i=r(`div`,`pr-verdict-line`),a=r(`strong`,`community-badge`,n.text);if(a.dataset.tone=n.tone,i.append(a),t.append(i),e.error&&t.append(r(`p`,`pr-attention-detail`,e.error)),e.summary&&t.append(r(`p`,`pr-verdict-summary`,e.summary)),e.goal&&t.append(r(`p`,`community-goal`,`Goal: ${e.goal}`)),e.gaps.length>0&&t.append(K(`pr-verdict-gaps`,`Not covered`,e.gaps)),e.checked.length===0)return t;let o=r(`details`,`pr-verdict-checked`);return o.append(r(`summary`,null,`What it checked (${e.checked.length})`),K(`community-checked`,`What it checked`,e.checked)),t.append(o),t}function me(e){if(!e.draft)return null;let t=r(`section`,`community-draft`);t.setAttribute(`aria-label`,`Draft reply`),t.append(r(`h3`,`pr-section-heading`,`Draft reply`),r(`p`,`community-draft-body`,e.draft.body));let n=e.draft.publicLinks.filter(f);if(n.length===0)return t;let i=r(`ul`,`community-links`);for(let e of n){let t=r(`li`);t.append(W(e,e)),i.append(t)}return t.append(i),t}function he(t,n){let r=t.draft?e(t.draft.body):null;r?r.then(()=>n.show(`ok`,`Draft copied. Post it yourself where the question was asked.`),()=>n.show(`error`,`Copying failed. Select the draft text instead.`)):n.show(`error`,`This browser does not allow copying here. Select the draft text instead.`)}async function ge(e,t){if(!V){t.show(`error`,`Pick a session to start from first.`);return}let n=await a(`open-community-session`,{key:e.item.key,projectId:V},t,{busyText:`Starting a session with the research.`});n?.type===`open-community-session-result`&&(n.ok?(t.show(`ok`,`Started ${n.sessionName??`a session`}.`),n.sessionId&&oe()?.openTerminal(n.sessionId)):t.show(`error`,n.error??`The session did not start.`))}async function q(e,t,n){let r=t===`rerun`?`Queuing the research again.`:`Setting the question aside.`,i=await a(`community-action`,{key:e.item.key,action:t},n,{busyText:r});i?.type===`community-action-result`&&(i.ok||n.show(`error`,i.error??`The change did not apply.`))}function _e(){let e=r(`select`,`community-session-picker`);e.setAttribute(`aria-label`,`Session to start from`);let t=U();t.some(e=>e.id===V)||(V=t[0]?.id??``);for(let n of t){let t=r(`option`,null,n.name);t.value=n.id,t.selected=n.id===V,e.append(t)}return e.disabled=t.length===0,e.addEventListener(`change`,()=>{V=e.value}),e}function ve(e){let t=r(`div`,`community-actions`),n=o(`pr-action-status`),i=r(`div`,`community-action-buttons`);return i.append(G(`Copy draft`,e.draft!==null,()=>he(e,n)),W(`Open thread`,e.item.url),_e(),G(`Start session`,!0,()=>void ge(e,n)),G(`Re-run`,ue(e),()=>void q(e,`rerun`,n)),G(`Set aside`,O(e),()=>void q(e,`set-aside`,n))),t.append(i,n.element),t}function ye(e){let t=r(`article`,`pr-detail community-detail`),n=me(e);return t.append(de(e),ve(e),...n?[n]:[],pe(e),fe(e)),t}function J(){if(!P)return;let e=l(I,L),t=e?JSON.stringify(e.entry):`empty:${h(I).length}`;if(t===B)return;if(B=t,e){P.replaceChildren(ye(e.entry));return}let n=I.some(e=>e.items.length>0);P.replaceChildren(n?x({title:`All caught up`,detail:k(I)}):r(`p`,`pr-empty`,A(g())))}function Y(e,t){s(u(e))&&t.querySelector(`.pr-queue-unseen`)?.remove()}function X(){if(!F)return;let e=d(I,D);ie(F,c(e),e.filter(e=>e.id!==L))}function Z(e){L=e;for(let[t,n]of H)n.setAttribute(`aria-current`,String(t===e));let t=l(I,e),n=H.get(e);t&&n&&Y(t,n),J(),X(),M&&(M.dataset.detailOpen=`true`)}function be(){M&&(M.dataset.detailOpen=`false`),L&&H.get(L)?.focus({preventScroll:!0})}function Q(e){let t=l(I,e);if(!t)return;I.find(e=>e.items.includes(t))?.id===`aside`&&(R=!0),L=e,$(),Z(e);let n=H.get(e);n?.focus({preventScroll:!0}),n?.scrollIntoView({block:`nearest`})}function xe(e){if(e.repeat||e.defaultPrevented||!M||t(M)||ee()||n(e)||document.activeElement?.classList.contains(`xterm-helper-textarea`))return;let r=p(e);if(r!==`next-row`&&r!==`previous-row`)return;let i=te([...H.keys()],L,r===`next-row`?1:-1);i&&(e.preventDefault(),i!==L&&Q(i))}function Se(e,t){let n=r(`button`,`pr-queue-row pr-queue-row-quiet`);n.type=`button`,n.dataset.queueKey=e.key,n.setAttribute(`aria-current`,String(e.key===L));let i=T(e.entry),a=r(`span`,`review-queue-action community-badge`,i.text);a.dataset.tone=i.tone;let o=r(`span`,`pr-queue-top`);if(o.append(a,r(`span`,`pr-queue-title`,D(e))),n.append(o,r(`span`,`pr-queue-elapsed`,E(e.entry))),n.title=D(e),t&&m(u(e))){let e=r(`span`,`tab-activity active pr-queue-unseen`);e.setAttribute(`aria-hidden`,`true`),n.append(e)}return n.addEventListener(`click`,()=>Z(e.key)),H.set(e.key,n),n}function Ce(e){let t=r(`h3`,`pr-section-heading review-group-heading`),n=r(`span`,`review-group-count`,String(e.items.length));if(e.id!==`aside`)return t.append(r(`span`,null,e.title),n),t;let i=r(`button`,`review-group-toggle`),a=r(`span`,`review-group-chevron`,`▸`);return a.setAttribute(`aria-hidden`,`true`),i.append(a,e.title),i.type=`button`,i.setAttribute(`aria-expanded`,String(R)),i.addEventListener(`click`,()=>{R=!R,z=null,$()}),t.append(i,n),t}function we(e){let t=r(`section`,`pr-queue-section`);if(t.dataset.group=e.id,t.append(Ce(e)),e.id===`aside`&&!R)return t;for(let n of e.items)t.append(Se(n,e.id===`turn`));return t}function $(){if(!N)return;I=b(),L=ae(I.filter(e=>e.id!==`aside`||R),L),X();let e=JSON.stringify([I,L,R,y(),g()?.error??null]);if(e!==z){z=e,H.clear();let t=g()?.error,n=t?[r(`p`,`my-pr-note`,t)]:[],i=I.filter(e=>e.items.length>0).map(we);N.replaceChildren(...n,...i.length>0?i:[r(`p`,`pr-empty`,A(g()))])}J()}function Te(e){if(M)return;M=r(`div`,`pr-content review-queue community-queue`),e.append(M);let n=S({queueLabel:`Community questions`,scopeTabs:null,resizerLabel:`Resize community queue`});N=n.queue,P=r(`div`,`review-queue-detail`);let i=r(`div`,`review-queue-phone-bar`),a=r(`button`,`pr-action pr-action-ghost review-queue-back`,`Back to queue`);a.type=`button`,a.addEventListener(`click`,be),i.append(a),n.detail.append(i,P),F=re({onJump:()=>{let e=d(I,D).find(e=>e.id!==L)?.id;e&&Q(e)},rowFor:e=>H.get(e)}),F.classList.add(`review-queue-banner`),n.queue.before(F),M.append(n.columns),M.dataset.detailOpen=`false`,_(()=>!t(M)),v(e=>{e.kind===`status`&&$()}),document.addEventListener(`keydown`,xe),$()}var Ee={mount:Te,refresh:()=>{B=null,$()}};export{Ee as view};
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,F as t,I as n,L as r,at as i,it as a}from"./updates-view-core-D9wi2i2r.js";import{g as o,h as s,s as c}from"./dom-helpers-DBbFg1c_.js";import{d as l}from"./control-ws-ZZY6O0nz.js";import{i as u,s as d,t as f}from"./action-status-DN4P3ZYj.js";import{n as p,r as m,t as h}from"./modal-USMHOKBI.js";import{n as g}from"./session-tick-BScyNMec.js";import{Ar as _,Dr as v,In as y,Mr as b,Or as x,Tr as S,_r as C,gi as w,hi as T,jr as E,kr as D,m as O,mi as k}from"./index-
|
|
1
|
+
import{C as e,F as t,I as n,L as r,at as i,it as a}from"./updates-view-core-D9wi2i2r.js";import{g as o,h as s,s as c}from"./dom-helpers-DBbFg1c_.js";import{d as l}from"./control-ws-ZZY6O0nz.js";import{i as u,s as d,t as f}from"./action-status-DN4P3ZYj.js";import{n as p,r as m,t as h}from"./modal-USMHOKBI.js";import{n as g}from"./session-tick-BScyNMec.js";import{Ar as _,Dr as v,In as y,Mr as b,Or as x,Tr as S,_r as C,gi as w,hi as T,jr as E,kr as D,m as O,mi as k}from"./index-B1lOI6hU.js";import{t as ee}from"./repo-roots-adder-2vUcylJi.js";import{t as te}from"./sandboxed-frame-D9MEfNuX.js";var ne=`<h2 class="dialog-title" id="add-session-title">Add Session</h2>
|
|
2
2
|
<fieldset class="dialog-mode-controls add-session-agent-only" aria-label="Session kind">
|
|
3
3
|
<button type="button" class="dialog-mode-button" id="add-session-single-mode" aria-pressed="true">Single repo</button>
|
|
4
4
|
<button type="button" class="dialog-mode-button" id="add-session-workspace-mode" aria-pressed="false">Workspace</button>
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./dom-helpers-DBbFg1c_.js";import{d as t}from"./control-ws-ZZY6O0nz.js";import{s as n,t as r}from"./action-status-DN4P3ZYj.js";import{a as i,r as a,t as o}from"./modal-USMHOKBI.js";import{fi as s,wn as c}from"./index-
|
|
1
|
+
import{s as e}from"./dom-helpers-DBbFg1c_.js";import{d as t}from"./control-ws-ZZY6O0nz.js";import{s as n,t as r}from"./action-status-DN4P3ZYj.js";import{a as i,r as a,t as o}from"./modal-USMHOKBI.js";import{fi as s,wn as c}from"./index-B1lOI6hU.js";import{i as l,t as u}from"./plan-render-BkviPv-c.js";var d=null;function f(t){let n=s(t.sessionId);t.select.replaceChildren(...n.map(n=>{let r=e(`option`,null,n.name);return r.value=n.path,r.selected=n.path===t.docPath,r})),t.select.hidden=n.length<2,t.title.textContent=n.find(e=>e.path===t.docPath)?.name??t.title.textContent}function p(e){let t=s(e.sessionId).some(t=>t.path===e.docPath);e.btnEdit.setAttribute(`aria-pressed`,String(e.mode===`edit`)),e.btnPreview.setAttribute(`aria-pressed`,String(e.mode===`preview`)),e.textarea.hidden=e.mode!==`edit`,e.preview.hidden=e.mode!==`preview`,e.select.disabled=e.isBusy,e.btnReload.disabled=e.isBusy||!t,e.btnSave.disabled=e.isBusy||!t||e.baseHash===null||!e.hasUnsavedChanges}function m(e,t,n=`quiet`){e.status.textContent=t,e.status.dataset.tone=n}function h(e){e.preview.replaceChildren(u(l(e.textarea.value)))}function g(e,t){i({title:e,message:`Your unsaved edits will be lost.`,confirmLabel:`Discard`,danger:!0,onConfirm:t})}function _(e,t,n){e.hasUnsavedChanges?g(t,n):n()}async function v(e,i){try{return{reply:await t(e,i,{timeoutMs:r}),failureText:null}}catch(e){return{reply:null,failureText:n(e,r)}}}async function y(e,t){e.docPath=t,e.isBusy=!0,e.baseHash=null,e.textarea.readOnly=!0,f(e),m(e,`Loading`),p(e);let{reply:n,failureText:r}=await v(`session-doc-read`,{id:e.sessionId,path:t});if(d!==e||e.docPath!==t)return;e.isBusy=!1,e.textarea.readOnly=!1;let i=n?.type===`session-doc-response`?n:null;!i?.ok||i.text===void 0||i.hash===void 0?(m(e,i?.error||r||`Could not open this doc`,`warn`),p(e)):(e.textarea.value=i.text,e.baseHash=i.hash,e.hasUnsavedChanges=!1,e.mode===`preview`&&h(e),m(e,``),p(e))}async function b(e){if(e.btnSave.disabled||e.baseHash===null)return;e.isBusy=!0,m(e,`Saving`),p(e);let t=e.docPath,n=e.textarea.value,{reply:r,failureText:i}=await v(`session-doc-save`,{id:e.sessionId,path:t,text:n,baseHash:e.baseHash});if(d!==e||e.docPath!==t)return;e.isBusy=!1;let a=r?.type===`session-doc-save-result`?r:null;!a?.ok||a.hash===void 0?(m(e,a?.conflict?`The agent changed this file since you opened it. Reload to see its version.`:a?.error||i||`Save failed`,`warn`),p(e)):(e.baseHash=a.hash,e.hasUnsavedChanges=e.textarea.value!==n,m(e,e.hasUnsavedChanges?`Unsaved changes`:`Saved`),p(e))}function x(e,t){e.mode=t,t===`preview`&&h(e),p(e),t===`edit`&&e.textarea.focus()}function S(t,n){let r=e(`button`,`plan-control ${n}`,t);return r.type=`button`,r}function C(t){let n=s(t)[0];if(!n||d)return;let r=()=>_(M,`Close this doc?`,()=>M.close()),i=a({dialogClass:`doc-editor`,closeOnBackdrop:!1,onEscape:r}),l=`doc-editor-title-${t}`,u=e(`h3`,`doc-editor-title`,n.name);u.id=l;let f=e(`select`,`plan-control doc-editor-picker`);f.setAttribute(`aria-label`,`Doc`);let h=e(`span`,`doc-editor-status`);h.setAttribute(`role`,`status`);let g=S(`Edit`,`doc-editor-mode`),v=S(`Preview`,`doc-editor-mode`),C=S(`Reload`,`doc-editor-reload`),w=S(`Save`,`doc-editor-save`),T=S(`Close`,`doc-editor-close`),E=e(`div`,`doc-editor-modes`);E.append(g,v);let D=e(`div`,`doc-editor-actions`);D.append(h,C,w,T);let O=e(`div`,`doc-editor-header`);O.append(u,f,E,D);let k=e(`textarea`,`plan-editor doc-editor-text`);k.spellcheck=!0,k.setAttribute(`aria-labelledby`,l);let A=e(`div`,`doc-editor-preview`),j=e(`div`,`doc-editor-body`);j.append(k,A),i.dialog.append(O,j),o(i.dialog,l);let M={sessionId:t,docPath:n.path,baseHash:null,hasUnsavedChanges:!1,isBusy:!1,mode:c()?`preview`:`edit`,title:u,select:f,textarea:k,preview:A,status:h,btnEdit:g,btnPreview:v,btnReload:C,btnSave:w,close:()=>{d=null,i.close()}};d=M,k.addEventListener(`input`,()=>{M.hasUnsavedChanges||(M.hasUnsavedChanges=!0,m(M,`Unsaved changes`),p(M))}),k.addEventListener(`keydown`,e=>{(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),b(M))}),f.addEventListener(`change`,()=>{let e=f.value;f.value=M.docPath,_(M,`Open another doc?`,()=>{y(M,e)})}),g.addEventListener(`click`,()=>x(M,`edit`)),v.addEventListener(`click`,()=>x(M,`preview`)),C.addEventListener(`click`,()=>{_(M,`Reload this doc?`,()=>{y(M,M.docPath)})}),w.addEventListener(`click`,()=>{b(M)}),T.addEventListener(`click`,r),y(M,n.path),M.mode===`edit`&&k.focus()}function w(e){d&&d.sessionId===e&&(f(d),p(d),!s(e).some(e=>e.path===d?.docPath)&&m(d,`This doc is no longer surfaced, so it cannot be saved.`,`warn`))}export{w as applyDocsToOpenEditor,C as openDocEditor};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{lt as e}from"./updates-view-core-D9wi2i2r.js";import{s as t}from"./dom-helpers-DBbFg1c_.js";import{u as n}from"./control-ws-ZZY6O0nz.js";import{bt as r}from"./ui-prefs-DfBm2IRm.js";import{Fn as i,Pn as a,_i as o,i as s,vi as c}from"./index-
|
|
1
|
+
import{lt as e}from"./updates-view-core-D9wi2i2r.js";import{s as t}from"./dom-helpers-DBbFg1c_.js";import{u as n}from"./control-ws-ZZY6O0nz.js";import{bt as r}from"./ui-prefs-DfBm2IRm.js";import{Fn as i,Pn as a,_i as o,i as s,vi as c}from"./index-B1lOI6hU.js";var l={teamReview:e=>`${e} pull requests reviewed this week. Reviews lines up every PR waiting on you, and it is off right now.`,issues:e=>`${e} issues touched this week. The Issues tab keeps them in one list and starts a session on any of them, and it is off right now.`,usage:()=>`Keeping an eye on tokens? Usage tracks spend per session and warns before a limit hits, and it is off right now.`,posthog:()=>`Hunting errors again? Radar watches PostHog error tracking and can investigate an issue for you, and it is off right now.`,benchmarks:()=>`Comparing agents by hand? Bench runs the same review cases across agent setups side by side, and it is off right now.`};function u(e){return`${l[e.feature](e.distinctTargetCount)} Show me takes you to its switch in Settings.`}function d(e){let t=s.find(t=>t.rule===e);return t?{sectionId:t.sectionId,settingId:t.settingId}:null}var f=null;function p(e,t){n({type:`dashboard-telemetry`,event:`operator_action`,properties:{surface:`hints`,action:t,feature:e}})}function m(e){try{return i(localStorage,a(`feature-hint`,`${e.feature}-${e.raisedAt}`),Date.now())}catch{return!0}}function h(t,n){if(n.isFeatureEnabled(t)){n.openView(e[t]);return}let r=d(t);r&&n.openSetting(r.sectionId,r.settingId)}function g(){return f?.isConnected===!0}function _({text:e,ariaLabel:n,onOpen:i,onDismiss:a}){let s=t(`aside`,`feature-hint`);s.setAttribute(`aria-live`,`polite`),s.setAttribute(`aria-label`,n);let l=t(`div`,`feature-hint-bubble`),u=t(`button`,`btn-dialog btn-dialog-confirm`,`Show me`),d=t(`button`,`btn-dialog btn-dialog-cancel`,`Nah`);u.type=`button`,d.type=`button`;let p=t(`div`,`feature-hint-actions`);p.append(d,u),l.append(t(`p`,`feature-hint-text`,e),p);let m=c()??r[0];s.append(l,o(m,`feature-hint-animal`));function h(){s.remove(),f=null}u.addEventListener(`click`,()=>{h(),i()}),d.addEventListener(`click`,()=>{h(),a()}),document.body.append(s),f=s}function v(e,t){g()||m(e)&&(_({text:u(e),ariaLabel:`Feature tip`,onOpen:()=>{p(e.feature,`open`),h(e.feature,t)},onDismiss:()=>p(e.feature,`dismiss`)}),p(e.feature,`shown`))}export{g as isHintCardShown,v as showFeatureHint,_ as showHintCard};
|
|
Binary file
|
package/dist/client/assets/{first-run-checklist-DZajXPRH.js → first-run-checklist-DvbK1fFl.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./dom-helpers-DBbFg1c_.js";import{d as t,u as n}from"./control-ws-ZZY6O0nz.js";import{i as r,s as i,t as a}from"./action-status-DN4P3ZYj.js";import{br as o,hr as s,jn as c,yr as l}from"./index-
|
|
1
|
+
import{s as e}from"./dom-helpers-DBbFg1c_.js";import{d as t,u as n}from"./control-ws-ZZY6O0nz.js";import{i as r,s as i,t as a}from"./action-status-DN4P3ZYj.js";import{br as o,hr as s,jn as c,yr as l}from"./index-B1lOI6hU.js";import{a as u,c as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v}from"./repo-roots-adder-2vUcylJi.js";import{n as y,t as b}from"./setup-step-D0y3riKj.js";var x=`npm install -g @anthropic-ai/claude-code`,S=null,C=null,w=null,T=null,E={steps:g,agentSummary:``,repoRoots:[],isShellAvailable:!1},D=0,O=!1,k=!1,A=new Set,j=r(`first-run-load-status`),M=c();function N(e){n({type:`dashboard-telemetry`,event:`operator_action`,properties:{surface:`onboarding`,action:e}})}function P(e){for(let t of _(A,e))n({type:`dashboard-telemetry`,event:`onboarding_step`,properties:t})&&A.add(d(t))}function F(){return s()?`No supported agent is on PATH of the machine running Glimmervoid. Install Claude Code, Codex or Grok there, then rescan.`:`No supported agent is on PATH. Install Claude Code, Codex or Grok, then rescan.`}function I(){let t=e(`button`,`btn-dialog btn-dialog-cancel`,`Open shell`);return t.type=`button`,t.addEventListener(`click`,()=>{N(`open-shell`),o()}),t}function L(){let t=e(`div`,`first-run-step-actions`);w=e(`button`,`btn-dialog btn-dialog-cancel`,`Rescan`),w.type=`button`,w.addEventListener(`click`,()=>{N(`rescan`),V({rescanAgents:!0})}),t.append(w),E.isShellAvailable&&t.append(I());let n=[e(`p`,`first-run-step-text`,F()),b(x),t];return O?[...n,e(`p`,`first-run-step-hint`,`Still missing after a rescan? Restart Glimmervoid from a terminal where the command runs. Other terminal agents go under customAgents.`)]:n}function R(){let t=T??v({onAdded:e=>{N(e===`typed`?`add-root-typed`:`add-root-suggested`),V({rescanAgents:!1})}});return T=t,[e(`p`,`first-run-step-text`,`The folder that holds your git checkouts. Each subfolder becomes a project you can start a session in.`),t.element]}function z(){let t=e(`div`,`first-run-step-actions`),n=e(`button`,`btn-dialog btn-dialog-confirm`,`+ Session`);return n.type=`button`,n.addEventListener(`click`,()=>{N(`add-session`),l()}),t.append(n),[e(`p`,`first-run-step-text`,`Pick a project and an agent. The session runs in its own git worktree, so your checkout is never touched.`),t]}function B(){if(!C)return;let{steps:e,agentSummary:t,repoRoots:n}=E;C.replaceChildren(y({title:`1. Agent CLI`,state:e.agent,summary:t,badge:`MISSING`,body:L}),y({title:`2. Repository roots`,state:e.repoRoots,summary:n.join(`, `),badge:`NEEDED`,body:R}),y({title:`3. First session`,state:e.firstSession,summary:``,badge:``,body:z}))}async function V({rescanAgents:e}){D+=1;let n=D;w&&(w.disabled=!0);try{let[r,i]=await Promise.all([t(`list-agents`,e?{rescan:!0}:{},{timeoutMs:a}),t(`scan-repo-roots`,{includeSuggestions:!0},{timeoutMs:a})]);if(n!==D)return;let o=i.type===`repo-roots-scanned`,s=o?i.directories.map(e=>e.root):[],c=o?i.suggestions??[]:[],l=p(s,c);if(l.length>0&&!k){k=!0;let e=await m(l).catch(e=>String(e));if(n!==D)return;if(!e){V({rescanAgents:!1});return}}let d=h({agentListing:r,repoRoots:s});e&&(O=d.agent===`current`),E={steps:d,agentSummary:f(r),repoRoots:s,isShellAvailable:u(r)},j.clear(),B(),P(E.steps),T?.setSuggestions(c)}catch(e){if(w&&(w.disabled=!1),n!==D)return;j.show(`error`,`The checklist could not load: ${i(e,a)} It loads again once the server answers. If it stays like this, check the terminal running Glimmervoid, or run glimmervoid doctor.`)}}function H(){if(S)return S;let t=e(`section`,`first-run-checklist`);t.setAttribute(`aria-labelledby`,`first-run-title`);let n=e(`h2`,`first-run-title`,`Get to your first session`);n.id=`first-run-title`,C=e(`ol`,`first-run-steps`);let r=e(`div`,`first-run-optional`);return r.append(e(`span`,`first-run-eyebrow`,`OPTIONAL`),M.element),t.append(e(`span`,`first-run-eyebrow`,`FIRST RUN`),n,C,j.element,r),S=t,B(),t}function U(e,t){if(!t){S?.parentElement===e&&!S.hidden&&(S.hidden=!0);return}let n=H(),r=!n.hidden&&n.parentElement===e;n.parentElement!==e&&e.append(n),n.hidden=!1,M.refresh(),r||V({rescanAgents:!1})}function W(){S&&!S.hidden&&S.isConnected&&V({rescanAgents:!1})}export{W as refreshFirstRunChecklist,U as showFirstRunChecklist};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,h as t,l as n,n as r,p as i,r as a,u as o,v as s}from"./zod-PTDW0N7l.js";import{n as c}from"./updates-view-core-D9wi2i2r.js";import{d as l,m as ee,n as u,r as d,s as f}from"./dom-helpers-DBbFg1c_.js";import{d as p}from"./control-ws-ZZY6O0nz.js";import{i as m,s as h,t as g}from"./action-status-DN4P3ZYj.js";import{a as _}from"./modal-USMHOKBI.js";import{cn as v,ln as y,un as b}from"./index-FZUUoDAZ.js";var te=i(t(),s());o({glimmervoidId:t().min(1),event:t().min(1),token:t().nullable().optional(),payload:te}),o({id:t().min(1),name:t().min(1),event:t().min(1),matcher:t().optional(),type:r([`command`,`http`]),command:t().optional(),url:t().optional(),timeout:n().int().positive().optional(),enabled:e(),projects:a(t()).optional()}).passthrough();var ne=`Claude Code hooks injected into every session Glimmervoid spawns.`,re=`Loading hooks`,ie=`No hooks yet. A hook runs a command, or calls a URL, when a Claude Code event fires in a Glimmervoid session. Start from one of these, or add your own.`,ae=`Start from`,oe=`Filter by name, event or command`,se=`Nothing matches that filter.`,ce=`Preview`,le=`The entry this becomes in the per-session settings file.`,ue=`Duplicate`,de=`Discard changes`,fe=`Close the editor and lose the unsaved changes?`,pe=`Esc cancels. Ctrl+Enter saves.`,me=4,he=`A change reaches a session at its next start or restart. Claude Code sessions only; Codex and Grok sessions do not read this file.`,ge=`Glimmervoid's own hooks`,_e=`Always present, read-only. Status detection depends on them.`,ve=`Your hooks`,ye=`New hook`,be=`Edit hook`,xe=`Saved to config.json.`,x=`All projects`,Se=`This event takes no matcher.`,Ce=`Blank uses Claude Code's default for the event.`,we=Object.freeze([{value:`command`,label:`Command`,hint:`Run a shell command. It receives the event JSON on stdin.`},{value:`http`,label:`HTTP`,hint:`POST the event JSON to a URL.`}]),Te=Object.freeze([{id:`lint`,label:`Lint after edits`,summary:`PostToolUse on Edit|Write`,draft:{name:`Lint after edits`,event:`PostToolUse`,matcher:`Edit|Write`,type:`command`,command:`npx biome check --write "$(jq -r .tool_input.file_path)"`}},{id:`notify`,label:`Notify on Stop`,summary:`Stop, command`,draft:{name:`Notify on Stop`,event:`Stop`,matcher:``,type:`command`,command:`command -v notify-send >/dev/null 2>&1 && notify-send "Claude finished a turn" || { command -v osascript >/dev/null 2>&1 && osascript -e 'display notification "Claude finished a turn" with title "Claude Code"'; }`}},{id:`guard`,label:`Guard destructive Bash`,summary:`PreToolUse on Bash, exit 2 blocks`,draft:{name:`Guard destructive Bash`,event:`PreToolUse`,matcher:`Bash`,type:`command`,command:`jq -r .tool_input.command | grep -Eq "rm -rf|git push --force" && exit 2 || exit 0`}},{id:`log`,label:`Log every prompt`,summary:`UserPromptSubmit, appends JSON`,draft:{name:`Log every prompt`,event:`UserPromptSubmit`,matcher:``,type:`command`,command:`cat >> ~/.claude/prompts.jsonl`}}]),Ee=Object.freeze({hooks:[],builtin:[],events:[]});function De(e){return!e||typeof e.error==`string`}function Oe(e){return!e||typeof e.error!=`string`?``:e.error}function S(e,t){let n=e?.[t];return Array.isArray(n)?n:Ee[t]}var C=e=>S(e,`hooks`),w=e=>S(e,`builtin`),T=e=>S(e,`events`);function E(e){let t=e?.limits?.maxTimeoutSec;return typeof t==`number`&&Number.isInteger(t)&&t>0?t:600}function ke(e){let t=C(e),n=t.filter(e=>e.enabled!==!1).length;return[{label:`yours`,value:String(t.length),tone:null},{label:`enabled`,value:String(n),tone:t.length>0&&n===0?`warn`:null},{label:`built in`,value:String(w(e).length),tone:null}]}function Ae(e,t){let n=new Map(t.map((e,t)=>[e.name,t])),r=e=>n.get(e.event)??t.length;return[...e].sort((e,t)=>{let n=r(e)-r(t);return n===0?String(e.name).localeCompare(String(t.name)):n})}function je(e,t){let n=String(t||``).trim().toLowerCase();return n?e.filter(e=>[e.name,e.event,e.matcher,e.command,e.url].some(e=>typeof e==`string`&&e.toLowerCase().includes(n))):e}function Me(e){return e.length>=me}function Ne(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.event===n.event?e.hooks.push(n):t.push({event:n.event,hooks:[n]})}return t}function Pe(e){let t=e.type===`http`?{type:`http`,url:e.url||``}:{type:`command`,command:e.command||``};Number.isInteger(e.timeout)&&Number(e.timeout)>0&&(t.timeout=e.timeout);let n=e.matcher?{matcher:e.matcher,hooks:[t]}:{hooks:[t]};return JSON.stringify({hooks:{[e.event]:[n]}},null,2)}function Fe(e){return`${e} copy`}function D(e,t){return e.find(e=>e.name===t)||null}function O(e,t){let n=D(e,t);return n?n.matcher?`Matches ${n.matcher}. Blank matches every ${n.name}.`:Se:``}function Ie(e){return e.type===`http`?e.url||``:e.command||``}function Le(e){let t=we.find(t=>t.value===e);return t?t.label:String(e||``)}function Re(e){return!Number.isInteger(e.timeout)||Number(e.timeout)<=0?``:`${e.timeout}s timeout`}function ze(e,t){let n=Array.isArray(e.projects)?e.projects:[];return n.length===0?x:n.map(e=>{let n=t.find(t=>t.id===e);return n?n.name:e}).join(`, `)}function Be(e){return e.matcher?`${e.event} / ${e.matcher}`:e.event}function Ve(e){return Be(e)}function He(e,t){let n=Array.isArray(e.projects)?e.projects:[],r=new Set(t.map(e=>e.id));return n.filter(e=>!r.has(e))}function k(e){let t=e[0];return{id:null,name:``,event:t?t.name:``,matcher:``,type:`command`,command:``,url:``,timeout:``,enabled:!0,projects:[]}}function A(e){return{id:e.id??null,name:e.name||``,event:e.event||``,matcher:e.matcher||``,type:e.type===`http`?`http`:`command`,command:e.command||``,url:e.url||``,timeout:Number.isInteger(e.timeout)?String(e.timeout):``,enabled:e.enabled!==!1,projects:Array.isArray(e.projects)?[...e.projects]:[]}}function Ue(e,t,n=600){if(!e.name.trim())return`Give the hook a name.`;let r=D(t,e.event);if(!r)return`Pick an event.`;if(e.matcher.trim()&&!r.matcher)return`${r.name} takes no matcher.`;if(e.type===`http`&&r.http===!1)return`${r.name} does not support HTTP hooks.`;if(e.type===`command`&&!e.command.trim())return`Enter the command to run.`;if(e.type===`http`&&!/^https?:\/\/\S+$/i.test(e.url.trim()))return`Enter a URL starting with http:// or https://.`;if(e.timeout.trim()!==``){let t=Number(e.timeout);if(!Number.isInteger(t)||t<1||t>n)return`Timeout must be a whole number of seconds from 1 to ${n}.`}return null}function j(e){let t={name:e.name.trim(),event:e.event,type:e.type,enabled:e.enabled!==!1};return e.id&&(t.id=e.id),e.matcher.trim()&&(t.matcher=e.matcher.trim()),e.type===`command`&&(t.command=e.command.trim()),e.type===`http`&&(t.url=e.url.trim()),e.timeout.trim()!==``&&(t.timeout=Number(e.timeout)),e.projects.length>0&&(t.projects=[...e.projects]),t}function We(e,t){let n={...k(t),...e.draft};return D(t,n.event)||(n.event=k(t).event),n}function Ge(e,t){return JSON.stringify(j(e))!==JSON.stringify(t)}function Ke(e){return{...e,enabled:e.enabled===!1}}function qe(e){return`Delete the hook "${e.name}"? Sessions already running keep it until they restart.`}var M=v(),N=null,P=null,F=null,I=null,L=null,R=null,z=!1,B=``,V=new Set,H=new Set,U=new Map,W=!1,G=(e,t)=>u(`hooks`,e,t);function K(e,t,n){let r=f(`p`,e,t);return n&&(r.dataset.tone=n),r}function q(e,t,n,r){let i=f(`button`,e,t);return i.type=`button`,r&&i.setAttribute(`aria-label`,r),i.addEventListener(`click`,n),i}async function Je(e,t){try{let n=await p(e,t,{timeoutMs:g});if((n.type===`save-hook-result`||n.type===`delete-hook-result`)&&n.ok)return null;let r=e===`save-hook`?`Could not save the hook.`:`Could not delete the hook.`;return`error`in n&&typeof n.error==`string`&&n.error?n.error:r}catch(e){return h(e,g)}}async function Ye(e,t,n,r){H.add(e),U.set(e,{tone:`busy`,text:r}),$({force:!0});let i=await Je(t,n);H.delete(e),i&&U.set(e,{tone:`error`,text:i}),i||U.delete(e),$({force:!0}),y()}function J(e,t,n){let r=f(`label`,`hooks-field`);return r.append(f(`span`,`hooks-field-label`,e),t),n&&r.append(f(`span`,`hooks-field-hint`,n)),r}function Y(e,t,n){let r=f(`input`,`settings-view-input`);return r.type=`text`,r.value=e,r.autocomplete=`off`,r.spellcheck=!1,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value)),r}function Xe(e,t){let n=f(`textarea`,`settings-view-input hooks-command`);return n.rows=3,n.value=e,n.spellcheck=!1,n.addEventListener(`input`,()=>t(n.value)),n}function Ze(e,t,n){let r=f(`select`,`settings-view-input hooks-select`);for(let n of t){let t=f(`option`,null,n.name);t.value=n.name,t.title=n.description,n.name===e.event&&(t.selected=!0),r.append(t)}return r.addEventListener(`change`,()=>n(r.value)),r}function Qe(e,t){let n=f(`div`,`hooks-type-row`);n.setAttribute(`role`,`radiogroup`);for(let r of we){let i=f(`label`,`settings-view-toggle hooks-choice`),a=f(`input`,`settings-view-checkbox`);a.type=`radio`,a.name=`hooks-type`,a.value=r.value,a.checked=e.type===r.value,a.title=r.hint,a.addEventListener(`change`,()=>{a.checked&&t(r.value)}),i.append(a,f(`span`,null,r.label)),n.append(i)}return n}function $e(e,t){let n=f(`div`,`hooks-projects`);if(t.length===0)return n.append(f(`span`,`hooks-field-hint`,x)),n;let r=f(`label`,`settings-view-project-choice hooks-choice`),i=f(`input`,`settings-view-checkbox`);i.type=`checkbox`,i.checked=e.projects.length===0,r.append(i,f(`span`,null,x)),n.append(r);let a=[];for(let r of t){let t=f(`label`,`settings-view-project-choice hooks-choice`),o=f(`input`,`settings-view-checkbox`);o.type=`checkbox`,o.value=r.id,o.checked=e.projects.includes(r.id),o.addEventListener(`change`,()=>{e.projects=a.filter(e=>e.checked).map(e=>e.value),i.checked=e.projects.length===0}),a.push(o),t.append(o,f(`span`,null,r.name)),r.agent!==`claude-code`&&(t.append(f(`span`,`hooks-choice-note`,r.agent)),t.title=`Not a Claude Code project: this hook will not reach its sessions.`),n.append(t)}return i.addEventListener(`change`,()=>{if(!i.checked)i.checked=e.projects.length===0;else{for(let e of a)e.checked=!1;e.projects=[]}}),n}function et(e){let t=f(`div`,`hooks-templates`);t.append(f(`span`,`hooks-templates-label`,ae));for(let n of Te){let r=q(`hooks-chip`,n.label,()=>Z(null,We(n,e)));r.title=n.summary,t.append(r)}return t}function X(e){L&&(e?L.show(`error`,e):L.clear())}function tt(e){let t=T(M.report),n=ee(M.report),r=G(e.id?be:ye,xe);r.classList.add(`hooks-editor`);let i=f(`form`,`hooks-form`);i.addEventListener(`submit`,e=>{e.preventDefault(),rt()}),i.addEventListener(`keydown`,e=>{e.key===`Escape`?(e.preventDefault(),nt()):e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),rt())}),e.id||i.append(et(t));let a=f(`span`,`hooks-field-hint`,O(t,e.event)),o=Y(e.matcher,``,t=>{e.matcher=t}),s=J(`Command`,Xe(e.command,t=>{e.command=t}),`Runs through the shell with the event JSON on stdin. Exit 2 blocks the action where the event allows it.`),c=J(`URL`,Y(e.url,`http://127.0.0.1:8080/hook`,t=>{e.url=t}),`Claude Code POSTs the event JSON to it.`),l=()=>{s.hidden=e.type!==`command`,c.hidden=e.type!==`http`};l();let u=J(`Matcher`,o,null);u.append(a);let d=()=>{let n=t.find(t=>t.name===e.event);a.textContent=O(t,e.event),o.disabled=!!n&&!n.matcher,o.disabled&&(o.value=``,e.matcher=``)};d();let p=f(`input`,`settings-view-input hooks-timeout`);p.type=`number`,p.inputMode=`numeric`,p.min=`1`,p.max=String(E(M.report)),p.value=e.timeout,p.addEventListener(`input`,()=>{e.timeout=p.value});let h=f(`label`,`settings-view-toggle hooks-choice`),g=f(`input`,`settings-view-checkbox`);g.type=`checkbox`,g.checked=e.enabled,g.addEventListener(`change`,()=>{e.enabled=g.checked}),h.append(g,f(`span`,null,`Enabled`)),i.append(J(`Name`,Y(e.name,`Lint after edits`,t=>{e.name=t}),null),J(`Event`,Ze(e,t,t=>{e.event=t,d()}),null),u,J(`Type`,Qe(e,t=>{e.type=t,l()}),null),s,c,J(`Timeout (seconds)`,p,Ce),J(`Projects`,$e(e,n),null),J(``,h,null)),L=m(`hooks-editor-status`);let _=f(`div`,`hooks-editor-footer`),v=f(`span`,`hooks-editor-shortcut`,pe),y=q(`btn-dialog btn-dialog-cancel`,`Cancel`,nt),b=f(`button`,`btn-dialog btn-dialog-confirm`,e.id?`Save changes`:`Add hook`);return b.type=`submit`,R=b,_.append(L.element,v,y,b),i.append(_),r.append(i),r}function Z(e,t=null){P=t||(e?A(e):k(T(M.report))),F=j(e?A(e):k(T(M.report))),I=tt(P),$({force:!0}),I.scrollIntoView({block:`nearest`});let n=I.querySelector(`input[type=text]`);n instanceof HTMLInputElement&&n.focus()}function Q(){P=null,F=null,I=null,L=null,R=null,z=!1,W=!0,$({force:!0})}function nt(){!P||!F||!Ge(P,F)?Q():_({title:de,message:fe,confirmLabel:`Discard`,danger:!0,onConfirm:Q})}async function rt(){if(!P||z)return;let e=Ue(P,T(M.report),E(M.report));if(e){X(e);return}let t=L,n=R;z=!0,t?.show(`busy`,`Saving the hook.`),n&&(n.disabled=!0);let r=await Je(`save-hook`,{hook:j(P)});z=!1,n&&(n.disabled=!1),t===L&&(r?X(r):(Q(),y()))}function it(e){let t=f(`details`,`hooks-preview`);t.open=V.has(e.id),t.addEventListener(`toggle`,()=>{t.open?V.add(e.id):V.delete(e.id)});let n=f(`summary`,`hooks-preview-summary`,ce);n.title=le;let r=f(`pre`,`hooks-preview-code`,Pe(e));return t.append(n,r),t}function at(e,{grouped:t=!1}={}){let n=ee(M.report),r=f(`article`,`hooks-row`);r.setAttribute(`aria-label`,e.name),e.enabled===!1&&(r.dataset.state=`off`);let i=f(`div`,`hooks-row-main`),a=f(`div`,`hooks-row-head`);a.append(f(`span`,`hooks-row-name`,e.name));let o=t?e.matcher||``:Be(e);o&&a.append(f(`span`,`hooks-row-event`,o));let s=f(`code`,`hooks-row-target`,Ie(e));s.title=Ie(e);let c=f(`p`,`hooks-row-meta`,[Le(e.type),Re(e),ze(e,n)].filter(Boolean).join(` / `));i.append(a,s,c);let l=He(e,n);l.length>0&&i.append(K(`hooks-row-meta`,`Scoped to a project no longer in config: ${l.join(`, `)}`,`warn`)),i.append(it(e));let u=U.get(e.id);if(u){let e=m(`hooks-row-status`);e.show(u.tone,u.text),i.append(e.element)}let d=f(`div`,`hooks-row-actions`),p=f(`label`,`settings-view-toggle hooks-choice`),h=f(`input`,`settings-view-checkbox`);h.type=`checkbox`,h.checked=e.enabled!==!1,h.disabled=H.has(e.id),h.setAttribute(`aria-label`,`${e.name} enabled`),h.addEventListener(`change`,()=>{Ye(e.id,`save-hook`,{hook:Ke(e)},h.checked?`Turning the hook on.`:`Turning the hook off.`)}),p.append(h,f(`span`,null,`On`));let g=q(`hooks-btn`,`Edit`,()=>Z(e),`Edit ${e.name}`),v=q(`hooks-btn`,ue,()=>{let t=A({...e,name:Fe(e.name)});t.id=null,Z(null,t)},`Duplicate ${e.name}`),y=q(`hooks-btn hooks-btn-danger`,`Delete`,()=>{_({title:`Delete hook`,message:qe(e),confirmLabel:`Delete`,danger:!0,onConfirm:()=>{Ye(e.id,`delete-hook`,{id:e.id},`Deleting the hook.`)}})},`Delete ${e.name}`);return y.disabled=H.has(e.id),d.append(p,g,v,y),r.append(i,d),r}function ot(e){let t=f(`article`,`hooks-row hooks-row-builtin`),n=f(`div`,`hooks-row-main`);return n.append(f(`span`,`hooks-row-event`,Ve(e)),f(`p`,`hooks-row-meta`,e.purpose)),t.append(n),t}function st(){let e=G(`Hooks`,ne),t=f(`div`,`hooks-stats`);for(let e of ke(M.report))t.append(d(`hooks`,e.label,e.value,e.tone));return e.append(t,K(`hooks-meta`,he)),e}function ct(){let e=f(`input`,`settings-view-input hooks-filter`);return e.type=`search`,e.value=B,e.placeholder=oe,e.setAttribute(`aria-label`,oe),e.addEventListener(`input`,()=>{B=e.value;let t=N?.querySelector(`.hooks-list-yours`);t&&t.replaceWith(ut())}),e}function lt(){let e=f(`div`,`hooks-empty-state`);return e.append(K(`hooks-empty`,ie),et(T(M.report))),e}function ut(){let e=f(`div`,`hooks-list-yours`),t=C(M.report);if(t.length===0)return e.append(lt()),e;let n=je(Ae(t,T(M.report)),B);if(n.length===0)return e.append(K(`hooks-empty`,se)),e;for(let t of Ne(n)){let n=f(`div`,`hooks-group`);n.append(f(`h3`,`hooks-group-title`,t.event));let r=f(`div`,`hooks-list`);for(let e of t.hooks)r.append(at(e,{grouped:!0}));n.append(r),e.append(n)}return e}function dt(){let e=G(ve,null),t=q(`hooks-btn hooks-btn-add`,`+ New hook`,()=>Z(null));t.disabled=!!P;let n=e.querySelector(`.hooks-section-head`);return n&&n.append(t),Me(C(M.report))&&e.append(ct()),e.append(ut()),e}function ft(){let e=f(`details`,`hooks-builtin`),t=f(`summary`,`hooks-builtin-summary`);t.append(f(`span`,`hooks-section-title`,`${ge} (${w(M.report).length})`),f(`span`,`hooks-section-hint`,_e));let n=f(`div`,`hooks-list`);for(let e of w(M.report))n.append(ot(e));return e.append(t,n),e}function pt(){let e=f(`div`,`hooks-content`);return M.report?De(M.report)?(e.append(K(`hooks-warning`,Oe(M.report))),e):(e.append(st()),I&&e.append(I),e.append(dt(),ft()),e):(e.append(M.hasReportSendFailed?K(`hooks-warning`,c):K(`hooks-empty`,re)),e)}function $({force:e=!1}={}){if(!N||!e&&l(N)||(M=v(),N.replaceChildren(pt()),!W))return;W=!1;let t=N.querySelector(`.hooks-btn-add`);t instanceof HTMLButtonElement&&t.focus()}function mt(e){N||(N=f(`div`,`hooks-panel`),e.append(N),b(()=>$()),$({force:!0}))}function ht(e){e===`shown`&&$({force:!0}),y()}var gt={mount:mt,refresh:ht};export{gt as view};
|
|
1
|
+
import{a as e,h as t,l as n,n as r,p as i,r as a,u as o,v as s}from"./zod-PTDW0N7l.js";import{n as c}from"./updates-view-core-D9wi2i2r.js";import{d as l,m as ee,n as u,r as d,s as f}from"./dom-helpers-DBbFg1c_.js";import{d as p}from"./control-ws-ZZY6O0nz.js";import{i as m,s as h,t as g}from"./action-status-DN4P3ZYj.js";import{a as _}from"./modal-USMHOKBI.js";import{cn as v,ln as y,un as b}from"./index-B1lOI6hU.js";var te=i(t(),s());o({glimmervoidId:t().min(1),event:t().min(1),token:t().nullable().optional(),payload:te}),o({id:t().min(1),name:t().min(1),event:t().min(1),matcher:t().optional(),type:r([`command`,`http`]),command:t().optional(),url:t().optional(),timeout:n().int().positive().optional(),enabled:e(),projects:a(t()).optional()}).passthrough();var ne=`Claude Code hooks injected into every session Glimmervoid spawns.`,re=`Loading hooks`,ie=`No hooks yet. A hook runs a command, or calls a URL, when a Claude Code event fires in a Glimmervoid session. Start from one of these, or add your own.`,ae=`Start from`,oe=`Filter by name, event or command`,se=`Nothing matches that filter.`,ce=`Preview`,le=`The entry this becomes in the per-session settings file.`,ue=`Duplicate`,de=`Discard changes`,fe=`Close the editor and lose the unsaved changes?`,pe=`Esc cancels. Ctrl+Enter saves.`,me=4,he=`A change reaches a session at its next start or restart. Claude Code sessions only; Codex and Grok sessions do not read this file.`,ge=`Glimmervoid's own hooks`,_e=`Always present, read-only. Status detection depends on them.`,ve=`Your hooks`,ye=`New hook`,be=`Edit hook`,xe=`Saved to config.json.`,x=`All projects`,Se=`This event takes no matcher.`,Ce=`Blank uses Claude Code's default for the event.`,we=Object.freeze([{value:`command`,label:`Command`,hint:`Run a shell command. It receives the event JSON on stdin.`},{value:`http`,label:`HTTP`,hint:`POST the event JSON to a URL.`}]),Te=Object.freeze([{id:`lint`,label:`Lint after edits`,summary:`PostToolUse on Edit|Write`,draft:{name:`Lint after edits`,event:`PostToolUse`,matcher:`Edit|Write`,type:`command`,command:`npx biome check --write "$(jq -r .tool_input.file_path)"`}},{id:`notify`,label:`Notify on Stop`,summary:`Stop, command`,draft:{name:`Notify on Stop`,event:`Stop`,matcher:``,type:`command`,command:`command -v notify-send >/dev/null 2>&1 && notify-send "Claude finished a turn" || { command -v osascript >/dev/null 2>&1 && osascript -e 'display notification "Claude finished a turn" with title "Claude Code"'; }`}},{id:`guard`,label:`Guard destructive Bash`,summary:`PreToolUse on Bash, exit 2 blocks`,draft:{name:`Guard destructive Bash`,event:`PreToolUse`,matcher:`Bash`,type:`command`,command:`jq -r .tool_input.command | grep -Eq "rm -rf|git push --force" && exit 2 || exit 0`}},{id:`log`,label:`Log every prompt`,summary:`UserPromptSubmit, appends JSON`,draft:{name:`Log every prompt`,event:`UserPromptSubmit`,matcher:``,type:`command`,command:`cat >> ~/.claude/prompts.jsonl`}}]),Ee=Object.freeze({hooks:[],builtin:[],events:[]});function De(e){return!e||typeof e.error==`string`}function Oe(e){return!e||typeof e.error!=`string`?``:e.error}function S(e,t){let n=e?.[t];return Array.isArray(n)?n:Ee[t]}var C=e=>S(e,`hooks`),w=e=>S(e,`builtin`),T=e=>S(e,`events`);function E(e){let t=e?.limits?.maxTimeoutSec;return typeof t==`number`&&Number.isInteger(t)&&t>0?t:600}function ke(e){let t=C(e),n=t.filter(e=>e.enabled!==!1).length;return[{label:`yours`,value:String(t.length),tone:null},{label:`enabled`,value:String(n),tone:t.length>0&&n===0?`warn`:null},{label:`built in`,value:String(w(e).length),tone:null}]}function Ae(e,t){let n=new Map(t.map((e,t)=>[e.name,t])),r=e=>n.get(e.event)??t.length;return[...e].sort((e,t)=>{let n=r(e)-r(t);return n===0?String(e.name).localeCompare(String(t.name)):n})}function je(e,t){let n=String(t||``).trim().toLowerCase();return n?e.filter(e=>[e.name,e.event,e.matcher,e.command,e.url].some(e=>typeof e==`string`&&e.toLowerCase().includes(n))):e}function Me(e){return e.length>=me}function Ne(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.event===n.event?e.hooks.push(n):t.push({event:n.event,hooks:[n]})}return t}function Pe(e){let t=e.type===`http`?{type:`http`,url:e.url||``}:{type:`command`,command:e.command||``};Number.isInteger(e.timeout)&&Number(e.timeout)>0&&(t.timeout=e.timeout);let n=e.matcher?{matcher:e.matcher,hooks:[t]}:{hooks:[t]};return JSON.stringify({hooks:{[e.event]:[n]}},null,2)}function Fe(e){return`${e} copy`}function D(e,t){return e.find(e=>e.name===t)||null}function O(e,t){let n=D(e,t);return n?n.matcher?`Matches ${n.matcher}. Blank matches every ${n.name}.`:Se:``}function Ie(e){return e.type===`http`?e.url||``:e.command||``}function Le(e){let t=we.find(t=>t.value===e);return t?t.label:String(e||``)}function Re(e){return!Number.isInteger(e.timeout)||Number(e.timeout)<=0?``:`${e.timeout}s timeout`}function ze(e,t){let n=Array.isArray(e.projects)?e.projects:[];return n.length===0?x:n.map(e=>{let n=t.find(t=>t.id===e);return n?n.name:e}).join(`, `)}function Be(e){return e.matcher?`${e.event} / ${e.matcher}`:e.event}function Ve(e){return Be(e)}function He(e,t){let n=Array.isArray(e.projects)?e.projects:[],r=new Set(t.map(e=>e.id));return n.filter(e=>!r.has(e))}function k(e){let t=e[0];return{id:null,name:``,event:t?t.name:``,matcher:``,type:`command`,command:``,url:``,timeout:``,enabled:!0,projects:[]}}function A(e){return{id:e.id??null,name:e.name||``,event:e.event||``,matcher:e.matcher||``,type:e.type===`http`?`http`:`command`,command:e.command||``,url:e.url||``,timeout:Number.isInteger(e.timeout)?String(e.timeout):``,enabled:e.enabled!==!1,projects:Array.isArray(e.projects)?[...e.projects]:[]}}function Ue(e,t,n=600){if(!e.name.trim())return`Give the hook a name.`;let r=D(t,e.event);if(!r)return`Pick an event.`;if(e.matcher.trim()&&!r.matcher)return`${r.name} takes no matcher.`;if(e.type===`http`&&r.http===!1)return`${r.name} does not support HTTP hooks.`;if(e.type===`command`&&!e.command.trim())return`Enter the command to run.`;if(e.type===`http`&&!/^https?:\/\/\S+$/i.test(e.url.trim()))return`Enter a URL starting with http:// or https://.`;if(e.timeout.trim()!==``){let t=Number(e.timeout);if(!Number.isInteger(t)||t<1||t>n)return`Timeout must be a whole number of seconds from 1 to ${n}.`}return null}function j(e){let t={name:e.name.trim(),event:e.event,type:e.type,enabled:e.enabled!==!1};return e.id&&(t.id=e.id),e.matcher.trim()&&(t.matcher=e.matcher.trim()),e.type===`command`&&(t.command=e.command.trim()),e.type===`http`&&(t.url=e.url.trim()),e.timeout.trim()!==``&&(t.timeout=Number(e.timeout)),e.projects.length>0&&(t.projects=[...e.projects]),t}function We(e,t){let n={...k(t),...e.draft};return D(t,n.event)||(n.event=k(t).event),n}function Ge(e,t){return JSON.stringify(j(e))!==JSON.stringify(t)}function Ke(e){return{...e,enabled:e.enabled===!1}}function qe(e){return`Delete the hook "${e.name}"? Sessions already running keep it until they restart.`}var M=v(),N=null,P=null,F=null,I=null,L=null,R=null,z=!1,B=``,V=new Set,H=new Set,U=new Map,W=!1,G=(e,t)=>u(`hooks`,e,t);function K(e,t,n){let r=f(`p`,e,t);return n&&(r.dataset.tone=n),r}function q(e,t,n,r){let i=f(`button`,e,t);return i.type=`button`,r&&i.setAttribute(`aria-label`,r),i.addEventListener(`click`,n),i}async function Je(e,t){try{let n=await p(e,t,{timeoutMs:g});if((n.type===`save-hook-result`||n.type===`delete-hook-result`)&&n.ok)return null;let r=e===`save-hook`?`Could not save the hook.`:`Could not delete the hook.`;return`error`in n&&typeof n.error==`string`&&n.error?n.error:r}catch(e){return h(e,g)}}async function Ye(e,t,n,r){H.add(e),U.set(e,{tone:`busy`,text:r}),$({force:!0});let i=await Je(t,n);H.delete(e),i&&U.set(e,{tone:`error`,text:i}),i||U.delete(e),$({force:!0}),y()}function J(e,t,n){let r=f(`label`,`hooks-field`);return r.append(f(`span`,`hooks-field-label`,e),t),n&&r.append(f(`span`,`hooks-field-hint`,n)),r}function Y(e,t,n){let r=f(`input`,`settings-view-input`);return r.type=`text`,r.value=e,r.autocomplete=`off`,r.spellcheck=!1,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value)),r}function Xe(e,t){let n=f(`textarea`,`settings-view-input hooks-command`);return n.rows=3,n.value=e,n.spellcheck=!1,n.addEventListener(`input`,()=>t(n.value)),n}function Ze(e,t,n){let r=f(`select`,`settings-view-input hooks-select`);for(let n of t){let t=f(`option`,null,n.name);t.value=n.name,t.title=n.description,n.name===e.event&&(t.selected=!0),r.append(t)}return r.addEventListener(`change`,()=>n(r.value)),r}function Qe(e,t){let n=f(`div`,`hooks-type-row`);n.setAttribute(`role`,`radiogroup`);for(let r of we){let i=f(`label`,`settings-view-toggle hooks-choice`),a=f(`input`,`settings-view-checkbox`);a.type=`radio`,a.name=`hooks-type`,a.value=r.value,a.checked=e.type===r.value,a.title=r.hint,a.addEventListener(`change`,()=>{a.checked&&t(r.value)}),i.append(a,f(`span`,null,r.label)),n.append(i)}return n}function $e(e,t){let n=f(`div`,`hooks-projects`);if(t.length===0)return n.append(f(`span`,`hooks-field-hint`,x)),n;let r=f(`label`,`settings-view-project-choice hooks-choice`),i=f(`input`,`settings-view-checkbox`);i.type=`checkbox`,i.checked=e.projects.length===0,r.append(i,f(`span`,null,x)),n.append(r);let a=[];for(let r of t){let t=f(`label`,`settings-view-project-choice hooks-choice`),o=f(`input`,`settings-view-checkbox`);o.type=`checkbox`,o.value=r.id,o.checked=e.projects.includes(r.id),o.addEventListener(`change`,()=>{e.projects=a.filter(e=>e.checked).map(e=>e.value),i.checked=e.projects.length===0}),a.push(o),t.append(o,f(`span`,null,r.name)),r.agent!==`claude-code`&&(t.append(f(`span`,`hooks-choice-note`,r.agent)),t.title=`Not a Claude Code project: this hook will not reach its sessions.`),n.append(t)}return i.addEventListener(`change`,()=>{if(!i.checked)i.checked=e.projects.length===0;else{for(let e of a)e.checked=!1;e.projects=[]}}),n}function et(e){let t=f(`div`,`hooks-templates`);t.append(f(`span`,`hooks-templates-label`,ae));for(let n of Te){let r=q(`hooks-chip`,n.label,()=>Z(null,We(n,e)));r.title=n.summary,t.append(r)}return t}function X(e){L&&(e?L.show(`error`,e):L.clear())}function tt(e){let t=T(M.report),n=ee(M.report),r=G(e.id?be:ye,xe);r.classList.add(`hooks-editor`);let i=f(`form`,`hooks-form`);i.addEventListener(`submit`,e=>{e.preventDefault(),rt()}),i.addEventListener(`keydown`,e=>{e.key===`Escape`?(e.preventDefault(),nt()):e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),rt())}),e.id||i.append(et(t));let a=f(`span`,`hooks-field-hint`,O(t,e.event)),o=Y(e.matcher,``,t=>{e.matcher=t}),s=J(`Command`,Xe(e.command,t=>{e.command=t}),`Runs through the shell with the event JSON on stdin. Exit 2 blocks the action where the event allows it.`),c=J(`URL`,Y(e.url,`http://127.0.0.1:8080/hook`,t=>{e.url=t}),`Claude Code POSTs the event JSON to it.`),l=()=>{s.hidden=e.type!==`command`,c.hidden=e.type!==`http`};l();let u=J(`Matcher`,o,null);u.append(a);let d=()=>{let n=t.find(t=>t.name===e.event);a.textContent=O(t,e.event),o.disabled=!!n&&!n.matcher,o.disabled&&(o.value=``,e.matcher=``)};d();let p=f(`input`,`settings-view-input hooks-timeout`);p.type=`number`,p.inputMode=`numeric`,p.min=`1`,p.max=String(E(M.report)),p.value=e.timeout,p.addEventListener(`input`,()=>{e.timeout=p.value});let h=f(`label`,`settings-view-toggle hooks-choice`),g=f(`input`,`settings-view-checkbox`);g.type=`checkbox`,g.checked=e.enabled,g.addEventListener(`change`,()=>{e.enabled=g.checked}),h.append(g,f(`span`,null,`Enabled`)),i.append(J(`Name`,Y(e.name,`Lint after edits`,t=>{e.name=t}),null),J(`Event`,Ze(e,t,t=>{e.event=t,d()}),null),u,J(`Type`,Qe(e,t=>{e.type=t,l()}),null),s,c,J(`Timeout (seconds)`,p,Ce),J(`Projects`,$e(e,n),null),J(``,h,null)),L=m(`hooks-editor-status`);let _=f(`div`,`hooks-editor-footer`),v=f(`span`,`hooks-editor-shortcut`,pe),y=q(`btn-dialog btn-dialog-cancel`,`Cancel`,nt),b=f(`button`,`btn-dialog btn-dialog-confirm`,e.id?`Save changes`:`Add hook`);return b.type=`submit`,R=b,_.append(L.element,v,y,b),i.append(_),r.append(i),r}function Z(e,t=null){P=t||(e?A(e):k(T(M.report))),F=j(e?A(e):k(T(M.report))),I=tt(P),$({force:!0}),I.scrollIntoView({block:`nearest`});let n=I.querySelector(`input[type=text]`);n instanceof HTMLInputElement&&n.focus()}function Q(){P=null,F=null,I=null,L=null,R=null,z=!1,W=!0,$({force:!0})}function nt(){!P||!F||!Ge(P,F)?Q():_({title:de,message:fe,confirmLabel:`Discard`,danger:!0,onConfirm:Q})}async function rt(){if(!P||z)return;let e=Ue(P,T(M.report),E(M.report));if(e){X(e);return}let t=L,n=R;z=!0,t?.show(`busy`,`Saving the hook.`),n&&(n.disabled=!0);let r=await Je(`save-hook`,{hook:j(P)});z=!1,n&&(n.disabled=!1),t===L&&(r?X(r):(Q(),y()))}function it(e){let t=f(`details`,`hooks-preview`);t.open=V.has(e.id),t.addEventListener(`toggle`,()=>{t.open?V.add(e.id):V.delete(e.id)});let n=f(`summary`,`hooks-preview-summary`,ce);n.title=le;let r=f(`pre`,`hooks-preview-code`,Pe(e));return t.append(n,r),t}function at(e,{grouped:t=!1}={}){let n=ee(M.report),r=f(`article`,`hooks-row`);r.setAttribute(`aria-label`,e.name),e.enabled===!1&&(r.dataset.state=`off`);let i=f(`div`,`hooks-row-main`),a=f(`div`,`hooks-row-head`);a.append(f(`span`,`hooks-row-name`,e.name));let o=t?e.matcher||``:Be(e);o&&a.append(f(`span`,`hooks-row-event`,o));let s=f(`code`,`hooks-row-target`,Ie(e));s.title=Ie(e);let c=f(`p`,`hooks-row-meta`,[Le(e.type),Re(e),ze(e,n)].filter(Boolean).join(` / `));i.append(a,s,c);let l=He(e,n);l.length>0&&i.append(K(`hooks-row-meta`,`Scoped to a project no longer in config: ${l.join(`, `)}`,`warn`)),i.append(it(e));let u=U.get(e.id);if(u){let e=m(`hooks-row-status`);e.show(u.tone,u.text),i.append(e.element)}let d=f(`div`,`hooks-row-actions`),p=f(`label`,`settings-view-toggle hooks-choice`),h=f(`input`,`settings-view-checkbox`);h.type=`checkbox`,h.checked=e.enabled!==!1,h.disabled=H.has(e.id),h.setAttribute(`aria-label`,`${e.name} enabled`),h.addEventListener(`change`,()=>{Ye(e.id,`save-hook`,{hook:Ke(e)},h.checked?`Turning the hook on.`:`Turning the hook off.`)}),p.append(h,f(`span`,null,`On`));let g=q(`hooks-btn`,`Edit`,()=>Z(e),`Edit ${e.name}`),v=q(`hooks-btn`,ue,()=>{let t=A({...e,name:Fe(e.name)});t.id=null,Z(null,t)},`Duplicate ${e.name}`),y=q(`hooks-btn hooks-btn-danger`,`Delete`,()=>{_({title:`Delete hook`,message:qe(e),confirmLabel:`Delete`,danger:!0,onConfirm:()=>{Ye(e.id,`delete-hook`,{id:e.id},`Deleting the hook.`)}})},`Delete ${e.name}`);return y.disabled=H.has(e.id),d.append(p,g,v,y),r.append(i,d),r}function ot(e){let t=f(`article`,`hooks-row hooks-row-builtin`),n=f(`div`,`hooks-row-main`);return n.append(f(`span`,`hooks-row-event`,Ve(e)),f(`p`,`hooks-row-meta`,e.purpose)),t.append(n),t}function st(){let e=G(`Hooks`,ne),t=f(`div`,`hooks-stats`);for(let e of ke(M.report))t.append(d(`hooks`,e.label,e.value,e.tone));return e.append(t,K(`hooks-meta`,he)),e}function ct(){let e=f(`input`,`settings-view-input hooks-filter`);return e.type=`search`,e.value=B,e.placeholder=oe,e.setAttribute(`aria-label`,oe),e.addEventListener(`input`,()=>{B=e.value;let t=N?.querySelector(`.hooks-list-yours`);t&&t.replaceWith(ut())}),e}function lt(){let e=f(`div`,`hooks-empty-state`);return e.append(K(`hooks-empty`,ie),et(T(M.report))),e}function ut(){let e=f(`div`,`hooks-list-yours`),t=C(M.report);if(t.length===0)return e.append(lt()),e;let n=je(Ae(t,T(M.report)),B);if(n.length===0)return e.append(K(`hooks-empty`,se)),e;for(let t of Ne(n)){let n=f(`div`,`hooks-group`);n.append(f(`h3`,`hooks-group-title`,t.event));let r=f(`div`,`hooks-list`);for(let e of t.hooks)r.append(at(e,{grouped:!0}));n.append(r),e.append(n)}return e}function dt(){let e=G(ve,null),t=q(`hooks-btn hooks-btn-add`,`+ New hook`,()=>Z(null));t.disabled=!!P;let n=e.querySelector(`.hooks-section-head`);return n&&n.append(t),Me(C(M.report))&&e.append(ct()),e.append(ut()),e}function ft(){let e=f(`details`,`hooks-builtin`),t=f(`summary`,`hooks-builtin-summary`);t.append(f(`span`,`hooks-section-title`,`${ge} (${w(M.report).length})`),f(`span`,`hooks-section-hint`,_e));let n=f(`div`,`hooks-list`);for(let e of w(M.report))n.append(ot(e));return e.append(t,n),e}function pt(){let e=f(`div`,`hooks-content`);return M.report?De(M.report)?(e.append(K(`hooks-warning`,Oe(M.report))),e):(e.append(st()),I&&e.append(I),e.append(dt(),ft()),e):(e.append(M.hasReportSendFailed?K(`hooks-warning`,c):K(`hooks-empty`,re)),e)}function $({force:e=!1}={}){if(!N||!e&&l(N)||(M=v(),N.replaceChildren(pt()),!W))return;W=!1;let t=N.querySelector(`.hooks-btn-add`);t instanceof HTMLButtonElement&&t.focus()}function mt(e){N||(N=f(`div`,`hooks-panel`),e.append(N),b(()=>$()),$({force:!0}))}function ht(e){e===`shown`&&$({force:!0}),y()}var gt={mount:mt,refresh:ht};export{gt as view};
|
|
Binary file
|