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,827 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
|
|
3
|
+
export const controllerProtocolVersion = 22 as const;
|
|
4
|
+
export const controllerUpgradeManagementVersion = 2 as const;
|
|
5
|
+
export const controllerPackageName = 'agl' as const;
|
|
6
|
+
export const controllerMaxToolEventBytes = 48 * 1024;
|
|
7
|
+
export const controllerMaxLiveMessageEventBytes = 128 * 1024;
|
|
8
|
+
export const controllerInitialMessageBundleLimit = 20;
|
|
9
|
+
export const controllerMaximumMessageBundles = 200;
|
|
10
|
+
export const controllerMaximumTranscriptBytes = 512 * 1024;
|
|
11
|
+
export const controllerLiveToolPayloadNotice =
|
|
12
|
+
'[elided: this tool payload exceeds the live transfer budget]' as const;
|
|
13
|
+
export const controllerMaxDraftTextBytes = 64 * 1024;
|
|
14
|
+
export const controllerMaxDraftAttachments = 8;
|
|
15
|
+
export const controllerMaxDraftAttachmentBytes = 10 * 1024 * 1024;
|
|
16
|
+
export const controllerMaxDraftAttachmentTotalBytes = 10 * 1024 * 1024;
|
|
17
|
+
export const controllerMaxAttachmentPromptSuffixBytes = 16 * 1024;
|
|
18
|
+
|
|
19
|
+
export const controllerHarnessIds = ['opencode', 'flex', 'controller'] as const;
|
|
20
|
+
export const controllerSessionHarnessIds = ['opencode', 'flex'] as const;
|
|
21
|
+
export type TControllerHarnessId = (typeof controllerHarnessIds)[number];
|
|
22
|
+
export type TControllerSessionHarnessId = (typeof controllerSessionHarnessIds)[number];
|
|
23
|
+
|
|
24
|
+
export interface IControllerRuntimeId {
|
|
25
|
+
harnessId: TControllerHarnessId;
|
|
26
|
+
nativeId: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type TControllerSessionId = IControllerRuntimeId & {
|
|
30
|
+
harnessId: TControllerSessionHarnessId;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type TControllerTerminalId = IControllerRuntimeId & {
|
|
34
|
+
harnessId: 'controller';
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type TControllerLayoutItemId = TControllerSessionId | TControllerTerminalId;
|
|
38
|
+
|
|
39
|
+
/** Collision-free key for maps and sets containing qualified runtime IDs. */
|
|
40
|
+
export const controllerRuntimeIdKey = (runtimeIdArg: IControllerRuntimeId): string =>
|
|
41
|
+
JSON.stringify([runtimeIdArg.harnessId, runtimeIdArg.nativeId]);
|
|
42
|
+
|
|
43
|
+
export type TControllerLifecycleState = 'starting' | 'ready' | 'stopping' | 'stopped';
|
|
44
|
+
export type TControllerProcessMode = 'detached' | 'foreground';
|
|
45
|
+
export type TControllerHarnessLifecycleState = 'starting' | 'ready' | 'stopping' | 'stopped' | 'failed';
|
|
46
|
+
export type TControllerAuthState = 'setupRequired' | 'ready';
|
|
47
|
+
export type TControllerSessionStatus = 'idle' | 'busy' | 'retry' | 'error';
|
|
48
|
+
export type TControllerMessageRole = 'user' | 'assistant' | 'system' | 'tool';
|
|
49
|
+
export type TControllerToolStatus = 'pending' | 'running' | 'completed' | 'error';
|
|
50
|
+
export type TControllerPermissionReply = 'once' | 'reject';
|
|
51
|
+
/**
|
|
52
|
+
* Built-in OpenCode session operations exposed as slash commands, next to the
|
|
53
|
+
* per-project custom command catalog.
|
|
54
|
+
*/
|
|
55
|
+
export const controllerBuiltinCommands = ['compact', 'undo', 'redo', 'init'] as const;
|
|
56
|
+
export type TControllerBuiltinCommand = (typeof controllerBuiltinCommands)[number];
|
|
57
|
+
export type TControllerSlashCommandKind = 'builtin' | 'template' | 'handler';
|
|
58
|
+
export type TControllerSlashWorkspaceReversion = 'supported' | 'unsupported' | 'not-applicable';
|
|
59
|
+
|
|
60
|
+
export interface IControllerAffectedWorkspace {
|
|
61
|
+
id: string;
|
|
62
|
+
label: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface IControllerSessionReversionGroup {
|
|
66
|
+
runId: string;
|
|
67
|
+
kind: 'candidate' | 'barrier' | 'no-change';
|
|
68
|
+
visibility: 'visible' | 'hidden';
|
|
69
|
+
affectedWorkspaces: IControllerAffectedWorkspace[];
|
|
70
|
+
affectedWorkspacesTruncated: boolean;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface IControllerSessionReversionInfo {
|
|
74
|
+
undoAvailable: boolean;
|
|
75
|
+
redoAvailable: boolean;
|
|
76
|
+
groups: IControllerSessionReversionGroup[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface IControllerSlashCommandDescriptor<
|
|
80
|
+
TMetadata extends Record<string, unknown> = Record<string, never>,
|
|
81
|
+
> {
|
|
82
|
+
name: string;
|
|
83
|
+
description: string;
|
|
84
|
+
kind: TControllerSlashCommandKind;
|
|
85
|
+
hints: string[];
|
|
86
|
+
available: boolean;
|
|
87
|
+
unavailableReason?: string;
|
|
88
|
+
workspaceReversion: TControllerSlashWorkspaceReversion;
|
|
89
|
+
metadata: TMetadata;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface IControllerSlashListResult<
|
|
93
|
+
TDescriptor extends IControllerSlashCommandDescriptor = IControllerSlashCommandDescriptor,
|
|
94
|
+
> {
|
|
95
|
+
commands: TDescriptor[];
|
|
96
|
+
reversion: IControllerSessionReversionInfo;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type TControllerSlashExecuteResult<TResult = unknown> =
|
|
100
|
+
| { type: 'operation'; name: string }
|
|
101
|
+
| { type: 'handler-result'; name: string; result: TResult }
|
|
102
|
+
| { type: 'prompt-admission'; name: string; queueId?: string; runId?: string }
|
|
103
|
+
| { type: 'literal-prompt'; name: string };
|
|
104
|
+
export type TControllerTodoStatus = 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
|
105
|
+
export type TControllerResourceKind = 'terminal' | 'browser';
|
|
106
|
+
export type TControllerResourceLifecycle = 'active' | 'retiring' | 'retired';
|
|
107
|
+
export type TControllerResourceAgentAvailability =
|
|
108
|
+
| 'detached'
|
|
109
|
+
| 'transitioning'
|
|
110
|
+
| 'available'
|
|
111
|
+
| 'dependencyUnavailable';
|
|
112
|
+
export type TControllerTerminalProcessState = 'running' | 'stopped';
|
|
113
|
+
export type TControllerBrowserRuntimeState = 'available' | 'unavailable';
|
|
114
|
+
|
|
115
|
+
export type TControllerUpgradePhase =
|
|
116
|
+
| 'preparing'
|
|
117
|
+
| 'pausing'
|
|
118
|
+
| 'installing'
|
|
119
|
+
| 'restarting'
|
|
120
|
+
| 'continuing'
|
|
121
|
+
| 'completed'
|
|
122
|
+
| 'failed';
|
|
123
|
+
|
|
124
|
+
export interface IControllerUpgradeStatus {
|
|
125
|
+
fromVersion: string;
|
|
126
|
+
toVersion: string;
|
|
127
|
+
phase: TControllerUpgradePhase;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface IControllerStatus {
|
|
131
|
+
packageName: string;
|
|
132
|
+
packageVersion: string;
|
|
133
|
+
protocolVersion: typeof controllerProtocolVersion;
|
|
134
|
+
upgradeManagementVersion: number;
|
|
135
|
+
controllerPid: number;
|
|
136
|
+
processGroupId: number;
|
|
137
|
+
processFingerprint: string;
|
|
138
|
+
processMode: TControllerProcessMode;
|
|
139
|
+
lifecycleState: TControllerLifecycleState;
|
|
140
|
+
startedAt: number;
|
|
141
|
+
setupRequired: boolean;
|
|
142
|
+
upgrade?: IControllerUpgradeStatus;
|
|
143
|
+
harnesses: Array<{
|
|
144
|
+
harnessId: TControllerSessionHarnessId;
|
|
145
|
+
pid?: number;
|
|
146
|
+
state: TControllerHarnessLifecycleState;
|
|
147
|
+
healthy: boolean;
|
|
148
|
+
version?: string;
|
|
149
|
+
}>;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface IControllerSystemMetrics {
|
|
153
|
+
sampledAt: number;
|
|
154
|
+
cpuUsagePercent: number | null;
|
|
155
|
+
/** Actively used memory, excluding reclaimable buffers and caches. */
|
|
156
|
+
memoryUsedBytes: number | null;
|
|
157
|
+
memoryTotalBytes: number | null;
|
|
158
|
+
networkReceiveBytesPerSecond: number | null;
|
|
159
|
+
networkTransmitBytesPerSecond: number | null;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface IControllerProject {
|
|
163
|
+
id: string;
|
|
164
|
+
/** Path relative to the configured projects root; doubles as display name. */
|
|
165
|
+
name: string;
|
|
166
|
+
/** Absolute resolved path of the project worktree. */
|
|
167
|
+
directory: string;
|
|
168
|
+
createdAt: number;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface IControllerResourceAttachment {
|
|
172
|
+
/** Stable authority owned by this resource for its complete lifetime. */
|
|
173
|
+
authorityId: string;
|
|
174
|
+
/** Monotonic fence advanced by every attach, detach, or reassignment. */
|
|
175
|
+
revision: number;
|
|
176
|
+
sessionId: TControllerSessionId | null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface IControllerResourceBase {
|
|
180
|
+
id: string;
|
|
181
|
+
projectId: string;
|
|
182
|
+
kind: TControllerResourceKind;
|
|
183
|
+
title: string;
|
|
184
|
+
lifecycle: TControllerResourceLifecycle;
|
|
185
|
+
attachment: IControllerResourceAttachment;
|
|
186
|
+
agentAvailability: TControllerResourceAgentAvailability;
|
|
187
|
+
createdAt: number;
|
|
188
|
+
updatedAt: number;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface IControllerTerminalResource extends IControllerResourceBase {
|
|
192
|
+
kind: 'terminal';
|
|
193
|
+
command: string;
|
|
194
|
+
cwd: string;
|
|
195
|
+
processState: TControllerTerminalProcessState;
|
|
196
|
+
stoppedAt?: number;
|
|
197
|
+
lastExitCode?: number;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface IControllerBrowserResource extends IControllerResourceBase {
|
|
201
|
+
kind: 'browser';
|
|
202
|
+
browserRuntimeState: TControllerBrowserRuntimeState;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export type TControllerResource = IControllerTerminalResource | IControllerBrowserResource;
|
|
206
|
+
|
|
207
|
+
export interface IControllerBrowserViewport {
|
|
208
|
+
width: number;
|
|
209
|
+
height: number;
|
|
210
|
+
deviceScaleFactor: number;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface IControllerBrowserTabState {
|
|
214
|
+
id: string;
|
|
215
|
+
url: string;
|
|
216
|
+
title: string;
|
|
217
|
+
active: boolean;
|
|
218
|
+
status: 'open' | 'crashed';
|
|
219
|
+
generation: number;
|
|
220
|
+
appliedViewportRevision: number;
|
|
221
|
+
streaming: boolean;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface IControllerBrowserViewState {
|
|
225
|
+
status: 'stopped' | 'starting' | 'running' | 'stopping';
|
|
226
|
+
activeTabId: string | null;
|
|
227
|
+
viewportRevision: number;
|
|
228
|
+
viewport: IControllerBrowserViewport;
|
|
229
|
+
tabs: IControllerBrowserTabState[];
|
|
230
|
+
lastError?: { code: string; message: string; fatal: boolean; tabId?: string };
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface IControllerBrowserFrame<
|
|
234
|
+
TDirection extends plugins.typedrequestInterfaces.TVirtualStreamDirection,
|
|
235
|
+
> {
|
|
236
|
+
tabId: string;
|
|
237
|
+
sequence: number;
|
|
238
|
+
generation: number;
|
|
239
|
+
viewportRevision: number;
|
|
240
|
+
viewport: IControllerBrowserViewport;
|
|
241
|
+
format: 'jpeg' | 'png';
|
|
242
|
+
mimeType: 'image/jpeg' | 'image/png';
|
|
243
|
+
width: number;
|
|
244
|
+
height: number;
|
|
245
|
+
metadata: {
|
|
246
|
+
offsetTop: number;
|
|
247
|
+
pageScaleFactor: number;
|
|
248
|
+
deviceWidth: number;
|
|
249
|
+
deviceHeight: number;
|
|
250
|
+
scrollOffsetX: number;
|
|
251
|
+
scrollOffsetY: number;
|
|
252
|
+
timestamp?: number;
|
|
253
|
+
};
|
|
254
|
+
dataStream: plugins.typedrequestInterfaces.TVirtualStream<TDirection>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export type TControllerBrowserViewEvent<
|
|
258
|
+
TDirection extends plugins.typedrequestInterfaces.TVirtualStreamDirection,
|
|
259
|
+
> =
|
|
260
|
+
| { type: 'state'; state: IControllerBrowserViewState }
|
|
261
|
+
| { type: 'frame'; frame: IControllerBrowserFrame<TDirection> }
|
|
262
|
+
| { type: 'error'; error: { code: string; message: string; fatal: boolean; tabId?: string } };
|
|
263
|
+
|
|
264
|
+
export interface IControllerBrowserFrameAcknowledgement {
|
|
265
|
+
tabId: string;
|
|
266
|
+
sequence: number;
|
|
267
|
+
generation: number;
|
|
268
|
+
viewportRevision: number;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface IControllerBrowserInputBase {
|
|
272
|
+
tabId: string;
|
|
273
|
+
generation: number;
|
|
274
|
+
viewportRevision: number;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export interface IControllerBrowserModifierState {
|
|
278
|
+
alt?: boolean;
|
|
279
|
+
control?: boolean;
|
|
280
|
+
meta?: boolean;
|
|
281
|
+
shift?: boolean;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export interface IControllerBrowserMouseInput extends IControllerBrowserInputBase {
|
|
285
|
+
type: 'move' | 'down' | 'up';
|
|
286
|
+
x: number;
|
|
287
|
+
y: number;
|
|
288
|
+
button?: 'none' | 'left' | 'middle' | 'right' | 'back' | 'forward';
|
|
289
|
+
buttons?: number;
|
|
290
|
+
clickCount?: number;
|
|
291
|
+
modifiers?: IControllerBrowserModifierState;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface IControllerBrowserWheelInput extends IControllerBrowserInputBase {
|
|
295
|
+
x: number;
|
|
296
|
+
y: number;
|
|
297
|
+
deltaX: number;
|
|
298
|
+
deltaY: number;
|
|
299
|
+
modifiers?: IControllerBrowserModifierState;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export interface IControllerBrowserKeyInput extends IControllerBrowserInputBase {
|
|
303
|
+
type: 'down' | 'up';
|
|
304
|
+
key: string;
|
|
305
|
+
code?: string;
|
|
306
|
+
text?: string;
|
|
307
|
+
unmodifiedText?: string;
|
|
308
|
+
windowsVirtualKeyCode?: number;
|
|
309
|
+
nativeVirtualKeyCode?: number;
|
|
310
|
+
autoRepeat?: boolean;
|
|
311
|
+
isKeypad?: boolean;
|
|
312
|
+
location?: number;
|
|
313
|
+
modifiers?: IControllerBrowserModifierState;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export type TControllerBrowserViewOperation =
|
|
317
|
+
| { type: 'acknowledgeFrame'; acknowledgement: IControllerBrowserFrameAcknowledgement }
|
|
318
|
+
| { type: 'setViewport'; viewport: IControllerBrowserViewport }
|
|
319
|
+
| { type: 'dispatchMouse'; input: IControllerBrowserMouseInput }
|
|
320
|
+
| { type: 'dispatchWheel'; input: IControllerBrowserWheelInput }
|
|
321
|
+
| { type: 'dispatchKey'; input: IControllerBrowserKeyInput }
|
|
322
|
+
| { type: 'insertText'; input: IControllerBrowserInputBase & { text: string } }
|
|
323
|
+
| { type: 'navigate'; url: string; tabId?: string; timeoutMs?: number }
|
|
324
|
+
| { type: 'createTab'; url?: string; activate?: boolean }
|
|
325
|
+
| { type: 'activateTab'; tabId: string }
|
|
326
|
+
| { type: 'closeTab'; tabId: string }
|
|
327
|
+
| { type: 'back' | 'forward' | 'reload'; tabId?: string };
|
|
328
|
+
|
|
329
|
+
export interface IControllerPathSuggestion {
|
|
330
|
+
/**
|
|
331
|
+
* Path usable directly for project registration: relative to the projects
|
|
332
|
+
* root, or absolute when the query that produced it was absolute.
|
|
333
|
+
*/
|
|
334
|
+
path: string;
|
|
335
|
+
/** Last path segment, for display. */
|
|
336
|
+
name: string;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export interface IControllerOpenCodeModelChoice {
|
|
340
|
+
harnessId: 'opencode';
|
|
341
|
+
providerID: string;
|
|
342
|
+
modelID: string;
|
|
343
|
+
/** Reasoning-effort variant name as advertised by the model (e.g. 'high'). */
|
|
344
|
+
variant?: string;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export interface IControllerFlexModelChoice {
|
|
348
|
+
harnessId: 'flex';
|
|
349
|
+
providerConnectionId: string;
|
|
350
|
+
providerID: string;
|
|
351
|
+
modelID: string;
|
|
352
|
+
/** Reasoning-effort variant name as advertised by the model (e.g. 'high'). */
|
|
353
|
+
variant?: string;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export type TControllerModelChoice =
|
|
357
|
+
| IControllerOpenCodeModelChoice
|
|
358
|
+
| IControllerFlexModelChoice;
|
|
359
|
+
|
|
360
|
+
export interface IControllerOpenCodeModelOption extends IControllerOpenCodeModelChoice {
|
|
361
|
+
providerName: string;
|
|
362
|
+
modelName: string;
|
|
363
|
+
/** Available reasoning-effort variant names, in catalog order. Empty when the model has none. */
|
|
364
|
+
variants: string[];
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export interface IControllerFlexModelOption extends IControllerFlexModelChoice {
|
|
368
|
+
providerName: string;
|
|
369
|
+
modelName: string;
|
|
370
|
+
/** Available reasoning-effort variant names, in catalog order. Empty when the model has none. */
|
|
371
|
+
variants: string[];
|
|
372
|
+
/** Provider-advertised default for this exact account catalog. */
|
|
373
|
+
isDefault: boolean;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export type TControllerModelOption =
|
|
377
|
+
| IControllerOpenCodeModelOption
|
|
378
|
+
| IControllerFlexModelOption;
|
|
379
|
+
|
|
380
|
+
export interface IControllerSettings {
|
|
381
|
+
/** At most one default per session harness. */
|
|
382
|
+
defaultModels: TControllerModelChoice[];
|
|
383
|
+
/** When true, the controller replies 'once' to every pending permission request automatically. */
|
|
384
|
+
autoAcceptPermissions?: boolean;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export interface IControllerSession {
|
|
388
|
+
id: IControllerRuntimeId;
|
|
389
|
+
title: string;
|
|
390
|
+
parentId?: IControllerRuntimeId;
|
|
391
|
+
createdAt: number;
|
|
392
|
+
updatedAt: number;
|
|
393
|
+
/** Unix milliseconds when the session was archived in OpenCode; absent for active sessions. */
|
|
394
|
+
archivedAt?: number;
|
|
395
|
+
status: TControllerSessionStatus;
|
|
396
|
+
/** True while OpenCode has a pending permission or question for this session. */
|
|
397
|
+
attention?: boolean;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export interface IControllerReasoningPart {
|
|
401
|
+
id: IControllerRuntimeId;
|
|
402
|
+
text: string;
|
|
403
|
+
startedAt?: number;
|
|
404
|
+
endedAt?: number;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export interface IControllerToolCall {
|
|
408
|
+
id: IControllerRuntimeId;
|
|
409
|
+
name: string;
|
|
410
|
+
status: TControllerToolStatus;
|
|
411
|
+
input?: unknown;
|
|
412
|
+
output?: unknown;
|
|
413
|
+
/** Process exit code when output is one combined stream. */
|
|
414
|
+
exitCode?: number;
|
|
415
|
+
errorText?: string;
|
|
416
|
+
/** Session spawned by this call (subagent/task tools). */
|
|
417
|
+
childSessionId?: IControllerRuntimeId;
|
|
418
|
+
/** "providerID/modelID" the spawned session runs on (subagent/task tools). */
|
|
419
|
+
model?: string;
|
|
420
|
+
startedAt?: number;
|
|
421
|
+
finishedAt?: number;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/** Replace-only live snapshot for one harness tool execution. */
|
|
425
|
+
export interface IControllerToolExecution {
|
|
426
|
+
sessionId: IControllerRuntimeId;
|
|
427
|
+
messageId: IControllerRuntimeId;
|
|
428
|
+
partId: IControllerRuntimeId;
|
|
429
|
+
callId: IControllerRuntimeId;
|
|
430
|
+
toolName: string;
|
|
431
|
+
status: TControllerToolStatus;
|
|
432
|
+
input?: unknown;
|
|
433
|
+
output?: unknown;
|
|
434
|
+
exitCode?: number;
|
|
435
|
+
errorText?: string;
|
|
436
|
+
childSessionId?: IControllerRuntimeId;
|
|
437
|
+
model?: string;
|
|
438
|
+
startedAt?: number;
|
|
439
|
+
finishedAt?: number;
|
|
440
|
+
/** Authoritative source coordinates; required for Flex and absent for OpenCode. */
|
|
441
|
+
order?: IControllerTranscriptOrder;
|
|
442
|
+
/** Harness tool-state timestamp used to reject delayed state regressions. */
|
|
443
|
+
sourceUpdatedAt: number;
|
|
444
|
+
/** Controller-process monotonic ordering for delivered snapshots. */
|
|
445
|
+
revision: number;
|
|
446
|
+
/** Changes whenever the controller observes a new event stream for this harness. */
|
|
447
|
+
streamEpoch: number;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/** Replace-only live Assistant reasoning snapshot from either session harness. */
|
|
451
|
+
export interface IControllerReasoningUpdate {
|
|
452
|
+
sessionId: IControllerRuntimeId;
|
|
453
|
+
messageId: IControllerRuntimeId;
|
|
454
|
+
partId: IControllerRuntimeId;
|
|
455
|
+
text: string;
|
|
456
|
+
status: 'running' | 'completed' | 'cancelled';
|
|
457
|
+
/** Authoritative source coordinates; required for Flex and absent for OpenCode. */
|
|
458
|
+
order?: IControllerTranscriptOrder;
|
|
459
|
+
sourceUpdatedAt: number;
|
|
460
|
+
revision: number;
|
|
461
|
+
streamEpoch: number;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/** Replace-only live Assistant text snapshot from either session harness. */
|
|
465
|
+
export interface IControllerTextUpdate {
|
|
466
|
+
sessionId: IControllerRuntimeId;
|
|
467
|
+
messageId: IControllerRuntimeId;
|
|
468
|
+
partId: IControllerRuntimeId;
|
|
469
|
+
text: string;
|
|
470
|
+
status: 'running' | 'completed';
|
|
471
|
+
/** Authoritative source coordinates; required for Flex and absent for OpenCode. */
|
|
472
|
+
order?: IControllerTranscriptOrder;
|
|
473
|
+
sourceUpdatedAt: number;
|
|
474
|
+
revision: number;
|
|
475
|
+
streamEpoch: number;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export interface IControllerToolStreamCursor {
|
|
479
|
+
streamEpoch: number;
|
|
480
|
+
revision: number;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export interface IControllerMessageStreamCursor {
|
|
484
|
+
streamEpoch: number;
|
|
485
|
+
revision: number;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export interface IControllerUsage {
|
|
489
|
+
inputTokens?: number;
|
|
490
|
+
outputTokens?: number;
|
|
491
|
+
totalTokens?: number;
|
|
492
|
+
cacheReadTokens?: number;
|
|
493
|
+
cacheWriteTokens?: number;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export interface IControllerTranscriptOrder {
|
|
497
|
+
messageIndex: number;
|
|
498
|
+
partIndex: number;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export interface IControllerDraftAttachment {
|
|
502
|
+
id: string;
|
|
503
|
+
name: string;
|
|
504
|
+
mediaType: string;
|
|
505
|
+
size: number;
|
|
506
|
+
kind: 'image' | 'text' | 'binary';
|
|
507
|
+
dataBase64: string;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** Controller-memory-only composer state for one exact session. */
|
|
511
|
+
export interface IControllerSessionDraft {
|
|
512
|
+
text: string;
|
|
513
|
+
attachments: IControllerDraftAttachment[];
|
|
514
|
+
revision: number;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/** Authoritative replacement fields changed by one draft mutation. */
|
|
518
|
+
export interface IControllerSessionDraftUpdate {
|
|
519
|
+
revision: number;
|
|
520
|
+
text?: string;
|
|
521
|
+
attachments?: IControllerDraftAttachment[];
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/** Controller-memory projection of a harness-accepted prompt not yet present in transcript hydration. */
|
|
525
|
+
export interface IControllerPendingPrompt {
|
|
526
|
+
id: IControllerRuntimeId;
|
|
527
|
+
text: string;
|
|
528
|
+
attachments: Array<Omit<IControllerDraftAttachment, 'dataBase64'>>;
|
|
529
|
+
createdAt: number;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/** Session-level token facts. Metrics that cannot be proven stay absent. */
|
|
533
|
+
export interface IControllerSessionMetrics {
|
|
534
|
+
lifetimeUsedTokens?: number;
|
|
535
|
+
compactionCount?: number;
|
|
536
|
+
tokensBeforeLatestCompaction?: number;
|
|
537
|
+
maxContextTokens?: number;
|
|
538
|
+
currentContextTokens?: number;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
export type TControllerScratchpadUpdater = 'user' | 'intelligence' | 'agent' | 'application';
|
|
542
|
+
|
|
543
|
+
export interface IControllerSessionScratchpad {
|
|
544
|
+
/** Stable controller/project/qualified-session identity. */
|
|
545
|
+
id: string;
|
|
546
|
+
text: string;
|
|
547
|
+
revision: number;
|
|
548
|
+
updatedAt?: number;
|
|
549
|
+
updatedBy?: TControllerScratchpadUpdater;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export type TControllerIntelligenceStatus = 'running' | 'completed' | 'error';
|
|
553
|
+
|
|
554
|
+
export interface IControllerIntelligenceExchange {
|
|
555
|
+
id: string;
|
|
556
|
+
question: string;
|
|
557
|
+
status: TControllerIntelligenceStatus;
|
|
558
|
+
answer?: string;
|
|
559
|
+
error?: string;
|
|
560
|
+
model?: string;
|
|
561
|
+
/** Luna answered, but a newer user scratchpad revision won the write race. */
|
|
562
|
+
scratchpadConflict?: true;
|
|
563
|
+
createdAt: number;
|
|
564
|
+
completedAt?: number;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
export interface IControllerMessage {
|
|
568
|
+
id: IControllerRuntimeId;
|
|
569
|
+
role: TControllerMessageRole;
|
|
570
|
+
text: string;
|
|
571
|
+
createdAt: number;
|
|
572
|
+
/** Authoritative source chronology when the harness exposes ordered messages and parts. */
|
|
573
|
+
order?: IControllerTranscriptOrder;
|
|
574
|
+
updatedAt?: number;
|
|
575
|
+
streaming?: boolean;
|
|
576
|
+
reasoning?: IControllerReasoningPart[];
|
|
577
|
+
toolCall?: IControllerToolCall;
|
|
578
|
+
usage?: IControllerUsage;
|
|
579
|
+
error?: string;
|
|
580
|
+
/** "providerID/modelID" that produced this assistant message. */
|
|
581
|
+
model?: string;
|
|
582
|
+
/** Model variant (reasoning effort) this message ran with. */
|
|
583
|
+
effort?: string;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
export interface IControllerPermission {
|
|
587
|
+
id: IControllerRuntimeId;
|
|
588
|
+
sessionId: IControllerRuntimeId;
|
|
589
|
+
title: string;
|
|
590
|
+
type: string;
|
|
591
|
+
patterns: string[];
|
|
592
|
+
metadata: Record<string, unknown>;
|
|
593
|
+
createdAt?: number;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
export interface IControllerTodo {
|
|
597
|
+
id?: IControllerRuntimeId;
|
|
598
|
+
content: string;
|
|
599
|
+
status: TControllerTodoStatus;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
export interface IControllerQuestionOption {
|
|
603
|
+
/** Short display text. */
|
|
604
|
+
label: string;
|
|
605
|
+
/** Explanation of the choice. */
|
|
606
|
+
description: string;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export interface IControllerQuestionItem {
|
|
610
|
+
/** Complete question text. */
|
|
611
|
+
question: string;
|
|
612
|
+
/** Very short label for the question, as advertised by OpenCode. */
|
|
613
|
+
header: string;
|
|
614
|
+
options: IControllerQuestionOption[];
|
|
615
|
+
/** Multiple answers may be selected. */
|
|
616
|
+
multiple?: boolean;
|
|
617
|
+
/** A free-text answer is accepted besides the listed options. */
|
|
618
|
+
custom?: boolean;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
export interface IControllerQuestion {
|
|
622
|
+
id: IControllerRuntimeId;
|
|
623
|
+
sessionId: IControllerRuntimeId;
|
|
624
|
+
questions: IControllerQuestionItem[];
|
|
625
|
+
/** Tool call that raised the ask; links the request to its transcript entry. */
|
|
626
|
+
toolCallId?: IControllerRuntimeId;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export interface IControllerTerminal {
|
|
630
|
+
/** Controller-generated opaque PTY identifier. */
|
|
631
|
+
id: TControllerTerminalId;
|
|
632
|
+
title: string;
|
|
633
|
+
command: string;
|
|
634
|
+
cwd: string;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
export interface IControllerSessionGroup {
|
|
638
|
+
/** Client-generated stable identifier. */
|
|
639
|
+
id: string;
|
|
640
|
+
name: string;
|
|
641
|
+
/** Historical field name: conversation and live-terminal IDs in display order. */
|
|
642
|
+
sessionIds: TControllerSessionId[];
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export interface IControllerSessionLayout {
|
|
646
|
+
groups: IControllerSessionGroup[];
|
|
647
|
+
/** Historical field name: explicit display order for ungrouped layout items. */
|
|
648
|
+
ungroupedSessionIds: TControllerSessionId[];
|
|
649
|
+
/** Monotonic persistence revision used to reject stale browser updates. */
|
|
650
|
+
revision: number;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
export interface IControllerSessionDetail {
|
|
654
|
+
session: IControllerSession;
|
|
655
|
+
messagePage: IControllerMessagePage;
|
|
656
|
+
pendingPrompts: IControllerPendingPrompt[];
|
|
657
|
+
permissions: IControllerPermission[];
|
|
658
|
+
questions: IControllerQuestion[];
|
|
659
|
+
todos: IControllerTodo[];
|
|
660
|
+
scratchpad: IControllerSessionScratchpad;
|
|
661
|
+
intelligenceExchanges: IControllerIntelligenceExchange[];
|
|
662
|
+
/** Effective auto-accept state for this chat: its own yolo switch or the global setting. */
|
|
663
|
+
autoAcceptPermissions?: boolean;
|
|
664
|
+
/** Durable per-session choice; the harness default applies when absent. */
|
|
665
|
+
modelChoice?: TControllerModelChoice;
|
|
666
|
+
/** "providerID/modelID" that answered most recently in this chat. */
|
|
667
|
+
model?: string;
|
|
668
|
+
/** Model variant (reasoning effort) of the most recent answer. */
|
|
669
|
+
effort?: string;
|
|
670
|
+
/** Latest live-tool cursor covered by this authoritative harness snapshot. */
|
|
671
|
+
toolStreamCursor: IControllerToolStreamCursor;
|
|
672
|
+
/** Latest live Assistant text/reasoning cursor covered by this snapshot. */
|
|
673
|
+
messageStreamCursor: IControllerMessageStreamCursor;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/** One source message and all normalized transcript entries derived from it. */
|
|
677
|
+
export interface IControllerMessageBundle {
|
|
678
|
+
sourceMessageId: IControllerRuntimeId;
|
|
679
|
+
structuralDigest: string;
|
|
680
|
+
messages: IControllerMessage[];
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
export interface IControllerMessagePage {
|
|
684
|
+
bundles: IControllerMessageBundle[];
|
|
685
|
+
/** Opaque harness cursor for the next older page. */
|
|
686
|
+
nextCursor?: string;
|
|
687
|
+
/** The harness retained only a bounded subset of the source transcript. */
|
|
688
|
+
truncated?: boolean;
|
|
689
|
+
/** The controller omitted source bundles or payloads to enforce its transfer budget. */
|
|
690
|
+
historyLimited?: boolean;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
export interface IControllerSessionAuxiliary {
|
|
694
|
+
sessionMetrics: IControllerSessionMetrics;
|
|
695
|
+
sessionIntelligenceEnabled: boolean;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
export type TControllerProviderLoginFlow = 'device';
|
|
699
|
+
export type TControllerProviderLoginStatus = 'pending' | 'succeeded' | 'cancelled' | 'failed';
|
|
700
|
+
export type TControllerProviderConnectionStatus = 'active' | 'reauthRequired';
|
|
701
|
+
export type TControllerModelRefreshJobStatus =
|
|
702
|
+
| 'pending'
|
|
703
|
+
| 'running'
|
|
704
|
+
| 'completed'
|
|
705
|
+
| 'failed'
|
|
706
|
+
| 'cancelled';
|
|
707
|
+
|
|
708
|
+
export interface IControllerProvider {
|
|
709
|
+
id: string;
|
|
710
|
+
name: string;
|
|
711
|
+
loginFlows: TControllerProviderLoginFlow[];
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
export interface IControllerProviderAccountSummary {
|
|
715
|
+
accountId?: string;
|
|
716
|
+
email?: string;
|
|
717
|
+
plan?: string;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
export interface IControllerProviderConnection {
|
|
721
|
+
/** Controller-owned opaque stable identifier. */
|
|
722
|
+
id: string;
|
|
723
|
+
providerID: string;
|
|
724
|
+
status: TControllerProviderConnectionStatus;
|
|
725
|
+
account: IControllerProviderAccountSummary;
|
|
726
|
+
/** True when this account currently authenticates the controller-owned OpenCode runtime. */
|
|
727
|
+
selectedForOpenCode?: true;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
export interface IControllerProviderRateLimitWindow {
|
|
731
|
+
usedPercent: number;
|
|
732
|
+
limitWindowSeconds: number;
|
|
733
|
+
resetAfterSeconds: number;
|
|
734
|
+
/** Unix timestamp in seconds. */
|
|
735
|
+
resetsAt: number;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
export interface IControllerProviderRateLimitDetails {
|
|
739
|
+
allowed: boolean;
|
|
740
|
+
limitReached: boolean;
|
|
741
|
+
primaryWindow?: IControllerProviderRateLimitWindow;
|
|
742
|
+
secondaryWindow?: IControllerProviderRateLimitWindow;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
export interface IControllerProviderAdditionalRateLimit {
|
|
746
|
+
limitName: string;
|
|
747
|
+
meteredFeature: string;
|
|
748
|
+
rateLimit?: IControllerProviderRateLimitDetails;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/** Public metadata-only account quota snapshot. Credentials and raw provider responses stay private. */
|
|
752
|
+
export interface IControllerProviderAccountRateLimits {
|
|
753
|
+
providerConnectionId: string;
|
|
754
|
+
providerID: 'openai';
|
|
755
|
+
plan: string;
|
|
756
|
+
observedAt: string;
|
|
757
|
+
rateLimit?: IControllerProviderRateLimitDetails;
|
|
758
|
+
additionalRateLimits: IControllerProviderAdditionalRateLimit[];
|
|
759
|
+
rateLimitReachedType?: string;
|
|
760
|
+
rateLimitResetCreditsAvailableCount?: number;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/** Public device-login state. Provider credentials and provider responses never cross this boundary. */
|
|
764
|
+
export interface IControllerProviderLogin {
|
|
765
|
+
id: IControllerRuntimeId;
|
|
766
|
+
verificationUrl: string;
|
|
767
|
+
userCode: string;
|
|
768
|
+
status: TControllerProviderLoginStatus;
|
|
769
|
+
account?: IControllerProviderAccountSummary;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
export interface IControllerModelRefreshJob {
|
|
773
|
+
id: IControllerRuntimeId;
|
|
774
|
+
providerConnectionId: string;
|
|
775
|
+
status: TControllerModelRefreshJobStatus;
|
|
776
|
+
modelCount?: number;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Single source of the controller event vocabulary: the browser socket
|
|
781
|
+
* client validates incoming events against this list at runtime, so a type
|
|
782
|
+
* added here is automatically deliverable — the two cannot drift apart.
|
|
783
|
+
*/
|
|
784
|
+
export const controllerEventTypes = [
|
|
785
|
+
'sessions.changed',
|
|
786
|
+
'session.changed',
|
|
787
|
+
'session.draft.changed',
|
|
788
|
+
'session.history.changed',
|
|
789
|
+
'session.tool.updated',
|
|
790
|
+
'session.reasoning.updated',
|
|
791
|
+
'session.text.updated',
|
|
792
|
+
'permissions.changed',
|
|
793
|
+
'harness.changed',
|
|
794
|
+
'projects.changed',
|
|
795
|
+
'settings.changed',
|
|
796
|
+
'sessiongroups.changed',
|
|
797
|
+
'resources.changed',
|
|
798
|
+
'terminals.changed',
|
|
799
|
+
'upgrade.changed',
|
|
800
|
+
] as const;
|
|
801
|
+
export type TControllerEventType = (typeof controllerEventTypes)[number];
|
|
802
|
+
|
|
803
|
+
export interface IControllerEvent {
|
|
804
|
+
type: TControllerEventType;
|
|
805
|
+
harnessId?: TControllerSessionHarnessId;
|
|
806
|
+
projectId?: string;
|
|
807
|
+
sessionId?: IControllerRuntimeId;
|
|
808
|
+
/** Authoritative status carried by harness session status/idle events. */
|
|
809
|
+
sessionStatus?: TControllerSessionStatus;
|
|
810
|
+
/** Literal marker carried only by a session.changed event from session.error. */
|
|
811
|
+
sessionError?: true;
|
|
812
|
+
/** Present only on live OpenCode or Flex tool snapshots. */
|
|
813
|
+
toolExecution?: IControllerToolExecution;
|
|
814
|
+
/** Present only on a live OpenCode or Flex reasoning snapshot. */
|
|
815
|
+
reasoningUpdate?: IControllerReasoningUpdate;
|
|
816
|
+
/** Present only on a live OpenCode or Flex text snapshot. */
|
|
817
|
+
textUpdate?: IControllerTextUpdate;
|
|
818
|
+
/** Present only on a session.draft.changed event. */
|
|
819
|
+
sessionDraftUpdate?: IControllerSessionDraftUpdate;
|
|
820
|
+
/** Ordered harness stream barrier carried by harness.changed. */
|
|
821
|
+
toolStreamEpoch?: number;
|
|
822
|
+
/** Ordered Assistant message stream barrier carried by harness.changed. */
|
|
823
|
+
messageStreamEpoch?: number;
|
|
824
|
+
/** Sanitized upgrade metadata; present only on upgrade.changed. */
|
|
825
|
+
upgrade?: IControllerUpgradeStatus;
|
|
826
|
+
timestamp: number;
|
|
827
|
+
}
|