nolo-cli 0.1.29 → 0.1.31
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/agent-runtime/agentRecordConfig.ts +0 -2
- package/agent-runtime/hostAdapter.ts +0 -1
- package/agent-runtime/hostRuntimeCapabilities.ts +7 -0
- package/agent-runtime/hostRuntimeConfig.ts +86 -0
- package/agent-runtime/index.ts +13 -0
- package/agent-runtime/localToolPolicy.ts +13 -6
- package/agent-runtime/localWorkspaceTools.ts +333 -30
- package/agent-runtime/platformChatProvider.ts +4 -1
- package/agent-runtime/runtimeToolPolicy.ts +32 -47
- package/agent-runtime/shellCommandPolicy.ts +117 -0
- package/agent-runtime/toolGate.ts +38 -0
- package/agentCreateCustomCommands.ts +9 -4
- package/agentDialogsCommands.ts +4 -3
- package/agentDoctorCommands.ts +3 -3
- package/agentListCommands.ts +3 -3
- package/agentMachineCommands.ts +6 -6
- package/agentPullCommand.ts +4 -12
- package/agentRecordCommands.ts +5 -3
- package/agentRecordHelpers.ts +42 -23
- package/agentRunCommand.ts +2 -6
- package/agentRunParsing.ts +18 -5
- package/agentRuntimeLocal.ts +10 -0
- package/agentUnpublishCommands.ts +3 -2
- package/ai/agent/agentRunDialogLineage.ts +56 -0
- package/ai/agent/agentSlice.ts +45 -10
- package/ai/agent/avatarUtils.ts +1 -1
- package/ai/agent/buildSystemPrompt.ts +1 -2
- package/ai/agent/cliExecutor.ts +330 -19
- package/ai/agent/createAgentSchema.ts +22 -0
- package/ai/agent/hooks/fetchPublicAgents.ts +14 -39
- package/ai/agent/hooks/usePublicAgents.ts +90 -192
- package/ai/agent/publicAgentCatalog.ts +359 -0
- package/ai/agent/publicAgentIdentity.ts +76 -0
- package/ai/agent/server/fetchPublicAgents.ts +21 -46
- package/ai/agent/serverOrigin.ts +7 -0
- package/ai/agent/streamAgentChatTurn.ts +23 -21
- package/ai/agent/streamAgentChatTurnUtils.ts +292 -6
- package/ai/agent/types.ts +2 -0
- package/ai/agent/web/agentDisplayUtils.ts +171 -0
- package/ai/agent/web/useAgentModelAvatarComponent.ts +32 -0
- package/ai/ai.locale.ts +8 -0
- package/ai/chat/sendOpenAICompletionsRequest.native.ts +15 -0
- package/ai/chat/sendOpenAICompletionsRequest.ts +93 -1
- package/ai/chat/sendOpenAIResponseRequest.ts +86 -9
- package/ai/chat/updateTotalUsage.ts +7 -0
- package/ai/llm/deepinfra.ts +30 -15
- package/ai/llm/mistral.ts +3 -4
- package/ai/llm/providers.ts +2 -0
- package/ai/llm/types.ts +15 -0
- package/ai/memory/capture.ts +3 -3
- package/ai/memory/consolidate.ts +2 -2
- package/ai/memory/delete.ts +4 -3
- package/ai/memory/query.ts +3 -3
- package/ai/memory/remember.ts +2 -2
- package/ai/memory/store.ts +3 -3
- package/ai/memory/storeShared.ts +3 -2
- package/ai/policy/commercialMultiplier.ts +16 -0
- package/ai/token/billingAdminAuditEvent.ts +68 -0
- package/ai/token/billingAdminAuditEventWriter.ts +41 -0
- package/ai/token/billingAnomaly.ts +90 -0
- package/ai/token/billingAnomalyLifecycle.ts +54 -0
- package/ai/token/billingAnomalyLifecycleWriter.ts +44 -0
- package/ai/token/billingAnomalyWriter.ts +41 -0
- package/ai/token/calculatePrice.ts +3 -2
- package/ai/token/deepinfraReconciliation.ts +153 -0
- package/ai/token/deepinfraRequestIdQuery.ts +92 -0
- package/ai/token/externalToolCost.ts +54 -41
- package/ai/token/missingUsageEstimate.ts +12 -3
- package/ai/token/normalizeUsage.ts +45 -5
- package/ai/token/openaiReconciliation.ts +188 -0
- package/ai/token/providerBillableEvent.ts +84 -0
- package/ai/token/providerBillableEventWriter.ts +36 -0
- package/ai/token/providerBillingAnomalyDrilldown.ts +308 -0
- package/ai/token/providerBillingDrilldown.ts +361 -0
- package/ai/token/providerBillingHealthReport.ts +366 -0
- package/ai/token/providerCall.ts +144 -0
- package/ai/token/providerCallSweeper.ts +168 -0
- package/ai/token/providerCallWriter.ts +33 -0
- package/ai/token/providerCredential.ts +89 -0
- package/ai/token/providerCredentialAnomaly.ts +154 -0
- package/ai/token/providerCredentialLifecycle.ts +59 -0
- package/ai/token/providerCredentialLifecycleWriter.ts +44 -0
- package/ai/token/providerCredentialRegistry.ts +83 -0
- package/ai/token/providerCredentialRegistryCommand.ts +97 -0
- package/ai/token/providerCredentialRegistryList.ts +124 -0
- package/ai/token/providerCredentialRegistryResolver.ts +150 -0
- package/ai/token/providerCredentialRegistryWriter.ts +41 -0
- package/ai/token/providerCredentialRotationCommand.ts +102 -0
- package/ai/token/providerCredentialRuntime.ts +56 -0
- package/ai/token/providerDispatchIntent.ts +67 -0
- package/ai/token/providerDispatchIntentWriter.ts +36 -0
- package/ai/token/providerGateway.ts +260 -0
- package/ai/token/providerReconciliation.ts +148 -0
- package/ai/token/providerReconciliationLocal.ts +97 -0
- package/ai/token/providerReconciliationRunner.ts +165 -0
- package/ai/token/providerReconciliationWriter.ts +41 -0
- package/ai/token/ratingResult.ts +202 -0
- package/ai/token/ratingResultWriter.ts +33 -0
- package/ai/token/serverDialogProjection.ts +5 -3
- package/ai/token/serverTokenWriter.ts +11 -3
- package/ai/token/types.ts +10 -0
- package/ai/tools/agent/callAgentTool.ts +3 -4
- package/ai/tools/agent/presets/appBuilderPreset.ts +5 -7
- package/ai/tools/agent/runStreamingAgentTool.ts +1 -2
- package/ai/tools/agent/streamParallelAgentsTool.ts +2 -3
- package/ai/tools/readXPostTool.ts +1 -5
- package/app/admin/adminPages.ts +9 -0
- package/app/i18n/i18n.config.ts +5 -0
- package/app/i18n/translations/pricing.locale.ts +397 -0
- package/app/utils/desktopAgentRuntimeStatusClient.ts +5 -4
- package/app/utils/desktopAgentRuntimeTurnClient.ts +4 -1
- package/app/utils/imageUtils.ts +64 -34
- package/auth/adminPermissions.ts +18 -0
- package/auth/authSlice.ts +26 -12
- package/auth/hooks/useFetchUsers.ts +3 -0
- package/auth/routes.ts +46 -0
- package/auth/server/accessActivity.ts +4 -3
- package/auth/server/adminPermissions.ts +43 -0
- package/auth/server/adminUsageReport.ts +375 -0
- package/auth/server/billingAnomalies.ts +235 -0
- package/auth/server/billingUsageReport.ts +41 -2
- package/auth/server/creatorEarningCreditConversion.ts +10 -2
- package/auth/server/deduct.ts +14 -7
- package/auth/server/delete.ts +10 -2
- package/auth/server/disable.ts +4 -3
- package/auth/server/emailAutomation.ts +7 -5
- package/auth/server/emailDbConfig.ts +4 -2
- package/auth/server/emailDelivery.ts +24 -20
- package/auth/server/emailDeliveryGuards.ts +10 -7
- package/auth/server/emailPreferences.ts +6 -4
- package/auth/server/emailReport.ts +6 -4
- package/auth/server/emailRuntimeConfig.ts +3 -3
- package/auth/server/emailScenarioNotifications.ts +9 -8
- package/auth/server/enable.ts +4 -3
- package/auth/server/getRechargeHistory.ts +3 -2
- package/auth/server/getUser.ts +3 -2
- package/auth/server/gptProAccess.ts +44 -0
- package/auth/server/inviteReward.ts +10 -7
- package/auth/server/listusers.ts +6 -4
- package/auth/server/login.ts +2 -2
- package/auth/server/productEntitlements.ts +7 -4
- package/auth/server/productPurchase.ts +10 -2
- package/auth/server/providerBillingDrilldown.ts +47 -0
- package/auth/server/providerBillingHealth.ts +71 -0
- package/auth/server/providerCredentials.ts +136 -0
- package/auth/server/recharge.ts +14 -8
- package/auth/server/revokeSessions.ts +4 -3
- package/auth/server/route.ts +77 -0
- package/auth/server/sendEmail.ts +5 -4
- package/auth/server/signup.ts +10 -3
- package/auth/server/token.ts +53 -55
- package/auth/server/tokenUsageBilling.ts +18 -7
- package/auth/server/usageManagementAccess.ts +43 -0
- package/auth/server/usageReport.ts +59 -0
- package/auth/types.ts +12 -0
- package/auth/utils.ts +24 -22
- package/authCommands.ts +36 -2
- package/buildPublish.ts +3 -1
- package/buildPublishArtifactAssembly.ts +62 -1
- package/buildPublishImportAnalysis.ts +21 -16
- package/chat/dialog/dialogLaunchScope.ts +32 -0
- package/chat/dialog/objectAssistantRegistry.ts +2 -2
- package/chat/dialog/useCreateDialog.ts +1 -1
- package/chat/hooks/useChatInput.ts +41 -10
- package/chat/messages/messageSlice.ts +5 -1
- package/chat/messages/pendingAttachmentParts.ts +28 -2
- package/chat/messages/sendFirstMessage.ts +76 -79
- package/chat/messages/types.ts +9 -0
- package/chat/messages/web/streamingMarkdownModel.ts +41 -0
- package/chat/messages/web/useStreamingReveal.ts +91 -0
- package/chat/web/messageInputAgentUi.ts +94 -6
- package/cliEnvHelpers.ts +68 -13
- package/cliRuntimeDoctorReport.ts +193 -0
- package/client/agentConfigResolver.test.ts +0 -2
- package/client/agentRun.test.ts +171 -10
- package/client/agentRun.ts +44 -637
- package/client/agentRunInput.ts +10 -0
- package/client/agentRunLocalExecutor.ts +179 -0
- package/client/agentRunServerTransport.ts +394 -0
- package/client/agentRunTaskRunRecorder.ts +176 -0
- package/client/localRuntimeAdapter.test.ts +236 -9
- package/client/localRuntimeAdapter.ts +221 -23
- package/client/localToolPolicy.test.ts +28 -4
- package/connector-experimental/daemonLauncher.ts +38 -4
- package/connectorRunArtifact.ts +34 -10
- package/connectorWebSocketTarget.ts +40 -15
- package/core/builtinAgents.ts +155 -11
- package/create/space/contentLabels.ts +1 -1
- package/create/space/contentTypeMeta.ts +3 -2
- package/create/space/sidebarVisibleTypes.ts +27 -0
- package/create/space/space.locale.ts +76 -4
- package/database/actions/agentReadResolution.ts +2 -8
- package/database/actions/read.ts +11 -9
- package/database/actions/readAndWait.ts +10 -5
- package/database/server/agentDelegation.ts +3 -2
- package/database/server/authorityStoreConformance.ts +209 -0
- package/database/server/authorityStoreTypes.ts +31 -0
- package/database/server/coreDataProxy.ts +1 -1
- package/database/server/dataHandlers.ts +13 -5
- package/database/server/db.ts +15 -34
- package/database/server/delete.ts +88 -71
- package/database/server/emailRepository.ts +11 -9
- package/database/server/fileService.ts +2 -1
- package/database/server/legacyServerDb.ts +58 -0
- package/database/server/levelAuthorityStore.ts +75 -0
- package/database/server/memoryAuthorityStore.ts +133 -0
- package/database/server/patch.ts +13 -12
- package/database/server/query.ts +3 -2
- package/database/server/read.ts +33 -30
- package/database/server/resourceAccess.ts +7 -5
- package/database/server/serverStoreFactory.ts +124 -0
- package/database/server/spaceMemberAuthority.ts +3 -2
- package/database/server/storeBatchCompat.ts +37 -0
- package/database/server/testAuthorityStore.ts +76 -0
- package/database/server/write.ts +29 -27
- package/dialogReadCommands.ts +2 -1
- package/dialogStatusCommands.ts +2 -1
- package/integrations/anthropic/anthropicModels.ts +12 -12
- package/integrations/deepseek/models.ts +67 -67
- package/integrations/google/models.ts +111 -53
- package/integrations/openai/models.ts +22 -22
- package/integrations/xai/models.ts +1 -1
- package/localRuntimeDb.ts +39 -2
- package/machineCommandPrompts.ts +2 -0
- package/machineCommands.ts +193 -62
- package/machineStatusCommands.ts +4 -12
- package/machineWsRunDispatch.ts +80 -15
- package/machineWsSession.ts +46 -2
- package/noloReadBridgePrompt.ts +16 -0
- package/package.json +114 -21
- package/pageCreateCommands.ts +2 -2
- package/pageDeleteCommands.ts +3 -3
- package/pageReadCommands.ts +3 -3
- package/pageUpdateCommands.ts +3 -3
- package/render/layout/mainLayoutViewMode.ts +25 -0
- package/render/page/server/createPage.ts +3 -1
- package/render/page/server/handleCreatePage.ts +2 -11
- package/runtimeDoctorCommands.ts +18 -69
- package/server/api/methods.ts +34 -12
- package/server/api/tableHandlers.ts +6 -3
- package/server/authenticateToken.ts +47 -2
- package/server/billingLedgerRoutes.ts +15 -0
- package/server/buildManifest.ts +54 -0
- package/server/coreReadiness.ts +34 -25
- package/server/coreRuntime.ts +15 -10
- package/server/handlers/activityStatsHandler.ts +5 -2
- package/server/handlers/agentEmailRegistrationE2EHandler.ts +25 -23
- package/server/handlers/agentRun/agentLookup.ts +1 -7
- package/server/handlers/agentRun/autonomousRuntime.ts +11 -10
- package/server/handlers/agentRun/builtinAgents.ts +12 -88
- package/server/handlers/agentRun/continueDialogContext.ts +15 -3
- package/server/handlers/agentRun/{inheritedDialogPrompt.ts → conversationReference.ts} +3 -3
- package/server/handlers/agentRun/dialogLookup.ts +4 -3
- package/server/handlers/agentRun/index.ts +864 -404
- package/server/handlers/agentRun/localRuntimeBootstrap.ts +17 -1
- package/server/handlers/agentRun/loop.ts +920 -508
- package/server/handlers/agentRun/machineConnector.ts +56 -8
- package/server/handlers/agentRun/machineRunAudit.ts +3 -2
- package/server/handlers/agentRun/modelUsageToolHandlers.ts +13 -10
- package/server/handlers/agentRun/requestContext.ts +12 -8
- package/server/handlers/agentRun/runtimeExecutionContext.ts +15 -3
- package/server/handlers/agentRun/runtimePreparation.ts +26 -24
- package/server/handlers/agentRun/runtimeRouting.ts +25 -40
- package/server/handlers/agentRun/runtimeSystemMessages.ts +65 -0
- package/server/handlers/agentRun/saveDialog.ts +97 -87
- package/server/handlers/agentRun/taskRunToolHandler.ts +9 -7
- package/server/handlers/agentRun/toolExecutor.ts +42 -78
- package/server/handlers/agentRun/types.ts +2 -1
- package/server/handlers/appDeployStatusStore.ts +17 -10
- package/server/handlers/appDomainHandler.ts +21 -15
- package/server/handlers/appLegacyInfraCleanup.ts +5 -2
- package/server/handlers/appSandboxHandler.ts +29 -8
- package/server/handlers/appSpaceAccess.ts +15 -8
- package/server/handlers/chatHandler.ts +22 -2
- package/server/handlers/chatUpstreamRetry.ts +225 -2
- package/server/handlers/connector/connectorConnectionRegistry.ts +55 -7
- package/server/handlers/connector/connectorWebSocket.ts +14 -10
- package/server/handlers/desktopAgentRuntimeAdapter.ts +4 -4
- package/server/handlers/desktopAgentRuntimeHostCapabilities.ts +25 -0
- package/server/handlers/desktopAgentRuntimeReadiness.ts +62 -0
- package/server/handlers/desktopAgentRuntimeStatusHandler.ts +38 -30
- package/server/handlers/desktopAgentRuntimeTurnHandler.ts +7 -3
- package/server/handlers/desktopAgentRuntimeTurnService.ts +39 -45
- package/server/handlers/desktopLlamaRuntimeHandler.ts +85 -51
- package/server/handlers/desktopUpdaterHandler.ts +132 -24
- package/server/handlers/favoriteHandlers.ts +8 -2
- package/server/handlers/getDialogBillingHandler.ts +4 -3
- package/server/handlers/getTransactionsHandler.ts +5 -2
- package/server/handlers/machines/machineBinding.ts +1 -0
- package/server/handlers/machines/machineHandlers.ts +0 -14
- package/server/handlers/machines/machineInstallAssets.ts +4 -2
- package/server/handlers/notificationEmitter.ts +5 -3
- package/server/handlers/notificationsHandler.ts +5 -2
- package/server/handlers/providerCallsRecentHandler.ts +234 -0
- package/server/handlers/providerReconciliationRunHandler.ts +180 -0
- package/server/handlers/providerRequestIdsHandler.ts +105 -0
- package/server/handlers/tableAccess.ts +6 -2
- package/server/handlers/tableToolHandlers.ts +28 -14
- package/server/handlers/userSecretsHandler.ts +17 -6
- package/server/handlers/versionHandler.ts +9 -4
- package/server/handlers/versionStore.ts +18 -10
- package/server/html/ssrPreload.ts +5 -3
- package/server/payments/crypto/cryptoUsdcBasePaymentProvider.ts +11 -8
- package/server/payments/crypto/cryptoUsdcBaseScanner.ts +12 -7
- package/server/payments/crypto/cryptoUsdtTronPaymentProvider.ts +11 -8
- package/server/payments/crypto/cryptoUsdtTronScanner.ts +9 -7
- package/server/payments/waffo/waffoPaymentProvider.ts +12 -9
- package/server/runtimeRole.ts +15 -0
- package/server/scheduler/scheduledTaskRuntime.ts +4 -2
- package/server/scheduler/schedulerService.ts +2 -2
- package/server/taskRunBridgeRoutes.ts +8 -5
- package/share/server/fetchCommunityShares.ts +1 -1
- package/share/server/helpers.ts +19 -17
- package/share/server/importShare.ts +9 -13
- package/share/server/listCommunityShares.ts +4 -4
- package/share/server/purchaseDoc.ts +8 -16
- package/share/server/readCommunityShareCover.ts +3 -2
- package/share/server/readSharedTable.ts +14 -13
- package/share/server/tableReplication.ts +42 -39
- package/spaceAttachCommands.ts +135 -0
- package/spaceCategoryCommands.ts +6 -6
- package/spaceCommands.ts +3 -3
- package/spaceDeleteCommands.ts +2 -2
- package/spaceInternalCommandEntries.ts +2 -0
- package/spaceReadCommands.ts +3 -3
- package/tableMetaCommands.ts +2 -2
- package/taskRunCommand.ts +11 -0
- package/ai/agent/runtimeServerBase.ts +0 -37
- package/server/handlers/desktopAgentRuntimeHostFacts.ts +0 -40
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { ContentType } from "./app/types";
|
|
2
|
+
import { resolveCliAgentKeyInput } from "./agentAliases";
|
|
3
|
+
import { getReadableCliDb, type AgentCommandDeps } from "./agentCommandSupport";
|
|
4
|
+
import { resolveAgentRecordFromHybridStore } from "./agentRecordHelpers";
|
|
5
|
+
import {
|
|
6
|
+
parseUserIdFromAuthToken,
|
|
7
|
+
readOption,
|
|
8
|
+
resolveAuthToken,
|
|
9
|
+
resolveServerCandidates,
|
|
10
|
+
resolveServerUrl,
|
|
11
|
+
} from "./cliEnvHelpers";
|
|
12
|
+
import {
|
|
13
|
+
parseSpaceIdFromInput,
|
|
14
|
+
readSpaceRecordWithFallback,
|
|
15
|
+
writeSpaceRecord,
|
|
16
|
+
} from "./spaceMutationHelpers";
|
|
17
|
+
|
|
18
|
+
function usage() {
|
|
19
|
+
return [
|
|
20
|
+
"Usage:",
|
|
21
|
+
" nolo space attach-agent --space <spaceId|spaceKey|spaceUrl> --agent <agentKey|alias|agentUrl>",
|
|
22
|
+
"",
|
|
23
|
+
].join("\n");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export async function runSpaceAttachAgentCommand(
|
|
27
|
+
args: string[],
|
|
28
|
+
deps: AgentCommandDeps = {}
|
|
29
|
+
) {
|
|
30
|
+
const env = deps.env ?? process.env;
|
|
31
|
+
const output = deps.output ?? process.stdout;
|
|
32
|
+
|
|
33
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
34
|
+
output.write(`${usage()}\n`);
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const rawSpace = readOption(args, "--space");
|
|
39
|
+
const rawAgent = readOption(args, "--agent");
|
|
40
|
+
if (!rawSpace || !rawAgent) {
|
|
41
|
+
output.write(`${usage()}\n`);
|
|
42
|
+
return 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const authToken = resolveAuthToken(args, env);
|
|
46
|
+
const userId = parseUserIdFromAuthToken(authToken);
|
|
47
|
+
if (!authToken || !userId) {
|
|
48
|
+
output.write("[nolo] space attach-agent requires an auth token with userId. Run `nolo login`.\n");
|
|
49
|
+
return 1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const db = deps.db ?? await getReadableCliDb(output);
|
|
53
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
54
|
+
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
|
55
|
+
const defaultServerUrl = resolveServerUrl(args, env);
|
|
56
|
+
const serverCandidates = resolveServerCandidates(args, env, defaultServerUrl);
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
const spaceId = parseSpaceIdFromInput(rawSpace);
|
|
60
|
+
const agentKey = resolveCliAgentKeyInput(rawAgent);
|
|
61
|
+
const spaceRecord = await readSpaceRecordWithFallback({
|
|
62
|
+
authToken,
|
|
63
|
+
db,
|
|
64
|
+
fallbackFetchImpl,
|
|
65
|
+
fetchImpl,
|
|
66
|
+
serverCandidates,
|
|
67
|
+
spaceId,
|
|
68
|
+
});
|
|
69
|
+
const resolvedAgent = await resolveAgentRecordFromHybridStore({
|
|
70
|
+
agentInput: rawAgent,
|
|
71
|
+
cliArgs: args,
|
|
72
|
+
env,
|
|
73
|
+
db,
|
|
74
|
+
fetchImpl,
|
|
75
|
+
fallbackFetchImpl,
|
|
76
|
+
});
|
|
77
|
+
if (!resolvedAgent?.record || typeof resolvedAgent.record !== "object") {
|
|
78
|
+
throw new Error(`agent not found: ${agentKey}`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const title =
|
|
82
|
+
typeof resolvedAgent.record.name === "string" && resolvedAgent.record.name.trim()
|
|
83
|
+
? resolvedAgent.record.name.trim()
|
|
84
|
+
: agentKey;
|
|
85
|
+
const now = Date.now();
|
|
86
|
+
const nextSpaceRecord = {
|
|
87
|
+
...spaceRecord,
|
|
88
|
+
updatedAt: now,
|
|
89
|
+
contents: {
|
|
90
|
+
...(spaceRecord?.contents ?? {}),
|
|
91
|
+
[agentKey]: {
|
|
92
|
+
...(spaceRecord?.contents?.[agentKey] ?? {}),
|
|
93
|
+
title,
|
|
94
|
+
type: ContentType.AGENT,
|
|
95
|
+
contentKey: agentKey,
|
|
96
|
+
updatedAt: now,
|
|
97
|
+
createdAt: spaceRecord?.contents?.[agentKey]?.createdAt ?? now,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
await writeSpaceRecord({
|
|
103
|
+
authToken,
|
|
104
|
+
db,
|
|
105
|
+
fallbackFetchImpl,
|
|
106
|
+
fetchImpl,
|
|
107
|
+
record: nextSpaceRecord,
|
|
108
|
+
serverUrl: defaultServerUrl,
|
|
109
|
+
spaceId,
|
|
110
|
+
userId,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
output.write(
|
|
114
|
+
`${JSON.stringify(
|
|
115
|
+
{
|
|
116
|
+
ok: true,
|
|
117
|
+
baseUrl: defaultServerUrl,
|
|
118
|
+
spaceId,
|
|
119
|
+
agentKey,
|
|
120
|
+
title,
|
|
121
|
+
},
|
|
122
|
+
null,
|
|
123
|
+
2
|
|
124
|
+
)}\n`
|
|
125
|
+
);
|
|
126
|
+
return 0;
|
|
127
|
+
} catch (error) {
|
|
128
|
+
output.write(
|
|
129
|
+
`[nolo] space attach-agent failed: ${
|
|
130
|
+
error instanceof Error ? error.message : String(error)
|
|
131
|
+
}\n`
|
|
132
|
+
);
|
|
133
|
+
return 1;
|
|
134
|
+
}
|
|
135
|
+
}
|
package/spaceCategoryCommands.ts
CHANGED
|
@@ -49,7 +49,7 @@ export async function runSpaceCategoryCommand(
|
|
|
49
49
|
return 1;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const authToken = resolveAuthToken(env);
|
|
52
|
+
const authToken = resolveAuthToken(args, env);
|
|
53
53
|
const userId = parseUserIdFromAuthToken(authToken);
|
|
54
54
|
if (!authToken || !userId) {
|
|
55
55
|
output.write("[nolo] space category requires an auth token with userId. Run `nolo login`.\n");
|
|
@@ -66,8 +66,8 @@ export async function runSpaceCategoryCommand(
|
|
|
66
66
|
const db = deps.db ?? await getReadableCliDb(output);
|
|
67
67
|
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
68
68
|
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
|
69
|
-
const defaultServerUrl = resolveServerUrl(env);
|
|
70
|
-
const serverCandidates = resolveServerCandidates(env, defaultServerUrl);
|
|
69
|
+
const defaultServerUrl = resolveServerUrl(args, env);
|
|
70
|
+
const serverCandidates = resolveServerCandidates(args, env, defaultServerUrl);
|
|
71
71
|
|
|
72
72
|
try {
|
|
73
73
|
const spaceId = parseSpaceIdFromInput(rawSpace);
|
|
@@ -163,7 +163,7 @@ export async function runSpaceContentCategoryCommand(
|
|
|
163
163
|
return 1;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
const authToken = resolveAuthToken(env);
|
|
166
|
+
const authToken = resolveAuthToken(args, env);
|
|
167
167
|
const userId = parseUserIdFromAuthToken(authToken);
|
|
168
168
|
if (!authToken || !userId) {
|
|
169
169
|
output.write("[nolo] space content-category requires an auth token with userId. Run `nolo login`.\n");
|
|
@@ -189,8 +189,8 @@ export async function runSpaceContentCategoryCommand(
|
|
|
189
189
|
const db = deps.db ?? await getReadableCliDb(output);
|
|
190
190
|
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
191
191
|
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
|
192
|
-
const defaultServerUrl = resolveServerUrl(env);
|
|
193
|
-
const serverCandidates = resolveServerCandidates(env, defaultServerUrl);
|
|
192
|
+
const defaultServerUrl = resolveServerUrl(args, env);
|
|
193
|
+
const serverCandidates = resolveServerCandidates(args, env, defaultServerUrl);
|
|
194
194
|
|
|
195
195
|
try {
|
|
196
196
|
const spaceId = parseSpaceIdFromInput(rawSpace);
|
package/spaceCommands.ts
CHANGED
|
@@ -181,7 +181,7 @@ export async function runSpaceListCommand(
|
|
|
181
181
|
const output = deps.output ?? process.stdout;
|
|
182
182
|
const filters = parseSpaceListArgs(args);
|
|
183
183
|
|
|
184
|
-
const authToken = resolveAuthToken(env);
|
|
184
|
+
const authToken = resolveAuthToken(args, env);
|
|
185
185
|
if (!authToken) {
|
|
186
186
|
output.write("[nolo] space list requires an auth token. Run `nolo login` or set AUTH_TOKEN.\n");
|
|
187
187
|
return 1;
|
|
@@ -196,8 +196,8 @@ export async function runSpaceListCommand(
|
|
|
196
196
|
const db = deps.db ?? await getReadableCliDb(output);
|
|
197
197
|
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
198
198
|
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
|
199
|
-
const defaultServerUrl = resolveServerUrl(env);
|
|
200
|
-
const serverCandidates = resolveServerCandidates(env, defaultServerUrl);
|
|
199
|
+
const defaultServerUrl = resolveServerUrl(args, env);
|
|
200
|
+
const serverCandidates = resolveServerCandidates(args, env, defaultServerUrl);
|
|
201
201
|
|
|
202
202
|
try {
|
|
203
203
|
let spaces: ListedSpace[];
|
package/spaceDeleteCommands.ts
CHANGED
|
@@ -195,7 +195,7 @@ export async function runSpaceDeleteCommand(
|
|
|
195
195
|
return 1;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
const authToken = resolveAuthToken(env);
|
|
198
|
+
const authToken = resolveAuthToken(args, env);
|
|
199
199
|
const userId = parseUserIdFromAuthToken(authToken);
|
|
200
200
|
if (!authToken || !userId) {
|
|
201
201
|
output.write("[nolo] space delete requires an auth token with userId. Run `nolo login`.\n");
|
|
@@ -207,7 +207,7 @@ export async function runSpaceDeleteCommand(
|
|
|
207
207
|
const db = deps.db ?? await getReadableCliDb(output);
|
|
208
208
|
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
209
209
|
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
|
210
|
-
const serverUrl = resolveServerUrl(env);
|
|
210
|
+
const serverUrl = resolveServerUrl(args, env);
|
|
211
211
|
|
|
212
212
|
try {
|
|
213
213
|
const memberships = await fetchMemberships({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createEnvCommand } from "./cliCommandFactories";
|
|
2
2
|
import type { CommandEntry } from "./cliCommandTypes";
|
|
3
|
+
import { runSpaceAttachAgentCommand } from "./spaceAttachCommands";
|
|
3
4
|
import {
|
|
4
5
|
runSpaceCategoryCommand,
|
|
5
6
|
runSpaceContentCategoryCommand,
|
|
@@ -12,6 +13,7 @@ export function getSpaceInternalCommandEntries(): CommandEntry[] {
|
|
|
12
13
|
return [
|
|
13
14
|
createEnvCommand(["space", "list"], "List joined spaces", runSpaceListCommand),
|
|
14
15
|
createEnvCommand(["space", "read"], "Read a space", runSpaceReadCommand),
|
|
16
|
+
createEnvCommand(["space", "attach-agent"], "Attach an existing agent to a space", runSpaceAttachAgentCommand),
|
|
15
17
|
createEnvCommand(["space", "category"], "Create or update a space category", runSpaceCategoryCommand),
|
|
16
18
|
createEnvCommand(["space", "content-category"], "Move content into a space category", runSpaceContentCategoryCommand),
|
|
17
19
|
createEnvCommand(["space", "delete"], "Delete spaces by safe filters", runSpaceDeleteCommand),
|
package/spaceReadCommands.ts
CHANGED
|
@@ -79,7 +79,7 @@ export async function runSpaceReadCommand(
|
|
|
79
79
|
const output = deps.output ?? process.stdout;
|
|
80
80
|
const { raw, brief, contentKeyFilter, includeRecord } = parseSpaceReadArgs(args);
|
|
81
81
|
|
|
82
|
-
const authToken = resolveAuthToken(env);
|
|
82
|
+
const authToken = resolveAuthToken(args, env);
|
|
83
83
|
if (!authToken) {
|
|
84
84
|
output.write("[nolo] space read requires an auth token. Run `nolo login` or set AUTH_TOKEN.\n");
|
|
85
85
|
return 1;
|
|
@@ -94,8 +94,8 @@ export async function runSpaceReadCommand(
|
|
|
94
94
|
const db = deps.db ?? await getReadableCliDb(output);
|
|
95
95
|
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
96
96
|
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
|
97
|
-
const defaultServerUrl = resolveServerUrl(env);
|
|
98
|
-
const serverCandidates = resolveServerCandidates(env, defaultServerUrl);
|
|
97
|
+
const defaultServerUrl = resolveServerUrl(args, env);
|
|
98
|
+
const serverCandidates = resolveServerCandidates(args, env, defaultServerUrl);
|
|
99
99
|
|
|
100
100
|
try {
|
|
101
101
|
const spaceId = parseSpaceIdFromInput(raw);
|
package/tableMetaCommands.ts
CHANGED
|
@@ -158,7 +158,7 @@ export async function runTableMetaCommand(
|
|
|
158
158
|
return 1;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
const authToken = resolveAuthToken(env);
|
|
161
|
+
const authToken = resolveAuthToken(args, env);
|
|
162
162
|
const userId = parseUserIdFromAuthToken(authToken);
|
|
163
163
|
if (!authToken || !userId) {
|
|
164
164
|
output.write("[nolo] table meta requires an auth token with userId. Run `nolo login`.\n");
|
|
@@ -168,7 +168,7 @@ export async function runTableMetaCommand(
|
|
|
168
168
|
const name = rawName.trim();
|
|
169
169
|
const description = readOption(args, "--description")?.trim() || undefined;
|
|
170
170
|
const tags = parseTags(readOption(args, "--tags"));
|
|
171
|
-
const serverUrl = resolveServerUrl(env);
|
|
171
|
+
const serverUrl = resolveServerUrl(args, env);
|
|
172
172
|
const db = deps.db ?? await getReadableCliDb(output);
|
|
173
173
|
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
174
174
|
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
package/taskRunCommand.ts
CHANGED
|
@@ -13,6 +13,15 @@ type TaskRunCommandDeps = {
|
|
|
13
13
|
fetchImpl?: typeof fetch;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
const DEFAULT_TASK_RUN_TIMEOUT_MS = 10 * 60 * 1000;
|
|
17
|
+
|
|
18
|
+
function resolveTaskRunTimeoutMs(env: EnvLike) {
|
|
19
|
+
const raw = env.NOLO_TASK_RUN_TIMEOUT_MS;
|
|
20
|
+
if (!raw) return DEFAULT_TASK_RUN_TIMEOUT_MS;
|
|
21
|
+
const value = Number(raw);
|
|
22
|
+
return Number.isFinite(value) && value > 0 ? value : DEFAULT_TASK_RUN_TIMEOUT_MS;
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
export async function runTaskRunCommand(args: string[], deps: TaskRunCommandDeps = {}) {
|
|
17
26
|
const env = loadTaskRunEnv(deps.env ?? process.env, { includeDefaultEnvFiles: deps.env === undefined });
|
|
18
27
|
const output = deps.output ?? process.stdout;
|
|
@@ -38,6 +47,7 @@ export async function runTaskRunCommand(args: string[], deps: TaskRunCommandDeps
|
|
|
38
47
|
}
|
|
39
48
|
|
|
40
49
|
const serverUrl = resolveServerUrl(args, env);
|
|
50
|
+
const timeoutMs = resolveTaskRunTimeoutMs(env);
|
|
41
51
|
let response: Response;
|
|
42
52
|
try {
|
|
43
53
|
response = await fetchImpl(`${serverUrl}/api/task-run`, {
|
|
@@ -47,6 +57,7 @@ export async function runTaskRunCommand(args: string[], deps: TaskRunCommandDeps
|
|
|
47
57
|
"Content-Type": "application/json",
|
|
48
58
|
},
|
|
49
59
|
body: JSON.stringify(body),
|
|
60
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
50
61
|
});
|
|
51
62
|
} catch (error) {
|
|
52
63
|
output.write(`[nolo] task-run failed: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export const normalizeServerOrigin = (base: string): string | null => {
|
|
2
|
-
try {
|
|
3
|
-
return new URL(base).origin.replace(/\/+$/, "");
|
|
4
|
-
} catch {
|
|
5
|
-
return null;
|
|
6
|
-
}
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const extractAgentRuntimeServerBase = (agentRecord: any): string | null => {
|
|
10
|
-
const candidates = [
|
|
11
|
-
agentRecord?.delegation?.serverBase,
|
|
12
|
-
agentRecord?.runtime?.serverBase,
|
|
13
|
-
agentRecord?.runtimeServerBase,
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
if (Array.isArray(agentRecord?.runtimes)) {
|
|
17
|
-
const runtimes = agentRecord.runtimes
|
|
18
|
-
.filter((runtime: any) => runtime && typeof runtime === "object")
|
|
19
|
-
.slice()
|
|
20
|
-
.sort((a: any, b: any) => {
|
|
21
|
-
const priorityA =
|
|
22
|
-
typeof a.priority === "number" ? a.priority : Number.MAX_SAFE_INTEGER;
|
|
23
|
-
const priorityB =
|
|
24
|
-
typeof b.priority === "number" ? b.priority : Number.MAX_SAFE_INTEGER;
|
|
25
|
-
return priorityA - priorityB;
|
|
26
|
-
});
|
|
27
|
-
candidates.push(...runtimes.map((runtime: any) => runtime.serverBase));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
for (const candidate of candidates) {
|
|
31
|
-
if (typeof candidate === "string" && candidate.trim()) {
|
|
32
|
-
return candidate.trim();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return null;
|
|
37
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildAgentRuntimeDecisionInput,
|
|
3
|
-
canUsePlatformChatProvider,
|
|
4
|
-
hasDirectOpenAiCompatibleProvider,
|
|
5
|
-
type AgentRuntimeCapabilityFacts,
|
|
6
|
-
type AgentRuntimeDecisionInput,
|
|
7
|
-
} from "../../agent-runtime";
|
|
8
|
-
|
|
9
|
-
export type DesktopAgentRuntimeEnv = Record<string, string | undefined>;
|
|
10
|
-
|
|
11
|
-
function hasDesktopLevelDbPersistence(env: DesktopAgentRuntimeEnv) {
|
|
12
|
-
return Boolean(env.NOLO_SERVER_DB_PATH?.trim());
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function hasDesktopProviderRequestEndpoint(env: DesktopAgentRuntimeEnv) {
|
|
16
|
-
return hasDirectOpenAiCompatibleProvider(env) || canUsePlatformChatProvider(env);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function describeDesktopAgentRuntimeHostFacts(
|
|
20
|
-
env: DesktopAgentRuntimeEnv
|
|
21
|
-
): AgentRuntimeCapabilityFacts {
|
|
22
|
-
const hasLevelDbPersistence = hasDesktopLevelDbPersistence(env);
|
|
23
|
-
const hasProviderRequestEndpoint = hasDesktopProviderRequestEndpoint(env);
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
host: "desktop",
|
|
27
|
-
capabilities: [
|
|
28
|
-
...(hasLevelDbPersistence ? ["leveldb-agent-config"] : []),
|
|
29
|
-
...(hasProviderRequestEndpoint ? ["local-provider"] : []),
|
|
30
|
-
...(hasLevelDbPersistence ? ["leveldb-persistence"] : []),
|
|
31
|
-
],
|
|
32
|
-
serverFallbackAvailable: true,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function buildDesktopAgentRuntimeDecisionInput(
|
|
37
|
-
env: DesktopAgentRuntimeEnv
|
|
38
|
-
): AgentRuntimeDecisionInput {
|
|
39
|
-
return buildAgentRuntimeDecisionInput(describeDesktopAgentRuntimeHostFacts(env));
|
|
40
|
-
}
|