nolo-cli 0.1.32 → 0.1.33
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 +0 -6
- package/agent-runtime/agentRecordConfig.ts +2 -0
- package/agent-runtime/hostAdapter.ts +1 -0
- package/agent-runtime/index.ts +0 -21
- package/agent-runtime/localToolPolicy.ts +6 -13
- package/agent-runtime/localWorkspaceTools.ts +30 -333
- package/agent-runtime/platformChatProvider.ts +1 -4
- package/agent-runtime/runtimeToolPolicy.ts +47 -32
- package/agentAliases.ts +14 -83
- package/agentCommandSupport.ts +3 -6
- package/agentInternalCommandEntries.ts +2 -13
- package/agentListCommands.ts +19 -28
- package/agentMachineCommands.ts +40 -336
- package/agentPullCommand.ts +36 -56
- package/agentRecordCommands.ts +3 -5
- package/agentRecordHelpers.ts +22 -189
- package/agentRunCommand.ts +438 -107
- package/agentRuntimeLocal.ts +0 -10
- package/ai/agent/cliExecutor.ts +19 -323
- package/authCommands.ts +2 -36
- package/cli/agentAliases.ts +14 -83
- package/cli/agentCommandSupport.ts +3 -6
- package/cli/agentInternalCommandEntries.ts +2 -13
- package/cli/agentListCommands.ts +19 -28
- package/cli/agentMachineCommands.ts +40 -336
- package/cli/agentPullCommand.ts +36 -56
- package/cli/agentRecordCommands.ts +3 -5
- package/cli/agentRecordHelpers.ts +22 -189
- package/cli/agentRunCommand.ts +438 -107
- package/cli/agentRuntimeLocal.ts +0 -10
- package/cli/authCommands.ts +2 -36
- package/cli/cliEnvHelpers.ts +21 -162
- package/cli/client/agentRun.ts +853 -57
- package/cli/client/localRuntimeAdapter.ts +22 -159
- package/cli/client/streamingOutput.ts +3 -1
- package/cli/client/taskRunPrompt.ts +24 -7
- package/cli/commandRegistry.ts +2 -3
- package/cli/connectorRunArtifact.ts +10 -34
- package/cli/connectorWebSocketTarget.ts +6 -10
- package/cli/internalCommandEntries.ts +0 -8
- package/cli/localRuntimeDb.ts +2 -39
- package/cli/machineCommands.ts +189 -190
- package/cli/machineDaemonCommands.ts +165 -9
- package/cli/machineHeartbeatCommands.ts +2 -1
- package/cli/machineStatusCommands.ts +13 -5
- package/cli/machineWatchCommands.ts +1 -1
- package/cli/machineWsRunDispatch.ts +14 -48
- package/cli/machineWsSession.ts +0 -2
- package/cli/offlineMarxistsAgentCommand.ts +314 -0
- package/cli/runtimeDoctorCommands.ts +69 -18
- package/cli/scriptCommandEntries.ts +45 -5
- package/cli/tableCommands.ts +133 -33
- package/cli/taskRunCommand.ts +211 -16
- package/cli/tui/session.ts +372 -43
- package/cli/workflowInternalCommandEntries.ts +0 -20
- package/cliEnvHelpers.ts +21 -162
- package/client/agentConfigResolver.test.ts +2 -0
- package/client/agentRun.test.ts +12 -208
- package/client/agentRun.ts +853 -57
- package/client/localRuntimeAdapter.test.ts +9 -168
- package/client/localRuntimeAdapter.ts +22 -159
- package/client/localToolPolicy.test.ts +4 -28
- package/client/streamingOutput.ts +3 -1
- package/client/taskRunPrompt.ts +24 -7
- package/commandRegistry.ts +2 -3
- package/connectorRunArtifact.ts +10 -34
- package/connectorWebSocketTarget.ts +6 -10
- package/database/server/db.ts +34 -15
- package/internalCommandEntries.ts +0 -8
- package/localRuntimeDb.ts +2 -39
- package/machineCommands.ts +189 -190
- package/machineDaemonCommands.ts +165 -9
- package/machineHeartbeatCommands.ts +2 -1
- package/machineStatusCommands.ts +13 -5
- package/machineWatchCommands.ts +1 -1
- package/machineWsRunDispatch.ts +14 -48
- package/machineWsSession.ts +0 -2
- package/offlineMarxistsAgentCommand.ts +314 -0
- package/package.json +49 -193
- package/runtimeDoctorCommands.ts +69 -18
- package/scriptCommandEntries.ts +45 -5
- package/tableCommands.ts +133 -33
- package/taskRunCommand.ts +211 -16
- package/tui/session.ts +372 -43
- package/workflowInternalCommandEntries.ts +0 -20
- package/agent-runtime/dialogStatus.ts +0 -139
- package/agent-runtime/hostRuntimeConfig.ts +0 -86
- package/agentCreateCustomCommands.ts +0 -278
- package/agentDialogsCommands.ts +0 -227
- package/agentDoctorCommands.ts +0 -203
- package/agentRunLocalWorkspace.ts +0 -182
- package/agentRunParsing.ts +0 -298
- package/agentSuperviseCommands.ts +0 -8
- package/agentUnpublishCommands.ts +0 -113
- package/ai/agent/agentRunDialogLineage.ts +0 -56
- package/ai/policy/types.ts +0 -64
- package/ai/skills/skillSummaryMarker.ts +0 -26
- package/app/types.ts +0 -358
- package/build.ts +0 -16
- package/buildPublish.ts +0 -138
- package/buildPublishArtifactAssembly.ts +0 -724
- package/buildPublishImportAnalysis.ts +0 -242
- package/chat/messages/fetchMessages.ts +0 -84
- package/chat/messages/types.ts +0 -185
- package/cli/agentCreateCustomCommands.ts +0 -278
- package/cli/agentDialogsCommands.ts +0 -227
- package/cli/agentDoctorCommands.ts +0 -203
- package/cli/agentRunLocalWorkspace.ts +0 -182
- package/cli/agentRunParsing.ts +0 -298
- package/cli/agentSuperviseCommands.ts +0 -8
- package/cli/agentUnpublishCommands.ts +0 -113
- package/cli/buildPublish.ts +0 -138
- package/cli/buildPublishArtifactAssembly.ts +0 -724
- package/cli/buildPublishImportAnalysis.ts +0 -242
- package/cli/cliIoTypes.ts +0 -3
- package/cli/cliRuntimeDoctorReport.ts +0 -193
- package/cli/client/agentRunInput.ts +0 -10
- package/cli/client/agentRunLocalExecution.ts +0 -124
- package/cli/client/agentRunLocalExecutor.ts +0 -179
- package/cli/client/agentRunRuntimeSelection.ts +0 -145
- package/cli/client/agentRunServerTransport.ts +0 -397
- package/cli/client/agentRunTaskRunRecorder.ts +0 -176
- package/cli/customCodingAgentFlow.ts +0 -208
- package/cli/customCodingAgentRecord.ts +0 -179
- package/cli/dialogDataAccess.ts +0 -186
- package/cli/dialogInternalCommandEntries.ts +0 -11
- package/cli/dialogReadCommands.ts +0 -180
- package/cli/dialogReadHelpers.ts +0 -226
- package/cli/dialogStatusCommands.ts +0 -123
- package/cli/docInternalCommandEntries.ts +0 -20
- package/cli/hybridReadHelpers.ts +0 -109
- package/cli/machineCommandPrompts.ts +0 -79
- package/cli/machineCommandResolution.ts +0 -43
- package/cli/noloReadBridgePrompt.ts +0 -16
- package/cli/pageCreateCommands.ts +0 -219
- package/cli/pageDeleteCommands.ts +0 -167
- package/cli/pageReadCommands.ts +0 -151
- package/cli/pageUpdateCommands.ts +0 -249
- package/cli/pageWriteHelpers.ts +0 -209
- package/cli/publishPackage.ts +0 -36
- package/cli/runtimeInternalCommandEntries.ts +0 -15
- package/cli/runtimePassthroughCommands.ts +0 -22
- package/cli/scriptPassthroughHelpers.ts +0 -28
- package/cli/secretScanHelpers.ts +0 -31
- package/cli/spaceAttachCommands.ts +0 -134
- package/cli/spaceCategoryCommands.ts +0 -263
- package/cli/spaceCommands.ts +0 -295
- package/cli/spaceDeleteCommands.ts +0 -312
- package/cli/spaceInternalCommandEntries.ts +0 -21
- package/cli/spaceMutationHelpers.ts +0 -135
- package/cli/spaceReadCommands.ts +0 -323
- package/cli/tableDataOutput.ts +0 -41
- package/cli/tableDataSafety.ts +0 -26
- package/cli/tableMetaCommands.ts +0 -307
- package/cli/tableMutationCommands.ts +0 -266
- package/cli/tableQueryParsing.ts +0 -90
- package/cli/tableQueryRequest.ts +0 -53
- package/cli/taskRunActions.ts +0 -122
- package/cli/taskRunParsing.ts +0 -86
- package/cli/taskRunPromptShared.ts +0 -55
- package/cli/tui/tuiCatalog.ts +0 -22
- package/cli/tui/tuiCommandInterpreter.ts +0 -253
- package/cli/tui/tuiPresentation.ts +0 -146
- package/cliIoTypes.ts +0 -3
- package/cliRuntimeDoctorReport.ts +0 -193
- package/client/agentRunInput.ts +0 -10
- package/client/agentRunLocalExecution.test.ts +0 -123
- package/client/agentRunLocalExecution.ts +0 -124
- package/client/agentRunLocalExecutor.ts +0 -179
- package/client/agentRunRuntimeSelection.test.ts +0 -159
- package/client/agentRunRuntimeSelection.ts +0 -145
- package/client/agentRunServerTransport.ts +0 -397
- package/client/agentRunTaskRunRecorder.ts +0 -176
- package/connector-experimental/daemonLauncher.ts +0 -223
- package/create/space/spaceKeys.ts +0 -65
- package/create/types.ts +0 -21
- package/customCodingAgentFlow.ts +0 -208
- package/customCodingAgentRecord.ts +0 -179
- package/database/keys.ts +0 -765
- package/database/server/authorityStoreTypes.ts +0 -31
- package/database/server/legacyServerDb.ts +0 -58
- package/database/server/levelAuthorityStore.ts +0 -75
- package/database/server/memoryAuthorityStore.ts +0 -133
- package/database/server/serverStoreFactory.ts +0 -124
- package/database/tombstones.ts +0 -52
- package/database/utils/ulid.ts +0 -1
- package/dialogDataAccess.ts +0 -186
- package/dialogInternalCommandEntries.ts +0 -11
- package/dialogReadCommands.ts +0 -180
- package/dialogReadHelpers.ts +0 -226
- package/dialogStatusCommands.ts +0 -123
- package/docInternalCommandEntries.ts +0 -20
- package/hybridReadHelpers.ts +0 -109
- package/machineCommandPrompts.ts +0 -79
- package/machineCommandResolution.ts +0 -43
- package/noloReadBridgePrompt.ts +0 -16
- package/pageCreateCommands.ts +0 -219
- package/pageDeleteCommands.ts +0 -167
- package/pageReadCommands.ts +0 -151
- package/pageUpdateCommands.ts +0 -249
- package/pageWriteHelpers.ts +0 -209
- package/publishPackage.ts +0 -36
- package/runtimeInternalCommandEntries.ts +0 -15
- package/runtimePassthroughCommands.ts +0 -22
- package/scriptPassthroughHelpers.ts +0 -28
- package/secretScanHelpers.ts +0 -31
- package/share/helpers.ts +0 -302
- package/share/keys.ts +0 -243
- package/share/types.ts +0 -100
- package/spaceAttachCommands.ts +0 -134
- package/spaceCategoryCommands.ts +0 -263
- package/spaceCommands.ts +0 -295
- package/spaceDeleteCommands.ts +0 -312
- package/spaceInternalCommandEntries.ts +0 -21
- package/spaceMutationHelpers.ts +0 -135
- package/spaceReadCommands.ts +0 -323
- package/tableDataOutput.ts +0 -41
- package/tableDataSafety.ts +0 -26
- package/tableMetaCommands.ts +0 -307
- package/tableMutationCommands.ts +0 -266
- package/tableQueryParsing.ts +0 -90
- package/tableQueryRequest.ts +0 -53
- package/taskRunActions.ts +0 -122
- package/taskRunParsing.ts +0 -86
- package/taskRunPromptShared.ts +0 -55
- package/tui/tuiCatalog.ts +0 -22
- package/tui/tuiCommandInterpreter.test.ts +0 -169
- package/tui/tuiCommandInterpreter.ts +0 -253
- package/tui/tuiPresentation.test.ts +0 -154
- package/tui/tuiPresentation.ts +0 -146
package/cli/tui/tuiCatalog.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const DEFAULT_TUI_AGENT_KEY = "agent-pub-01NOLOAPPBLD000000019KCKT0";
|
|
2
|
-
|
|
3
|
-
export const KNOWN_AGENTS: Array<{
|
|
4
|
-
name: string;
|
|
5
|
-
key: string;
|
|
6
|
-
description: string;
|
|
7
|
-
}> = [
|
|
8
|
-
{
|
|
9
|
-
name: "nolo",
|
|
10
|
-
key: "agent-pub-01NOLOAPPBLD000000019KCKT0",
|
|
11
|
-
description: "one assistant that routes work across your agents and data",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: "app-builder",
|
|
15
|
-
key: "agent-pub-01APPBUILDER00000001YAII3I",
|
|
16
|
-
description: "builds web apps, tools, charts, and product prototypes",
|
|
17
|
-
},
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
export const KNOWN_AGENT_ALIASES: Record<string, { name: string; key: string }> =
|
|
21
|
-
Object.fromEntries(KNOWN_AGENTS.map((agent) => [agent.name, agent]));
|
|
22
|
-
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import type { AgentRuntimeRequestedMode } from "../agentRuntimeLocal";
|
|
2
|
-
|
|
3
|
-
export type TuiInterpreterState = {
|
|
4
|
-
agentKey: string;
|
|
5
|
-
agentName: string;
|
|
6
|
-
dialogId?: string;
|
|
7
|
-
dialogLabel: string;
|
|
8
|
-
profileName: string;
|
|
9
|
-
serverUrl: string;
|
|
10
|
-
cliVersion?: string;
|
|
11
|
-
attachedDocs: string[];
|
|
12
|
-
runtimeMode: AgentRuntimeRequestedMode;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type TuiInterpreterAction =
|
|
16
|
-
| {
|
|
17
|
-
type: "chat";
|
|
18
|
-
message: string;
|
|
19
|
-
agentKey: string;
|
|
20
|
-
runtimeMode: AgentRuntimeRequestedMode;
|
|
21
|
-
continueDialogId?: string;
|
|
22
|
-
}
|
|
23
|
-
| {
|
|
24
|
-
type: "compact";
|
|
25
|
-
dialogId: string;
|
|
26
|
-
}
|
|
27
|
-
| {
|
|
28
|
-
type: "self-update";
|
|
29
|
-
}
|
|
30
|
-
| {
|
|
31
|
-
type: "exit";
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type TuiInterpreterResult = {
|
|
35
|
-
nextState: TuiInterpreterState;
|
|
36
|
-
output: string;
|
|
37
|
-
action?: TuiInterpreterAction;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export type TuiKnownAgent = {
|
|
41
|
-
name: string;
|
|
42
|
-
key: string;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type TuiCommandInterpreterDeps = {
|
|
46
|
-
knownAgents: TuiKnownAgent[];
|
|
47
|
-
renderHelp: () => string;
|
|
48
|
-
renderContextPanel: (state: TuiInterpreterState) => string;
|
|
49
|
-
renderKnownAgents: () => string;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export function resolveSwitchTarget(
|
|
53
|
-
rawTarget: string,
|
|
54
|
-
deps: Pick<TuiCommandInterpreterDeps, "knownAgents">
|
|
55
|
-
) {
|
|
56
|
-
const target = rawTarget.trim();
|
|
57
|
-
if (/^\d+$/.test(target)) {
|
|
58
|
-
const agent = deps.knownAgents[Number(target) - 1];
|
|
59
|
-
return agent ? { name: agent.name, key: agent.key } : null;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const knownAgentAliases: Record<string, TuiKnownAgent> = Object.fromEntries(
|
|
63
|
-
deps.knownAgents.map((agent) => [agent.name.toLowerCase(), agent])
|
|
64
|
-
);
|
|
65
|
-
const alias = knownAgentAliases[target.toLowerCase()];
|
|
66
|
-
if (alias) return alias;
|
|
67
|
-
|
|
68
|
-
if (target.startsWith("agent-") || target.startsWith("agent-pub-")) {
|
|
69
|
-
return { name: target, key: target };
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function handleTuiInput(
|
|
76
|
-
input: string,
|
|
77
|
-
state: TuiInterpreterState,
|
|
78
|
-
deps: TuiCommandInterpreterDeps
|
|
79
|
-
): TuiInterpreterResult {
|
|
80
|
-
const trimmed = input.trim();
|
|
81
|
-
if (!trimmed) {
|
|
82
|
-
return { nextState: state, output: "" };
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (!trimmed.startsWith("/")) {
|
|
86
|
-
return {
|
|
87
|
-
nextState: state,
|
|
88
|
-
output: "",
|
|
89
|
-
action: {
|
|
90
|
-
type: "chat",
|
|
91
|
-
message: trimmed,
|
|
92
|
-
agentKey: state.agentKey,
|
|
93
|
-
runtimeMode: state.runtimeMode,
|
|
94
|
-
...(state.dialogId ? { continueDialogId: state.dialogId } : {}),
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const [command = "", ...rest] = trimmed.split(/\s+/);
|
|
100
|
-
const argText = rest.join(" ").trim();
|
|
101
|
-
|
|
102
|
-
switch (command) {
|
|
103
|
-
case "/help":
|
|
104
|
-
return { nextState: state, output: deps.renderHelp() };
|
|
105
|
-
case "/context":
|
|
106
|
-
case "/ctx":
|
|
107
|
-
return { nextState: state, output: deps.renderContextPanel(state) };
|
|
108
|
-
case "/runtime": {
|
|
109
|
-
if (argText !== "auto" && argText !== "local" && argText !== "server") {
|
|
110
|
-
return {
|
|
111
|
-
nextState: state,
|
|
112
|
-
output: "Usage: /runtime <auto|local|server>",
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return {
|
|
117
|
-
nextState: { ...state, runtimeMode: argText },
|
|
118
|
-
output: `Runtime: ${argText}`,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
case "/exit":
|
|
122
|
-
case "/quit":
|
|
123
|
-
return { nextState: state, output: "Bye.", action: { type: "exit" } };
|
|
124
|
-
case "/new":
|
|
125
|
-
return {
|
|
126
|
-
nextState: {
|
|
127
|
-
...state,
|
|
128
|
-
dialogId: undefined,
|
|
129
|
-
dialogLabel: "new",
|
|
130
|
-
attachedDocs: [],
|
|
131
|
-
},
|
|
132
|
-
output: "Started a fresh dialog.",
|
|
133
|
-
};
|
|
134
|
-
case "/compact":
|
|
135
|
-
if (argText) {
|
|
136
|
-
return {
|
|
137
|
-
nextState: state,
|
|
138
|
-
output: `Unknown command: ${trimmed}\n\n${deps.renderHelp()}`,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
if (!state.dialogId) {
|
|
142
|
-
return {
|
|
143
|
-
nextState: state,
|
|
144
|
-
output: "Current dialog: new (nothing to compact yet)",
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
return {
|
|
148
|
-
nextState: state,
|
|
149
|
-
output: "Compacting current dialog...",
|
|
150
|
-
action: { type: "compact", dialogId: state.dialogId },
|
|
151
|
-
};
|
|
152
|
-
case "/agent":
|
|
153
|
-
return {
|
|
154
|
-
nextState: state,
|
|
155
|
-
output: `Current agent: ${state.agentName} (${state.agentKey})`,
|
|
156
|
-
};
|
|
157
|
-
case "/agents":
|
|
158
|
-
return {
|
|
159
|
-
nextState: state,
|
|
160
|
-
output: deps.renderKnownAgents(),
|
|
161
|
-
};
|
|
162
|
-
case "/switch": {
|
|
163
|
-
if (!argText) {
|
|
164
|
-
return {
|
|
165
|
-
nextState: state,
|
|
166
|
-
output: "Usage: /switch <agent-key|alias>",
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
const resolvedTarget = resolveSwitchTarget(argText, deps);
|
|
170
|
-
if (!resolvedTarget) {
|
|
171
|
-
return {
|
|
172
|
-
nextState: state,
|
|
173
|
-
output:
|
|
174
|
-
`I don't know agent shortcut "${argText}" yet.\n` +
|
|
175
|
-
"Use /switch nolo, /switch app-builder, or a full agent key like agent-pub-...",
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
return {
|
|
179
|
-
nextState: {
|
|
180
|
-
...state,
|
|
181
|
-
agentName: resolvedTarget.name,
|
|
182
|
-
agentKey: resolvedTarget.key,
|
|
183
|
-
},
|
|
184
|
-
output: `Switched to ${resolvedTarget.name}.`,
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
case "/dialog":
|
|
188
|
-
return {
|
|
189
|
-
nextState: state,
|
|
190
|
-
output: state.dialogId
|
|
191
|
-
? `Current dialog: ${state.dialogId}`
|
|
192
|
-
: "Current dialog: new",
|
|
193
|
-
};
|
|
194
|
-
case "/doc": {
|
|
195
|
-
if (rest[0] === "attach") {
|
|
196
|
-
const docName = rest.slice(1).join(" ").trim();
|
|
197
|
-
if (!docName) {
|
|
198
|
-
return { nextState: state, output: "Usage: /doc attach <doc>" };
|
|
199
|
-
}
|
|
200
|
-
const attachedDocs = state.attachedDocs.includes(docName)
|
|
201
|
-
? state.attachedDocs
|
|
202
|
-
: [...state.attachedDocs, docName];
|
|
203
|
-
return {
|
|
204
|
-
nextState: { ...state, attachedDocs },
|
|
205
|
-
output: `Attached doc: ${docName}`,
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
return {
|
|
209
|
-
nextState: state,
|
|
210
|
-
output:
|
|
211
|
-
state.attachedDocs.length > 0
|
|
212
|
-
? `Attached docs: ${state.attachedDocs.join(", ")}`
|
|
213
|
-
: "No docs attached. Use /doc attach <doc>.",
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
case "/customize":
|
|
217
|
-
return {
|
|
218
|
-
nextState: state,
|
|
219
|
-
output:
|
|
220
|
-
"Tell nolo what to change, for example: /customize make my default agent more concise.",
|
|
221
|
-
};
|
|
222
|
-
case "/login":
|
|
223
|
-
return {
|
|
224
|
-
nextState: state,
|
|
225
|
-
output:
|
|
226
|
-
"MVP login uses profile/env auth. Set AUTH_TOKEN, NOLO_SERVER, or NOLO_PROFILE before starting nolo.",
|
|
227
|
-
};
|
|
228
|
-
case "/profile":
|
|
229
|
-
return {
|
|
230
|
-
nextState: state,
|
|
231
|
-
output: `Profile: ${state.profileName}`,
|
|
232
|
-
};
|
|
233
|
-
case "/update":
|
|
234
|
-
return {
|
|
235
|
-
nextState: state,
|
|
236
|
-
output: "Starting self-update...",
|
|
237
|
-
action: { type: "self-update" },
|
|
238
|
-
};
|
|
239
|
-
case "/version":
|
|
240
|
-
return {
|
|
241
|
-
nextState: state,
|
|
242
|
-
output:
|
|
243
|
-
`nolo ${state.cliVersion || "unknown version"}\n` +
|
|
244
|
-
"Update this install with: nolo update\n" +
|
|
245
|
-
"If repo-local output differs, publish/install the latest npm package first.",
|
|
246
|
-
};
|
|
247
|
-
default:
|
|
248
|
-
return {
|
|
249
|
-
nextState: state,
|
|
250
|
-
output: `Unknown command: ${command}\n\n${deps.renderHelp()}`,
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_NOLO_SERVER_URL } from "../defaultServer";
|
|
2
|
-
import type { AgentRuntimeRequestedMode } from "../agentRuntimeLocal";
|
|
3
|
-
import type { EnvLike } from "../cliEnvHelpers";
|
|
4
|
-
import { DEFAULT_TUI_AGENT_KEY, KNOWN_AGENTS } from "./tuiCatalog";
|
|
5
|
-
|
|
6
|
-
export const DEFAULT_TUI_SERVER_URL = DEFAULT_NOLO_SERVER_URL;
|
|
7
|
-
|
|
8
|
-
export type TuiState = {
|
|
9
|
-
agentKey: string;
|
|
10
|
-
agentName: string;
|
|
11
|
-
dialogId?: string;
|
|
12
|
-
dialogLabel: string;
|
|
13
|
-
profileName: string;
|
|
14
|
-
serverUrl: string;
|
|
15
|
-
cliVersion?: string;
|
|
16
|
-
attachedDocs: string[];
|
|
17
|
-
runtimeMode: AgentRuntimeRequestedMode;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export function shortenDialogId(dialogId: string) {
|
|
21
|
-
return dialogId.length > 12
|
|
22
|
-
? `${dialogId.slice(0, 6)}...${dialogId.slice(-4)}`
|
|
23
|
-
: dialogId;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function resolveDialogLabel(
|
|
27
|
-
state: Pick<TuiState, "dialogId" | "dialogLabel">
|
|
28
|
-
) {
|
|
29
|
-
return state.dialogId ? shortenDialogId(state.dialogId) : state.dialogLabel;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function createInitialTuiState(env: EnvLike): TuiState {
|
|
33
|
-
const agentKey = env.NOLO_AGENT?.trim() || DEFAULT_TUI_AGENT_KEY;
|
|
34
|
-
const agentName = env.NOLO_AGENT_NAME?.trim() || "nolo";
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
agentKey,
|
|
38
|
-
agentName,
|
|
39
|
-
dialogId: env.NOLO_DIALOG_ID?.trim() || undefined,
|
|
40
|
-
dialogLabel: env.NOLO_DIALOG?.trim() || "new",
|
|
41
|
-
profileName: env.NOLO_PROFILE?.trim() || "local",
|
|
42
|
-
serverUrl: (env.NOLO_SERVER || env.BASE_URL || DEFAULT_TUI_SERVER_URL).replace(
|
|
43
|
-
/\/+$/,
|
|
44
|
-
""
|
|
45
|
-
),
|
|
46
|
-
cliVersion: env.NOLO_CLI_VERSION?.trim() || undefined,
|
|
47
|
-
attachedDocs: [],
|
|
48
|
-
runtimeMode:
|
|
49
|
-
env.NOLO_RUNTIME_MODE === "local" || env.NOLO_RUNTIME_MODE === "server"
|
|
50
|
-
? env.NOLO_RUNTIME_MODE
|
|
51
|
-
: "auto",
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function renderStatusLine(state: TuiState) {
|
|
56
|
-
const docs =
|
|
57
|
-
state.attachedDocs.length > 0
|
|
58
|
-
? String(state.attachedDocs.length)
|
|
59
|
-
: "0";
|
|
60
|
-
|
|
61
|
-
return [
|
|
62
|
-
`agent ${state.agentName}`,
|
|
63
|
-
`dialog ${resolveDialogLabel(state)}`,
|
|
64
|
-
`docs ${docs}`,
|
|
65
|
-
`runtime ${state.runtimeMode}`,
|
|
66
|
-
`profile ${state.profileName}`,
|
|
67
|
-
].join(" | ");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function renderWelcome(state: TuiState) {
|
|
71
|
-
const docs =
|
|
72
|
-
state.attachedDocs.length > 0
|
|
73
|
-
? `${state.attachedDocs.length} attached`
|
|
74
|
-
: "none";
|
|
75
|
-
return [
|
|
76
|
-
"",
|
|
77
|
-
`Nolo workspace${state.cliVersion ? ` nolo ${state.cliVersion}` : ""}`,
|
|
78
|
-
`agent ${state.agentName} | dialog ${resolveDialogLabel(state)} | docs ${docs} | profile ${state.profileName}`,
|
|
79
|
-
`server ${state.serverUrl}`,
|
|
80
|
-
"",
|
|
81
|
-
"Tell nolo what you want. Use /help for commands. Use /version if this install feels stale.",
|
|
82
|
-
"",
|
|
83
|
-
].join("\n");
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export function renderPrompt(_state: TuiState) {
|
|
87
|
-
return "you > ";
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function renderTuiHelp() {
|
|
91
|
-
return [
|
|
92
|
-
"Commands:",
|
|
93
|
-
" /help Show this help",
|
|
94
|
-
" /new Start a fresh dialog",
|
|
95
|
-
" /compact Compact current dialog and fork a new one",
|
|
96
|
-
" /context Show workspace context and next actions",
|
|
97
|
-
" /runtime <mode> Use auto, local, or server runtime",
|
|
98
|
-
" /agent Show the current agent",
|
|
99
|
-
" /agents List built-in agent shortcuts",
|
|
100
|
-
" /switch <agent> Switch the current agent",
|
|
101
|
-
" /dialog Show the current dialog",
|
|
102
|
-
" /doc List attached docs",
|
|
103
|
-
" /doc attach <doc> Attach a doc to this workspace",
|
|
104
|
-
" /customize Describe how you want to tune nolo",
|
|
105
|
-
" /login Show login/profile hint",
|
|
106
|
-
" /profile Show active profile",
|
|
107
|
-
" /update Update the global nolo install",
|
|
108
|
-
" /version Show version/update hint",
|
|
109
|
-
" /exit Leave the workspace",
|
|
110
|
-
"",
|
|
111
|
-
"You can also type normally. nolo will send it to the current agent.",
|
|
112
|
-
].join("\n");
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export function renderContextPanel(state: TuiState) {
|
|
116
|
-
const docs = state.attachedDocs.length
|
|
117
|
-
? state.attachedDocs.join(", ")
|
|
118
|
-
: "none";
|
|
119
|
-
return [
|
|
120
|
-
"Workspace context",
|
|
121
|
-
"-----------------",
|
|
122
|
-
`agent ${state.agentName}`,
|
|
123
|
-
`dialog ${resolveDialogLabel(state)}`,
|
|
124
|
-
`docs ${docs}`,
|
|
125
|
-
`profile ${state.profileName}`,
|
|
126
|
-
`runtime ${state.runtimeMode}`,
|
|
127
|
-
`server ${state.serverUrl}`,
|
|
128
|
-
"",
|
|
129
|
-
"Next:",
|
|
130
|
-
" /agents see specialist shortcuts",
|
|
131
|
-
" /doc attach <doc> add working context",
|
|
132
|
-
" /new start a clean dialog",
|
|
133
|
-
].join("\n");
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export function renderKnownAgents() {
|
|
137
|
-
return [
|
|
138
|
-
"Agents:",
|
|
139
|
-
...KNOWN_AGENTS.map(
|
|
140
|
-
(agent, index) =>
|
|
141
|
-
` ${index + 1} ${agent.name.padEnd(11)} ${agent.description}`
|
|
142
|
-
),
|
|
143
|
-
"",
|
|
144
|
-
"Tip: stay on nolo for the one-assistant feel; switch only when you want a specialist directly.",
|
|
145
|
-
].join("\n");
|
|
146
|
-
}
|
package/cliIoTypes.ts
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { resolveAgentRuntimeDecision } from "./agent-runtime/runtimeDecision";
|
|
2
|
-
import type { AgentRuntimeDecision } from "./agent-runtime/types";
|
|
3
|
-
import type { LocalRuntimeProbeResult } from "./agentCommandSupport";
|
|
4
|
-
import type { EnvLike } from "./cliEnvHelpers";
|
|
5
|
-
|
|
6
|
-
export type CliRuntimeDoctorProbe = {
|
|
7
|
-
levelDb: {
|
|
8
|
-
ok: boolean;
|
|
9
|
-
path: string;
|
|
10
|
-
error?: string;
|
|
11
|
-
};
|
|
12
|
-
agentConfig: {
|
|
13
|
-
key: string;
|
|
14
|
-
cacheReady: boolean;
|
|
15
|
-
found: boolean;
|
|
16
|
-
};
|
|
17
|
-
provider: {
|
|
18
|
-
available: boolean;
|
|
19
|
-
label: string;
|
|
20
|
-
};
|
|
21
|
-
sync: {
|
|
22
|
-
available: boolean;
|
|
23
|
-
};
|
|
24
|
-
serverFallback: {
|
|
25
|
-
available: boolean;
|
|
26
|
-
url: string;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export type CliRuntimeDoctorReport = {
|
|
31
|
-
decision: AgentRuntimeDecision;
|
|
32
|
-
levelDb: {
|
|
33
|
-
status: "ok" | "failed";
|
|
34
|
-
path: string;
|
|
35
|
-
error?: string;
|
|
36
|
-
};
|
|
37
|
-
agentConfig: {
|
|
38
|
-
status: "found" | "missing";
|
|
39
|
-
value: string;
|
|
40
|
-
};
|
|
41
|
-
provider: {
|
|
42
|
-
status: "available" | "missing";
|
|
43
|
-
label: string;
|
|
44
|
-
};
|
|
45
|
-
sync: {
|
|
46
|
-
status: "available" | "unavailable";
|
|
47
|
-
};
|
|
48
|
-
serverFallback: {
|
|
49
|
-
status: "available" | "unavailable";
|
|
50
|
-
value: string;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
function readLocalAgentKey(env: EnvLike) {
|
|
55
|
-
return env.NOLO_LOCAL_AGENT_KEY || env.NOLO_AGENT || "";
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function detectLocalProvider(env: EnvLike) {
|
|
59
|
-
return Boolean(
|
|
60
|
-
env.OPENAI_API_KEY ||
|
|
61
|
-
env.ANTHROPIC_API_KEY ||
|
|
62
|
-
env.GOOGLE_API_KEY ||
|
|
63
|
-
env.NOLO_LOCAL_OPENAI_BASE_URL ||
|
|
64
|
-
env.OLLAMA_BASE_URL
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function detectProviderLabel(env: EnvLike) {
|
|
69
|
-
if (env.NOLO_LOCAL_OPENAI_BASE_URL) {
|
|
70
|
-
return `openai-compatible endpoint ${env.NOLO_LOCAL_OPENAI_BASE_URL}`;
|
|
71
|
-
}
|
|
72
|
-
if (env.OLLAMA_BASE_URL) {
|
|
73
|
-
return `ollama-compatible endpoint ${env.OLLAMA_BASE_URL}`;
|
|
74
|
-
}
|
|
75
|
-
if (env.OPENAI_API_KEY) return "openai via env OPENAI_API_KEY";
|
|
76
|
-
if (env.ANTHROPIC_API_KEY) return "anthropic via env ANTHROPIC_API_KEY";
|
|
77
|
-
if (env.GOOGLE_API_KEY) return "google via env GOOGLE_API_KEY";
|
|
78
|
-
return "missing";
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function buildCliRuntimeDoctorProbe(input: {
|
|
82
|
-
env: EnvLike;
|
|
83
|
-
localProbe: LocalRuntimeProbeResult;
|
|
84
|
-
authToken: string;
|
|
85
|
-
serverUrl: string;
|
|
86
|
-
}): CliRuntimeDoctorProbe {
|
|
87
|
-
const agentKey = input.localProbe.agentKey || readLocalAgentKey(input.env);
|
|
88
|
-
const cacheReady = Boolean(input.env.NOLO_AGENT_CACHE_READY);
|
|
89
|
-
return {
|
|
90
|
-
levelDb: {
|
|
91
|
-
ok: input.localProbe.ok,
|
|
92
|
-
path: input.localProbe.dbPath,
|
|
93
|
-
...(input.localProbe.error ? { error: input.localProbe.error } : {}),
|
|
94
|
-
},
|
|
95
|
-
agentConfig: {
|
|
96
|
-
key: agentKey,
|
|
97
|
-
cacheReady,
|
|
98
|
-
found: input.localProbe.ok && input.localProbe.agentFound && (Boolean(agentKey) || cacheReady),
|
|
99
|
-
},
|
|
100
|
-
provider: {
|
|
101
|
-
available: detectLocalProvider(input.env),
|
|
102
|
-
label: detectProviderLabel(input.env),
|
|
103
|
-
},
|
|
104
|
-
sync: {
|
|
105
|
-
available: Boolean(input.authToken),
|
|
106
|
-
},
|
|
107
|
-
serverFallback: {
|
|
108
|
-
available: Boolean(input.authToken || input.env.NOLO_SERVER || input.env.BASE_URL),
|
|
109
|
-
url: input.serverUrl,
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export function buildCliRuntimeDoctorReport(
|
|
115
|
-
probe: CliRuntimeDoctorProbe
|
|
116
|
-
): CliRuntimeDoctorReport {
|
|
117
|
-
const missingLocalCapabilities = [
|
|
118
|
-
...(probe.levelDb.ok ? [] : ["leveldb"]),
|
|
119
|
-
...(probe.agentConfig.found ? [] : ["agent-config"]),
|
|
120
|
-
...(probe.provider.available ? [] : ["provider"]),
|
|
121
|
-
];
|
|
122
|
-
const decision = resolveAgentRuntimeDecision({
|
|
123
|
-
requestedMode: "auto",
|
|
124
|
-
syncRequested: false,
|
|
125
|
-
host: "cli",
|
|
126
|
-
hasLocalAgentConfig: probe.agentConfig.found,
|
|
127
|
-
hasLocalProvider: probe.provider.available,
|
|
128
|
-
hasLocalPersistence: true,
|
|
129
|
-
missingLocalCapabilities,
|
|
130
|
-
requiresServer: false,
|
|
131
|
-
serverFallbackAvailable: probe.serverFallback.available,
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
return {
|
|
135
|
-
decision,
|
|
136
|
-
levelDb: {
|
|
137
|
-
status: probe.levelDb.ok ? "ok" : "failed",
|
|
138
|
-
path: probe.levelDb.path,
|
|
139
|
-
...(probe.levelDb.error ? { error: probe.levelDb.error } : {}),
|
|
140
|
-
},
|
|
141
|
-
agentConfig: {
|
|
142
|
-
status: probe.agentConfig.found ? "found" : "missing",
|
|
143
|
-
value: probe.agentConfig.key || (probe.agentConfig.cacheReady ? "cache ready" : "no local agent key"),
|
|
144
|
-
},
|
|
145
|
-
provider: {
|
|
146
|
-
status: probe.provider.available ? "available" : "missing",
|
|
147
|
-
label: probe.provider.label,
|
|
148
|
-
},
|
|
149
|
-
sync: {
|
|
150
|
-
status: probe.sync.available ? "available" : "unavailable",
|
|
151
|
-
},
|
|
152
|
-
serverFallback: {
|
|
153
|
-
status: probe.serverFallback.available ? "available" : "unavailable",
|
|
154
|
-
value: probe.serverFallback.available ? probe.serverFallback.url : "unavailable",
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export function formatCliRuntimeDoctorReport(
|
|
160
|
-
report: CliRuntimeDoctorReport
|
|
161
|
-
): string {
|
|
162
|
-
const lines = [
|
|
163
|
-
`Runtime: ${report.decision.mode}`,
|
|
164
|
-
`Reason: ${report.decision.reason}`,
|
|
165
|
-
`LevelDB: ${report.levelDb.status}`,
|
|
166
|
-
`DB path: ${report.levelDb.path}`,
|
|
167
|
-
];
|
|
168
|
-
if (report.levelDb.error) {
|
|
169
|
-
lines.push(`DB error: ${report.levelDb.error}`);
|
|
170
|
-
}
|
|
171
|
-
if (report.agentConfig.status === "found") {
|
|
172
|
-
lines.push(`Agent config: found (${report.agentConfig.value})`);
|
|
173
|
-
} else if (report.agentConfig.value === "no local agent key") {
|
|
174
|
-
lines.push("Agent config: missing (no local agent key)");
|
|
175
|
-
} else {
|
|
176
|
-
lines.push(`Agent config: missing (${report.agentConfig.value})`);
|
|
177
|
-
}
|
|
178
|
-
lines.push(`Provider: ${report.provider.status} (${report.provider.label})`);
|
|
179
|
-
lines.push("Persistence: LevelDB local store");
|
|
180
|
-
lines.push(
|
|
181
|
-
`Sync: ${report.sync.status}${
|
|
182
|
-
report.sync.status === "available" ? "" : " (not authenticated)"
|
|
183
|
-
}`
|
|
184
|
-
);
|
|
185
|
-
lines.push(`Server fallback: ${report.serverFallback.value}`);
|
|
186
|
-
if (report.decision.missingLocalCapabilities.length > 0) {
|
|
187
|
-
lines.push("Missing local capabilities:");
|
|
188
|
-
for (const capability of report.decision.missingLocalCapabilities) {
|
|
189
|
-
lines.push(`- ${capability}`);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return `${lines.join("\n")}\n`;
|
|
193
|
-
}
|
package/client/agentRunInput.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function buildUserInputContent(message: string, imageUrls: string[] = []) {
|
|
2
|
-
if (imageUrls.length === 0) return message;
|
|
3
|
-
return [
|
|
4
|
-
...(message.trim() ? [{ type: "text" as const, text: message }] : []),
|
|
5
|
-
...imageUrls.map((url) => ({
|
|
6
|
-
type: "image_url" as const,
|
|
7
|
-
image_url: { url },
|
|
8
|
-
})),
|
|
9
|
-
];
|
|
10
|
-
}
|