veryfront 0.1.1069 → 0.1.1071

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.
Files changed (29) hide show
  1. package/esm/deno.js +2 -2
  2. package/esm/src/agent/runtime/index.d.ts.map +1 -1
  3. package/esm/src/agent/runtime/index.js +26 -3
  4. package/esm/src/agent/runtime/tool-result-continuation.d.ts.map +1 -1
  5. package/esm/src/agent/runtime/tool-result-continuation.js +10 -2
  6. package/esm/src/cache/cache-key-builder.d.ts +30 -0
  7. package/esm/src/cache/cache-key-builder.d.ts.map +1 -1
  8. package/esm/src/cache/cache-key-builder.js +65 -0
  9. package/esm/src/cache/keys/builders/render.d.ts +1 -1
  10. package/esm/src/cache/keys/builders/render.d.ts.map +1 -1
  11. package/esm/src/cache/keys/builders/render.js +7 -4
  12. package/esm/src/observability/tracing/otlp-setup.d.ts +2 -0
  13. package/esm/src/observability/tracing/otlp-setup.d.ts.map +1 -1
  14. package/esm/src/observability/tracing/otlp-setup.js +7 -1
  15. package/esm/src/platform/adapters/fs/veryfront/proxy-manager.d.ts +2 -2
  16. package/esm/src/platform/adapters/fs/veryfront/proxy-manager.d.ts.map +1 -1
  17. package/esm/src/platform/adapters/fs/veryfront/proxy-manager.js +12 -6
  18. package/esm/src/registry/project-scoped-registry-manager.d.ts +17 -0
  19. package/esm/src/registry/project-scoped-registry-manager.d.ts.map +1 -1
  20. package/esm/src/registry/project-scoped-registry-manager.js +112 -13
  21. package/esm/src/server/handlers/request/api/project-discovery.d.ts.map +1 -1
  22. package/esm/src/server/handlers/request/api/project-discovery.js +45 -41
  23. package/esm/src/tool/remote-mcp.d.ts.map +1 -1
  24. package/esm/src/tool/remote-mcp.js +14 -2
  25. package/esm/src/utils/version-constant.d.ts +1 -1
  26. package/esm/src/utils/version-constant.js +1 -1
  27. package/esm/src/workflow/executor/step-executor.d.ts.map +1 -1
  28. package/esm/src/workflow/executor/step-executor.js +24 -4
  29. package/package.json +5 -5
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.1069",
3
+ "version": "0.1.1071",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -458,7 +458,7 @@ export default {
458
458
  "lint:ban-test-only": "deno run --allow-read scripts/lint/ban-test-only.ts",
459
459
  "lint:sanitizer-baseline": "deno run --allow-read scripts/lint/check-sanitizer-baseline.ts",
460
460
  "lint:skipped-tests": "deno run --allow-read scripts/lint/check-skipped-tests-baseline.ts",
461
- "test:scripts": "deno test --config=scripts/test.deno.json --no-check --allow-read --allow-write --allow-run scripts/build/dnt-polyfill.test.ts scripts/build/generate-sbom.test.ts scripts/build/npm-dependency-sources.test.ts scripts/build/npm-extension-package-metadata.test.ts scripts/build/npm-package-metadata.test.ts scripts/build/npm-react-shims.test.ts scripts/docs/docs-coverage.test.ts scripts/docs/generate-api-reference.test.ts scripts/docs/guide-validation.test.ts scripts/lint/audit-core-deps.test.ts scripts/lint/audit-dependency-boundaries.test.ts scripts/lint/audit-extension-capabilities.test.ts scripts/lint/audit-extension-contracts.test.ts scripts/lint/audit-deps.test.ts scripts/lint/check-circular-baseline.test.ts scripts/lint/ban-test-only.test.ts scripts/lint/check-sanitizer-baseline.test.ts scripts/lint/check-skipped-tests-baseline.test.ts scripts/lint/check-coverage.test.ts scripts/security/audit-npm.test.ts scripts/security/submit-dependency-snapshot.test.ts",
461
+ "test:scripts": "deno test --config=scripts/test.deno.json --no-check --allow-read --allow-write --allow-run scripts/ci/publish-npm-packages.test.ts scripts/build/dnt-polyfill.test.ts scripts/build/generate-sbom.test.ts scripts/build/npm-dependency-sources.test.ts scripts/build/npm-extension-package-metadata.test.ts scripts/build/npm-package-metadata.test.ts scripts/build/npm-react-shims.test.ts scripts/docs/docs-coverage.test.ts scripts/docs/generate-api-reference.test.ts scripts/docs/guide-validation.test.ts scripts/lint/audit-core-deps.test.ts scripts/lint/audit-dependency-boundaries.test.ts scripts/lint/audit-extension-capabilities.test.ts scripts/lint/audit-extension-contracts.test.ts scripts/lint/audit-deps.test.ts scripts/lint/check-circular-baseline.test.ts scripts/lint/ban-test-only.test.ts scripts/lint/check-sanitizer-baseline.test.ts scripts/lint/check-skipped-tests-baseline.test.ts scripts/lint/check-coverage.test.ts scripts/security/audit-npm.test.ts scripts/security/submit-dependency-snapshot.test.ts",
462
462
  "test:cross-runtime": "deno run --allow-all src/platform/compat/cross-runtime.test.ts",
463
463
  "test:node": "node ./tests/node/run-tests.mjs 'src/**/*.test.ts'",
464
464
  "test:bun": "node ./tests/bun/run-tests.mjs src/",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAGlB,KAAK,OAAO,EAIZ,KAAK,QAAQ,EAGd,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAqB,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAyDpE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,8BAA8B,EAC9B,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,sBAAsB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,0BA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M,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAIF;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC"}
@@ -16,7 +16,7 @@ import { generateId } from "../../utils/id.js";
16
16
  import { detectPlatform, getPlatformCapabilities } from "../../platform/core-platform.js";
17
17
  import { createAgentMemory } from "../memory/index.js";
18
18
  import { serverLogger } from "../../utils/index.js";
19
- import { addSpanEvent, setActiveSpanAttributes as setOtelActiveSpanAttributes, setSpanAttributes, withSpan, } from "../../observability/tracing/otlp-setup.js";
19
+ import { addSpanEvent, setActiveSpanAttributes as setOtelActiveSpanAttributes, setActiveSpanErrorStatus as setOtelActiveSpanErrorStatus, setSpanAttributes, withSpan, } from "../../observability/tracing/otlp-setup.js";
20
20
  import { convertToTextGenerationRuntimeRequestMessages } from "./text-generation-runtime-message-converter.js";
21
21
  import { convertToolsToRuntimeTools } from "./model-tool-converter.js";
22
22
  import { getRuntimeRemoteToolSources } from "./mcp-server-tool-sources.js";
@@ -208,6 +208,9 @@ async function traceConfiguredToolExecution(input) {
208
208
  try {
209
209
  const result = await executeConfiguredTool(input.toolName, input.args, input.toolsConfig, input.context, input.allowedRemoteToolNames, input.remoteToolSources);
210
210
  const resultError = getToolResultError(result);
211
+ if (resultError !== undefined) {
212
+ setOtelActiveSpanErrorStatus(resultError);
213
+ }
211
214
  setOtelActiveSpanAttributes(buildRuntimeToolTraceAttributes({
212
215
  mode: input.mode,
213
216
  agentId: input.agentId,
@@ -256,6 +259,9 @@ async function traceProviderExecutedTool(input) {
256
259
  const status = input.isError === true ? "failed" : "completed";
257
260
  const errorMessage = input.isError === true ? stringifyToolError(input.result) : undefined;
258
261
  await withSpan("agent.tool_execute", async () => {
262
+ if (errorMessage !== undefined) {
263
+ setOtelActiveSpanErrorStatus(errorMessage);
264
+ }
259
265
  setOtelActiveSpanAttributes(buildRuntimeToolTraceAttributes({
260
266
  ...input,
261
267
  status,
@@ -540,6 +546,7 @@ export class AgentRuntime {
540
546
  const remoteToolSources = getRuntimeRemoteToolSources(this.config);
541
547
  let currentSystemPrompt = systemPrompt;
542
548
  let currentRuntimeContext = runtimeContext;
549
+ let agentWriteFinalResponseToolGuardEnabled = false;
543
550
  for (let step = 0; step < maxSteps; step++) {
544
551
  this.status = "thinking";
545
552
  addSpanEvent(loopSpan, "step_start", { step });
@@ -568,7 +575,10 @@ export class AgentRuntime {
568
575
  currentSystemPrompt = preparedStep.systemPrompt;
569
576
  currentRuntimeContext = preparedStep.runtimeContext;
570
577
  const toolContext = preparedStep.toolContext;
571
- const tools = preparedStep.tools;
578
+ const tools = agentWriteFinalResponseToolGuardEnabled
579
+ ? preparedStep.tools.filter((tool) => !shouldHideProjectToolAfterAgentWriteSuccess(tool.name))
580
+ : preparedStep.tools;
581
+ const stepProviderTools = agentWriteFinalResponseToolGuardEnabled ? [] : providerTools;
572
582
  const temperature = this.resolveTemperature(temperatureModelString ?? effectiveModel, providerOptions);
573
583
  const response = await withSpan("agent.generate_text", async (span) => {
574
584
  setSpanAttributes(span, {
@@ -581,7 +591,7 @@ export class AgentRuntime {
581
591
  messages: convertToTextGenerationRuntimeRequestMessages(currentMessages),
582
592
  tools: convertToolsToRuntimeTools(tools, {
583
593
  model: effectiveModel,
584
- providerTools,
594
+ providerTools: stepProviderTools,
585
595
  }),
586
596
  experimental_repairToolCall: repairToolCall,
587
597
  maxOutputTokens: this.resolveMaxOutputTokens(effectiveModel, maxOutputTokensOverride),
@@ -714,6 +724,13 @@ export class AgentRuntime {
714
724
  toolCall.error = generatedToolResult.isError === true
715
725
  ? stringifyToolError(generatedToolResult.result)
716
726
  : undefined;
727
+ if (toolCall.error !== undefined) {
728
+ setOtelActiveSpanErrorStatus(toolCall.error);
729
+ }
730
+ if (generatedToolResult.isError !== true &&
731
+ shouldHideProjectToolAfterAgentWriteSuccess(tc.toolName)) {
732
+ agentWriteFinalResponseToolGuardEnabled = true;
733
+ }
717
734
  setSpanAttributes(toolSpan, compactRuntimeTraceAttributes({
718
735
  "tool.status": generatedToolResult.isError === true ? "failed" : "completed",
719
736
  "tool.provider_executed": generatedToolResult.providerExecuted === true,
@@ -791,6 +808,9 @@ export class AgentRuntime {
791
808
  context: executionContext,
792
809
  });
793
810
  const resultError = getToolResultError(result);
811
+ if (resultError !== undefined) {
812
+ setOtelActiveSpanErrorStatus(resultError);
813
+ }
794
814
  toolCall.status = resultError === undefined ? "completed" : "error";
795
815
  toolCall.result = result;
796
816
  toolCall.error = resultError;
@@ -806,6 +826,9 @@ export class AgentRuntime {
806
826
  }),
807
827
  }));
808
828
  if (resultError === undefined) {
829
+ if (shouldHideProjectToolAfterAgentWriteSuccess(tc.toolName)) {
830
+ agentWriteFinalResponseToolGuardEnabled = true;
831
+ }
809
832
  // Track skill policy from successful load_skill results
810
833
  if (tc.toolName === LOAD_SKILL_TOOL_ID) {
811
834
  activeSkillId = extractSkillId(result);
@@ -1 +1 @@
1
- {"version":3,"file":"tool-result-continuation.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/tool-result-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAElF,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAmBzF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAWtE;AAED,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,EACf,gBAAgB,UAAQ,GACvB,OAAO,CAeT;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EA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AAY,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;CAC1C,CAAC;AAEJ,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,iBAAiB,GACpB,+BAA+B,CAoCjC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,IAAI,cAAc,CAE1E"}
@@ -1,4 +1,5 @@
1
1
  import { stripLeadingEmptyObjectPlaceholder } from "../streaming/data-stream.js";
2
+ import { hasToolExecutionErrorMarker } from "../../tool/result.js";
2
3
  import { parseToolArgs } from "./tool-helpers.js";
3
4
  import { stringifyToolError } from "./error-utils.js";
4
5
  function getMcpToolErrorMessage(result) {
@@ -15,14 +16,21 @@ function getMcpToolErrorMessage(result) {
15
16
  return record.error;
16
17
  }
17
18
  export function getToolResultError(result) {
18
- if (!result || typeof result !== "object" || !("error" in result)) {
19
+ if (!hasToolExecutionErrorMarker(result)) {
19
20
  return undefined;
20
21
  }
21
22
  const mcpToolErrorMessage = getMcpToolErrorMessage(result);
22
23
  if (mcpToolErrorMessage !== undefined) {
23
24
  return mcpToolErrorMessage;
24
25
  }
25
- return stringifyToolError(result.error);
26
+ const record = result;
27
+ if (typeof record.error === "string") {
28
+ return stringifyToolError(record.error);
29
+ }
30
+ if (typeof record.message === "string" && record.message.trim().length > 0) {
31
+ return record.message;
32
+ }
33
+ return "Tool execution failed";
26
34
  }
27
35
  export function createToolResultMessage(toolCallId, toolName, result, providerExecuted = false) {
28
36
  return {
@@ -10,10 +10,40 @@ type MultiProjectRequestContextType = {
10
10
  environmentName?: string | null;
11
11
  };
12
12
  export type { CacheKeyContext };
13
+ export interface RegistryScopeContext {
14
+ scopeId: string;
15
+ /** Whether completed discovery is safe to retain for this immutable source. */
16
+ immutable: boolean;
17
+ }
13
18
  export declare function getContentHashKey(prefix: string, filePath: string, contentHash: string, suffix?: string): string;
14
19
  export declare function runWithCacheKeyContext<T>(ctx: CacheKeyContext, fn: () => T): T;
20
+ /**
21
+ * Suppress an inherited explicit cache scope for a callback. This is used when
22
+ * a restored tenant has a mutable source (for example, a production
23
+ * environment without a pinned release) that cannot safely use distributed
24
+ * caching. Ambient request context remains available for in-process registry
25
+ * isolation.
26
+ */
27
+ export declare function runWithoutCacheKeyContext<T>(fn: () => T): T;
15
28
  export declare function getCurrentCacheKeyContext(): CacheKeyContext;
16
29
  export declare function tryGetCacheKeyContext(): CacheKeyContext | null;
30
+ /**
31
+ * Returns a stable scope identifier for in-process registry isolation.
32
+ *
33
+ * Unlike tryGetCacheKeyContext(), this function does NOT return null when the
34
+ * request context lacks a field that would be required for a safe distributed
35
+ * cache key (e.g. productionMode=true without a releaseId). For in-process
36
+ * registries (ProjectScopedRegistryManager), project identity and the active
37
+ * content source still provide a safe process-local scope. Collapsing to
38
+ * "__default__" would let concurrent projects overwrite one another's
39
+ * registered skills, tools, and agents.
40
+ *
41
+ * Returns null only when no project identity is available at all (e.g. CLI /
42
+ * local dev without a multi-project context), in which case the caller should
43
+ * fall back to DEFAULT_SCOPE_ID.
44
+ */
45
+ export declare function tryGetRegistryScopeContext(): RegistryScopeContext | null;
46
+ export declare function tryGetRegistryScopeId(): string | null;
17
47
  export declare function getProjectScopedKey(prefix: string, resourceKey: string): string | null;
18
48
  export declare function getProjectScopedKeyAlways(prefix: string, resourceKey: string): string | null;
19
49
  export declare function extractCacheKeyContext(handlerCtx: HandlerContext): CacheKeyContext | null;
@@ -1 +1 @@
1
- {"version":3,"file":"cache-key-builder.d.ts","sourceRoot":"","sources":["../../../src/src/cache/cache-key-builder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,oBAAoB,CAAC;AAIjF,KAAK,8BAA8B,GAAG;IACpC,WAAW,EAAE,MAAM,C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Ac,GAAG,eAAe,GAAG,IAAI,CAyBzF;AAED,YAAY,EAAE,8BAA8B,IAAI,0BAA0B,EAAE,CAAC"}
@@ -14,6 +14,16 @@ export function getContentHashKey(prefix, filePath, contentHash, suffix) {
14
14
  export function runWithCacheKeyContext(ctx, fn) {
15
15
  return cacheKeyContextStorage.run(validateCacheKeyContext(ctx), fn);
16
16
  }
17
+ /**
18
+ * Suppress an inherited explicit cache scope for a callback. This is used when
19
+ * a restored tenant has a mutable source (for example, a production
20
+ * environment without a pinned release) that cannot safely use distributed
21
+ * caching. Ambient request context remains available for in-process registry
22
+ * isolation.
23
+ */
24
+ export function runWithoutCacheKeyContext(fn) {
25
+ return cacheKeyContextStorage.run(null, fn);
26
+ }
17
27
  export function getCurrentCacheKeyContext() {
18
28
  const ctx = cacheKeyContextStorage.getStore();
19
29
  if (ctx)
@@ -73,6 +83,61 @@ export function tryGetCacheKeyContext() {
73
83
  return null;
74
84
  return extractCacheKeyContextFromMultiProjectContext(reqCtx);
75
85
  }
86
+ /**
87
+ * Returns a stable scope identifier for in-process registry isolation.
88
+ *
89
+ * Unlike tryGetCacheKeyContext(), this function does NOT return null when the
90
+ * request context lacks a field that would be required for a safe distributed
91
+ * cache key (e.g. productionMode=true without a releaseId). For in-process
92
+ * registries (ProjectScopedRegistryManager), project identity and the active
93
+ * content source still provide a safe process-local scope. Collapsing to
94
+ * "__default__" would let concurrent projects overwrite one another's
95
+ * registered skills, tools, and agents.
96
+ *
97
+ * Returns null only when no project identity is available at all (e.g. CLI /
98
+ * local dev without a multi-project context), in which case the caller should
99
+ * fall back to DEFAULT_SCOPE_ID.
100
+ */
101
+ export function tryGetRegistryScopeContext() {
102
+ // Explicit contexts are authoritative for workflows and other callers that
103
+ // intentionally override ambient filesystem tenancy.
104
+ const cacheCtx = cacheKeyContextStorage.getStore();
105
+ if (cacheCtx) {
106
+ return {
107
+ scopeId: `${cacheCtx.projectId}:${cacheCtx.mode}:${cacheCtx.versionId}`,
108
+ immutable: cacheCtx.mode === "production",
109
+ };
110
+ }
111
+ const reqCtx = getRequestContextFn()?.();
112
+ if (reqCtx) {
113
+ const projectId = reqCtx.projectId || reqCtx.projectSlug;
114
+ if (!projectId)
115
+ return null;
116
+ if (reqCtx.productionMode) {
117
+ if (reqCtx.releaseId) {
118
+ return {
119
+ scopeId: `${projectId}:production:${reqCtx.releaseId}`,
120
+ immutable: true,
121
+ };
122
+ }
123
+ // Match ProxyFSAdapterManager's canonical default so registry,
124
+ // discovery, and adapter caches all describe the same content source.
125
+ const environmentName = reqCtx.environmentName || "production";
126
+ return {
127
+ scopeId: `${projectId}:production:environment:${environmentName}`,
128
+ immutable: false,
129
+ };
130
+ }
131
+ return {
132
+ scopeId: `${projectId}:preview:${reqCtx.branch || "main"}`,
133
+ immutable: false,
134
+ };
135
+ }
136
+ return null;
137
+ }
138
+ export function tryGetRegistryScopeId() {
139
+ return tryGetRegistryScopeContext()?.scopeId ?? null;
140
+ }
76
141
  function buildProjectScopedKey(prefix, resourceKey, ctx) {
77
142
  return `${prefix}:${ctx.projectId}:${ctx.mode}:${ctx.versionId}:${resourceKey}`;
78
143
  }
@@ -35,7 +35,7 @@ export declare function buildRenderCacheKey(cachePrefix: string, contentKey: str
35
35
  export declare function buildComponentCacheKey(projectId: string, filePath: string, contentHash: string): string;
36
36
  export declare function buildLayoutComponentCacheKey(projectId: string, componentPath: string, hash: string, contentSourceId: string): string;
37
37
  export declare function buildErrorPageCacheKey(projectId: string | undefined, projectDir: string, pageType: string): string;
38
- export declare function buildProxyManagerCacheKey(projectSlug: string, productionMode: boolean, releaseId: string | null, branch: string | null): string;
38
+ export declare function buildProxyManagerCacheKey(projectSlug: string, productionMode: boolean, releaseId: string | null, branch: string | null, environmentName?: string | null): string;
39
39
  /**
40
40
  * Build a query-aware cache key that is safe for multi-tenant caching.
41
41
  *
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../../../src/src/cache/keys/builders/render.ts"],"names":[],"mappings":"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AM,CAMR"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../../../src/src/cache/keys/builders/render.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAI7D,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,SAAS,GAAG,YAAY,EACrC,UAAU,EAAE,MAAM;AAClB;;;;;GAKG;AACH,eAAe,CAAC,EAAE,MAAM,GACvB,MAAM,CAGR;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,GAAG,YAAY,EACrC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACnC,MAAM,CAaR;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,MAAM,CAER;AAED,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,GACtB,MAAM,CAER;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,OAAO,EACvB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,GAC9B,MAAM,CAgBR;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,GAAG,EACT,OAAO,CAAC,EAAE,sBAAsB,GAC/B,MAAM,CAMR"}
@@ -61,15 +61,18 @@ export function buildLayoutComponentCacheKey(projectId, componentPath, hash, con
61
61
  export function buildErrorPageCacheKey(projectId, projectDir, pageType) {
62
62
  return `${CacheKeyPrefix.ERROR_PAGE}:${projectId ?? projectDir}:${pageType}`;
63
63
  }
64
- export function buildProxyManagerCacheKey(projectSlug, productionMode, releaseId, branch) {
64
+ export function buildProxyManagerCacheKey(projectSlug, productionMode, releaseId, branch, environmentName) {
65
65
  const mode = productionMode ? "production" : "preview";
66
66
  if (productionMode) {
67
- if (!releaseId) {
67
+ if (releaseId) {
68
+ return `${CacheKeyPrefix.PROXY}:${projectSlug}:${mode}:${releaseId}`;
69
+ }
70
+ if (!environmentName) {
68
71
  throw CACHE_INVARIANT_VIOLATION.create({
69
- detail: `Missing releaseId in production for ${projectSlug}`,
72
+ detail: `Missing releaseId or environmentName in production for ${projectSlug}`,
70
73
  });
71
74
  }
72
- return `${CacheKeyPrefix.PROXY}:${projectSlug}:${mode}:${releaseId}`;
75
+ return `${CacheKeyPrefix.PROXY}:${projectSlug}:${mode}:environment:${environmentName}`;
73
76
  }
74
77
  return `${CacheKeyPrefix.PROXY}:${projectSlug}:${mode}:${branch ?? "main"}`;
75
78
  }
@@ -52,6 +52,8 @@ export declare function setSpanAttributes(span: unknown, attributes: Record<stri
52
52
  export declare function addSpanEvent(span: unknown, name: string, attributes?: Record<string, AttributeValue>): void;
53
53
  /** Sets active span attributes. */
54
54
  export declare function setActiveSpanAttributes(attributes: Record<string, AttributeValue>): void;
55
+ /** Marks the active span as failed. */
56
+ export declare function setActiveSpanErrorStatus(error: unknown): void;
55
57
  /** Context for with. */
56
58
  export declare function withContext<T>(spanContext: unknown, fn: () => Promise<T>): Promise<T>;
57
59
  /** Context for get trace. */
@@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E3F;AAED,6BAA6B;AAC7B,wBAAgB,eAAe,IAAI;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAMvE"}
@@ -106,7 +106,6 @@ export async function withSpan(name, fn, attributes, options) {
106
106
  const spanContext = shimTrace.setSpan(parentContext, span);
107
107
  try {
108
108
  const result = await shimContext.with(spanContext, () => fn(span));
109
- span.setStatus({ code: SpanStatusCode.OK });
110
109
  return result;
111
110
  }
112
111
  catch (error) {
@@ -200,6 +199,13 @@ export function setActiveSpanAttributes(attributes) {
200
199
  for (const [key, value] of Object.entries(attributes))
201
200
  span.setAttribute(key, value);
202
201
  }
202
+ /** Marks the active span as failed. */
203
+ export function setActiveSpanErrorStatus(error) {
204
+ const span = shimTrace.getActiveSpan?.();
205
+ if (!span)
206
+ return;
207
+ setSpanErrorStatus(span, error);
208
+ }
203
209
  /** Context for with. */
204
210
  export async function withContext(spanContext, fn) {
205
211
  return shimContext.with(spanContext, fn);
@@ -22,8 +22,8 @@ export declare class ProxyFSAdapterManager {
22
22
  private createAdapter;
23
23
  private evictLeastRecentlyUsed;
24
24
  private cleanupIdleAdapters;
25
- hasAdapter(projectSlug: string, productionMode?: boolean, releaseId?: string | null, branch?: string | null): boolean;
26
- evictAdapter(projectSlug: string, productionMode?: boolean, releaseId?: string | null, branch?: string | null): void;
25
+ hasAdapter(projectSlug: string, productionMode?: boolean, releaseId?: string | null, branch?: string | null, environmentName?: string | null): boolean;
26
+ evictAdapter(projectSlug: string, productionMode?: boolean, releaseId?: string | null, branch?: string | null, environmentName?: string | null): void;
27
27
  getStats(): {
28
28
  adapters: number;
29
29
  stats: Record<string, CacheStats>;
@@ -1 +1 @@
1
- {"version":3,"file":"proxy-manager.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/proxy-manager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO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;IAUV,YAAY,CACV,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,OAAO,EACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,EACzB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GACrB,IAAI;IAmBP,QAAQ,IAAI;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;KAAE;IAUnE,OAAO,IAAI,IAAI;CAoBhB"}
1
+ {"version":3,"file":"proxy-manager.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/proxy-manager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAA0B,MAAM,YAAY,CAAC;AAetF,UAAU,2BAA2B;IACnC,UAAU,EAAE,eAAe,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoCD,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,cAAc,UAAQ,GACrB,MAAM,GAAG,IAAI,CAgBf;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAqC;IACrD,OAAO,CAAC,eAAe,CAAkD;IACzE,OAAO,CAAC,oBAAoB,CAAyC;IACrE,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,YAAY,CAAC,CAAiC;gBAE1C,MAAM,EAAE,2BAA2B;IAkBzC,UAAU,CACd,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,OAAO,EACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,EACzB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,EAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAAC,kBAAkB,CAAC;IAmK9B,OAAO,CAAC,oBAAoB;IAuC5B,OAAO,CAAC,wBAAwB;IAyChC,OAAO,CAAC,aAAa;IAyJrB,OAAO,CAAC,sBAAsB;IAsB9B,OAAO,CAAC,mBAAmB;IAY3B,UAAU,CACR,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,OAAO,EACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,EACzB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,EACtB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,GAC9B,OAAO;IAcV,YAAY,CACV,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,OAAO,EACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,EACzB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,EACtB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,GAC9B,IAAI;IAuBP,QAAQ,IAAI;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;KAAE;IAUnE,OAAO,IAAI,IAAI;CAoBhB"}
@@ -104,7 +104,7 @@ export class ProxyFSAdapterManager {
104
104
  detail: `[ProxyFSAdapterManager] Invalid getAdapter parameters: ${detailMessage}`,
105
105
  });
106
106
  }
107
- const cacheKey = buildProxyManagerCacheKey(projectSlug, effectiveProductionMode, effectiveReleaseId, effectiveBranch);
107
+ const cacheKey = buildProxyManagerCacheKey(projectSlug, effectiveProductionMode, effectiveReleaseId, effectiveBranch, effectiveEnvironmentName);
108
108
  logger.debug("getAdapter called", {
109
109
  projectSlug,
110
110
  productionMode: effectiveProductionMode,
@@ -250,7 +250,7 @@ export class ProxyFSAdapterManager {
250
250
  },
251
251
  invalidationCallbacks: createDefaultInvalidationCallbacks({
252
252
  ...this.baseConfig.invalidationCallbacks,
253
- evictCurrentAdapter: () => this.evictAdapter(projectSlug, productionMode, releaseId, branch),
253
+ evictCurrentAdapter: () => this.evictAdapter(projectSlug, productionMode, releaseId, branch, environmentName),
254
254
  }),
255
255
  };
256
256
  const adapter = new VeryfrontFSAdapter(config);
@@ -374,12 +374,18 @@ export class ProxyFSAdapterManager {
374
374
  this.adapters.delete(cacheKey);
375
375
  }
376
376
  }
377
- hasAdapter(projectSlug, productionMode, releaseId, branch) {
378
- const cacheKey = buildProxyManagerCacheKey(projectSlug, productionMode ?? false, releaseId ?? null, branch ?? null);
377
+ hasAdapter(projectSlug, productionMode, releaseId, branch, environmentName) {
378
+ const effectiveProductionMode = productionMode ?? false;
379
+ const effectiveEnvironmentName = environmentName ??
380
+ (effectiveProductionMode ? "production" : null);
381
+ const cacheKey = buildProxyManagerCacheKey(projectSlug, effectiveProductionMode, releaseId ?? null, branch ?? null, effectiveEnvironmentName);
379
382
  return this.adapters.has(cacheKey);
380
383
  }
381
- evictAdapter(projectSlug, productionMode, releaseId, branch) {
382
- const cacheKey = buildProxyManagerCacheKey(projectSlug, productionMode ?? false, releaseId ?? null, branch ?? null);
384
+ evictAdapter(projectSlug, productionMode, releaseId, branch, environmentName) {
385
+ const effectiveProductionMode = productionMode ?? false;
386
+ const effectiveEnvironmentName = environmentName ??
387
+ (effectiveProductionMode ? "production" : null);
388
+ const cacheKey = buildProxyManagerCacheKey(projectSlug, effectiveProductionMode, releaseId ?? null, branch ?? null, effectiveEnvironmentName);
383
389
  const adapter = this.adapters.get(cacheKey);
384
390
  if (!adapter) {
385
391
  logger.debug("No adapter to evict", { cacheKey });
@@ -22,6 +22,19 @@
22
22
  *
23
23
  * @module
24
24
  */
25
+ /**
26
+ * Stage project-scoped registry mutations and publish them as one synchronous
27
+ * commit after the callback succeeds. Reads inside the callback see staged
28
+ * state; concurrent requests keep seeing the previous live state.
29
+ * The commit is an authoritative replacement, so it linearizes after and may
30
+ * supersede live writes made to the same scope while staging is in progress.
31
+ * Use this for complete discovery generations, not incremental updates.
32
+ *
33
+ * Nested calls participate in the existing transaction. If a nested tenant
34
+ * context changes the registry scope, the first registry access throws rather
35
+ * than committing data into the wrong tenant.
36
+ */
37
+ export declare function runWithRegistryTransaction<T>(fn: () => Promise<T>): Promise<T>;
25
38
  /**
26
39
  * Base class for project-scoped registries.
27
40
  * Provides isolation between projects while allowing
@@ -37,6 +50,10 @@ export declare class ProjectScopedRegistryManager<T> {
37
50
  * Falls back to default for CLI/test scenarios.
38
51
  */
39
52
  private getCurrentScopeId;
53
+ /** Return a transaction-local copy of the target registry when staging. */
54
+ private getTransactionRegistry;
55
+ /** Read the active registry, routing transaction access to its staged copy. */
56
+ private getActiveScopeRegistry;
40
57
  /**
41
58
  * Get or create registry for a specific project.
42
59
  */
@@ -1 +1 @@
1
- {"version":3,"file":"project-scoped-registry-manager.d.ts","sourceRoot":"","sources":["../../../src/src/registry/project-scoped-registry-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAgBH;;;;GAIG;AACH,qBAAa,4BAA4B,CAAC,CAAC;IAI7B,OAAO,CAAC,YAAY;IAHhC,OAAO,CAAC,iBAAiB,CAAqC;IAC9D,OAAO,CAAC,cAAc,CAAwB;gBAE1B,YAAY,EAAE,MAAM;IAExC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAIzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IASxB;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI;IAcnC;;;OAGG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI;IASzC;;;OAGG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAK9B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAKjC;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAMxB;;OAEG;IACH,SAAS,IAAI,MAAM,EAAE;IAOrB;;OAEG;IACH,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAUxB;;OAEG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAU3B;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAcrC;;OAEG;IACH,QAAQ,IAAI,IAAI;IAMhB;;OAEG;IACH,QAAQ,IAAI;QACV,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,mBAAmB,EAAE,MAAM,CAAC;KAC7B;CAeF"}
1
+ {"version":3,"file":"project-scoped-registry-manager.d.ts","sourceRoot":"","sources":["../../../src/src/registry/project-scoped-registry-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AA6BH;;;;;;;;;;;GAWG;AACH,wBAAsB,0BAA0B,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CA4BpF;AAED;;;;GAIG;AACH,qBAAa,4BAA4B,CAAC,CAAC;IAI7B,OAAO,CAAC,YAAY;IAHhC,OAAO,CAAC,iBAAiB,CAAqC;IAC9D,OAAO,CAAC,cAAc,CAAwB;gBAE1B,YAAY,EAAE,MAAM;IAExC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAIzB,2EAA2E;IAC3E,OAAO,CAAC,sBAAsB;IAsC9B,+EAA+E;IAC/E,OAAO,CAAC,sBAAsB;IAI9B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAYxB;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI;IAcnC;;;OAGG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI;IAYzC;;;OAGG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAK9B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAKjC;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAMxB;;OAEG;IACH,SAAS,IAAI,MAAM,EAAE;IAOrB;;OAEG;IACH,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAUxB;;OAEG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAU3B;;OAEG;IACH,KAAK,IAAI,IAAI;IASb;;OAEG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAqBrC;;OAEG;IACH,QAAQ,IAAI,IAAI;IAahB;;OAEG;IACH,QAAQ,IAAI;QACV,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,mBAAmB,EAAE,MAAM,CAAC;KAC7B;CAeF"}
@@ -22,15 +22,58 @@
22
22
  *
23
23
  * @module
24
24
  */
25
- import { tryGetCacheKeyContext } from "../cache/cache-key-builder.js";
25
+ import { tryGetRegistryScopeId } from "../cache/cache-key-builder.js";
26
26
  import { agentLogger } from "../utils/logger/logger.js";
27
+ import { AsyncLocalStorage } from "node:async_hooks";
27
28
  const DEFAULT_SCOPE_ID = "__default__";
29
+ const registryTransactionStorage = new AsyncLocalStorage();
28
30
  function buildRegistryScopeId() {
29
- const cacheContext = tryGetCacheKeyContext();
30
- if (!cacheContext) {
31
- return DEFAULT_SCOPE_ID;
32
- }
33
- return `${cacheContext.projectId}:${cacheContext.mode}:${cacheContext.versionId}`;
31
+ // tryGetRegistryScopeId() returns a project-isolated key even when
32
+ // tryGetCacheKeyContext() would return null (e.g. control-plane runs for an
33
+ // environment source without a pinned releaseId). Without this, all such
34
+ // runs collapse to "__default__", so concurrent projects can overwrite one
35
+ // another's registered primitives.
36
+ return tryGetRegistryScopeId() ?? DEFAULT_SCOPE_ID;
37
+ }
38
+ /**
39
+ * Stage project-scoped registry mutations and publish them as one synchronous
40
+ * commit after the callback succeeds. Reads inside the callback see staged
41
+ * state; concurrent requests keep seeing the previous live state.
42
+ * The commit is an authoritative replacement, so it linearizes after and may
43
+ * supersede live writes made to the same scope while staging is in progress.
44
+ * Use this for complete discovery generations, not incremental updates.
45
+ *
46
+ * Nested calls participate in the existing transaction. If a nested tenant
47
+ * context changes the registry scope, the first registry access throws rather
48
+ * than committing data into the wrong tenant.
49
+ */
50
+ export async function runWithRegistryTransaction(fn) {
51
+ const existing = registryTransactionStorage.getStore();
52
+ if (existing?.state === "active")
53
+ return await fn();
54
+ const transaction = {
55
+ targetScopeId: buildRegistryScopeId(),
56
+ stages: new Map(),
57
+ state: "active",
58
+ };
59
+ return await registryTransactionStorage.run(transaction, async () => {
60
+ try {
61
+ const result = await fn();
62
+ // Map replacement is synchronous. No other request can observe a partial
63
+ // commit between managers in this JavaScript turn.
64
+ for (const stage of transaction.stages.values()) {
65
+ stage.commit();
66
+ }
67
+ transaction.state = "committed";
68
+ transaction.stages.clear();
69
+ return result;
70
+ }
71
+ catch (error) {
72
+ transaction.state = "aborted";
73
+ transaction.stages.clear();
74
+ throw error;
75
+ }
76
+ });
34
77
  }
35
78
  /**
36
79
  * Base class for project-scoped registries.
@@ -51,10 +94,50 @@ export class ProjectScopedRegistryManager {
51
94
  getCurrentScopeId() {
52
95
  return buildRegistryScopeId();
53
96
  }
97
+ /** Return a transaction-local copy of the target registry when staging. */
98
+ getTransactionRegistry(scopeId) {
99
+ const transaction = registryTransactionStorage.getStore();
100
+ if (!transaction)
101
+ return undefined;
102
+ if (transaction.state === "committed")
103
+ return undefined;
104
+ if (transaction.state === "aborted") {
105
+ throw new Error(`[${this.registryName}] Registry transaction already aborted for scope ` +
106
+ `"${transaction.targetScopeId}"`);
107
+ }
108
+ if (scopeId !== transaction.targetScopeId) {
109
+ throw new Error(`[${this.registryName}] Registry scope changed during transaction: ` +
110
+ `expected "${transaction.targetScopeId}", got "${scopeId}"`);
111
+ }
112
+ const existing = transaction.stages.get(this);
113
+ if (existing)
114
+ return existing.registry;
115
+ const registry = new Map(this.registriesByScope.get(scopeId));
116
+ const stage = {
117
+ registry,
118
+ commit: () => {
119
+ if (registry.size === 0) {
120
+ this.registriesByScope.delete(scopeId);
121
+ }
122
+ else {
123
+ this.registriesByScope.set(scopeId, registry);
124
+ }
125
+ },
126
+ };
127
+ transaction.stages.set(this, stage);
128
+ return registry;
129
+ }
130
+ /** Read the active registry, routing transaction access to its staged copy. */
131
+ getActiveScopeRegistry(scopeId) {
132
+ return this.getTransactionRegistry(scopeId) ?? this.registriesByScope.get(scopeId);
133
+ }
54
134
  /**
55
135
  * Get or create registry for a specific project.
56
136
  */
57
137
  getScopeRegistry(scopeId) {
138
+ const staged = this.getTransactionRegistry(scopeId);
139
+ if (staged)
140
+ return staged;
58
141
  const existing = this.registriesByScope.get(scopeId);
59
142
  if (existing)
60
143
  return existing;
@@ -79,6 +162,9 @@ export class ProjectScopedRegistryManager {
79
162
  * Use for framework-provided tools, not user-defined ones.
80
163
  */
81
164
  registerShared(id, item) {
165
+ // Shared framework infrastructure is intentionally process-wide and is
166
+ // published immediately even inside a project transaction. Project
167
+ // discovery must never use this method for tenant-owned definitions.
82
168
  if (this.sharedRegistry.has(id)) {
83
169
  agentLogger.debug(`[${this.registryName}] Shared "${id}" already registered. Overwriting.`);
84
170
  }
@@ -91,7 +177,7 @@ export class ProjectScopedRegistryManager {
91
177
  */
92
178
  get(id) {
93
179
  const scopeId = this.getCurrentScopeId();
94
- return this.registriesByScope.get(scopeId)?.get(id) ?? this.sharedRegistry.get(id);
180
+ return this.getActiveScopeRegistry(scopeId)?.get(id) ?? this.sharedRegistry.get(id);
95
181
  }
96
182
  /**
97
183
  * Get item registered in the current project's own scope, without falling
@@ -101,14 +187,14 @@ export class ProjectScopedRegistryManager {
101
187
  */
102
188
  getOwn(id) {
103
189
  const scopeId = this.getCurrentScopeId();
104
- return this.registriesByScope.get(scopeId)?.get(id);
190
+ return this.getActiveScopeRegistry(scopeId)?.get(id);
105
191
  }
106
192
  /**
107
193
  * Check if item exists for the current project.
108
194
  */
109
195
  has(id) {
110
196
  const scopeId = this.getCurrentScopeId();
111
- return (this.registriesByScope.get(scopeId)?.has(id) ?? false) ||
197
+ return (this.getActiveScopeRegistry(scopeId)?.has(id) ?? false) ||
112
198
  this.sharedRegistry.has(id);
113
199
  }
114
200
  /**
@@ -116,7 +202,7 @@ export class ProjectScopedRegistryManager {
116
202
  */
117
203
  getAllIds() {
118
204
  const scopeId = this.getCurrentScopeId();
119
- const projectIds = this.registriesByScope.get(scopeId)?.keys() ?? [];
205
+ const projectIds = this.getActiveScopeRegistry(scopeId)?.keys() ?? [];
120
206
  const sharedIds = this.sharedRegistry.keys();
121
207
  return Array.from(new Set([...projectIds, ...sharedIds]));
122
208
  }
@@ -125,7 +211,7 @@ export class ProjectScopedRegistryManager {
125
211
  */
126
212
  getAll() {
127
213
  const scopeId = this.getCurrentScopeId();
128
- const projectRegistry = this.registriesByScope.get(scopeId);
214
+ const projectRegistry = this.getActiveScopeRegistry(scopeId);
129
215
  if (!projectRegistry)
130
216
  return new Map(this.sharedRegistry);
131
217
  const result = new Map(this.sharedRegistry);
@@ -138,7 +224,7 @@ export class ProjectScopedRegistryManager {
138
224
  */
139
225
  delete(id) {
140
226
  const scopeId = this.getCurrentScopeId();
141
- const registry = this.registriesByScope.get(scopeId);
227
+ const registry = this.getActiveScopeRegistry(scopeId);
142
228
  if (!registry?.has(id))
143
229
  return false;
144
230
  registry.delete(id);
@@ -149,12 +235,21 @@ export class ProjectScopedRegistryManager {
149
235
  * Clear all items for the current project.
150
236
  */
151
237
  clear() {
238
+ const staged = this.getTransactionRegistry(this.getCurrentScopeId());
239
+ if (staged) {
240
+ staged.clear();
241
+ return;
242
+ }
152
243
  this.clearProject(this.getCurrentScopeId());
153
244
  }
154
245
  /**
155
246
  * Clear a specific project's registry.
156
247
  */
157
248
  clearProject(projectId) {
249
+ const transaction = registryTransactionStorage.getStore();
250
+ if (transaction && transaction.state !== "committed") {
251
+ throw new Error(`[${this.registryName}] clearProject() is not supported during a registry transaction`);
252
+ }
158
253
  let cleared = false;
159
254
  for (const scopeId of Array.from(this.registriesByScope.keys())) {
160
255
  if (scopeId === projectId || scopeId.startsWith(`${projectId}:`)) {
@@ -170,6 +265,10 @@ export class ProjectScopedRegistryManager {
170
265
  * Clear everything (for testing).
171
266
  */
172
267
  clearAll() {
268
+ const transaction = registryTransactionStorage.getStore();
269
+ if (transaction && transaction.state !== "committed") {
270
+ throw new Error(`[${this.registryName}] clearAll() is not supported during a registry transaction`);
271
+ }
173
272
  this.registriesByScope.clear();
174
273
  this.sharedRegistry.clear();
175
274
  agentLogger.debug(`[${this.registryName}] Cleared all registries`);
@@ -185,7 +284,7 @@ export class ProjectScopedRegistryManager {
185
284
  projectCount: this.registriesByScope.size,
186
285
  sharedCount: this.sharedRegistry.size,
187
286
  totalItems,
188
- currentProjectItems: this.registriesByScope.get(scopeId)?.size ?? 0,
287
+ currentProjectItems: this.getActiveScopeRegistry(scopeId)?.size ?? 0,
189
288
  };
190
289
  }
191
290
  }
@@ -1 +1 @@
1
- {"version":3,"file":"project-discovery.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/request/api/project-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAKtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAyHrD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAgF1F"}
1
+ {"version":3,"file":"project-discovery.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/request/api/project-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAMtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAyHrD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAmF1F"}
@@ -1,6 +1,7 @@
1
1
  import { serverLogger } from "../../../../utils/index.js";
2
2
  import { clearTrackedAgents, createProjectDiscoveryConfig } from "../../../../discovery/index.js";
3
- import { tryGetCacheKeyContext } from "../../../../cache/cache-key-builder.js";
3
+ import { tryGetRegistryScopeContext } from "../../../../cache/cache-key-builder.js";
4
+ import { runWithRegistryTransaction } from "../../../../registry/project-scoped-registry-manager.js";
4
5
  import { sanitizeUrlCredentials } from "../../../../utils/logger/redact.js";
5
6
  const logger = serverLogger.component("api-wrapper");
6
7
  const discoveredProjects = new Map();
@@ -61,9 +62,9 @@ function summarizeDiscoveryFailures(errors, projectDir) {
61
62
  }
62
63
  /** Build a discovery cache key that incorporates the release/version. */
63
64
  function discoveryKey(ctx) {
64
- const cacheContext = tryGetCacheKeyContext();
65
- if (cacheContext) {
66
- return `${cacheContext.projectId}:${cacheContext.mode}:${cacheContext.versionId}`;
65
+ const registryScope = tryGetRegistryScopeContext();
66
+ if (registryScope) {
67
+ return registryScope.scopeId;
67
68
  }
68
69
  const slug = ctx.projectSlug ?? ctx.projectDir;
69
70
  const environment = ctx.enriched?.environment ?? ctx.resolvedEnvironment ??
@@ -76,9 +77,9 @@ function discoveryKey(ctx) {
76
77
  return `${slug}:preview:${branch}`;
77
78
  }
78
79
  function shouldCacheCompletedDiscovery(ctx) {
79
- const cacheContext = tryGetCacheKeyContext();
80
- if (cacheContext) {
81
- return cacheContext.mode === "production";
80
+ const registryScope = tryGetRegistryScopeContext();
81
+ if (registryScope) {
82
+ return registryScope.immutable;
82
83
  }
83
84
  const environment = ctx.enriched?.environment ?? ctx.resolvedEnvironment ??
84
85
  (ctx.releaseId ? "production" : "preview");
@@ -101,41 +102,44 @@ export async function ensureProjectDiscovery(ctx) {
101
102
  const { clearTranspileCache, discoverAll } = await import("../../../../discovery/index.js");
102
103
  const { agentRegistry } = await import("../../../../agent/composition/composition.js");
103
104
  const { toolRegistry } = await import("../../../../tool/registry.js");
104
- // Clear stale entries for this project scope before re-discovery.
105
- // This prevents agents/tools removed in a new release from lingering.
106
- clearTrackedAgents();
107
- clearTranspileCache();
108
- agentRegistry.clear();
109
- toolRegistry.clear();
110
- const discoveryOptions = createProjectDiscoveryConfig({
111
- projectDir: ctx.projectDir,
112
- config: ctx.config,
113
- fsAdapter: ctx.adapter.fs,
114
- });
115
- const result = await discoverAll(discoveryOptions);
116
- const shouldWarnOnEmptyAiDiscovery = discoveryOptions.toolDirs.length > 0 ||
117
- discoveryOptions.agentDirs.length > 0;
118
- const logData = {
119
- projectSlug: ctx.projectSlug,
120
- releaseId: ctx.releaseId,
121
- agents: result.agents.size,
122
- tools: result.tools.size,
123
- errors: result.errors.length,
124
- };
125
- if (result.errors.length > 0) {
126
- logger.warn("Primitive discovery completed with errors", {
127
- ...logData,
128
- failures: summarizeDiscoveryFailures(result.errors, ctx.projectDir),
129
- omittedErrors: Math.max(0, result.errors.length - MAX_DISCOVERY_FAILURES_TO_LOG),
105
+ return await runWithRegistryTransaction(async () => {
106
+ // Clear stale entries in a transaction-local copy. Concurrent runs keep
107
+ // using the prior live registry until discovery succeeds and the staged
108
+ // replacement is committed atomically.
109
+ clearTrackedAgents();
110
+ clearTranspileCache();
111
+ agentRegistry.clear();
112
+ toolRegistry.clear();
113
+ const discoveryOptions = createProjectDiscoveryConfig({
114
+ projectDir: ctx.projectDir,
115
+ config: ctx.config,
116
+ fsAdapter: ctx.adapter.fs,
130
117
  });
131
- }
132
- else if (result.agents.size === 0 && result.tools.size === 0 && shouldWarnOnEmptyAiDiscovery) {
133
- logger.info("Primitive discovery found 0 agents and 0 tools", logData);
134
- }
135
- else {
136
- logger.info("Primitive discovery completed", logData);
137
- }
138
- return result;
118
+ const result = await discoverAll(discoveryOptions);
119
+ const shouldWarnOnEmptyAiDiscovery = discoveryOptions.toolDirs.length > 0 ||
120
+ discoveryOptions.agentDirs.length > 0;
121
+ const logData = {
122
+ projectSlug: ctx.projectSlug,
123
+ releaseId: ctx.releaseId,
124
+ agents: result.agents.size,
125
+ tools: result.tools.size,
126
+ errors: result.errors.length,
127
+ };
128
+ if (result.errors.length > 0) {
129
+ logger.warn("Primitive discovery completed with errors", {
130
+ ...logData,
131
+ failures: summarizeDiscoveryFailures(result.errors, ctx.projectDir),
132
+ omittedErrors: Math.max(0, result.errors.length - MAX_DISCOVERY_FAILURES_TO_LOG),
133
+ });
134
+ }
135
+ else if (result.agents.size === 0 && result.tools.size === 0 && shouldWarnOnEmptyAiDiscovery) {
136
+ logger.info("Primitive discovery found 0 agents and 0 tools", logData);
137
+ }
138
+ else {
139
+ logger.info("Primitive discovery completed", logData);
140
+ }
141
+ return result;
142
+ });
139
143
  })(),
140
144
  };
141
145
  discoveredProjects.set(key, discovery);
@@ -1 +1 @@
1
- {"version":3,"file":"remote-mcp.d.ts","sourceRoot":"","sources":["../../../src/src/tool/remote-mcp.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,oBAAoB,EAAE,MAAM,YAAY,CAAC;AASzF,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,oBAAoB,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnF,oDAAoD;AACpD,MAAM,WAAW,yBAAyB;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,eAAe,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;IACnD,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAqbD,qCAAqC;AACrC,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,yBAAyB,GAChC,gBAAgB,CA0FlB"}
1
+ {"version":3,"file":"remote-mcp.d.ts","sourceRoot":"","sources":["../../../src/src/tool/remote-mcp.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,oBAAoB,EAAE,MAAM,YAAY,CAAC;AASzF,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,oBAAoB,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnF,oDAAoD;AACpD,MAAM,WAAW,yBAAyB;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,eAAe,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;IACnD,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAucD,qCAAqC;AACrC,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,yBAAyB,GAChC,gBAAgB,CA0FlB"}
@@ -139,6 +139,18 @@ function normalizeKnownToolError(value, toolName, endpoint, context) {
139
139
  message: `${label} needs to be reconnected before this tool can run.`,
140
140
  };
141
141
  }
142
+ function preserveToolExecutionErrorMarker(value) {
143
+ if (isRecord(value) && !Array.isArray(value)) {
144
+ return hasToolExecutionErrorMarker(value) ? value : { ...value, isError: true };
145
+ }
146
+ return {
147
+ isError: true,
148
+ message: typeof value === "string" && value.trim().length > 0
149
+ ? value
150
+ : "Remote MCP tool returned an error",
151
+ ...(value === undefined ? {} : { output: value }),
152
+ };
153
+ }
142
154
  function isReconnectRequiredToolOutput(value) {
143
155
  return isRecord(value) && value.error === "reconnect_required";
144
156
  }
@@ -296,7 +308,7 @@ function normalizeCallToolResult(input) {
296
308
  const errorBody = "structuredContent" in result
297
309
  ? result.structuredContent
298
310
  : parseJsonText(text) ?? { error: "tool_error", message: text };
299
- return normalizeKnownToolError(errorBody, input.toolName, input.endpoint, input.context);
311
+ return preserveToolExecutionErrorMarker(normalizeKnownToolError(errorBody, input.toolName, input.endpoint, input.context));
300
312
  }
301
313
  if ("structuredContent" in result) {
302
314
  return result.structuredContent;
@@ -305,7 +317,7 @@ function normalizeCallToolResult(input) {
305
317
  }
306
318
  if (isError) {
307
319
  const errorBody = "structuredContent" in result ? result.structuredContent : result;
308
- return normalizeKnownToolError(errorBody, input.toolName, input.endpoint, input.context);
320
+ return preserveToolExecutionErrorMarker(normalizeKnownToolError(errorBody, input.toolName, input.endpoint, input.context));
309
321
  }
310
322
  if ("structuredContent" in result) {
311
323
  return result.structuredContent;
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.1069";
2
+ export declare const VERSION = "0.1.1071";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.1069";
4
+ export const VERSION = "0.1.1071";
@@ -1 +1 @@
1
- {"version":3,"file":"step-executor.d.ts","sourceRoot":"","sources":["../../../../src/src/workflow/executor/step-executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAehD,OAAO,KAAK,EACV,qBAAqB,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 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
- import { runWithCacheKeyContext, } from "../../cache/cache-key-builder.js";
2
+ import { runWithCacheKeyContext, runWithoutCacheKeyContext, } from "../../cache/cache-key-builder.js";
3
+ import { runWithRequestContext } from "../../platform/adapters/fs/veryfront/request-context.js";
3
4
  import { ensureError } from "../../errors/veryfront-error.js";
4
5
  import { isVeryfrontError } from "../../errors/http-error.js";
5
6
  import { AGENT_NOT_FOUND, INITIALIZATION_ERROR, INVALID_ARGUMENT, ORCHESTRATION_ERROR, RESOURCE_NOT_FOUND, TIMEOUT_ERROR, } from "../../errors/error-registry.js";
@@ -22,10 +23,16 @@ export function getWorkflowTenant() {
22
23
  }
23
24
  function cacheKeyContextFromWorkflowTenant(tenant) {
24
25
  const mode = tenant.productionMode ? "production" : "preview";
26
+ // Environment sources are mutable and have no immutable version segment.
27
+ // A synthetic "latest" distributed-cache bucket can mix different source
28
+ // snapshots, so these tenants use request context for registry isolation and
29
+ // deliberately skip distributed caching.
30
+ if (mode === "production" && !tenant.releaseId)
31
+ return null;
25
32
  return {
26
- projectId: tenant.projectId || tenant.projectSlug || "default",
33
+ projectId: tenant.projectId || tenant.projectSlug,
27
34
  mode,
28
- versionId: mode === "production" ? (tenant.releaseId || "latest") : (tenant.branch || "main"),
35
+ versionId: mode === "production" ? tenant.releaseId : (tenant.branch || "main"),
29
36
  };
30
37
  }
31
38
  /**
@@ -35,7 +42,20 @@ function cacheKeyContextFromWorkflowTenant(tenant) {
35
42
  export function runWithWorkflowTenant(tenant, fn) {
36
43
  if (!tenant)
37
44
  return fn();
38
- return workflowTenantStorage.run(tenant, () => runWithCacheKeyContext(cacheKeyContextFromWorkflowTenant(tenant), fn));
45
+ return workflowTenantStorage.run(tenant, () => runWithRequestContext({
46
+ projectSlug: tenant.projectSlug,
47
+ token: tenant.token,
48
+ projectId: tenant.projectId,
49
+ productionMode: tenant.productionMode,
50
+ releaseId: tenant.releaseId,
51
+ branch: tenant.branch,
52
+ environmentName: tenant.environmentName,
53
+ }, () => {
54
+ const cacheContext = cacheKeyContextFromWorkflowTenant(tenant);
55
+ return cacheContext
56
+ ? runWithCacheKeyContext(cacheContext, fn)
57
+ : runWithoutCacheKeyContext(fn);
58
+ }));
39
59
  }
40
60
  /** Default initial delay before first retry attempt */
41
61
  const DEFAULT_RETRY_INITIAL_DELAY_MS = 1_000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.1069",
3
+ "version": "0.1.1071",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
@@ -328,10 +328,10 @@
328
328
  "@types/react": "19.2.14",
329
329
  "@types/react-dom": "19.2.3",
330
330
  "ws": "8.21.0",
331
- "@veryfront/ext-bundler-esbuild": "0.1.1069",
332
- "@veryfront/ext-content-mdx": "0.1.1069",
333
- "@veryfront/ext-css-tailwind": "0.1.1069",
334
- "@veryfront/ext-parser-babel": "0.1.1069"
331
+ "@veryfront/ext-bundler-esbuild": "0.1.1071",
332
+ "@veryfront/ext-content-mdx": "0.1.1071",
333
+ "@veryfront/ext-css-tailwind": "0.1.1071",
334
+ "@veryfront/ext-parser-babel": "0.1.1071"
335
335
  },
336
336
  "devDependencies": {
337
337
  "@types/node": "20.9.0"