nolo-cli 0.1.40 → 0.1.42
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 +27 -12
- package/agent-runtime/agentThread.ts +222 -0
- package/agent-runtime/agentThreadAdmission.ts +74 -0
- package/agent-runtime/dialogWritePlan.ts +42 -0
- package/agent-runtime/hostAdapter.ts +1 -0
- package/agent-runtime/hybridRecordStore.ts +5 -3
- package/agent-runtime/index.ts +43 -0
- package/agent-runtime/localLoop.ts +31 -2
- package/agent-runtime/localToolPolicy.ts +1 -0
- package/agent-runtime/localWorkspaceTools.ts +1258 -78
- package/agent-runtime/noloWorkspaceTools.ts +20 -1
- package/agent-runtime/runtimeToolPolicy.ts +1 -5
- package/agent-runtime/runtimeToolSurface.ts +1 -0
- package/agentAliases.ts +29 -9
- package/agentInternalCommandEntries.ts +11 -3
- package/agentMachineCommands.ts +1 -0
- package/agentRecordCommands.ts +2 -2
- package/agentRecordHelpers.ts +59 -6
- package/agentRunCommand.ts +84 -19
- package/ai/agent/_executeModel.ts +146 -0
- package/ai/agent/agentSlice.ts +556 -1
- package/ai/agent/appWorkingMemory.ts +126 -0
- package/ai/agent/buildEditingContext.ts +378 -0
- package/ai/agent/buildSystemPrompt.ts +599 -0
- package/ai/agent/canvasEditingContext.ts +49 -0
- package/ai/agent/cleanAgentMessages.ts +140 -0
- package/ai/agent/cliChatClient.ts +153 -0
- package/ai/agent/cliExecutor.ts +264 -46
- package/ai/agent/contextCompiler.ts +107 -0
- package/ai/agent/contextLayerContract.ts +44 -0
- package/ai/agent/createAgentSchema.ts +272 -0
- package/ai/agent/currentTimeContext.ts +65 -0
- package/ai/agent/executeToolCall.ts +58 -0
- package/ai/agent/fetchAgentContexts.ts +42 -0
- package/ai/agent/generatePrompt.ts +3 -0
- package/ai/agent/getFullChatContextKeys.ts +168 -0
- package/ai/agent/guidedCreation/capabilities.ts +84 -0
- package/ai/agent/guidedCreation/types.ts +38 -0
- package/ai/agent/isLiveAudioOnlyAgent.ts +26 -0
- package/ai/agent/liveAudioModel.ts +2 -0
- package/ai/agent/pageBuilderHandoffRules.ts +75 -0
- package/ai/agent/persistMessageWithFixedId.ts +37 -0
- package/ai/agent/planSlice.ts +259 -0
- package/ai/agent/referenceUtils.ts +229 -0
- package/ai/agent/runAgentBackground.ts +310 -0
- package/ai/agent/runAgentClientLoop.ts +164 -0
- package/ai/agent/runtimeGuidance.ts +116 -0
- package/ai/agent/serverOrigin.ts +7 -0
- package/ai/agent/startParallelAgentStreams.ts +424 -0
- package/ai/agent/startupProtocol.ts +53 -0
- package/ai/agent/streamAgentChatTurn.ts +2135 -0
- package/ai/agent/streamAgentChatTurnUtils.ts +923 -0
- package/ai/agent/toolFailureGuard.ts +99 -0
- package/ai/agent/types.ts +73 -0
- package/ai/agent/utils/imageOutput.ts +37 -0
- package/ai/agent/utils/publicImageAgentMode.ts +26 -0
- package/ai/ai.locale.ts +1165 -0
- package/ai/chat/accumulateToolCallChunks.ts +126 -0
- package/ai/chat/fetchUtils.ts +143 -0
- package/ai/chat/inlineImageUrlsForCustomProvider.ts +122 -0
- package/ai/chat/parseApiError.ts +67 -0
- package/ai/chat/parseMultilineSSE.ts +95 -0
- package/ai/chat/sendOpenAICompletionsRequest.ts +921 -0
- package/ai/chat/sendOpenAIResponseRequest.ts +720 -0
- package/ai/chat/serverProxyRetry.ts +102 -0
- package/ai/chat/shouldUseServerProxy.ts +18 -0
- package/ai/chat/streamRetry.ts +46 -0
- package/ai/chat/updateTotalUsage.ts +89 -0
- package/ai/context/buildReferenceContext.ts +437 -0
- package/ai/context/retention.ts +165 -0
- package/ai/context/tokenUtils.ts +78 -0
- package/ai/llm/agentCapabilities.ts +74 -0
- package/ai/llm/deepinfra.ts +79 -0
- package/ai/llm/fireworks.ts +68 -0
- package/ai/llm/generateRequestBody.ts +165 -0
- package/ai/llm/getModelContextWindow.ts +93 -0
- package/ai/llm/getPricing.ts +252 -0
- package/ai/llm/imagePricing.ts +66 -0
- package/ai/llm/isResponseAPIModel.ts +13 -0
- package/ai/llm/kimi.ts +22 -0
- package/ai/llm/mimo.ts +99 -0
- package/ai/llm/mistral.ts +21 -0
- package/ai/llm/models.ts +45 -0
- package/ai/llm/openrouterModels.ts +31 -0
- package/ai/llm/providers.ts +313 -0
- package/ai/llm/reasoningModels.ts +27 -0
- package/ai/llm/types.ts +82 -0
- package/ai/llm/usageRequestOptions.ts +59 -0
- package/ai/memory/policy.ts +49 -0
- package/ai/memory/queryShared.ts +167 -0
- package/ai/memory/recentRelationshipRecap.ts +251 -0
- package/ai/memory/remember.ts +111 -0
- package/ai/memory/scope.ts +74 -0
- package/ai/memory/store.ts +20 -0
- package/ai/memory/storeShared.ts +76 -0
- package/ai/memory/types.ts +52 -0
- package/ai/memory/understanding.ts +341 -0
- package/ai/memory/understandingGreeting.ts +264 -0
- package/ai/policy/personalizationDialog.ts +333 -0
- package/ai/policy/runtimePolicy.ts +526 -0
- package/ai/policy/selfUpdateFields.ts +48 -0
- package/ai/policy/types.ts +64 -0
- package/ai/skills/referenceRuntime.ts +274 -0
- package/ai/skills/skillDiagnostics.ts +251 -0
- package/ai/skills/skillDocBuilder.ts +139 -0
- package/ai/skills/skillSummaryMarker.ts +26 -0
- package/ai/token/calculatePrice.ts +576 -0
- package/ai/token/missingUsageEstimate.ts +42 -0
- package/ai/token/normalizeUsage.ts +124 -0
- package/ai/token/openaiImageGenerationUsage.ts +56 -0
- package/ai/token/prepareTokenUsageData.ts +93 -0
- package/ai/token/resolveBillingTarget.ts +52 -0
- package/ai/token/saveTokenRecord.ts +53 -0
- package/ai/token/types.ts +103 -0
- package/ai/tools/agent/agentTools.ts +214 -0
- package/ai/tools/agent/agentUpdateShared.ts +311 -0
- package/ai/tools/agent/callAgentTool.ts +139 -0
- package/ai/tools/agent/createAgentTool.ts +512 -0
- package/ai/tools/agent/createDialogTool.ts +69 -0
- package/ai/tools/agent/createSkillAgentTool.ts +62 -0
- package/ai/tools/agent/parallelBudget.ts +221 -0
- package/ai/tools/agent/prepareAgentDraftTool.ts +159 -0
- package/ai/tools/agent/presets/appBuilderPreset.ts +154 -0
- package/ai/tools/agent/runLlmTool.ts +96 -0
- package/ai/tools/agent/runStreamingAgentTool.ts +73 -0
- package/ai/tools/agent/skillAgentArgs.ts +106 -0
- package/ai/tools/agent/startAgentDialogTool.ts +54 -0
- package/ai/tools/agent/streamParallelAgentsTool.ts +123 -0
- package/ai/tools/agent/updateAgentTool.ts +96 -0
- package/ai/tools/agent/updateSelfTool.ts +113 -0
- package/ai/tools/amazonProductScraperTool.ts +86 -0
- package/ai/tools/apifyActorClient.ts +45 -0
- package/ai/tools/appEditGuard.ts +372 -0
- package/ai/tools/appReadSnapshot.ts +153 -0
- package/ai/tools/appTools.ts +1549 -0
- package/ai/tools/applyEditTool.ts +259 -0
- package/ai/tools/applyLineEditsTool.ts +315 -0
- package/ai/tools/browserTools/click.ts +33 -0
- package/ai/tools/browserTools/closeSession.ts +29 -0
- package/ai/tools/browserTools/common.ts +27 -0
- package/ai/tools/browserTools/openSession.ts +48 -0
- package/ai/tools/browserTools/readContent.ts +38 -0
- package/ai/tools/browserTools/selectOption.ts +46 -0
- package/ai/tools/browserTools/typeText.ts +42 -0
- package/ai/tools/category/createCategoryTool.ts +66 -0
- package/ai/tools/category/queryContentsByCategoryTool.ts +69 -0
- package/ai/tools/category/updateContentCategoryTool.ts +75 -0
- package/ai/tools/cfBrowserTools.ts +319 -0
- package/ai/tools/cfSpeechToTextTool.ts +49 -0
- package/ai/tools/checkEnvTool.ts +102 -0
- package/ai/tools/cloudflareCrawlTool.ts +289 -0
- package/ai/tools/codeSearchTool.ts +123 -0
- package/ai/tools/codeTools.ts +101 -0
- package/ai/tools/convertMarxistsBookTool.ts +103 -0
- package/ai/tools/createDocTool.ts +132 -0
- package/ai/tools/createSkillDocTool.ts +155 -0
- package/ai/tools/createWorkflowTool.ts +154 -0
- package/ai/tools/delayTool.ts +31 -0
- package/ai/tools/deleteSpacesTool.ts +325 -0
- package/ai/tools/deleteSpacesToolModel.ts +159 -0
- package/ai/tools/devReloadUtils.ts +29 -0
- package/ai/tools/dialogMessageSearch.ts +137 -0
- package/ai/tools/doctorSkillTool.ts +72 -0
- package/ai/tools/ecommerceScraperTool.ts +86 -0
- package/ai/tools/emailTools.ts +549 -0
- package/ai/tools/evalSkillTool.ts +92 -0
- package/ai/tools/exaSearchTool.ts +63 -0
- package/ai/tools/execShellTool.ts +266 -0
- package/ai/tools/executeSqlTool.ts +192 -0
- package/ai/tools/fetchWebpageSupport.ts +333 -0
- package/ai/tools/fetchWebpageTool.ts +97 -0
- package/ai/tools/geminiImagePreviewTool.ts +386 -0
- package/ai/tools/generateDocxTool.ts +215 -0
- package/ai/tools/googleSearchScraperTool.ts +106 -0
- package/ai/tools/importDataTool.ts +133 -0
- package/ai/tools/importSkillTool.ts +162 -0
- package/ai/tools/index.ts +2290 -0
- package/ai/tools/jdProductScraperTool.ts +821 -0
- package/ai/tools/listUserSpacesTool.ts +113 -0
- package/ai/tools/localFilesTool.ts +276 -0
- package/ai/tools/marxistsOfflineBook.ts +253 -0
- package/ai/tools/modelUsageTools.ts +206 -0
- package/ai/tools/noloWorkspaceReadTools.ts +467 -0
- package/ai/tools/olmOcrTool.ts +33 -0
- package/ai/tools/openaiImageTool.ts +267 -0
- package/ai/tools/prepareTools.ts +193 -0
- package/ai/tools/readDocTool.ts +88 -0
- package/ai/tools/readFileTool.ts +214 -0
- package/ai/tools/readTool.ts +194 -0
- package/ai/tools/readXPostTool.ts +229 -0
- package/ai/tools/readXhsProfileTool.ts +638 -0
- package/ai/tools/rememberMemoryTool.ts +84 -0
- package/ai/tools/remotionVideoTool.ts +151 -0
- package/ai/tools/searchDialogMessagesTool.ts +222 -0
- package/ai/tools/searchWorkspaceTool.ts +259 -0
- package/ai/tools/skillFollowup.ts +86 -0
- package/ai/tools/surfWeatherTool.ts +169 -0
- package/ai/tools/table/addTableRowTool.ts +217 -0
- package/ai/tools/table/createTableTool.ts +326 -0
- package/ai/tools/table/rowTools.ts +386 -0
- package/ai/tools/table/schemaTools.ts +244 -0
- package/ai/tools/table/shareTableTool.ts +148 -0
- package/ai/tools/table/toolShared.ts +129 -0
- package/ai/tools/taobaoTmallProductScraperTool.ts +49 -0
- package/ai/tools/toolApiClient.ts +279 -0
- package/ai/tools/toolPacks.ts +19 -0
- package/ai/tools/toolResultError.ts +42 -0
- package/ai/tools/toolRunSlice.ts +303 -0
- package/ai/tools/toolSchemaCompatibility.ts +53 -0
- package/ai/tools/uiAskChoiceTool.ts +104 -0
- package/ai/tools/updateContentTitleTool.ts +84 -0
- package/ai/tools/updateDocTool.ts +105 -0
- package/ai/tools/updateUserPreferenceProfileTool.ts +153 -0
- package/ai/tools/wereadGatewayTool.ts +152 -0
- package/ai/tools/whisperTool.ts +76 -0
- package/ai/tools/writeFileTool.ts +213 -0
- package/ai/tools/youtubeScraperTool.ts +116 -0
- package/ai/tools/ziweiChartTool.ts +678 -0
- package/ai/types.ts +58 -0
- package/ai/workflow/workflowExecutor.ts +323 -0
- package/ai/workflow/workflowSlice.ts +73 -0
- package/ai/workflow/workflowTypes.ts +106 -0
- package/app/actions/syncAppRecord.ts +73 -0
- package/app/constants/animationSets.ts +21 -0
- package/app/constants/appEditor.ts +99 -0
- package/app/favorite/deletedFavoriteProjection.ts +31 -0
- package/app/favorite/favoriteSlice.ts +690 -0
- package/app/favorite/type.ts +43 -0
- package/app/hooks/deleteDbKey.ts +254 -0
- package/app/i18n/client.ts +13 -0
- package/app/i18n/i18n.base.ts +14 -0
- package/app/i18n/i18n.config.ts +77 -0
- package/app/i18n/index.ts +15 -0
- package/app/i18n/mapLanguage.ts +11 -0
- package/app/i18n/translations/appBuilder.locale.ts +453 -0
- package/app/i18n/translations/error.locale.ts +246 -0
- package/app/i18n/translations/interface.locale.ts +2206 -0
- package/app/i18n/translations/pricing.locale.ts +397 -0
- package/app/i18n/translations/privacy.locale.ts +168 -0
- package/app/i18n/translations/seo.locale.ts +129 -0
- package/app/i18n/translations/terms.locale.ts +124 -0
- package/app/i18n/types.ts +6 -0
- package/app/notifications/model.ts +77 -0
- package/app/notifications/notificationSlice.ts +141 -0
- package/app/reducer.ts +36 -0
- package/app/settings/dbActionThunks.ts +34 -0
- package/app/settings/defaultSpacePreference.ts +87 -0
- package/app/settings/settingSlice.tsx +1212 -0
- package/app/settings/settingsRecord.ts +8 -0
- package/app/stateViews/runtime.ts +90 -0
- package/app/store.ts +55 -0
- package/app/theme/colors.ts +280 -0
- package/app/theme/fontPreference.ts +77 -0
- package/app/theme/theme.config.ts +120 -0
- package/app/theme/themeModeBootstrap.ts +123 -0
- package/app/types/appSummary.ts +118 -0
- package/app/types.ts +358 -0
- package/app/utils/appKeys.ts +55 -0
- package/app/utils/async.ts +28 -0
- package/app/utils/desktopAgentRuntimeTurnClient.ts +75 -0
- package/app/utils/env.ts +17 -0
- package/app/utils/fileUtils.ts +229 -0
- package/app/utils/imageUtils.ts +274 -0
- package/app/utils/myContentItems.ts +289 -0
- package/app/utils/retryAfter.ts +36 -0
- package/app/utils/retryFetch.ts +61 -0
- package/app/utils/toast.ts +3 -0
- package/auth/action/signUpAction.ts +227 -0
- package/auth/adminPermissions.ts +78 -0
- package/auth/authSlice.ts +531 -0
- package/auth/client/loginRequest.ts +14 -0
- package/auth/resetAuthScopedClientState.ts +27 -0
- package/auth/routes.ts +183 -0
- package/auth/token.ts +63 -0
- package/auth/types.ts +40 -0
- package/chat/chat.locale.ts +817 -0
- package/chat/dialog/actions/addCybotAction.ts +52 -0
- package/chat/dialog/actions/addReferenceKeysAction.ts +62 -0
- package/chat/dialog/actions/builtinDialogLlm.ts +35 -0
- package/chat/dialog/actions/cleanupCliSession.ts +40 -0
- package/chat/dialog/actions/createDialogAction.ts +379 -0
- package/chat/dialog/actions/createScheduledTaskAction.ts +78 -0
- package/chat/dialog/actions/handleSendMessageAction.ts +202 -0
- package/chat/dialog/actions/handleSendMessageResolver.ts +27 -0
- package/chat/dialog/actions/removeCybotAction.ts +6 -0
- package/chat/dialog/actions/removeDialogAgentAction.ts +44 -0
- package/chat/dialog/actions/replacePrimaryCybotAction.ts +6 -0
- package/chat/dialog/actions/setPrimaryDialogAgentAction.ts +52 -0
- package/chat/dialog/actions/updateDialogSummaryAction.ts +430 -0
- package/chat/dialog/actions/updateDialogTitleAction.ts +151 -0
- package/chat/dialog/actions/updateDialogTitlePolicy.ts +30 -0
- package/chat/dialog/actions/updateTokensAction.ts +233 -0
- package/chat/dialog/dialogAgents.ts +72 -0
- package/chat/dialog/dialogAttachmentCleanup.ts +135 -0
- package/chat/dialog/dialogSlice.ts +985 -0
- package/chat/dialog/dialogTitle.ts +81 -0
- package/chat/dialog/dialogTokenStats.ts +12 -0
- package/chat/dialog/dialogUrl.ts +6 -0
- package/chat/dialog/goal.ts +108 -0
- package/chat/dialog/objectAssistantRegistry.ts +286 -0
- package/chat/dialog/schedule.ts +17 -0
- package/chat/messages/activityCompletion.ts +97 -0
- package/chat/messages/fetchAndCacheMessages.ts +119 -0
- package/chat/messages/fetchConvMsgs.ts +51 -0
- package/chat/messages/fileUrl.ts +13 -0
- package/chat/messages/imagePayloadPersistence.ts +22 -0
- package/chat/messages/messageAgent.ts +8 -0
- package/chat/messages/messageContent.ts +203 -0
- package/chat/messages/messageContract.ts +88 -0
- package/chat/messages/messageSlice.ts +1386 -0
- package/chat/messages/toolThunks.ts +646 -0
- package/chat/messages/types.ts +8 -1
- package/chat/messages/web/toolDisplayName.ts +686 -0
- package/cli/agentAliases.ts +29 -9
- package/cli/agentInternalCommandEntries.ts +11 -3
- package/cli/agentMachineCommands.ts +1 -0
- package/cli/agentRecordCommands.ts +2 -2
- package/cli/agentRecordHelpers.ts +59 -6
- package/cli/agentRunCommand.ts +84 -19
- package/cli/client/agentRun.ts +92 -261
- package/cli/client/localRuntimeAdapter.ts +292 -50
- package/cli/commandRegistry.ts +7 -4
- package/cli/dialogAttachmentCleanup.ts +151 -0
- package/cli/dialogCommands.ts +163 -61
- package/cli/dialogInternalCommandEntries.ts +1 -1
- package/cli/docCreateCommands.ts +345 -0
- package/cli/docInternalCommandEntries.ts +11 -0
- package/cli/docPageHelpers.ts +80 -0
- package/cli/docSkillHelpers.ts +67 -0
- package/cli/docSpaceHelpers.ts +46 -0
- package/cli/internalCommandEntries.ts +4 -0
- package/cli/machineCommands.ts +18 -34
- package/cli/memoryCommands.ts +253 -0
- package/cli/memoryInternalCommandEntries.ts +9 -0
- package/cli/qoderUsageProbe.ts +252 -0
- package/cli/scriptCommandEntries.ts +0 -3
- package/cli/secretScan.ts +31 -0
- package/cli/tableCommands.ts +248 -13
- package/cli/workflowInternalCommandEntries.ts +2 -3
- package/client/agentRun.test.ts +119 -83
- package/client/agentRun.ts +92 -261
- package/client/localRuntimeAdapter.test.ts +894 -32
- package/client/localRuntimeAdapter.ts +292 -50
- package/commandRegistry.ts +7 -4
- package/connector-experimental/capabilities.ts +10 -9
- package/core/builtinAgents.ts +209 -0
- package/core/config.ts +15 -0
- package/core/crypto.ts +51 -0
- package/core/generateKeyPairFromSeedV1.ts +15 -0
- package/core/generateMainKey.ts +22 -0
- package/core/init.ts +41 -0
- package/core/localOrigins.ts +8 -0
- package/core/password.ts +13 -0
- package/core/prefix.ts +23 -0
- package/create/editor/transforms/fromMarkdown/index.ts +260 -0
- package/create/editor/transforms/fromMarkdown/inline.ts +285 -0
- package/create/editor/transforms/fromMarkdown/table.ts +130 -0
- package/create/editor/transforms/markdownToSlate.ts +24 -0
- package/create/editor/transforms/slateToRenderMarkdown.ts +218 -0
- package/create/editor/transforms/slateToSimplifiedMarkdown.ts +224 -0
- package/create/editor/transforms/slateToText.ts +33 -0
- package/create/editor/utils/slateUtils.ts +233 -0
- package/create/space/addSpaceAction.ts +193 -0
- package/create/space/category/categoryActions.ts +427 -0
- package/create/space/changeSpaceAction.ts +36 -0
- package/create/space/constants.ts +8 -0
- package/create/space/content/addContentAction.ts +116 -0
- package/create/space/content/contentThunks.ts +90 -0
- package/create/space/content/deleteContentFromSpaceAction.ts +187 -0
- package/create/space/content/deleteMultipleContentAction.ts +112 -0
- package/create/space/content/moveContentAction.ts +285 -0
- package/create/space/content/updateContentCategoryAction.ts +154 -0
- package/create/space/content/updateContentTitleAction.ts +151 -0
- package/create/space/content/uploadAndAddFileToSpaceAction.ts +98 -0
- package/create/space/contentKeyUtils.ts +117 -0
- package/create/space/deleteSpaceAction.ts +276 -0
- package/create/space/fetchSpaceAction.ts +70 -0
- package/create/space/fetchSpaceSidebarStateAction.ts +26 -0
- package/create/space/loadDefaultSpaceAction.ts +57 -0
- package/create/space/member/addMemberAction.ts +79 -0
- package/create/space/member/fetchUserSpaceMembershipsAction.ts +386 -0
- package/create/space/member/memberThunks.ts +47 -0
- package/create/space/member/removeMemberAction.ts +67 -0
- package/create/space/resolvePreferredSpaceId.ts +113 -0
- package/create/space/sidebarVisibleTypes.ts +260 -0
- package/create/space/space.locale.ts +1087 -0
- package/create/space/spaceAccess.ts +182 -0
- package/create/space/spaceCollapsedState.ts +54 -0
- package/create/space/spaceKeys.ts +65 -0
- package/create/space/spaceSlice.ts +328 -0
- package/create/space/spaceThunks.ts +410 -0
- package/create/space/types.ts +27 -0
- package/create/space/updateSpaceAction.ts +107 -0
- package/create/space/utils/permissions.ts +47 -0
- package/create/types.ts +21 -0
- package/database/actions/agentReadResolution.ts +33 -0
- package/database/actions/common.ts +243 -0
- package/database/actions/deleteFile.ts +40 -0
- package/database/actions/fileContent.ts +125 -0
- package/database/actions/patch.ts +155 -0
- package/database/actions/read.ts +358 -0
- package/database/actions/readAndWait.ts +260 -0
- package/database/actions/readRequestManager.ts +120 -0
- package/database/actions/readResolution.ts +125 -0
- package/database/actions/remove.ts +94 -0
- package/database/actions/replication.ts +477 -0
- package/database/actions/upload.ts +186 -0
- package/database/actions/upsert.ts +56 -0
- package/database/actions/write.ts +146 -0
- package/database/authority/ownerKey.ts +80 -0
- package/database/authority/recordAuthority.ts +67 -0
- package/database/authority/userAuthorityRegistry.ts +54 -0
- package/database/client/fetchUserData.ts +61 -0
- package/database/dbActionThunks.ts +1 -0
- package/database/dbSlice.ts +149 -0
- package/database/fileRing.ts +51 -0
- package/database/fileStorage.ts +232 -0
- package/database/fileUrl.ts +34 -0
- package/database/keys.ts +767 -0
- package/database/queryPrefixes.ts +14 -0
- package/database/requests.ts +443 -0
- package/database/runtimeServerContext.ts +54 -0
- package/database/tenantPlacement.ts +57 -0
- package/database/userPreferenceRegister.ts +131 -0
- package/database/utils/ulid.ts +1 -0
- package/dialogAttachmentCleanup.ts +151 -0
- package/dialogCommands.ts +163 -61
- package/dialogInternalCommandEntries.ts +1 -1
- package/docCreateCommands.ts +345 -0
- package/docInternalCommandEntries.ts +11 -0
- package/docPageHelpers.ts +80 -0
- package/docSkillHelpers.ts +67 -0
- package/docSpaceHelpers.ts +46 -0
- package/integrations/anthropic/anthropicModels.ts +47 -0
- package/integrations/deepseek/models.ts +37 -0
- package/integrations/google/models.ts +341 -0
- package/integrations/openai/chatCompletionStreamMode.ts +10 -0
- package/integrations/openai/filterAndCleanMessages.ts +284 -0
- package/integrations/openai/flexTier.ts +102 -0
- package/integrations/openai/generateOpenAIRequestBody.ts +271 -0
- package/integrations/openai/generateResponseRequestBody.ts +77 -0
- package/integrations/openai/models.ts +271 -0
- package/integrations/openai/providerBodyCompatibility.ts +23 -0
- package/integrations/openai/responsesHelpers.ts +297 -0
- package/integrations/x-reader/types.ts +109 -0
- package/integrations/xai/models.ts +13 -0
- package/integrations/xhs-reader/redaction.ts +68 -0
- package/integrations/xhs-reader/types.ts +277 -0
- package/integrations/xhs-reader/url.ts +80 -0
- package/internalCommandEntries.ts +4 -0
- package/machineCommands.ts +18 -34
- package/memoryCommands.ts +253 -0
- package/memoryInternalCommandEntries.ts +9 -0
- package/package.json +454 -9
- package/qoderUsageProbe.ts +252 -0
- package/render/contentIcon/types.ts +167 -0
- package/render/page/createPageAction.ts +183 -0
- package/render/page/docSlice.ts +495 -0
- package/render/page/types.ts +19 -0
- package/render/table/createTableAction.ts +274 -0
- package/render/table/deleteTableAction.ts +193 -0
- package/render/table/fetchAndCacheTableRows.ts +174 -0
- package/render/table/tableSlice.ts +1167 -0
- package/render/table/toolValueUtils.ts +363 -0
- package/render/table/types.ts +262 -0
- package/render/table/utils/tableSerialization.ts +50 -0
- package/scriptCommandEntries.ts +0 -3
- package/secretScan.ts +31 -0
- package/server/handlers/agentRun/types.ts +105 -0
- package/share/action.ts +225 -0
- package/share/helpers.ts +302 -0
- package/share/keys.ts +243 -0
- package/share/publicSharePolicy.ts +27 -0
- package/share/shareSlice.ts +53 -0
- package/share/types.ts +100 -0
- package/tableCommands.ts +248 -13
- package/workflowInternalCommandEntries.ts +2 -3
- package/ai/tools/agent/taskRunTool.ts +0 -112
- package/cli/client/taskRunPrompt.ts +0 -27
- package/cli/taskRunCommand.ts +0 -265
- package/client/taskRunPrompt.ts +0 -27
- package/taskRunCommand.ts +0 -265
|
@@ -7,6 +7,7 @@ export const NOLO_WORKSPACE_TOOL_NAMES = [
|
|
|
7
7
|
"readSpace",
|
|
8
8
|
"readDoc",
|
|
9
9
|
"readSkillDoc",
|
|
10
|
+
"listTables",
|
|
10
11
|
"queryTableRows",
|
|
11
12
|
"cliWhoami",
|
|
12
13
|
"cliDoctor",
|
|
@@ -15,7 +16,7 @@ export const NOLO_WORKSPACE_TOOL_NAMES = [
|
|
|
15
16
|
export type NoloWorkspaceToolName = typeof NOLO_WORKSPACE_TOOL_NAMES[number];
|
|
16
17
|
|
|
17
18
|
export const NOLO_WORKSPACE_TOOL_PROMPT =
|
|
18
|
-
"Nolo workspace tools are available for Nolo data: use listDialogs/readDialog, listAgents/readAgent, listSpaces/readSpace, readDoc/readSkillDoc, queryTableRows, cliWhoami, and cliDoctor when the user asks to inspect Nolo workspace data. Prefer tools over guessing, and combine tool results when the user asks for summaries or analysis.";
|
|
19
|
+
"Nolo workspace tools are available for Nolo data: use listDialogs/readDialog, listAgents/readAgent, listSpaces/readSpace, readDoc/readSkillDoc, listTables/queryTableRows, cliWhoami, and cliDoctor when the user asks to inspect Nolo workspace data. Prefer tools over guessing, and combine tool results when the user asks for summaries or analysis.";
|
|
19
20
|
|
|
20
21
|
const NOLO_WORKSPACE_TOOL_NAME_SET = new Set<string>(NOLO_WORKSPACE_TOOL_NAMES);
|
|
21
22
|
const DIALOG_ID_RE = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
|
@@ -79,6 +80,12 @@ export function buildNoloWorkspaceOpenAiTools(args: { toolNames?: string[] }) {
|
|
|
79
80
|
add("readSkillDoc", "Read one skill doc in the Nolo workspace.", {
|
|
80
81
|
doc: stringToolParam("Skill doc/page key."),
|
|
81
82
|
}, ["doc"]);
|
|
83
|
+
add("listTables", "List tables in the current user scope or an optional space scope.", {
|
|
84
|
+
limit: { type: "integer", description: "Maximum tables to return." },
|
|
85
|
+
space: stringToolParam("Optional space id or URL."),
|
|
86
|
+
titleQuery: stringToolParam("Optional case-insensitive title substring."),
|
|
87
|
+
purpose: stringToolParam("Optional purpose value such as agent_eval_workbench."),
|
|
88
|
+
});
|
|
82
89
|
add("queryTableRows", "Query rows from a Nolo table.", {
|
|
83
90
|
table: stringToolParam("Table id or meta key."),
|
|
84
91
|
limit: { type: "integer", description: "Optional row limit." },
|
|
@@ -274,6 +281,18 @@ export function buildNoloWorkspaceCommandArgs(call: { name: string; arguments: s
|
|
|
274
281
|
if (!doc) throw new Error("readSkillDoc requires doc.");
|
|
275
282
|
return ["skill-doc", "read", doc];
|
|
276
283
|
}
|
|
284
|
+
case "listTables": {
|
|
285
|
+
const cliArgs = ["table", "list"];
|
|
286
|
+
const limit = noloPositiveIntegerString(args.limit);
|
|
287
|
+
const space = noloStringArg(args.space ?? args.spaceId);
|
|
288
|
+
const titleQuery = noloStringArg(args.titleQuery);
|
|
289
|
+
const purpose = noloStringArg(args.purpose);
|
|
290
|
+
if (limit) cliArgs.push("--limit", limit);
|
|
291
|
+
if (space) cliArgs.push("--space", space);
|
|
292
|
+
if (titleQuery) cliArgs.push("--title-query", titleQuery);
|
|
293
|
+
if (purpose) cliArgs.push("--purpose", purpose);
|
|
294
|
+
return cliArgs;
|
|
295
|
+
}
|
|
277
296
|
case "queryTableRows": {
|
|
278
297
|
const table = noloStringArg(args.table ?? args.tableId ?? args.metaKey);
|
|
279
298
|
if (!table) throw new Error("queryTableRows requires table.");
|
|
@@ -181,14 +181,10 @@ function applyWebRuntimeSafetyBaseline(
|
|
|
181
181
|
|
|
182
182
|
export function resolveEffectiveRuntimeToolPolicy(args: {
|
|
183
183
|
agentConfig: Pick<AgentRuntimeAgentConfig, "runtimeToolPolicy" | "runtimeBinding">;
|
|
184
|
-
taskRunControl?: { runtimeToolPolicy?: unknown } | null;
|
|
185
184
|
host?: AgentRuntimeHost;
|
|
186
185
|
}): AgentRuntimeToolPolicy | undefined {
|
|
187
186
|
const agentPolicy = resolveCurrentRunRuntimeToolPolicy(args.agentConfig);
|
|
188
|
-
const
|
|
189
|
-
args.taskRunControl?.runtimeToolPolicy,
|
|
190
|
-
);
|
|
191
|
-
const effectivePolicy = mergeAgentRuntimeToolPolicies(agentPolicy, taskPolicy);
|
|
187
|
+
const effectivePolicy = mergeAgentRuntimeToolPolicies(agentPolicy);
|
|
192
188
|
return args.host === "web"
|
|
193
189
|
? applyWebRuntimeSafetyBaseline(effectivePolicy)
|
|
194
190
|
: effectivePolicy;
|
package/agentAliases.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
export const PLATFORM_DEMO_USER_ID = "b2e06f801f";
|
|
2
1
|
export const CURRENT_OPERATOR_USER_ID = "0e95801d90";
|
|
3
2
|
export const NOLO_DEFAULT_AGENT_ID = "01NOLOAPPBLD000000019KCKT0";
|
|
4
3
|
export const NOLO_DEFAULT_AGENT_KEY = `agent-pub-${NOLO_DEFAULT_AGENT_ID}`;
|
|
5
4
|
export const NOLO_PROJECT_MANAGER_AGENT_ID = "01NOLOPROJMGR00000000MSVGG";
|
|
6
5
|
export const NOLO_PROJECT_MANAGER_AGENT_KEY =
|
|
7
|
-
`agent-${
|
|
8
|
-
export const NOLO_SENIOR_FULLSTACK_AGENT_ID = "01NOLOFULLSTK00000000T3XR4";
|
|
9
|
-
export const NOLO_SENIOR_FULLSTACK_AGENT_KEY =
|
|
10
|
-
`agent-${PLATFORM_DEMO_USER_ID}-${NOLO_SENIOR_FULLSTACK_AGENT_ID}`;
|
|
6
|
+
`agent-${CURRENT_OPERATOR_USER_ID}-${NOLO_PROJECT_MANAGER_AGENT_ID}`;
|
|
11
7
|
export const NOLO_FRONTEND_AGENT_ID = "01FRONTENDAG0000000115N4E1";
|
|
12
8
|
export const NOLO_FRONTEND_AGENT_KEY =
|
|
13
9
|
`agent-${CURRENT_OPERATOR_USER_ID}-${NOLO_FRONTEND_AGENT_ID}`;
|
|
@@ -20,6 +16,15 @@ export const WIN_QWEN_AGENT_KEY =
|
|
|
20
16
|
export const MIMO_MONTH_AGENT_ID = "01MIMO25MONTH0000000NEW001";
|
|
21
17
|
export const MIMO_MONTH_AGENT_KEY =
|
|
22
18
|
`agent-0e95801d90-${MIMO_MONTH_AGENT_ID}`;
|
|
19
|
+
export const QODER_AGENT_ID = "01QODERCLIAGENT00000000NEW";
|
|
20
|
+
export const QODER_AGENT_KEY =
|
|
21
|
+
`agent-0e95801d90-${QODER_AGENT_ID}`;
|
|
22
|
+
export const LOCAL_CODEX_AGENT_ID = "01LOCALCODEXCLI000000NEW";
|
|
23
|
+
export const LOCAL_CODEX_AGENT_KEY =
|
|
24
|
+
`agent-${CURRENT_OPERATOR_USER_ID}-${LOCAL_CODEX_AGENT_ID}`;
|
|
25
|
+
export const LOCAL_QODER_AGENT_ID = "01LOCALQODERCLI000000NEW";
|
|
26
|
+
export const LOCAL_QODER_AGENT_KEY =
|
|
27
|
+
`agent-${CURRENT_OPERATOR_USER_ID}-${LOCAL_QODER_AGENT_ID}`;
|
|
23
28
|
|
|
24
29
|
const AGENT_ALIAS_TO_KEY: Record<string, string> = {
|
|
25
30
|
nolo: NOLO_DEFAULT_AGENT_KEY,
|
|
@@ -48,6 +53,21 @@ const AGENT_ALIAS_TO_KEY: Record<string, string> = {
|
|
|
48
53
|
"全栈": MIMO_MONTH_AGENT_KEY,
|
|
49
54
|
"nolo 全栈工程师": MIMO_MONTH_AGENT_KEY,
|
|
50
55
|
|
|
56
|
+
// Qoder CLI (本机 Qoder CLI 实现 agent)
|
|
57
|
+
qoder: QODER_AGENT_KEY,
|
|
58
|
+
"qoder-agent": QODER_AGENT_KEY,
|
|
59
|
+
"qoder cli": QODER_AGENT_KEY,
|
|
60
|
+
"qoder-cli": QODER_AGENT_KEY,
|
|
61
|
+
|
|
62
|
+
// Explicit local CLI agents. These are ordinary private agent records that
|
|
63
|
+
// run through the current computer local runtime when unbound.
|
|
64
|
+
"local-codex": LOCAL_CODEX_AGENT_KEY,
|
|
65
|
+
"codex-local": LOCAL_CODEX_AGENT_KEY,
|
|
66
|
+
"local codex": LOCAL_CODEX_AGENT_KEY,
|
|
67
|
+
"local-qoder": LOCAL_QODER_AGENT_KEY,
|
|
68
|
+
"qoder-local": LOCAL_QODER_AGENT_KEY,
|
|
69
|
+
"local qoder": LOCAL_QODER_AGENT_KEY,
|
|
70
|
+
|
|
51
71
|
// 产品前端实现
|
|
52
72
|
"frontend": NOLO_FRONTEND_AGENT_KEY,
|
|
53
73
|
"frontend-agent": NOLO_FRONTEND_AGENT_KEY,
|
|
@@ -70,10 +90,6 @@ const AGENT_ALIAS_TO_KEY: Record<string, string> = {
|
|
|
70
90
|
pm: NOLO_PROJECT_MANAGER_AGENT_KEY,
|
|
71
91
|
"项目经理": NOLO_PROJECT_MANAGER_AGENT_KEY,
|
|
72
92
|
"nolo 项目经理": NOLO_PROJECT_MANAGER_AGENT_KEY,
|
|
73
|
-
"senior-fullstack": NOLO_SENIOR_FULLSTACK_AGENT_KEY,
|
|
74
|
-
"nolo-senior-fullstack": NOLO_SENIOR_FULLSTACK_AGENT_KEY,
|
|
75
|
-
"高级全栈": NOLO_SENIOR_FULLSTACK_AGENT_KEY,
|
|
76
|
-
"nolo 高级全栈工程师": NOLO_SENIOR_FULLSTACK_AGENT_KEY,
|
|
77
93
|
};
|
|
78
94
|
|
|
79
95
|
function parseAgentKeyFromInput(raw: string): string {
|
|
@@ -88,3 +104,7 @@ function parseAgentKeyFromInput(raw: string): string {
|
|
|
88
104
|
export function resolveCliAgentKeyInput(raw: string): string {
|
|
89
105
|
return AGENT_ALIAS_TO_KEY[raw.trim().toLowerCase()] ?? parseAgentKeyFromInput(raw);
|
|
90
106
|
}
|
|
107
|
+
|
|
108
|
+
export function isLocalCliAgentKey(agentKey: string): boolean {
|
|
109
|
+
return agentKey === LOCAL_CODEX_AGENT_KEY || agentKey === LOCAL_QODER_AGENT_KEY;
|
|
110
|
+
}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
runAgentCreateCommand,
|
|
12
12
|
} from "./agentRecordCommands";
|
|
13
13
|
import { runAgentRunCommand } from "./agentRunCommand";
|
|
14
|
+
import { runQoderUsageCommand } from "./qoderUsageProbe";
|
|
14
15
|
import {
|
|
15
16
|
createEnvCommand,
|
|
16
17
|
createEnvScriptDirCommand,
|
|
@@ -19,18 +20,25 @@ import type { CommandEntry } from "./cliCommandTypes";
|
|
|
19
20
|
import { runSetupOfflineMarxistsAgentCommand } from "./offlineMarxistsAgentCommand";
|
|
20
21
|
|
|
21
22
|
export function getAgentInternalCommandEntries(): CommandEntry[] {
|
|
23
|
+
const createAgentRunCommand = (path: string[], description: string): CommandEntry =>
|
|
24
|
+
createEnvScriptDirCommand(path, description, (args, deps) =>
|
|
25
|
+
runAgentRunCommand(args, { ...deps, commandPath: path })
|
|
26
|
+
);
|
|
27
|
+
|
|
22
28
|
return [
|
|
23
|
-
|
|
29
|
+
createAgentRunCommand(["run"], "Run a no-login local agent in this workspace"),
|
|
30
|
+
createAgentRunCommand(["chat"], "Chat with an agent"),
|
|
24
31
|
createEnvCommand(["agent", "list"], "List owned agents", runAgentListCommand),
|
|
25
32
|
createEnvCommand(["agent", "create"], "Create a new agent", runAgentCreateCommand),
|
|
26
33
|
createEnvCommand(["agent", "pull"], "Cache an agent for local runs", runAgentPullCommand),
|
|
27
34
|
createEnvCommand(["agent", "read"], "Read a single agent", runAgentReadCommand),
|
|
28
|
-
|
|
35
|
+
createAgentRunCommand(["agent", "run"], "Run an agent"),
|
|
36
|
+
createEnvCommand(["agent", "usage"], "Read local provider usage for an agent", runQoderUsageCommand),
|
|
29
37
|
createEnvCommand(["agent", "setup-offline-marxists"], "Create or update the Marxists.org offline book agent", runSetupOfflineMarxistsAgentCommand),
|
|
30
38
|
createEnvCommand(["agent", "update"], "Update agent fields", runAgentUpdateCommand),
|
|
31
39
|
createEnvCommand(["agent", "bind-current"], "Bind an agent to this machine", runAgentBindCurrentCommand),
|
|
32
40
|
createEnvCommand(["agent", "smoke-current"], "Smoke test a bound agent through this machine", runAgentSmokeCurrentCommand),
|
|
33
41
|
createEnvCommand(["agent", "runtime-doctor"], "Diagnose current machine runtime compatibility", runAgentRuntimeDoctorCommand),
|
|
34
|
-
|
|
42
|
+
createAgentRunCommand(["agent", "chat"], "Chat with an agent"),
|
|
35
43
|
];
|
|
36
44
|
}
|
package/agentMachineCommands.ts
CHANGED
package/agentRecordCommands.ts
CHANGED
|
@@ -76,7 +76,7 @@ export async function runAgentUpdateCommand(
|
|
|
76
76
|
}
|
|
77
77
|
if (!parsed) {
|
|
78
78
|
output.write(
|
|
79
|
-
"Usage: nolo agent update <agent> [--model <id>] [--cli-provider <provider>] [--api-source <source>] [--prompt <text> | --prompt-file <path> | --prompt-doc <pageKey>] [--tools <json>] [--copy-provider-from <agent>] [--field key=value]\n"
|
|
79
|
+
"Usage: nolo agent update <agent> [--model <id>] [--cli-provider <provider>] [--api-source <source>] [--max-concurrent <n>] [--expires-at <iso>] [--usage-probe qoder-local-quota-log] [--prompt <text> | --prompt-file <path> | --prompt-doc <pageKey>] [--tools <json>] [--copy-provider-from <agent>] [--field key=value]\n"
|
|
80
80
|
);
|
|
81
81
|
return args[0] ? 0 : 1;
|
|
82
82
|
}
|
|
@@ -158,7 +158,7 @@ export async function runAgentCreateCommand(
|
|
|
158
158
|
}
|
|
159
159
|
if (!parsed) {
|
|
160
160
|
output.write(
|
|
161
|
-
"Usage: nolo agent create <agent> [--model <id>] [--cli-provider <provider>] [--api-source <source>] [--prompt <text> | --prompt-file <path> | --prompt-doc <pageKey>] [--tools <json>] [--copy-provider-from <agent>] [--name <name>] [--custom-provider-url <url>] [--provider-api-key <key>] [--field key=value]\n"
|
|
161
|
+
"Usage: nolo agent create <agent> [--model <id>] [--cli-provider <provider>] [--api-source <source>] [--max-concurrent <n>] [--expires-at <iso>] [--usage-probe qoder-local-quota-log] [--prompt <text> | --prompt-file <path> | --prompt-doc <pageKey>] [--tools <json>] [--copy-provider-from <agent>] [--name <name>] [--custom-provider-url <url>] [--provider-api-key <key>] [--field key=value]\n"
|
|
162
162
|
);
|
|
163
163
|
return args[0] ? 0 : 1;
|
|
164
164
|
}
|
package/agentRecordHelpers.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
|
+
import { DataType } from "./create/types";
|
|
3
|
+
import { createAgentKey } from "./database/keys";
|
|
2
4
|
import { resolveCliAgentKeyInput } from "./agentAliases";
|
|
3
5
|
import type { CliKvDb } from "./client/hybridRecordStore";
|
|
4
6
|
import { buildLocalAgentLookupKeys, shouldReadAgentKeyRemotely } from "./client/localAgentRecords";
|
|
@@ -41,6 +43,36 @@ function parseJsonishValue(raw: string) {
|
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
|
|
46
|
+
function parsePositiveIntegerOption(raw: string | undefined, flag: string) {
|
|
47
|
+
if (!raw) return undefined;
|
|
48
|
+
const value = Number(raw);
|
|
49
|
+
if (!Number.isInteger(value) || value <= 0) {
|
|
50
|
+
throw new Error(`${flag} must be a positive integer.`);
|
|
51
|
+
}
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function parseIsoTimestampOption(raw: string | undefined, flag: string) {
|
|
56
|
+
if (!raw) return undefined;
|
|
57
|
+
const time = Date.parse(raw);
|
|
58
|
+
if (!Number.isFinite(time)) {
|
|
59
|
+
throw new Error(`${flag} must be an ISO timestamp.`);
|
|
60
|
+
}
|
|
61
|
+
return new Date(time).toISOString();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function buildUsageProbeConfig(kind: string | undefined) {
|
|
65
|
+
if (!kind) return undefined;
|
|
66
|
+
if (kind !== "qoder-local-quota-log") {
|
|
67
|
+
throw new Error("--usage-probe currently supports qoder-local-quota-log.");
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
kind,
|
|
71
|
+
command: "nolo agent usage qoder",
|
|
72
|
+
capability: "qoder-usage",
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
44
76
|
async function curlFetch(url: string, init?: RequestInit): Promise<Response> {
|
|
45
77
|
const method = init?.method ?? "GET";
|
|
46
78
|
const headers = new Headers(init?.headers ?? {});
|
|
@@ -341,6 +373,12 @@ export function parseAgentUpdateArgs(args: string[]) {
|
|
|
341
373
|
const name = readOption(args, "--name");
|
|
342
374
|
const customProviderUrl = readOption(args, "--custom-provider-url");
|
|
343
375
|
const apiKey = readOption(args, "--api-key");
|
|
376
|
+
const maxConcurrent = parsePositiveIntegerOption(
|
|
377
|
+
readOption(args, "--max-concurrent"),
|
|
378
|
+
"--max-concurrent",
|
|
379
|
+
);
|
|
380
|
+
const expiresAt = parseIsoTimestampOption(readOption(args, "--expires-at"), "--expires-at");
|
|
381
|
+
const usageProbe = buildUsageProbeConfig(readOption(args, "--usage-probe"));
|
|
344
382
|
|
|
345
383
|
const promptSources = [prompt, promptFile, promptDoc].filter(Boolean);
|
|
346
384
|
if (promptSources.length > 1) {
|
|
@@ -357,6 +395,13 @@ export function parseAgentUpdateArgs(args: string[]) {
|
|
|
357
395
|
if (name) updates.name = name;
|
|
358
396
|
if (customProviderUrl) updates.customProviderUrl = customProviderUrl;
|
|
359
397
|
if (apiKey) updates.apiKey = apiKey;
|
|
398
|
+
if (maxConcurrent != null) updates.admission = { maxConcurrent };
|
|
399
|
+
if (expiresAt || usageProbe) {
|
|
400
|
+
updates.scheduling = {
|
|
401
|
+
...(expiresAt ? { expiresAt } : {}),
|
|
402
|
+
...(usageProbe ? { usageProbe } : {}),
|
|
403
|
+
};
|
|
404
|
+
}
|
|
360
405
|
|
|
361
406
|
for (const entry of readRepeatedOption(args, "--field")) {
|
|
362
407
|
const index = entry.indexOf("=");
|
|
@@ -384,8 +429,12 @@ export async function buildCreatedAgentRecord(args: {
|
|
|
384
429
|
fallbackFetchImpl?: typeof fetch;
|
|
385
430
|
authToken: string;
|
|
386
431
|
}) {
|
|
387
|
-
const agentKey = resolveCliAgentKeyInput(args.parsed.agentInput);
|
|
388
432
|
const serverUrl = args.cliArgs ? resolveServerUrl(args.cliArgs, args.env) : resolveServerUrl(args.env);
|
|
433
|
+
const userId = parseUserIdFromAuthToken(args.authToken);
|
|
434
|
+
const resolvedAgentInput = resolveCliAgentKeyInput(args.parsed.agentInput);
|
|
435
|
+
const agentKey = resolvedAgentInput.startsWith("agent-")
|
|
436
|
+
? resolvedAgentInput
|
|
437
|
+
: createAgentKey.private(userId || "local", resolvedAgentInput);
|
|
389
438
|
|
|
390
439
|
if (args.parsed.copyProviderFrom) {
|
|
391
440
|
const providerSource = await resolveAgentRecordFromHybridStore({
|
|
@@ -421,12 +470,11 @@ export async function buildCreatedAgentRecord(args: {
|
|
|
421
470
|
args.parsed.updates.prompt = promptBody;
|
|
422
471
|
}
|
|
423
472
|
|
|
424
|
-
const userId = parseUserIdFromAuthToken(args.authToken);
|
|
425
|
-
|
|
426
473
|
const nextRecord = {
|
|
427
474
|
...args.parsed.updates,
|
|
428
475
|
dbKey: agentKey,
|
|
429
476
|
key: agentKey,
|
|
477
|
+
type: DataType.AGENT,
|
|
430
478
|
createdAt: Date.now(),
|
|
431
479
|
updatedAt: Date.now(),
|
|
432
480
|
userId,
|
|
@@ -458,9 +506,14 @@ export async function buildUpdatedAgentRecord(args: {
|
|
|
458
506
|
fallbackFetchImpl: args.fallbackFetchImpl,
|
|
459
507
|
});
|
|
460
508
|
const agentKey = cached?.agentKey ?? resolveCliAgentKeyInput(args.parsed.agentInput);
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
|
|
509
|
+
const explicitServerUrl = args.cliArgs
|
|
510
|
+
? readOption(args.cliArgs, "--server-url") || readOption(args.cliArgs, "--server")
|
|
511
|
+
: undefined;
|
|
512
|
+
const envServerUrl = args.env.NOLO_SERVER || args.env.BASE_URL || args.env.NOLO_SERVER_URL;
|
|
513
|
+
const requestedServerUrl = explicitServerUrl || envServerUrl
|
|
514
|
+
? (args.cliArgs ? resolveServerUrl(args.cliArgs, args.env) : resolveServerUrl(args.env))
|
|
515
|
+
: undefined;
|
|
516
|
+
const serverUrl = requestedServerUrl || cached?.record?.serverOrigin || resolveServerUrl(args.env);
|
|
464
517
|
const currentRecord = await readAgentRecord({
|
|
465
518
|
agentKey,
|
|
466
519
|
authToken: args.authToken,
|
package/agentRunCommand.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { DEFAULT_NOLO_SERVER_URL } from "./defaultServer";
|
|
2
|
-
import { runAgentTurn, type RunAgentTurnResult } from "./client/agentRun";
|
|
2
|
+
import { runAgentTurn, type RunAgentTurnResult, type TaskRowContext } from "./client/agentRun";
|
|
3
3
|
import type { AgentRuntimeHostAdapter, AgentRuntimeRequestedMode } from "./agentRuntimeLocal";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import { extname, resolve } from "node:path";
|
|
6
6
|
import { parseSkillDocProtocol, type WorkflowReferenceConfig } from "./ai/skills/skillDocProtocol";
|
|
7
|
-
import { MIMO_MONTH_AGENT_KEY, resolveCliAgentKeyInput } from "./agentAliases";
|
|
8
|
-
import type { TaskRunPromptContext } from "./client/taskRunPrompt";
|
|
7
|
+
import { LOCAL_CODEX_AGENT_KEY, MIMO_MONTH_AGENT_KEY, isLocalCliAgentKey, resolveCliAgentKeyInput } from "./agentAliases";
|
|
9
8
|
|
|
10
9
|
type EnvLike = Record<string, string | undefined>;
|
|
11
10
|
|
|
@@ -17,6 +16,7 @@ type AgentRunCommandDeps = {
|
|
|
17
16
|
env?: EnvLike;
|
|
18
17
|
scriptDir: string;
|
|
19
18
|
output?: OutputLike;
|
|
19
|
+
commandPath?: string[];
|
|
20
20
|
runner?: typeof runAgentTurn;
|
|
21
21
|
localRuntimeAdapterFactory?: (env: EnvLike, options?: { cwd?: string }) => AgentRuntimeHostAdapter;
|
|
22
22
|
inspectLocalRunWorkspace?: typeof inspectLocalRunWorkspace;
|
|
@@ -35,6 +35,7 @@ type LocalRunWorkspaceInspection = {
|
|
|
35
35
|
|
|
36
36
|
type ParseAgentRunArgsOptions = {
|
|
37
37
|
readTextFile?: (path: string) => string;
|
|
38
|
+
commandPath?: string[];
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
type ParsedAgentRunArgs = {
|
|
@@ -48,6 +49,8 @@ type ParsedAgentRunArgs = {
|
|
|
48
49
|
category?: string;
|
|
49
50
|
inheritedFromDialogKey?: string;
|
|
50
51
|
parentDialogId?: string;
|
|
52
|
+
subjectDialogKey?: string;
|
|
53
|
+
subjectRefs?: Array<{ kind: string; id: string; role?: string }>;
|
|
51
54
|
background: boolean;
|
|
52
55
|
noStream: boolean;
|
|
53
56
|
cwd?: string;
|
|
@@ -55,7 +58,7 @@ type ParsedAgentRunArgs = {
|
|
|
55
58
|
traceTools: boolean;
|
|
56
59
|
eventsMode?: "jsonl";
|
|
57
60
|
injectFeatureWorktreeInstruction: boolean;
|
|
58
|
-
|
|
61
|
+
taskRowContext?: TaskRowContext;
|
|
59
62
|
workflowRef?: string;
|
|
60
63
|
};
|
|
61
64
|
|
|
@@ -111,6 +114,20 @@ function parsePositiveInteger(value: string | undefined) {
|
|
|
111
114
|
return Math.floor(parsed);
|
|
112
115
|
}
|
|
113
116
|
|
|
117
|
+
function parseSubjectRef(raw: string): { kind: string; id: string; role?: string } | null {
|
|
118
|
+
const value = raw.trim();
|
|
119
|
+
if (!value) return null;
|
|
120
|
+
const firstColon = value.indexOf(":");
|
|
121
|
+
if (firstColon <= 0 || firstColon === value.length - 1) return null;
|
|
122
|
+
const kind = value.slice(0, firstColon).trim();
|
|
123
|
+
const rest = value.slice(firstColon + 1).trim();
|
|
124
|
+
const lastColon = rest.lastIndexOf(":");
|
|
125
|
+
const id = lastColon > 0 ? rest.slice(0, lastColon).trim() : rest;
|
|
126
|
+
const role = lastColon > 0 ? rest.slice(lastColon + 1).trim() : "";
|
|
127
|
+
if (!kind || !id) return null;
|
|
128
|
+
return { kind, id, ...(role ? { role } : {}) };
|
|
129
|
+
}
|
|
130
|
+
|
|
114
131
|
function positionalArgs(args: string[]) {
|
|
115
132
|
const values: string[] = [];
|
|
116
133
|
const valuelessFlags = new Set([
|
|
@@ -139,14 +156,18 @@ export function parseAgentRunArgs(
|
|
|
139
156
|
args: string[],
|
|
140
157
|
options: ParseAgentRunArgsOptions = {}
|
|
141
158
|
): ParsedAgentRunArgs | null {
|
|
142
|
-
const
|
|
159
|
+
const positional = positionalArgs(args);
|
|
160
|
+
const isNoLoginRunShorthand =
|
|
161
|
+
(options.commandPath?.join(" ") === "run" || options.commandPath?.join(" ") === "chat") &&
|
|
162
|
+
!readFlagValue(args, "--agent");
|
|
163
|
+
const rawAgentKey = readFlagValue(args, "--agent") ?? (isNoLoginRunShorthand ? LOCAL_CODEX_AGENT_KEY : positional[0]);
|
|
143
164
|
const agentKey = rawAgentKey ? resolveCliAgentKeyInput(rawAgentKey) : undefined;
|
|
144
165
|
const explicitMsg = readFlagValue(args, "--msg");
|
|
145
166
|
const msgFile = readFlagValue(args, "--msg-file");
|
|
146
167
|
const fileMessage = msgFile
|
|
147
168
|
? (options.readTextFile ?? ((path: string) => readFileSync(path, "utf8")))(msgFile)
|
|
148
169
|
: undefined;
|
|
149
|
-
const rawMessage = explicitMsg ?? fileMessage ??
|
|
170
|
+
const rawMessage = explicitMsg ?? fileMessage ?? positional.slice(isNoLoginRunShorthand ? 0 : 1).join(" ");
|
|
150
171
|
if (!agentKey || !rawMessage.trim()) return null;
|
|
151
172
|
const message = rawMessage.trim();
|
|
152
173
|
const runtimeMode = runtimeModeFromArgs(args);
|
|
@@ -154,6 +175,13 @@ export function parseAgentRunArgs(
|
|
|
154
175
|
const spaceId = readFlagValue(args, "--space");
|
|
155
176
|
const category = readFlagValue(args, "--category");
|
|
156
177
|
const inheritedFromDialog = readFlagValue(args, "--inherit-from-dialog");
|
|
178
|
+
const subjectDialog =
|
|
179
|
+
readFlagValue(args, "--subject-dialog") ??
|
|
180
|
+
readFlagValue(args, "--reference-dialog");
|
|
181
|
+
const subjectDialogKey = subjectDialog?.trim();
|
|
182
|
+
const subjectRefs = readRepeatedFlagValues(args, "--subject-ref")
|
|
183
|
+
.map(parseSubjectRef)
|
|
184
|
+
.filter((ref): ref is { kind: string; id: string; role?: string } => Boolean(ref));
|
|
157
185
|
const cwd = readFlagValue(args, "--cwd");
|
|
158
186
|
const timeoutMs = parsePositiveInteger(readFlagValue(args, "--timeout-ms"));
|
|
159
187
|
const rawEventsMode = readFlagValue(args, "--events");
|
|
@@ -167,6 +195,8 @@ export function parseAgentRunArgs(
|
|
|
167
195
|
];
|
|
168
196
|
const mimoLocalWorkspaceDefault =
|
|
169
197
|
isMonthlyMimoAgentRef(rawAgentKey, agentKey) && runtimeMode !== "server";
|
|
198
|
+
const explicitLocalCliAgentDefault =
|
|
199
|
+
isLocalCliAgentKey(agentKey) && runtimeMode !== "server";
|
|
170
200
|
const workflowRef = readFlagValue(args, "--workflow");
|
|
171
201
|
const taskRowDbKey = readFlagValue(args, "--task-row-dbkey");
|
|
172
202
|
const artifactIds = readFlagValue(args, "--artifact-ids")
|
|
@@ -177,24 +207,22 @@ export function parseAgentRunArgs(
|
|
|
177
207
|
agentKey,
|
|
178
208
|
message,
|
|
179
209
|
imageUrls,
|
|
180
|
-
allowShell: args.includes("--dangerously-allow-shell") || mimoLocalWorkspaceDefault,
|
|
210
|
+
allowShell: args.includes("--dangerously-allow-shell") || mimoLocalWorkspaceDefault || explicitLocalCliAgentDefault,
|
|
181
211
|
traceTools: args.includes("--trace-tools"),
|
|
182
212
|
...(eventsMode ? { eventsMode } : {}),
|
|
183
213
|
injectFeatureWorktreeInstruction: mimoLocalWorkspaceDefault,
|
|
184
214
|
...(workflowRef ? { workflowRef } : {}),
|
|
185
215
|
...(taskRowDbKey
|
|
186
216
|
? {
|
|
187
|
-
|
|
217
|
+
taskRowContext: {
|
|
188
218
|
rowDbKey: taskRowDbKey,
|
|
189
|
-
...(readFlagValue(args, "--task-run-id") ? { taskRunId: readFlagValue(args, "--task-run-id") } : {}),
|
|
190
|
-
...(readFlagValue(args, "--work-item-id") ? { workItemId: readFlagValue(args, "--work-item-id") } : {}),
|
|
191
219
|
...(artifactIds?.length ? { artifactIds } : {}),
|
|
192
220
|
},
|
|
193
221
|
}
|
|
194
222
|
: {}),
|
|
195
223
|
...(runtimeMode
|
|
196
224
|
? { runtimeMode }
|
|
197
|
-
: mimoLocalWorkspaceDefault || args.includes("--dangerously-allow-shell")
|
|
225
|
+
: mimoLocalWorkspaceDefault || explicitLocalCliAgentDefault || args.includes("--dangerously-allow-shell")
|
|
198
226
|
? { runtimeMode: "local" as const }
|
|
199
227
|
: {}),
|
|
200
228
|
background: args.includes("--bg"),
|
|
@@ -204,6 +232,8 @@ export function parseAgentRunArgs(
|
|
|
204
232
|
...(category ? { category } : {}),
|
|
205
233
|
...(inheritedRef?.dialogKey ? { inheritedFromDialogKey: inheritedRef.dialogKey } : {}),
|
|
206
234
|
...(inheritedRef?.dialogId ? { parentDialogId: inheritedRef.dialogId } : {}),
|
|
235
|
+
...(subjectDialogKey ? { subjectDialogKey } : {}),
|
|
236
|
+
...(subjectRefs.length ? { subjectRefs } : {}),
|
|
207
237
|
...(cwd ? { cwd } : {}),
|
|
208
238
|
...(typeof timeoutMs === "number" ? { timeoutMs } : {}),
|
|
209
239
|
};
|
|
@@ -274,6 +304,19 @@ function prependFeatureWorktreeInstruction(message: string, enabled: boolean) {
|
|
|
274
304
|
].join("\n");
|
|
275
305
|
}
|
|
276
306
|
|
|
307
|
+
export function prependSubjectDialogMarker(
|
|
308
|
+
message: string,
|
|
309
|
+
subjectDialogKey: string | undefined
|
|
310
|
+
) {
|
|
311
|
+
if (!subjectDialogKey) return message;
|
|
312
|
+
return [
|
|
313
|
+
`Subject dialog for this run: ${subjectDialogKey}`,
|
|
314
|
+
"If the user asks to evaluate the referenced dialog, call readDialog with this id/key first.",
|
|
315
|
+
"",
|
|
316
|
+
message,
|
|
317
|
+
].join("\n");
|
|
318
|
+
}
|
|
319
|
+
|
|
277
320
|
function parseDialogReference(rawInput: string) {
|
|
278
321
|
const normalized = rawInput.trim();
|
|
279
322
|
if (normalized.startsWith("dialog-")) {
|
|
@@ -396,19 +439,36 @@ function buildLocalRunEnv(args: {
|
|
|
396
439
|
};
|
|
397
440
|
}
|
|
398
441
|
|
|
399
|
-
function writeUsage(output: OutputLike) {
|
|
442
|
+
function writeUsage(output: OutputLike, commandPath?: string[]) {
|
|
443
|
+
const commandName = commandPath?.join(" ");
|
|
444
|
+
if (commandName === "run") {
|
|
445
|
+
output.write(
|
|
446
|
+
"Usage: nolo run <message> [--cwd <path>] [--events jsonl]\n" +
|
|
447
|
+
" nolo run --msg <message> [--cwd <path>] [--image <url-or-path>]\n" +
|
|
448
|
+
"Runs local Codex in the current workspace; no Nolo login required.\n"
|
|
449
|
+
);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
if (commandName === "chat") {
|
|
453
|
+
output.write(
|
|
454
|
+
"Usage: nolo chat <message> [--cwd <path>] [--events jsonl]\n" +
|
|
455
|
+
" nolo chat --agent <agent> (--msg <message>|--msg-file <path>) [--local|--server|--auto]\n" +
|
|
456
|
+
"Without --agent, this uses local Codex in the current workspace; no Nolo login required.\n"
|
|
457
|
+
);
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
400
460
|
output.write(
|
|
401
461
|
"Usage: nolo agent run <agent> <message> [--local|--server|--auto] [--continue <dialogId>] [--cwd <path>]\n" +
|
|
402
|
-
" nolo agent run --agent <agent> (--msg <message>|--msg-file <path>) [--image <url-or-path>] [--space <spaceId>] [--category <name>] [--inherit-from-dialog <dialog>] [--task-row-dbkey <key>] [--bg] [--timeout-ms <n>] [--events jsonl] [--no-stream]\n"
|
|
462
|
+
" nolo agent run --agent <agent> (--msg <message>|--msg-file <path>) [--image <url-or-path>] [--space <spaceId>] [--category <name>] [--inherit-from-dialog <dialog>] [--subject-dialog <dialog>] [--subject-ref <kind:id[:role]>] [--task-row-dbkey <key>] [--bg] [--timeout-ms <n>] [--events jsonl] [--no-stream]\n"
|
|
403
463
|
);
|
|
404
464
|
}
|
|
405
465
|
|
|
406
466
|
export async function runAgentRunCommand(args: string[], deps: AgentRunCommandDeps) {
|
|
407
467
|
const env = deps.env ?? process.env;
|
|
408
468
|
const output = deps.output ?? process.stdout;
|
|
409
|
-
const parsed = parseAgentRunArgs(args);
|
|
469
|
+
const parsed = parseAgentRunArgs(args, { commandPath: deps.commandPath });
|
|
410
470
|
if (!parsed) {
|
|
411
|
-
writeUsage(output);
|
|
471
|
+
writeUsage(output, deps.commandPath);
|
|
412
472
|
return 1;
|
|
413
473
|
}
|
|
414
474
|
|
|
@@ -437,9 +497,12 @@ export async function runAgentRunCommand(args: string[], deps: AgentRunCommandDe
|
|
|
437
497
|
agentKey: parsed.agentKey,
|
|
438
498
|
serverUrl: resolveServerUrl(env),
|
|
439
499
|
message: prependWorkflowReferencePrompt(
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
500
|
+
prependSubjectDialogMarker(
|
|
501
|
+
prependFeatureWorktreeInstruction(
|
|
502
|
+
parsed.message,
|
|
503
|
+
parsed.injectFeatureWorktreeInstruction
|
|
504
|
+
),
|
|
505
|
+
parsed.subjectDialogKey
|
|
443
506
|
),
|
|
444
507
|
workflowReference
|
|
445
508
|
),
|
|
@@ -457,12 +520,14 @@ export async function runAgentRunCommand(args: string[], deps: AgentRunCommandDe
|
|
|
457
520
|
...(parsed.category ? { category: parsed.category } : {}),
|
|
458
521
|
...(parsed.inheritedFromDialogKey ? { inheritedFromDialogKey: parsed.inheritedFromDialogKey } : {}),
|
|
459
522
|
...(parsed.parentDialogId ? { parentDialogId: parsed.parentDialogId } : {}),
|
|
523
|
+
...(parsed.subjectDialogKey ? { subjectDialogKey: parsed.subjectDialogKey } : {}),
|
|
524
|
+
...(parsed.subjectRefs?.length ? { subjectRefs: parsed.subjectRefs } : {}),
|
|
460
525
|
background: parsed.background,
|
|
461
526
|
noStream: parsed.noStream,
|
|
462
527
|
...(typeof parsed.timeoutMs === "number" ? { timeoutMs: parsed.timeoutMs } : {}),
|
|
463
528
|
traceTools: parsed.traceTools,
|
|
464
529
|
...(parsed.eventsMode ? { eventsMode: parsed.eventsMode } : {}),
|
|
465
|
-
...(parsed.
|
|
530
|
+
...(parsed.taskRowContext ? { taskRowContext: parsed.taskRowContext } : {}),
|
|
466
531
|
});
|
|
467
532
|
|
|
468
533
|
if (result.dialogId) {
|