glimmervoid 0.52.2-next.712 → 0.52.2-next.714
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 +16 -16
- package/dist/chunks/{adapters-BGeDQaId.js → adapters-9LqeWvgp.js} +1 -1
- package/dist/chunks/{adapters-FSyntKT4.js → adapters-BxpskOkA.js} +6 -6
- package/dist/chunks/{agent-api-cli-D5i6Aaxk.js → agent-api-cli-BVOkv4-2.js} +3 -120
- package/dist/chunks/agent-api-cli-BcRxYTRj.js +1 -0
- package/dist/chunks/{agent-api-core-Bxc1V6IS.js → agent-api-core-BUmwsDmz.js} +5 -26
- package/dist/chunks/{agent-setup-cli-CNfGVi5N.js → agent-setup-cli-B_jNJOM5.js} +1 -1
- package/dist/chunks/{config-BmJ9RqVi.js → config-BjiC6jzw.js} +2 -7
- package/dist/chunks/config-store-DgjCZF1l.js +1 -0
- package/dist/chunks/{config-store-6XipBvYu.js → config-store-QV2o_a1w.js} +2 -2
- package/dist/chunks/{grok-BXZnhs-i.js → grok-Bm_l620N.js} +1 -1
- package/dist/chunks/kimi-CFmz5R41.js +1 -0
- package/dist/chunks/{kimi-DU7pXLJd.js → kimi-Docy1xQH.js} +2 -2
- package/dist/chunks/{main-DgVS2gOW.js → main-rdLT8yhk.js} +323 -505
- package/dist/chunks/{pack-agent-kPL1_C11.js → pack-agent-BT3srmZK.js} +3 -3
- package/dist/chunks/{pack-bridge-DT97V0M_.js → pack-bridge-CZ617fLE.js} +1 -1
- package/dist/chunks/packs-cli-CoUHJF-O.js +1 -0
- package/dist/chunks/{packs-cli-wE9e0PRp.js → packs-cli-TBgqXVlJ.js} +4 -4
- package/dist/chunks/{pair-cli-2uiU5BkX.js → pair-cli-QUr5kxs6.js} +2 -2
- package/dist/chunks/{pr-flows-cli-CC5XrR6y.js → pr-flows-cli-CSTgWBsw.js} +6 -6
- package/dist/chunks/{pr-flows-external-DoqZWZkV.js → pr-flows-external-C1552H5t.js} +3 -3
- package/dist/chunks/{remote-config-F5lysUVX.js → remote-config-BKrmIl1e.js} +1 -1
- package/dist/chunks/{session-Ctzyy3sF.js → session-Cjdtb0jm.js} +10 -27
- package/dist/chunks/{settings-cli-DDupUmFE.js → settings-cli-BowaotP4.js} +5 -5
- package/dist/chunks/{settings-readout-core-Dx_X8p0M.js → settings-readout-core-C259m22Z.js} +2 -2
- package/dist/chunks/{spawn-env-D9Gtgndb.js → spawn-env-exIHMDhs.js} +1 -1
- package/dist/chunks/{ssh-sign-cli-DSCqRc-5.js → ssh-sign-cli-ZR4qAwSu.js} +2 -2
- package/dist/chunks/{shown-files-core-AKNIXRfL.js → whiteboard-svg-core-nEP3Ksz-.js} +2 -230
- package/dist/client/assets/{action-status-rxc5WGWV.js → action-status-DQFqR8jN.js} +1 -1
- package/dist/client/assets/action-status-DQFqR8jN.js.br +0 -0
- package/dist/client/assets/arena-panel-DMJGea76.js +2 -0
- package/dist/client/assets/arena-panel-DMJGea76.js.br +0 -0
- package/dist/client/assets/{benchmark-panel-D8VPI2wO.js → benchmark-panel-Mp2vJ4RL.js} +1 -1
- package/dist/client/assets/benchmark-panel-Mp2vJ4RL.js.br +0 -0
- package/dist/client/assets/boards-view-BpMoCYWQ.js +1 -0
- package/dist/client/assets/boards-view-BpMoCYWQ.js.br +0 -0
- package/dist/client/assets/button-CJs4ySg3.js +1 -0
- package/dist/client/assets/button-CJs4ySg3.js.br +0 -0
- package/dist/client/assets/{card-actions-DOYXIR7t.js → card-actions-DH8NFxxU.js} +1 -1
- package/dist/client/assets/{card-registry-DY8mP3KR.js → card-registry-BnkpQyzf.js} +1 -1
- package/dist/client/assets/card-registry-BnkpQyzf.js.br +0 -0
- package/dist/client/assets/community-panel-C-v-WuLl.js +1 -0
- package/dist/client/assets/community-panel-C-v-WuLl.js.br +0 -0
- package/dist/client/assets/{control-ws-CtahMJLs.js → control-ws-DqfbKL5i.js} +2 -2
- package/dist/client/assets/control-ws-DqfbKL5i.js.br +0 -0
- package/dist/client/assets/dialogs-BgUFwN5t.js +62 -0
- package/dist/client/assets/dialogs-BgUFwN5t.js.br +0 -0
- package/dist/client/assets/{doc-editor-ui-wLyKOWOt.js → doc-editor-ui-m2bY7ta6.js} +1 -1
- package/dist/client/assets/doc-editor-ui-m2bY7ta6.js.br +0 -0
- package/dist/client/assets/{feature-hint-BLT-qbbR.js → feature-hint-DkVBzo6C.js} +1 -1
- package/dist/client/assets/feature-hint-DkVBzo6C.js.br +0 -0
- package/dist/client/assets/{first-run-checklist-CWPehBYJ.js → first-run-checklist-CG2_QRz7.js} +1 -1
- package/dist/client/assets/first-run-checklist-CG2_QRz7.js.br +0 -0
- package/dist/client/assets/{hooks-panel-VaC0hqmc.js → hooks-panel-BL-CTj9b.js} +1 -1
- package/dist/client/assets/hooks-panel-BL-CTj9b.js.br +0 -0
- package/dist/client/assets/index-C3MaaLRo.js +75 -0
- package/dist/client/assets/index-C3MaaLRo.js.br +0 -0
- package/dist/client/assets/index-DrSgqYkh.css +2 -0
- package/dist/client/assets/index-DrSgqYkh.css.br +0 -0
- package/dist/client/assets/issues-panel-CyDLx5ko.js +1 -0
- package/dist/client/assets/issues-panel-CyDLx5ko.js.br +0 -0
- package/dist/client/assets/{lane-read-token-step-BDF2eUgb.js → lane-read-token-step-BeS9I4SL.js} +7 -7
- package/dist/client/assets/lane-read-token-step-BeS9I4SL.js.br +0 -0
- package/dist/client/assets/lane-read-token-step-GYpu4zXr.css +1 -0
- package/dist/client/assets/lane-read-token-step-GYpu4zXr.css.br +0 -0
- package/dist/client/assets/{menu-CHluFLPe.js → menu-D-wg0nAO.js} +1 -1
- package/dist/client/assets/menu-D-wg0nAO.js.br +0 -0
- package/dist/client/assets/{modal-C1JTHud7.js → modal-CaYkOGc7.js} +1 -1
- package/dist/client/assets/modal-CaYkOGc7.js.br +0 -0
- package/dist/client/assets/my-prs-panel-CyXp6T32.js +1 -0
- package/dist/client/assets/my-prs-panel-CyXp6T32.js.br +0 -0
- package/dist/client/assets/{nyan-cat-Be4x7rjQ.js → nyan-cat-c96fcVAe.js} +1 -1
- package/dist/client/assets/nyan-cat-c96fcVAe.js.br +0 -0
- package/dist/client/assets/phone-shell-DE_mxTQw.js +1 -0
- package/dist/client/assets/phone-shell-DE_mxTQw.js.br +0 -0
- package/dist/client/assets/{plan-face-R1Q9sc8i.js → plan-face-ChTeqjaB.js} +2 -2
- package/dist/client/assets/plan-face-ChTeqjaB.js.br +0 -0
- package/dist/client/assets/{plan-render-DctM-lVt.js → plan-render-BodoJFmJ.js} +1 -1
- package/dist/client/assets/plan-render-BodoJFmJ.js.br +0 -0
- package/dist/client/assets/{pr-queue-columns-CX84GsEz.js → pr-queue-columns-BYmldL0b.js} +1 -1
- package/dist/client/assets/pr-queue-columns-BYmldL0b.js.br +0 -0
- package/dist/client/assets/{pr-status-icon-CZbk4RGh.js → pr-status-icon-21lNgewd.js} +1 -1
- package/dist/client/assets/pr-status-icon-21lNgewd.js.br +0 -0
- package/dist/client/assets/radar-panel-CHLr9sPR.js +1 -0
- package/dist/client/assets/radar-panel-CHLr9sPR.js.br +0 -0
- package/dist/client/assets/{repo-roots-adder-DQlAuwJR.js → repo-roots-adder-Bsl35qZU.js} +1 -1
- package/dist/client/assets/repo-roots-adder-Bsl35qZU.js.br +0 -0
- package/dist/client/assets/{resume-dialog-Bv2uB8T1.js → resume-dialog-DjxevPvZ.js} +1 -1
- package/dist/client/assets/resume-dialog-DjxevPvZ.js.br +0 -0
- package/dist/client/assets/review-queue-panel-BOTJmzko.js +1 -0
- package/dist/client/assets/review-queue-panel-BOTJmzko.js.br +0 -0
- package/dist/client/assets/{session-actions-CNlVriOo.js → session-actions-JIJxTTXv.js} +2 -2
- package/dist/client/assets/session-actions-JIJxTTXv.js.br +0 -0
- package/dist/client/assets/{session-row-sHYnfDwe.js → session-row-h4Z5UZXP.js} +2 -2
- package/dist/client/assets/session-row-h4Z5UZXP.js.br +0 -0
- package/dist/client/assets/{session-tick-BqAW_8XQ.js → session-tick-ClcENCsX.js} +1 -1
- package/dist/client/assets/session-tick-ClcENCsX.js.br +0 -0
- package/dist/client/assets/settings-panel-DOvWcLB-.js +4 -0
- package/dist/client/assets/settings-panel-DOvWcLB-.js.br +0 -0
- package/dist/client/assets/{setup-step-ChXUUNTF.js → setup-step-8g7PtcDK.js} +1 -1
- package/dist/client/assets/setup-step-8g7PtcDK.js.br +0 -0
- package/dist/client/assets/trace-panel-ChZgfrAd.js +2 -0
- package/dist/client/assets/trace-panel-ChZgfrAd.js.br +0 -0
- package/dist/client/assets/usage-panel-B2e8ojE1.js +1 -0
- package/dist/client/assets/usage-panel-B2e8ojE1.js.br +0 -0
- package/dist/client/assets/your-day-tip-BXTX2aRH.js +1 -0
- package/dist/client/assets/your-day-tip-BXTX2aRH.js.br +0 -0
- package/dist/client/index.html +13 -13
- package/dist/client/index.html.br +0 -0
- package/dist/server/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/agent-api-cli-CN904-o8.js +0 -1
- package/dist/chunks/config-store-VDlYwv_U.js +0 -1
- package/dist/chunks/kimi-DRku5Zt9.js +0 -1
- package/dist/chunks/packs-cli-BGjPjwjC.js +0 -1
- package/dist/client/assets/action-status-rxc5WGWV.js.br +0 -0
- package/dist/client/assets/arena-panel-zzVbwvJ7.js +0 -2
- package/dist/client/assets/arena-panel-zzVbwvJ7.js.br +0 -0
- package/dist/client/assets/benchmark-panel-D8VPI2wO.js.br +0 -0
- package/dist/client/assets/boards-view-BK7cN-WO.js +0 -1
- package/dist/client/assets/boards-view-BK7cN-WO.js.br +0 -0
- package/dist/client/assets/button-D4yLJK3N.js +0 -1
- package/dist/client/assets/button-D4yLJK3N.js.br +0 -0
- package/dist/client/assets/card-registry-DY8mP3KR.js.br +0 -0
- package/dist/client/assets/community-panel-CC2ujf7Y.js +0 -1
- package/dist/client/assets/community-panel-CC2ujf7Y.js.br +0 -0
- package/dist/client/assets/control-ws-CtahMJLs.js.br +0 -0
- package/dist/client/assets/dialogs-C-3Hi5yJ.js +0 -62
- package/dist/client/assets/dialogs-C-3Hi5yJ.js.br +0 -0
- package/dist/client/assets/doc-editor-ui-wLyKOWOt.js.br +0 -0
- package/dist/client/assets/feature-hint-BLT-qbbR.js.br +0 -0
- package/dist/client/assets/first-run-checklist-CWPehBYJ.js.br +0 -0
- package/dist/client/assets/hooks-panel-VaC0hqmc.js.br +0 -0
- package/dist/client/assets/index-Dz4mCYiS.js +0 -75
- package/dist/client/assets/index-Dz4mCYiS.js.br +0 -0
- package/dist/client/assets/index-zDeRHW8z.css +0 -2
- package/dist/client/assets/index-zDeRHW8z.css.br +0 -0
- package/dist/client/assets/issues-panel-BErf-wVZ.js +0 -1
- package/dist/client/assets/issues-panel-BErf-wVZ.js.br +0 -0
- package/dist/client/assets/lane-read-token-step-BDF2eUgb.js.br +0 -0
- package/dist/client/assets/lane-read-token-step-W8nsxXSA.css +0 -1
- package/dist/client/assets/lane-read-token-step-W8nsxXSA.css.br +0 -0
- package/dist/client/assets/menu-CHluFLPe.js.br +0 -0
- package/dist/client/assets/modal-C1JTHud7.js.br +0 -0
- package/dist/client/assets/my-prs-panel-Jr6S952v.js +0 -1
- package/dist/client/assets/my-prs-panel-Jr6S952v.js.br +0 -0
- package/dist/client/assets/nyan-cat-Be4x7rjQ.js.br +0 -0
- package/dist/client/assets/phone-shell-DIhWS2Sw.js +0 -1
- package/dist/client/assets/phone-shell-DIhWS2Sw.js.br +0 -0
- package/dist/client/assets/plan-face-R1Q9sc8i.js.br +0 -0
- package/dist/client/assets/plan-render-DctM-lVt.js.br +0 -0
- package/dist/client/assets/pr-queue-columns-CX84GsEz.js.br +0 -0
- package/dist/client/assets/pr-status-icon-CZbk4RGh.js.br +0 -0
- package/dist/client/assets/radar-panel-BYyqmRNZ.js +0 -1
- package/dist/client/assets/radar-panel-BYyqmRNZ.js.br +0 -0
- package/dist/client/assets/repo-roots-adder-DQlAuwJR.js.br +0 -0
- package/dist/client/assets/resume-dialog-Bv2uB8T1.js.br +0 -0
- package/dist/client/assets/review-queue-panel-B1JceZwT.js +0 -1
- package/dist/client/assets/review-queue-panel-B1JceZwT.js.br +0 -0
- package/dist/client/assets/session-actions-CNlVriOo.js.br +0 -0
- package/dist/client/assets/session-row-sHYnfDwe.js.br +0 -0
- package/dist/client/assets/session-tick-BqAW_8XQ.js.br +0 -0
- package/dist/client/assets/settings-panel-BjpF8d3p.js +0 -4
- package/dist/client/assets/settings-panel-BjpF8d3p.js.br +0 -0
- package/dist/client/assets/setup-step-ChXUUNTF.js.br +0 -0
- package/dist/client/assets/shown-face-Ax0KgQXK.js +0 -1
- package/dist/client/assets/shown-face-Ax0KgQXK.js.br +0 -0
- package/dist/client/assets/trace-panel-BrAO7Iux.js +0 -2
- package/dist/client/assets/trace-panel-BrAO7Iux.js.br +0 -0
- package/dist/client/assets/usage-panel-C8MBye6g.js +0 -1
- package/dist/client/assets/usage-panel-C8MBye6g.js.br +0 -0
- package/dist/client/assets/your-day-tip-CEcPH6D1.js +0 -1
- package/dist/client/assets/your-day-tip-CEcPH6D1.js.br +0 -0
|
@@ -2,10 +2,10 @@ import { a as showHomeAsTilde, i as sanitizeOneLine, n as requireExecutableSpawn
|
|
|
2
2
|
import { a as isMissingFileError, r as errorMessage, t as errorCode } from "./text-DoirglWV.js";
|
|
3
3
|
import { a as examplePacksDir, c as resolveFfmpegPath, d as equalsIgnoringCaseOnWindows, f as isPathInside, i as clientDir, l as resolvePackageBin, m as sanitizeWorktreeName, n as bundled, o as packageRoot, p as safePathSegment, r as cliPath, s as relayPath, t as assetRoot, u as caseFoldedPathKey } from "./runtime-paths-DfoHzN15.js";
|
|
4
4
|
import { n as glimmervoidHomeDir, r as isOperatorHomeUnderTest, t as decideConfigPath } from "./config-path-core-DUWk0Lui.js";
|
|
5
|
-
import { $ as
|
|
5
|
+
import { $ as Panel, $t as TeamReviewStatus, A as SESSION_NAME_PATTERN, An as PrThreadReplyResponse, Bn as GH_SEGMENT, Bt as PrDetail, C as CONVERSATION_TOOL_RESULT_HOOK_EVENT, Cn as PrFlowRule, Dn as PrFlowsSettings, Dt as MyPrsState, Et as MyPrsSnapshot, Ft as FindingSeverity, G as Board, Gt as ReviewResult, Hn as REPO_SLUG_RE, Ht as ReviewComment, Jn as BADGE_LABELS, Jt as TeamReviewActionRequest, K as BoardRecord, Kt as ReviewThreadId, Lt as GithubReviewState, M as SHOWN_FILE_CAP_BYTES, Mt as CommitSha$1, N as SIGN_URL_ENV, Nt as DECIDING_REVIEW_STATES, O as SESSION_DOC_BODY_CAP_BYTES, On as PrFlowsState, P as SSH_SIGN_BODY_CAP_BYTES, Pn as prActionReportPath, Pt as EarlierReview, Q as Op, Qn as STATES, Qt as TeamReviewStateEntry, Rn as HEX_SHA_RE, Rt as PostedReviewEvent, S as CONVERSATION_PERMISSION_HOOK_EVENT, T as ConversationQuestion, Tt as MyPrThreadsResponse, U as BOARD_MEDIA_MAX_EDGE_PX, Un as repoParts, Ut as ReviewDraft, V as TaskTitle, Vn as NODE_ID_RE, Wt as ReviewFinding, X as Frame, Xn as MERGEABLE_LIVE_STATES, Xt as TeamReviewCompareFiles, Y as Box, Yn as KILLABLE_STATES, Z as Note, Zn as RESTARTABLE_STATES, Zt as TeamReviewResolveResponse, _ as AgentSettingsRequest, _t as MyPrMergeMethod, b as COHERENCE_HOOKS_INACTIVE, bt as MyPrMergeStateResponse, c as AgentCloseRequest, cn as PR_ACTION_REPORT_ROUTE, ct as sparseBoardReply, d as AgentPacksRequest, dt as MyPrAutoRebase, en as TeamReviewThreadCommentsResponse, f as AgentPullRequestRequest, fn as PrActionReportBody, ft as MyPrCheckContext, gn as PrFlowDisposeRequest, gt as MyPrLaneEntry, i as ASK_USER_QUESTION_TOOL_NAME, in as decisionAsIfApprovalRequired, j as SESSION_NAME_RULE_TEXT, jn as PrThreadUnresolveResponse, l as AgentEditRequest, ln as PR_ACTION_REPORT_URL_ENV, lt as LinkedPr, mn as PrFlowApproveRequest, mt as MyPrKeepMergeableRequest, nn as TeamReviewThreadsRepository, nt as WHITEBOARD_ASSET_ROUTE, o as AgentAttentionRequest, on as hasStandingViewerApproval, ot as Wire, pn as PrActionRunRequest, pt as MyPrCheckContextsResponse, qt as ReviewVerdict, r as AGENT_URL_ENV, rn as canApproveAfterComment, rt as WHITEBOARD_LIMITS, sn as PR_ACTION_REPORT_BODY_CAP_BYTES, st as sparseBoardRecord, tn as TeamReviewThreadResult, tt as Unit, un as PR_ACTION_TOKEN_ENV, ut as MyPr, v as AgentSpawnRequest, vt as MyPrMergeRequest, wn as PrFlowSaveRuleRequest, wt as MyPrThreadNode, x as CONVERSATION_APPROVAL_SUMMARY_MAX_CHARS, xt as MyPrMergeWhenReadyRequest, y as AgentWhyRequest, yn as PrFlowItemRequest, z as SshSignRequest, zn as shortSha, zt as PostingPlan } from "./session-Cjdtb0jm.js";
|
|
6
6
|
import { c as runCommandSafely$1, i as execFileSync, l as spawn, n as execFile, r as execFileAsync, s as refuseLaunchesOf, t as assertLaunchable } from "./child-process-safe-BIh8yQ0I.js";
|
|
7
|
-
import { $ as WorkflowsSettings, A as BenchmarkId, At as IssuesStatus, B as CommunityDraft, Bt as changeMapFactId, C as RaceRecord, D as EFFORT_OPTION_ID, Dt as IssueUpdate, E as DEFAULT_MODELS, Et as IssueKey, F as CommitComparison, Ft as MAX_RAW_LINE_CHARS, G as SKILL_NAME_RE, H as CommunityState, I as MergedPrListing, It as TraceCheckpoint, J as GithubPrLightSearchNode, K as GithubPrDetailNode, Kt as GithubTeam, L as MinedPrReviewData, Lt as TraceRecord, M as BenchmarkRun, N as BenchmarkStatus, Nt as HookEnvelope, O as BenchmarkActionRequest, Ot as IssuesSearchResponse, P as BenchmarkSuite, Pt as SessionSetup, Q as WorkflowLabelName, Qt as pullRequestKeyFromReference, R as PrCheckoutCaseInput, Rt as CoherenceJournalOutput, T as CATALOG_AGENT_IDS, Tt as GithubIssueResponse, U as CommunityVerdict, Ut as CLIENT_LOG_TEXT_MAX_CHARS, V as CommunityItem, Vt as CHANGES_POLL_INTERVAL_MS, W as DISCORD_CHANNEL_NAME_RE, Wt as CONTROL_FRAME_MAX_BYTES, X as comparablePrKey, Y as GithubPrsFrame, Z as WorkflowCommentBody, _ as FeatureHintState, a as ConfigUpdate, an as PLAN_RESULT_HOOK_EVENT, c as SHELL_AGENT_ID, cn as PlanRevision, et as WorkflowsState, f as USAGE_COST_MODES, g as PackApproveRequest, h as ClientMessage, in as PLAN_HOOK_OUTPUT_MAX_CHARS, j as BenchmarkJudgement, jt as issuePullRequestStateFromGithub, k as BenchmarkCase, kt as IssuesState, ln as parseExitPlanModeHookPayload, n as BUILTIN_AGENT_IDS, nn as PLAN_BODY_CAP_BYTES, on as PLAN_TOOL_NAME, ot as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, p as USAGE_VENDOR_KEYS, q as GithubPrKey, r as BrowserConfig, rn as PLAN_HOOK_EVENT, s as RUNTIME_CONFIG_SCALAR_KEYS, sn as PlanDecision, tn as UpdateJournal, u as configIssueMessage, un as planTitle, v as HINT_FEATURES, w as RaceSpec, wt as GithubIssuePullRequestsRepository, x as JudgeResult, y as HINT_VIEW_BY_FEATURE, yt as USAGE_INTEGER_RANGES, z as CommunityActionRequest, zt as ChangeMap } from "./config-
|
|
8
|
-
import { $ as routeAgentNotes, A as isSubstantivePrompt, B as resolveResumeTarget, C as decideTaskTitleRefinement, D as extractOscTaskTitle, E as extractNotifiedTaskIds, F as seedTaskTitleSources, G as listRepoWorktreePaths, H as shouldAdoptReportedResumeId, I as AUTO_CONTINUE_PROMPT, J as describeSessionLimits, K as isAutoNameOf, L as RESUME_ID_RE, M as parseRefinedTaskTitle, N as resolveRefocusTaskTitle, O as extractPromptTaskTitle, P as resolveTaskTitle, Q as promptHintFor, R as isConversationReplacedAtStartup, S as cleanTaskPrompt, T as extractHookTaskTitle, U as claudeProjectsDir, V as resumePromptFor, W as listRepoConversations, X as hintFor, Z as permitsHelpCommand, _ as projectReviewDetail, a as checkAgentReply, b as buildTaskTitleRefinementPrompt, c as deriveChildSessionName, d as describePushLanding, et as supervisionLine, f as describeRoleRefusal, g as projectMyPrs, h as parseAgentVerb, j as parseRefinedSessionName, k as isSelfWakePrompt, l as describeChildEndNote, n as REFUSAL_REASON, o as decideAgentRequest, p as describeUnpushedCloseRefusal, q as nextSuggestedName, s as decideSpawnAllowance, tt as toolHookFactsOf, u as describeKeptChildAttention, v as projectReviews, w as extractAiTitle, x as chooseRefinedSessionName, y as buildPersistedTaskTitle, z as pickAutoResume } from "./agent-api-core-
|
|
7
|
+
import { $ as WorkflowsSettings, A as BenchmarkId, At as IssuesStatus, B as CommunityDraft, Bt as changeMapFactId, C as RaceRecord, D as EFFORT_OPTION_ID, Dt as IssueUpdate, E as DEFAULT_MODELS, Et as IssueKey, F as CommitComparison, Ft as MAX_RAW_LINE_CHARS, G as SKILL_NAME_RE, H as CommunityState, I as MergedPrListing, It as TraceCheckpoint, J as GithubPrLightSearchNode, K as GithubPrDetailNode, Kt as GithubTeam, L as MinedPrReviewData, Lt as TraceRecord, M as BenchmarkRun, N as BenchmarkStatus, Nt as HookEnvelope, O as BenchmarkActionRequest, Ot as IssuesSearchResponse, P as BenchmarkSuite, Pt as SessionSetup, Q as WorkflowLabelName, Qt as pullRequestKeyFromReference, R as PrCheckoutCaseInput, Rt as CoherenceJournalOutput, T as CATALOG_AGENT_IDS, Tt as GithubIssueResponse, U as CommunityVerdict, Ut as CLIENT_LOG_TEXT_MAX_CHARS, V as CommunityItem, Vt as CHANGES_POLL_INTERVAL_MS, W as DISCORD_CHANNEL_NAME_RE, Wt as CONTROL_FRAME_MAX_BYTES, X as comparablePrKey, Y as GithubPrsFrame, Z as WorkflowCommentBody, _ as FeatureHintState, a as ConfigUpdate, an as PLAN_RESULT_HOOK_EVENT, c as SHELL_AGENT_ID, cn as PlanRevision, et as WorkflowsState, f as USAGE_COST_MODES, g as PackApproveRequest, h as ClientMessage, in as PLAN_HOOK_OUTPUT_MAX_CHARS, j as BenchmarkJudgement, jt as issuePullRequestStateFromGithub, k as BenchmarkCase, kt as IssuesState, ln as parseExitPlanModeHookPayload, n as BUILTIN_AGENT_IDS, nn as PLAN_BODY_CAP_BYTES, on as PLAN_TOOL_NAME, ot as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, p as USAGE_VENDOR_KEYS, q as GithubPrKey, r as BrowserConfig, rn as PLAN_HOOK_EVENT, s as RUNTIME_CONFIG_SCALAR_KEYS, sn as PlanDecision, tn as UpdateJournal, u as configIssueMessage, un as planTitle, v as HINT_FEATURES, w as RaceSpec, wt as GithubIssuePullRequestsRepository, x as JudgeResult, y as HINT_VIEW_BY_FEATURE, yt as USAGE_INTEGER_RANGES, z as CommunityActionRequest, zt as ChangeMap } from "./config-BjiC6jzw.js";
|
|
8
|
+
import { $ as routeAgentNotes, A as isSubstantivePrompt, B as resolveResumeTarget, C as decideTaskTitleRefinement, D as extractOscTaskTitle, E as extractNotifiedTaskIds, F as seedTaskTitleSources, G as listRepoWorktreePaths, H as shouldAdoptReportedResumeId, I as AUTO_CONTINUE_PROMPT, J as describeSessionLimits, K as isAutoNameOf, L as RESUME_ID_RE, M as parseRefinedTaskTitle, N as resolveRefocusTaskTitle, O as extractPromptTaskTitle, P as resolveTaskTitle, Q as promptHintFor, R as isConversationReplacedAtStartup, S as cleanTaskPrompt, T as extractHookTaskTitle, U as claudeProjectsDir, V as resumePromptFor, W as listRepoConversations, X as hintFor, Z as permitsHelpCommand, _ as projectReviewDetail, a as checkAgentReply, b as buildTaskTitleRefinementPrompt, c as deriveChildSessionName, d as describePushLanding, et as supervisionLine, f as describeRoleRefusal, g as projectMyPrs, h as parseAgentVerb, j as parseRefinedSessionName, k as isSelfWakePrompt, l as describeChildEndNote, n as REFUSAL_REASON, o as decideAgentRequest, p as describeUnpushedCloseRefusal, q as nextSuggestedName, s as decideSpawnAllowance, tt as toolHookFactsOf, u as describeKeptChildAttention, v as projectReviews, w as extractAiTitle, x as chooseRefinedSessionName, y as buildPersistedTaskTitle, z as pickAutoResume } from "./agent-api-core-BUmwsDmz.js";
|
|
9
9
|
import { a as rawTextOr, i as positiveNumberOr, n as isRecord$2, o as textOr, r as numberOr, t as coercedNumberOr } from "./coerce-oz_Z_6E7.js";
|
|
10
10
|
import { i as parseCommandLine, n as warnWhenGitIsTooOld } from "./git-version-BfOQqktJ.js";
|
|
11
11
|
import { t as HOOK_URL_ENV } from "./hook-relay-core-DA_bz2KA.js";
|
|
@@ -13,20 +13,20 @@ import { n as promptContextReplyOf, o as toolHookContextReplyOf, r as refocusRep
|
|
|
13
13
|
import { n as parseJsonRecord, t as parseJsonOrNull } from "./json-core-If8h-Qgy.js";
|
|
14
14
|
import { a as saneYoloFiles } from "./sane-yolo-BjUkqIoH.js";
|
|
15
15
|
import { r as knownWriteHookInput } from "./posthog-read-gate-core-CeSY56AB.js";
|
|
16
|
-
import {
|
|
16
|
+
import { a as findDependencyCycle, i as cappedWarnings, n as escapeMarkup, o as planSteps$1, r as layoutBoard, s as unitsOf, t as boardSvgDocument } from "./whiteboard-svg-core-nEP3Ksz-.js";
|
|
17
17
|
import { a as mcpLaunchFor, o as parsePresentedCredential } from "./agent-config-DDpOIcFv.js";
|
|
18
18
|
import { n as shellQuote } from "./hook-command-core-qTNK-xMF.js";
|
|
19
19
|
import { C as parseCgroupBytes, D as DEFAULT_MAX_MS, E as DEFAULT_BASE_MS, O as nextBackoffMs, S as memoryReserveBytes, T as parseMemAvailableBytes, _ as createSpawnGate, a as jsonStateLoadError, b as cgroupLimitBytes, c as loadedJsonValue, d as writeJsonAtomicSync, f as writeTextAtomic, g as createSerialQueue, h as createMemoryAdmission, i as createJsonStateWriter, m as createKeyedSerialQueue, n as appendJsonLines, o as loadJsonStateFile, p as writeTextAtomicSync, r as createJsonStateStore, s as loadJsonStateFileSync, t as appendJsonLine, u as writeJsonAtomic, v as isQueueAdmissionTimeout, w as parseCgroupV2Path, x as headroomFromReadings, y as cgroupAncestorPaths } from "./json-file-AKRVPqG1.js";
|
|
20
|
-
import { $ as buildAiGenerationEvents, Ct as isSameDirectoryPath, D as settingsBlockSpecFor, E as mergeSettingsBlock, G as LOGGED_FAST_CLOSE_COUNTS, H as isExperimentalSetting, J as parseDataClientMessage, K as describeDataAttach, O as validateSettingsBlock, Q as adapterBucket, St as comparableDirectoryPath, U as DEEP_HISTORY_SCROLLBACK_LINES, X as TELEMETRY_BATCH_URL, Y as FIRST_RUN_NOTICE, Z as TELEMETRY_FLAGS_URL, _ as sessionIdFromBranch, a as generateProjectId, at as codexUserIdOf, b as DEFAULT_TIMER_FNS, ct as decideTelemetryConsent, d as DEFAULT_CONFIG, dt as parsePosthogReleaseId, et as buildBrowserExceptionProperties, f as DEFAULT_BRANCH_GC_PREFIXES, ft as resolveProjectToken, g as planWorktreeGc, gt as TelemetryState, h as planBranchGc, ht as TELEMETRY_EVENT_SCHEMAS, i as ensureProjectIds, it as claudeAccountUuidOf, k as SETTINGS_INDEX, lt as exceptionFingerprint, m as matchedPrefix, mt as PendingCrashReport, n as createConfigStore, nt as buildPersonProperties, o as glimmervoidHomeDir$1, ot as decideIsDevInstall, p as isGcCandidateWorktree, pt as DashboardTelemetryReport, q as parseDataAttach, r as ABORT_CONFIG_SAVE, rt as classifySessionExit, st as decideRemoteTelemetryState, tt as buildExceptionProperties, ut as nodeMajorVersion, v as usablePrefixes, x as unrefTimer, xt as canonicalizePath, y as worktreeIntegrationTips, yt as stableConfigKey, z as valueAtPath } from "./config-store-
|
|
21
|
-
import { i as resolveArgvCommandMatches, t as kimi } from "./kimi-
|
|
22
|
-
import { $ as grokHomes, A as decideUploadType, At as generateToken, B as containmentRefusalReason, Bt as readStoredHooks, C as parseRegistryLatest, Ct as shouldReplace, D as openContainedFile, Dt as HOOK_EVENTS, E as shortSha$1, Et as claudeCode, F as planUploadRetention, Ft as agentHookGroupOf, G as codexFallbackRoots, Gt as sweepOrphanedHostScratch, H as planContiguousRead, Ht as upsertHook, I as MAX_TRANSCRIPT_READ_BYTES, It as appendUserHooks, J as codexSessionIdFromPath, Jt as recordSweptPath, K as codexHomes, Kt as appendRemovalRecord, L as TRACE_TAIL_SCAN_BYTES, Lt as hooksForProject, M as framePathPaste, Mt as writeSessionSettings, N as imageMimeForUploadFilename, Nt as HOOK_EVENT_CATALOG, O as MAX_UPLOAD_BYTES, Ot as PLAN_HOLD_RELEASE_MS, P as isSafePathSegment, Pt as ID_RE, Q as expandTilde, R as committedOffsetFromTraceTailOrNull, Rt as normalizeHook, S as parseRegistryDeprecation, St as parseUsageLine, T as pickNewestPublished, Tt as vendorUsageEntry, U as resumeOffsetFrom, Ut as HOOK_TOOLS, V as isOversizedPartialLine, Vt as removeHook, W as withCommittedOffset, Wt as makeHostScratchDirectory, X as decideFileRead, Xt as listClaudeGlobalConfigPathCandidates, Y as continuationDelayMs, Yt as removalsJournalPath, Z as dedupeCodexFiles, _ as decideInstallFlavor, _t as foldReplacementIntoGenerationRollup, a as describeAgentResolvability, at as scopedClaudeRoots, b as normalizeSha, bt as mergeGenerationRollups, c as isKnownAgentId, ct as shouldPersistWarehouse, d as resolveAdapter, dt as parseKimiUsageLine, et as isUsageFile, f as setCustomAgents, ft as addEntryToTotals, g as NODE_PTY_INSTALL_SCRIPT_FLAG, gt as foldEntryIntoGenerationRollup, h as requestCodexAppServer, ht as expandAdvisorIterations, i as customAgentFingerprint, it as resolveProjectsDirs, j as exceedsUploadCap, jt as sweepOrphans, k as buildUploadFilename, kt as buildHookSettings, l as listAgentIds, lt as splitLines, m as readHostCodexVersion, mt as emptyTotals, n as cachedAgentResolvability, nt as passOutcome, o as getAdapter, ot as sessionsRootCandidates, p as codex, pt as dedupKeys, q as codexRootCandidates, qt as appendRemovalRecordSync, r as commandFor, rt as projectDirCandidates, s as hookProfileOf, st as shouldEvaluateDespiteIoFailures, t as DEFAULT_AGENT_ID$1, tt as kimiHomes, u as resetCommandCache, ut as kimiDedupIdentity, v as decideUpdateStatus, vt as identityFromRelPath, w as parseResolvedSha, wt as totalTokensOf$1, x as normalizeUpdateChannel, xt as parseJsonLine$1, y as isCheckFresh, yt as isWithinGenerationRecencyWindow, z as completeLineBytes, zt as rawStoredHooks } from "./adapters-
|
|
20
|
+
import { $ as buildAiGenerationEvents, Ct as isSameDirectoryPath, D as settingsBlockSpecFor, E as mergeSettingsBlock, G as LOGGED_FAST_CLOSE_COUNTS, H as isExperimentalSetting, J as parseDataClientMessage, K as describeDataAttach, O as validateSettingsBlock, Q as adapterBucket, St as comparableDirectoryPath, U as DEEP_HISTORY_SCROLLBACK_LINES, X as TELEMETRY_BATCH_URL, Y as FIRST_RUN_NOTICE, Z as TELEMETRY_FLAGS_URL, _ as sessionIdFromBranch, a as generateProjectId, at as codexUserIdOf, b as DEFAULT_TIMER_FNS, ct as decideTelemetryConsent, d as DEFAULT_CONFIG, dt as parsePosthogReleaseId, et as buildBrowserExceptionProperties, f as DEFAULT_BRANCH_GC_PREFIXES, ft as resolveProjectToken, g as planWorktreeGc, gt as TelemetryState, h as planBranchGc, ht as TELEMETRY_EVENT_SCHEMAS, i as ensureProjectIds, it as claudeAccountUuidOf, k as SETTINGS_INDEX, lt as exceptionFingerprint, m as matchedPrefix, mt as PendingCrashReport, n as createConfigStore, nt as buildPersonProperties, o as glimmervoidHomeDir$1, ot as decideIsDevInstall, p as isGcCandidateWorktree, pt as DashboardTelemetryReport, q as parseDataAttach, r as ABORT_CONFIG_SAVE, rt as classifySessionExit, st as decideRemoteTelemetryState, tt as buildExceptionProperties, ut as nodeMajorVersion, v as usablePrefixes, x as unrefTimer, xt as canonicalizePath, y as worktreeIntegrationTips, yt as stableConfigKey, z as valueAtPath } from "./config-store-QV2o_a1w.js";
|
|
21
|
+
import { i as resolveArgvCommandMatches, t as kimi } from "./kimi-Docy1xQH.js";
|
|
22
|
+
import { $ as grokHomes, A as decideUploadType, At as generateToken, B as containmentRefusalReason, Bt as readStoredHooks, C as parseRegistryLatest, Ct as shouldReplace, D as openContainedFile, Dt as HOOK_EVENTS, E as shortSha$1, Et as claudeCode, F as planUploadRetention, Ft as agentHookGroupOf, G as codexFallbackRoots, Gt as sweepOrphanedHostScratch, H as planContiguousRead, Ht as upsertHook, I as MAX_TRANSCRIPT_READ_BYTES, It as appendUserHooks, J as codexSessionIdFromPath, Jt as recordSweptPath, K as codexHomes, Kt as appendRemovalRecord, L as TRACE_TAIL_SCAN_BYTES, Lt as hooksForProject, M as framePathPaste, Mt as writeSessionSettings, N as imageMimeForUploadFilename, Nt as HOOK_EVENT_CATALOG, O as MAX_UPLOAD_BYTES, Ot as PLAN_HOLD_RELEASE_MS, P as isSafePathSegment, Pt as ID_RE, Q as expandTilde, R as committedOffsetFromTraceTailOrNull, Rt as normalizeHook, S as parseRegistryDeprecation, St as parseUsageLine, T as pickNewestPublished, Tt as vendorUsageEntry, U as resumeOffsetFrom, Ut as HOOK_TOOLS, V as isOversizedPartialLine, Vt as removeHook, W as withCommittedOffset, Wt as makeHostScratchDirectory, X as decideFileRead, Xt as listClaudeGlobalConfigPathCandidates, Y as continuationDelayMs, Yt as removalsJournalPath, Z as dedupeCodexFiles, _ as decideInstallFlavor, _t as foldReplacementIntoGenerationRollup, a as describeAgentResolvability, at as scopedClaudeRoots, b as normalizeSha, bt as mergeGenerationRollups, c as isKnownAgentId, ct as shouldPersistWarehouse, d as resolveAdapter, dt as parseKimiUsageLine, et as isUsageFile, f as setCustomAgents, ft as addEntryToTotals, g as NODE_PTY_INSTALL_SCRIPT_FLAG, gt as foldEntryIntoGenerationRollup, h as requestCodexAppServer, ht as expandAdvisorIterations, i as customAgentFingerprint, it as resolveProjectsDirs, j as exceedsUploadCap, jt as sweepOrphans, k as buildUploadFilename, kt as buildHookSettings, l as listAgentIds, lt as splitLines, m as readHostCodexVersion, mt as emptyTotals, n as cachedAgentResolvability, nt as passOutcome, o as getAdapter, ot as sessionsRootCandidates, p as codex, pt as dedupKeys, q as codexRootCandidates, qt as appendRemovalRecordSync, r as commandFor, rt as projectDirCandidates, s as hookProfileOf, st as shouldEvaluateDespiteIoFailures, t as DEFAULT_AGENT_ID$1, tt as kimiHomes, u as resetCommandCache, ut as kimiDedupIdentity, v as decideUpdateStatus, vt as identityFromRelPath, w as parseResolvedSha, wt as totalTokensOf$1, x as normalizeUpdateChannel, xt as parseJsonLine$1, y as isCheckFresh, yt as isWithinGenerationRecencyWindow, z as completeLineBytes, zt as rawStoredHooks } from "./adapters-BxpskOkA.js";
|
|
23
23
|
import { c as CODEX_HOME_PROFILE, l as KIMI_HOME_PROFILE } from "./agent-home-core-CbCN4fxx.js";
|
|
24
24
|
import { d as releaseSessionLock, f as sessionIdOfLockFile, l as releaseUnheldAgentHomeSecrets, n as generatedAgentHomePath, p as trashSessionTempFolderOnceUnheld, s as realAgentHome, u as createHeldSessionTempFolder } from "./agent-home-UaqVWfqV.js";
|
|
25
|
-
import { A as prActionRunAfterExit, B as unknownActionWarnings, C as fixLocallyPrompt, D as packPathsOf, E as mergeItems, F as scopedToRepo, G as withPrActionRun, H as withHandled, I as shouldTellBranchMoved, J as decideHostAllowed, K as withReopened, L as sourceCandidates$1, M as prFlowRules, N as prFlowSetup, O as plannedActions, P as savedRuleFor, R as teammateThreadItems, T as itemLocation, U as withInterruptedRuns, V as visibleRun, W as withOnlyOpenPrs, _ as packRow, b as branchMovedNote, c as packsStatePath, d as PACK_FILE_NAME, f as PacksState, g as packFileHeaders, h as approvedPackThemes, m as approvedPackPanels, n as readPacksForAgent, o as PACKS_DIR_NAME, q as withRuleRun, s as packDirsUnder, u as readPackDir, v as pendingPackNote, w as flaggingReviewers, x as commandFingerprint, y as acceptReport, z as threadCandidates } from "./pack-agent-
|
|
25
|
+
import { A as prActionRunAfterExit, B as unknownActionWarnings, C as fixLocallyPrompt, D as packPathsOf, E as mergeItems, F as scopedToRepo, G as withPrActionRun, H as withHandled, I as shouldTellBranchMoved, J as decideHostAllowed, K as withReopened, L as sourceCandidates$1, M as prFlowRules, N as prFlowSetup, O as plannedActions, P as savedRuleFor, R as teammateThreadItems, T as itemLocation, U as withInterruptedRuns, V as visibleRun, W as withOnlyOpenPrs, _ as packRow, b as branchMovedNote, c as packsStatePath, d as PACK_FILE_NAME, f as PacksState, g as packFileHeaders, h as approvedPackThemes, m as approvedPackPanels, n as readPacksForAgent, o as PACKS_DIR_NAME, q as withRuleRun, s as packDirsUnder, u as readPackDir, v as pendingPackNote, w as flaggingReviewers, x as commandFingerprint, y as acceptReport, z as threadCandidates } from "./pack-agent-BT3srmZK.js";
|
|
26
26
|
import { a as formatSshPublicKey, c as orderAgentSockets, i as commitSigningShimText, l as parseSshPublicKey, n as NO_AGENT_HOLDS_KEY, o as isForwardedAgentDirName, r as agentListsKey, s as isSignableGitObject, t as COMMIT_SIGNING_SHIM_NAME, u as wellKnownAgentSocketPaths } from "./ssh-signing-core-BbhBpAhR.js";
|
|
27
|
-
import { a as configSiblingPath, c as defaultPairingsPath, d as decideDeviceAuth, f as deviceNameFromUserAgent, l as defaultSeenPath, n as normalizeRemoteConfig, o as createPairingsStore, p as hashSecret, r as validateRemoteConfig, s as createSeenStore, t as decideBindHost, u as DEFAULT_DEVICE_MAX_AGE_MS } from "./remote-config-
|
|
28
|
-
import { n as configFileViewOf, u as readSettingsForAgent } from "./settings-readout-core-
|
|
29
|
-
import { t as createPrFlowsExternal } from "./pr-flows-external-
|
|
27
|
+
import { a as configSiblingPath, c as defaultPairingsPath, d as decideDeviceAuth, f as deviceNameFromUserAgent, l as defaultSeenPath, n as normalizeRemoteConfig, o as createPairingsStore, p as hashSecret, r as validateRemoteConfig, s as createSeenStore, t as decideBindHost, u as DEFAULT_DEVICE_MAX_AGE_MS } from "./remote-config-BKrmIl1e.js";
|
|
28
|
+
import { n as configFileViewOf, u as readSettingsForAgent } from "./settings-readout-core-C259m22Z.js";
|
|
29
|
+
import { t as createPrFlowsExternal } from "./pr-flows-external-C1552H5t.js";
|
|
30
30
|
import { createRequire } from "node:module";
|
|
31
31
|
import fs, { readFileSync } from "node:fs";
|
|
32
32
|
import path, { join, resolve } from "node:path";
|
|
@@ -34,13 +34,12 @@ import os from "node:os";
|
|
|
34
34
|
import { z } from "zod";
|
|
35
35
|
import crypto, { createHash, randomBytes, randomInt, randomUUID } from "node:crypto";
|
|
36
36
|
import http from "node:http";
|
|
37
|
-
import { pipeline } from "node:stream";
|
|
38
37
|
import net, { isIPv6 } from "node:net";
|
|
39
38
|
import fs$1, { chmod, copyFile, lstat, mkdir, mkdtemp, open, readFile, readdir, readlink, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
39
|
+
import { pipeline } from "node:stream";
|
|
40
40
|
import express from "express";
|
|
41
41
|
import { toNodeHandler } from "@modelcontextprotocol/node";
|
|
42
42
|
import { McpServer, createMcpHandler } from "@modelcontextprotocol/server";
|
|
43
|
-
import { pipeline as pipeline$1 } from "node:stream/promises";
|
|
44
43
|
import WebSocket$1, { WebSocket, WebSocketServer } from "ws";
|
|
45
44
|
import { EventEmitter } from "node:events";
|
|
46
45
|
import pty from "node-pty";
|
|
@@ -577,90 +576,11 @@ var SERVER_INSTRUCTIONS = [
|
|
|
577
576
|
"Glimmervoid supervises this session and shows it to the operator on a dashboard.",
|
|
578
577
|
"Use the session tool to spawn work that edits files or runs long: the spawned session gets its own dashboard card the operator can watch, where an in-process subagent stays fine only for a quick read-only lookup.",
|
|
579
578
|
"Use the whiteboard tool to draw a diagram, architecture map or plan the operator can see and edit, rather than drawing one in chat.",
|
|
579
|
+
"Use show to put an image, video or HTML page you made in front of the operator as a card on a whiteboard, rather than publishing an artifact, pasting it into chat or asking the operator to open the file.",
|
|
580
580
|
"Use push to land this session's commits when a plain git push is refused, attention to ask the operator for a decision, review for team pull request reviews, and settings to read Glimmervoid's settings.",
|
|
581
581
|
"session limits reports what this session may do."
|
|
582
582
|
].join(" ");
|
|
583
583
|
//#endregion
|
|
584
|
-
//#region mcp/show.ts
|
|
585
|
-
var OPEN_WITHOUT_BLOCKING_ON_A_PIPE$1 = fs.constants.O_RDONLY | (fs.constants.O_NONBLOCK ?? 0);
|
|
586
|
-
function refusal$3(status, error) {
|
|
587
|
-
return {
|
|
588
|
-
status,
|
|
589
|
-
body: {
|
|
590
|
-
ok: false,
|
|
591
|
-
error
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
function remoteRefusal(workspace) {
|
|
596
|
-
return refusal$3(409, `show reads files on the Glimmervoid machine, and this session runs in the Coder workspace ${workspace}, so its files are not there`);
|
|
597
|
-
}
|
|
598
|
-
async function copyCapped(handle, incomingPath) {
|
|
599
|
-
let copiedBytes = 0;
|
|
600
|
-
const source = handle.createReadStream({
|
|
601
|
-
start: 0,
|
|
602
|
-
end: SHOWN_FILE_CAP_BYTES,
|
|
603
|
-
autoClose: false
|
|
604
|
-
});
|
|
605
|
-
source.on("data", (chunk) => {
|
|
606
|
-
copiedBytes += chunk.length;
|
|
607
|
-
});
|
|
608
|
-
await pipeline$1(source, fs.createWriteStream(incomingPath, { mode: 384 }));
|
|
609
|
-
return copiedBytes > 209715200 ? null : copiedBytes;
|
|
610
|
-
}
|
|
611
|
-
async function openRegularFile(absolutePath) {
|
|
612
|
-
if (!(await fs$1.stat(absolutePath).catch(() => null))?.isFile()) return null;
|
|
613
|
-
const handle = await fs$1.open(absolutePath, OPEN_WITHOUT_BLOCKING_ON_A_PIPE$1).catch(() => null);
|
|
614
|
-
if (!handle) return null;
|
|
615
|
-
if ((await handle.stat().catch(() => null))?.isFile()) return handle;
|
|
616
|
-
await handle.close();
|
|
617
|
-
return null;
|
|
618
|
-
}
|
|
619
|
-
async function storeAndAdmit(session, shownFiles, handle, name, caption) {
|
|
620
|
-
const incomingPath = await shownFiles.reserveIncomingPath(session.id);
|
|
621
|
-
const copiedBytes = await copyCapped(handle, incomingPath).catch(() => void 0);
|
|
622
|
-
if (copiedBytes === void 0 || copiedBytes === null) {
|
|
623
|
-
await fs$1.unlink(incomingPath).catch(() => {});
|
|
624
|
-
if (copiedBytes === null) return refusal$3(413, describeOverCap(name, null));
|
|
625
|
-
return refusal$3(500, `could not read ${name}`);
|
|
626
|
-
}
|
|
627
|
-
const admitted = await shownFiles.admit(session, {
|
|
628
|
-
incomingPath,
|
|
629
|
-
name,
|
|
630
|
-
caption,
|
|
631
|
-
sizeBytes: copiedBytes
|
|
632
|
-
});
|
|
633
|
-
if (!admitted.ok) return refusal$3(admitted.status, admitted.error);
|
|
634
|
-
return {
|
|
635
|
-
status: 200,
|
|
636
|
-
body: {
|
|
637
|
-
ok: true,
|
|
638
|
-
shown: {
|
|
639
|
-
name: admitted.file.name,
|
|
640
|
-
kind: admitted.file.kind
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
|
-
}
|
|
645
|
-
async function showByPath(session, agentApi, shownFiles, request) {
|
|
646
|
-
const roleRefusal = agentApi.refuseRole(session, "show");
|
|
647
|
-
if (roleRefusal) return roleRefusal;
|
|
648
|
-
if (session.remoteWorkspace !== null) return remoteRefusal(session.remoteWorkspace);
|
|
649
|
-
if (!shownFiles) return refusal$3(503, "show is not available right now");
|
|
650
|
-
const absolutePath = path.resolve(session.effectiveCwd(), request.requestedPath);
|
|
651
|
-
const name = path.basename(absolutePath);
|
|
652
|
-
const handle = await openRegularFile(absolutePath);
|
|
653
|
-
if (!handle) return refusal$3(404, `${request.requestedPath} is not a file this session can read`);
|
|
654
|
-
try {
|
|
655
|
-
const { size } = await handle.stat();
|
|
656
|
-
if (size > 209715200) return refusal$3(413, describeOverCap(request.requestedPath, size));
|
|
657
|
-
session.noteCommandRan("show");
|
|
658
|
-
return await storeAndAdmit(session, shownFiles, handle, name, request.caption?.trim().slice(0, 500) || null);
|
|
659
|
-
} finally {
|
|
660
|
-
await handle.close();
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
//#endregion
|
|
664
584
|
//#region mcp/core/board-reading.ts
|
|
665
585
|
function readingOf(board, layout) {
|
|
666
586
|
return {
|
|
@@ -1079,20 +999,34 @@ var ATTENTION_TOOL = {
|
|
|
1079
999
|
openWorld: true
|
|
1080
1000
|
} }) }
|
|
1081
1001
|
};
|
|
1002
|
+
function showPayload(toolArguments, context) {
|
|
1003
|
+
const caption = typeof toolArguments.caption === "string" ? { caption: toolArguments.caption } : {};
|
|
1004
|
+
if (typeof toolArguments.path !== "string") return {
|
|
1005
|
+
sub: "show",
|
|
1006
|
+
...caption
|
|
1007
|
+
};
|
|
1008
|
+
return {
|
|
1009
|
+
sub: "show",
|
|
1010
|
+
path: context.resolveSessionPath(toolArguments.path),
|
|
1011
|
+
...caption
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1082
1014
|
var SHOW_TOOL = {
|
|
1083
1015
|
name: "show",
|
|
1084
1016
|
title: "Glimmervoid show",
|
|
1085
|
-
description: "
|
|
1086
|
-
loadsUpfront:
|
|
1017
|
+
description: "Show the operator an image, video or HTML page you made (a screenshot, a rendered chart, a report, a mockup, a demo clip) as a card on a whiteboard on their dashboard. Use it instead of publishing an artifact, pasting a picture into chat, or asking the operator to open a file: the operator is already watching the board, and the card stays there for them and other sessions to see and edit. It puts the card on the board this session is connected to, creating one named after this session when there is none, and returns the board and the box id so whiteboard put can change it. Accepts PNG, JPEG, WebP, GIF, SVG, MP4, WebM or HTML on this machine, up to 200 MB.",
|
|
1018
|
+
loadsUpfront: true,
|
|
1087
1019
|
fields: {
|
|
1088
1020
|
path: z.string().min(1).max(4096).describe("The file, absolute or relative to this session's directory"),
|
|
1089
|
-
caption: z.string().min(1).max(
|
|
1021
|
+
caption: z.string().min(1).max(WHITEBOARD_LIMITS.line).optional().describe("A short line shown under the file on its card")
|
|
1090
1022
|
},
|
|
1091
|
-
actions: { show:
|
|
1023
|
+
actions: { show: {
|
|
1024
|
+
verb: "whiteboard",
|
|
1092
1025
|
required: ["path"],
|
|
1026
|
+
accepts: ["path", "caption"],
|
|
1093
1027
|
hints: WRITES,
|
|
1094
|
-
|
|
1095
|
-
}
|
|
1028
|
+
toPayload: showPayload
|
|
1029
|
+
} }
|
|
1096
1030
|
};
|
|
1097
1031
|
var SETTINGS_TOOL = {
|
|
1098
1032
|
name: "settings",
|
|
@@ -1259,15 +1193,8 @@ function reshapedReply(reshape) {
|
|
|
1259
1193
|
};
|
|
1260
1194
|
};
|
|
1261
1195
|
}
|
|
1262
|
-
function showPathRequest(payload) {
|
|
1263
|
-
return {
|
|
1264
|
-
requestedPath: typeof payload.path === "string" ? payload.path : "",
|
|
1265
|
-
caption: typeof payload.caption === "string" ? payload.caption : null
|
|
1266
|
-
};
|
|
1267
|
-
}
|
|
1268
1196
|
var PRESENTERS = {
|
|
1269
1197
|
"agent-reply": ({ session, agentApi }, verb, payload) => agentApi.handle(session, verb, payload),
|
|
1270
|
-
"show-by-path": ({ session, agentApi, getShownFiles }, _verb, payload) => showByPath(session, agentApi, getShownFiles(), showPathRequest(payload)),
|
|
1271
1198
|
"board-with-reading": ({ session, agentApi }, _verb, payload) => boardReplyWithReading(session, agentApi, payload),
|
|
1272
1199
|
"board-picture": ({ session, agentApi, getWhiteboardAssets }, _verb, payload) => boardPictureResult(session, agentApi, getWhiteboardAssets(), payload),
|
|
1273
1200
|
"spawn-reply": reshapedReply(spawnReplyForMcp),
|
|
@@ -1299,7 +1226,6 @@ function registerGroupedTool(server, tool, session, agentApi, stores) {
|
|
|
1299
1226
|
return toolResultOf(await PRESENTERS[route.presenter]({
|
|
1300
1227
|
session,
|
|
1301
1228
|
agentApi,
|
|
1302
|
-
getShownFiles: stores.getShownFiles,
|
|
1303
1229
|
getWhiteboardAssets: stores.getWhiteboardAssets
|
|
1304
1230
|
}, route.verb, route.payload));
|
|
1305
1231
|
});
|
|
@@ -1815,6 +1741,121 @@ function mountCustomSoundRoutes(app, { soundsDir }) {
|
|
|
1815
1741
|
});
|
|
1816
1742
|
}
|
|
1817
1743
|
//#endregion
|
|
1744
|
+
//#region server/core/shown-files-core.ts
|
|
1745
|
+
var SHOWN_SNIFF_BYTES = 65536;
|
|
1746
|
+
var PAGE_TITLE_MAX_CHARS = 200;
|
|
1747
|
+
var ACCEPTED_KINDS_TEXT = "PNG, JPEG, WebP, GIF, SVG, MP4, WebM or HTML";
|
|
1748
|
+
var PNG = {
|
|
1749
|
+
kind: "image",
|
|
1750
|
+
mime: "image/png",
|
|
1751
|
+
extension: ".png"
|
|
1752
|
+
};
|
|
1753
|
+
var JPEG = {
|
|
1754
|
+
kind: "image",
|
|
1755
|
+
mime: "image/jpeg",
|
|
1756
|
+
extension: ".jpg"
|
|
1757
|
+
};
|
|
1758
|
+
var GIF = {
|
|
1759
|
+
kind: "image",
|
|
1760
|
+
mime: "image/gif",
|
|
1761
|
+
extension: ".gif"
|
|
1762
|
+
};
|
|
1763
|
+
var WEBP = {
|
|
1764
|
+
kind: "image",
|
|
1765
|
+
mime: "image/webp",
|
|
1766
|
+
extension: ".webp"
|
|
1767
|
+
};
|
|
1768
|
+
var SVG = {
|
|
1769
|
+
kind: "image",
|
|
1770
|
+
mime: "image/svg+xml",
|
|
1771
|
+
extension: ".svg"
|
|
1772
|
+
};
|
|
1773
|
+
var MP4 = {
|
|
1774
|
+
kind: "video",
|
|
1775
|
+
mime: "video/mp4",
|
|
1776
|
+
extension: ".mp4"
|
|
1777
|
+
};
|
|
1778
|
+
var WEBM = {
|
|
1779
|
+
kind: "video",
|
|
1780
|
+
mime: "video/webm",
|
|
1781
|
+
extension: ".webm"
|
|
1782
|
+
};
|
|
1783
|
+
var PAGE = {
|
|
1784
|
+
kind: "page",
|
|
1785
|
+
mime: "text/html; charset=utf-8",
|
|
1786
|
+
extension: ".html"
|
|
1787
|
+
};
|
|
1788
|
+
var PNG_SIGNATURE = Buffer.from([
|
|
1789
|
+
137,
|
|
1790
|
+
80,
|
|
1791
|
+
78,
|
|
1792
|
+
71,
|
|
1793
|
+
13,
|
|
1794
|
+
10,
|
|
1795
|
+
26,
|
|
1796
|
+
10
|
|
1797
|
+
]);
|
|
1798
|
+
var JPEG_SIGNATURE = Buffer.from([
|
|
1799
|
+
255,
|
|
1800
|
+
216,
|
|
1801
|
+
255
|
|
1802
|
+
]);
|
|
1803
|
+
var WEBM_SIGNATURE = Buffer.from([
|
|
1804
|
+
26,
|
|
1805
|
+
69,
|
|
1806
|
+
223,
|
|
1807
|
+
163
|
|
1808
|
+
]);
|
|
1809
|
+
var UTF8_BYTE_ORDER_MARK = "";
|
|
1810
|
+
var PAGE_TITLE_RE = /<title[^>]*>([\s\S]*?)<\/title>/i;
|
|
1811
|
+
function startsWithBytes(chunk, signature, offset = 0) {
|
|
1812
|
+
return chunk.length >= offset + signature.length && chunk.subarray(offset, offset + signature.length).equals(signature);
|
|
1813
|
+
}
|
|
1814
|
+
function asciiAt(chunk, offset, length) {
|
|
1815
|
+
return chunk.subarray(offset, offset + length).toString("latin1");
|
|
1816
|
+
}
|
|
1817
|
+
function sniffBinaryFormat(chunk) {
|
|
1818
|
+
if (startsWithBytes(chunk, PNG_SIGNATURE)) return PNG;
|
|
1819
|
+
if (startsWithBytes(chunk, JPEG_SIGNATURE)) return JPEG;
|
|
1820
|
+
if (asciiAt(chunk, 0, 6) === "GIF87a" || asciiAt(chunk, 0, 6) === "GIF89a") return GIF;
|
|
1821
|
+
if (asciiAt(chunk, 0, 4) === "RIFF" && asciiAt(chunk, 8, 4) === "WEBP") return WEBP;
|
|
1822
|
+
if (asciiAt(chunk, 4, 4) === "ftyp") return MP4;
|
|
1823
|
+
if (startsWithBytes(chunk, WEBM_SIGNATURE)) return WEBM;
|
|
1824
|
+
return null;
|
|
1825
|
+
}
|
|
1826
|
+
function leadingMarkup(chunk) {
|
|
1827
|
+
const text = chunk.toString("utf8");
|
|
1828
|
+
return (text.startsWith(UTF8_BYTE_ORDER_MARK) ? text.slice(1) : text).trimStart().toLowerCase();
|
|
1829
|
+
}
|
|
1830
|
+
function sniffMarkupFormat(chunk, declaredName) {
|
|
1831
|
+
const markup = leadingMarkup(chunk);
|
|
1832
|
+
if (!markup.startsWith("<")) return null;
|
|
1833
|
+
if (markup.startsWith("<svg")) return SVG;
|
|
1834
|
+
if (markup.startsWith("<!doctype html") || markup.startsWith("<html")) return PAGE;
|
|
1835
|
+
const declaredExtension = path.extname(declaredName).toLowerCase();
|
|
1836
|
+
if (declaredExtension === ".svg" && markup.includes("<svg")) return SVG;
|
|
1837
|
+
if (declaredExtension === ".html" || declaredExtension === ".htm") return PAGE;
|
|
1838
|
+
if (markup.startsWith("<?xml") && markup.includes("<svg")) return SVG;
|
|
1839
|
+
return null;
|
|
1840
|
+
}
|
|
1841
|
+
function decideShownKind(firstChunk, declaredName) {
|
|
1842
|
+
const format = sniffBinaryFormat(firstChunk) ?? sniffMarkupFormat(firstChunk, declaredName);
|
|
1843
|
+
if (!format) return {
|
|
1844
|
+
ok: false,
|
|
1845
|
+
error: `${declaredName} is not a file show takes; show takes ${ACCEPTED_KINDS_TEXT} files`
|
|
1846
|
+
};
|
|
1847
|
+
return {
|
|
1848
|
+
ok: true,
|
|
1849
|
+
kind: format.kind,
|
|
1850
|
+
mime: format.mime,
|
|
1851
|
+
extension: format.extension
|
|
1852
|
+
};
|
|
1853
|
+
}
|
|
1854
|
+
function readPageTitle(firstChunk) {
|
|
1855
|
+
const title = PAGE_TITLE_RE.exec(firstChunk.subarray(0, 65536).toString("utf8"))?.[1]?.replace(/\s+/g, " ").trim() ?? "";
|
|
1856
|
+
return title ? title.slice(0, PAGE_TITLE_MAX_CHARS) : null;
|
|
1857
|
+
}
|
|
1858
|
+
//#endregion
|
|
1818
1859
|
//#region server/whiteboard/whiteboard-assets.ts
|
|
1819
1860
|
var ASSETS_FOLDER_NAME = "assets";
|
|
1820
1861
|
var ASSET_INPUT_CAP_BYTES = SHOWN_FILE_CAP_BYTES;
|
|
@@ -1825,12 +1866,12 @@ var PAGE_WIDTH_PX = 1280;
|
|
|
1825
1866
|
var PAGE_HEIGHT_PX = 800;
|
|
1826
1867
|
var UNPOSTERED_VIDEO_WIDTH_PX = 1280;
|
|
1827
1868
|
var UNPOSTERED_VIDEO_HEIGHT_PX = 720;
|
|
1828
|
-
var VIDEO_POSTER_TIMEOUT_MS
|
|
1869
|
+
var VIDEO_POSTER_TIMEOUT_MS = 15e3;
|
|
1829
1870
|
var ASSET_FILE_MODE = 384;
|
|
1830
1871
|
var PREVIEW_SUFFIX = ".preview.webp";
|
|
1831
1872
|
var ORIGINAL_FILENAME_RE = /^([0-9a-f]{64})(\.png|\.jpg|\.gif|\.webp|\.svg|\.mp4|\.webm|\.html)$/;
|
|
1832
1873
|
var PREVIEW_FILENAME_RE = /^([0-9a-f]{64})\.preview\.webp$/;
|
|
1833
|
-
var INCOMING_PREFIX
|
|
1874
|
+
var INCOMING_PREFIX = ".incoming-";
|
|
1834
1875
|
var ATTACH_HOLD_MS = 6e5;
|
|
1835
1876
|
var STILL_IMAGE_FTYP_BRANDS = /* @__PURE__ */ new Set([
|
|
1836
1877
|
"mif1",
|
|
@@ -1929,7 +1970,7 @@ function overCapRefusal(name) {
|
|
|
1929
1970
|
function isRefusal(value) {
|
|
1930
1971
|
return typeof value === "object" && value !== null && "ok" in value && value.ok === false;
|
|
1931
1972
|
}
|
|
1932
|
-
async function readFirstChunk
|
|
1973
|
+
async function readFirstChunk(filePath) {
|
|
1933
1974
|
const handle = await fs$1.open(filePath, "r");
|
|
1934
1975
|
try {
|
|
1935
1976
|
const firstChunk = Buffer.alloc(SHOWN_SNIFF_BYTES);
|
|
@@ -2026,7 +2067,7 @@ function posterFailureOf(failure) {
|
|
|
2026
2067
|
if ("killed" in failure && failure.killed === true || "signal" in failure && typeof failure.signal === "string" && STOPPING_SIGNALS.has(failure.signal) || hasPassingErrorCode(failure) || PASSING_OUTPUT_FAILURE_TEXT.test(failureTextOf(failure))) return "interrupted";
|
|
2027
2068
|
return "undecodable";
|
|
2028
2069
|
}
|
|
2029
|
-
async function writeVideoPoster
|
|
2070
|
+
async function writeVideoPoster(sourcePath, posterPath) {
|
|
2030
2071
|
const ffmpegPath = resolveFfmpegPath();
|
|
2031
2072
|
if (!ffmpegPath) return "undecodable";
|
|
2032
2073
|
return execFileAsync(ffmpegPath, [
|
|
@@ -2044,7 +2085,7 @@ async function writeVideoPoster$1(sourcePath, posterPath) {
|
|
|
2044
2085
|
String(PREVIEW_WEBP_QUALITY),
|
|
2045
2086
|
"-y",
|
|
2046
2087
|
posterPath
|
|
2047
|
-
], { timeout: VIDEO_POSTER_TIMEOUT_MS
|
|
2088
|
+
], { timeout: VIDEO_POSTER_TIMEOUT_MS }).then(() => "written", posterFailureOf);
|
|
2048
2089
|
}
|
|
2049
2090
|
function interruptedReadRefusal(name) {
|
|
2050
2091
|
return refusal$2(503, `${name} could not be read while the machine was short of resources; attach it again`);
|
|
@@ -2070,7 +2111,7 @@ async function sizeImage(sourcePath, previewPath, format, name) {
|
|
|
2070
2111
|
};
|
|
2071
2112
|
}
|
|
2072
2113
|
async function sizeVideo(sourcePath, previewPath, name) {
|
|
2073
|
-
const posterOutcome = await writeVideoPoster
|
|
2114
|
+
const posterOutcome = await writeVideoPoster(sourcePath, previewPath);
|
|
2074
2115
|
if (posterOutcome === "interrupted") return refusal$2(503, `${name}'s first frame could not be read before ffmpeg was stopped or the machine ran short of resources; attach it again`);
|
|
2075
2116
|
const posterSize = posterOutcome === "written" ? await rasterSizeOf(previewPath) : "unreadable";
|
|
2076
2117
|
if (posterSize === "interrupted") return interruptedReadRefusal(name);
|
|
@@ -2129,7 +2170,7 @@ function createWhiteboardAssetStore({ boardsRoot, logger = console, now = Date.n
|
|
|
2129
2170
|
media: null
|
|
2130
2171
|
});
|
|
2131
2172
|
}
|
|
2132
|
-
const abandonedIncomingNames = filenames.filter((filename) => filename.startsWith(INCOMING_PREFIX
|
|
2173
|
+
const abandonedIncomingNames = filenames.filter((filename) => filename.startsWith(INCOMING_PREFIX));
|
|
2133
2174
|
await Promise.all(abandonedIncomingNames.map((filename) => fs$1.rm(path.join(assetsRoot, filename), { force: true }).catch(() => {})));
|
|
2134
2175
|
}, () => {});
|
|
2135
2176
|
function originalPathOf(assetId, extension) {
|
|
@@ -2196,7 +2237,7 @@ function createWhiteboardAssetStore({ boardsRoot, logger = console, now = Date.n
|
|
|
2196
2237
|
async function adoptIncoming(incomingPath, name) {
|
|
2197
2238
|
await loaded;
|
|
2198
2239
|
try {
|
|
2199
|
-
const firstChunk = await readFirstChunk
|
|
2240
|
+
const firstChunk = await readFirstChunk(incomingPath);
|
|
2200
2241
|
const verdict = decideShownKind(firstChunk, name);
|
|
2201
2242
|
const format = verdict.ok ? MEDIA_FORMAT_BY_EXTENSION[verdict.extension] : void 0;
|
|
2202
2243
|
if (!verdict.ok || !format || isStillImageInVideoContainer(firstChunk, verdict.extension)) return refusal$2(415, `${name} is not a file a board takes; a board takes ${ACCEPTED_TEXT}`);
|
|
@@ -2226,7 +2267,7 @@ function createWhiteboardAssetStore({ boardsRoot, logger = console, now = Date.n
|
|
|
2226
2267
|
recursive: true,
|
|
2227
2268
|
mode: 448
|
|
2228
2269
|
});
|
|
2229
|
-
return path.join(assetsRoot, `${INCOMING_PREFIX
|
|
2270
|
+
return path.join(assetsRoot, `${INCOMING_PREFIX}${crypto.randomBytes(8).toString("hex")}`);
|
|
2230
2271
|
}
|
|
2231
2272
|
function hold(assetId, holdMs) {
|
|
2232
2273
|
const heldUntil = now() + holdMs;
|
|
@@ -2481,146 +2522,6 @@ function receiveUpload({ req, res, sess, dir, filename, savedPath, logger }) {
|
|
|
2481
2522
|
});
|
|
2482
2523
|
}
|
|
2483
2524
|
//#endregion
|
|
2484
|
-
//#region server/backend/http/backend-http-shown-files.ts
|
|
2485
|
-
function sendShowReply({ res, logger }, status, body) {
|
|
2486
|
-
if (res.headersSent) return;
|
|
2487
|
-
const checked = checkAgentReply("show", {
|
|
2488
|
-
status,
|
|
2489
|
-
body
|
|
2490
|
-
});
|
|
2491
|
-
if (!checked.ok) logger.warn(`[agent-api] show reply broke its contract: ${checked.issue}`);
|
|
2492
|
-
res.status(checked.reply.status).json(checked.reply.body);
|
|
2493
|
-
}
|
|
2494
|
-
function answerShow({ req, res, session, shownFiles, logger }) {
|
|
2495
|
-
const answer = (status, body) => sendShowReply({
|
|
2496
|
-
res,
|
|
2497
|
-
logger
|
|
2498
|
-
}, status, body);
|
|
2499
|
-
const name = path.basename(decodeHeaderText(req.headers["x-glimmervoid-show-name"]) ?? "");
|
|
2500
|
-
if (!name) {
|
|
2501
|
-
answer(400, {
|
|
2502
|
-
ok: false,
|
|
2503
|
-
error: "show needs the file name in x-glimmervoid-show-name"
|
|
2504
|
-
});
|
|
2505
|
-
return;
|
|
2506
|
-
}
|
|
2507
|
-
const caption = decodeHeaderText(req.headers["x-glimmervoid-show-caption"])?.slice(0, 500) ?? null;
|
|
2508
|
-
const declaredBytes = declaredContentLength(req);
|
|
2509
|
-
if (declaredBytes !== null && declaredBytes > 209715200) {
|
|
2510
|
-
answer(413, {
|
|
2511
|
-
ok: false,
|
|
2512
|
-
error: describeOverCap(name, declaredBytes)
|
|
2513
|
-
});
|
|
2514
|
-
req.resume();
|
|
2515
|
-
return;
|
|
2516
|
-
}
|
|
2517
|
-
shownFiles.reserveIncomingPath(session.id).then(async (incomingPath) => {
|
|
2518
|
-
const outcome = await streamRequestToFile({
|
|
2519
|
-
req,
|
|
2520
|
-
savedPath: incomingPath,
|
|
2521
|
-
capBytes: SHOWN_FILE_CAP_BYTES
|
|
2522
|
-
});
|
|
2523
|
-
if (!outcome.ok) {
|
|
2524
|
-
const failure = UPLOAD_FAILURE_REPLIES[outcome.reason];
|
|
2525
|
-
answer(failure.status, {
|
|
2526
|
-
ok: false,
|
|
2527
|
-
error: outcome.reason === "over-cap" ? describeOverCap(name, declaredBytes) : failure.error
|
|
2528
|
-
});
|
|
2529
|
-
return;
|
|
2530
|
-
}
|
|
2531
|
-
const admitted = await shownFiles.admit(session, {
|
|
2532
|
-
incomingPath,
|
|
2533
|
-
name,
|
|
2534
|
-
caption,
|
|
2535
|
-
sizeBytes: outcome.sizeBytes
|
|
2536
|
-
});
|
|
2537
|
-
if (!admitted.ok) {
|
|
2538
|
-
answer(admitted.status, {
|
|
2539
|
-
ok: false,
|
|
2540
|
-
error: admitted.error
|
|
2541
|
-
});
|
|
2542
|
-
return;
|
|
2543
|
-
}
|
|
2544
|
-
answer(200, {
|
|
2545
|
-
ok: true,
|
|
2546
|
-
shown: {
|
|
2547
|
-
name: admitted.file.name,
|
|
2548
|
-
kind: admitted.file.kind
|
|
2549
|
-
}
|
|
2550
|
-
});
|
|
2551
|
-
}).catch(() => {
|
|
2552
|
-
answer(500, {
|
|
2553
|
-
ok: false,
|
|
2554
|
-
error: "could not store the file"
|
|
2555
|
-
});
|
|
2556
|
-
});
|
|
2557
|
-
}
|
|
2558
|
-
var SHOWN_FILE_SANDBOX_POLICY = "sandbox allow-scripts allow-popups allow-modals allow-forms";
|
|
2559
|
-
async function* withZoomBridgeAppended(pageChunks) {
|
|
2560
|
-
yield* pageChunks;
|
|
2561
|
-
yield SHOWN_PAGE_ZOOM_BRIDGE;
|
|
2562
|
-
}
|
|
2563
|
-
async function readPageTail(servable) {
|
|
2564
|
-
const handle = await fs$1.open(servable.path, "r");
|
|
2565
|
-
try {
|
|
2566
|
-
const tailStart = Math.max(0, servable.sizeBytes - SHOWN_SNIFF_BYTES);
|
|
2567
|
-
const tailBuffer = Buffer.alloc(servable.sizeBytes - tailStart);
|
|
2568
|
-
const { bytesRead } = await handle.read(tailBuffer, 0, tailBuffer.byteLength, tailStart);
|
|
2569
|
-
return tailBuffer.subarray(0, bytesRead).toString("utf8");
|
|
2570
|
-
} finally {
|
|
2571
|
-
await handle.close().catch(() => {});
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2574
|
-
function streamPage(res, servable, pageTail) {
|
|
2575
|
-
res.setHeader("Content-Type", servable.mime);
|
|
2576
|
-
if (leavesVisibleRawTextOpen(pageTail)) {
|
|
2577
|
-
res.setHeader("Content-Length", String(servable.sizeBytes));
|
|
2578
|
-
pipeline(fs.createReadStream(servable.path), res, () => {});
|
|
2579
|
-
return;
|
|
2580
|
-
}
|
|
2581
|
-
res.setHeader("Content-Length", String(servable.sizeBytes + SHOWN_PAGE_ZOOM_BRIDGE.byteLength));
|
|
2582
|
-
pipeline(fs.createReadStream(servable.path), withZoomBridgeAppended, res, () => {});
|
|
2583
|
-
}
|
|
2584
|
-
function servePageWithZoomBridge(res, servable) {
|
|
2585
|
-
readPageTail(servable).then((pageTail) => streamPage(res, servable, pageTail)).catch(() => {
|
|
2586
|
-
if (!res.headersSent) res.status(404).end();
|
|
2587
|
-
});
|
|
2588
|
-
}
|
|
2589
|
-
function serveShownFile(req, res, shownFiles) {
|
|
2590
|
-
const servable = shownFiles?.findServable(req.params.sessionId, req.params.filename) ?? null;
|
|
2591
|
-
if (!servable) {
|
|
2592
|
-
res.status(404).end();
|
|
2593
|
-
return;
|
|
2594
|
-
}
|
|
2595
|
-
res.setHeader("Content-Security-Policy", SHOWN_FILE_SANDBOX_POLICY);
|
|
2596
|
-
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
2597
|
-
res.setHeader("Cache-Control", "private, max-age=604800, immutable");
|
|
2598
|
-
if (isShownPageMime(servable.mime)) {
|
|
2599
|
-
servePageWithZoomBridge(res, servable);
|
|
2600
|
-
return;
|
|
2601
|
-
}
|
|
2602
|
-
res.setHeader("Accept-Ranges", "bytes");
|
|
2603
|
-
const byteRange = decideByteRange(req.headers.range, servable.sizeBytes);
|
|
2604
|
-
if (byteRange.kind === "unsatisfiable") {
|
|
2605
|
-
res.status(416).setHeader("Content-Range", `bytes */${servable.sizeBytes}`);
|
|
2606
|
-
res.end();
|
|
2607
|
-
return;
|
|
2608
|
-
}
|
|
2609
|
-
res.setHeader("Content-Type", servable.mime);
|
|
2610
|
-
if (byteRange.kind === "partial") {
|
|
2611
|
-
res.status(206);
|
|
2612
|
-
res.setHeader("Content-Range", `bytes ${byteRange.start}-${byteRange.end}/${servable.sizeBytes}`);
|
|
2613
|
-
res.setHeader("Content-Length", String(byteRange.end - byteRange.start + 1));
|
|
2614
|
-
pipeline(fs.createReadStream(servable.path, {
|
|
2615
|
-
start: byteRange.start,
|
|
2616
|
-
end: byteRange.end
|
|
2617
|
-
}), res, () => {});
|
|
2618
|
-
return;
|
|
2619
|
-
}
|
|
2620
|
-
res.setHeader("Content-Length", String(servable.sizeBytes));
|
|
2621
|
-
pipeline(fs.createReadStream(servable.path), res, () => {});
|
|
2622
|
-
}
|
|
2623
|
-
//#endregion
|
|
2624
2525
|
//#region server/backend/http/backend-http-pack-files.ts
|
|
2625
2526
|
function requestedFilePath(splat) {
|
|
2626
2527
|
if (!Array.isArray(splat) || splat.length === 0) return null;
|
|
@@ -2877,7 +2778,7 @@ function mountAgentIngressRoutes(app, dependencies) {
|
|
|
2877
2778
|
const { hookRouter, getSession, getUsage, getPlanReview = () => null, refocusContextFor = () => ({
|
|
2878
2779
|
taskTitle: null,
|
|
2879
2780
|
latestPlanTitle: null
|
|
2880
|
-
}), takePromptSupervision = () => null, getAgentApi = () => null,
|
|
2781
|
+
}), takePromptSupervision = () => null, getAgentApi = () => null, getWhiteboardAssets = () => null, recordOutcome = () => {}, logger = console } = dependencies;
|
|
2881
2782
|
function toolHookHintReply(glimmervoidId, event, payload) {
|
|
2882
2783
|
const session = getSession(glimmervoidId);
|
|
2883
2784
|
const agentApi = getAgentApi();
|
|
@@ -2961,44 +2862,11 @@ function mountAgentIngressRoutes(app, dependencies) {
|
|
|
2961
2862
|
mountAgentMcp(app, {
|
|
2962
2863
|
getSession,
|
|
2963
2864
|
getAgentApi,
|
|
2964
|
-
getShownFiles,
|
|
2965
2865
|
getWhiteboardAssets,
|
|
2966
2866
|
isLoopback: isLoopbackRequest,
|
|
2967
2867
|
logger,
|
|
2968
2868
|
isOriginAllowed: (req) => decideOriginAllowed(req.headers.origin, [], { listenerPorts: req.socket.localPort ?? [] })
|
|
2969
2869
|
});
|
|
2970
|
-
app.post("/agent/:glimmervoidId/show", (req, res) => {
|
|
2971
|
-
const agentApi = getAgentApi();
|
|
2972
|
-
const shownFiles = getShownFiles();
|
|
2973
|
-
const session = getSession(req.params.glimmervoidId);
|
|
2974
|
-
if (!decideAgentRequest({
|
|
2975
|
-
sessionId: req.params.glimmervoidId,
|
|
2976
|
-
presentedToken: presentedToken(req),
|
|
2977
|
-
expectedToken: session?.agentToken ?? null,
|
|
2978
|
-
isLoopback: isLoopbackRequest(req)
|
|
2979
|
-
}).ok || !session || !agentApi || !shownFiles) {
|
|
2980
|
-
req.resume();
|
|
2981
|
-
refuseAgentRequest(res);
|
|
2982
|
-
return;
|
|
2983
|
-
}
|
|
2984
|
-
const roleRefusal = agentApi.refuseRole(session, "show");
|
|
2985
|
-
if (roleRefusal) {
|
|
2986
|
-
req.resume();
|
|
2987
|
-
sendShowReply({
|
|
2988
|
-
res,
|
|
2989
|
-
logger
|
|
2990
|
-
}, roleRefusal.status, roleRefusal.body);
|
|
2991
|
-
return;
|
|
2992
|
-
}
|
|
2993
|
-
session.noteCommandRan("show");
|
|
2994
|
-
answerShow({
|
|
2995
|
-
req,
|
|
2996
|
-
res,
|
|
2997
|
-
session,
|
|
2998
|
-
shownFiles,
|
|
2999
|
-
logger
|
|
3000
|
-
});
|
|
3001
|
-
});
|
|
3002
2870
|
app.post("/agent/:glimmervoidId/:verb", (req, res) => {
|
|
3003
2871
|
const agentApi = getAgentApi();
|
|
3004
2872
|
const session = getSession(req.params.glimmervoidId);
|
|
@@ -3268,9 +3136,6 @@ function createBackendHttpApp(dependencies) {
|
|
|
3268
3136
|
if (!res.headersSent) res.status(404).end();
|
|
3269
3137
|
});
|
|
3270
3138
|
});
|
|
3271
|
-
app.get("/shown/:sessionId/:filename", (req, res) => {
|
|
3272
|
-
serveShownFile(req, res, dependencies.getShownFiles?.() ?? null);
|
|
3273
|
-
});
|
|
3274
3139
|
app.post(WHITEBOARD_ASSET_ROUTE, (req, res) => {
|
|
3275
3140
|
const assets = dependencies.getWhiteboardAssets?.() ?? null;
|
|
3276
3141
|
const name = path.basename(decodeHeaderText(req.headers["x-glimmervoid-upload-name"]) ?? "");
|
|
@@ -7386,7 +7251,6 @@ function createAgentVerbHandlers(runtime, channels, { spawn }) {
|
|
|
7386
7251
|
}),
|
|
7387
7252
|
push,
|
|
7388
7253
|
edit,
|
|
7389
|
-
show: () => refusal(400, "show sends the file itself; run glimmervoid show <path>"),
|
|
7390
7254
|
limits: (session) => ({
|
|
7391
7255
|
status: 200,
|
|
7392
7256
|
body: limits(session)
|
|
@@ -7463,7 +7327,7 @@ function createAgentApiWiring({ config, agentSessions, listAllSessions, listBoar
|
|
|
7463
7327
|
};
|
|
7464
7328
|
const roleRefusal = describeRoleRefusal(parsed.verb, roleFactsOf(session));
|
|
7465
7329
|
if (roleRefusal) return roleRefusal;
|
|
7466
|
-
session.noteCommandRan(parsed.verb);
|
|
7330
|
+
session.noteCommandRan(parsed.verb === "whiteboard" && payload.sub === "show" ? "show" : parsed.verb);
|
|
7467
7331
|
const checked = checkAgentReply(parsed.verb, await dispatch(session, parsed.verb, parsed.request));
|
|
7468
7332
|
if (!checked.ok) logger.warn(`[agent-api] ${parsed.verb} reply broke its contract: ${checked.issue}`);
|
|
7469
7333
|
return checked.reply;
|
|
@@ -8378,6 +8242,68 @@ function resolveBoardRef(boards, ref) {
|
|
|
8378
8242
|
if (byTitle.length > 1) return { error: `${byTitle.length} boards are titled "${ref}", so name it by id: ${byTitle.map((board) => board.id).join(", ")}` };
|
|
8379
8243
|
return { error: `no board is called ${ref}: whiteboard list names the boards, and whiteboard new creates one` };
|
|
8380
8244
|
}
|
|
8245
|
+
var SHOWN_BOX_ID_RE = /^shown-(\d{1,9})$/;
|
|
8246
|
+
var SHOWN_BOX_WIDTH = 480;
|
|
8247
|
+
var SHOWN_BOX_GAP = 60;
|
|
8248
|
+
var EMPTY_BOARD_ORIGIN = {
|
|
8249
|
+
x: 40,
|
|
8250
|
+
y: 40
|
|
8251
|
+
};
|
|
8252
|
+
function isConnectedTo(record, sessionId) {
|
|
8253
|
+
return sessionId in record.cursorBySessionId;
|
|
8254
|
+
}
|
|
8255
|
+
function newestBoardId(records, timeOf) {
|
|
8256
|
+
return records.reduce((best, record) => best === null || timeOf(record) > timeOf(best) ? record : best, null)?.board.id ?? null;
|
|
8257
|
+
}
|
|
8258
|
+
function pickShowBoardId(records, sessionId) {
|
|
8259
|
+
const connectedRecords = records.filter((record) => isConnectedTo(record, sessionId));
|
|
8260
|
+
return newestBoardId(connectedRecords.filter((record) => record.createdBy === sessionId), (record) => record.board.createdAt) ?? newestBoardId(connectedRecords, (record) => record.board.updatedAt);
|
|
8261
|
+
}
|
|
8262
|
+
function shownBoxNumbers(board) {
|
|
8263
|
+
return Object.keys(board.elements).flatMap((elementId) => {
|
|
8264
|
+
const shownNumber = SHOWN_BOX_ID_RE.exec(elementId)?.[1];
|
|
8265
|
+
return shownNumber ? [Number(shownNumber)] : [];
|
|
8266
|
+
});
|
|
8267
|
+
}
|
|
8268
|
+
function shownBoxOp(board, contentBounds, card) {
|
|
8269
|
+
const lastShownNumber = Math.max(0, ...shownBoxNumbers(board));
|
|
8270
|
+
const boxId = `shown-${lastShownNumber + 1}`;
|
|
8271
|
+
const caption = card.caption?.slice(0, WHITEBOARD_LIMITS.line) ?? null;
|
|
8272
|
+
const isEmptyBoard = Object.keys(board.elements).length === 0;
|
|
8273
|
+
const belowContent = {
|
|
8274
|
+
x: contentBounds.x,
|
|
8275
|
+
y: contentBounds.y + contentBounds.height + SHOWN_BOX_GAP
|
|
8276
|
+
};
|
|
8277
|
+
const placement = lastShownNumber > 0 ? { near: {
|
|
8278
|
+
of: `shown-${lastShownNumber}`,
|
|
8279
|
+
side: "right",
|
|
8280
|
+
gap: SHOWN_BOX_GAP
|
|
8281
|
+
} } : { at: isEmptyBoard ? EMPTY_BOARD_ORIGIN : belowContent };
|
|
8282
|
+
const box = Box.safeParse({
|
|
8283
|
+
kind: "box",
|
|
8284
|
+
id: boxId,
|
|
8285
|
+
title: card.title.slice(0, WHITEBOARD_LIMITS.title),
|
|
8286
|
+
lines: caption ? [{ text: caption }] : [],
|
|
8287
|
+
media: {
|
|
8288
|
+
...card.media,
|
|
8289
|
+
alt: caption ?? card.title.slice(0, WHITEBOARD_LIMITS.line)
|
|
8290
|
+
},
|
|
8291
|
+
width: SHOWN_BOX_WIDTH,
|
|
8292
|
+
...placement
|
|
8293
|
+
});
|
|
8294
|
+
if (!box.success) return {
|
|
8295
|
+
ok: false,
|
|
8296
|
+
error: `box ${boxId} could not be built: ${box.error.issues[0]?.message ?? "invalid box"}`
|
|
8297
|
+
};
|
|
8298
|
+
return {
|
|
8299
|
+
ok: true,
|
|
8300
|
+
op: {
|
|
8301
|
+
op: "add",
|
|
8302
|
+
element: box.data
|
|
8303
|
+
},
|
|
8304
|
+
boxId
|
|
8305
|
+
};
|
|
8306
|
+
}
|
|
8381
8307
|
//#endregion
|
|
8382
8308
|
//#region server/whiteboard/whiteboard-wiring.ts
|
|
8383
8309
|
var WHITEBOARDS_FOLDER_NAME = "whiteboards";
|
|
@@ -8912,10 +8838,84 @@ function createWhiteboardWiring({ boardsRoot, broadcastControl = () => {}, now =
|
|
|
8912
8838
|
}
|
|
8913
8839
|
};
|
|
8914
8840
|
}
|
|
8841
|
+
async function pageTitleOf(sourcePath) {
|
|
8842
|
+
const handle = await fs$1.open(sourcePath, "r").catch(() => null);
|
|
8843
|
+
if (!handle) return null;
|
|
8844
|
+
try {
|
|
8845
|
+
const firstChunk = Buffer.alloc(SHOWN_SNIFF_BYTES);
|
|
8846
|
+
const { bytesRead } = await handle.read(firstChunk, 0, SHOWN_SNIFF_BYTES, 0);
|
|
8847
|
+
return readPageTitle(firstChunk.subarray(0, bytesRead));
|
|
8848
|
+
} finally {
|
|
8849
|
+
await handle.close();
|
|
8850
|
+
}
|
|
8851
|
+
}
|
|
8852
|
+
async function showBoardIdFor(caller) {
|
|
8853
|
+
const pickedBoardId = pickShowBoardId([...recordsByBoardId.values()], caller.id);
|
|
8854
|
+
if (pickedBoardId) return {
|
|
8855
|
+
ok: true,
|
|
8856
|
+
boardId: pickedBoardId
|
|
8857
|
+
};
|
|
8858
|
+
const created = await createBoardFor(caller, caller.name.slice(0, WHITEBOARD_LIMITS.title));
|
|
8859
|
+
if (!created.body.ok || !("board" in created.body)) return {
|
|
8860
|
+
ok: false,
|
|
8861
|
+
reply: created
|
|
8862
|
+
};
|
|
8863
|
+
return {
|
|
8864
|
+
ok: true,
|
|
8865
|
+
boardId: created.body.board.id
|
|
8866
|
+
};
|
|
8867
|
+
}
|
|
8868
|
+
async function showOnBoard(caller, requestedPath, caption) {
|
|
8869
|
+
if (caller.remoteWorkspace) return refusal$1(409, `show reads files on the Glimmervoid machine, and this session runs in the Coder workspace ${caller.remoteWorkspace}, so its files are not there`);
|
|
8870
|
+
const sourcePath = path.resolve(caller.cwd ?? boardsRoot, requestedPath);
|
|
8871
|
+
const ingested = await assets.ingestFile(sourcePath);
|
|
8872
|
+
if (!ingested.ok) return refusal$1(ingested.status, ingested.error);
|
|
8873
|
+
const pageTitle = ingested.media.kind === "page" ? await pageTitleOf(sourcePath) : null;
|
|
8874
|
+
const target = await showBoardIdFor(caller);
|
|
8875
|
+
if (!target.ok) return target.reply;
|
|
8876
|
+
const card = {
|
|
8877
|
+
media: ingested.media,
|
|
8878
|
+
title: pageTitle ?? path.basename(sourcePath),
|
|
8879
|
+
caption
|
|
8880
|
+
};
|
|
8881
|
+
const author = {
|
|
8882
|
+
id: caller.id,
|
|
8883
|
+
name: caller.name
|
|
8884
|
+
};
|
|
8885
|
+
return changeRecord(target.boardId, (record) => {
|
|
8886
|
+
const shownBox = shownBoxOp(record.board, layoutBoard(record.board).bounds, card);
|
|
8887
|
+
if (!shownBox.ok) return {
|
|
8888
|
+
ok: false,
|
|
8889
|
+
reply: refusal$1(400, `${shownBox.error}, so nothing changed`)
|
|
8890
|
+
};
|
|
8891
|
+
const { op, boxId } = shownBox;
|
|
8892
|
+
const applied = applyOpsToRecord(record, [op], author);
|
|
8893
|
+
if (!applied.ok) return {
|
|
8894
|
+
ok: false,
|
|
8895
|
+
reply: refusal$1(400, `${applied.error}, so nothing changed`)
|
|
8896
|
+
};
|
|
8897
|
+
const { board } = applied.record;
|
|
8898
|
+
const note = `showed ${card.title} as box ${boxId} on board "${board.title}" (${board.id}), where the operator sees it; change it with whiteboard put`;
|
|
8899
|
+
return {
|
|
8900
|
+
ok: true,
|
|
8901
|
+
record: applied.record,
|
|
8902
|
+
reply: {
|
|
8903
|
+
status: 200,
|
|
8904
|
+
body: {
|
|
8905
|
+
ok: true,
|
|
8906
|
+
board: summarizeBoard(applied.record),
|
|
8907
|
+
note
|
|
8908
|
+
}
|
|
8909
|
+
},
|
|
8910
|
+
patch: applied.patch
|
|
8911
|
+
};
|
|
8912
|
+
});
|
|
8913
|
+
}
|
|
8915
8914
|
async function handleAgent(caller, request) {
|
|
8916
8915
|
await loaded;
|
|
8917
8916
|
if (request.sub === "new") return createBoardFor(caller, request.title);
|
|
8918
8917
|
if (request.sub === "attach") return attachMedia(caller, request.path);
|
|
8918
|
+
if (request.sub === "show") return showOnBoard(caller, request.path, request.caption?.trim() || null);
|
|
8919
8919
|
if (request.sub === "list") return {
|
|
8920
8920
|
status: 200,
|
|
8921
8921
|
body: {
|
|
@@ -48063,215 +48063,41 @@ function createTraceChangeBroadcast({ source, broadcast, setTimeoutFunction = se
|
|
|
48063
48063
|
return { stop };
|
|
48064
48064
|
}
|
|
48065
48065
|
//#endregion
|
|
48066
|
-
//#region server/session/shown-thumbnails.ts
|
|
48067
|
-
var VIDEO_POSTER_TIMEOUT_MS = 15e3;
|
|
48068
|
-
var THUMBNAIL_WEBP_QUALITY = 80;
|
|
48069
|
-
async function writeImageThumbnail(sourcePath, thumbnailPath) {
|
|
48070
|
-
const { default: sharp } = await import("sharp");
|
|
48071
|
-
await sharp(sourcePath, { animated: false }).resize(320, 320, {
|
|
48072
|
-
fit: "inside",
|
|
48073
|
-
withoutEnlargement: true
|
|
48074
|
-
}).webp({ quality: THUMBNAIL_WEBP_QUALITY }).toFile(thumbnailPath);
|
|
48075
|
-
}
|
|
48076
|
-
async function writeVideoPoster(sourcePath, thumbnailPath) {
|
|
48077
|
-
const ffmpegPath = resolveFfmpegPath();
|
|
48078
|
-
if (!ffmpegPath) throw new Error("ffmpeg-static has no binary for this platform");
|
|
48079
|
-
await execFileAsync(ffmpegPath, [
|
|
48080
|
-
"-v",
|
|
48081
|
-
"error",
|
|
48082
|
-
"-i",
|
|
48083
|
-
sourcePath,
|
|
48084
|
-
"-frames:v",
|
|
48085
|
-
"1",
|
|
48086
|
-
"-vf",
|
|
48087
|
-
`scale='min(320,iw)':'min(320,ih)':force_original_aspect_ratio=decrease`,
|
|
48088
|
-
"-c:v",
|
|
48089
|
-
"libwebp",
|
|
48090
|
-
"-quality",
|
|
48091
|
-
String(THUMBNAIL_WEBP_QUALITY),
|
|
48092
|
-
"-y",
|
|
48093
|
-
thumbnailPath
|
|
48094
|
-
], { timeout: VIDEO_POSTER_TIMEOUT_MS });
|
|
48095
|
-
}
|
|
48096
|
-
var THUMBNAIL_WRITERS = {
|
|
48097
|
-
image: writeImageThumbnail,
|
|
48098
|
-
"video-poster": writeVideoPoster
|
|
48099
|
-
};
|
|
48100
|
-
async function makeShownThumbnail(recipe, sourcePath, thumbnailPath) {
|
|
48101
|
-
if (recipe === "none") return false;
|
|
48102
|
-
try {
|
|
48103
|
-
await THUMBNAIL_WRITERS[recipe](sourcePath, thumbnailPath);
|
|
48104
|
-
return true;
|
|
48105
|
-
} catch {
|
|
48106
|
-
await fs$1.unlink(thumbnailPath).catch(() => {});
|
|
48107
|
-
return false;
|
|
48108
|
-
}
|
|
48109
|
-
}
|
|
48110
|
-
//#endregion
|
|
48111
|
-
//#region server/session/shown-files-wiring.ts
|
|
48112
|
-
var SHOWN_FOLDER_NAME = "shown";
|
|
48113
|
-
var INDEX_FILENAME = "index.json";
|
|
48114
|
-
var INCOMING_PREFIX = ".incoming-";
|
|
48115
|
-
var ShownIndex = z.array(ShownFile);
|
|
48116
|
-
async function readFirstChunk(filePath) {
|
|
48117
|
-
const handle = await fs$1.open(filePath, "r");
|
|
48118
|
-
try {
|
|
48119
|
-
const buffer = Buffer.alloc(SHOWN_SNIFF_BYTES);
|
|
48120
|
-
const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, 0);
|
|
48121
|
-
return buffer.subarray(0, bytesRead);
|
|
48122
|
-
} finally {
|
|
48123
|
-
await handle.close().catch(() => {});
|
|
48124
|
-
}
|
|
48125
|
-
}
|
|
48126
|
-
async function readSessionIndex(indexPath) {
|
|
48127
|
-
const text = await fs$1.readFile(indexPath, "utf8").catch(() => null);
|
|
48128
|
-
if (text === null) return [];
|
|
48129
|
-
const parsed = ShownIndex.safeParse(parseJsonOrNull(text));
|
|
48130
|
-
return parsed.success ? parsed.data : [];
|
|
48131
|
-
}
|
|
48132
|
-
async function writeSessionIndex(indexPath, files) {
|
|
48133
|
-
const pendingPath = `${indexPath}.${crypto.randomBytes(4).toString("hex")}.tmp`;
|
|
48134
|
-
await fs$1.writeFile(pendingPath, JSON.stringify(files), { mode: 384 });
|
|
48135
|
-
await fs$1.rename(pendingPath, indexPath);
|
|
48136
|
-
}
|
|
48137
|
-
function createShownFilesWiring({ shownRoot, broadcastControl, now = Date.now }) {
|
|
48138
|
-
const filesBySessionId = /* @__PURE__ */ new Map();
|
|
48139
|
-
const indexQueue = createKeyedSerialQueue();
|
|
48140
|
-
const thumbnailSizeByPath = /* @__PURE__ */ new Map();
|
|
48141
|
-
function sessionDir(sessionId) {
|
|
48142
|
-
return path.join(shownRoot, sessionId);
|
|
48143
|
-
}
|
|
48144
|
-
async function loadIndexes() {
|
|
48145
|
-
const sessionIds = await fs$1.readdir(shownRoot).catch(() => []);
|
|
48146
|
-
for (const sessionId of sessionIds) {
|
|
48147
|
-
if (!isSafePathSegment(sessionId)) continue;
|
|
48148
|
-
const files = await readSessionIndex(path.join(sessionDir(sessionId), INDEX_FILENAME));
|
|
48149
|
-
if (files.length > 0 && !filesBySessionId.has(sessionId)) filesBySessionId.set(sessionId, files);
|
|
48150
|
-
for (const file of files) if (file.hasThumbnail) await recordThumbnailSize(path.join(sessionDir(sessionId), thumbnailFilenameOf(file.id)));
|
|
48151
|
-
}
|
|
48152
|
-
}
|
|
48153
|
-
async function recordThumbnailSize(thumbnailPath) {
|
|
48154
|
-
const stats = await fs$1.stat(thumbnailPath).catch(() => null);
|
|
48155
|
-
if (!stats) return false;
|
|
48156
|
-
thumbnailSizeByPath.set(thumbnailPath, stats.size);
|
|
48157
|
-
return true;
|
|
48158
|
-
}
|
|
48159
|
-
async function reserveIncomingPath(sessionId) {
|
|
48160
|
-
const dir = sessionDir(sessionId);
|
|
48161
|
-
await fs$1.mkdir(dir, {
|
|
48162
|
-
recursive: true,
|
|
48163
|
-
mode: 448
|
|
48164
|
-
});
|
|
48165
|
-
return path.join(dir, `${INCOMING_PREFIX}${crypto.randomBytes(8).toString("hex")}`);
|
|
48166
|
-
}
|
|
48167
|
-
async function recordAdmitted(sessionId, file) {
|
|
48168
|
-
const dir = sessionDir(sessionId);
|
|
48169
|
-
const withNewest = [...filesBySessionId.get(sessionId) ?? await readSessionIndex(path.join(dir, INDEX_FILENAME)), file];
|
|
48170
|
-
const droppedIds = planUploadRetention(withNewest.map((shown) => shown.id), {
|
|
48171
|
-
keep: 50,
|
|
48172
|
-
justWritten: file.id
|
|
48173
|
-
});
|
|
48174
|
-
const kept = filesAfterRetention(withNewest, droppedIds);
|
|
48175
|
-
await writeSessionIndex(path.join(dir, INDEX_FILENAME), kept);
|
|
48176
|
-
filesBySessionId.set(sessionId, kept);
|
|
48177
|
-
const droppedFilenames = droppedIds.flatMap((droppedId) => [droppedId, thumbnailFilenameOf(droppedId)]);
|
|
48178
|
-
for (const droppedId of droppedIds) thumbnailSizeByPath.delete(path.join(dir, thumbnailFilenameOf(droppedId)));
|
|
48179
|
-
await Promise.all(droppedFilenames.map((droppedFilename) => fs$1.unlink(path.join(dir, droppedFilename)).catch(() => {})));
|
|
48180
|
-
}
|
|
48181
|
-
async function admit(session, arrival) {
|
|
48182
|
-
const firstChunk = await readFirstChunk(arrival.incomingPath);
|
|
48183
|
-
const verdict = decideShownKind(firstChunk, arrival.name);
|
|
48184
|
-
if (!verdict.ok) {
|
|
48185
|
-
await fs$1.unlink(arrival.incomingPath).catch(() => {});
|
|
48186
|
-
return {
|
|
48187
|
-
ok: false,
|
|
48188
|
-
status: 415,
|
|
48189
|
-
error: verdict.error
|
|
48190
|
-
};
|
|
48191
|
-
}
|
|
48192
|
-
const shownAt = now();
|
|
48193
|
-
const fileId = buildUploadFilename({
|
|
48194
|
-
now: shownAt,
|
|
48195
|
-
randomSuffix: crypto.randomBytes(4).toString("hex"),
|
|
48196
|
-
extension: verdict.extension
|
|
48197
|
-
});
|
|
48198
|
-
const storedPath = path.join(sessionDir(session.id), fileId);
|
|
48199
|
-
await fs$1.rename(arrival.incomingPath, storedPath);
|
|
48200
|
-
const thumbnailPath = path.join(sessionDir(session.id), thumbnailFilenameOf(fileId));
|
|
48201
|
-
const hasThumbnail = await makeShownThumbnail(thumbnailRecipeFor(verdict.kind), storedPath, thumbnailPath) && await recordThumbnailSize(thumbnailPath);
|
|
48202
|
-
const file = {
|
|
48203
|
-
id: fileId,
|
|
48204
|
-
name: arrival.name,
|
|
48205
|
-
caption: arrival.caption,
|
|
48206
|
-
kind: verdict.kind,
|
|
48207
|
-
mime: verdict.mime,
|
|
48208
|
-
sizeBytes: arrival.sizeBytes,
|
|
48209
|
-
pageTitle: verdict.kind === "page" ? readPageTitle(firstChunk) : null,
|
|
48210
|
-
shownAt,
|
|
48211
|
-
hasThumbnail
|
|
48212
|
-
};
|
|
48213
|
-
await indexQueue.run(session.id, () => recordAdmitted(session.id, file));
|
|
48214
|
-
broadcastControl({
|
|
48215
|
-
type: "session-shown",
|
|
48216
|
-
id: session.id,
|
|
48217
|
-
files: [file]
|
|
48218
|
-
});
|
|
48219
|
-
return {
|
|
48220
|
-
ok: true,
|
|
48221
|
-
file
|
|
48222
|
-
};
|
|
48223
|
-
}
|
|
48224
|
-
function findServable(sessionId, filename) {
|
|
48225
|
-
if (!isSafePathSegment(sessionId) || !isSafePathSegment(filename)) return null;
|
|
48226
|
-
const thumbnailOwnerId = thumbnailOwnerIdOf(filename);
|
|
48227
|
-
if (thumbnailOwnerId !== null) return findServableThumbnail(sessionId, thumbnailOwnerId, filename);
|
|
48228
|
-
const file = filesBySessionId.get(sessionId)?.find((shown) => shown.id === filename);
|
|
48229
|
-
const mime = shownMimeForFilename(filename);
|
|
48230
|
-
if (!file || !mime) return null;
|
|
48231
|
-
return {
|
|
48232
|
-
path: path.join(sessionDir(sessionId), filename),
|
|
48233
|
-
mime,
|
|
48234
|
-
sizeBytes: file.sizeBytes
|
|
48235
|
-
};
|
|
48236
|
-
}
|
|
48237
|
-
function findServableThumbnail(sessionId, ownerId, filename) {
|
|
48238
|
-
const owner = filesBySessionId.get(sessionId)?.find((shown) => shown.id === ownerId);
|
|
48239
|
-
const mime = shownMimeForFilename(filename);
|
|
48240
|
-
if (!owner?.hasThumbnail || !mime) return null;
|
|
48241
|
-
const thumbnailPath = path.join(sessionDir(sessionId), filename);
|
|
48242
|
-
const sizeBytes = thumbnailSizeByPath.get(thumbnailPath);
|
|
48243
|
-
if (sizeBytes === void 0) return null;
|
|
48244
|
-
return {
|
|
48245
|
-
path: thumbnailPath,
|
|
48246
|
-
mime,
|
|
48247
|
-
sizeBytes
|
|
48248
|
-
};
|
|
48249
|
-
}
|
|
48250
|
-
function snapshotMessage() {
|
|
48251
|
-
return {
|
|
48252
|
-
type: "session-shown-snapshot",
|
|
48253
|
-
sessions: Object.fromEntries(filesBySessionId)
|
|
48254
|
-
};
|
|
48255
|
-
}
|
|
48256
|
-
return {
|
|
48257
|
-
reserveIncomingPath,
|
|
48258
|
-
admit,
|
|
48259
|
-
findServable,
|
|
48260
|
-
snapshotMessage,
|
|
48261
|
-
loaded: loadIndexes()
|
|
48262
|
-
};
|
|
48263
|
-
}
|
|
48264
|
-
//#endregion
|
|
48265
48066
|
//#region server/uploads-wiring.ts
|
|
48067
|
+
var RETIRED_SHOWN_FOLDER_NAME = "shown";
|
|
48068
|
+
var RETIRED_SHOWN_INDEX_FILENAME = "index.json";
|
|
48069
|
+
var RETIRED_SHOWN_STORE_FILE_RE = /^(index\.json(\.[0-9a-f]{8}\.tmp)?|\.incoming-[0-9a-f]{16}|\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z-[0-9a-f]{8}\.(png|jpg|gif|webp|svg|mp4|webm|html)(\.thumb\.webp)?)$/;
|
|
48266
48070
|
var UPLOAD_RETAIN_DAYS = 7;
|
|
48267
48071
|
var PRUNE_INTERVAL_MS = 864e5;
|
|
48072
|
+
function isMissingOrNotEmpty(error) {
|
|
48073
|
+
return error.code === "ENOENT" || error.code === "ENOTEMPTY";
|
|
48074
|
+
}
|
|
48075
|
+
async function removeRetiredShownSessionFolder(sessionFolder) {
|
|
48076
|
+
const fileNames = await fs.promises.readdir(sessionFolder);
|
|
48077
|
+
if (!fileNames.includes(RETIRED_SHOWN_INDEX_FILENAME)) return;
|
|
48078
|
+
const storeFileNames = fileNames.filter((fileName) => RETIRED_SHOWN_STORE_FILE_RE.test(fileName));
|
|
48079
|
+
await Promise.all(storeFileNames.map((fileName) => fs.promises.rm(path.join(sessionFolder, fileName), { force: true })));
|
|
48080
|
+
await fs.promises.rmdir(sessionFolder).catch((error) => {
|
|
48081
|
+
if (!isMissingOrNotEmpty(error)) throw error;
|
|
48082
|
+
});
|
|
48083
|
+
}
|
|
48084
|
+
async function removeRetiredShownFiles(shownRoot) {
|
|
48085
|
+
const entries = await fs.promises.readdir(shownRoot, { withFileTypes: true }).catch((error) => {
|
|
48086
|
+
if (error.code === "ENOENT") return [];
|
|
48087
|
+
throw error;
|
|
48088
|
+
});
|
|
48089
|
+
for (const entry of entries) if (entry.isDirectory()) await removeRetiredShownSessionFolder(path.join(shownRoot, entry.name));
|
|
48090
|
+
await fs.promises.rmdir(shownRoot).catch((error) => {
|
|
48091
|
+
if (!isMissingOrNotEmpty(error)) throw error;
|
|
48092
|
+
});
|
|
48093
|
+
}
|
|
48268
48094
|
function createUploadsWiring({ configPath, liveSessionIds, setIntervalFn = DEFAULT_TIMER_FNS.setIntervalFn, clearIntervalFn = DEFAULT_TIMER_FNS.clearIntervalFn }) {
|
|
48269
48095
|
const uploadsRoot = configSiblingPath(configPath, "uploads");
|
|
48270
48096
|
let timer = null;
|
|
48271
48097
|
async function prune() {
|
|
48272
48098
|
const retainedSessionIds = liveSessionIds();
|
|
48273
|
-
|
|
48274
|
-
directory,
|
|
48099
|
+
await pruneAgedFiles({
|
|
48100
|
+
directory: uploadsRoot,
|
|
48275
48101
|
suffixes: [""],
|
|
48276
48102
|
retainDays: UPLOAD_RETAIN_DAYS,
|
|
48277
48103
|
entryMode: "directory",
|
|
@@ -48287,6 +48113,7 @@ function createUploadsWiring({ configPath, liveSessionIds, setIntervalFn = DEFAU
|
|
|
48287
48113
|
prune();
|
|
48288
48114
|
}, PRUNE_INTERVAL_MS);
|
|
48289
48115
|
unrefTimer(timer);
|
|
48116
|
+
await removeRetiredShownFiles(configSiblingPath(configPath, RETIRED_SHOWN_FOLDER_NAME));
|
|
48290
48117
|
}
|
|
48291
48118
|
function stop() {
|
|
48292
48119
|
if (!timer) return;
|
|
@@ -54144,7 +53971,6 @@ function createBackendControl(dependencies) {
|
|
|
54144
53971
|
});
|
|
54145
53972
|
};
|
|
54146
53973
|
sendLaneSnapshotOnConnect("session-docs", () => dependencies.sessionDocs);
|
|
54147
|
-
sendLaneSnapshotOnConnect("session-shown", () => dependencies.shownFiles);
|
|
54148
53974
|
sendLaneSnapshotOnConnect("coherence-feed", () => dependencies.coherenceFeed);
|
|
54149
53975
|
sendLaneSnapshotOnConnect("whiteboards", () => dependencies.whiteboards);
|
|
54150
53976
|
return { removeExitedSession: controlHandlers.removeExitedSession };
|
|
@@ -59495,7 +59321,6 @@ function createBackend(httpServer, options = {}) {
|
|
|
59495
59321
|
let broadcastControl = null;
|
|
59496
59322
|
let removeExitedSession = null;
|
|
59497
59323
|
let agentApi = null;
|
|
59498
|
-
let shownFiles = null;
|
|
59499
59324
|
let gitWorkspace = null;
|
|
59500
59325
|
warnWhenGitIsTooOld({ log: console });
|
|
59501
59326
|
const sessionRuntime = createBackendSessionRuntime({
|
|
@@ -59529,7 +59354,6 @@ function createBackend(httpServer, options = {}) {
|
|
|
59529
59354
|
return deliverable.length === 0 ? null : promptContextReplyOf(replyShape, deliverable.join("\n\n"));
|
|
59530
59355
|
},
|
|
59531
59356
|
getAgentApi: () => agentApi,
|
|
59532
|
-
getShownFiles: () => shownFiles,
|
|
59533
59357
|
getWhiteboardAssets: () => whiteboards.assets,
|
|
59534
59358
|
getPrActionReports: () => laneAssembly.prFlows,
|
|
59535
59359
|
sshSigner,
|
|
@@ -59574,11 +59398,6 @@ function createBackend(httpServer, options = {}) {
|
|
|
59574
59398
|
if (message.type === "session-removed" && typeof message.id === "string") whiteboards.forgetSession(message.id);
|
|
59575
59399
|
};
|
|
59576
59400
|
const sessionDocs = createSessionDocsWiring({ broadcastControl: broadcastControlFromWebSockets });
|
|
59577
|
-
const shownFilesWiring = createShownFilesWiring({
|
|
59578
|
-
shownRoot: configSiblingPath(configStore.configPath, SHOWN_FOLDER_NAME),
|
|
59579
|
-
broadcastControl: broadcastControlFromWebSockets
|
|
59580
|
-
});
|
|
59581
|
-
shownFiles = shownFilesWiring;
|
|
59582
59401
|
const whiteboards = createWhiteboardWiring({
|
|
59583
59402
|
boardsRoot: configSiblingPath(configStore.configPath, WHITEBOARDS_FOLDER_NAME),
|
|
59584
59403
|
broadcastControl: broadcastControlFromWebSockets,
|
|
@@ -59942,7 +59761,6 @@ function createBackend(httpServer, options = {}) {
|
|
|
59942
59761
|
readPlanRevision: laneAssembly.planReview?.readPlanRevision ?? null,
|
|
59943
59762
|
decidePlanReview: laneAssembly.planReview?.decide ?? null,
|
|
59944
59763
|
sessionDocs,
|
|
59945
|
-
shownFiles: shownFilesWiring,
|
|
59946
59764
|
whiteboards,
|
|
59947
59765
|
changeMaps,
|
|
59948
59766
|
coherenceFeed,
|