@topolo/sdk 0.11.2 → 0.11.4

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,83 @@ 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 = 3;
2234
+ var ACTION_RESULT_MAX_KEYS = 12;
2235
+ var ACTION_RESULT_MAX_ORDINARY_KEYS = 5;
2236
+ var ACTION_RESULT_MAX_ITEMS = 3;
2237
+ var ACTION_RESULT_MAX_SCALARS = 60;
2238
+ var ACTION_RESULT_MAX_STRING = 256;
2239
+ function resultKeyPriority(key) {
2240
+ if (/^(id|requestId|status|state|url|slug|name|title|version)$/i.test(key)) return 0;
2241
+ if (/(Id|Ids|Url|Uri|Status|State|Count|Total|Version|CreatedAt|UpdatedAt)$/i.test(key)) return 1;
2242
+ return 2;
2243
+ }
2244
+ function compactResultValue(value, depth, budget) {
2245
+ if (value === null || typeof value === "boolean" || typeof value === "number") {
2246
+ budget.scalars += 1;
2247
+ return value;
2248
+ }
2249
+ if (typeof value === "string") {
2250
+ budget.scalars += 1;
2251
+ if (value.length <= ACTION_RESULT_MAX_STRING) return value;
2252
+ return `${value.slice(0, ACTION_RESULT_MAX_STRING)}\u2026 (${value.length} chars)`;
2253
+ }
2254
+ if (depth >= ACTION_RESULT_MAX_DEPTH || budget.scalars >= ACTION_RESULT_MAX_SCALARS) {
2255
+ return Array.isArray(value) ? { count: value.length, omitted: true } : { omitted: true };
2256
+ }
2257
+ if (Array.isArray(value)) {
2258
+ const items = value.slice(0, ACTION_RESULT_MAX_ITEMS).map((item) => compactResultValue(item, depth + 1, budget));
2259
+ return value.length > ACTION_RESULT_MAX_ITEMS ? { count: value.length, items, omittedItems: value.length - ACTION_RESULT_MAX_ITEMS } : items;
2260
+ }
2261
+ if (typeof value === "object") {
2262
+ const record = value;
2263
+ const allKeys = Object.keys(record);
2264
+ const ranked = allKeys.sort((left, right) => resultKeyPriority(left) - resultKeyPriority(right));
2265
+ const prioritized = ranked.filter((key) => resultKeyPriority(key) < 2);
2266
+ const ordinary = ranked.filter((key) => resultKeyPriority(key) === 2);
2267
+ const ordinaryLimit = depth === 0 ? ACTION_RESULT_MAX_ORDINARY_KEYS : prioritized.length ? 1 : ACTION_RESULT_MAX_ORDINARY_KEYS;
2268
+ const keys = [
2269
+ ...prioritized,
2270
+ ...ordinary.slice(0, ordinaryLimit)
2271
+ ].slice(0, ACTION_RESULT_MAX_KEYS);
2272
+ const compact = Object.fromEntries(keys.map((key) => [key, compactResultValue(record[key], depth + 1, budget)]));
2273
+ if (allKeys.length > keys.length) compact["_omittedKeys"] = allKeys.length - keys.length;
2274
+ return compact;
2275
+ }
2276
+ budget.scalars += 1;
2277
+ return String(value);
2278
+ }
2279
+ function compactActionResult(actionId, result) {
2280
+ let normalized = result;
2281
+ if (typeof result === "string") {
2282
+ try {
2283
+ normalized = JSON.parse(result);
2284
+ } catch {
2285
+ normalized = result;
2286
+ }
2287
+ }
2288
+ return { actionId, result: compactResultValue(normalized, 0, { scalars: 0 }) };
2289
+ }
2290
+ function preferExactActionMatches(actions, query) {
2291
+ const expected = query?.trim().toLowerCase();
2292
+ if (!expected) return actions;
2293
+ const exact = actions.filter((action) => [action.actionId, action.name, action.toolName].some((candidate) => candidate?.trim().toLowerCase() === expected));
2294
+ return exact.length ? exact : actions;
2295
+ }
2223
2296
  function compactActionPlan(plan) {
2224
2297
  return {
2225
2298
  actionId: plan.action.actionId,
@@ -5470,6 +5543,7 @@ function createTopolo(options) {
5470
5543
  compactActionCatalogEntry,
5471
5544
  compactActionPlan,
5472
5545
  compactActionPreparation,
5546
+ compactActionResult,
5473
5547
  compactActionValidation,
5474
5548
  createTopolo,
5475
5549
  createTopoloAgentExecutionContext,
@@ -5488,6 +5562,7 @@ function createTopolo(options) {
5488
5562
  friendlyAppId,
5489
5563
  listApplicationDirectory,
5490
5564
  parseTopoloActionUploadContract,
5565
+ preferExactActionMatches,
5491
5566
  prepareTopoloActionBase64UploadInput,
5492
5567
  prepareTopoloActionUploadInput,
5493
5568
  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,83 @@ 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 = 3;
2144
+ var ACTION_RESULT_MAX_KEYS = 12;
2145
+ var ACTION_RESULT_MAX_ORDINARY_KEYS = 5;
2146
+ var ACTION_RESULT_MAX_ITEMS = 3;
2147
+ var ACTION_RESULT_MAX_SCALARS = 60;
2148
+ var ACTION_RESULT_MAX_STRING = 256;
2149
+ function resultKeyPriority(key) {
2150
+ if (/^(id|requestId|status|state|url|slug|name|title|version)$/i.test(key)) return 0;
2151
+ if (/(Id|Ids|Url|Uri|Status|State|Count|Total|Version|CreatedAt|UpdatedAt)$/i.test(key)) return 1;
2152
+ return 2;
2153
+ }
2154
+ function compactResultValue(value, depth, budget) {
2155
+ if (value === null || typeof value === "boolean" || typeof value === "number") {
2156
+ budget.scalars += 1;
2157
+ return value;
2158
+ }
2159
+ if (typeof value === "string") {
2160
+ budget.scalars += 1;
2161
+ if (value.length <= ACTION_RESULT_MAX_STRING) return value;
2162
+ return `${value.slice(0, ACTION_RESULT_MAX_STRING)}\u2026 (${value.length} chars)`;
2163
+ }
2164
+ if (depth >= ACTION_RESULT_MAX_DEPTH || budget.scalars >= ACTION_RESULT_MAX_SCALARS) {
2165
+ return Array.isArray(value) ? { count: value.length, omitted: true } : { omitted: true };
2166
+ }
2167
+ if (Array.isArray(value)) {
2168
+ const items = value.slice(0, ACTION_RESULT_MAX_ITEMS).map((item) => compactResultValue(item, depth + 1, budget));
2169
+ return value.length > ACTION_RESULT_MAX_ITEMS ? { count: value.length, items, omittedItems: value.length - ACTION_RESULT_MAX_ITEMS } : items;
2170
+ }
2171
+ if (typeof value === "object") {
2172
+ const record = value;
2173
+ const allKeys = Object.keys(record);
2174
+ const ranked = allKeys.sort((left, right) => resultKeyPriority(left) - resultKeyPriority(right));
2175
+ const prioritized = ranked.filter((key) => resultKeyPriority(key) < 2);
2176
+ const ordinary = ranked.filter((key) => resultKeyPriority(key) === 2);
2177
+ const ordinaryLimit = depth === 0 ? ACTION_RESULT_MAX_ORDINARY_KEYS : prioritized.length ? 1 : ACTION_RESULT_MAX_ORDINARY_KEYS;
2178
+ const keys = [
2179
+ ...prioritized,
2180
+ ...ordinary.slice(0, ordinaryLimit)
2181
+ ].slice(0, ACTION_RESULT_MAX_KEYS);
2182
+ const compact = Object.fromEntries(keys.map((key) => [key, compactResultValue(record[key], depth + 1, budget)]));
2183
+ if (allKeys.length > keys.length) compact["_omittedKeys"] = allKeys.length - keys.length;
2184
+ return compact;
2185
+ }
2186
+ budget.scalars += 1;
2187
+ return String(value);
2188
+ }
2189
+ function compactActionResult(actionId, result) {
2190
+ let normalized = result;
2191
+ if (typeof result === "string") {
2192
+ try {
2193
+ normalized = JSON.parse(result);
2194
+ } catch {
2195
+ normalized = result;
2196
+ }
2197
+ }
2198
+ return { actionId, result: compactResultValue(normalized, 0, { scalars: 0 }) };
2199
+ }
2200
+ function preferExactActionMatches(actions, query) {
2201
+ const expected = query?.trim().toLowerCase();
2202
+ if (!expected) return actions;
2203
+ const exact = actions.filter((action) => [action.actionId, action.name, action.toolName].some((candidate) => candidate?.trim().toLowerCase() === expected));
2204
+ return exact.length ? exact : actions;
2205
+ }
2135
2206
  function compactActionPlan(plan) {
2136
2207
  return {
2137
2208
  actionId: plan.action.actionId,
@@ -5381,6 +5452,7 @@ export {
5381
5452
  compactActionCatalogEntry,
5382
5453
  compactActionPlan,
5383
5454
  compactActionPreparation,
5455
+ compactActionResult,
5384
5456
  compactActionValidation,
5385
5457
  createTopolo,
5386
5458
  createTopoloAgentExecutionContext,
@@ -5399,6 +5471,7 @@ export {
5399
5471
  friendlyAppId,
5400
5472
  listApplicationDirectory,
5401
5473
  parseTopoloActionUploadContract,
5474
+ preferExactActionMatches,
5402
5475
  prepareTopoloActionBase64UploadInput,
5403
5476
  prepareTopoloActionUploadInput,
5404
5477
  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.4",
4
+ "topoloPublishedVersion": "0.11.4",
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",