aicodeman 0.9.3 → 0.9.5
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/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/update.d.ts +79 -0
- package/dist/types/update.d.ts.map +1 -0
- package/dist/types/update.js +16 -0
- package/dist/types/update.js.map +1 -0
- package/dist/web/middleware/auth.d.ts +18 -0
- package/dist/web/middleware/auth.d.ts.map +1 -1
- package/dist/web/middleware/auth.js +33 -0
- package/dist/web/middleware/auth.js.map +1 -1
- package/dist/web/network-auth-policy.d.ts +38 -0
- package/dist/web/network-auth-policy.d.ts.map +1 -1
- package/dist/web/network-auth-policy.js +108 -0
- package/dist/web/network-auth-policy.js.map +1 -1
- package/dist/web/public/api-client.3adebdc2.js.gz +0 -0
- package/dist/web/public/app.c860ea08.js.gz +0 -0
- package/dist/web/public/{constants.cb6426c4.js → constants.5b68d2de.js} +39 -3
- package/dist/web/public/constants.5b68d2de.js.br +0 -0
- package/dist/web/public/constants.5b68d2de.js.gz +0 -0
- package/dist/web/public/image-input.7cade6a8.js.gz +0 -0
- package/dist/web/public/index.html +22 -4
- package/dist/web/public/index.html.br +0 -0
- package/dist/web/public/index.html.gz +0 -0
- package/dist/web/public/input-cjk.88082175.js.gz +0 -0
- package/dist/web/public/keyboard-accessory.cdfd8c04.js.gz +0 -0
- package/dist/web/public/mobile-handlers.1e2a8ef8.js.gz +0 -0
- package/dist/web/public/mobile.26dc30d6.css.gz +0 -0
- package/dist/web/public/notification-manager.9c984ac2.js.gz +0 -0
- package/dist/web/public/orchestrator-panel.js.gz +0 -0
- package/dist/web/public/{panels-ui.3e304caf.js → panels-ui.5192a2c0.js} +8 -8
- package/dist/web/public/panels-ui.5192a2c0.js.br +0 -0
- package/dist/web/public/panels-ui.5192a2c0.js.gz +0 -0
- package/dist/web/public/ralph-panel.61076370.js.gz +0 -0
- package/dist/web/public/ralph-wizard.52d533d2.js.gz +0 -0
- package/dist/web/public/respawn-ui.5377f958.js.gz +0 -0
- package/dist/web/public/session-ui.3e0cf024.js.gz +0 -0
- package/dist/web/public/{settings-ui.c06be9c3.js → settings-ui.da0621e1.js} +8 -8
- package/dist/web/public/settings-ui.da0621e1.js.br +0 -0
- package/dist/web/public/settings-ui.da0621e1.js.gz +0 -0
- package/dist/web/public/styles.e87cb785.css.gz +0 -0
- package/dist/web/public/subagent-windows.a366a4ad.js.gz +0 -0
- package/dist/web/public/sw.js.gz +0 -0
- package/dist/web/public/terminal-ui.37caa926.js.gz +0 -0
- package/dist/web/public/upload.html.gz +0 -0
- package/dist/web/public/vendor/marked.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-zerolag-input.137ad9f0.js.gz +0 -0
- package/dist/web/public/vendor/xterm.css.gz +0 -0
- package/dist/web/public/vendor/xterm.min.js.gz +0 -0
- package/dist/web/public/voice-input.085e9e73.js.gz +0 -0
- package/dist/web/routes/system-routes.d.ts.map +1 -1
- package/dist/web/routes/system-routes.js +30 -0
- package/dist/web/routes/system-routes.js.map +1 -1
- package/dist/web/routes/ws-routes.d.ts +2 -1
- package/dist/web/routes/ws-routes.d.ts.map +1 -1
- package/dist/web/routes/ws-routes.js +12 -1
- package/dist/web/routes/ws-routes.js.map +1 -1
- package/dist/web/self-update.d.ts +112 -0
- package/dist/web/self-update.d.ts.map +1 -0
- package/dist/web/self-update.js +518 -0
- package/dist/web/self-update.js.map +1 -0
- package/dist/web/server.d.ts +5 -0
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +45 -15
- package/dist/web/server.js.map +1 -1
- package/dist/web/sse-events.d.ts +5 -3
- package/dist/web/sse-events.d.ts.map +1 -1
- package/dist/web/sse-events.js +5 -3
- package/dist/web/sse-events.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/public/constants.cb6426c4.js.br +0 -0
- package/dist/web/public/constants.cb6426c4.js.gz +0 -0
- package/dist/web/public/panels-ui.3e304caf.js.br +0 -0
- package/dist/web/public/panels-ui.3e304caf.js.gz +0 -0
- package/dist/web/public/settings-ui.c06be9c3.js.br +0 -0
- package/dist/web/public/settings-ui.c06be9c3.js.gz +0 -0
|
@@ -27,5 +27,6 @@
|
|
|
27
27
|
*/
|
|
28
28
|
import { FastifyInstance } from 'fastify';
|
|
29
29
|
import type { SessionPort } from '../ports/session-port.js';
|
|
30
|
-
|
|
30
|
+
import { type HostPolicy } from '../network-auth-policy.js';
|
|
31
|
+
export declare function registerWsRoutes(app: FastifyInstance, ctx: SessionPort, getHostPolicy: () => HostPolicy): void;
|
|
31
32
|
//# sourceMappingURL=ws-routes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws-routes.d.ts","sourceRoot":"","sources":["../../../src/web/routes/ws-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"ws-routes.d.ts","sourceRoot":"","sources":["../../../src/web/routes/ws-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAgD,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AA6B1G,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,GAAG,IAAI,CA4J9G"}
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* {"t":"z","c":N,"r":N} — resize terminal
|
|
27
27
|
*/
|
|
28
28
|
import { MAX_INPUT_LENGTH } from '../../config/terminal-limits.js';
|
|
29
|
+
import { isAllowedRequestHost, isAllowedRequestOrigin } from '../network-auth-policy.js';
|
|
29
30
|
/** Micro-batch interval for terminal output (ms). Short enough for low latency,
|
|
30
31
|
* long enough to group Ink's rapid cursor-up redraw sequences into single frames. */
|
|
31
32
|
const WS_BATCH_INTERVAL_MS = 8;
|
|
@@ -46,8 +47,18 @@ const DEC_2026_END = '\x1b[?2026l';
|
|
|
46
47
|
const MAX_WS_PER_SESSION = 5;
|
|
47
48
|
/** Track active WS connections per session for connection limiting. */
|
|
48
49
|
const sessionWsCount = new Map();
|
|
49
|
-
export function registerWsRoutes(app, ctx) {
|
|
50
|
+
export function registerWsRoutes(app, ctx, getHostPolicy) {
|
|
50
51
|
app.get('/ws/sessions/:id/terminal', { websocket: true }, (socket, req) => {
|
|
52
|
+
// Reject cross-site WebSocket hijacking (CSWSH) and DNS-rebinding before doing
|
|
53
|
+
// anything: the upgrade must come from an allowed Host and (when the browser
|
|
54
|
+
// sends one — it always does for WS) a same-site Origin. Writing to this socket
|
|
55
|
+
// injects keystrokes into a --dangerously-skip-permissions agent, so this gate
|
|
56
|
+
// matters even on the default no-password install. See security review H5.
|
|
57
|
+
const policy = getHostPolicy();
|
|
58
|
+
if (!isAllowedRequestHost(req.headers.host, policy) || !isAllowedRequestOrigin(req.headers.origin, policy)) {
|
|
59
|
+
socket.close(4003, 'Forbidden');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
51
62
|
const { id } = req.params;
|
|
52
63
|
const session = ctx.sessions.get(id);
|
|
53
64
|
if (!session) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws-routes.js","sourceRoot":"","sources":["../../../src/web/routes/ws-routes.ts"],"names":[],"mappings":"AAAA;;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AC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-side logic for the in-app self-updater.
|
|
3
|
+
*
|
|
4
|
+
* Powers App Settings → Updates. Codeman is installed as a git clone and run
|
|
5
|
+
* under systemd (Linux) or launchd (macOS); updating means `git checkout <release
|
|
6
|
+
* tag> && npm install && npm run build && restart-the-service`. The hard part is
|
|
7
|
+
* that the update restarts the very process performing it, so the actual work
|
|
8
|
+
* runs in a DETACHED `scripts/self-update.sh` that outlives the restart, writing
|
|
9
|
+
* progress to `dataPath('update-status.json')` which the browser polls across the
|
|
10
|
+
* connection drop.
|
|
11
|
+
*
|
|
12
|
+
* Channel: latest tagged RELEASE (tags look like `codeman@0.9.3`). Dirty trees
|
|
13
|
+
* are auto-stashed (stash left for the user). Detection is manual (a button).
|
|
14
|
+
*
|
|
15
|
+
* Split into PURE helpers (semver/tag parsing, reconcile decision) that are unit
|
|
16
|
+
* tested, and IO wrappers (`getInstallInfo`, `checkForUpdate`, `startUpdate`,
|
|
17
|
+
* `reconcileUpdateOnBoot`) that touch git/network/fs.
|
|
18
|
+
*
|
|
19
|
+
* Related: `src/types/update.ts`, `scripts/self-update.sh`, routes in
|
|
20
|
+
* `src/web/routes/system-routes.ts`.
|
|
21
|
+
*
|
|
22
|
+
* @module web/self-update
|
|
23
|
+
*/
|
|
24
|
+
import type { InstallInfo, SupervisorKind, UpdateCheckResult, UpdateStatus } from '../types/update.js';
|
|
25
|
+
export declare function isInFlight(status: UpdateStatus | null | undefined): boolean;
|
|
26
|
+
export interface ParsedVersion {
|
|
27
|
+
major: number;
|
|
28
|
+
minor: number;
|
|
29
|
+
patch: number;
|
|
30
|
+
/** Non-empty for prereleases like `0.9.3-rc1`. */
|
|
31
|
+
prerelease: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Parse a semver out of a release tag. Accepts `codeman@0.9.3`, `aicodeman@0.9.3`,
|
|
35
|
+
* `v0.9.3`, and bare `0.9.3` (with optional `-prerelease`). Returns null if no
|
|
36
|
+
* `X.Y.Z` is present.
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseVersionFromTag(tag: string): ParsedVersion | null;
|
|
39
|
+
/** Compare two parsed versions. Returns >0 if a>b, <0 if a<b, 0 if equal. A release outranks a prerelease of the same X.Y.Z. */
|
|
40
|
+
export declare function compareVersions(a: ParsedVersion, b: ParsedVersion): number;
|
|
41
|
+
/** True when `latest` is a strictly newer STABLE version than `current`. */
|
|
42
|
+
export declare function isNewerStableVersion(current: string, latest: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* From a list of `refs/tags/...` (or bare tag names), pick the highest STABLE
|
|
45
|
+
* release tag we recognize. Skips prereleases and unrecognized tags.
|
|
46
|
+
*/
|
|
47
|
+
export declare function pickLatestStableTag(tagRefs: string[]): {
|
|
48
|
+
tag: string;
|
|
49
|
+
version: string;
|
|
50
|
+
} | null;
|
|
51
|
+
/** Tags must match this before they're ever passed to the shell. */
|
|
52
|
+
export declare function isValidReleaseTag(tag: string): boolean;
|
|
53
|
+
/** Derive `{owner, repo}` from a GitHub SSH or HTTPS remote URL. */
|
|
54
|
+
export declare function parseGitHubRepo(remoteUrl: string): {
|
|
55
|
+
owner: string;
|
|
56
|
+
repo: string;
|
|
57
|
+
} | null;
|
|
58
|
+
/**
|
|
59
|
+
* PURE boot-time reconcile decision. Given the persisted status, the version the
|
|
60
|
+
* freshly-booted process is actually running, and `now`, return the status to
|
|
61
|
+
* persist — or null to leave it untouched.
|
|
62
|
+
*
|
|
63
|
+
* Rules (see plan "Hardening"):
|
|
64
|
+
* - Terminal phases → untouched.
|
|
65
|
+
* - Only the `restarting` marker (written right before the updater triggers our
|
|
66
|
+
* restart) flips to completed/failed by comparing running version vs. target.
|
|
67
|
+
* - Other in-flight phases are owned by the still-running updater scope — leave
|
|
68
|
+
* them alone so a normal/crash restart mid-update isn't misreported.
|
|
69
|
+
* - A backstop staleness guard fails any in-flight status older than the window.
|
|
70
|
+
*/
|
|
71
|
+
export declare function reconcileStatusDecision(status: UpdateStatus | null, runningVersion: string, now: number): UpdateStatus | null;
|
|
72
|
+
/** Read the persisted status; tolerant of a missing/torn file (returns null). */
|
|
73
|
+
export declare function readUpdateStatus(): UpdateStatus | null;
|
|
74
|
+
/** Write the status atomically (temp + rename — readers never see a torn file). */
|
|
75
|
+
export declare function writeUpdateStatusAtomic(status: UpdateStatus): void;
|
|
76
|
+
/** Reconcile the status file on server boot (call once, early in start()). */
|
|
77
|
+
export declare function reconcileUpdateOnBoot(now?: number): void;
|
|
78
|
+
/**
|
|
79
|
+
* Resolve the repo root from this module's location. Compiled to
|
|
80
|
+
* `dist/web/self-update.js` (or `src/web/self-update.ts` under tsx) → two levels
|
|
81
|
+
* up is the package root that holds `package.json` and `.git`. Matches the
|
|
82
|
+
* `require('../../package.json')` resolution in `server.ts`.
|
|
83
|
+
*/
|
|
84
|
+
export declare function resolveInstallDir(): string;
|
|
85
|
+
/**
|
|
86
|
+
* Detect which init system supervises us. Detection happens HERE (in the running
|
|
87
|
+
* server, which has a rich env) and the result is passed to the updater script —
|
|
88
|
+
* the detached child must not re-probe with a stripped-down environment.
|
|
89
|
+
*/
|
|
90
|
+
export declare function detectSupervisor(): SupervisorKind;
|
|
91
|
+
/** Inspect the running install: kind, dir, branch, dirtiness, supervisor, version. */
|
|
92
|
+
export declare function getInstallInfo(): InstallInfo;
|
|
93
|
+
/** Check the configured remote for a newer release than the running version. */
|
|
94
|
+
export declare function checkForUpdate(): Promise<UpdateCheckResult>;
|
|
95
|
+
export type StartUpdateResult = {
|
|
96
|
+
ok: true;
|
|
97
|
+
updateId: string;
|
|
98
|
+
toTag: string;
|
|
99
|
+
toVersion: string | null;
|
|
100
|
+
} | {
|
|
101
|
+
ok: false;
|
|
102
|
+
code: 'disabled' | 'not-git' | 'in-flight' | 'up-to-date' | 'bad-tag' | 'error';
|
|
103
|
+
message: string;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Validate, snapshot the current commit, write the initial status, and spawn the
|
|
107
|
+
* detached updater. Returns immediately — progress is reported via the status file.
|
|
108
|
+
*/
|
|
109
|
+
export declare function startUpdate(): Promise<StartUpdateResult>;
|
|
110
|
+
/** Current status for the polling endpoint; null collapses to an explicit idle. */
|
|
111
|
+
export declare function getUpdateStatusForApi(): UpdateStatus;
|
|
112
|
+
//# sourceMappingURL=self-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self-update.d.ts","sourceRoot":"","sources":["../../src/web/self-update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAWH,OAAO,KAAK,EACV,WAAW,EAEX,cAAc,EACd,iBAAiB,EAEjB,YAAY,EACb,MAAM,oBAAoB,CAAC;AA4B5B,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE3E;AAMD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CASrE;AAED,gIAAgI;AAChI,wBAAgB,eAAe,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,GAAG,MAAM,CAS1E;AAED,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAM7E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAkB9F;AAED,oE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