toolroll 0.9.129 → 0.9.131
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/CHANGELOG.md +44 -0
- package/dist/agent-fence.js +0 -2
- package/dist/agent-state.js +1 -1
- package/dist/agents-board.js +0 -3
- package/dist/assignment.js +4 -3
- package/dist/backup-ui.js +6 -3
- package/dist/bounded-spawn.js +0 -1
- package/dist/browser/manifest.json +57 -0
- package/dist/browser/terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css.br +0 -0
- package/dist/browser/terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css.gz +0 -0
- package/dist/browser/{terminal.js → terminal.8978c8cbb268e1006f4b0be371c2401b58078e6d9f1380f4a5c2a12da843909f.js} +1 -1
- package/dist/browser/terminal.8978c8cbb268e1006f4b0be371c2401b58078e6d9f1380f4a5c2a12da843909f.js.br +0 -0
- package/dist/browser/terminal.8978c8cbb268e1006f4b0be371c2401b58078e6d9f1380f4a5c2a12da843909f.js.gz +0 -0
- package/dist/browser/{workspace.js → workspace.4f5935dc80574baadf1adafd39a08c567fb1fac1323052ca355546622f9b06d2.js} +25 -25
- package/dist/browser/workspace.4f5935dc80574baadf1adafd39a08c567fb1fac1323052ca355546622f9b06d2.js.br +0 -0
- package/dist/browser/workspace.4f5935dc80574baadf1adafd39a08c567fb1fac1323052ca355546622f9b06d2.js.gz +0 -0
- package/dist/browser/{workspace.css → workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css} +1 -1
- package/dist/browser/workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css.br +0 -0
- package/dist/browser/workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css.gz +0 -0
- package/dist/browser-shell.js +271 -25
- package/dist/builder-restart.js +13 -4
- package/dist/builder.js +4 -1
- package/dist/canvas-freshness.js +122 -0
- package/dist/canvas-fs.js +273 -0
- package/dist/canvas-reads.js +747 -0
- package/dist/canvas-state-key.js +45 -0
- package/dist/canvas-state-worker.js +12 -0
- package/dist/central-recovery-stage.js +3 -3
- package/dist/chat-actions.js +26 -0
- package/dist/chat-channel.js +4 -3
- package/dist/chat-follow.js +4 -0
- package/dist/chat-task-actions.js +1 -1
- package/dist/chat-warmth.js +0 -1
- package/dist/check-report.js +0 -6
- package/dist/commit-extract.js +79 -40
- package/dist/companion/access.js +1 -0
- package/dist/companion/actions.js +79 -16
- package/dist/companion/canvas.js +141 -0
- package/dist/companion/chat-origin.js +92 -0
- package/dist/companion/chat.js +571 -0
- package/dist/companion/daemon.js +46 -5
- package/dist/companion/finish.js +51 -0
- package/dist/companion/reads.js +5 -1
- package/dist/companion/schema.js +64 -0
- package/dist/companion/service.js +1 -0
- package/dist/companion/store.js +1 -0
- package/dist/companion/webauthn.js +11 -2
- package/dist/console-instance.js +0 -4
- package/dist/contracts/console-api.js +1 -1
- package/dist/converse.js +0 -1
- package/dist/coordinator.js +1 -1
- package/dist/db-tuning.js +16 -0
- package/dist/desktop-config.js +156 -0
- package/dist/desktop-host.js +6 -152
- package/dist/desktop-update.js +1 -1
- package/dist/discord.js +9 -3
- package/dist/dispatch.js +32 -4
- package/dist/doctor.js +30 -0
- package/dist/evidence.js +49 -3
- package/dist/exec.js +3 -0
- package/dist/finished-task-sql.js +14 -0
- package/dist/flexible-answers.js +0 -1
- package/dist/git-views.js +7 -1
- package/dist/github-read.js +41 -0
- package/dist/guides.js +4 -3
- package/dist/invoke.js +12 -2
- package/dist/lead-doors.js +50 -3
- package/dist/lead-queue-runtime.js +18 -6
- package/dist/lead-queue.js +25 -0
- package/dist/lead-status.js +3 -3
- package/dist/live-backup-change.js +93 -0
- package/dist/live-backup.js +75 -31
- package/dist/live-bus.js +3 -2
- package/dist/live-records.js +0 -1
- package/dist/local-owner.js +0 -1
- package/dist/loop-recovery.js +40 -0
- package/dist/maintenance.js +29 -1
- package/dist/model-choices.js +0 -11
- package/dist/needs-you.js +2 -0
- package/dist/nightly-check.js +0 -3
- package/dist/nightly-github.js +1 -2
- package/dist/notification-retention.js +119 -0
- package/dist/observations.js +0 -1
- package/dist/operate.js +393 -56
- package/dist/planner.js +4 -1
- package/dist/pull-request-flow.js +56 -15
- package/dist/qr.js +0 -25
- package/dist/query-index-schema.js +10 -0
- package/dist/read-executor-worker.js +9 -7
- package/dist/read-executor.js +18 -1
- package/dist/read-worker-connection.js +7 -0
- package/dist/release-adapters.js +63 -48
- package/dist/release-auto.js +17 -13
- package/dist/release-card.js +0 -4
- package/dist/release-cli.js +58 -10
- package/dist/release-next.js +1 -1
- package/dist/release-stops.js +71 -0
- package/dist/release-supersede.js +125 -0
- package/dist/release-supervise.js +90 -0
- package/dist/release.js +265 -42
- package/dist/restore-retirement.js +4 -1
- package/dist/result-review.js +0 -3
- package/dist/retention-ui.js +1 -1
- package/dist/retention.js +14 -21
- package/dist/review-context.js +0 -5
- package/dist/route-rules.js +1 -5
- package/dist/runner.js +36 -1
- package/dist/sandbox-runtime.js +0 -1
- package/dist/scope.js +1 -13
- package/dist/scout.js +4 -7
- package/dist/serve.js +122 -12
- package/dist/server/kit.js +1 -0
- package/dist/server/live.js +9 -2
- package/dist/server/pages.js +3 -2
- package/dist/server/phone-engine-api.js +22 -2
- package/dist/server/render-pages.js +1 -11
- package/dist/server/render-results.js +0 -1
- package/dist/server/render-tasks.js +0 -68
- package/dist/server/route-table.js +1 -1
- package/dist/server/settings-phone.js +32 -9
- package/dist/server/settings-scripts.js +1 -1
- package/dist/server/settings-section-table.js +0 -3
- package/dist/server/settings-sections.js +4 -2
- package/dist/server/settings.js +20 -5
- package/dist/server/terminals.js +2 -1
- package/dist/shutdown-proof.js +29 -0
- package/dist/slack.js +9 -3
- package/dist/sqlite-telemetry.js +26 -14
- package/dist/statement-cache.js +137 -0
- package/dist/store.js +86 -14
- package/dist/structured-output.js +0 -1
- package/dist/style-asset.js +20 -7
- package/dist/tailnet.js +0 -3
- package/dist/task-control.js +5 -0
- package/dist/task-sizing.js +0 -1
- package/dist/task-status.js +1 -1
- package/dist/teams.js +9 -3
- package/dist/teardown-git.js +10 -1
- package/dist/telegram.js +4 -1
- package/dist/toolroll-update-cli.js +19 -3
- package/dist/toolroll-update-ui.js +2 -2
- package/dist/toolroll-update.js +95 -15
- package/dist/up-processes.js +16 -1
- package/dist/up-role-child.js +2 -0
- package/dist/wake-hub.js +15 -6
- package/dist/work-index.js +101 -44
- package/dist/work-reads.js +53 -9
- package/dist/work-snapshots.js +185 -0
- package/dist/worker-statement-cache.js +83 -0
- package/dist/workspace-revision.js +145 -21
- package/package.json +1 -1
- package/dist/companion/webauthn-test-support.js +0 -44
- package/dist/contracts/contract-test.js +0 -55
- package/dist/unfenced-test-support.js +0 -6
- /package/dist/browser/{terminal.css → terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css} +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
export const STATEMENT_CACHE_ENTRIES = 512;
|
|
2
|
+
export const STATEMENT_CACHE_BYTES = 2 * 1024 * 1024;
|
|
3
|
+
export const STATEMENT_CACHE_ENTRY_BYTES = 256 * 1024;
|
|
4
|
+
const SETTINGS = new Set(['setReadBigInts', 'setReturnArrays', 'setAllowBareNamedParameters', 'setAllowUnknownNamedParameters']);
|
|
5
|
+
const lead = (sql) => sql.replace(/^(?:\s|--[^\n]*(?:\n|$)|\/\*[\s\S]*?\*\/)+/, '');
|
|
6
|
+
export const transientSql = (sql) => /\btemp\s*\.|\bCREATE\s+TEMP(?:ORARY)?\b|\bso_work_ranked_\d+\b/i.test(sql);
|
|
7
|
+
export const schemaChanging = (sql) => sql.split(';').some(part => /^(?:CREATE|DROP|ALTER|VACUUM|REINDEX|ANALYZE)\b/i.test(lead(part)) && !transientSql(part));
|
|
8
|
+
export class StatementCache {
|
|
9
|
+
compile;
|
|
10
|
+
limits;
|
|
11
|
+
#entries = new Map();
|
|
12
|
+
#bytes = 0;
|
|
13
|
+
stats = { hits: 0, misses: 0, bypassed: 0, entries: 0, bytes: 0, cleared: 0 };
|
|
14
|
+
constructor(compile, limits = { entries: STATEMENT_CACHE_ENTRIES, bytes: STATEMENT_CACHE_BYTES, entryBytes: STATEMENT_CACHE_ENTRY_BYTES }) {
|
|
15
|
+
this.compile = compile;
|
|
16
|
+
this.limits = limits;
|
|
17
|
+
}
|
|
18
|
+
prepare(sql) {
|
|
19
|
+
if (schemaChanging(sql)) {
|
|
20
|
+
this.stats.bypassed++;
|
|
21
|
+
return this.#clearingOnRun(this.compile(sql));
|
|
22
|
+
}
|
|
23
|
+
const bytes = Buffer.byteLength(sql);
|
|
24
|
+
if (bytes > this.limits.entryBytes || transientSql(sql)) {
|
|
25
|
+
this.stats.bypassed++;
|
|
26
|
+
return this.compile(sql);
|
|
27
|
+
}
|
|
28
|
+
const found = this.#entries.get(sql);
|
|
29
|
+
if (found !== undefined) {
|
|
30
|
+
if (found.running > 0) {
|
|
31
|
+
this.stats.bypassed++;
|
|
32
|
+
return this.compile(sql);
|
|
33
|
+
}
|
|
34
|
+
this.stats.hits++;
|
|
35
|
+
this.#entries.delete(sql);
|
|
36
|
+
this.#entries.set(sql, found);
|
|
37
|
+
return this.#handle(sql, found);
|
|
38
|
+
}
|
|
39
|
+
this.stats.misses++;
|
|
40
|
+
const statement = this.compile(sql);
|
|
41
|
+
const entry = { statement, bytes, running: 0 };
|
|
42
|
+
this.#entries.set(sql, entry);
|
|
43
|
+
this.#bytes += bytes;
|
|
44
|
+
this.#evict();
|
|
45
|
+
this.#count();
|
|
46
|
+
return this.#handle(sql, entry);
|
|
47
|
+
}
|
|
48
|
+
prepareUncached(sql) {
|
|
49
|
+
this.stats.bypassed++;
|
|
50
|
+
return schemaChanging(sql) ? this.#clearingOnRun(this.compile(sql)) : this.compile(sql);
|
|
51
|
+
}
|
|
52
|
+
executed(sql) { if (schemaChanging(sql))
|
|
53
|
+
this.clear(); }
|
|
54
|
+
clear() {
|
|
55
|
+
if (this.#entries.size > 0)
|
|
56
|
+
this.stats.cleared++;
|
|
57
|
+
this.#entries.clear();
|
|
58
|
+
this.#bytes = 0;
|
|
59
|
+
this.#count();
|
|
60
|
+
}
|
|
61
|
+
get size() { return this.#entries.size; }
|
|
62
|
+
get bytes() { return this.#bytes; }
|
|
63
|
+
#count() { this.stats.entries = this.#entries.size; this.stats.bytes = this.#bytes; }
|
|
64
|
+
#evict() {
|
|
65
|
+
for (const [sql, entry] of this.#entries) {
|
|
66
|
+
if (this.#entries.size <= this.limits.entries && this.#bytes <= this.limits.bytes)
|
|
67
|
+
break;
|
|
68
|
+
this.#entries.delete(sql);
|
|
69
|
+
this.#bytes -= entry.bytes;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
#handle(sql, entry) {
|
|
73
|
+
let own = null;
|
|
74
|
+
const guarded = (call) => {
|
|
75
|
+
if (own !== null)
|
|
76
|
+
return call(own);
|
|
77
|
+
if (entry.running > 0)
|
|
78
|
+
return call(this.compile(sql));
|
|
79
|
+
entry.running++;
|
|
80
|
+
try {
|
|
81
|
+
return call(entry.statement);
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
entry.running--;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const methods = {
|
|
88
|
+
run: (...params) => guarded(target => target.run(...params)),
|
|
89
|
+
get: (...params) => guarded(target => target.get(...params)),
|
|
90
|
+
all: (...params) => guarded(target => target.all(...params)),
|
|
91
|
+
iterate: (...params) => (own ?? this.compile(sql)).iterate(...params),
|
|
92
|
+
};
|
|
93
|
+
return new Proxy(methods, {
|
|
94
|
+
get: (target, property) => {
|
|
95
|
+
if (Object.hasOwn(target, property))
|
|
96
|
+
return Reflect.get(target, property);
|
|
97
|
+
if (typeof property === 'string' && SETTINGS.has(property)) {
|
|
98
|
+
return (...args) => {
|
|
99
|
+
own ??= this.compile(sql);
|
|
100
|
+
return own[property].apply(own, args);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const statement = own ?? entry.statement;
|
|
104
|
+
const value = Reflect.get(statement, property, statement);
|
|
105
|
+
return typeof value === 'function' ? value.bind(statement) : value;
|
|
106
|
+
},
|
|
107
|
+
has: (target, property) => Reflect.has(target, property) || Reflect.has(own ?? entry.statement, property),
|
|
108
|
+
getPrototypeOf: () => Object.getPrototypeOf(entry.statement),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
#clearingOnRun(statement) {
|
|
112
|
+
const after = (body) => { try {
|
|
113
|
+
return body();
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
this.clear();
|
|
117
|
+
} };
|
|
118
|
+
return new Proxy(statement, {
|
|
119
|
+
get: (target, property) => {
|
|
120
|
+
if (property === 'run' || property === 'get' || property === 'all' || property === 'iterate') {
|
|
121
|
+
const method = Reflect.get(target, property, target);
|
|
122
|
+
return (...params) => after(() => method.apply(target, params));
|
|
123
|
+
}
|
|
124
|
+
const value = Reflect.get(target, property, target);
|
|
125
|
+
return typeof value === 'function' ? value.bind(target) : value;
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
export function prepareUncached(db, sql) {
|
|
131
|
+
const own = db.prepareUncached;
|
|
132
|
+
return typeof own === 'function' ? own.call(db, sql) : db.prepare(sql);
|
|
133
|
+
}
|
|
134
|
+
export function statementCacheStats(db) {
|
|
135
|
+
const stats = db.statementCacheStats;
|
|
136
|
+
return typeof stats === 'function' ? stats.call(db) : null;
|
|
137
|
+
}
|
package/dist/store.js
CHANGED
|
@@ -35,13 +35,14 @@ import { V173_ADDED_COLUMNS, V173_STEPS } from "./plan-problems-schema.js";
|
|
|
35
35
|
import { V175_OBJECTS, V175_SCHEMA, V175_STEPS } from "./flexible-interactive-schema.js";
|
|
36
36
|
import { V176_ADDED_COLUMNS, V176_STEPS, V176_SCHEMA, V176_OBJECTS } from "./subagent-backup-schema.js";
|
|
37
37
|
import { V178_STEPS, V178_SCHEMA, V178_INDEX } from "./check-recovery-index-schema.js";
|
|
38
|
+
import { V190_DROPPED_INDEXES, V190_INDEXES, V190_SCHEMA, V190_STEPS } from "./query-index-schema.js";
|
|
38
39
|
import { V180_SCHEMA, V180_STEPS } from "./agent-change-schema.js";
|
|
39
40
|
import { V181_REQUIRED_COLUMNS, V181_SCHEMA, V181_STEPS, V181_TABLES, V182_REQUIRED_COLUMNS, V182_SCHEMA, V182_STEPS, V182_TABLES, V183_ADDED_COLUMNS, V183_STEPS, V184_ADDED_COLUMNS, V184_STEPS } from "./direct-chat-schema.js";
|
|
40
41
|
import { V177_STEPS, V177_SCHEMA, V177_OBJECTS, WORKSPACE_ID_PATTERN, RECOVERY_GENERATION_PATTERN } from "./workspace-identity-schema.js";
|
|
41
42
|
import { V174_OBJECTS, V174_SCHEMA, V174_STEPS } from "./flexible-everyday-schema.js";
|
|
42
43
|
import { V185_OBJECTS, V185_SCHEMA, V185_STEPS } from "./flexible-conversation-schema.js";
|
|
43
44
|
import { V186_OBJECTS, V186_SCHEMA, V186_STEPS } from "./skill-library-schema.js";
|
|
44
|
-
import { adoptLegacyCompanion, companionPasskeyShapeProblem, companionShapeProblem, V187_STEPS, V188_SCHEMA, V188_STEPS } from "./companion/schema.js";
|
|
45
|
+
import { adoptCompanionChatOrigin, adoptLegacyCompanion, companionChatShapeProblem, companionPasskeyShapeProblem, companionShapeProblem, V187_STEPS, V188_SCHEMA, V188_STEPS, V189_STEPS } from "./companion/schema.js";
|
|
45
46
|
import { endThreadAuthorityFor } from "./flexible-authority-end.js";
|
|
46
47
|
import { relayCancel } from "./flexible-relay-cancel.js";
|
|
47
48
|
import { endLapsedFlexible } from "./flexible.js";
|
|
@@ -54,6 +55,7 @@ import { isLifecycleNotification, isTelegramProgressNotification, LIFECYCLE_KEY_
|
|
|
54
55
|
import { chatTablesShared, convertChatTables, legacyAppTables, legacyChatProblem, legacyChatTablesPresent } from "./chat-migration.js";
|
|
55
56
|
import { ServerTelemetry } from "./server-telemetry.js";
|
|
56
57
|
import { instrumentDatabase, measureWriteWait } from "./sqlite-telemetry.js";
|
|
58
|
+
import { tuneConnection } from "./db-tuning.js";
|
|
57
59
|
import { trackWorkspaceWrites } from "./workspace-revision.js";
|
|
58
60
|
import { parseStoreColumn, readStoreColumn, readStoreStringifiedList, readStoreTextList } from "./contracts/store-json.js";
|
|
59
61
|
import { assessmentFromSavedEvidence, verificationEvidence } from "./verification-evidence.js";
|
|
@@ -848,7 +850,7 @@ export function checkSuitesOf(value) {
|
|
|
848
850
|
}
|
|
849
851
|
}
|
|
850
852
|
const REGISTERED_AT_FILING = "again, as it was filed";
|
|
851
|
-
export const SCHEMA_VERSION =
|
|
853
|
+
export const SCHEMA_VERSION = 190;
|
|
852
854
|
export const V179_STEPS = Object.freeze(["antigravity-provider"]);
|
|
853
855
|
export const V118_MERGED_TABLES = Object.freeze({ api_token: "person", coordinator_credential: "coordinator", lead_credential: "lead" });
|
|
854
856
|
const V118_REFERENCES = /REFERENCES (?:coordinator_credential\(cid\)|api_token\(id\))/g;
|
|
@@ -914,7 +916,7 @@ export const V115_DROPPED_TABLES = Object.freeze([
|
|
|
914
916
|
"fallback_config", "fallback_cycle", "fallback_transition",
|
|
915
917
|
]);
|
|
916
918
|
const V115_DROPPED_REFERENCES = /\s+REFERENCES (?:contestant|contest|tournament_terms|session_turn|attended_authorization|held_session|fallback_cycle|fallback_config|fallback_transition|routine|routine_fire)\(id\)(?: ON DELETE CASCADE)?/g;
|
|
917
|
-
export const UPDATE_SAFE_MIGRATIONS = Object.freeze([108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188]);
|
|
919
|
+
export const UPDATE_SAFE_MIGRATIONS = Object.freeze([108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190]);
|
|
918
920
|
export const V119_ADDED_COLUMNS = Object.freeze({
|
|
919
921
|
task_ref: { planning_generation: { definition: "INTEGER NOT NULL DEFAULT 0", saved: "0" } },
|
|
920
922
|
run: { planning_generation: { definition: "INTEGER NOT NULL DEFAULT 0", saved: "0" } },
|
|
@@ -1457,7 +1459,7 @@ export { V156_STEPS };
|
|
|
1457
1459
|
export { V157_STEPS };
|
|
1458
1460
|
export { V158_STEPS };
|
|
1459
1461
|
export { V159_STEPS };
|
|
1460
|
-
export { V160_STEPS, V161_STEPS, V162_STEPS, V163_STEPS, V164_STEPS, V165_STEPS, V166_STEPS, V167_STEPS, V168_STEPS, V169_STEPS, V170_STEPS, V171_STEPS, V172_STEPS, V173_STEPS, V174_STEPS, V175_STEPS, V176_STEPS, V177_STEPS, V178_STEPS, V180_STEPS, V181_STEPS, V182_STEPS, V183_STEPS, V184_STEPS, V185_STEPS, V186_STEPS, V187_STEPS, V188_STEPS };
|
|
1462
|
+
export { V160_STEPS, V161_STEPS, V162_STEPS, V163_STEPS, V164_STEPS, V165_STEPS, V166_STEPS, V167_STEPS, V168_STEPS, V169_STEPS, V170_STEPS, V171_STEPS, V172_STEPS, V173_STEPS, V174_STEPS, V175_STEPS, V176_STEPS, V177_STEPS, V178_STEPS, V180_STEPS, V181_STEPS, V182_STEPS, V183_STEPS, V184_STEPS, V185_STEPS, V186_STEPS, V187_STEPS, V188_STEPS, V189_STEPS, V190_STEPS };
|
|
1461
1463
|
export const RELEASE_ONCE_SCHEMA = `
|
|
1462
1464
|
CREATE TABLE IF NOT EXISTS release_authority (
|
|
1463
1465
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -4030,7 +4032,7 @@ CREATE TABLE IF NOT EXISTS run_process_summary (
|
|
|
4030
4032
|
|
|
4031
4033
|
CREATE INDEX IF NOT EXISTS task_by_state ON task (state);
|
|
4032
4034
|
CREATE INDEX IF NOT EXISTS edge_by_blocker ON task_edge (blocker);
|
|
4033
|
-
|
|
4035
|
+
-- claim_by_task (task_ref, lease_generation DESC) duplicated UNIQUE (task_ref, lease_generation); v190 dropped it.
|
|
4034
4036
|
CREATE INDEX IF NOT EXISTS hold_by_task ON hold (task_ref);
|
|
4035
4037
|
CREATE INDEX IF NOT EXISTS run_stop_by_task ON run_stop (task_ref, requested_at DESC);
|
|
4036
4038
|
`;
|
|
@@ -4041,18 +4043,20 @@ export function databasePath(env, home) {
|
|
|
4041
4043
|
return namedPath(configBase(env, home), ["orders.db"]);
|
|
4042
4044
|
}
|
|
4043
4045
|
export const CONCURRENT_WRITER_WAIT_MS = 15_000;
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
+
export const BRIEF_WRITER_WAIT_MS = 500;
|
|
4047
|
+
const briefBudgets = new WeakMap();
|
|
4048
|
+
function waitForConcurrentWriter(db, waitMs = CONCURRENT_WRITER_WAIT_MS) {
|
|
4049
|
+
db.exec(`PRAGMA busy_timeout = ${waitMs}`);
|
|
4046
4050
|
}
|
|
4047
4051
|
const WRITE_WAIT_SLICE_MS = 100;
|
|
4048
4052
|
export function isDatabaseBusy(error) {
|
|
4049
4053
|
const code = error?.errcode;
|
|
4050
4054
|
return typeof code === "number" && (code & 0xff) === 5;
|
|
4051
4055
|
}
|
|
4052
|
-
function beginWriteWithin(db, budgetMs) {
|
|
4053
|
-
measureWriteWait(db, () => beginWriteAttempt(db, budgetMs));
|
|
4056
|
+
function beginWriteWithin(db, budgetMs, restoreMs = CONCURRENT_WRITER_WAIT_MS) {
|
|
4057
|
+
measureWriteWait(db, () => beginWriteAttempt(db, budgetMs, restoreMs));
|
|
4054
4058
|
}
|
|
4055
|
-
function beginWriteAttempt(db, budgetMs) {
|
|
4059
|
+
function beginWriteAttempt(db, budgetMs, restoreMs = CONCURRENT_WRITER_WAIT_MS) {
|
|
4056
4060
|
const deadline = performance.now() + budgetMs;
|
|
4057
4061
|
db.exec(`PRAGMA busy_timeout = ${WRITE_WAIT_SLICE_MS}`);
|
|
4058
4062
|
try {
|
|
@@ -4068,7 +4072,7 @@ function beginWriteAttempt(db, budgetMs) {
|
|
|
4068
4072
|
}
|
|
4069
4073
|
}
|
|
4070
4074
|
finally {
|
|
4071
|
-
waitForConcurrentWriter(db);
|
|
4075
|
+
waitForConcurrentWriter(db, restoreMs);
|
|
4072
4076
|
}
|
|
4073
4077
|
}
|
|
4074
4078
|
export function openStore(file, options = {}) {
|
|
@@ -4246,7 +4250,7 @@ function initializeStore(db, file, options = {}) {
|
|
|
4246
4250
|
throw new Error(`${file}: ${problem}; refusing to move chat history it cannot name`);
|
|
4247
4251
|
}
|
|
4248
4252
|
if (preflight === SCHEMA_VERSION && !findingSourcesStale(db)) {
|
|
4249
|
-
const missing = codeMapShapeProblem(db) ?? viewPreferenceShapeProblem(db) ?? flexibleTermsShapeProblem(db) ?? flexibleThreadShapeProblem(db) ?? typedByPersonShapeProblem(db) ?? flexibleTurnsShapeProblem(db) ?? flexibleLaunchShapeProblem(db) ?? flexibleRelayShapeProblem(db) ?? flexibleAnswersShapeProblem(db) ?? flexibleShipShapeProblem(db) ?? taskSizingShapeProblem(db) ?? agentSaidShapeProblem(db) ?? flexibleSettingShapeProblem(db) ?? flexibleSignInShapeProblem(db) ?? planProblemsShapeProblem(db) ?? flexibleEverydayShapeProblem(db) ?? flexibleInteractiveShapeProblem(db) ?? subagentBackupShapeProblem(db) ?? workspaceIdentityShapeProblem(db) ?? pendingAgentChangeShapeProblem(db) ?? directChatShapeProblem(db) ?? directChatPhase1bShapeProblem(db) ?? directChatHardeningShapeProblem(db) ?? flexibleConversationShapeProblem(db) ?? skillLibraryShapeProblem(db) ?? companionShapeProblem(db) ?? companionPasskeyShapeProblem(db);
|
|
4253
|
+
const missing = codeMapShapeProblem(db) ?? viewPreferenceShapeProblem(db) ?? flexibleTermsShapeProblem(db) ?? flexibleThreadShapeProblem(db) ?? typedByPersonShapeProblem(db) ?? flexibleTurnsShapeProblem(db) ?? flexibleLaunchShapeProblem(db) ?? flexibleRelayShapeProblem(db) ?? flexibleAnswersShapeProblem(db) ?? flexibleShipShapeProblem(db) ?? taskSizingShapeProblem(db) ?? agentSaidShapeProblem(db) ?? flexibleSettingShapeProblem(db) ?? flexibleSignInShapeProblem(db) ?? planProblemsShapeProblem(db) ?? flexibleEverydayShapeProblem(db) ?? flexibleInteractiveShapeProblem(db) ?? subagentBackupShapeProblem(db) ?? workspaceIdentityShapeProblem(db) ?? pendingAgentChangeShapeProblem(db) ?? directChatShapeProblem(db) ?? directChatPhase1bShapeProblem(db) ?? directChatHardeningShapeProblem(db) ?? flexibleConversationShapeProblem(db) ?? skillLibraryShapeProblem(db) ?? companionShapeProblem(db) ?? companionPasskeyShapeProblem(db) ?? companionChatShapeProblem(db) ?? queryIndexShapeProblem(db);
|
|
4250
4254
|
if (missing !== null)
|
|
4251
4255
|
throw new Error(`${file}: refusing to open — ${missing}, though the schema says v${SCHEMA_VERSION}`);
|
|
4252
4256
|
db.exec("PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON;");
|
|
@@ -4771,6 +4775,34 @@ CREATE INDEX IF NOT EXISTS run_checkpoint_by_task ON run_checkpoint (task_ref, i
|
|
|
4771
4775
|
throw new Error(`${file}: refusing to open — ${error.message}`);
|
|
4772
4776
|
throw error;
|
|
4773
4777
|
}
|
|
4778
|
+
db.exec("BEGIN IMMEDIATE");
|
|
4779
|
+
try {
|
|
4780
|
+
adoptCompanionChatOrigin(db);
|
|
4781
|
+
const chatDamaged = companionChatShapeProblem(db);
|
|
4782
|
+
if (chatDamaged !== null)
|
|
4783
|
+
throw new Error(`${file}: refusing to open — ${chatDamaged}`);
|
|
4784
|
+
step("companion-chat-origin");
|
|
4785
|
+
db.exec("COMMIT");
|
|
4786
|
+
}
|
|
4787
|
+
catch (error) {
|
|
4788
|
+
db.exec("ROLLBACK");
|
|
4789
|
+
if (error instanceof Error && !error.message.startsWith(`${file}:`) && /unknown shape|missing/.test(error.message))
|
|
4790
|
+
throw new Error(`${file}: refusing to open — ${error.message}`);
|
|
4791
|
+
throw error;
|
|
4792
|
+
}
|
|
4793
|
+
db.exec("BEGIN IMMEDIATE");
|
|
4794
|
+
try {
|
|
4795
|
+
db.exec(V190_SCHEMA);
|
|
4796
|
+
const indexesDamaged = queryIndexShapeProblem(db);
|
|
4797
|
+
if (indexesDamaged !== null)
|
|
4798
|
+
throw new Error(`${file}: refusing to open — ${indexesDamaged}`);
|
|
4799
|
+
step("query-indexes");
|
|
4800
|
+
db.exec("COMMIT");
|
|
4801
|
+
}
|
|
4802
|
+
catch (error) {
|
|
4803
|
+
db.exec("ROLLBACK");
|
|
4804
|
+
throw error;
|
|
4805
|
+
}
|
|
4774
4806
|
if (!fresh)
|
|
4775
4807
|
reclaimDatabase(db, "migration");
|
|
4776
4808
|
const expectedMarker = preflight < 0 ? preflight : -preflight;
|
|
@@ -5665,7 +5697,8 @@ export class Store {
|
|
|
5665
5697
|
db;
|
|
5666
5698
|
constructor(db) {
|
|
5667
5699
|
this.telemetry = new ServerTelemetry();
|
|
5668
|
-
|
|
5700
|
+
tuneConnection(db);
|
|
5701
|
+
this.db = instrumentDatabase(trackWorkspaceWrites(db), this.telemetry, { cacheStatements: true });
|
|
5669
5702
|
lockStoreMoneyMethods(this);
|
|
5670
5703
|
rememberStoredHostAliases(this.db);
|
|
5671
5704
|
}
|
|
@@ -6142,7 +6175,8 @@ export class Store {
|
|
|
6142
6175
|
transact(body) {
|
|
6143
6176
|
if (this.transacting)
|
|
6144
6177
|
return body();
|
|
6145
|
-
|
|
6178
|
+
const budget = briefBudgets.get(this.db) ?? CONCURRENT_WRITER_WAIT_MS;
|
|
6179
|
+
beginWriteWithin(this.db, budget, budget);
|
|
6146
6180
|
this.transacting = true;
|
|
6147
6181
|
let result;
|
|
6148
6182
|
try {
|
|
@@ -19741,3 +19775,41 @@ function skillLibraryShapeProblem(db) {
|
|
|
19741
19775
|
}
|
|
19742
19776
|
return null;
|
|
19743
19777
|
}
|
|
19778
|
+
function queryIndexShapeProblem(db) {
|
|
19779
|
+
for (const [name, table, ddl] of V190_INDEXES) {
|
|
19780
|
+
const row = db.prepare("SELECT type, tbl_name, sql FROM sqlite_master WHERE name = ?").get(name);
|
|
19781
|
+
if (row === undefined)
|
|
19782
|
+
return `the query index ${name} is missing`;
|
|
19783
|
+
if (row["type"] !== "index" || row["tbl_name"] !== table || canonicalDdl(String(row["sql"]).replace(/;$/, "")).trim() !== canonicalDdl(ddl).trim())
|
|
19784
|
+
return `the query index ${name} has an unknown shape`;
|
|
19785
|
+
}
|
|
19786
|
+
for (const name of V190_DROPPED_INDEXES) {
|
|
19787
|
+
if (db.prepare("SELECT 1 FROM sqlite_master WHERE name = ?").get(name) !== undefined)
|
|
19788
|
+
return `the duplicate index ${name} is still here`;
|
|
19789
|
+
}
|
|
19790
|
+
return null;
|
|
19791
|
+
}
|
|
19792
|
+
export function briefly(store, body, budgetMs = BRIEF_WRITER_WAIT_MS) {
|
|
19793
|
+
const db = store.raw();
|
|
19794
|
+
if (briefBudgets.has(db) || db.isTransaction === true)
|
|
19795
|
+
return body();
|
|
19796
|
+
briefBudgets.set(db, budgetMs);
|
|
19797
|
+
db.exec(`PRAGMA busy_timeout = ${budgetMs}`);
|
|
19798
|
+
try {
|
|
19799
|
+
return body();
|
|
19800
|
+
}
|
|
19801
|
+
finally {
|
|
19802
|
+
briefBudgets.delete(db);
|
|
19803
|
+
waitForConcurrentWriter(db);
|
|
19804
|
+
}
|
|
19805
|
+
}
|
|
19806
|
+
export function watchLeaseRow(store, runner, repo) {
|
|
19807
|
+
const row = store.handle.prepare("SELECT owner, generation, expires_at FROM watch_lease WHERE runner = ? AND repo = ?").get(runner, repo);
|
|
19808
|
+
return row === undefined ? null : { owner: String(row["owner"]), generation: Number(row["generation"]), expiresAt: String(row["expires_at"]) };
|
|
19809
|
+
}
|
|
19810
|
+
export function reviveWatchLease(store, runner, repo, owner, generation, ttlMs, now) {
|
|
19811
|
+
const { changes } = store.handle
|
|
19812
|
+
.prepare("UPDATE watch_lease SET expires_at = ?, heartbeat_at = ? WHERE runner = ? AND repo = ? AND owner = ? AND generation = ?")
|
|
19813
|
+
.run(new Date(now.getTime() + Math.min(ttlMs, MAX_WATCH_LEASE_MS)).toISOString(), now.toISOString(), runner, repo, owner, generation);
|
|
19814
|
+
return Number(changes) > 0;
|
|
19815
|
+
}
|
|
@@ -4,7 +4,6 @@ export const STRUCTURED_REPAIR_ATTEMPTS = 2;
|
|
|
4
4
|
export const STRUCTURED_REPAIR_MAX_TURNS = 4;
|
|
5
5
|
export const STRUCTURED_REPAIR_TIMEOUT_MS = 5 * 60_000;
|
|
6
6
|
export const REVIEW_OUTPUT_LIMITS = { comments: 40, criteria: 12, note: TEXT_LIMITS.reviewNote, path: TEXT_LIMITS.reviewPath };
|
|
7
|
-
export const REVIEW_NOTE_CODE_POINTS = Math.floor(REVIEW_OUTPUT_LIMITS.note / 2);
|
|
8
7
|
export function normalizeStructuredJson(raw) {
|
|
9
8
|
let text = raw;
|
|
10
9
|
const changes = [];
|
package/dist/style-asset.js
CHANGED
|
@@ -8,13 +8,7 @@ export function styleAsset(css) {
|
|
|
8
8
|
return {
|
|
9
9
|
path,
|
|
10
10
|
serve(request, response) {
|
|
11
|
-
const
|
|
12
|
-
const [name, ...params] = value.trim().toLowerCase().split(";");
|
|
13
|
-
const quality = params.find(p => p.trim().startsWith("q="));
|
|
14
|
-
return { name, q: quality === undefined ? 1 : Number(quality.trim().slice(2)) };
|
|
15
|
-
});
|
|
16
|
-
const gzip = encodings.find(e => e.name === "gzip") ?? encodings.find(e => e.name === "*");
|
|
17
|
-
const compressed = gzip !== undefined && gzip.q > 0 && gzip.q <= 1;
|
|
11
|
+
const compressed = acceptedEncodings(request.headers["accept-encoding"], ["gzip"]).length > 0;
|
|
18
12
|
const bytes = compressed ? zipped : body;
|
|
19
13
|
const etag = `"${digest}${compressed ? "-gzip" : ""}"`;
|
|
20
14
|
const headers = {
|
|
@@ -37,3 +31,22 @@ export function styleAsset(css) {
|
|
|
37
31
|
},
|
|
38
32
|
};
|
|
39
33
|
}
|
|
34
|
+
function codingsOf(header) {
|
|
35
|
+
return (header ?? "").split(",").map(value => {
|
|
36
|
+
const [name, ...params] = value.trim().toLowerCase().split(";");
|
|
37
|
+
const quality = params.find(p => p.trim().startsWith("q="));
|
|
38
|
+
return { name: (name ?? "").trim(), q: quality === undefined ? 1 : Number(quality.trim().slice(2)) };
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export function acceptedEncodings(header, offered) {
|
|
42
|
+
const encodings = codingsOf(header);
|
|
43
|
+
return offered.filter(coding => {
|
|
44
|
+
const named = encodings.find(e => e.name === coding) ?? encodings.find(e => e.name === "*");
|
|
45
|
+
return named !== undefined && named.q > 0 && named.q <= 1;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export function identityAccepted(header) {
|
|
49
|
+
const encodings = codingsOf(header);
|
|
50
|
+
const named = encodings.find(e => e.name === "identity") ?? encodings.find(e => e.name === "*");
|
|
51
|
+
return named === undefined || (named.q > 0 && named.q <= 1);
|
|
52
|
+
}
|
package/dist/tailnet.js
CHANGED
|
@@ -58,9 +58,6 @@ export function tailnetIpv4Of(statusJson) {
|
|
|
58
58
|
}
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
|
-
export async function readTailnetIpv4(runner = run, platform = process.platform) {
|
|
62
|
-
return (await readTailnetStatus(runner, platform)).ipv4;
|
|
63
|
-
}
|
|
64
61
|
export async function readTailnetStatus(runner = run, platform = process.platform) {
|
|
65
62
|
const candidates = ["tailscale", ...(platform === "darwin" && existsSync(MAC_APP_CLI) ? [MAC_APP_CLI] : [])];
|
|
66
63
|
let found = false;
|
package/dist/task-control.js
CHANGED
|
@@ -60,6 +60,8 @@ export function requestTaskStop(store, request, now) {
|
|
|
60
60
|
if (ref === null || store.getTask(request.taskId) === null) {
|
|
61
61
|
return { ok: false, reason: "no-task", detail: `no task \`${request.taskId}\`` };
|
|
62
62
|
}
|
|
63
|
+
if (request.via === "phone")
|
|
64
|
+
return { ok: false, reason: "not-live", detail: PHONE_STOP_LATER };
|
|
63
65
|
const asked = store.requestRunStop({ runId: request.runId, taskRef: ref.id, by: request.by, via: request.via }, now);
|
|
64
66
|
if (!asked.ok)
|
|
65
67
|
return asked;
|
|
@@ -78,6 +80,8 @@ export function resumeTaskStop(store, request, now) {
|
|
|
78
80
|
if (ref === null || store.getTask(request.taskId) === null) {
|
|
79
81
|
return { ok: false, reason: "no-task", detail: `no task \`${request.taskId}\`` };
|
|
80
82
|
}
|
|
83
|
+
if (request.via === "phone")
|
|
84
|
+
return { ok: false, reason: "review", detail: PHONE_STOP_LATER };
|
|
81
85
|
const run = store.getRun(request.runId);
|
|
82
86
|
if (run !== null && run.worktree !== null && request.occupied !== undefined) {
|
|
83
87
|
const held = request.occupied(run.worktree);
|
|
@@ -136,3 +140,4 @@ export function taskControlOf(store, taskRef, now) {
|
|
|
136
140
|
}
|
|
137
141
|
return { kind: "none" };
|
|
138
142
|
}
|
|
143
|
+
export const PHONE_STOP_LATER = "Stop or resume this task on your Mac. It can't be done from the iPhone app yet.";
|
package/dist/task-sizing.js
CHANGED
|
@@ -129,7 +129,6 @@ export function ownerSizer(fetcher = fetch, keyOf = () => readProviderKey("openr
|
|
|
129
129
|
export function availableSizer(keyOf = () => readProviderKey("openrouter")) {
|
|
130
130
|
return keyOf() === null ? "claude" : "jev";
|
|
131
131
|
}
|
|
132
|
-
export const SIZER_WORDS = { claude: "Claude Haiku, on your plan", jev: "Jev via OpenRouter, your credit" };
|
|
133
132
|
export async function classifyTask(input, sizer, budgetMs = SIZING_BUDGET_MS) {
|
|
134
133
|
if (sizer === null)
|
|
135
134
|
return heuristicSizing(input);
|
package/dist/task-status.js
CHANGED
|
@@ -282,7 +282,7 @@ export function statusOf(facts) {
|
|
|
282
282
|
}
|
|
283
283
|
export const taskStatusOf = statusOf;
|
|
284
284
|
const ALWAYS_NEEDS = new Set(["planner-source", "signed-out", "needs-approval", "waiting-decision", "decision-queue"]);
|
|
285
|
-
const QUEUED_REASONS = new Set(["worker-at-capacity", "waiting-dependency", "retry-scheduled", "plan-retry", "updating", "planning-ready", "scouting-ready", "provider-quota"]);
|
|
285
|
+
const QUEUED_REASONS = new Set(["worker-at-capacity", "watch-stalled", "waiting-dependency", "retry-scheduled", "plan-retry", "updating", "planning-ready", "scouting-ready", "provider-quota"]);
|
|
286
286
|
export function plainReasonOf(stage, code, detail) {
|
|
287
287
|
if (stage === "building" || stage === "checking" || stage === "reviewing" || stage === "planning")
|
|
288
288
|
return null;
|
package/dist/teams.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { adapterPolicy } from "./server/route-policy.js";
|
|
2
2
|
import { randomBytes } from "node:crypto";
|
|
3
|
-
import { abortablePause, workChatQueue } from "./chat-follow.js";
|
|
3
|
+
import { abortablePause, busyError, workChatQueue } from "./chat-follow.js";
|
|
4
4
|
import { ChatState } from "./chat-delivery-state.js";
|
|
5
5
|
import { chatObject as object } from "./chat-delivery.js";
|
|
6
6
|
import { loadTeamsCredentials, teamsAccessToken, teamsApi, verifyTeamsToken, TeamsError } from "./teams-api.js";
|
|
@@ -84,8 +84,14 @@ export async function followTeams(options) {
|
|
|
84
84
|
const problem = (message) => state.setProblem(credentials.installation, owner, message);
|
|
85
85
|
const stop = () => { alive = false; };
|
|
86
86
|
options.signal.addEventListener("abort", stop, { once: true });
|
|
87
|
-
const heartbeat = setInterval(() => {
|
|
88
|
-
|
|
87
|
+
const heartbeat = setInterval(() => { try {
|
|
88
|
+
if (!same() || !state.lease(credentials.installation, owner, new Date()))
|
|
89
|
+
stop();
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (!busyError(error))
|
|
93
|
+
stop();
|
|
94
|
+
} }, 10_000);
|
|
89
95
|
const chat = { ...options, identity: credentials, owner, api: teamsApi(credentials, options.fetcher), canNotify: options.notifications, current: same, liveReplies: true };
|
|
90
96
|
try {
|
|
91
97
|
try {
|
package/dist/teardown-git.js
CHANGED
|
@@ -2,7 +2,7 @@ import { spawnSync } from "node:child_process";
|
|
|
2
2
|
import { accessSync, closeSync, constants as fsConstants, existsSync, fstatSync, lstatSync, mkdirSync, mkdtempSync, openSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, symlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
3
3
|
import { randomBytes } from "node:crypto";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
|
-
import { ensureGitViewsRoot, withCheckoutLock } from "./git-views.js";
|
|
5
|
+
import { CheckoutBusy, ensureGitViewsRoot, withCheckoutLock } from "./git-views.js";
|
|
6
6
|
import { gitIncident } from "./git-incident.js";
|
|
7
7
|
import { basename, delimiter, dirname, isAbsolute, join, resolve } from "node:path";
|
|
8
8
|
import { run } from "./exec.js";
|
|
@@ -176,6 +176,8 @@ async function inView(cwd, binding, work, after = true, lockTimeoutMs, doing, gi
|
|
|
176
176
|
}, lockTimeoutMs);
|
|
177
177
|
}
|
|
178
178
|
catch (error) {
|
|
179
|
+
if (error instanceof CheckoutBusy)
|
|
180
|
+
return busyRefusal(error.message);
|
|
179
181
|
return refused(error instanceof Error ? error.message : "the checkout is busy");
|
|
180
182
|
}
|
|
181
183
|
}
|
|
@@ -1195,3 +1197,10 @@ export function checkoutTop(dir, timeoutMs = 10_000) {
|
|
|
1195
1197
|
at = up;
|
|
1196
1198
|
}
|
|
1197
1199
|
}
|
|
1200
|
+
function busyRefusal(why) {
|
|
1201
|
+
const result = { ...refused(why), checkoutBusy: true };
|
|
1202
|
+
return result;
|
|
1203
|
+
}
|
|
1204
|
+
export function checkoutBusy(result) {
|
|
1205
|
+
return result.checkoutBusy === true && refusal(result) !== null;
|
|
1206
|
+
}
|
package/dist/telegram.js
CHANGED
|
@@ -246,7 +246,10 @@ export async function bridgePass(store, options) {
|
|
|
246
246
|
report.pushed = pushed;
|
|
247
247
|
await drainUpdates(store, botId, transport, owner, lease.generation, lease.cursor, clock, report, 0, undefined, options.readProjects, options.conversation);
|
|
248
248
|
if (options.conversation !== undefined && options.readProjects !== undefined) {
|
|
249
|
-
const renew = setInterval(() => {
|
|
249
|
+
const renew = setInterval(() => { try {
|
|
250
|
+
store.acquireBridgeLease(botId, owner, BRIDGE_LEASE_MS, clock());
|
|
251
|
+
}
|
|
252
|
+
catch { } }, 30_000);
|
|
250
253
|
renew.unref?.();
|
|
251
254
|
try {
|
|
252
255
|
await processConversations(store, botId, transport, owner, clock, report, options.readProjects, options.conversation);
|
|
@@ -6,7 +6,7 @@ import { isNewer, latestVersionNow } from "./releases.js";
|
|
|
6
6
|
import { databasePath } from "./store.js";
|
|
7
7
|
import { neverAnswered, unreachableWhy } from "./unreachable.js";
|
|
8
8
|
import { PACKAGE_VERSION } from "./version.js";
|
|
9
|
-
import { currentRuntime, lastCompletedUpdate, machineSystem, readRuntimeUpdate, requestRuntimeUpdateCancel, resumeRuntimeUpdate, retireUpdateJob, startRuntimeRollback, startRuntimeUpdate, } from "./toolroll-update.js";
|
|
9
|
+
import { currentRuntime, driftFact, lastCompletedUpdate, machineSystem, serviceDrift, readRuntimeUpdate, requestRuntimeUpdateCancel, resumeRuntimeUpdate, retireUpdateJob, startRuntimeRollback, startRuntimeUpdate, } from "./toolroll-update.js";
|
|
10
10
|
function sqlite() {
|
|
11
11
|
return createRequire(import.meta.url)("node:sqlite");
|
|
12
12
|
}
|
|
@@ -54,7 +54,7 @@ export async function runUpdateCommand(args, write, deps = {}) {
|
|
|
54
54
|
const stateDir = dirname(databaseFile);
|
|
55
55
|
const actor = value("by") ?? userInfo().username;
|
|
56
56
|
const current = deps.current ?? currentRuntime(PACKAGE_VERSION);
|
|
57
|
-
const system = () => deps.system ?? machineSystem();
|
|
57
|
+
const system = () => deps.system ?? machineSystem(deps.home);
|
|
58
58
|
if (has("status")) {
|
|
59
59
|
const j = readRuntimeUpdate(stateDir);
|
|
60
60
|
write(j ? `${j.kind === "update" ? "Update" : "Rollback"} ${j.from.version} → ${j.to.version}: ${j.phase}. ${j.detail}` : "No update has run here.");
|
|
@@ -126,10 +126,24 @@ export async function runUpdateCommand(args, write, deps = {}) {
|
|
|
126
126
|
return 1;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
const drift = serviceDrift(system().serviceUnit(current, databaseFile), current);
|
|
130
|
+
const driftLine = drift === null ? null : driftFact(drift.service, current);
|
|
131
|
+
if (version === current.version && drift === null) {
|
|
130
132
|
write(`Toolroll ${version} is current.`);
|
|
131
133
|
return 0;
|
|
132
134
|
}
|
|
135
|
+
if (version === current.version) {
|
|
136
|
+
if (!has("yes")) {
|
|
137
|
+
write(driftLine);
|
|
138
|
+
write(`Add --yes to bring them together: Toolroll ${version} is downloaded again and verified as an update is, ${when === "now" ? "refusing if any work is running" : "running work finishes first"}, the database is backed up and rehearsed, and the service and the toolroll command are pointed at it.`);
|
|
139
|
+
return 0;
|
|
140
|
+
}
|
|
141
|
+
if (when === "at")
|
|
142
|
+
write(`Waiting until ${at}. Keep this running.`);
|
|
143
|
+
const outcome = await startRuntimeUpdate({ stateDir, databaseFile, current, actor, version, when, at: at ?? null, realign: true }, system());
|
|
144
|
+
write(outcome.message);
|
|
145
|
+
return outcome.ok ? 0 : 1;
|
|
146
|
+
}
|
|
133
147
|
const downgrade = !isNewer(version, current.version);
|
|
134
148
|
if (downgrade && !has("allow-downgrade")) {
|
|
135
149
|
write(`Toolroll ${version} is older than ${current.version}. Add --allow-downgrade to go back to it.`);
|
|
@@ -142,6 +156,8 @@ export async function runUpdateCommand(args, write, deps = {}) {
|
|
|
142
156
|
}
|
|
143
157
|
if (!has("yes")) {
|
|
144
158
|
write(`Update Toolroll ${current.version} → ${version}.`);
|
|
159
|
+
if (driftLine !== null)
|
|
160
|
+
write(`${driftLine} This update moves both to ${version}.`);
|
|
145
161
|
write(`${when === "now" ? "Refuses if any work is running" : when === "at" ? `Waits until ${at}, then pauses new work and lets running work finish` : "Pauses new work and lets running work finish"}; verifies the package came from ap9000/toolroll's publish workflow; backs up and rehearses the database; keeps ${current.version} for toolroll update --rollback.`);
|
|
146
162
|
write("Add --yes to update.");
|
|
147
163
|
return 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html, joinHtml, postForm } from "./html.js";
|
|
2
2
|
import { STEP_WORDS, UPDATE_STEPS, runtimeUpdateTerminal } from "./toolroll-update.js";
|
|
3
|
-
import { btn, chip, codeLine, disclose, formRow, infoLine, note, notice, radios, settingsRecord, settingsSection } from "./server/kit.js";
|
|
3
|
+
import { btn, chip, codeLine, codeWords, disclose, formRow, infoLine, note, notice, radios, settingsRecord, settingsSection } from "./server/kit.js";
|
|
4
4
|
import { kitSectionForm } from "./settings-kit.js";
|
|
5
5
|
const clock = (iso) => { const d = new Date(iso); return `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`; };
|
|
6
6
|
export const UPDATES_CSS = "";
|
|
@@ -70,7 +70,7 @@ export function updatesHtml(view, said) {
|
|
|
70
70
|
: "";
|
|
71
71
|
const rollback = view.rollbackTo !== null ? joinHtml([note(`To go back to ${view.rollbackTo}:`), codeLine("toolroll update --rollback")]) : "";
|
|
72
72
|
const version = settingsSection({ id: "update", title: state[0], ...(state[2] === "" ? {} : { right: state[2] }),
|
|
73
|
-
body: html `<div data-update-state="${newer ? "available" : "current"}">${joinHtml([answer, state[1] === "" ? "" : note(state[1]), form, rollback])}</div>` });
|
|
73
|
+
body: html `<div data-update-state="${newer ? "available" : "current"}">${joinHtml([answer, view.drift ? html `<div data-runtime-drift>${infoLine(codeWords(view.drift))}</div>` : "", state[1] === "" ? "" : note(state[1]), form, rollback])}</div>` });
|
|
74
74
|
return joinHtml([whatsNew, j ? outcomeHtml(j) : "", version]);
|
|
75
75
|
}
|
|
76
76
|
export function newerThan(a, b) {
|