@agentick/core 0.0.1
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/LICENSE +21 -0
- package/README.md +875 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/.tsbuildinfo.build +1 -0
- package/dist/agent.d.ts +32 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +26 -0
- package/dist/agent.js.map +1 -0
- package/dist/agentick-instance.d.ts +285 -0
- package/dist/agentick-instance.d.ts.map +1 -0
- package/dist/agentick-instance.js +700 -0
- package/dist/agentick-instance.js.map +1 -0
- package/dist/aidk-instance.d.ts +294 -0
- package/dist/aidk-instance.d.ts.map +1 -0
- package/dist/aidk-instance.js +340 -0
- package/dist/aidk-instance.js.map +1 -0
- package/dist/app/session-store.d.ts +57 -0
- package/dist/app/session-store.d.ts.map +1 -0
- package/dist/app/session-store.js +87 -0
- package/dist/app/session-store.js.map +1 -0
- package/dist/app/session.d.ts +209 -0
- package/dist/app/session.d.ts.map +1 -0
- package/dist/app/session.js +2131 -0
- package/dist/app/session.js.map +1 -0
- package/dist/app/sqlite-session-store.d.ts +60 -0
- package/dist/app/sqlite-session-store.d.ts.map +1 -0
- package/dist/app/sqlite-session-store.js +234 -0
- package/dist/app/sqlite-session-store.js.map +1 -0
- package/dist/app/types.d.ts +1461 -0
- package/dist/app/types.d.ts.map +1 -0
- package/dist/app/types.js +14 -0
- package/dist/app/types.js.map +1 -0
- package/dist/app.d.ts +79 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +83 -0
- package/dist/app.js.map +1 -0
- package/dist/channels/adapters/index.d.ts +2 -0
- package/dist/channels/adapters/index.d.ts.map +1 -0
- package/dist/channels/adapters/index.js +2 -0
- package/dist/channels/adapters/index.js.map +1 -0
- package/dist/channels/adapters/redis.d.ts +77 -0
- package/dist/channels/adapters/redis.d.ts.map +1 -0
- package/dist/channels/adapters/redis.js +259 -0
- package/dist/channels/adapters/redis.js.map +1 -0
- package/dist/channels/index.d.ts +38 -0
- package/dist/channels/index.d.ts.map +1 -0
- package/dist/channels/index.js +38 -0
- package/dist/channels/index.js.map +1 -0
- package/dist/channels/service.d.ts +684 -0
- package/dist/channels/service.d.ts.map +1 -0
- package/dist/channels/service.js +870 -0
- package/dist/channels/service.js.map +1 -0
- package/dist/channels/transports/index.d.ts +4 -0
- package/dist/channels/transports/index.d.ts.map +1 -0
- package/dist/channels/transports/index.js +4 -0
- package/dist/channels/transports/index.js.map +1 -0
- package/dist/channels/transports/socketio.d.ts +98 -0
- package/dist/channels/transports/socketio.d.ts.map +1 -0
- package/dist/channels/transports/socketio.js +246 -0
- package/dist/channels/transports/socketio.js.map +1 -0
- package/dist/channels/transports/streamable-http.d.ts +107 -0
- package/dist/channels/transports/streamable-http.d.ts.map +1 -0
- package/dist/channels/transports/streamable-http.js +353 -0
- package/dist/channels/transports/streamable-http.js.map +1 -0
- package/dist/channels/transports/websocket.d.ts +117 -0
- package/dist/channels/transports/websocket.d.ts.map +1 -0
- package/dist/channels/transports/websocket.js +416 -0
- package/dist/channels/transports/websocket.js.map +1 -0
- package/dist/com/index.d.ts +29 -0
- package/dist/com/index.d.ts.map +1 -0
- package/dist/com/index.js +29 -0
- package/dist/com/index.js.map +1 -0
- package/dist/com/object-model.d.ts +634 -0
- package/dist/com/object-model.d.ts.map +1 -0
- package/dist/com/object-model.js +963 -0
- package/dist/com/object-model.js.map +1 -0
- package/dist/com/types.d.ts +192 -0
- package/dist/com/types.d.ts.map +1 -0
- package/dist/com/types.js +1 -0
- package/dist/com/types.js.map +1 -0
- package/dist/compiler/collector.d.ts +16 -0
- package/dist/compiler/collector.d.ts.map +1 -0
- package/dist/compiler/collector.js +388 -0
- package/dist/compiler/collector.js.map +1 -0
- package/dist/compiler/content-block-registry.d.ts +11 -0
- package/dist/compiler/content-block-registry.d.ts.map +1 -0
- package/dist/compiler/content-block-registry.js +312 -0
- package/dist/compiler/content-block-registry.js.map +1 -0
- package/dist/compiler/extractors.d.ts +68 -0
- package/dist/compiler/extractors.d.ts.map +1 -0
- package/dist/compiler/extractors.js +547 -0
- package/dist/compiler/extractors.js.map +1 -0
- package/dist/compiler/fiber-compiler.d.ts +203 -0
- package/dist/compiler/fiber-compiler.d.ts.map +1 -0
- package/dist/compiler/fiber-compiler.js +498 -0
- package/dist/compiler/fiber-compiler.js.map +1 -0
- package/dist/compiler/fiber.d.ts +61 -0
- package/dist/compiler/fiber.d.ts.map +1 -0
- package/dist/compiler/fiber.js +244 -0
- package/dist/compiler/fiber.js.map +1 -0
- package/dist/compiler/index.d.ts +18 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/index.js +38 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/compiler/scheduler.d.ts +95 -0
- package/dist/compiler/scheduler.d.ts.map +1 -0
- package/dist/compiler/scheduler.js +138 -0
- package/dist/compiler/scheduler.js.map +1 -0
- package/dist/compiler/structure-renderer.d.ts +42 -0
- package/dist/compiler/structure-renderer.d.ts.map +1 -0
- package/dist/compiler/structure-renderer.js +189 -0
- package/dist/compiler/structure-renderer.js.map +1 -0
- package/dist/compiler/types.d.ts +96 -0
- package/dist/compiler/types.d.ts.map +1 -0
- package/dist/compiler/types.js +19 -0
- package/dist/compiler/types.js.map +1 -0
- package/dist/component/component-hooks.d.ts +68 -0
- package/dist/component/component-hooks.d.ts.map +1 -0
- package/dist/component/component-hooks.js +112 -0
- package/dist/component/component-hooks.js.map +1 -0
- package/dist/component/component.d.ts +314 -0
- package/dist/component/component.d.ts.map +1 -0
- package/dist/component/component.js +64 -0
- package/dist/component/component.js.map +1 -0
- package/dist/component/index.d.ts +47 -0
- package/dist/component/index.d.ts.map +1 -0
- package/dist/component/index.js +47 -0
- package/dist/component/index.js.map +1 -0
- package/dist/component/tentickle-component.d.ts +185 -0
- package/dist/component/tentickle-component.d.ts.map +1 -0
- package/dist/component/tentickle-component.js +182 -0
- package/dist/component/tentickle-component.js.map +1 -0
- package/dist/content/index.d.ts +12 -0
- package/dist/content/index.d.ts.map +1 -0
- package/dist/content/index.js +17 -0
- package/dist/content/index.js.map +1 -0
- package/dist/context/index.d.ts +51 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +69 -0
- package/dist/context/index.js.map +1 -0
- package/dist/core/channel-helpers.d.ts +31 -0
- package/dist/core/channel-helpers.d.ts.map +1 -0
- package/dist/core/channel-helpers.js +62 -0
- package/dist/core/channel-helpers.js.map +1 -0
- package/dist/core/channel.d.ts +164 -0
- package/dist/core/channel.d.ts.map +1 -0
- package/dist/core/channel.js +199 -0
- package/dist/core/channel.js.map +1 -0
- package/dist/core/context.d.ts +412 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +290 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/event-buffer.d.ts +212 -0
- package/dist/core/event-buffer.d.ts.map +1 -0
- package/dist/core/event-buffer.js +346 -0
- package/dist/core/event-buffer.js.map +1 -0
- package/dist/core/execution-helpers.d.ts +179 -0
- package/dist/core/execution-helpers.d.ts.map +1 -0
- package/dist/core/execution-helpers.js +212 -0
- package/dist/core/execution-helpers.js.map +1 -0
- package/dist/core/execution-tracker.d.ts +53 -0
- package/dist/core/execution-tracker.d.ts.map +1 -0
- package/dist/core/execution-tracker.js +309 -0
- package/dist/core/execution-tracker.js.map +1 -0
- package/dist/core/index.d.ts +58 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +58 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/logger.d.ts +341 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +346 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/metrics-helpers.d.ts +40 -0
- package/dist/core/metrics-helpers.d.ts.map +1 -0
- package/dist/core/metrics-helpers.js +72 -0
- package/dist/core/metrics-helpers.js.map +1 -0
- package/dist/core/otel-provider.d.ts +54 -0
- package/dist/core/otel-provider.d.ts.map +1 -0
- package/dist/core/otel-provider.js +107 -0
- package/dist/core/otel-provider.js.map +1 -0
- package/dist/core/procedure-graph.d.ts +136 -0
- package/dist/core/procedure-graph.d.ts.map +1 -0
- package/dist/core/procedure-graph.js +272 -0
- package/dist/core/procedure-graph.js.map +1 -0
- package/dist/core/procedure.d.ts +755 -0
- package/dist/core/procedure.d.ts.map +1 -0
- package/dist/core/procedure.js +899 -0
- package/dist/core/procedure.js.map +1 -0
- package/dist/core/stream.d.ts +106 -0
- package/dist/core/stream.d.ts.map +1 -0
- package/dist/core/stream.js +186 -0
- package/dist/core/stream.js.map +1 -0
- package/dist/core/telemetry.d.ts +182 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/core/telemetry.js +124 -0
- package/dist/core/telemetry.js.map +1 -0
- package/dist/engine/client-tool-coordinator.d.ts +50 -0
- package/dist/engine/client-tool-coordinator.d.ts.map +1 -0
- package/dist/engine/client-tool-coordinator.js +121 -0
- package/dist/engine/client-tool-coordinator.js.map +1 -0
- package/dist/engine/engine-events.d.ts +117 -0
- package/dist/engine/engine-events.d.ts.map +1 -0
- package/dist/engine/engine-events.js +178 -0
- package/dist/engine/engine-events.js.map +1 -0
- package/dist/engine/engine-response.d.ts +48 -0
- package/dist/engine/engine-response.d.ts.map +1 -0
- package/dist/engine/engine-response.js +2 -0
- package/dist/engine/engine-response.js.map +1 -0
- package/dist/engine/execution-graph.d.ts +104 -0
- package/dist/engine/execution-graph.d.ts.map +1 -0
- package/dist/engine/execution-graph.js +257 -0
- package/dist/engine/execution-graph.js.map +1 -0
- package/dist/engine/execution-handle.d.ts +212 -0
- package/dist/engine/execution-handle.d.ts.map +1 -0
- package/dist/engine/execution-handle.js +602 -0
- package/dist/engine/execution-handle.js.map +1 -0
- package/dist/engine/execution-types.d.ts +248 -0
- package/dist/engine/execution-types.d.ts.map +1 -0
- package/dist/engine/execution-types.js +23 -0
- package/dist/engine/execution-types.js.map +1 -0
- package/dist/engine/index.d.ts +21 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +23 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/tool-confirmation-coordinator.d.ts +74 -0
- package/dist/engine/tool-confirmation-coordinator.d.ts.map +1 -0
- package/dist/engine/tool-confirmation-coordinator.js +137 -0
- package/dist/engine/tool-confirmation-coordinator.js.map +1 -0
- package/dist/engine/tool-executor.d.ts +127 -0
- package/dist/engine/tool-executor.d.ts.map +1 -0
- package/dist/engine/tool-executor.js +363 -0
- package/dist/engine/tool-executor.js.map +1 -0
- package/dist/hibernation/index.d.ts +126 -0
- package/dist/hibernation/index.d.ts.map +1 -0
- package/dist/hibernation/index.js +127 -0
- package/dist/hibernation/index.js.map +1 -0
- package/dist/hooks/base-hook-registry.d.ts +41 -0
- package/dist/hooks/base-hook-registry.d.ts.map +1 -0
- package/dist/hooks/base-hook-registry.js +76 -0
- package/dist/hooks/base-hook-registry.js.map +1 -0
- package/dist/hooks/com-state.d.ts +40 -0
- package/dist/hooks/com-state.d.ts.map +1 -0
- package/dist/hooks/com-state.js +90 -0
- package/dist/hooks/com-state.js.map +1 -0
- package/dist/hooks/context-info.d.ts +139 -0
- package/dist/hooks/context-info.d.ts.map +1 -0
- package/dist/hooks/context-info.js +115 -0
- package/dist/hooks/context-info.js.map +1 -0
- package/dist/hooks/context-internal.d.ts +21 -0
- package/dist/hooks/context-internal.d.ts.map +1 -0
- package/dist/hooks/context-internal.js +20 -0
- package/dist/hooks/context-internal.js.map +1 -0
- package/dist/hooks/context.d.ts +64 -0
- package/dist/hooks/context.d.ts.map +1 -0
- package/dist/hooks/context.js +83 -0
- package/dist/hooks/context.js.map +1 -0
- package/dist/hooks/data.d.ts +33 -0
- package/dist/hooks/data.d.ts.map +1 -0
- package/dist/hooks/data.js +84 -0
- package/dist/hooks/data.js.map +1 -0
- package/dist/hooks/formatter-context.d.ts +34 -0
- package/dist/hooks/formatter-context.d.ts.map +1 -0
- package/dist/hooks/formatter-context.js +34 -0
- package/dist/hooks/formatter-context.js.map +1 -0
- package/dist/hooks/hook-registry.d.ts +45 -0
- package/dist/hooks/hook-registry.d.ts.map +1 -0
- package/dist/hooks/hook-registry.js +109 -0
- package/dist/hooks/hook-registry.js.map +1 -0
- package/dist/hooks/index.d.ts +20 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +47 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/knob.d.ts +87 -0
- package/dist/hooks/knob.d.ts.map +1 -0
- package/dist/hooks/knob.js +129 -0
- package/dist/hooks/knob.js.map +1 -0
- package/dist/hooks/knobs-component.d.ts +70 -0
- package/dist/hooks/knobs-component.d.ts.map +1 -0
- package/dist/hooks/knobs-component.js +300 -0
- package/dist/hooks/knobs-component.js.map +1 -0
- package/dist/hooks/lifecycle.d.ts +158 -0
- package/dist/hooks/lifecycle.d.ts.map +1 -0
- package/dist/hooks/lifecycle.js +217 -0
- package/dist/hooks/lifecycle.js.map +1 -0
- package/dist/hooks/message-context.d.ts +101 -0
- package/dist/hooks/message-context.d.ts.map +1 -0
- package/dist/hooks/message-context.js +145 -0
- package/dist/hooks/message-context.js.map +1 -0
- package/dist/hooks/policy-context.d.ts.map +1 -0
- package/dist/hooks/runtime-context.d.ts +122 -0
- package/dist/hooks/runtime-context.d.ts.map +1 -0
- package/dist/hooks/runtime-context.js +149 -0
- package/dist/hooks/runtime-context.js.map +1 -0
- package/dist/hooks/signal.d.ts +267 -0
- package/dist/hooks/signal.d.ts.map +1 -0
- package/dist/hooks/signal.js +825 -0
- package/dist/hooks/signal.js.map +1 -0
- package/dist/hooks/types.d.ts +179 -0
- package/dist/hooks/types.d.ts.map +1 -0
- package/dist/hooks/types.js +5 -0
- package/dist/hooks/types.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx/components/agent.d.ts +64 -0
- package/dist/jsx/components/agent.d.ts.map +1 -0
- package/dist/jsx/components/agent.js +80 -0
- package/dist/jsx/components/agent.js.map +1 -0
- package/dist/jsx/components/complete.d.ts +65 -0
- package/dist/jsx/components/complete.d.ts.map +1 -0
- package/dist/jsx/components/complete.js +64 -0
- package/dist/jsx/components/complete.js.map +1 -0
- package/dist/jsx/components/content.d.ts +98 -0
- package/dist/jsx/components/content.d.ts.map +1 -0
- package/dist/jsx/components/content.js +51 -0
- package/dist/jsx/components/content.js.map +1 -0
- package/dist/jsx/components/harness.d.ts +118 -0
- package/dist/jsx/components/harness.d.ts.map +1 -0
- package/dist/jsx/components/harness.js +117 -0
- package/dist/jsx/components/harness.js.map +1 -0
- package/dist/jsx/components/index.d.ts +11 -0
- package/dist/jsx/components/index.d.ts.map +1 -0
- package/dist/jsx/components/index.js +11 -0
- package/dist/jsx/components/index.js.map +1 -0
- package/dist/jsx/components/markdown.d.ts +31 -0
- package/dist/jsx/components/markdown.d.ts.map +1 -0
- package/dist/jsx/components/markdown.js +17 -0
- package/dist/jsx/components/markdown.js.map +1 -0
- package/dist/jsx/components/messages.d.ts +283 -0
- package/dist/jsx/components/messages.d.ts.map +1 -0
- package/dist/jsx/components/messages.js +257 -0
- package/dist/jsx/components/messages.js.map +1 -0
- package/dist/jsx/components/model.d.ts +94 -0
- package/dist/jsx/components/model.d.ts.map +1 -0
- package/dist/jsx/components/model.js +96 -0
- package/dist/jsx/components/model.js.map +1 -0
- package/dist/jsx/components/primitives.d.ts +117 -0
- package/dist/jsx/components/primitives.d.ts.map +1 -0
- package/dist/jsx/components/primitives.js +83 -0
- package/dist/jsx/components/primitives.js.map +1 -0
- package/dist/jsx/components/renderer.d.ts +24 -0
- package/dist/jsx/components/renderer.d.ts.map +1 -0
- package/dist/jsx/components/renderer.js +11 -0
- package/dist/jsx/components/renderer.js.map +1 -0
- package/dist/jsx/components/semantic.d.ts +155 -0
- package/dist/jsx/components/semantic.d.ts.map +1 -0
- package/dist/jsx/components/semantic.js +39 -0
- package/dist/jsx/components/semantic.js.map +1 -0
- package/dist/jsx/components/timeline.d.ts +157 -0
- package/dist/jsx/components/timeline.d.ts.map +1 -0
- package/dist/jsx/components/timeline.js +357 -0
- package/dist/jsx/components/timeline.js.map +1 -0
- package/dist/jsx/components/token-budget.d.ts +70 -0
- package/dist/jsx/components/token-budget.d.ts.map +1 -0
- package/dist/jsx/components/token-budget.js +135 -0
- package/dist/jsx/components/token-budget.js.map +1 -0
- package/dist/jsx/components/xml.d.ts +27 -0
- package/dist/jsx/components/xml.d.ts.map +1 -0
- package/dist/jsx/components/xml.js +17 -0
- package/dist/jsx/components/xml.js.map +1 -0
- package/dist/jsx/index.d.ts +58 -0
- package/dist/jsx/index.d.ts.map +1 -0
- package/dist/jsx/index.js +59 -0
- package/dist/jsx/index.js.map +1 -0
- package/dist/jsx/jsx-runtime.d.ts +370 -0
- package/dist/jsx/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx/jsx-runtime.js +79 -0
- package/dist/jsx/jsx-runtime.js.map +1 -0
- package/dist/jsx/jsx-types.d.ts +23 -0
- package/dist/jsx/jsx-types.d.ts.map +1 -0
- package/dist/jsx/jsx-types.js +1 -0
- package/dist/jsx/jsx-types.js.map +1 -0
- package/dist/mcp/client.d.ts +46 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +138 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/component.d.ts +95 -0
- package/dist/mcp/component.d.ts.map +1 -0
- package/dist/mcp/component.js +185 -0
- package/dist/mcp/component.js.map +1 -0
- package/dist/mcp/create-mcp-tool.d.ts +191 -0
- package/dist/mcp/create-mcp-tool.d.ts.map +1 -0
- package/dist/mcp/create-mcp-tool.js +228 -0
- package/dist/mcp/create-mcp-tool.js.map +1 -0
- package/dist/mcp/index.d.ts +49 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +48 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/service.d.ts +39 -0
- package/dist/mcp/service.d.ts.map +1 -0
- package/dist/mcp/service.js +77 -0
- package/dist/mcp/service.js.map +1 -0
- package/dist/mcp/tool.d.ts +55 -0
- package/dist/mcp/tool.d.ts.map +1 -0
- package/dist/mcp/tool.js +119 -0
- package/dist/mcp/tool.js.map +1 -0
- package/dist/mcp/types.d.ts +72 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +6 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/middleware/defaults.d.ts +9 -0
- package/dist/middleware/defaults.d.ts.map +1 -0
- package/dist/middleware/defaults.js +47 -0
- package/dist/middleware/defaults.js.map +1 -0
- package/dist/model/adapter-helpers.d.ts +161 -0
- package/dist/model/adapter-helpers.d.ts.map +1 -0
- package/dist/model/adapter-helpers.js +351 -0
- package/dist/model/adapter-helpers.js.map +1 -0
- package/dist/model/adapter.d.ts +399 -0
- package/dist/model/adapter.d.ts.map +1 -0
- package/dist/model/adapter.js +497 -0
- package/dist/model/adapter.js.map +1 -0
- package/dist/model/index.d.ts +54 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +55 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/model-hooks.d.ts +45 -0
- package/dist/model/model-hooks.d.ts.map +1 -0
- package/dist/model/model-hooks.js +24 -0
- package/dist/model/model-hooks.js.map +1 -0
- package/dist/model/model.d.ts +302 -0
- package/dist/model/model.d.ts.map +1 -0
- package/dist/model/model.js +20 -0
- package/dist/model/model.js.map +1 -0
- package/dist/model/simple-adapter.d.ts +176 -0
- package/dist/model/simple-adapter.d.ts.map +1 -0
- package/dist/model/simple-adapter.js +264 -0
- package/dist/model/simple-adapter.js.map +1 -0
- package/dist/model/stream-accumulator.d.ts +284 -0
- package/dist/model/stream-accumulator.d.ts.map +1 -0
- package/dist/model/stream-accumulator.js +532 -0
- package/dist/model/stream-accumulator.js.map +1 -0
- package/dist/model/utils/index.d.ts +2 -0
- package/dist/model/utils/index.d.ts.map +1 -0
- package/dist/model/utils/index.js +2 -0
- package/dist/model/utils/index.js.map +1 -0
- package/dist/model/utils/language-model.d.ts +26 -0
- package/dist/model/utils/language-model.d.ts.map +1 -0
- package/dist/model/utils/language-model.js +706 -0
- package/dist/model/utils/language-model.js.map +1 -0
- package/dist/procedure/index.d.ts +20 -0
- package/dist/procedure/index.d.ts.map +1 -0
- package/dist/procedure/index.js +19 -0
- package/dist/procedure/index.js.map +1 -0
- package/dist/reconciler/devtools-bridge.d.ts +40 -0
- package/dist/reconciler/devtools-bridge.d.ts.map +1 -0
- package/dist/reconciler/devtools-bridge.js +79 -0
- package/dist/reconciler/devtools-bridge.js.map +1 -0
- package/dist/reconciler/host-config.d.ts +39 -0
- package/dist/reconciler/host-config.d.ts.map +1 -0
- package/dist/reconciler/host-config.js +195 -0
- package/dist/reconciler/host-config.js.map +1 -0
- package/dist/reconciler/index.d.ts +7 -0
- package/dist/reconciler/index.d.ts.map +1 -0
- package/dist/reconciler/index.js +7 -0
- package/dist/reconciler/index.js.map +1 -0
- package/dist/reconciler/reconciler.d.ts +47 -0
- package/dist/reconciler/reconciler.d.ts.map +1 -0
- package/dist/reconciler/reconciler.js +89 -0
- package/dist/reconciler/reconciler.js.map +1 -0
- package/dist/reconciler/types.d.ts +86 -0
- package/dist/reconciler/types.d.ts.map +1 -0
- package/dist/reconciler/types.js +37 -0
- package/dist/reconciler/types.js.map +1 -0
- package/dist/renderers/base.d.ts +98 -0
- package/dist/renderers/base.d.ts.map +1 -0
- package/dist/renderers/base.js +82 -0
- package/dist/renderers/base.js.map +1 -0
- package/dist/renderers/index.d.ts +31 -0
- package/dist/renderers/index.d.ts.map +1 -0
- package/dist/renderers/index.js +31 -0
- package/dist/renderers/index.js.map +1 -0
- package/dist/renderers/markdown.d.ts +48 -0
- package/dist/renderers/markdown.d.ts.map +1 -0
- package/dist/renderers/markdown.js +432 -0
- package/dist/renderers/markdown.js.map +1 -0
- package/dist/renderers/types.d.ts +7 -0
- package/dist/renderers/types.d.ts.map +1 -0
- package/dist/renderers/types.js +7 -0
- package/dist/renderers/types.js.map +1 -0
- package/dist/renderers/xml.d.ts +49 -0
- package/dist/renderers/xml.d.ts.map +1 -0
- package/dist/renderers/xml.js +444 -0
- package/dist/renderers/xml.js.map +1 -0
- package/dist/state/boundary.d.ts +347 -0
- package/dist/state/boundary.d.ts.map +1 -0
- package/dist/state/boundary.js +341 -0
- package/dist/state/boundary.js.map +1 -0
- package/dist/state/context.d.ts +138 -0
- package/dist/state/context.d.ts.map +1 -0
- package/dist/state/context.js +139 -0
- package/dist/state/context.js.map +1 -0
- package/dist/state/hooks.d.ts +798 -0
- package/dist/state/hooks.d.ts.map +1 -0
- package/dist/state/hooks.js +1437 -0
- package/dist/state/hooks.js.map +1 -0
- package/dist/state/index.d.ts +72 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +73 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/signal.d.ts +223 -0
- package/dist/state/signal.d.ts.map +1 -0
- package/dist/state/signal.js +699 -0
- package/dist/state/signal.js.map +1 -0
- package/dist/state/use-state.d.ts +210 -0
- package/dist/state/use-state.d.ts.map +1 -0
- package/dist/state/use-state.js +327 -0
- package/dist/state/use-state.js.map +1 -0
- package/dist/tentickle-instance.d.ts +285 -0
- package/dist/tentickle-instance.d.ts.map +1 -0
- package/dist/tentickle-instance.js +700 -0
- package/dist/tentickle-instance.js.map +1 -0
- package/dist/testing/act.d.ts +59 -0
- package/dist/testing/act.d.ts.map +1 -0
- package/dist/testing/act.js +92 -0
- package/dist/testing/act.js.map +1 -0
- package/dist/testing/async-helpers.d.ts +99 -0
- package/dist/testing/async-helpers.d.ts.map +1 -0
- package/dist/testing/async-helpers.js +193 -0
- package/dist/testing/async-helpers.js.map +1 -0
- package/dist/testing/compile-agent.d.ts +101 -0
- package/dist/testing/compile-agent.d.ts.map +1 -0
- package/dist/testing/compile-agent.js +136 -0
- package/dist/testing/compile-agent.js.map +1 -0
- package/dist/testing/index.d.ts +57 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +59 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/mock-app.d.ts +163 -0
- package/dist/testing/mock-app.d.ts.map +1 -0
- package/dist/testing/mock-app.js +393 -0
- package/dist/testing/mock-app.js.map +1 -0
- package/dist/testing/mocks.d.ts +142 -0
- package/dist/testing/mocks.d.ts.map +1 -0
- package/dist/testing/mocks.js +191 -0
- package/dist/testing/mocks.js.map +1 -0
- package/dist/testing/render-agent.d.ts +146 -0
- package/dist/testing/render-agent.d.ts.map +1 -0
- package/dist/testing/render-agent.js +200 -0
- package/dist/testing/render-agent.js.map +1 -0
- package/dist/testing/test-adapter.d.ts +157 -0
- package/dist/testing/test-adapter.d.ts.map +1 -0
- package/dist/testing/test-adapter.js +297 -0
- package/dist/testing/test-adapter.js.map +1 -0
- package/dist/testing/test-model.d.ts +132 -0
- package/dist/testing/test-model.d.ts.map +1 -0
- package/dist/testing/test-model.js +260 -0
- package/dist/testing/test-model.js.map +1 -0
- package/dist/tool/index.d.ts +61 -0
- package/dist/tool/index.d.ts.map +1 -0
- package/dist/tool/index.js +63 -0
- package/dist/tool/index.js.map +1 -0
- package/dist/tool/tool-hooks.d.ts +45 -0
- package/dist/tool/tool-hooks.d.ts.map +1 -0
- package/dist/tool/tool-hooks.js +35 -0
- package/dist/tool/tool-hooks.js.map +1 -0
- package/dist/tool/tool.d.ts +403 -0
- package/dist/tool/tool.d.ts.map +1 -0
- package/dist/tool/tool.js +176 -0
- package/dist/tool/tool.js.map +1 -0
- package/dist/types.d.ts +442 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +97 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/abort-utils.d.ts +5 -0
- package/dist/utils/abort-utils.d.ts.map +1 -0
- package/dist/utils/abort-utils.js +50 -0
- package/dist/utils/abort-utils.js.map +1 -0
- package/dist/utils/classify-error.d.ts +19 -0
- package/dist/utils/classify-error.d.ts.map +1 -0
- package/dist/utils/classify-error.js +77 -0
- package/dist/utils/classify-error.js.map +1 -0
- package/dist/utils/index.d.ts +21 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/normalization.d.ts +6 -0
- package/dist/utils/normalization.d.ts.map +1 -0
- package/dist/utils/normalization.js +103 -0
- package/dist/utils/normalization.js.map +1 -0
- package/dist/utils/registry.d.ts +15 -0
- package/dist/utils/registry.d.ts.map +1 -0
- package/dist/utils/registry.js +28 -0
- package/dist/utils/registry.js.map +1 -0
- package/dist/utils/schema.d.ts +7 -0
- package/dist/utils/schema.d.ts.map +1 -0
- package/dist/utils/schema.js +13 -0
- package/dist/utils/schema.js.map +1 -0
- package/dist/utils/token-estimate.d.ts +87 -0
- package/dist/utils/token-estimate.d.ts.map +1 -0
- package/dist/utils/token-estimate.js +199 -0
- package/dist/utils/token-estimate.js.map +1 -0
- package/dist/v2/reconciler/host-config.d.ts +31 -0
- package/dist/v2/reconciler/host-config.d.ts.map +1 -0
- package/dist/v2/reconciler/host-config.js +197 -0
- package/dist/v2/reconciler/host-config.js.map +1 -0
- package/dist/v2/reconciler/index.d.ts +7 -0
- package/dist/v2/reconciler/index.d.ts.map +1 -0
- package/dist/v2/reconciler/index.js +7 -0
- package/dist/v2/reconciler/index.js.map +1 -0
- package/dist/v2/reconciler/reconciler.d.ts +39 -0
- package/dist/v2/reconciler/reconciler.d.ts.map +1 -0
- package/dist/v2/reconciler/reconciler.js +54 -0
- package/dist/v2/reconciler/reconciler.js.map +1 -0
- package/dist/v2/reconciler/types.d.ts +64 -0
- package/dist/v2/reconciler/types.d.ts.map +1 -0
- package/dist/v2/reconciler/types.js +20 -0
- package/dist/v2/reconciler/types.js.map +1 -0
- package/dist/v2/renderers/index.d.ts +7 -0
- package/dist/v2/renderers/index.d.ts.map +1 -0
- package/dist/v2/renderers/index.js +7 -0
- package/dist/v2/renderers/index.js.map +1 -0
- package/dist/v2/renderers/markdown.d.ts +16 -0
- package/dist/v2/renderers/markdown.d.ts.map +1 -0
- package/dist/v2/renderers/markdown.js +65 -0
- package/dist/v2/renderers/markdown.js.map +1 -0
- package/dist/v2/renderers/types.d.ts +26 -0
- package/dist/v2/renderers/types.d.ts.map +1 -0
- package/dist/v2/renderers/types.js +6 -0
- package/dist/v2/renderers/types.js.map +1 -0
- package/dist/v2/renderers/xml.d.ts +17 -0
- package/dist/v2/renderers/xml.d.ts.map +1 -0
- package/dist/v2/renderers/xml.js +73 -0
- package/dist/v2/renderers/xml.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import type { EventEmitter } from "node:events";
|
|
2
|
+
import type { EngineInput, COMInput } from "../com/types";
|
|
3
|
+
import type { ComponentDefinition } from "../component/component";
|
|
4
|
+
import type { ProcedureGraph } from "@agentick/kernel";
|
|
5
|
+
/**
|
|
6
|
+
* Signal types for execution and engine signals
|
|
7
|
+
*/
|
|
8
|
+
export type SignalType = "abort" | "interrupt" | "pause" | "resume" | "shutdown" | string;
|
|
9
|
+
/**
|
|
10
|
+
* Signal event structure
|
|
11
|
+
*/
|
|
12
|
+
export interface SignalEvent {
|
|
13
|
+
type: SignalType;
|
|
14
|
+
source: "engine" | "execution" | "parent" | "external";
|
|
15
|
+
pid?: string;
|
|
16
|
+
parentPid?: string;
|
|
17
|
+
reason?: string;
|
|
18
|
+
timestamp: number;
|
|
19
|
+
metadata?: Record<string, any>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Execution message for communication with running executions.
|
|
23
|
+
*
|
|
24
|
+
* Messages can be sent to a running execution via:
|
|
25
|
+
* - RuntimeSession.sendMessage() - Direct programmatic injection
|
|
26
|
+
* - ExecutionHandle.send() - Via handle reference
|
|
27
|
+
* - Channel events with type='message' - From client
|
|
28
|
+
*
|
|
29
|
+
* Messages are delivered immediately to component onMessage hooks,
|
|
30
|
+
* then queued for availability in TickState.queuedMessages.
|
|
31
|
+
*/
|
|
32
|
+
export interface ExecutionMessage {
|
|
33
|
+
/**
|
|
34
|
+
* Unique message ID (auto-generated if not provided)
|
|
35
|
+
*/
|
|
36
|
+
id: string;
|
|
37
|
+
/**
|
|
38
|
+
* User-defined message type (e.g., 'user_feedback', 'interrupt', 'tool_response')
|
|
39
|
+
*/
|
|
40
|
+
type: string;
|
|
41
|
+
/**
|
|
42
|
+
* Message payload
|
|
43
|
+
*/
|
|
44
|
+
content: unknown;
|
|
45
|
+
/**
|
|
46
|
+
* When the message was received (auto-generated)
|
|
47
|
+
*/
|
|
48
|
+
timestamp: number;
|
|
49
|
+
/**
|
|
50
|
+
* Optional metadata (source, channel, etc.)
|
|
51
|
+
*/
|
|
52
|
+
metadata?: Record<string, any>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Execution status
|
|
56
|
+
*/
|
|
57
|
+
export type ExecutionStatus = "running" | "completed" | "failed" | "cancelled" | "pending";
|
|
58
|
+
export declare const ExecutionStatuses: ExecutionStatus[];
|
|
59
|
+
/**
|
|
60
|
+
* Execution type
|
|
61
|
+
*/
|
|
62
|
+
export type ExecutionType = "root" | "child";
|
|
63
|
+
export declare const ExecutionTypes: ExecutionType[];
|
|
64
|
+
/**
|
|
65
|
+
* Execution state for persistence and recovery
|
|
66
|
+
*/
|
|
67
|
+
export interface ExecutionState {
|
|
68
|
+
pid: string;
|
|
69
|
+
parentPid?: string;
|
|
70
|
+
rootPid: string;
|
|
71
|
+
type: ExecutionType;
|
|
72
|
+
status: ExecutionStatus;
|
|
73
|
+
input: EngineInput;
|
|
74
|
+
component: ComponentDefinition;
|
|
75
|
+
currentTick: number;
|
|
76
|
+
previous?: COMInput;
|
|
77
|
+
startedAt: Date;
|
|
78
|
+
completedAt?: Date;
|
|
79
|
+
error?: {
|
|
80
|
+
message: string;
|
|
81
|
+
stack?: string;
|
|
82
|
+
phase?: string;
|
|
83
|
+
};
|
|
84
|
+
metadata?: Record<string, unknown>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Execution handle for managing an execution lifecycle
|
|
88
|
+
* Extends EventEmitter for signal handling
|
|
89
|
+
*/
|
|
90
|
+
export interface ExecutionHandle extends EventEmitter {
|
|
91
|
+
/**
|
|
92
|
+
* Process ID (unique identifier for this execution)
|
|
93
|
+
*/
|
|
94
|
+
pid: string;
|
|
95
|
+
/**
|
|
96
|
+
* Parent process ID (if this is a child execution)
|
|
97
|
+
*/
|
|
98
|
+
parentPid?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Root process ID (top-level execution)
|
|
101
|
+
*/
|
|
102
|
+
rootPid: string;
|
|
103
|
+
/**
|
|
104
|
+
* Execution status
|
|
105
|
+
*/
|
|
106
|
+
status: ExecutionStatus;
|
|
107
|
+
/**
|
|
108
|
+
* Execution type
|
|
109
|
+
*/
|
|
110
|
+
type: ExecutionType;
|
|
111
|
+
/**
|
|
112
|
+
* When execution started
|
|
113
|
+
*/
|
|
114
|
+
startedAt: Date;
|
|
115
|
+
/**
|
|
116
|
+
* When execution completed (if completed)
|
|
117
|
+
*/
|
|
118
|
+
completedAt?: Date;
|
|
119
|
+
/**
|
|
120
|
+
* Wait for execution to complete
|
|
121
|
+
*/
|
|
122
|
+
waitForCompletion(options?: {
|
|
123
|
+
timeout?: number;
|
|
124
|
+
}): Promise<COMInput>;
|
|
125
|
+
/**
|
|
126
|
+
* Cancel the execution (triggers abort signal)
|
|
127
|
+
*/
|
|
128
|
+
cancel(reason?: string): void;
|
|
129
|
+
/**
|
|
130
|
+
* Get execution result (if completed)
|
|
131
|
+
*/
|
|
132
|
+
getResult(): COMInput | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Stream execution events
|
|
135
|
+
*/
|
|
136
|
+
stream(): AsyncIterable<any>;
|
|
137
|
+
/**
|
|
138
|
+
* Get execution metrics
|
|
139
|
+
*/
|
|
140
|
+
getMetrics(): ExecutionMetrics;
|
|
141
|
+
/**
|
|
142
|
+
* Get execution duration in milliseconds
|
|
143
|
+
*/
|
|
144
|
+
getDuration(): number;
|
|
145
|
+
/**
|
|
146
|
+
* Get the cancel signal (if cancel controller is set)
|
|
147
|
+
*/
|
|
148
|
+
getCancelSignal(): AbortSignal | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Get procedure graph for this execution (if procedures were executed)
|
|
151
|
+
* Returns undefined if no procedures were executed in this execution's context
|
|
152
|
+
*/
|
|
153
|
+
getProcedureGraph(): ProcedureGraph | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Get aggregated metrics from all procedures in this execution
|
|
156
|
+
* Includes both execution-level metrics and procedure-level metrics
|
|
157
|
+
*/
|
|
158
|
+
getProcedureMetrics(): Record<string, number>;
|
|
159
|
+
/**
|
|
160
|
+
* Emit signal for this execution (and its children)
|
|
161
|
+
*/
|
|
162
|
+
emitSignal(signal: SignalType, reason?: string, metadata?: Record<string, any>): void;
|
|
163
|
+
/**
|
|
164
|
+
* Register graceful shutdown hook for this execution
|
|
165
|
+
*/
|
|
166
|
+
onShutdown(handler: () => Promise<void> | void): () => void;
|
|
167
|
+
/**
|
|
168
|
+
* Send a message to the running execution.
|
|
169
|
+
*
|
|
170
|
+
* The message is delivered immediately to component onMessage hooks,
|
|
171
|
+
* then queued for availability in TickState.queuedMessages.
|
|
172
|
+
*
|
|
173
|
+
* @param message The message to send (id and timestamp are auto-generated)
|
|
174
|
+
* @throws Error if execution is not running or no active session
|
|
175
|
+
*/
|
|
176
|
+
send(message: Omit<ExecutionMessage, "id" | "timestamp">): Promise<void>;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Execution metrics
|
|
180
|
+
*/
|
|
181
|
+
export interface ExecutionMetrics {
|
|
182
|
+
pid: string;
|
|
183
|
+
parentPid?: string;
|
|
184
|
+
rootPid: string;
|
|
185
|
+
type: ExecutionType;
|
|
186
|
+
status: ExecutionStatus;
|
|
187
|
+
startedAt: Date;
|
|
188
|
+
completedAt?: Date;
|
|
189
|
+
duration: number;
|
|
190
|
+
tickCount: number;
|
|
191
|
+
error?: {
|
|
192
|
+
message: string;
|
|
193
|
+
phase?: string;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Execution tree node
|
|
198
|
+
*/
|
|
199
|
+
export interface ExecutionTreeNode {
|
|
200
|
+
pid: string;
|
|
201
|
+
parentPid?: string;
|
|
202
|
+
rootPid: string;
|
|
203
|
+
type: ExecutionType;
|
|
204
|
+
status: ExecutionStatus;
|
|
205
|
+
startedAt: Date;
|
|
206
|
+
completedAt?: Date;
|
|
207
|
+
children: ExecutionTreeNode[];
|
|
208
|
+
metrics: ExecutionMetrics;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Engine metrics
|
|
212
|
+
*/
|
|
213
|
+
export interface EngineMetrics {
|
|
214
|
+
/**
|
|
215
|
+
* Number of active executions
|
|
216
|
+
*/
|
|
217
|
+
activeExecutions: number;
|
|
218
|
+
/**
|
|
219
|
+
* Total number of executions (including completed)
|
|
220
|
+
*/
|
|
221
|
+
totalExecutions: number;
|
|
222
|
+
/**
|
|
223
|
+
* Executions by status
|
|
224
|
+
*/
|
|
225
|
+
executionsByStatus: Record<ExecutionStatus, number>;
|
|
226
|
+
/**
|
|
227
|
+
* Executions by type
|
|
228
|
+
*/
|
|
229
|
+
executionsByType: Record<ExecutionType, number>;
|
|
230
|
+
/**
|
|
231
|
+
* Average execution duration (ms)
|
|
232
|
+
*/
|
|
233
|
+
averageExecutionTime: number;
|
|
234
|
+
/**
|
|
235
|
+
* Memory usage
|
|
236
|
+
*/
|
|
237
|
+
memoryUsage: NodeJS.MemoryUsage;
|
|
238
|
+
/**
|
|
239
|
+
* Timestamp of metrics collection
|
|
240
|
+
*/
|
|
241
|
+
timestamp: Date;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Generate a unique process ID (execution identifier)
|
|
245
|
+
* @param _prefix - Deprecated, ignored. Kept for backwards compatibility.
|
|
246
|
+
*/
|
|
247
|
+
export declare function generatePid(_prefix?: string): string;
|
|
248
|
+
//# sourceMappingURL=execution-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|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AM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAEpD;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAEhD;;OAEG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC;IAEhC;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAOpD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { randomUUID } from "crypto";
|
|
2
|
+
export const ExecutionStatuses = [
|
|
3
|
+
"running",
|
|
4
|
+
"completed",
|
|
5
|
+
"failed",
|
|
6
|
+
"cancelled",
|
|
7
|
+
"pending",
|
|
8
|
+
];
|
|
9
|
+
export const ExecutionTypes = ["root", "child"];
|
|
10
|
+
/**
|
|
11
|
+
* Generate a unique process ID (execution identifier)
|
|
12
|
+
* @param _prefix - Deprecated, ignored. Kept for backwards compatibility.
|
|
13
|
+
*/
|
|
14
|
+
export function generatePid(_prefix) {
|
|
15
|
+
try {
|
|
16
|
+
return randomUUID();
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// Fallback if crypto.randomUUID is not available
|
|
20
|
+
return `${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=execution-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-types.js","sourceRoot":"","sources":["../../src/engine/execution-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAwEpC,MAAM,CAAC,MAAM,iBAAiB,GAAsB;IAClD,SAAS;IACT,WAAW;IACX,QAAQ;IACR,WAAW;IACX,SAAS;CACV,CAAC;AAMF,MAAM,CAAC,MAAM,cAAc,GAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAgNjE;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,IAAI,CAAC;QACH,OAAO,UAAU,EAAE,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,iDAAiD;QACjD,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Engine Types and Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module exports the essential types for execution:
|
|
5
|
+
* - ExecutionHandle - The handle returned by session.render()
|
|
6
|
+
* - ExecutionMessage, ExecutionHandle - Core execution types
|
|
7
|
+
* - StreamEvent - Event types for streaming
|
|
8
|
+
* - ToolExecutor - Tool execution utilities
|
|
9
|
+
*
|
|
10
|
+
* Note: The Engine class has been replaced by SessionImpl.
|
|
11
|
+
* Use createApp() and session.render() for execution.
|
|
12
|
+
*
|
|
13
|
+
* @module agentick/engine
|
|
14
|
+
*/
|
|
15
|
+
export * from "./execution-handle";
|
|
16
|
+
export * from "./execution-types";
|
|
17
|
+
export { StopReason, isModelStreamEvent, isOrchestrationStreamEvent, isDeltaEvent, isFinalEvent, generateEventId, createEventBase, createExecutionStartEvent, createExecutionEndEvent, createTickStartEvent, createTickEndEvent, createToolCallEvent, createToolResultEvent, createToolConfirmationRequiredEvent, createToolConfirmationResultEvent, createEngineErrorEvent, } from "./engine-events";
|
|
18
|
+
export type { StreamEventBase, ModelStreamEvent, OrchestrationStreamEvent, ResultStreamEvent, CompiledEvent, ModelRequestEvent, ModelResponseEvent, StreamEvent, } from "./engine-events";
|
|
19
|
+
export type { EngineResponse, COMSection, COMTimelineEntry } from "./engine-response";
|
|
20
|
+
export { ToolExecutor } from "./tool-executor";
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,cAAc,oBAAoB,CAAC;AAGnC,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,mCAAmC,EACnC,iCAAiC,EACjC,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,GACZ,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGtF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Engine Types and Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module exports the essential types for execution:
|
|
5
|
+
* - ExecutionHandle - The handle returned by session.render()
|
|
6
|
+
* - ExecutionMessage, ExecutionHandle - Core execution types
|
|
7
|
+
* - StreamEvent - Event types for streaming
|
|
8
|
+
* - ToolExecutor - Tool execution utilities
|
|
9
|
+
*
|
|
10
|
+
* Note: The Engine class has been replaced by SessionImpl.
|
|
11
|
+
* Use createApp() and session.render() for execution.
|
|
12
|
+
*
|
|
13
|
+
* @module agentick/engine
|
|
14
|
+
*/
|
|
15
|
+
// Execution Handle
|
|
16
|
+
export * from "./execution-handle";
|
|
17
|
+
// Execution Types
|
|
18
|
+
export * from "./execution-types";
|
|
19
|
+
// Events
|
|
20
|
+
export { StopReason, isModelStreamEvent, isOrchestrationStreamEvent, isDeltaEvent, isFinalEvent, generateEventId, createEventBase, createExecutionStartEvent, createExecutionEndEvent, createTickStartEvent, createTickEndEvent, createToolCallEvent, createToolResultEvent, createToolConfirmationRequiredEvent, createToolConfirmationResultEvent, createEngineErrorEvent, } from "./engine-events";
|
|
21
|
+
// Tool Executor
|
|
22
|
+
export { ToolExecutor } from "./tool-executor";
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,mBAAmB;AACnB,cAAc,oBAAoB,CAAC;AAEnC,kBAAkB;AAClB,cAAc,mBAAmB,CAAC;AAElC,SAAS;AACT,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,mCAAmC,EACnC,iCAAiC,EACjC,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAezB,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { ToolConfirmationResult } from "../tool/tool";
|
|
2
|
+
/**
|
|
3
|
+
* ToolConfirmationCoordinator - Manages tool confirmation requests
|
|
4
|
+
*
|
|
5
|
+
* Handles waiting for user confirmation before executing tools that have
|
|
6
|
+
* requiresConfirmation enabled. Similar pattern to ClientToolCoordinator
|
|
7
|
+
* but for confirmation flow instead of tool results.
|
|
8
|
+
*
|
|
9
|
+
* Flow:
|
|
10
|
+
* 1. ToolExecutor checks if tool requiresConfirmation
|
|
11
|
+
* 2. If true, calls waitForConfirmation() which blocks
|
|
12
|
+
* 3. Engine yields 'tool_confirmation_required' event to client
|
|
13
|
+
* 4. Client shows confirmation UI to user
|
|
14
|
+
* 5. User confirms/denies (with optional "always" flag)
|
|
15
|
+
* 6. Client sends confirmation via /api/channels/tool-confirmation
|
|
16
|
+
* 7. Server calls resolveConfirmation() which unblocks the promise
|
|
17
|
+
* 8. ToolExecutor proceeds or skips based on confirmation
|
|
18
|
+
*/
|
|
19
|
+
export declare class ToolConfirmationCoordinator {
|
|
20
|
+
private pendingConfirmations;
|
|
21
|
+
/**
|
|
22
|
+
* Wait for user confirmation for a tool call.
|
|
23
|
+
* Returns a promise that resolves when user confirms/denies.
|
|
24
|
+
*
|
|
25
|
+
* Note: No timeout by default - waits indefinitely for user response.
|
|
26
|
+
* The tool is simply not executed if no confirmation is received.
|
|
27
|
+
*
|
|
28
|
+
* @param toolUseId - ID of the tool call awaiting confirmation
|
|
29
|
+
* @param toolName - Name of the tool (for result)
|
|
30
|
+
* @returns Promise that resolves with confirmation result
|
|
31
|
+
*/
|
|
32
|
+
waitForConfirmation(toolUseId: string, _toolName: string): Promise<ToolConfirmationResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Check if there's a pending confirmation for a tool call.
|
|
35
|
+
*
|
|
36
|
+
* @param toolUseId - ID of the tool call
|
|
37
|
+
* @returns true if confirmation is pending
|
|
38
|
+
*/
|
|
39
|
+
hasPendingConfirmation(toolUseId: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Resolve a pending confirmation with user's response.
|
|
42
|
+
* Called when client sends confirmation via /api/channels/tool-confirmation.
|
|
43
|
+
*
|
|
44
|
+
* @param toolUseId - ID of the tool call
|
|
45
|
+
* @param confirmed - Whether user confirmed the execution
|
|
46
|
+
* @param always - Whether to remember this decision
|
|
47
|
+
* @returns The confirmation result, or null if no pending confirmation found
|
|
48
|
+
*/
|
|
49
|
+
resolveConfirmation(toolUseId: string, confirmed: boolean, always?: boolean): ToolConfirmationResult | null;
|
|
50
|
+
/**
|
|
51
|
+
* Resolve a pending confirmation with full result (including tool name).
|
|
52
|
+
* Used internally when we have all the context.
|
|
53
|
+
*
|
|
54
|
+
* @param result - Full confirmation result
|
|
55
|
+
* @returns true if resolved, false if no pending confirmation found
|
|
56
|
+
*/
|
|
57
|
+
resolveConfirmationWithResult(result: ToolConfirmationResult): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Cancel a pending confirmation (e.g., execution cancelled).
|
|
60
|
+
*
|
|
61
|
+
* @param toolUseId - ID of the tool call to cancel
|
|
62
|
+
*/
|
|
63
|
+
cancelConfirmation(toolUseId: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Cancel all pending confirmations (e.g., engine shutdown).
|
|
66
|
+
*/
|
|
67
|
+
cancelAll(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get the number of pending confirmations.
|
|
70
|
+
* Useful for debugging and testing.
|
|
71
|
+
*/
|
|
72
|
+
getPendingCount(): number;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=tool-confirmation-coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-confirmation-coordinator.d.ts","sourceRoot":"","sources":["../../src/engine/tool-confirmation-coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAkB3D;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,2BAA2B;IACtC,OAAO,CAAC,oBAAoB,CAAuD;IAEnF;;;;;;;;;;OAUG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAahG;;;;;OAKG;IACH,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAIlD;;;;;;;;OAQG;IACH,mBAAmB,CACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,OAAO,EAClB,MAAM,GAAE,OAAe,GACtB,sBAAsB,GAAG,IAAI;IAqBhC;;;;;;OAMG;IACH,6BAA6B,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO;IAWtE;;;;OAIG;IACH,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAQ3C;;OAEG;IACH,SAAS,IAAI,IAAI;IAOjB;;;OAGG;IACH,eAAe,IAAI,MAAM;CAG1B"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deferred promise pattern for async coordination
|
|
3
|
+
*/
|
|
4
|
+
class Deferred {
|
|
5
|
+
promise;
|
|
6
|
+
resolve;
|
|
7
|
+
reject;
|
|
8
|
+
constructor() {
|
|
9
|
+
this.promise = new Promise((resolve, reject) => {
|
|
10
|
+
this.resolve = resolve;
|
|
11
|
+
this.reject = reject;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* ToolConfirmationCoordinator - Manages tool confirmation requests
|
|
17
|
+
*
|
|
18
|
+
* Handles waiting for user confirmation before executing tools that have
|
|
19
|
+
* requiresConfirmation enabled. Similar pattern to ClientToolCoordinator
|
|
20
|
+
* but for confirmation flow instead of tool results.
|
|
21
|
+
*
|
|
22
|
+
* Flow:
|
|
23
|
+
* 1. ToolExecutor checks if tool requiresConfirmation
|
|
24
|
+
* 2. If true, calls waitForConfirmation() which blocks
|
|
25
|
+
* 3. Engine yields 'tool_confirmation_required' event to client
|
|
26
|
+
* 4. Client shows confirmation UI to user
|
|
27
|
+
* 5. User confirms/denies (with optional "always" flag)
|
|
28
|
+
* 6. Client sends confirmation via /api/channels/tool-confirmation
|
|
29
|
+
* 7. Server calls resolveConfirmation() which unblocks the promise
|
|
30
|
+
* 8. ToolExecutor proceeds or skips based on confirmation
|
|
31
|
+
*/
|
|
32
|
+
export class ToolConfirmationCoordinator {
|
|
33
|
+
pendingConfirmations = new Map();
|
|
34
|
+
/**
|
|
35
|
+
* Wait for user confirmation for a tool call.
|
|
36
|
+
* Returns a promise that resolves when user confirms/denies.
|
|
37
|
+
*
|
|
38
|
+
* Note: No timeout by default - waits indefinitely for user response.
|
|
39
|
+
* The tool is simply not executed if no confirmation is received.
|
|
40
|
+
*
|
|
41
|
+
* @param toolUseId - ID of the tool call awaiting confirmation
|
|
42
|
+
* @param toolName - Name of the tool (for result)
|
|
43
|
+
* @returns Promise that resolves with confirmation result
|
|
44
|
+
*/
|
|
45
|
+
async waitForConfirmation(toolUseId, _toolName) {
|
|
46
|
+
// Create deferred promise for this confirmation
|
|
47
|
+
const deferred = new Deferred();
|
|
48
|
+
this.pendingConfirmations.set(toolUseId, deferred);
|
|
49
|
+
try {
|
|
50
|
+
return await deferred.promise;
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
// Cleanup (in case of cancellation)
|
|
54
|
+
this.pendingConfirmations.delete(toolUseId);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Check if there's a pending confirmation for a tool call.
|
|
59
|
+
*
|
|
60
|
+
* @param toolUseId - ID of the tool call
|
|
61
|
+
* @returns true if confirmation is pending
|
|
62
|
+
*/
|
|
63
|
+
hasPendingConfirmation(toolUseId) {
|
|
64
|
+
return this.pendingConfirmations.has(toolUseId);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Resolve a pending confirmation with user's response.
|
|
68
|
+
* Called when client sends confirmation via /api/channels/tool-confirmation.
|
|
69
|
+
*
|
|
70
|
+
* @param toolUseId - ID of the tool call
|
|
71
|
+
* @param confirmed - Whether user confirmed the execution
|
|
72
|
+
* @param always - Whether to remember this decision
|
|
73
|
+
* @returns The confirmation result, or null if no pending confirmation found
|
|
74
|
+
*/
|
|
75
|
+
resolveConfirmation(toolUseId, confirmed, always = false) {
|
|
76
|
+
const pending = this.pendingConfirmations.get(toolUseId);
|
|
77
|
+
if (!pending) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
// Build result
|
|
81
|
+
const result = {
|
|
82
|
+
toolUseId,
|
|
83
|
+
toolName: "", // Will be filled by caller who has access to tool metadata
|
|
84
|
+
confirmed,
|
|
85
|
+
always,
|
|
86
|
+
};
|
|
87
|
+
// Resolve the promise
|
|
88
|
+
this.pendingConfirmations.delete(toolUseId);
|
|
89
|
+
pending.resolve(result);
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Resolve a pending confirmation with full result (including tool name).
|
|
94
|
+
* Used internally when we have all the context.
|
|
95
|
+
*
|
|
96
|
+
* @param result - Full confirmation result
|
|
97
|
+
* @returns true if resolved, false if no pending confirmation found
|
|
98
|
+
*/
|
|
99
|
+
resolveConfirmationWithResult(result) {
|
|
100
|
+
const pending = this.pendingConfirmations.get(result.toolUseId);
|
|
101
|
+
if (!pending) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
this.pendingConfirmations.delete(result.toolUseId);
|
|
105
|
+
pending.resolve(result);
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Cancel a pending confirmation (e.g., execution cancelled).
|
|
110
|
+
*
|
|
111
|
+
* @param toolUseId - ID of the tool call to cancel
|
|
112
|
+
*/
|
|
113
|
+
cancelConfirmation(toolUseId) {
|
|
114
|
+
const deferred = this.pendingConfirmations.get(toolUseId);
|
|
115
|
+
if (deferred) {
|
|
116
|
+
this.pendingConfirmations.delete(toolUseId);
|
|
117
|
+
deferred.reject(new Error(`Tool confirmation cancelled: ${toolUseId}`));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Cancel all pending confirmations (e.g., engine shutdown).
|
|
122
|
+
*/
|
|
123
|
+
cancelAll() {
|
|
124
|
+
for (const [toolUseId, deferred] of this.pendingConfirmations.entries()) {
|
|
125
|
+
deferred.reject(new Error(`Tool confirmation cancelled: ${toolUseId}`));
|
|
126
|
+
}
|
|
127
|
+
this.pendingConfirmations.clear();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get the number of pending confirmations.
|
|
131
|
+
* Useful for debugging and testing.
|
|
132
|
+
*/
|
|
133
|
+
getPendingCount() {
|
|
134
|
+
return this.pendingConfirmations.size;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=tool-confirmation-coordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-confirmation-coordinator.js","sourceRoot":"","sources":["../../src/engine/tool-confirmation-coordinator.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,QAAQ;IACZ,OAAO,CAAa;IACpB,OAAO,CAAsB;IAC7B,MAAM,CAA0B;IAEhC;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,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