agl 1.0.17 → 21.0.2
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/.smartconfig.json +55 -0
- package/changelog.md +1026 -0
- package/cli.js +14 -0
- package/dist_serve/bundle.js +44778 -0
- package/dist_serve/index.html +13 -0
- package/dist_ts/00_commitinfo_data.d.ts +8 -0
- package/dist_ts/00_commitinfo_data.js +9 -0
- package/dist_ts/classes.authmodels.d.ts +126 -0
- package/dist_ts/classes.authmodels.js +1422 -0
- package/dist_ts/classes.authstore.d.ts +160 -0
- package/dist_ts/classes.authstore.js +2483 -0
- package/dist_ts/classes.browserresourcehost.d.ts +85 -0
- package/dist_ts/classes.browserresourcehost.js +912 -0
- package/dist_ts/classes.cli.d.ts +21 -0
- package/dist_ts/classes.cli.js +1082 -0
- package/dist_ts/classes.config.d.ts +23 -0
- package/dist_ts/classes.config.js +267 -0
- package/dist_ts/classes.controller.d.ts +523 -0
- package/dist_ts/classes.controller.js +10611 -0
- package/dist_ts/classes.controllermanagement.d.ts +32 -0
- package/dist_ts/classes.controllermanagement.js +222 -0
- package/dist_ts/classes.draftmanager.d.ts +30 -0
- package/dist_ts/classes.draftmanager.js +179 -0
- package/dist_ts/classes.embeddeddb.d.ts +30 -0
- package/dist_ts/classes.embeddeddb.js +159 -0
- package/dist_ts/classes.flexframedtransport.d.ts +56 -0
- package/dist_ts/classes.flexframedtransport.js +275 -0
- package/dist_ts/classes.flexmodels.private.d.ts +231 -0
- package/dist_ts/classes.flexmodels.private.js +985 -0
- package/dist_ts/classes.flexmodels.public.d.ts +207 -0
- package/dist_ts/classes.flexmodels.public.js +885 -0
- package/dist_ts/classes.flexprojectionreader.d.ts +89 -0
- package/dist_ts/classes.flexprojectionreader.js +580 -0
- package/dist_ts/classes.flexservice.d.ts +196 -0
- package/dist_ts/classes.flexservice.js +3704 -0
- package/dist_ts/classes.flexstore.d.ts +174 -0
- package/dist_ts/classes.flexstore.js +3400 -0
- package/dist_ts/classes.flexsupervisor.d.ts +105 -0
- package/dist_ts/classes.flexsupervisor.js +1191 -0
- package/dist_ts/classes.gitreversion.d.ts +431 -0
- package/dist_ts/classes.gitreversion.js +10592 -0
- package/dist_ts/classes.harnessoperationmanager.d.ts +113 -0
- package/dist_ts/classes.harnessoperationmanager.js +602 -0
- package/dist_ts/classes.opencodeclient.d.ts +146 -0
- package/dist_ts/classes.opencodeclient.js +3003 -0
- package/dist_ts/classes.opencodesupervisor.d.ts +60 -0
- package/dist_ts/classes.opencodesupervisor.js +1003 -0
- package/dist_ts/classes.passkeymanager.d.ts +34 -0
- package/dist_ts/classes.passkeymanager.js +456 -0
- package/dist_ts/classes.processinspection.d.ts +50 -0
- package/dist_ts/classes.processinspection.js +484 -0
- package/dist_ts/classes.resourcecoordinator.d.ts +64 -0
- package/dist_ts/classes.resourcecoordinator.js +294 -0
- package/dist_ts/classes.sessionintelligencereader.d.ts +13 -0
- package/dist_ts/classes.sessionintelligencereader.js +40 -0
- package/dist_ts/classes.systemmetricssampler.d.ts +53 -0
- package/dist_ts/classes.systemmetricssampler.js +168 -0
- package/dist_ts/classes.terminalmanager.d.ts +95 -0
- package/dist_ts/classes.terminalmanager.js +981 -0
- package/dist_ts/classes.terminalresourcehost.d.ts +20 -0
- package/dist_ts/classes.terminalresourcehost.js +84 -0
- package/dist_ts/classes.upgradecoordinator.d.ts +244 -0
- package/dist_ts/classes.upgradecoordinator.js +2155 -0
- package/dist_ts/classes.upgradetransaction.d.ts +92 -0
- package/dist_ts/classes.upgradetransaction.js +2125 -0
- package/dist_ts/classes.uploadmanager.d.ts +24 -0
- package/dist_ts/classes.uploadmanager.js +210 -0
- package/dist_ts/classes.validation.d.ts +91 -0
- package/dist_ts/classes.validation.js +1087 -0
- package/dist_ts/flexharness.child.d.ts +1 -0
- package/dist_ts/flexharness.child.js +28 -0
- package/dist_ts/functions.canonicaldirectory.d.ts +21 -0
- package/dist_ts/functions.canonicaldirectory.js +144 -0
- package/dist_ts/functions.controllerdataroot.d.ts +15 -0
- package/dist_ts/functions.controllerdataroot.js +76 -0
- package/dist_ts/functions.embeddeddb.d.ts +2 -0
- package/dist_ts/functions.embeddeddb.js +21 -0
- package/dist_ts/functions.flexcredentialstore.d.ts +16 -0
- package/dist_ts/functions.flexcredentialstore.js +93 -0
- package/dist_ts/functions.opencodeauth.d.ts +3 -0
- package/dist_ts/functions.opencodeauth.js +31 -0
- package/dist_ts/functions.runtimeenvironment.d.ts +2 -0
- package/dist_ts/functions.runtimeenvironment.js +79 -0
- package/dist_ts/functions.upgradefollower.d.ts +3 -0
- package/dist_ts/functions.upgradefollower.js +95 -0
- package/dist_ts/index.d.ts +24 -0
- package/dist_ts/index.js +25 -0
- package/dist_ts/interfaces.auth.d.ts +181 -0
- package/dist_ts/interfaces.auth.js +82 -0
- package/dist_ts/interfaces.config.d.ts +34 -0
- package/dist_ts/interfaces.config.js +2 -0
- package/dist_ts/interfaces.flexipc.d.ts +939 -0
- package/dist_ts/interfaces.flexipc.js +1492 -0
- package/dist_ts/interfaces.gitreversion.d.ts +246 -0
- package/dist_ts/interfaces.gitreversion.js +2 -0
- package/dist_ts/interfaces.lifecycle.d.ts +37 -0
- package/dist_ts/interfaces.lifecycle.js +2 -0
- package/dist_ts/interfaces.opencode.d.ts +101 -0
- package/dist_ts/interfaces.opencode.js +3 -0
- package/dist_ts/interfaces.projects.d.ts +156 -0
- package/dist_ts/interfaces.projects.js +5 -0
- package/dist_ts/plugins.d.ts +36 -0
- package/dist_ts/plugins.js +40 -0
- package/dist_ts_interfaces/index.d.ts +2 -0
- package/dist_ts_interfaces/index.js +3 -0
- package/dist_ts_interfaces/interfaces.d.ts +747 -0
- package/dist_ts_interfaces/interfaces.js +47 -0
- package/dist_ts_interfaces/plugins.d.ts +4 -0
- package/dist_ts_interfaces/plugins.js +3 -0
- package/dist_ts_interfaces/requests.d.ts +806 -0
- package/dist_ts_interfaces/requests.js +2 -0
- package/dist_ts_migration/classes.documentmigrationrunner.d.ts +8 -0
- package/dist_ts_migration/classes.documentmigrationrunner.js +24 -0
- package/dist_ts_migration/classes.flexmigrationrunner.d.ts +11 -0
- package/dist_ts_migration/classes.flexmigrationrunner.js +25 -0
- package/dist_ts_migration/classes.flexpostharnessmigrationrunner.d.ts +10 -0
- package/dist_ts_migration/classes.flexpostharnessmigrationrunner.js +15 -0
- package/dist_ts_migration/classes.migrationrunner.d.ts +8 -0
- package/dist_ts_migration/classes.migrationrunner.js +34 -0
- package/dist_ts_migration/index.d.ts +12 -0
- package/dist_ts_migration/index.js +13 -0
- package/dist_ts_migration/v10_flexharnessv3migration.d.ts +11 -0
- package/dist_ts_migration/v10_flexharnessv3migration.js +23 -0
- package/dist_ts_migration/v13_flexprojectionorder.d.ts +11 -0
- package/dist_ts_migration/v13_flexprojectionorder.js +23 -0
- package/dist_ts_migration/v16_flexprovidercredentials.d.ts +22 -0
- package/dist_ts_migration/v16_flexprovidercredentials.js +149 -0
- package/dist_ts_migration/v18_resourcelayout.d.ts +22 -0
- package/dist_ts_migration/v18_resourcelayout.js +23 -0
- package/dist_ts_migration/v18_resourcelayoutmigration.d.ts +6 -0
- package/dist_ts_migration/v18_resourcelayoutmigration.js +61 -0
- package/dist_ts_migration/v19_flexprojectmanagement.d.ts +11 -0
- package/dist_ts_migration/v19_flexprojectmanagement.js +21 -0
- package/dist_ts_migration/v1_embeddeddatabaselocation.d.ts +28 -0
- package/dist_ts_migration/v1_embeddeddatabaselocation.js +415 -0
- package/dist_ts_migration/v22_projectfilesystemidentitymigration.d.ts +7 -0
- package/dist_ts_migration/v22_projectfilesystemidentitymigration.js +105 -0
- package/dist_ts_migration/v2_controllerdataroot.d.ts +130 -0
- package/dist_ts_migration/v2_controllerdataroot.js +1887 -0
- package/dist_ts_migration/v6_protocoldocumentmigration.d.ts +7 -0
- package/dist_ts_migration/v6_protocoldocumentmigration.js +100 -0
- package/dist_ts_migration/v6_protocoldocuments.d.ts +7 -0
- package/dist_ts_migration/v6_protocoldocuments.js +138 -0
- package/html/index.html +13 -0
- package/{LICENSE → license.md} +2 -2
- package/package.json +86 -48
- package/readme.md +480 -0
- package/readme.plan.md +188 -0
- package/ts/00_commitinfo_data.ts +8 -0
- package/ts/classes.authmodels.ts +1245 -0
- package/ts/classes.authstore.ts +3274 -0
- package/ts/classes.browserresourcehost.ts +1205 -0
- package/ts/classes.cli.ts +1254 -0
- package/ts/classes.config.ts +351 -0
- package/ts/classes.controller.ts +14426 -0
- package/ts/classes.controllermanagement.ts +330 -0
- package/ts/classes.draftmanager.ts +232 -0
- package/ts/classes.embeddeddb.ts +166 -0
- package/ts/classes.flexframedtransport.ts +283 -0
- package/ts/classes.flexmodels.private.ts +823 -0
- package/ts/classes.flexmodels.public.ts +732 -0
- package/ts/classes.flexprojectionreader.ts +816 -0
- package/ts/classes.flexservice.ts +4302 -0
- package/ts/classes.flexstore.ts +4565 -0
- package/ts/classes.flexsupervisor.ts +1453 -0
- package/ts/classes.gitreversion.ts +13353 -0
- package/ts/classes.harnessoperationmanager.ts +870 -0
- package/ts/classes.opencodeclient.ts +4110 -0
- package/ts/classes.opencodesupervisor.ts +1280 -0
- package/ts/classes.passkeymanager.ts +570 -0
- package/ts/classes.processinspection.ts +623 -0
- package/ts/classes.resourcecoordinator.ts +436 -0
- package/ts/classes.sessionintelligencereader.ts +52 -0
- package/ts/classes.systemmetricssampler.ts +215 -0
- package/ts/classes.terminalmanager.ts +1207 -0
- package/ts/classes.terminalresourcehost.ts +122 -0
- package/ts/classes.upgradecoordinator.ts +2675 -0
- package/ts/classes.upgradetransaction.ts +2900 -0
- package/ts/classes.uploadmanager.ts +240 -0
- package/ts/classes.validation.ts +1409 -0
- package/ts/flexharness.child.ts +35 -0
- package/ts/functions.canonicaldirectory.ts +213 -0
- package/ts/functions.controllerdataroot.ts +107 -0
- package/ts/functions.embeddeddb.ts +22 -0
- package/ts/functions.flexcredentialstore.ts +128 -0
- package/ts/functions.opencodeauth.ts +34 -0
- package/ts/functions.runtimeenvironment.ts +90 -0
- package/ts/functions.upgradefollower.ts +115 -0
- package/ts/index.ts +36 -6
- package/ts/interfaces.auth.ts +316 -0
- package/ts/interfaces.config.ts +37 -0
- package/ts/interfaces.flexipc.ts +2586 -0
- package/ts/interfaces.gitreversion.ts +336 -0
- package/ts/interfaces.lifecycle.ts +46 -0
- package/ts/interfaces.opencode.ts +153 -0
- package/ts/interfaces.projects.ts +182 -0
- package/ts/plugins.ts +64 -0
- package/ts_interfaces/index.ts +2 -0
- package/ts_interfaces/interfaces.ts +827 -0
- package/ts_interfaces/plugins.ts +15 -0
- package/ts_interfaces/requests.ts +1186 -0
- package/ts_migration/classes.documentmigrationrunner.ts +32 -0
- package/ts_migration/classes.flexmigrationrunner.ts +33 -0
- package/ts_migration/classes.flexpostharnessmigrationrunner.ts +22 -0
- package/ts_migration/classes.migrationrunner.ts +40 -0
- package/ts_migration/index.ts +12 -0
- package/ts_migration/v10_flexharnessv3migration.ts +35 -0
- package/ts_migration/v13_flexprojectionorder.ts +33 -0
- package/ts_migration/v16_flexprovidercredentials.ts +196 -0
- package/ts_migration/v18_resourcelayout.ts +55 -0
- package/ts_migration/v18_resourcelayoutmigration.ts +68 -0
- package/ts_migration/v19_flexprojectmanagement.ts +28 -0
- package/ts_migration/v1_embeddeddatabaselocation.ts +560 -0
- package/ts_migration/v22_projectfilesystemidentitymigration.ts +121 -0
- package/ts_migration/v2_controllerdataroot.ts +2349 -0
- package/ts_migration/v6_protocoldocumentmigration.ts +144 -0
- package/ts_migration/v6_protocoldocuments.ts +198 -0
- package/ts_web/00_commitinfo_data.ts +8 -0
- package/ts_web/classes.controllersocketclient.ts +517 -0
- package/ts_web/classes.sessiondraftsync.ts +390 -0
- package/ts_web/elements.harnesscontrollerapp.ts +11494 -0
- package/ts_web/index.ts +2 -0
- package/ts_web/plugins.ts +31 -0
- package/.gitlab-ci.yml +0 -71
- package/.npmignore +0 -5
- package/README.md +0 -40
- package/dist/cli.js +0 -2
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -9
- package/dist/mod_bundle/index.d.ts +0 -1
- package/dist/mod_bundle/index.js +0 -18
- package/dist/mod_bundle/mod.plugins.d.ts +0 -4
- package/dist/mod_bundle/mod.plugins.js +0 -11
- package/dist/mod_install/index.d.ts +0 -4
- package/dist/mod_install/index.js +0 -21
- package/dist/mod_install/mod.plugins.d.ts +0 -1
- package/dist/mod_install/mod.plugins.js +0 -7
- package/dist/mod_standard/index.d.ts +0 -4
- package/dist/mod_standard/index.js +0 -21
- package/dist/mod_standard/mod.browser.d.ts +0 -6
- package/dist/mod_standard/mod.browser.js +0 -14
- package/dist/mod_standard/mod.clean.d.ts +0 -4
- package/dist/mod_standard/mod.clean.js +0 -12
- package/dist/mod_standard/mod.compile.d.ts +0 -4
- package/dist/mod_standard/mod.compile.js +0 -21
- package/dist/mod_standard/mod.plugins.d.ts +0 -8
- package/dist/mod_standard/mod.plugins.js +0 -19
- package/dist/mod_standard/mod.test.d.ts +0 -4
- package/dist/mod_standard/mod.test.js +0 -12
- package/dist/plr.cli.d.ts +0 -3
- package/dist/plr.cli.js +0 -57
- package/dist/plr.config.d.ts +0 -11
- package/dist/plr.config.js +0 -26
- package/dist/plr.mods.d.ts +0 -17
- package/dist/plr.mods.js +0 -17
- package/dist/plr.paths.d.ts +0 -19
- package/dist/plr.paths.js +0 -26
- package/dist/plr.plugins.d.ts +0 -8
- package/dist/plr.plugins.js +0 -16
- package/npmextra.json +0 -10
- package/ts/mod_bundle/index.ts +0 -20
- package/ts/mod_bundle/mod.plugins.ts +0 -9
- package/ts/mod_install/index.ts +0 -20
- package/ts/mod_install/mod.plugins.ts +0 -1
- package/ts/mod_standard/index.ts +0 -23
- package/ts/mod_standard/mod.browser.ts +0 -17
- package/ts/mod_standard/mod.clean.ts +0 -13
- package/ts/mod_standard/mod.compile.ts +0 -23
- package/ts/mod_standard/mod.plugins.ts +0 -17
- package/ts/mod_standard/mod.test.ts +0 -13
- package/ts/plr.cli.ts +0 -60
- package/ts/plr.config.ts +0 -36
- package/ts/plr.mods.ts +0 -25
- package/ts/plr.paths.ts +0 -29
- package/ts/plr.plugins.ts +0 -17
- package/tslint.json +0 -3
- package/yarn.lock +0 -3464
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
import { controllerPackageName } from '../ts_interfaces/index.js';
|
|
3
|
+
import {
|
|
4
|
+
UpgradeCoordinator,
|
|
5
|
+
upgradePackageTransitionSource,
|
|
6
|
+
upgradePackageTransitionTarget,
|
|
7
|
+
upgradePackageTransitionTransactionVersion,
|
|
8
|
+
upgradeTransactionIsStalled,
|
|
9
|
+
} from './classes.upgradecoordinator.js';
|
|
10
|
+
import {
|
|
11
|
+
recoverStalledUpgrade,
|
|
12
|
+
type IPnpmGlobalInstallation,
|
|
13
|
+
} from './classes.upgradetransaction.js';
|
|
14
|
+
|
|
15
|
+
const currentCliName = String(controllerPackageName) === upgradePackageTransitionSource.packageName
|
|
16
|
+
? upgradePackageTransitionSource.cliName
|
|
17
|
+
: upgradePackageTransitionTarget.cliName;
|
|
18
|
+
|
|
19
|
+
export const followUpgradeTransaction = async (
|
|
20
|
+
coordinatorArg: UpgradeCoordinator,
|
|
21
|
+
tokenArg: string,
|
|
22
|
+
logFilePathArg: string,
|
|
23
|
+
streamLogArg: boolean,
|
|
24
|
+
installationArg: IPnpmGlobalInstallation,
|
|
25
|
+
): Promise<Awaited<ReturnType<UpgradeCoordinator['readTransaction']>>> => {
|
|
26
|
+
let offset = 0;
|
|
27
|
+
let activeLogFilePath = logFilePathArg;
|
|
28
|
+
let lastRevision = -1;
|
|
29
|
+
let workerMissingSince: number | undefined;
|
|
30
|
+
while (true) {
|
|
31
|
+
const transaction = await coordinatorArg.readTransaction(tokenArg);
|
|
32
|
+
const transactionCliName = transaction.version === upgradePackageTransitionTransactionVersion
|
|
33
|
+
? transaction.sourceCliName
|
|
34
|
+
: currentCliName;
|
|
35
|
+
const retainedLogFilePath = transaction.worker?.logFilePath;
|
|
36
|
+
if (retainedLogFilePath && retainedLogFilePath !== activeLogFilePath) {
|
|
37
|
+
activeLogFilePath = retainedLogFilePath;
|
|
38
|
+
offset = 0;
|
|
39
|
+
if (streamLogArg) {
|
|
40
|
+
process.stdout.write(
|
|
41
|
+
`${transactionCliName} upgrade: recovery worker logs: ${activeLogFilePath}\n`,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (streamLogArg) {
|
|
46
|
+
const handle = await plugins.fs.promises.open(
|
|
47
|
+
activeLogFilePath,
|
|
48
|
+
plugins.fs.constants.O_RDONLY | plugins.fs.constants.O_NOFOLLOW,
|
|
49
|
+
);
|
|
50
|
+
try {
|
|
51
|
+
const stats = await handle.stat();
|
|
52
|
+
if (!stats.isFile() || stats.size < offset) {
|
|
53
|
+
throw new Error(`The ${transactionCliName} upgrade log changed unexpectedly.`);
|
|
54
|
+
}
|
|
55
|
+
if (stats.size > offset) {
|
|
56
|
+
const bytes = Buffer.alloc(Math.min(stats.size - offset, 64 * 1024));
|
|
57
|
+
await handle.read(bytes, 0, bytes.byteLength, offset);
|
|
58
|
+
offset += bytes.byteLength;
|
|
59
|
+
if (!process.stdout.write(bytes)) {
|
|
60
|
+
await new Promise<void>((resolve) => process.stdout.once('drain', resolve));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
} finally {
|
|
64
|
+
await handle.close();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (transaction.revision !== lastRevision) {
|
|
68
|
+
lastRevision = transaction.revision;
|
|
69
|
+
if (streamLogArg && transaction.message) {
|
|
70
|
+
process.stdout.write(`${transactionCliName} upgrade: ${transaction.message}\n`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (transaction.terminal) return transaction;
|
|
74
|
+
if (upgradeTransactionIsStalled(transaction)) {
|
|
75
|
+
const recovered = await recoverStalledUpgrade({
|
|
76
|
+
coordinator: coordinatorArg,
|
|
77
|
+
token: tokenArg,
|
|
78
|
+
transaction,
|
|
79
|
+
installation: installationArg,
|
|
80
|
+
command: 'upgrade',
|
|
81
|
+
});
|
|
82
|
+
if (!recovered) await new Promise((resolve) => setTimeout(resolve, 5_000));
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (transaction.worker) {
|
|
86
|
+
if (await coordinatorArg.transactionWorkerIsLive(transaction)) {
|
|
87
|
+
workerMissingSince = undefined;
|
|
88
|
+
} else {
|
|
89
|
+
workerMissingSince ??= Date.now();
|
|
90
|
+
if (Date.now() - workerMissingSince > 5_000) {
|
|
91
|
+
const recovered = await recoverStalledUpgrade({
|
|
92
|
+
coordinator: coordinatorArg,
|
|
93
|
+
token: tokenArg,
|
|
94
|
+
transaction,
|
|
95
|
+
installation: installationArg,
|
|
96
|
+
command: 'upgrade',
|
|
97
|
+
});
|
|
98
|
+
if (!recovered) await new Promise((resolve) => setTimeout(resolve, 5_000));
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
workerMissingSince ??= Date.now();
|
|
104
|
+
if (Date.now() - workerMissingSince > 5_000) {
|
|
105
|
+
return await coordinatorArg.finishTransaction(
|
|
106
|
+
tokenArg,
|
|
107
|
+
false,
|
|
108
|
+
'The upgrade worker did not establish durable ownership.',
|
|
109
|
+
'No upgrade worker identity was retained before the launch deadline.',
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
114
|
+
}
|
|
115
|
+
};
|
package/ts/index.ts
CHANGED
|
@@ -1,8 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
early.start('plr')
|
|
3
|
-
import * as plrCli from './plr.cli'
|
|
4
|
-
early.stop().then(() => {
|
|
5
|
-
plrCli.run()
|
|
6
|
-
})
|
|
1
|
+
export * from '../ts_interfaces/index.js';
|
|
7
2
|
|
|
3
|
+
export * from './00_commitinfo_data.js';
|
|
4
|
+
export * from './interfaces.auth.js';
|
|
5
|
+
export * from './interfaces.config.js';
|
|
6
|
+
export * from './interfaces.lifecycle.js';
|
|
7
|
+
export {
|
|
8
|
+
openCodeExpectedVersion,
|
|
9
|
+
openCodeUsername,
|
|
10
|
+
type IOpenCodeClientOptions,
|
|
11
|
+
type IOpenCodeConnectionConfig,
|
|
12
|
+
type IOpenCodeEventStreamOptions,
|
|
13
|
+
type IOpenCodeHealth,
|
|
14
|
+
type IOpenCodeLogEntry,
|
|
15
|
+
type IOpenCodeProcessGroupController,
|
|
16
|
+
type IOpenCodeSupervisorOptions,
|
|
17
|
+
type IOpenCodeSupervisorStatus,
|
|
18
|
+
type TOpenCodeSdkClient,
|
|
19
|
+
} from './interfaces.opencode.js';
|
|
20
|
+
export * from './interfaces.projects.js';
|
|
21
|
+
export * from './interfaces.gitreversion.js';
|
|
8
22
|
|
|
23
|
+
export * from './classes.authmodels.js';
|
|
24
|
+
export * from './classes.authstore.js';
|
|
25
|
+
export * from './classes.cli.js';
|
|
26
|
+
export * from './classes.config.js';
|
|
27
|
+
export * from './classes.controller.js';
|
|
28
|
+
export * from './classes.resourcecoordinator.js';
|
|
29
|
+
export * from './classes.terminalresourcehost.js';
|
|
30
|
+
export * from './classes.browserresourcehost.js';
|
|
31
|
+
export * from './classes.gitreversion.js';
|
|
32
|
+
export * from './classes.opencodeclient.js';
|
|
33
|
+
export * from './classes.opencodesupervisor.js';
|
|
34
|
+
export * from './classes.passkeymanager.js';
|
|
35
|
+
export * from './classes.processinspection.js';
|
|
36
|
+
export * from './classes.upgradecoordinator.js';
|
|
37
|
+
export * from './classes.upgradetransaction.js';
|
|
38
|
+
export * from './classes.validation.js';
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import type * as plugins from './plugins.js';
|
|
2
|
+
import type { IControllerRuntimeId } from '../ts_interfaces/index.js';
|
|
3
|
+
import type { IControllerRuntimeConfig } from './interfaces.config.js';
|
|
4
|
+
|
|
5
|
+
export type TControllerAuthLifecycleState = 'setupRequired' | 'ready';
|
|
6
|
+
export type TWebAuthnCeremonyKind = 'setup' | 'authentication';
|
|
7
|
+
export type TWebAuthnCeremonyState = 'pending' | 'consumed';
|
|
8
|
+
/**
|
|
9
|
+
* Single source of the audit event vocabulary: the persisted-document
|
|
10
|
+
* assertion consumes this list at runtime, so a type added here is
|
|
11
|
+
* automatically storable — the two can no longer drift apart.
|
|
12
|
+
*/
|
|
13
|
+
export const controllerAuditEventTypes = [
|
|
14
|
+
'controller.started',
|
|
15
|
+
'controller.stopped',
|
|
16
|
+
'setup.finish',
|
|
17
|
+
'authentication.finish',
|
|
18
|
+
'authentication.logout',
|
|
19
|
+
'temppassword.create',
|
|
20
|
+
'temppassword.login',
|
|
21
|
+
'auth.resume',
|
|
22
|
+
'session.list',
|
|
23
|
+
'session.read',
|
|
24
|
+
'session.auxiliary.read',
|
|
25
|
+
'session.model.update',
|
|
26
|
+
'session.scratchpad.save',
|
|
27
|
+
'session.intelligence.ask',
|
|
28
|
+
'session.messages.page',
|
|
29
|
+
'session.message.read',
|
|
30
|
+
'session.create',
|
|
31
|
+
'session.delete',
|
|
32
|
+
'session.discard-empty',
|
|
33
|
+
'session.send',
|
|
34
|
+
'session.abort',
|
|
35
|
+
'session.rename',
|
|
36
|
+
'session.archive',
|
|
37
|
+
'session.yolo',
|
|
38
|
+
'session.builtin',
|
|
39
|
+
'slash.list',
|
|
40
|
+
'slash.execute',
|
|
41
|
+
'permission.reply',
|
|
42
|
+
'question.reply',
|
|
43
|
+
'project.list',
|
|
44
|
+
'project.create',
|
|
45
|
+
'project.remove',
|
|
46
|
+
'model.list',
|
|
47
|
+
'provider.list',
|
|
48
|
+
'provider.connection.list',
|
|
49
|
+
'provider.login.begin',
|
|
50
|
+
'provider.login.read',
|
|
51
|
+
'provider.login.cancel',
|
|
52
|
+
'provider.connection.logout',
|
|
53
|
+
'provider.connection.activate-opencode',
|
|
54
|
+
'provider.connection.ratelimits.read',
|
|
55
|
+
'provider.model.refresh.begin',
|
|
56
|
+
'provider.model.refresh.read',
|
|
57
|
+
'command.list',
|
|
58
|
+
'session.command',
|
|
59
|
+
'settings.read',
|
|
60
|
+
'settings.update',
|
|
61
|
+
'sessiongroups.read',
|
|
62
|
+
'sessiongroups.update',
|
|
63
|
+
'terminal.list',
|
|
64
|
+
'terminal.create',
|
|
65
|
+
'terminal.rename',
|
|
66
|
+
'terminal.remove',
|
|
67
|
+
'terminal.attach',
|
|
68
|
+
'resource.list',
|
|
69
|
+
'resource.create',
|
|
70
|
+
'resource.rename',
|
|
71
|
+
'resource.attach',
|
|
72
|
+
'resource.detach',
|
|
73
|
+
'resource.start',
|
|
74
|
+
'resource.stop',
|
|
75
|
+
'resource.retire',
|
|
76
|
+
'resource.browser.operation',
|
|
77
|
+
'resource.browser.view.open',
|
|
78
|
+
'resource.browser.view.close',
|
|
79
|
+
'resource.browser.view.operate',
|
|
80
|
+
] as const;
|
|
81
|
+
export type TControllerAuditEventType = (typeof controllerAuditEventTypes)[number];
|
|
82
|
+
export type TControllerAuditOutcome = 'attempted' | 'succeeded' | 'denied' | 'failed';
|
|
83
|
+
|
|
84
|
+
export type TAuthErrorCode =
|
|
85
|
+
| 'not_initialized'
|
|
86
|
+
| 'config_mismatch'
|
|
87
|
+
| 'setup_unavailable'
|
|
88
|
+
| 'setup_invalid'
|
|
89
|
+
| 'setup_expired'
|
|
90
|
+
| 'rate_limited'
|
|
91
|
+
| 'ceremony_limit'
|
|
92
|
+
| 'ceremony_invalid'
|
|
93
|
+
| 'ceremony_replayed'
|
|
94
|
+
| 'ceremony_expired'
|
|
95
|
+
| 'origin_mismatch'
|
|
96
|
+
| 'peer_mismatch'
|
|
97
|
+
| 'verification_failed'
|
|
98
|
+
| 'credential_not_found'
|
|
99
|
+
| 'concurrent_change'
|
|
100
|
+
| 'ambiguous_write'
|
|
101
|
+
| 'counter_conflict'
|
|
102
|
+
| 'invalid_project'
|
|
103
|
+
| 'invalid_resource'
|
|
104
|
+
| 'temp_password_invalid'
|
|
105
|
+
| 'temp_password_limit';
|
|
106
|
+
|
|
107
|
+
export class AuthError extends Error {
|
|
108
|
+
public readonly code: TAuthErrorCode;
|
|
109
|
+
|
|
110
|
+
constructor(codeArg: TAuthErrorCode, messageArg: string, optionsArg?: ErrorOptions) {
|
|
111
|
+
super(messageArg, optionsArg);
|
|
112
|
+
this.name = 'AuthError';
|
|
113
|
+
this.code = codeArg;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface IStoredPasskeyCredential {
|
|
118
|
+
id: string;
|
|
119
|
+
publicKey: string;
|
|
120
|
+
counter: number;
|
|
121
|
+
transports: plugins.simplewebauthnServer.AuthenticatorTransportFuture[];
|
|
122
|
+
deviceType: plugins.simplewebauthnServer.CredentialDeviceType;
|
|
123
|
+
backedUp: boolean;
|
|
124
|
+
createdAt: Date;
|
|
125
|
+
counterUpdateId: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface ISetupAuthorityState {
|
|
129
|
+
generation: string;
|
|
130
|
+
hash: string;
|
|
131
|
+
expiresAt: Date;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface IControllerAuthDocument {
|
|
135
|
+
id: string;
|
|
136
|
+
config: IControllerRuntimeConfig;
|
|
137
|
+
authState: TControllerAuthLifecycleState;
|
|
138
|
+
setup: ISetupAuthorityState | null;
|
|
139
|
+
webauthnUserId: string;
|
|
140
|
+
credentials: IStoredPasskeyCredential[];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface IWebAuthnCeremonyDocument {
|
|
144
|
+
id: string;
|
|
145
|
+
kind: TWebAuthnCeremonyKind;
|
|
146
|
+
state: TWebAuthnCeremonyState;
|
|
147
|
+
peerId: string;
|
|
148
|
+
challenge: string;
|
|
149
|
+
origin: string;
|
|
150
|
+
rpId: string;
|
|
151
|
+
userId: string;
|
|
152
|
+
createdAt: Date;
|
|
153
|
+
expiresAt: Date;
|
|
154
|
+
consumedAt?: Date;
|
|
155
|
+
consumedNonce?: string;
|
|
156
|
+
setupGeneration?: string;
|
|
157
|
+
setupHash?: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface IWebAuthnSetupCeremonyDocument extends IWebAuthnCeremonyDocument {
|
|
161
|
+
kind: 'setup';
|
|
162
|
+
setupGeneration: string;
|
|
163
|
+
setupHash: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface IWebAuthnAuthenticationCeremonyDocument extends IWebAuthnCeremonyDocument {
|
|
167
|
+
kind: 'authentication';
|
|
168
|
+
setupGeneration?: never;
|
|
169
|
+
setupHash?: never;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface ISetupAuthority {
|
|
173
|
+
setupCode: string;
|
|
174
|
+
generation: string;
|
|
175
|
+
expiresAt: Date;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface IControllerAuditEvent {
|
|
179
|
+
id: string;
|
|
180
|
+
controllerId: string;
|
|
181
|
+
timestamp: Date;
|
|
182
|
+
type: TControllerAuditEventType;
|
|
183
|
+
outcome: TControllerAuditOutcome;
|
|
184
|
+
operationId?: string;
|
|
185
|
+
peerId?: string;
|
|
186
|
+
credentialId?: string;
|
|
187
|
+
sessionId?: IControllerRuntimeId;
|
|
188
|
+
requestId?: IControllerRuntimeId;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface IControllerTempPasswordDocument {
|
|
192
|
+
id: string;
|
|
193
|
+
controllerId: string;
|
|
194
|
+
/** base64url SHA-256 of the plaintext; the plaintext is never stored. */
|
|
195
|
+
secretHash: string;
|
|
196
|
+
createdAt: Date;
|
|
197
|
+
expiresAt: Date;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface IMintedTempPassword {
|
|
201
|
+
/** Plaintext credential, shown once by the CLI and never persisted. */
|
|
202
|
+
password: string;
|
|
203
|
+
credentialId: string;
|
|
204
|
+
expiresAt: Date;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface IRecordAuditEventInput {
|
|
208
|
+
timestamp?: Date;
|
|
209
|
+
type: TControllerAuditEventType;
|
|
210
|
+
outcome: TControllerAuditOutcome;
|
|
211
|
+
operationId?: string;
|
|
212
|
+
peerId?: string;
|
|
213
|
+
credentialId?: string;
|
|
214
|
+
sessionId?: IControllerRuntimeId;
|
|
215
|
+
requestId?: IControllerRuntimeId;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface IConsumeCeremonyOptions {
|
|
219
|
+
ceremonyId: string;
|
|
220
|
+
kind: TWebAuthnCeremonyKind;
|
|
221
|
+
peerId: string;
|
|
222
|
+
origin: string;
|
|
223
|
+
rpId: string;
|
|
224
|
+
userId: string;
|
|
225
|
+
now: Date;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface IAuthStore {
|
|
229
|
+
init(): Promise<void>;
|
|
230
|
+
close(): Promise<void>;
|
|
231
|
+
getRuntimeConfig(controllerPortArg: number): Promise<IControllerRuntimeConfig | undefined>;
|
|
232
|
+
resolveOrCreateRuntimeConfig(
|
|
233
|
+
runtimeConfigArg: IControllerRuntimeConfig,
|
|
234
|
+
): Promise<IControllerAuthDocument>;
|
|
235
|
+
rotateSetupAuthority(): Promise<ISetupAuthority | null>;
|
|
236
|
+
getState(): Promise<IControllerAuthDocument>;
|
|
237
|
+
assertSetupAuthority(
|
|
238
|
+
setupCodeArg: string,
|
|
239
|
+
ceremonyArg?: IWebAuthnSetupCeremonyDocument,
|
|
240
|
+
nowArg?: Date,
|
|
241
|
+
): Promise<IControllerAuthDocument>;
|
|
242
|
+
countActiveCeremonies(kindArg: TWebAuthnCeremonyKind, nowArg: Date): Promise<number>;
|
|
243
|
+
createCeremony(
|
|
244
|
+
ceremonyArg: IWebAuthnCeremonyDocument,
|
|
245
|
+
): Promise<IWebAuthnCeremonyDocument>;
|
|
246
|
+
assertPendingCeremony(
|
|
247
|
+
optionsArg: IConsumeCeremonyOptions,
|
|
248
|
+
): Promise<IWebAuthnCeremonyDocument>;
|
|
249
|
+
consumeCeremony(optionsArg: IConsumeCeremonyOptions): Promise<IWebAuthnCeremonyDocument>;
|
|
250
|
+
commitFirstCredential(
|
|
251
|
+
ceremonyArg: IWebAuthnSetupCeremonyDocument,
|
|
252
|
+
credentialArg: IStoredPasskeyCredential,
|
|
253
|
+
): Promise<IControllerAuthDocument>;
|
|
254
|
+
updateCounter(
|
|
255
|
+
credentialIdArg: string,
|
|
256
|
+
expectedCounterArg: number,
|
|
257
|
+
newCounterArg: number,
|
|
258
|
+
): Promise<IStoredPasskeyCredential>;
|
|
259
|
+
recordAuditEvent(eventArg: IRecordAuditEventInput): Promise<IControllerAuditEvent>;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface IWebAuthnServerImplementation {
|
|
263
|
+
generateRegistrationOptions: typeof plugins.simplewebauthnServer.generateRegistrationOptions;
|
|
264
|
+
verifyRegistrationResponse: typeof plugins.simplewebauthnServer.verifyRegistrationResponse;
|
|
265
|
+
generateAuthenticationOptions: typeof plugins.simplewebauthnServer.generateAuthenticationOptions;
|
|
266
|
+
verifyAuthenticationResponse: typeof plugins.simplewebauthnServer.verifyAuthenticationResponse;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export interface IPasskeyManagerOptions {
|
|
270
|
+
store: IAuthStore;
|
|
271
|
+
relyingPartyName?: string;
|
|
272
|
+
webAuthn?: IWebAuthnServerImplementation;
|
|
273
|
+
now?: () => Date;
|
|
274
|
+
setupAttemptLimit?: number;
|
|
275
|
+
setupAttemptWindowMs?: number;
|
|
276
|
+
authenticationAttemptLimitPerPeer?: number;
|
|
277
|
+
authenticationAttemptWindowMs?: number;
|
|
278
|
+
maxActiveSetupCeremonies?: number;
|
|
279
|
+
maxActiveAuthenticationCeremonies?: number;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export interface ISetupBeginOptions {
|
|
283
|
+
peerId: string;
|
|
284
|
+
origin: string;
|
|
285
|
+
setupCode: string;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface ISetupFinishOptions extends ISetupBeginOptions {
|
|
289
|
+
ceremonyId: string;
|
|
290
|
+
response: plugins.simplewebauthnServer.RegistrationResponseJSON;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export interface IAuthenticationBeginOptions {
|
|
294
|
+
peerId: string;
|
|
295
|
+
origin: string;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export interface IAuthenticationFinishOptions extends IAuthenticationBeginOptions {
|
|
299
|
+
ceremonyId: string;
|
|
300
|
+
response: plugins.simplewebauthnServer.AuthenticationResponseJSON;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export interface ISetupBeginResult {
|
|
304
|
+
ceremonyId: string;
|
|
305
|
+
options: plugins.simplewebauthnServer.PublicKeyCredentialCreationOptionsJSON;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface IAuthenticationBeginResult {
|
|
309
|
+
ceremonyId: string;
|
|
310
|
+
options: plugins.simplewebauthnServer.PublicKeyCredentialRequestOptionsJSON;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export interface IAuthenticationResult {
|
|
314
|
+
authenticated: true;
|
|
315
|
+
credentialId: string;
|
|
316
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type TControllerTlsMode = 'local' | 'proxy';
|
|
2
|
+
|
|
3
|
+
export interface IControllerRuntimeConfig {
|
|
4
|
+
controllerPort: number;
|
|
5
|
+
publicOrigin: string;
|
|
6
|
+
rpId: string;
|
|
7
|
+
workspaceDirectory: string;
|
|
8
|
+
/**
|
|
9
|
+
* Root directory that bounds all registered projects. Absent only in
|
|
10
|
+
* documents persisted before v2; config resolution adopts a value exactly
|
|
11
|
+
* once (from --projects-root, else the workspace directory), after which it
|
|
12
|
+
* is immutable like every other boundary.
|
|
13
|
+
*/
|
|
14
|
+
projectsRoot?: string;
|
|
15
|
+
opencodePort: number;
|
|
16
|
+
tlsMode: TControllerTlsMode;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface IControllerRuntimeOverrides {
|
|
20
|
+
controllerPort: number;
|
|
21
|
+
publicOrigin?: string;
|
|
22
|
+
rpId?: string;
|
|
23
|
+
workspaceDirectory?: string;
|
|
24
|
+
projectsRoot?: string;
|
|
25
|
+
opencodePort?: number;
|
|
26
|
+
behindTlsProxy?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface IControllerDatabaseConfig {
|
|
30
|
+
/** external server URL; absent = embedded smartdb engine */
|
|
31
|
+
mongoDbUrl?: string;
|
|
32
|
+
mongoDbName: string;
|
|
33
|
+
/** storage directory for the embedded engine; set when mongoDbUrl is absent */
|
|
34
|
+
embeddedDataDirectory?: string;
|
|
35
|
+
/** previous installed default, logically migrated only for the implicit installed database */
|
|
36
|
+
legacyEmbeddedDataDirectory?: string;
|
|
37
|
+
}
|