nolo-cli 0.1.39 → 0.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/agent-runtime/dialogWritePlan.ts +39 -0
- package/agent-runtime/hostAdapter.ts +4 -0
- package/agent-runtime/hybridRecordStore.ts +5 -3
- package/agent-runtime/index.ts +15 -0
- package/agent-runtime/localLoop.ts +87 -7
- package/agent-runtime/localToolPolicy.ts +2 -13
- package/agent-runtime/localWorkspaceTools.ts +42 -110
- package/agent-runtime/runtimeToolPolicy.ts +2 -11
- package/agent-runtime/runtimeToolSurface.ts +198 -0
- package/agent-runtime/types.ts +1 -0
- package/agentAliases.ts +2 -1
- package/agentRunCommand.ts +10 -32
- package/agentRuntimeLocal.ts +1 -0
- 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 +585 -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 +314 -40
- 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 +2001 -0
- package/ai/agent/streamAgentChatTurnUtils.ts +860 -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 +1095 -0
- package/ai/chat/accumulateToolCallChunks.ts +126 -0
- package/ai/chat/fetchUtils.ts +143 -0
- package/ai/chat/inlineImageUrlsForCustomProvider.ts +117 -0
- package/ai/chat/parseApiError.ts +67 -0
- package/ai/chat/parseMultilineSSE.ts +95 -0
- package/ai/chat/sendOpenAICompletionsRequest.ts +897 -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 +23 -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 +6 -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/queryShared.ts +161 -0
- package/ai/memory/recentRelationshipRecap.ts +247 -0
- package/ai/memory/remember.ts +167 -0
- package/ai/memory/store.ts +20 -0
- package/ai/memory/storeShared.ts +76 -0
- package/ai/memory/types.ts +46 -0
- package/ai/memory/understanding.ts +349 -0
- package/ai/memory/understandingGreeting.ts +264 -0
- package/ai/policy/personalizationDialog.ts +333 -0
- package/ai/policy/runtimePolicy.ts +454 -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 +235 -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 +53 -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 +2308 -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 +23 -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 +627 -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 +315 -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/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 +55 -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/favoriteSlice.ts +690 -0
- package/app/favorite/type.ts +43 -0
- package/app/hooks/deleteDbKey.ts +233 -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 +2174 -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 +114 -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 +73 -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 +18 -0
- package/auth/authSlice.ts +531 -0
- package/auth/client/loginRequest.ts +14 -0
- package/auth/resetAuthScopedClientState.ts +27 -0
- package/auth/routes.ts +178 -0
- package/auth/token.ts +63 -0
- package/auth/types.ts +40 -0
- package/chat/chat.locale.ts +813 -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 +197 -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/dialogSlice.ts +872 -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/fetchAndCacheMessages.ts +119 -0
- package/chat/messages/fetchConvMsgs.ts +51 -0
- package/chat/messages/fileUrl.ts +13 -0
- package/chat/messages/messageAgent.ts +8 -0
- package/chat/messages/messageContent.ts +199 -0
- package/chat/messages/messageContract.ts +88 -0
- package/chat/messages/messageSlice.ts +1367 -0
- package/chat/messages/toolThunks.ts +625 -0
- package/cli/agentAliases.ts +2 -1
- package/cli/agentRunCommand.ts +10 -32
- package/cli/agentRuntimeLocal.ts +1 -0
- package/cli/client/agentRun.ts +67 -95
- package/cli/client/localRuntimeAdapter.ts +323 -54
- package/cli/commandRegistry.ts +2 -2
- package/cli/machineWsRunDispatch.ts +51 -6
- package/cli/offlineMarxistsAgentCommand.ts +6 -4
- package/client/agentConfigResolver.test.ts +2 -2
- package/client/agentRun.test.ts +175 -57
- package/client/agentRun.ts +67 -95
- package/client/localRuntimeAdapter.test.ts +682 -37
- package/client/localRuntimeAdapter.ts +323 -54
- package/client/localRuntimeDryRun.test.ts +23 -9
- package/client/localToolPolicy.test.ts +4 -4
- package/commandRegistry.ts +2 -2
- 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 +241 -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/server/levelAuthorityStore.ts +20 -1
- package/database/tenantPlacement.ts +57 -0
- package/database/userPreferenceRegister.ts +131 -0
- package/database/utils/ulid.ts +1 -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 +274 -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/analyze/profileAnalyzer.ts +205 -0
- package/integrations/xhs-reader/backends/playwrightProfileCollector.ts +624 -0
- package/integrations/xhs-reader/bridge/readXhsProfileWithBridge.ts +227 -0
- package/integrations/xhs-reader/client/xhsWebApiClient.ts +229 -0
- package/integrations/xhs-reader/normalize.ts +390 -0
- package/integrations/xhs-reader/orchestrator.ts +178 -0
- package/integrations/xhs-reader/redaction.ts +68 -0
- package/integrations/xhs-reader/types.ts +244 -0
- package/integrations/xhs-reader/url.ts +57 -0
- package/machineWsRunDispatch.ts +51 -6
- package/offlineMarxistsAgentCommand.ts +6 -4
- package/package.json +430 -3
- package/render/page/createPageAction.ts +183 -0
- package/render/page/docSlice.ts +468 -0
- package/render/page/types.ts +17 -0
- package/render/table/createTableAction.ts +270 -0
- package/render/table/deleteTableAction.ts +193 -0
- package/render/table/fetchAndCacheTableRows.ts +174 -0
- package/render/table/tableSlice.ts +1106 -0
- package/render/table/toolValueUtils.ts +363 -0
- package/render/table/types.ts +252 -0
- package/render/table/utils/tableSerialization.ts +50 -0
- package/server/handlers/agentRun/types.ts +104 -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/cli/agentRunCommand.ts
CHANGED
|
@@ -50,11 +50,10 @@ type ParsedAgentRunArgs = {
|
|
|
50
50
|
parentDialogId?: string;
|
|
51
51
|
background: boolean;
|
|
52
52
|
noStream: boolean;
|
|
53
|
-
noDefaultTestRoot: boolean;
|
|
54
53
|
cwd?: string;
|
|
55
|
-
maxToolRounds?: number;
|
|
56
54
|
timeoutMs?: number;
|
|
57
55
|
traceTools: boolean;
|
|
56
|
+
eventsMode?: "jsonl";
|
|
58
57
|
injectFeatureWorktreeInstruction: boolean;
|
|
59
58
|
taskRunContext?: TaskRunPromptContext;
|
|
60
59
|
workflowRef?: string;
|
|
@@ -66,10 +65,6 @@ type ResolvedWorkflowReference = {
|
|
|
66
65
|
config?: Partial<WorkflowReferenceConfig>;
|
|
67
66
|
};
|
|
68
67
|
|
|
69
|
-
const DEFAULT_TEST_ROOT_DIALOG_ID = "01KN6V3MVEQA4Q1PNKVM2W7YY8";
|
|
70
|
-
const DEFAULT_TEST_ROOT_DIALOG_KEY = `dialog-b2e06f801f-${DEFAULT_TEST_ROOT_DIALOG_ID}`;
|
|
71
|
-
const DEFAULT_TEST_DIALOG_CATEGORY_ID = "test-dialogs";
|
|
72
|
-
|
|
73
68
|
function readFlagValue(args: string[], flag: string) {
|
|
74
69
|
const index = args.indexOf(flag);
|
|
75
70
|
if (index < 0) return undefined;
|
|
@@ -109,13 +104,6 @@ function isMonthlyMimoAgentRef(raw: string | undefined, resolved: string) {
|
|
|
109
104
|
);
|
|
110
105
|
}
|
|
111
106
|
|
|
112
|
-
function parseNonNegativeInteger(value: string | undefined) {
|
|
113
|
-
if (!value) return undefined;
|
|
114
|
-
const parsed = Number(value);
|
|
115
|
-
if (!Number.isFinite(parsed) || parsed < 0) return undefined;
|
|
116
|
-
return Math.floor(parsed);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
107
|
function parsePositiveInteger(value: string | undefined) {
|
|
120
108
|
if (!value) return undefined;
|
|
121
109
|
const parsed = Number(value);
|
|
@@ -134,7 +122,6 @@ function positionalArgs(args: string[]) {
|
|
|
134
122
|
"--bg",
|
|
135
123
|
"--no-stream",
|
|
136
124
|
"--debug",
|
|
137
|
-
"--no-default-test-root",
|
|
138
125
|
]);
|
|
139
126
|
for (let index = 0; index < args.length; index += 1) {
|
|
140
127
|
const arg = args[index];
|
|
@@ -167,20 +154,13 @@ export function parseAgentRunArgs(
|
|
|
167
154
|
const spaceId = readFlagValue(args, "--space");
|
|
168
155
|
const category = readFlagValue(args, "--category");
|
|
169
156
|
const inheritedFromDialog = readFlagValue(args, "--inherit-from-dialog");
|
|
170
|
-
const noDefaultTestRoot = args.includes("--no-default-test-root");
|
|
171
157
|
const cwd = readFlagValue(args, "--cwd");
|
|
172
|
-
const maxToolRounds = parseNonNegativeInteger(
|
|
173
|
-
readFlagValue(args, "--max-tool-rounds") ?? readFlagValue(args, "--rounds")
|
|
174
|
-
);
|
|
175
158
|
const timeoutMs = parsePositiveInteger(readFlagValue(args, "--timeout-ms"));
|
|
159
|
+
const rawEventsMode = readFlagValue(args, "--events");
|
|
160
|
+
const eventsMode = rawEventsMode === "jsonl" ? "jsonl" : undefined;
|
|
176
161
|
const inheritedRef = inheritedFromDialog
|
|
177
162
|
? parseDialogReference(inheritedFromDialog)
|
|
178
|
-
:
|
|
179
|
-
? {
|
|
180
|
-
dialogKey: DEFAULT_TEST_ROOT_DIALOG_KEY,
|
|
181
|
-
dialogId: DEFAULT_TEST_ROOT_DIALOG_ID,
|
|
182
|
-
}
|
|
183
|
-
: undefined;
|
|
163
|
+
: undefined;
|
|
184
164
|
const imageUrls = [
|
|
185
165
|
...readRepeatedFlagValues(args, "--image"),
|
|
186
166
|
...readRepeatedFlagValues(args, "--image-url"),
|
|
@@ -199,6 +179,7 @@ export function parseAgentRunArgs(
|
|
|
199
179
|
imageUrls,
|
|
200
180
|
allowShell: args.includes("--dangerously-allow-shell") || mimoLocalWorkspaceDefault,
|
|
201
181
|
traceTools: args.includes("--trace-tools"),
|
|
182
|
+
...(eventsMode ? { eventsMode } : {}),
|
|
202
183
|
injectFeatureWorktreeInstruction: mimoLocalWorkspaceDefault,
|
|
203
184
|
...(workflowRef ? { workflowRef } : {}),
|
|
204
185
|
...(taskRowDbKey
|
|
@@ -218,14 +199,12 @@ export function parseAgentRunArgs(
|
|
|
218
199
|
: {}),
|
|
219
200
|
background: args.includes("--bg"),
|
|
220
201
|
noStream: args.includes("--no-stream"),
|
|
221
|
-
noDefaultTestRoot,
|
|
222
202
|
...(continueDialogId ? { continueDialogId } : {}),
|
|
223
203
|
...(!continueDialogId && spaceId ? { spaceId } : {}),
|
|
224
|
-
...(category ? { category } :
|
|
204
|
+
...(category ? { category } : {}),
|
|
225
205
|
...(inheritedRef?.dialogKey ? { inheritedFromDialogKey: inheritedRef.dialogKey } : {}),
|
|
226
206
|
...(inheritedRef?.dialogId ? { parentDialogId: inheritedRef.dialogId } : {}),
|
|
227
207
|
...(cwd ? { cwd } : {}),
|
|
228
|
-
...(typeof maxToolRounds === "number" ? { maxToolRounds } : {}),
|
|
229
208
|
...(typeof timeoutMs === "number" ? { timeoutMs } : {}),
|
|
230
209
|
};
|
|
231
210
|
}
|
|
@@ -411,16 +390,16 @@ function buildLocalRunEnv(args: {
|
|
|
411
390
|
env: EnvLike;
|
|
412
391
|
allowShell: boolean;
|
|
413
392
|
}) {
|
|
393
|
+
void args.allowShell;
|
|
414
394
|
return {
|
|
415
395
|
...args.env,
|
|
416
|
-
...(args.allowShell ? { NOLO_LOCAL_SHELL_MODE: "worktree" } : {}),
|
|
417
396
|
};
|
|
418
397
|
}
|
|
419
398
|
|
|
420
399
|
function writeUsage(output: OutputLike) {
|
|
421
400
|
output.write(
|
|
422
|
-
"Usage: nolo agent run <agent> <message> [--local|--server|--auto] [--continue <dialogId>] [--cwd <path>]
|
|
423
|
-
" 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>] [--no-stream]\n"
|
|
401
|
+
"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"
|
|
424
403
|
);
|
|
425
404
|
}
|
|
426
405
|
|
|
@@ -480,10 +459,9 @@ export async function runAgentRunCommand(args: string[], deps: AgentRunCommandDe
|
|
|
480
459
|
...(parsed.parentDialogId ? { parentDialogId: parsed.parentDialogId } : {}),
|
|
481
460
|
background: parsed.background,
|
|
482
461
|
noStream: parsed.noStream,
|
|
483
|
-
noDefaultTestRoot: parsed.noDefaultTestRoot,
|
|
484
|
-
...(typeof parsed.maxToolRounds === "number" ? { maxToolRounds: parsed.maxToolRounds } : {}),
|
|
485
462
|
...(typeof parsed.timeoutMs === "number" ? { timeoutMs: parsed.timeoutMs } : {}),
|
|
486
463
|
traceTools: parsed.traceTools,
|
|
464
|
+
...(parsed.eventsMode ? { eventsMode: parsed.eventsMode } : {}),
|
|
487
465
|
...(parsed.taskRunContext ? { taskRunContext: parsed.taskRunContext } : {}),
|
|
488
466
|
});
|
|
489
467
|
|
package/cli/agentRuntimeLocal.ts
CHANGED
package/cli/client/agentRun.ts
CHANGED
|
@@ -44,7 +44,6 @@ type RunAgentTurnOptions = {
|
|
|
44
44
|
parentDialogId?: string;
|
|
45
45
|
background?: boolean;
|
|
46
46
|
noStream?: boolean;
|
|
47
|
-
noDefaultTestRoot?: boolean;
|
|
48
47
|
scriptDir: string;
|
|
49
48
|
env: EnvLike;
|
|
50
49
|
output: OutputLike;
|
|
@@ -52,9 +51,9 @@ type RunAgentTurnOptions = {
|
|
|
52
51
|
localRuntimeAdapter?: AgentRuntimeHostAdapter;
|
|
53
52
|
localRuntimeAdapterFactory?: (env: EnvLike, options?: { cwd?: string }) => AgentRuntimeHostAdapter;
|
|
54
53
|
localRuntimeCwd?: string;
|
|
55
|
-
maxToolRounds?: number;
|
|
56
54
|
timeoutMs?: number;
|
|
57
55
|
traceTools?: boolean;
|
|
56
|
+
eventsMode?: "jsonl";
|
|
58
57
|
taskRunContext?: TaskRunPromptContext;
|
|
59
58
|
taskRunRecorder?: (args: {
|
|
60
59
|
options: RunAgentTurnOptions;
|
|
@@ -198,6 +197,16 @@ function isMachineBoundLocalhostCustomProvider(agentConfig: any) {
|
|
|
198
197
|
}
|
|
199
198
|
}
|
|
200
199
|
|
|
200
|
+
function isCliProviderAgentConfig(agentConfig: any) {
|
|
201
|
+
const cliProvider = typeof agentConfig?.cliProvider === "string"
|
|
202
|
+
? agentConfig.cliProvider.trim()
|
|
203
|
+
: "";
|
|
204
|
+
const provider = typeof agentConfig?.provider === "string"
|
|
205
|
+
? agentConfig.provider.trim()
|
|
206
|
+
: "";
|
|
207
|
+
return Boolean(cliProvider) || provider === "agy" || provider === "codex" || provider === "claude";
|
|
208
|
+
}
|
|
209
|
+
|
|
201
210
|
function resolveAuthToken(env: EnvLike) {
|
|
202
211
|
return env.AUTH_TOKEN || env.AUTH || env.BENCHMARK_AUTH_TOKEN || "";
|
|
203
212
|
}
|
|
@@ -232,24 +241,33 @@ function resolveLocalRuntimeAdapter(options: RunAgentTurnOptions) {
|
|
|
232
241
|
|
|
233
242
|
async function shouldSkipAutoLocalForServerPlatformTools(options: RunAgentTurnOptions) {
|
|
234
243
|
if (isBuiltinNoloAgentRef(options.agentKey)) return false;
|
|
235
|
-
if (options.localRuntimeCwd
|
|
244
|
+
if (options.localRuntimeCwd) {
|
|
236
245
|
return false;
|
|
237
246
|
}
|
|
238
|
-
|
|
239
|
-
options.output.write(
|
|
240
|
-
`[nolo] auto runtime: skipping local runtime because ${options.agentKey} is a known platform agent. ` +
|
|
241
|
-
"Use --local explicitly to force local workspace tools.\n"
|
|
242
|
-
);
|
|
243
|
-
return true;
|
|
244
|
-
}
|
|
247
|
+
const knownServerPlatformAgent = isKnownServerPlatformAgent(options);
|
|
245
248
|
const adapter = resolveLocalRuntimeAdapter(options);
|
|
246
|
-
if (!adapter) return
|
|
249
|
+
if (!adapter) return knownServerPlatformAgent;
|
|
247
250
|
let agentConfig;
|
|
248
251
|
try {
|
|
249
252
|
agentConfig = await adapter.loadAgentConfig(options.agentKey);
|
|
250
253
|
} catch {
|
|
254
|
+
if (knownServerPlatformAgent) {
|
|
255
|
+
options.output.write(
|
|
256
|
+
`[nolo] auto runtime: skipping local runtime because ${options.agentKey} is a known platform agent. ` +
|
|
257
|
+
"Use --local explicitly to force local workspace tools.\n"
|
|
258
|
+
);
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
251
261
|
return false;
|
|
252
262
|
}
|
|
263
|
+
if (isCliProviderAgentConfig(agentConfig)) return false;
|
|
264
|
+
if (knownServerPlatformAgent) {
|
|
265
|
+
options.output.write(
|
|
266
|
+
`[nolo] auto runtime: skipping local runtime because ${options.agentKey} is a known platform agent. ` +
|
|
267
|
+
"Use --local explicitly to force local workspace tools.\n"
|
|
268
|
+
);
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
253
271
|
if (isMachineBoundLocalhostCustomProvider(agentConfig)) {
|
|
254
272
|
options.output.write(
|
|
255
273
|
`[nolo] auto runtime: skipping local runtime because ${options.agentKey} is a machine-bound localhost custom provider. ` +
|
|
@@ -278,7 +296,14 @@ function buildUserInputContent(message: string, imageUrls: string[] = []) {
|
|
|
278
296
|
}
|
|
279
297
|
|
|
280
298
|
function shouldTraceLocalTools(options: RunAgentTurnOptions) {
|
|
281
|
-
|
|
299
|
+
const setting = (options.env.NOLO_TRACE_TOOLS ?? "").trim().toLowerCase();
|
|
300
|
+
if (setting === "0" || setting === "false" || setting === "off") return false;
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function resolveAgentEventMode(options: RunAgentTurnOptions): "text" | "jsonl" {
|
|
305
|
+
if (options.eventsMode === "jsonl") return "jsonl";
|
|
306
|
+
return options.env.NOLO_AGENT_EVENTS === "jsonl" ? "jsonl" : "text";
|
|
282
307
|
}
|
|
283
308
|
|
|
284
309
|
function shouldCollectLocalToolEvidence(options: RunAgentTurnOptions) {
|
|
@@ -307,15 +332,6 @@ function summarizeLocalToolEvidence(events: LocalAgentToolEvent[]): TaskRunToolE
|
|
|
307
332
|
};
|
|
308
333
|
}
|
|
309
334
|
|
|
310
|
-
const DEFAULT_LOCAL_AGENT_TOOL_ROUND_RETRY_LIMIT = 512;
|
|
311
|
-
|
|
312
|
-
function parseLocalToolRoundLimitError(error: unknown) {
|
|
313
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
314
|
-
const match = message.match(/Local agent exceeded max tool rounds:\s*(\d+)/);
|
|
315
|
-
if (!match) return null;
|
|
316
|
-
return Number(match[1]);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
335
|
function isMissingLocalAgentConfigError(error: unknown, agentRef: string) {
|
|
320
336
|
return Boolean(
|
|
321
337
|
error &&
|
|
@@ -326,33 +342,33 @@ function isMissingLocalAgentConfigError(error: unknown, agentRef: string) {
|
|
|
326
342
|
);
|
|
327
343
|
}
|
|
328
344
|
|
|
329
|
-
function parsePositiveInteger(value: string | undefined) {
|
|
330
|
-
if (!value) return null;
|
|
331
|
-
const parsed = Number(value);
|
|
332
|
-
if (!Number.isInteger(parsed) || parsed <= 0) return null;
|
|
333
|
-
return parsed;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
function resolveLocalToolRoundRetryLimit(options: RunAgentTurnOptions) {
|
|
337
|
-
return (
|
|
338
|
-
parsePositiveInteger(options.env.NOLO_LOCAL_MAX_TOOL_ROUNDS_LIMIT) ??
|
|
339
|
-
DEFAULT_LOCAL_AGENT_TOOL_ROUND_RETRY_LIMIT
|
|
340
|
-
);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
function nextLocalToolRoundLimit(current: number) {
|
|
344
|
-
return current <= 0 ? 1 : current * 2;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
345
|
function formatToolTraceEvent(event: LocalAgentToolEvent) {
|
|
348
346
|
const round = event.round + 1;
|
|
347
|
+
const detail = event.argumentsPreview ? ` ${event.argumentsPreview}` : "";
|
|
349
348
|
if (event.type === "tool-call") {
|
|
350
|
-
return `[nolo:tool]
|
|
349
|
+
return `[nolo:tool] #${round} -> ${event.toolName}${detail}\n`;
|
|
351
350
|
}
|
|
352
351
|
if (event.type === "tool-error") {
|
|
353
|
-
|
|
352
|
+
const elapsed = typeof event.elapsedMs === "number" ? ` ${event.elapsedMs}ms` : "";
|
|
353
|
+
return `[nolo:tool] #${round} !! ${event.toolName}${elapsed}: ${event.message ?? "failed"}\n`;
|
|
354
354
|
}
|
|
355
|
-
|
|
355
|
+
const elapsed = typeof event.elapsedMs === "number" ? ` ${event.elapsedMs}ms` : "";
|
|
356
|
+
const summary = event.summary ? ` ${event.summary}` : "";
|
|
357
|
+
return `[nolo:tool] #${round} <- ${event.toolName}${elapsed}${summary}\n`;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function formatToolJsonEvent(event: LocalAgentToolEvent) {
|
|
361
|
+
return `${JSON.stringify({
|
|
362
|
+
schemaVersion: 1,
|
|
363
|
+
type: event.type,
|
|
364
|
+
round: event.round + 1,
|
|
365
|
+
tool: event.toolName,
|
|
366
|
+
toolCallId: event.toolCallId,
|
|
367
|
+
...(event.argumentsPreview ? { argsPreview: event.argumentsPreview } : {}),
|
|
368
|
+
...(typeof event.elapsedMs === "number" ? { elapsedMs: event.elapsedMs } : {}),
|
|
369
|
+
...(event.summary ? { summary: event.summary } : {}),
|
|
370
|
+
...(event.message ? { message: event.message } : {}),
|
|
371
|
+
})}\n`;
|
|
356
372
|
}
|
|
357
373
|
|
|
358
374
|
function shouldAttemptAutoLocal(options: RunAgentTurnOptions) {
|
|
@@ -629,7 +645,6 @@ async function runHttpAgentTurn(options: RunAgentTurnOptions, authToken: string)
|
|
|
629
645
|
: {}),
|
|
630
646
|
...(options.parentDialogId ? { parentDialogId: options.parentDialogId } : {}),
|
|
631
647
|
...(options.background ? { background: true } : {}),
|
|
632
|
-
...(typeof options.maxToolRounds === "number" ? { maxRounds: options.maxToolRounds } : {}),
|
|
633
648
|
...(typeof options.timeoutMs === "number" ? { timeoutMs: options.timeoutMs } : {}),
|
|
634
649
|
stream: !options.noStream && !options.background,
|
|
635
650
|
}),
|
|
@@ -717,7 +732,7 @@ async function runHttpAgentTurn(options: RunAgentTurnOptions, authToken: string)
|
|
|
717
732
|
}
|
|
718
733
|
|
|
719
734
|
async function runInjectedLocalAgentTurn(options: RunAgentTurnOptions) {
|
|
720
|
-
return
|
|
735
|
+
return runLocalAgentTurnForCli(options, { reportFailure: true });
|
|
721
736
|
}
|
|
722
737
|
|
|
723
738
|
async function refreshMissingLocalAgentConfig(options: RunAgentTurnOptions) {
|
|
@@ -727,53 +742,6 @@ async function refreshMissingLocalAgentConfig(options: RunAgentTurnOptions) {
|
|
|
727
742
|
return Boolean(agentConfig);
|
|
728
743
|
}
|
|
729
744
|
|
|
730
|
-
async function runLocalAgentTurnWithAutoRoundExpansion(
|
|
731
|
-
options: RunAgentTurnOptions,
|
|
732
|
-
settings: { reportFailure: boolean }
|
|
733
|
-
) {
|
|
734
|
-
const maxRetryLimit = resolveLocalToolRoundRetryLimit(options);
|
|
735
|
-
let currentMaxToolRounds = options.maxToolRounds;
|
|
736
|
-
let lastResult: Awaited<ReturnType<typeof runLocalAgentTurnForCli>> | null = null;
|
|
737
|
-
|
|
738
|
-
while (true) {
|
|
739
|
-
const attemptOptions = {
|
|
740
|
-
...options,
|
|
741
|
-
...(typeof currentMaxToolRounds === "number" ? { maxToolRounds: currentMaxToolRounds } : {}),
|
|
742
|
-
};
|
|
743
|
-
const result = await runLocalAgentTurnForCli(attemptOptions, { reportFailure: false });
|
|
744
|
-
lastResult = result;
|
|
745
|
-
if (result.exitCode === 0) return result;
|
|
746
|
-
|
|
747
|
-
const exhaustedRounds = parseLocalToolRoundLimitError(result.localError);
|
|
748
|
-
if (exhaustedRounds === null) break;
|
|
749
|
-
|
|
750
|
-
const nextMaxToolRounds = nextLocalToolRoundLimit(exhaustedRounds);
|
|
751
|
-
if (nextMaxToolRounds > maxRetryLimit) break;
|
|
752
|
-
|
|
753
|
-
options.output.write(
|
|
754
|
-
`[nolo] Local agent used all ${exhaustedRounds} tool rounds; retrying with ${nextMaxToolRounds}.\n`
|
|
755
|
-
);
|
|
756
|
-
currentMaxToolRounds = nextMaxToolRounds;
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
if (settings.reportFailure && lastResult?.localError) {
|
|
760
|
-
options.output.write(
|
|
761
|
-
`[nolo] Local agent run failed: ${
|
|
762
|
-
lastResult.localError instanceof Error ? lastResult.localError.message : String(lastResult.localError)
|
|
763
|
-
}\n`
|
|
764
|
-
);
|
|
765
|
-
await recordTaskRunOutcome({
|
|
766
|
-
options,
|
|
767
|
-
status: "failed",
|
|
768
|
-
errorCode: "LOCAL_AGENT_FAILED",
|
|
769
|
-
resultSummary:
|
|
770
|
-
lastResult.localError instanceof Error ? lastResult.localError.message : String(lastResult.localError),
|
|
771
|
-
toolEvidence: lastResult.toolEvidence,
|
|
772
|
-
});
|
|
773
|
-
}
|
|
774
|
-
return lastResult ?? { exitCode: 1 };
|
|
775
|
-
}
|
|
776
|
-
|
|
777
745
|
async function runLocalAgentTurnForCli(
|
|
778
746
|
options: RunAgentTurnOptions,
|
|
779
747
|
settings: { reportFailure: boolean }
|
|
@@ -790,6 +758,7 @@ async function runLocalAgentTurnForCli(
|
|
|
790
758
|
try {
|
|
791
759
|
const traceLocalTools = shouldTraceLocalTools(options);
|
|
792
760
|
const collectToolEvidence = shouldCollectLocalToolEvidence(options);
|
|
761
|
+
const eventMode = resolveAgentEventMode(options);
|
|
793
762
|
const result = await runLocalAgentTurn({
|
|
794
763
|
adapter,
|
|
795
764
|
agentRef: options.agentKey,
|
|
@@ -804,7 +773,6 @@ async function runLocalAgentTurnForCli(
|
|
|
804
773
|
parentDialogId: options.parentDialogId,
|
|
805
774
|
background: options.background,
|
|
806
775
|
noStream: options.noStream,
|
|
807
|
-
maxToolRounds: options.maxToolRounds,
|
|
808
776
|
...(typeof options.timeoutMs === "number" ? { timeoutMs: options.timeoutMs } : {}),
|
|
809
777
|
...(traceLocalTools || collectToolEvidence
|
|
810
778
|
? {
|
|
@@ -812,7 +780,11 @@ async function runLocalAgentTurnForCli(
|
|
|
812
780
|
if (collectToolEvidence) toolEvents.push(event);
|
|
813
781
|
if (traceLocalTools) {
|
|
814
782
|
spinner.stop();
|
|
815
|
-
options.output.write(
|
|
783
|
+
options.output.write(
|
|
784
|
+
eventMode === "jsonl"
|
|
785
|
+
? formatToolJsonEvent(event)
|
|
786
|
+
: formatToolTraceEvent(event)
|
|
787
|
+
);
|
|
816
788
|
}
|
|
817
789
|
},
|
|
818
790
|
}
|
|
@@ -968,7 +940,7 @@ export async function runAgentTurn(options: RunAgentTurnOptions) {
|
|
|
968
940
|
if (runtimeMode === "auto" && shouldAttemptAutoLocal(options)) {
|
|
969
941
|
const skipLocal = await shouldSkipAutoLocalForServerPlatformTools(options);
|
|
970
942
|
if (!skipLocal) {
|
|
971
|
-
const localResult = await
|
|
943
|
+
const localResult = await runLocalAgentTurnForCli(options, { reportFailure: false });
|
|
972
944
|
if (localResult.exitCode === 0) {
|
|
973
945
|
return {
|
|
974
946
|
exitCode: localResult.exitCode,
|
|
@@ -982,7 +954,7 @@ export async function runAgentTurn(options: RunAgentTurnOptions) {
|
|
|
982
954
|
try {
|
|
983
955
|
const refreshed = await refreshMissingLocalAgentConfig(options);
|
|
984
956
|
if (refreshed) {
|
|
985
|
-
const retriedLocalResult = await
|
|
957
|
+
const retriedLocalResult = await runLocalAgentTurnForCli(options, {
|
|
986
958
|
reportFailure: false,
|
|
987
959
|
});
|
|
988
960
|
if (retriedLocalResult.exitCode === 0) {
|