@topolo/sdk 0.11.2 → 0.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -54,6 +54,7 @@ __export(index_exports, {
54
54
  compactActionCatalogEntry: () => compactActionCatalogEntry,
55
55
  compactActionPlan: () => compactActionPlan,
56
56
  compactActionPreparation: () => compactActionPreparation,
57
+ compactActionResult: () => compactActionResult,
57
58
  compactActionValidation: () => compactActionValidation,
58
59
  createTopolo: () => createTopolo,
59
60
  createTopoloAgentExecutionContext: () => createTopoloAgentExecutionContext,
@@ -72,6 +73,7 @@ __export(index_exports, {
72
73
  friendlyAppId: () => friendlyAppId,
73
74
  listApplicationDirectory: () => listApplicationDirectory,
74
75
  parseTopoloActionUploadContract: () => parseTopoloActionUploadContract,
76
+ preferExactActionMatches: () => preferExactActionMatches,
75
77
  prepareTopoloActionBase64UploadInput: () => prepareTopoloActionBase64UploadInput,
76
78
  prepareTopoloActionUploadInput: () => prepareTopoloActionUploadInput,
77
79
  publicTopoloErrorMessage: () => publicTopoloErrorMessage,
@@ -2202,6 +2204,7 @@ function mergeSignals(a, b) {
2202
2204
  function compactActionCatalogEntry(action) {
2203
2205
  const required = Array.isArray(action.inputSchema["required"]) ? action.inputSchema["required"].filter((value) => typeof value === "string") : [];
2204
2206
  const examples = action.agentContract?.examples ?? [];
2207
+ const example = compactExample(examples[0]?.input);
2205
2208
  return {
2206
2209
  actionId: action.actionId,
2207
2210
  title: action.title,
@@ -2213,13 +2216,75 @@ function compactActionCatalogEntry(action) {
2213
2216
  requiredPermission: action.requiredPermission,
2214
2217
  requiredInput: required,
2215
2218
  resourceType: action.agentContract?.resource?.kind ?? null,
2216
- exampleInput: examples[0]?.input ?? null,
2219
+ exampleInput: example.value,
2220
+ exampleInputAvailable: example.available,
2217
2221
  docsUrl: action.agentContract?.docsUrl ?? null
2218
2222
  };
2219
2223
  }
2224
+ function compactExample(input) {
2225
+ if (!input) return { value: null, available: false };
2226
+ const serialized = JSON.stringify(input);
2227
+ if (serialized.length > 512) return { value: null, available: true };
2228
+ return { value: input, available: true };
2229
+ }
2220
2230
  function compactActionValidation(actionId, validation) {
2221
2231
  return { actionId, valid: validation.valid, errors: validation.errors };
2222
2232
  }
2233
+ var ACTION_RESULT_MAX_DEPTH = 4;
2234
+ var ACTION_RESULT_MAX_KEYS = 16;
2235
+ var ACTION_RESULT_MAX_ITEMS = 5;
2236
+ var ACTION_RESULT_MAX_SCALARS = 120;
2237
+ var ACTION_RESULT_MAX_STRING = 512;
2238
+ function resultKeyPriority(key) {
2239
+ if (/^(id|requestId|status|state|url|slug|name|title|version)$/i.test(key)) return 0;
2240
+ if (/(Id|Ids|Url|Uri|Status|State|Count|Total|Version|CreatedAt|UpdatedAt)$/i.test(key)) return 1;
2241
+ return 2;
2242
+ }
2243
+ function compactResultValue(value, depth, budget) {
2244
+ if (value === null || typeof value === "boolean" || typeof value === "number") {
2245
+ budget.scalars += 1;
2246
+ return value;
2247
+ }
2248
+ if (typeof value === "string") {
2249
+ budget.scalars += 1;
2250
+ if (value.length <= ACTION_RESULT_MAX_STRING) return value;
2251
+ return `${value.slice(0, ACTION_RESULT_MAX_STRING)}\u2026 (${value.length} chars)`;
2252
+ }
2253
+ if (depth >= ACTION_RESULT_MAX_DEPTH || budget.scalars >= ACTION_RESULT_MAX_SCALARS) {
2254
+ return Array.isArray(value) ? { count: value.length, omitted: true } : { omitted: true };
2255
+ }
2256
+ if (Array.isArray(value)) {
2257
+ const items = value.slice(0, ACTION_RESULT_MAX_ITEMS).map((item) => compactResultValue(item, depth + 1, budget));
2258
+ return value.length > ACTION_RESULT_MAX_ITEMS ? { count: value.length, items, omittedItems: value.length - ACTION_RESULT_MAX_ITEMS } : items;
2259
+ }
2260
+ if (typeof value === "object") {
2261
+ const record = value;
2262
+ const allKeys = Object.keys(record);
2263
+ const keys = allKeys.sort((left, right) => resultKeyPriority(left) - resultKeyPriority(right)).slice(0, ACTION_RESULT_MAX_KEYS);
2264
+ const compact = Object.fromEntries(keys.map((key) => [key, compactResultValue(record[key], depth + 1, budget)]));
2265
+ if (allKeys.length > keys.length) compact["_omittedKeys"] = allKeys.length - keys.length;
2266
+ return compact;
2267
+ }
2268
+ budget.scalars += 1;
2269
+ return String(value);
2270
+ }
2271
+ function compactActionResult(actionId, result) {
2272
+ let normalized = result;
2273
+ if (typeof result === "string") {
2274
+ try {
2275
+ normalized = JSON.parse(result);
2276
+ } catch {
2277
+ normalized = result;
2278
+ }
2279
+ }
2280
+ return { actionId, result: compactResultValue(normalized, 0, { scalars: 0 }) };
2281
+ }
2282
+ function preferExactActionMatches(actions, query) {
2283
+ const expected = query?.trim().toLowerCase();
2284
+ if (!expected) return actions;
2285
+ const exact = actions.filter((action) => [action.actionId, action.name, action.toolName].some((candidate) => candidate?.trim().toLowerCase() === expected));
2286
+ return exact.length ? exact : actions;
2287
+ }
2223
2288
  function compactActionPlan(plan) {
2224
2289
  return {
2225
2290
  actionId: plan.action.actionId,
@@ -5470,6 +5535,7 @@ function createTopolo(options) {
5470
5535
  compactActionCatalogEntry,
5471
5536
  compactActionPlan,
5472
5537
  compactActionPreparation,
5538
+ compactActionResult,
5473
5539
  compactActionValidation,
5474
5540
  createTopolo,
5475
5541
  createTopoloAgentExecutionContext,
@@ -5488,6 +5554,7 @@ function createTopolo(options) {
5488
5554
  friendlyAppId,
5489
5555
  listApplicationDirectory,
5490
5556
  parseTopoloActionUploadContract,
5557
+ preferExactActionMatches,
5491
5558
  prepareTopoloActionBase64UploadInput,
5492
5559
  prepareTopoloActionUploadInput,
5493
5560
  publicTopoloErrorMessage,
package/dist/index.d.cts CHANGED
@@ -508,6 +508,7 @@ declare function compactActionCatalogEntry(action: TopoloActionCatalogEntry): {
508
508
  requiredInput: string[];
509
509
  resourceType: string | null;
510
510
  exampleInput: Record<string, unknown> | null;
511
+ exampleInputAvailable: boolean;
511
512
  docsUrl: string | null;
512
513
  };
513
514
  declare function compactActionValidation(actionId: string, validation: TopoloActionValidationResult): {
@@ -515,6 +516,11 @@ declare function compactActionValidation(actionId: string, validation: TopoloAct
515
516
  valid: boolean;
516
517
  errors: TopoloActionValidationIssue[];
517
518
  };
519
+ declare function compactActionResult(actionId: string, result: unknown): {
520
+ actionId: string;
521
+ result: unknown;
522
+ };
523
+ declare function preferExactActionMatches(actions: TopoloActionCatalogEntry[], query?: string): TopoloActionCatalogEntry[];
518
524
  declare function compactActionPlan(plan: TopoloActionPlan): {
519
525
  actionId: string;
520
526
  valid: boolean;
@@ -2724,4 +2730,4 @@ declare function createTopolo(options: TopoloClientOptions): {
2724
2730
  };
2725
2731
  type Topolo = ReturnType<typeof createTopolo>;
2726
2732
 
2727
- export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationDirectory, type ApplicationDirectoryApplication, type ApplicationDirectoryClient, type ApplicationDirectorySource, type ApplicationId, type ApplicationRequirement, type ApplicationRequirementAudit, type ApplicationRequirementFinding, type ApplicationRequirementMigrationItem, type ApplicationRequirementScope, type ApplicationRequirementScore, type ApplicationRequirementStatus, type ApplicationRequirementsAuditReport, type CredentialIntrospection, type CrmContactSummary, CrmModule, DEFAULT_APP_URLS, type DeviceAuthorizationResponse, IdentityModule, type ListContactsOptions, type ListContactsResult, type OAuthHelperOptions, type P2PActionDetail, type P2PActionRequestInput, type P2PActionRequestResult, type P2PActionRow, type P2PActionRun, type P2PCapability, type P2PConnection, type P2PHold, type P2PLedgerEntry, P2PModule, type P2PPolicy, type P2PPricingModel, type P2PSettlementBatch, type P2PSettlementGroup, type PublishCapabilityInput, type RequestOptions, type ServiceCatalogUrlEntry, TOPOLO_ENVIRONMENT_SERVICE_URLS, TOPOLO_RUNTIME_ENVIRONMENTS, TOPOLO_WIDGET_ENDPOINT, TOPOLO_WIDGET_REFRESH_INTERVAL_MS, type TokenResponse, type Topolo, type TopoloActionAgentContract, type TopoloActionCatalogEntry, type TopoloActionCatalogSummary, type TopoloActionDigestInput, type TopoloActionPlan, type TopoloActionPreparation, type TopoloActionUploadOptions, type TopoloActionValidationIssue, type TopoloActionValidationResult, type TopoloAgentExecutionContext, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloQuickActionsWidget, type TopoloRecentActivityWidget, type TopoloRuntimeEnvironment, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetActionItem, type TopoloWidgetActivityItem, type TopoloWidgetApiResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetDraft, type TopoloWidgetMetric, type TopoloWidgetNotificationItem, type TopoloWidgetResponseOptions, type TopoloWidgetSnapshotMetadata, type TopoloWidgetSnapshotMetric, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationEntryFromCatalog, applicationRequirementScopes, assertTopoloServiceUrlEnvironment, auditAllApplicationRequirements, auditApplicationEntries, auditApplicationRequirements, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionValidation, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, listApplicationDirectory, parseTopoloActionUploadContract, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, publicTopoloErrorMessage, requirementsForApplication, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
2733
+ export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationDirectory, type ApplicationDirectoryApplication, type ApplicationDirectoryClient, type ApplicationDirectorySource, type ApplicationId, type ApplicationRequirement, type ApplicationRequirementAudit, type ApplicationRequirementFinding, type ApplicationRequirementMigrationItem, type ApplicationRequirementScope, type ApplicationRequirementScore, type ApplicationRequirementStatus, type ApplicationRequirementsAuditReport, type CredentialIntrospection, type CrmContactSummary, CrmModule, DEFAULT_APP_URLS, type DeviceAuthorizationResponse, IdentityModule, type ListContactsOptions, type ListContactsResult, type OAuthHelperOptions, type P2PActionDetail, type P2PActionRequestInput, type P2PActionRequestResult, type P2PActionRow, type P2PActionRun, type P2PCapability, type P2PConnection, type P2PHold, type P2PLedgerEntry, P2PModule, type P2PPolicy, type P2PPricingModel, type P2PSettlementBatch, type P2PSettlementGroup, type PublishCapabilityInput, type RequestOptions, type ServiceCatalogUrlEntry, TOPOLO_ENVIRONMENT_SERVICE_URLS, TOPOLO_RUNTIME_ENVIRONMENTS, TOPOLO_WIDGET_ENDPOINT, TOPOLO_WIDGET_REFRESH_INTERVAL_MS, type TokenResponse, type Topolo, type TopoloActionAgentContract, type TopoloActionCatalogEntry, type TopoloActionCatalogSummary, type TopoloActionDigestInput, type TopoloActionPlan, type TopoloActionPreparation, type TopoloActionUploadOptions, type TopoloActionValidationIssue, type TopoloActionValidationResult, type TopoloAgentExecutionContext, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloQuickActionsWidget, type TopoloRecentActivityWidget, type TopoloRuntimeEnvironment, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetActionItem, type TopoloWidgetActivityItem, type TopoloWidgetApiResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetDraft, type TopoloWidgetMetric, type TopoloWidgetNotificationItem, type TopoloWidgetResponseOptions, type TopoloWidgetSnapshotMetadata, type TopoloWidgetSnapshotMetric, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationEntryFromCatalog, applicationRequirementScopes, assertTopoloServiceUrlEnvironment, auditAllApplicationRequirements, auditApplicationEntries, auditApplicationRequirements, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionResult, compactActionValidation, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, listApplicationDirectory, parseTopoloActionUploadContract, preferExactActionMatches, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, publicTopoloErrorMessage, requirementsForApplication, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
package/dist/index.d.ts CHANGED
@@ -508,6 +508,7 @@ declare function compactActionCatalogEntry(action: TopoloActionCatalogEntry): {
508
508
  requiredInput: string[];
509
509
  resourceType: string | null;
510
510
  exampleInput: Record<string, unknown> | null;
511
+ exampleInputAvailable: boolean;
511
512
  docsUrl: string | null;
512
513
  };
513
514
  declare function compactActionValidation(actionId: string, validation: TopoloActionValidationResult): {
@@ -515,6 +516,11 @@ declare function compactActionValidation(actionId: string, validation: TopoloAct
515
516
  valid: boolean;
516
517
  errors: TopoloActionValidationIssue[];
517
518
  };
519
+ declare function compactActionResult(actionId: string, result: unknown): {
520
+ actionId: string;
521
+ result: unknown;
522
+ };
523
+ declare function preferExactActionMatches(actions: TopoloActionCatalogEntry[], query?: string): TopoloActionCatalogEntry[];
518
524
  declare function compactActionPlan(plan: TopoloActionPlan): {
519
525
  actionId: string;
520
526
  valid: boolean;
@@ -2724,4 +2730,4 @@ declare function createTopolo(options: TopoloClientOptions): {
2724
2730
  };
2725
2731
  type Topolo = ReturnType<typeof createTopolo>;
2726
2732
 
2727
- export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationDirectory, type ApplicationDirectoryApplication, type ApplicationDirectoryClient, type ApplicationDirectorySource, type ApplicationId, type ApplicationRequirement, type ApplicationRequirementAudit, type ApplicationRequirementFinding, type ApplicationRequirementMigrationItem, type ApplicationRequirementScope, type ApplicationRequirementScore, type ApplicationRequirementStatus, type ApplicationRequirementsAuditReport, type CredentialIntrospection, type CrmContactSummary, CrmModule, DEFAULT_APP_URLS, type DeviceAuthorizationResponse, IdentityModule, type ListContactsOptions, type ListContactsResult, type OAuthHelperOptions, type P2PActionDetail, type P2PActionRequestInput, type P2PActionRequestResult, type P2PActionRow, type P2PActionRun, type P2PCapability, type P2PConnection, type P2PHold, type P2PLedgerEntry, P2PModule, type P2PPolicy, type P2PPricingModel, type P2PSettlementBatch, type P2PSettlementGroup, type PublishCapabilityInput, type RequestOptions, type ServiceCatalogUrlEntry, TOPOLO_ENVIRONMENT_SERVICE_URLS, TOPOLO_RUNTIME_ENVIRONMENTS, TOPOLO_WIDGET_ENDPOINT, TOPOLO_WIDGET_REFRESH_INTERVAL_MS, type TokenResponse, type Topolo, type TopoloActionAgentContract, type TopoloActionCatalogEntry, type TopoloActionCatalogSummary, type TopoloActionDigestInput, type TopoloActionPlan, type TopoloActionPreparation, type TopoloActionUploadOptions, type TopoloActionValidationIssue, type TopoloActionValidationResult, type TopoloAgentExecutionContext, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloQuickActionsWidget, type TopoloRecentActivityWidget, type TopoloRuntimeEnvironment, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetActionItem, type TopoloWidgetActivityItem, type TopoloWidgetApiResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetDraft, type TopoloWidgetMetric, type TopoloWidgetNotificationItem, type TopoloWidgetResponseOptions, type TopoloWidgetSnapshotMetadata, type TopoloWidgetSnapshotMetric, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationEntryFromCatalog, applicationRequirementScopes, assertTopoloServiceUrlEnvironment, auditAllApplicationRequirements, auditApplicationEntries, auditApplicationRequirements, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionValidation, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, listApplicationDirectory, parseTopoloActionUploadContract, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, publicTopoloErrorMessage, requirementsForApplication, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
2733
+ export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationDirectory, type ApplicationDirectoryApplication, type ApplicationDirectoryClient, type ApplicationDirectorySource, type ApplicationId, type ApplicationRequirement, type ApplicationRequirementAudit, type ApplicationRequirementFinding, type ApplicationRequirementMigrationItem, type ApplicationRequirementScope, type ApplicationRequirementScore, type ApplicationRequirementStatus, type ApplicationRequirementsAuditReport, type CredentialIntrospection, type CrmContactSummary, CrmModule, DEFAULT_APP_URLS, type DeviceAuthorizationResponse, IdentityModule, type ListContactsOptions, type ListContactsResult, type OAuthHelperOptions, type P2PActionDetail, type P2PActionRequestInput, type P2PActionRequestResult, type P2PActionRow, type P2PActionRun, type P2PCapability, type P2PConnection, type P2PHold, type P2PLedgerEntry, P2PModule, type P2PPolicy, type P2PPricingModel, type P2PSettlementBatch, type P2PSettlementGroup, type PublishCapabilityInput, type RequestOptions, type ServiceCatalogUrlEntry, TOPOLO_ENVIRONMENT_SERVICE_URLS, TOPOLO_RUNTIME_ENVIRONMENTS, TOPOLO_WIDGET_ENDPOINT, TOPOLO_WIDGET_REFRESH_INTERVAL_MS, type TokenResponse, type Topolo, type TopoloActionAgentContract, type TopoloActionCatalogEntry, type TopoloActionCatalogSummary, type TopoloActionDigestInput, type TopoloActionPlan, type TopoloActionPreparation, type TopoloActionUploadOptions, type TopoloActionValidationIssue, type TopoloActionValidationResult, type TopoloAgentExecutionContext, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloQuickActionsWidget, type TopoloRecentActivityWidget, type TopoloRuntimeEnvironment, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetActionItem, type TopoloWidgetActivityItem, type TopoloWidgetApiResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetDraft, type TopoloWidgetMetric, type TopoloWidgetNotificationItem, type TopoloWidgetResponseOptions, type TopoloWidgetSnapshotMetadata, type TopoloWidgetSnapshotMetric, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationEntryFromCatalog, applicationRequirementScopes, assertTopoloServiceUrlEnvironment, auditAllApplicationRequirements, auditApplicationEntries, auditApplicationRequirements, canonicalTopoloErrorCode, canonicalTopoloRequestId, canonicalTopoloRequired, canonicalTopoloRetryAfter, compactActionCatalogEntry, compactActionPlan, compactActionPreparation, compactActionResult, compactActionValidation, createTopolo, createTopoloAgentExecutionContext, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, extractTopoloServiceErrorCode, extractTopoloServiceErrorDetails, formatDirectoryApplicationIds, friendlyAppId, listApplicationDirectory, parseTopoloActionUploadContract, preferExactActionMatches, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, publicTopoloErrorMessage, requirementsForApplication, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, topoloErrorHint, topoloServiceOrigins, validateTopoloActionInput, validateTopoloWidgetResponse };
package/dist/index.js CHANGED
@@ -2114,6 +2114,7 @@ function mergeSignals(a, b) {
2114
2114
  function compactActionCatalogEntry(action) {
2115
2115
  const required = Array.isArray(action.inputSchema["required"]) ? action.inputSchema["required"].filter((value) => typeof value === "string") : [];
2116
2116
  const examples = action.agentContract?.examples ?? [];
2117
+ const example = compactExample(examples[0]?.input);
2117
2118
  return {
2118
2119
  actionId: action.actionId,
2119
2120
  title: action.title,
@@ -2125,13 +2126,75 @@ function compactActionCatalogEntry(action) {
2125
2126
  requiredPermission: action.requiredPermission,
2126
2127
  requiredInput: required,
2127
2128
  resourceType: action.agentContract?.resource?.kind ?? null,
2128
- exampleInput: examples[0]?.input ?? null,
2129
+ exampleInput: example.value,
2130
+ exampleInputAvailable: example.available,
2129
2131
  docsUrl: action.agentContract?.docsUrl ?? null
2130
2132
  };
2131
2133
  }
2134
+ function compactExample(input) {
2135
+ if (!input) return { value: null, available: false };
2136
+ const serialized = JSON.stringify(input);
2137
+ if (serialized.length > 512) return { value: null, available: true };
2138
+ return { value: input, available: true };
2139
+ }
2132
2140
  function compactActionValidation(actionId, validation) {
2133
2141
  return { actionId, valid: validation.valid, errors: validation.errors };
2134
2142
  }
2143
+ var ACTION_RESULT_MAX_DEPTH = 4;
2144
+ var ACTION_RESULT_MAX_KEYS = 16;
2145
+ var ACTION_RESULT_MAX_ITEMS = 5;
2146
+ var ACTION_RESULT_MAX_SCALARS = 120;
2147
+ var ACTION_RESULT_MAX_STRING = 512;
2148
+ function resultKeyPriority(key) {
2149
+ if (/^(id|requestId|status|state|url|slug|name|title|version)$/i.test(key)) return 0;
2150
+ if (/(Id|Ids|Url|Uri|Status|State|Count|Total|Version|CreatedAt|UpdatedAt)$/i.test(key)) return 1;
2151
+ return 2;
2152
+ }
2153
+ function compactResultValue(value, depth, budget) {
2154
+ if (value === null || typeof value === "boolean" || typeof value === "number") {
2155
+ budget.scalars += 1;
2156
+ return value;
2157
+ }
2158
+ if (typeof value === "string") {
2159
+ budget.scalars += 1;
2160
+ if (value.length <= ACTION_RESULT_MAX_STRING) return value;
2161
+ return `${value.slice(0, ACTION_RESULT_MAX_STRING)}\u2026 (${value.length} chars)`;
2162
+ }
2163
+ if (depth >= ACTION_RESULT_MAX_DEPTH || budget.scalars >= ACTION_RESULT_MAX_SCALARS) {
2164
+ return Array.isArray(value) ? { count: value.length, omitted: true } : { omitted: true };
2165
+ }
2166
+ if (Array.isArray(value)) {
2167
+ const items = value.slice(0, ACTION_RESULT_MAX_ITEMS).map((item) => compactResultValue(item, depth + 1, budget));
2168
+ return value.length > ACTION_RESULT_MAX_ITEMS ? { count: value.length, items, omittedItems: value.length - ACTION_RESULT_MAX_ITEMS } : items;
2169
+ }
2170
+ if (typeof value === "object") {
2171
+ const record = value;
2172
+ const allKeys = Object.keys(record);
2173
+ const keys = allKeys.sort((left, right) => resultKeyPriority(left) - resultKeyPriority(right)).slice(0, ACTION_RESULT_MAX_KEYS);
2174
+ const compact = Object.fromEntries(keys.map((key) => [key, compactResultValue(record[key], depth + 1, budget)]));
2175
+ if (allKeys.length > keys.length) compact["_omittedKeys"] = allKeys.length - keys.length;
2176
+ return compact;
2177
+ }
2178
+ budget.scalars += 1;
2179
+ return String(value);
2180
+ }
2181
+ function compactActionResult(actionId, result) {
2182
+ let normalized = result;
2183
+ if (typeof result === "string") {
2184
+ try {
2185
+ normalized = JSON.parse(result);
2186
+ } catch {
2187
+ normalized = result;
2188
+ }
2189
+ }
2190
+ return { actionId, result: compactResultValue(normalized, 0, { scalars: 0 }) };
2191
+ }
2192
+ function preferExactActionMatches(actions, query) {
2193
+ const expected = query?.trim().toLowerCase();
2194
+ if (!expected) return actions;
2195
+ const exact = actions.filter((action) => [action.actionId, action.name, action.toolName].some((candidate) => candidate?.trim().toLowerCase() === expected));
2196
+ return exact.length ? exact : actions;
2197
+ }
2135
2198
  function compactActionPlan(plan) {
2136
2199
  return {
2137
2200
  actionId: plan.action.actionId,
@@ -5381,6 +5444,7 @@ export {
5381
5444
  compactActionCatalogEntry,
5382
5445
  compactActionPlan,
5383
5446
  compactActionPreparation,
5447
+ compactActionResult,
5384
5448
  compactActionValidation,
5385
5449
  createTopolo,
5386
5450
  createTopoloAgentExecutionContext,
@@ -5399,6 +5463,7 @@ export {
5399
5463
  friendlyAppId,
5400
5464
  listApplicationDirectory,
5401
5465
  parseTopoloActionUploadContract,
5466
+ preferExactActionMatches,
5402
5467
  prepareTopoloActionBase64UploadInput,
5403
5468
  prepareTopoloActionUploadInput,
5404
5469
  publicTopoloErrorMessage,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@topolo/sdk",
3
- "version": "0.11.2",
4
- "topoloPublishedVersion": "0.11.2",
3
+ "version": "0.11.3",
4
+ "topoloPublishedVersion": "0.11.3",
5
5
  "description": "Typed client SDK for the Topolo platform. Used by TopoloCli, TopoloMCP, and third-party agents.",
6
6
  "license": "UNLICENSED",
7
7
  "author": "Topolo",