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.
Files changed (329) hide show
  1. package/agent-runtime/agentRecordConfig.ts +0 -2
  2. package/agent-runtime/hostAdapter.ts +0 -1
  3. package/agent-runtime/hostRuntimeCapabilities.ts +7 -0
  4. package/agent-runtime/hostRuntimeConfig.ts +86 -0
  5. package/agent-runtime/index.ts +13 -0
  6. package/agent-runtime/localToolPolicy.ts +13 -6
  7. package/agent-runtime/localWorkspaceTools.ts +333 -30
  8. package/agent-runtime/platformChatProvider.ts +4 -1
  9. package/agent-runtime/runtimeToolPolicy.ts +32 -47
  10. package/agent-runtime/shellCommandPolicy.ts +117 -0
  11. package/agent-runtime/toolGate.ts +38 -0
  12. package/agentCreateCustomCommands.ts +9 -4
  13. package/agentDialogsCommands.ts +4 -3
  14. package/agentDoctorCommands.ts +3 -3
  15. package/agentListCommands.ts +3 -3
  16. package/agentMachineCommands.ts +6 -6
  17. package/agentPullCommand.ts +4 -12
  18. package/agentRecordCommands.ts +5 -3
  19. package/agentRecordHelpers.ts +42 -23
  20. package/agentRunCommand.ts +2 -6
  21. package/agentRunParsing.ts +18 -5
  22. package/agentRuntimeLocal.ts +10 -0
  23. package/agentUnpublishCommands.ts +3 -2
  24. package/ai/agent/agentRunDialogLineage.ts +56 -0
  25. package/ai/agent/agentSlice.ts +45 -10
  26. package/ai/agent/avatarUtils.ts +1 -1
  27. package/ai/agent/buildSystemPrompt.ts +1 -2
  28. package/ai/agent/cliExecutor.ts +330 -19
  29. package/ai/agent/createAgentSchema.ts +22 -0
  30. package/ai/agent/hooks/fetchPublicAgents.ts +14 -39
  31. package/ai/agent/hooks/usePublicAgents.ts +90 -192
  32. package/ai/agent/publicAgentCatalog.ts +359 -0
  33. package/ai/agent/publicAgentIdentity.ts +76 -0
  34. package/ai/agent/server/fetchPublicAgents.ts +21 -46
  35. package/ai/agent/serverOrigin.ts +7 -0
  36. package/ai/agent/streamAgentChatTurn.ts +23 -21
  37. package/ai/agent/streamAgentChatTurnUtils.ts +292 -6
  38. package/ai/agent/types.ts +2 -0
  39. package/ai/agent/web/agentDisplayUtils.ts +171 -0
  40. package/ai/agent/web/useAgentModelAvatarComponent.ts +32 -0
  41. package/ai/ai.locale.ts +8 -0
  42. package/ai/chat/sendOpenAICompletionsRequest.native.ts +15 -0
  43. package/ai/chat/sendOpenAICompletionsRequest.ts +93 -1
  44. package/ai/chat/sendOpenAIResponseRequest.ts +86 -9
  45. package/ai/chat/updateTotalUsage.ts +7 -0
  46. package/ai/llm/deepinfra.ts +30 -15
  47. package/ai/llm/mistral.ts +3 -4
  48. package/ai/llm/providers.ts +2 -0
  49. package/ai/llm/types.ts +15 -0
  50. package/ai/memory/capture.ts +3 -3
  51. package/ai/memory/consolidate.ts +2 -2
  52. package/ai/memory/delete.ts +4 -3
  53. package/ai/memory/query.ts +3 -3
  54. package/ai/memory/remember.ts +2 -2
  55. package/ai/memory/store.ts +3 -3
  56. package/ai/memory/storeShared.ts +3 -2
  57. package/ai/policy/commercialMultiplier.ts +16 -0
  58. package/ai/token/billingAdminAuditEvent.ts +68 -0
  59. package/ai/token/billingAdminAuditEventWriter.ts +41 -0
  60. package/ai/token/billingAnomaly.ts +90 -0
  61. package/ai/token/billingAnomalyLifecycle.ts +54 -0
  62. package/ai/token/billingAnomalyLifecycleWriter.ts +44 -0
  63. package/ai/token/billingAnomalyWriter.ts +41 -0
  64. package/ai/token/calculatePrice.ts +3 -2
  65. package/ai/token/deepinfraReconciliation.ts +153 -0
  66. package/ai/token/deepinfraRequestIdQuery.ts +92 -0
  67. package/ai/token/externalToolCost.ts +54 -41
  68. package/ai/token/missingUsageEstimate.ts +12 -3
  69. package/ai/token/normalizeUsage.ts +45 -5
  70. package/ai/token/openaiReconciliation.ts +188 -0
  71. package/ai/token/providerBillableEvent.ts +84 -0
  72. package/ai/token/providerBillableEventWriter.ts +36 -0
  73. package/ai/token/providerBillingAnomalyDrilldown.ts +308 -0
  74. package/ai/token/providerBillingDrilldown.ts +361 -0
  75. package/ai/token/providerBillingHealthReport.ts +366 -0
  76. package/ai/token/providerCall.ts +144 -0
  77. package/ai/token/providerCallSweeper.ts +168 -0
  78. package/ai/token/providerCallWriter.ts +33 -0
  79. package/ai/token/providerCredential.ts +89 -0
  80. package/ai/token/providerCredentialAnomaly.ts +154 -0
  81. package/ai/token/providerCredentialLifecycle.ts +59 -0
  82. package/ai/token/providerCredentialLifecycleWriter.ts +44 -0
  83. package/ai/token/providerCredentialRegistry.ts +83 -0
  84. package/ai/token/providerCredentialRegistryCommand.ts +97 -0
  85. package/ai/token/providerCredentialRegistryList.ts +124 -0
  86. package/ai/token/providerCredentialRegistryResolver.ts +150 -0
  87. package/ai/token/providerCredentialRegistryWriter.ts +41 -0
  88. package/ai/token/providerCredentialRotationCommand.ts +102 -0
  89. package/ai/token/providerCredentialRuntime.ts +56 -0
  90. package/ai/token/providerDispatchIntent.ts +67 -0
  91. package/ai/token/providerDispatchIntentWriter.ts +36 -0
  92. package/ai/token/providerGateway.ts +260 -0
  93. package/ai/token/providerReconciliation.ts +148 -0
  94. package/ai/token/providerReconciliationLocal.ts +97 -0
  95. package/ai/token/providerReconciliationRunner.ts +165 -0
  96. package/ai/token/providerReconciliationWriter.ts +41 -0
  97. package/ai/token/ratingResult.ts +202 -0
  98. package/ai/token/ratingResultWriter.ts +33 -0
  99. package/ai/token/serverDialogProjection.ts +5 -3
  100. package/ai/token/serverTokenWriter.ts +11 -3
  101. package/ai/token/types.ts +10 -0
  102. package/ai/tools/agent/callAgentTool.ts +3 -4
  103. package/ai/tools/agent/presets/appBuilderPreset.ts +5 -7
  104. package/ai/tools/agent/runStreamingAgentTool.ts +1 -2
  105. package/ai/tools/agent/streamParallelAgentsTool.ts +2 -3
  106. package/ai/tools/readXPostTool.ts +1 -5
  107. package/app/admin/adminPages.ts +9 -0
  108. package/app/i18n/i18n.config.ts +5 -0
  109. package/app/i18n/translations/pricing.locale.ts +397 -0
  110. package/app/utils/desktopAgentRuntimeStatusClient.ts +5 -4
  111. package/app/utils/desktopAgentRuntimeTurnClient.ts +4 -1
  112. package/app/utils/imageUtils.ts +64 -34
  113. package/auth/adminPermissions.ts +18 -0
  114. package/auth/authSlice.ts +26 -12
  115. package/auth/hooks/useFetchUsers.ts +3 -0
  116. package/auth/routes.ts +46 -0
  117. package/auth/server/accessActivity.ts +4 -3
  118. package/auth/server/adminPermissions.ts +43 -0
  119. package/auth/server/adminUsageReport.ts +375 -0
  120. package/auth/server/billingAnomalies.ts +235 -0
  121. package/auth/server/billingUsageReport.ts +41 -2
  122. package/auth/server/creatorEarningCreditConversion.ts +10 -2
  123. package/auth/server/deduct.ts +14 -7
  124. package/auth/server/delete.ts +10 -2
  125. package/auth/server/disable.ts +4 -3
  126. package/auth/server/emailAutomation.ts +7 -5
  127. package/auth/server/emailDbConfig.ts +4 -2
  128. package/auth/server/emailDelivery.ts +24 -20
  129. package/auth/server/emailDeliveryGuards.ts +10 -7
  130. package/auth/server/emailPreferences.ts +6 -4
  131. package/auth/server/emailReport.ts +6 -4
  132. package/auth/server/emailRuntimeConfig.ts +3 -3
  133. package/auth/server/emailScenarioNotifications.ts +9 -8
  134. package/auth/server/enable.ts +4 -3
  135. package/auth/server/getRechargeHistory.ts +3 -2
  136. package/auth/server/getUser.ts +3 -2
  137. package/auth/server/gptProAccess.ts +44 -0
  138. package/auth/server/inviteReward.ts +10 -7
  139. package/auth/server/listusers.ts +6 -4
  140. package/auth/server/login.ts +2 -2
  141. package/auth/server/productEntitlements.ts +7 -4
  142. package/auth/server/productPurchase.ts +10 -2
  143. package/auth/server/providerBillingDrilldown.ts +47 -0
  144. package/auth/server/providerBillingHealth.ts +71 -0
  145. package/auth/server/providerCredentials.ts +136 -0
  146. package/auth/server/recharge.ts +14 -8
  147. package/auth/server/revokeSessions.ts +4 -3
  148. package/auth/server/route.ts +77 -0
  149. package/auth/server/sendEmail.ts +5 -4
  150. package/auth/server/signup.ts +10 -3
  151. package/auth/server/token.ts +53 -55
  152. package/auth/server/tokenUsageBilling.ts +18 -7
  153. package/auth/server/usageManagementAccess.ts +43 -0
  154. package/auth/server/usageReport.ts +59 -0
  155. package/auth/types.ts +12 -0
  156. package/auth/utils.ts +24 -22
  157. package/authCommands.ts +36 -2
  158. package/buildPublish.ts +3 -1
  159. package/buildPublishArtifactAssembly.ts +62 -1
  160. package/buildPublishImportAnalysis.ts +21 -16
  161. package/chat/dialog/dialogLaunchScope.ts +32 -0
  162. package/chat/dialog/objectAssistantRegistry.ts +2 -2
  163. package/chat/dialog/useCreateDialog.ts +1 -1
  164. package/chat/hooks/useChatInput.ts +41 -10
  165. package/chat/messages/messageSlice.ts +5 -1
  166. package/chat/messages/pendingAttachmentParts.ts +28 -2
  167. package/chat/messages/sendFirstMessage.ts +76 -79
  168. package/chat/messages/types.ts +9 -0
  169. package/chat/messages/web/streamingMarkdownModel.ts +41 -0
  170. package/chat/messages/web/useStreamingReveal.ts +91 -0
  171. package/chat/web/messageInputAgentUi.ts +94 -6
  172. package/cliEnvHelpers.ts +68 -13
  173. package/cliRuntimeDoctorReport.ts +193 -0
  174. package/client/agentConfigResolver.test.ts +0 -2
  175. package/client/agentRun.test.ts +171 -10
  176. package/client/agentRun.ts +44 -637
  177. package/client/agentRunInput.ts +10 -0
  178. package/client/agentRunLocalExecutor.ts +179 -0
  179. package/client/agentRunServerTransport.ts +394 -0
  180. package/client/agentRunTaskRunRecorder.ts +176 -0
  181. package/client/localRuntimeAdapter.test.ts +236 -9
  182. package/client/localRuntimeAdapter.ts +221 -23
  183. package/client/localToolPolicy.test.ts +28 -4
  184. package/connector-experimental/daemonLauncher.ts +38 -4
  185. package/connectorRunArtifact.ts +34 -10
  186. package/connectorWebSocketTarget.ts +40 -15
  187. package/core/builtinAgents.ts +155 -11
  188. package/create/space/contentLabels.ts +1 -1
  189. package/create/space/contentTypeMeta.ts +3 -2
  190. package/create/space/sidebarVisibleTypes.ts +27 -0
  191. package/create/space/space.locale.ts +76 -4
  192. package/database/actions/agentReadResolution.ts +2 -8
  193. package/database/actions/read.ts +11 -9
  194. package/database/actions/readAndWait.ts +10 -5
  195. package/database/server/agentDelegation.ts +3 -2
  196. package/database/server/authorityStoreConformance.ts +209 -0
  197. package/database/server/authorityStoreTypes.ts +31 -0
  198. package/database/server/coreDataProxy.ts +1 -1
  199. package/database/server/dataHandlers.ts +13 -5
  200. package/database/server/db.ts +15 -34
  201. package/database/server/delete.ts +88 -71
  202. package/database/server/emailRepository.ts +11 -9
  203. package/database/server/fileService.ts +2 -1
  204. package/database/server/legacyServerDb.ts +58 -0
  205. package/database/server/levelAuthorityStore.ts +75 -0
  206. package/database/server/memoryAuthorityStore.ts +133 -0
  207. package/database/server/patch.ts +13 -12
  208. package/database/server/query.ts +3 -2
  209. package/database/server/read.ts +33 -30
  210. package/database/server/resourceAccess.ts +7 -5
  211. package/database/server/serverStoreFactory.ts +124 -0
  212. package/database/server/spaceMemberAuthority.ts +3 -2
  213. package/database/server/storeBatchCompat.ts +37 -0
  214. package/database/server/testAuthorityStore.ts +76 -0
  215. package/database/server/write.ts +29 -27
  216. package/dialogReadCommands.ts +2 -1
  217. package/dialogStatusCommands.ts +2 -1
  218. package/integrations/anthropic/anthropicModels.ts +12 -12
  219. package/integrations/deepseek/models.ts +67 -67
  220. package/integrations/google/models.ts +111 -53
  221. package/integrations/openai/models.ts +22 -22
  222. package/integrations/xai/models.ts +1 -1
  223. package/localRuntimeDb.ts +39 -2
  224. package/machineCommandPrompts.ts +2 -0
  225. package/machineCommands.ts +193 -62
  226. package/machineStatusCommands.ts +4 -12
  227. package/machineWsRunDispatch.ts +80 -15
  228. package/machineWsSession.ts +46 -2
  229. package/noloReadBridgePrompt.ts +16 -0
  230. package/package.json +114 -21
  231. package/pageCreateCommands.ts +2 -2
  232. package/pageDeleteCommands.ts +3 -3
  233. package/pageReadCommands.ts +3 -3
  234. package/pageUpdateCommands.ts +3 -3
  235. package/render/layout/mainLayoutViewMode.ts +25 -0
  236. package/render/page/server/createPage.ts +3 -1
  237. package/render/page/server/handleCreatePage.ts +2 -11
  238. package/runtimeDoctorCommands.ts +18 -69
  239. package/server/api/methods.ts +34 -12
  240. package/server/api/tableHandlers.ts +6 -3
  241. package/server/authenticateToken.ts +47 -2
  242. package/server/billingLedgerRoutes.ts +15 -0
  243. package/server/buildManifest.ts +54 -0
  244. package/server/coreReadiness.ts +34 -25
  245. package/server/coreRuntime.ts +15 -10
  246. package/server/handlers/activityStatsHandler.ts +5 -2
  247. package/server/handlers/agentEmailRegistrationE2EHandler.ts +25 -23
  248. package/server/handlers/agentRun/agentLookup.ts +1 -7
  249. package/server/handlers/agentRun/autonomousRuntime.ts +11 -10
  250. package/server/handlers/agentRun/builtinAgents.ts +12 -88
  251. package/server/handlers/agentRun/continueDialogContext.ts +15 -3
  252. package/server/handlers/agentRun/{inheritedDialogPrompt.ts → conversationReference.ts} +3 -3
  253. package/server/handlers/agentRun/dialogLookup.ts +4 -3
  254. package/server/handlers/agentRun/index.ts +864 -404
  255. package/server/handlers/agentRun/localRuntimeBootstrap.ts +17 -1
  256. package/server/handlers/agentRun/loop.ts +920 -508
  257. package/server/handlers/agentRun/machineConnector.ts +56 -8
  258. package/server/handlers/agentRun/machineRunAudit.ts +3 -2
  259. package/server/handlers/agentRun/modelUsageToolHandlers.ts +13 -10
  260. package/server/handlers/agentRun/requestContext.ts +12 -8
  261. package/server/handlers/agentRun/runtimeExecutionContext.ts +15 -3
  262. package/server/handlers/agentRun/runtimePreparation.ts +26 -24
  263. package/server/handlers/agentRun/runtimeRouting.ts +25 -40
  264. package/server/handlers/agentRun/runtimeSystemMessages.ts +65 -0
  265. package/server/handlers/agentRun/saveDialog.ts +97 -87
  266. package/server/handlers/agentRun/taskRunToolHandler.ts +9 -7
  267. package/server/handlers/agentRun/toolExecutor.ts +42 -78
  268. package/server/handlers/agentRun/types.ts +2 -1
  269. package/server/handlers/appDeployStatusStore.ts +17 -10
  270. package/server/handlers/appDomainHandler.ts +21 -15
  271. package/server/handlers/appLegacyInfraCleanup.ts +5 -2
  272. package/server/handlers/appSandboxHandler.ts +29 -8
  273. package/server/handlers/appSpaceAccess.ts +15 -8
  274. package/server/handlers/chatHandler.ts +22 -2
  275. package/server/handlers/chatUpstreamRetry.ts +225 -2
  276. package/server/handlers/connector/connectorConnectionRegistry.ts +55 -7
  277. package/server/handlers/connector/connectorWebSocket.ts +14 -10
  278. package/server/handlers/desktopAgentRuntimeAdapter.ts +4 -4
  279. package/server/handlers/desktopAgentRuntimeHostCapabilities.ts +25 -0
  280. package/server/handlers/desktopAgentRuntimeReadiness.ts +62 -0
  281. package/server/handlers/desktopAgentRuntimeStatusHandler.ts +38 -30
  282. package/server/handlers/desktopAgentRuntimeTurnHandler.ts +7 -3
  283. package/server/handlers/desktopAgentRuntimeTurnService.ts +39 -45
  284. package/server/handlers/desktopLlamaRuntimeHandler.ts +85 -51
  285. package/server/handlers/desktopUpdaterHandler.ts +132 -24
  286. package/server/handlers/favoriteHandlers.ts +8 -2
  287. package/server/handlers/getDialogBillingHandler.ts +4 -3
  288. package/server/handlers/getTransactionsHandler.ts +5 -2
  289. package/server/handlers/machines/machineBinding.ts +1 -0
  290. package/server/handlers/machines/machineHandlers.ts +0 -14
  291. package/server/handlers/machines/machineInstallAssets.ts +4 -2
  292. package/server/handlers/notificationEmitter.ts +5 -3
  293. package/server/handlers/notificationsHandler.ts +5 -2
  294. package/server/handlers/providerCallsRecentHandler.ts +234 -0
  295. package/server/handlers/providerReconciliationRunHandler.ts +180 -0
  296. package/server/handlers/providerRequestIdsHandler.ts +105 -0
  297. package/server/handlers/tableAccess.ts +6 -2
  298. package/server/handlers/tableToolHandlers.ts +28 -14
  299. package/server/handlers/userSecretsHandler.ts +17 -6
  300. package/server/handlers/versionHandler.ts +9 -4
  301. package/server/handlers/versionStore.ts +18 -10
  302. package/server/html/ssrPreload.ts +5 -3
  303. package/server/payments/crypto/cryptoUsdcBasePaymentProvider.ts +11 -8
  304. package/server/payments/crypto/cryptoUsdcBaseScanner.ts +12 -7
  305. package/server/payments/crypto/cryptoUsdtTronPaymentProvider.ts +11 -8
  306. package/server/payments/crypto/cryptoUsdtTronScanner.ts +9 -7
  307. package/server/payments/waffo/waffoPaymentProvider.ts +12 -9
  308. package/server/runtimeRole.ts +15 -0
  309. package/server/scheduler/scheduledTaskRuntime.ts +4 -2
  310. package/server/scheduler/schedulerService.ts +2 -2
  311. package/server/taskRunBridgeRoutes.ts +8 -5
  312. package/share/server/fetchCommunityShares.ts +1 -1
  313. package/share/server/helpers.ts +19 -17
  314. package/share/server/importShare.ts +9 -13
  315. package/share/server/listCommunityShares.ts +4 -4
  316. package/share/server/purchaseDoc.ts +8 -16
  317. package/share/server/readCommunityShareCover.ts +3 -2
  318. package/share/server/readSharedTable.ts +14 -13
  319. package/share/server/tableReplication.ts +42 -39
  320. package/spaceAttachCommands.ts +135 -0
  321. package/spaceCategoryCommands.ts +6 -6
  322. package/spaceCommands.ts +3 -3
  323. package/spaceDeleteCommands.ts +2 -2
  324. package/spaceInternalCommandEntries.ts +2 -0
  325. package/spaceReadCommands.ts +3 -3
  326. package/tableMetaCommands.ts +2 -2
  327. package/taskRunCommand.ts +11 -0
  328. package/ai/agent/runtimeServerBase.ts +0 -37
  329. package/server/handlers/desktopAgentRuntimeHostFacts.ts +0 -40
