@standardagents/builder 0.15.3 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/built-in-routes.js +290 -270
  2. package/dist/built-in-routes.js.map +1 -1
  3. package/dist/client/ApiKeysView.js +1 -1
  4. package/dist/client/CenteredContentView.js +1 -1
  5. package/dist/client/CompositionView.js +1 -1
  6. package/dist/client/ConfirmDialog.vue_vue_type_script_setup_true_lang.js +1 -1
  7. package/dist/client/CopyButton.vue_vue_type_script_setup_true_lang.js +1 -1
  8. package/dist/client/DataTable.vue_vue_type_script_setup_true_lang.js +1 -1
  9. package/dist/client/JsonViewer.js +1 -1
  10. package/dist/client/LoginView.js +1 -1
  11. package/dist/client/Modal.vue_vue_type_script_setup_true_lang.js +1 -1
  12. package/dist/client/ModelModal.vue_vue_type_script_setup_true_lang.js +1 -1
  13. package/dist/client/ModelsView.js +1 -1
  14. package/dist/client/PromptEditView.js +1 -1
  15. package/dist/client/PromptModal.js +1 -1
  16. package/dist/client/PromptsView.js +1 -1
  17. package/dist/client/ProvidersView.js +2 -2
  18. package/dist/client/ThreadInspectorPane.vue_vue_type_script_setup_true_lang.js +1 -1
  19. package/dist/client/ToolsView.js +1 -1
  20. package/dist/client/UsersView.js +1 -1
  21. package/dist/client/VariablesView.js +1 -1
  22. package/dist/client/assets/index.css +1 -1
  23. package/dist/client/index.js +3 -3
  24. package/dist/{discovery-DVviz3By.d.ts → discovery-DiMJWisl.d.ts} +1 -1
  25. package/dist/{index-BwqQtJ4r.d.ts → index-EaxysUHv.d.ts} +2 -5
  26. package/dist/index.d.ts +116 -3402
  27. package/dist/index.js +149 -323
  28. package/dist/index.js.map +1 -1
  29. package/dist/packing.d.ts +3 -3
  30. package/dist/plugin.d.ts +5 -4
  31. package/dist/plugin.js +143 -78
  32. package/dist/plugin.js.map +1 -1
  33. package/dist/runtime.d.ts +3124 -0
  34. package/dist/runtime.js +21178 -0
  35. package/dist/runtime.js.map +1 -0
  36. package/dist/test.d.ts +2 -2
  37. package/dist/{types-DH3Egc5l.d.ts → types-Bpe7IANZ.d.ts} +1 -1
  38. package/package.json +10 -9
@@ -4,10 +4,10 @@ import * as z7 from 'zod/v4/core';
4
4
  import * as z128 from 'zod/v4';
5
5
  import { z as z$1 } from 'zod/v4';
6
6
  import z179, { ZodFirstPartyTypeKind } from 'zod/v3';
7
- import * as fs2 from 'fs';
8
- import fs2__default from 'fs';
9
- import * as path4 from 'path';
10
- import path4__default from 'path';
7
+ import * as fs3 from 'fs';
8
+ import fs3__default from 'fs';
9
+ import * as path5 from 'path';
10
+ import path5__default from 'path';
11
11
  import MagicString from 'magic-string';
12
12
  import { exec } from 'child_process';
13
13
  import { promisify } from 'util';
@@ -9189,7 +9189,7 @@ function runCodeInDynamicWorker(params) {
9189
9189
  durationMs: Date.now() - startedAt,
9190
9190
  error: {
9191
9191
  name: "MissingWorkerLoader",
9192
- message: `ThreadState.runCode requires the ${WORKER_LOADER_BINDING} Worker Loader binding. Run the AgentBuilder scaffold/init step or add worker_loaders to wrangler config.`
9192
+ message: `ThreadState.runCode requires the ${WORKER_LOADER_BINDING} Worker Loader binding. Run the AgentBuilder scaffold/init step or use builder(), which injects the worker_loaders binding.`
9193
9193
  }
9194
9194
  };
9195
9195
  }
