@steerable/agent-shell 0.6.53 → 0.6.56

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.
Files changed (55) hide show
  1. package/dist/brand.js +1 -1
  2. package/dist/host/pack-assembly.d.ts +6 -16
  3. package/dist/host/pack-assembly.js +3 -4
  4. package/dist/host/visible-terminal-exec.js +1 -1
  5. package/dist/i18n.d.ts +23 -0
  6. package/dist/i18n.js +87 -0
  7. package/dist/image-attachment.d.ts +31 -4
  8. package/dist/image-attachment.js +13 -18
  9. package/dist/json-store.js +3 -6
  10. package/dist/local-backend/portable-bundle.js +8 -7
  11. package/dist/local-backend/router.js +2 -2
  12. package/dist/local-backend/skills/10-goal/SKILL.md +1 -1
  13. package/dist/local-backend/skills/11-loop/SKILL.md +1 -1
  14. package/dist/local-backend/skills/12-create-skill/SKILL.md +2 -2
  15. package/dist/local-executor.js +1 -1
  16. package/dist/local-script-registry.js +2 -2
  17. package/dist/log.d.ts +7 -13
  18. package/dist/log.js +43 -8
  19. package/dist/mcp-server-registry.d.ts +3 -3
  20. package/dist/mcp-server-registry.js +2 -2
  21. package/dist/product-config.d.ts +10 -14
  22. package/dist/project-registry.d.ts +3 -3
  23. package/dist/project-registry.js +2 -2
  24. package/dist/runtime.d.ts +8 -54
  25. package/dist/runtime.js +15 -129
  26. package/dist/scenario/pack.d.ts +1 -1
  27. package/dist/scenario/registry.d.ts +4 -5
  28. package/dist/scenario/registry.js +2 -10
  29. package/dist/server/http-server.js +1 -1
  30. package/dist/server/start.js +2 -5
  31. package/dist/sidecar/boot.js +1 -1
  32. package/dist/sidecar/exec-sandbox.js +1 -1
  33. package/dist/sidecar/reverse-spawn.js +7 -16
  34. package/dist/sidecar/supervisor.d.ts +0 -2
  35. package/dist/sidecar/supervisor.js +7 -30
  36. package/dist/storage/index.js +1 -1
  37. package/dist/storage/write-lease-error.d.ts +2 -11
  38. package/dist/storage/write-lease-error.js +3 -8
  39. package/dist/terminal-manager.js +1 -1
  40. package/package.json +6 -14
  41. package/dist/app-update-electron.d.ts +0 -5
  42. package/dist/app-update-electron.js +0 -66
  43. package/dist/app-update.d.ts +0 -92
  44. package/dist/app-update.js +0 -213
  45. package/dist/host/ipc.d.ts +0 -11
  46. package/dist/host/ipc.js +0 -20
  47. package/dist/main.d.ts +0 -1
  48. package/dist/main.js +0 -967
  49. package/dist/preload-default.d.ts +0 -1
  50. package/dist/preload-default.js +0 -9
  51. package/dist/preload.cjs +0 -425
  52. package/dist/preload.d.ts +0 -20
  53. package/dist/preload.js +0 -442
  54. package/dist/single-instance.d.ts +0 -11
  55. package/dist/single-instance.js +0 -21
