@sonde/agent 0.2.2 → 0.2.4
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/.turbo/turbo-build.log +6 -4
- package/.turbo/turbo-test.log +66 -21
- package/.turbo/turbo-typecheck.log +1 -1
- package/CHANGELOG.md +16 -0
- package/dist/cli/mcp-bridge.d.ts +2 -0
- package/dist/cli/mcp-bridge.d.ts.map +1 -0
- package/dist/cli/mcp-bridge.js +193 -0
- package/dist/cli/mcp-bridge.js.map +1 -0
- package/dist/cli/mcp-bridge.test.d.ts +2 -0
- package/dist/cli/mcp-bridge.test.d.ts.map +1 -0
- package/dist/cli/mcp-bridge.test.js +54 -0
- package/dist/cli/mcp-bridge.test.js.map +1 -0
- package/dist/cli/update.d.ts +18 -0
- package/dist/cli/update.d.ts.map +1 -0
- package/dist/cli/update.js +71 -0
- package/dist/cli/update.js.map +1 -0
- package/dist/cli/update.test.d.ts +2 -0
- package/dist/cli/update.test.d.ts.map +1 -0
- package/dist/cli/update.test.js +55 -0
- package/dist/cli/update.test.js.map +1 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +16 -2
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +65 -6
- package/dist/index.js.map +1 -1
- package/dist/runtime/connection.d.ts +1 -0
- package/dist/runtime/connection.d.ts.map +1 -1
- package/dist/runtime/connection.js +33 -7
- package/dist/runtime/connection.js.map +1 -1
- package/dist/runtime/executor.d.ts +6 -0
- package/dist/runtime/executor.d.ts.map +1 -1
- package/dist/runtime/executor.js +4 -4
- package/dist/runtime/executor.js.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/package.json +1 -1
- package/src/cli/mcp-bridge.test.ts +58 -0
- package/src/cli/mcp-bridge.ts +217 -0
- package/src/cli/update.test.ts +69 -0
- package/src/cli/update.ts +78 -0
- package/src/config.ts +16 -2
- package/src/index.ts +73 -8
- package/src/runtime/connection.ts +43 -9
- package/src/runtime/executor.ts +17 -5
- package/src/version.ts +10 -0
- package/tsconfig.tsbuildinfo +1 -1
package/src/runtime/executor.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { execFile } from 'node:child_process';
|
|
2
2
|
import { promisify } from 'node:util';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type ExecFn,
|
|
5
|
+
type Pack,
|
|
6
|
+
type PackRegistryOptions,
|
|
7
|
+
createPackRegistry,
|
|
8
|
+
packRegistry,
|
|
9
|
+
} from '@sonde/packs';
|
|
4
10
|
import type { ProbeRequest, ProbeResponse } from '@sonde/shared';
|
|
11
|
+
import { VERSION } from '../version.js';
|
|
5
12
|
import { type ScrubPattern, buildPatterns, scrubData } from './scrubber.js';
|
|
6
13
|
|
|
7
14
|
const execFileAsync = promisify(execFile);
|
|
8
15
|
|
|
9
|
-
const AGENT_VERSION = '0.1.0';
|
|
10
|
-
|
|
11
16
|
/** Default exec function that shells out to real commands */
|
|
12
17
|
async function defaultExec(command: string, args: string[]): Promise<string> {
|
|
13
18
|
const { stdout } = await execFileAsync(command, args, {
|
|
@@ -17,6 +22,13 @@ async function defaultExec(command: string, args: string[]): Promise<string> {
|
|
|
17
22
|
return stdout;
|
|
18
23
|
}
|
|
19
24
|
|
|
25
|
+
export interface ProbeExecutorOptions {
|
|
26
|
+
packs?: ReadonlyMap<string, Pack>;
|
|
27
|
+
exec?: ExecFn;
|
|
28
|
+
scrubPatterns?: ScrubPattern[];
|
|
29
|
+
allowUnsignedPacks?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
20
32
|
export class ProbeExecutor {
|
|
21
33
|
private packs: ReadonlyMap<string, Pack>;
|
|
22
34
|
private exec: ExecFn;
|
|
@@ -73,7 +85,7 @@ export class ProbeExecutor {
|
|
|
73
85
|
data,
|
|
74
86
|
durationMs: Date.now() - start,
|
|
75
87
|
metadata: {
|
|
76
|
-
agentVersion:
|
|
88
|
+
agentVersion: VERSION,
|
|
77
89
|
packName: pack.manifest.name,
|
|
78
90
|
packVersion: pack.manifest.version,
|
|
79
91
|
capabilityLevel: 'observe',
|
|
@@ -97,7 +109,7 @@ export class ProbeExecutor {
|
|
|
97
109
|
data: { error: message },
|
|
98
110
|
durationMs: Date.now() - startMs,
|
|
99
111
|
metadata: {
|
|
100
|
-
agentVersion:
|
|
112
|
+
agentVersion: VERSION,
|
|
101
113
|
packName: pack?.manifest.name ?? 'unknown',
|
|
102
114
|
packVersion: pack?.manifest.version ?? '0.0.0',
|
|
103
115
|
capabilityLevel: 'observe',
|
package/src/version.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const pkg = JSON.parse(readFileSync(resolve(__dirname, '..', 'package.json'), 'utf-8')) as {
|
|
7
|
+
version: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const VERSION: string = pkg.version;
|