@steerable/agent-shell 0.6.53 → 0.6.55

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 (47) 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/i18n.d.ts +23 -0
  5. package/dist/i18n.js +87 -0
  6. package/dist/image-attachment.d.ts +31 -4
  7. package/dist/image-attachment.js +13 -18
  8. package/dist/json-store.js +3 -6
  9. package/dist/local-backend/portable-bundle.js +8 -7
  10. package/dist/local-backend/router.js +2 -2
  11. package/dist/local-backend/skills/10-goal/SKILL.md +1 -1
  12. package/dist/local-backend/skills/11-loop/SKILL.md +1 -1
  13. package/dist/local-backend/skills/12-create-skill/SKILL.md +2 -2
  14. package/dist/local-script-registry.js +2 -2
  15. package/dist/mcp-server-registry.d.ts +3 -3
  16. package/dist/mcp-server-registry.js +2 -2
  17. package/dist/product-config.d.ts +10 -14
  18. package/dist/project-registry.d.ts +3 -3
  19. package/dist/project-registry.js +2 -2
  20. package/dist/runtime.d.ts +8 -54
  21. package/dist/runtime.js +15 -129
  22. package/dist/scenario/pack.d.ts +1 -1
  23. package/dist/scenario/registry.d.ts +4 -5
  24. package/dist/scenario/registry.js +2 -10
  25. package/dist/server/start.js +1 -2
  26. package/dist/sidecar/reverse-spawn.js +6 -15
  27. package/dist/sidecar/supervisor.d.ts +0 -2
  28. package/dist/sidecar/supervisor.js +7 -30
  29. package/dist/storage/index.js +1 -1
  30. package/dist/storage/write-lease-error.d.ts +2 -11
  31. package/dist/storage/write-lease-error.js +3 -8
  32. package/package.json +6 -13
  33. package/dist/app-update-electron.d.ts +0 -5
  34. package/dist/app-update-electron.js +0 -66
  35. package/dist/app-update.d.ts +0 -92
  36. package/dist/app-update.js +0 -213
  37. package/dist/host/ipc.d.ts +0 -11
  38. package/dist/host/ipc.js +0 -20
  39. package/dist/main.d.ts +0 -1
  40. package/dist/main.js +0 -967
  41. package/dist/preload-default.d.ts +0 -1
  42. package/dist/preload-default.js +0 -9
  43. package/dist/preload.cjs +0 -425
  44. package/dist/preload.d.ts +0 -20
  45. package/dist/preload.js +0 -442
  46. package/dist/single-instance.d.ts +0 -11
  47. package/dist/single-instance.js +0 -21
@@ -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 {};