@hearsay-tools/squawk 0.19.0-dev.9172 → 0.19.0-dev.9180
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/ci-wait/controller.d.ts +7 -7
- package/dist/contract/hosts.d.ts +925 -0
- package/dist/contract/index.js +104 -2
- package/dist/core/server-hook-registry.d.ts +13 -0
- package/dist/core/server-hook-registry.js.map +1 -1
- package/dist/delegation/routes.d.ts +78 -78
- package/dist/features/hosts/admission.d.ts +52 -0
- package/dist/features/hosts/admission.js +89 -0
- package/dist/features/hosts/admission.js.map +1 -0
- package/dist/features/hosts/gateway.d.ts +14 -3
- package/dist/features/hosts/gateway.js +35 -21
- package/dist/features/hosts/gateway.js.map +1 -1
- package/dist/features/hosts/index.d.ts +7 -3
- package/dist/features/hosts/index.js +41 -7
- package/dist/features/hosts/index.js.map +1 -1
- package/dist/features/hosts/registry-reconciler.d.ts +41 -0
- package/dist/features/hosts/registry-reconciler.js +168 -0
- package/dist/features/hosts/registry-reconciler.js.map +1 -0
- package/dist/features/hosts/routes.d.ts +414 -48
- package/dist/features/hosts/routes.js +72 -62
- package/dist/features/hosts/routes.js.map +1 -1
- package/dist/features/hosts/runs-index-events.d.ts +23 -0
- package/dist/features/hosts/runs-index-events.js +116 -0
- package/dist/features/hosts/runs-index-events.js.map +1 -0
- package/dist/features/hosts/runs-index-patch.d.ts +203 -0
- package/dist/features/hosts/runs-index-patch.js +798 -0
- package/dist/features/hosts/runs-index-patch.js.map +1 -0
- package/dist/features/hosts/runs-index.d.ts +149 -0
- package/dist/features/hosts/runs-index.js +762 -0
- package/dist/features/hosts/runs-index.js.map +1 -0
- package/dist/features/hosts/runs-search.d.ts +28 -0
- package/dist/features/hosts/runs-search.js +151 -0
- package/dist/features/hosts/runs-search.js.map +1 -0
- package/dist/features/hosts/supervisor.d.ts +4 -0
- package/dist/features/hosts/supervisor.js +14 -6
- package/dist/features/hosts/supervisor.js.map +1 -1
- package/dist/features/reports/routes.d.ts +2 -2
- package/dist/features/webhooks/routes.d.ts +38 -38
- package/dist/plugin/index.d.ts +1 -1
- package/dist/plugin/index.js.map +1 -1
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/models-routes.d.ts +12 -12
- package/dist/server/project-settings-routes.d.ts +107 -107
- package/dist/server/projects-routes.d.ts +41 -41
- package/dist/server/provider-sign-in-routes.d.ts +2 -2
- package/dist/server/providers-routes.d.ts +58 -58
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/runners-routes.d.ts +10 -10
- package/dist/server/runs-routes.d.ts +344 -344
- package/dist/server/server.d.ts +1195 -1195
- package/dist/server/server.js +7 -1
- package/dist/server/server.js.map +1 -1
- package/dist/server/workspace-identity-routes.d.ts +5 -5
- package/dist/server/workspace-live-routes.d.ts +5 -5
- package/dist/server/workspace-routes.d.ts +85 -85
- package/dist/server/workspace-run-feed.d.ts +4 -0
- package/dist/server/workspace-run-feed.js +13 -0
- package/dist/server/workspace-run-feed.js.map +1 -1
- package/package.json +4 -4
- package/scripts/benchmark-hosts-runs-index-probes.ts +242 -0
- package/scripts/benchmark-hosts-runs-index.ts +776 -0
- package/web/dist/assets/accounts-section-BDUoikVg.js +1 -0
- package/web/dist/assets/activity-motion-CYdEr0hu.js +1 -0
- package/web/dist/assets/{activity-route-C2zP5vVV.js → activity-route-D8BPLoZj.js} +1 -1
- package/web/dist/assets/{agent-accounts-D_ZKAmaW.js → agent-accounts-C2ILQhZy.js} +1 -1
- package/web/dist/assets/{agent-config-section-CwK_izpU.js → agent-config-section-BO8w2cry.js} +2 -2
- package/web/dist/assets/agent-defaults-section-BBcv7Vbh.js +1 -0
- package/web/dist/assets/{appearance-DvoRcoRX.js → appearance-yF_NXlq5.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-DWPtF9dh.js → archive-on-merge-field-Dh1M21D6.js} +1 -1
- package/web/dist/assets/{ask-card-D-om0EtP.js → ask-card-2E9m5VRA.js} +1 -1
- package/web/dist/assets/attention-C7BUdd2s.js +1 -0
- package/web/dist/assets/automations-route-D27bK2j6.js +2 -0
- package/web/dist/assets/{commit-list-CPJLP4DU.js → commit-list-sFxchD2V.js} +1 -1
- package/web/dist/assets/{diff-BQJN6jzN.js → diff-C5-32cRp.js} +2 -2
- package/web/dist/assets/{diff-controls-AsSX7gfO.js → diff-controls-Ci36iPlK.js} +1 -1
- package/web/dist/assets/{diff-view-BW5bbiaq.js → diff-view-CCtuYJNL.js} +1 -1
- package/web/dist/assets/{discard-changes-dialog-Bv4yc0N1.js → discard-changes-dialog-BACqR1hj.js} +1 -1
- package/web/dist/assets/{file-preview-CnrFxbea.js → file-preview-B7T7jFYo.js} +1 -1
- package/web/dist/assets/{folder-browser-CFd1U5hn.js → folder-browser-3cBLlnE9.js} +1 -1
- package/web/dist/assets/{git-toolbar-C7iolhIi.js → git-toolbar-UkRnjuDs.js} +1 -1
- package/web/dist/assets/github-CkbZgMnJ.js +1 -0
- package/web/dist/assets/{global-activity-route-Dijwg4OL.js → global-activity-route-j37l-BQU.js} +1 -1
- package/web/dist/assets/hosts-iUyg8S3j.js +1 -0
- package/web/dist/assets/index-DkQ5xrLr.js +21 -0
- package/web/dist/assets/{label-CgU9vxuM.js → label-CWlxyeC-.js} +1 -1
- package/web/dist/assets/{markdown-Cljq4S1h.js → markdown-FIfZPsax.js} +1 -1
- package/web/dist/assets/{open-in-menu-BI7mnPPf.js → open-in-menu-Bf8JA2DJ.js} +1 -1
- package/web/dist/assets/{option-select-BcTkv-7t.js → option-select-DylfDjGi.js} +1 -1
- package/web/dist/assets/{preferences-section-CEKXGhEj.js → preferences-section-DjWfc1i-.js} +1 -1
- package/web/dist/assets/{preview-EtD19mg1.js → preview-BSFJfN4s.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-CKRBfx7t.js → preview-pane-connected-CfiPFvTH.js} +2 -2
- package/web/dist/assets/{project-location-hufc_p8y.js → project-location-CEX0-MZp.js} +1 -1
- package/web/dist/assets/{project-router-Dc6KBQsv.js → project-router-CwD1firw.js} +1 -1
- package/web/dist/assets/{projects-section-vOFZ4lbx.js → projects-section-Czmf0wFK.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-Caash2nq.js → prompt-templates-section-DK4CV73w.js} +1 -1
- package/web/dist/assets/queries-D9mg7sFY.js +1 -0
- package/web/dist/assets/{read-state-BeVNfGkB.js → read-state-BsTfJki5.js} +1 -1
- package/web/dist/assets/{reference-chip-BjerVjzM.js → reference-chip-CZKBU_Ud.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-fNgh5LdN.js → remote-settings-notice-Dott-jyP.js} +1 -1
- package/web/dist/assets/repo-git-Djt3N2wP.js +1 -0
- package/web/dist/assets/{report-reader-CK1WDtEH.js → report-reader-CrdDix7Z.js} +1 -1
- package/web/dist/assets/{report-selection-CZ8eb9QP.js → report-selection-Y2F9NTAs.js} +1 -1
- package/web/dist/assets/{reports-B-GImLAo.js → reports-Iw4LUvz2.js} +1 -1
- package/web/dist/assets/{resources-section-ApF3gXrw.js → resources-section-D3wUzdUQ.js} +1 -1
- package/web/dist/assets/{review-notes-drafts-BdjEFs1G.js → review-notes-drafts-xyC7GvRB.js} +1 -1
- package/web/dist/assets/{review-panel-D4zmYH8O.js → review-panel-3x_2lbej.js} +1 -1
- package/web/dist/assets/{review-strip-BpHXklAn.js → review-strip-CDYpq9_S.js} +1 -1
- package/web/dist/assets/{run-detail-refresh-CE0vyYYA.js → run-detail-refresh-SYZM94ch.js} +1 -1
- package/web/dist/assets/{run-diff-ClfLRsHF.js → run-diff-D26PXp6r.js} +1 -1
- package/web/dist/assets/run-header-DZ0rkryR.js +2 -0
- package/web/dist/assets/{select-CwDhRDtw.js → select-DC_G2no3.js} +1 -1
- package/web/dist/assets/{session-context-section-C87jx7RB.js → session-context-section-DEUv-ISr.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-Dk8yJ57U.js → settings-agent-picker-BrFN2RaQ.js} +1 -1
- package/web/dist/assets/{settings-save-bar-cu8BKCGT.js → settings-save-bar-C0pFHqte.js} +1 -1
- package/web/dist/assets/{settings-shell-mhQfQKf1.js → settings-shell-BWWbVxv-.js} +1 -1
- package/web/dist/assets/{sidebar-section-DOQ5N1L6.js → sidebar-section-BGo1zjJt.js} +1 -1
- package/web/dist/assets/{skills-DXJ1gQBD.js → skills-qFMQz6sm.js} +1 -1
- package/web/dist/assets/{status-dot-Bmn4xhch.js → status-dot-DTU7afRv.js} +1 -1
- package/web/dist/assets/{tab-link-6TltE1jl.js → tab-link-BJDe5cT4.js} +1 -1
- package/web/dist/assets/{task-changes-D9Sdmpmw.js → task-changes-DKJHAtKC.js} +2 -2
- package/web/dist/assets/{task-commits-A0UIqxpL.js → task-commits-Dtt60D0o.js} +1 -1
- package/web/dist/assets/{task-file-scope-ID220XKo.js → task-file-scope-FTt7SiGn.js} +1 -1
- package/web/dist/assets/{task-files-Id2tuAAG.js → task-files-DVz4222z.js} +1 -1
- package/web/dist/assets/{task-github-item-YKUcwp2o.js → task-github-item-CJpKQ6cU.js} +1 -1
- package/web/dist/assets/{task-groups-DCg4iOB9.js → task-groups-BvVfsQKd.js} +1 -1
- package/web/dist/assets/{task-thread-A_vkygGX.js → task-thread-DiYtqka4.js} +2 -2
- package/web/dist/assets/{thread-state-6-BzRrJ_.js → thread-state-pO7Wy_7R.js} +1 -1
- package/web/dist/assets/toaster-2ud_VdfV.js +4 -0
- package/web/dist/assets/{use-finish-run-DO-nnAaa.js → use-finish-run-5S30Eu3d.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-CADaL8U8.js → use-hand-to-agent-state-BB_VmbF7.js} +1 -1
- package/web/dist/assets/use-path-bases-npA-uKvg.js +1 -0
- package/web/dist/assets/use-workspace-config-save-DDI7_WtK.js +1 -0
- package/web/dist/assets/{workflows-DOLG-Rns.js → workflows-DLuBawpi.js} +2 -2
- package/web/dist/assets/{workspace-tools-DTCJVDTE.js → workspace-tools-D4jshe-2.js} +1 -1
- package/web/dist/assets/{worktrees-section-BOHDbywt.js → worktrees-section-CESTBOem.js} +5 -5
- package/web/dist/index.html +19 -19
- package/web/dist/assets/accounts-section-Bnr89jmC.js +0 -1
- package/web/dist/assets/activity-motion-BW0tAmYF.js +0 -1
- package/web/dist/assets/agent-defaults-section-RyEogH0g.js +0 -1
- package/web/dist/assets/attention-BI6592lk.js +0 -1
- package/web/dist/assets/automations-route-DfGE4xWT.js +0 -2
- package/web/dist/assets/github-DGElvfMU.js +0 -1
- package/web/dist/assets/hosts-CpDMDiQW.js +0 -1
- package/web/dist/assets/index-DPfg7xSB.js +0 -21
- package/web/dist/assets/queries-IlC9MZgh.js +0 -1
- package/web/dist/assets/repo-git-5MK_RAR6.js +0 -1
- package/web/dist/assets/run-header-BUe92WWr.js +0 -2
- package/web/dist/assets/toaster-DNnL8v10.js +0 -4
- package/web/dist/assets/use-path-bases-CFAmFn_E.js +0 -1
- package/web/dist/assets/use-workspace-config-save-DScW6_8J.js +0 -1
package/dist/contract/index.js
CHANGED
|
@@ -6502,11 +6502,21 @@ var agentToolCatalogSchema = z60.object({ tools: z60.array(agentToolMetadataSche
|
|
|
6502
6502
|
import { z as z61 } from "zod";
|
|
6503
6503
|
var HOST_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,31}$/;
|
|
6504
6504
|
var LOCAL_HOST_ID = "local";
|
|
6505
|
+
var RESERVED_HOST_ROUTE_IDS = ["projects", "runs-index", "runs-search"];
|
|
6506
|
+
var RESERVED_HOST_ROUTE_ID_SET = new Set(RESERVED_HOST_ROUTE_IDS);
|
|
6505
6507
|
var CONTROL_CHARS_PATTERN = /[\u0000-\u001f\u007f]/;
|
|
6506
6508
|
var INVALID_SSH_ALIAS_CHARS = /[\s*?![\]\\'"`]/;
|
|
6507
6509
|
var hostIdSchema = z61.string().regex(HOST_ID_PATTERN, "host id must match ^[a-z0-9][a-z0-9-]{0,31}$").refine((value) => value !== LOCAL_HOST_ID, {
|
|
6508
6510
|
message: `host id "${LOCAL_HOST_ID}" is reserved`
|
|
6509
6511
|
});
|
|
6512
|
+
var createHostIdSchema = hostIdSchema.superRefine((value, ctx) => {
|
|
6513
|
+
if (RESERVED_HOST_ROUTE_ID_SET.has(value)) {
|
|
6514
|
+
ctx.addIssue({
|
|
6515
|
+
code: "custom",
|
|
6516
|
+
message: `host id "${value}" is reserved`
|
|
6517
|
+
});
|
|
6518
|
+
}
|
|
6519
|
+
});
|
|
6510
6520
|
var hostLabelSchema = z61.string().trim().min(1, "label must not be empty").max(255, "label must be at most 255 characters").refine((value) => !CONTROL_CHARS_PATTERN.test(value), {
|
|
6511
6521
|
message: "label must not contain control characters"
|
|
6512
6522
|
});
|
|
@@ -6580,13 +6590,13 @@ var hostRouteParamsSchema = z61.object({
|
|
|
6580
6590
|
});
|
|
6581
6591
|
var createHostInputSchema = z61.object({
|
|
6582
6592
|
sshAlias: hostSshAliasSchema,
|
|
6583
|
-
id:
|
|
6593
|
+
id: createHostIdSchema.optional(),
|
|
6584
6594
|
label: hostLabelSchema.optional(),
|
|
6585
6595
|
port: hostPortSchema.optional()
|
|
6586
6596
|
}).strict().superRefine((data, ctx) => {
|
|
6587
6597
|
if (data.id !== void 0) return;
|
|
6588
6598
|
const derived = slugHostId(data.sshAlias);
|
|
6589
|
-
const parsed =
|
|
6599
|
+
const parsed = createHostIdSchema.safeParse(derived);
|
|
6590
6600
|
if (!parsed.success) {
|
|
6591
6601
|
ctx.addIssue({
|
|
6592
6602
|
code: "custom",
|
|
@@ -6752,6 +6762,79 @@ var hostsProjectsResponseSchema = z61.object({
|
|
|
6752
6762
|
hosts: z61.array(hostProjectsEntrySchema),
|
|
6753
6763
|
warning: z61.string().optional()
|
|
6754
6764
|
});
|
|
6765
|
+
var hostRunIndexEntrySchema = runIndexEntrySchema.extend({
|
|
6766
|
+
hostId: hostIdSchema
|
|
6767
|
+
});
|
|
6768
|
+
var hostRunsIndexStateSchema = z61.object({
|
|
6769
|
+
id: hostIdSchema,
|
|
6770
|
+
label: hostLabelSchema,
|
|
6771
|
+
state: hostStateSchema,
|
|
6772
|
+
/** True while the host is not connected and live-synced; cached rows may be behind the host. */
|
|
6773
|
+
stale: z61.boolean(),
|
|
6774
|
+
/** True once the main server has read the host's task index at least once since starting. */
|
|
6775
|
+
loaded: z61.boolean(),
|
|
6776
|
+
/** Project ids on this host that hit `perProjectLimit` for archived root runs. */
|
|
6777
|
+
truncated: z61.array(z61.string()),
|
|
6778
|
+
/** Cached PR/issue reference statuses per project id from the host's latest snapshot. */
|
|
6779
|
+
referenceStatuses: referenceStatusesByProjectSchema,
|
|
6780
|
+
/** Per-project archived window reported by the host's latest snapshot, when loaded. */
|
|
6781
|
+
perProjectLimit: z61.number().int().nonnegative().optional()
|
|
6782
|
+
});
|
|
6783
|
+
var hostsRunsIndexQuerySchema = z61.object({
|
|
6784
|
+
/** When set, returns rows and state for that single saved host only. */
|
|
6785
|
+
hostId: hostIdSchema.optional()
|
|
6786
|
+
});
|
|
6787
|
+
var hostsRunsIndexResponseSchema = z61.object({
|
|
6788
|
+
runs: z61.array(hostRunIndexEntrySchema),
|
|
6789
|
+
hosts: z61.array(hostRunsIndexStateSchema),
|
|
6790
|
+
generation: z61.string().min(1),
|
|
6791
|
+
eventSeq: z61.number().int().nonnegative(),
|
|
6792
|
+
warning: z61.string().optional()
|
|
6793
|
+
});
|
|
6794
|
+
var HOST_SEARCH_UNANSWERED_REASONS = ["not-connected", "deadline", "error"];
|
|
6795
|
+
var hostSearchUnansweredReasonSchema = z61.enum(HOST_SEARCH_UNANSWERED_REASONS);
|
|
6796
|
+
var hostSearchUnansweredSchema = z61.object({
|
|
6797
|
+
hostId: hostIdSchema,
|
|
6798
|
+
label: hostLabelSchema,
|
|
6799
|
+
state: hostStateSchema,
|
|
6800
|
+
reason: hostSearchUnansweredReasonSchema
|
|
6801
|
+
});
|
|
6802
|
+
var hostTruncatedProjectSchema = z61.object({
|
|
6803
|
+
hostId: hostIdSchema,
|
|
6804
|
+
projectId: z61.string()
|
|
6805
|
+
});
|
|
6806
|
+
var hostsRunsSearchResponseSchema = z61.object({
|
|
6807
|
+
runs: z61.array(hostRunIndexEntrySchema),
|
|
6808
|
+
truncated: z61.array(hostTruncatedProjectSchema),
|
|
6809
|
+
unanswered: z61.array(hostSearchUnansweredSchema),
|
|
6810
|
+
warning: z61.string().optional()
|
|
6811
|
+
});
|
|
6812
|
+
var HOSTS_CHANGED_EVENT = "hosts-changed";
|
|
6813
|
+
var hostsChangedEventSchema = z61.object({
|
|
6814
|
+
hostIds: z61.array(hostIdSchema).min(1),
|
|
6815
|
+
stateChanged: z61.boolean(),
|
|
6816
|
+
indexChanged: z61.boolean()
|
|
6817
|
+
});
|
|
6818
|
+
var HOST_RUN_SUMMARY_EVENT = "host-run-summary";
|
|
6819
|
+
var hostRunSummaryEventSchema = z61.object({
|
|
6820
|
+
hostId: hostIdSchema,
|
|
6821
|
+
project: z61.string().min(1),
|
|
6822
|
+
seq: z61.number().int().positive(),
|
|
6823
|
+
run: runSummarySchema
|
|
6824
|
+
});
|
|
6825
|
+
var HOST_RUN_DELETED_EVENT = "host-run-deleted";
|
|
6826
|
+
var hostRunDeletedEventSchema = z61.object({
|
|
6827
|
+
hostId: hostIdSchema,
|
|
6828
|
+
project: z61.string().min(1),
|
|
6829
|
+
seq: z61.number().int().positive(),
|
|
6830
|
+
id: z61.string().min(1)
|
|
6831
|
+
});
|
|
6832
|
+
var HOST_USAGE_EVENT = "host-usage";
|
|
6833
|
+
var hostUsageEventSchema = z61.object({
|
|
6834
|
+
hostId: hostIdSchema,
|
|
6835
|
+
project: z61.string().min(1),
|
|
6836
|
+
usage: z61.record(z61.string(), processUsageSchema)
|
|
6837
|
+
});
|
|
6755
6838
|
export {
|
|
6756
6839
|
ACTIVITY_CHECKS_MAX,
|
|
6757
6840
|
ACTIVITY_CHECK_NAME_MAX,
|
|
@@ -6788,10 +6871,15 @@ export {
|
|
|
6788
6871
|
HANDOFF_AUTOSAVE_RECORDS_MAX,
|
|
6789
6872
|
HOME_FILE_PATTERN,
|
|
6790
6873
|
HOME_RECOVERY_REASONS,
|
|
6874
|
+
HOSTS_CHANGED_EVENT,
|
|
6791
6875
|
HOST_GATEWAY_ERROR_CODES,
|
|
6792
6876
|
HOST_ID_PATTERN,
|
|
6793
6877
|
HOST_NOT_CONNECTED_REASON,
|
|
6878
|
+
HOST_RUN_DELETED_EVENT,
|
|
6879
|
+
HOST_RUN_SUMMARY_EVENT,
|
|
6880
|
+
HOST_SEARCH_UNANSWERED_REASONS,
|
|
6794
6881
|
HOST_STATES,
|
|
6882
|
+
HOST_USAGE_EVENT,
|
|
6795
6883
|
HUMAN_ASK_EVENT_TYPES,
|
|
6796
6884
|
ISOLATED_BASELINE_REFUSAL,
|
|
6797
6885
|
LAST_WAITS_LIMIT,
|
|
@@ -6830,6 +6918,7 @@ export {
|
|
|
6830
6918
|
REFERENCE_STATUS_MAX,
|
|
6831
6919
|
RENEW_MS,
|
|
6832
6920
|
REPORTS_QUERY_MAX,
|
|
6921
|
+
RESERVED_HOST_ROUTE_IDS,
|
|
6833
6922
|
RETENTION_RUN_RULE,
|
|
6834
6923
|
RUNS_SEARCH_PER_PROJECT_MAX,
|
|
6835
6924
|
RUN_HISTORY_PAGE_ITEMS,
|
|
@@ -7016,6 +7105,7 @@ export {
|
|
|
7016
7105
|
createAgentProfileInputSchema,
|
|
7017
7106
|
createAgentProfileSchema,
|
|
7018
7107
|
createAutomationInputSchema,
|
|
7108
|
+
createHostIdSchema,
|
|
7019
7109
|
createHostInputSchema,
|
|
7020
7110
|
createPrResponseSchema,
|
|
7021
7111
|
createProjectInputSchema,
|
|
@@ -7118,6 +7208,12 @@ export {
|
|
|
7118
7208
|
hostProjectsEntrySchema,
|
|
7119
7209
|
hostResponseSchema,
|
|
7120
7210
|
hostRouteParamsSchema,
|
|
7211
|
+
hostRunDeletedEventSchema,
|
|
7212
|
+
hostRunIndexEntrySchema,
|
|
7213
|
+
hostRunSummaryEventSchema,
|
|
7214
|
+
hostRunsIndexStateSchema,
|
|
7215
|
+
hostSearchUnansweredReasonSchema,
|
|
7216
|
+
hostSearchUnansweredSchema,
|
|
7121
7217
|
hostServerActiveTasksResultSchema,
|
|
7122
7218
|
hostServerClaimPhaseSchema,
|
|
7123
7219
|
hostServerClaimSummarySchema,
|
|
@@ -7132,9 +7228,15 @@ export {
|
|
|
7132
7228
|
hostStarterInstallIdSchema,
|
|
7133
7229
|
hostStateSchema,
|
|
7134
7230
|
hostSummarySchema,
|
|
7231
|
+
hostTruncatedProjectSchema,
|
|
7232
|
+
hostUsageEventSchema,
|
|
7233
|
+
hostsChangedEventSchema,
|
|
7135
7234
|
hostsListResponseSchema,
|
|
7136
7235
|
hostsProjectsResponseSchema,
|
|
7137
7236
|
hostsRegistryFileSchema,
|
|
7237
|
+
hostsRunsIndexQuerySchema,
|
|
7238
|
+
hostsRunsIndexResponseSchema,
|
|
7239
|
+
hostsRunsSearchResponseSchema,
|
|
7138
7240
|
humanAskClosedEventSchema,
|
|
7139
7241
|
humanInputDeliveredEventSchema,
|
|
7140
7242
|
humanWaitEntrySchema,
|
|
@@ -55,6 +55,18 @@ export interface ServerWorkspaceEventsPort {
|
|
|
55
55
|
emit(event: string, data: unknown): void;
|
|
56
56
|
on(listener: (event: string, data: unknown) => void): () => void;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Structural port for publishing summary-mode SSE frames to `GET /api/v1/workspace/events?runs=summary`
|
|
60
|
+
* subscribers only, without touching the local run feed's sequence counter.
|
|
61
|
+
*/
|
|
62
|
+
export interface ServerWorkspaceSummaryFeedPort {
|
|
63
|
+
/** Process-wide generation id matching `ready.generation` on `/api/v1/workspace/events`. */
|
|
64
|
+
readonly generation: string;
|
|
65
|
+
/** Write one pre-serialized SSE frame to every `?runs=summary` subscriber only. */
|
|
66
|
+
emitSummary(event: string, data: string): void;
|
|
67
|
+
/** True when at least one `?runs=summary` client is currently connected. */
|
|
68
|
+
hasSummarySubscribers(): boolean;
|
|
69
|
+
}
|
|
58
70
|
/** Structural port over a resolved forge driver's availability probe. */
|
|
59
71
|
export interface ServerForgePort {
|
|
60
72
|
readonly kind: string;
|
|
@@ -83,6 +95,7 @@ export interface ServerPluginContext {
|
|
|
83
95
|
refresh?: boolean;
|
|
84
96
|
}) => Promise<ProviderStatusResponse>;
|
|
85
97
|
readonly workspaceEvents: ServerWorkspaceEventsPort;
|
|
98
|
+
readonly workspaceSummaryFeed: ServerWorkspaceSummaryFeedPort;
|
|
86
99
|
readonly projects: {
|
|
87
100
|
/** Boot project handle, or `undefined` on a server started with no boot project. */
|
|
88
101
|
readonly boot?: ServerProjectHandle | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-hook-registry.js","sourceRoot":"","sources":["../../src/core/server-hook-registry.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAUpD,MAAM,UAAU,wBAAwB,CAAC,OAA2C;IAClF,MAAM,KAAK,GAAG,IAAI,GAAG,CAAkB,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACtF,OAAO;QACL,GAAG,EAAE,CAAc,GAAW,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAkB;QAClE,GAAG,EAAE,CAAc,GAAW,EAAE,KAAQ,EAAE,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACvE,MAAM,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;KAC3C,CAAC;AACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"server-hook-registry.js","sourceRoot":"","sources":["../../src/core/server-hook-registry.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAUpD,MAAM,UAAU,wBAAwB,CAAC,OAA2C;IAClF,MAAM,KAAK,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AK,CAAC,kBAAkB,IAAI,CAAC,EAAE,KAAK,GAAG,sBAAsB,CAAC,CAAC;QACvG,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,KAAK,eAAe,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,CAAC,EAAE,KAAK,GAAG,uBAAuB,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IACD,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,aAAa,KAAK,UAAU,EAAE,CAAC;QACjF,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,CAAC,EAAE,qCAAqC,CAAC,CAAC;IAClF,CAAC;AACH,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,2BAA2B,CAAC,IAA0B;IACpE,UAAU,CAAC,IAAI,CAAC,CAAC;IACjB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAA0B;IAC3D,2BAA2B,CAAC,IAAI,CAAC,CAAC;IAClC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,eAAe,KAAW,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAEzD,oDAAoD;AACpD,MAAM,UAAU,iBAAiB,KAAc,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;AAEzE,0EAA0E;AAC1E,MAAM,UAAU,qBAAqB;IACnC,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -27,18 +27,6 @@ export declare function delegationFailure(error: unknown): {
|
|
|
27
27
|
export declare function createDelegationRoutes(service: DelegationService, credentials: CredentialRegistry): import("hono/hono-base").HonoBase<Env, {
|
|
28
28
|
"/list": {
|
|
29
29
|
$get: {
|
|
30
|
-
output: {
|
|
31
|
-
error: string;
|
|
32
|
-
code?: "invalid_input" | undefined;
|
|
33
|
-
};
|
|
34
|
-
outputFormat: "json";
|
|
35
|
-
status: 400;
|
|
36
|
-
input: {
|
|
37
|
-
query: {
|
|
38
|
-
offset?: string | undefined;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
} | {
|
|
42
30
|
output: {
|
|
43
31
|
workers: {
|
|
44
32
|
workerId: string;
|
|
@@ -91,6 +79,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
91
79
|
offset?: string | undefined;
|
|
92
80
|
};
|
|
93
81
|
};
|
|
82
|
+
} | {
|
|
83
|
+
output: {
|
|
84
|
+
error: string;
|
|
85
|
+
code?: "invalid_input" | undefined;
|
|
86
|
+
};
|
|
87
|
+
outputFormat: "json";
|
|
88
|
+
status: 400;
|
|
89
|
+
input: {
|
|
90
|
+
query: {
|
|
91
|
+
offset?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
} & {
|
|
@@ -677,18 +677,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
677
677
|
} & {
|
|
678
678
|
"/:workerId": {
|
|
679
679
|
$get: {
|
|
680
|
-
output: {
|
|
681
|
-
error: string;
|
|
682
|
-
code?: "invalid_input" | undefined;
|
|
683
|
-
};
|
|
684
|
-
outputFormat: "json";
|
|
685
|
-
status: 400;
|
|
686
|
-
input: {
|
|
687
|
-
param: {
|
|
688
|
-
workerId: string;
|
|
689
|
-
};
|
|
690
|
-
};
|
|
691
|
-
} | {
|
|
692
680
|
output: {
|
|
693
681
|
workerId: string;
|
|
694
682
|
settled: boolean;
|
|
@@ -813,11 +801,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
813
801
|
workerId: string;
|
|
814
802
|
};
|
|
815
803
|
};
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
} & {
|
|
819
|
-
"/:workerId/collect": {
|
|
820
|
-
$post: {
|
|
804
|
+
} | {
|
|
821
805
|
output: {
|
|
822
806
|
error: string;
|
|
823
807
|
code?: "invalid_input" | undefined;
|
|
@@ -828,10 +812,12 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
828
812
|
param: {
|
|
829
813
|
workerId: string;
|
|
830
814
|
};
|
|
831
|
-
} & {
|
|
832
|
-
json: Record<string, never>;
|
|
833
815
|
};
|
|
834
|
-
}
|
|
816
|
+
};
|
|
817
|
+
};
|
|
818
|
+
} & {
|
|
819
|
+
"/:workerId/collect": {
|
|
820
|
+
$post: {
|
|
835
821
|
output: {
|
|
836
822
|
workerId: string;
|
|
837
823
|
parentRunId: string;
|
|
@@ -956,11 +942,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
956
942
|
} & {
|
|
957
943
|
json: Record<string, never>;
|
|
958
944
|
};
|
|
959
|
-
}
|
|
960
|
-
};
|
|
961
|
-
} & {
|
|
962
|
-
"/:workerId/steer": {
|
|
963
|
-
$post: {
|
|
945
|
+
} | {
|
|
964
946
|
output: {
|
|
965
947
|
error: string;
|
|
966
948
|
code?: "invalid_input" | undefined;
|
|
@@ -972,11 +954,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
972
954
|
workerId: string;
|
|
973
955
|
};
|
|
974
956
|
} & {
|
|
975
|
-
json:
|
|
976
|
-
text: string;
|
|
977
|
-
};
|
|
957
|
+
json: Record<string, never>;
|
|
978
958
|
};
|
|
979
|
-
}
|
|
959
|
+
};
|
|
960
|
+
};
|
|
961
|
+
} & {
|
|
962
|
+
"/:workerId/steer": {
|
|
963
|
+
$post: {
|
|
980
964
|
output: {
|
|
981
965
|
workerId: string;
|
|
982
966
|
state: "delivered" | "queued";
|
|
@@ -992,11 +976,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
992
976
|
text: string;
|
|
993
977
|
};
|
|
994
978
|
};
|
|
995
|
-
}
|
|
996
|
-
};
|
|
997
|
-
} & {
|
|
998
|
-
"/:workerId/stop": {
|
|
999
|
-
$post: {
|
|
979
|
+
} | {
|
|
1000
980
|
output: {
|
|
1001
981
|
error: string;
|
|
1002
982
|
code?: "invalid_input" | undefined;
|
|
@@ -1008,9 +988,15 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1008
988
|
workerId: string;
|
|
1009
989
|
};
|
|
1010
990
|
} & {
|
|
1011
|
-
json:
|
|
991
|
+
json: {
|
|
992
|
+
text: string;
|
|
993
|
+
};
|
|
1012
994
|
};
|
|
1013
|
-
}
|
|
995
|
+
};
|
|
996
|
+
};
|
|
997
|
+
} & {
|
|
998
|
+
"/:workerId/stop": {
|
|
999
|
+
$post: {
|
|
1014
1000
|
output: {
|
|
1015
1001
|
workerId: string;
|
|
1016
1002
|
state: "stopping" | "terminated";
|
|
@@ -1024,11 +1010,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1024
1010
|
} & {
|
|
1025
1011
|
json: Record<string, never>;
|
|
1026
1012
|
};
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
} & {
|
|
1030
|
-
"/:workerId/destroy": {
|
|
1031
|
-
$post: {
|
|
1013
|
+
} | {
|
|
1032
1014
|
output: {
|
|
1033
1015
|
error: string;
|
|
1034
1016
|
code?: "invalid_input" | undefined;
|
|
@@ -1040,11 +1022,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1040
1022
|
workerId: string;
|
|
1041
1023
|
};
|
|
1042
1024
|
} & {
|
|
1043
|
-
json:
|
|
1044
|
-
discardWork?: true | undefined;
|
|
1045
|
-
};
|
|
1025
|
+
json: Record<string, never>;
|
|
1046
1026
|
};
|
|
1047
|
-
}
|
|
1027
|
+
};
|
|
1028
|
+
};
|
|
1029
|
+
} & {
|
|
1030
|
+
"/:workerId/destroy": {
|
|
1031
|
+
$post: {
|
|
1048
1032
|
output: {
|
|
1049
1033
|
workerId: string;
|
|
1050
1034
|
state: "complete" | "incomplete";
|
|
@@ -1073,6 +1057,22 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1073
1057
|
discardWork?: true | undefined;
|
|
1074
1058
|
};
|
|
1075
1059
|
};
|
|
1060
|
+
} | {
|
|
1061
|
+
output: {
|
|
1062
|
+
error: string;
|
|
1063
|
+
code?: "invalid_input" | undefined;
|
|
1064
|
+
};
|
|
1065
|
+
outputFormat: "json";
|
|
1066
|
+
status: 400;
|
|
1067
|
+
input: {
|
|
1068
|
+
param: {
|
|
1069
|
+
workerId: string;
|
|
1070
|
+
};
|
|
1071
|
+
} & {
|
|
1072
|
+
json: {
|
|
1073
|
+
discardWork?: true | undefined;
|
|
1074
|
+
};
|
|
1075
|
+
};
|
|
1076
1076
|
} | {
|
|
1077
1077
|
output: {
|
|
1078
1078
|
workerId: string;
|
|
@@ -1108,11 +1108,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1108
1108
|
"/:workerId/summary": {
|
|
1109
1109
|
$post: {
|
|
1110
1110
|
output: {
|
|
1111
|
-
|
|
1112
|
-
|
|
1111
|
+
workerId: string;
|
|
1112
|
+
revision: number;
|
|
1113
|
+
source: "assistant" | "failure";
|
|
1114
|
+
seq: number;
|
|
1115
|
+
totalLines: number;
|
|
1116
|
+
offset: number;
|
|
1117
|
+
lineCount: number;
|
|
1118
|
+
text: string;
|
|
1119
|
+
nextOffset?: number | undefined;
|
|
1113
1120
|
};
|
|
1114
1121
|
outputFormat: "json";
|
|
1115
|
-
status:
|
|
1122
|
+
status: 200;
|
|
1116
1123
|
input: {
|
|
1117
1124
|
param: {
|
|
1118
1125
|
workerId: string;
|
|
@@ -1125,18 +1132,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1125
1132
|
};
|
|
1126
1133
|
} | {
|
|
1127
1134
|
output: {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
source: "assistant" | "failure";
|
|
1131
|
-
seq: number;
|
|
1132
|
-
totalLines: number;
|
|
1133
|
-
offset: number;
|
|
1134
|
-
lineCount: number;
|
|
1135
|
-
text: string;
|
|
1136
|
-
nextOffset?: number | undefined;
|
|
1135
|
+
error: string;
|
|
1136
|
+
code?: "invalid_input" | undefined;
|
|
1137
1137
|
};
|
|
1138
1138
|
outputFormat: "json";
|
|
1139
|
-
status:
|
|
1139
|
+
status: 400;
|
|
1140
1140
|
input: {
|
|
1141
1141
|
param: {
|
|
1142
1142
|
workerId: string;
|
|
@@ -1153,11 +1153,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1153
1153
|
"/:workerId/diff": {
|
|
1154
1154
|
$get: {
|
|
1155
1155
|
output: {
|
|
1156
|
-
|
|
1157
|
-
|
|
1156
|
+
workerId: string;
|
|
1157
|
+
baselineSha: string;
|
|
1158
|
+
diff: string;
|
|
1159
|
+
truncated: boolean;
|
|
1158
1160
|
};
|
|
1159
1161
|
outputFormat: "json";
|
|
1160
|
-
status:
|
|
1162
|
+
status: 200;
|
|
1161
1163
|
input: {
|
|
1162
1164
|
param: {
|
|
1163
1165
|
workerId: string;
|
|
@@ -1165,13 +1167,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1165
1167
|
};
|
|
1166
1168
|
} | {
|
|
1167
1169
|
output: {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
diff: string;
|
|
1171
|
-
truncated: boolean;
|
|
1170
|
+
error: string;
|
|
1171
|
+
code?: "invalid_input" | undefined;
|
|
1172
1172
|
};
|
|
1173
1173
|
outputFormat: "json";
|
|
1174
|
-
status:
|
|
1174
|
+
status: 400;
|
|
1175
1175
|
input: {
|
|
1176
1176
|
param: {
|
|
1177
1177
|
workerId: string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared connected-host admission check and bounded response reader
|
|
3
|
+
* (`packages/cezar/src/features/hosts/admission.ts`, hearsay-tools/squawk#4541).
|
|
4
|
+
*
|
|
5
|
+
* Used by the host gateway, the host task index reader, and host task search so all three enforce
|
|
6
|
+
* the exact same rule: the host is saved in `<config>/hosts.json` with the expected fingerprint,
|
|
7
|
+
* the supervisor tracks that same fingerprint, its state is `connected`, and a live loopback
|
|
8
|
+
* tunnel port is present. An absent supervisor entry is never treated as connected.
|
|
9
|
+
*/
|
|
10
|
+
import type { HostEntry, HostState } from '../../contract/index.js';
|
|
11
|
+
import type { Home } from '../../home/home.ts';
|
|
12
|
+
import { type HostRuntimeSnapshot } from './supervisor.ts';
|
|
13
|
+
export interface HostAdmissionSupervisor {
|
|
14
|
+
getState(hostId: string): HostRuntimeSnapshot | undefined;
|
|
15
|
+
getTunnelPort(hostId: string): number | undefined;
|
|
16
|
+
getTrackedFingerprint(hostId: string): string | undefined;
|
|
17
|
+
}
|
|
18
|
+
export type ConnectedHostTunnelResolution = {
|
|
19
|
+
ok: true;
|
|
20
|
+
localPort: number;
|
|
21
|
+
} | {
|
|
22
|
+
ok: false;
|
|
23
|
+
state: HostState;
|
|
24
|
+
reason: 'fingerprint-mismatch' | 'not-connected';
|
|
25
|
+
};
|
|
26
|
+
export type SavedHostAdmissionResult = {
|
|
27
|
+
ok: true;
|
|
28
|
+
entry: HostEntry;
|
|
29
|
+
localPort: number;
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
state: HostState;
|
|
33
|
+
reason: 'registry-warning' | 'missing' | 'fingerprint-mismatch' | 'not-connected';
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Single admission check shared by the gateway, `/api/v1/hosts/projects`, the host task index
|
|
37
|
+
* reader, and host task search: the supervisor must track the same entry fingerprint, report
|
|
38
|
+
* `connected`, and hold a live loopback tunnel port. An absent supervisor entry is never treated
|
|
39
|
+
* as connected, and the fingerprint check can never be skipped.
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveConnectedHostTunnel(entry: HostEntry, supervisor: HostAdmissionSupervisor | undefined): ConnectedHostTunnelResolution;
|
|
42
|
+
/**
|
|
43
|
+
* Verify before issuing any request to a host that it is still saved in `<config>/hosts.json`
|
|
44
|
+
* with `expectedFingerprint`, and that its supervisor tracks the same fingerprint and holds a
|
|
45
|
+
* connected tunnel port.
|
|
46
|
+
*/
|
|
47
|
+
export declare function verifySavedHostConnected(home: Home, hostId: string, expectedFingerprint: string, supervisor: HostAdmissionSupervisor | undefined): SavedHostAdmissionResult;
|
|
48
|
+
/**
|
|
49
|
+
* Read a response body as UTF-8 text up to `maxBytes`. Cancels the stream and returns `undefined`
|
|
50
|
+
* if `Content-Length` or streamed bytes exceed `maxBytes`, or if the stream errors/aborts.
|
|
51
|
+
*/
|
|
52
|
+
export declare function readResponseTextBounded(res: Response, maxBytes: number): Promise<string | undefined>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { getHostById } from './registry.js';
|
|
2
|
+
import { hostEntryFingerprint } from './supervisor.js';
|
|
3
|
+
/**
|
|
4
|
+
* Single admission check shared by the gateway, `/api/v1/hosts/projects`, the host task index
|
|
5
|
+
* reader, and host task search: the supervisor must track the same entry fingerprint, report
|
|
6
|
+
* `connected`, and hold a live loopback tunnel port. An absent supervisor entry is never treated
|
|
7
|
+
* as connected, and the fingerprint check can never be skipped.
|
|
8
|
+
*/
|
|
9
|
+
export function resolveConnectedHostTunnel(entry, supervisor) {
|
|
10
|
+
if (!supervisor) {
|
|
11
|
+
return { ok: false, state: 'unreachable', reason: 'not-connected' };
|
|
12
|
+
}
|
|
13
|
+
const trackedFingerprint = supervisor.getTrackedFingerprint(entry.id);
|
|
14
|
+
if (trackedFingerprint !== hostEntryFingerprint(entry)) {
|
|
15
|
+
return { ok: false, state: 'unreachable', reason: 'fingerprint-mismatch' };
|
|
16
|
+
}
|
|
17
|
+
const snapshot = supervisor.getState(entry.id);
|
|
18
|
+
const state = snapshot?.state ?? 'unreachable';
|
|
19
|
+
const localPort = supervisor.getTunnelPort(entry.id);
|
|
20
|
+
if (state !== 'connected' || localPort === undefined) {
|
|
21
|
+
return { ok: false, state, reason: 'not-connected' };
|
|
22
|
+
}
|
|
23
|
+
return { ok: true, localPort };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Verify before issuing any request to a host that it is still saved in `<config>/hosts.json`
|
|
27
|
+
* with `expectedFingerprint`, and that its supervisor tracks the same fingerprint and holds a
|
|
28
|
+
* connected tunnel port.
|
|
29
|
+
*/
|
|
30
|
+
export function verifySavedHostConnected(home, hostId, expectedFingerprint, supervisor) {
|
|
31
|
+
const loaded = getHostById(home, hostId);
|
|
32
|
+
if (loaded.httpWarning !== undefined) {
|
|
33
|
+
return { ok: false, state: 'unreachable', reason: 'registry-warning' };
|
|
34
|
+
}
|
|
35
|
+
if (!loaded.host) {
|
|
36
|
+
return { ok: false, state: 'unreachable', reason: 'missing' };
|
|
37
|
+
}
|
|
38
|
+
if (hostEntryFingerprint(loaded.host) !== expectedFingerprint) {
|
|
39
|
+
return { ok: false, state: 'unreachable', reason: 'fingerprint-mismatch' };
|
|
40
|
+
}
|
|
41
|
+
const resolved = resolveConnectedHostTunnel(loaded.host, supervisor);
|
|
42
|
+
if (!resolved.ok)
|
|
43
|
+
return resolved;
|
|
44
|
+
return { ok: true, entry: loaded.host, localPort: resolved.localPort };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Read a response body as UTF-8 text up to `maxBytes`. Cancels the stream and returns `undefined`
|
|
48
|
+
* if `Content-Length` or streamed bytes exceed `maxBytes`, or if the stream errors/aborts.
|
|
49
|
+
*/
|
|
50
|
+
export async function readResponseTextBounded(res, maxBytes) {
|
|
51
|
+
const declaredLength = res.headers.get('content-length')?.trim();
|
|
52
|
+
if (declaredLength !== undefined && /^\d+$/.test(declaredLength) && Number(declaredLength) > maxBytes) {
|
|
53
|
+
await res.body?.cancel().catch(() => undefined);
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
if (!res.body)
|
|
57
|
+
return undefined;
|
|
58
|
+
const reader = res.body.getReader();
|
|
59
|
+
const chunks = [];
|
|
60
|
+
let totalBytes = 0;
|
|
61
|
+
try {
|
|
62
|
+
for (;;) {
|
|
63
|
+
const next = await reader.read();
|
|
64
|
+
if (next.done)
|
|
65
|
+
break;
|
|
66
|
+
totalBytes += next.value.byteLength;
|
|
67
|
+
if (totalBytes > maxBytes) {
|
|
68
|
+
await reader.cancel().catch(() => undefined);
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
chunks.push(next.value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
await reader.cancel().catch(() => undefined);
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
reader.releaseLock();
|
|
80
|
+
}
|
|
81
|
+
const combined = new Uint8Array(totalBytes);
|
|
82
|
+
let offset = 0;
|
|
83
|
+
for (const chunk of chunks) {
|
|
84
|
+
combined.set(chunk, offset);
|
|
85
|
+
offset += chunk.byteLength;
|
|
86
|
+
}
|
|
87
|
+
return new TextDecoder().decode(combined);
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=admission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admission.js","sourceRoot":"","sources":["../../../src/features/hosts/admission.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAA4B,MAAM,iBAAiB,CAAC;AAoBjF;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAgB,EAChB,UAA+C;IAE/C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IACtE,CAAC;IACD,MAAM,kBAAkB,GAAG,UAAU,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACtE,IAAI,kBAAkB,KAAK,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;QACvD,OAAO,EAAE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C7C,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC7C,OAAO,SAAS,CAAC;IACnB,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;IAC5C,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC;IAC7B,CAAC;IACD,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
import { type IncomingHttpHeaders, type OutgoingHttpHeaders } from 'node:http';
|
|
26
26
|
import { type HostEntry, type HostGatewayErrorCode, type HostState } from '../../contract/index.js';
|
|
27
27
|
import type { Home } from '../../home/home.ts';
|
|
28
|
-
import type
|
|
28
|
+
import { type HostAdmissionSupervisor } from './admission.ts';
|
|
29
|
+
import { type HostRuntimeSnapshot } from './supervisor.ts';
|
|
29
30
|
export declare const GATEWAY_CONNECT_TIMEOUT_MS = 10000;
|
|
30
31
|
/**
|
|
31
32
|
* Maximum idle wait with no write progress while streaming a request body to the upstream.
|
|
@@ -50,8 +51,7 @@ export declare const GATEWAY_REQUEST_HEADER_ALLOWLIST: ReadonlySet<string>;
|
|
|
50
51
|
export declare const GATEWAY_HOP_BY_HOP_HEADERS: ReadonlySet<string>;
|
|
51
52
|
/** Origin-affecting response headers dropped so a remote cannot act on the main origin. */
|
|
52
53
|
export declare const GATEWAY_RESPONSE_HEADER_DENYLIST: ReadonlySet<string>;
|
|
53
|
-
export interface HostGatewaySupervisor {
|
|
54
|
-
getState(hostId: string): HostRuntimeSnapshot | undefined;
|
|
54
|
+
export interface HostGatewaySupervisor extends HostAdmissionSupervisor {
|
|
55
55
|
getTunnelPort(hostId: string): number | undefined;
|
|
56
56
|
ensureConnected(hostId: string, entry?: HostEntry): Promise<HostRuntimeSnapshot | undefined>;
|
|
57
57
|
syncHostEntry?(entry: HostEntry): void;
|
|
@@ -97,6 +97,17 @@ export declare function buildForwardedRequestHeaders(request: Request, localPort
|
|
|
97
97
|
* Adds zero headers of its own.
|
|
98
98
|
*/
|
|
99
99
|
export declare function buildForwardedResponseHeaders(rawHeaders: IncomingHttpHeaders): Headers;
|
|
100
|
+
export interface ConnectedHostRequestOptions {
|
|
101
|
+
signal?: AbortSignal | undefined;
|
|
102
|
+
headers?: Readonly<Record<string, string>> | undefined;
|
|
103
|
+
readHeadersTimeoutMs?: number | undefined;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Send a read-only GET request directly to a connected host's loopback tunnel port using the
|
|
107
|
+
* gateway's exact header allowlist, response header denylist, redirect refusal, and streaming
|
|
108
|
+
* abort teardown. Never calls `ensureConnected`.
|
|
109
|
+
*/
|
|
110
|
+
export declare function forwardToConnectedHost(localPort: number, upstreamPath: string, options?: ConnectedHostRequestOptions): Promise<Response>;
|
|
100
111
|
/** Handle one incoming gateway request to `ALL /api/v1/hosts/:hostId/api/v1/*`. */
|
|
101
112
|
export declare function handleHostGatewayRequest(request: Request, deps: {
|
|
102
113
|
home: Home;
|