veryfront 0.1.216 → 0.1.217
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/esm/cli/commands/generate/integration-generator-helpers.d.ts +35 -0
- package/esm/cli/commands/generate/integration-generator-helpers.d.ts.map +1 -0
- package/esm/cli/commands/generate/integration-generator-helpers.js +123 -0
- package/esm/cli/commands/generate/integration-generator.d.ts +1 -2
- package/esm/cli/commands/generate/integration-generator.d.ts.map +1 -1
- package/esm/cli/commands/generate/integration-generator.js +1 -123
- package/esm/cli/commands/knowledge/command-helpers.d.ts +48 -0
- package/esm/cli/commands/knowledge/command-helpers.d.ts.map +1 -0
- package/esm/cli/commands/knowledge/command-helpers.js +216 -0
- package/esm/cli/commands/knowledge/command.d.ts +11 -16
- package/esm/cli/commands/knowledge/command.d.ts.map +1 -1
- package/esm/cli/commands/knowledge/command.js +25 -212
- package/esm/cli/mcp/remote-file-tool-helpers.d.ts +5 -0
- package/esm/cli/mcp/remote-file-tool-helpers.d.ts.map +1 -0
- package/esm/cli/mcp/remote-file-tool-helpers.js +22 -0
- package/esm/cli/mcp/remote-file-tools.d.ts.map +1 -1
- package/esm/cli/mcp/remote-file-tools.js +1 -22
- package/esm/cli/templates/integration-loader-helpers.d.ts +8 -0
- package/esm/cli/templates/integration-loader-helpers.d.ts.map +1 -0
- package/esm/cli/templates/integration-loader-helpers.js +29 -0
- package/esm/cli/templates/integration-loader.d.ts.map +1 -1
- package/esm/cli/templates/integration-loader.js +5 -21
- package/esm/cli/templates/manifest.d.ts +1 -0
- package/esm/cli/templates/manifest.js +2 -1
- package/esm/deno.js +2 -2
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +48 -90
- package/esm/src/chat/ag-ui-helpers.d.ts +17 -0
- package/esm/src/chat/ag-ui-helpers.d.ts.map +1 -0
- package/esm/src/chat/ag-ui-helpers.js +111 -0
- package/esm/src/chat/ag-ui.d.ts.map +1 -1
- package/esm/src/chat/ag-ui.js +1 -111
- package/esm/src/config/schemas/config.schema.d.ts +1 -0
- package/esm/src/config/schemas/config.schema.d.ts.map +1 -1
- package/esm/src/config/schemas/config.schema.js +11 -0
- package/esm/src/config/schemas/index.d.ts +11 -1
- package/esm/src/config/schemas/index.d.ts.map +1 -1
- package/esm/src/errors/error-registry-helpers.d.ts +6 -0
- package/esm/src/errors/error-registry-helpers.d.ts.map +1 -0
- package/esm/src/errors/error-registry-helpers.js +9 -0
- package/esm/src/errors/error-registry.d.ts.map +1 -1
- package/esm/src/errors/error-registry.js +4 -3
- package/esm/src/extensions/factory-loader.d.ts +29 -0
- package/esm/src/extensions/factory-loader.d.ts.map +1 -0
- package/esm/src/extensions/factory-loader.js +63 -0
- package/esm/src/extensions/index.d.ts +16 -0
- package/esm/src/extensions/index.d.ts.map +1 -1
- package/esm/src/extensions/index.js +16 -0
- package/esm/src/extensions/orchestrate.d.ts +54 -0
- package/esm/src/extensions/orchestrate.d.ts.map +1 -0
- package/esm/src/extensions/orchestrate.js +116 -0
- package/esm/src/html/styles-builder/plugin-loader.d.ts.map +1 -1
- package/esm/src/html/styles-builder/plugin-loader.js +23 -0
- package/esm/src/html/styles-builder/tailwind-plugin-allowlist.d.ts +29 -0
- package/esm/src/html/styles-builder/tailwind-plugin-allowlist.d.ts.map +1 -0
- package/esm/src/html/styles-builder/tailwind-plugin-allowlist.js +48 -0
- package/esm/src/modules/react-loader/ssr-module-loader/loader-helpers.d.ts +15 -0
- package/esm/src/modules/react-loader/ssr-module-loader/loader-helpers.d.ts.map +1 -0
- package/esm/src/modules/react-loader/ssr-module-loader/loader-helpers.js +22 -0
- package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts +0 -2
- package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/loader.js +4 -24
- package/esm/src/platform/adapters/fs/veryfront/adapter-helpers.d.ts +19 -0
- package/esm/src/platform/adapters/fs/veryfront/adapter-helpers.d.ts.map +1 -0
- package/esm/src/platform/adapters/fs/veryfront/adapter-helpers.js +26 -0
- package/esm/src/platform/adapters/fs/veryfront/adapter.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/adapter.js +4 -20
- package/esm/src/platform/adapters/fs/veryfront/read-operations-helpers.d.ts +1 -0
- package/esm/src/platform/adapters/fs/veryfront/read-operations-helpers.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/read-operations-helpers.js +3 -0
- package/esm/src/platform/adapters/fs/veryfront/read-operations.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/read-operations.js +4 -7
- package/esm/src/platform/adapters/fs/veryfront/websocket-manager-helpers.d.ts +28 -0
- package/esm/src/platform/adapters/fs/veryfront/websocket-manager-helpers.d.ts.map +1 -0
- package/esm/src/platform/adapters/fs/veryfront/websocket-manager-helpers.js +41 -0
- package/esm/src/platform/adapters/fs/veryfront/websocket-manager.d.ts +1 -4
- package/esm/src/platform/adapters/fs/veryfront/websocket-manager.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/websocket-manager.js +7 -40
- package/esm/src/provider/runtime-loader/tool-input-status.d.ts +17 -0
- package/esm/src/provider/runtime-loader/tool-input-status.d.ts.map +1 -0
- package/esm/src/provider/runtime-loader/tool-input-status.js +155 -0
- package/esm/src/provider/runtime-loader.d.ts +2 -3
- package/esm/src/provider/runtime-loader.d.ts.map +1 -1
- package/esm/src/provider/runtime-loader.js +2 -155
- package/esm/src/rendering/orchestrator/pipeline-helpers.d.ts +8 -0
- package/esm/src/rendering/orchestrator/pipeline-helpers.d.ts.map +1 -0
- package/esm/src/rendering/orchestrator/pipeline-helpers.js +20 -0
- package/esm/src/rendering/orchestrator/pipeline.d.ts +0 -3
- package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/pipeline.js +4 -22
- package/esm/src/routing/api/module-loader/loader-helpers.d.ts +10 -0
- package/esm/src/routing/api/module-loader/loader-helpers.d.ts.map +1 -0
- package/esm/src/routing/api/module-loader/loader-helpers.js +62 -0
- package/esm/src/routing/api/module-loader/loader.d.ts +1 -1
- package/esm/src/routing/api/module-loader/loader.d.ts.map +1 -1
- package/esm/src/routing/api/module-loader/loader.js +2 -60
- package/esm/src/server/bootstrap.d.ts +22 -2
- package/esm/src/server/bootstrap.d.ts.map +1 -1
- package/esm/src/server/bootstrap.js +67 -5
- package/esm/src/server/dev-ui/manifest.d.ts +2 -0
- package/esm/src/server/dev-ui/manifest.js +3 -1
- package/esm/src/server/handlers/request/api/project-discovery.d.ts.map +1 -1
- package/esm/src/server/handlers/request/api/project-discovery.js +14 -8
- package/esm/src/server/production-server.js +1 -1
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +2 -2
- package/esm/src/studio/bridge/bridge-bundle.generated.d.ts.map +1 -1
- package/esm/src/studio/bridge/bridge-bundle.generated.js +1 -1
- package/esm/src/tool/index.d.ts +1 -1
- package/esm/src/tool/index.d.ts.map +1 -1
- package/esm/src/tool/types.d.ts +20 -0
- package/esm/src/tool/types.d.ts.map +1 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
- package/src/cli/commands/generate/integration-generator-helpers.ts +185 -0
- package/src/cli/commands/generate/integration-generator.ts +12 -168
- package/src/cli/commands/knowledge/command-helpers.ts +295 -0
- package/src/cli/commands/knowledge/command.ts +33 -259
- package/src/cli/mcp/remote-file-tool-helpers.ts +27 -0
- package/src/cli/mcp/remote-file-tools.ts +6 -28
- package/src/cli/templates/integration-loader-helpers.ts +49 -0
- package/src/cli/templates/integration-loader.ts +10 -28
- package/src/cli/templates/manifest.js +2 -1
- package/src/deno.js +2 -2
- package/src/src/agent/runtime/index.ts +77 -94
- package/src/src/chat/ag-ui-helpers.ts +139 -0
- package/src/src/chat/ag-ui.ts +11 -139
- package/src/src/config/schemas/config.schema.ts +11 -0
- package/src/src/config/schemas/index.ts +15 -1
- package/src/src/errors/error-registry-helpers.ts +23 -0
- package/src/src/errors/error-registry.ts +8 -3
- package/src/src/extensions/factory-loader.ts +76 -0
- package/src/src/extensions/index.ts +20 -0
- package/src/src/extensions/orchestrate.ts +184 -0
- package/src/src/html/styles-builder/plugin-loader.ts +32 -0
- package/src/src/html/styles-builder/tailwind-plugin-allowlist.ts +51 -0
- package/src/src/modules/react-loader/ssr-module-loader/loader-helpers.ts +37 -0
- package/src/src/modules/react-loader/ssr-module-loader/loader.ts +8 -39
- package/src/src/platform/adapters/fs/veryfront/adapter-helpers.ts +43 -0
- package/src/src/platform/adapters/fs/veryfront/adapter.ts +8 -22
- package/src/src/platform/adapters/fs/veryfront/read-operations-helpers.ts +4 -0
- package/src/src/platform/adapters/fs/veryfront/read-operations.ts +4 -7
- package/src/src/platform/adapters/fs/veryfront/websocket-manager-helpers.ts +73 -0
- package/src/src/platform/adapters/fs/veryfront/websocket-manager.ts +29 -44
- package/src/src/provider/runtime-loader/tool-input-status.ts +210 -0
- package/src/src/provider/runtime-loader.ts +6 -203
- package/src/src/rendering/orchestrator/pipeline-helpers.ts +35 -0
- package/src/src/rendering/orchestrator/pipeline.ts +8 -35
- package/src/src/routing/api/module-loader/loader-helpers.ts +68 -0
- package/src/src/routing/api/module-loader/loader.ts +8 -65
- package/src/src/server/bootstrap.ts +88 -7
- package/src/src/server/dev-ui/manifest.js +3 -1
- package/src/src/server/handlers/request/api/project-discovery.ts +19 -8
- package/src/src/server/production-server.ts +1 -1
- package/src/src/server/services/rsc/endpoints/rsc-bundles.generated.ts +2 -2
- package/src/src/studio/bridge/bridge-bundle.generated.ts +1 -1
- package/src/src/tool/index.ts +1 -0
- package/src/src/tool/types.ts +21 -0
- package/src/src/utils/version-constant.ts +1 -1
|
@@ -10,13 +10,8 @@ import { buildFileCacheKeyPrefix, buildFileListCacheKey } from "./cache-keys.js"
|
|
|
10
10
|
import { isPrefixBeingInvalidated } from "./invalidation-state.js";
|
|
11
11
|
import { WebSocketManager } from "./websocket-manager.js";
|
|
12
12
|
import { fetchFileListForContext, hasContentContextChanged, resolveContentContext, summarizeFileList, toClientContext, } from "./adapter-content-context.js";
|
|
13
|
+
import { buildFileCacheOptions, buildRetryConfig, shouldBackgroundPregenerateStyles, } from "./adapter-helpers.js";
|
|
13
14
|
const logger = baseLogger.component("veryfront-fs-adapter");
|
|
14
|
-
const DEFAULT_MAX_RETRIES = 3;
|
|
15
|
-
const DEFAULT_INITIAL_RETRY_DELAY_MS = 1_000;
|
|
16
|
-
const DEFAULT_MAX_RETRY_DELAY_MS = 10_000;
|
|
17
|
-
const DEFAULT_CACHE_TTL_MS = 60_000;
|
|
18
|
-
const DEFAULT_CACHE_MAX_ENTRIES = 1_000;
|
|
19
|
-
const DEFAULT_CACHE_MAX_MEMORY_BYTES = 100 * 1024 * 1024;
|
|
20
15
|
export class VeryfrontFSAdapter {
|
|
21
16
|
client;
|
|
22
17
|
cache;
|
|
@@ -85,12 +80,7 @@ export class VeryfrontFSAdapter {
|
|
|
85
80
|
this.projectSlug = vf.projectSlug ?? "";
|
|
86
81
|
this.contentSource = vf.contentSource ?? { type: "branch", branch: "main" };
|
|
87
82
|
this.proxyMode = vf.proxyMode ?? false;
|
|
88
|
-
const retryConfig =
|
|
89
|
-
maxRetries: DEFAULT_MAX_RETRIES,
|
|
90
|
-
initialDelay: DEFAULT_INITIAL_RETRY_DELAY_MS,
|
|
91
|
-
maxDelay: DEFAULT_MAX_RETRY_DELAY_MS,
|
|
92
|
-
...vf.retry,
|
|
93
|
-
};
|
|
83
|
+
const retryConfig = buildRetryConfig(vf.retry);
|
|
94
84
|
this.client = new VeryfrontApiClient({
|
|
95
85
|
apiBaseUrl: this.apiBaseUrl,
|
|
96
86
|
apiToken: this.apiToken,
|
|
@@ -99,13 +89,7 @@ export class VeryfrontFSAdapter {
|
|
|
99
89
|
proxyMode: vf.proxyMode,
|
|
100
90
|
retry: retryConfig,
|
|
101
91
|
});
|
|
102
|
-
const cacheConfig =
|
|
103
|
-
enabled: true,
|
|
104
|
-
ttl: DEFAULT_CACHE_TTL_MS,
|
|
105
|
-
maxSize: DEFAULT_CACHE_MAX_ENTRIES,
|
|
106
|
-
maxMemory: DEFAULT_CACHE_MAX_MEMORY_BYTES,
|
|
107
|
-
...vf.cache,
|
|
108
|
-
};
|
|
92
|
+
const cacheConfig = buildFileCacheOptions(vf.cache);
|
|
109
93
|
this.cache = new FileCache(cacheConfig);
|
|
110
94
|
this.normalizer = new PathNormalizer(config.projectDir);
|
|
111
95
|
const contentContextGetter = {
|
|
@@ -283,7 +267,7 @@ export class VeryfrontFSAdapter {
|
|
|
283
267
|
// Branch previews should recover the last registered stylesheet artifact on
|
|
284
268
|
// cold starts before rebuilding CSS locally. Live edit pokes still
|
|
285
269
|
// pregenerate through the WebSocket path after branch content changes.
|
|
286
|
-
return this.contentContext
|
|
270
|
+
return shouldBackgroundPregenerateStyles(this.contentContext);
|
|
287
271
|
}
|
|
288
272
|
scheduleFileListWarmup(reason, cacheKey) {
|
|
289
273
|
if (!this.initialized || !this.contentContext)
|
|
@@ -31,6 +31,7 @@ interface BuildReadFetchStateOptions {
|
|
|
31
31
|
export declare function assertProjectSourcePath(normalizedPath: string): void;
|
|
32
32
|
export declare function buildReadFetchState(options: BuildReadFetchStateOptions): ReadFetchState;
|
|
33
33
|
export declare function getResolvedCacheKey(cacheKeyPrefix: string, normalizedResolvedPath: string): string;
|
|
34
|
+
export declare function buildContentPreview(content: string, max?: number): string;
|
|
34
35
|
export declare function buildExtensionCandidatePaths(basePath: string): string[];
|
|
35
36
|
export declare function splitKnownFileExtension(apiPath: string): {
|
|
36
37
|
originalExtension: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-operations-helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/read-operations-helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,i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,sBAAsB,EAAE,MAAM,GAC7B,MAAM,CAER;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAEvE;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,GACd;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CASxD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAG3D;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAEvE"}
|
|
1
|
+
{"version":3,"file":"read-operations-helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/read-operations-helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iCAAiC,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD,OAAO,EAAE,iCAAiC,EAAE,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D,UAAU,uBAAuB;IAC/B,gBAAgB,EAAE,MAAM,OAAO,CAAC;IAChC,4BAA4B,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAC3D,yBAAyB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;CAC5D;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACrC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1C,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAED,UAAU,0BAA0B;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC9C,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC/C;AAED,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAOpE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,cAAc,CA2BvF;AAED,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,MAAM,EACtB,sBAAsB,EAAE,MAAM,GAC7B,MAAM,CAER;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAK,GAAG,MAAM,CAErE;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAEvE;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,GACd;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CASxD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAG3D;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAEvE"}
|
|
@@ -40,6 +40,9 @@ export function buildReadFetchState(options) {
|
|
|
40
40
|
export function getResolvedCacheKey(cacheKeyPrefix, normalizedResolvedPath) {
|
|
41
41
|
return `${cacheKeyPrefix}:${normalizedResolvedPath}`;
|
|
42
42
|
}
|
|
43
|
+
export function buildContentPreview(content, max = 80) {
|
|
44
|
+
return content.length > max ? `${content.slice(0, max)}...` : content;
|
|
45
|
+
}
|
|
43
46
|
export function buildExtensionCandidatePaths(basePath) {
|
|
44
47
|
return READ_OPERATION_EXTENSION_PRIORITY.map((ext) => `${basePath}${ext}`);
|
|
45
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-operations.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/read-operations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAKnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"read-operations.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/read-operations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAKnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAcpE,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAQ9B,qBAAa,cAAc;IAWvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC;IACjC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IACpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAfpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAI9B;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,mGAAmG;IACnG,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAA6B;gBAGnD,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,cAAc,EAC1B,eAAe,CAAC,EAAE,sBAAsB,YAAA,EACxC,kBAAkB,CAAC,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,aAAA,EAC7C,gBAAgB,CAAC,GAAE,MAAM,OAAO,CAC/C,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,CACtD,aAAA;IAKH,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAIrD,kBAAkB,IAAI,IAAI;IAK1B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAY3C,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAY3C,OAAO,CAAC,mBAAmB;YAsBb,+BAA+B;YA0C/B,mBAAmB;IA0CjC,OAAO,CAAC,kBAAkB;YAoFZ,2BAA2B;YAmD3B,uCAAuC;IAiCrD,OAAO,CAAC,yBAAyB;IAmCjC,OAAO,CAAC,oBAAoB;IAgB5B,OAAO,CAAC,mBAAmB;IAU3B,OAAO,CAAC,qBAAqB;YAYf,YAAY;YA6JZ,qBAAqB;YAwDrB,qBAAqB;YA8CrB,+BAA+B;YAwD/B,iBAAiB;CAuBhC"}
|
|
@@ -4,15 +4,12 @@ import { logContentMetric } from "./content-metrics.js";
|
|
|
4
4
|
import { FileListIndex } from "./file-list-index.js";
|
|
5
5
|
import { InFlightRequestDeduper } from "./in-flight-dedupe.js";
|
|
6
6
|
import { getRequestScopedFile, setRequestScopedFile } from "./multi-project-adapter.js";
|
|
7
|
-
import { assertProjectSourcePath, buildExtensionCandidatePaths, buildReadFetchState, createNotFoundLikeError, getResolvedCacheKey, isNotFoundLikeError, READ_OPERATION_EXTENSION_PRIORITY as EXTENSION_PRIORITY, splitKnownFileExtension, } from "./read-operations-helpers.js";
|
|
7
|
+
import { assertProjectSourcePath, buildContentPreview, buildExtensionCandidatePaths, buildReadFetchState, createNotFoundLikeError, getResolvedCacheKey, isNotFoundLikeError, READ_OPERATION_EXTENSION_PRIORITY as EXTENSION_PRIORITY, splitKnownFileExtension, } from "./read-operations-helpers.js";
|
|
8
8
|
export { endRequestMetrics, getContentMetricsSnapshot, resetContentMetrics, startRequestMetrics, } from "./content-metrics.js";
|
|
9
9
|
const logger = baseLogger.component("read-operations");
|
|
10
10
|
const IN_FLIGHT_REQUEST_TIMEOUT_MS = 15_000;
|
|
11
11
|
const MAX_IN_FLIGHT_REQUESTS = 100;
|
|
12
12
|
const IN_FLIGHT_CLEANUP_INTERVAL_MS = 1_000;
|
|
13
|
-
function previewText(content, max = 80) {
|
|
14
|
-
return content.length > max ? `${content.slice(0, max)}...` : content;
|
|
15
|
-
}
|
|
16
13
|
export class ReadOperations {
|
|
17
14
|
client;
|
|
18
15
|
cache;
|
|
@@ -71,7 +68,7 @@ export class ReadOperations {
|
|
|
71
68
|
path: normalizedPath,
|
|
72
69
|
cacheKey,
|
|
73
70
|
contentLength: requestCached.length,
|
|
74
|
-
preview:
|
|
71
|
+
preview: buildContentPreview(requestCached).replace(/\n/g, "\\n"),
|
|
75
72
|
});
|
|
76
73
|
return requestCached;
|
|
77
74
|
}
|
|
@@ -101,7 +98,7 @@ export class ReadOperations {
|
|
|
101
98
|
path: normalizedPath,
|
|
102
99
|
cacheKey,
|
|
103
100
|
contentLength: cached.length,
|
|
104
|
-
preview:
|
|
101
|
+
preview: buildContentPreview(cached).replace(/\n/g, "\\n"),
|
|
105
102
|
});
|
|
106
103
|
setRequestScopedFile(cacheKey, cached);
|
|
107
104
|
return cached;
|
|
@@ -481,7 +478,7 @@ export class ReadOperations {
|
|
|
481
478
|
logger.debug("API_FETCH_DONE - got content from API", {
|
|
482
479
|
path: normalizedPath,
|
|
483
480
|
contentLength: content.length,
|
|
484
|
-
preview:
|
|
481
|
+
preview: buildContentPreview(content).replace(/\n/g, "\\n"),
|
|
485
482
|
willCache: shouldCache,
|
|
486
483
|
});
|
|
487
484
|
return this.storeFetchedContent(cacheKey, content, shouldCache);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ContentSource, ResolvedContentContext } from "./types.js";
|
|
2
|
+
export declare const INVALIDATION_DEBOUNCE_MS = 100;
|
|
3
|
+
export declare const WS_RECONNECT_DELAY_MS = 5000;
|
|
4
|
+
export declare const WS_RECONNECT_MAX_DELAY_MS = 120000;
|
|
5
|
+
export declare const WS_RECONNECT_MAX_FAILURES = 10;
|
|
6
|
+
export declare const WS_HEARTBEAT_INTERVAL_MS = 60000;
|
|
7
|
+
export declare const WS_HEARTBEAT_TIMEOUT_MS = 300000;
|
|
8
|
+
export interface PreviewStyleArtifactInfo {
|
|
9
|
+
hash: string;
|
|
10
|
+
assetPath: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function getConnectionLogContext(projectSlug: string | undefined, context?: Record<string, unknown>): Record<string, unknown>;
|
|
13
|
+
export declare function getPreviewInvalidationPrefixes(contentContext: ResolvedContentContext | null): string[];
|
|
14
|
+
export declare function getReconnectDelay(consecutiveFailures: number): number;
|
|
15
|
+
export declare function buildReloadProjectContext(contentContext: ResolvedContentContext | null, projectSlug: string, projectId: string, preparedStyleArtifact?: PreviewStyleArtifactInfo): {
|
|
16
|
+
projectSlug: string;
|
|
17
|
+
projectId: string;
|
|
18
|
+
environment: "preview" | "production";
|
|
19
|
+
branch: string | null;
|
|
20
|
+
releaseId: string | null;
|
|
21
|
+
styleArtifactHash: string | undefined;
|
|
22
|
+
styleAssetPath: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
export declare function buildContentSourceLabel(getContentSource: () => ContentSource, getContentContext: () => ResolvedContentContext | null): {
|
|
25
|
+
contentSource: ContentSource;
|
|
26
|
+
branch: string | null;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=websocket-manager-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"websocket-manager-helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/websocket-manager-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGxE,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,eAAO,MAAM,yBAAyB,SAAS,CAAC;AAChD,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAC9C,eAAO,MAAM,uBAAuB,SAAS,CAAC;AAE9C,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACpC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGzB;AAED,wBAAgB,8BAA8B,CAC5C,cAAc,EAAE,sBAAsB,GAAG,IAAI,GAC5C,MAAM,EAAE,CAGV;AAED,wBAAgB,iBAAiB,CAAC,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAGrE;AAED,wBAAgB,yBAAyB,CACvC,cAAc,EAAE,sBAAsB,GAAG,IAAI,EAC7C,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,qBAAqB,CAAC,EAAE,wBAAwB,GAC/C;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,SAAS,GAAG,YAAY,CAAC;IACtC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,CAcA;AAED,wBAAgB,uBAAuB,CACrC,gBAAgB,EAAE,MAAM,aAAa,EACrC,iBAAiB,EAAE,MAAM,sBAAsB,GAAG,IAAI,GACrD;IAAE,aAAa,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAKzD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { buildFileCacheKeyPrefix } from "./cache-keys.js";
|
|
2
|
+
export const INVALIDATION_DEBOUNCE_MS = 100;
|
|
3
|
+
export const WS_RECONNECT_DELAY_MS = 5000;
|
|
4
|
+
export const WS_RECONNECT_MAX_DELAY_MS = 120000;
|
|
5
|
+
export const WS_RECONNECT_MAX_FAILURES = 10;
|
|
6
|
+
export const WS_HEARTBEAT_INTERVAL_MS = 60000;
|
|
7
|
+
export const WS_HEARTBEAT_TIMEOUT_MS = 300000;
|
|
8
|
+
export function getConnectionLogContext(projectSlug, context = {}) {
|
|
9
|
+
if (!projectSlug)
|
|
10
|
+
return context;
|
|
11
|
+
return { projectSlug, ...context };
|
|
12
|
+
}
|
|
13
|
+
export function getPreviewInvalidationPrefixes(contentContext) {
|
|
14
|
+
if (contentContext?.sourceType !== "branch")
|
|
15
|
+
return [];
|
|
16
|
+
return [buildFileCacheKeyPrefix(contentContext)];
|
|
17
|
+
}
|
|
18
|
+
export function getReconnectDelay(consecutiveFailures) {
|
|
19
|
+
const delay = WS_RECONNECT_DELAY_MS * Math.pow(2, consecutiveFailures - 1);
|
|
20
|
+
return Math.min(delay, WS_RECONNECT_MAX_DELAY_MS);
|
|
21
|
+
}
|
|
22
|
+
export function buildReloadProjectContext(contentContext, projectSlug, projectId, preparedStyleArtifact) {
|
|
23
|
+
const environment = contentContext?.sourceType === "branch"
|
|
24
|
+
? "preview"
|
|
25
|
+
: "production";
|
|
26
|
+
return {
|
|
27
|
+
projectSlug,
|
|
28
|
+
projectId,
|
|
29
|
+
environment,
|
|
30
|
+
branch: contentContext?.branch ?? null,
|
|
31
|
+
releaseId: contentContext?.releaseId ?? null,
|
|
32
|
+
styleArtifactHash: preparedStyleArtifact?.hash,
|
|
33
|
+
styleAssetPath: preparedStyleArtifact?.assetPath,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export function buildContentSourceLabel(getContentSource, getContentContext) {
|
|
37
|
+
return {
|
|
38
|
+
contentSource: getContentSource(),
|
|
39
|
+
branch: getContentContext()?.branch ?? null,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { FileCache } from "../cache/file-cache.js";
|
|
2
2
|
import type { VeryfrontApiClient } from "../../veryfront-api-client/index.js";
|
|
3
3
|
import type { ContentSource, InvalidationCallbacks, ResolvedContentContext } from "./types.js";
|
|
4
|
-
|
|
5
|
-
hash: string;
|
|
6
|
-
assetPath: string;
|
|
7
|
-
}
|
|
4
|
+
import { type PreviewStyleArtifactInfo } from "./websocket-manager-helpers.js";
|
|
8
5
|
interface WebSocketDeps {
|
|
9
6
|
apiBaseUrl: string;
|
|
10
7
|
apiToken: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket-manager.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/websocket-manager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"websocket-manager.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters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AsD;IAC9E,OAAO,CAAC,gBAAgB,CAAuD;IAC/E,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,iBAAiB,CAAsD;IAC/E,OAAO,CAAC,0BAA0B,CAAsD;IACxF,OAAO,CAAC,mBAAmB,CAAqB;IAEhD,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,qBAAqB,CAAK;IAClC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,0BAA0B,CAAK;IACvC,OAAO,CAAC,iCAAiC,CAAqB;IAC9D,OAAO,CAAC,WAAW,CAIjB;gBAE2B,IAAI,EAAE,aAAa;IAEhD,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,8BAA8B;IAMtC,OAAO,CAAC,wBAAwB;IAahC,OAAO,CAAC,2BAA2B;IAUnC,cAAc,IAAI;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;KAC7B;IAID,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IA8GhC,OAAO,CAAC,iBAAiB;IAKzB,OAAO,IAAI,IAAI;IA8Bf,OAAO,CAAC,iBAAiB;IAyJzB,OAAO,CAAC,8BAA8B;IA0GtC,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,6BAA6B;YAiBvB,4BAA4B;YAwI5B,mBAAmB;IA2IjC,OAAO,CAAC,cAAc;IA+BtB,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,WAAW;CAyBpB"}
|
|
@@ -2,13 +2,8 @@ import * as dntShim from "../../../../../_dnt.shims.js";
|
|
|
2
2
|
import { getBaseLogger } from "../../../../utils/logger/logger.js";
|
|
3
3
|
import { buildDirCacheKeyPrefix, buildFileCacheKeyPrefix, buildFileListCacheKey, buildStatCacheKeyPrefix, } from "./cache-keys.js";
|
|
4
4
|
import { addPendingInvalidation, getPendingInvalidationsCount, removePendingInvalidation, } from "./invalidation-state.js";
|
|
5
|
+
import { buildContentSourceLabel, buildReloadProjectContext, getConnectionLogContext as getConnectionLogContextHelper, getPreviewInvalidationPrefixes as getPreviewInvalidationPrefixesHelper, getReconnectDelay as getReconnectDelayHelper, INVALIDATION_DEBOUNCE_MS, WS_HEARTBEAT_INTERVAL_MS, WS_HEARTBEAT_TIMEOUT_MS, WS_RECONNECT_MAX_DELAY_MS, WS_RECONNECT_MAX_FAILURES, } from "./websocket-manager-helpers.js";
|
|
5
6
|
const logger = getBaseLogger("SERVER", { injectTraceContext: false }).component("web-socket-manager");
|
|
6
|
-
const INVALIDATION_DEBOUNCE_MS = 100;
|
|
7
|
-
const WS_RECONNECT_DELAY_MS = 5000;
|
|
8
|
-
const WS_RECONNECT_MAX_DELAY_MS = 120000;
|
|
9
|
-
const WS_RECONNECT_MAX_FAILURES = 10;
|
|
10
|
-
const WS_HEARTBEAT_INTERVAL_MS = 60000;
|
|
11
|
-
const WS_HEARTBEAT_TIMEOUT_MS = 300000;
|
|
12
7
|
export class WebSocketManager {
|
|
13
8
|
deps;
|
|
14
9
|
ws = null;
|
|
@@ -33,14 +28,10 @@ export class WebSocketManager {
|
|
|
33
28
|
this.deps = deps;
|
|
34
29
|
}
|
|
35
30
|
getConnectionLogContext(context = {}) {
|
|
36
|
-
|
|
37
|
-
return context;
|
|
38
|
-
return { projectSlug: this.deps.projectSlug, ...context };
|
|
31
|
+
return getConnectionLogContextHelper(this.deps.projectSlug, context);
|
|
39
32
|
}
|
|
40
33
|
getPreviewInvalidationPrefixes(contentContext) {
|
|
41
|
-
|
|
42
|
-
return [];
|
|
43
|
-
return [buildFileCacheKeyPrefix(contentContext)];
|
|
34
|
+
return getPreviewInvalidationPrefixesHelper(contentContext);
|
|
44
35
|
}
|
|
45
36
|
beginPreviewInvalidation(contentContext) {
|
|
46
37
|
const prefixes = this.getPreviewInvalidationPrefixes(contentContext);
|
|
@@ -105,8 +96,7 @@ export class WebSocketManager {
|
|
|
105
96
|
logger.debug("WebSocket connected to events channel", this.getConnectionLogContext({
|
|
106
97
|
projectId,
|
|
107
98
|
connectionId: this.wsConnectionId,
|
|
108
|
-
|
|
109
|
-
branch: this.deps.getContentContext()?.branch,
|
|
99
|
+
...buildContentSourceLabel(this.deps.getContentSource, this.deps.getContentContext),
|
|
110
100
|
}));
|
|
111
101
|
this.wsLastPong = Date.now();
|
|
112
102
|
this.startHeartbeat(projectId);
|
|
@@ -155,8 +145,7 @@ export class WebSocketManager {
|
|
|
155
145
|
}
|
|
156
146
|
getReconnectDelay() {
|
|
157
147
|
// Exponential backoff: 5s, 10s, 20s, 40s, 80s, capped at 120s
|
|
158
|
-
|
|
159
|
-
return Math.min(delay, WS_RECONNECT_MAX_DELAY_MS);
|
|
148
|
+
return getReconnectDelayHelper(this.wsConsecutiveFailures);
|
|
160
149
|
}
|
|
161
150
|
dispose() {
|
|
162
151
|
this.disposed = true;
|
|
@@ -502,18 +491,7 @@ export class WebSocketManager {
|
|
|
502
491
|
projectId: this.deps.client.getProjectId(),
|
|
503
492
|
hasTriggerReloadCallback: !!this.deps.invalidationCallbacks.triggerReload,
|
|
504
493
|
});
|
|
505
|
-
const
|
|
506
|
-
? "preview"
|
|
507
|
-
: "production";
|
|
508
|
-
const projectContext = {
|
|
509
|
-
projectSlug: this.deps.projectSlug,
|
|
510
|
-
projectId: this.deps.client.getProjectId(),
|
|
511
|
-
environment,
|
|
512
|
-
branch: contentContext?.branch ?? null,
|
|
513
|
-
releaseId: contentContext?.releaseId ?? null,
|
|
514
|
-
styleArtifactHash: preparedStyleArtifact?.hash,
|
|
515
|
-
styleAssetPath: preparedStyleArtifact?.assetPath,
|
|
516
|
-
};
|
|
494
|
+
const projectContext = buildReloadProjectContext(contentContext, this.deps.projectSlug, this.deps.client.getProjectId(), preparedStyleArtifact);
|
|
517
495
|
this.deps.invalidationCallbacks.triggerReload?.(changedPaths, projectContext);
|
|
518
496
|
logger.info("Selective invalidation complete - HMR triggered", {
|
|
519
497
|
changedPaths,
|
|
@@ -610,18 +588,7 @@ export class WebSocketManager {
|
|
|
610
588
|
projectId: this.deps.client.getProjectId(),
|
|
611
589
|
hasTriggerReloadCallback: !!this.deps.invalidationCallbacks.triggerReload,
|
|
612
590
|
});
|
|
613
|
-
const
|
|
614
|
-
? "preview"
|
|
615
|
-
: "production";
|
|
616
|
-
const projectContext = {
|
|
617
|
-
projectSlug: this.deps.projectSlug,
|
|
618
|
-
projectId: this.deps.client.getProjectId(),
|
|
619
|
-
environment,
|
|
620
|
-
branch: contentContext?.branch ?? null,
|
|
621
|
-
releaseId: contentContext?.releaseId ?? null,
|
|
622
|
-
styleArtifactHash: preparedStyleArtifact?.hash,
|
|
623
|
-
styleAssetPath: preparedStyleArtifact?.assetPath,
|
|
624
|
-
};
|
|
591
|
+
const projectContext = buildReloadProjectContext(contentContext, this.deps.projectSlug, this.deps.client.getProjectId(), preparedStyleArtifact);
|
|
625
592
|
this.deps.invalidationCallbacks.triggerReload?.(undefined, projectContext);
|
|
626
593
|
logger.debug("CACHE INVALIDATION COMPLETE", {
|
|
627
594
|
fileCacheCleared: totalFileCount,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const TOOL_INPUT_PENDING_THRESHOLD_MS = 5000;
|
|
2
|
+
type ToolInputActivityStatus = "pending_input" | "streaming_input";
|
|
3
|
+
type ToolInputStatusState = {
|
|
4
|
+
dueAt: number | null;
|
|
5
|
+
lastStatus: ToolInputActivityStatus | null;
|
|
6
|
+
};
|
|
7
|
+
export declare function getToolCallIdFromStreamPart(part: unknown): string | null;
|
|
8
|
+
export declare function collectDueToolStatuses(toolStates: Map<string, ToolInputStatusState>, now: number, thresholdMs: number): Array<{
|
|
9
|
+
type: "data-tool-call-status";
|
|
10
|
+
data: {
|
|
11
|
+
toolCallId: string;
|
|
12
|
+
status: "pending_input";
|
|
13
|
+
};
|
|
14
|
+
}>;
|
|
15
|
+
export declare function withToolInputStatusTransitions(stream: AsyncIterable<unknown>, thresholdMs?: number): AsyncIterable<unknown>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=tool-input-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-input-status.d.ts","sourceRoot":"","sources":["../../../../src/src/provider/runtime-loader/tool-input-status.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,+BAA+B,OAAQ,CAAC;AAErD,KAAK,uBAAuB,GAAG,eAAe,GAAG,iBAAiB,CAAC;AAEnE,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,uBAAuB,GAAG,IAAI,CAAC;CAC5C,CAAC;AAOF,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAexE;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAC7C,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,GAClB,KAAK,CAAC;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,eAAe,CAAA;KAAE,CAAA;CAAE,CAAC,CAsBjG;AAED,wBAAuB,8BAA8B,CACnD,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,EAC9B,WAAW,SAAkC,GAC5C,aAAa,CAAC,OAAO,CAAC,CAkJxB"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
|
+
export const TOOL_INPUT_PENDING_THRESHOLD_MS = 5_000;
|
|
3
|
+
export function getToolCallIdFromStreamPart(part) {
|
|
4
|
+
if (!part || typeof part !== "object") {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
const record = part;
|
|
8
|
+
if (typeof record.toolCallId === "string" && record.toolCallId.length > 0) {
|
|
9
|
+
return record.toolCallId;
|
|
10
|
+
}
|
|
11
|
+
if (typeof record.id === "string" && record.id.length > 0) {
|
|
12
|
+
return record.id;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
export function collectDueToolStatuses(toolStates, now, thresholdMs) {
|
|
17
|
+
const events = [];
|
|
18
|
+
for (const [toolCallId, state] of toolStates.entries()) {
|
|
19
|
+
if (state.dueAt === null || state.dueAt > now) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
state.dueAt = now + thresholdMs;
|
|
23
|
+
state.lastStatus = "pending_input";
|
|
24
|
+
events.push({
|
|
25
|
+
type: "data-tool-call-status",
|
|
26
|
+
data: {
|
|
27
|
+
toolCallId,
|
|
28
|
+
status: "pending_input",
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return events;
|
|
33
|
+
}
|
|
34
|
+
export async function* withToolInputStatusTransitions(stream, thresholdMs = TOOL_INPUT_PENDING_THRESHOLD_MS) {
|
|
35
|
+
const iterator = stream[Symbol.asyncIterator]();
|
|
36
|
+
const toolStates = new Map();
|
|
37
|
+
const buffered = [];
|
|
38
|
+
let nextPartPromise = null;
|
|
39
|
+
const closeTool = (toolCallId) => {
|
|
40
|
+
if (!toolCallId) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
toolStates.delete(toolCallId);
|
|
44
|
+
};
|
|
45
|
+
const schedulePending = (toolCallId) => {
|
|
46
|
+
if (!toolCallId) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const state = toolStates.get(toolCallId) ?? {
|
|
50
|
+
dueAt: null,
|
|
51
|
+
lastStatus: null,
|
|
52
|
+
};
|
|
53
|
+
state.dueAt = Date.now() + thresholdMs;
|
|
54
|
+
toolStates.set(toolCallId, state);
|
|
55
|
+
};
|
|
56
|
+
const markStreaming = (toolCallId) => {
|
|
57
|
+
if (!toolCallId) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const state = toolStates.get(toolCallId) ?? {
|
|
61
|
+
dueAt: null,
|
|
62
|
+
lastStatus: null,
|
|
63
|
+
};
|
|
64
|
+
if (state.lastStatus !== "streaming_input") {
|
|
65
|
+
buffered.push({
|
|
66
|
+
type: "data-tool-call-status",
|
|
67
|
+
data: {
|
|
68
|
+
toolCallId,
|
|
69
|
+
status: "streaming_input",
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
state.lastStatus = "streaming_input";
|
|
74
|
+
state.dueAt = Date.now() + thresholdMs;
|
|
75
|
+
toolStates.set(toolCallId, state);
|
|
76
|
+
};
|
|
77
|
+
const processPart = (part) => {
|
|
78
|
+
if (!part || typeof part !== "object") {
|
|
79
|
+
buffered.push(part);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const record = part;
|
|
83
|
+
const partType = typeof record.type === "string" ? record.type : null;
|
|
84
|
+
const toolCallId = getToolCallIdFromStreamPart(part);
|
|
85
|
+
switch (partType) {
|
|
86
|
+
case "tool-input-start":
|
|
87
|
+
schedulePending(toolCallId);
|
|
88
|
+
buffered.push(part);
|
|
89
|
+
return;
|
|
90
|
+
case "tool-input-delta":
|
|
91
|
+
markStreaming(toolCallId);
|
|
92
|
+
buffered.push(part);
|
|
93
|
+
return;
|
|
94
|
+
case "tool-call":
|
|
95
|
+
case "tool-result":
|
|
96
|
+
case "tool-error":
|
|
97
|
+
closeTool(toolCallId);
|
|
98
|
+
buffered.push(part);
|
|
99
|
+
return;
|
|
100
|
+
case "finish":
|
|
101
|
+
case "error":
|
|
102
|
+
toolStates.clear();
|
|
103
|
+
buffered.push(part);
|
|
104
|
+
return;
|
|
105
|
+
default:
|
|
106
|
+
buffered.push(part);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
while (true) {
|
|
111
|
+
if (buffered.length > 0) {
|
|
112
|
+
yield buffered.shift();
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (!nextPartPromise) {
|
|
116
|
+
nextPartPromise = iterator.next();
|
|
117
|
+
}
|
|
118
|
+
const nextDueAt = [...toolStates.values()]
|
|
119
|
+
.map((state) => state.dueAt)
|
|
120
|
+
.filter((value) => value !== null)
|
|
121
|
+
.sort((left, right) => left - right)[0] ?? null;
|
|
122
|
+
if (nextDueAt !== null) {
|
|
123
|
+
let timeoutId = null;
|
|
124
|
+
const timeoutResult = await Promise.race([
|
|
125
|
+
nextPartPromise.then((result) => ({ kind: "part", result })),
|
|
126
|
+
new Promise((resolve) => {
|
|
127
|
+
timeoutId = dntShim.setTimeout(() => resolve({ kind: "timeout" }), Math.max(0, nextDueAt - Date.now()));
|
|
128
|
+
}),
|
|
129
|
+
]);
|
|
130
|
+
if (timeoutId !== null) {
|
|
131
|
+
clearTimeout(timeoutId);
|
|
132
|
+
}
|
|
133
|
+
if (timeoutResult.kind === "timeout") {
|
|
134
|
+
buffered.push(...collectDueToolStatuses(toolStates, Date.now(), thresholdMs));
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
nextPartPromise = null;
|
|
138
|
+
if (timeoutResult.result.done) {
|
|
139
|
+
buffered.push(...collectDueToolStatuses(toolStates, Date.now(), thresholdMs));
|
|
140
|
+
while (buffered.length > 0) {
|
|
141
|
+
yield buffered.shift();
|
|
142
|
+
}
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
processPart(timeoutResult.result.value);
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
const result = await nextPartPromise;
|
|
149
|
+
nextPartPromise = null;
|
|
150
|
+
if (result.done) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
processPart(result.value);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { EmbeddingRuntime, ModelRuntime } from "./types.js";
|
|
2
|
+
import { TOOL_INPUT_PENDING_THRESHOLD_MS, withToolInputStatusTransitions } from "./runtime-loader/tool-input-status.js";
|
|
3
|
+
export { TOOL_INPUT_PENDING_THRESHOLD_MS, withToolInputStatusTransitions };
|
|
2
4
|
export interface OpenAIRuntimeConfig {
|
|
3
5
|
apiKey: string;
|
|
4
6
|
baseURL?: string;
|
|
@@ -18,8 +20,6 @@ export interface GoogleRuntimeConfig {
|
|
|
18
20
|
name?: string;
|
|
19
21
|
fetch?: typeof globalThis.fetch;
|
|
20
22
|
}
|
|
21
|
-
export declare const TOOL_INPUT_PENDING_THRESHOLD_MS = 5000;
|
|
22
|
-
export declare function withToolInputStatusTransitions(stream: AsyncIterable<unknown>, thresholdMs?: number): AsyncIterable<unknown>;
|
|
23
23
|
type ProviderKind = "anthropic" | "openai" | "google";
|
|
24
24
|
/**
|
|
25
25
|
* Structured warning emitted when a provider runtime drops or rewrites a
|
|
@@ -71,5 +71,4 @@ export declare function createAnthropicModelRuntime(config: AnthropicRuntimeConf
|
|
|
71
71
|
export declare function createGoogleModelRuntime(config: GoogleRuntimeConfig, modelId: string): ModelRuntime;
|
|
72
72
|
export declare function createOpenAIEmbeddingRuntime(config: OpenAIRuntimeConfig, modelId: string): EmbeddingRuntime;
|
|
73
73
|
export declare function createGoogleEmbeddingRuntime(config: GoogleRuntimeConfig, modelId: string): EmbeddingRuntime;
|
|
74
|
-
export {};
|
|
75
74
|
//# sourceMappingURL=runtime-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-loader.d.ts","sourceRoot":"","sources":["../../../src/src/provider/runtime-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime-loader.d.ts","sourceRoot":"","sources":["../../../src/src/provider/runtime-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAejE,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,uCAAuC,CAAC;AAE/C,OA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