nolo-cli 0.1.32 → 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 -10
- package/agent-runtime/agentRecordConfig.ts +10 -0
- package/agent-runtime/hostAdapter.ts +10 -1
- package/agent-runtime/index.ts +9 -20
- package/agent-runtime/localLoop.ts +49 -2
- package/agent-runtime/localToolPolicy.ts +76 -34
- package/agent-runtime/localWorkspaceTools.ts +30 -333
- package/agent-runtime/openAiCompatibleProvider.ts +7 -3
- package/agent-runtime/openAiCompatibleProviderConfig.ts +15 -26
- package/agent-runtime/platformChatProvider.ts +47 -73
- package/agent-runtime/providerResolution.ts +244 -0
- package/agent-runtime/runtimeToolPolicy.ts +77 -29
- package/agent-runtime/shellCommandPolicy.ts +120 -0
- package/agentAliases.ts +14 -83
- package/agentCommandSupport.ts +3 -6
- package/agentInternalCommandEntries.ts +4 -13
- package/agentListCommands.ts +18 -27
- package/agentMachineCommands.ts +40 -336
- package/agentPullCommand.ts +30 -55
- package/agentRecordCommands.ts +84 -1
- package/agentRecordHelpers.ts +102 -186
- package/agentRunCommand.ts +438 -107
- package/agentRuntimeLocal.ts +2 -9
- package/ai/agent/cliExecutor.ts +19 -323
- package/ai/tools/toolNameAliases.ts +70 -0
- package/authCommands.ts +2 -36
- package/cli/agentAliases.ts +14 -83
- package/cli/agentCommandSupport.ts +3 -6
- package/cli/agentInternalCommandEntries.ts +4 -13
- package/cli/agentListCommands.ts +18 -27
- package/cli/agentMachineCommands.ts +40 -336
- package/cli/agentPullCommand.ts +30 -55
- package/cli/agentRecordCommands.ts +84 -1
- package/cli/agentRecordHelpers.ts +102 -186
- package/cli/agentRunCommand.ts +438 -107
- package/cli/agentRuntimeLocal.ts +2 -9
- package/cli/authCommands.ts +2 -36
- package/cli/cliCommandDispatch.ts +2 -2
- package/cli/cliEnvHelpers.ts +34 -107
- package/cli/client/agentRun.ts +854 -57
- package/cli/client/localRuntimeAdapter.ts +59 -159
- package/cli/client/streamingOutput.ts +3 -1
- package/cli/client/taskRunPrompt.ts +24 -7
- package/cli/commandRegistry.ts +4 -5
- 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 +30 -44
- package/cli/machineWsSession.ts +0 -2
- package/cli/offlineMarxistsAgentCommand.ts +314 -0
- package/cli/runtimeDoctorCommands.ts +72 -15
- 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/cliCommandDispatch.ts +2 -2
- package/cliEnvHelpers.ts +34 -107
- package/client/agentConfigResolver.test.ts +2 -0
- package/client/agentRun.test.ts +12 -208
- package/client/agentRun.ts +854 -57
- package/client/localProviderResolver.test.ts +26 -2
- package/client/localRuntimeAdapter.test.ts +296 -171
- package/client/localRuntimeAdapter.ts +59 -159
- package/client/localToolPolicy.test.ts +4 -28
- package/client/streamingOutput.ts +3 -1
- package/client/taskRunPrompt.ts +24 -7
- package/commandRegistry.ts +4 -5
- package/connectorRunArtifact.ts +10 -34
- package/connectorWebSocketTarget.ts +6 -10
- package/database/server/serverStoreFactory.ts +2 -8
- 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 +30 -44
- package/machineWsSession.ts +0 -2
- package/offlineMarxistsAgentCommand.ts +314 -0
- package/package.json +52 -188
- package/runtimeDoctorCommands.ts +72 -15
- 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/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/spaceReadCommands.ts
DELETED
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
import { ContentType } from "./app/types";
|
|
2
|
-
import { parseSkillDocProtocol, resolvePageSkillMetadata } from "./ai/skills/skillDocProtocol";
|
|
3
|
-
import { createSpaceKey } from "./create/space/spaceKeys";
|
|
4
|
-
import { getReadableCliDb, type AgentCommandDeps } from "./agentCommandSupport";
|
|
5
|
-
import { readDbRecord } from "./agentRecordHelpers";
|
|
6
|
-
import {
|
|
7
|
-
parseUserIdFromAuthToken,
|
|
8
|
-
readOption,
|
|
9
|
-
resolveAuthToken,
|
|
10
|
-
resolveServerCandidates,
|
|
11
|
-
resolveServerUrl,
|
|
12
|
-
} from "./cliEnvHelpers";
|
|
13
|
-
import { readRecordWithCandidates } from "./hybridReadHelpers";
|
|
14
|
-
import { parseSpaceIdFromInput } from "./spaceMutationHelpers";
|
|
15
|
-
|
|
16
|
-
function readPositionalInput(args: string[]) {
|
|
17
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
18
|
-
const value = args[index];
|
|
19
|
-
if (value === "--content-key") {
|
|
20
|
-
index += 1;
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
if (!value.startsWith("-")) return value;
|
|
24
|
-
}
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function parseSpaceReadArgs(args: string[]) {
|
|
29
|
-
const raw = readPositionalInput(args);
|
|
30
|
-
if (!raw) throw new Error("Usage: nolo space read <spaceId|spaceKey|spaceUrl> [--brief] [--content-key <key>] [--include-record]");
|
|
31
|
-
const brief = args.includes("--brief");
|
|
32
|
-
const contentKeyFilter = readOption(args, "--content-key");
|
|
33
|
-
const includeRecord = args.includes("--include-record") || (!brief && !contentKeyFilter);
|
|
34
|
-
return {
|
|
35
|
-
raw,
|
|
36
|
-
brief,
|
|
37
|
-
contentKeyFilter,
|
|
38
|
-
includeRecord,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function buildContentEntries(space: Record<string, any>) {
|
|
43
|
-
return Object.entries(space.contents ?? {})
|
|
44
|
-
.filter(([, value]) => value && typeof value === "object")
|
|
45
|
-
.map(([entryKey, value]) => ({
|
|
46
|
-
entryKey,
|
|
47
|
-
...(value as Record<string, any>),
|
|
48
|
-
}))
|
|
49
|
-
.sort((a, b) => {
|
|
50
|
-
const pinnedDiff = Number(Boolean(b.pinned)) - Number(Boolean(a.pinned));
|
|
51
|
-
if (pinnedDiff !== 0) return pinnedDiff;
|
|
52
|
-
const orderA = typeof a.order === "number" ? a.order : Number.MAX_SAFE_INTEGER;
|
|
53
|
-
const orderB = typeof b.order === "number" ? b.order : Number.MAX_SAFE_INTEGER;
|
|
54
|
-
if (orderA !== orderB) return orderA - orderB;
|
|
55
|
-
return (b.updatedAt ?? 0) - (a.updatedAt ?? 0);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function buildCategories(space: Record<string, any>) {
|
|
60
|
-
return Object.entries(space.categories ?? {})
|
|
61
|
-
.filter(([, value]) => value && typeof value === "object")
|
|
62
|
-
.map(([categoryId, value]) => ({
|
|
63
|
-
categoryId,
|
|
64
|
-
...(value as Record<string, any>),
|
|
65
|
-
}))
|
|
66
|
-
.sort((a, b) => {
|
|
67
|
-
const orderA = typeof a.order === "number" ? a.order : Number.MAX_SAFE_INTEGER;
|
|
68
|
-
const orderB = typeof b.order === "number" ? b.order : Number.MAX_SAFE_INTEGER;
|
|
69
|
-
if (orderA !== orderB) return orderA - orderB;
|
|
70
|
-
return String(a.name ?? "").localeCompare(String(b.name ?? ""), "zh-Hans");
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export async function runSpaceReadCommand(
|
|
75
|
-
args: string[],
|
|
76
|
-
deps: AgentCommandDeps = {}
|
|
77
|
-
) {
|
|
78
|
-
const env = deps.env ?? process.env;
|
|
79
|
-
const output = deps.output ?? process.stdout;
|
|
80
|
-
const { raw, brief, contentKeyFilter, includeRecord } = parseSpaceReadArgs(args);
|
|
81
|
-
|
|
82
|
-
const authToken = resolveAuthToken(args, env);
|
|
83
|
-
if (!authToken) {
|
|
84
|
-
output.write("[nolo] space read requires an auth token. Run `nolo login` or set AUTH_TOKEN.\n");
|
|
85
|
-
return 1;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const userId = parseUserIdFromAuthToken(authToken);
|
|
89
|
-
if (!userId) {
|
|
90
|
-
output.write("[nolo] space read could not read userId from AUTH_TOKEN.\n");
|
|
91
|
-
return 1;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const db = deps.db ?? await getReadableCliDb(output);
|
|
95
|
-
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
96
|
-
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
|
97
|
-
const defaultServerUrl = resolveServerUrl(args, env);
|
|
98
|
-
const serverCandidates = resolveServerCandidates(args, env, defaultServerUrl);
|
|
99
|
-
|
|
100
|
-
try {
|
|
101
|
-
const spaceId = parseSpaceIdFromInput(raw);
|
|
102
|
-
const spaceKey = createSpaceKey.space(spaceId);
|
|
103
|
-
const space = await readRecordWithCandidates<Record<string, any>>({
|
|
104
|
-
db,
|
|
105
|
-
dbKey: spaceKey,
|
|
106
|
-
serverCandidates,
|
|
107
|
-
readRemote: async (serverUrl, dbKey) =>
|
|
108
|
-
readDbRecord({
|
|
109
|
-
authToken,
|
|
110
|
-
dbKey,
|
|
111
|
-
fallbackFetchImpl,
|
|
112
|
-
fetchImpl,
|
|
113
|
-
serverUrl,
|
|
114
|
-
}),
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
const categories = buildCategories(space);
|
|
118
|
-
const allContents = buildContentEntries(space);
|
|
119
|
-
const contents = contentKeyFilter
|
|
120
|
-
? allContents.filter((item) => {
|
|
121
|
-
const contentKey =
|
|
122
|
-
typeof item.contentKey === "string" && item.contentKey.trim()
|
|
123
|
-
? item.contentKey.trim()
|
|
124
|
-
: item.entryKey;
|
|
125
|
-
return item.entryKey === contentKeyFilter || contentKey === contentKeyFilter;
|
|
126
|
-
})
|
|
127
|
-
: allContents;
|
|
128
|
-
|
|
129
|
-
const contentCounts = allContents.reduce<Record<string, number>>((acc, item) => {
|
|
130
|
-
const type = typeof item.type === "string" ? item.type : "unknown";
|
|
131
|
-
acc[type] = (acc[type] ?? 0) + 1;
|
|
132
|
-
return acc;
|
|
133
|
-
}, {});
|
|
134
|
-
|
|
135
|
-
const categoryContentMap = allContents.reduce<Record<string, string[]>>((acc, item) => {
|
|
136
|
-
const categoryId =
|
|
137
|
-
typeof item.categoryId === "string" && item.categoryId.trim()
|
|
138
|
-
? item.categoryId.trim()
|
|
139
|
-
: "";
|
|
140
|
-
if (!categoryId) return acc;
|
|
141
|
-
if (!acc[categoryId]) acc[categoryId] = [];
|
|
142
|
-
acc[categoryId].push(
|
|
143
|
-
typeof item.contentKey === "string" && item.contentKey.trim()
|
|
144
|
-
? item.contentKey.trim()
|
|
145
|
-
: item.entryKey
|
|
146
|
-
);
|
|
147
|
-
return acc;
|
|
148
|
-
}, {});
|
|
149
|
-
|
|
150
|
-
const categoriesWithStats = categories.map((category) => ({
|
|
151
|
-
...category,
|
|
152
|
-
itemCount: categoryContentMap[category.categoryId]?.length ?? 0,
|
|
153
|
-
contentKeys: categoryContentMap[category.categoryId] ?? [],
|
|
154
|
-
}));
|
|
155
|
-
|
|
156
|
-
const uncategorizedContentKeys = contents
|
|
157
|
-
.filter((item) => !(typeof item.categoryId === "string" && item.categoryId.trim()))
|
|
158
|
-
.map((item) =>
|
|
159
|
-
typeof item.contentKey === "string" && item.contentKey.trim()
|
|
160
|
-
? item.contentKey.trim()
|
|
161
|
-
: item.entryKey
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
const resolvedAgents = await Promise.all(
|
|
165
|
-
contents
|
|
166
|
-
.filter((item) => item.type === ContentType.AGENT && !brief)
|
|
167
|
-
.map(async (item) => {
|
|
168
|
-
const contentKey =
|
|
169
|
-
typeof item.contentKey === "string" && item.contentKey.trim()
|
|
170
|
-
? item.contentKey.trim()
|
|
171
|
-
: item.entryKey;
|
|
172
|
-
try {
|
|
173
|
-
const record = await readRecordWithCandidates<Record<string, any>>({
|
|
174
|
-
db,
|
|
175
|
-
dbKey: contentKey,
|
|
176
|
-
serverCandidates,
|
|
177
|
-
readRemote: async (serverUrl, dbKey) =>
|
|
178
|
-
readDbRecord({
|
|
179
|
-
authToken,
|
|
180
|
-
dbKey,
|
|
181
|
-
fallbackFetchImpl,
|
|
182
|
-
fetchImpl,
|
|
183
|
-
serverUrl,
|
|
184
|
-
}),
|
|
185
|
-
});
|
|
186
|
-
return {
|
|
187
|
-
contentKey,
|
|
188
|
-
slotTitle: item.title,
|
|
189
|
-
categoryId: item.categoryId ?? null,
|
|
190
|
-
pinned: !!item.pinned,
|
|
191
|
-
updatedAt: item.updatedAt ?? null,
|
|
192
|
-
agentId: record?.id ?? null,
|
|
193
|
-
name: record?.name ?? null,
|
|
194
|
-
model: record?.model ?? null,
|
|
195
|
-
provider: record?.provider ?? record?.apiSource ?? null,
|
|
196
|
-
isPublic: typeof record?.isPublic === "boolean" ? record.isPublic : null,
|
|
197
|
-
userId: record?.userId ?? null,
|
|
198
|
-
tools: Array.isArray(record?.tools) ? record.tools : [],
|
|
199
|
-
customProviderUrl: record?.customProviderUrl ?? null,
|
|
200
|
-
};
|
|
201
|
-
} catch (error) {
|
|
202
|
-
return {
|
|
203
|
-
contentKey,
|
|
204
|
-
slotTitle: item.title,
|
|
205
|
-
categoryId: item.categoryId ?? null,
|
|
206
|
-
pinned: !!item.pinned,
|
|
207
|
-
updatedAt: item.updatedAt ?? null,
|
|
208
|
-
readError: error instanceof Error ? error.message : String(error),
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
})
|
|
212
|
-
);
|
|
213
|
-
|
|
214
|
-
const resolvedSkillDocs = (
|
|
215
|
-
await Promise.all(
|
|
216
|
-
contents
|
|
217
|
-
.filter((item) => item.type === ContentType.DOC && !brief)
|
|
218
|
-
.map(async (item) => {
|
|
219
|
-
const contentKey =
|
|
220
|
-
typeof item.contentKey === "string" && item.contentKey.trim()
|
|
221
|
-
? item.contentKey.trim()
|
|
222
|
-
: item.entryKey;
|
|
223
|
-
try {
|
|
224
|
-
const record = await readRecordWithCandidates<Record<string, any>>({
|
|
225
|
-
db,
|
|
226
|
-
dbKey: contentKey,
|
|
227
|
-
serverCandidates,
|
|
228
|
-
readRemote: async (serverUrl, dbKey) =>
|
|
229
|
-
readDbRecord({
|
|
230
|
-
authToken,
|
|
231
|
-
dbKey,
|
|
232
|
-
fallbackFetchImpl,
|
|
233
|
-
fetchImpl,
|
|
234
|
-
serverUrl,
|
|
235
|
-
}),
|
|
236
|
-
});
|
|
237
|
-
const parsed = parseSkillDocProtocol(
|
|
238
|
-
typeof record?.content === "string" ? record.content : "",
|
|
239
|
-
record?.meta,
|
|
240
|
-
record?.tools
|
|
241
|
-
);
|
|
242
|
-
const meta = resolvePageSkillMetadata(record);
|
|
243
|
-
const skillConfig = meta?.skillConfig;
|
|
244
|
-
if (!(meta?.kind === "skill" || skillConfig)) {
|
|
245
|
-
return null;
|
|
246
|
-
}
|
|
247
|
-
return {
|
|
248
|
-
contentKey,
|
|
249
|
-
slotTitle: item.title,
|
|
250
|
-
title: record?.title ?? item.title ?? null,
|
|
251
|
-
categoryId: item.categoryId ?? null,
|
|
252
|
-
pinned: !!item.pinned,
|
|
253
|
-
updatedAt: item.updatedAt ?? null,
|
|
254
|
-
skillId: skillConfig?.id ?? record?.id ?? null,
|
|
255
|
-
name: skillConfig?.name ?? null,
|
|
256
|
-
description: skillConfig?.description ?? null,
|
|
257
|
-
toolNames: skillConfig?.toolNames ?? [],
|
|
258
|
-
requiredSkills: skillConfig?.requiredSkills ?? [],
|
|
259
|
-
recommendedSkills: skillConfig?.recommendedSkills ?? [],
|
|
260
|
-
triggerMode: skillConfig?.triggerMode ?? null,
|
|
261
|
-
promptPatch: skillConfig?.promptPatch ?? null,
|
|
262
|
-
bodyPreview:
|
|
263
|
-
typeof parsed.content === "string" ? parsed.content.slice(0, 240) : "",
|
|
264
|
-
};
|
|
265
|
-
} catch (error) {
|
|
266
|
-
return {
|
|
267
|
-
contentKey,
|
|
268
|
-
slotTitle: item.title,
|
|
269
|
-
categoryId: item.categoryId ?? null,
|
|
270
|
-
pinned: !!item.pinned,
|
|
271
|
-
updatedAt: item.updatedAt ?? null,
|
|
272
|
-
readError: error instanceof Error ? error.message : String(error),
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
})
|
|
276
|
-
)
|
|
277
|
-
).filter(Boolean);
|
|
278
|
-
|
|
279
|
-
const result: Record<string, any> = {
|
|
280
|
-
baseUrl: defaultServerUrl,
|
|
281
|
-
spaceId,
|
|
282
|
-
spaceKey,
|
|
283
|
-
name: space?.name ?? null,
|
|
284
|
-
description: space?.description ?? null,
|
|
285
|
-
ownerId: space?.ownerId ?? null,
|
|
286
|
-
visibility: space?.visibility ?? null,
|
|
287
|
-
memberCount: Array.isArray(space?.members) ? space.members.length : 0,
|
|
288
|
-
members: Array.isArray(space?.members) ? space.members : [],
|
|
289
|
-
categoryCount: categories.length,
|
|
290
|
-
categories: brief
|
|
291
|
-
? categoriesWithStats.map(({ contentKeys, ...category }) => category)
|
|
292
|
-
: categoriesWithStats,
|
|
293
|
-
uncategorizedCount: uncategorizedContentKeys.length,
|
|
294
|
-
...(brief ? {} : { uncategorizedContentKeys }),
|
|
295
|
-
contentCount: allContents.length,
|
|
296
|
-
contentCounts,
|
|
297
|
-
contents,
|
|
298
|
-
agents: resolvedAgents,
|
|
299
|
-
pageCount: allContents.filter((item) => item.type === ContentType.DOC).length,
|
|
300
|
-
skillDocCount: resolvedSkillDocs.length,
|
|
301
|
-
skillDocs: resolvedSkillDocs,
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
if (contentKeyFilter) {
|
|
305
|
-
result.contentKeyFilter = contentKeyFilter;
|
|
306
|
-
result.matchedCount = contents.length;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
if (includeRecord) {
|
|
310
|
-
result.record = space;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
output.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
314
|
-
return 0;
|
|
315
|
-
} catch (error) {
|
|
316
|
-
output.write(
|
|
317
|
-
`[nolo] space read failed: ${
|
|
318
|
-
error instanceof Error ? error.message : String(error)
|
|
319
|
-
}\n`
|
|
320
|
-
);
|
|
321
|
-
return 1;
|
|
322
|
-
}
|
|
323
|
-
}
|
package/tableDataOutput.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export type TableDataOutputMode = "full" | "raw" | "items" | "jsonl";
|
|
2
|
-
|
|
3
|
-
export function parseTableDataOutputMode(raw?: string): TableDataOutputMode {
|
|
4
|
-
const value = raw?.trim();
|
|
5
|
-
if (!value) return "full";
|
|
6
|
-
if (value === "json") return "raw";
|
|
7
|
-
if (value === "full" || value === "raw" || value === "items" || value === "jsonl") {
|
|
8
|
-
return value;
|
|
9
|
-
}
|
|
10
|
-
throw new Error(`--output must be one of full, raw, items, json, jsonl; got ${value}`);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function getItems(result: unknown): unknown[] | undefined {
|
|
14
|
-
if (!result || typeof result !== "object") return undefined;
|
|
15
|
-
const items = (result as any).items;
|
|
16
|
-
return Array.isArray(items) ? items : undefined;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function formatTableDataOutput(input: {
|
|
20
|
-
envelope: unknown;
|
|
21
|
-
result: unknown;
|
|
22
|
-
mode: TableDataOutputMode;
|
|
23
|
-
}): string {
|
|
24
|
-
if (input.mode === "full") {
|
|
25
|
-
return JSON.stringify(input.envelope, null, 2);
|
|
26
|
-
}
|
|
27
|
-
if (input.mode === "raw") {
|
|
28
|
-
return JSON.stringify(input.result, null, 2);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const items = getItems(input.result);
|
|
32
|
-
const value = items ?? input.result;
|
|
33
|
-
if (input.mode === "items") {
|
|
34
|
-
return JSON.stringify(value, null, 2);
|
|
35
|
-
}
|
|
36
|
-
if (!Array.isArray(value)) {
|
|
37
|
-
return JSON.stringify(value);
|
|
38
|
-
}
|
|
39
|
-
return value.map((item) => JSON.stringify(item)).join("\n");
|
|
40
|
-
}
|
|
41
|
-
|
package/tableDataSafety.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const TABLE_SCHEMA_WRITE_ACTIONS = new Set(["add-column"]);
|
|
2
|
-
|
|
3
|
-
export function isTableSchemaWriteAction(action: string): boolean {
|
|
4
|
-
return TABLE_SCHEMA_WRITE_ACTIONS.has(action.trim());
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function tableSchemaWriteSafetyMessage(action: string): string {
|
|
8
|
-
return [
|
|
9
|
-
`Action "${action}" mutates table schema metadata and must be serialized per table.`,
|
|
10
|
-
"Rerun with --schema-write-ok only after confirming no other agent/script is changing the same table schema.",
|
|
11
|
-
"Server-side schema CAS/locking is not implemented yet; row-level writes do not need this flag.",
|
|
12
|
-
].join(" ");
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function assertTableSchemaWriteAllowed(input: {
|
|
16
|
-
action: string;
|
|
17
|
-
allowSchemaWrite: boolean;
|
|
18
|
-
}): void {
|
|
19
|
-
if (!isTableSchemaWriteAction(input.action)) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (input.allowSchemaWrite) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
throw new Error(tableSchemaWriteSafetyMessage(input.action));
|
|
26
|
-
}
|
package/tableMetaCommands.ts
DELETED
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
import { ulid } from "ulid";
|
|
2
|
-
import { getReadableCliDb, type AgentCommandDeps } from "./agentCommandSupport";
|
|
3
|
-
import { readDbRecord } from "./agentRecordHelpers";
|
|
4
|
-
import { parseUserIdFromAuthToken, readOption, resolveAuthToken, resolveServerUrl } from "./cliEnvHelpers";
|
|
5
|
-
import {
|
|
6
|
-
buildTableAttachedSpaceRecord,
|
|
7
|
-
parseSpaceIdFromInput,
|
|
8
|
-
readSpaceRecordWithFallback,
|
|
9
|
-
} from "./spaceMutationHelpers";
|
|
10
|
-
import { writeRemoteRecordsThenCache } from "./pageWriteHelpers";
|
|
11
|
-
|
|
12
|
-
type ColumnType =
|
|
13
|
-
| "text"
|
|
14
|
-
| "number"
|
|
15
|
-
| "boolean"
|
|
16
|
-
| "date"
|
|
17
|
-
| "datetime"
|
|
18
|
-
| "select"
|
|
19
|
-
| "multi_select";
|
|
20
|
-
|
|
21
|
-
type ColumnInput = {
|
|
22
|
-
id?: string;
|
|
23
|
-
name: string;
|
|
24
|
-
label?: string;
|
|
25
|
-
type?: ColumnType;
|
|
26
|
-
description?: string;
|
|
27
|
-
required?: boolean;
|
|
28
|
-
isPrimary?: boolean;
|
|
29
|
-
options?: string[];
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
function usage() {
|
|
33
|
-
return [
|
|
34
|
-
"Usage:",
|
|
35
|
-
" nolo table meta --name <name> [--table <tableId|metaKey>] [--space <spaceId|spaceKey|spaceUrl>] [--category-id <id>] [--description <text>] [--tags <comma-list>] [--columns <json-array>]",
|
|
36
|
-
"",
|
|
37
|
-
].join("\n");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function parseTableArg(raw?: string) {
|
|
41
|
-
if (!raw?.trim()) return {};
|
|
42
|
-
const trimmed = raw.trim();
|
|
43
|
-
if (trimmed.startsWith("meta-")) {
|
|
44
|
-
const parts = trimmed.split("-");
|
|
45
|
-
return {
|
|
46
|
-
tableId: parts.slice(2).join("-"),
|
|
47
|
-
dbKey: trimmed,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return { tableId: trimmed };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function parseTags(raw?: string) {
|
|
54
|
-
if (!raw) return undefined;
|
|
55
|
-
const tags = raw
|
|
56
|
-
.split(",")
|
|
57
|
-
.map((value) => value.trim())
|
|
58
|
-
.filter(Boolean);
|
|
59
|
-
return tags.length > 0 ? tags : undefined;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function defaultColumns(): ColumnInput[] {
|
|
63
|
-
return [
|
|
64
|
-
{
|
|
65
|
-
name: "title",
|
|
66
|
-
label: "标题",
|
|
67
|
-
type: "text",
|
|
68
|
-
description: "这一行记录的主题或名称。",
|
|
69
|
-
isPrimary: true,
|
|
70
|
-
required: true,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: "note",
|
|
74
|
-
label: "备注",
|
|
75
|
-
type: "text",
|
|
76
|
-
description: "对该条目的补充说明。",
|
|
77
|
-
},
|
|
78
|
-
];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function normalizeColumns(rawColumns?: string, existingColumns?: any[]) {
|
|
82
|
-
if (!rawColumns) {
|
|
83
|
-
if (Array.isArray(existingColumns) && existingColumns.length > 0) {
|
|
84
|
-
return existingColumns;
|
|
85
|
-
}
|
|
86
|
-
return defaultColumns().map((column) => ({ ...column, id: ulid() }));
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
let parsed: unknown;
|
|
90
|
-
try {
|
|
91
|
-
parsed = JSON.parse(rawColumns);
|
|
92
|
-
} catch (error) {
|
|
93
|
-
throw new Error(
|
|
94
|
-
`--columns must be a valid JSON array: ${
|
|
95
|
-
error instanceof Error ? error.message : String(error)
|
|
96
|
-
}`
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (!Array.isArray(parsed)) {
|
|
101
|
-
throw new Error("--columns must be a JSON array.");
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const seen = new Set<string>();
|
|
105
|
-
const normalized = parsed
|
|
106
|
-
.map((value) => {
|
|
107
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
108
|
-
const column = value as ColumnInput;
|
|
109
|
-
const name = typeof column.name === "string" ? column.name.trim() : "";
|
|
110
|
-
if (!name || seen.has(name)) return null;
|
|
111
|
-
seen.add(name);
|
|
112
|
-
|
|
113
|
-
const nextColumn: Record<string, unknown> = {
|
|
114
|
-
id: typeof column.id === "string" && column.id.trim() ? column.id.trim() : ulid(),
|
|
115
|
-
name,
|
|
116
|
-
};
|
|
117
|
-
if (typeof column.label === "string" && column.label.trim()) nextColumn.label = column.label.trim();
|
|
118
|
-
if (typeof column.type === "string" && column.type.trim()) nextColumn.type = column.type.trim();
|
|
119
|
-
if (typeof column.description === "string" && column.description.trim()) {
|
|
120
|
-
nextColumn.description = column.description.trim();
|
|
121
|
-
}
|
|
122
|
-
if (typeof column.required === "boolean") nextColumn.required = column.required;
|
|
123
|
-
if (typeof column.isPrimary === "boolean") nextColumn.isPrimary = column.isPrimary;
|
|
124
|
-
if (Array.isArray(column.options)) {
|
|
125
|
-
const options = column.options
|
|
126
|
-
.map((option) => (typeof option === "string" ? option.trim() : ""))
|
|
127
|
-
.filter(Boolean);
|
|
128
|
-
if (options.length > 0) nextColumn.options = options;
|
|
129
|
-
}
|
|
130
|
-
return nextColumn;
|
|
131
|
-
})
|
|
132
|
-
.filter(Boolean) as Array<Record<string, unknown>>;
|
|
133
|
-
|
|
134
|
-
if (normalized.length === 0) {
|
|
135
|
-
throw new Error("--columns did not contain any valid columns.");
|
|
136
|
-
}
|
|
137
|
-
if (!normalized.some((column) => column.isPrimary === true)) {
|
|
138
|
-
normalized[0].isPrimary = true;
|
|
139
|
-
}
|
|
140
|
-
return normalized;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export async function runTableMetaCommand(
|
|
144
|
-
args: string[],
|
|
145
|
-
deps: AgentCommandDeps = {}
|
|
146
|
-
) {
|
|
147
|
-
const env = deps.env ?? process.env;
|
|
148
|
-
const output = deps.output ?? process.stdout;
|
|
149
|
-
|
|
150
|
-
if (args.includes("--help") || args.includes("-h")) {
|
|
151
|
-
output.write(`${usage()}\n`);
|
|
152
|
-
return 0;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const rawName = readOption(args, "--name");
|
|
156
|
-
if (!rawName?.trim()) {
|
|
157
|
-
output.write(`${usage()}\n`);
|
|
158
|
-
return 1;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const authToken = resolveAuthToken(args, env);
|
|
162
|
-
const userId = parseUserIdFromAuthToken(authToken);
|
|
163
|
-
if (!authToken || !userId) {
|
|
164
|
-
output.write("[nolo] table meta requires an auth token with userId. Run `nolo login`.\n");
|
|
165
|
-
return 1;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const name = rawName.trim();
|
|
169
|
-
const description = readOption(args, "--description")?.trim() || undefined;
|
|
170
|
-
const tags = parseTags(readOption(args, "--tags"));
|
|
171
|
-
const serverUrl = resolveServerUrl(args, env);
|
|
172
|
-
const db = deps.db ?? await getReadableCliDb(output);
|
|
173
|
-
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
174
|
-
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
|
175
|
-
|
|
176
|
-
try {
|
|
177
|
-
const parsedTable = parseTableArg(readOption(args, "--table"));
|
|
178
|
-
const tableId = parsedTable.tableId ?? ulid();
|
|
179
|
-
const dbKey = parsedTable.dbKey ?? `meta-${userId}-${tableId}`;
|
|
180
|
-
|
|
181
|
-
let existingRecord: Record<string, any> | null = null;
|
|
182
|
-
try {
|
|
183
|
-
const value = await db.get(dbKey);
|
|
184
|
-
existingRecord = value && typeof value === "object" ? (value as Record<string, any>) : null;
|
|
185
|
-
} catch {
|
|
186
|
-
try {
|
|
187
|
-
existingRecord = await readDbRecord({
|
|
188
|
-
authToken,
|
|
189
|
-
dbKey,
|
|
190
|
-
fallbackFetchImpl,
|
|
191
|
-
fetchImpl,
|
|
192
|
-
serverUrl,
|
|
193
|
-
});
|
|
194
|
-
} catch (error) {
|
|
195
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
196
|
-
if (parsedTable.dbKey || parsedTable.tableId) {
|
|
197
|
-
if (!message.includes("404")) {
|
|
198
|
-
throw error;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const columns = normalizeColumns(readOption(args, "--columns"), existingRecord?.columns);
|
|
205
|
-
const nowIso = new Date().toISOString();
|
|
206
|
-
const rawSpace = readOption(args, "--space");
|
|
207
|
-
const spaceId =
|
|
208
|
-
rawSpace != null
|
|
209
|
-
? parseSpaceIdFromInput(rawSpace)
|
|
210
|
-
: typeof existingRecord?.spaceId === "string" && existingRecord.spaceId
|
|
211
|
-
? existingRecord.spaceId
|
|
212
|
-
: undefined;
|
|
213
|
-
const explicitCategoryId = readOption(args, "--category-id")?.trim() || undefined;
|
|
214
|
-
const categoryId =
|
|
215
|
-
explicitCategoryId ??
|
|
216
|
-
(typeof existingRecord?.categoryId === "string" && existingRecord.categoryId
|
|
217
|
-
? existingRecord.categoryId
|
|
218
|
-
: undefined);
|
|
219
|
-
|
|
220
|
-
let spaceRecord: Record<string, any> | null = null;
|
|
221
|
-
if (spaceId) {
|
|
222
|
-
spaceRecord = await readSpaceRecordWithFallback({
|
|
223
|
-
authToken,
|
|
224
|
-
db,
|
|
225
|
-
fallbackFetchImpl,
|
|
226
|
-
fetchImpl,
|
|
227
|
-
serverCandidates: [serverUrl],
|
|
228
|
-
spaceId,
|
|
229
|
-
});
|
|
230
|
-
if (categoryId && !spaceRecord?.categories?.[categoryId]) {
|
|
231
|
-
throw new Error(`space ${spaceId} does not contain category ${categoryId}`);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
const nextRecord = {
|
|
236
|
-
...(existingRecord ?? {}),
|
|
237
|
-
dbKey,
|
|
238
|
-
tenantId: userId,
|
|
239
|
-
tableId,
|
|
240
|
-
spaceId: spaceId ?? null,
|
|
241
|
-
displayName: name,
|
|
242
|
-
...(description !== undefined ? { description } : {}),
|
|
243
|
-
...(tags !== undefined ? { tags } : existingRecord?.tags ? { tags: existingRecord.tags } : {}),
|
|
244
|
-
...(categoryId ? { categoryId } : {}),
|
|
245
|
-
schemaVersion:
|
|
246
|
-
typeof existingRecord?.schemaVersion === "number" ? existingRecord.schemaVersion : 1,
|
|
247
|
-
columns,
|
|
248
|
-
views: Array.isArray(existingRecord?.views) ? existingRecord.views : [],
|
|
249
|
-
triggers: Array.isArray(existingRecord?.triggers) ? existingRecord.triggers : [],
|
|
250
|
-
aiConfig: existingRecord?.aiConfig,
|
|
251
|
-
createdAt: existingRecord?.createdAt ?? nowIso,
|
|
252
|
-
updatedAt: nowIso,
|
|
253
|
-
type: "table",
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
const writeRecords = [{ dbKey, record: nextRecord, serverUrl }];
|
|
257
|
-
|
|
258
|
-
if (spaceId && spaceRecord) {
|
|
259
|
-
const nextSpaceRecord = buildTableAttachedSpaceRecord({
|
|
260
|
-
categoryId,
|
|
261
|
-
contentKey: dbKey,
|
|
262
|
-
existingSpaceRecord: spaceRecord,
|
|
263
|
-
spaceId,
|
|
264
|
-
title: name,
|
|
265
|
-
});
|
|
266
|
-
writeRecords.push({
|
|
267
|
-
dbKey: `space-${spaceId}`,
|
|
268
|
-
record: nextSpaceRecord,
|
|
269
|
-
serverUrl,
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
await writeRemoteRecordsThenCache({
|
|
274
|
-
authToken,
|
|
275
|
-
db,
|
|
276
|
-
fallbackFetchImpl,
|
|
277
|
-
fetchImpl,
|
|
278
|
-
records: writeRecords,
|
|
279
|
-
userId,
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
output.write(
|
|
283
|
-
`${JSON.stringify(
|
|
284
|
-
{
|
|
285
|
-
ok: true,
|
|
286
|
-
action: existingRecord ? "updated" : "created",
|
|
287
|
-
baseUrl: serverUrl,
|
|
288
|
-
dbKey,
|
|
289
|
-
tableId,
|
|
290
|
-
spaceId: spaceId ?? null,
|
|
291
|
-
categoryId: categoryId ?? null,
|
|
292
|
-
table: nextRecord,
|
|
293
|
-
},
|
|
294
|
-
null,
|
|
295
|
-
2
|
|
296
|
-
)}\n`
|
|
297
|
-
);
|
|
298
|
-
return 0;
|
|
299
|
-
} catch (error) {
|
|
300
|
-
output.write(
|
|
301
|
-
`[nolo] table meta failed: ${
|
|
302
|
-
error instanceof Error ? error.message : String(error)
|
|
303
|
-
}\n`
|
|
304
|
-
);
|
|
305
|
-
return 1;
|
|
306
|
-
}
|
|
307
|
-
}
|