nolo-cli 0.1.33 → 0.1.34
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/README.md +4 -4
- package/agent-runtime/agentRecordConfig.ts +8 -0
- package/agent-runtime/hostAdapter.ts +9 -1
- package/agent-runtime/index.ts +10 -0
- package/agent-runtime/localLoop.ts +49 -2
- package/agent-runtime/localToolPolicy.ts +70 -21
- package/agent-runtime/openAiCompatibleProvider.ts +7 -3
- package/agent-runtime/openAiCompatibleProviderConfig.ts +15 -26
- package/agent-runtime/platformChatProvider.ts +48 -71
- package/agent-runtime/providerResolution.ts +244 -0
- package/agent-runtime/runtimeToolPolicy.ts +33 -0
- package/agent-runtime/shellCommandPolicy.ts +120 -0
- package/agentInternalCommandEntries.ts +2 -0
- package/agentListCommands.ts +2 -2
- package/agentPullCommand.ts +6 -11
- package/agentRecordCommands.ts +87 -2
- package/agentRecordHelpers.ts +87 -4
- package/agentRuntimeLocal.ts +3 -0
- package/ai/tools/toolNameAliases.ts +70 -0
- package/cli/agentInternalCommandEntries.ts +2 -0
- package/cli/agentListCommands.ts +2 -2
- package/cli/agentPullCommand.ts +6 -11
- package/cli/agentRecordCommands.ts +87 -2
- package/cli/agentRecordHelpers.ts +87 -4
- package/cli/agentRuntimeLocal.ts +3 -0
- package/cli/cliCommandDispatch.ts +2 -2
- package/cli/cliEnvHelpers.ts +80 -12
- package/cli/client/agentRun.ts +1 -0
- package/cli/client/localRuntimeAdapter.ts +44 -7
- package/cli/commandRegistry.ts +2 -2
- package/cli/machineCommands.ts +1 -1
- package/cli/machineWsRunDispatch.ts +29 -9
- package/cli/offlineMarxistsAgentCommand.ts +1 -1
- package/cli/runtimeDoctorCommands.ts +10 -4
- package/cli/tableCommands.ts +1 -1
- package/cli/taskRunCommand.ts +1 -1
- package/cliCommandDispatch.ts +2 -2
- package/cliEnvHelpers.ts +80 -12
- package/client/agentRun.ts +1 -0
- package/client/localProviderResolver.test.ts +26 -2
- package/client/localRuntimeAdapter.test.ts +287 -3
- package/client/localRuntimeAdapter.ts +44 -7
- package/commandRegistry.ts +2 -2
- package/database/server/authorityStoreTypes.ts +31 -0
- package/database/server/db.ts +15 -34
- package/database/server/legacyServerDb.ts +58 -0
- package/database/server/levelAuthorityStore.ts +75 -0
- package/database/server/memoryAuthorityStore.ts +133 -0
- package/database/server/serverStoreFactory.ts +118 -0
- package/machineCommands.ts +1 -1
- package/machineWsRunDispatch.ts +29 -9
- package/offlineMarxistsAgentCommand.ts +1 -1
- package/package.json +10 -2
- package/runtimeDoctorCommands.ts +10 -4
- package/tableCommands.ts +1 -1
- package/taskRunCommand.ts +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AuthorityBatchOperation,
|
|
3
|
+
AuthorityBatchWriter,
|
|
4
|
+
AuthorityIteratorOptions,
|
|
5
|
+
AuthorityStore,
|
|
6
|
+
} from "./authorityStoreTypes";
|
|
7
|
+
|
|
8
|
+
type LevelBatchWriterLike = {
|
|
9
|
+
put(key: string, value: unknown): unknown;
|
|
10
|
+
del(key: string): unknown;
|
|
11
|
+
write(): Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type LevelLike = {
|
|
15
|
+
readonly location?: string;
|
|
16
|
+
readonly status?: string;
|
|
17
|
+
open?(): Promise<void>;
|
|
18
|
+
close?(): Promise<void>;
|
|
19
|
+
get<T = any>(key: string): Promise<T>;
|
|
20
|
+
put(key: string, value: unknown): Promise<void>;
|
|
21
|
+
del(key: string): Promise<void>;
|
|
22
|
+
batch(ops: AuthorityBatchOperation[]): Promise<void>;
|
|
23
|
+
batch(): LevelBatchWriterLike;
|
|
24
|
+
iterator(
|
|
25
|
+
options?: AuthorityIteratorOptions
|
|
26
|
+
): AsyncIterableIterator<[string, unknown]>;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export function createLevelAuthorityStore(levelDb: LevelLike): AuthorityStore {
|
|
30
|
+
const createBatch = (): AuthorityBatchWriter => {
|
|
31
|
+
const batch = levelDb.batch();
|
|
32
|
+
return {
|
|
33
|
+
put(key: string, value: unknown) {
|
|
34
|
+
batch.put(key, value);
|
|
35
|
+
},
|
|
36
|
+
del(key: string) {
|
|
37
|
+
batch.del(key);
|
|
38
|
+
},
|
|
39
|
+
async write() {
|
|
40
|
+
await batch.write();
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
get location() {
|
|
47
|
+
return levelDb.location;
|
|
48
|
+
},
|
|
49
|
+
get status() {
|
|
50
|
+
return levelDb.status;
|
|
51
|
+
},
|
|
52
|
+
async open() {
|
|
53
|
+
await levelDb.open?.();
|
|
54
|
+
},
|
|
55
|
+
async close() {
|
|
56
|
+
await levelDb.close?.();
|
|
57
|
+
},
|
|
58
|
+
async get<T = any>(key: string) {
|
|
59
|
+
return levelDb.get<T>(key);
|
|
60
|
+
},
|
|
61
|
+
async put(key: string, value: unknown) {
|
|
62
|
+
await levelDb.put(key, value);
|
|
63
|
+
},
|
|
64
|
+
async del(key: string) {
|
|
65
|
+
await levelDb.del(key);
|
|
66
|
+
},
|
|
67
|
+
async batchWrite(ops: AuthorityBatchOperation[]) {
|
|
68
|
+
await levelDb.batch(ops);
|
|
69
|
+
},
|
|
70
|
+
createBatch,
|
|
71
|
+
iterator(options: AuthorityIteratorOptions = {}) {
|
|
72
|
+
return levelDb.iterator(options);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AuthorityBatchOperation,
|
|
3
|
+
AuthorityBatchWriter,
|
|
4
|
+
AuthorityIteratorOptions,
|
|
5
|
+
AuthorityStore,
|
|
6
|
+
} from "./authorityStoreTypes";
|
|
7
|
+
|
|
8
|
+
type MemoryEntry = {
|
|
9
|
+
key: string;
|
|
10
|
+
value: unknown;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const createNotFoundError = () => {
|
|
14
|
+
const error = new Error("NotFound") as Error & { notFound: true };
|
|
15
|
+
error.notFound = true;
|
|
16
|
+
return error;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
class MemoryAuthorityBacking {
|
|
20
|
+
readonly location: string;
|
|
21
|
+
status: "closed" | "open" = "closed";
|
|
22
|
+
private readonly data = new Map<string, unknown>();
|
|
23
|
+
|
|
24
|
+
constructor(location: string) {
|
|
25
|
+
this.location = location;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async open() {
|
|
29
|
+
this.status = "open";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async close() {
|
|
33
|
+
this.status = "closed";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async get<T = any>(key: string): Promise<T> {
|
|
37
|
+
if (!this.data.has(key)) {
|
|
38
|
+
throw createNotFoundError();
|
|
39
|
+
}
|
|
40
|
+
return this.data.get(key) as T;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async put(key: string, value: unknown) {
|
|
44
|
+
this.data.set(key, value);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async del(key: string) {
|
|
48
|
+
this.data.delete(key);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async batchWrite(ops: AuthorityBatchOperation[]) {
|
|
52
|
+
for (const op of ops) {
|
|
53
|
+
if (op.type === "put") {
|
|
54
|
+
this.data.set(op.key, op.value);
|
|
55
|
+
} else {
|
|
56
|
+
this.data.delete(op.key);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
createBatch(): AuthorityBatchWriter {
|
|
62
|
+
const buffered: AuthorityBatchOperation[] = [];
|
|
63
|
+
return {
|
|
64
|
+
put(key: string, value: unknown) {
|
|
65
|
+
buffered.push({ type: "put", key, value });
|
|
66
|
+
},
|
|
67
|
+
del(key: string) {
|
|
68
|
+
buffered.push({ type: "del", key });
|
|
69
|
+
},
|
|
70
|
+
write: async () => {
|
|
71
|
+
await this.batchWrite(buffered);
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async *iterator(
|
|
77
|
+
options: AuthorityIteratorOptions = {}
|
|
78
|
+
): AsyncIterableIterator<[string, unknown]> {
|
|
79
|
+
const entries: MemoryEntry[] = Array.from(this.data.entries())
|
|
80
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
81
|
+
.map(([key, value]) => ({ key, value }));
|
|
82
|
+
|
|
83
|
+
if (options.reverse) {
|
|
84
|
+
entries.reverse();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
for (const entry of entries) {
|
|
88
|
+
if (options.gte && entry.key < options.gte) continue;
|
|
89
|
+
if (options.lte && entry.key > options.lte) continue;
|
|
90
|
+
if (options.lt && entry.key >= options.lt) continue;
|
|
91
|
+
yield [entry.key, entry.value];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function createMemoryAuthorityStore(
|
|
97
|
+
location = ":memory:"
|
|
98
|
+
): AuthorityStore {
|
|
99
|
+
const backing = new MemoryAuthorityBacking(location);
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
get location() {
|
|
103
|
+
return backing.location;
|
|
104
|
+
},
|
|
105
|
+
get status() {
|
|
106
|
+
return backing.status;
|
|
107
|
+
},
|
|
108
|
+
async open() {
|
|
109
|
+
await backing.open();
|
|
110
|
+
},
|
|
111
|
+
async close() {
|
|
112
|
+
await backing.close();
|
|
113
|
+
},
|
|
114
|
+
async get<T = any>(key: string) {
|
|
115
|
+
return backing.get<T>(key);
|
|
116
|
+
},
|
|
117
|
+
async put(key: string, value: unknown) {
|
|
118
|
+
await backing.put(key, value);
|
|
119
|
+
},
|
|
120
|
+
async del(key: string) {
|
|
121
|
+
await backing.del(key);
|
|
122
|
+
},
|
|
123
|
+
async batchWrite(ops: AuthorityBatchOperation[]) {
|
|
124
|
+
await backing.batchWrite(ops);
|
|
125
|
+
},
|
|
126
|
+
createBatch() {
|
|
127
|
+
return backing.createBatch();
|
|
128
|
+
},
|
|
129
|
+
iterator(options: AuthorityIteratorOptions = {}) {
|
|
130
|
+
return backing.iterator(options);
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { Level } from "level";
|
|
4
|
+
|
|
5
|
+
import type { AuthorityStore } from "./authorityStoreTypes";
|
|
6
|
+
import { createLegacyServerDb, type LegacyServerDb } from "./legacyServerDb";
|
|
7
|
+
import { createLevelAuthorityStore } from "./levelAuthorityStore";
|
|
8
|
+
import { createMemoryAuthorityStore } from "./memoryAuthorityStore";
|
|
9
|
+
|
|
10
|
+
export type ServerStoreDriver = "level" | "memory";
|
|
11
|
+
|
|
12
|
+
export type ServerStoreFactoryEnv = {
|
|
13
|
+
NOLO_SERVER_AUTHORITY_DRIVER?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const safeJsonEncoding = {
|
|
17
|
+
name: "safe-json",
|
|
18
|
+
format: "utf8" as const,
|
|
19
|
+
encode: (data: any) => JSON.stringify(data),
|
|
20
|
+
decode: (data: string) => {
|
|
21
|
+
try {
|
|
22
|
+
return JSON.parse(data);
|
|
23
|
+
} catch {
|
|
24
|
+
console.warn("[LevelDB] Corrupted value:", data?.substring?.(0, 60));
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type ServerStoreRuntime = {
|
|
31
|
+
authorityStore: AuthorityStore;
|
|
32
|
+
serverDb: LegacyServerDb;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type ServerStoreFactoryOptions = {
|
|
36
|
+
driver?: ServerStoreDriver;
|
|
37
|
+
env?: ServerStoreFactoryEnv;
|
|
38
|
+
globalScope?: Record<string, unknown>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export function ensureServerDbDirectory(dbPath: string) {
|
|
42
|
+
const dir = path.dirname(dbPath);
|
|
43
|
+
if (!fs.existsSync(dir)) {
|
|
44
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function createLevelBackedAuthorityStore(dbPath: string): AuthorityStore {
|
|
49
|
+
const levelDb = new Level<string, any>(dbPath, {
|
|
50
|
+
valueEncoding: safeJsonEncoding,
|
|
51
|
+
});
|
|
52
|
+
return createLevelAuthorityStore(levelDb);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function resolveServerStoreDriver(
|
|
56
|
+
env: ServerStoreFactoryEnv = process.env
|
|
57
|
+
): ServerStoreDriver {
|
|
58
|
+
const rawDriver = env.NOLO_SERVER_AUTHORITY_DRIVER?.trim().toLowerCase();
|
|
59
|
+
if (!rawDriver) return "level";
|
|
60
|
+
if (rawDriver === "level") return "level";
|
|
61
|
+
if (rawDriver === "memory") return "memory";
|
|
62
|
+
throw new Error(`Unsupported server authority store driver: ${rawDriver}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function createAuthorityStoreForDriver(
|
|
66
|
+
driver: ServerStoreDriver,
|
|
67
|
+
dbPath: string
|
|
68
|
+
): AuthorityStore {
|
|
69
|
+
switch (driver) {
|
|
70
|
+
case "level":
|
|
71
|
+
return createLevelBackedAuthorityStore(dbPath);
|
|
72
|
+
case "memory":
|
|
73
|
+
return createMemoryAuthorityStore(dbPath);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function getOrCreateServerStoreRuntime(
|
|
78
|
+
dbPath: string,
|
|
79
|
+
options: ServerStoreFactoryOptions = {}
|
|
80
|
+
): ServerStoreRuntime {
|
|
81
|
+
const globalScope =
|
|
82
|
+
options.globalScope ?? (globalThis as Record<string, unknown>);
|
|
83
|
+
const driver = options.driver ?? resolveServerStoreDriver(options.env);
|
|
84
|
+
const cachedDriver = globalScope.__serverAuthorityStoreDriver;
|
|
85
|
+
|
|
86
|
+
ensureServerDbDirectory(dbPath);
|
|
87
|
+
|
|
88
|
+
if (
|
|
89
|
+
globalScope.__serverAuthorityStore &&
|
|
90
|
+
typeof cachedDriver === "string" &&
|
|
91
|
+
cachedDriver !== driver
|
|
92
|
+
) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
`Server authority store already initialized with driver ${cachedDriver}, cannot reuse it for ${driver}`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (!globalScope.__serverAuthorityStore) {
|
|
99
|
+
globalScope.__serverAuthorityStore = createAuthorityStoreForDriver(
|
|
100
|
+
driver,
|
|
101
|
+
dbPath
|
|
102
|
+
);
|
|
103
|
+
globalScope.__serverAuthorityStoreDriver = driver;
|
|
104
|
+
} else if (!cachedDriver) {
|
|
105
|
+
globalScope.__serverAuthorityStoreDriver = driver;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const authorityStore = globalScope.__serverAuthorityStore as AuthorityStore;
|
|
109
|
+
|
|
110
|
+
if (!globalScope.__serverDb) {
|
|
111
|
+
globalScope.__serverDb = createLegacyServerDb(authorityStore);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
authorityStore,
|
|
116
|
+
serverDb: globalScope.__serverDb as LegacyServerDb,
|
|
117
|
+
};
|
|
118
|
+
}
|
package/machineCommands.ts
CHANGED
|
@@ -95,7 +95,7 @@ function resolveConnectServerUrl(args: string[], env: EnvLike) {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
function resolveConnectAuthToken(args: string[], env: EnvLike) {
|
|
98
|
-
return readOption(args, "--
|
|
98
|
+
return readOption(args, "--machine-key") || readOption(args, "--token") || resolveAuthToken(env);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
const defaultSleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
|
package/machineWsRunDispatch.ts
CHANGED
|
@@ -148,6 +148,7 @@ function hasExplicitMachinePermissions(agentConfig: any) {
|
|
|
148
148
|
|
|
149
149
|
function runtimeWorkspacePermissionPolicy(
|
|
150
150
|
runtimePolicy: ConnectorRuntimePolicy | undefined,
|
|
151
|
+
runtimeEnv: EnvLike,
|
|
151
152
|
cwd: string
|
|
152
153
|
): PermissionPolicy | null {
|
|
153
154
|
if (!requestsTaskWorktree(runtimePolicy)) return null;
|
|
@@ -155,7 +156,10 @@ function runtimeWorkspacePermissionPolicy(
|
|
|
155
156
|
mode: "full_access",
|
|
156
157
|
allowFilesystemRead: true,
|
|
157
158
|
allowFilesystemWrite: true,
|
|
158
|
-
allowShell:
|
|
159
|
+
allowShell:
|
|
160
|
+
["worktree", "dangerous", "1", "true"].includes(runtimeEnv.NOLO_LOCAL_SHELL_MODE || "") &&
|
|
161
|
+
Array.isArray(runtimePolicy?.runtimeTools) &&
|
|
162
|
+
runtimePolicy.runtimeTools.includes("execShell"),
|
|
159
163
|
writableRoots: [cwd],
|
|
160
164
|
};
|
|
161
165
|
}
|
|
@@ -445,7 +449,7 @@ export async function handleConnectorRunMessage(
|
|
|
445
449
|
artifactCwd = prepared.path;
|
|
446
450
|
}
|
|
447
451
|
const runtimePermissionPolicy = !hasExplicitMachinePermissions(agentConfig)
|
|
448
|
-
? runtimeWorkspacePermissionPolicy(runtimePolicy, cwd)
|
|
452
|
+
? runtimeWorkspacePermissionPolicy(runtimePolicy, runtimeEnv, cwd)
|
|
449
453
|
: null;
|
|
450
454
|
const effectivePermissionPolicy = scopePermissionPolicyToRuntimeWorkspace(
|
|
451
455
|
runtimePermissionPolicy ?? machinePermissionPolicy,
|
|
@@ -499,21 +503,37 @@ export async function handleConnectorRunMessage(
|
|
|
499
503
|
const heartbeat = setInterval(() => {
|
|
500
504
|
sendProgress({
|
|
501
505
|
...progressBase,
|
|
502
|
-
|
|
506
|
+
message: "cli-running",
|
|
503
507
|
updatedAt: Date.now(),
|
|
504
508
|
});
|
|
505
509
|
}, 15_000);
|
|
510
|
+
const effectiveRuntimeEnv = withForwardedUserAuthToken(runtimeEnv, parsed);
|
|
506
511
|
const result = await executeCli(provider, materializedPrompt.prompt, {
|
|
507
512
|
model: agentConfig.model || undefined,
|
|
508
513
|
timeout,
|
|
509
514
|
cwd,
|
|
510
515
|
yolo: true,
|
|
511
516
|
env: {
|
|
512
|
-
NOLO_SERVER:
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
+
NOLO_SERVER:
|
|
518
|
+
effectiveRuntimeEnv.NOLO_SERVER ||
|
|
519
|
+
effectiveRuntimeEnv.NOLO_SERVER_URL ||
|
|
520
|
+
effectiveRuntimeEnv.BASE_URL,
|
|
521
|
+
NOLO_SERVER_URL:
|
|
522
|
+
effectiveRuntimeEnv.NOLO_SERVER_URL ||
|
|
523
|
+
effectiveRuntimeEnv.NOLO_SERVER ||
|
|
524
|
+
effectiveRuntimeEnv.BASE_URL,
|
|
525
|
+
BASE_URL:
|
|
526
|
+
effectiveRuntimeEnv.BASE_URL ||
|
|
527
|
+
effectiveRuntimeEnv.NOLO_SERVER ||
|
|
528
|
+
effectiveRuntimeEnv.NOLO_SERVER_URL,
|
|
529
|
+
AUTH_TOKEN:
|
|
530
|
+
effectiveRuntimeEnv.AUTH_TOKEN ||
|
|
531
|
+
effectiveRuntimeEnv.AUTH ||
|
|
532
|
+
effectiveRuntimeEnv.NOLO_MACHINE_API_KEY,
|
|
533
|
+
NOLO_MACHINE_API_KEY:
|
|
534
|
+
effectiveRuntimeEnv.NOLO_MACHINE_API_KEY ||
|
|
535
|
+
effectiveRuntimeEnv.AUTH_TOKEN ||
|
|
536
|
+
effectiveRuntimeEnv.AUTH,
|
|
517
537
|
},
|
|
518
538
|
}).finally(() => clearInterval(heartbeat));
|
|
519
539
|
logConnectorRun("agent.run.cli.result", {
|
|
@@ -555,7 +575,7 @@ export async function handleConnectorRunMessage(
|
|
|
555
575
|
baseSha = await readConnectorGitHead(cwd);
|
|
556
576
|
const result = await runConnectorLocalRuntimeAgent({
|
|
557
577
|
parsed,
|
|
558
|
-
runtimeEnv,
|
|
578
|
+
runtimeEnv: withForwardedUserAuthToken(runtimeEnv, parsed),
|
|
559
579
|
cwd,
|
|
560
580
|
fetchImpl,
|
|
561
581
|
onProgress: sendProgress,
|
|
@@ -28,7 +28,7 @@ type ParsedArgs = {
|
|
|
28
28
|
|
|
29
29
|
const DEFAULT_USER_ID = "b2e06f801f";
|
|
30
30
|
const DEFAULT_SPACE_ID = "01KKY77TT0DA9NY7TNW3R7255N";
|
|
31
|
-
const DEFAULT_SOURCE_AGENT_ID = "
|
|
31
|
+
const DEFAULT_SOURCE_AGENT_ID = "01MIMO25MONTH0000000NEW001";
|
|
32
32
|
const DEFAULT_TARGET_AGENT_ID = "01OFFMARXBOOK000000010AHL1";
|
|
33
33
|
const DEFAULT_AGENT_NAME = "离线马克思主义文库书籍转换助手";
|
|
34
34
|
const TOOL_NAME = "convertMarxistsBookToOfflineHtml";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nolo-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Agent-first terminal workspace for Nolo",
|
|
6
6
|
"bin": {
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"cli/connectorWebSocketTarget.ts",
|
|
105
105
|
"cli/agentAliases.ts",
|
|
106
106
|
"cli/machineCommands.ts",
|
|
107
|
-
"cli/defaultServer.ts",
|
|
108
107
|
"cli/client/localAgentRecords.ts",
|
|
108
|
+
"cli/defaultServer.ts",
|
|
109
109
|
"cli/client/agentRun.ts",
|
|
110
110
|
"cli/agentRuntimeLocal.ts",
|
|
111
111
|
"cli/client/taskWorktree.ts",
|
|
@@ -153,6 +153,7 @@
|
|
|
153
153
|
"agent-runtime/agentConfigOptions.ts",
|
|
154
154
|
"agent-runtime/openAiCompatibleProvider.ts",
|
|
155
155
|
"agent-runtime/openAiCompatibleProviderConfig.ts",
|
|
156
|
+
"agent-runtime/providerResolution.ts",
|
|
156
157
|
"agent-runtime/platformChatProvider.ts",
|
|
157
158
|
"agent-runtime/runtimeFacts.ts",
|
|
158
159
|
"agent-runtime/agentRecordKeys.ts",
|
|
@@ -161,6 +162,7 @@
|
|
|
161
162
|
"agent-runtime/dialogWritePlan.ts",
|
|
162
163
|
"agent-runtime/hybridRecordStore.ts",
|
|
163
164
|
"agent-runtime/localToolPolicy.ts",
|
|
165
|
+
"agent-runtime/shellCommandPolicy.ts",
|
|
164
166
|
"agent-runtime/runtimeToolPolicy.ts",
|
|
165
167
|
"connector-experimental/heartbeatLoop.ts",
|
|
166
168
|
"connector-experimental/capabilities.ts",
|
|
@@ -169,10 +171,16 @@
|
|
|
169
171
|
"database/server/db.ts",
|
|
170
172
|
"database/config.ts",
|
|
171
173
|
"database/server/ensureDbOpen.ts",
|
|
174
|
+
"database/server/legacyServerDb.ts",
|
|
175
|
+
"database/server/authorityStoreTypes.ts",
|
|
176
|
+
"database/server/serverStoreFactory.ts",
|
|
177
|
+
"database/server/levelAuthorityStore.ts",
|
|
178
|
+
"database/server/memoryAuthorityStore.ts",
|
|
172
179
|
"ai/agent/cliExecutor.ts",
|
|
173
180
|
"ai/skills/skillDocProtocol.ts",
|
|
174
181
|
"ai/tools/agent/taskRunTool.ts",
|
|
175
182
|
"ai/agent/cliPrompt.ts",
|
|
183
|
+
"ai/tools/toolNameAliases.ts",
|
|
176
184
|
"render/table/activityColumns.ts"
|
|
177
185
|
],
|
|
178
186
|
"publishConfig": {
|
package/runtimeDoctorCommands.ts
CHANGED
|
@@ -64,13 +64,13 @@ async function defaultLocalRuntimeProbe(env: EnvLike): Promise<LocalRuntimeProbe
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export async function runDoctorRuntimeCommand(
|
|
67
|
-
|
|
67
|
+
args: string[],
|
|
68
68
|
deps: AgentCommandDeps = {}
|
|
69
69
|
) {
|
|
70
70
|
const env = deps.env ?? process.env;
|
|
71
71
|
const output = deps.output ?? process.stdout;
|
|
72
|
-
const authToken = resolveAuthToken(env);
|
|
73
|
-
const serverUrl = resolveServerUrl(env);
|
|
72
|
+
const authToken = resolveAuthToken(args, env);
|
|
73
|
+
const serverUrl = resolveServerUrl(args, env);
|
|
74
74
|
const localProbe = await (deps.localRuntimeProbe ?? defaultLocalRuntimeProbe)(env);
|
|
75
75
|
const hasLocalAgentConfig = detectLocalAgentConfig(env) && localProbe.ok && localProbe.agentFound;
|
|
76
76
|
const hasLocalProvider = detectLocalProvider(env);
|
|
@@ -88,7 +88,13 @@ export async function runDoctorRuntimeCommand(
|
|
|
88
88
|
hasLocalPersistence: true,
|
|
89
89
|
missingLocalCapabilities,
|
|
90
90
|
requiresServer: false,
|
|
91
|
-
serverFallbackAvailable: Boolean(
|
|
91
|
+
serverFallbackAvailable: Boolean(
|
|
92
|
+
authToken ||
|
|
93
|
+
args.includes("--server") ||
|
|
94
|
+
args.includes("--server-url") ||
|
|
95
|
+
env.NOLO_SERVER ||
|
|
96
|
+
env.BASE_URL
|
|
97
|
+
),
|
|
92
98
|
});
|
|
93
99
|
|
|
94
100
|
output.write(`Runtime: ${decision.mode}\n`);
|
package/tableCommands.ts
CHANGED
|
@@ -80,7 +80,7 @@ function resolveServerUrl(args: string[], env: EnvLike): string {
|
|
|
80
80
|
|
|
81
81
|
function resolveAuthToken(args: string[], env: EnvLike): string {
|
|
82
82
|
return (
|
|
83
|
-
readOption(args, "--
|
|
83
|
+
readOption(args, "--machine-key") ||
|
|
84
84
|
readOption(args, "--token") ||
|
|
85
85
|
env.AUTH_TOKEN ||
|
|
86
86
|
env.AUTH ||
|
package/taskRunCommand.ts
CHANGED
|
@@ -82,7 +82,7 @@ function resolveServerUrl(args: string[], env: EnvLike) {
|
|
|
82
82
|
|
|
83
83
|
function resolveAuthToken(args: string[], env: EnvLike) {
|
|
84
84
|
return (
|
|
85
|
-
readOption(args, "--
|
|
85
|
+
readOption(args, "--machine-key") ||
|
|
86
86
|
readOption(args, "--token") ||
|
|
87
87
|
env.NOLO_TASK_RUN_TOKEN ||
|
|
88
88
|
env.NOLO_MACHINE_API_KEY ||
|