@@ -1,5 +0,0 @@
1
- /**
2
- * electron-updater 适配。只在桌面主进程启用更新时加载。
3
- */
4
- import type { AppUpdaterPort } from './app-update.js';
5
- export declare function createElectronAppUpdater(): AppUpdaterPort;
@@ -1,66 +0,0 @@
1
- /**
2
- * electron-updater 适配。只在桌面主进程启用更新时加载。
3
- */
4
- import log from 'electron-log';
5
- import electronUpdater from 'electron-updater';
6
- export function createElectronAppUpdater() {
7
- const { autoUpdater } = electronUpdater;
8
- autoUpdater.logger = log;
9
- return {
10
- get autoDownload() {
11
- return autoUpdater.autoDownload;
12
- },
13
- set autoDownload(value) {
14
- autoUpdater.autoDownload = value;
15
- },
16
- get autoInstallOnAppQuit() {
17
- return autoUpdater.autoInstallOnAppQuit;
18
- },
19
- set autoInstallOnAppQuit(value) {
20
- autoUpdater.autoInstallOnAppQuit = value;
21
- },
22
- get allowDowngrade() {
23
- return autoUpdater.allowDowngrade;
24
- },
25
- set allowDowngrade(value) {
26
- autoUpdater.allowDowngrade = value;
27
- },
28
- setFeedURL(options) {
29
- autoUpdater.setFeedURL(options);
30
- },
31
- async checkForUpdates() {
32
- const result = await autoUpdater.checkForUpdates();
33
- if (!result)
34
- return null;
35
- return {
36
- updateInfo: { version: result.updateInfo.version },
37
- isUpdateAvailable: result.isUpdateAvailable,
38
- };
39
- },
40
- quitAndInstall(isSilent, isForceRunAfter) {
41
- autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
42
- },
43
- on(event, listener) {
44
- if (event === 'download-progress') {
45
- autoUpdater.on('download-progress', listener);
46
- }
47
- else if (event === 'update-downloaded') {
48
- autoUpdater.on('update-downloaded', listener);
49
- }
50
- else {
51
- autoUpdater.on('error', listener);
52
- }
53
- },
54
- off(event, listener) {
55
- if (event === 'download-progress') {
56
- autoUpdater.off('download-progress', listener);
57
- }
58
- else if (event === 'update-downloaded') {
59
- autoUpdater.off('update-downloaded', listener);
60
- }
61
- else {
62
- autoUpdater.off('error', listener);
63
- }
64
- },
65
- };
66
- }
@@ -1,92 +0,0 @@
1
- /**
2
- * 桌面自动更新。产品经 `ProductConfig.updates.feedUrl` 注入 generic 通道;
3
- * 本模块只编排检查、下载和安装,具体传输交给 `AppUpdaterPort`
4
- * (生产环境是 electron-updater)。
5
- */
6
- export declare const APP_UPDATE_CHECK_INTERVAL_MS: number;
7
- export type AppUpdatePhase = 'disabled' | 'idle' | 'checking' | 'downloading' | 'ready' | 'installing' | 'error';
8
- export interface AppUpdateState {
9
- phase: AppUpdatePhase;
10
- version?: string;
11
- percent?: number;
12
- message?: string;
13
- }
14
- /** 渲染层看到的版本与更新状态。`version` 是当前安装版本。 */
15
- export interface AppReleaseSnapshot {
16
- version: string;
17
- enabled: boolean;
18
- phase: AppUpdatePhase;
19
- availableVersion?: string;
20
- percent?: number;
21
- message?: string;
22
- }
23
- export declare function toAppReleaseSnapshot(currentVersion: string, state: AppUpdateState): AppReleaseSnapshot;
24
- export interface AppUpdateCheckResult {
25
- updateInfo: {
26
- version: string;
27
- };
28
- isUpdateAvailable: boolean;
29
- }
30
- export interface AppUpdaterPort {
31
- autoDownload: boolean;
32
- autoInstallOnAppQuit: boolean;
33
- allowDowngrade: boolean;
34
- setFeedURL(options: {
35
- provider: 'generic';
36
- url: string;
37
- }): void;
38
- checkForUpdates(): Promise<AppUpdateCheckResult | null>;
39
- quitAndInstall(isSilent?: boolean, isForceRunAfter?: boolean): void;
40
- on(event: 'download-progress', listener: (progress: {
41
- percent: number;
42
- }) => void): void;
43
- on(event: 'update-downloaded', listener: (info: {
44
- version: string;
45
- }) => void): void;
46
- on(event: 'error', listener: (error: Error) => void): void;
47
- off(event: 'download-progress', listener: (progress: {
48
- percent: number;
49
- }) => void): void;
50
- off(event: 'update-downloaded', listener: (info: {
51
- version: string;
52
- }) => void): void;
53
- off(event: 'error', listener: (error: Error) => void): void;
54
- }
55
- export interface AppUpdateOptions {
56
- feedUrl?: string;
57
- packaged: boolean;
58
- currentVersion: string;
59
- env: NodeJS.ProcessEnv;
60
- updater: AppUpdaterPort;
61
- onState?: (state: AppUpdateState) => void;
62
- /** 测试注入。缺省写 `env.DEEPPATH_UPDATE_STATUS_FILE`。 */
63
- statusFile?: string;
64
- }
65
- export declare function appUpdateMenuAction(state: AppUpdateState): 'none' | 'check' | 'install';
66
- export declare function shouldNotifyUpdateReady(previous: AppUpdatePhase, next: AppUpdateState): boolean;
67
- export declare class AppUpdateController {
68
- private readonly options;
69
- private current;
70
- private enabled;
71
- private started;
72
- private disposed;
73
- private bound;
74
- private candidate;
75
- private downloadedVersion;
76
- private checkPromise;
77
- private cancelTimer;
78
- private readonly statusFile;
79
- constructor(options: AppUpdateOptions);
80
- get state(): AppUpdateState;
81
- start(): Promise<AppUpdateState>;
82
- checkNow(): Promise<AppUpdateState>;
83
- installNow(): AppUpdateState;
84
- dispose(): void;
85
- private bind;
86
- private readonly onProgress;
87
- private readonly onDownloaded;
88
- private readonly onError;
89
- private doCheck;
90
- private isNewer;
91
- private publish;
92
- }
@@ -1,213 +0,0 @@
1
- /**
2
- * 桌面自动更新。产品经 `ProductConfig.updates.feedUrl` 注入 generic 通道;
3
- * 本模块只编排检查、下载和安装,具体传输交给 `AppUpdaterPort`
4
- * (生产环境是 electron-updater)。
5
- */
6
- import { appendFileSync } from 'node:fs';
7
- import { gt, valid } from 'semver';
8
- export const APP_UPDATE_CHECK_INTERVAL_MS = 4 * 60 * 60 * 1000;
9
- export function toAppReleaseSnapshot(currentVersion, state) {
10
- const snapshot = {
11
- version: currentVersion,
12
- enabled: state.phase !== 'disabled',
13
- phase: state.phase,
14
- };
15
- if (state.version)
16
- snapshot.availableVersion = state.version;
17
- if (state.percent !== undefined)
18
- snapshot.percent = state.percent;
19
- if (state.message)
20
- snapshot.message = state.message;
21
- return snapshot;
22
- }
23
- export function appUpdateMenuAction(state) {
24
- if (state.phase === 'disabled')
25
- return 'none';
26
- if (state.phase === 'ready' || state.phase === 'installing')
27
- return 'install';
28
- return 'check';
29
- }
30
- export function shouldNotifyUpdateReady(previous, next) {
31
- return previous !== 'ready' && next.phase === 'ready' && Boolean(next.version);
32
- }
33
- function resolveFeed(options) {
34
- const override = options.env.DEEPPATH_UPDATE_FEED_URL?.trim() ?? '';
35
- const feedUrl = override || options.feedUrl?.trim() || '';
36
- const forceUnpackaged = options.env.DEEPPATH_APP_UPDATE === '1';
37
- if (!feedUrl || (!options.packaged && !forceUnpackaged))
38
- return { enabled: false };
39
- return { enabled: true, feedUrl };
40
- }
41
- function clampPercent(percent) {
42
- if (!Number.isFinite(percent))
43
- return 0;
44
- return Math.min(100, Math.max(0, percent));
45
- }
46
- function defaultSchedule(fn, ms) {
47
- const timer = setInterval(fn, ms);
48
- timer.unref();
49
- return () => clearInterval(timer);
50
- }
51
- export class AppUpdateController {
52
- options;
53
- current = { phase: 'disabled' };
54
- enabled = false;
55
- started = false;
56
- disposed = false;
57
- bound = false;
58
- candidate;
59
- downloadedVersion;
60
- checkPromise;
61
- cancelTimer;
62
- statusFile;
63
- constructor(options) {
64
- this.options = options;
65
- this.statusFile = options.statusFile ?? options.env.DEEPPATH_UPDATE_STATUS_FILE;
66
- }
67
- get state() {
68
- return this.current;
69
- }
70
- async start() {
71
- if (this.started)
72
- return this.checkPromise ?? this.state;
73
- this.started = true;
74
- const target = resolveFeed(this.options);
75
- if (!target.enabled)
76
- return this.publish({ phase: 'disabled' });
77
- this.enabled = true;
78
- this.options.updater.autoDownload = true;
79
- this.options.updater.autoInstallOnAppQuit = true;
80
- this.options.updater.allowDowngrade = false;
81
- this.options.updater.setFeedURL({ provider: 'generic', url: target.feedUrl });
82
- this.bind();
83
- const first = this.checkNow();
84
- this.cancelTimer = defaultSchedule(() => {
85
- void this.checkNow();
86
- }, APP_UPDATE_CHECK_INTERVAL_MS);
87
- return first;
88
- }
89
- checkNow() {
90
- if (this.disposed || !this.enabled)
91
- return Promise.resolve(this.state);
92
- if (this.state.phase === 'downloading' || this.state.phase === 'ready' || this.state.phase === 'installing') {
93
- return Promise.resolve(this.state);
94
- }
95
- if (this.checkPromise)
96
- return this.checkPromise;
97
- this.checkPromise = this.doCheck().finally(() => {
98
- this.checkPromise = undefined;
99
- });
100
- return this.checkPromise;
101
- }
102
- installNow() {
103
- if (this.disposed || this.state.phase !== 'ready' || !this.downloadedVersion)
104
- return this.state;
105
- const version = this.downloadedVersion;
106
- this.publish({ phase: 'installing', version });
107
- try {
108
- this.options.updater.quitAndInstall(false, true);
109
- }
110
- catch (error) {
111
- return this.publish({
112
- phase: 'error',
113
- version,
114
- message: error instanceof Error ? error.message : String(error),
115
- });
116
- }
117
- return this.state;
118
- }
119
- dispose() {
120
- this.disposed = true;
121
- this.cancelTimer?.();
122
- this.cancelTimer = undefined;
123
- if (!this.bound)
124
- return;
125
- this.options.updater.off('download-progress', this.onProgress);
126
- this.options.updater.off('update-downloaded', this.onDownloaded);
127
- this.options.updater.off('error', this.onError);
128
- this.bound = false;
129
- }
130
- bind() {
131
- if (this.bound)
132
- return;
133
- this.bound = true;
134
- this.options.updater.on('download-progress', this.onProgress);
135
- this.options.updater.on('update-downloaded', this.onDownloaded);
136
- this.options.updater.on('error', this.onError);
137
- }
138
- onProgress = (progress) => {
139
- if (this.downloadedVersion)
140
- return;
141
- this.publish({
142
- phase: 'downloading',
143
- ...(this.candidate ? { version: this.candidate } : {}),
144
- percent: clampPercent(progress.percent),
145
- });
146
- };
147
- onDownloaded = (info) => {
148
- if (!this.isNewer(info.version))
149
- return;
150
- this.downloadedVersion = info.version;
151
- this.candidate = info.version;
152
- this.publish({ phase: 'ready', version: info.version });
153
- };
154
- onError = (error) => {
155
- const version = this.candidate ?? this.state.version;
156
- this.publish({
157
- phase: 'error',
158
- ...(version ? { version } : {}),
159
- message: error instanceof Error ? error.message : String(error),
160
- });
161
- };
162
- async doCheck() {
163
- this.downloadedVersion = undefined;
164
- this.candidate = undefined;
165
- this.publish({ phase: 'checking' });
166
- try {
167
- const result = await this.options.updater.checkForUpdates();
168
- if (this.disposed)
169
- return this.state;
170
- if (this.downloadedVersion && this.isNewer(this.downloadedVersion)) {
171
- if (this.state.phase === 'ready' && this.state.version === this.downloadedVersion)
172
- return this.state;
173
- return this.publish({ phase: 'ready', version: this.downloadedVersion });
174
- }
175
- if (!result)
176
- return this.publish({ phase: 'error', message: 'app update: no check result' });
177
- const version = result.updateInfo.version;
178
- if (!result.isUpdateAvailable)
179
- return this.publish({ phase: 'idle' });
180
- if (valid(version) === null) {
181
- return this.publish({ phase: 'error', message: 'app update: feed version is invalid' });
182
- }
183
- if (!this.isNewer(version))
184
- return this.publish({ phase: 'idle' });
185
- this.candidate = version;
186
- if (this.state.phase === 'downloading') {
187
- return this.publish({ phase: 'downloading', version, percent: this.state.percent ?? 0 });
188
- }
189
- return this.publish({ phase: 'downloading', version, percent: 0 });
190
- }
191
- catch (error) {
192
- if (this.disposed)
193
- return this.state;
194
- return this.publish({
195
- phase: 'error',
196
- ...(this.candidate ? { version: this.candidate } : {}),
197
- message: error instanceof Error ? error.message : String(error),
198
- });
199
- }
200
- }
201
- isNewer(version) {
202
- return valid(version) !== null && valid(this.options.currentVersion) !== null && gt(version, this.options.currentVersion);
203
- }
204
- publish(state) {
205
- if (this.disposed)
206
- return this.current;
207
- this.current = state;
208
- if (this.statusFile)
209
- appendFileSync(this.statusFile, `${JSON.stringify(state)}\n`);
210
- this.options.onState?.(state);
211
- return state;
212
- }
213
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * 包 IPC 绑定器(0.3e):把包的 IpcContribution 注册到 Electron ipcMain。
3
- *
4
- * 命名空间规则:channel 必须以 `<packId>:` 开头——包只能占用自己的
5
- * 命名空间,注册期 fail fast。handler 统一收单个序列化载荷(renderer
6
- * 经 preload 透传),返回值经 IPC 结构化克隆回 renderer。
7
- */
8
- import type { IpcContribution } from '../scenario/pack.js';
9
- /** 命名空间校验(纯函数,单测直接覆盖)。 */
10
- export declare function assertPackChannel(packId: string, channel: string): void;
11
- export declare function registerPackIpc(packId: string, contributions: readonly IpcContribution[]): void;
package/dist/host/ipc.js DELETED
@@ -1,20 +0,0 @@
1
- /**
2
- * 包 IPC 绑定器(0.3e):把包的 IpcContribution 注册到 Electron ipcMain。
3
- *
4
- * 命名空间规则:channel 必须以 `<packId>:` 开头——包只能占用自己的
5
- * 命名空间,注册期 fail fast。handler 统一收单个序列化载荷(renderer
6
- * 经 preload 透传),返回值经 IPC 结构化克隆回 renderer。
7
- */
8
- import { ipcMain } from 'electron';
9
- /** 命名空间校验(纯函数,单测直接覆盖)。 */
10
- export function assertPackChannel(packId, channel) {
11
- if (!channel.startsWith(`${packId}:`)) {
12
- throw new Error(`[pack-ipc] channel "${channel}" must be namespaced under "${packId}:"`);
13
- }
14
- }
15
- export function registerPackIpc(packId, contributions) {
16
- for (const contribution of contributions) {
17
- assertPackChannel(packId, contribution.channel);
18
- ipcMain.handle(contribution.channel, (_event, payload) => contribution.handler(payload));
19
- }
20
- }
package/dist/main.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};