nolo-cli 0.1.22 → 0.1.26
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 +25 -3
- package/agent-runtime/agentRecordConfig.ts +4 -0
- package/agent-runtime/hostAdapter.ts +2 -0
- package/agent-runtime/hybridRecordStore.ts +30 -9
- package/agent-runtime/index.ts +7 -0
- package/agent-runtime/localLoop.ts +14 -4
- package/agent-runtime/localToolPolicy.ts +22 -10
- package/agent-runtime/localWorkspaceTools.ts +140 -374
- package/agent-runtime/platformChatProvider.ts +3 -0
- package/agent-runtime/runtimeToolPolicy.ts +133 -0
- package/agent-runtime/types.ts +47 -0
- package/agentAliases.ts +1 -1
- package/agentCommandSupport.ts +77 -0
- package/agentInternalCommandEntries.ts +34 -0
- package/agentListCommands.ts +123 -0
- package/agentListHelpers.ts +187 -0
- package/agentMachineCommands.ts +402 -0
- package/agentRecordCommands.ts +141 -0
- package/agentRecordHelpers.ts +395 -0
- package/agentRunCommand.ts +75 -3
- package/agentRuntimeCommands.ts +7 -773
- package/ai/agent/_executeModel.ts +29 -3
- package/ai/agent/buildSystemPrompt.ts +17 -0
- package/ai/agent/cliChatClient.ts +38 -4
- package/ai/agent/cliExecutor.ts +304 -25
- package/ai/agent/createAgentSchema.ts +2 -2
- package/ai/agent/guidedCreation/assistant.ts +82 -0
- package/ai/agent/guidedCreation/capabilities.ts +84 -0
- package/ai/agent/guidedCreation/draft.ts +62 -0
- package/ai/agent/guidedCreation/types.ts +38 -0
- package/ai/agent/machineRunPermissions.ts +21 -3
- package/ai/agent/runtimeGuidance.ts +1 -1
- package/ai/agent/server/fetchPublicAgents.ts +6 -1
- package/ai/agent/streamAgentChatTurn.ts +593 -36
- package/ai/agent/web/useGuidedAgentCreation.ts +217 -0
- package/ai/ai.locale.ts +14 -2
- package/ai/chat/fetchUtils.native.ts +2 -0
- package/ai/chat/fetchUtils.ts +2 -0
- package/ai/chat/sendOpenAICompletionsRequest.ts +82 -1
- package/ai/chat/sendOpenAIResponseRequest.ts +65 -0
- package/ai/llm/getPricing.ts +14 -0
- package/ai/llm/kimi.ts +4 -1
- package/ai/llm/modelAvatar.ts +1 -0
- package/ai/llm/providers.ts +4 -1
- package/ai/llm/reasoningModels.ts +1 -0
- package/ai/taskRun/taskRunProtocol.ts +25 -10
- package/ai/token/modelUsageQuery.ts +17 -0
- package/ai/tools/agent/agentTools.ts +38 -0
- package/ai/tools/agent/prepareAgentDraftTool.ts +159 -0
- package/ai/tools/agent/startAgentDialogTool.ts +53 -0
- package/ai/tools/checkEnvTool.ts +52 -20
- package/ai/tools/convertMarxistsBookTool.ts +103 -0
- package/ai/tools/{execBashTool.ts → execShellTool.ts} +44 -161
- package/ai/tools/index.ts +24 -14
- package/ai/tools/marxistsOfflineBook.ts +253 -0
- package/ai/tools/modelUsageTools.ts +9 -2
- package/ai/tools/readTool.ts +31 -0
- package/ai/tools/toolApiClient.ts +35 -1
- package/ai/tools/toolNameAliases.ts +13 -0
- package/cliCommandAdapters.ts +28 -0
- package/cliCommandDispatch.ts +66 -0
- package/cliCommandFactories.ts +34 -0
- package/cliCommandTypes.ts +49 -0
- package/cliEnvHelpers.ts +44 -0
- package/client/agentRun.test.ts +330 -24
- package/client/agentRun.ts +117 -35
- package/client/hybridRecordStore.test.ts +42 -0
- package/client/hybridRecordStore.ts +11 -0
- package/client/localRuntimeAdapter.test.ts +191 -21
- package/client/localRuntimeAdapter.ts +99 -10
- package/client/localRuntimeDryRun.test.ts +5 -2
- package/client/taskRunPrompt.ts +1 -0
- package/commandRegistry.ts +11 -61
- package/connector-experimental/capabilities.ts +1 -0
- package/database/actions/common.ts +4 -3
- package/database/config.ts +19 -0
- package/database/server/coreDataProxy.ts +43 -26
- package/index.ts +54 -191
- package/internalCommandEntries.ts +12 -0
- package/machineCommands.ts +688 -64
- package/offlineMarxistsAgentCommand.ts +314 -0
- package/package.json +22 -2
- package/render/canvas/canvasEditContext.ts +127 -0
- package/render/canvas/canvasRuntime.ts +57 -0
- package/render/canvas/canvasSnapshotParser.ts +76 -0
- package/render/canvas/canvasTree.ts +308 -0
- package/render/canvas/types.ts +46 -0
- package/render/layout/deleteBehavior.ts +52 -0
- package/render/layout/mainLayoutSidebar.ts +17 -0
- package/render/layout/mainLayoutViewMode.ts +56 -0
- package/render/layout/topbarUtils.ts +87 -0
- package/render/layout/useDevReloadPending.ts +30 -0
- package/render/page/createPageAction.ts +183 -0
- package/render/page/docSlice.ts +468 -0
- package/render/page/server/createPage.ts +174 -0
- package/render/page/server/handleCreatePage.ts +91 -0
- package/render/page/server/index.ts +4 -0
- package/render/page/types.ts +17 -0
- package/render/page/useKeyboardSave.ts +48 -0
- package/render/styles/zIndex.ts +12 -0
- package/render/surf/WeatherIconStyles.ts +17 -0
- package/render/surf/color.ts +9 -0
- package/render/surf/config.ts +46 -0
- package/render/surf/screens/style.ts +1 -0
- package/render/surf/styles/ToggleButtonStyles.ts +8 -0
- package/render/surf/utils/groupedWeatherData.ts +32 -0
- package/render/surf/weatherUtils.ts +50 -0
- package/render/table/activityColumns.ts +6 -0
- package/render/table/createTableAction.ts +270 -0
- package/render/table/deleteTableAction.ts +129 -0
- package/render/table/fetchAndCacheTableRows.ts +174 -0
- package/render/table/tableSlice.ts +1106 -0
- package/render/table/tableView.ts +289 -0
- package/render/table/toolValueUtils.ts +363 -0
- package/render/table/types.ts +252 -0
- package/render/table/useCreateTable.ts +72 -0
- package/render/table/useTable.ts +61 -0
- package/render/table/utils/tableSerialization.ts +50 -0
- package/render/web/elements/artifactPreviewCode.ts +43 -0
- package/render/web/elements/artifactRuntimePreload.ts +52 -0
- package/render/web/elements/codeBlockAutoPreview.ts +10 -0
- package/render/web/elements/mermaidPreview.ts +21 -0
- package/render/web/ui/useInlineEdit.ts +135 -0
- package/runtimeDoctorCommands.ts +118 -0
- package/scriptCommandEntries.ts +71 -0
- package/systemInternalCommandEntries.ts +71 -0
- package/tableCommands.ts +42 -5
- package/workflowInternalCommandEntries.ts +11 -0
package/index.ts
CHANGED
|
@@ -1,54 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
|
|
6
|
-
import { renderHelpText, resolveCommand } from "./commandRegistry";
|
|
7
|
-
import { runLoginCommand, runLogoutCommand, runWhoamiCommand } from "./authCommands";
|
|
2
|
+
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
8
6
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from "./
|
|
15
|
-
import { runAgentRunCommand } from "./agentRunCommand";
|
|
16
|
-
import { runAgentPullCommand } from "./agentPullCommand";
|
|
7
|
+
createCliRuntimeContext,
|
|
8
|
+
looksLikeDaemonShortcut,
|
|
9
|
+
renderHelpText,
|
|
10
|
+
resolveCommand,
|
|
11
|
+
runResolvedCommand,
|
|
12
|
+
} from "./commandRegistry";
|
|
17
13
|
import { buildEnvFromProfile, loadProfileConfig } from "./client/profileConfig";
|
|
18
14
|
import { resolveTuiLaunchMode } from "./runtimeModeArgs";
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
async function runScript(script: string, forwardedArgs: string[], env: NodeJS.ProcessEnv) {
|
|
40
|
-
const scriptPath = join(SCRIPT_DIR, script);
|
|
41
|
-
const proc = Bun.spawn({
|
|
42
|
-
cmd: [process.execPath, scriptPath, ...forwardedArgs],
|
|
43
|
-
stdin: "inherit",
|
|
44
|
-
stdout: "inherit",
|
|
45
|
-
stderr: "inherit",
|
|
46
|
-
env,
|
|
47
|
-
});
|
|
48
|
-
const exitCode = await proc.exited;
|
|
49
|
-
process.exit(exitCode);
|
|
50
|
-
}
|
|
51
|
-
|
|
15
|
+
import { startTuiWorkspace } from "./tui/readlineWorkspace";
|
|
16
|
+
import { readPackageInfo } from "./updateCommands";
|
|
17
|
+
|
|
18
|
+
const CLI_DIR = dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const ROOT_DIR = join(CLI_DIR, "..", "..");
|
|
20
|
+
const SCRIPT_DIR = join(ROOT_DIR, "scripts");
|
|
21
|
+
const packageInfo = readPackageInfo();
|
|
22
|
+
|
|
23
|
+
async function runScript(script: string, forwardedArgs: string[], env: NodeJS.ProcessEnv) {
|
|
24
|
+
const scriptPath = join(SCRIPT_DIR, script);
|
|
25
|
+
const proc = Bun.spawn({
|
|
26
|
+
cmd: [process.execPath, scriptPath, ...forwardedArgs],
|
|
27
|
+
stdin: "inherit",
|
|
28
|
+
stdout: "inherit",
|
|
29
|
+
stderr: "inherit",
|
|
30
|
+
env,
|
|
31
|
+
});
|
|
32
|
+
return proc.exited;
|
|
33
|
+
}
|
|
34
|
+
|
|
52
35
|
const args = process.argv.slice(2);
|
|
53
36
|
const profileEnv = buildEnvFromProfile(loadProfileConfig());
|
|
54
37
|
const explicitServerUrl = process.env.NOLO_SERVER || process.env.NOLO_SERVER_URL || process.env.BASE_URL;
|
|
@@ -58,35 +41,23 @@ const runtimeEnv = {
|
|
|
58
41
|
...(explicitServerUrl ? { NOLO_SERVER: explicitServerUrl, BASE_URL: explicitServerUrl } : {}),
|
|
59
42
|
NOLO_CLI_VERSION: packageInfo.version,
|
|
60
43
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return args.includes("--server-url") || args.includes("--api-key");
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (args.length === 0) {
|
|
82
|
-
if (process.stdin.isTTY) {
|
|
83
|
-
await startTuiWorkspace({ scriptDir: SCRIPT_DIR, env: runtimeEnv });
|
|
84
|
-
} else {
|
|
85
|
-
console.log(renderHelpText());
|
|
86
|
-
}
|
|
87
|
-
process.exit(0);
|
|
88
|
-
}
|
|
89
|
-
|
|
44
|
+
|
|
45
|
+
const runtimeContext = createCliRuntimeContext({
|
|
46
|
+
env: runtimeEnv,
|
|
47
|
+
scriptDir: SCRIPT_DIR,
|
|
48
|
+
entrypointPath: fileURLToPath(import.meta.url),
|
|
49
|
+
packageInfo,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (args.length === 0) {
|
|
53
|
+
if (process.stdin.isTTY) {
|
|
54
|
+
await startTuiWorkspace({ scriptDir: SCRIPT_DIR, env: runtimeEnv });
|
|
55
|
+
} else {
|
|
56
|
+
console.log(renderHelpText());
|
|
57
|
+
}
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
60
|
+
|
|
90
61
|
const tuiLaunchMode = resolveTuiLaunchMode(args);
|
|
91
62
|
if (tuiLaunchMode.shouldStartTui) {
|
|
92
63
|
await startTuiWorkspace({
|
|
@@ -95,125 +66,17 @@ if (tuiLaunchMode.shouldStartTui) {
|
|
|
95
66
|
});
|
|
96
67
|
process.exit(0);
|
|
97
68
|
}
|
|
98
|
-
|
|
99
|
-
if (args[0] === "login") {
|
|
100
|
-
process.exit(await runLoginCommand(args.slice(1)));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (args[0] === "whoami") {
|
|
104
|
-
process.exit(runWhoamiCommand());
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (args[0] === "logout") {
|
|
108
|
-
process.exit(runLogoutCommand());
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (args[0] === "connect") {
|
|
112
|
-
process.exit(await runMachineConnectCommand(args.slice(1), {
|
|
113
|
-
env: runtimeEnv,
|
|
114
|
-
cliEntrypointPath: fileURLToPath(import.meta.url),
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (args[0] === "task-run") {
|
|
119
|
-
process.exit(await runTaskRunCommand(args.slice(1), { env: runtimeEnv }));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (args[0] === "table" && args[1] === "query") {
|
|
123
|
-
process.exit(await runTableQueryCommand(args.slice(2), { env: runtimeEnv }));
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (args[0] === "daemon" || looksLikeDaemonShortcut(args)) {
|
|
127
|
-
const daemonArgs = args[0] === "daemon" ? args.slice(1) : args;
|
|
128
|
-
process.exit(await runMachineConnectCommand(["--ws"], {
|
|
129
|
-
env: buildDaemonEnv(daemonArgs),
|
|
130
|
-
cliEntrypointPath: fileURLToPath(import.meta.url),
|
|
131
|
-
}));
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (args[0] === "machine" && args[1] === "status") {
|
|
135
|
-
process.exit(await runMachineStatusCommand(args.slice(2), { env: runtimeEnv }));
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (args[0] === "agent" && args[1] === "bind-current") {
|
|
139
|
-
process.exit(await runAgentBindCurrentCommand(args.slice(2), { env: runtimeEnv }));
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (args[0] === "agent" && args[1] === "smoke-current") {
|
|
143
|
-
process.exit(await runAgentSmokeCurrentCommand(args.slice(2), { env: runtimeEnv }));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (args[0] === "agent" && args[1] === "run") {
|
|
147
|
-
process.exit(await runAgentRunCommand(args.slice(2), {
|
|
148
|
-
env: runtimeEnv,
|
|
149
|
-
scriptDir: SCRIPT_DIR,
|
|
150
|
-
}));
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (args[0] === "agent" && args[1] === "chat") {
|
|
154
|
-
process.exit(await runAgentRunCommand(args.slice(2), {
|
|
155
|
-
env: runtimeEnv,
|
|
156
|
-
scriptDir: SCRIPT_DIR,
|
|
157
|
-
}));
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if (args[0] === "chat") {
|
|
161
|
-
process.exit(await runAgentRunCommand(args.slice(1), {
|
|
162
|
-
env: runtimeEnv,
|
|
163
|
-
scriptDir: SCRIPT_DIR,
|
|
164
|
-
}));
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (args[0] === "agent" && args[1] === "pull") {
|
|
168
|
-
process.exit(await runAgentPullCommand(args.slice(2), { env: runtimeEnv }));
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (args[0] === "agent" && args[1] === "read") {
|
|
172
|
-
process.exit(await runAgentReadCommand(args.slice(2), { env: runtimeEnv }));
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (args[0] === "agent" && args[1] === "runtime-doctor") {
|
|
176
|
-
process.exit(await runAgentRuntimeDoctorCommand(args.slice(2), { env: runtimeEnv }));
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (args[0] === "doctor" && args[1] === "runtime") {
|
|
180
|
-
process.exit(await runDoctorRuntimeCommand(args.slice(2), { env: runtimeEnv }));
|
|
181
|
-
}
|
|
182
69
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
process.exit(0);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (args[0] === "doctor") {
|
|
189
|
-
console.log(
|
|
190
|
-
buildCliDoctorText({
|
|
191
|
-
packageName: packageInfo.name,
|
|
192
|
-
version: packageInfo.version,
|
|
193
|
-
entrypoint: fileURLToPath(import.meta.url),
|
|
194
|
-
serverUrl: runtimeEnv.NOLO_SERVER || runtimeEnv.BASE_URL || DEFAULT_NOLO_SERVER_URL,
|
|
195
|
-
profileName: runtimeEnv.NOLO_PROFILE || "local",
|
|
196
|
-
})
|
|
197
|
-
);
|
|
198
|
-
process.exit(0);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (args[0] === "update") {
|
|
202
|
-
process.exit(await runSelfUpdate());
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (args[0] === "--help" || args[0] === "-h") {
|
|
206
|
-
console.log(renderHelpText());
|
|
207
|
-
process.exit(0);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
const command = resolveCommand(args);
|
|
70
|
+
const commandArgs = looksLikeDaemonShortcut(args) ? ["daemon", ...args] : args;
|
|
71
|
+
const command = resolveCommand(commandArgs);
|
|
211
72
|
if (!command) {
|
|
212
73
|
console.error(`Unknown command: ${args.join(" ")}`);
|
|
213
74
|
console.error("");
|
|
214
75
|
console.log(renderHelpText());
|
|
215
|
-
process.exit(1);
|
|
76
|
+
process.exit(1);
|
|
216
77
|
}
|
|
217
78
|
|
|
218
|
-
const
|
|
219
|
-
|
|
79
|
+
const exitCode = await runResolvedCommand(command, commandArgs, runtimeContext, {
|
|
80
|
+
runScript,
|
|
81
|
+
});
|
|
82
|
+
process.exit(exitCode);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getAgentInternalCommandEntries } from "./agentInternalCommandEntries";
|
|
2
|
+
import type { CommandEntry } from "./cliCommandTypes";
|
|
3
|
+
import { getSystemInternalCommandEntries } from "./systemInternalCommandEntries";
|
|
4
|
+
import { getWorkflowInternalCommandEntries } from "./workflowInternalCommandEntries";
|
|
5
|
+
|
|
6
|
+
export function getInternalCommandEntries(renderHelpText: () => string): CommandEntry[] {
|
|
7
|
+
return [
|
|
8
|
+
...getAgentInternalCommandEntries(),
|
|
9
|
+
...getWorkflowInternalCommandEntries(),
|
|
10
|
+
...getSystemInternalCommandEntries(renderHelpText),
|
|
11
|
+
];
|
|
12
|
+
}
|