@@ -24892,7 +24892,7 @@ async function getBlobStat(file) {
24892
24892
  function sleep(ms) {
24893
24893
  return new Promise((resolvePromise) => setTimeout(resolvePromise, ms));
24894
24894
  }
24895
- var import_p_retry, _defaultBaseGeminiUrl, _defaultBaseVertexUrl, BaseModule, Language, Outcome, FunctionResponseScheduling, Type, Environment, AuthType, HttpElementLocation, ApiSpec, PhishBlockThreshold, Behavior, DynamicRetrievalConfigMode, FunctionCallingConfigMode, ThinkingLevel, PersonGeneration, ProminentPeople, HarmCategory, HarmBlockMethod, HarmBlockThreshold, FinishReason, HarmProbability, HarmSeverity, UrlRetrievalStatus, BlockedReason, TrafficType, Modality, ModelStage, MediaResolution, TuningMode, AdapterSize, JobState, TuningJobState, AggregationMetric, PairwiseChoice, TuningTask, DocumentState, PartMediaResolutionLevel, ToolType, ResourceScope, ServiceTier, FeatureSelectionPreference, EmbeddingApiType, SafetyFilterLevel, ImagePromptLanguage, MaskReferenceMode, ControlReferenceType, SubjectReferenceType, EditMode, SegmentMode, VideoGenerationReferenceType, VideoGenerationMaskMode, VideoCompressionQuality, TuningMethod, FileState, FileSource, TurnCompleteReason, MediaModality, VadSignalType, VoiceActivityType, StartSensitivity, EndSensitivity, ActivityHandling, TurnCoverage, Scale, MusicGenerationMode, LiveMusicPlaybackControl, HttpResponse, GenerateContentResponse, EmbedContentResponse, GenerateImagesResponse, EditImageResponse, UpscaleImageResponse, RecontextImageResponse, SegmentImageResponse, ListModelsResponse, DeleteModelResponse, CountTokensResponse, ComputeTokensResponse, GenerateVideosOperation, ListTuningJobsResponse, CancelTuningJobResponse, DeleteCachedContentResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, UploadToFileSearchStoreResumableResponse, ImportFileOperation, ListFilesResponse, CreateFileResponse, DeleteFileResponse, RegisterFilesResponse, ListBatchJobsResponse, RawReferenceImage, LiveServerMessage, LiveMusicServerMessage, UploadToFileSearchStoreOperation, PagedItem, Pager, Batches, Caches, Chats, Chat, ApiError, Files, CONTENT_TYPE_HEADER, SERVER_TIMEOUT_HEADER, USER_AGENT_HEADER, GOOGLE_API_CLIENT_HEADER, SDK_VERSION, LIBRARY_LABEL, VERTEX_AI_API_DEFAULT_VERSION, GOOGLE_AI_API_DEFAULT_VERSION, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_HTTP_STATUS_CODES, ApiClient, MCP_LABEL, hasMcpToolUsageFromMcpToTool, McpCallableTool, LiveMusic, LiveMusicSession, FUNCTION_RESPONSE_REQUIRES_ID, Live, defaultLiveSendClientContentParamerters, Session, DEFAULT_MAX_REMOTE_CALLS, Models, Operations, Tokens, Documents, FileSearchStores, uuid4Internal, uuid4, castToError, GeminiNextGenAPIClientError, APIError, APIUserAbortError, APIConnectionError, APIConnectionTimeoutError, BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError, startsWithSchemeRegexp, isAbsoluteURL, isArrayInternal, isArray, isReadonlyArrayInternal, isReadonlyArray, validatePositiveInteger, safeJSON, sleep$1, FallbackEncoder, VERSION, checkFileSupport, isAsyncIterable, isBlobLike, isFileLike, isResponseLike, APIResource, EMPTY, createPathTagFunction, path, BaseInteractions, Interactions, encodeUTF8_, decodeUTF8_, LineDecoder, levelNumbers, parseLogLevel, noopLogger, cachedLoggers, formatRequestDetails, Stream, SSEDecoder, APIPromise, brand_privateNullableHeaders, buildHeaders, readEnv, _a, BaseGeminiNextGenAPIClient, GeminiNextGenAPIClient, Tunings, BrowserDownloader, MAX_CHUNK_SIZE, MAX_RETRY_COUNT, INITIAL_RETRY_DELAY_MS, DELAY_MULTIPLIER, X_GOOG_UPLOAD_STATUS_HEADER_FIELD, BrowserUploader, BrowserWebSocketFactory, BrowserWebSocket, GOOGLE_API_KEY_HEADER, WebAuth, LANGUAGE_LABEL_PREFIX, GoogleGenAI;
24895
+ var import_p_retry, _defaultBaseGeminiUrl, _defaultBaseVertexUrl, BaseModule, Language, Outcome, FunctionResponseScheduling, Type, Environment, AuthType, HttpElementLocation, ApiSpec, PhishBlockThreshold, Behavior, DynamicRetrievalConfigMode, FunctionCallingConfigMode, ThinkingLevel, PersonGeneration, ProminentPeople, HarmCategory, HarmBlockMethod, HarmBlockThreshold, FinishReason, HarmProbability, HarmSeverity, UrlRetrievalStatus, BlockedReason, TrafficType, Modality, ModelStage, MediaResolution, TuningMode, AdapterSize, JobState, TuningJobState, AggregationMetric, PairwiseChoice, TuningTask, DocumentState, PartMediaResolutionLevel, ToolType, ResourceScope, ServiceTier, FeatureSelectionPreference, EmbeddingApiType, SafetyFilterLevel, ImagePromptLanguage, MaskReferenceMode, ControlReferenceType, SubjectReferenceType, EditMode, SegmentMode, VideoGenerationReferenceType, VideoGenerationMaskMode, VideoCompressionQuality, TuningMethod, FileState, FileSource, TurnCompleteReason, MediaModality, VadSignalType, VoiceActivityType, StartSensitivity, EndSensitivity, ActivityHandling, TurnCoverage, Scale, MusicGenerationMode, LiveMusicPlaybackControl, HttpResponse, GenerateContentResponse, EmbedContentResponse, GenerateImagesResponse, EditImageResponse, UpscaleImageResponse, RecontextImageResponse, SegmentImageResponse, ListModelsResponse, DeleteModelResponse, CountTokensResponse, ComputeTokensResponse, GenerateVideosOperation, ListTuningJobsResponse, CancelTuningJobResponse, DeleteCachedContentResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, UploadToFileSearchStoreResumableResponse, ImportFileOperation, ListFilesResponse, CreateFileResponse, DeleteFileResponse, RegisterFilesResponse, ListBatchJobsResponse, RawReferenceImage, LiveServerMessage, LiveMusicServerMessage, UploadToFileSearchStoreOperation, PagedItem, Pager, Batches, Caches, Chats, Chat, ApiError, Files, CONTENT_TYPE_HEADER, SERVER_TIMEOUT_HEADER, USER_AGENT_HEADER, GOOGLE_API_CLIENT_HEADER, SDK_VERSION, LIBRARY_LABEL, VERTEX_AI_API_DEFAULT_VERSION, GOOGLE_AI_API_DEFAULT_VERSION, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_HTTP_STATUS_CODES, ApiClient, MCP_LABEL, hasMcpToolUsageFromMcpToTool, McpCallableTool, LiveMusic, LiveMusicSession, FUNCTION_RESPONSE_REQUIRES_ID, Live, defaultLiveSendClientContentParamerters, Session, DEFAULT_MAX_REMOTE_CALLS, Models, Operations, Tokens, Documents, FileSearchStores, uuid4Internal, uuid4, castToError, GeminiNextGenAPIClientError, APIError, APIUserAbortError, APIConnectionError, APIConnectionTimeoutError, BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError, startsWithSchemeRegexp, isAbsoluteURL, isArrayInternal, isArray, isReadonlyArrayInternal, isReadonlyArray, validatePositiveInteger, safeJSON, sleep$1, FallbackEncoder, VERSION, checkFileSupport, isAsyncIterable, isBlobLike, isFileLike, isResponseLike, APIResource, EMPTY, createPathTagFunction, path2, BaseInteractions, Interactions, encodeUTF8_, decodeUTF8_, LineDecoder, levelNumbers, parseLogLevel, noopLogger, cachedLoggers, formatRequestDetails, Stream, SSEDecoder, APIPromise, brand_privateNullableHeaders, buildHeaders, readEnv, _a, BaseGeminiNextGenAPIClient, GeminiNextGenAPIClient, Tunings, BrowserDownloader, MAX_CHUNK_SIZE, MAX_RETRY_COUNT, INITIAL_RETRY_DELAY_MS, DELAY_MULTIPLIER, X_GOOG_UPLOAD_STATUS_HEADER_FIELD, BrowserUploader, BrowserWebSocketFactory, BrowserWebSocket, GOOGLE_API_KEY_HEADER, WebAuth, LANGUAGE_LABEL_PREFIX, GoogleGenAI;
24896
24896
  var init_web = __esm({
24897
24897
  "../../node_modules/.pnpm/@google+genai@1.47.0/node_modules/@google/genai/dist/web/index.mjs"() {
24898
24898
  import_p_retry = __toESM(require_p_retry());
@@ -30434,7 +30434,7 @@ ${underline}`);
30434
30434
  }
30435
30435
  return path10;
30436
30436
  });
30437
- path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
30437
+ path2 = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
30438
30438
  BaseInteractions = class extends APIResource {
30439
30439
  create(params, options) {
30440
30440
  var _a16;
@@ -30445,7 +30445,7 @@ ${underline}`);
30445
30445
  if ("agent" in body && "generation_config" in body) {
30446
30446
  throw new GeminiNextGenAPIClientError(`Invalid request: specified \`agent\` and \`generation_config\`. If specifying \`agent\`, use \`agent_config\`.`);
30447
30447
  }
30448
- return this._client.post(path`/${api_version}/interactions`, Object.assign(Object.assign({ body }, options), { stream: (_a16 = params.stream) !== null && _a16 !== void 0 ? _a16 : false }));
30448
+ return this._client.post(path2`/${api_version}/interactions`, Object.assign(Object.assign({ body }, options), { stream: (_a16 = params.stream) !== null && _a16 !== void 0 ? _a16 : false }));
30449
30449
  }
30450
30450
  /**
30451
30451
  * Deletes the interaction by id.
@@ -30459,7 +30459,7 @@ ${underline}`);
30459
30459
  */
30460
30460
  delete(id, params = {}, options) {
30461
30461
  const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
30462
- return this._client.delete(path`/${api_version}/interactions/${id}`, options);
30462
+ return this._client.delete(path2`/${api_version}/interactions/${id}`, options);
30463
30463
  }
30464
30464
  /**
30465
30465
  * Cancels an interaction by id. This only applies to background interactions that are still running.
@@ -30473,12 +30473,12 @@ ${underline}`);
30473
30473
  */
30474
30474
  cancel(id, params = {}, options) {
30475
30475
  const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
30476
- return this._client.post(path`/${api_version}/interactions/${id}/cancel`, options);
30476
+ return this._client.post(path2`/${api_version}/interactions/${id}/cancel`, options);
30477
30477
  }
30478
30478
  get(id, params = {}, options) {
30479
30479
  var _a16;
30480
30480
  const _b16 = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _b16, query = __rest(_b16, ["api_version"]);
30481
- return this._client.get(path`/${api_version}/interactions/${id}`, Object.assign(Object.assign({ query }, options), { stream: (_a16 = params === null || params === void 0 ? void 0 : params.stream) !== null && _a16 !== void 0 ? _a16 : false }));
30481
+ return this._client.get(path2`/${api_version}/interactions/${id}`, Object.assign(Object.assign({ query }, options), { stream: (_a16 = params === null || params === void 0 ? void 0 : params.stream) !== null && _a16 !== void 0 ? _a16 : false }));
30482
30482
  }
30483
30483
  };
30484
30484
  BaseInteractions._key = Object.freeze(["interactions"]);
@@ -33811,7 +33811,7 @@ var init_audio = __esm({
33811
33811
  function encodeURIPath2(str) {
33812
33812
  return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
33813
33813
  }
33814
- var EMPTY2, createPathTagFunction2, path2;
33814
+ var EMPTY2, createPathTagFunction2, path3;
33815
33815
  var init_path = __esm({
33816
33816
  "../../node_modules/.pnpm/groq-sdk@1.1.2/node_modules/groq-sdk/internal/utils/path.mjs"() {
33817
33817
  init_error();
@@ -33864,7 +33864,7 @@ ${underline}`);
33864
33864
  }
33865
33865
  return path10;
33866
33866
  };
33867
- path2 = /* @__PURE__ */ createPathTagFunction2(encodeURIPath2);
33867
+ path3 = /* @__PURE__ */ createPathTagFunction2(encodeURIPath2);
33868
33868
  }
33869
33869
  });
33870
33870
 
@@ -33886,7 +33886,7 @@ var init_batches = __esm({
33886
33886
  * Retrieves a batch.
33887
33887
  */
33888
33888
  retrieve(batchID, options) {
33889
- return this._client.get(path2`/openai/v1/batches/${batchID}`, options);
33889
+ return this._client.get(path3`/openai/v1/batches/${batchID}`, options);
33890
33890
  }
33891
33891
  /**
33892
33892
  * List your organization's batches.
@@ -33898,7 +33898,7 @@ var init_batches = __esm({
33898
33898
  * Cancels a batch.
33899
33899
  */
33900
33900
  cancel(batchID, options) {
33901
- return this._client.post(path2`/openai/v1/batches/${batchID}/cancel`, options);
33901
+ return this._client.post(path3`/openai/v1/batches/${batchID}/cancel`, options);
33902
33902
  }
33903
33903
  };
33904
33904
  }
@@ -34003,13 +34003,13 @@ var init_files2 = __esm({
34003
34003
  * Delete a file.
34004
34004
  */
34005
34005
  delete(fileID, options) {
34006
- return this._client.delete(path2`/openai/v1/files/${fileID}`, options);
34006
+ return this._client.delete(path3`/openai/v1/files/${fileID}`, options);
34007
34007
  }
34008
34008
  /**
34009
34009
  * Returns the contents of the specified file.
34010
34010
  */
34011
34011
  content(fileID, options) {
34012
- return this._client.get(path2`/openai/v1/files/${fileID}/content`, {
34012
+ return this._client.get(path3`/openai/v1/files/${fileID}/content`, {
34013
34013
  ...options,
34014
34014
  headers: buildHeaders2([{ Accept: "application/octet-stream" }, options?.headers]),
34015
34015
  __binaryResponse: true
@@ -34019,7 +34019,7 @@ var init_files2 = __esm({
34019
34019
  * Returns information about a file.
34020
34020
  */
34021
34021
  info(fileID, options) {
34022
- return this._client.get(path2`/openai/v1/files/${fileID}`, options);
34022
+ return this._client.get(path3`/openai/v1/files/${fileID}`, options);
34023
34023
  }
34024
34024
  };
34025
34025
  }
@@ -34036,7 +34036,7 @@ var init_models = __esm({
34036
34036
  * Get a specific model
34037
34037
  */
34038
34038
  retrieve(model, options) {
34039
- return this._client.get(path2`/openai/v1/models/${model}`, options);
34039
+ return this._client.get(path3`/openai/v1/models/${model}`, options);
34040
34040
  }
34041
34041
  /**
34042
34042
  * get all available models
@@ -34048,7 +34048,7 @@ var init_models = __esm({
34048
34048
  * Delete a model
34049
34049
  */
34050
34050
  delete(model, options) {
34051
- return this._client.delete(path2`/openai/v1/models/${model}`, options);
34051
+ return this._client.delete(path3`/openai/v1/models/${model}`, options);
34052
34052
  }
34053
34053
  };
34054
34054
  }
@@ -58422,7 +58422,7 @@ var init_metadata_service = __esm({
58422
58422
  * @param agentsDir - Path to the agents/ directory
58423
58423
  */
58424
58424
  constructor(agentsDir) {
58425
- this.metadataDir = path4.join(agentsDir, ".standardagent");
58425
+ this.metadataDir = path5.join(agentsDir, ".standardagent");
58426
58426
  }
58427
58427
  /**
58428
58428
  * Read metadata for an agent.
@@ -58432,11 +58432,11 @@ var init_metadata_service = __esm({
58432
58432
  */
58433
58433
  async read(agentName) {
58434
58434
  const filePath = this.getMetadataPath(agentName);
58435
- if (!fs2.existsSync(filePath)) {
58435
+ if (!fs3.existsSync(filePath)) {
58436
58436
  return null;
58437
58437
  }
58438
58438
  try {
58439
- const content = fs2.readFileSync(filePath, "utf-8");
58439
+ const content = fs3.readFileSync(filePath, "utf-8");
58440
58440
  return JSON.parse(content);
58441
58441
  } catch {
58442
58442
  return null;
@@ -58449,11 +58449,11 @@ var init_metadata_service = __esm({
58449
58449
  * @param metadata - Metadata to write
58450
58450
  */
58451
58451
  async write(agentName, metadata) {
58452
- if (!fs2.existsSync(this.metadataDir)) {
58453
- fs2.mkdirSync(this.metadataDir, { recursive: true });
58452
+ if (!fs3.existsSync(this.metadataDir)) {
58453
+ fs3.mkdirSync(this.metadataDir, { recursive: true });
58454
58454
  }
58455
58455
  const filePath = this.getMetadataPath(agentName);
58456
- fs2.writeFileSync(filePath, JSON.stringify(metadata, null, 2));
58456
+ fs3.writeFileSync(filePath, JSON.stringify(metadata, null, 2));
58457
58457
  }
58458
58458
  /**
58459
58459
  * Delete metadata for an agent.
@@ -58462,8 +58462,8 @@ var init_metadata_service = __esm({
58462
58462
  */
58463
58463
  async delete(agentName) {
58464
58464
  const filePath = this.getMetadataPath(agentName);
58465
- if (fs2.existsSync(filePath)) {
58466
- fs2.unlinkSync(filePath);
58465
+ if (fs3.existsSync(filePath)) {
58466
+ fs3.unlinkSync(filePath);
58467
58467
  }
58468
58468
  }
58469
58469
  /**
@@ -58544,7 +58544,7 @@ var init_metadata_service = __esm({
58544
58544
  * Get the file path for an agent's metadata.
58545
58545
  */
58546
58546
  getMetadataPath(agentName) {
58547
- return path4.join(this.metadataDir, `${agentName}.json`);
58547
+ return path5.join(this.metadataDir, `${agentName}.json`);
58548
58548
  }
58549
58549
  };
58550
58550
  }
@@ -58931,9 +58931,9 @@ var init_packing_service = __esm({
58931
58931
  * @returns Version specifier (e.g., '^1.2.3') or '*' if not found
58932
58932
  */
58933
58933
  resolvePackageVersion(pkgName, rootDir) {
58934
- const pkgJsonPath = path4.join(rootDir, "node_modules", pkgName, "package.json");
58934
+ const pkgJsonPath = path5.join(rootDir, "node_modules", pkgName, "package.json");
58935
58935
  try {
58936
- const pkgJson = JSON.parse(fs2.readFileSync(pkgJsonPath, "utf-8"));
58936
+ const pkgJson = JSON.parse(fs3.readFileSync(pkgJsonPath, "utf-8"));
58937
58937
  return `^${pkgJson.version}`;
58938
58938
  } catch {
58939
58939
  return "*";
@@ -58950,7 +58950,7 @@ var init_packing_service = __esm({
58950
58950
  * @returns Analysis result with all discovered constituents
58951
58951
  */
58952
58952
  async analyzeAgent(agentName, rootDir) {
58953
- const agentsDir = path4.join(rootDir, "agents");
58953
+ const agentsDir = path5.join(rootDir, "agents");
58954
58954
  const analysis = {
58955
58955
  agent: agentName,
58956
58956
  primaryPrompt: "",
@@ -58974,7 +58974,7 @@ var init_packing_service = __esm({
58974
58974
  warnings: [],
58975
58975
  errors: []
58976
58976
  };
58977
- const agentFilePath = await this.findFile(path4.join(agentsDir, "agents"), agentName);
58977
+ const agentFilePath = await this.findFile(path5.join(agentsDir, "agents"), agentName);
58978
58978
  if (!agentFilePath) {
58979
58979
  analysis.errors.push(`Agent file not found: ${agentName}`);
58980
58980
  return analysis;
@@ -58985,7 +58985,7 @@ var init_packing_service = __esm({
58985
58985
  discoveredVia: "static",
58986
58986
  sharedWith: []
58987
58987
  });
58988
- const agentSource = fs2.readFileSync(agentFilePath, "utf-8");
58988
+ const agentSource = fs3.readFileSync(agentFilePath, "utf-8");
58989
58989
  const agentPrompts = await extractAgentPrompts(agentSource);
58990
58990
  if (agentPrompts.sideA) {
58991
58991
  analysis.primaryPrompt = agentPrompts.sideA;
@@ -59010,13 +59010,13 @@ var init_packing_service = __esm({
59010
59010
  * @returns Object with generatedReadme and agentDescription
59011
59011
  */
59012
59012
  async generateReadmeForAnalysis(analysis, rootDir) {
59013
- const agentsDir = path4.join(rootDir, "agents");
59013
+ const agentsDir = path5.join(rootDir, "agents");
59014
59014
  const metadataService = new MetadataService(agentsDir);
59015
59015
  let agentDescription;
59016
59016
  const agentItem = analysis.constituents.agents.find((a) => a.name === analysis.agent);
59017
59017
  if (agentItem?.filePath) {
59018
59018
  try {
59019
- const agentSource = fs2.readFileSync(agentItem.filePath, "utf-8");
59019
+ const agentSource = fs3.readFileSync(agentItem.filePath, "utf-8");
59020
59020
  agentDescription = await extractAgentDescription(agentSource) || void 0;
59021
59021
  } catch {
59022
59022
  }
@@ -59040,7 +59040,7 @@ var init_packing_service = __esm({
59040
59040
  * include all endpoint modules discovered under agents/api.
59041
59041
  */
59042
59042
  async analyzeThreadEndpoints(agentsDir, analysis) {
59043
- const apiDir = path4.join(agentsDir, "api");
59043
+ const apiDir = path5.join(agentsDir, "api");
59044
59044
  const endpoints = this.scanThreadEndpointFiles(apiDir);
59045
59045
  for (const endpoint of endpoints) {
59046
59046
  if (analysis.constituents.threadEndpoints.some((item) => item.name === endpoint.name)) {
@@ -59062,15 +59062,15 @@ var init_packing_service = __esm({
59062
59062
  * - `admin/users/[userId]/sync.post`
59063
59063
  */
59064
59064
  scanThreadEndpointFiles(apiDir, relativeDir = "") {
59065
- if (!fs2.existsSync(apiDir)) {
59065
+ if (!fs3.existsSync(apiDir)) {
59066
59066
  return [];
59067
59067
  }
59068
59068
  const endpoints = [];
59069
- const currentDir = relativeDir ? path4.join(apiDir, relativeDir) : apiDir;
59070
- if (!fs2.existsSync(currentDir)) {
59069
+ const currentDir = relativeDir ? path5.join(apiDir, relativeDir) : apiDir;
59070
+ if (!fs3.existsSync(currentDir)) {
59071
59071
  return endpoints;
59072
59072
  }
59073
- const entries = fs2.readdirSync(currentDir, { withFileTypes: true });
59073
+ const entries = fs3.readdirSync(currentDir, { withFileTypes: true });
59074
59074
  if (entries.length > 0 && typeof entries[0] === "string") {
59075
59075
  return endpoints;
59076
59076
  }
@@ -59078,8 +59078,8 @@ var init_packing_service = __esm({
59078
59078
  const entryName = typeof entry === "string" ? entry : entry.name;
59079
59079
  const isDirectory = typeof entry === "string" ? false : entry.isDirectory();
59080
59080
  const isFile = typeof entry === "string" ? true : entry.isFile();
59081
- const entryRelative = relativeDir ? path4.posix.join(relativeDir.replace(/\\/g, "/"), entryName) : entryName;
59082
- const absolutePath = path4.join(apiDir, entryRelative);
59081
+ const entryRelative = relativeDir ? path5.posix.join(relativeDir.replace(/\\/g, "/"), entryName) : entryName;
59082
+ const absolutePath = path5.join(apiDir, entryRelative);
59083
59083
  if (isDirectory) {
59084
59084
  endpoints.push(...this.scanThreadEndpointFiles(apiDir, entryRelative));
59085
59085
  continue;
@@ -59106,7 +59106,7 @@ var init_packing_service = __esm({
59106
59106
  * include all effect modules discovered under agents/effects.
59107
59107
  */
59108
59108
  async analyzeEffects(agentsDir, analysis) {
59109
- const effectsDir = path4.join(agentsDir, "effects");
59109
+ const effectsDir = path5.join(agentsDir, "effects");
59110
59110
  const effects = this.scanEffectFiles(effectsDir);
59111
59111
  for (const effect of effects) {
59112
59112
  if (analysis.constituents.effects.some((item) => item.name === effect.name)) {
@@ -59128,15 +59128,15 @@ var init_packing_service = __esm({
59128
59128
  * - `notifications/digest`
59129
59129
  */
59130
59130
  scanEffectFiles(effectsDir, relativeDir = "") {
59131
- if (!fs2.existsSync(effectsDir)) {
59131
+ if (!fs3.existsSync(effectsDir)) {
59132
59132
  return [];
59133
59133
  }
59134
59134
  const effects = [];
59135
- const currentDir = relativeDir ? path4.join(effectsDir, relativeDir) : effectsDir;
59136
- if (!fs2.existsSync(currentDir)) {
59135
+ const currentDir = relativeDir ? path5.join(effectsDir, relativeDir) : effectsDir;
59136
+ if (!fs3.existsSync(currentDir)) {
59137
59137
  return effects;
59138
59138
  }
59139
- const entries = fs2.readdirSync(currentDir, { withFileTypes: true });
59139
+ const entries = fs3.readdirSync(currentDir, { withFileTypes: true });
59140
59140
  if (entries.length > 0 && typeof entries[0] === "string") {
59141
59141
  return effects;
59142
59142
  }
@@ -59144,8 +59144,8 @@ var init_packing_service = __esm({
59144
59144
  const entryName = typeof entry === "string" ? entry : entry.name;
59145
59145
  const isDirectory = typeof entry === "string" ? false : entry.isDirectory();
59146
59146
  const isFile = typeof entry === "string" ? true : entry.isFile();
59147
- const entryRelative = relativeDir ? path4.posix.join(relativeDir.replace(/\\/g, "/"), entryName) : entryName;
59148
- const absolutePath = path4.join(effectsDir, entryRelative);
59147
+ const entryRelative = relativeDir ? path5.posix.join(relativeDir.replace(/\\/g, "/"), entryName) : entryName;
59148
+ const absolutePath = path5.join(effectsDir, entryRelative);
59149
59149
  if (isDirectory) {
59150
59150
  effects.push(...this.scanEffectFiles(effectsDir, entryRelative));
59151
59151
  continue;
@@ -59169,7 +59169,7 @@ var init_packing_service = __esm({
59169
59169
  * Recursively analyze a prompt and its dependencies.
59170
59170
  */
59171
59171
  async analyzePrompt(promptName, agentsDir, analysis, visited, parentKey) {
59172
- const promptFilePath = await this.findFile(path4.join(agentsDir, "prompts"), promptName);
59172
+ const promptFilePath = await this.findFile(path5.join(agentsDir, "prompts"), promptName);
59173
59173
  if (!promptFilePath) {
59174
59174
  analysis.warnings.push(`Prompt file not found: ${promptName}`);
59175
59175
  return;
@@ -59188,7 +59188,7 @@ var init_packing_service = __esm({
59188
59188
  return;
59189
59189
  }
59190
59190
  visited.add(`prompt:${promptName}`);
59191
- const promptSource = fs2.readFileSync(promptFilePath, "utf-8");
59191
+ const promptSource = fs3.readFileSync(promptFilePath, "utf-8");
59192
59192
  const modelName = await extractPromptModel(promptSource);
59193
59193
  if (modelName) {
59194
59194
  await this.analyzeModel(modelName, agentsDir, analysis, visited, thisKey);
@@ -59214,17 +59214,17 @@ var init_packing_service = __esm({
59214
59214
  */
59215
59215
  async analyzeTool(toolName, agentsDir, analysis, visited, discoveredVia, parentKey) {
59216
59216
  const thisKey = `tool:${toolName}`;
59217
- const promptFilePath = await this.findFile(path4.join(agentsDir, "prompts"), toolName);
59217
+ const promptFilePath = await this.findFile(path5.join(agentsDir, "prompts"), toolName);
59218
59218
  if (promptFilePath) {
59219
59219
  await this.analyzePrompt(toolName, agentsDir, analysis, visited, parentKey);
59220
59220
  return;
59221
59221
  }
59222
- const agentFilePath = await this.findFile(path4.join(agentsDir, "agents"), toolName);
59222
+ const agentFilePath = await this.findFile(path5.join(agentsDir, "agents"), toolName);
59223
59223
  if (agentFilePath) {
59224
59224
  await this.analyzeNestedAgent(toolName, agentsDir, analysis, visited, parentKey);
59225
59225
  return;
59226
59226
  }
59227
- const toolFilePath = await this.findFile(path4.join(agentsDir, "tools"), toolName);
59227
+ const toolFilePath = await this.findFile(path5.join(agentsDir, "tools"), toolName);
59228
59228
  if (!toolFilePath) {
59229
59229
  analysis.warnings.push(`Tool file not found: ${toolName}`);
59230
59230
  return;
@@ -59242,7 +59242,7 @@ var init_packing_service = __esm({
59242
59242
  return;
59243
59243
  }
59244
59244
  visited.add(`tool:${toolName}`);
59245
- const toolSource = fs2.readFileSync(toolFilePath, "utf-8");
59245
+ const toolSource = fs3.readFileSync(toolFilePath, "utf-8");
59246
59246
  const { uses } = await extractToolUses(toolSource);
59247
59247
  for (const usedItem of uses) {
59248
59248
  await this.analyzeTool(usedItem, agentsDir, analysis, visited, "uses", thisKey);
@@ -59252,7 +59252,7 @@ var init_packing_service = __esm({
59252
59252
  * Analyze a nested agent (used as a handoff target).
59253
59253
  */
59254
59254
  async analyzeNestedAgent(agentName, agentsDir, analysis, visited, parentKey) {
59255
- const agentFilePath = await this.findFile(path4.join(agentsDir, "agents"), agentName);
59255
+ const agentFilePath = await this.findFile(path5.join(agentsDir, "agents"), agentName);
59256
59256
  if (!agentFilePath) {
59257
59257
  analysis.warnings.push(`Agent file not found: ${agentName}`);
59258
59258
  return;
@@ -59271,7 +59271,7 @@ var init_packing_service = __esm({
59271
59271
  return;
59272
59272
  }
59273
59273
  visited.add(`agent:${agentName}`);
59274
- const agentSource = fs2.readFileSync(agentFilePath, "utf-8");
59274
+ const agentSource = fs3.readFileSync(agentFilePath, "utf-8");
59275
59275
  const agentPrompts = await extractAgentPrompts(agentSource);
59276
59276
  if (agentPrompts.sideA) {
59277
59277
  await this.analyzePrompt(agentPrompts.sideA, agentsDir, analysis, visited, thisKey);
@@ -59284,7 +59284,7 @@ var init_packing_service = __esm({
59284
59284
  * Analyze a model and its fallbacks.
59285
59285
  */
59286
59286
  async analyzeModel(modelName, agentsDir, analysis, visited, parentKey) {
59287
- const modelFilePath = await this.findFile(path4.join(agentsDir, "models"), modelName);
59287
+ const modelFilePath = await this.findFile(path5.join(agentsDir, "models"), modelName);
59288
59288
  if (!modelFilePath) {
59289
59289
  analysis.warnings.push(`Model file not found: ${modelName}`);
59290
59290
  return;
@@ -59303,7 +59303,7 @@ var init_packing_service = __esm({
59303
59303
  return;
59304
59304
  }
59305
59305
  visited.add(`model:${modelName}`);
59306
- const modelSource = fs2.readFileSync(modelFilePath, "utf-8");
59306
+ const modelSource = fs3.readFileSync(modelFilePath, "utf-8");
59307
59307
  const fallbacks = await extractModelFallbacks(modelSource);
59308
59308
  for (const fallbackName of fallbacks) {
59309
59309
  await this.analyzeModel(fallbackName, agentsDir, analysis, visited, thisKey);
@@ -59313,13 +59313,13 @@ var init_packing_service = __esm({
59313
59313
  * Check which items are shared with other agents.
59314
59314
  */
59315
59315
  async checkSharedItems(agentsDir, analysis) {
59316
- const agentsPath = path4.join(agentsDir, "agents");
59317
- if (!fs2.existsSync(agentsPath)) return;
59318
- const agentFiles = fs2.readdirSync(agentsPath).filter((f) => f.endsWith(".ts"));
59316
+ const agentsPath = path5.join(agentsDir, "agents");
59317
+ if (!fs3.existsSync(agentsPath)) return;
59318
+ const agentFiles = fs3.readdirSync(agentsPath).filter((f) => f.endsWith(".ts"));
59319
59319
  for (const agentFile of agentFiles) {
59320
59320
  const otherAgentName = agentFile.replace(".ts", "");
59321
59321
  if (otherAgentName === analysis.agent) continue;
59322
- const otherAnalysis = await this.analyzeAgentLight(otherAgentName, path4.dirname(agentsDir));
59322
+ const otherAnalysis = await this.analyzeAgentLight(otherAgentName, path5.dirname(agentsDir));
59323
59323
  for (const prompt of analysis.constituents.prompts) {
59324
59324
  if (otherAnalysis.prompts.includes(prompt.name)) {
59325
59325
  prompt.sharedWith.push(otherAgentName);
@@ -59351,19 +59351,19 @@ var init_packing_service = __esm({
59351
59351
  */
59352
59352
  async analyzeAgentLight(agentName, rootDir) {
59353
59353
  const result = { prompts: [], tools: [], models: [] };
59354
- const agentsDir = path4.join(rootDir, "agents");
59354
+ const agentsDir = path5.join(rootDir, "agents");
59355
59355
  const visited = /* @__PURE__ */ new Set();
59356
- const agentFilePath = await this.findFile(path4.join(agentsDir, "agents"), agentName);
59356
+ const agentFilePath = await this.findFile(path5.join(agentsDir, "agents"), agentName);
59357
59357
  if (!agentFilePath) return result;
59358
- const agentSource = fs2.readFileSync(agentFilePath, "utf-8");
59358
+ const agentSource = fs3.readFileSync(agentFilePath, "utf-8");
59359
59359
  const agentPrompts = await extractAgentPrompts(agentSource);
59360
59360
  const analyzePromptLight = async (promptName) => {
59361
59361
  if (visited.has(promptName)) return;
59362
59362
  visited.add(promptName);
59363
59363
  result.prompts.push(promptName);
59364
- const promptFilePath = await this.findFile(path4.join(agentsDir, "prompts"), promptName);
59364
+ const promptFilePath = await this.findFile(path5.join(agentsDir, "prompts"), promptName);
59365
59365
  if (!promptFilePath) return;
59366
- const promptSource = fs2.readFileSync(promptFilePath, "utf-8");
59366
+ const promptSource = fs3.readFileSync(promptFilePath, "utf-8");
59367
59367
  const modelName = await extractPromptModel(promptSource);
59368
59368
  if (modelName && !result.models.includes(modelName)) {
59369
59369
  result.models.push(modelName);
@@ -59436,14 +59436,14 @@ var init_packing_service = __esm({
59436
59436
  return result;
59437
59437
  }
59438
59438
  result.warnings = analysis.warnings;
59439
- const pkgOutputDir = path4.join(outputDir, packageId);
59440
- fs2.mkdirSync(path4.join(pkgOutputDir, "dist", "agents"), { recursive: true });
59441
- fs2.mkdirSync(path4.join(pkgOutputDir, "dist", "prompts"), { recursive: true });
59442
- fs2.mkdirSync(path4.join(pkgOutputDir, "dist", "tools"), { recursive: true });
59443
- fs2.mkdirSync(path4.join(pkgOutputDir, "dist", "models"), { recursive: true });
59444
- fs2.mkdirSync(path4.join(pkgOutputDir, "dist", "hooks"), { recursive: true });
59445
- fs2.mkdirSync(path4.join(pkgOutputDir, "dist", "effects"), { recursive: true });
59446
- fs2.mkdirSync(path4.join(pkgOutputDir, "dist", "thread-endpoints"), { recursive: true });
59439
+ const pkgOutputDir = path5.join(outputDir, packageId);
59440
+ fs3.mkdirSync(path5.join(pkgOutputDir, "dist", "agents"), { recursive: true });
59441
+ fs3.mkdirSync(path5.join(pkgOutputDir, "dist", "prompts"), { recursive: true });
59442
+ fs3.mkdirSync(path5.join(pkgOutputDir, "dist", "tools"), { recursive: true });
59443
+ fs3.mkdirSync(path5.join(pkgOutputDir, "dist", "models"), { recursive: true });
59444
+ fs3.mkdirSync(path5.join(pkgOutputDir, "dist", "hooks"), { recursive: true });
59445
+ fs3.mkdirSync(path5.join(pkgOutputDir, "dist", "effects"), { recursive: true });
59446
+ fs3.mkdirSync(path5.join(pkgOutputDir, "dist", "thread-endpoints"), { recursive: true });
59447
59447
  const seenItems = /* @__PURE__ */ new Set();
59448
59448
  const allItems = [];
59449
59449
  for (const a of analysis.constituents.agents) {
@@ -59497,13 +59497,13 @@ var init_packing_service = __esm({
59497
59497
  }
59498
59498
  const externalDeps = /* @__PURE__ */ new Map();
59499
59499
  for (const item of allItems) {
59500
- const outputPath = path4.join(
59500
+ const outputPath = path5.join(
59501
59501
  pkgOutputDir,
59502
59502
  "dist",
59503
59503
  this.getTypeDir(item.type),
59504
59504
  `${item.name}.js`
59505
59505
  );
59506
- fs2.mkdirSync(path4.dirname(outputPath), { recursive: true });
59506
+ fs3.mkdirSync(path5.dirname(outputPath), { recursive: true });
59507
59507
  const deps = await this.bundleFile(item.filePath, outputPath, rootDir);
59508
59508
  for (const [depName, depVersion] of deps) {
59509
59509
  if (!externalDeps.has(depName)) {
@@ -59513,12 +59513,12 @@ var init_packing_service = __esm({
59513
59513
  result.filesCreated.push(outputPath);
59514
59514
  }
59515
59515
  const indexJs = this.generateReExportIndex(analysis, meta);
59516
- const indexJsPath = path4.join(pkgOutputDir, "dist", "index.js");
59517
- fs2.writeFileSync(indexJsPath, indexJs);
59516
+ const indexJsPath = path5.join(pkgOutputDir, "dist", "index.js");
59517
+ fs3.writeFileSync(indexJsPath, indexJs);
59518
59518
  result.filesCreated.push(indexJsPath);
59519
59519
  const indexDts = this.generateIndexDts(analysis);
59520
- const indexDtsPath = path4.join(pkgOutputDir, "dist", "index.d.ts");
59521
- fs2.writeFileSync(indexDtsPath, indexDts);
59520
+ const indexDtsPath = path5.join(pkgOutputDir, "dist", "index.d.ts");
59521
+ fs3.writeFileSync(indexDtsPath, indexDts);
59522
59522
  result.filesCreated.push(indexDtsPath);
59523
59523
  const pkgJson = this.generatePackageJson(
59524
59524
  finalPackageName,
@@ -59531,13 +59531,13 @@ var init_packing_service = __esm({
59531
59531
  license,
59532
59532
  licenseOwner
59533
59533
  );
59534
- const pkgJsonPath = path4.join(pkgOutputDir, "package.json");
59535
- fs2.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
59534
+ const pkgJsonPath = path5.join(pkgOutputDir, "package.json");
59535
+ fs3.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
59536
59536
  result.filesCreated.push(pkgJsonPath);
59537
59537
  if (license) {
59538
59538
  const licenseContent = this.generateLicenseFile(license, licenseOwner);
59539
- const licensePath = path4.join(pkgOutputDir, "LICENSE");
59540
- fs2.writeFileSync(licensePath, licenseContent);
59539
+ const licensePath = path5.join(pkgOutputDir, "LICENSE");
59540
+ fs3.writeFileSync(licensePath, licenseContent);
59541
59541
  result.filesCreated.push(licensePath);
59542
59542
  }
59543
59543
  let readmeContent = readme;
@@ -59545,7 +59545,7 @@ var init_packing_service = __esm({
59545
59545
  const agentItem = analysis.constituents.agents.find((a) => a.name === agentName);
59546
59546
  let agentDescription;
59547
59547
  if (agentItem?.filePath) {
59548
- const agentSource = fs2.readFileSync(agentItem.filePath, "utf-8");
59548
+ const agentSource = fs3.readFileSync(agentItem.filePath, "utf-8");
59549
59549
  agentDescription = await extractAgentDescription(agentSource) || void 0;
59550
59550
  }
59551
59551
  readmeContent = this.generateReadme(
@@ -59556,21 +59556,21 @@ var init_packing_service = __esm({
59556
59556
  agentDescription
59557
59557
  );
59558
59558
  }
59559
- const readmePath = path4.join(pkgOutputDir, "README.md");
59560
- fs2.writeFileSync(readmePath, readmeContent);
59559
+ const readmePath = path5.join(pkgOutputDir, "README.md");
59560
+ fs3.writeFileSync(readmePath, readmeContent);
59561
59561
  result.filesCreated.push(readmePath);
59562
59562
  if (removeOriginals || itemSelections) {
59563
59563
  result.filesRemoved = [];
59564
59564
  for (const item of allItems) {
59565
59565
  const selection = itemSelections?.find((s) => s.name === item.name && s.type === item.type);
59566
59566
  const shouldRemove = selection ? selection.mode === "extract" : removeOriginals && item.sharedWith.length === 0 && item.type !== "thread-endpoint" && item.type !== "effect";
59567
- if (shouldRemove && fs2.existsSync(item.filePath)) {
59568
- fs2.unlinkSync(item.filePath);
59567
+ if (shouldRemove && fs3.existsSync(item.filePath)) {
59568
+ fs3.unlinkSync(item.filePath);
59569
59569
  result.filesRemoved.push(item.filePath);
59570
59570
  }
59571
59571
  }
59572
59572
  }
59573
- const agentsDir = path4.join(rootDir, "agents");
59573
+ const agentsDir = path5.join(rootDir, "agents");
59574
59574
  const metadataService = new MetadataService(agentsDir);
59575
59575
  const metadata = {
59576
59576
  packageName: finalPackageName,
@@ -59604,7 +59604,7 @@ var init_packing_service = __esm({
59604
59604
  const commonjs = (await import('@rollup/plugin-commonjs')).default;
59605
59605
  const esbuild = (await import('rollup-plugin-esbuild')).default;
59606
59606
  const externalDeps = /* @__PURE__ */ new Map();
59607
- const agentsDir = path4.join(rootDir, "agents");
59607
+ const agentsDir = path5.join(rootDir, "agents");
59608
59608
  const resolveVersion = this.resolvePackageVersion.bind(this);
59609
59609
  const trackExternalsPlugin = {
59610
59610
  name: "track-externals",
@@ -59613,14 +59613,14 @@ var init_packing_service = __esm({
59613
59613
  return null;
59614
59614
  }
59615
59615
  if (source.startsWith("./") || source.startsWith("../")) {
59616
- const resolved = path4.resolve(path4.dirname(importer), source);
59616
+ const resolved = path5.resolve(path5.dirname(importer), source);
59617
59617
  let tsResolved = resolved;
59618
59618
  if (!resolved.endsWith(".ts") && !resolved.endsWith(".js")) {
59619
- if (fs2.existsSync(`${resolved}.ts`)) {
59619
+ if (fs3.existsSync(`${resolved}.ts`)) {
59620
59620
  tsResolved = `${resolved}.ts`;
59621
- } else if (fs2.existsSync(`${resolved}.js`)) {
59621
+ } else if (fs3.existsSync(`${resolved}.js`)) {
59622
59622
  tsResolved = `${resolved}.js`;
59623
- } else if (fs2.existsSync(`${resolved}/index.ts`)) {
59623
+ } else if (fs3.existsSync(`${resolved}/index.ts`)) {
59624
59624
  tsResolved = `${resolved}/index.ts`;
59625
59625
  }
59626
59626
  }
@@ -59669,11 +59669,11 @@ var init_packing_service = __esm({
59669
59669
  exports: "named"
59670
59670
  });
59671
59671
  const bundledCode = output[0].code;
59672
- const header = `// Bundled from: ${path4.relative(rootDir, inputPath)}
59672
+ const header = `// Bundled from: ${path5.relative(rootDir, inputPath)}
59673
59673
  // Local dependencies have been inlined
59674
59674
 
59675
59675
  `;
59676
- fs2.writeFileSync(outputPath, header + bundledCode);
59676
+ fs3.writeFileSync(outputPath, header + bundledCode);
59677
59677
  await bundle.close();
59678
59678
  } catch (error) {
59679
59679
  await bundle.close();
@@ -60098,30 +60098,30 @@ Copyright (c) ${year} ${copyrightHolder}
60098
60098
  * @returns Package info or null if not found
60099
60099
  */
60100
60100
  getPackedInfo(packageId, rootDir) {
60101
- const packedDir = path4.join(rootDir, "agents", "packed");
60102
- let packageDir = path4.join(packedDir, packageId);
60103
- if (!fs2.existsSync(packageDir)) {
60104
- if (!fs2.existsSync(packedDir)) {
60101
+ const packedDir = path5.join(rootDir, "agents", "packed");
60102
+ let packageDir = path5.join(packedDir, packageId);
60103
+ if (!fs3.existsSync(packageDir)) {
60104
+ if (!fs3.existsSync(packedDir)) {
60105
60105
  return null;
60106
60106
  }
60107
- const dirs = fs2.readdirSync(packedDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
60107
+ const dirs = fs3.readdirSync(packedDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
60108
60108
  const matchingDir = dirs.find(
60109
60109
  (d) => d === packageId || d === `standardagent-${packageId}` || d === `standardagent-${packageId.replace(/_/g, "-")}`
60110
60110
  );
60111
60111
  if (!matchingDir) {
60112
60112
  return null;
60113
60113
  }
60114
- packageDir = path4.join(packedDir, matchingDir);
60114
+ packageDir = path5.join(packedDir, matchingDir);
60115
60115
  }
60116
- const pkgJsonPath = path4.join(packageDir, "package.json");
60117
- if (!fs2.existsSync(pkgJsonPath)) {
60116
+ const pkgJsonPath = path5.join(packageDir, "package.json");
60117
+ if (!fs3.existsSync(pkgJsonPath)) {
60118
60118
  return null;
60119
60119
  }
60120
- const pkgJson = JSON.parse(fs2.readFileSync(pkgJsonPath, "utf-8"));
60120
+ const pkgJson = JSON.parse(fs3.readFileSync(pkgJsonPath, "utf-8"));
60121
60121
  let readme;
60122
- const readmePath = path4.join(packageDir, "README.md");
60123
- if (fs2.existsSync(readmePath)) {
60124
- readme = fs2.readFileSync(readmePath, "utf-8");
60122
+ const readmePath = path5.join(packageDir, "README.md");
60123
+ if (fs3.existsSync(readmePath)) {
60124
+ readme = fs3.readFileSync(readmePath, "utf-8");
60125
60125
  }
60126
60126
  return {
60127
60127
  packageName: pkgJson.name,
@@ -60139,11 +60139,11 @@ Copyright (c) ${year} ${copyrightHolder}
60139
60139
  * @returns Array of package directory names
60140
60140
  */
60141
60141
  listPackedPackages(rootDir) {
60142
- const packedDir = path4.join(rootDir, "agents", "packed");
60143
- if (!fs2.existsSync(packedDir)) {
60142
+ const packedDir = path5.join(rootDir, "agents", "packed");
60143
+ if (!fs3.existsSync(packedDir)) {
60144
60144
  return [];
60145
60145
  }
60146
- return fs2.readdirSync(packedDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
60146
+ return fs3.readdirSync(packedDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
60147
60147
  }
60148
60148
  /**
60149
60149
  * Generate README.md content for a packed agent.
@@ -60190,17 +60190,17 @@ ${license || "See LICENSE file"}
60190
60190
  * Find a file by name in a directory.
60191
60191
  */
60192
60192
  async findFile(dir, name15) {
60193
- if (!fs2.existsSync(dir)) {
60193
+ if (!fs3.existsSync(dir)) {
60194
60194
  return null;
60195
60195
  }
60196
- const exactPath = path4.join(dir, `${name15}.ts`);
60197
- if (fs2.existsSync(exactPath)) {
60196
+ const exactPath = path5.join(dir, `${name15}.ts`);
60197
+ if (fs3.existsSync(exactPath)) {
60198
60198
  return exactPath;
60199
60199
  }
60200
- const files = fs2.readdirSync(dir).filter((f) => f.endsWith(".ts"));
60200
+ const files = fs3.readdirSync(dir).filter((f) => f.endsWith(".ts"));
60201
60201
  for (const file of files) {
60202
- const filePath = path4.join(dir, file);
60203
- const source = fs2.readFileSync(filePath, "utf-8");
60202
+ const filePath = path5.join(dir, file);
60203
+ const source = fs3.readFileSync(filePath, "utf-8");
60204
60204
  const extractedName = await extractDefinitionName(source);
60205
60205
  if (extractedName === name15) {
60206
60206
  return filePath;
@@ -60212,15 +60212,15 @@ ${license || "See LICENSE file"}
60212
60212
  * List all agents in the workspace.
60213
60213
  */
60214
60214
  async listAgents(rootDir) {
60215
- const agentsDir = path4.join(rootDir, "agents", "agents");
60216
- if (!fs2.existsSync(agentsDir)) {
60215
+ const agentsDir = path5.join(rootDir, "agents", "agents");
60216
+ if (!fs3.existsSync(agentsDir)) {
60217
60217
  return [];
60218
60218
  }
60219
- const files = fs2.readdirSync(agentsDir).filter((f) => f.endsWith(".ts"));
60219
+ const files = fs3.readdirSync(agentsDir).filter((f) => f.endsWith(".ts"));
60220
60220
  const agents = [];
60221
60221
  for (const file of files) {
60222
- const filePath = path4.join(agentsDir, file);
60223
- const source = fs2.readFileSync(filePath, "utf-8");
60222
+ const filePath = path5.join(agentsDir, file);
60223
+ const source = fs3.readFileSync(filePath, "utf-8");
60224
60224
  const name15 = await extractDefinitionName(source);
60225
60225
  if (name15) {
60226
60226
  agents.push(name15);
@@ -60241,7 +60241,7 @@ var init_discovery = __esm({
60241
60241
  constructor(config) {
60242
60242
  this.config = {
60243
60243
  rootDir: config.rootDir,
60244
- packedDir: config.packedDir ?? path4.join(config.rootDir, "agents", "packed"),
60244
+ packedDir: config.packedDir ?? path5.join(config.rootDir, "agents", "packed"),
60245
60245
  scanNpm: config.scanNpm ?? true,
60246
60246
  scanLocal: config.scanLocal ?? true
60247
60247
  };
@@ -60274,19 +60274,19 @@ var init_discovery = __esm({
60274
60274
  */
60275
60275
  async discoverNpmPackages() {
60276
60276
  const packages = [];
60277
- const nodeModulesDir = path4.join(this.config.rootDir, "node_modules");
60278
- if (!fs2.existsSync(nodeModulesDir)) {
60277
+ const nodeModulesDir = path5.join(this.config.rootDir, "node_modules");
60278
+ if (!fs3.existsSync(nodeModulesDir)) {
60279
60279
  return packages;
60280
60280
  }
60281
60281
  const rootEntries = await this.scanDirectory(nodeModulesDir);
60282
60282
  for (const entry of rootEntries) {
60283
60283
  if (entry.startsWith(".")) continue;
60284
60284
  if (entry.startsWith("@")) {
60285
- const scopeDir = path4.join(nodeModulesDir, entry);
60285
+ const scopeDir = path5.join(nodeModulesDir, entry);
60286
60286
  const scopeEntries = await this.scanDirectory(scopeDir);
60287
60287
  for (const scopedPkg of scopeEntries) {
60288
60288
  if (scopedPkg.startsWith(".")) continue;
60289
- const pkgDir = path4.join(scopeDir, scopedPkg);
60289
+ const pkgDir = path5.join(scopeDir, scopedPkg);
60290
60290
  const fullName = `${entry}/${scopedPkg}`;
60291
60291
  const pkg = await this.checkNpmPackage(pkgDir, fullName);
60292
60292
  if (pkg) {
@@ -60294,7 +60294,7 @@ var init_discovery = __esm({
60294
60294
  }
60295
60295
  }
60296
60296
  } else {
60297
- const pkgDir = path4.join(nodeModulesDir, entry);
60297
+ const pkgDir = path5.join(nodeModulesDir, entry);
60298
60298
  const pkg = await this.checkNpmPackage(pkgDir, entry);
60299
60299
  if (pkg) {
60300
60300
  packages.push(pkg);
@@ -60310,12 +60310,12 @@ var init_discovery = __esm({
60310
60310
  * which must contain `entryAgents` array.
60311
60311
  */
60312
60312
  async checkNpmPackage(pkgDir, pkgName) {
60313
- const pkgJsonPath = path4.join(pkgDir, "package.json");
60314
- if (!fs2.existsSync(pkgJsonPath)) {
60313
+ const pkgJsonPath = path5.join(pkgDir, "package.json");
60314
+ if (!fs3.existsSync(pkgJsonPath)) {
60315
60315
  return null;
60316
60316
  }
60317
60317
  try {
60318
- const pkgJson = JSON.parse(fs2.readFileSync(pkgJsonPath, "utf-8"));
60318
+ const pkgJson = JSON.parse(fs3.readFileSync(pkgJsonPath, "utf-8"));
60319
60319
  const isStandardAgent = (
60320
60320
  // Has "standardagent" keyword
60321
60321
  pkgJson.keywords?.includes("standardagent") || // Has "standardagent-*" prefix
@@ -60352,21 +60352,21 @@ var init_discovery = __esm({
60352
60352
  */
60353
60353
  async discoverLocalPackages() {
60354
60354
  const packages = [];
60355
- if (!fs2.existsSync(this.config.packedDir)) {
60355
+ if (!fs3.existsSync(this.config.packedDir)) {
60356
60356
  return packages;
60357
60357
  }
60358
60358
  const entries = await this.scanDirectory(this.config.packedDir);
60359
60359
  for (const entry of entries) {
60360
60360
  if (entry.startsWith(".")) continue;
60361
- const pkgDir = path4.join(this.config.packedDir, entry);
60362
- const stat = fs2.statSync(pkgDir);
60361
+ const pkgDir = path5.join(this.config.packedDir, entry);
60362
+ const stat = fs3.statSync(pkgDir);
60363
60363
  if (!stat.isDirectory()) continue;
60364
60364
  if (entry.startsWith("@")) {
60365
60365
  const scopeEntries = await this.scanDirectory(pkgDir);
60366
60366
  for (const scopedPkg of scopeEntries) {
60367
60367
  if (scopedPkg.startsWith(".")) continue;
60368
- const scopedPkgDir = path4.join(pkgDir, scopedPkg);
60369
- const scopedStat = fs2.statSync(scopedPkgDir);
60368
+ const scopedPkgDir = path5.join(pkgDir, scopedPkg);
60369
+ const scopedStat = fs3.statSync(scopedPkgDir);
60370
60370
  if (!scopedStat.isDirectory()) continue;
60371
60371
  const fullName = `${entry}/${scopedPkg}`;
60372
60372
  const pkg = await this.checkLocalPackage(scopedPkgDir, fullName);
@@ -60389,12 +60389,12 @@ var init_discovery = __esm({
60389
60389
  * Detection is based on the `standardagent` field in package.json.
60390
60390
  */
60391
60391
  async checkLocalPackage(pkgDir, dirName) {
60392
- const pkgJsonPath = path4.join(pkgDir, "package.json");
60393
- if (!fs2.existsSync(pkgJsonPath)) {
60392
+ const pkgJsonPath = path5.join(pkgDir, "package.json");
60393
+ if (!fs3.existsSync(pkgJsonPath)) {
60394
60394
  return null;
60395
60395
  }
60396
60396
  try {
60397
- const pkgJson = JSON.parse(fs2.readFileSync(pkgJsonPath, "utf-8"));
60397
+ const pkgJson = JSON.parse(fs3.readFileSync(pkgJsonPath, "utf-8"));
60398
60398
  if (!pkgJson.standardagent?.entryAgents) {
60399
60399
  return null;
60400
60400
  }
@@ -60419,10 +60419,10 @@ var init_discovery = __esm({
60419
60419
  * Scan a directory and return entry names.
60420
60420
  */
60421
60421
  async scanDirectory(dir) {
60422
- if (!fs2.existsSync(dir)) {
60422
+ if (!fs3.existsSync(dir)) {
60423
60423
  return [];
60424
60424
  }
60425
- const entries = fs2.readdirSync(dir);
60425
+ const entries = fs3.readdirSync(dir);
60426
60426
  return entries;
60427
60427
  }
60428
60428
  /**
@@ -60526,29 +60526,29 @@ var init_unpacking_service = __esm({
60526
60526
  }
60527
60527
  analysis.version = pkg.version;
60528
60528
  analysis.source = pkg.source;
60529
- const indexPath = path4.join(pkg.path, "dist", "index.js");
60530
- if (!fs2.existsSync(indexPath)) {
60529
+ const indexPath = path5.join(pkg.path, "dist", "index.js");
60530
+ if (!fs3.existsSync(indexPath)) {
60531
60531
  analysis.errors.push(`Package index not found: ${indexPath}`);
60532
60532
  return analysis;
60533
60533
  }
60534
- const indexContent = fs2.readFileSync(indexPath, "utf-8");
60534
+ const indexContent = fs3.readFileSync(indexPath, "utf-8");
60535
60535
  const registryItems = await this.parseIndexExports(indexContent);
60536
60536
  const availableItems = /* @__PURE__ */ new Map();
60537
60537
  for (const item of registryItems) {
60538
60538
  availableItems.set(`${item.type}:${item.name}`, item);
60539
60539
  }
60540
- const agentsDir = path4.join(rootDir, "agents");
60540
+ const agentsDir = path5.join(rootDir, "agents");
60541
60541
  const itemsWithRelations = [];
60542
60542
  for (const item of registryItems) {
60543
- const targetPath = path4.join(agentsDir, TYPE_TO_TARGET_DIR[item.type], `${item.name}.ts`);
60544
- const sourcePath = path4.join(pkg.path, "dist", TYPE_TO_DIR[item.type], `${item.name}.js`);
60543
+ const targetPath = path5.join(agentsDir, TYPE_TO_TARGET_DIR[item.type], `${item.name}.ts`);
60544
+ const sourcePath = path5.join(pkg.path, "dist", TYPE_TO_DIR[item.type], `${item.name}.js`);
60545
60545
  const existsGlobally = this.fileExists(targetPath);
60546
- const sourceExists = fs2.existsSync(sourcePath);
60546
+ const sourceExists = fs3.existsSync(sourcePath);
60547
60547
  if (!sourceExists) {
60548
60548
  analysis.warnings.push(`Source file not found for ${item.type} "${item.name}": ${sourcePath}`);
60549
60549
  continue;
60550
60550
  }
60551
- const bundledCode = fs2.readFileSync(sourcePath, "utf-8");
60551
+ const bundledCode = fs3.readFileSync(sourcePath, "utf-8");
60552
60552
  const children = await this.discoverRelationships(item.type, item.name, bundledCode, availableItems);
60553
60553
  itemsWithRelations.push({
60554
60554
  name: item.name,
@@ -60558,10 +60558,10 @@ var init_unpacking_service = __esm({
60558
60558
  action: existsGlobally ? "skip" : "generate"
60559
60559
  });
60560
60560
  for (const child of children) {
60561
- const childTargetPath = path4.join(agentsDir, TYPE_TO_TARGET_DIR[child.type], `${child.name}.ts`);
60562
- const childSourcePath = path4.join(pkg.path, "dist", TYPE_TO_DIR[child.type], `${child.name}.js`);
60561
+ const childTargetPath = path5.join(agentsDir, TYPE_TO_TARGET_DIR[child.type], `${child.name}.ts`);
60562
+ const childSourcePath = path5.join(pkg.path, "dist", TYPE_TO_DIR[child.type], `${child.name}.js`);
60563
60563
  const childExists = this.fileExists(childTargetPath);
60564
- const childSourceExists = fs2.existsSync(childSourcePath);
60564
+ const childSourceExists = fs3.existsSync(childSourcePath);
60565
60565
  if (!childSourceExists) {
60566
60566
  continue;
60567
60567
  }
@@ -60664,8 +60664,8 @@ var init_unpacking_service = __esm({
60664
60664
  return result;
60665
60665
  }
60666
60666
  const itemsToProcess = this.applySelections(analysis.items, itemSelections);
60667
- const pkgJsonPath = path4.join(pkg.path, "package.json");
60668
- const pkgJson = JSON.parse(fs2.readFileSync(pkgJsonPath, "utf-8"));
60667
+ const pkgJsonPath = path5.join(pkg.path, "package.json");
60668
+ const pkgJson = JSON.parse(fs3.readFileSync(pkgJsonPath, "utf-8"));
60669
60669
  let author = "";
60670
60670
  if (typeof pkgJson.author === "string") {
60671
60671
  author = pkgJson.author;
@@ -60690,17 +60690,17 @@ var init_unpacking_service = __esm({
60690
60690
  continue;
60691
60691
  }
60692
60692
  try {
60693
- const sourcePath = path4.join(pkg.path, "dist", TYPE_TO_DIR[item.type], `${item.name}.js`);
60694
- const bundledCode = fs2.readFileSync(sourcePath, "utf-8");
60693
+ const sourcePath = path5.join(pkg.path, "dist", TYPE_TO_DIR[item.type], `${item.name}.js`);
60694
+ const bundledCode = fs3.readFileSync(sourcePath, "utf-8");
60695
60695
  let tsCode = await transformBundledJs(bundledCode);
60696
60696
  if (item.type === "agent") {
60697
60697
  tsCode = await injectAgentMetadata(tsCode, agentMetadata);
60698
60698
  }
60699
- const dir = path4.dirname(item.targetPath);
60700
- if (!fs2.existsSync(dir)) {
60701
- fs2.mkdirSync(dir, { recursive: true });
60699
+ const dir = path5.dirname(item.targetPath);
60700
+ if (!fs3.existsSync(dir)) {
60701
+ fs3.mkdirSync(dir, { recursive: true });
60702
60702
  }
60703
- fs2.writeFileSync(item.targetPath, tsCode);
60703
+ fs3.writeFileSync(item.targetPath, tsCode);
60704
60704
  result.filesGenerated.push(item.targetPath);
60705
60705
  } catch (error) {
60706
60706
  result.warnings.push(
@@ -60789,14 +60789,14 @@ var init_unpacking_service = __esm({
60789
60789
  */
60790
60790
  async resolvePackage(pkgIdentifier, rootDir) {
60791
60791
  if (pkgIdentifier.startsWith("/") || pkgIdentifier.startsWith("./")) {
60792
- const absolutePath = path4.isAbsolute(pkgIdentifier) ? pkgIdentifier : path4.join(rootDir, pkgIdentifier);
60793
- const pkgJsonPath2 = path4.join(absolutePath, "package.json");
60794
- if (fs2.existsSync(pkgJsonPath2)) {
60792
+ const absolutePath = path5.isAbsolute(pkgIdentifier) ? pkgIdentifier : path5.join(rootDir, pkgIdentifier);
60793
+ const pkgJsonPath2 = path5.join(absolutePath, "package.json");
60794
+ if (fs3.existsSync(pkgJsonPath2)) {
60795
60795
  try {
60796
- const pkgJson = JSON.parse(fs2.readFileSync(pkgJsonPath2, "utf-8"));
60796
+ const pkgJson = JSON.parse(fs3.readFileSync(pkgJsonPath2, "utf-8"));
60797
60797
  if (pkgJson.standardagent?.entryAgents) {
60798
60798
  return {
60799
- packageId: pkgJson.name || path4.basename(absolutePath),
60799
+ packageId: pkgJson.name || path5.basename(absolutePath),
60800
60800
  version: pkgJson.version || "0.0.0",
60801
60801
  source: "local",
60802
60802
  path: absolutePath,
@@ -60808,11 +60808,11 @@ var init_unpacking_service = __esm({
60808
60808
  }
60809
60809
  return null;
60810
60810
  }
60811
- const packedDir = path4.join(rootDir, "agents", "packed", pkgIdentifier);
60812
- const pkgJsonPath = path4.join(packedDir, "package.json");
60813
- if (fs2.existsSync(pkgJsonPath)) {
60811
+ const packedDir = path5.join(rootDir, "agents", "packed", pkgIdentifier);
60812
+ const pkgJsonPath = path5.join(packedDir, "package.json");
60813
+ if (fs3.existsSync(pkgJsonPath)) {
60814
60814
  try {
60815
- const pkgJson = JSON.parse(fs2.readFileSync(pkgJsonPath, "utf-8"));
60815
+ const pkgJson = JSON.parse(fs3.readFileSync(pkgJsonPath, "utf-8"));
60816
60816
  if (pkgJson.standardagent?.entryAgents) {
60817
60817
  return {
60818
60818
  packageId: pkgJson.name || pkgIdentifier,
@@ -60853,18 +60853,18 @@ var init_unpacking_service = __esm({
60853
60853
  * Check if a file exists.
60854
60854
  */
60855
60855
  fileExists(filePath) {
60856
- if (fs2.existsSync(filePath)) {
60856
+ if (fs3.existsSync(filePath)) {
60857
60857
  return true;
60858
60858
  }
60859
60859
  const withoutExt = filePath.replace(/\.(ts|js)$/, "");
60860
- return fs2.existsSync(`${withoutExt}.ts`) || fs2.existsSync(`${withoutExt}.js`);
60860
+ return fs3.existsSync(`${withoutExt}.ts`) || fs3.existsSync(`${withoutExt}.js`);
60861
60861
  }
60862
60862
  /**
60863
60863
  * Recursively delete a directory.
60864
60864
  */
60865
60865
  deleteDirectory(dirPath) {
60866
- if (fs2.existsSync(dirPath)) {
60867
- fs2.rmSync(dirPath, { recursive: true, force: true });
60866
+ if (fs3.existsSync(dirPath)) {
60867
+ fs3.rmSync(dirPath, { recursive: true, force: true });
60868
60868
  }
60869
60869
  }
60870
60870
  /**
@@ -60951,8 +60951,8 @@ var init_npm_publish_service = __esm({
60951
60951
  error: "Registry URL must use HTTPS"
60952
60952
  };
60953
60953
  }
60954
- const pkgJsonPath = path4.join(packageDir, "package.json");
60955
- if (!fs2.existsSync(pkgJsonPath)) {
60954
+ const pkgJsonPath = path5.join(packageDir, "package.json");
60955
+ if (!fs3.existsSync(pkgJsonPath)) {
60956
60956
  return {
60957
60957
  success: false,
60958
60958
  output: "",
@@ -60962,7 +60962,7 @@ var init_npm_publish_service = __esm({
60962
60962
  let packageName;
60963
60963
  let version;
60964
60964
  try {
60965
- const pkgJson = JSON.parse(fs2.readFileSync(pkgJsonPath, "utf-8"));
60965
+ const pkgJson = JSON.parse(fs3.readFileSync(pkgJsonPath, "utf-8"));
60966
60966
  packageName = pkgJson.name;
60967
60967
  version = pkgJson.version;
60968
60968
  } catch (e) {
@@ -60972,13 +60972,13 @@ var init_npm_publish_service = __esm({
60972
60972
  error: `Failed to read package.json: ${e instanceof Error ? e.message : String(e)}`
60973
60973
  };
60974
60974
  }
60975
- const npmrcPath = path4.join(packageDir, ".npmrc");
60975
+ const npmrcPath = path5.join(packageDir, ".npmrc");
60976
60976
  const registryHost = new URL(registry).host;
60977
60977
  const npmrcContent = `//${registryHost}/:_authToken=${token}
60978
60978
  registry=${registry}
60979
60979
  `;
60980
60980
  try {
60981
- fs2.writeFileSync(npmrcPath, npmrcContent, { mode: 384 });
60981
+ fs3.writeFileSync(npmrcPath, npmrcContent, { mode: 384 });
60982
60982
  const args = ["publish"];
60983
60983
  if (dryRun) {
60984
60984
  args.push("--dry-run");
@@ -61010,8 +61010,8 @@ registry=${registry}
61010
61010
  };
61011
61011
  } finally {
61012
61012
  try {
61013
- if (fs2.existsSync(npmrcPath)) {
61014
- fs2.unlinkSync(npmrcPath);
61013
+ if (fs3.existsSync(npmrcPath)) {
61014
+ fs3.unlinkSync(npmrcPath);
61015
61015
  }
61016
61016
  } catch {
61017
61017
  }
@@ -61616,7 +61616,7 @@ var index_post_default2 = defineController2(async ({ req, env: env2 }) => {
61616
61616
  });
61617
61617
 
61618
61618
  // src/utils/platform-auth.ts
61619
- var FALLBACK_PLATFORM_ORIGIN = "https://standardagents.ai";
61619
+ var FALLBACK_PLATFORM_ORIGIN = "https://platform.standardagents.ai";
61620
61620
  var SESSION_TTL_SECONDS = 30 * 24 * 60 * 60;
61621
61621
  function platformApiKey(env2) {
61622
61622
  const value = env2.STANDARD_AGENTS_API_KEY;
@@ -61707,8 +61707,12 @@ async function createPlatformLocalSession(env2) {
61707
61707
  if (!identity) {
61708
61708
  return null;
61709
61709
  }
61710
- const agentBuilderId = env2.AGENT_BUILDER.idFromName("singleton");
61711
- const agentBuilder = env2.AGENT_BUILDER.get(agentBuilderId);
61710
+ const agentBuilderNamespace = env2.AGENT_BUILDER;
61711
+ if (!agentBuilderNamespace || typeof agentBuilderNamespace.idFromName !== "function" || typeof agentBuilderNamespace.get !== "function") {
61712
+ throw new Error("Server misconfigured: AGENT_BUILDER Durable Object binding is required for platform auth");
61713
+ }
61714
+ const agentBuilderId = agentBuilderNamespace.idFromName("singleton");
61715
+ const agentBuilder = agentBuilderNamespace.get(agentBuilderId);
61712
61716
  const username = identity.user.username;
61713
61717
  let user = await agentBuilder.getUserByUsername(username);
61714
61718
  if (!user) {
@@ -61737,12 +61741,91 @@ async function createPlatformLocalSession(env2) {
61737
61741
  platform: identity
61738
61742
  };
61739
61743
  }
61744
+ var STATE_RELATIVE_PATH = path5__default.join(".agents", "bootstrap-session.json");
61745
+ var PROJECT_ROOT_ENV_KEYS = ["INIT_CWD", "PWD", "npm_config_local_prefix"];
61746
+ function readEnvString(env2, key) {
61747
+ if (!env2 || typeof env2 !== "object") return void 0;
61748
+ const value = env2[key];
61749
+ return typeof value === "string" ? value : void 0;
61750
+ }
61751
+ function uniquePaths(paths) {
61752
+ return Array.from(
61753
+ new Set(
61754
+ paths.filter((value) => !!value?.trim()).map((value) => path5__default.resolve(value))
61755
+ )
61756
+ );
61757
+ }
61758
+ function hasSessionCookie(cookieHeader) {
61759
+ const raw = Array.isArray(cookieHeader) ? cookieHeader.join("; ") : cookieHeader || "";
61760
+ return /(?:^|;\s*)session=/.test(raw);
61761
+ }
61762
+ function loadLocalBootstrapSession(projectRoot) {
61763
+ const statePath = path5__default.join(projectRoot, STATE_RELATIVE_PATH);
61764
+ if (!fs3__default.existsSync(statePath)) return null;
61765
+ try {
61766
+ const parsed = JSON.parse(
61767
+ fs3__default.readFileSync(statePath, "utf-8")
61768
+ );
61769
+ if (parsed.version !== 1) return null;
61770
+ if (!parsed.endpoint || !parsed.user?.id || !parsed.account?.id) return null;
61771
+ if (!parsed.session_cookie || typeof parsed.session_cookie !== "string") return null;
61772
+ return parsed;
61773
+ } catch {
61774
+ return null;
61775
+ }
61776
+ }
61777
+ function loadLocalBootstrapSessionFromEnv(env2) {
61778
+ if (!env2) return null;
61779
+ const endpoint = readEnvString(env2, "PLATFORM_ENDPOINT")?.trim();
61780
+ const sessionCookie = readEnvString(env2, "STANDARDAGENTS_BOOTSTRAP_SESSION_COOKIE")?.trim();
61781
+ const userId = readEnvString(env2, "STANDARDAGENTS_ORG_USER_ID")?.trim();
61782
+ const accountId = readEnvString(env2, "STANDARDAGENTS_ORG_ACCOUNT_ID")?.trim();
61783
+ const accountSlug = readEnvString(env2, "STANDARDAGENTS_ORG_SLUG")?.trim();
61784
+ if (!endpoint || !sessionCookie || !userId || !accountId) {
61785
+ return null;
61786
+ }
61787
+ return {
61788
+ version: 1,
61789
+ endpoint,
61790
+ authenticated_at: 0,
61791
+ session_cookie: sessionCookie,
61792
+ user: { id: userId },
61793
+ account: {
61794
+ id: accountId,
61795
+ ...accountSlug ? { slug: accountSlug } : {}
61796
+ }
61797
+ };
61798
+ }
61799
+ function findLocalBootstrapSession(projectRoot, env2) {
61800
+ const envSession = loadLocalBootstrapSessionFromEnv(env2);
61801
+ if (envSession) {
61802
+ return {
61803
+ projectRoot: process.cwd(),
61804
+ session: envSession
61805
+ };
61806
+ }
61807
+ const candidates = uniquePaths([
61808
+ projectRoot,
61809
+ process.cwd(),
61810
+ ...PROJECT_ROOT_ENV_KEYS.map((key) => process.env[key])
61811
+ ]);
61812
+ for (const candidate of candidates) {
61813
+ const session = loadLocalBootstrapSession(candidate);
61814
+ if (session) {
61815
+ return {
61816
+ projectRoot: candidate,
61817
+ session
61818
+ };
61819
+ }
61820
+ }
61821
+ return null;
61822
+ }
61740
61823
 
61741
61824
  // src/api/platform-endpoint.ts
61742
61825
  var ORB_CORE_HOST_PATTERN = /^core\.([a-z0-9-]+)\.orb\.local$/i;
61743
61826
  var LOCAL_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
61744
61827
  var DEFAULT_DOCKER_PLATFORM_ENDPOINT = "http://platform-admin:8787";
61745
- function readEnvString(env2, key) {
61828
+ function readEnvString2(env2, key) {
61746
61829
  if (!env2 || typeof env2 !== "object") return void 0;
61747
61830
  const value = env2[key];
61748
61831
  return typeof value === "string" ? value : void 0;
@@ -61772,7 +61855,7 @@ function resolvePlatformEndpoint(req, env2) {
61772
61855
  return endpoints[0] ?? null;
61773
61856
  }
61774
61857
  function resolvePlatformEndpointCandidates(req, env2) {
61775
- const configuredEndpoint = normalizeEndpoint(readEnvString(env2, "PLATFORM_ENDPOINT"));
61858
+ const configuredEndpoint = normalizeEndpoint(readEnvString2(env2, "PLATFORM_ENDPOINT"));
61776
61859
  const orbFallbackEndpoint = deriveOrbPlatformEndpoint(req.url);
61777
61860
  const configuredHost = configuredEndpoint ? getHostname(configuredEndpoint) : null;
61778
61861
  const hasLocalConfiguredEndpoint = !!(configuredHost && LOCAL_HOSTS.has(configuredHost));
@@ -61805,10 +61888,12 @@ var platform_endpoint_default = defineController2(async ({ req, env: env2 }) =>
61805
61888
  // src/api/config.get.ts
61806
61889
  var config_get_default = defineController2(async ({ config, env: env2, req }) => {
61807
61890
  const configuredPlatformEndpoint = resolvePlatformEndpoint(req, env2);
61808
- const platformConnected = hasPlatformApiKey(env2) || !!configuredPlatformEndpoint;
61891
+ const platformConnected = hasPlatformApiKey(env2) || !!findLocalBootstrapSession(void 0, env2);
61892
+ const localPassword = typeof env2.SUPER_ADMIN_PASSWORD === "string" && env2.SUPER_ADMIN_PASSWORD.length > 0;
61809
61893
  return Response.json({
61810
61894
  ...config,
61811
61895
  platformConnected,
61896
+ localPassword,
61812
61897
  platformEndpoint: hasPlatformApiKey(env2) ? platformEndpoint(env2) : configuredPlatformEndpoint
61813
61898
  });
61814
61899
  });
@@ -63740,85 +63825,6 @@ var id_put_default = defineController2(async ({ req, env: env2, params }) => {
63740
63825
  );
63741
63826
  }
63742
63827
  });
63743
- var STATE_RELATIVE_PATH = path4__default.join(".agents", "bootstrap-session.json");
63744
- var PROJECT_ROOT_ENV_KEYS = ["INIT_CWD", "PWD", "npm_config_local_prefix"];
63745
- function readEnvString2(env2, key) {
63746
- if (!env2 || typeof env2 !== "object") return void 0;
63747
- const value = env2[key];
63748
- return typeof value === "string" ? value : void 0;
63749
- }
63750
- function uniquePaths(paths) {
63751
- return Array.from(
63752
- new Set(
63753
- paths.filter((value) => !!value?.trim()).map((value) => path4__default.resolve(value))
63754
- )
63755
- );
63756
- }
63757
- function hasSessionCookie(cookieHeader) {
63758
- const raw = Array.isArray(cookieHeader) ? cookieHeader.join("; ") : cookieHeader || "";
63759
- return /(?:^|;\s*)session=/.test(raw);
63760
- }
63761
- function loadLocalBootstrapSession(projectRoot) {
63762
- const statePath = path4__default.join(projectRoot, STATE_RELATIVE_PATH);
63763
- if (!fs2__default.existsSync(statePath)) return null;
63764
- try {
63765
- const parsed = JSON.parse(
63766
- fs2__default.readFileSync(statePath, "utf-8")
63767
- );
63768
- if (parsed.version !== 1) return null;
63769
- if (!parsed.endpoint || !parsed.user?.id || !parsed.account?.id) return null;
63770
- if (!parsed.session_cookie || typeof parsed.session_cookie !== "string") return null;
63771
- return parsed;
63772
- } catch {
63773
- return null;
63774
- }
63775
- }
63776
- function loadLocalBootstrapSessionFromEnv(env2) {
63777
- if (!env2) return null;
63778
- const endpoint = readEnvString2(env2, "PLATFORM_ENDPOINT")?.trim();
63779
- const sessionCookie = readEnvString2(env2, "STANDARDAGENTS_BOOTSTRAP_SESSION_COOKIE")?.trim();
63780
- const userId = readEnvString2(env2, "STANDARDAGENTS_ORG_USER_ID")?.trim();
63781
- const accountId = readEnvString2(env2, "STANDARDAGENTS_ORG_ACCOUNT_ID")?.trim();
63782
- const accountSlug = readEnvString2(env2, "STANDARDAGENTS_ORG_SLUG")?.trim();
63783
- if (!endpoint || !sessionCookie || !userId || !accountId) {
63784
- return null;
63785
- }
63786
- return {
63787
- version: 1,
63788
- endpoint,
63789
- authenticated_at: 0,
63790
- session_cookie: sessionCookie,
63791
- user: { id: userId },
63792
- account: {
63793
- id: accountId,
63794
- ...accountSlug ? { slug: accountSlug } : {}
63795
- }
63796
- };
63797
- }
63798
- function findLocalBootstrapSession(projectRoot, env2) {
63799
- const envSession = loadLocalBootstrapSessionFromEnv(env2);
63800
- if (envSession) {
63801
- return {
63802
- projectRoot: process.cwd(),
63803
- session: envSession
63804
- };
63805
- }
63806
- const candidates = uniquePaths([
63807
- projectRoot,
63808
- process.cwd(),
63809
- ...PROJECT_ROOT_ENV_KEYS.map((key) => process.env[key])
63810
- ]);
63811
- for (const candidate of candidates) {
63812
- const session = loadLocalBootstrapSession(candidate);
63813
- if (session) {
63814
- return {
63815
- projectRoot: candidate,
63816
- session
63817
- };
63818
- }
63819
- }
63820
- return null;
63821
- }
63822
63828
 
63823
63829
  // src/api/auth/bootstrap.post.ts
63824
63830
  function deriveManagedUsername(platformUserId) {
@@ -63883,6 +63889,12 @@ var bootstrap_post_default = defineController2(async ({ req, env: env2 }) => {
63883
63889
  );
63884
63890
  }
63885
63891
  const username = deriveManagedUsername(platformUserId);
63892
+ if (!env2.AGENT_BUILDER || typeof env2.AGENT_BUILDER.idFromName !== "function") {
63893
+ return Response.json(
63894
+ { error: "Server misconfigured: AGENT_BUILDER Durable Object binding is required for platform auth" },
63895
+ { status: 500 }
63896
+ );
63897
+ }
63886
63898
  const agentBuilderId = env2.AGENT_BUILDER.idFromName("singleton");
63887
63899
  const agentBuilder = env2.AGENT_BUILDER.get(agentBuilderId);
63888
63900
  let user = await agentBuilder.getUserByUsername(username);
@@ -63920,11 +63932,13 @@ var config_get_default2 = defineController2(async ({ req, env: env2 }) => {
63920
63932
  const githubConfigured = !!(env2.GITHUB_CLIENT_ID && env2.GITHUB_CLIENT_SECRET);
63921
63933
  const googleConfigured = !!(env2.GOOGLE_CLIENT_ID && env2.GOOGLE_CLIENT_SECRET);
63922
63934
  const configuredPlatformEndpoint = resolvePlatformEndpoint(req, env2);
63923
- const platformConnected = hasPlatformApiKey(env2) || !!configuredPlatformEndpoint;
63935
+ const platformConnected = hasPlatformApiKey(env2) || !!findLocalBootstrapSession(void 0, env2);
63936
+ const localPassword = typeof env2.SUPER_ADMIN_PASSWORD === "string" && env2.SUPER_ADMIN_PASSWORD.length > 0;
63924
63937
  return {
63925
63938
  github: githubConfigured,
63926
63939
  google: googleConfigured,
63927
63940
  platformConnected,
63941
+ localPassword,
63928
63942
  platformEndpoint: hasPlatformApiKey(env2) ? platformEndpoint(env2) : configuredPlatformEndpoint
63929
63943
  };
63930
63944
  });
@@ -63963,6 +63977,12 @@ var login_post_default = defineController2(async ({ req, env: env2 }) => {
63963
63977
  { status: 400 }
63964
63978
  );
63965
63979
  }
63980
+ if (!env2.AGENT_BUILDER || typeof env2.AGENT_BUILDER.idFromName !== "function") {
63981
+ return Response.json(
63982
+ { error: "Server misconfigured: AGENT_BUILDER Durable Object binding is required for local login" },
63983
+ { status: 500 }
63984
+ );
63985
+ }
63966
63986
  const agentBuilderId = env2.AGENT_BUILDER.idFromName("singleton");
63967
63987
  const agentBuilder = env2.AGENT_BUILDER.get(agentBuilderId);
63968
63988
  const user = await agentBuilder.getUserByUsername(username);