@steerable/agent-shell 0.6.55 → 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.
- package/dist/host/visible-terminal-exec.js +1 -1
- package/dist/local-executor.js +1 -1
- package/dist/log.d.ts +7 -13
- package/dist/log.js +43 -8
- package/dist/server/http-server.js +1 -1
- package/dist/server/start.js +1 -3
- package/dist/sidecar/boot.js +1 -1
- package/dist/sidecar/exec-sandbox.js +1 -1
- package/dist/sidecar/reverse-spawn.js +1 -1
- package/dist/terminal-manager.js +1 -1
- package/package.json +4 -5
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* sentinel 抓不住的形态回退 headless。Electron main 与 BS server 共用。
|
|
4
4
|
* 命令进入 PTY 时不通知 renderer 展开面板——终端只由用户手动打开。
|
|
5
5
|
*/
|
|
6
|
-
import log from '
|
|
6
|
+
import { log } from '../log.js';
|
|
7
7
|
import { GUI_LAUNCH_WAIT_MS, getConfiguredExecTimeoutMs, isGuiLaunchCommand, rewriteExeCommandIfNeeded, } from '../local-executor.js';
|
|
8
8
|
import { getResolvedHostTools } from '../host-tools-runtime.js';
|
|
9
9
|
/**
|
package/dist/local-executor.js
CHANGED
|
@@ -4,7 +4,7 @@ import os from 'os';
|
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import { createHash } from 'crypto';
|
|
6
6
|
import { spawn, execSync } from 'child_process';
|
|
7
|
-
import log from '
|
|
7
|
+
import { log } from './log.js';
|
|
8
8
|
import { constants as fsConstants } from 'fs';
|
|
9
9
|
import { adaptCommandForPowerShell } from './shell-adapt.js';
|
|
10
10
|
import { evaluateExecPolicy, planSshArgv, } from './shell-exec.js';
|
package/dist/log.d.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
* import { log } from '@steerable/agent-shell/log';
|
|
10
|
-
*/
|
|
11
|
-
import log from 'electron-log';
|
|
12
|
-
export { log };
|
|
13
|
-
export type { Logger, LogMessage, LogLevel } from 'electron-log';
|
|
1
|
+
export type LogLevel = 'error' | 'warn' | 'info' | 'debug';
|
|
2
|
+
export declare const log: {
|
|
3
|
+
error: (...args: unknown[]) => void;
|
|
4
|
+
warn: (...args: unknown[]) => void;
|
|
5
|
+
info: (...args: unknown[]) => void;
|
|
6
|
+
debug: (...args: unknown[]) => void;
|
|
7
|
+
};
|
package/dist/log.js
CHANGED
|
@@ -1,12 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `__ELECTRON_LOG__` IPC handler——同一个 Electron 进程里只能有一个
|
|
4
|
-
* 物理副本完成注册。shell 与场景包若各自从所属仓库的 node_modules
|
|
5
|
-
* 解析 electron-log(link: 依赖下是两个物理路径),第二个 import
|
|
6
|
-
* 会抛 "Attempted to register a second handler"。因此 electron-log
|
|
7
|
-
* 只由 shell 直接依赖,场景包/产品代码一律经本模块拿同一个实例:
|
|
2
|
+
* 宿主日志单例。场景包和产品代码从这里拿同一个实例:
|
|
8
3
|
*
|
|
9
4
|
* import { log } from '@steerable/agent-shell/log';
|
|
5
|
+
*
|
|
6
|
+
* 文件落在 `<userData>/logs/main.log`。写失败只留在 stderr,不拖垮宿主。
|
|
10
7
|
*/
|
|
11
|
-
import
|
|
12
|
-
|
|
8
|
+
import fs from 'node:fs';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import { getUserDataDir } from './runtime.js';
|
|
11
|
+
function formatArg(part) {
|
|
12
|
+
if (typeof part === 'string')
|
|
13
|
+
return part;
|
|
14
|
+
if (part instanceof Error)
|
|
15
|
+
return part.stack ?? part.message;
|
|
16
|
+
try {
|
|
17
|
+
return JSON.stringify(part);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return String(part);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function write(level, args) {
|
|
24
|
+
const line = `${new Date().toISOString()} [${level}] ${args.map(formatArg).join(' ')}`;
|
|
25
|
+
if (level === 'error')
|
|
26
|
+
console.error(line);
|
|
27
|
+
else if (level === 'warn')
|
|
28
|
+
console.warn(line);
|
|
29
|
+
else if (level === 'debug')
|
|
30
|
+
console.debug(line);
|
|
31
|
+
else
|
|
32
|
+
console.info(line);
|
|
33
|
+
try {
|
|
34
|
+
const file = path.join(getUserDataDir(), 'logs', 'main.log');
|
|
35
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
36
|
+
fs.appendFileSync(file, `${line}\n`);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.error('[log] failed to write main.log', error);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export const log = {
|
|
43
|
+
error: (...args) => write('error', args),
|
|
44
|
+
warn: (...args) => write('warn', args),
|
|
45
|
+
info: (...args) => write('info', args),
|
|
46
|
+
debug: (...args) => write('debug', args),
|
|
47
|
+
};
|
|
@@ -28,7 +28,7 @@ import { randomBytes } from 'node:crypto';
|
|
|
28
28
|
import { readFile } from 'node:fs/promises';
|
|
29
29
|
import { existsSync } from 'node:fs';
|
|
30
30
|
import path from 'node:path';
|
|
31
|
-
import log from '
|
|
31
|
+
import { log } from '../log.js';
|
|
32
32
|
import { getActiveCoreLoopStreamId } from '../local-backend/coreloop-stream.js';
|
|
33
33
|
import { getSidecarSupervisor } from '../llm/index.js';
|
|
34
34
|
import { matchPackHttpRoute } from '../host/http-routes.js';
|
package/dist/server/start.js
CHANGED
|
@@ -5,11 +5,10 @@ import { existsSync } from 'node:fs';
|
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import dotenv from 'dotenv';
|
|
8
|
-
import log from '
|
|
8
|
+
import { log } from '../log.js';
|
|
9
9
|
import { getBrand } from '../brand.js';
|
|
10
10
|
import { registerPackHttpRoutes } from '../host/http-routes.js';
|
|
11
11
|
import { createHostRuntime } from '../host/runtime.js';
|
|
12
|
-
import { getUserDataDir } from '../runtime.js';
|
|
13
12
|
import { createBsServer, } from './http-server.js';
|
|
14
13
|
import { SseBus } from './sse-bus.js';
|
|
15
14
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -19,7 +18,6 @@ for (const file of ['.env.local', '.env']) {
|
|
|
19
18
|
if (existsSync(fullPath))
|
|
20
19
|
dotenv.config({ path: fullPath, override: false });
|
|
21
20
|
}
|
|
22
|
-
log.transports.file.resolvePathFn = () => path.join(getUserDataDir(), 'logs', 'main.log');
|
|
23
21
|
/**
|
|
24
22
|
* Assembles and starts the BS HTTP host.
|
|
25
23
|
*
|
package/dist/sidecar/boot.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import path from 'node:path';
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
|
-
import log from '
|
|
11
|
+
import { log } from '../log.js';
|
|
12
12
|
import { SidecarSupervisor, } from './supervisor.js';
|
|
13
13
|
import { setSidecarSupervisor, setSidecarSupervisorPending, llmService } from '../llm/index.js';
|
|
14
14
|
import { resolveSidecarStoragePath } from './storage-path.js';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* 可写根不同。两边各建一份的时候,`requireFull` 在其中一边改错就只在另一边
|
|
6
6
|
* 暴露——所以这里收成一个 `buildExecSandbox`。
|
|
7
7
|
*/
|
|
8
|
-
import log from '
|
|
8
|
+
import { log } from '../log.js';
|
|
9
9
|
import { llmService } from '../llm/index.js';
|
|
10
10
|
import { getActiveEgressProxyEndpoint } from './egress-proxy.js';
|
|
11
11
|
export function parseExecPolicy(value) {
|
|
@@ -19,7 +19,7 @@ import { existsSync } from 'node:fs';
|
|
|
19
19
|
import { dirname, join } from 'node:path';
|
|
20
20
|
import { fileURLToPath } from 'node:url';
|
|
21
21
|
import { createInterface } from 'node:readline';
|
|
22
|
-
import log from '
|
|
22
|
+
import { log } from '../log.js';
|
|
23
23
|
const __filename = fileURLToPath(import.meta.url);
|
|
24
24
|
const __dirname = dirname(__filename);
|
|
25
25
|
/** Helper spawn supervision cap; the sidecar's own tool timeout is shorter. */
|
package/dist/terminal-manager.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
import os from 'os';
|
|
3
3
|
import { randomUUID } from 'crypto';
|
|
4
|
-
import log from '
|
|
4
|
+
import { log } from './log.js';
|
|
5
5
|
import * as pty from 'node-pty';
|
|
6
6
|
import { adaptCommandForPowerShell } from './shell-adapt.js';
|
|
7
7
|
const DEFAULT_COLS = 100;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steerable/agent-shell",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.56",
|
|
4
4
|
"description": "Steerable framework — product-neutral Node HostRuntime and headless HTTP server shared by Tauri desktop and browser deployments; scenario packs extend it through @steerable/pack-sdk.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://steerableframework.com/",
|
|
@@ -49,12 +49,11 @@
|
|
|
49
49
|
"better-sqlite3": "^11.9.1",
|
|
50
50
|
"conf": "10.2.0",
|
|
51
51
|
"dotenv": "^17.4.2",
|
|
52
|
-
"electron-log": "^5.4.3",
|
|
53
52
|
"he": "^1.2.0",
|
|
54
53
|
"node-pty": "^1.1.0",
|
|
55
|
-
"@steerable/agent-harness": "0.6.
|
|
56
|
-
"@steerable/
|
|
57
|
-
"@steerable/
|
|
54
|
+
"@steerable/agent-harness": "0.6.56",
|
|
55
|
+
"@steerable/agent-protocol": "0.6.56",
|
|
56
|
+
"@steerable/pack-sdk": "0.6.56"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
59
|
"@types/better-sqlite3": "^7.6.13",
|