@staff0rd/assist 0.954.3 → 0.955.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.md +11 -0
- package/dist/commands/sessions/web/bundle.js +458 -455
- package/dist/index.js +62 -6
- package/package.json +8 -2
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.955.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -33,7 +33,11 @@ var package_default = {
|
|
|
33
33
|
"docs:install": "npm ci --prefix docs",
|
|
34
34
|
"docs:build": "npm run --prefix docs build",
|
|
35
35
|
"docs:preview": "tsx src/docs/previewDocs.ts",
|
|
36
|
-
"docs:capture": "tsx src/docs/captureDocs.ts"
|
|
36
|
+
"docs:capture": "tsx src/docs/captureDocs.ts",
|
|
37
|
+
"ios:install": "npm ci --prefix ios-app",
|
|
38
|
+
"ios:build": "npm run build && tsx src/commands/sessions/web/ios/buildIosWeb.ts && npm run --prefix ios-app sync",
|
|
39
|
+
"ios:open": "npm run --prefix ios-app open",
|
|
40
|
+
"ios:run": "npm run --prefix ios-app run"
|
|
37
41
|
},
|
|
38
42
|
overrides: {
|
|
39
43
|
lodash: "^4.18.0",
|
|
@@ -85,6 +89,8 @@ var package_default = {
|
|
|
85
89
|
zod: "^4.3.6"
|
|
86
90
|
},
|
|
87
91
|
devDependencies: {
|
|
92
|
+
"@capacitor/core": "^8.6.0",
|
|
93
|
+
"@capacitor/preferences": "^8.0.1",
|
|
88
94
|
"@electric-sql/pglite": "^0.4.6",
|
|
89
95
|
"@emotion/cache": "^11.14.0",
|
|
90
96
|
"@emotion/react": "^11.14.0",
|
|
@@ -1896,6 +1902,29 @@ function withRepoCwd(line, repoCwd) {
|
|
|
1896
1902
|
}
|
|
1897
1903
|
}
|
|
1898
1904
|
|
|
1905
|
+
// src/commands/sessions/web/isAppOrigin.ts
|
|
1906
|
+
var APP_ORIGIN = "capacitor://localhost";
|
|
1907
|
+
function isAppOrigin(origin) {
|
|
1908
|
+
return origin === APP_ORIGIN;
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
// src/commands/sessions/web/isAllowedSocketOrigin.ts
|
|
1912
|
+
function originHost(origin) {
|
|
1913
|
+
try {
|
|
1914
|
+
return new URL(origin).host;
|
|
1915
|
+
} catch {
|
|
1916
|
+
return void 0;
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
function isAllowedSocketOrigin(req) {
|
|
1920
|
+
const origin = req.headers.origin;
|
|
1921
|
+
const isNonBrowserClient = !origin;
|
|
1922
|
+
if (isNonBrowserClient || isAppOrigin(origin)) return true;
|
|
1923
|
+
const host = originHost(origin);
|
|
1924
|
+
const forwardedHost = req.headers["x-forwarded-host"];
|
|
1925
|
+
return !!host && (host === req.headers.host || typeof forwardedHost === "string" && host === forwardedHost);
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1899
1928
|
// src/commands/sessions/web/restartMenu/releaseWebServerPort.ts
|
|
1900
1929
|
var release;
|
|
1901
1930
|
function onReleaseWebServerPort(fn) {
|
|
@@ -1911,7 +1940,9 @@ function releaseWebServerPort() {
|
|
|
1911
1940
|
function attachSessionSocket(server, ctx) {
|
|
1912
1941
|
const wss = new WebSocketServer({ noServer: true });
|
|
1913
1942
|
server.on("upgrade", (req, socket, head) => {
|
|
1914
|
-
if (req.url === "/ws") {
|
|
1943
|
+
if (req.url === "/ws" && isAllowedSocketOrigin(req)) {
|
|
1944
|
+
if (isAppOrigin(req.headers.origin))
|
|
1945
|
+
console.log(`ws: accepted app origin ${req.headers.origin}`);
|
|
1915
1946
|
wss.handleUpgrade(req, socket, head, (ws) => {
|
|
1916
1947
|
handleSocket(ws, ctx);
|
|
1917
1948
|
});
|
|
@@ -1922,6 +1953,10 @@ function attachSessionSocket(server, ctx) {
|
|
|
1922
1953
|
console.log(
|
|
1923
1954
|
`browser link: refused origin ${req.headers.origin ?? "(none)"}`
|
|
1924
1955
|
);
|
|
1956
|
+
if (req.url === "/ws")
|
|
1957
|
+
console.log(
|
|
1958
|
+
`ws: refused origin ${req.headers.origin} for host ${req.headers.host}`
|
|
1959
|
+
);
|
|
1925
1960
|
socket.destroy();
|
|
1926
1961
|
}
|
|
1927
1962
|
});
|
|
@@ -7683,6 +7718,25 @@ async function handleItemRoute(req, res, pathname) {
|
|
|
7683
7718
|
return false;
|
|
7684
7719
|
}
|
|
7685
7720
|
|
|
7721
|
+
// src/commands/sessions/web/allowAppOrigin.ts
|
|
7722
|
+
function allowAppOrigin(req, res, pathname) {
|
|
7723
|
+
const origin = req.headers.origin;
|
|
7724
|
+
if (!pathname.startsWith("/api/") || !isAppOrigin(origin)) return false;
|
|
7725
|
+
res.setHeader("Access-Control-Allow-Origin", origin);
|
|
7726
|
+
res.setHeader("Vary", "Origin");
|
|
7727
|
+
if (req.method !== "OPTIONS") return false;
|
|
7728
|
+
res.setHeader("Access-Control-Allow-Methods", "GET, POST");
|
|
7729
|
+
res.setHeader(
|
|
7730
|
+
"Access-Control-Allow-Headers",
|
|
7731
|
+
req.headers["access-control-request-headers"] ?? "Content-Type"
|
|
7732
|
+
);
|
|
7733
|
+
res.setHeader("Access-Control-Max-Age", "600");
|
|
7734
|
+
console.log(`app cors: preflight ${pathname} from ${origin}`);
|
|
7735
|
+
res.writeHead(204);
|
|
7736
|
+
res.end();
|
|
7737
|
+
return true;
|
|
7738
|
+
}
|
|
7739
|
+
|
|
7686
7740
|
// src/shared/db/dismissInboxMessage.ts
|
|
7687
7741
|
import { and as and6, eq as eq16, isNull } from "drizzle-orm";
|
|
7688
7742
|
async function dismissInboxMessage(orm, source, messageId) {
|
|
@@ -7874,7 +7928,7 @@ async function proxyToNode(req, res) {
|
|
|
7874
7928
|
|
|
7875
7929
|
// src/commands/sessions/web/handleDynamicRoute.ts
|
|
7876
7930
|
async function handleDynamicRoute(req, res, pathname) {
|
|
7877
|
-
return await proxyToNode(req, res) || await handleInboxRoute(req, res, pathname) || handleItemRoute(req, res, pathname);
|
|
7931
|
+
return allowAppOrigin(req, res, pathname) || await proxyToNode(req, res) || await handleInboxRoute(req, res, pathname) || handleItemRoute(req, res, pathname);
|
|
7878
7932
|
}
|
|
7879
7933
|
|
|
7880
7934
|
// src/commands/sessions/web/harnessCapabilities.ts
|
|
@@ -27832,7 +27886,7 @@ function buildInboxScanArgs(since) {
|
|
|
27832
27886
|
"--output-format",
|
|
27833
27887
|
"json",
|
|
27834
27888
|
"--json-schema",
|
|
27835
|
-
JSON.stringify(z13.toJSONSchema(inboxScanSchema)),
|
|
27889
|
+
JSON.stringify(z13.toJSONSchema(inboxScanSchema, { target: "draft-07" })),
|
|
27836
27890
|
"--",
|
|
27837
27891
|
buildInboxScanPrompt(since)
|
|
27838
27892
|
];
|
|
@@ -27844,12 +27898,14 @@ function parseInboxScanOutput(stdout) {
|
|
|
27844
27898
|
return inboxScanSchema.parse(result.structured_output).messages;
|
|
27845
27899
|
}
|
|
27846
27900
|
async function runInboxScanClaude(since) {
|
|
27847
|
-
const
|
|
27901
|
+
const run4 = execFileAsync11("claude", buildInboxScanArgs(since), {
|
|
27848
27902
|
encoding: "utf8",
|
|
27849
27903
|
windowsHide: true,
|
|
27850
27904
|
timeout: 20 * 6e4,
|
|
27851
27905
|
maxBuffer: 64 * 1024 * 1024
|
|
27852
27906
|
});
|
|
27907
|
+
run4.child.stdin?.end();
|
|
27908
|
+
const { stdout } = await run4;
|
|
27853
27909
|
return parseInboxScanOutput(stdout);
|
|
27854
27910
|
}
|
|
27855
27911
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@staff0rd/assist",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.955.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -27,7 +27,11 @@
|
|
|
27
27
|
"docs:install": "npm ci --prefix docs",
|
|
28
28
|
"docs:build": "npm run --prefix docs build",
|
|
29
29
|
"docs:preview": "tsx src/docs/previewDocs.ts",
|
|
30
|
-
"docs:capture": "tsx src/docs/captureDocs.ts"
|
|
30
|
+
"docs:capture": "tsx src/docs/captureDocs.ts",
|
|
31
|
+
"ios:install": "npm ci --prefix ios-app",
|
|
32
|
+
"ios:build": "npm run build && tsx src/commands/sessions/web/ios/buildIosWeb.ts && npm run --prefix ios-app sync",
|
|
33
|
+
"ios:open": "npm run --prefix ios-app open",
|
|
34
|
+
"ios:run": "npm run --prefix ios-app run"
|
|
31
35
|
},
|
|
32
36
|
"overrides": {
|
|
33
37
|
"lodash": "^4.18.0",
|
|
@@ -79,6 +83,8 @@
|
|
|
79
83
|
"zod": "^4.3.6"
|
|
80
84
|
},
|
|
81
85
|
"devDependencies": {
|
|
86
|
+
"@capacitor/core": "^8.6.0",
|
|
87
|
+
"@capacitor/preferences": "^8.0.1",
|
|
82
88
|
"@electric-sql/pglite": "^0.4.6",
|
|
83
89
|
"@emotion/cache": "^11.14.0",
|
|
84
90
|
"@emotion/react": "^11.14.0",
|