lua-cli 3.23.2 → 3.25.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.
- package/dist/api-exports.d.ts +173 -11
- package/dist/api-exports.js +158 -13
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +176 -15
- package/dist/index.js.map +1 -1
- package/docs/README.md +2 -2
- package/package.json +1 -1
- package/template/package.json +1 -1
package/dist/api-exports.d.ts
CHANGED
|
@@ -1046,6 +1046,22 @@ export declare interface ChatHistoryMessage {
|
|
|
1046
1046
|
*/
|
|
1047
1047
|
export declare type ChatMessage = TextMessage | ImageMessage | FileMessage;
|
|
1048
1048
|
|
|
1049
|
+
/**
|
|
1050
|
+
* Options for creating a custom data entry.
|
|
1051
|
+
*/
|
|
1052
|
+
declare interface CreateCustomDataOptions {
|
|
1053
|
+
/** Text used for semantic (vector) search indexing of this entry. */
|
|
1054
|
+
searchText?: string;
|
|
1055
|
+
/**
|
|
1056
|
+
* Declare `data` fields this agent queries with filters, so the platform
|
|
1057
|
+
* maintains agent-scoped database indexes for them. Entries are a single
|
|
1058
|
+
* field path (`'business_id'`) or a compound of up to 2 paths
|
|
1059
|
+
* (`['country', 'business_id']`). Idempotent — declare on every write; an
|
|
1060
|
+
* index whose declaration stops arriving is removed after ~14 days.
|
|
1061
|
+
*/
|
|
1062
|
+
index?: Array<string | string[]>;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1049
1065
|
/**
|
|
1050
1066
|
* Response from creating custom data entry.
|
|
1051
1067
|
* Includes optional similarity score for search results.
|
|
@@ -1096,7 +1112,8 @@ declare interface CustomDataAPI {
|
|
|
1096
1112
|
* @param searchText - Optional text for vector search indexing
|
|
1097
1113
|
* @returns Promise resolving to created entry (DataEntryInstance)
|
|
1098
1114
|
*/
|
|
1099
|
-
|
|
1115
|
+
collections(): Promise<CustomDataCollectionsResponse>;
|
|
1116
|
+
create(collectionName: string, data: Record<string, any>, optionsOrSearchText?: string | CreateCustomDataOptions): Promise<DataEntryInstance>;
|
|
1100
1117
|
/**
|
|
1101
1118
|
* Gets entries from a collection with filtering and pagination.
|
|
1102
1119
|
* @param collectionName - Collection name
|
|
@@ -1121,7 +1138,7 @@ declare interface CustomDataAPI {
|
|
|
1121
1138
|
* @param searchText - Optional text for vector search indexing
|
|
1122
1139
|
* @returns Promise resolving to update response
|
|
1123
1140
|
*/
|
|
1124
|
-
update(collectionName: string, entryId: string, data: Record<string, any>,
|
|
1141
|
+
update(collectionName: string, entryId: string, data: Record<string, any>, optionsOrSearchText?: string | CreateCustomDataOptions): Promise<UpdateCustomDataResponse>;
|
|
1125
1142
|
/** Atomically sets and removes top-level entry fields and optionally changes search text. */
|
|
1126
1143
|
patch(collectionName: string, entryId: string, mutation: {
|
|
1127
1144
|
set?: Record<string, any>;
|
|
@@ -1146,6 +1163,29 @@ declare interface CustomDataAPI {
|
|
|
1146
1163
|
delete(collectionName: string, entryId: string): Promise<DeleteCustomDataResponse>;
|
|
1147
1164
|
}
|
|
1148
1165
|
|
|
1166
|
+
/** One collection in the agent's Data namespace, from Data.collections(). */
|
|
1167
|
+
declare interface CustomDataCollectionInfo {
|
|
1168
|
+
name: string;
|
|
1169
|
+
entryCount: number;
|
|
1170
|
+
lastUpdatedAt: number;
|
|
1171
|
+
firstCreatedAt: number;
|
|
1172
|
+
/** Managed index declarations for this collection — present only when declared. */
|
|
1173
|
+
indexes?: CustomDataIndexStatus[];
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
declare interface CustomDataCollectionsResponse {
|
|
1177
|
+
data: CustomDataCollectionInfo[];
|
|
1178
|
+
count: number;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
declare interface CustomDataEntry extends IdentifiedEntity, TimestampedEntity {
|
|
1182
|
+
id: string;
|
|
1183
|
+
data: Record<string, any>;
|
|
1184
|
+
createdAt: number;
|
|
1185
|
+
updatedAt: number;
|
|
1186
|
+
searchText?: string;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1149
1189
|
/**
|
|
1150
1190
|
* Custom data entry.
|
|
1151
1191
|
* Represents a single entry in a custom data collection.
|
|
@@ -1155,12 +1195,15 @@ declare interface CustomDataAPI {
|
|
|
1155
1195
|
* - Vector search via searchText
|
|
1156
1196
|
* - Automatic timestamps
|
|
1157
1197
|
*/
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1198
|
+
/** Status of one managed index declaration, from the collections listing. */
|
|
1199
|
+
declare interface CustomDataIndexStatus {
|
|
1200
|
+
fields: string[];
|
|
1201
|
+
/** pending | building | ready | failed | rejected */
|
|
1202
|
+
status: string;
|
|
1203
|
+
/** Populated when status is failed/rejected — the reason, verbatim. */
|
|
1204
|
+
error?: string;
|
|
1205
|
+
lastDeclaredAt: number;
|
|
1206
|
+
lastUsedAt?: number;
|
|
1164
1207
|
}
|
|
1165
1208
|
|
|
1166
1209
|
/**
|
|
@@ -1168,18 +1211,59 @@ declare interface CustomDataEntry extends IdentifiedEntity, TimestampedEntity {
|
|
|
1168
1211
|
* Store and retrieve custom data with vector search capabilities
|
|
1169
1212
|
*/
|
|
1170
1213
|
export declare const Data: {
|
|
1214
|
+
/**
|
|
1215
|
+
* Lists this agent's data collections, including managed index status
|
|
1216
|
+
* (fields, pending/building/ready/failed/rejected, error reasons) for any
|
|
1217
|
+
* declared indexes — the fastest way to diagnose a declaration.
|
|
1218
|
+
*
|
|
1219
|
+
* @returns Promise resolving to `{ data: CustomDataCollectionInfo[], count }`
|
|
1220
|
+
*/
|
|
1221
|
+
collections(): Promise<CustomDataCollectionsResponse>;
|
|
1171
1222
|
/**
|
|
1172
1223
|
* Creates a new entry in a custom data collection.
|
|
1173
1224
|
*
|
|
1225
|
+
* Declaring indexes: if your agent FILTERS this collection (e.g.
|
|
1226
|
+
* `Data.get(c, { business_id: 123 })`), declare the filtered fields here so
|
|
1227
|
+
* the platform maintains an index for them:
|
|
1228
|
+
*
|
|
1229
|
+
* ```typescript
|
|
1230
|
+
* await Data.create('inference_cache', doc, { index: ['business_id'] });
|
|
1231
|
+
* // Compound index (fields queried together) — note the NESTED array:
|
|
1232
|
+
* await Data.create('inference_cache', doc, { index: [['country', 'business_id']] });
|
|
1233
|
+
* // ['country', 'business_id'] WITHOUT nesting = two separate single-field
|
|
1234
|
+
* // indexes, which will NOT serve a combined filter efficiently.
|
|
1235
|
+
* ```
|
|
1236
|
+
*
|
|
1237
|
+
* Index semantics — read before relying on them:
|
|
1238
|
+
* - Builds are ASYNCHRONOUS: allow minutes after first declaration before
|
|
1239
|
+
* expecting fast queries. Check status via `Data.collections()`.
|
|
1240
|
+
* - A compound index serves filters on its leftmost field(s) only:
|
|
1241
|
+
* `[['country','business_id']]` serves `{country}` and
|
|
1242
|
+
* `{country, business_id}`, but NOT `{business_id}` alone.
|
|
1243
|
+
* - Limits: 2 fields per index, 3 declarations per call, 5 indexes per
|
|
1244
|
+
* agent. Over-limit or invalid declarations are REJECTED (visible in
|
|
1245
|
+
* index status), never silently trimmed.
|
|
1246
|
+
* - Lifecycle: an index stays while your agent uses it (declaring writes OR
|
|
1247
|
+
* matching filtered reads keep it alive) and is removed ~14 days after
|
|
1248
|
+
* all usage stops. No cleanup code needed.
|
|
1249
|
+
*
|
|
1174
1250
|
* @param collectionName - Name of the collection
|
|
1175
1251
|
* @param data - Data to store
|
|
1176
|
-
* @param
|
|
1252
|
+
* @param optionsOrSearchText - Options object `{ searchText?, index? }`.
|
|
1253
|
+
* Passing a bare string (legacy) sets `searchText` only — easy to confuse
|
|
1254
|
+
* with an index declaration, so prefer the object form.
|
|
1177
1255
|
* @returns Promise resolving to created entry
|
|
1178
1256
|
*/
|
|
1179
|
-
create(collectionName: string, data: Record<string, any>,
|
|
1257
|
+
create(collectionName: string, data: Record<string, any>, optionsOrSearchText?: string | CreateCustomDataOptions): Promise<DataEntryInstance>;
|
|
1180
1258
|
/**
|
|
1181
1259
|
* Retrieves entries from a collection with optional filtering and pagination.
|
|
1182
1260
|
*
|
|
1261
|
+
* Filtering a LARGE collection? Declare the filtered fields where you store
|
|
1262
|
+
* data — `Data.create(c, doc, { index: ['your_field'] })` — or queries will
|
|
1263
|
+
* slow down as the collection grows and eventually fail with an error
|
|
1264
|
+
* message naming the unindexed field and the declaration to add. Filtered reads on a declared field keep its index
|
|
1265
|
+
* alive automatically.
|
|
1266
|
+
*
|
|
1183
1267
|
* @param collectionName - Name of the collection
|
|
1184
1268
|
* @param filter - Optional filter criteria
|
|
1185
1269
|
* @param page - Page number (default: 1)
|
|
@@ -1204,7 +1288,7 @@ export declare const Data: {
|
|
|
1204
1288
|
* @param searchText - Optional new search text for vector search indexing
|
|
1205
1289
|
* @returns Promise resolving to update response
|
|
1206
1290
|
*/
|
|
1207
|
-
update(collectionName: string, entryId: string, data: Record<string, any>,
|
|
1291
|
+
update(collectionName: string, entryId: string, data: Record<string, any>, optionsOrSearchText?: string | CreateCustomDataOptions): Promise<UpdateCustomDataResponse>;
|
|
1208
1292
|
/**
|
|
1209
1293
|
* Performs vector search on a collection.
|
|
1210
1294
|
*
|
|
@@ -1747,6 +1831,60 @@ declare interface ImmutableUserProfile {
|
|
|
1747
1831
|
emailAddresses: string[];
|
|
1748
1832
|
}
|
|
1749
1833
|
|
|
1834
|
+
/**
|
|
1835
|
+
* PRO-1208 (B7) — `User.Inbox.push()`: the governed SDK door into a user's
|
|
1836
|
+
* inbox. Shared between the sandbox runtime (the SDK surface), lua-core (the
|
|
1837
|
+
* seam's `runInboxPush`) and lua-api (the lua-cli dev route) so all three
|
|
1838
|
+
* speak one wire contract.
|
|
1839
|
+
*/
|
|
1840
|
+
/** What the card offers. `approve` requires `options` (routed through the
|
|
1841
|
+
* agent-question path so answers are one click); `fix` requires
|
|
1842
|
+
* `connection`; plain notices need neither. */
|
|
1843
|
+
declare type InboxPushAction = 'approve' | 'redirect' | 'fix';
|
|
1844
|
+
|
|
1845
|
+
declare interface InboxPushInput {
|
|
1846
|
+
/** Card title — the row's first line. 1..140 chars after trim. */
|
|
1847
|
+
title: string;
|
|
1848
|
+
/** The human body — the row's context line and the detail pane's prose. */
|
|
1849
|
+
body: string;
|
|
1850
|
+
/** Optional longer detail shown only in the drill-in pane. */
|
|
1851
|
+
detail?: string;
|
|
1852
|
+
/** Primary link out (issue URL, doc permalink) — rendered as the card's
|
|
1853
|
+
* source link, never auto-opened. */
|
|
1854
|
+
deeplink?: string;
|
|
1855
|
+
/** Server-clamped: urgent is limited per day and demoted when over budget. */
|
|
1856
|
+
priority?: 'urgent' | 'high' | 'normal' | 'low';
|
|
1857
|
+
actions?: InboxPushAction[];
|
|
1858
|
+
/** One-click answers (2..4). Presence routes the push through the
|
|
1859
|
+
* agent-question path — the user's pick resolves the card. */
|
|
1860
|
+
options?: {
|
|
1861
|
+
label: string;
|
|
1862
|
+
description?: string;
|
|
1863
|
+
}[];
|
|
1864
|
+
/** For `fix`: the integration the agent needs — catalog slug + display name. */
|
|
1865
|
+
connection?: {
|
|
1866
|
+
type: string;
|
|
1867
|
+
name: string;
|
|
1868
|
+
};
|
|
1869
|
+
/** Idempotency/revision key: same key = revise the existing card in place,
|
|
1870
|
+
* never a second knock. Omit for one-shot notices. */
|
|
1871
|
+
key?: string;
|
|
1872
|
+
/** Conversation the card should hand off into when the user acts. */
|
|
1873
|
+
threadId?: string;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
declare type InboxPushOutcome = 'deposited' | 'updated' | 'exists' | 'capped';
|
|
1877
|
+
|
|
1878
|
+
declare interface InboxPushReceipt {
|
|
1879
|
+
outcome: InboxPushOutcome;
|
|
1880
|
+
/** The inbox kind the push routed to. */
|
|
1881
|
+
kind: 'input_request' | 'connection_fix' | 'agent_notice';
|
|
1882
|
+
/** Echo of the dedup key (or the generated one) — reuse it to revise. */
|
|
1883
|
+
key: string;
|
|
1884
|
+
/** Present on `capped`: what to tell the agent author. */
|
|
1885
|
+
reason?: string;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1750
1888
|
/**
|
|
1751
1889
|
* Job with versions array
|
|
1752
1890
|
* Matches JobDto and job.schema.ts
|
|
@@ -2284,6 +2422,7 @@ export declare const Lua: LuaRuntime;
|
|
|
2284
2422
|
*/
|
|
2285
2423
|
export declare class LuaAgent {
|
|
2286
2424
|
private readonly name;
|
|
2425
|
+
private readonly description?;
|
|
2287
2426
|
private readonly persona;
|
|
2288
2427
|
private readonly model?;
|
|
2289
2428
|
private readonly modelSettings?;
|
|
@@ -2318,6 +2457,8 @@ export declare class LuaAgent {
|
|
|
2318
2457
|
*/
|
|
2319
2458
|
constructor(config: LuaAgentConfig);
|
|
2320
2459
|
getName(): string;
|
|
2460
|
+
/** Capability summary consumed by Space routing. */
|
|
2461
|
+
getDescription(): string | undefined;
|
|
2321
2462
|
/** Browser switch (LuaBrowser) — `true`/config when the agent can browse. */
|
|
2322
2463
|
getBrowser(): LuaAgentConfig['browser'];
|
|
2323
2464
|
getPersona(): PersonaText;
|
|
@@ -2338,6 +2479,12 @@ export declare class LuaAgent {
|
|
|
2338
2479
|
export declare interface LuaAgentConfig {
|
|
2339
2480
|
/** Agent name (used for identification) */
|
|
2340
2481
|
name: string;
|
|
2482
|
+
/**
|
|
2483
|
+
* Short capability summary used by Spaces to decide when to delegate to
|
|
2484
|
+
* this agent. Keep this focused on what the agent can do; the persona owns
|
|
2485
|
+
* behavior, voice, and detailed instructions.
|
|
2486
|
+
*/
|
|
2487
|
+
description?: string;
|
|
2341
2488
|
/** Agent persona - defines the agent's behavior and personality */
|
|
2342
2489
|
persona: PersonaText;
|
|
2343
2490
|
/** LLM model to use — 'provider/model' string or resolver function */
|
|
@@ -5461,6 +5608,21 @@ export declare const User: {
|
|
|
5461
5608
|
* ```
|
|
5462
5609
|
*/
|
|
5463
5610
|
getChatHistory(): Promise<ChatHistoryMessage[]>;
|
|
5611
|
+
/**
|
|
5612
|
+
* PRO-1208 (B7) — push an approve/redirect/fix card to YOUR OWN inbox.
|
|
5613
|
+
* Capped (5/day per agent), urgent-clamped, same-`key` deduped (revise in
|
|
5614
|
+
* place). Cap-hit resolves to `{outcome: 'capped'}` — never throws.
|
|
5615
|
+
*
|
|
5616
|
+
* @example
|
|
5617
|
+
* const receipt = await User.Inbox.push({
|
|
5618
|
+
* title: 'Nightly digest ready',
|
|
5619
|
+
* body: 'Built and filed to the Library.',
|
|
5620
|
+
* key: 'nightly-digest',
|
|
5621
|
+
* });
|
|
5622
|
+
*/
|
|
5623
|
+
Inbox: {
|
|
5624
|
+
push(input: InboxPushInput): Promise<InboxPushReceipt>;
|
|
5625
|
+
};
|
|
5464
5626
|
};
|
|
5465
5627
|
|
|
5466
5628
|
/**
|
package/dist/api-exports.js
CHANGED
|
@@ -351,6 +351,9 @@ function isDesktopFileCommandName(value) {
|
|
|
351
351
|
function isDesktopFileSessionId(value) {
|
|
352
352
|
return typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
|
|
353
353
|
}
|
|
354
|
+
function isImplicitModelSelectionSource(source) {
|
|
355
|
+
return source !== void 0 && IMPLICIT_MODEL_SELECTION_SOURCES.includes(source);
|
|
356
|
+
}
|
|
354
357
|
function resolveRequireToolApproval(rules) {
|
|
355
358
|
const raw = rules?.requireToolApproval ?? rules?.requireApproval;
|
|
356
359
|
if (raw === void 0 || raw === null) return void 0;
|
|
@@ -378,7 +381,7 @@ function normalizeLuaJobExecutionTimeoutSeconds(timeout) {
|
|
|
378
381
|
}
|
|
379
382
|
return Math.min(Math.max(timeout, LUA_JOB_MIN_TIMEOUT_SECONDS), LUA_JOB_MAX_TIMEOUT_SECONDS);
|
|
380
383
|
}
|
|
381
|
-
var __defProp2, __name2, CHANNEL_SEND_CHANNELS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, REASONING_EFFORT_VALUES, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS;
|
|
384
|
+
var __defProp2, __name2, CHANNEL_SEND_CHANNELS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, REASONING_EFFORT_VALUES, IMPLICIT_MODEL_SELECTION_SOURCES, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS;
|
|
382
385
|
var init_dist = __esm({
|
|
383
386
|
"../shared-types/dist/index.mjs"() {
|
|
384
387
|
"use strict";
|
|
@@ -701,6 +704,12 @@ var init_dist = __esm({
|
|
|
701
704
|
"high",
|
|
702
705
|
"max"
|
|
703
706
|
];
|
|
707
|
+
IMPLICIT_MODEL_SELECTION_SOURCES = [
|
|
708
|
+
"workspace-default",
|
|
709
|
+
"platform-default"
|
|
710
|
+
];
|
|
711
|
+
__name(isImplicitModelSelectionSource, "isImplicitModelSelectionSource");
|
|
712
|
+
__name2(isImplicitModelSelectionSource, "isImplicitModelSelectionSource");
|
|
704
713
|
__name(resolveRequireToolApproval, "resolveRequireToolApproval");
|
|
705
714
|
__name2(resolveRequireToolApproval, "resolveRequireToolApproval");
|
|
706
715
|
AGENT_NAME_TOKEN = "[Your Agent Name]";
|
|
@@ -4476,17 +4485,42 @@ var init_custom_data_api_service = __esm({
|
|
|
4476
4485
|
this.agentId = agentId;
|
|
4477
4486
|
}
|
|
4478
4487
|
/**
|
|
4488
|
+
* Lists the agent's data collections with entry counts, timestamps, and —
|
|
4489
|
+
* when declared — managed index status (fields, pending/building/ready/
|
|
4490
|
+
* failed/rejected, error reason). The place to diagnose index declarations.
|
|
4491
|
+
* @returns Promise resolving to the collections listing
|
|
4492
|
+
*/
|
|
4493
|
+
async collections() {
|
|
4494
|
+
const response = await this.httpGet(`/developer/agents/${this.agentId}/custom-data`, {
|
|
4495
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
4496
|
+
});
|
|
4497
|
+
if (response.success && response.data) {
|
|
4498
|
+
return response.data;
|
|
4499
|
+
}
|
|
4500
|
+
throw new Error(response.error?.message || "Failed to list custom data collections");
|
|
4501
|
+
}
|
|
4502
|
+
/**
|
|
4479
4503
|
* Creates a new custom data entry in a specified collection
|
|
4480
4504
|
* @param collectionName - The name of the collection to create the entry in
|
|
4481
4505
|
* @param data - The data object to store in the entry
|
|
4482
|
-
* @param
|
|
4506
|
+
* @param optionsOrSearchText - Either a searchText string (legacy form) or an
|
|
4507
|
+
* options object: `searchText` for semantic search indexing, and `index` to
|
|
4508
|
+
* declare data fields this agent filters on (e.g. `['business_id']` or
|
|
4509
|
+
* compounds like `[['country', 'business_id']]`). Declared fields get
|
|
4510
|
+
* agent-scoped database indexes maintained by the platform: created when
|
|
4511
|
+
* first declared, removed automatically ~14 days after the code stops
|
|
4512
|
+
* declaring them. Declaring on every write is the intended, idempotent use.
|
|
4483
4513
|
* @returns Promise resolving to a DataEntryInstance representing the created entry
|
|
4484
4514
|
* @throws Error if the entry creation fails or the API request is unsuccessful
|
|
4485
4515
|
*/
|
|
4486
|
-
async create(collectionName, data,
|
|
4516
|
+
async create(collectionName, data, optionsOrSearchText) {
|
|
4517
|
+
const options = typeof optionsOrSearchText === "string" ? {
|
|
4518
|
+
searchText: optionsOrSearchText
|
|
4519
|
+
} : optionsOrSearchText ?? {};
|
|
4487
4520
|
const response = await this.httpPost(`/developer/agents/${this.agentId}/custom-data/${collectionName}`, {
|
|
4488
4521
|
data,
|
|
4489
|
-
searchText
|
|
4522
|
+
searchText: options.searchText,
|
|
4523
|
+
index: options.index
|
|
4490
4524
|
}, {
|
|
4491
4525
|
Authorization: `Bearer ${this.apiKey}`
|
|
4492
4526
|
});
|
|
@@ -4539,14 +4573,19 @@ var init_custom_data_api_service = __esm({
|
|
|
4539
4573
|
* @param collectionName - The name of the collection containing the entry
|
|
4540
4574
|
* @param entryId - The unique identifier of the entry to update
|
|
4541
4575
|
* @param data - The data object to update
|
|
4542
|
-
* @param
|
|
4576
|
+
* @param optionsOrSearchText - searchText string (legacy) or { searchText?, index? };
|
|
4577
|
+
* `index` refreshes this agent's index declarations (same semantics as create)
|
|
4543
4578
|
* @returns Promise resolving to an UpdateCustomDataResponse with the updated entry details
|
|
4544
4579
|
* @throws Error if the entry is not found or the update fails
|
|
4545
4580
|
*/
|
|
4546
|
-
async update(collectionName, entryId, data,
|
|
4581
|
+
async update(collectionName, entryId, data, optionsOrSearchText) {
|
|
4582
|
+
const options = typeof optionsOrSearchText === "string" ? {
|
|
4583
|
+
searchText: optionsOrSearchText
|
|
4584
|
+
} : optionsOrSearchText ?? {};
|
|
4547
4585
|
const response = await this.httpPut(`/developer/agents/${this.agentId}/custom-data/${collectionName}/${entryId}`, {
|
|
4548
4586
|
data,
|
|
4549
|
-
searchText
|
|
4587
|
+
searchText: options.searchText,
|
|
4588
|
+
index: options.index
|
|
4550
4589
|
}, {
|
|
4551
4590
|
Authorization: `Bearer ${this.apiKey}`
|
|
4552
4591
|
});
|
|
@@ -5792,6 +5831,31 @@ var init_channels_send_api_service = __esm({
|
|
|
5792
5831
|
}
|
|
5793
5832
|
});
|
|
5794
5833
|
|
|
5834
|
+
// src/api/inbox-push.api.service.ts
|
|
5835
|
+
var InboxPushApiService;
|
|
5836
|
+
var init_inbox_push_api_service = __esm({
|
|
5837
|
+
"src/api/inbox-push.api.service.ts"() {
|
|
5838
|
+
"use strict";
|
|
5839
|
+
init_http_client();
|
|
5840
|
+
InboxPushApiService = class extends HttpClient {
|
|
5841
|
+
static {
|
|
5842
|
+
__name(this, "InboxPushApiService");
|
|
5843
|
+
}
|
|
5844
|
+
apiKey;
|
|
5845
|
+
agentId;
|
|
5846
|
+
constructor(baseUrl, apiKey, agentId) {
|
|
5847
|
+
super(baseUrl), this.apiKey = apiKey, this.agentId = agentId;
|
|
5848
|
+
}
|
|
5849
|
+
/** POST /developer/agents/:agentId/inbox/push */
|
|
5850
|
+
async push(input) {
|
|
5851
|
+
return this.httpPost(`/developer/agents/${this.agentId}/inbox/push`, input, {
|
|
5852
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
5853
|
+
});
|
|
5854
|
+
}
|
|
5855
|
+
};
|
|
5856
|
+
}
|
|
5857
|
+
});
|
|
5858
|
+
|
|
5795
5859
|
// src/api/directory.api.service.ts
|
|
5796
5860
|
var DirectoryApiService;
|
|
5797
5861
|
var init_directory_api_service = __esm({
|
|
@@ -5927,6 +5991,7 @@ __export(lazy_instances_exports, {
|
|
|
5927
5991
|
getDeveloperInstance: () => getDeveloperInstance,
|
|
5928
5992
|
getDeviceInstance: () => getDeviceInstance,
|
|
5929
5993
|
getDirectoryInstance: () => getDirectoryInstance,
|
|
5994
|
+
getInboxPushInstance: () => getInboxPushInstance,
|
|
5930
5995
|
getJobInstance: () => getJobInstance,
|
|
5931
5996
|
getOrderInstance: () => getOrderInstance,
|
|
5932
5997
|
getProductsInstance: () => getProductsInstance,
|
|
@@ -6034,6 +6099,13 @@ async function getVoiceInstance() {
|
|
|
6034
6099
|
}
|
|
6035
6100
|
return _voiceInstance;
|
|
6036
6101
|
}
|
|
6102
|
+
async function getInboxPushInstance() {
|
|
6103
|
+
if (!_inboxPushInstance) {
|
|
6104
|
+
const creds = await getCredentials();
|
|
6105
|
+
_inboxPushInstance = new InboxPushApiService(BASE_URLS.API, creds.apiKey, creds.agentId);
|
|
6106
|
+
}
|
|
6107
|
+
return _inboxPushInstance;
|
|
6108
|
+
}
|
|
6037
6109
|
async function getChannelsSendInstance() {
|
|
6038
6110
|
if (!_channelsSendInstance) {
|
|
6039
6111
|
const creds = await getCredentials();
|
|
@@ -6065,7 +6137,7 @@ function clearAllInstances() {
|
|
|
6065
6137
|
_channelsSendInstance = null;
|
|
6066
6138
|
_directoryInstance = null;
|
|
6067
6139
|
}
|
|
6068
|
-
var _userInstance, _dataInstance, _productsInstance, _basketsInstance, _orderInstance, _webhookInstance, _jobInstance, _aiInstance, _agentsInstance, _whatsAppTemplatesInstance, _cdnInstance, _developerInstance, _voiceInstance, _channelsSendInstance, _directoryInstance, _deviceInstance;
|
|
6140
|
+
var _userInstance, _dataInstance, _productsInstance, _basketsInstance, _orderInstance, _webhookInstance, _jobInstance, _aiInstance, _agentsInstance, _whatsAppTemplatesInstance, _cdnInstance, _developerInstance, _voiceInstance, _channelsSendInstance, _directoryInstance, _deviceInstance, _inboxPushInstance;
|
|
6069
6141
|
var init_lazy_instances = __esm({
|
|
6070
6142
|
"src/api/lazy-instances.ts"() {
|
|
6071
6143
|
"use strict";
|
|
@@ -6085,6 +6157,7 @@ var init_lazy_instances = __esm({
|
|
|
6085
6157
|
init_developer_api_service();
|
|
6086
6158
|
init_voice_api_service();
|
|
6087
6159
|
init_channels_send_api_service();
|
|
6160
|
+
init_inbox_push_api_service();
|
|
6088
6161
|
init_directory_api_service();
|
|
6089
6162
|
_userInstance = null;
|
|
6090
6163
|
_dataInstance = null;
|
|
@@ -6116,6 +6189,8 @@ var init_lazy_instances = __esm({
|
|
|
6116
6189
|
__name(getDeviceInstance, "getDeviceInstance");
|
|
6117
6190
|
__name(getDeveloperInstance, "getDeveloperInstance");
|
|
6118
6191
|
__name(getVoiceInstance, "getVoiceInstance");
|
|
6192
|
+
_inboxPushInstance = null;
|
|
6193
|
+
__name(getInboxPushInstance, "getInboxPushInstance");
|
|
6119
6194
|
__name(getChannelsSendInstance, "getChannelsSendInstance");
|
|
6120
6195
|
__name(getDirectoryInstance, "getDirectoryInstance");
|
|
6121
6196
|
__name(clearAllInstances, "clearAllInstances");
|
|
@@ -6607,6 +6682,7 @@ var LuaAgent = class {
|
|
|
6607
6682
|
__name(this, "LuaAgent");
|
|
6608
6683
|
}
|
|
6609
6684
|
name;
|
|
6685
|
+
description;
|
|
6610
6686
|
persona;
|
|
6611
6687
|
model;
|
|
6612
6688
|
modelSettings;
|
|
@@ -6641,6 +6717,7 @@ var LuaAgent = class {
|
|
|
6641
6717
|
*/
|
|
6642
6718
|
constructor(config) {
|
|
6643
6719
|
this.name = config.name;
|
|
6720
|
+
this.description = config.description;
|
|
6644
6721
|
this.persona = config.persona;
|
|
6645
6722
|
this.model = config.model;
|
|
6646
6723
|
if (config.modelSettings !== void 0) {
|
|
@@ -6669,6 +6746,10 @@ var LuaAgent = class {
|
|
|
6669
6746
|
getName() {
|
|
6670
6747
|
return this.name;
|
|
6671
6748
|
}
|
|
6749
|
+
/** Capability summary consumed by Space routing. */
|
|
6750
|
+
getDescription() {
|
|
6751
|
+
return this.description;
|
|
6752
|
+
}
|
|
6672
6753
|
/** Browser switch (LuaBrowser) — `true`/config when the agent can browse. */
|
|
6673
6754
|
getBrowser() {
|
|
6674
6755
|
return this.browser;
|
|
@@ -6890,24 +6971,88 @@ var User = {
|
|
|
6890
6971
|
async getChatHistory() {
|
|
6891
6972
|
const instance = await getUserInstance();
|
|
6892
6973
|
return instance.getChatHistory();
|
|
6974
|
+
},
|
|
6975
|
+
/**
|
|
6976
|
+
* PRO-1208 (B7) — push an approve/redirect/fix card to YOUR OWN inbox.
|
|
6977
|
+
* Capped (5/day per agent), urgent-clamped, same-`key` deduped (revise in
|
|
6978
|
+
* place). Cap-hit resolves to `{outcome: 'capped'}` — never throws.
|
|
6979
|
+
*
|
|
6980
|
+
* @example
|
|
6981
|
+
* const receipt = await User.Inbox.push({
|
|
6982
|
+
* title: 'Nightly digest ready',
|
|
6983
|
+
* body: 'Built and filed to the Library.',
|
|
6984
|
+
* key: 'nightly-digest',
|
|
6985
|
+
* });
|
|
6986
|
+
*/
|
|
6987
|
+
Inbox: {
|
|
6988
|
+
async push(input) {
|
|
6989
|
+
const { getInboxPushInstance: getInboxPushInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
|
|
6990
|
+
const service = await getInboxPushInstance2();
|
|
6991
|
+
const res = await service.push(input);
|
|
6992
|
+
return res.data;
|
|
6993
|
+
}
|
|
6893
6994
|
}
|
|
6894
6995
|
};
|
|
6895
6996
|
var Data = {
|
|
6997
|
+
/**
|
|
6998
|
+
* Lists this agent's data collections, including managed index status
|
|
6999
|
+
* (fields, pending/building/ready/failed/rejected, error reasons) for any
|
|
7000
|
+
* declared indexes — the fastest way to diagnose a declaration.
|
|
7001
|
+
*
|
|
7002
|
+
* @returns Promise resolving to `{ data: CustomDataCollectionInfo[], count }`
|
|
7003
|
+
*/
|
|
7004
|
+
async collections() {
|
|
7005
|
+
const instance = await getDataInstance();
|
|
7006
|
+
return instance.collections();
|
|
7007
|
+
},
|
|
6896
7008
|
/**
|
|
6897
7009
|
* Creates a new entry in a custom data collection.
|
|
6898
7010
|
*
|
|
7011
|
+
* Declaring indexes: if your agent FILTERS this collection (e.g.
|
|
7012
|
+
* `Data.get(c, { business_id: 123 })`), declare the filtered fields here so
|
|
7013
|
+
* the platform maintains an index for them:
|
|
7014
|
+
*
|
|
7015
|
+
* ```typescript
|
|
7016
|
+
* await Data.create('inference_cache', doc, { index: ['business_id'] });
|
|
7017
|
+
* // Compound index (fields queried together) — note the NESTED array:
|
|
7018
|
+
* await Data.create('inference_cache', doc, { index: [['country', 'business_id']] });
|
|
7019
|
+
* // ['country', 'business_id'] WITHOUT nesting = two separate single-field
|
|
7020
|
+
* // indexes, which will NOT serve a combined filter efficiently.
|
|
7021
|
+
* ```
|
|
7022
|
+
*
|
|
7023
|
+
* Index semantics — read before relying on them:
|
|
7024
|
+
* - Builds are ASYNCHRONOUS: allow minutes after first declaration before
|
|
7025
|
+
* expecting fast queries. Check status via `Data.collections()`.
|
|
7026
|
+
* - A compound index serves filters on its leftmost field(s) only:
|
|
7027
|
+
* `[['country','business_id']]` serves `{country}` and
|
|
7028
|
+
* `{country, business_id}`, but NOT `{business_id}` alone.
|
|
7029
|
+
* - Limits: 2 fields per index, 3 declarations per call, 5 indexes per
|
|
7030
|
+
* agent. Over-limit or invalid declarations are REJECTED (visible in
|
|
7031
|
+
* index status), never silently trimmed.
|
|
7032
|
+
* - Lifecycle: an index stays while your agent uses it (declaring writes OR
|
|
7033
|
+
* matching filtered reads keep it alive) and is removed ~14 days after
|
|
7034
|
+
* all usage stops. No cleanup code needed.
|
|
7035
|
+
*
|
|
6899
7036
|
* @param collectionName - Name of the collection
|
|
6900
7037
|
* @param data - Data to store
|
|
6901
|
-
* @param
|
|
7038
|
+
* @param optionsOrSearchText - Options object `{ searchText?, index? }`.
|
|
7039
|
+
* Passing a bare string (legacy) sets `searchText` only — easy to confuse
|
|
7040
|
+
* with an index declaration, so prefer the object form.
|
|
6902
7041
|
* @returns Promise resolving to created entry
|
|
6903
7042
|
*/
|
|
6904
|
-
async create(collectionName, data,
|
|
7043
|
+
async create(collectionName, data, optionsOrSearchText) {
|
|
6905
7044
|
const instance = await getDataInstance();
|
|
6906
|
-
return instance.create(collectionName, data,
|
|
7045
|
+
return instance.create(collectionName, data, optionsOrSearchText);
|
|
6907
7046
|
},
|
|
6908
7047
|
/**
|
|
6909
7048
|
* Retrieves entries from a collection with optional filtering and pagination.
|
|
6910
7049
|
*
|
|
7050
|
+
* Filtering a LARGE collection? Declare the filtered fields where you store
|
|
7051
|
+
* data — `Data.create(c, doc, { index: ['your_field'] })` — or queries will
|
|
7052
|
+
* slow down as the collection grows and eventually fail with an error
|
|
7053
|
+
* message naming the unindexed field and the declaration to add. Filtered reads on a declared field keep its index
|
|
7054
|
+
* alive automatically.
|
|
7055
|
+
*
|
|
6911
7056
|
* @param collectionName - Name of the collection
|
|
6912
7057
|
* @param filter - Optional filter criteria
|
|
6913
7058
|
* @param page - Page number (default: 1)
|
|
@@ -6938,9 +7083,9 @@ var Data = {
|
|
|
6938
7083
|
* @param searchText - Optional new search text for vector search indexing
|
|
6939
7084
|
* @returns Promise resolving to update response
|
|
6940
7085
|
*/
|
|
6941
|
-
async update(collectionName, entryId, data,
|
|
7086
|
+
async update(collectionName, entryId, data, optionsOrSearchText) {
|
|
6942
7087
|
const instance = await getDataInstance();
|
|
6943
|
-
return instance.update(collectionName, entryId, data,
|
|
7088
|
+
return instance.update(collectionName, entryId, data, optionsOrSearchText);
|
|
6944
7089
|
},
|
|
6945
7090
|
/**
|
|
6946
7091
|
* Performs vector search on a collection.
|