@infinityi/engine-lib 1.3.1 → 1.4.0
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 +81 -445
- package/dist/agent/index.js +14 -8
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.js +8 -5
- package/dist/context/providers.d.ts +3 -3
- package/dist/context/types.d.ts +16 -1
- package/dist/errors.d.ts +18 -0
- package/dist/errors.js +6 -1
- package/dist/events/index.js +2 -1
- package/dist/execution/index.js +9 -4
- package/dist/execution/types.d.ts +14 -0
- package/dist/index-37x76zdn.js +4 -0
- package/dist/index-4c15ysa8.js +84 -0
- package/dist/{index-pwr8179t.js → index-7nb9qwa1.js} +23 -14
- package/dist/{index-jxgj4z08.js → index-9egrqxkf.js} +4 -0
- package/dist/index-9rr5dkzh.js +0 -0
- package/dist/{index-w34cbktd.js → index-a67ej96j.js} +1 -0
- package/dist/{index-64tt9696.js → index-aed6fe4z.js} +3 -3
- package/dist/{index-7690reng.js → index-ajr3nk10.js} +15 -1
- package/dist/index-c6kgts41.js +0 -0
- package/dist/{index-xsv43c5j.js → index-e14g2e48.js} +2 -2
- package/dist/index-k0q7x4mz.js +54 -0
- package/dist/index-mnx5mqbs.js +102 -0
- package/dist/index-mr1hs98z.js +661 -0
- package/dist/{index-yrqrxwjt.js → index-nvdsr51v.js} +4 -38
- package/dist/{index-jp2b31xs.js → index-vwcyawfk.js} +4 -4
- package/dist/index-ycjsqfpq.js +39 -0
- package/dist/{index-bqg01r42.js → index-zdggff0y.js} +183 -180
- package/dist/index.d.ts +2 -2
- package/dist/index.js +49 -38
- package/dist/lifecycle/index.js +2 -0
- package/dist/messages/index.js +1 -0
- package/dist/providers/index.js +5 -4
- package/dist/retrieval/chunking.d.ts +8 -0
- package/dist/retrieval/context.d.ts +4 -0
- package/dist/retrieval/index.d.ts +19 -0
- package/dist/retrieval/index.js +747 -0
- package/dist/retrieval/loaders.d.ts +8 -0
- package/dist/retrieval/memory.d.ts +29 -0
- package/dist/retrieval/retriever.d.ts +8 -0
- package/dist/retrieval/types.d.ts +253 -0
- package/dist/retrieval/utils.d.ts +11 -0
- package/dist/retrieval/vector-store.d.ts +13 -0
- package/dist/runtime/index.js +2 -1
- package/dist/schema/index.js +10 -4
- package/dist/session/index.js +1 -0
- package/dist/session-stores/codec.d.ts +8 -0
- package/dist/session-stores/forge-data.d.ts +43 -0
- package/dist/session-stores/hooks.d.ts +4 -0
- package/dist/session-stores/ids.d.ts +3 -0
- package/dist/session-stores/index.d.ts +20 -0
- package/dist/session-stores/index.js +1382 -0
- package/dist/session-stores/jsonl.d.ts +26 -0
- package/dist/session-stores/redis.d.ts +45 -0
- package/dist/session-stores/types.d.ts +45 -0
- package/dist/session-stores/versioning.d.ts +6 -0
- package/dist/testing/conformance.js +5 -4
- package/dist/testing/index.js +1 -0
- package/dist/tools/index.js +5 -3
- package/dist/tools-fs/define.d.ts +2 -0
- package/dist/tools-fs/files.d.ts +40 -0
- package/dist/tools-fs/git.d.ts +14 -0
- package/dist/tools-fs/index.d.ts +19 -0
- package/dist/tools-fs/index.js +1695 -0
- package/dist/tools-fs/policy.d.ts +32 -0
- package/dist/tools-fs/schemas.d.ts +31 -0
- package/dist/tools-fs/search.d.ts +45 -0
- package/dist/tools-fs/symbols.d.ts +12 -0
- package/dist/tools-fs/types.d.ts +151 -0
- package/dist/tools-http/client.d.ts +12 -0
- package/dist/tools-http/define.d.ts +12 -0
- package/dist/tools-http/events.d.ts +22 -0
- package/dist/tools-http/index.d.ts +24 -0
- package/dist/tools-http/index.js +18 -0
- package/dist/tools-http/policy.d.ts +52 -0
- package/dist/tools-http/types.d.ts +116 -0
- package/dist/tools-shell/define.d.ts +23 -0
- package/dist/tools-shell/events.d.ts +38 -0
- package/dist/tools-shell/exec.d.ts +37 -0
- package/dist/tools-shell/index.d.ts +30 -0
- package/dist/tools-shell/index.js +327 -0
- package/dist/tools-shell/policy.d.ts +42 -0
- package/dist/tools-shell/types.d.ts +121 -0
- package/dist/tools-web/define.d.ts +11 -0
- package/dist/tools-web/html.d.ts +22 -0
- package/dist/tools-web/index.d.ts +21 -0
- package/dist/tools-web/index.js +472 -0
- package/dist/tools-web/types.d.ts +81 -0
- package/docs/README.md +58 -10
- package/docs/api/.nojekyll +1 -0
- package/docs/api/assets/hierarchy.js +1 -0
- package/docs/api/assets/highlight.css +99 -0
- package/docs/api/assets/icons.js +18 -0
- package/docs/api/assets/icons.svg +1 -0
- package/docs/api/assets/main.js +60 -0
- package/docs/api/assets/navigation.js +1 -0
- package/docs/api/assets/search.js +1 -0
- package/docs/api/assets/style.css +1633 -0
- package/docs/api/classes/errors.AgentError.html +47 -0
- package/docs/api/classes/errors.CancelledError.html +46 -0
- package/docs/api/classes/errors.ContextWindowError.html +48 -0
- package/docs/api/classes/errors.ExecutionError.html +46 -0
- package/docs/api/classes/errors.FilesystemPolicyError.html +48 -0
- package/docs/api/classes/errors.MaxHandoffsExceededError.html +47 -0
- package/docs/api/classes/errors.MaxStepsExceededError.html +47 -0
- package/docs/api/classes/errors.ProviderError.html +47 -0
- package/docs/api/classes/errors.SchemaValidationError.html +47 -0
- package/docs/api/classes/errors.ShellPolicyError.html +50 -0
- package/docs/api/classes/errors.ToolError.html +47 -0
- package/docs/api/classes/errors.ToolValidationError.html +48 -0
- package/docs/api/classes/index.InMemorySessionStore.html +11 -0
- package/docs/api/classes/index.Secret.html +20 -0
- package/docs/api/classes/providers.StreamAccumulator.html +8 -0
- package/docs/api/classes/session-stores.FilesystemJsonlSessionStore.html +13 -0
- package/docs/api/classes/session-stores.ForgeDataSessionStore.html +14 -0
- package/docs/api/classes/session-stores.RedisSessionStore.html +12 -0
- package/docs/api/classes/tools-http.HttpPolicyError.html +41 -0
- package/docs/api/functions/agent.createToolRegistry.html +3 -0
- package/docs/api/functions/agent.handoffProviderTools.html +3 -0
- package/docs/api/functions/agent.handoffToolName.html +2 -0
- package/docs/api/functions/agent.resolveHandoffTargets.html +8 -0
- package/docs/api/functions/context.applyContextWindow.html +5 -0
- package/docs/api/functions/context.estimateTokens.html +3 -0
- package/docs/api/functions/context.resolveContext.html +5 -0
- package/docs/api/functions/events.createRunTelemetry.html +3 -0
- package/docs/api/functions/events.eventFields.html +4 -0
- package/docs/api/functions/events.eventPayload.html +5 -0
- package/docs/api/functions/execution.addUsage.html +2 -0
- package/docs/api/functions/execution.emptyUsage.html +2 -0
- package/docs/api/functions/index.asSchema.html +4 -0
- package/docs/api/functions/index.asTool.html +8 -0
- package/docs/api/functions/index.assistant.html +2 -0
- package/docs/api/functions/index.createAgentRegistry.html +5 -0
- package/docs/api/functions/index.createAnthropic.html +5 -0
- package/docs/api/functions/index.createEventHub.html +2 -0
- package/docs/api/functions/index.createGoogle.html +5 -0
- package/docs/api/functions/index.createOpenAI.html +5 -0
- package/docs/api/functions/index.createOpenAICompatible.html +7 -0
- package/docs/api/functions/index.createSession.html +3 -0
- package/docs/api/functions/index.defineAgent.html +7 -0
- package/docs/api/functions/index.defineTool.html +7 -0
- package/docs/api/functions/index.dynamicContext.html +2 -0
- package/docs/api/functions/index.fromJsonSchema.html +3 -0
- package/docs/api/functions/index.isSecret.html +4 -0
- package/docs/api/functions/index.loggingSubscriber.html +4 -0
- package/docs/api/functions/index.messageBusSubscriber.html +6 -0
- package/docs/api/functions/index.normalizeContent.html +2 -0
- package/docs/api/functions/index.resolveSecret.html +4 -0
- package/docs/api/functions/index.runAgent.html +19 -0
- package/docs/api/functions/index.staticContext.html +3 -0
- package/docs/api/functions/index.summarizeOldest.html +4 -0
- package/docs/api/functions/index.system.html +2 -0
- package/docs/api/functions/index.text.html +2 -0
- package/docs/api/functions/index.toJsonSchema.html +2 -0
- package/docs/api/functions/index.toolResult.html +2 -0
- package/docs/api/functions/index.truncateOldest.html +5 -0
- package/docs/api/functions/index.user.html +2 -0
- package/docs/api/functions/index.validateJsonSchema.html +3 -0
- package/docs/api/functions/lifecycle.agentRuntimeComponent.html +5 -0
- package/docs/api/functions/providers.collectStream.html +2 -0
- package/docs/api/functions/providers.createProvider.html +4 -0
- package/docs/api/functions/providers.createProviderHttp.html +3 -0
- package/docs/api/functions/providers.defaultProviderResilience.html +3 -0
- package/docs/api/functions/providers.openSseStream.html +6 -0
- package/docs/api/functions/providers.parseSse.html +2 -0
- package/docs/api/functions/providers.toProviderError.html +2 -0
- package/docs/api/functions/session-stores.createPostgresSessionStore.html +1 -0
- package/docs/api/functions/session-stores.createSqliteSessionStore.html +1 -0
- package/docs/api/functions/session-stores.isCloseableSessionStore.html +1 -0
- package/docs/api/functions/session-stores.isVersionedSessionStore.html +1 -0
- package/docs/api/functions/session-stores.migrateSessionStore.html +1 -0
- package/docs/api/functions/session-stores.withSessionStoreHooks.html +2 -0
- package/docs/api/functions/testing.byteStreamOf.html +2 -0
- package/docs/api/functions/testing.collectProviderStream.html +2 -0
- package/docs/api/functions/testing.conversation.html +2 -0
- package/docs/api/functions/testing.expectValid.html +3 -0
- package/docs/api/functions/testing.inMemorySessionStore.html +2 -0
- package/docs/api/functions/testing.jsonFetch.html +3 -0
- package/docs/api/functions/testing.mockProvider.html +3 -0
- package/docs/api/functions/testing.scriptedProvider.html +4 -0
- package/docs/api/functions/testing.sseFetch.html +3 -0
- package/docs/api/functions/testing.textResult.html +3 -0
- package/docs/api/functions/testing.toolCallResult.html +3 -0
- package/docs/api/functions/testing_conformance.runProviderConformance.html +3 -0
- package/docs/api/functions/tools-fs.filesystemTools.html +1 -0
- package/docs/api/functions/tools-http.createHttpToolClient.html +2 -0
- package/docs/api/functions/tools-http.httpTools.html +2 -0
- package/docs/api/functions/tools-shell.shellTools.html +4 -0
- package/docs/api/functions/tools-web.webTools.html +2 -0
- package/docs/api/functions/tools.renderToolContent.html +6 -0
- package/docs/api/functions/tools.toProviderTool.html +3 -0
- package/docs/api/functions/tools.toToolResultMessage.html +4 -0
- package/docs/api/hierarchy.html +1 -0
- package/docs/api/index.html +1 -0
- package/docs/api/interfaces/agent.ToolRegistry.html +8 -0
- package/docs/api/interfaces/errors.SchemaIssue.html +4 -0
- package/docs/api/interfaces/events.RunTelemetry.html +10 -0
- package/docs/api/interfaces/events.SpanHandle.html +6 -0
- package/docs/api/interfaces/index.AgentDefinition.html +16 -0
- package/docs/api/interfaces/index.AgentHooks.html +21 -0
- package/docs/api/interfaces/index.AgentRegistry.html +16 -0
- package/docs/api/interfaces/index.AnthropicOptions.html +13 -0
- package/docs/api/interfaces/index.AsToolOptions.html +13 -0
- package/docs/api/interfaces/index.CompletionRequest.html +30 -0
- package/docs/api/interfaces/index.CompletionResult.html +14 -0
- package/docs/api/interfaces/index.ContextItem.html +6 -0
- package/docs/api/interfaces/index.ContextProvider.html +5 -0
- package/docs/api/interfaces/index.ContextStrategy.html +8 -0
- package/docs/api/interfaces/index.ContextStrategyContext.html +8 -0
- package/docs/api/interfaces/index.ContextWindowOptions.html +8 -0
- package/docs/api/interfaces/index.CreateSessionOptions.html +10 -0
- package/docs/api/interfaces/index.EngineContext.html +10 -0
- package/docs/api/interfaces/index.EventHub.html +4 -0
- package/docs/api/interfaces/index.EventHubOptions.html +8 -0
- package/docs/api/interfaces/index.GenerationSettings.html +12 -0
- package/docs/api/interfaces/index.GoogleOptions.html +11 -0
- package/docs/api/interfaces/index.ImagePart.html +5 -0
- package/docs/api/interfaces/index.InstructionContext.html +9 -0
- package/docs/api/interfaces/index.JsonSchema.html +18 -0
- package/docs/api/interfaces/index.LoggingSubscriberOptions.html +4 -0
- package/docs/api/interfaces/index.Message.html +8 -0
- package/docs/api/interfaces/index.MessageBusSubscriberOptions.html +4 -0
- package/docs/api/interfaces/index.OpenAICompatibleOptions.html +16 -0
- package/docs/api/interfaces/index.OpenAIOptions.html +16 -0
- package/docs/api/interfaces/index.Provider.html +11 -0
- package/docs/api/interfaces/index.ProviderCapabilities.html +9 -0
- package/docs/api/interfaces/index.ProviderTool.html +6 -0
- package/docs/api/interfaces/index.ResponseSchema.html +6 -0
- package/docs/api/interfaces/index.RunBridge.html +10 -0
- package/docs/api/interfaces/index.RunOptions.html +39 -0
- package/docs/api/interfaces/index.RunResult.html +20 -0
- package/docs/api/interfaces/index.Schema.html +13 -0
- package/docs/api/interfaces/index.Session.html +13 -0
- package/docs/api/interfaces/index.SessionState.html +5 -0
- package/docs/api/interfaces/index.SessionStore.html +15 -0
- package/docs/api/interfaces/index.TextPart.html +4 -0
- package/docs/api/interfaces/index.ToolCall.html +9 -0
- package/docs/api/interfaces/index.ToolCallPart.html +6 -0
- package/docs/api/interfaces/index.ToolContext.html +21 -0
- package/docs/api/interfaces/index.ToolDefinition.html +14 -0
- package/docs/api/interfaces/index.ToolFailure.html +9 -0
- package/docs/api/interfaces/index.ToolResultPart.html +8 -0
- package/docs/api/interfaces/index.ToolSpec.html +6 -0
- package/docs/api/interfaces/index.ToolSuccess.html +6 -0
- package/docs/api/interfaces/index.Usage.html +9 -0
- package/docs/api/interfaces/lifecycle.AgentRuntimeOptions.html +17 -0
- package/docs/api/interfaces/providers.AdapterSpec.html +17 -0
- package/docs/api/interfaces/providers.ProviderHttpOptions.html +14 -0
- package/docs/api/interfaces/providers.SseMessage.html +6 -0
- package/docs/api/interfaces/providers.SseRequest.html +8 -0
- package/docs/api/interfaces/runtime.Logger.html +22 -0
- package/docs/api/interfaces/runtime.Telemetry.html +9 -0
- package/docs/api/interfaces/schema.OptionalSchema.html +13 -0
- package/docs/api/interfaces/session-stores.CloseableSessionStore.html +11 -0
- package/docs/api/interfaces/session-stores.CreatePostgresSessionStoreOptions.html +6 -0
- package/docs/api/interfaces/session-stores.CreateSqliteSessionStoreOptions.html +7 -0
- package/docs/api/interfaces/session-stores.FilesystemJsonlSessionStoreOptions.html +3 -0
- package/docs/api/interfaces/session-stores.ForgeDataSessionStoreOptions.html +5 -0
- package/docs/api/interfaces/session-stores.RedisSessionStoreClient.html +9 -0
- package/docs/api/interfaces/session-stores.RedisSessionStoreOptions.html +4 -0
- package/docs/api/interfaces/session-stores.RedisSessionStoreTransaction.html +6 -0
- package/docs/api/interfaces/session-stores.SessionArchiveRecord.html +7 -0
- package/docs/api/interfaces/session-stores.SessionArchiver.html +2 -0
- package/docs/api/interfaces/session-stores.SessionCompactionResult.html +3 -0
- package/docs/api/interfaces/session-stores.SessionCompactor.html +3 -0
- package/docs/api/interfaces/session-stores.SessionStoreCodec.html +6 -0
- package/docs/api/interfaces/session-stores.SessionStoreHookContext.html +3 -0
- package/docs/api/interfaces/session-stores.SessionStoreHooks.html +3 -0
- package/docs/api/interfaces/session-stores.VersionedSessionStore.html +11 -0
- package/docs/api/interfaces/testing.MockProviderOptions.html +12 -0
- package/docs/api/interfaces/testing.RecordedCall.html +4 -0
- package/docs/api/interfaces/testing.RecordingFetch.html +4 -0
- package/docs/api/interfaces/testing_conformance.ConformanceFixtures.html +12 -0
- package/docs/api/interfaces/testing_conformance.ConformanceOptions.html +10 -0
- package/docs/api/interfaces/testing_conformance.ConformanceTestApi.html +4 -0
- package/docs/api/interfaces/testing_conformance.ProviderIO.html +7 -0
- package/docs/api/interfaces/tools-fs.ApplyPatchArgs.html +6 -0
- package/docs/api/interfaces/tools-fs.DiffStatusArgs.html +5 -0
- package/docs/api/interfaces/tools-fs.EditRangeArgs.html +7 -0
- package/docs/api/interfaces/tools-fs.EditReplaceArgs.html +7 -0
- package/docs/api/interfaces/tools-fs.FilesystemTools.html +13 -0
- package/docs/api/interfaces/tools-fs.FilesystemToolsConfig.html +12 -0
- package/docs/api/interfaces/tools-fs.FindFilesArgs.html +7 -0
- package/docs/api/interfaces/tools-fs.OpenWindowArgs.html +5 -0
- package/docs/api/interfaces/tools-fs.ReadArgs.html +9 -0
- package/docs/api/interfaces/tools-fs.RepoMapArgs.html +7 -0
- package/docs/api/interfaces/tools-fs.SearchSemanticArgs.html +8 -0
- package/docs/api/interfaces/tools-fs.SearchTextArgs.html +11 -0
- package/docs/api/interfaces/tools-fs.SymbolInfo.html +7 -0
- package/docs/api/interfaces/tools-fs.SymbolsArgs.html +5 -0
- package/docs/api/interfaces/tools-fs.ValidationCommandRequest.html +4 -0
- package/docs/api/interfaces/tools-fs.ValidationCommandResult.html +6 -0
- package/docs/api/interfaces/tools-fs.ValidationOptions.html +4 -0
- package/docs/api/interfaces/tools-fs.WriteFileArgs.html +6 -0
- package/docs/api/interfaces/tools-http.HeaderEntry.html +4 -0
- package/docs/api/interfaces/tools-http.HttpClientRequest.html +11 -0
- package/docs/api/interfaces/tools-http.HttpPolicy.html +13 -0
- package/docs/api/interfaces/tools-http.HttpRequestResult.html +17 -0
- package/docs/api/interfaces/tools-http.HttpRetryOptions.html +10 -0
- package/docs/api/interfaces/tools-http.HttpToolClient.html +5 -0
- package/docs/api/interfaces/tools-http.HttpTools.html +4 -0
- package/docs/api/interfaces/tools-http.HttpToolsConfig.html +38 -0
- package/docs/api/interfaces/tools-shell.ApprovalDecision.html +5 -0
- package/docs/api/interfaces/tools-shell.CommandRequest.html +14 -0
- package/docs/api/interfaces/tools-shell.CommandResult.html +21 -0
- package/docs/api/interfaces/tools-shell.EnvPolicy.html +9 -0
- package/docs/api/interfaces/tools-shell.ShellPolicy.html +7 -0
- package/docs/api/interfaces/tools-shell.ShellTools.html +6 -0
- package/docs/api/interfaces/tools-shell.ShellToolsConfig.html +26 -0
- package/docs/api/interfaces/tools-web.Citation.html +6 -0
- package/docs/api/interfaces/tools-web.SearchProvider.html +3 -0
- package/docs/api/interfaces/tools-web.SearchRequest.html +4 -0
- package/docs/api/interfaces/tools-web.SearchResult.html +7 -0
- package/docs/api/interfaces/tools-web.SourceMetadata.html +10 -0
- package/docs/api/interfaces/tools-web.WebTools.html +6 -0
- package/docs/api/interfaces/tools-web.WebToolsConfig.html +56 -0
- package/docs/api/modules/agent.html +5 -0
- package/docs/api/modules/context.html +5 -0
- package/docs/api/modules/errors.html +8 -0
- package/docs/api/modules/events.html +16 -0
- package/docs/api/modules/execution.html +4 -0
- package/docs/api/modules/index.html +16 -0
- package/docs/api/modules/lifecycle.html +6 -0
- package/docs/api/modules/messages.html +3 -0
- package/docs/api/modules/providers.html +10 -0
- package/docs/api/modules/runtime.html +4 -0
- package/docs/api/modules/schema.html +5 -0
- package/docs/api/modules/session-stores.html +6 -0
- package/docs/api/modules/session.html +4 -0
- package/docs/api/modules/testing.html +4 -0
- package/docs/api/modules/testing_conformance.html +21 -0
- package/docs/api/modules/tools-fs.html +9 -0
- package/docs/api/modules/tools-http.html +8 -0
- package/docs/api/modules/tools-shell.html +12 -0
- package/docs/api/modules/tools-web.html +7 -0
- package/docs/api/modules/tools.html +4 -0
- package/docs/api/types/events.Attrs.html +2 -0
- package/docs/api/types/index.AnyRunOptions.html +3 -0
- package/docs/api/types/index.BufferedRunOptions.html +2 -0
- package/docs/api/types/index.ContentPart.html +2 -0
- package/docs/api/types/index.FinishReason.html +2 -0
- package/docs/api/types/index.Infer.html +2 -0
- package/docs/api/types/index.Instructions.html +5 -0
- package/docs/api/types/index.LogLevel.html +2 -0
- package/docs/api/types/index.Role.html +2 -0
- package/docs/api/types/index.RunEvent.html +30 -0
- package/docs/api/types/index.RunHandle.html +7 -0
- package/docs/api/types/index.RunInput.html +2 -0
- package/docs/api/types/index.RunSubscriber.html +4 -0
- package/docs/api/types/index.SafeParseResult.html +2 -0
- package/docs/api/types/index.StreamEvent.html +8 -0
- package/docs/api/types/index.StreamingRunOptions.html +2 -0
- package/docs/api/types/index.TelemetryHandle.html +2 -0
- package/docs/api/types/index.TokenCounter.html +2 -0
- package/docs/api/types/index.ToolChoice.html +2 -0
- package/docs/api/types/index.ToolResult.html +2 -0
- package/docs/api/types/lifecycle.ProviderProbe.html +2 -0
- package/docs/api/types/session-stores.SessionStoreHookOperation.html +1 -0
- package/docs/api/types/testing_conformance.MakeProvider.html +2 -0
- package/docs/api/types/tools-fs.SymbolKind.html +1 -0
- package/docs/api/types/tools-http.HostPattern.html +2 -0
- package/docs/api/types/tools-shell.CommandPattern.html +2 -0
- package/docs/api/types/tools-web.RobotsPolicy.html +2 -0
- package/docs/api/variables/events.SPAN_PROVIDER.html +2 -0
- package/docs/api/variables/events.SPAN_RUN.html +2 -0
- package/docs/api/variables/events.SPAN_TOOL.html +2 -0
- package/docs/api/variables/execution.DEFAULT_MAX_HANDOFFS.html +2 -0
- package/docs/api/variables/execution.DEFAULT_MAX_STEPS.html +2 -0
- package/docs/api/variables/index.s.html +11 -0
- package/docs/api/variables/providers.DEFAULT_TIMEOUT_MS.html +2 -0
- package/docs/api/variables/session-stores.SESSION_STORE_SCHEMA_VERSION.html +1 -0
- package/docs/api/variables/session-stores.jsonSessionStoreCodec.html +2 -0
- package/docs/api/variables/tools-http.HTTP_EVENT.html +2 -0
- package/docs/api/variables/tools-shell.SHELL_EVENT.html +2 -0
- package/docs/events-and-telemetry.md +68 -0
- package/docs/execution.md +63 -0
- package/docs/getting-started.md +73 -0
- package/docs/multi-agent.md +52 -0
- package/docs/optional-tool-packs.md +93 -0
- package/docs/providers.md +68 -0
- package/docs/retrieval.md +83 -0
- package/docs/sessions-and-context.md +82 -0
- package/docs/testing-and-lifecycle.md +60 -0
- package/docs/tools.md +69 -0
- package/examples/01-minimal-agent.ts +19 -0
- package/examples/02-custom-tool.ts +32 -0
- package/examples/03-streaming.ts +46 -0
- package/examples/04-sessions-context.ts +40 -0
- package/examples/05-events-subscribers.ts +35 -0
- package/examples/06-multi-agent-handoff.ts +27 -0
- package/examples/07-sub-agent-tool.ts +26 -0
- package/examples/08-testing-agent.ts +31 -0
- package/examples/09-tools-filesystem.ts +49 -0
- package/examples/10-tools-http-web.ts +74 -0
- package/examples/11-shell-tools.ts +39 -0
- package/examples/12-provider-openai.ts +24 -0
- package/examples/13-lifecycle.ts +37 -0
- package/examples/14-retrieval.ts +65 -0
- package/examples/incident-analysis.ts +52 -0
- package/package.json +78 -4
- package/dist/index-02s1fjxr.js +0 -226
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Message } from "../messages/types";
|
|
2
|
+
import type { SessionState, SessionStore } from "../session/types";
|
|
3
|
+
import type { SessionStoreCodec } from "./types";
|
|
4
|
+
export interface FilesystemJsonlSessionStoreOptions {
|
|
5
|
+
readonly directory: string;
|
|
6
|
+
readonly codec?: SessionStoreCodec;
|
|
7
|
+
}
|
|
8
|
+
/** Append-only JSONL {@link SessionStore} backed by one file per session id. */
|
|
9
|
+
export declare class FilesystemJsonlSessionStore implements SessionStore {
|
|
10
|
+
private readonly directory;
|
|
11
|
+
private readonly codec;
|
|
12
|
+
private readonly queues;
|
|
13
|
+
constructor(options: FilesystemJsonlSessionStoreOptions);
|
|
14
|
+
migrate(): Promise<void>;
|
|
15
|
+
load(id: string): Promise<SessionState | undefined>;
|
|
16
|
+
append(id: string, messages: readonly Message[]): Promise<void>;
|
|
17
|
+
save(state: SessionState): Promise<void>;
|
|
18
|
+
delete(id: string): Promise<void>;
|
|
19
|
+
compact(id?: string): Promise<void>;
|
|
20
|
+
private pathFor;
|
|
21
|
+
private waitForWrites;
|
|
22
|
+
private enqueue;
|
|
23
|
+
private appendRecord;
|
|
24
|
+
private replayFile;
|
|
25
|
+
private compactFile;
|
|
26
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Message } from "../messages/types";
|
|
2
|
+
import type { SessionState, SessionStore } from "../session/types";
|
|
3
|
+
import type { SessionStoreCodec } from "./types";
|
|
4
|
+
export interface RedisSessionStoreTransaction {
|
|
5
|
+
del(...keys: string[]): RedisSessionStoreTransaction;
|
|
6
|
+
set(key: string, value: string): RedisSessionStoreTransaction;
|
|
7
|
+
rPush?(key: string, ...values: string[]): RedisSessionStoreTransaction;
|
|
8
|
+
rpush?(key: string, ...values: string[]): RedisSessionStoreTransaction;
|
|
9
|
+
exec(): Promise<unknown> | unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface RedisSessionStoreClient {
|
|
12
|
+
get(key: string): Promise<string | null | undefined> | string | null | undefined;
|
|
13
|
+
set(key: string, value: string): Promise<unknown> | unknown;
|
|
14
|
+
del(...keys: string[]): Promise<unknown> | unknown;
|
|
15
|
+
lRange?(key: string, start: number, stop: number): Promise<string[]> | string[];
|
|
16
|
+
lrange?(key: string, start: number, stop: number): Promise<string[]> | string[];
|
|
17
|
+
rPush?(key: string, ...values: string[]): Promise<unknown> | unknown;
|
|
18
|
+
rpush?(key: string, ...values: string[]): Promise<unknown> | unknown;
|
|
19
|
+
multi?(): RedisSessionStoreTransaction;
|
|
20
|
+
}
|
|
21
|
+
export interface RedisSessionStoreOptions {
|
|
22
|
+
readonly client: RedisSessionStoreClient;
|
|
23
|
+
readonly keyPrefix?: string;
|
|
24
|
+
readonly codec?: SessionStoreCodec;
|
|
25
|
+
}
|
|
26
|
+
/** Redis-list-backed {@link SessionStore} using a structural Redis client. */
|
|
27
|
+
export declare class RedisSessionStore implements SessionStore {
|
|
28
|
+
private readonly client;
|
|
29
|
+
private readonly keyPrefix;
|
|
30
|
+
private readonly codec;
|
|
31
|
+
constructor(options: RedisSessionStoreOptions);
|
|
32
|
+
migrate(): Promise<void>;
|
|
33
|
+
load(id: string): Promise<SessionState | undefined>;
|
|
34
|
+
append(id: string, messages: readonly Message[]): Promise<void>;
|
|
35
|
+
save(state: SessionState): Promise<void>;
|
|
36
|
+
delete(id: string): Promise<void>;
|
|
37
|
+
private transaction;
|
|
38
|
+
private lRange;
|
|
39
|
+
private rPush;
|
|
40
|
+
private idKey;
|
|
41
|
+
private messagesKey;
|
|
42
|
+
private metadataKey;
|
|
43
|
+
private existsKey;
|
|
44
|
+
private versionKey;
|
|
45
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Message } from "../messages/types";
|
|
2
|
+
import type { SessionState, SessionStore } from "../session/types";
|
|
3
|
+
/** Encodes persisted session payloads. Wrap this to add encryption at rest. */
|
|
4
|
+
export interface SessionStoreCodec {
|
|
5
|
+
encodeMessage(message: Message): Promise<string> | string;
|
|
6
|
+
decodeMessage(payload: string): Promise<Message> | Message;
|
|
7
|
+
encodeMetadata?(metadata: Readonly<Record<string, unknown>> | undefined): Promise<string | undefined> | string | undefined;
|
|
8
|
+
decodeMetadata?(payload: string | undefined): Promise<Readonly<Record<string, unknown>> | undefined> | Readonly<Record<string, unknown>> | undefined;
|
|
9
|
+
}
|
|
10
|
+
/** A store that can initialize or migrate its backing data format. */
|
|
11
|
+
export interface VersionedSessionStore extends SessionStore {
|
|
12
|
+
migrate(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
/** A store that owns resources that should be released at shutdown. */
|
|
15
|
+
export interface CloseableSessionStore extends SessionStore {
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export type SessionStoreHookOperation = "append" | "save";
|
|
19
|
+
export interface SessionStoreHookContext {
|
|
20
|
+
readonly operation: SessionStoreHookOperation;
|
|
21
|
+
readonly store: SessionStore;
|
|
22
|
+
}
|
|
23
|
+
export interface SessionArchiveRecord {
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly at: string;
|
|
26
|
+
readonly operation: SessionStoreHookOperation;
|
|
27
|
+
readonly messages?: readonly Message[];
|
|
28
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
29
|
+
readonly reason?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface SessionCompactionResult {
|
|
32
|
+
readonly state: SessionState;
|
|
33
|
+
readonly archive?: Omit<SessionArchiveRecord, "id" | "at" | "operation">;
|
|
34
|
+
}
|
|
35
|
+
export interface SessionCompactor {
|
|
36
|
+
shouldCompact?(state: SessionState, context: SessionStoreHookContext): Promise<boolean> | boolean;
|
|
37
|
+
compact(state: SessionState, context: SessionStoreHookContext): Promise<SessionState | SessionCompactionResult> | SessionState | SessionCompactionResult;
|
|
38
|
+
}
|
|
39
|
+
export interface SessionArchiver {
|
|
40
|
+
archive(record: SessionArchiveRecord, context: SessionStoreHookContext): Promise<void> | void;
|
|
41
|
+
}
|
|
42
|
+
export interface SessionStoreHooks {
|
|
43
|
+
readonly compactor?: SessionCompactor;
|
|
44
|
+
readonly archiver?: SessionArchiver;
|
|
45
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SessionStore } from "../session/types";
|
|
2
|
+
import type { CloseableSessionStore, VersionedSessionStore } from "./types";
|
|
3
|
+
export declare const SESSION_STORE_SCHEMA_VERSION = 1;
|
|
4
|
+
export declare function isVersionedSessionStore(store: SessionStore): store is VersionedSessionStore;
|
|
5
|
+
export declare function isCloseableSessionStore(store: SessionStore): store is CloseableSessionStore;
|
|
6
|
+
export declare function migrateSessionStore(store: SessionStore): Promise<void>;
|
|
@@ -6,14 +6,15 @@ import"../index-vnby35rm.js";
|
|
|
6
6
|
import"../index-19pwq79t.js";
|
|
7
7
|
import {
|
|
8
8
|
combine
|
|
9
|
-
} from "../index-
|
|
9
|
+
} from "../index-zdggff0y.js";
|
|
10
10
|
import"../index-zfgr4xx3.js";
|
|
11
|
-
import {
|
|
12
|
-
ProviderError
|
|
13
|
-
} from "../index-7690reng.js";
|
|
14
11
|
import {
|
|
15
12
|
user
|
|
16
13
|
} from "../index-1p6mb2vz.js";
|
|
14
|
+
import {
|
|
15
|
+
ProviderError
|
|
16
|
+
} from "../index-ajr3nk10.js";
|
|
17
|
+
import"../index-37x76zdn.js";
|
|
17
18
|
|
|
18
19
|
// src/testing/conformance.ts
|
|
19
20
|
function getTestApi() {
|
package/dist/testing/index.js
CHANGED
package/dist/tools/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
defineTool
|
|
3
|
-
} from "../index-w34cbktd.js";
|
|
1
|
+
import"../index-9rr5dkzh.js";
|
|
4
2
|
import {
|
|
5
3
|
renderToolContent,
|
|
6
4
|
toProviderTool,
|
|
7
5
|
toToolResultMessage
|
|
8
6
|
} from "../index-rentvdpp.js";
|
|
9
7
|
import"../index-1p6mb2vz.js";
|
|
8
|
+
import {
|
|
9
|
+
defineTool
|
|
10
|
+
} from "../index-a67ej96j.js";
|
|
11
|
+
import"../index-37x76zdn.js";
|
|
10
12
|
export {
|
|
11
13
|
toToolResultMessage,
|
|
12
14
|
toProviderTool,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface ListedEntry {
|
|
2
|
+
readonly path: string;
|
|
3
|
+
readonly relativePath: string;
|
|
4
|
+
readonly type: "file" | "directory" | "symlink" | "other";
|
|
5
|
+
readonly size: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ListOptions {
|
|
8
|
+
readonly includeHidden?: boolean;
|
|
9
|
+
readonly respectGitignore?: boolean;
|
|
10
|
+
readonly includeFiles?: boolean;
|
|
11
|
+
readonly maxEntries?: number;
|
|
12
|
+
readonly onlyFiles?: boolean;
|
|
13
|
+
readonly includeGlobs?: readonly string[];
|
|
14
|
+
readonly excludeGlobs?: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export declare function fileVersion(bytes: string | Buffer): string;
|
|
17
|
+
export declare function languageForPath(path: string): string | undefined;
|
|
18
|
+
export declare function isProbablyTextPath(path: string): boolean;
|
|
19
|
+
export declare function isHiddenRelativePath(path: string): boolean;
|
|
20
|
+
export declare function listEntries(root: string, options?: ListOptions): Promise<{
|
|
21
|
+
readonly entries: ListedEntry[];
|
|
22
|
+
readonly truncated: boolean;
|
|
23
|
+
readonly total: number;
|
|
24
|
+
}>;
|
|
25
|
+
export declare function readTextFile(path: string, maxBytes: number): Promise<{
|
|
26
|
+
readonly text: string;
|
|
27
|
+
readonly version: string;
|
|
28
|
+
readonly truncated: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
export declare function atomicWrite(path: string, content: string): Promise<string>;
|
|
31
|
+
export declare function removeFile(path: string): Promise<void>;
|
|
32
|
+
export declare function lineOffsets(text: string): readonly string[];
|
|
33
|
+
export declare function renderLineRange(lines: readonly string[], startLine: number, endLine: number, includeLineNumbers: boolean): string;
|
|
34
|
+
export declare function clampLineRange(totalLines: number, startLine?: number, endLine?: number): {
|
|
35
|
+
readonly startLine: number;
|
|
36
|
+
readonly endLine: number;
|
|
37
|
+
};
|
|
38
|
+
export declare function detectFrameworks(entries: readonly ListedEntry[]): string[];
|
|
39
|
+
export declare function importantFiles(entries: readonly ListedEntry[]): string[];
|
|
40
|
+
export declare function pathForDisplay(root: string, path: string): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function diffStatus(root: string, options: {
|
|
2
|
+
readonly paths?: readonly string[];
|
|
3
|
+
readonly includeDiff: boolean;
|
|
4
|
+
readonly maxDiffChars: number;
|
|
5
|
+
readonly contextLines: number;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
readonly isGitRepo: boolean;
|
|
8
|
+
readonly files: readonly {
|
|
9
|
+
readonly path: string;
|
|
10
|
+
readonly status: string;
|
|
11
|
+
readonly diff?: string;
|
|
12
|
+
}[];
|
|
13
|
+
readonly truncated: boolean;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@infinityi/engine-lib/tools-fs` — optional, policy-gated filesystem and
|
|
3
|
+
* workspace tools for coding agents and local document agents.
|
|
4
|
+
*
|
|
5
|
+
* The core library remains tool-agnostic. This subpath exports a single
|
|
6
|
+
* {@link filesystemTools} factory that binds prebuilt tool definitions to an
|
|
7
|
+
* explicit allowed-root policy.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { filesystemTools } from "@infinityi/engine-lib/tools-fs";
|
|
12
|
+
*
|
|
13
|
+
* const fs = filesystemTools({ allowedRoots: [process.cwd()] });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
export { filesystemTools } from "./define";
|
|
19
|
+
export type { ApplyPatchArgs, DiffStatusArgs, EditRangeArgs, EditReplaceArgs, FilesystemTools, FilesystemToolsConfig, FindFilesArgs, OpenWindowArgs, ReadArgs, RepoMapArgs, SearchSemanticArgs, SearchTextArgs, SymbolInfo, SymbolKind, SymbolsArgs, ValidationCommandRequest, ValidationCommandResult, ValidationOptions, WriteFileArgs, } from "./types";
|