@hearsay-tools/squawk 0.18.0-dev.8161 → 0.18.0-dev.8169
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/boot.d.ts +11 -2
- package/dist/boot.js +24 -4
- package/dist/boot.js.map +1 -1
- package/dist/built-in-cli-commands.d.ts +3 -0
- package/dist/built-in-cli-commands.js +8 -0
- package/dist/built-in-cli-commands.js.map +1 -1
- package/dist/cli-dispatch.d.ts +6 -0
- package/dist/cli-dispatch.js +61 -20
- package/dist/cli-dispatch.js.map +1 -1
- package/dist/contract/health.d.ts +67 -0
- package/dist/contract/index.js +18 -1
- package/dist/core/cli-registry.d.ts +2 -0
- package/dist/core/cli-registry.js +4 -0
- package/dist/core/cli-registry.js.map +1 -1
- package/dist/core/runner-registry.js +5 -1
- package/dist/core/runner-registry.js.map +1 -1
- package/dist/home/home.d.ts +2 -0
- package/dist/home/home.js +1 -1
- package/dist/home/home.js.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/plugin/api.d.ts +12 -2
- package/dist/plugin/api.js +14 -14
- package/dist/plugin/api.js.map +1 -1
- package/dist/plugin/cli.d.ts +5 -0
- package/dist/plugin/cli.js +53 -0
- package/dist/plugin/cli.js.map +1 -0
- package/dist/plugin/loader.d.ts +61 -0
- package/dist/plugin/loader.js +142 -0
- package/dist/plugin/loader.js.map +1 -0
- package/dist/plugin/resolve-hook.d.ts +15 -0
- package/dist/plugin/resolve-hook.js +39 -0
- package/dist/plugin/resolve-hook.js.map +1 -0
- package/dist/server/accept-negotiation.d.ts +17 -0
- package/dist/server/accept-negotiation.js +53 -0
- package/dist/server/accept-negotiation.js.map +1 -0
- package/dist/server/host-authority.d.ts +20 -0
- package/dist/server/host-authority.js +46 -0
- package/dist/server/host-authority.js.map +1 -0
- package/dist/server/server.d.ts +2067 -2054
- package/dist/server/server.js +16 -99
- package/dist/server/server.js.map +1 -1
- package/dist/subcommands.d.ts +5 -1
- package/dist/subcommands.js +11 -6
- package/dist/subcommands.js.map +1 -1
- package/dist/task-cli/discovery.js +5 -4
- package/dist/task-cli/discovery.js.map +1 -1
- package/package.json +4 -4
- package/web/dist/assets/{accounts-section-xFYT_zfY.js → accounts-section-3TFV3bKA.js} +1 -1
- package/web/dist/assets/{activity-motion-OAYNqxZ2.js → activity-motion-DIEqBTn_.js} +1 -1
- package/web/dist/assets/{activity-route-cdDIR26F.js → activity-route-1e-zJAwF.js} +1 -1
- package/web/dist/assets/{agent-config-section-B8yx4Ftt.js → agent-config-section-BEhRUFXI.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-BUJi0JBr.js → agent-defaults-section-CPFpExY0.js} +1 -1
- package/web/dist/assets/{appearance-L-Mcz7xt.js → appearance-DmZqmV_h.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-BJoirmK5.js → archive-on-merge-field-BMxl0_RG.js} +1 -1
- package/web/dist/assets/attention-BiqSbE32.js +1 -0
- package/web/dist/assets/{automations-route-DndFRPQ2.js → automations-route-BQTvY9OZ.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-uXKNbpAQ.js → commit-diff-panel-CrCQrLkj.js} +1 -1
- package/web/dist/assets/{diff-DcmpXzlx.js → diff-CSURjwWN.js} +2 -2
- package/web/dist/assets/{diff-view-Bu3mxoNK.js → diff-view-C0EkYWIb.js} +1 -1
- package/web/dist/assets/{file-preview-DmLdg1Ak.js → file-preview-Dwpny4J1.js} +1 -1
- package/web/dist/assets/{folder-browser-DwKXxvit.js → folder-browser-vE5IBaDD.js} +1 -1
- package/web/dist/assets/{git-toolbar-CBMk5v-t.js → git-toolbar-Cxylz9oM.js} +1 -1
- package/web/dist/assets/github-QMdDPo6m.js +1 -0
- package/web/dist/assets/{global-activity-route-Rx7cgzpu.js → global-activity-route-CbOpfU7Q.js} +1 -1
- package/web/dist/assets/{index-CilVqe_c.js → index-Bra3Zx6_.js} +5 -5
- package/web/dist/assets/{label-DozlouK_.js → label-uUv3KkFX.js} +1 -1
- package/web/dist/assets/{markdown-CoC8_Mxa.js → markdown-CVLWRUFa.js} +1 -1
- package/web/dist/assets/{notifications-section-CRVfC723.js → notifications-section-y0N1nPKx.js} +1 -1
- package/web/dist/assets/{open-in-menu-9Hic-2Jh.js → open-in-menu-szYIrLlc.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-BcePJL41.js → preview-pane-connected-DzLCKXRK.js} +1 -1
- package/web/dist/assets/{project-location-YHLlezCN.js → project-location-D5yAc-_A.js} +1 -1
- package/web/dist/assets/{project-router-CYJwJlJL.js → project-router-BYHPCHz0.js} +1 -1
- package/web/dist/assets/project-scope-context-C0FJXpqD.js +4 -0
- package/web/dist/assets/{projects-section-BzJOvGbU.js → projects-section-DwrBHp8U.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-DCXEFZeZ.js → prompt-templates-section-B63ytixw.js} +1 -1
- package/web/dist/assets/{queries-DeeY9cGJ.js → queries-CK9ZDDfL.js} +1 -1
- package/web/dist/assets/{reference-chip-BSXiknFh.js → reference-chip-jyOBNGWj.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-B6gmSQmK.js → remote-settings-notice-BaEqkFLb.js} +1 -1
- package/web/dist/assets/{repo-git-f5cKDC-i.js → repo-git-CY6YcBMo.js} +1 -1
- package/web/dist/assets/{report-reader-D_SwO-8H.js → report-reader-4K1U0nwt.js} +1 -1
- package/web/dist/assets/{reports-CyP79G2S.js → reports-DzfdonA_.js} +1 -1
- package/web/dist/assets/{resources-section-21R3ObSS.js → resources-section-Dzqw_Eh_.js} +1 -1
- package/web/dist/assets/{run-header-CmEgf2OE.js → run-header-BwxE9ges.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-CIUuXcrv.js → settings-agent-picker-BsfSkgY9.js} +1 -1
- package/web/dist/assets/{settings-shell-DuQAKYA0.js → settings-shell-DDTVjo7C.js} +1 -1
- package/web/dist/assets/{sidebar-section-D7e8bdCc.js → sidebar-section-BFcDThEN.js} +1 -1
- package/web/dist/assets/{skills-CBHa5_n1.js → skills-Cw_PL5-A.js} +1 -1
- package/web/dist/assets/{tab-link-Bc33InzJ.js → tab-link-Crlr5m1D.js} +1 -1
- package/web/dist/assets/{task-changes-B-daTy0n.js → task-changes-DLzIXSTR.js} +1 -1
- package/web/dist/assets/{task-commits-B8JcUxwa.js → task-commits-amn0LePZ.js} +1 -1
- package/web/dist/assets/{task-files-QGAAGN7K.js → task-files-9b6zqJWa.js} +1 -1
- package/web/dist/assets/{task-github-item-BUQ-EaXP.js → task-github-item-DJvWvk2q.js} +1 -1
- package/web/dist/assets/{task-groups-CC8zwSMv.js → task-groups-CZPi6W0m.js} +1 -1
- package/web/dist/assets/{task-thread-BDXHF8cV.js → task-thread-DA-IdbEA.js} +1 -1
- package/web/dist/assets/{tasks-table-_5cXATkO.js → tasks-table-Cim2-KSS.js} +1 -1
- package/web/dist/assets/{thread-state-CiVcAJSc.js → thread-state-PGrlMiQA.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-qYz6wj5e.js → use-hand-to-agent-state-CMiYRssU.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-BswGDVd8.js → useInfiniteQuery-waSOS4EO.js} +1 -1
- package/web/dist/assets/useQuery-9BEU-yko.js +1 -0
- package/web/dist/assets/{workflows-CmaJn4ba.js → workflows-DowJdAnR.js} +1 -1
- package/web/dist/assets/{workspace-tools-CJ8gOVwz.js → workspace-tools-BPmJcyzi.js} +1 -1
- package/web/dist/assets/{worktrees-section-DmsaW6FZ.js → worktrees-section-Bn-NIqrK.js} +1 -1
- package/web/dist/assets/{ws-CKLbENkm.js → ws-DQjRhoew.js} +1 -1
- package/web/dist/index.html +14 -14
- package/web/dist/assets/attention-D8ku2yDQ.js +0 -1
- package/web/dist/assets/github-ktVA2Gmk.js +0 -1
- package/web/dist/assets/project-scope-context-DqBHMdSb.js +0 -4
- package/web/dist/assets/useQuery-IS5tPlew.js +0 -1
package/dist/server/server.js
CHANGED
|
@@ -119,6 +119,9 @@ import { releaseThenRemoveWorktree } from '../git-worktree-release.js';
|
|
|
119
119
|
import { isReclaimable, reclaimWorktree, reclaimWorktrees, selectReclaimableWorktrees } from '../runs/retention.js';
|
|
120
120
|
import { getCommit, getDiff, getRepoInfo, getStatus } from './git.js';
|
|
121
121
|
import { createHealthCache, HEALTH_TTL_MS } from './health-cache.js';
|
|
122
|
+
import { COMMIT_FORMATS, FILE_FORMATS, negotiate } from './accept-negotiation.js';
|
|
123
|
+
import { authorityOfHost, authorityOfOrigin, hostnameOfHost, hostnameOfOrigin } from './host-authority.js';
|
|
124
|
+
import { pluginHealth, pluginLoadReport } from '../plugin/loader.js';
|
|
122
125
|
import { createBackendChecks } from './backend-checks.js';
|
|
123
126
|
import { createGithubBranchForge } from './repo-branch-forge.js';
|
|
124
127
|
import { classifyInputFor, deleteBranches, forgetRepoBranches, readRepoBranchCounts, readRepoBranches } from './repo-branches.js';
|
|
@@ -143,7 +146,7 @@ import { createProject, listGithubOwners } from './create-project.js';
|
|
|
143
146
|
import { createWorkspaceRunFeed, currentRecord } from './workspace-run-feed.js';
|
|
144
147
|
import { mergeWriteProjectUiState, readUiState } from '../ui-state.js';
|
|
145
148
|
import { expandTilde } from '../paths.js';
|
|
146
|
-
import { isLoopbackHostHeader,
|
|
149
|
+
import { isLoopbackHostHeader, resolveCapabilities } from './capabilities.js';
|
|
147
150
|
import { browseDirectory, isInsideBrowseRoot, isLexicallyInsideBrowseRoot, resolveBrowseRoot } from './fs-browse.js';
|
|
148
151
|
import { resolveForge, forgeWebRoot, resolveForgeRoot, GithubPrNotFoundError, GH_CHECKS_MAX, GH_REF_STATUS_MAX } from './forge/index.js';
|
|
149
152
|
import { refNumberFromUrl } from '../contract/index.js';
|
|
@@ -258,58 +261,6 @@ function foldedLength(task, stack) {
|
|
|
258
261
|
// it only ever carries small GUI prefs.
|
|
259
262
|
const GLOBAL_BODY_LIMIT = 32 * 1024 * 1024; // 32 MiB
|
|
260
263
|
const UI_STATE_BODY_LIMIT = 128 * 1024; // 128 KiB
|
|
261
|
-
function parseAccept(header) {
|
|
262
|
-
const ranges = [];
|
|
263
|
-
for (const part of header.split(',')) {
|
|
264
|
-
const [range = '', ...params] = part.split(';');
|
|
265
|
-
const [type = '', subtype = ''] = range.trim().toLowerCase().split('/');
|
|
266
|
-
if (type === '' || subtype === '')
|
|
267
|
-
continue;
|
|
268
|
-
const weight = params.map((p) => p.trim().toLowerCase()).find((p) => p.startsWith('q='));
|
|
269
|
-
const parsed = weight === undefined ? 1 : Number.parseFloat(weight.slice(2));
|
|
270
|
-
const q = Number.isFinite(parsed) ? Math.min(Math.max(parsed, 0), 1) : 0;
|
|
271
|
-
if (q > 0)
|
|
272
|
-
ranges.push({ type, subtype, q });
|
|
273
|
-
}
|
|
274
|
-
return ranges;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* The best of `offers` for this `Accept`, or `null` for "no preference expressed" — which is what
|
|
278
|
-
* an absent header, a `*<slash>*`-only header and a header naming nothing on offer all mean, and
|
|
279
|
-
* what leaves the caller on its route's default.
|
|
280
|
-
*
|
|
281
|
-
* `offers` is the server's own preference order: an offer may itself be a wildcard (`image/*`,
|
|
282
|
-
* since the concrete image type is not known until the file is read), and equal q-values go to the
|
|
283
|
-
* EARLIER offer, so each route lists its default representation first.
|
|
284
|
-
*/
|
|
285
|
-
function negotiate(accept, offers) {
|
|
286
|
-
if (accept === undefined)
|
|
287
|
-
return null;
|
|
288
|
-
const ranges = parseAccept(accept);
|
|
289
|
-
let best = null;
|
|
290
|
-
for (const offer of offers) {
|
|
291
|
-
const [type = '', subtype = ''] = offer.split('/');
|
|
292
|
-
let q = 0;
|
|
293
|
-
for (const range of ranges) {
|
|
294
|
-
if (range.type === '*' && range.subtype === '*')
|
|
295
|
-
continue; // "anything" is not a preference
|
|
296
|
-
const typeMatches = range.type === type || range.type === '*' || type === '*';
|
|
297
|
-
const subtypeMatches = range.subtype === subtype || range.subtype === '*' || subtype === '*';
|
|
298
|
-
if (typeMatches && subtypeMatches && range.q > q)
|
|
299
|
-
q = range.q;
|
|
300
|
-
}
|
|
301
|
-
if (q > 0 && (best === null || q > best.q))
|
|
302
|
-
best = { offer, q };
|
|
303
|
-
}
|
|
304
|
-
return best?.offer ?? null;
|
|
305
|
-
}
|
|
306
|
-
/** What `GET /repo/commit/:sha` offers, DEFAULT FIRST: the legacy `text/plain` blob is what a
|
|
307
|
-
* request with no opinion has always received, so it also wins an Accept tie. */
|
|
308
|
-
const COMMIT_FORMATS = ['text/plain', 'application/json'];
|
|
309
|
-
/** What `GET /runs/:id/files` offers, DEFAULT FIRST. `image/*` rather than a concrete type: which
|
|
310
|
-
* image type the bytes are is only known once the path resolves, and the raw branch refuses
|
|
311
|
-
* everything that is not an image anyway. */
|
|
312
|
-
const FILE_FORMATS = ['application/json', 'image/*'];
|
|
313
264
|
function writeErrorMessage(error) { return error instanceof Error ? error.message : String(error); }
|
|
314
265
|
// The return type is INFERRED on purpose: it is the chained app type built at the bottom of
|
|
315
266
|
// this function, and `AppType` (src/server/app-type.ts) is `ReturnType<typeof createApp>`.
|
|
@@ -688,14 +639,24 @@ export function createApp(deps) {
|
|
|
688
639
|
// unreadable workspace degrades to `projects: []`.
|
|
689
640
|
projects: workspace.projects,
|
|
690
641
|
bootProject: workspace.bootProject,
|
|
642
|
+
// Same CORS-open rule as repoRoot: a hosted cockpit sends no host path.
|
|
643
|
+
plugins: pluginHealth(pluginLoadReport(), { hostPaths: caps.localHandoff }),
|
|
691
644
|
};
|
|
692
645
|
};
|
|
693
646
|
// Stale-while-revalidate cache over the snapshot; see health-cache.ts.
|
|
694
647
|
// Set while the topic has a subscriber (a noop when nobody is listening).
|
|
695
648
|
let publishHealth = () => { };
|
|
649
|
+
// Capabilities follow each read and push, like the gates (ADR 0055). Host paths follow them: a
|
|
650
|
+
// snapshot cached in local mode must not send them once the cockpit is hosted.
|
|
651
|
+
const inCurrentMode = (payload) => {
|
|
652
|
+
const caps = capabilities();
|
|
653
|
+
const repoRoot = caps.localHandoff ? bootRoot : basename(bootRoot);
|
|
654
|
+
return { ...payload, capabilities: caps, repoRoot, plugins: pluginHealth(pluginLoadReport(), { hostPaths: caps.localHandoff }) };
|
|
655
|
+
};
|
|
696
656
|
const healthCache = createHealthCache({
|
|
697
657
|
snapshot: healthSnapshot,
|
|
698
|
-
publish: (
|
|
658
|
+
publish: (cached) => {
|
|
659
|
+
const payload = inCurrentMode(cached);
|
|
699
660
|
publishHealth(payload);
|
|
700
661
|
workspaceEvents.emit('health', payload);
|
|
701
662
|
},
|
|
@@ -707,7 +668,7 @@ export function createApp(deps) {
|
|
|
707
668
|
const readHealth = async () => {
|
|
708
669
|
if (!deps.socketHub)
|
|
709
670
|
return healthSnapshot();
|
|
710
|
-
return healthCache.read(
|
|
671
|
+
return healthCache.read(inCurrentMode);
|
|
711
672
|
};
|
|
712
673
|
// ---- chained family: health (workspace-level) ----------------------------
|
|
713
674
|
// Written as ONE chained expression rather than a loose `app.get(...)`
|
|
@@ -4163,50 +4124,6 @@ export function verifyWsUpgrade(req, bindHost) {
|
|
|
4163
4124
|
// indistinguishable: admit as UNTRUSTED so only `loopbackReadable` topics show.
|
|
4164
4125
|
return { trusted: fetchSite === 'same-origin' };
|
|
4165
4126
|
}
|
|
4166
|
-
/** The bare hostname of a `Host` header — see `normalizeHostname`. `''` when the
|
|
4167
|
-
* header is absent, which no allowlist matches. */
|
|
4168
|
-
function hostnameOfHost(host) {
|
|
4169
|
-
return host ? normalizeHostname(host) : '';
|
|
4170
|
-
}
|
|
4171
|
-
/** The `hostname:port` authority of a `Host` header, e.g. `127.0.0.1:4321`.
|
|
4172
|
-
*
|
|
4173
|
-
* The port is kept verbatim and is `''` when the header omits it — which is
|
|
4174
|
-
* exactly when a browser also omits it from `Origin` (both drop the scheme's
|
|
4175
|
-
* default port). That symmetry is what lets us compare the two without knowing
|
|
4176
|
-
* our own scheme, which we cannot know behind a TLS-terminating proxy. */
|
|
4177
|
-
function authorityOfHost(host) {
|
|
4178
|
-
if (!host)
|
|
4179
|
-
return '';
|
|
4180
|
-
const port = host.match(/^\[[^\]]*\]:(\d+)$/)?.[1] ?? host.match(/^[^:]*:(\d+)$/)?.[1] ?? '';
|
|
4181
|
-
return `${normalizeHostname(host)}:${port}`;
|
|
4182
|
-
}
|
|
4183
|
-
/** The `hostname:port` authority of an `Origin` header, or `null` when it is not
|
|
4184
|
-
* a parseable http(s) URL (the opaque `"null"` origin of a sandboxed iframe, a
|
|
4185
|
-
* `file://` page). `URL.port` is `''` for a scheme's default port, matching
|
|
4186
|
-
* `authorityOfHost`. */
|
|
4187
|
-
function authorityOfOrigin(origin) {
|
|
4188
|
-
try {
|
|
4189
|
-
const u = new URL(origin);
|
|
4190
|
-
if (u.protocol !== 'http:' && u.protocol !== 'https:')
|
|
4191
|
-
return null;
|
|
4192
|
-
return `${normalizeHostname(u.hostname)}:${u.port}`;
|
|
4193
|
-
}
|
|
4194
|
-
catch {
|
|
4195
|
-
return null;
|
|
4196
|
-
}
|
|
4197
|
-
}
|
|
4198
|
-
/** The hostname of an `Origin` header, or `null` when it is not a parseable URL
|
|
4199
|
-
* (e.g. the opaque `"null"` origin of a sandboxed iframe). Normalized through
|
|
4200
|
-
* the same path as `hostnameOfHost` so the two compare equal for IPv6 and for
|
|
4201
|
-
* trailing-dot FQDNs. */
|
|
4202
|
-
function hostnameOfOrigin(origin) {
|
|
4203
|
-
try {
|
|
4204
|
-
return normalizeHostname(new URL(origin).hostname);
|
|
4205
|
-
}
|
|
4206
|
-
catch {
|
|
4207
|
-
return null;
|
|
4208
|
-
}
|
|
4209
|
-
}
|
|
4210
4127
|
function resolveWebDir() {
|
|
4211
4128
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
4212
4129
|
// here = <pkg>/dist/server (built) or <pkg>/src/server (tsx dev).
|