hinacode 0.1.0-alpha.10 → 0.1.0-alpha.12
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.
|
@@ -15901,7 +15901,9 @@ const Project = Struct({
|
|
|
15901
15901
|
* The GitHub repository the root checks out, as lower-case `owner/name`, then the root's folder inside the repository
|
|
15902
15902
|
* when it is not the top level. Only `projects.list` sets it. Absent without a GitHub `origin`.
|
|
15903
15903
|
*/
|
|
15904
|
-
repository: optionalKey(String$1)
|
|
15904
|
+
repository: optionalKey(String$1),
|
|
15905
|
+
/** Experimental. Opens the project's GitHub pull request links on linear.review instead. */
|
|
15906
|
+
linearReview: Boolean$1.pipe(withDecodingDefaultKey(succeed$3(false)))
|
|
15905
15907
|
});
|
|
15906
15908
|
const WorktreeStatus = Literals(["preparing", "ready", "failed", "removed"]);
|
|
15907
15909
|
const Worktree = Struct({
|
|
@@ -16517,7 +16519,8 @@ const RpcMethods = {
|
|
|
16517
16519
|
id: String$1,
|
|
16518
16520
|
name: optional$6(String$1),
|
|
16519
16521
|
rootPath: optional$6(String$1),
|
|
16520
|
-
setupScript: optional$6(NullOr(String$1))
|
|
16522
|
+
setupScript: optional$6(NullOr(String$1)),
|
|
16523
|
+
linearReview: optional$6(Boolean$1)
|
|
16521
16524
|
}),
|
|
16522
16525
|
Project
|
|
16523
16526
|
),
|
|
@@ -16571,6 +16574,8 @@ const RpcMethods = {
|
|
|
16571
16574
|
Worktree
|
|
16572
16575
|
),
|
|
16573
16576
|
"worktrees.setupLog": rpc(Struct({ id: String$1 }), String$1),
|
|
16577
|
+
/** Kills a setup script still running; the worktree ends `failed`. */
|
|
16578
|
+
"worktrees.stopSetup": rpc(Struct({ id: String$1 }), Void2),
|
|
16574
16579
|
/** The branch's GitHub pull request via `gh`, or null when there is none. */
|
|
16575
16580
|
"worktrees.pullRequest": rpc(Struct({ id: String$1 }), NullOr(PullRequest)),
|
|
16576
16581
|
/** Null when the scope has no base: the thread has no live worktree, or no turn started in a git checkout. */
|
|
@@ -16926,6 +16931,7 @@ const methodKind = {
|
|
|
16926
16931
|
"worktrees.create": "mutation",
|
|
16927
16932
|
"worktrees.remove": "mutation",
|
|
16928
16933
|
"worktrees.setupLog": "read",
|
|
16934
|
+
"worktrees.stopSetup": "mutation",
|
|
16929
16935
|
"worktrees.pullRequest": "read",
|
|
16930
16936
|
"threads.changes": "read",
|
|
16931
16937
|
"threads.archive": "mutation",
|
|
@@ -19003,13 +19009,12 @@ class ThreadBusyError extends TaggedError()("ThreadBusyError", {
|
|
|
19003
19009
|
}
|
|
19004
19010
|
}
|
|
19005
19011
|
const busyReasons = {
|
|
19006
|
-
setup: "its setup script is still running",
|
|
19007
19012
|
turn: "a thread is still running in it",
|
|
19008
19013
|
shared: "another thread still uses it"
|
|
19009
19014
|
};
|
|
19010
19015
|
class WorktreeBusyError extends TaggedError()("WorktreeBusyError", {
|
|
19011
19016
|
path: String$1,
|
|
19012
|
-
reason: Literals(["
|
|
19017
|
+
reason: Literals(["turn", "shared"])
|
|
19013
19018
|
}) {
|
|
19014
19019
|
get message() {
|
|
19015
19020
|
return `Cannot remove ${this.path}: ${busyReasons[this.reason]}`;
|
|
@@ -23017,6 +23022,10 @@ const threadUserSkills = gen(function* () {
|
|
|
23017
23022
|
const sql = yield* SqlClient;
|
|
23018
23023
|
yield* sql`ALTER TABLE thread ADD COLUMN user_skills INTEGER NOT NULL DEFAULT 1 CHECK (user_skills IN (0, 1))`;
|
|
23019
23024
|
});
|
|
23025
|
+
const projectLinearReview = gen(function* () {
|
|
23026
|
+
const sql = yield* SqlClient;
|
|
23027
|
+
yield* sql`ALTER TABLE project ADD COLUMN linear_review INTEGER NOT NULL DEFAULT 0 CHECK (linear_review IN (0, 1))`;
|
|
23028
|
+
});
|
|
23020
23029
|
const run = make$V({});
|
|
23021
23030
|
const runMigrations = run({
|
|
23022
23031
|
loader: fromRecord({
|
|
@@ -23036,7 +23045,8 @@ const runMigrations = run({
|
|
|
23036
23045
|
"15_environments": environments,
|
|
23037
23046
|
"16_thread_queue": threadQueue,
|
|
23038
23047
|
"17_fts_on_completion": ftsOnCompletion,
|
|
23039
|
-
"18_thread_user_skills": threadUserSkills
|
|
23048
|
+
"18_thread_user_skills": threadUserSkills,
|
|
23049
|
+
"19_project_linear_review": projectLinearReview
|
|
23040
23050
|
})
|
|
23041
23051
|
}).pipe(tap$1((ran) => logInfo("migrations ran", ran)));
|
|
23042
23052
|
const setup = effectDiscard(
|
|
@@ -23601,6 +23611,7 @@ const ICON_NAMES = ["favicon.svg", "favicon.png", "favicon.ico", "icon.svg", "ic
|
|
|
23601
23611
|
const ICON_DIRS = ["", "public", "static", "app", "src/app", "assets", "apps/web/public", "apps/web/app"];
|
|
23602
23612
|
const ICON_PATHS = ICON_DIRS.flatMap((dir) => ICON_NAMES.map((name) => join$2(dir, name)));
|
|
23603
23613
|
const ICON_LIMIT_BYTES$1 = 100 * 1024;
|
|
23614
|
+
const ProjectRow = Struct({ ...Project.fields, linearReview: BooleanFromBit });
|
|
23604
23615
|
const make$N = gen(function* () {
|
|
23605
23616
|
const sql = yield* SqlClient;
|
|
23606
23617
|
const fs = yield* FileSystem;
|
|
@@ -23608,12 +23619,12 @@ const make$N = gen(function* () {
|
|
|
23608
23619
|
const github = yield* GitHub;
|
|
23609
23620
|
const findAll$1 = findAll({
|
|
23610
23621
|
Request: Void2,
|
|
23611
|
-
Result:
|
|
23622
|
+
Result: ProjectRow,
|
|
23612
23623
|
execute: () => sql`SELECT * FROM project ORDER BY created_at`
|
|
23613
23624
|
});
|
|
23614
23625
|
const findById = findOneOption({
|
|
23615
23626
|
Request: String$1,
|
|
23616
|
-
Result:
|
|
23627
|
+
Result: ProjectRow,
|
|
23617
23628
|
execute: (id) => sql`SELECT * FROM project WHERE id = ${id}`
|
|
23618
23629
|
});
|
|
23619
23630
|
const get2 = (id) => findById(id).pipe(
|
|
@@ -23638,11 +23649,17 @@ const make$N = gen(function* () {
|
|
|
23638
23649
|
}).pipe(catchTag("PlatformError", () => fail$2(new ProjectRootInvalidError({ rootPath }))));
|
|
23639
23650
|
const insert = (input) => gen(function* () {
|
|
23640
23651
|
const now2 = yield* nowIso;
|
|
23641
|
-
const
|
|
23642
|
-
|
|
23652
|
+
const { linearReview, ...row } = {
|
|
23653
|
+
id: randomUUID(),
|
|
23654
|
+
...input,
|
|
23655
|
+
linearReview: false,
|
|
23656
|
+
createdAt: now2,
|
|
23657
|
+
updatedAt: now2
|
|
23658
|
+
};
|
|
23659
|
+
yield* sql`INSERT INTO project ${sql.insert(row)}`.pipe(
|
|
23643
23660
|
mapError(mapWriteError("projects.create", input.rootPath))
|
|
23644
23661
|
);
|
|
23645
|
-
return
|
|
23662
|
+
return { ...row, linearReview };
|
|
23646
23663
|
});
|
|
23647
23664
|
const create = (input) => gen(function* () {
|
|
23648
23665
|
const rootPath = yield* resolveRoot(input.rootPath);
|
|
@@ -23700,12 +23717,13 @@ const make$N = gen(function* () {
|
|
|
23700
23717
|
name: input.name ?? current.name,
|
|
23701
23718
|
rootPath: input.rootPath ?? current.rootPath,
|
|
23702
23719
|
setupScript: input.setupScript === void 0 ? current.setupScript : input.setupScript,
|
|
23720
|
+
linearReview: input.linearReview ?? current.linearReview,
|
|
23703
23721
|
updatedAt: yield* nowIso
|
|
23704
23722
|
};
|
|
23705
23723
|
yield* sql`
|
|
23706
23724
|
UPDATE project
|
|
23707
23725
|
SET name = ${next.name}, root_path = ${next.rootPath}, setup_script = ${next.setupScript},
|
|
23708
|
-
updated_at = ${next.updatedAt}
|
|
23726
|
+
linear_review = ${next.linearReview ? 1 : 0}, updated_at = ${next.updatedAt}
|
|
23709
23727
|
WHERE id = ${next.id}
|
|
23710
23728
|
`.pipe(mapError(mapWriteError("projects.update", next.rootPath)));
|
|
23711
23729
|
return next;
|
|
@@ -24000,7 +24018,9 @@ const make$L = gen(function* () {
|
|
|
24000
24018
|
HINACODE_BRANCH: worktree.branch
|
|
24001
24019
|
},
|
|
24002
24020
|
extendEnv: true,
|
|
24003
|
-
stdin: "ignore"
|
|
24021
|
+
stdin: "ignore",
|
|
24022
|
+
// Without it, a script that ignores SIGTERM would keep stopSetup waiting forever.
|
|
24023
|
+
forceKillAfter: "3 seconds"
|
|
24004
24024
|
})
|
|
24005
24025
|
);
|
|
24006
24026
|
yield* handle.all.pipe(
|
|
@@ -24028,6 +24048,12 @@ Setup script exited with code ${exitCode}
|
|
|
24028
24048
|
andThen(setStatus(worktree.id, "failed")),
|
|
24029
24049
|
ignore$1
|
|
24030
24050
|
)
|
|
24051
|
+
),
|
|
24052
|
+
onInterrupt(
|
|
24053
|
+
() => appendLog(worktree.id, "\nSetup script was stopped.\n").pipe(
|
|
24054
|
+
andThen(setStatus(worktree.id, "failed")),
|
|
24055
|
+
ignore$1
|
|
24056
|
+
)
|
|
24031
24057
|
)
|
|
24032
24058
|
);
|
|
24033
24059
|
const setups = /* @__PURE__ */ new Map();
|
|
@@ -24039,6 +24065,10 @@ Setup script exited with code ${exitCode}
|
|
|
24039
24065
|
}
|
|
24040
24066
|
return yield* get2(id);
|
|
24041
24067
|
});
|
|
24068
|
+
const stopSetup = (id) => {
|
|
24069
|
+
const running = setups.get(id);
|
|
24070
|
+
return running === void 0 ? void_$1 : interrupt(running);
|
|
24071
|
+
};
|
|
24042
24072
|
const removals = /* @__PURE__ */ new Map();
|
|
24043
24073
|
const findOrphan = (rootPath, checkouts, branch) => gen(function* () {
|
|
24044
24074
|
const checkout2 = (yield* registeredCheckouts(rootPath)).find(
|
|
@@ -24124,9 +24154,6 @@ Setup script exited with code ${exitCode}
|
|
|
24124
24154
|
return yield* publishCurrent(id);
|
|
24125
24155
|
}).pipe(exclusive);
|
|
24126
24156
|
const ensureRemovable = (worktree, owner) => gen(function* () {
|
|
24127
|
-
if (worktree.status === "preparing") {
|
|
24128
|
-
return yield* new WorktreeBusyError({ path: worktree.path, reason: "setup" });
|
|
24129
|
-
}
|
|
24130
24157
|
const users = yield* findUsers(worktree.id).pipe(mapError(persistence("worktrees.remove")));
|
|
24131
24158
|
if (users.some((thread) => isThreadBusy(thread.status))) {
|
|
24132
24159
|
return yield* new WorktreeBusyError({ path: worktree.path, reason: "turn" });
|
|
@@ -24161,9 +24188,11 @@ Setup script exited with code ${exitCode}
|
|
|
24161
24188
|
const worktree = yield* get2(id);
|
|
24162
24189
|
if (worktree.status === "removed") return worktree;
|
|
24163
24190
|
yield* ensureRemovable(worktree, owner);
|
|
24191
|
+
yield* stopSetup(id);
|
|
24192
|
+
const stopped = yield* get2(id);
|
|
24164
24193
|
const { rootPath } = yield* projects.get(worktree.projectId);
|
|
24165
24194
|
const removed = yield* setStatus(id, "removed");
|
|
24166
|
-
const deletion = yield* forkDetach(deleteFiles(rootPath,
|
|
24195
|
+
const deletion = yield* forkDetach(deleteFiles(rootPath, stopped, deleteBranch));
|
|
24167
24196
|
removals.set(removalKey(worktree.projectId, worktree.branch), deletion);
|
|
24168
24197
|
return removed;
|
|
24169
24198
|
});
|
|
@@ -24232,7 +24261,8 @@ Setup script exited with code ${exitCode}
|
|
|
24232
24261
|
defaultBranch,
|
|
24233
24262
|
fetch: fetch2,
|
|
24234
24263
|
renameBranch,
|
|
24235
|
-
whenPrepared
|
|
24264
|
+
whenPrepared,
|
|
24265
|
+
stopSetup
|
|
24236
24266
|
});
|
|
24237
24267
|
});
|
|
24238
24268
|
const layer$s = effect(Worktrees, make$L);
|
|
@@ -42632,6 +42662,7 @@ const handlers = {
|
|
|
42632
42662
|
"worktrees.create": (input) => Worktrees.use((worktrees) => worktrees.create(input)),
|
|
42633
42663
|
"worktrees.remove": ({ id, deleteBranch }) => Worktrees.use((worktrees) => worktrees.remove(id, deleteBranch)),
|
|
42634
42664
|
"worktrees.setupLog": ({ id }) => Worktrees.use((worktrees) => map$3(worktrees.get(id), (w) => w.setupLog)),
|
|
42665
|
+
"worktrees.stopSetup": ({ id }) => Worktrees.use((worktrees) => worktrees.stopSetup(id)),
|
|
42635
42666
|
"worktrees.pullRequest": ({ id }) => Worktrees.use((worktrees) => worktrees.pullRequest(id)),
|
|
42636
42667
|
"threads.changes": ({ threadId, scope: scope2 }) => Threads.use((threads) => threads.changes(threadId, scope2)),
|
|
42637
42668
|
"threads.archive": ({ threadId }) => Threads.use((threads) => threads.archive(threadId)),
|
|
@@ -42666,7 +42697,8 @@ const handlers = {
|
|
|
42666
42697
|
"notifications.askPermission": ({ title, body: body2 }, desktop) => desktop?.askNotificationPermission(title, body2) ?? succeed$3("noAnswer"),
|
|
42667
42698
|
"models.list": ({ provider }) => AgentRunner.use((runner) => runner.listModels(provider)),
|
|
42668
42699
|
"agents.account": ({ provider, accountId }) => AgentLogins.use((logins) => logins.account(provider, accountId)),
|
|
42669
|
-
|
|
42700
|
+
// e2e runs on machines with real, possibly outdated CLIs, whose update toast would cover the UI under test.
|
|
42701
|
+
"agents.updates": () => process.env["HINACODE_SKIP_AGENT_UPDATES"] ? succeed$3([]) : availableUpdates,
|
|
42670
42702
|
"agents.update": ({ provider }) => installUpdate(provider),
|
|
42671
42703
|
"limits.list": () => AgentRunner.use((runner) => runner.limits),
|
|
42672
42704
|
"accounts.list": () => AgentAccounts.use((accounts) => accounts.list),
|
package/out/main/daemon.js
CHANGED
|
@@ -2,7 +2,7 @@ import { mkdirSync, readlinkSync, writeFileSync, readFileSync, rmSync } from "no
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { homedir, hostname } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
-
import { s as serveConfig, h as hydratePath, m as make, a as makeAppLayer, b as succeed, u as unsupported, U as Updates, n as noKeyring, R as RemoteAccess, p as pairingUrl, v as void_ } from "./chunks/shellPath-
|
|
5
|
+
import { s as serveConfig, h as hydratePath, m as make, a as makeAppLayer, b as succeed, u as unsupported, U as Updates, n as noKeyring, R as RemoteAccess, p as pairingUrl, v as void_ } from "./chunks/shellPath-_2pyKB3Q.js";
|
|
6
6
|
import "node:crypto";
|
|
7
7
|
import "node:url";
|
|
8
8
|
import "node:stream";
|
package/out/main/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { existsSync, renameSync } from "node:fs";
|
|
|
2
2
|
import { join, delimiter } from "node:path";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
import { Notification, nativeImage, BrowserWindow, ipcMain, app, dialog, shell, protocol, safeStorage, Menu, net, session } from "electron";
|
|
5
|
-
import { c as sync, d as catchDefect, e as succeed, f as callback, t as timeoutOrElse, g as seconds, T as TaggedError, S as String$1, i as promise, j as tryPromise, k as Struct, o as optional, l as RpcCall, q as decodeUnknownOption, E as EVENT_CHANNEL, r as RPC_CHANNEL, w as isTrustedSender, x as gen, y as getOrUndefined, z as dispatch, A as Environments, B as flatMap, C as catch_, D as all$1, F as map, G as decodeUnknownEffect, H as RpcMethods, I as inlineSource, u as unsupported, J as Events, K as runFork, L as logWarning, M as repeat, N as spaced, O as forkScoped, U as Updates, P as suspend, Q as effect, v as void_, V as ignore, h as hydratePath, W as ATTACHMENT_PROTOCOL, X as GITHUB_ASSET_PROTOCOL, Y as PROJECT_FILE_PROTOCOL, b as succeed$1, Z as Keyring, m as make$1, a as makeAppLayer, _ as isInside, $ as githubAssetId, a0 as GitHub, a1 as externalUrl, a2 as projectFileRequest, a3 as Files, a4 as BROWSER_PARTITION, a5 as lockDownWebview, a6 as isAllowedNavigation } from "./chunks/shellPath-
|
|
5
|
+
import { c as sync, d as catchDefect, e as succeed, f as callback, t as timeoutOrElse, g as seconds, T as TaggedError, S as String$1, i as promise, j as tryPromise, k as Struct, o as optional, l as RpcCall, q as decodeUnknownOption, E as EVENT_CHANNEL, r as RPC_CHANNEL, w as isTrustedSender, x as gen, y as getOrUndefined, z as dispatch, A as Environments, B as flatMap, C as catch_, D as all$1, F as map, G as decodeUnknownEffect, H as RpcMethods, I as inlineSource, u as unsupported, J as Events, K as runFork, L as logWarning, M as repeat, N as spaced, O as forkScoped, U as Updates, P as suspend, Q as effect, v as void_, V as ignore, h as hydratePath, W as ATTACHMENT_PROTOCOL, X as GITHUB_ASSET_PROTOCOL, Y as PROJECT_FILE_PROTOCOL, b as succeed$1, Z as Keyring, m as make$1, a as makeAppLayer, _ as isInside, $ as githubAssetId, a0 as GitHub, a1 as externalUrl, a2 as projectFileRequest, a3 as Files, a4 as BROWSER_PARTITION, a5 as lockDownWebview, a6 as isAllowedNavigation } from "./chunks/shellPath-_2pyKB3Q.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { execFile, spawn } from "node:child_process";
|
|
8
8
|
import { access } from "node:fs/promises";
|
|
@@ -138,6 +138,7 @@ const routes = {
|
|
|
138
138
|
"attachments.read": named,
|
|
139
139
|
"worktrees.remove": owner("worktree", "id"),
|
|
140
140
|
"worktrees.setupLog": owner("worktree", "id"),
|
|
141
|
+
"worktrees.stopSetup": owner("worktree", "id"),
|
|
141
142
|
"worktrees.pullRequest": owner("worktree", "id"),
|
|
142
143
|
"terminal.write": owner("terminal", "id"),
|
|
143
144
|
"terminal.resize": owner("terminal", "id"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hinacode",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.12",
|
|
4
4
|
"description": "Run coding agents on this machine and drive them from the HinaCode desktop or phone app",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"typecheck": "pnpm paraglide && tsc --noEmit -p tsconfig.node.json && tsc --noEmit -p tsconfig.web.json && tsc --noEmit -p tsconfig.web-test.json && tsc --noEmit -p tsconfig.e2e.json",
|
|
29
29
|
"lint": "oxlint",
|
|
30
30
|
"check:specs": "node scripts/tlc.mjs",
|
|
31
|
+
"chart:thread": "node scripts/thread-chart.mjs",
|
|
31
32
|
"format": "oxfmt",
|
|
32
33
|
"test": "vitest run",
|
|
33
34
|
"test:unit": "vitest run --project unit",
|