@@ -1,4 +1,6 @@
1
1
  import { runLocalAgentTurn, type LocalAgentToolEvent } from "./agent-runtime/localLoop";
2
+ import { resolveHostRuntimeConfigFromEnv } from "./agent-runtime/hostRuntimeConfig";
3
+ import { normalizeAgentRunDialogLineage } from "./ai/agent/agentRunDialogLineage";
2
4
  import {
3
5
  assertMachineRunAllowed as defaultAssertMachineRunAllowed,
4
6
  resolveMachineRunPermissionPolicy as defaultResolveMachineRunPermissionPolicy,
@@ -118,6 +120,24 @@ function requestsLocalWorkspaceRuntime(policy?: ConnectorRuntimePolicy) {
118
120
  );
119
121
  }
120
122
 
123
+ function isMachineBoundLocalCustomProvider(agentConfig: any) {
124
+ const machineId =
125
+ isRecord(agentConfig?.runtimeBinding) && typeof agentConfig.runtimeBinding.machineId === "string"
126
+ ? agentConfig.runtimeBinding.machineId.trim()
127
+ : "";
128
+ const providerUrl =
129
+ typeof agentConfig?.customProviderUrl === "string"
130
+ ? agentConfig.customProviderUrl.trim()
131
+ : "";
132
+ if (!machineId || !providerUrl) return false;
133
+ try {
134
+ const hostname = new URL(providerUrl).hostname.toLowerCase();
135
+ return hostname === "127.0.0.1" || hostname === "localhost" || hostname === "::1";
136
+ } catch {
137
+ return false;
138
+ }
139
+ }
140
+
121
141
  function hasExplicitMachinePermissions(agentConfig: any) {
122
142
  const runtimeBinding = isRecord(agentConfig?.runtimeBinding) ? agentConfig.runtimeBinding : {};
123
143
  return Boolean(
@@ -130,6 +150,7 @@ function hasExplicitMachinePermissions(agentConfig: any) {
130
150
 
131
151
  function runtimeWorkspacePermissionPolicy(
132
152
  runtimePolicy: ConnectorRuntimePolicy | undefined,
153
+ hostRuntimeConfig: { capabilities: { allowShell: boolean } },
133
154
  cwd: string
134
155
  ): PermissionPolicy | null {
135
156
  if (!requestsTaskWorktree(runtimePolicy)) return null;
@@ -137,7 +158,10 @@ function runtimeWorkspacePermissionPolicy(
137
158
  mode: "full_access",
138
159
  allowFilesystemRead: true,
139
160
  allowFilesystemWrite: true,
140
- allowShell: runtimePolicy?.shell?.enabled !== false,
161
+ allowShell:
162
+ hostRuntimeConfig.capabilities.allowShell &&
163
+ Array.isArray(runtimePolicy?.runtimeTools) &&
164
+ runtimePolicy.runtimeTools.includes("execShell"),
141
165
  writableRoots: [cwd],
142
166
  };
143
167
  }
@@ -175,13 +199,20 @@ function mergeToolNames(...values: unknown[]) {
175
199
  function localRuntimeEnvFromPolicy(runtimeEnv: EnvLike, policy?: ConnectorRuntimePolicy): EnvLike {
176
200
  return {
177
201
  ...runtimeEnv,
178
- ...(policy?.shell?.enabled && policy.shell.mode === "worktree"
179
- ? { NOLO_LOCAL_SHELL_MODE: "worktree" }
180
- : {}),
181
202
  ...(policy?.workspace?.cwd ? { NOLO_LOCAL_WORKTREE: policy.workspace.cwd } : {}),
182
203
  };
183
204
  }
184
205
 
206
+ function forwardedUserAuthToken(parsed: any): string {
207
+ const value = parsed?.payload?.meta?.userAuthToken;
208
+ return typeof value === "string" ? value.trim() : "";
209
+ }
210
+
211
+ function withForwardedUserAuthToken(runtimeEnv: EnvLike, parsed: any): EnvLike {
212
+ const userAuthToken = forwardedUserAuthToken(parsed);
213
+ return userAuthToken ? { ...runtimeEnv, AUTH_TOKEN: userAuthToken } : runtimeEnv;
214
+ }
215
+
185
216
  function runtimeWorkspaceRootFromTrace(trace: unknown): string | undefined {
186
217
  if (!Array.isArray(trace)) return undefined;
187
218
  for (const message of trace) {
@@ -241,6 +272,12 @@ async function defaultRunConnectorLocalRuntimeAgent(args: {
241
272
  ? args.parsed.payload.agentConfig
242
273
  : {};
243
274
  const policy = runtimePolicyFromConnectorPayload(args.parsed);
275
+ const wantsTaskWorktree = requestsTaskWorktree(policy);
276
+ const hostRuntimeConfig = resolveHostRuntimeConfigFromEnv({
277
+ env: args.runtimeEnv,
278
+ surface: "connector-local",
279
+ workspaceBinding: wantsTaskWorktree ? "default-cwd" : "explicit-cwd",
280
+ });
244
281
  const agentRecord = {
245
282
  ...payloadAgentConfig,
246
283
  dbKey: agentKey,
@@ -262,12 +299,14 @@ async function defaultRunConnectorLocalRuntimeAgent(args: {
262
299
  [`agent-${args.runtimeEnv.NOLO_USER_ID || "local"}-${agentKey}`, agentRecord],
263
300
  [`agent-${args.runtimeEnv.NOLO_LOCAL_USER_ID || args.runtimeEnv.NOLO_USER_ID || "local"}-${agentKey}`, agentRecord],
264
301
  ]);
265
- const env = localRuntimeEnvFromPolicy(args.runtimeEnv, policy);
266
- const wantsTaskWorktree = requestsTaskWorktree(policy);
302
+ const env = localRuntimeEnvFromPolicy(
303
+ withForwardedUserAuthToken(args.runtimeEnv, args.parsed),
304
+ policy
305
+ );
267
306
  const adapter = createCliLocalRuntimeAdapter({
268
307
  env,
308
+ hostRuntimeConfig,
269
309
  cwd: args.cwd,
270
- useCwdAsTaskWorkspaceBase: wantsTaskWorktree,
271
310
  ...(wantsTaskWorktree
272
311
  ? {
273
312
  prepareTaskWorktree: (input) => prepareTaskWorktree({
@@ -350,6 +389,20 @@ function normalizeConnectorRunTimeoutMs(value: unknown): number | undefined {
350
389
  return Math.floor(value);
351
390
  }
352
391
 
392
+ function normalizeConnectorRunPayloadContinueDialogId(payload: unknown) {
393
+ if (!isRecord(payload)) return payload;
394
+ const dialogLineage = normalizeAgentRunDialogLineage({
395
+ continueDialogId: payload.continueDialogId,
396
+ });
397
+ const normalizedPayload = { ...payload };
398
+ if (dialogLineage.continueDialogId) {
399
+ normalizedPayload.continueDialogId = dialogLineage.continueDialogId;
400
+ } else {
401
+ delete normalizedPayload.continueDialogId;
402
+ }
403
+ return normalizedPayload;
404
+ }
405
+
353
406
  export async function handleConnectorRunMessage(
354
407
  message: string,
355
408
  send: (message: string) => void,
@@ -365,6 +418,12 @@ export async function handleConnectorRunMessage(
365
418
  return;
366
419
  }
367
420
  if (parsed?.type !== "agent.run" || typeof parsed.requestId !== "string") return;
421
+ if (isRecord(parsed)) {
422
+ parsed = {
423
+ ...parsed,
424
+ payload: normalizeConnectorRunPayloadContinueDialogId(parsed.payload),
425
+ };
426
+ }
368
427
  const agentConfig = parsed.payload?.agentConfig ?? {};
369
428
  const sendProgress = (progress: ConnectorRunProgress) => {
370
429
  send(JSON.stringify({
@@ -392,6 +451,11 @@ export async function handleConnectorRunMessage(
392
451
  try {
393
452
  const machinePermissionPolicy = resolveMachineRunPermissionPolicy(agentConfig);
394
453
  const runtimePolicy = runtimePolicyFromConnectorPayload(parsed);
454
+ const hostRuntimeConfig = resolveHostRuntimeConfigFromEnv({
455
+ env: runtimeEnv,
456
+ surface: agentConfig.apiSource === "cli" ? "connector-cli" : "connector-local",
457
+ workspaceBinding: requestsTaskWorktree(runtimePolicy) ? "default-cwd" : "explicit-cwd",
458
+ });
395
459
  const userInput = String(parsed.payload?.userInput ?? "");
396
460
  const timeout = normalizeConnectorRunTimeoutMs(parsed.payload?.timeoutMs);
397
461
  let cwd = resolveConnectorRunCwd({ env: runtimeEnv, policy: machinePermissionPolicy });
@@ -414,7 +478,7 @@ export async function handleConnectorRunMessage(
414
478
  artifactCwd = prepared.path;
415
479
  }
416
480
  const runtimePermissionPolicy = !hasExplicitMachinePermissions(agentConfig)
417
- ? runtimeWorkspacePermissionPolicy(runtimePolicy, cwd)
481
+ ? runtimeWorkspacePermissionPolicy(runtimePolicy, hostRuntimeConfig, cwd)
418
482
  : null;
419
483
  const effectivePermissionPolicy = scopePermissionPolicyToRuntimeWorkspace(
420
484
  runtimePermissionPolicy ?? machinePermissionPolicy,
@@ -472,17 +536,18 @@ export async function handleConnectorRunMessage(
472
536
  updatedAt: Date.now(),
473
537
  });
474
538
  }, 15_000);
539
+ const effectiveRuntimeEnv = withForwardedUserAuthToken(runtimeEnv, parsed);
475
540
  const result = await executeCli(provider, materializedPrompt.prompt, {
476
541
  model: agentConfig.model || undefined,
477
542
  timeout,
478
543
  cwd,
479
544
  yolo: true,
480
545
  env: {
481
- NOLO_SERVER: runtimeEnv.NOLO_SERVER || runtimeEnv.NOLO_SERVER_URL || runtimeEnv.BASE_URL,
482
- NOLO_SERVER_URL: runtimeEnv.NOLO_SERVER_URL || runtimeEnv.NOLO_SERVER || runtimeEnv.BASE_URL,
483
- BASE_URL: runtimeEnv.BASE_URL || runtimeEnv.NOLO_SERVER || runtimeEnv.NOLO_SERVER_URL,
484
- AUTH_TOKEN: runtimeEnv.AUTH_TOKEN || runtimeEnv.AUTH || runtimeEnv.NOLO_MACHINE_API_KEY,
485
- NOLO_MACHINE_API_KEY: runtimeEnv.NOLO_MACHINE_API_KEY || runtimeEnv.AUTH_TOKEN || runtimeEnv.AUTH,
546
+ NOLO_SERVER: effectiveRuntimeEnv.NOLO_SERVER || effectiveRuntimeEnv.NOLO_SERVER_URL || effectiveRuntimeEnv.BASE_URL,
547
+ NOLO_SERVER_URL: effectiveRuntimeEnv.NOLO_SERVER_URL || effectiveRuntimeEnv.NOLO_SERVER || effectiveRuntimeEnv.BASE_URL,
548
+ BASE_URL: effectiveRuntimeEnv.BASE_URL || effectiveRuntimeEnv.NOLO_SERVER || effectiveRuntimeEnv.NOLO_SERVER_URL,
549
+ AUTH_TOKEN: effectiveRuntimeEnv.AUTH_TOKEN || effectiveRuntimeEnv.AUTH || effectiveRuntimeEnv.NOLO_MACHINE_API_KEY,
550
+ NOLO_MACHINE_API_KEY: effectiveRuntimeEnv.NOLO_MACHINE_API_KEY || effectiveRuntimeEnv.AUTH_TOKEN || effectiveRuntimeEnv.AUTH,
486
551
  },
487
552
  }).finally(() => clearInterval(heartbeat));
488
553
  logConnectorRun("agent.run.cli.result", {
@@ -518,13 +583,13 @@ export async function handleConnectorRunMessage(
518
583
  }));
519
584
  return;
520
585
  }
521
- if (!requestsLocalWorkspaceRuntime(runtimePolicy)) {
586
+ if (!requestsLocalWorkspaceRuntime(runtimePolicy) && !isMachineBoundLocalCustomProvider(agentConfig)) {
522
587
  throw new Error("Connector can only execute non-CLI agents when runtimeToolPolicySnapshot requests a local workspace runtime.");
523
588
  }
524
589
  baseSha = await readConnectorGitHead(cwd);
525
590
  const result = await runConnectorLocalRuntimeAgent({
526
591
  parsed,
527
- runtimeEnv,
592
+ runtimeEnv: withForwardedUserAuthToken(runtimeEnv, parsed),
528
593
  cwd,
529
594
  fetchImpl,
530
595
  onProgress: sendProgress,
@@ -1,5 +1,6 @@
1
1
  import type { HeartbeatLoopOptions } from "./connector-experimental/heartbeatLoop";
2
2
  import type { MachineHeartbeat } from "./connector-experimental/protocol";
3
+ import { isConnectorWebSocketAuthError } from "./connectorWebSocketTarget";
3
4
 
4
5
  type EnvLike = Record<string, string | undefined>;
5
6
  type OutputLike = { write(chunk: string): unknown };
@@ -8,6 +9,7 @@ export type ConnectorWebSocketOptions = {
8
9
  headers: Record<string, string>;
9
10
  onMessage: (message: string) => void | Promise<void>;
10
11
  sentMessages: string[];
12
+ signal?: AbortSignal;
11
13
  };
12
14
 
13
15
  const CONNECTOR_WS_KEEPALIVE_MS = 25_000;
@@ -34,6 +36,7 @@ export async function defaultConnectWebSocket(
34
36
  headers: options.headers,
35
37
  } as any);
36
38
  let opened = false;
39
+ let aborted = options.signal?.aborted ?? false;
37
40
  let keepalive: ReturnType<typeof setInterval> | null = null;
38
41
  const clearKeepalive = () => {
39
42
  if (keepalive) {
@@ -41,6 +44,16 @@ export async function defaultConnectWebSocket(
41
44
  keepalive = null;
42
45
  }
43
46
  };
47
+ const handleAbort = () => {
48
+ aborted = true;
49
+ clearKeepalive();
50
+ try {
51
+ ws.close();
52
+ } catch {
53
+ resolve();
54
+ }
55
+ };
56
+ options.signal?.addEventListener("abort", handleAbort, { once: true });
44
57
  ws.addEventListener(
45
58
  "open",
46
59
  () => {
@@ -57,13 +70,17 @@ export async function defaultConnectWebSocket(
57
70
  );
58
71
  ws.addEventListener("error", () => {
59
72
  clearKeepalive();
73
+ if (aborted) {
74
+ resolve();
75
+ return;
76
+ }
60
77
  reject(new Error("connector websocket failed"));
61
78
  });
62
79
  ws.addEventListener(
63
80
  "close",
64
81
  () => {
65
82
  clearKeepalive();
66
- if (opened) resolve();
83
+ if (opened || aborted) resolve();
67
84
  else reject(new Error("connector websocket closed before opening"));
68
85
  },
69
86
  { once: true },
@@ -87,11 +104,13 @@ export async function runMachineWsSession(options: {
87
104
  machine: MachineHeartbeat;
88
105
  serverUrl: string;
89
106
  authToken: string;
107
+ signal?: AbortSignal;
90
108
  sendHeartbeat: () => Promise<void>;
91
109
  runHeartbeatLoop: (options: HeartbeatLoopOptions) => Promise<void>;
92
110
  resolveConnectorWebSocketTarget: (args: {
93
111
  serverUrl: string;
94
112
  machineId: string;
113
+ connectorSurface?: string;
95
114
  headers: Record<string, string>;
96
115
  }) => Promise<string>;
97
116
  connectWebSocket: (url: string, options: ConnectorWebSocketOptions) => Promise<void>;
@@ -102,6 +121,9 @@ export async function runMachineWsSession(options: {
102
121
  let heartbeatLoopPromise: Promise<void> | null = null;
103
122
  let websocketPromise: Promise<void> | null = null;
104
123
  try {
124
+ if (options.signal?.aborted) {
125
+ return 0;
126
+ }
105
127
  await options.sendHeartbeat();
106
128
  options.output.write(
107
129
  `Connector websocket connected: ${options.machine.name} (${options.machine.machineId})\n`
@@ -119,25 +141,47 @@ export async function runMachineWsSession(options: {
119
141
  const wsTarget = await options.resolveConnectorWebSocketTarget({
120
142
  serverUrl: options.serverUrl,
121
143
  machineId: options.machine.machineId,
144
+ connectorSurface: "cli",
122
145
  headers: { Authorization: `Bearer ${options.authToken}` },
123
146
  });
124
147
  websocketPromise = options.connectWebSocket(wsTarget, {
125
148
  headers: { Authorization: `Bearer ${options.authToken}` },
149
+ signal: options.signal,
126
150
  sentMessages,
127
151
  onMessage: (message) =>
128
152
  options.onMessage(message, (response) => {
129
153
  sentMessages.push(response);
130
154
  }),
131
155
  });
132
- await Promise.race([websocketPromise, heartbeatMonitorPromise]);
156
+ const abortPromise = options.signal
157
+ ? new Promise<"aborted">((resolve) => {
158
+ if (options.signal?.aborted) {
159
+ resolve("aborted");
160
+ return;
161
+ }
162
+ options.signal?.addEventListener("abort", () => resolve("aborted"), { once: true });
163
+ })
164
+ : null;
165
+ const raceResult = await Promise.race(
166
+ [websocketPromise, heartbeatMonitorPromise, abortPromise].filter(Boolean) as Promise<void | "aborted">[]
167
+ );
133
168
  heartbeatAbort.abort();
134
169
  await Promise.allSettled([websocketPromise, heartbeatLoopPromise]);
170
+ if (raceResult === "aborted") {
171
+ return 0;
172
+ }
135
173
  return 0;
136
174
  } catch (error) {
137
175
  heartbeatAbort.abort();
138
176
  await Promise.allSettled(
139
177
  [websocketPromise, heartbeatLoopPromise].filter(Boolean) as Promise<void>[],
140
178
  );
179
+ if (isConnectorWebSocketAuthError(error)) {
180
+ options.output.write(
181
+ `[nolo] Connector websocket auth failed: ${error.message}. Re-register this machine or update NOLO_MACHINE_API_KEY.\n`
182
+ );
183
+ return 2;
184
+ }
141
185
  options.output.write(
142
186
  `[nolo] Connector websocket failed: ${
143
187
  error instanceof Error ? error.message : String(error)
@@ -0,0 +1,16 @@
1
+ const REPO_CLI_PREFIX = "bun packages/cli/index.ts";
2
+
3
+ export function buildNoloReadOnlyBridgePrompt() {
4
+ return [
5
+ "--- Nolo read-only CLI bridge ---",
6
+ "This CLI runtime does not receive server-side function tools directly.",
7
+ "Use these repo-local read commands to fetch authoritative Nolo docs and records on demand instead of trusting prompt snapshots or summaries alone.",
8
+ "Run commands from the repository root. The runner already provides server URL and auth in the environment.",
9
+ `Read doc/page truth: ${REPO_CLI_PREFIX} doc read "<pageKey>"`,
10
+ `Read skill doc truth: ${REPO_CLI_PREFIX} skill-doc read "<pageKey>"`,
11
+ `Read dialog truth: ${REPO_CLI_PREFIX} dialog read "<dialogId|dialogUrl>"`,
12
+ `Read shared space truth: ${REPO_CLI_PREFIX} space read "<spaceId|spaceKey|spaceUrl>"`,
13
+ `Read agent truth: ${REPO_CLI_PREFIX} agent read "<agentKey|agentAlias|agentUrl>"`,
14
+ "If a read command fails, report the exact command and error.",
15
+ ].join("\n");
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nolo-cli",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "type": "module",
5
5
  "description": "Agent-first terminal workspace for Nolo",
6
6
  "bin": {
@@ -97,11 +97,104 @@
97
97
  "runtimeModeArgs.ts",
98
98
  "tableCommands.ts",
99
99
  "updateCommands.ts",
100
- "client/**/*.ts",
101
- "tui/**/*.ts",
100
+ "client/compactDialog.test.ts",
101
+ "client/localAgentRecords.test.ts",
102
+ "client/localRuntimeDryRun.test.ts",
103
+ "client/agentRunTaskRunRecorder.ts",
104
+ "client/workspaceSession.test.ts",
105
+ "client/localProviderResolver.test.ts",
106
+ "client/localDialogRecords.ts",
107
+ "client/agentRunLocalExecutor.ts",
108
+ "client/localDialogRecords.test.ts",
109
+ "client/profileConfig.test.ts",
110
+ "client/profileConfig.ts",
111
+ "client/agentRunRuntimeSelection.ts",
112
+ "client/localAgentRecords.ts",
113
+ "client/taskWorktree.ts",
114
+ "client/localToolPolicy.test.ts",
115
+ "client/streamingOutput.test.ts",
116
+ "client/streamingOutput.ts",
117
+ "client/localToolPolicy.ts",
118
+ "client/compactDialog.ts",
119
+ "client/hybridRecordStore.test.ts",
120
+ "client/agentRun.ts",
121
+ "client/localRuntimeAdapter.test.ts",
122
+ "client/agentRunRuntimeSelection.test.ts",
123
+ "client/agentRunLocalExecution.test.ts",
124
+ "client/agentRunInput.ts",
125
+ "client/localProviderResolver.ts",
126
+ "client/taskRunPrompt.ts",
127
+ "client/hybridRecordStore.ts",
128
+ "client/agentConfigResolver.test.ts",
129
+ "client/agentRunServerTransport.ts",
130
+ "client/workspaceSession.ts",
131
+ "client/agentRun.test.ts",
132
+ "client/agentConfigResolver.ts",
133
+ "client/agentRunLocalExecution.ts",
134
+ "client/localRuntimeAdapter.ts",
135
+ "tui/tuiPresentation.ts",
136
+ "tui/readlineWorkspace.ts",
137
+ "tui/session.ts",
138
+ "tui/tuiPresentation.test.ts",
139
+ "tui/tuiCommandInterpreter.test.ts",
140
+ "tui/tuiCommandInterpreter.ts",
141
+ "tui/tuiCatalog.ts",
102
142
  "README.md",
103
- "ai/**/*.ts",
104
- "connector-experimental/**/*.ts",
143
+ "ai/agent.ts",
144
+ "ai/tools/agent/taskRunTool.ts",
145
+ "ai/agent/cliExecutor.ts",
146
+ "ai/agent/agentSlice.ts",
147
+ "ai/agent/machineRunPermissions.ts",
148
+ "ai/agent/agentRunDialogLineage.ts",
149
+ "ai/agent/cliPrompt.ts",
150
+ "ai/index.ts",
151
+ "connector-experimental/protocol.ts",
152
+ "connector-experimental/machineInfo.ts",
153
+ "../agent-runtime/index.ts",
154
+ "../ai/tools/agent/taskRunTool.ts",
155
+ "../ai/agent/cliExecutor.ts",
156
+ "../ai/agent/cliPrompt.ts",
157
+ "../agent-runtime/hostAdapter.ts",
158
+ "../agent-runtime/localLoop.ts",
159
+ "../agent-runtime/agentConfigOptions.ts",
160
+ "../agent-runtime/openAiCompatibleProvider.ts",
161
+ "../agent-runtime/openAiCompatibleProviderConfig.ts",
162
+ "../agent-runtime/platformChatProvider.ts",
163
+ "../agent-runtime/runtimeDecision.ts",
164
+ "../agent-runtime/runtimeFacts.ts",
165
+ "../agent-runtime/agentRecordKeys.ts",
166
+ "../agent-runtime/agentRecordConfig.ts",
167
+ "../agent-runtime/dialogMessageRecord.ts",
168
+ "../agent-runtime/dialogStatus.ts",
169
+ "../agent-runtime/dialogWritePlan.ts",
170
+ "../agent-runtime/hybridRecordStore.ts",
171
+ "../agent-runtime/workspaceSession.ts",
172
+ "../agent-runtime/taskWorkspace.ts",
173
+ "../agent-runtime/hostRuntimeConfig.ts",
174
+ "../agent-runtime/localToolPolicy.ts",
175
+ "../agent-runtime/runtimeToolPolicy.ts",
176
+ "../agent-runtime/localWorkspaceTools.ts",
177
+ "../agent-runtime/types.ts",
178
+ "../database/config.ts",
179
+ "../app/types.ts",
180
+ "../create/space/spaceKeys.ts",
181
+ "spaceAttachCommands.ts",
182
+ "cliRuntimeDoctorReport.ts",
183
+ "../ai/agent/agentRunDialogLineage.ts",
184
+ "../ai/agent/machineRunPermissions.ts",
185
+ "noloReadBridgePrompt.ts",
186
+ "../chat/messages/fetchMessages.ts",
187
+ "../chat/messages/types.ts",
188
+ "../database/server/dbPath.ts",
189
+ "../database/server/db.ts",
190
+ "../database/server/ensureDbOpen.ts",
191
+ "../database/server/legacyServerDb.ts",
192
+ "../database/server/authorityStoreTypes.ts",
193
+ "../database/server/serverStoreFactory.ts",
194
+ "../database/server/levelAuthorityStore.ts",
195
+ "../database/server/memoryAuthorityStore.ts",
196
+ "../database/keys.ts",
197
+ "../database/utils/ulid.ts",
105
198
  "agent-runtime/**/*.ts",
106
199
  "connector-experimental/**/*.ts",
107
200
  "app/**/*.ts",
@@ -110,10 +203,10 @@
110
203
  "ai/**/*.ts",
111
204
  "chat/**/*.ts",
112
205
  "render/**/*.ts",
113
- "core/**/*.ts",
206
+ "share/**/*.ts",
114
207
  "auth/**/*.ts",
115
208
  "life/**/*.ts",
116
- "share/**/*.ts",
209
+ "core/**/*.ts",
117
210
  "server/**/*.ts",
118
211
  "integrations/**/*.ts"
119
212
  ],
@@ -136,24 +229,23 @@
136
229
  "tweetnacl": "^1.0.3",
137
230
  "@reduxjs/toolkit": "^2.5.0",
138
231
  "react-redux": "^9.2.0",
139
- "react-hot-toast": "^2.4.1",
140
232
  "react": "^19.2.1",
141
- "browser-image-compression": "^2.0.2",
233
+ "react-hot-toast": "^2.4.1",
142
234
  "react-i18next": "^14.1.2",
143
235
  "i18next": "^23.11.5",
144
- "ulid": "^2.3.0",
236
+ "browser-image-compression": "^2.0.2",
145
237
  "pino": "^9.9.0",
238
+ "ulid": "^2.3.0",
146
239
  "slate": "^0.112.0",
240
+ "slate-react": "^0.112.1",
241
+ "pdfjs-dist": "^5.2.133",
242
+ "slate-history": "^0.113.1",
147
243
  "mdast-util-from-markdown": "^2.0.2",
148
244
  "mdast-util-gfm": "^3.0.0",
149
245
  "micromark-extension-gfm": "^3.0.0",
150
- "slate-history": "^0.113.1",
151
- "slate-react": "^0.112.1",
152
- "pdfjs-dist": "^5.2.133",
153
- "rambda": "^8.6.0",
154
- "react-native-blob-util": "^0.24.7",
155
246
  "@react-native-community/netinfo": "^11.5.0",
156
- "react-native-sse": "^1.2.1",
247
+ "react-native-blob-util": "^0.24.7",
248
+ "rambda": "^8.6.0",
157
249
  "@lobehub/icons": "^5.0.1",
158
250
  "pizzip": "^3.2.0",
159
251
  "docxtemplater": "^3.67.5",
@@ -161,16 +253,17 @@
161
253
  "zod": "^3.25.20",
162
254
  "react-hook-form": "^7.51.5",
163
255
  "@hookform/resolvers": "^3.3.2",
256
+ "react-native-sse": "^1.2.1",
257
+ "xlsx": "^0.18.5",
164
258
  "react-router-dom": "^6.23.1",
165
259
  "croner": "^8.0.1",
166
- "xlsx": "^0.18.5",
167
260
  "mermaid": "^11.6.0",
168
- "js-base64": "^3.7.7",
169
261
  "react-native-keychain": "^9.2.2",
170
262
  "async-mutex": "^0.5.0",
171
- "diff": "^8.0.2",
263
+ "js-base64": "^3.7.7",
172
264
  "react-dom": "^19.2.1",
173
- "@waffo/pancake-ts": "^0.5.2",
174
- "playwright": "^1.59.1"
265
+ "diff": "^8.0.2",
266
+ "playwright": "^1.59.1",
267
+ "@waffo/pancake-ts": "^0.5.2"
175
268
  }
176
269
  }
@@ -66,7 +66,7 @@ async function runBasePageCreateCommand(
66
66
  return 1;
67
67
  }
68
68
 
69
- const authToken = resolveAuthToken(env);
69
+ const authToken = resolveAuthToken(args, env);
70
70
  const userId = parseUserIdFromAuthToken(authToken);
71
71
  if (!authToken || !userId) {
72
72
  output.write(`[nolo] ${mode} create requires an auth token with userId. Run \`nolo login\`.\n`);
@@ -82,7 +82,7 @@ async function runBasePageCreateCommand(
82
82
  return 1;
83
83
  }
84
84
 
85
- const serverUrl = resolveServerUrl(env);
85
+ const serverUrl = resolveServerUrl(args, env);
86
86
  const db = deps.db ?? await getReadableCliDb(output);
87
87
  const fetchImpl = deps.fetchImpl ?? fetch;
88
88
  const fallbackFetchImpl = deps.fallbackFetchImpl;
@@ -54,7 +54,7 @@ export async function runBasePageDeleteCommand(
54
54
  return dbKey ? 0 : 1;
55
55
  }
56
56
 
57
- const authToken = resolveAuthToken(env);
57
+ const authToken = resolveAuthToken(args, env);
58
58
  const userId = parseUserIdFromAuthToken(authToken);
59
59
  if (!authToken || !userId) {
60
60
  output.write(`[nolo] ${mode} delete requires an auth token with userId. Run \`nolo login\`.\n`);
@@ -64,8 +64,8 @@ export async function runBasePageDeleteCommand(
64
64
  const db = deps.db ?? await getReadableCliDb(output);
65
65
  const fetchImpl = deps.fetchImpl ?? fetch;
66
66
  const fallbackFetchImpl = deps.fallbackFetchImpl;
67
- const defaultServerUrl = resolveServerUrl(env);
68
- const serverCandidates = resolveServerCandidates(env, defaultServerUrl);
67
+ const defaultServerUrl = resolveServerUrl(args, env);
68
+ const serverCandidates = resolveServerCandidates(args, env, defaultServerUrl);
69
69
 
70
70
  try {
71
71
  const existing = await readRecord({
@@ -76,7 +76,7 @@ async function runBasePageReadCommand(
76
76
  return raw ? 0 : 1;
77
77
  }
78
78
 
79
- const authToken = resolveAuthToken(env);
79
+ const authToken = resolveAuthToken(args, env);
80
80
  if (!authToken) {
81
81
  output.write(`[nolo] ${mode} read requires an auth token. Run \`nolo login\` or set AUTH_TOKEN.\n`);
82
82
  return 1;
@@ -85,8 +85,8 @@ async function runBasePageReadCommand(
85
85
  const db = deps.db ?? await getReadableCliDb(output);
86
86
  const fetchImpl = deps.fetchImpl ?? fetch;
87
87
  const fallbackFetchImpl = deps.fallbackFetchImpl;
88
- const defaultServerUrl = resolveServerUrl(env);
89
- const serverCandidates = resolveServerCandidates(env, defaultServerUrl);
88
+ const defaultServerUrl = resolveServerUrl(args, env);
89
+ const serverCandidates = resolveServerCandidates(args, env, defaultServerUrl);
90
90
 
91
91
  try {
92
92
  const record = await readPageRecord({
@@ -63,7 +63,7 @@ async function runBasePageUpdateCommand(
63
63
  return dbKey ? 0 : 1;
64
64
  }
65
65
 
66
- const authToken = resolveAuthToken(env);
66
+ const authToken = resolveAuthToken(args, env);
67
67
  const userId = parseUserIdFromAuthToken(authToken);
68
68
  if (!authToken || !userId) {
69
69
  output.write(`[nolo] ${mode} update requires an auth token with userId. Run \`nolo login\`.\n`);
@@ -73,8 +73,8 @@ async function runBasePageUpdateCommand(
73
73
  const db = deps.db ?? await getReadableCliDb(output);
74
74
  const fetchImpl = deps.fetchImpl ?? fetch;
75
75
  const fallbackFetchImpl = deps.fallbackFetchImpl;
76
- const defaultServerUrl = resolveServerUrl(env);
77
- const serverCandidates = resolveServerCandidates(env, defaultServerUrl);
76
+ const defaultServerUrl = resolveServerUrl(args, env);
77
+ const serverCandidates = resolveServerCandidates(args, env, defaultServerUrl);
78
78
  const writeTargets = [defaultServerUrl];
79
79
 
80
80
  try {
@@ -12,6 +12,15 @@ export interface SpaceRouteContext {
12
12
  isSpaceRoute: boolean;
13
13
  isSpaceRootRoute: boolean;
14
14
  spaceId: string | null;
15
+ routeSection:
16
+ | "none"
17
+ | "root"
18
+ | "files"
19
+ | "ai"
20
+ | "scheduled"
21
+ | "members"
22
+ | "settings"
23
+ | "content";
15
24
  }
16
25
 
17
26
  export function isAllViewRoutePath(pathname: string): boolean {
@@ -25,6 +34,7 @@ export function getSpaceRouteContext(pathname: string): SpaceRouteContext {
25
34
  isSpaceRoute: false,
26
35
  isSpaceRootRoute: false,
27
36
  spaceId: null,
37
+ routeSection: "none",
28
38
  };
29
39
  }
30
40
 
@@ -37,10 +47,25 @@ export function getSpaceRouteContext(pathname: string): SpaceRouteContext {
37
47
  // Keep the encoded segment so route classification never fails on bad input.
38
48
  }
39
49
 
50
+ const routeSection = !descendantPath
51
+ ? "root"
52
+ : descendantPath === "files" || descendantPath.startsWith("files/")
53
+ ? "files"
54
+ : descendantPath === "ai" || descendantPath.startsWith("ai/")
55
+ ? "ai"
56
+ : descendantPath === "scheduled" || descendantPath.startsWith("scheduled/")
57
+ ? "scheduled"
58
+ : descendantPath === "members" || descendantPath.startsWith("members/")
59
+ ? "members"
60
+ : descendantPath === "settings" || descendantPath.startsWith("settings/")
61
+ ? "settings"
62
+ : "content";
63
+
40
64
  return {
41
65
  isSpaceRoute: true,
42
66
  isSpaceRootRoute: !descendantPath,
43
67
  spaceId,
68
+ routeSection,
44
69
  };
45
70
  }
46
71