stitchkit 0.67.0 → 0.68.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/dist/agent-runtime/admission-lanes.d.ts +1 -1
- package/dist/agent-runtime/compaction.d.ts +2 -2
- package/dist/agent-runtime/events.d.ts +1 -1
- package/dist/agent-runtime/history.d.ts +1 -1
- package/dist/agent-runtime/history.d.ts.map +1 -1
- package/dist/agent-runtime/injection.d.ts +1 -1
- package/dist/agent-runtime/managed-tools.d.ts +3 -3
- package/dist/agent-runtime/models.d.ts +1 -1
- package/dist/agent-runtime/observability.d.ts +1 -1
- package/dist/agent-runtime/prompt.d.ts +1 -1
- package/dist/agent-runtime/prompt.d.ts.map +1 -1
- package/dist/agent-runtime/protocol.d.ts +19 -1
- package/dist/agent-runtime/protocol.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution.d.ts +5 -5
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/runtime-internals.d.ts +1 -1
- package/dist/agent-runtime/runtime-result.d.ts +1 -1
- package/dist/agent-runtime/runtime.d.ts +14 -12
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver.d.ts +2 -2
- package/dist/agent-runtime/store.d.ts +2 -2
- package/dist/agent-runtime/terminal-commit.d.ts +2 -2
- package/dist/agent-runtime/terminal-status.d.ts +1 -1
- package/dist/agent-runtime-openrouter.d.ts +1 -1
- package/dist/agent-runtime.d.ts +15 -15
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/agent-runtime.js +90 -30
- package/dist/application/admission.d.ts +131 -0
- package/dist/application/admission.d.ts.map +1 -0
- package/dist/application/channel.d.ts +106 -0
- package/dist/application/channel.d.ts.map +1 -0
- package/dist/application/events.d.ts +2 -2
- package/dist/application/grammy.d.ts +2 -2
- package/dist/application/graph.d.ts +1 -1
- package/dist/application/health.d.ts +1 -1
- package/dist/application/kernel.d.ts +3 -3
- package/dist/application/latest-sink.d.ts.map +1 -1
- package/dist/application/opentelemetry.d.ts +3 -3
- package/dist/application/resource.d.ts +1 -1
- package/dist/application/schedule.d.ts +1 -1
- package/dist/application/server-resource.d.ts +7 -9
- package/dist/application/server-resource.d.ts.map +1 -1
- package/dist/application-grammy.d.ts +1 -1
- package/dist/application-grammy.js +1 -1
- package/dist/application-opentelemetry.d.ts +1 -1
- package/dist/application-opentelemetry.js +1 -1
- package/dist/application.d.ts +11 -9
- package/dist/application.d.ts.map +1 -1
- package/dist/application.js +393 -24
- package/dist/browser/client-multipart.d.ts +1 -1
- package/dist/browser/client-url.d.ts +2 -2
- package/dist/browser/client.d.ts +4 -5
- package/dist/browser/client.d.ts.map +1 -1
- package/dist/browser/contract-stream.d.ts +5 -0
- package/dist/browser/contract-stream.d.ts.map +1 -0
- package/dist/browser/http.d.ts +9 -6
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/socket-io.d.ts +12 -31
- package/dist/browser/socket-io.d.ts.map +1 -1
- package/dist/browser/stream.d.ts +5 -2
- package/dist/browser/stream.d.ts.map +1 -1
- package/dist/browser/transport.d.ts +3 -0
- package/dist/browser/transport.d.ts.map +1 -0
- package/dist/cli.d.ts +6 -6
- package/dist/cli.js +7 -7
- package/dist/contract/define.d.ts +34 -2
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/errors-factory.d.ts +1 -1
- package/dist/contract/errors.d.ts +4 -0
- package/dist/contract/errors.d.ts.map +1 -1
- package/dist/contract/factory.d.ts +1 -1
- package/dist/contract/index.d.ts +7 -6
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/contract/index.js +5 -1
- package/dist/contract/stream.d.ts +19 -0
- package/dist/contract/stream.d.ts.map +1 -0
- package/dist/files/boundary.d.ts +1 -1
- package/dist/files.d.ts +2 -2
- package/dist/{index-xxye8j3k.js → index-0w9abg87.js} +4 -0
- package/dist/{index-svqhcrrj.js → index-2ve29dzn.js} +159 -13
- package/dist/index-69m2278y.js +115 -0
- package/dist/{index-physbf4z.js → index-6wzr93cg.js} +1 -1
- package/dist/index-7etq650s.js +75 -0
- package/dist/index-9ky9hhg3.js +484 -0
- package/dist/{index-413xk7ga.js → index-cq9q73nf.js} +50 -1
- package/dist/{index-1pgeyyee.js → index-cszjsxy5.js} +25 -88
- package/dist/{index-wrhf06ak.js → index-cz32amcb.js} +8 -8
- package/dist/{index-6taryy00.js → index-dafax5md.js} +1 -1
- package/dist/index-g2j2m6vv.js +63 -0
- package/dist/{index-8mxadm34.js → index-nck3yx3y.js} +1102 -22
- package/dist/{index-y91zd0ch.js → index-pr0qsmjy.js} +3 -2
- package/dist/index-v5bayx1z.js +138 -0
- package/dist/{index-mfw1pec7.js → index-wqyrvhzz.js} +3 -3
- package/dist/{index-x8v8b7rc.js → index-zpyj7hsv.js} +330 -58
- package/dist/index.d.ts +10 -10
- package/dist/index.js +274 -109
- package/dist/internal/bounded-lines.d.ts +4 -0
- package/dist/internal/bounded-lines.d.ts.map +1 -0
- package/dist/internal/errors.d.ts +1 -1
- package/dist/internal/observability-sink.d.ts +1 -1
- package/dist/node.d.ts +11 -10
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +11 -8
- package/dist/observability/audit.d.ts +5 -5
- package/dist/observability/context.d.ts +2 -2
- package/dist/observability/event.d.ts +2 -2
- package/dist/observability/index.d.ts +6 -6
- package/dist/observability/index.js +6 -7
- package/dist/react/entity-cache.d.ts +26 -1
- package/dist/react/entity-cache.d.ts.map +1 -1
- package/dist/react.d.ts +3 -3
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +136 -38
- package/dist/realtime/contract.d.ts +1 -1
- package/dist/realtime/index.d.ts +4 -4
- package/dist/realtime/rejection.d.ts +1 -1
- package/dist/realtime/request.d.ts +1 -1
- package/dist/realtime/socket.d.ts +2 -2
- package/dist/remote.d.ts +1 -1
- package/dist/remote.js +5 -6
- package/dist/server/bun.d.ts +3 -3
- package/dist/server/context-contribution.d.ts +1 -1
- package/dist/server/context.d.ts +4 -4
- package/dist/server/contract-stream.d.ts +5 -0
- package/dist/server/contract-stream.d.ts.map +1 -0
- package/dist/server/create.d.ts +1 -1
- package/dist/server/create.d.ts.map +1 -1
- package/dist/server/error-hook.d.ts +3 -3
- package/dist/server/file.d.ts +1 -1
- package/dist/server/implement.d.ts +2 -2
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/index.d.ts +31 -30
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +44 -286
- package/dist/server/lifecycle.d.ts +1 -1
- package/dist/server/logging.d.ts +1 -1
- package/dist/server/middleware/auth.d.ts +2 -2
- package/dist/server/multipart.d.ts +2 -2
- package/dist/server/node.d.ts +2 -2
- package/dist/server/openapi.d.ts +1 -1
- package/dist/server/openapi.d.ts.map +1 -1
- package/dist/server/process-signal-common.d.ts +1 -1
- package/dist/server/process-signals.d.ts +1 -1
- package/dist/server/realtime.d.ts +4 -4
- package/dist/server/response-metadata.d.ts +1 -1
- package/dist/server/router.d.ts +1 -1
- package/dist/server/shutdown.d.ts +1 -1
- package/dist/server/socket-io-node.d.ts +3 -3
- package/dist/server/socket-io.d.ts +6 -6
- package/dist/server/stream.d.ts +3 -1
- package/dist/server/stream.d.ts.map +1 -1
- package/dist/server/streaming-route.d.ts +4 -2
- package/dist/server/streaming-route.d.ts.map +1 -1
- package/dist/server/types.d.ts +18 -8
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/unix-client-body.d.ts +4 -0
- package/dist/server/unix-client-body.d.ts.map +1 -0
- package/dist/server/unix-client-bun.d.ts +13 -0
- package/dist/server/unix-client-bun.d.ts.map +1 -0
- package/dist/server/unix-client-error.d.ts +9 -0
- package/dist/server/unix-client-error.d.ts.map +1 -0
- package/dist/server/unix-client.d.ts +25 -0
- package/dist/server/unix-client.d.ts.map +1 -0
- package/dist/testing/agent-store-conformance.d.ts +1 -1
- package/dist/testing/managed-resource-conformance-contract.d.ts +1 -1
- package/dist/testing/managed-resource-conformance-driver.d.ts +2 -2
- package/dist/testing/managed-resource-conformance-scenarios.d.ts +2 -2
- package/dist/testing/managed-resource-conformance.d.ts +2 -2
- package/dist/testing/surface-conformance.d.ts +3 -3
- package/dist/testing/surface-manifest.d.ts +5 -5
- package/dist/testing.d.ts +8 -8
- package/dist/testing.js +6 -5
- package/dist/tool-invoker.d.ts +9 -0
- package/dist/tool-invoker.d.ts.map +1 -0
- package/dist/tool-invoker.js +16 -0
- package/dist/tools/agent.d.ts +4 -4
- package/dist/tools/async-operation.d.ts +3 -3
- package/dist/tools/cli-command.d.ts +3 -3
- package/dist/tools/cli-format.d.ts +1 -1
- package/dist/tools/cli-policy.d.ts +1 -1
- package/dist/tools/cli-wait.d.ts +1 -1
- package/dist/tools/cli.d.ts +7 -7
- package/dist/tools/define-download-tool.d.ts +4 -4
- package/dist/tools/define-upload-tool.d.ts +3 -3
- package/dist/tools/define-view-file-tool.d.ts +3 -3
- package/dist/tools/define-wait-tool.d.ts +2 -2
- package/dist/tools/download-core.d.ts +2 -2
- package/dist/tools/execute.d.ts +2 -2
- package/dist/tools/flatten-join.d.ts +1 -1
- package/dist/tools/internal/surface-projector.d.ts +3 -3
- package/dist/tools/invoker.d.ts +4 -4
- package/dist/tools/lifecycle.d.ts +1 -1
- package/dist/tools/list-names.d.ts +2 -2
- package/dist/tools/managed-file-error.d.ts +1 -1
- package/dist/tools/manifest.d.ts +3 -3
- package/dist/tools/mcp-handler.d.ts +4 -4
- package/dist/tools/mcp-prepare.d.ts +8 -8
- package/dist/tools/mcp-round-policy.d.ts +1 -1
- package/dist/tools/mcp-round.d.ts +3 -3
- package/dist/tools/mcp-stdio-signals.d.ts +2 -2
- package/dist/tools/mcp-stdio.d.ts +3 -3
- package/dist/tools/mcp.d.ts +7 -7
- package/dist/tools/mount-download.d.ts +1 -1
- package/dist/tools/mount-upload.d.ts +1 -1
- package/dist/tools/mount.d.ts +5 -5
- package/dist/tools/native-definition.d.ts +2 -2
- package/dist/tools/native-mcp.d.ts +3 -3
- package/dist/tools/oauth-metadata.d.ts +1 -1
- package/dist/tools/oauth-provider.d.ts +1 -1
- package/dist/tools/presentation.d.ts +1 -1
- package/dist/tools/remote.d.ts +3 -3
- package/dist/tools/runtime-tool.d.ts +2 -2
- package/dist/tools/surface.d.ts +5 -5
- package/dist/tools/tool-logger.d.ts +1 -1
- package/dist/tools/toolkit.d.ts +7 -7
- package/dist/tools/transports.d.ts +2 -2
- package/dist/tools/upload-core.d.ts +1 -1
- package/dist/tools/view-file.d.ts +1 -1
- package/dist/tools.d.ts +42 -42
- package/dist/tools.js +27 -72
- package/llms-full.txt +506 -35
- package/package.json +8 -4
- package/dist/index-48ffdxgk.js +0 -6
- package/dist/index-pzyt11ch.js +0 -127
- package/dist/index-tvwcrx2d.js +0 -224
- package/dist/index-wd8g8z6e.js +0 -206
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ZodType, z } from 'zod';
|
|
2
|
-
import type { AgentMessage, AgentSnapshot, AgentUsage } from './schemas';
|
|
3
|
-
import type { AgentRuntimeStore } from './store';
|
|
2
|
+
import type { AgentMessage, AgentSnapshot, AgentUsage } from './schemas.js';
|
|
3
|
+
import type { AgentRuntimeStore } from './store.js';
|
|
4
4
|
export interface AgentCompactionContext<SUMMARY> {
|
|
5
5
|
conversationId: string;
|
|
6
6
|
snapshot: AgentSnapshot;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type { ObservabilitySinkStatus } from '../observability/status';
|
|
2
|
+
import type { ObservabilitySinkStatus } from '../observability/status.js';
|
|
3
3
|
export declare const AgentAdmissionEventSchema: z.ZodObject<{
|
|
4
4
|
type: z.ZodLiteral<"admission">;
|
|
5
5
|
eventId: z.ZodString;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FilePart, type ModelMessage } from 'ai';
|
|
2
|
-
import type { AgentMessage, AgentMessagePart } from './schemas';
|
|
2
|
+
import type { AgentMessage, AgentMessagePart } from './schemas.js';
|
|
3
3
|
type PartType = AgentMessagePart['type'];
|
|
4
4
|
export interface AgentHistoryProjectionOptions {
|
|
5
5
|
resolveFile?(part: Extract<AgentMessagePart, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAsB,MAAM,IAAI,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAyB,MAAM,WAAW,CAAC;AAGvF,KAAK,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEzC,MAAM,WAAW,6BAA6B;IAC5C,WAAW,CAAC,CACV,IAAI,EAAE,OAAO,CAAC,gBAAgB,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,EACjD,OAAO,EAAE,YAAY,GACpB,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAChD;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC3C,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC9C,kBAAkB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,oBAAoB,CAAC,EAAE,kBAAkB,GAAG,aAAa,GAAG,MAAM,CAAC;CACpE;AAED,MAAM,WAAW,8BAA8B;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,MAAM,EACF,WAAW,GACX,iBAAiB,GACjB,OAAO,GACP,mBAAmB,GACnB,sBAAsB,GACtB,aAAa,GACb,YAAY,CAAC;IACjB;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CACpC;AAED,MAAM,WAAW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YAAY,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAClC,SAAS,EAAE,SAAS,8BAA8B,EAAE,CAAC;IACrD;;;;;;;;;;;OAWG;IACH,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B;AAwMD,wEAAwE;AACxE,wBAAsB,2BAA2B,CAC/C,QAAQ,EAAE,SAAS,YAAY,EAAE,EACjC,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,4BAA4B,CAAC,CAsFvC;AAED,4EAA4E;AAC5E,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,SAAS,YAAY,EAAE,EACjC,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,YAAY,EAAE,CAAC,CAEzB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { RuntimeContext } from '../contract';
|
|
2
|
-
import type { OperationIdentity } from '../server/types';
|
|
3
|
-
import { type ToolExecutionControlReason, type ToolLifecycle } from '../tools/execute';
|
|
1
|
+
import type { RuntimeContext } from '../contract/index.js';
|
|
2
|
+
import type { OperationIdentity } from '../server/types.js';
|
|
3
|
+
import { type ToolExecutionControlReason, type ToolLifecycle } from '../tools/execute.js';
|
|
4
4
|
export interface AgentToolFenceContext {
|
|
5
5
|
runId: string;
|
|
6
6
|
stepId?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LanguageModel, LanguageModelUsage } from 'ai';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import type { AgentUsage } from './schemas';
|
|
3
|
+
import type { AgentUsage } from './schemas.js';
|
|
4
4
|
export declare const AgentModelCapabilitySchema: z.ZodEnum<{
|
|
5
5
|
files: "files";
|
|
6
6
|
reasoning: "reasoning";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type { ObservabilitySinkStatus } from '../observability/status';
|
|
2
|
+
import type { ObservabilitySinkStatus } from '../observability/status.js';
|
|
3
3
|
export declare const AgentRunStartedEventSchema: z.ZodObject<{
|
|
4
4
|
schemaVersion: z.ZodLiteral<1>;
|
|
5
5
|
eventId: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,YAAY,EAAyB,MAAM,WAAW,CAAC;AAGrE;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;iBAQhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,MAAM,WAAW,yBAAyB,CAAC,OAAO;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB,CAAC,OAAO;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,QAAQ,GAAG,SAAS,CAAC;IAChC,MAAM,CAAC,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5E,cAAc,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC3E;AAED,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,eAAe,CAAC;IAC7B,WAAW,EAAE,eAAe,CAAC;IAC7B,gBAAgB,EAAE,eAAe,CAAC;CACnC;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,YAAY,CAAC;I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AG,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACpF;AA6CD,sFAAsF;AACtF,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CA2GnC;AAED,MAAM,WAAW,yBAAyB,CAAC,OAAO;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,cAAc,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACtC,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAChF,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC5E;AAMD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,kBAAkB,CAAC,OAAO,CAAC,EAAE,aACnE,yBAAyB,CAAC,OAAO,CAAC,KAAG,OAAO,CAAC,mBAAmB,CAAC,CAqFzF"}
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import type { ZodType, z } from 'zod';
|
|
2
|
-
import { AgentJsonObjectSchema, type AgentMessage, type AgentMessagePart } from './schemas';
|
|
2
|
+
import { AgentJsonObjectSchema, type AgentMessage, type AgentMessagePart, type AgentTerminalReason } from './schemas.js';
|
|
3
|
+
export interface AgentTerminalAcceptanceInput {
|
|
4
|
+
message: AgentMessage;
|
|
5
|
+
reason: AgentTerminalReason;
|
|
6
|
+
policyName?: string;
|
|
7
|
+
}
|
|
8
|
+
export type AgentTerminalAcceptance = 'allow-empty' | 'require-output' | ((input: AgentTerminalAcceptanceInput) => boolean | Promise<boolean>);
|
|
9
|
+
/** Generic final-output policy used by `terminalAcceptance: 'require-output'`. */
|
|
10
|
+
export declare function hasAgentTerminalOutput(input: AgentTerminalAcceptanceInput): boolean;
|
|
3
11
|
export interface AgentProtocolConfig<CONTEXT extends ZodType, INPUT_METADATA extends ZodType> {
|
|
4
12
|
context: CONTEXT;
|
|
5
13
|
inputMetadata: INPUT_METADATA;
|
|
14
|
+
/**
|
|
15
|
+
* Validate a would-be completed assistant before its terminal CAS.
|
|
16
|
+
*
|
|
17
|
+
* Default `allow-empty` preserves protocols where an empty stop is valid.
|
|
18
|
+
* `require-output` accepts non-blank text, generated files, structured opaque
|
|
19
|
+
* provider output, and an explicit tool-only policy stop. A callback owns any
|
|
20
|
+
* product-specific definition without rewriting a committed terminal record.
|
|
21
|
+
*/
|
|
22
|
+
terminalAcceptance?: AgentTerminalAcceptance;
|
|
6
23
|
}
|
|
7
24
|
export interface AgentProtocol<CONTEXT extends ZodType, INPUT_METADATA extends ZodType> {
|
|
8
25
|
contextSchema: CONTEXT;
|
|
@@ -11,6 +28,7 @@ export interface AgentProtocol<CONTEXT extends ZodType, INPUT_METADATA extends Z
|
|
|
11
28
|
parseInputMetadata(input: unknown): z.infer<typeof AgentJsonObjectSchema>;
|
|
12
29
|
parseMessage(input: unknown): AgentMessage;
|
|
13
30
|
parsePart(input: unknown): AgentMessagePart;
|
|
31
|
+
acceptTerminal?(input: AgentTerminalAcceptanceInput): boolean | Promise<boolean>;
|
|
14
32
|
}
|
|
15
33
|
export declare function defineAgentProtocol<CONTEXT extends ZodType, INPUT_METADATA extends ZodType>(config: AgentProtocolConfig<CONTEXT, INPUT_METADATA>): AgentProtocol<CONTEXT, INPUT_METADATA>;
|
|
16
34
|
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,KAAK,Y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AS,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC;IAC5C,cAAc,CAAC,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAClF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,SAAS,OAAO,EAAE,cAAc,SAAS,OAAO,EACzF,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,cAAc,CAAC,GACnD,aAAa,CAAC,OAAO,EAAE,cAAc,CAAC,CAexC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ToolSet } from 'ai';
|
|
2
|
-
import { type AgentRuntimeEvent } from './events';
|
|
3
|
-
import type { AgentInjectionRegistry } from './injection';
|
|
4
|
-
import type { AgentRuntimeConfig } from './runtime';
|
|
5
|
-
import type { AgentRuntimeResult } from './runtime-result';
|
|
6
|
-
import { type AgentRun } from './schemas';
|
|
2
|
+
import { type AgentRuntimeEvent } from './events.js';
|
|
3
|
+
import type { AgentInjectionRegistry } from './injection.js';
|
|
4
|
+
import type { AgentRuntimeConfig } from './runtime.js';
|
|
5
|
+
import type { AgentRuntimeResult } from './runtime-result.js';
|
|
6
|
+
import { type AgentRun } from './schemas.js';
|
|
7
7
|
/** Everything one run needs from the factory that owns it. */
|
|
8
8
|
export interface RunExecutorDependencies<CONTEXT, TOOLS extends ToolSet> {
|
|
9
9
|
config: AgentRuntimeConfig<CONTEXT, TOOLS>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-execution.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/run-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,OAAO,EACb,MAAM,IAAI,CAAC;AAEZ,OAAO,EAAE,KAAK,iBAAiB,EAAuB,MAAM,UAAU,CAAC;AAEvE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,C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O,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAKL,KAAK,QAAQ,EAKd,MAAM,WAAW,CAAC;AAQnB,8DAA8D;AAC9D,MAAM,WAAW,uBAAuB,CAAC,OAAO,EAAE,KAAK,SAAS,OAAO;IACrE,MAAM,EAAE,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3C,OAAO,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,IAAI,MAAM,CAAC;IACrB,GAAG,IAAI,IAAI,CAAC;IACZ,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,KAAK,SAAS,OAAO,EAC9D,YAAY,EAAE,uBAAuB,CAAC,OAAO,EAAE,KAAK,CAAC,WAcb;IACtC,WAAW,EAAE,QAAQ,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;IACpB,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAC;CACb,KAAG,OAAO,CAAC,kBAAkB,CAAC,CAk3BhC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LanguageModelUsage } from 'ai';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { type AgentMessagePart, type AgentRun, type AgentTerminalReason, type AgentUsage } from './schemas';
|
|
3
|
+
import { type AgentMessagePart, type AgentRun, type AgentTerminalReason, type AgentUsage } from './schemas.js';
|
|
4
4
|
/**
|
|
5
5
|
* Pure helpers shared by the runtime factory and the run executor.
|
|
6
6
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentMessage, AgentRun, AgentRunMetrics, AgentTerminalReason } from './schemas';
|
|
1
|
+
import type { AgentMessage, AgentRun, AgentRunMetrics, AgentTerminalReason } from './schemas.js';
|
|
2
2
|
/** What one completed run reports back to whoever submitted it. */
|
|
3
3
|
export interface AgentRuntimeResult {
|
|
4
4
|
run: AgentRun;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import type { GeneratedFile, ModelMessage, PrepareStepFunction, StopCondition, ToolSet } from 'ai';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
|
-
import type { ToolLifecycle } from '../tools/execute';
|
|
4
|
-
import type { AgentCompactionResult } from './compaction';
|
|
5
|
-
import { type AgentInputPolicy, type AgentSessionCloseOptions, type AgentSessionCloseResult, type AgentStopReason } from './coordinator';
|
|
6
|
-
import { type AgentRuntimeEvent, type AgentRuntimePublisher } from './events';
|
|
7
|
-
import type { AgentHistoryProjectionOptions } from './history';
|
|
8
|
-
import type { AgentResolvedModel } from './models';
|
|
9
|
-
import type { AgentObservability } from './observability';
|
|
10
|
-
import type { ComposedAgentPrompt } from './prompt';
|
|
11
|
-
import type {
|
|
12
|
-
import
|
|
13
|
-
import type
|
|
14
|
-
import type {
|
|
3
|
+
import type { ToolLifecycle } from '../tools/execute.js';
|
|
4
|
+
import type { AgentCompactionResult } from './compaction.js';
|
|
5
|
+
import { type AgentInputPolicy, type AgentSessionCloseOptions, type AgentSessionCloseResult, type AgentStopReason } from './coordinator.js';
|
|
6
|
+
import { type AgentRuntimeEvent, type AgentRuntimePublisher } from './events.js';
|
|
7
|
+
import type { AgentHistoryProjectionOptions } from './history.js';
|
|
8
|
+
import type { AgentResolvedModel } from './models.js';
|
|
9
|
+
import type { AgentObservability } from './observability.js';
|
|
10
|
+
import type { ComposedAgentPrompt } from './prompt.js';
|
|
11
|
+
import type { AgentTerminalAcceptanceInput } from './protocol.js';
|
|
12
|
+
import type { AgentRuntimeResult } from './runtime-result.js';
|
|
13
|
+
import { type AgentAssistantPlaceholder, type AgentJsonObjectSchema, type AgentMessage, type AgentMessagePart, type AgentRun, type AgentSnapshot } from './schemas.js';
|
|
14
|
+
import type { AgentRuntimeStore, AgentStoreMutationResult } from './store.js';
|
|
15
|
+
import type { AgentRecoverableDescriptor } from './store-driver.js';
|
|
15
16
|
export interface AgentRuntimeProtocolInput<CONTEXT> {
|
|
16
17
|
parseContext(input: unknown): CONTEXT;
|
|
17
18
|
parseInputMetadata(input: unknown): z.infer<typeof AgentJsonObjectSchema>;
|
|
18
19
|
parsePart(input: unknown): AgentMessagePart;
|
|
20
|
+
acceptTerminal?(input: AgentTerminalAcceptanceInput): boolean | Promise<boolean>;
|
|
19
21
|
}
|
|
20
22
|
export interface AgentRuntimeInput {
|
|
21
23
|
conversationId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,OAAO,EACR,MAAM,IAAI,CAAC;AACZ,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EAGrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAE3B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,WAAW,CAAC;AAE/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,K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,CAAC,KAAK,SAAS,OAAO,GAAG,OAAO;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY,CAAC,OAAO,GAAG,OAAO;IAC7C,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG;QAChC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACxB,SAAS,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;QAC1C,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;KACrC,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,yBAAyB,GAAG;QACxC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACxB,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;KACrC,CAAC;IACF,SAAS,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAChF,OAAO,CACL,OAAO,EAAE,0BAA0B,CAAC,OAAO,CAAC,GAC3C,OAAO,CAAC,SAAS,2BAA2B,EAAE,CAAC,CAAC;IACnD,IAAI,CAAC,eAAe,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC;IACjE;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC7E;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,KAAK,SAAS,OAAO,EAC/D,MAAM,EAAE,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,GACzC,YAAY,CAAC,OAAO,CAAC,CAgrBvB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type AgentMessage, type AgentRun } from './schemas';
|
|
3
|
-
import { type AgentRuntimeStore } from './store';
|
|
2
|
+
import { type AgentMessage, type AgentRun } from './schemas.js';
|
|
3
|
+
import { type AgentRuntimeStore } from './store.js';
|
|
4
4
|
export declare const AgentRuntimeHeadSchema: z.ZodObject<{
|
|
5
5
|
schemaVersion: z.ZodLiteral<1>;
|
|
6
6
|
conversationId: z.ZodString;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type AgentRun, type AgentSnapshot } from './schemas';
|
|
2
|
+
import { type AgentRun, type AgentSnapshot } from './schemas.js';
|
|
3
3
|
export declare const AgentStoreConflictSchema: z.ZodObject<{
|
|
4
4
|
outcome: z.ZodLiteral<"conflict">;
|
|
5
5
|
actualVersion: z.ZodInt;
|
|
@@ -2078,6 +2078,6 @@ export interface AgentRuntimeStore {
|
|
|
2078
2078
|
scanRecoverable(input: {
|
|
2079
2079
|
cursor?: string;
|
|
2080
2080
|
limit: number;
|
|
2081
|
-
}): Promise<import('./store-driver').AgentRecoverablePage>;
|
|
2081
|
+
}): Promise<import('./store-driver.js').AgentRecoverablePage>;
|
|
2082
2082
|
}
|
|
2083
2083
|
//# sourceMappingURL=store.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AgentMessage, type AgentRun, type AgentTerminalReason, type AgentUsage } from './schemas';
|
|
2
|
-
import type { AgentRuntimeStore, AgentStoreMutationResult } from './store';
|
|
1
|
+
import { type AgentMessage, type AgentRun, type AgentTerminalReason, type AgentUsage } from './schemas.js';
|
|
2
|
+
import type { AgentRuntimeStore, AgentStoreMutationResult } from './store.js';
|
|
3
3
|
export declare class AgentRuntimeConflictError extends Error {
|
|
4
4
|
constructor(operation: string);
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type OpenRouterProviderSettings } from '@openrouter/ai-sdk-provider';
|
|
2
|
-
import type { AgentLanguageModelProvider } from './agent-runtime/models';
|
|
2
|
+
import type { AgentLanguageModelProvider } from './agent-runtime/models.js';
|
|
3
3
|
export type { OpenRouterProviderSettings } from '@openrouter/ai-sdk-provider';
|
|
4
4
|
/** Isolated OpenRouter adapter; credentials stay inside the provider instance. */
|
|
5
5
|
export declare function openRouterProvider(settings: OpenRouterProviderSettings): AgentLanguageModelProvider;
|
package/dist/agent-runtime.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export { type AgentCompactionContext, type AgentCompactionResult, type StructuredCompactionConfig, structuredCompaction, } from './agent-runtime/compaction';
|
|
2
|
-
export { type AgentCoordinatedRun, type AgentInputPolicy, type AgentRunTicket, type AgentSessionCloseOptions, type AgentSessionCloseResult, type AgentSessionCoordinator, type AgentStopReason, createAgentSessionCoordinator, } from './agent-runtime/coordinator';
|
|
3
|
-
export { AgentAdmissionEventSchema, AgentCheckpointEventSchema, AgentReasoningDeltaEventSchema, AgentReasoningEndEventSchema, AgentReasoningStartEventSchema, AgentRunStateEventSchema, type AgentRuntimeCursorAdvance, type AgentRuntimeEvent, type AgentRuntimeEventCursor, AgentRuntimeEventCursorSchema, AgentRuntimeEventSchema, type AgentRuntimeEventSink, type AgentRuntimeEventSinkConfig, type AgentRuntimePublisher, AgentTerminalEventSchema, AgentToolStatusEventSchema, AgentTransientDeltaEventSchema, advanceAgentRuntimeEventCursor, agentDurableEventId, createAgentRuntimeEventSink, } from './agent-runtime/events';
|
|
4
|
-
export { type AgentHistoryProjectionDecision, type AgentHistoryProjectionOptions, type AgentHistoryProjectionResult, projectAgentHistory, projectAgentHistoryDetailed, } from './agent-runtime/history';
|
|
5
|
-
export { type AgentToolFenceConfig, type AgentToolFenceContext, createAgentToolFenceLifecycle, } from './agent-runtime/managed-tools';
|
|
6
|
-
export { type AgentLanguageModelProvider, type AgentModelCapability, AgentModelCapabilitySchema, type AgentModelDescriptor, AgentModelDescriptorSchema, type AgentModelRegistry, type AgentModelRegistryConfig, type AgentModelRegistrySnapshot, AgentModelRegistrySnapshotSchema, type AgentModelSnapshotPolicy, type AgentResolvedModel, defineModelRegistry, validateAgentModelSnapshot, } from './agent-runtime/models';
|
|
7
|
-
export { type AgentObservability, type AgentRunEvent, AgentRunEventSchema, type AgentRunSinkConfig, type AgentRunSinkDrop, type AgentRunSinkError, type AgentRunStartedEvent, AgentRunStartedEventSchema, type AgentRunTerminalEvent, AgentRunTerminalEventSchema, type AgentStepFinishedEvent, AgentStepFinishedEventSchema, createAgentObservability, } from './agent-runtime/observability';
|
|
8
|
-
export { type AgentHistoryBudgetDecision, type AgentHistoryBudgetResult, type AgentPromptBudget, type AgentPromptSection, type AgentPromptSectionContext, type AgentTokenCount, AgentTokenCountSchema, type ComposeAgentPromptOptions, type ComposedAgentPrompt, composeAgentPrompt, type SelectAgentHistoryOptions, selectAgentHistory, } from './agent-runtime/prompt';
|
|
9
|
-
export { type AgentProtocol, type AgentProtocolConfig, defineAgentProtocol, } from './agent-runtime/protocol';
|
|
10
|
-
export { type AgentRuntime, type AgentRuntimeAdmission, type AgentRuntimeConfig, type AgentRuntimeInput, type AgentRuntimeInterruptInput, type AgentRuntimePrepareStep, type AgentRuntimeProtocolInput, type AgentRuntimeRecordIds, type AgentRuntimeRecoverOptions, type AgentRuntimeRecoveryDecision, type AgentRuntimeRecoveryInput, type AgentRuntimeRecoveryOutcome, type AgentRuntimeRunContext, type AgentRuntimeStopPolicy, createAgentRuntime, } from './agent-runtime/runtime';
|
|
11
|
-
export type { AgentRuntimeResult } from './agent-runtime/runtime-result';
|
|
12
|
-
export * from './agent-runtime/schemas';
|
|
13
|
-
export { type AcceptInputAndAssignRun, AcceptInputAndAssignRunSchema, type AcquireAgentRun, AcquireAgentRunSchema, type AgentRuntimeStore, type AgentRunView, AgentRunViewSchema, AgentStoreAppliedSchema, AgentStoreConflictSchema, AgentStoreDuplicateSchema, type AgentStoreMutationResult, AgentStoreMutationResultSchema, AgentStoreNotFoundSchema, type CheckpointRunAssistant, CheckpointRunAssistantSchema, type CommitRunTerminal, CommitRunTerminalSchema, type RecoverAgentRun, RecoverAgentRunSchema, type ReplaceCompactedRange, ReplaceCompactedRangeSchema, type RequestRunInterrupt, RequestRunInterruptSchema, } from './agent-runtime/store';
|
|
14
|
-
export { ACTIVE_AGENT_RUN_STATES, type AgentAdmissionReceipt, AgentAdmissionReceiptSchema, type AgentHistoryMutation, AgentHistoryMutationSchema, type AgentRecoverableDescriptor, AgentRecoverableDescriptorSchema, type AgentRecoverablePage, AgentRecoverablePageSchema, type AgentRuntimeHead, AgentRuntimeHeadSchema, type AgentRuntimeStoreDriver, type AgentStoreCompareAndSwapResult, type AgentStoredRun, AgentStoredRunSchema, createAgentRuntimeStore, createMemoryAgentRuntimeStore, } from './agent-runtime/store-driver';
|
|
15
|
-
export { AgentRuntimeConflictError } from './agent-runtime/terminal-commit';
|
|
1
|
+
export { type AgentCompactionContext, type AgentCompactionResult, type StructuredCompactionConfig, structuredCompaction, } from './agent-runtime/compaction.js';
|
|
2
|
+
export { type AgentCoordinatedRun, type AgentInputPolicy, type AgentRunTicket, type AgentSessionCloseOptions, type AgentSessionCloseResult, type AgentSessionCoordinator, type AgentStopReason, createAgentSessionCoordinator, } from './agent-runtime/coordinator.js';
|
|
3
|
+
export { AgentAdmissionEventSchema, AgentCheckpointEventSchema, AgentReasoningDeltaEventSchema, AgentReasoningEndEventSchema, AgentReasoningStartEventSchema, AgentRunStateEventSchema, type AgentRuntimeCursorAdvance, type AgentRuntimeEvent, type AgentRuntimeEventCursor, AgentRuntimeEventCursorSchema, AgentRuntimeEventSchema, type AgentRuntimeEventSink, type AgentRuntimeEventSinkConfig, type AgentRuntimePublisher, AgentTerminalEventSchema, AgentToolStatusEventSchema, AgentTransientDeltaEventSchema, advanceAgentRuntimeEventCursor, agentDurableEventId, createAgentRuntimeEventSink, } from './agent-runtime/events.js';
|
|
4
|
+
export { type AgentHistoryProjectionDecision, type AgentHistoryProjectionOptions, type AgentHistoryProjectionResult, projectAgentHistory, projectAgentHistoryDetailed, } from './agent-runtime/history.js';
|
|
5
|
+
export { type AgentToolFenceConfig, type AgentToolFenceContext, createAgentToolFenceLifecycle, } from './agent-runtime/managed-tools.js';
|
|
6
|
+
export { type AgentLanguageModelProvider, type AgentModelCapability, AgentModelCapabilitySchema, type AgentModelDescriptor, AgentModelDescriptorSchema, type AgentModelRegistry, type AgentModelRegistryConfig, type AgentModelRegistrySnapshot, AgentModelRegistrySnapshotSchema, type AgentModelSnapshotPolicy, type AgentResolvedModel, defineModelRegistry, validateAgentModelSnapshot, } from './agent-runtime/models.js';
|
|
7
|
+
export { type AgentObservability, type AgentRunEvent, AgentRunEventSchema, type AgentRunSinkConfig, type AgentRunSinkDrop, type AgentRunSinkError, type AgentRunStartedEvent, AgentRunStartedEventSchema, type AgentRunTerminalEvent, AgentRunTerminalEventSchema, type AgentStepFinishedEvent, AgentStepFinishedEventSchema, createAgentObservability, } from './agent-runtime/observability.js';
|
|
8
|
+
export { type AgentHistoryBudgetDecision, type AgentHistoryBudgetResult, type AgentPromptBudget, type AgentPromptSection, type AgentPromptSectionContext, type AgentTokenCount, AgentTokenCountSchema, type ComposeAgentPromptOptions, type ComposedAgentPrompt, composeAgentPrompt, type SelectAgentHistoryOptions, selectAgentHistory, } from './agent-runtime/prompt.js';
|
|
9
|
+
export { type AgentProtocol, type AgentProtocolConfig, type AgentTerminalAcceptance, type AgentTerminalAcceptanceInput, defineAgentProtocol, hasAgentTerminalOutput, } from './agent-runtime/protocol.js';
|
|
10
|
+
export { type AgentRuntime, type AgentRuntimeAdmission, type AgentRuntimeConfig, type AgentRuntimeInput, type AgentRuntimeInterruptInput, type AgentRuntimePrepareStep, type AgentRuntimeProtocolInput, type AgentRuntimeRecordIds, type AgentRuntimeRecoverOptions, type AgentRuntimeRecoveryDecision, type AgentRuntimeRecoveryInput, type AgentRuntimeRecoveryOutcome, type AgentRuntimeRunContext, type AgentRuntimeStopPolicy, createAgentRuntime, } from './agent-runtime/runtime.js';
|
|
11
|
+
export type { AgentRuntimeResult } from './agent-runtime/runtime-result.js';
|
|
12
|
+
export * from './agent-runtime/schemas.js';
|
|
13
|
+
export { type AcceptInputAndAssignRun, AcceptInputAndAssignRunSchema, type AcquireAgentRun, AcquireAgentRunSchema, type AgentRuntimeStore, type AgentRunView, AgentRunViewSchema, AgentStoreAppliedSchema, AgentStoreConflictSchema, AgentStoreDuplicateSchema, type AgentStoreMutationResult, AgentStoreMutationResultSchema, AgentStoreNotFoundSchema, type CheckpointRunAssistant, CheckpointRunAssistantSchema, type CommitRunTerminal, CommitRunTerminalSchema, type RecoverAgentRun, RecoverAgentRunSchema, type ReplaceCompactedRange, ReplaceCompactedRangeSchema, type RequestRunInterrupt, RequestRunInterruptSchema, } from './agent-runtime/store.js';
|
|
14
|
+
export { ACTIVE_AGENT_RUN_STATES, type AgentAdmissionReceipt, AgentAdmissionReceiptSchema, type AgentHistoryMutation, AgentHistoryMutationSchema, type AgentRecoverableDescriptor, AgentRecoverableDescriptorSchema, type AgentRecoverablePage, AgentRecoverablePageSchema, type AgentRuntimeHead, AgentRuntimeHeadSchema, type AgentRuntimeStoreDriver, type AgentStoreCompareAndSwapResult, type AgentStoredRun, AgentStoredRunSchema, createAgentRuntimeStore, createMemoryAgentRuntimeStore, } from './agent-runtime/store-driver.js';
|
|
15
|
+
export { AgentRuntimeConflictError } from './agent-runtime/terminal-commit.js';
|
|
16
16
|
//# sourceMappingURL=agent-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-runtime.d.ts","sourceRoot":"","sources":["../src/agent-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,6BAA6B,GAC9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,yBAAyB,EACzB,0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ChC,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,cAAc,yBAAyB,CAAC;AACxC,OAAO,EACL,KAAK,uBAAuB,EAC5B,6BAA6B,EAC7B,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,KAAK,iBAAiB,EACtB,uBAAuB,EACvB,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,2BAA2B,EAC3B,KAAK,mBAAmB,EACxB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,2BAA2B,EAC3B,KAAK,oBAAoB,EACzB,0BAA0B,EAC1B,KAAK,0BAA0B,EAC/B,gCAAgC,EAChC,KAAK,oBAAoB,EACzB,0BAA0B,EAC1B,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,cAAc,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/agent-runtime.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createBoundedSinkManager
|
|
3
|
+
} from "./index-a59da114.js";
|
|
1
4
|
import {
|
|
2
5
|
ToolExecutionControlError,
|
|
3
6
|
isToolExecutionControlError
|
|
4
|
-
} from "./index-
|
|
7
|
+
} from "./index-cz32amcb.js";
|
|
8
|
+
import"./index-69m2278y.js";
|
|
5
9
|
import {
|
|
6
10
|
AgentAssistantPlaceholderSchema,
|
|
7
11
|
AgentControlPartSchema,
|
|
@@ -34,18 +38,13 @@ import {
|
|
|
34
38
|
} from "./index-fhsmrzj7.js";
|
|
35
39
|
import"./index-6djpbnda.js";
|
|
36
40
|
import"./index-cby4ar3v.js";
|
|
37
|
-
import {
|
|
38
|
-
createBoundedSinkManager
|
|
39
|
-
} from "./index-a59da114.js";
|
|
40
|
-
import"./index-tvwcrx2d.js";
|
|
41
|
-
import"./index-wd8g8z6e.js";
|
|
42
|
-
import"./index-6k1937bx.js";
|
|
43
41
|
import {
|
|
44
42
|
childSpan,
|
|
45
43
|
createTraceContext
|
|
46
|
-
} from "./index-
|
|
44
|
+
} from "./index-9ky9hhg3.js";
|
|
47
45
|
import"./index-smpbdg6k.js";
|
|
48
|
-
import"./index-
|
|
46
|
+
import"./index-0w9abg87.js";
|
|
47
|
+
import"./index-6k1937bx.js";
|
|
49
48
|
|
|
50
49
|
// src/agent-runtime/terminal-status.ts
|
|
51
50
|
function isSpeakableAssistantStatus(status) {
|
|
@@ -509,15 +508,29 @@ async function userMessage(message, options) {
|
|
|
509
508
|
}
|
|
510
509
|
function assistantMessages(message, interrupted) {
|
|
511
510
|
const rendered = new Set;
|
|
512
|
-
const
|
|
513
|
-
|
|
511
|
+
const messages = [];
|
|
512
|
+
let role;
|
|
513
|
+
let content = [];
|
|
514
|
+
const flush = () => {
|
|
515
|
+
if (!role || content.length === 0)
|
|
516
|
+
return;
|
|
517
|
+
messages.push(modelMessageSchema.parse({ role, content }));
|
|
518
|
+
content = [];
|
|
519
|
+
};
|
|
520
|
+
const append = (nextRole, part) => {
|
|
521
|
+
if (role !== nextRole) {
|
|
522
|
+
flush();
|
|
523
|
+
role = nextRole;
|
|
524
|
+
}
|
|
525
|
+
content.push(part);
|
|
526
|
+
};
|
|
514
527
|
for (const part of message.parts) {
|
|
515
528
|
if (part.type === "text") {
|
|
516
|
-
|
|
529
|
+
append("assistant", { type: "text", text: part.text });
|
|
517
530
|
rendered.add("text");
|
|
518
531
|
}
|
|
519
532
|
if (part.type === "reasoning") {
|
|
520
|
-
|
|
533
|
+
append("assistant", {
|
|
521
534
|
type: "reasoning",
|
|
522
535
|
text: part.text,
|
|
523
536
|
...part.provider && { providerOptions: providerOptions(part.provider) }
|
|
@@ -525,7 +538,7 @@ function assistantMessages(message, interrupted) {
|
|
|
525
538
|
rendered.add("reasoning");
|
|
526
539
|
}
|
|
527
540
|
if (part.type === "tool-call") {
|
|
528
|
-
|
|
541
|
+
append("assistant", {
|
|
529
542
|
type: "tool-call",
|
|
530
543
|
toolCallId: part.callId,
|
|
531
544
|
toolName: part.toolName,
|
|
@@ -536,7 +549,7 @@ function assistantMessages(message, interrupted) {
|
|
|
536
549
|
}
|
|
537
550
|
if (part.type === "tool-result") {
|
|
538
551
|
const output = part.outcome === "success" ? { type: "json", value: part.output ?? null } : { type: "error-json", value: part.output ?? { message: part.outcome } };
|
|
539
|
-
|
|
552
|
+
append("tool", {
|
|
540
553
|
type: "tool-result",
|
|
541
554
|
toolCallId: part.callId,
|
|
542
555
|
toolName: part.toolName,
|
|
@@ -545,17 +558,11 @@ function assistantMessages(message, interrupted) {
|
|
|
545
558
|
rendered.add("tool-result");
|
|
546
559
|
}
|
|
547
560
|
}
|
|
548
|
-
if (interrupted && (
|
|
549
|
-
|
|
561
|
+
if (interrupted && (messages.length > 0 || content.length > 0)) {
|
|
562
|
+
append("assistant", { type: "text", text: INTERRUPTION_NOTE });
|
|
550
563
|
rendered.add("control");
|
|
551
564
|
}
|
|
552
|
-
|
|
553
|
-
if (assistantContent.length > 0) {
|
|
554
|
-
messages.push(modelMessageSchema.parse({ role: "assistant", content: assistantContent }));
|
|
555
|
-
}
|
|
556
|
-
if (toolContent.length > 0) {
|
|
557
|
-
messages.push(modelMessageSchema.parse({ role: "tool", content: toolContent }));
|
|
558
|
-
}
|
|
565
|
+
flush();
|
|
559
566
|
return { messages, rendered };
|
|
560
567
|
}
|
|
561
568
|
function interruptedSystemNote(message) {
|
|
@@ -568,9 +575,27 @@ function interruptedSystemNote(message) {
|
|
|
568
575
|
return { text: `[interrupted] partial response: ${text}`, rendered };
|
|
569
576
|
}
|
|
570
577
|
function completeToolChronology(message) {
|
|
571
|
-
const
|
|
572
|
-
const
|
|
573
|
-
|
|
578
|
+
const pending = new Set;
|
|
579
|
+
const completed = new Set;
|
|
580
|
+
let resultsStarted = false;
|
|
581
|
+
for (const part of message.parts) {
|
|
582
|
+
if (part.type === "tool-call") {
|
|
583
|
+
if (resultsStarted && pending.size > 0)
|
|
584
|
+
return false;
|
|
585
|
+
if (pending.size === 0)
|
|
586
|
+
resultsStarted = false;
|
|
587
|
+
if (pending.has(part.callId) || completed.has(part.callId))
|
|
588
|
+
return false;
|
|
589
|
+
pending.add(part.callId);
|
|
590
|
+
}
|
|
591
|
+
if (part.type === "tool-result") {
|
|
592
|
+
if (!pending.delete(part.callId))
|
|
593
|
+
return false;
|
|
594
|
+
completed.add(part.callId);
|
|
595
|
+
resultsStarted = true;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
return pending.size === 0;
|
|
574
599
|
}
|
|
575
600
|
async function projectAgentHistoryDetailed(messages, options = {}) {
|
|
576
601
|
const projected = [];
|
|
@@ -1001,10 +1026,12 @@ function composeAgentPrompt(sections) {
|
|
|
1001
1026
|
knownValue(instructionTokens)
|
|
1002
1027
|
];
|
|
1003
1028
|
if (reserveValues.every((value) => value !== undefined)) {
|
|
1004
|
-
availableHistoryTokens =
|
|
1029
|
+
availableHistoryTokens = options.budget.contextWindow - reserveValues.reduce((sum, value) => sum + (value ?? 0), 0);
|
|
1005
1030
|
const historyTokens = options.historyTokens ? knownValue(AgentTokenCountSchema.parse(options.historyTokens)) : undefined;
|
|
1006
1031
|
if (historyTokens !== undefined) {
|
|
1007
|
-
if (
|
|
1032
|
+
if (availableHistoryTokens < 0)
|
|
1033
|
+
contextDecision = "oversized";
|
|
1034
|
+
else if (historyTokens <= availableHistoryTokens)
|
|
1008
1035
|
contextDecision = "fits";
|
|
1009
1036
|
else
|
|
1010
1037
|
contextDecision = options.oversizePolicy === "compact" ? "requires-compaction" : "oversized";
|
|
@@ -1024,14 +1051,30 @@ function composeAgentPrompt(sections) {
|
|
|
1024
1051
|
};
|
|
1025
1052
|
}
|
|
1026
1053
|
// src/agent-runtime/protocol.ts
|
|
1054
|
+
function hasAgentTerminalOutput(input) {
|
|
1055
|
+
for (const part of input.message.parts) {
|
|
1056
|
+
if (part.type === "text" && part.text.trim().length > 0)
|
|
1057
|
+
return true;
|
|
1058
|
+
if (part.type === "file" || part.type === "provider")
|
|
1059
|
+
return true;
|
|
1060
|
+
if (input.reason === "policy_stop" && (part.type === "tool-call" || part.type === "tool-result")) {
|
|
1061
|
+
return true;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
return false;
|
|
1065
|
+
}
|
|
1027
1066
|
function defineAgentProtocol(config) {
|
|
1067
|
+
const acceptance = config.terminalAcceptance;
|
|
1028
1068
|
return {
|
|
1029
1069
|
contextSchema: config.context,
|
|
1030
1070
|
inputMetadataSchema: config.inputMetadata,
|
|
1031
1071
|
parseContext: (input) => config.context.parse(input),
|
|
1032
1072
|
parseInputMetadata: (input) => AgentJsonObjectSchema.parse(config.inputMetadata.parse(input)),
|
|
1033
1073
|
parseMessage: (input) => AgentMessageSchema.parse(input),
|
|
1034
|
-
parsePart: (input) => AgentMessageSchema.shape.parts.element.parse(input)
|
|
1074
|
+
parsePart: (input) => AgentMessageSchema.shape.parts.element.parse(input),
|
|
1075
|
+
...acceptance !== undefined && acceptance !== "allow-empty" && {
|
|
1076
|
+
acceptTerminal: acceptance === "require-output" ? hasAgentTerminalOutput : acceptance
|
|
1077
|
+
}
|
|
1035
1078
|
};
|
|
1036
1079
|
}
|
|
1037
1080
|
// src/agent-runtime/admission-lanes.ts
|
|
@@ -1966,6 +2009,22 @@ function createRunExecutor(dependencies) {
|
|
|
1966
2009
|
terminalReason = "policy_stop";
|
|
1967
2010
|
if (executionSignal.aborted)
|
|
1968
2011
|
terminalReason = abortTerminalReason(executionSignal);
|
|
2012
|
+
if (config.protocol.acceptTerminal && (terminalReason === "success" || terminalReason === "policy_stop" || terminalReason === "provider_stop")) {
|
|
2013
|
+
const candidate = AgentMessageSchema.parse({
|
|
2014
|
+
...assistant,
|
|
2015
|
+
status: assistantStatus(terminalReason),
|
|
2016
|
+
parts,
|
|
2017
|
+
updatedAt: now().toISOString()
|
|
2018
|
+
});
|
|
2019
|
+
if (!await config.protocol.acceptTerminal({
|
|
2020
|
+
message: candidate,
|
|
2021
|
+
reason: terminalReason,
|
|
2022
|
+
...terminalPolicyName && { policyName: terminalPolicyName }
|
|
2023
|
+
})) {
|
|
2024
|
+
terminalReason = "provider_failure";
|
|
2025
|
+
internalCause = new Error("Agent terminal output was rejected by the protocol");
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
1969
2028
|
} catch (error) {
|
|
1970
2029
|
internalCause = error;
|
|
1971
2030
|
const latest = await config.store.loadRun({
|
|
@@ -3557,6 +3616,7 @@ export {
|
|
|
3557
3616
|
createMemoryAgentRuntimeStore,
|
|
3558
3617
|
defineAgentProtocol,
|
|
3559
3618
|
defineModelRegistry,
|
|
3619
|
+
hasAgentTerminalOutput,
|
|
3560
3620
|
projectAgentHistory,
|
|
3561
3621
|
projectAgentHistoryDetailed,
|
|
3562
3622
|
runStateForTerminalReason,
|