eve 0.86.0 → 0.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -0
- package/README.md +1 -1
- package/dist/src/acp/adapter.d.ts +2 -26
- package/dist/src/acp/adapter.js +1 -1
- package/dist/src/acp/server.d.ts +0 -3
- package/dist/src/ai/decision-adapter.d.ts +5 -3
- package/dist/src/ai/decision-adapter.js +1 -1
- package/dist/src/ai/decision-types.d.ts +4 -3
- package/dist/src/channel/adapter.d.ts +0 -14
- package/dist/src/channel/auth/definitions.d.ts +0 -4
- package/dist/src/channel/channel-address.d.ts +1 -1
- package/dist/src/channel/channel-address.js +1 -1
- package/dist/src/channel/channel-operations.d.ts +2 -2
- package/dist/src/channel/channel-operations.js +1 -1
- package/dist/src/channel/prompt-queue.d.ts +0 -2
- package/dist/src/channel/session-not-active-error.d.ts +10 -5
- package/dist/src/channel/session-not-active-error.js +1 -1
- package/dist/src/channel/session-stranded-error.d.ts +1 -1
- package/dist/src/channel/session.d.ts +3 -4
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +5 -14
- package/dist/src/chunks/{use-eve-agent-B2jCfcnG.js → use-eve-agent-BExXjBv6.js} +82 -72
- package/dist/src/chunks/{use-eve-agent-DCLFi26P.js → use-eve-agent-C0KHCyb9.js} +82 -72
- package/dist/src/cli/dev/command-options.d.ts +4 -4
- package/dist/src/cli/dev/command.js +1 -1
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/test/fake-eve-server.js +1 -1
- package/dist/src/cli/dev/tui/tool-format.d.ts +2 -2
- package/dist/src/cli/dev/ui-options.d.ts +4 -4
- package/dist/src/cli/dev/ui-options.js +1 -1
- package/dist/src/client/agent-info-error.d.ts +4 -1
- package/dist/src/client/agent-info-error.js +1 -1
- package/dist/src/client/agent-session.d.ts +1 -4
- package/dist/src/client/agent-session.js +1 -1
- package/dist/src/client/agent-stream-follower.js +1 -1
- package/dist/src/client/client-error.d.ts +13 -4
- package/dist/src/client/client-error.js +1 -1
- package/dist/src/client/delivery.d.ts +2 -17
- package/dist/src/client/health-response-error.d.ts +4 -1
- package/dist/src/client/health-response-error.js +1 -1
- package/dist/src/client/index.d.ts +5 -3
- package/dist/src/client/index.js +1 -1
- package/dist/src/client/open-stream.d.ts +7 -12
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session-controls.d.ts +2 -2
- package/dist/src/client/session-controls.js +1 -1
- package/dist/src/client/session-event-stream.d.ts +2 -2
- package/dist/src/client/session-event-stream.js +1 -1
- package/dist/src/client/session-store.d.ts +2 -6
- package/dist/src/client/session-store.js +1 -1
- package/dist/src/client/session.d.ts +4 -13
- package/dist/src/client/session.js +1 -1
- package/dist/src/client/sessions.d.ts +3 -6
- package/dist/src/client/types.d.ts +23 -32
- package/dist/src/compiled/.vendor-stamp.json +3 -3
- package/dist/src/compiled/@vercel/agent-runs/LICENSE +202 -0
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-connection.d.ts +1 -1
- package/dist/src/compiler/normalize-connection.js +1 -1
- package/dist/src/compiler/normalize-instructions.js +1 -1
- package/dist/src/compiler/normalize-skill.js +1 -1
- package/dist/src/compiler/resolve-workspace-subagent.js +1 -1
- package/dist/src/context/memory-tools.d.ts +9 -5
- package/dist/src/discover/sandbox.js +1 -1
- package/dist/src/dynamic/definition.d.ts +11 -5
- package/dist/src/dynamic/definition.js +1 -1
- package/dist/src/evals/mock-model.d.ts +1 -1
- package/dist/src/evals/session-manager.d.ts +0 -2
- package/dist/src/evals/session.d.ts +1 -11
- package/dist/src/evals/session.js +1 -1
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/support.js +1 -1
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/effective-agent-config.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.d.ts +1 -2
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/instrumentation/ai-sdk-telemetry.d.ts +0 -2
- package/dist/src/instrumentation/providers.d.ts +1 -38
- package/dist/src/instrumentation/providers.js +1 -1
- package/dist/src/instrumentation/setup-context.d.ts +1 -7
- package/dist/src/internal/application/package.d.ts +1 -0
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/application/stamped-package-version.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/authored-definition/schema-backed.js +1 -1
- package/dist/src/internal/classify-model-routing.d.ts +2 -3
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/runtime-model.d.ts +9 -4
- package/dist/src/internal/runtime-model.js +1 -1
- package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -1
- package/dist/src/internal/workflow-bundle/builder-support.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/builder-support.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-transformer.js +1 -1
- package/dist/src/models/auto.js +1 -1
- package/dist/src/protocol/delivery.d.ts +1 -0
- package/dist/src/protocol/reset-session.d.ts +0 -2
- package/dist/src/protocol/routes.d.ts +9 -2
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +1 -22
- package/dist/src/public/channels/discord/discordChannel.d.ts +3 -12
- package/dist/src/public/channels/discord/gateway/{index.d.ts → relay.d.ts} +2 -2
- package/dist/src/public/channels/discord/gateway/relay.js +1 -0
- package/dist/src/public/channels/discord/messages.d.ts +4 -4
- package/dist/src/public/channels/github/state.d.ts +0 -2
- package/dist/src/public/channels/index.d.ts +1 -2
- package/dist/src/public/channels/index.js +1 -1
- package/dist/src/public/channels/linear/index.d.ts +1 -1
- package/dist/src/public/channels/linear/index.js +1 -1
- package/dist/src/public/channels/linear/linearChannel.d.ts +0 -5
- package/dist/src/public/channels/linq/index.d.ts +1 -1
- package/dist/src/public/channels/linq/linqChannel.d.ts +7 -5
- package/dist/src/public/channels/photon/index.d.ts +1 -1
- package/dist/src/public/channels/photon/photonIMessageChannel.d.ts +15 -4
- package/dist/src/public/channels/slack/api.d.ts +1 -1
- package/dist/src/public/channels/slack/api.js +1 -1
- package/dist/src/public/channels/slack/blocks.d.ts +1 -1
- package/dist/src/public/channels/slack/blocks.js +2 -2
- package/dist/src/public/channels/slack/cards.d.ts +2 -297
- package/dist/src/public/channels/slack/cards.js +1 -1
- package/dist/src/public/channels/slack/index.d.ts +2 -2
- package/dist/src/public/channels/slack/index.js +1 -1
- package/dist/src/public/channels/slack/session-operations.d.ts +2 -2
- package/dist/src/public/channels/slack/session-operations.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +11 -72
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/teams/teamsChannel.d.ts +4 -3
- package/dist/src/public/channels/telegram/hitl.d.ts +2 -9
- package/dist/src/public/channels/telegram/index.d.ts +1 -1
- package/dist/src/public/channels/telegram/telegramChannel.d.ts +0 -2
- package/dist/src/public/channels/twilio/twilioChannel.d.ts +0 -2
- package/dist/src/public/channels/undelivered-reply.d.ts +0 -5
- package/dist/src/public/definitions/agent.d.ts +15 -7
- package/dist/src/public/definitions/agent.js +1 -1
- package/dist/src/public/definitions/channel.d.ts +7 -5
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/definitions/connections/protocol.d.ts +1 -7
- package/dist/src/public/definitions/connections/protocol.js +1 -1
- package/dist/src/public/experimental/channels/discord/gateway.d.ts +1 -0
- package/dist/src/public/experimental/channels/discord/gateway.js +1 -0
- package/dist/src/public/experimental/sandbox/just-bash.d.ts +1 -0
- package/dist/src/public/experimental/sandbox/just-bash.js +1 -0
- package/dist/src/public/experimental/workspace/index.d.ts +1 -0
- package/dist/src/public/experimental/workspace/index.js +1 -0
- package/dist/src/public/index.d.ts +2 -2
- package/dist/src/public/index.js +1 -1
- package/dist/src/public/instrumentation/otel.d.ts +1 -1
- package/dist/src/public/instrumentation/provider.d.ts +1 -1
- package/dist/src/public/instrumentation/provider.js +1 -1
- package/dist/src/public/memory/file/backend.d.ts +1 -1
- package/dist/src/public/memory/file/backends/in-memory.js +1 -1
- package/dist/src/public/memory/file/backends/vercel-blob.js +1 -1
- package/dist/src/public/memory/file/provider.js +1 -1
- package/dist/src/public/memory/index.d.ts +3 -11
- package/dist/src/public/models/anthropic/index.d.ts +1 -1
- package/dist/src/public/models/index.d.ts +1 -0
- package/dist/src/public/models/openai/index.d.ts +2 -2
- package/dist/src/public/next/index.d.ts +2 -2
- package/dist/src/public/sandbox/just-bash-sandbox.d.ts +27 -20
- package/dist/src/public/sandbox/just-bash.d.ts +0 -1
- package/dist/src/public/sessions/index.d.ts +1 -0
- package/dist/src/public/sessions/index.js +1 -1
- package/dist/src/public/tools/index.d.ts +1 -1
- package/dist/src/public/tools/index.js +1 -1
- package/dist/src/public/workflow/api.d.ts +25 -0
- package/dist/src/public/workflow/api.js +1 -0
- package/dist/src/public/workflow/index.d.ts +76 -0
- package/dist/src/public/workflow/index.js +1 -0
- package/dist/src/public/workflow-modules.d.ts +2 -17
- package/dist/src/react/use-eve-agent.d.ts +3 -2
- package/dist/src/react/use-eve-agent.js +1 -1
- package/dist/src/reactions/kinds/model.js +1 -1
- package/dist/src/runtime/agent/resolve-model.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/resolve-dynamic.js +1 -1
- package/dist/src/runtime/subagents/dynamic-agent-config.js +1 -1
- package/dist/src/runtime/subagents/workflow.js +1 -1
- package/dist/src/sandbox/providers/default.js +1 -1
- package/dist/src/self-modification/extension/subagents/agent/agent.d.ts +2 -2
- package/dist/src/self-modification/sandbox.js +1 -1
- package/dist/src/setup/integrations/discord/daemon.js +2 -2
- package/dist/src/setup/scaffold/create/project.js +2 -2
- package/dist/src/setup/scaffold/create/web-template.d.ts +2 -2
- package/dist/src/setup/scaffold/create/web-template.js +2 -2
- package/dist/src/setup/verified-remote-agent.d.ts +1 -3
- package/dist/src/shared/agent-definition.d.ts +18 -9
- package/dist/src/shared/eve-error.d.ts +22 -0
- package/dist/src/shared/eve-error.js +1 -0
- package/dist/src/shared/session.d.ts +2 -2
- package/dist/src/shared/token-usage.d.ts +7 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.d.ts +2 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tools/definition.d.ts +7 -5
- package/dist/src/tools/definition.js +1 -1
- package/dist/src/tools/provided/ask-question-workflow.js +1 -1
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/dist/src/tracing/eve/batch-span-processor.d.ts +1 -1
- package/dist/src/tracing/eve/content-span-processor.d.ts +1 -19
- package/dist/src/tracing/eve/otel-configuration.d.ts +6 -0
- package/dist/src/tracing/eve/otel-declaration.d.ts +6 -19
- package/dist/src/tracing/eve/span-export-policy.d.ts +0 -2
- package/dist/src/tracing/local/instrumentation-runtime.d.ts +0 -3
- package/dist/src/tracing/local/traces.d.ts +0 -13
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.d.ts +3 -2
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/agent-config.md +15 -11
- package/docs/channels/custom.mdx +26 -10
- package/docs/channels/discord.mdx +10 -10
- package/docs/channels/eve.mdx +14 -8
- package/docs/channels/linear.mdx +11 -0
- package/docs/channels/linq.mdx +5 -1
- package/docs/channels/photon.mdx +6 -1
- package/docs/channels/slack.mdx +73 -14
- package/docs/channels/telegram.mdx +6 -0
- package/docs/code-extension.mdx +25 -0
- package/docs/concepts/default-harness.md +2 -2
- package/docs/concepts/execution-model-and-durability.mdx +11 -11
- package/docs/concepts/security-model.md +2 -2
- package/docs/concepts/sessions-runs-and-streaming.md +23 -10
- package/docs/concepts/upgrade-to-v27-events.md +2 -1
- package/docs/connections/overview.mdx +4 -0
- package/docs/evals/reporters.mdx +21 -0
- package/docs/extensions.md +12 -0
- package/docs/getting-started.mdx +5 -1
- package/docs/guides/auth-and-route-protection.md +1 -1
- package/docs/guides/client/continuations.mdx +12 -10
- package/docs/guides/client/messages.mdx +24 -1
- package/docs/guides/client/overview.mdx +8 -6
- package/docs/guides/client/streaming.mdx +24 -6
- package/docs/guides/decide.md +3 -3
- package/docs/guides/deployment/vercel.mdx +1 -1
- package/docs/guides/dev-tui.md +2 -2
- package/docs/guides/frontend/overview.mdx +1 -1
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +13 -11
- package/docs/guides/frontend/use-eve-agent-vue.mdx +13 -11
- package/docs/guides/frontend/use-eve-agent.mdx +4 -4
- package/docs/guides/instrumentation/otel.mdx +3 -1
- package/docs/guides/prepare-for-1-0.md +255 -0
- package/docs/guides/remote-agents.md +22 -20
- package/docs/instructions.mdx +1 -1
- package/docs/memory/custom-provider.md +1 -1
- package/docs/memory/file.md +11 -2
- package/docs/meta.json +1 -0
- package/docs/reference/agent-files.md +17 -17
- package/docs/reference/cli.md +14 -9
- package/docs/reference/typescript-api.md +46 -20
- package/docs/sandbox/custom-providers.mdx +2 -0
- package/docs/sandbox/default.mdx +6 -6
- package/docs/sandbox/index.mdx +5 -5
- package/docs/sandbox/just-bash.mdx +30 -21
- package/docs/subagents/index.mdx +4 -4
- package/docs/tools/human-in-the-loop.md +1 -1
- package/docs/tools/workflows.mdx +52 -8
- package/docs/tutorial/first-agent.mdx +1 -1
- package/package.json +36 -9
- package/dist/CHANGELOG.md +0 -38
- package/dist/src/public/channels/discord/gateway/index.js +0 -1
|
@@ -29,6 +29,7 @@ const EVE_SESSION_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId`;
|
|
|
29
29
|
const EVE_SESSION_CANCEL_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/cancel`;
|
|
30
30
|
const EVE_SESSION_COMPACT_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/compact`;
|
|
31
31
|
const EVE_SESSION_CLEAR_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/clear`;
|
|
32
|
+
const EVE_SESSION_END_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/end`;
|
|
32
33
|
const EVE_SESSION_RESET_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/reset`;
|
|
33
34
|
const EVE_SESSION_STUBS_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/stubs`;
|
|
34
35
|
const EVE_SESSION_STREAM_ROUTE_PATTERN = `${EVE_SESSION_ROUTE_PATH}/:sessionId/stream`;
|
|
@@ -56,33 +57,58 @@ function createEveSessionCompactRoutePath(sessionId) {
|
|
|
56
57
|
function createEveSessionClearRoutePath(sessionId) {
|
|
57
58
|
return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}/clear`;
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
-
return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}/
|
|
60
|
+
function createEveSessionEndRoutePath(sessionId) {
|
|
61
|
+
return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}/end`;
|
|
61
62
|
}
|
|
62
63
|
function createEveSessionStreamRoutePath(sessionId) {
|
|
63
64
|
return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}/stream`;
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/shared/eve-error.ts
|
|
69
|
+
const LINEAGE = Symbol.for("eve.error.lineage");
|
|
70
|
+
var EveError = class EveError extends Error {
|
|
71
|
+
static errorName = "EveError";
|
|
72
|
+
code;
|
|
73
|
+
constructor(code, message, options) {
|
|
74
|
+
super(message, options);
|
|
75
|
+
if (new.target !== EveError && !Object.hasOwn(new.target, "errorName")) throw new TypeError(`${new.target.name} must declare its own static errorName.`);
|
|
76
|
+
this.name = new.target.errorName;
|
|
77
|
+
this.code = code;
|
|
78
|
+
const lineage = [new.target.errorName];
|
|
79
|
+
for (let type = new.target; type !== EveError;) {
|
|
80
|
+
type = Object.getPrototypeOf(type);
|
|
81
|
+
lineage.push(type.errorName);
|
|
82
|
+
}
|
|
83
|
+
Object.defineProperty(this, LINEAGE, { value: Object.freeze(lineage) });
|
|
84
|
+
}
|
|
85
|
+
static is(error) {
|
|
86
|
+
if (typeof error !== "object" || error === null) return false;
|
|
87
|
+
const lineage = Reflect.get(error, LINEAGE);
|
|
88
|
+
return Array.isArray(lineage) && lineage.includes(this.errorName);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
66
92
|
//#endregion
|
|
67
93
|
//#region src/client/agent-info-error.ts
|
|
68
|
-
var AgentInfoResponseError = class extends
|
|
94
|
+
var AgentInfoResponseError = class extends EveError {
|
|
95
|
+
static errorName = "AgentInfoResponseError";
|
|
69
96
|
issues;
|
|
70
97
|
constructor(issues = []) {
|
|
71
98
|
const detail = issues.length === 0 ? "" : ` (${issues.join("; ")})`;
|
|
72
|
-
super(`The server returned an unrecognized response from the eve agent info route.${detail}`);
|
|
73
|
-
this.name = "AgentInfoResponseError";
|
|
99
|
+
super("invalid_agent_info_response", `The server returned an unrecognized response from the eve agent info route.${detail}`);
|
|
74
100
|
this.issues = issues;
|
|
75
101
|
}
|
|
76
102
|
};
|
|
77
103
|
|
|
78
104
|
//#endregion
|
|
79
105
|
//#region src/client/health-response-error.ts
|
|
80
|
-
var HealthResponseError = class extends
|
|
106
|
+
var HealthResponseError = class extends EveError {
|
|
107
|
+
static errorName = "HealthResponseError";
|
|
81
108
|
issues;
|
|
82
109
|
constructor(issues = []) {
|
|
83
110
|
const detail = issues.length === 0 ? "" : ` (${issues.join("; ")})`;
|
|
84
|
-
super(`The server returned an unrecognized eve health response.${detail}`);
|
|
85
|
-
this.name = "HealthResponseError";
|
|
111
|
+
super("invalid_health_response", `The server returned an unrecognized eve health response.${detail}`);
|
|
86
112
|
this.issues = issues;
|
|
87
113
|
}
|
|
88
114
|
};
|
|
@@ -558,24 +584,20 @@ function isObject$1(value) {
|
|
|
558
584
|
|
|
559
585
|
//#endregion
|
|
560
586
|
//#region src/channel/session-not-active-error.ts
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
code = CODE;
|
|
587
|
+
var SessionNotActiveError = class extends EveError {
|
|
588
|
+
static errorName = "SessionNotActiveError";
|
|
564
589
|
retryable;
|
|
565
590
|
constructor(options = {}) {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
this.retryable =
|
|
569
|
-
}
|
|
570
|
-
static is(error) {
|
|
571
|
-
return error !== null && typeof error === "object" && Reflect.get(error, "code") === CODE && typeof Reflect.get(error, "retryable") === "boolean";
|
|
591
|
+
const retryable = options.retryable === true;
|
|
592
|
+
super(retryable ? "session_not_ready" : "session_not_active", retryable ? "The session is not ready to accept commands. Retry shortly." : "The session is no longer active. Start a new session.");
|
|
593
|
+
this.retryable = retryable;
|
|
572
594
|
}
|
|
573
595
|
};
|
|
574
596
|
|
|
575
597
|
//#endregion
|
|
576
598
|
//#region src/client/client-error.ts
|
|
577
|
-
var ClientError = class extends
|
|
578
|
-
|
|
599
|
+
var ClientError = class extends EveError {
|
|
600
|
+
static errorName = "ClientError";
|
|
579
601
|
status;
|
|
580
602
|
body;
|
|
581
603
|
headers;
|
|
@@ -586,19 +608,17 @@ var ClientError = class extends Error {
|
|
|
586
608
|
let message = body || `Server returned ${status}.`;
|
|
587
609
|
if (typeof parsed?.error === "string") message = parsed.error;
|
|
588
610
|
else if (parsed === void 0 && contentType?.includes("text/html")) message = `Server returned ${status} with an HTML response. Check the eve route and development server configuration.`;
|
|
589
|
-
super(message);
|
|
590
|
-
this.name = "ClientError";
|
|
591
|
-
this.code = typeof parsed?.code === "string" ? parsed.code : void 0;
|
|
611
|
+
super(typeof parsed?.code === "string" ? parsed.code : "http_error", message);
|
|
592
612
|
this.status = status;
|
|
593
613
|
this.body = body;
|
|
594
614
|
this.headers = normalizedHeaders;
|
|
595
615
|
}
|
|
596
616
|
};
|
|
597
617
|
var ClientSessionStrandedError = class extends ClientError {
|
|
618
|
+
static errorName = "ClientSessionStrandedError";
|
|
598
619
|
eveVersion;
|
|
599
620
|
constructor(status, body, headers, details) {
|
|
600
621
|
super(status, body, headers);
|
|
601
|
-
this.name = "ClientSessionStrandedError";
|
|
602
622
|
this.eveVersion = details.eveVersion;
|
|
603
623
|
}
|
|
604
624
|
};
|
|
@@ -2115,7 +2135,7 @@ const RECONNECT_BACKOFF = {
|
|
|
2115
2135
|
};
|
|
2116
2136
|
const DEFAULT_STREAM_RECONNECT_POLICY = {
|
|
2117
2137
|
reconnect: true,
|
|
2118
|
-
|
|
2138
|
+
retryableStatuses: /* @__PURE__ */ new Set([
|
|
2119
2139
|
404,
|
|
2120
2140
|
409,
|
|
2121
2141
|
425,
|
|
@@ -2124,43 +2144,34 @@ const DEFAULT_STREAM_RECONNECT_POLICY = {
|
|
|
2124
2144
|
503,
|
|
2125
2145
|
504
|
|
2126
2146
|
]),
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
maxDelayMs: 5e3
|
|
2131
|
-
}
|
|
2147
|
+
baseDelayMs: 250,
|
|
2148
|
+
maxAttempts: 12,
|
|
2149
|
+
maxDelayMs: 5e3
|
|
2132
2150
|
};
|
|
2133
2151
|
const NO_STREAM_RECONNECT_POLICY = {
|
|
2134
2152
|
...DEFAULT_STREAM_RECONNECT_POLICY,
|
|
2135
2153
|
reconnect: false,
|
|
2136
|
-
|
|
2137
|
-
...DEFAULT_STREAM_RECONNECT_POLICY.streamOpenReconnectPolicy,
|
|
2138
|
-
maxAttempts: 1
|
|
2139
|
-
}
|
|
2154
|
+
maxAttempts: 1
|
|
2140
2155
|
};
|
|
2141
|
-
function isRetryableStreamError(error, statuses = DEFAULT_STREAM_RECONNECT_POLICY.
|
|
2156
|
+
function isRetryableStreamError(error, statuses = DEFAULT_STREAM_RECONNECT_POLICY.retryableStatuses) {
|
|
2142
2157
|
if (error instanceof ClientSessionStrandedError) return false;
|
|
2143
2158
|
if (SessionNotActiveError.is(error)) return statuses.has(409);
|
|
2144
2159
|
if (error instanceof ClientError) return error.code !== "session_version_unsupported" && statuses.has(error.status);
|
|
2145
2160
|
return isStreamDisconnectError(error);
|
|
2146
2161
|
}
|
|
2147
|
-
function
|
|
2148
|
-
return
|
|
2149
|
-
|
|
2150
|
-
...policy
|
|
2151
|
-
};
|
|
2152
|
-
}
|
|
2153
|
-
function resolveStreamReconnectPolicy(policy) {
|
|
2154
|
-
if (policy && "reconnect" in policy && policy.reconnect === false) return NO_STREAM_RECONNECT_POLICY;
|
|
2155
|
-
const configured = policy;
|
|
2162
|
+
function resolveStreamReconnectPolicy(options) {
|
|
2163
|
+
if (options === false) return NO_STREAM_RECONNECT_POLICY;
|
|
2164
|
+
const defaults = DEFAULT_STREAM_RECONNECT_POLICY;
|
|
2156
2165
|
return {
|
|
2157
2166
|
reconnect: true,
|
|
2158
|
-
|
|
2159
|
-
|
|
2167
|
+
retryableStatuses: options?.retryableStatuses ? new Set(options.retryableStatuses) : defaults.retryableStatuses,
|
|
2168
|
+
baseDelayMs: options?.baseDelayMs ?? defaults.baseDelayMs,
|
|
2169
|
+
maxAttempts: options?.maxAttempts ?? defaults.maxAttempts,
|
|
2170
|
+
maxDelayMs: options?.maxDelayMs ?? defaults.maxDelayMs
|
|
2160
2171
|
};
|
|
2161
2172
|
}
|
|
2162
2173
|
async function* followStreamLines(input) {
|
|
2163
|
-
const resolvePolicy = () => resolveStreamReconnectPolicy(input.resolveReconnectPolicy === void 0 ? input.
|
|
2174
|
+
const resolvePolicy = () => resolveStreamReconnectPolicy(input.resolveReconnectPolicy === void 0 ? input.reconnect : input.resolveReconnectPolicy());
|
|
2164
2175
|
const bounded = input.follow === false || input.onCaughtUp !== void 0;
|
|
2165
2176
|
let startIndex = input.startIndex;
|
|
2166
2177
|
let reconnectDelayMs = RECONNECT_BACKOFF.baseDelayMs;
|
|
@@ -2255,7 +2266,7 @@ async function* followStreamLines(input) {
|
|
|
2255
2266
|
if (streamEnded || input.signal?.aborted || !resolvePolicy().reconnect) return;
|
|
2256
2267
|
if (leaseEnded) continue;
|
|
2257
2268
|
failures += 1;
|
|
2258
|
-
if (input.follow === false && failures >= retryPolicy.
|
|
2269
|
+
if (input.follow === false && failures >= retryPolicy.maxAttempts) throw new Error("The session stream kept disconnecting before the read reached its tail.");
|
|
2259
2270
|
await sleep(reconnectDelayMs, input.signal);
|
|
2260
2271
|
if (input.signal?.aborted) return;
|
|
2261
2272
|
reconnectDelayMs = Math.min(reconnectDelayMs * 2, RECONNECT_BACKOFF.maxDelayMs);
|
|
@@ -2273,17 +2284,16 @@ async function* followStreamIterable(input) {
|
|
|
2273
2284
|
}
|
|
2274
2285
|
}
|
|
2275
2286
|
async function openStreamBody(input) {
|
|
2276
|
-
const retryPolicy = input.retryPolicy ?? resolveStreamReconnectPolicy(input.
|
|
2277
|
-
const openRetryPolicy = retryPolicy.streamOpenReconnectPolicy;
|
|
2287
|
+
const retryPolicy = input.retryPolicy ?? resolveStreamReconnectPolicy(input.reconnect);
|
|
2278
2288
|
let lastStatus;
|
|
2279
2289
|
let lastBody;
|
|
2280
2290
|
let lastHeaders;
|
|
2281
|
-
let retryDelayMs =
|
|
2291
|
+
let retryDelayMs = retryPolicy.baseDelayMs;
|
|
2282
2292
|
const searchParams = { ...input.searchParams };
|
|
2283
2293
|
if (input.startIndex !== 0) searchParams.startIndex = String(input.startIndex);
|
|
2284
2294
|
if (input.requestTailIndex === true) searchParams.includeTailIndex = "1";
|
|
2285
2295
|
if (input.follow === false) searchParams.follow = "false";
|
|
2286
|
-
for (let attempt = 0; attempt <
|
|
2296
|
+
for (let attempt = 0; attempt < retryPolicy.maxAttempts; attempt += 1) {
|
|
2287
2297
|
throwIfAborted(input.signal);
|
|
2288
2298
|
const url = createClientUrl(input.baseUrl, input.path, Object.keys(searchParams).length > 0 ? searchParams : void 0);
|
|
2289
2299
|
const headers = await input.resolveHeaders();
|
|
@@ -2300,9 +2310,9 @@ async function openStreamBody(input) {
|
|
|
2300
2310
|
});
|
|
2301
2311
|
} catch (error) {
|
|
2302
2312
|
if (input.redirect === "error" && error instanceof Error && error.cause instanceof Error && error.cause.message === "unexpected redirect") throw new Error("The session stream refused a redirect. Use the final agent URL instead.", { cause: error });
|
|
2303
|
-
if (input.signal?.aborted || !isStreamDisconnectError(error) || attempt ===
|
|
2313
|
+
if (input.signal?.aborted || !isStreamDisconnectError(error) || attempt === retryPolicy.maxAttempts - 1) throw error;
|
|
2304
2314
|
await sleep(retryDelayMs, input.signal);
|
|
2305
|
-
retryDelayMs = Math.min(retryDelayMs * 2,
|
|
2315
|
+
retryDelayMs = Math.min(retryDelayMs * 2, retryPolicy.maxDelayMs);
|
|
2306
2316
|
continue;
|
|
2307
2317
|
}
|
|
2308
2318
|
if (response.ok) {
|
|
@@ -2331,10 +2341,10 @@ async function openStreamBody(input) {
|
|
|
2331
2341
|
lastBody = await response.text();
|
|
2332
2342
|
lastHeaders = response.headers;
|
|
2333
2343
|
const error = createClientError(response.status, lastBody, response.headers);
|
|
2334
|
-
if (!isRetryableStreamError(error, retryPolicy.
|
|
2335
|
-
if (attempt <
|
|
2344
|
+
if (!isRetryableStreamError(error, retryPolicy.retryableStatuses)) throw error;
|
|
2345
|
+
if (attempt < retryPolicy.maxAttempts - 1) {
|
|
2336
2346
|
await sleep(retryDelayMs, input.signal);
|
|
2337
|
-
retryDelayMs = Math.min(retryDelayMs * 2,
|
|
2347
|
+
retryDelayMs = Math.min(retryDelayMs * 2, retryPolicy.maxDelayMs);
|
|
2338
2348
|
}
|
|
2339
2349
|
}
|
|
2340
2350
|
throw new ClientError(lastStatus ?? 0, lastBody ?? "Failed to open message stream.", lastHeaders);
|
|
@@ -2407,7 +2417,7 @@ var ClientAgentSession = class ClientAgentSession {
|
|
|
2407
2417
|
resolveHeaders: () => this.#context.resolveHeaders(),
|
|
2408
2418
|
signal: options?.signal,
|
|
2409
2419
|
startIndex: options?.startIndex ?? 0,
|
|
2410
|
-
|
|
2420
|
+
reconnect: options?.reconnect,
|
|
2411
2421
|
onOpen: (headers) => {
|
|
2412
2422
|
if (onIdentity === void 0) return;
|
|
2413
2423
|
const key = headers.get(EVE_OBSERVATION_KEY_HEADER);
|
|
@@ -2524,7 +2534,7 @@ const paths = {
|
|
|
2524
2534
|
cancel: createEveSessionCancelRoutePath,
|
|
2525
2535
|
clear: createEveSessionClearRoutePath,
|
|
2526
2536
|
compact: createEveSessionCompactRoutePath,
|
|
2527
|
-
|
|
2537
|
+
end: createEveSessionEndRoutePath
|
|
2528
2538
|
};
|
|
2529
2539
|
async function prewarmClientSession(input) {
|
|
2530
2540
|
const response = await fetch(createClientUrl(input.context.baseUrl, createEveSessionRoutePath(input.sessionId)), {
|
|
@@ -2547,7 +2557,7 @@ async function prewarmClientSession(input) {
|
|
|
2547
2557
|
}
|
|
2548
2558
|
async function sendClientControl(input) {
|
|
2549
2559
|
const { signal, turnId, reason } = input.options ?? {};
|
|
2550
|
-
const body = input.kind === "cancel" ? { turnId } : input.kind === "
|
|
2560
|
+
const body = input.kind === "cancel" ? { turnId } : input.kind === "end" ? { reason } : {};
|
|
2551
2561
|
const headers = await input.context.resolveHeaders();
|
|
2552
2562
|
headers.set("content-type", "application/json");
|
|
2553
2563
|
const response = await fetch(createClientUrl(input.context.baseUrl, paths[input.kind](input.sessionId)), {
|
|
@@ -2992,7 +3002,7 @@ var ClientSession = class ClientSession {
|
|
|
2992
3002
|
return {
|
|
2993
3003
|
events,
|
|
2994
3004
|
session: {
|
|
2995
|
-
|
|
3005
|
+
...this.#state,
|
|
2996
3006
|
streamIndex
|
|
2997
3007
|
}
|
|
2998
3008
|
};
|
|
@@ -3042,8 +3052,8 @@ var ClientSession = class ClientSession {
|
|
|
3042
3052
|
async compact(options) {
|
|
3043
3053
|
return this.#control("compact", options);
|
|
3044
3054
|
}
|
|
3045
|
-
async
|
|
3046
|
-
return this.#control("
|
|
3055
|
+
async end(options) {
|
|
3056
|
+
return this.#control("end", options);
|
|
3047
3057
|
}
|
|
3048
3058
|
async #control(kind, options) {
|
|
3049
3059
|
const startIndex = this.#state.streamIndex;
|
|
@@ -3055,7 +3065,7 @@ var ClientSession = class ClientSession {
|
|
|
3055
3065
|
});
|
|
3056
3066
|
return new StreamDelivery({
|
|
3057
3067
|
...receipt,
|
|
3058
|
-
createStream: (read) => this.#createEventStream(startIndex, { signal: read?.signal }, receipt.deliveryId, kind !== "
|
|
3068
|
+
createStream: (read) => this.#createEventStream(startIndex, { signal: read?.signal }, receipt.deliveryId, kind !== "end")
|
|
3059
3069
|
});
|
|
3060
3070
|
}
|
|
3061
3071
|
stream(options) {
|
|
@@ -3086,7 +3096,7 @@ var ClientSession = class ClientSession {
|
|
|
3086
3096
|
headers: input.headers,
|
|
3087
3097
|
signal: input.signal,
|
|
3088
3098
|
startIndex: initialStreamIndex,
|
|
3089
|
-
|
|
3099
|
+
reconnect: input.reconnect
|
|
3090
3100
|
}), deliveryId, input.signal);
|
|
3091
3101
|
}
|
|
3092
3102
|
async *#streamAndAdvance(options) {
|
|
@@ -3099,7 +3109,7 @@ var ClientSession = class ClientSession {
|
|
|
3099
3109
|
resolveReconnectPolicy: options?.resolveReconnectPolicy,
|
|
3100
3110
|
signal: options?.signal,
|
|
3101
3111
|
startIndex,
|
|
3102
|
-
|
|
3112
|
+
reconnect: options?.reconnect
|
|
3103
3113
|
})) {
|
|
3104
3114
|
this.#advanceStreamIndex(cursor);
|
|
3105
3115
|
yield event;
|
|
@@ -3121,7 +3131,7 @@ var ClientSession = class ClientSession {
|
|
|
3121
3131
|
redirect: this.#context.redirect,
|
|
3122
3132
|
signal: input.signal,
|
|
3123
3133
|
startIndex: input.startIndex,
|
|
3124
|
-
|
|
3134
|
+
reconnect: input.reconnect,
|
|
3125
3135
|
resolveReconnectPolicy: input.resolveReconnectPolicy
|
|
3126
3136
|
});
|
|
3127
3137
|
}
|
|
@@ -4169,7 +4179,7 @@ var AgentStreamFollower = class {
|
|
|
4169
4179
|
signal: controller.signal,
|
|
4170
4180
|
startIndex: conversation.view.position,
|
|
4171
4181
|
follow: false,
|
|
4172
|
-
|
|
4182
|
+
reconnect: false
|
|
4173
4183
|
}, (key) => {
|
|
4174
4184
|
if (!current()) throw new Error("Observation stopped.");
|
|
4175
4185
|
if (node.key !== void 0 && node.key !== key) throw new ClientError(422, "Descendant reader identity changed.");
|
|
@@ -4214,7 +4224,7 @@ var AgentStreamFollower = class {
|
|
|
4214
4224
|
if (!current()) return;
|
|
4215
4225
|
node.failures += 1;
|
|
4216
4226
|
const status = error instanceof ClientError ? error.status : void 0;
|
|
4217
|
-
node.status = isRetryableStreamError(error) && node.failures < DEFAULT_STREAM_RECONNECT_POLICY.
|
|
4227
|
+
node.status = isRetryableStreamError(error) && node.failures < DEFAULT_STREAM_RECONNECT_POLICY.maxAttempts ? "interrupted" : "unavailable";
|
|
4218
4228
|
node.reason = status === 401 || status === 403 ? "unauthorized" : status === 410 ? "expired" : status === 422 ? error instanceof ClientError && error.code === "cycle" ? "cycle" : "unsupported" : "transport";
|
|
4219
4229
|
node.readyAt = Date.now() + Math.min(RECONNECT_BACKOFF.maxDelayMs, RECONNECT_BACKOFF.baseDelayMs * 2 ** Math.min(node.failures - 1, 5));
|
|
4220
4230
|
} finally {
|
|
@@ -4316,7 +4326,7 @@ var SessionEventStream = class {
|
|
|
4316
4326
|
}
|
|
4317
4327
|
setOptions(options) {
|
|
4318
4328
|
if ("headers" in options) this.#headers = options.headers;
|
|
4319
|
-
if ("
|
|
4329
|
+
if ("reconnect" in options) this.#reconnectPolicy = options.reconnect;
|
|
4320
4330
|
}
|
|
4321
4331
|
close() {
|
|
4322
4332
|
this.#ended = true;
|
|
@@ -4679,8 +4689,8 @@ var SessionStore = class {
|
|
|
4679
4689
|
clear() {
|
|
4680
4690
|
return this.#control((session) => session.clear());
|
|
4681
4691
|
}
|
|
4682
|
-
|
|
4683
|
-
return this.#control((session) => session.
|
|
4692
|
+
end() {
|
|
4693
|
+
return this.#control((session) => session.end());
|
|
4684
4694
|
}
|
|
4685
4695
|
async #control(dispatch) {
|
|
4686
4696
|
const session = this.#session;
|
|
@@ -5025,7 +5035,7 @@ function useEveAgent(options = {}) {
|
|
|
5025
5035
|
error: computed(() => snapshot.value.error),
|
|
5026
5036
|
events: computed(() => snapshot.value.events),
|
|
5027
5037
|
prewarm: () => store.prewarm(),
|
|
5028
|
-
|
|
5038
|
+
end: () => store.end(),
|
|
5029
5039
|
newSession: () => store.newSession(),
|
|
5030
5040
|
clear: () => store.clear(),
|
|
5031
5041
|
compact: () => store.compact(),
|