@oar-sh/oar 0.9.18 → 0.9.20
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/.github/extensions/web-relay/polling/polling-loop.mjs +2 -26
- package/.github/extensions/web-relay/server-lifecycle/managed-server.mjs +13 -1
- package/.github/extensions/web-relay/skills/question-routing-hooks.mjs +2 -26
- package/CHANGELOG.md +359 -0
- package/README.md +10 -10
- package/bin/oar.js +391 -97
- package/package.json +4 -2
- package/server/claude-cloud-worker/claude-cloud-event-normalizer.mjs +60 -0
- package/server/claude-cloud-worker/claude-cloud-session-process.mjs +27 -0
- package/server/claude-worker/claude-remote-relay-tool.mjs +3 -2
- package/server/claude-worker/claude-session-process.mjs +3 -0
- package/server/claude-worker/claude-turn-publisher.mjs +163 -8
- package/server/claude-worker/claude-usage-totals.mjs +58 -0
- package/server/copilot-worker/copilot-plan-board.mjs +4 -7
- package/server/copilot-worker/copilot-sdk-event-normalizer.mjs +86 -3
- package/server/copilot-worker/copilot-sdk-session-process.mjs +57 -4
- package/server/cursor-worker/cursor-turn-runner.mjs +42 -6
- package/server/db-schema.mjs +18 -0
- package/server/deepseek-worker/deepseek-claude-backend.mjs +14 -0
- package/server/grok-worker/grok-turn-runner.mjs +44 -6
- package/server/migrations/0001-add-structured-answer.mjs +5 -7
- package/server/migrations/0002-recent-workspace-roots-path-key.mjs +5 -7
- package/server/migrations/0003-push-subscriptions.mjs +5 -7
- package/server/migrations/0004-steer-settle-markers.mjs +5 -7
- package/server/migrations/0005-remote-relays.mjs +5 -7
- package/server/migrations/0006-workspace-root-settings.mjs +5 -7
- package/server/migrations/0007-claude-cloud.mjs +5 -7
- package/server/migrations/0008-message-pins.mjs +5 -7
- package/server/migrations/0009-subagent-timeline.mjs +5 -7
- package/server/migrations/0010-subagent-timeline-pruning.mjs +5 -7
- package/server/migrations/0011-relay-event-subscriptions.mjs +5 -7
- package/server/migrations/0012-cross-relay-event-subscriptions.mjs +5 -7
- package/server/migrations/0013-previews.mjs +5 -7
- package/server/migrations/0014-conversation-groups.mjs +5 -7
- package/server/migrations/0015-conversation-group-position.mjs +5 -7
- package/server/migrations/0016-share-access-log.mjs +5 -7
- package/server/migrations/0017-conversation-history-indexes.mjs +5 -7
- package/server/migrations/0018-background-task-rows.mjs +5 -7
- package/server/migrations/0019-relay-event-subscription-options.mjs +5 -7
- package/server/migrations/0020-conversation-may-create-sessions.mjs +5 -7
- package/server/migrations/0021-conversation-group-agent-marks.mjs +5 -7
- package/server/migrations/0022-relay-schedules.mjs +5 -7
- package/server/migrations/0023-relay-asks.mjs +5 -7
- package/server/migrations/0024-deepseek-usage-totals.mjs +5 -7
- package/server/migrations/0025-deepseek-usage-requests-daily.mjs +5 -7
- package/server/migrations/0026-deepseek-usage-served-models.mjs +5 -7
- package/server/migrations/0027-deepseek-usage-checkpoint-runs.mjs +5 -7
- package/server/migrations/0028-deepseek-usage-checkpoint-request-runs.mjs +5 -7
- package/server/migrations/0029-deepseek-balance-rises.mjs +5 -7
- package/server/migrations/0030-deepseek-usage-actuals.mjs +5 -7
- package/server/migrations/0031-queue-provider.mjs +5 -7
- package/server/migrations/0032-runtime-session-billing-switch.mjs +5 -7
- package/server/migrations/0033-claude-api-usage-checkpoints.mjs +5 -7
- package/server/migrations/0034-claude-api-usage-totals.mjs +5 -7
- package/server/migrations/0035-conversation-plan-only.mjs +87 -0
- package/server/migrations/0036-token-usage.mjs +267 -0
- package/server/public/app/about-view.mjs +87 -3
- package/server/public/app/api-client.js +2 -1
- package/server/public/app/bootstrap.js +55 -2
- package/server/public/app/composer-control-state.mjs +12 -2
- package/server/public/app/context-usage-view.mjs +16 -0
- package/server/public/app/conversation-view.js +17 -2
- package/server/public/app/inbox-ui.js +32 -0
- package/server/public/app/inbox-view.mjs +141 -5
- package/server/public/app/plan-board-shared.mjs +49 -0
- package/server/public/app/plan-usage-view.mjs +1 -1
- package/server/public/app/relay-board-inline.mjs +4 -1
- package/server/public/app/relay-board-view.js +38 -10
- package/server/public/app/relay-event-view.mjs +4 -0
- package/server/public/app/socket-handlers.js +10 -2
- package/server/public/index.html +14 -0
- package/server/public/sw.js +8 -0
- package/server/relay-heap-guard.mjs +351 -0
- package/server/relay-self-restart.mjs +116 -9
- package/server/relay-tools.md +5 -4
- package/server/repositories/message-repository.mjs +31 -1
- package/server/repositories/remote-relay-repository.mjs +10 -0
- package/server/repositories/session-repository.mjs +6 -1
- package/server/routes/messages-routes.mjs +120 -4
- package/server/routes/relay-ask-routes.mjs +138 -8
- package/server/routes/relay-board-routes.mjs +55 -40
- package/server/routes/sessions-routes.mjs +141 -31
- package/server/server-runtime.mjs +142 -11
- package/server/services/about-service.mjs +59 -0
- package/server/services/cache-rebuild-service.mjs +7 -0
- package/server/services/conversation-preferences-service.mjs +31 -0
- package/server/services/database-file.mjs +413 -0
- package/server/services/db-backup-service.mjs +809 -0
- package/server/services/deepseek-usage-import.mjs +6 -9
- package/server/services/delete-archive-service.mjs +3 -0
- package/server/services/earlier-database-service.mjs +69 -126
- package/server/services/oar-cli-helpers.mjs +214 -12
- package/server/services/oar-cli-menu.mjs +1 -0
- package/server/services/oar-state-migration-service.mjs +33 -13
- package/server/services/package-data-rescue.mjs +4 -2
- package/server/services/plan-usage-claude-api.mjs +14 -15
- package/server/services/plan-usage-contract.mjs +6 -2
- package/server/services/plan-usage-deepseek.mjs +1 -1
- package/server/services/plan-usage-tokens.mjs +248 -0
- package/server/services/push-dispatch-service.mjs +134 -9
- package/server/services/relay-cli-launcher-service.mjs +3 -0
- package/server/services/relay-event-service.mjs +30 -0
- package/server/services/relay-question-context.mjs +11 -0
- package/server/services/relay-restart-picture.mjs +67 -22
- package/server/services/remote-inbox-watch-service.mjs +204 -0
- package/server/services/remote-relay-caller-context.mjs +80 -7
- package/server/services/remote-relay-dispatcher.mjs +68 -8
- package/server/services/restart-resume-service.mjs +5 -2
- package/server/services/session-worker-launch-service.mjs +12 -3
- package/server/services/session-worker-stop-service.mjs +27 -6
- package/server/services/token-usage-service.mjs +430 -0
- package/server/services/update-install-service.mjs +13 -0
- package/server/services/usage-limit-pause-service.mjs +8 -1
- package/server/services/worker-scope.mjs +77 -0
- package/shared/plan-board-actions.mjs +130 -0
- package/shared/plan-only.mjs +43 -0
- package/shared/relay-asks.mjs +3 -0
- package/shared/relay-events.mjs +38 -4
- package/shared/remote-relay-contract.mjs +98 -21
- package/shared/turn-token-usage.mjs +144 -0
|
@@ -16,13 +16,14 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Additive and idempotent. Safe to run on every boot.
|
|
18
18
|
*
|
|
19
|
-
* Usage: node server/migrations/0009-subagent-timeline.mjs [path/to/
|
|
19
|
+
* Usage: node server/migrations/0009-subagent-timeline.mjs [path/to/oar.db]
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import { fileURLToPath } from 'url';
|
|
23
23
|
import path from 'path';
|
|
24
24
|
import process from 'process';
|
|
25
25
|
import Database from 'better-sqlite3';
|
|
26
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
26
27
|
|
|
27
28
|
function tableExists(db, name) {
|
|
28
29
|
return !!db
|
|
@@ -104,11 +105,6 @@ export function migrateSubagentTimeline(db) {
|
|
|
104
105
|
};
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
function defaultDbPath() {
|
|
108
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
109
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
110
|
-
}
|
|
111
|
-
|
|
112
108
|
export function migrate(dbPath, options = {}) {
|
|
113
109
|
const db = new Database(dbPath, options);
|
|
114
110
|
try {
|
|
@@ -120,8 +116,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
120
116
|
|
|
121
117
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
122
118
|
if (isMain) {
|
|
123
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
124
119
|
try {
|
|
120
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
121
|
+
// name before 0.9.20); never a new one.
|
|
122
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
125
123
|
const result = migrate(dbPath);
|
|
126
124
|
console.log(`Migration 0009 on ${dbPath}`);
|
|
127
125
|
console.log(result.applied
|
|
@@ -11,13 +11,14 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Additive and idempotent. Safe to run on every boot.
|
|
13
13
|
*
|
|
14
|
-
* Usage: node server/migrations/0010-subagent-timeline-pruning.mjs [path/to/
|
|
14
|
+
* Usage: node server/migrations/0010-subagent-timeline-pruning.mjs [path/to/oar.db]
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { fileURLToPath } from 'url';
|
|
18
18
|
import path from 'path';
|
|
19
19
|
import process from 'process';
|
|
20
20
|
import Database from 'better-sqlite3';
|
|
21
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
21
22
|
|
|
22
23
|
export const PRUNABLE_INDEX_NAME = 'idx_subagent_timeline_prunable';
|
|
23
24
|
|
|
@@ -58,11 +59,6 @@ export function migrateSubagentTimelinePruning(db) {
|
|
|
58
59
|
return { applied: columnsAdded + indexesAdded > 0, columnsAdded, indexesAdded };
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
function defaultDbPath() {
|
|
62
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
63
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
62
|
export function migrate(dbPath, options = {}) {
|
|
67
63
|
const db = new Database(dbPath, options);
|
|
68
64
|
try {
|
|
@@ -74,8 +70,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
74
70
|
|
|
75
71
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
76
72
|
if (isMain) {
|
|
77
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
78
73
|
try {
|
|
74
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
75
|
+
// name before 0.9.20); never a new one.
|
|
76
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
79
77
|
const result = migrate(dbPath);
|
|
80
78
|
console.log(`Migration 0010 on ${dbPath}`);
|
|
81
79
|
console.log(result.applied
|
|
@@ -18,13 +18,14 @@
|
|
|
18
18
|
*
|
|
19
19
|
* Additive and idempotent. Safe to run on every boot.
|
|
20
20
|
*
|
|
21
|
-
* Usage: node server/migrations/0011-relay-event-subscriptions.mjs [path/to/
|
|
21
|
+
* Usage: node server/migrations/0011-relay-event-subscriptions.mjs [path/to/oar.db]
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { fileURLToPath } from 'url';
|
|
25
25
|
import path from 'path';
|
|
26
26
|
import process from 'process';
|
|
27
27
|
import Database from 'better-sqlite3';
|
|
28
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
28
29
|
|
|
29
30
|
function tableExists(db, name) {
|
|
30
31
|
return !!db
|
|
@@ -94,11 +95,6 @@ export function migrateRelayEventSubscriptions(db) {
|
|
|
94
95
|
return { applied: tablesAdded > 0, tablesAdded };
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
function defaultDbPath() {
|
|
98
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
99
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
100
|
-
}
|
|
101
|
-
|
|
102
98
|
export function migrate(dbPath, options = {}) {
|
|
103
99
|
const db = new Database(dbPath, options);
|
|
104
100
|
try {
|
|
@@ -110,8 +106,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
110
106
|
|
|
111
107
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
112
108
|
if (isMain) {
|
|
113
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
114
109
|
try {
|
|
110
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
111
|
+
// name before 0.9.20); never a new one.
|
|
112
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
115
113
|
const result = migrate(dbPath);
|
|
116
114
|
console.log(`Migration 0011 on ${dbPath}`);
|
|
117
115
|
console.log(result.applied
|
|
@@ -21,13 +21,14 @@
|
|
|
21
21
|
*
|
|
22
22
|
* Additive and idempotent. Safe to run on every boot.
|
|
23
23
|
*
|
|
24
|
-
* Usage: node server/migrations/0012-cross-relay-event-subscriptions.mjs [path/to/
|
|
24
|
+
* Usage: node server/migrations/0012-cross-relay-event-subscriptions.mjs [path/to/oar.db]
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
import { fileURLToPath } from 'url';
|
|
28
28
|
import path from 'path';
|
|
29
29
|
import process from 'process';
|
|
30
30
|
import Database from 'better-sqlite3';
|
|
31
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
31
32
|
|
|
32
33
|
const SUBSCRIPTION_COLUMNS = Object.freeze([
|
|
33
34
|
['remote_subscription_id', 'TEXT'],
|
|
@@ -85,11 +86,6 @@ export function migrateCrossRelayEventSubscriptions(db) {
|
|
|
85
86
|
return { applied: columnsAdded > 0 || tablesAdded > 0, columnsAdded, tablesAdded };
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
function defaultDbPath() {
|
|
89
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
90
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
91
|
-
}
|
|
92
|
-
|
|
93
89
|
export function migrate(dbPath, options = {}) {
|
|
94
90
|
const db = new Database(dbPath, options);
|
|
95
91
|
try {
|
|
@@ -101,8 +97,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
101
97
|
|
|
102
98
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
103
99
|
if (isMain) {
|
|
104
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
105
100
|
try {
|
|
101
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
102
|
+
// name before 0.9.20); never a new one.
|
|
103
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
106
104
|
const result = migrate(dbPath);
|
|
107
105
|
console.log(`Migration 0012 on ${dbPath}`);
|
|
108
106
|
console.log(result.applied
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* alone and reported as not compatible; the relay then keeps previews in
|
|
28
28
|
* memory only, it never refuses to start over it.
|
|
29
29
|
*
|
|
30
|
-
* Usage: node server/migrations/0013-previews.mjs [path/to/
|
|
30
|
+
* Usage: node server/migrations/0013-previews.mjs [path/to/oar.db]
|
|
31
31
|
* The file must exist: a wrong path is refused rather than creating an empty
|
|
32
32
|
* database.
|
|
33
33
|
*/
|
|
@@ -37,6 +37,7 @@ import { fileURLToPath } from 'url';
|
|
|
37
37
|
import path from 'path';
|
|
38
38
|
import process from 'process';
|
|
39
39
|
import Database from 'better-sqlite3';
|
|
40
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
40
41
|
|
|
41
42
|
function tableExists(db, name) {
|
|
42
43
|
return !!db
|
|
@@ -94,11 +95,6 @@ export function migratePreviews(db) {
|
|
|
94
95
|
return { applied: tablesAdded > 0, tablesAdded, compatible: true };
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
function defaultDbPath() {
|
|
98
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
99
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
100
|
-
}
|
|
101
|
-
|
|
102
98
|
export function migrate(dbPath, options = {}) {
|
|
103
99
|
if (!fs.existsSync(dbPath)) throw new Error(`no database at ${dbPath}`);
|
|
104
100
|
const db = new Database(dbPath, { fileMustExist: true, ...options });
|
|
@@ -111,8 +107,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
111
107
|
|
|
112
108
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
113
109
|
if (isMain) {
|
|
114
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
115
110
|
try {
|
|
111
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
112
|
+
// name before 0.9.20); never a new one.
|
|
113
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
116
114
|
const result = migrate(dbPath);
|
|
117
115
|
console.log(`Migration 0013 on ${dbPath}`);
|
|
118
116
|
if (!result.compatible) {
|
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Additive and idempotent. Safe to run on every boot.
|
|
15
15
|
*
|
|
16
|
-
* Usage: node server/migrations/0014-conversation-groups.mjs [path/to/
|
|
16
|
+
* Usage: node server/migrations/0014-conversation-groups.mjs [path/to/oar.db]
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { fileURLToPath } from 'url';
|
|
20
20
|
import path from 'path';
|
|
21
21
|
import process from 'process';
|
|
22
22
|
import Database from 'better-sqlite3';
|
|
23
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
23
24
|
|
|
24
25
|
function tableExists(db, name) {
|
|
25
26
|
return !!db
|
|
@@ -58,11 +59,6 @@ export function migrateConversationGroups(db) {
|
|
|
58
59
|
return { applied: columnsAdded > 0 || tablesAdded > 0, columnsAdded, tablesAdded };
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
function defaultDbPath() {
|
|
62
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
63
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
62
|
export function migrate(dbPath, options = {}) {
|
|
67
63
|
const db = new Database(dbPath, options);
|
|
68
64
|
try {
|
|
@@ -74,8 +70,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
74
70
|
|
|
75
71
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
76
72
|
if (isMain) {
|
|
77
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
78
73
|
try {
|
|
74
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
75
|
+
// name before 0.9.20); never a new one.
|
|
76
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
79
77
|
const result = migrate(dbPath);
|
|
80
78
|
console.log(`Migration 0014 on ${dbPath}`);
|
|
81
79
|
console.log(result.applied
|
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
* data change: older code ignores the column; a row it moves out of a group
|
|
14
14
|
* keeps a stale place, which the next run here clears.
|
|
15
15
|
*
|
|
16
|
-
* Usage: node server/migrations/0015-conversation-group-position.mjs [path/to/
|
|
16
|
+
* Usage: node server/migrations/0015-conversation-group-position.mjs [path/to/oar.db]
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { fileURLToPath } from 'url';
|
|
20
20
|
import path from 'path';
|
|
21
21
|
import process from 'process';
|
|
22
22
|
import Database from 'better-sqlite3';
|
|
23
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
23
24
|
|
|
24
25
|
function tableExists(db, name) {
|
|
25
26
|
return !!db
|
|
@@ -45,11 +46,6 @@ export function migrateConversationGroupPosition(db) {
|
|
|
45
46
|
return { applied: columnsAdded > 0 || placesCleared > 0, columnsAdded, placesCleared };
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
function defaultDbPath() {
|
|
49
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
50
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
49
|
export function migrate(dbPath, options = {}) {
|
|
54
50
|
const db = new Database(dbPath, options);
|
|
55
51
|
try {
|
|
@@ -61,8 +57,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
61
57
|
|
|
62
58
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
63
59
|
if (isMain) {
|
|
64
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
65
60
|
try {
|
|
61
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
62
|
+
// name before 0.9.20); never a new one.
|
|
63
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
66
64
|
const result = migrate(dbPath);
|
|
67
65
|
console.log(`Migration 0015 on ${dbPath}`);
|
|
68
66
|
console.log(result.applied
|
|
@@ -25,13 +25,14 @@
|
|
|
25
25
|
* reads the new table, and a share it creates has no lineage, which this build
|
|
26
26
|
* reads as the share's own token.
|
|
27
27
|
*
|
|
28
|
-
* Usage: node server/migrations/0016-share-access-log.mjs [path/to/
|
|
28
|
+
* Usage: node server/migrations/0016-share-access-log.mjs [path/to/oar.db]
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
import { fileURLToPath } from 'url';
|
|
32
32
|
import path from 'path';
|
|
33
33
|
import process from 'process';
|
|
34
34
|
import Database from 'better-sqlite3';
|
|
35
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
35
36
|
|
|
36
37
|
function tableExists(db, name) {
|
|
37
38
|
return !!db
|
|
@@ -79,11 +80,6 @@ export function migrateShareAccessLog(db) {
|
|
|
79
80
|
return { applied: columnsAdded > 0 || tablesAdded > 0 || lineagesSet > 0, columnsAdded, tablesAdded, lineagesSet };
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
function defaultDbPath() {
|
|
83
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
84
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
83
|
export function migrate(dbPath, options = {}) {
|
|
88
84
|
const db = new Database(dbPath, options);
|
|
89
85
|
try {
|
|
@@ -95,8 +91,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
95
91
|
|
|
96
92
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
97
93
|
if (isMain) {
|
|
98
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
99
94
|
try {
|
|
95
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
96
|
+
// name before 0.9.20); never a new one.
|
|
97
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
100
98
|
const result = migrate(dbPath);
|
|
101
99
|
console.log(`Migration 0016 on ${dbPath}`);
|
|
102
100
|
console.log(result.applied
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
* Additive and idempotent. Safe to run on every boot. An older build ignores
|
|
16
16
|
* both indexes.
|
|
17
17
|
*
|
|
18
|
-
* Usage: node server/migrations/0017-conversation-history-indexes.mjs [path/to/
|
|
18
|
+
* Usage: node server/migrations/0017-conversation-history-indexes.mjs [path/to/oar.db]
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
import { fileURLToPath } from 'url';
|
|
22
22
|
import path from 'path';
|
|
23
23
|
import process from 'process';
|
|
24
24
|
import Database from 'better-sqlite3';
|
|
25
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
25
26
|
|
|
26
27
|
function tableExists(db, name) {
|
|
27
28
|
return !!db
|
|
@@ -58,11 +59,6 @@ export function migrateConversationHistoryIndexes(db) {
|
|
|
58
59
|
return { applied: indexesAdded > 0, indexesAdded };
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
function defaultDbPath() {
|
|
62
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
63
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
62
|
export function migrate(dbPath, options = {}) {
|
|
67
63
|
const db = new Database(dbPath, options);
|
|
68
64
|
try {
|
|
@@ -74,8 +70,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
74
70
|
|
|
75
71
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
76
72
|
if (isMain) {
|
|
77
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
78
73
|
try {
|
|
74
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
75
|
+
// name before 0.9.20); never a new one.
|
|
76
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
79
77
|
const result = migrate(dbPath);
|
|
80
78
|
console.log(`Migration 0017 on ${dbPath}`);
|
|
81
79
|
console.log(result.applied
|
|
@@ -23,13 +23,14 @@
|
|
|
23
23
|
* Additive and idempotent. Safe to run on every boot. An older build never
|
|
24
24
|
* reads the table; its consoles start empty after a restart as before.
|
|
25
25
|
*
|
|
26
|
-
* Usage: node server/migrations/0018-background-task-rows.mjs [path/to/
|
|
26
|
+
* Usage: node server/migrations/0018-background-task-rows.mjs [path/to/oar.db]
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
import { fileURLToPath } from 'url';
|
|
30
30
|
import path from 'path';
|
|
31
31
|
import process from 'process';
|
|
32
32
|
import Database from 'better-sqlite3';
|
|
33
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
33
34
|
|
|
34
35
|
export const BACKGROUND_TASK_ROWS_COLUMNS = Object.freeze(['store_key', 'task_id', 'state', 'row_json', 'ended_at', 'updated_at']);
|
|
35
36
|
|
|
@@ -70,11 +71,6 @@ export function migrateBackgroundTaskRows(db) {
|
|
|
70
71
|
return { applied: tablesAdded > 0, tablesAdded };
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
function defaultDbPath() {
|
|
74
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
75
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
76
|
-
}
|
|
77
|
-
|
|
78
74
|
export function migrate(dbPath, options = {}) {
|
|
79
75
|
const db = new Database(dbPath, options);
|
|
80
76
|
try {
|
|
@@ -86,8 +82,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
86
82
|
|
|
87
83
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
88
84
|
if (isMain) {
|
|
89
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
90
85
|
try {
|
|
86
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
87
|
+
// name before 0.9.20); never a new one.
|
|
88
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
91
89
|
const result = migrate(dbPath);
|
|
92
90
|
console.log(`Migration 0018 on ${dbPath}`);
|
|
93
91
|
console.log(result.applied
|
|
@@ -22,13 +22,14 @@
|
|
|
22
22
|
*
|
|
23
23
|
* Additive and idempotent. Safe to run on every boot.
|
|
24
24
|
*
|
|
25
|
-
* Usage: node server/migrations/0019-relay-event-subscription-options.mjs [path/to/
|
|
25
|
+
* Usage: node server/migrations/0019-relay-event-subscription-options.mjs [path/to/oar.db]
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
import { fileURLToPath } from 'url';
|
|
29
29
|
import path from 'path';
|
|
30
30
|
import process from 'process';
|
|
31
31
|
import Database from 'better-sqlite3';
|
|
32
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
32
33
|
|
|
33
34
|
export const RELAY_EVENT_OPTION_COLUMNS = Object.freeze([
|
|
34
35
|
['digest_minutes', 'INTEGER'],
|
|
@@ -75,11 +76,6 @@ export function migrateRelayEventSubscriptionOptions(db) {
|
|
|
75
76
|
return { applied: columnsAdded > 0 || tablesAdded > 0, columnsAdded, tablesAdded };
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
function defaultDbPath() {
|
|
79
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
80
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
79
|
export function migrate(dbPath, options = {}) {
|
|
84
80
|
const db = new Database(dbPath, options);
|
|
85
81
|
try {
|
|
@@ -91,8 +87,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
91
87
|
|
|
92
88
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
93
89
|
if (isMain) {
|
|
94
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
95
90
|
try {
|
|
91
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
92
|
+
// name before 0.9.20); never a new one.
|
|
93
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
96
94
|
const result = migrate(dbPath);
|
|
97
95
|
console.log(`Migration 0019 on ${dbPath}`);
|
|
98
96
|
console.log(result.applied
|
|
@@ -12,13 +12,14 @@
|
|
|
12
12
|
* Additive and idempotent. Safe to run on every boot. Rolling back needs no
|
|
13
13
|
* data change: older code ignores the column and keeps the one-level rule.
|
|
14
14
|
*
|
|
15
|
-
* Usage: node server/migrations/0020-conversation-may-create-sessions.mjs [path/to/
|
|
15
|
+
* Usage: node server/migrations/0020-conversation-may-create-sessions.mjs [path/to/oar.db]
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { fileURLToPath } from 'url';
|
|
19
19
|
import path from 'path';
|
|
20
20
|
import process from 'process';
|
|
21
21
|
import Database from 'better-sqlite3';
|
|
22
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
22
23
|
|
|
23
24
|
function tableExists(db, name) {
|
|
24
25
|
return !!db
|
|
@@ -36,11 +37,6 @@ export function migrateConversationMayCreateSessions(db) {
|
|
|
36
37
|
return { applied: true, columnsAdded: 1 };
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
function defaultDbPath() {
|
|
40
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
41
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
40
|
export function migrate(dbPath, options = {}) {
|
|
45
41
|
const db = new Database(dbPath, options);
|
|
46
42
|
try {
|
|
@@ -52,8 +48,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
52
48
|
|
|
53
49
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
54
50
|
if (isMain) {
|
|
55
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
56
51
|
try {
|
|
52
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
53
|
+
// name before 0.9.20); never a new one.
|
|
54
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
57
55
|
const result = migrate(dbPath);
|
|
58
56
|
console.log(`Migration 0020 on ${dbPath}`);
|
|
59
57
|
console.log(result.applied
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
* data change: older code ignores both columns (its boot repair removes an
|
|
16
16
|
* empty group, as it always did).
|
|
17
17
|
*
|
|
18
|
-
* Usage: node server/migrations/0021-conversation-group-agent-marks.mjs [path/to/
|
|
18
|
+
* Usage: node server/migrations/0021-conversation-group-agent-marks.mjs [path/to/oar.db]
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
import { fileURLToPath } from 'url';
|
|
22
22
|
import path from 'path';
|
|
23
23
|
import process from 'process';
|
|
24
24
|
import Database from 'better-sqlite3';
|
|
25
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
25
26
|
|
|
26
27
|
function tableExists(db, name) {
|
|
27
28
|
return !!db
|
|
@@ -46,11 +47,6 @@ export function migrateConversationGroupAgentMarks(db) {
|
|
|
46
47
|
return { applied: columnsAdded > 0, columnsAdded };
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
function defaultDbPath() {
|
|
50
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
51
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
50
|
export function migrate(dbPath, options = {}) {
|
|
55
51
|
const db = new Database(dbPath, options);
|
|
56
52
|
try {
|
|
@@ -62,8 +58,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
62
58
|
|
|
63
59
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
64
60
|
if (isMain) {
|
|
65
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
66
61
|
try {
|
|
62
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
63
|
+
// name before 0.9.20); never a new one.
|
|
64
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
67
65
|
const result = migrate(dbPath);
|
|
68
66
|
console.log(`Migration 0021 on ${dbPath}`);
|
|
69
67
|
console.log(result.applied
|
|
@@ -26,13 +26,14 @@
|
|
|
26
26
|
*
|
|
27
27
|
* Additive and idempotent. Safe to run on every boot.
|
|
28
28
|
*
|
|
29
|
-
* Usage: node server/migrations/0022-relay-schedules.mjs [path/to/
|
|
29
|
+
* Usage: node server/migrations/0022-relay-schedules.mjs [path/to/oar.db]
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
import { fileURLToPath } from 'url';
|
|
33
33
|
import path from 'path';
|
|
34
34
|
import process from 'process';
|
|
35
35
|
import Database from 'better-sqlite3';
|
|
36
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
36
37
|
|
|
37
38
|
export const RELAY_SCHEDULE_COLUMNS = Object.freeze([
|
|
38
39
|
'id',
|
|
@@ -113,11 +114,6 @@ export function migrateRelaySchedules(db) {
|
|
|
113
114
|
return { applied: tablesAdded > 0 || columnsAdded > 0, tablesAdded, columnsAdded };
|
|
114
115
|
}
|
|
115
116
|
|
|
116
|
-
function defaultDbPath() {
|
|
117
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
118
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
119
|
-
}
|
|
120
|
-
|
|
121
117
|
export function migrate(dbPath, options = {}) {
|
|
122
118
|
const db = new Database(dbPath, options);
|
|
123
119
|
try {
|
|
@@ -129,8 +125,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
129
125
|
|
|
130
126
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
131
127
|
if (isMain) {
|
|
132
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
133
128
|
try {
|
|
129
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
130
|
+
// name before 0.9.20); never a new one.
|
|
131
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
134
132
|
const result = migrate(dbPath);
|
|
135
133
|
console.log(`Migration 0022 on ${dbPath}`);
|
|
136
134
|
console.log(result.applied ? ` relay schedules: tables added ${result.tablesAdded}, columns added ${result.columnsAdded}` : ' skipped: nothing to change');
|
|
@@ -29,13 +29,14 @@
|
|
|
29
29
|
*
|
|
30
30
|
* Additive and idempotent. Safe to run on every boot.
|
|
31
31
|
*
|
|
32
|
-
* Usage: node server/migrations/0023-relay-asks.mjs [path/to/
|
|
32
|
+
* Usage: node server/migrations/0023-relay-asks.mjs [path/to/oar.db]
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
import { fileURLToPath } from 'url';
|
|
36
36
|
import path from 'path';
|
|
37
37
|
import process from 'process';
|
|
38
38
|
import Database from 'better-sqlite3';
|
|
39
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
39
40
|
|
|
40
41
|
export const RELAY_ASK_COLUMNS = Object.freeze([
|
|
41
42
|
'id',
|
|
@@ -112,11 +113,6 @@ export function migrateRelayAsks(db) {
|
|
|
112
113
|
return { applied: tablesAdded > 0, tablesAdded };
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
function defaultDbPath() {
|
|
116
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
117
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
118
|
-
}
|
|
119
|
-
|
|
120
116
|
export function migrate(dbPath, options = {}) {
|
|
121
117
|
const db = new Database(dbPath, options);
|
|
122
118
|
try {
|
|
@@ -128,8 +124,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
128
124
|
|
|
129
125
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
130
126
|
if (isMain) {
|
|
131
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
132
127
|
try {
|
|
128
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
129
|
+
// name before 0.9.20); never a new one.
|
|
130
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
133
131
|
const result = migrate(dbPath);
|
|
134
132
|
console.log(`Migration 0023 on ${dbPath}`);
|
|
135
133
|
console.log(result.applied ? ` relay asks: tables added ${result.tablesAdded}` : ' skipped: nothing to change');
|
|
@@ -32,13 +32,14 @@
|
|
|
32
32
|
*
|
|
33
33
|
* Additive and idempotent. Safe to run on every boot.
|
|
34
34
|
*
|
|
35
|
-
* Usage: node server/migrations/0024-deepseek-usage-totals.mjs [path/to/
|
|
35
|
+
* Usage: node server/migrations/0024-deepseek-usage-totals.mjs [path/to/oar.db]
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
38
|
import { fileURLToPath } from 'url';
|
|
39
39
|
import path from 'path';
|
|
40
40
|
import process from 'process';
|
|
41
41
|
import Database from 'better-sqlite3';
|
|
42
|
+
import { cliDbPath } from '../services/database-file.mjs';
|
|
42
43
|
|
|
43
44
|
export const DEEPSEEK_USAGE_TOTALS_TABLE = 'deepseek_usage_totals';
|
|
44
45
|
export const DEEPSEEK_USAGE_CHECKPOINTS_TABLE = 'deepseek_usage_checkpoints';
|
|
@@ -122,11 +123,6 @@ export function migrateDeepSeekUsageTotals(db) {
|
|
|
122
123
|
return { applied: true, tablesAdded };
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
function defaultDbPath() {
|
|
126
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
127
|
-
return path.resolve(here, '..', 'data', 'copilot.db');
|
|
128
|
-
}
|
|
129
|
-
|
|
130
126
|
export function migrate(dbPath, options = {}) {
|
|
131
127
|
const db = new Database(dbPath, options);
|
|
132
128
|
try {
|
|
@@ -138,8 +134,10 @@ export function migrate(dbPath, options = {}) {
|
|
|
138
134
|
|
|
139
135
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
140
136
|
if (isMain) {
|
|
141
|
-
const dbPath = process.argv[2] ? path.resolve(process.argv[2]) : defaultDbPath();
|
|
142
137
|
try {
|
|
138
|
+
// The given path, else the database in server/data (oar.db, else the
|
|
139
|
+
// name before 0.9.20); never a new one.
|
|
140
|
+
const dbPath = cliDbPath(process.argv[2], new URL('..', import.meta.url));
|
|
143
141
|
const result = migrate(dbPath);
|
|
144
142
|
console.log(`Migration 0024 on ${dbPath}`);
|
|
145
143
|
console.log(result.applied ? ` deepseek usage totals: tables added ${result.tablesAdded}` : ' skipped: nothing to change');
|