@fish-under-sea/dsh-client-ui-task-board-fish 2.2.2 → 2.3.0
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/README.en.md +4 -4
- package/package.json +5 -4
- package/README.i18n.yaml +0 -6
- package/README.md +0 -31
- package/README.zh.md +0 -31
- package/lib/client.js +0 -15861
- package/lib/client.js.map +0 -1
- package/lib/index.js +0 -12653
- package/lib/types/client/CardDefaultPresetField.d.ts +0 -35
- package/lib/types/client/PluginSettingsCard.d.ts +0 -255
- package/lib/types/client/RangeBubble.d.ts +0 -46
- package/lib/types/client/SegmentGroup.d.ts +0 -28
- package/lib/types/client/TaskBoardSettingsCard.d.ts +0 -155
- package/lib/types/client/apply-guard.d.ts +0 -25
- package/lib/types/client/board/AttachmentField.d.ts +0 -70
- package/lib/types/client/board/ClampedMarkdown.d.ts +0 -3
- package/lib/types/client/board/ConfirmDialog.d.ts +0 -15
- package/lib/types/client/board/EditTaskModal.d.ts +0 -17
- package/lib/types/client/board/ExecutionLog.d.ts +0 -24
- package/lib/types/client/board/LinkSubtaskModal.d.ts +0 -14
- package/lib/types/client/board/NewTaskModal.d.ts +0 -26
- package/lib/types/client/board/ReasoningEffortField.d.ts +0 -25
- package/lib/types/client/board/TagManagerModal.d.ts +0 -26
- package/lib/types/client/board/TaskBoard.d.ts +0 -26
- package/lib/types/client/board/TaskCard.d.ts +0 -36
- package/lib/types/client/board/TaskDetail.d.ts +0 -9
- package/lib/types/client/board/TaskForm.d.ts +0 -76
- package/lib/types/client/board/VerificationReport.d.ts +0 -10
- package/lib/types/client/board/card-view.d.ts +0 -113
- package/lib/types/client/board/icons.d.ts +0 -32
- package/lib/types/client/board/model-options.d.ts +0 -87
- package/lib/types/client/board/overlay.d.ts +0 -69
- package/lib/types/client/board/parse-model-pref.d.ts +0 -4
- package/lib/types/client/board/preset-label.d.ts +0 -43
- package/lib/types/client/board/preset-roster.d.ts +0 -45
- package/lib/types/client/board/source-group.d.ts +0 -27
- package/lib/types/client/board/status-key.d.ts +0 -19
- package/lib/types/client/board/task-markdown.d.ts +0 -19
- package/lib/types/client/body-mutations.d.ts +0 -45
- package/lib/types/client/host-api.d.ts +0 -88
- package/lib/types/client/index.d.ts +0 -128
- package/lib/types/client/locales.d.ts +0 -521
- package/lib/types/client/main-session.d.ts +0 -32
- package/lib/types/client/native-panel.d.ts +0 -48
- package/lib/types/client/pending-verify.d.ts +0 -47
- package/lib/types/client/plugin-card-seat.d.ts +0 -110
- package/lib/types/client/schedule-presets.d.ts +0 -10
- package/lib/types/client/schedule-zone.d.ts +0 -97
- package/lib/types/client/seats.d.ts +0 -18
- package/lib/types/client/service.d.ts +0 -35
- package/lib/types/client/settings-entry-form.d.ts +0 -49
- package/lib/types/client/settings-form.d.ts +0 -235
- package/lib/types/core/attachment.d.ts +0 -132
- package/lib/types/core/card-defaults.d.ts +0 -78
- package/lib/types/core/controller.d.ts +0 -422
- package/lib/types/core/degraded-reason.d.ts +0 -46
- package/lib/types/core/execution-summary.d.ts +0 -52
- package/lib/types/core/extension.d.ts +0 -399
- package/lib/types/core/freeze-snapshot.d.ts +0 -71
- package/lib/types/core/handover.d.ts +0 -70
- package/lib/types/core/issue-form.d.ts +0 -16
- package/lib/types/core/launch-width.d.ts +0 -31
- package/lib/types/core/package-name.d.ts +0 -9
- package/lib/types/core/poll-cadence.d.ts +0 -31
- package/lib/types/core/reasoning-effort.d.ts +0 -57
- package/lib/types/core/schedule.d.ts +0 -124
- package/lib/types/core/session-reuse.d.ts +0 -30
- package/lib/types/core/spend-budget.d.ts +0 -28
- package/lib/types/core/store.d.ts +0 -64
- package/lib/types/core/subtask.d.ts +0 -204
- package/lib/types/core/tasks.d.ts +0 -685
- package/lib/types/core/use-cases/task-archive.d.ts +0 -20
- package/lib/types/core/use-cases/task-create.d.ts +0 -32
- package/lib/types/core/use-cases/task-delete.d.ts +0 -27
- package/lib/types/core/use-cases/task-parent.d.ts +0 -21
- package/lib/types/core/use-cases/task-schedule.d.ts +0 -96
- package/lib/types/core/use-cases/task-tag.d.ts +0 -84
- package/lib/types/core/use-cases/task-update.d.ts +0 -77
- package/lib/types/core/verification-budget.d.ts +0 -52
- package/lib/types/core/verification.d.ts +0 -753
- package/lib/types/core/wire-projection.d.ts +0 -35
- package/lib/types/core/workspace-target.d.ts +0 -61
- package/lib/types/dsh-home.d.ts +0 -16
- package/lib/types/host/agent-tools.d.ts +0 -27
- package/lib/types/host/attachments.d.ts +0 -250
- package/lib/types/host/extension-registry.d.ts +0 -151
- package/lib/types/host/launch-admission.d.ts +0 -71
- package/lib/types/host/llm-dispatch.d.ts +0 -63
- package/lib/types/host/verification-gate.d.ts +0 -95
- package/lib/types/host/verification-runner.d.ts +0 -139
- package/lib/types/host/workspace-evidence.d.ts +0 -53
- package/lib/types/host-ai.d.ts +0 -51
- package/lib/types/host-ledger.d.ts +0 -452
- package/lib/types/host-routes.d.ts +0 -99
- package/lib/types/host-runner.d.ts +0 -401
- package/lib/types/host-service.d.ts +0 -517
- package/lib/types/host-spend.d.ts +0 -52
- package/lib/types/http.d.ts +0 -59
- package/lib/types/index.d.ts +0 -441
- package/lib/types/loopback.d.ts +0 -64
- package/lib/types/mount-once.d.ts +0 -55
- package/lib/types/power-inhibitor.d.ts +0 -73
- package/lib/types/protocol.d.ts +0 -253
- package/lib/types/tool-surface.d.ts +0 -72
package/lib/types/index.d.ts
DELETED
|
@@ -1,441 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Host loader entry for the task-board plugin.
|
|
3
|
-
*
|
|
4
|
-
* The Host owns the v2 ledger, action API, cron scheduler, session runner,
|
|
5
|
-
* execution reconciliation, and optional idle-sleep inhibitor. The browser is
|
|
6
|
-
* a same-origin asynchronous view over that service.
|
|
7
|
-
*/
|
|
8
|
-
import type { Context, Volatile } from '@deepseek-ai/cordis';
|
|
9
|
-
import z from '@deepseek-ai/schemastery';
|
|
10
|
-
import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
11
|
-
import type { LlmRuntime } from '@deepseek-ai/dsh-llm';
|
|
12
|
-
import { type HostTimerFace } from './host-service.ts';
|
|
13
|
-
import { type TaskPermission } from './core/tasks.ts';
|
|
14
|
-
import { type TaskBoardConnectionTrust } from './host-routes.ts';
|
|
15
|
-
import type { ModelInfoResolver, TaskBoardAttachmentStore } from './host/attachments.ts';
|
|
16
|
-
/** Default environment variable holding the authenticated proxy token. */
|
|
17
|
-
export declare const DEFAULT_PROXY_TOKEN_ENV = "DSH_TASK_BOARD_PROXY_TOKEN";
|
|
18
|
-
export declare const inject: string[];
|
|
19
|
-
/** Model-facing announcement: plugin presence, capabilities, and limits. */
|
|
20
|
-
export declare const TASK_BOARD_GUIDANCE = "\u672C\u673A\u5DF2\u5B89\u88C5 dsh-task-board \u63D2\u4EF6\uFF08DSH Web GUI \u7684\u4EFB\u52A1\u770B\u677F\uFF09\uFF1A\u4FA7\u8FB9\u680F\u300C\u4EFB\u52A1\u770B\u677F\u300D\u5165\u53E3\uFF1B\u5728 dsh-web \u63D2\u4EF6\u5168\u5BB6\u6876\u4ED3\u5E93\uFF08packages/dsh-task-board\uFF09\u7EDF\u4E00\u7EF4\u62A4\uFF0C\u7ECF\u805A\u5408\u5305 web-ui-all \u4E00\u952E\u5B89\u88C5\u3002\u80FD\u529B\uFF1A\u591A\u5217\u770B\u677F\u7BA1\u7406\u4EFB\u52A1\uFF1BHost \u6743\u5A01\u8D26\u672C\uFF1B\u5173\u95ED\u6D4F\u89C8\u5668\u540E\u4ECD\u7531 Host \u6267\u884C\u548C\u7ED3\u7B97\uFF1B\u4EFB\u52A1\u53EF\u9489\u4F4F\u5DE5\u4F5C\u533A\u3001agent \u9884\u8BBE\u548C\u6743\u9650\uFF1B\u4EFB\u52A1\u53EF\u5EFA\u5B50\u4EFB\u52A1\uFF08\u6DF1\u5EA6\u4E0A\u9650\u53EF\u914D 1..3\uFF0C\u9ED8\u8BA4 1 \u5C42\uFF0C\u5B50\u4EFB\u52A1\u4E0D\u80FD\u518D\u5E26\u5B50\u4EFB\u52A1\uFF09\uFF0C\u6267\u884C\u7236\u4EFB\u52A1\u4F1A\u5E76\u53D1\u6267\u884C\u5176\u5B50\u4EFB\u52A1\u6811\uFF0C\u5B50\u4EFB\u52A1\u53EF\u5355\u72EC\u8986\u76D6\u6743\u9650\u4E0E\u6A21\u578B\uFF1B\u53E6\u6CE8\u518C task_board_* agent \u5DE5\u5177\uFF08list/get/create/update/set_parent/run/manage/schedule\uFF09\uFF0C\u4EFB\u4F55\u4F1A\u8BDD\u90FD\u53EF\u76F4\u63A5\u8BFB\u5199\u770B\u677F\u3001\u5B50\u4EFB\u52A1\u4E0E\u5B9A\u65F6\u8BA1\u5212\uFF0C\u4F46\u8FD0\u884C\u4EFB\u52A1\u4F1A\u771F\u5B9E\u6267\u884C\u5E76\u6D88\u8017\u989D\u5EA6\uFF0C\u9AD8\u4E8E\u4F1A\u8BDD\u9ED8\u8BA4\u6743\u9650\u7684\u7ED1\u5B9A\u4ECD\u5FC5\u987B\u7531\u7528\u6237\u5728 GUI \u4EBA\u5DE5\u786E\u8BA4\uFF08\u5DE5\u5177\u523B\u610F\u4E0D\u63D0\u4F9B\u786E\u8BA4\u80FD\u529B\uFF09\uFF1B\u652F\u6301 Host \u672C\u5730\u65F6\u533A\u7684 5 \u6BB5 cron\uFF0C\u9519\u8FC7\u7684\u89E6\u53D1\u70B9\u4E0D\u8865\u8DD1\uFF1B\u53EF\u9009\u4E14\u9ED8\u8BA4\u5173\u95ED\u7684\u7A7A\u95F2\u7CFB\u7EDF\u7761\u7720\u4FDD\u62A4\u5141\u8BB8\u5C4F\u5E55\u7184\u706D\uFF0C\u4F46\u4E0D\u627F\u8BFA\u62E6\u622A\u5408\u76D6\u3001\u624B\u52A8\u7761\u7720\u3001\u4F11\u7720\u3001\u5173\u673A\u6216\u5524\u9192\u5DF2\u7761\u7720\u673A\u5668\u3002\u6267\u884C\u6D88\u8017 API \u989D\u5EA6\u3002\u7528\u6237\u63D0\u5230\u300C\u4EFB\u52A1\u770B\u677F / \u770B\u677F / \u5B9A\u65F6\u4EFB\u52A1\u300D\u65F6\u5373\u6307\u672C\u63D2\u4EF6\uFF0C\u8BF7\u636E\u6B64\u534F\u4F5C\u3002\u82E5\u4F60\u540C\u65F6\u7528 todo_write \u7EF4\u62A4\u4F1A\u8BDD\u9876\u90E8\u7684\u53EF\u89C1\u8BA1\u5212\u5217\u8868\uFF0C\u6700\u7EC8\u56DE\u590D\u524D\u5FC5\u987B\u518D\u6B21\u8C03\u7528 todo_write \u6536\u5C3E\uFF1A\u6CA1\u6709\u5269\u4F59\u5DE5\u4F5C\u65F6\u4E0D\u8981\u4FDD\u7559 in_progress\uFF0C\u5DF2\u5B8C\u6210\u7684\u6700\u540E\u4E00\u6B65\u8981\u6807\u4E3A completed\u3002";
|
|
21
|
-
/**
|
|
22
|
-
* Plugin config, validated by the same-named schemastery schema.
|
|
23
|
-
*
|
|
24
|
-
* This schema IS the board's settings page: the 0.1.7 Host serves one
|
|
25
|
-
* configuration form per profile entry from the entry's own Config, so the
|
|
26
|
-
* fields the browser card edits are marked volatile — the Loader commits
|
|
27
|
-
* an edit into the running fiber's references without remounting the row (no
|
|
28
|
-
* settings document of the plugin's own exists any more). A field without the
|
|
29
|
-
* marker is refused by the settings write path, which fences writes on
|
|
30
|
-
* volatility.
|
|
31
|
-
*/
|
|
32
|
-
export interface Config {
|
|
33
|
-
/**
|
|
34
|
-
* When true (default), a system-prompt section announces the board to every
|
|
35
|
-
* agent. Set false to keep the board silent in prompts; agents then learn
|
|
36
|
-
* about it only when the user mentions it.
|
|
37
|
-
*/
|
|
38
|
-
announceToAgent?: Volatile<boolean>;
|
|
39
|
-
/** Master switch for the plugin (browser half + host announcement). */
|
|
40
|
-
enabled?: Volatile<boolean>;
|
|
41
|
-
/** Prevent idle system sleep while sessions run or schedules are armed. */
|
|
42
|
-
preventIdleSleep?: Volatile<boolean>;
|
|
43
|
-
/**
|
|
44
|
-
* Canonical reverse-proxy Host authorities admitted with a server-side
|
|
45
|
-
* token. Deployment-level, so it stays an ordinary field: editing it reloads
|
|
46
|
-
* the row, which re-registers the routes with the new proxy access.
|
|
47
|
-
*/
|
|
48
|
-
trustedProxyHosts?: string[];
|
|
49
|
-
/** Environment variable whose value the authenticated proxy injects upstream. */
|
|
50
|
-
proxyTokenEnv?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Whether the operator's OWN reverse proxy or tunnel may speak for the
|
|
53
|
-
* browser (default OFF). Off keeps the pre-existing fence exactly: a request
|
|
54
|
-
* that carries a forwarding header is never local, so only a direct loopback
|
|
55
|
-
* client or an allowlisted token-injecting proxy reaches the board (issue
|
|
56
|
-
* #1906). On admits one narrower case — a forwarded request whose socket and
|
|
57
|
-
* Host are both this machine's loopback upstream, i.e. the proxy dials the
|
|
58
|
-
* board itself (issue #1918) — and still requires the browser same-origin
|
|
59
|
-
* marker, so a third party's tunnel is only trusted while the operator says
|
|
60
|
-
* it is. Volatile: the fence reads it at each request, so an edit binds the
|
|
61
|
-
* next request without re-registering the routes.
|
|
62
|
-
*/
|
|
63
|
-
trustForwardedProxy?: Volatile<boolean>;
|
|
64
|
-
/**
|
|
65
|
-
* An explicit baseline for the permission confirmation gate. Left unset, the
|
|
66
|
-
* board follows the Host's own default permission preset — the value new DSH
|
|
67
|
-
* sessions start at — and falls back to `read-only` when the deployment
|
|
68
|
-
* serves no permission catalog. A card whose effective permission (handover
|
|
69
|
-
* bundle or pin) is above the baseline requires a human confirmation before
|
|
70
|
-
* it may run; cron refuses unconfirmed cards.
|
|
71
|
-
*/
|
|
72
|
-
sessionDefaultPermission?: TaskPermission;
|
|
73
|
-
/**
|
|
74
|
-
* Subtask depth limit, 1..3 (default 1). At 1 a task may carry one level of
|
|
75
|
-
* subtasks and a subtask cannot be given subtasks of its own; raising it
|
|
76
|
-
* allows deeper trees. Every extra level is another tree the card's own
|
|
77
|
-
* session may have to dispatch, so the ceiling is deliberately small.
|
|
78
|
-
*/
|
|
79
|
-
maxSubtaskDepth?: Volatile<number>;
|
|
80
|
-
/**
|
|
81
|
-
* How often, in seconds, the Host re-reads the DSH session roster while the
|
|
82
|
-
* board has something to reconcile: a running card, an open execution, or an
|
|
83
|
-
* active provider extension. An idle board with none of those does not poll
|
|
84
|
-
* at all, so this cadence only bounds how quickly a running card settles.
|
|
85
|
-
*/
|
|
86
|
-
sessionPollSeconds?: Volatile<number>;
|
|
87
|
-
/**
|
|
88
|
-
* How many run launches this board may have in flight at once (1..16,
|
|
89
|
-
* default 3). A run opens one session, so a burst is several cards run at
|
|
90
|
-
* once (several tabs, or a due schedule firing while a manual run starts);
|
|
91
|
-
* without a bound the Host would ask DSH for all of them in the same tick.
|
|
92
|
-
* This is the mechanism that enforces the repository's measured guidance for
|
|
93
|
-
* heavy implementation subagents. Runs wait their turn instead of being
|
|
94
|
-
* dropped, and every one of them still starts. Read at each admission, so an
|
|
95
|
-
* edit bounds the next launch of a run that is still queueing.
|
|
96
|
-
*/
|
|
97
|
-
runLaunchWidth?: Volatile<number>;
|
|
98
|
-
/**
|
|
99
|
-
* Daily token ceiling for the work this board dispatches (default 0 = no
|
|
100
|
-
* gate). Tokens, not money: the ledger the board measures against prices
|
|
101
|
-
* DeepSeek's own routes only, so a cost cap would read 0 elsewhere. Read at
|
|
102
|
-
* each gate, so an edit binds the next run without a remount; a manual
|
|
103
|
-
* run/rerun whose day already spent the cap is refused, and a due occurrence
|
|
104
|
-
* is skipped onto the scheduler with its run budget untouched.
|
|
105
|
-
*/
|
|
106
|
-
spendBudgetTokens?: Volatile<number>;
|
|
107
|
-
/**
|
|
108
|
-
* GLOBAL native /goal switch (default OFF), the master control over whether
|
|
109
|
-
* this board starts a run with dsh's built-in /goal at all. A run uses native
|
|
110
|
-
* /goal only when THIS is on AND the task's own `goalRun` is not off; while
|
|
111
|
-
* it is off every task runs one plain turn.
|
|
112
|
-
*
|
|
113
|
-
* The value is frozen when an execution starts, so toggling it only affects
|
|
114
|
-
* executions that begin afterwards and never re-writes a task's stored
|
|
115
|
-
* `goalRun` preference. A run that consequently does not execute native
|
|
116
|
-
* /goal is marked as such (its acceptance applicability is `goal-disabled`)
|
|
117
|
-
* and is never reported as a passed goal acceptance or failed for lacking a
|
|
118
|
-
* completion call. Independent of `goalVerification`; acceptance governs the
|
|
119
|
-
* completing call of a goal-form run, this switch governs whether the run
|
|
120
|
-
* becomes a goal run.
|
|
121
|
-
*/
|
|
122
|
-
goalRunEnabled?: Volatile<boolean>;
|
|
123
|
-
/**
|
|
124
|
-
* Agent preset a NEW card starts from (volatile, default blank = not set).
|
|
125
|
-
* A prefill, never a pin: the create dialog opens with it selected, the
|
|
126
|
-
* caller may override it, and the card stores what it was created with. It
|
|
127
|
-
* reaches the create path only when that caller opts in with
|
|
128
|
-
* `applyCardDefaults`, so the extension provider's own create and the legacy
|
|
129
|
-
* import are untouched.
|
|
130
|
-
*/
|
|
131
|
-
cardDefaultMode?: Volatile<string>;
|
|
132
|
-
/**
|
|
133
|
-
* Permission a NEW card starts from (volatile, default blank = not set), one
|
|
134
|
-
* of the three presets. A prefill like the rest: a value above
|
|
135
|
-
* `sessionDefaultPermission` still has to be confirmed by a human before the
|
|
136
|
-
* card may run, because the pre-execution gate is what decides that.
|
|
137
|
-
*/
|
|
138
|
-
cardDefaultPermission?: Volatile<TaskPermission | ''>;
|
|
139
|
-
/**
|
|
140
|
-
* Model a NEW card starts from (volatile, default blank = not set).
|
|
141
|
-
*/
|
|
142
|
-
cardDefaultModel?: Volatile<string>;
|
|
143
|
-
/**
|
|
144
|
-
* Reasoning level a NEW card starts from (volatile, default blank = not set).
|
|
145
|
-
* Bound to `cardDefaultModel` exactly as a card's own level is bound to its
|
|
146
|
-
* own model: it applies only while the card's final model IS that default
|
|
147
|
-
* model, and a blank `cardDefaultModel` makes it inert.
|
|
148
|
-
*/
|
|
149
|
-
cardDefaultReasoningEffort?: Volatile<string>;
|
|
150
|
-
/**
|
|
151
|
-
* Goal acceptance for executions this board starts (default ON). When on,
|
|
152
|
-
* update_goal(action: complete) inside a task execution is refused until an
|
|
153
|
-
* acceptance pass is recorded for that execution: the three coding criteria,
|
|
154
|
-
* a 0.65 threshold, two rounds per criterion with the A/B slots swapped, and
|
|
155
|
-
* at most two acceptances per execution — the first failure returns its
|
|
156
|
-
* findings to the fixing agent, the second ends the cycle. The switch only
|
|
157
|
-
* affects goal-form executions of the board; plain chat and a task pinned to
|
|
158
|
-
* goalRun: false are untouched. When a separate third-party verifier also
|
|
159
|
-
* runs its own automatic acceptance, both judges score independently: this
|
|
160
|
-
* one gates completion, the other only steers, and no public interface lets
|
|
161
|
-
* the two share a verdict.
|
|
162
|
-
*/
|
|
163
|
-
goalVerification?: Volatile<boolean>;
|
|
164
|
-
/**
|
|
165
|
-
* Judge model for goal acceptance as provider/model. Blank inherits the HOST's
|
|
166
|
-
* own model catalog default — never the card's pinned execution model.
|
|
167
|
-
*/
|
|
168
|
-
goalVerificationModel?: Volatile<string>;
|
|
169
|
-
/**
|
|
170
|
-
* Reasoning effort for the judge. Blank inherits the host default level; an
|
|
171
|
-
* effort the resolved model does not declare is dropped instead of being
|
|
172
|
-
* sent, and the fallback to the model's own default is reported.
|
|
173
|
-
*/
|
|
174
|
-
goalVerificationReasoningEffort?: Volatile<string>;
|
|
175
|
-
/**
|
|
176
|
-
* Ceiling of ONE judge request of a goal acceptance, in seconds
|
|
177
|
-
* (30..600, default 150). One acceptance issues six judge requests (three
|
|
178
|
-
* criteria times two rounds), so a ceiling that is too small turns a slow but
|
|
179
|
-
* healthy judge route into a wall of timeouts, and every timeout was charged
|
|
180
|
-
* as an acceptance anomaly. Raise it for a reasoning model reading a long
|
|
181
|
-
* trace.
|
|
182
|
-
*/
|
|
183
|
-
goalVerificationCallTimeoutSeconds?: Volatile<number>;
|
|
184
|
-
/**
|
|
185
|
-
* Total ceiling of ONE goal acceptance attempt, in seconds (120..1800,
|
|
186
|
-
* default eight times the per-call default). Keep it at or above
|
|
187
|
-
* `goalVerificationCallTimeoutSeconds` times six or an acceptance can never
|
|
188
|
-
* finish: the attempt then ends early with a budget stop that judges nothing
|
|
189
|
-
* and spends no acceptance budget.
|
|
190
|
-
*/
|
|
191
|
-
goalVerificationBudgetSeconds?: Volatile<number>;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Profile-patch shape of {@link Config}: what the Host validates the row's
|
|
195
|
-
* config against, before the schema turns volatile fields into live references
|
|
196
|
-
* and applies defaults. Declared separately because the two sides no longer
|
|
197
|
-
* share one shape, so the schema is annotated `z<ConfigInput, Config>` — the
|
|
198
|
-
* same split the git-family packages use. The annotation is also what keeps the
|
|
199
|
-
* emitted declaration portable: an unannotated schema holding a nested object
|
|
200
|
-
* array infers a type that cannot be named without reaching into a transitive
|
|
201
|
-
* dependency's own types.
|
|
202
|
-
*/
|
|
203
|
-
export interface ConfigInput {
|
|
204
|
-
/** Announce the board in the system prompt. */
|
|
205
|
-
announceToAgent?: boolean;
|
|
206
|
-
/** Master switch for the plugin. */
|
|
207
|
-
enabled?: boolean;
|
|
208
|
-
/** Prevent idle system sleep while sessions run or schedules are armed. */
|
|
209
|
-
preventIdleSleep?: boolean;
|
|
210
|
-
/** Canonical reverse-proxy Host authorities. */
|
|
211
|
-
trustedProxyHosts?: string[];
|
|
212
|
-
/** Environment variable whose value the authenticated proxy injects. */
|
|
213
|
-
proxyTokenEnv?: string;
|
|
214
|
-
/** Trust a forwarded request that landed on this machine's loopback upstream; default off. */
|
|
215
|
-
trustForwardedProxy?: boolean;
|
|
216
|
-
/** Explicit baseline for the permission confirmation gate; unset follows the Host default. */
|
|
217
|
-
sessionDefaultPermission?: TaskPermission;
|
|
218
|
-
/** Subtask depth limit, 1..3. */
|
|
219
|
-
maxSubtaskDepth?: number;
|
|
220
|
-
/** Roster-poll cadence in seconds while the board has work to reconcile. */
|
|
221
|
-
sessionPollSeconds?: number;
|
|
222
|
-
/** Concurrent run launches allowed at once, 1..16. */
|
|
223
|
-
runLaunchWidth?: number;
|
|
224
|
-
/** Daily token ceiling for board runs; 0 disables the gate. */
|
|
225
|
-
spendBudgetTokens?: number;
|
|
226
|
-
/** Global native /goal switch; default off, frozen per execution. */
|
|
227
|
-
goalRunEnabled?: boolean;
|
|
228
|
-
/** Agent preset a new card starts from; blank = not set. */
|
|
229
|
-
cardDefaultMode?: string;
|
|
230
|
-
/** Permission a new card starts from; blank = not set. */
|
|
231
|
-
cardDefaultPermission?: TaskPermission | '';
|
|
232
|
-
/** Model a new card starts from; blank = not set. */
|
|
233
|
-
cardDefaultModel?: string;
|
|
234
|
-
/** Reasoning level a new card starts from; blank = not set. */
|
|
235
|
-
cardDefaultReasoningEffort?: string;
|
|
236
|
-
/** Goal acceptance switch. */
|
|
237
|
-
goalVerification?: boolean;
|
|
238
|
-
/** Judge model route for goal acceptance; blank inherits the host default. */
|
|
239
|
-
goalVerificationModel?: string;
|
|
240
|
-
/** Judge reasoning effort; blank inherits the host default. */
|
|
241
|
-
goalVerificationReasoningEffort?: string;
|
|
242
|
-
/** Ceiling of one judge request of a goal acceptance, in seconds. */
|
|
243
|
-
goalVerificationCallTimeoutSeconds?: number;
|
|
244
|
-
/** Total ceiling of one goal acceptance attempt, in seconds. */
|
|
245
|
-
goalVerificationBudgetSeconds?: number;
|
|
246
|
-
}
|
|
247
|
-
export declare const Config: z<ConfigInput, Config>;
|
|
248
|
-
/** Schema default for the goal-acceptance switch, re-read for hand-built contexts. */
|
|
249
|
-
export declare const DEFAULT_GOAL_VERIFICATION = true;
|
|
250
|
-
/**
|
|
251
|
-
* Schema default for the GLOBAL native-/goal switch, re-read for hand-built
|
|
252
|
-
* contexts. Deliberately false: a deployment that never configured it (and
|
|
253
|
-
* every card written before the option existed) runs plain single turns.
|
|
254
|
-
*/
|
|
255
|
-
export declare const DEFAULT_GOAL_RUN = false;
|
|
256
|
-
declare module '@deepseek-ai/cordis' {
|
|
257
|
-
interface Events {
|
|
258
|
-
/**
|
|
259
|
-
* Volatile config values were committed into the running fiber without a
|
|
260
|
-
* remount; dispatched to the owning fiber only. Spelled here because the
|
|
261
|
-
* Loader package is not a dependency of this plugin, with the Loader's own
|
|
262
|
-
* shape so the two declarations merge when a Host program carries both.
|
|
263
|
-
* @param paths - changed config paths as key arrays; every value is committed before dispatch.
|
|
264
|
-
* @mode emit
|
|
265
|
-
*/
|
|
266
|
-
'loader/volatile-update'(paths: readonly (readonly string[])[]): void;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Read one config field's current value.
|
|
271
|
-
*
|
|
272
|
-
* The Loader hands schema-volatile fields as stable references it commits in
|
|
273
|
-
* place, so a live value must be read at use time rather than captured when
|
|
274
|
-
* the plugin activates; a plain value (a programmatic mount, or a field the
|
|
275
|
-
* schema does not mark volatile) is returned as it stands.
|
|
276
|
-
* @param field - the config field as the Loader handed it.
|
|
277
|
-
* @param fallback - value to use when the field is absent.
|
|
278
|
-
* @returns the effective field value.
|
|
279
|
-
*/
|
|
280
|
-
export declare function readConfigField<T>(field: Volatile<T> | T | undefined, fallback: T): T;
|
|
281
|
-
/**
|
|
282
|
-
* Resolve proxy access without ever placing the token value in plugin config.
|
|
283
|
-
*
|
|
284
|
-
* The forwarded-proxy switch travels as a reader rather than a value: it is
|
|
285
|
-
* schema-volatile, so the fence must read it when a request arrives instead of
|
|
286
|
-
* when the routes are registered.
|
|
287
|
-
* @param config - the resolved plugin config.
|
|
288
|
-
* @param env - environment holding the proxy token value.
|
|
289
|
-
* @returns the route access handed to {@link makeTaskBoardRoutes}.
|
|
290
|
-
*/
|
|
291
|
-
export declare function resolveProxyAccess(config: Config | undefined, env?: NodeJS.ProcessEnv): {
|
|
292
|
-
trustedProxyHosts: string[];
|
|
293
|
-
proxyToken?: string;
|
|
294
|
-
trustForwardedProxy: () => boolean;
|
|
295
|
-
};
|
|
296
|
-
/**
|
|
297
|
-
/**
|
|
298
|
-
* Schema default for the forwarded-proxy switch, re-read for hand-built
|
|
299
|
-
* contexts. Deliberately false: a deployment that never configured it keeps
|
|
300
|
-
* refusing every forwarded request, which is the #1906 fence.
|
|
301
|
-
*/
|
|
302
|
-
export declare const DEFAULT_TRUST_FORWARDED_PROXY = false;
|
|
303
|
-
/**
|
|
304
|
-
* Resolve the composition's optional `connection` service.
|
|
305
|
-
*
|
|
306
|
-
* The service is the Host's own browser-session authority: it fronts every
|
|
307
|
-
* `/api` request with the Host/Origin fence and the signed `dsh-auth-*` cookie,
|
|
308
|
-
* which is what a deployment behind a reverse proxy or ingress validates on the
|
|
309
|
-
* same authority the GUI is served from. The board bridges it instead of
|
|
310
|
-
* repeating that check, so a proxy request the Host already authenticated is
|
|
311
|
-
* admitted without a board-specific host allowlist (issue #1930). It is
|
|
312
|
-
* deliberately resolved like the agent-tool registry rather than injected:
|
|
313
|
-
* a composition that serves no connection keeps mounting the board on the
|
|
314
|
-
* pre-existing loopback fence, and one that mounts the service later is picked
|
|
315
|
-
* up on the next request because the fence asks this resolver each time.
|
|
316
|
-
* @param ctx - the plugin context.
|
|
317
|
-
* @returns the trust face, or undefined when this deployment serves none.
|
|
318
|
-
*/
|
|
319
|
-
export declare function resolveConnectionTrust(ctx: Context): TaskBoardConnectionTrust | undefined;
|
|
320
|
-
/** The registry face the agent tools register into. */
|
|
321
|
-
interface AgentToolRegistry {
|
|
322
|
-
register(definition: ToolDefinition): () => void;
|
|
323
|
-
/** Scoped lookup; present on the real registry, absent on a stub that only registers. */
|
|
324
|
-
get?(name: string, scope?: unknown): unknown;
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Resolve the optional agent-tool registry. The board deliberately does not
|
|
328
|
-
* inject it: a deployment whose runtime serves no registry must still mount the
|
|
329
|
-
* whole board and lose only the agent-tool surface, the same tolerance the
|
|
330
|
-
* optional llm service gets.
|
|
331
|
-
* @param ctx - the plugin context.
|
|
332
|
-
* @returns the registry, or undefined when this deployment serves none.
|
|
333
|
-
*/
|
|
334
|
-
export declare function resolveToolRegistry(ctx: Context): AgentToolRegistry | undefined;
|
|
335
|
-
/**
|
|
336
|
-
* Resolve the native cordis timer service (dsh-base's own `cordis-plugin-timer`
|
|
337
|
-
* row). The board arms its schedule through it so unloading the row clears
|
|
338
|
-
* every pending timer with the owning fiber, instead of the row tracking raw
|
|
339
|
-
* process handles by hand. A composition that serves no timer service keeps
|
|
340
|
-
* working on the process globals.
|
|
341
|
-
* @param ctx - the plugin context.
|
|
342
|
-
* @returns the timer face, or undefined when this deployment serves none.
|
|
343
|
-
*/
|
|
344
|
-
export declare function resolveHostTimers(ctx: Context): HostTimerFace | undefined;
|
|
345
|
-
/**
|
|
346
|
-
* The Host's own default permission preset, mapped into the board's vocabulary.
|
|
347
|
-
*
|
|
348
|
-
* This is the value new DSH sessions start at (the deployment's `permission`
|
|
349
|
-
* settings row), so a board that follows it treats an ordinary card exactly as
|
|
350
|
-
* the Host would. Absent when the deployment serves no permission catalog, or
|
|
351
|
-
* its default is a current-session identity (`auto`) that names no fixed
|
|
352
|
-
* sandbox mode; the caller then keeps the fail-safe baseline.
|
|
353
|
-
* @param ctx - the plugin context.
|
|
354
|
-
* @returns the Host default as a board permission, or undefined when unreadable.
|
|
355
|
-
*/
|
|
356
|
-
export declare function resolveHostDefaultPermission(ctx: Context): TaskPermission | undefined;
|
|
357
|
-
/**
|
|
358
|
-
* Read the optional `llm` service. The board deliberately does not inject it:
|
|
359
|
-
* a deployment without a model must still mount the board, and the parse route
|
|
360
|
-
* answers a typed failure instead of the plugin failing to load (issue #1540).
|
|
361
|
-
* @param ctx - the plugin context.
|
|
362
|
-
* @returns the llm service, or undefined when this deployment serves none.
|
|
363
|
-
*/
|
|
364
|
-
export declare function resolveLlmRuntime(ctx: Context): LlmRuntime | undefined;
|
|
365
|
-
/**
|
|
366
|
-
* Resolve the optional attachment storage.
|
|
367
|
-
*
|
|
368
|
-
* The board does not inject the service: a deployment without one must still
|
|
369
|
-
* mount the board, and every attachment surface then answers with a typed
|
|
370
|
-
* "storage unavailable" failure instead of the plugin failing to load.
|
|
371
|
-
* @param ctx - the plugin context.
|
|
372
|
-
* @returns the attachment storage, or undefined when this deployment serves none.
|
|
373
|
-
*/
|
|
374
|
-
export declare function resolveAttachmentStore(ctx: Context): TaskBoardAttachmentStore | undefined;
|
|
375
|
-
/**
|
|
376
|
-
* The model-info reader the image preflight uses.
|
|
377
|
-
*
|
|
378
|
-
* It asks the OFFICIAL model service about one exact route. The model catalog
|
|
379
|
-
* the board already publishes carries no modality information and must not be
|
|
380
|
-
* used to answer that question: only the model's own declared input
|
|
381
|
-
* modalities can refuse an image route, and a route whose modalities cannot be
|
|
382
|
-
* read is UNKNOWN and therefore allowed.
|
|
383
|
-
* @param ctx - the plugin context.
|
|
384
|
-
* @returns the reader, or undefined when the deployment serves no model service.
|
|
385
|
-
*/
|
|
386
|
-
export declare function resolveModelInfoReader(ctx: Context): ModelInfoResolver | undefined;
|
|
387
|
-
/**
|
|
388
|
-
* The subset of `sessionController` the board uses to wake a cold persisted
|
|
389
|
-
* session before running a slash command on it (issue #1861).
|
|
390
|
-
*/
|
|
391
|
-
interface SessionControllerFace {
|
|
392
|
-
resolveAgent(sessionId: Parameters<Context['agents']['get']>[0]): Promise<{
|
|
393
|
-
readonly agent: Parameters<Context['commands']['execute']>[0];
|
|
394
|
-
} | {
|
|
395
|
-
readonly error: {
|
|
396
|
-
readonly message?: string;
|
|
397
|
-
};
|
|
398
|
-
}>;
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Resolve the optional `sessionController` service. Like the tool registry and
|
|
402
|
-
* the llm runtime, it is read dynamically so capture-only test contexts that do
|
|
403
|
-
* not mount the full session controller still activate the board.
|
|
404
|
-
* @param ctx - the plugin context.
|
|
405
|
-
* @returns the session controller face, or undefined when unavailable.
|
|
406
|
-
*/
|
|
407
|
-
export declare function resolveSessionController(ctx: Context): SessionControllerFace | undefined;
|
|
408
|
-
/**
|
|
409
|
-
* Resolve the live Agent for an execution session, resuming a cold persisted
|
|
410
|
-
* session through `sessionController.resolveAgent` when it is not yet in
|
|
411
|
-
* `ctx.agents` (issue #1861).
|
|
412
|
-
*
|
|
413
|
-
* A fresh run (`session/create`) or a session the browser is currently
|
|
414
|
-
* following is already in `ctx.agents`, so the fast path returns immediately.
|
|
415
|
-
* A scheduled or manual reuse of a cold session — one that `session/list`
|
|
416
|
-
* reports as idle from disk without activating its Agent — is not in
|
|
417
|
-
* `ctx.agents` when `pinAndPrompt` runs `/permission` ahead of
|
|
418
|
-
* `session/selectModel` and `session/prompt`; delegating to
|
|
419
|
-
* `sessionController.resolveAgent` resumes it with its recorded preset and
|
|
420
|
-
* model-selection state, matching what those gateway endpoints do next.
|
|
421
|
-
* @param ctx - the plugin context.
|
|
422
|
-
* @param sessionId - the target execution session id.
|
|
423
|
-
* @returns the live Agent for `sessionId`.
|
|
424
|
-
*/
|
|
425
|
-
export declare function resolveExecutionAgent(ctx: Context, sessionId: Parameters<Context['agents']['get']>[0]): Promise<Parameters<Context['commands']['execute']>[0]>;
|
|
426
|
-
/**
|
|
427
|
-
* Activate the board's host half: ledger, routes, cron scheduler, power
|
|
428
|
-
* inhibitor, and the model-facing announcement.
|
|
429
|
-
*
|
|
430
|
-
* The effective settings are the config the Host hands this row. The fields
|
|
431
|
-
* the browser card edits are schema-volatile, so the Loader commits an
|
|
432
|
-
* edit into the running fiber's references instead of remounting the row —
|
|
433
|
-
* `sync` therefore reads them at use time and follows
|
|
434
|
-
* `loader/volatile-update`, the event the Loader emits once it has committed
|
|
435
|
-
* them. Every other field reloads the row, which re-runs this activation.
|
|
436
|
-
* @param ctx - the plugin context (systemPrompt injected).
|
|
437
|
-
* @param config - resolved plugin config (schema defaults applied by the loader).
|
|
438
|
-
*/
|
|
439
|
-
export declare const apply: typeof applyImpl;
|
|
440
|
-
declare function applyImpl(ctx: Context, config?: Config): void;
|
|
441
|
-
export {};
|
package/lib/types/loopback.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Loopback trust fence shared by the host route families: socket address,
|
|
3
|
-
* Host header, and browser same-origin markers. Packages receive this file as
|
|
4
|
-
* a generated copy via scripts/sync-shared.mjs; edit the shared source and
|
|
5
|
-
* re-run the sync instead of editing a copy.
|
|
6
|
-
*
|
|
7
|
-
* Semantics: RFC 5735 IPv4 127/8, ::1, IPv4-mapped ::ffff:127/8 (matching the
|
|
8
|
-
* remote-web-ui gate), localhost hostnames, plus the browser same-origin
|
|
9
|
-
* markers (sec-fetch-site and Origin) for the request-level fence.
|
|
10
|
-
*
|
|
11
|
-
* A reverse proxy in front of the host rewrites the Host header to its own
|
|
12
|
-
* upstream literal (a Cloudflare tunnel, frp and an nginx reverse proxy all
|
|
13
|
-
* dial 127.0.0.1:<port>), and the socket the origin sees is the proxy's, which
|
|
14
|
-
* is loopback by construction. Both halves of the fence then hold for a public
|
|
15
|
-
* request. Forwarding headers are the signal that a hop stands in between: a
|
|
16
|
-
* request that carries CF-Connecting-IP or X-Forwarded-For is answered through
|
|
17
|
-
* a proxy and is never treated as a local one (issue #1906).
|
|
18
|
-
*
|
|
19
|
-
* An operator who runs that proxy or tunnel themselves can opt into the
|
|
20
|
-
* narrower case: isForwardedLoopbackRequest describes a forwarded request that
|
|
21
|
-
* still landed on this machine's loopback upstream, and a route family admits
|
|
22
|
-
* it only behind its own default-off switch (issue #1918).
|
|
23
|
-
* @module dsh-web-shared/host/loopback
|
|
24
|
-
*/
|
|
25
|
-
import type { IncomingMessage } from 'node:http';
|
|
26
|
-
/** IPv4 127/8 predicate (four decimal octets, first == 127). */
|
|
27
|
-
export declare function isIPv4Loopback(v4: string): boolean;
|
|
28
|
-
/** Whether a socket remote address names the loopback range (127/8, ::1, IPv4-mapped). */
|
|
29
|
-
export declare function isLoopbackAddress(address: string | undefined): boolean;
|
|
30
|
-
/** Whether a normalized URL hostname names the loopback authority (localhost, [::1], 127/8). */
|
|
31
|
-
export declare function isLoopbackHostname(hostname: string): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Whether a reverse proxy stood between the client and this host: the request
|
|
34
|
-
* carries CF-Connecting-IP or X-Forwarded-For. Either header is stamped by a
|
|
35
|
-
* hop that forwards traffic, so the request did not originate on this machine.
|
|
36
|
-
* @param request - node HTTP request.
|
|
37
|
-
* @returns true when a forwarding header is present.
|
|
38
|
-
*/
|
|
39
|
-
export declare function isProxiedRequest(request: IncomingMessage): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Request-level trust fence: a loopback socket address AND a loopback Host
|
|
42
|
-
* header, plus browser same-origin markers. The socket address is
|
|
43
|
-
* authoritative for a direct connection; a request that carries a forwarding
|
|
44
|
-
* header is refused outright, because a proxy in front of the host makes both
|
|
45
|
-
* the socket address and the Host header describe the proxy rather than the
|
|
46
|
-
* client. X-Forwarded-For is therefore never evidence *for* loopback.
|
|
47
|
-
*/
|
|
48
|
-
export declare function isLoopbackRequest(request: IncomingMessage): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Whether a forwarded request landed on this machine's loopback upstream: a
|
|
51
|
-
* forwarding header (the proxy's own stamp), a loopback socket address (the
|
|
52
|
-
* proxy dials 127.0.0.1:<port>), and a loopback Host header (the proxy rewrote
|
|
53
|
-
* the authority to its upstream literal).
|
|
54
|
-
*
|
|
55
|
-
* This is a fact about the route, not a trust decision. A public request to a
|
|
56
|
-
* tunnel satisfies all three by construction, because the proxy is the client
|
|
57
|
-
* of this process: only a caller that operates the proxy can decide it stands
|
|
58
|
-
* for the browser, which is why every consumer keeps this behind an explicit
|
|
59
|
-
* default-off switch and its own browser markers. isLoopbackRequest is
|
|
60
|
-
* unchanged and still refuses a forwarded request (issue #1906).
|
|
61
|
-
* @param request - node HTTP request.
|
|
62
|
-
* @returns true when a forwarding header, a loopback socket, and a loopback Host all hold.
|
|
63
|
-
*/
|
|
64
|
-
export declare function isForwardedLoopbackRequest(request: IncomingMessage): boolean;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Host single-instance guard shared by the plugin family. The family bundle
|
|
3
|
-
* (dsh-web-all / dsh-skins) namespaces every child row id (web-ui-*), so
|
|
4
|
-
* the loader accepts a standalone install of the same package side by side;
|
|
5
|
-
* without this guard the second instance would still re-register the same
|
|
6
|
-
* webserver routes, tools, settings namespaces, and system-prompt sections
|
|
7
|
-
* and fail the boot. mountOnce makes a mount of an already-mounted package a
|
|
8
|
-
* no-op for as long as the first instance lives (the browser half is already
|
|
9
|
-
* deduped by package name in the client module host).
|
|
10
|
-
*
|
|
11
|
-
* A no-op is only safe while the holder is ALIVE. The holder can be disposed
|
|
12
|
-
* long after the refused mount ran its course: the Host reloads a profile by
|
|
13
|
-
* creating the new loader entries before the old ones are torn down (a
|
|
14
|
-
* plugin-manager enable/disable/install write, a settings-driven row reload,
|
|
15
|
-
* HMR), so the new aggregate shell entry mounts its family plugin while the
|
|
16
|
-
* previous entry still owns the name. Dropping that refused mount lost the
|
|
17
|
-
* plugin for good - the previous entry then disposed its own mount, releasing
|
|
18
|
-
* the name with nobody left to take it, and the family row stayed listed as
|
|
19
|
-
* active while its host routes 404ed (the task-board panel showed
|
|
20
|
-
* "board.hostError.notMounted", no degraded record appeared, and only a Host
|
|
21
|
-
* restart recovered it).
|
|
22
|
-
*
|
|
23
|
-
* The refused mount is therefore QUEUED, not dropped, and replayed the moment
|
|
24
|
-
* the holder releases the name - if the waiting fiber is still alive then. The
|
|
25
|
-
* single-instance guarantee is unchanged: exactly one mount is live per
|
|
26
|
-
* package name, and the replay re-enters the guard so a later mount still
|
|
27
|
-
* dedupes against it.
|
|
28
|
-
*
|
|
29
|
-
* The registry rides a global symbol so two module instances of the same
|
|
30
|
-
* package (npm copy vs repository link) still share one verdict. That symbol
|
|
31
|
-
* is a CROSS-REPOSITORY contract, not this file's private state: the four
|
|
32
|
-
* satellite packages (dsh-skins / dsh-pet / dsh-presets /
|
|
33
|
-
* dsh-community-plugins) are separate repositories carrying their own copy of
|
|
34
|
-
* this guard, rebuilt on their own schedule, so the value under `MOUNTED`
|
|
35
|
-
* must keep the shape every published copy reads (a `Set` of package names
|
|
36
|
-
* with `has`/`add`/`delete`). The wait queues this guard added therefore live
|
|
37
|
-
* under their own additive key, and the registry reads back a `Set` even when
|
|
38
|
-
* some other build left a different value there. Changing `MOUNTED`'s shape
|
|
39
|
-
* in place broke that contract once: a satellite's legacy copy created a
|
|
40
|
-
* `Set`, the family's new copy read it as a `Map`, and every family row
|
|
41
|
-
* mounted after it failed with "claims.get is not a function".
|
|
42
|
-
*
|
|
43
|
-
* cordis `ctx.effect` runs its callback immediately and treats the callback's
|
|
44
|
-
* return value as the fiber disposer, so the unmarker is returned, not run.
|
|
45
|
-
*/
|
|
46
|
-
/**
|
|
47
|
-
* Wrap a cordis plugin apply so the package runs at most once per process.
|
|
48
|
-
* The first mount registers normally and releases the name when its fiber
|
|
49
|
-
* disposes; a mount refused while that name is held waits for the release and
|
|
50
|
-
* then runs, unless its own fiber disposes first.
|
|
51
|
-
* @param packageName - npm package identity shared by every install source.
|
|
52
|
-
* @param fn - the original plugin apply.
|
|
53
|
-
* @returns an apply of the same shape.
|
|
54
|
-
*/
|
|
55
|
-
export declare function mountOnce<T extends (...args: any[]) => unknown>(packageName: string, fn: T): T;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { type ChildProcess, type SpawnSyncReturns } from 'node:child_process';
|
|
2
|
-
import { existsSync } from 'node:fs';
|
|
3
|
-
import type { TaskBoardPowerSnapshot } from './protocol.ts';
|
|
4
|
-
declare const WINDOWS_HELPER: string;
|
|
5
|
-
declare const LINUX_HELPER: string;
|
|
6
|
-
declare const LINUX_INHIBIT_PATHS: readonly ["/usr/bin/systemd-inhibit", "/bin/systemd-inhibit"];
|
|
7
|
-
export interface PowerReasons {
|
|
8
|
-
runningSessions: number;
|
|
9
|
-
armedSchedules: number;
|
|
10
|
-
sessionStateKnown: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface SpawnOptions {
|
|
13
|
-
shell: false;
|
|
14
|
-
windowsHide: boolean;
|
|
15
|
-
stdio: ['pipe', 'pipe', 'pipe'] | ['ignore', 'ignore', 'ignore'];
|
|
16
|
-
}
|
|
17
|
-
export type SpawnLike = (file: string, args: readonly string[], options: SpawnOptions) => ChildProcess;
|
|
18
|
-
export type SpawnSyncLike = (file: string, args: readonly string[], options: {
|
|
19
|
-
stdio: 'ignore';
|
|
20
|
-
timeout: number;
|
|
21
|
-
windowsHide: boolean;
|
|
22
|
-
}) => Pick<SpawnSyncReturns<Buffer>, 'status' | 'error'>;
|
|
23
|
-
export interface PowerInhibitorOptions {
|
|
24
|
-
platform?: NodeJS.Platform;
|
|
25
|
-
pid?: number;
|
|
26
|
-
env?: NodeJS.ProcessEnv;
|
|
27
|
-
spawn?: SpawnLike;
|
|
28
|
-
spawnSync?: SpawnSyncLike;
|
|
29
|
-
exists?: typeof existsSync;
|
|
30
|
-
execPath?: string;
|
|
31
|
-
setTimeout?: typeof globalThis.setTimeout;
|
|
32
|
-
clearTimeout?: typeof globalThis.clearTimeout;
|
|
33
|
-
}
|
|
34
|
-
export declare class PowerInhibitor {
|
|
35
|
-
private readonly listeners;
|
|
36
|
-
private enabled;
|
|
37
|
-
private reasons;
|
|
38
|
-
private phase;
|
|
39
|
-
private child;
|
|
40
|
-
private retry;
|
|
41
|
-
private retryReset;
|
|
42
|
-
private retryIndex;
|
|
43
|
-
private lastError;
|
|
44
|
-
private stopping;
|
|
45
|
-
private readonly platform;
|
|
46
|
-
private readonly pid;
|
|
47
|
-
private readonly env;
|
|
48
|
-
private readonly spawn;
|
|
49
|
-
private readonly spawnSync;
|
|
50
|
-
private readonly exists;
|
|
51
|
-
private readonly execPath;
|
|
52
|
-
private readonly timer;
|
|
53
|
-
private readonly clearTimer;
|
|
54
|
-
private linuxProbe;
|
|
55
|
-
constructor(options?: PowerInhibitorOptions);
|
|
56
|
-
setEnabled(enabled: boolean): void;
|
|
57
|
-
updateReasons(reasons: PowerReasons): void;
|
|
58
|
-
subscribe(listener: () => void): () => void;
|
|
59
|
-
snapshot(): TaskBoardPowerSnapshot;
|
|
60
|
-
dispose(): void;
|
|
61
|
-
private desired;
|
|
62
|
-
private sync;
|
|
63
|
-
private acquire;
|
|
64
|
-
private markReady;
|
|
65
|
-
private fail;
|
|
66
|
-
private release;
|
|
67
|
-
private clearRetryReset;
|
|
68
|
-
private windowsPowerShell;
|
|
69
|
-
private linuxSystemdInhibit;
|
|
70
|
-
private spawnCommand;
|
|
71
|
-
private emit;
|
|
72
|
-
}
|
|
73
|
-
export { LINUX_HELPER, LINUX_INHIBIT_PATHS, WINDOWS_HELPER };
|