crewly 1.20.209 → 1.20.211

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/config/skills/agent/core/app-data/SKILL.md +117 -0
  2. package/config/skills/agent/core/app-data/execute.sh +141 -0
  3. package/config/skills/agent/core/app-data/execute.test.sh +108 -0
  4. package/config/skills/agent/core/publish-app/SKILL.md +248 -0
  5. package/config/skills/agent/core/publish-app/execute.sh +302 -0
  6. package/config/skills/agent/core/publish-app/execute.test.sh +205 -0
  7. package/dist/backend/backend/src/constants.d.ts +115 -0
  8. package/dist/backend/backend/src/constants.d.ts.map +1 -1
  9. package/dist/backend/backend/src/constants.js +115 -0
  10. package/dist/backend/backend/src/constants.js.map +1 -1
  11. package/dist/backend/backend/src/controllers/apps/apps.controller.d.ts +55 -0
  12. package/dist/backend/backend/src/controllers/apps/apps.controller.d.ts.map +1 -0
  13. package/dist/backend/backend/src/controllers/apps/apps.controller.js +131 -0
  14. package/dist/backend/backend/src/controllers/apps/apps.controller.js.map +1 -0
  15. package/dist/backend/backend/src/controllers/apps/apps.routes.d.ts +53 -0
  16. package/dist/backend/backend/src/controllers/apps/apps.routes.d.ts.map +1 -0
  17. package/dist/backend/backend/src/controllers/apps/apps.routes.js +108 -0
  18. package/dist/backend/backend/src/controllers/apps/apps.routes.js.map +1 -0
  19. package/dist/backend/backend/src/index.d.ts +1 -0
  20. package/dist/backend/backend/src/index.d.ts.map +1 -1
  21. package/dist/backend/backend/src/index.js +57 -5
  22. package/dist/backend/backend/src/index.js.map +1 -1
  23. package/dist/backend/backend/src/middleware/body-parser-except.d.ts +25 -0
  24. package/dist/backend/backend/src/middleware/body-parser-except.d.ts.map +1 -0
  25. package/dist/backend/backend/src/middleware/body-parser-except.js +33 -0
  26. package/dist/backend/backend/src/middleware/body-parser-except.js.map +1 -0
  27. package/dist/backend/backend/src/routes/api.routes.d.ts.map +1 -1
  28. package/dist/backend/backend/src/routes/api.routes.js +4 -0
  29. package/dist/backend/backend/src/routes/api.routes.js.map +1 -1
  30. package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.d.ts.map +1 -1
  31. package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js +5 -0
  32. package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js.map +1 -1
  33. package/dist/backend/backend/src/services/apps/app-open-link.d.ts +61 -0
  34. package/dist/backend/backend/src/services/apps/app-open-link.d.ts.map +1 -0
  35. package/dist/backend/backend/src/services/apps/app-open-link.js +112 -0
  36. package/dist/backend/backend/src/services/apps/app-open-link.js.map +1 -0
  37. package/dist/backend/backend/src/services/apps/app-wake-message.d.ts +136 -0
  38. package/dist/backend/backend/src/services/apps/app-wake-message.d.ts.map +1 -0
  39. package/dist/backend/backend/src/services/apps/app-wake-message.js +253 -0
  40. package/dist/backend/backend/src/services/apps/app-wake-message.js.map +1 -0
  41. package/dist/backend/backend/src/services/apps/app-wake.service.d.ts +145 -0
  42. package/dist/backend/backend/src/services/apps/app-wake.service.d.ts.map +1 -0
  43. package/dist/backend/backend/src/services/apps/app-wake.service.js +455 -0
  44. package/dist/backend/backend/src/services/apps/app-wake.service.js.map +1 -0
  45. package/dist/backend/backend/src/services/apps/apps-cloud.client.d.ts +74 -0
  46. package/dist/backend/backend/src/services/apps/apps-cloud.client.d.ts.map +1 -0
  47. package/dist/backend/backend/src/services/apps/apps-cloud.client.js +120 -0
  48. package/dist/backend/backend/src/services/apps/apps-cloud.client.js.map +1 -0
  49. package/dist/backend/backend/src/services/apps/apps-registry.service.d.ts +125 -0
  50. package/dist/backend/backend/src/services/apps/apps-registry.service.d.ts.map +1 -0
  51. package/dist/backend/backend/src/services/apps/apps-registry.service.js +192 -0
  52. package/dist/backend/backend/src/services/apps/apps-registry.service.js.map +1 -0
  53. package/dist/backend/backend/src/services/apps/apps.service.d.ts +466 -0
  54. package/dist/backend/backend/src/services/apps/apps.service.d.ts.map +1 -0
  55. package/dist/backend/backend/src/services/apps/apps.service.js +740 -0
  56. package/dist/backend/backend/src/services/apps/apps.service.js.map +1 -0
  57. package/dist/backend/backend/src/services/apps/apps.wiring.d.ts +97 -0
  58. package/dist/backend/backend/src/services/apps/apps.wiring.d.ts.map +1 -0
  59. package/dist/backend/backend/src/services/apps/apps.wiring.js +153 -0
  60. package/dist/backend/backend/src/services/apps/apps.wiring.js.map +1 -0
  61. package/dist/backend/backend/src/services/chat-v2/chat-v2.dispatcher.service.d.ts.map +1 -1
  62. package/dist/backend/backend/src/services/chat-v2/chat-v2.dispatcher.service.js +3 -1
  63. package/dist/backend/backend/src/services/chat-v2/chat-v2.dispatcher.service.js.map +1 -1
  64. package/dist/backend/backend/src/services/core/logger.service.d.ts +5 -0
  65. package/dist/backend/backend/src/services/core/logger.service.d.ts.map +1 -1
  66. package/dist/backend/backend/src/services/core/logger.service.js +8 -0
  67. package/dist/backend/backend/src/services/core/logger.service.js.map +1 -1
  68. package/dist/backend/backend/src/services/slack/slack-thread-context.service.d.ts.map +1 -1
  69. package/dist/backend/backend/src/services/slack/slack-thread-context.service.js +3 -1
  70. package/dist/backend/backend/src/services/slack/slack-thread-context.service.js.map +1 -1
  71. package/dist/backend/build-info.json +2 -2
  72. package/dist/cli/backend/src/constants.d.ts +115 -0
  73. package/dist/cli/backend/src/constants.d.ts.map +1 -1
  74. package/dist/cli/backend/src/constants.js +115 -0
  75. package/dist/cli/backend/src/constants.js.map +1 -1
  76. package/dist/cli/backend/src/services/ai/prompt-modules/skills-reference.module.d.ts.map +1 -1
  77. package/dist/cli/backend/src/services/ai/prompt-modules/skills-reference.module.js +5 -0
  78. package/dist/cli/backend/src/services/ai/prompt-modules/skills-reference.module.js.map +1 -1
  79. package/dist/cli/backend/src/services/apps/app-open-link.d.ts +61 -0
  80. package/dist/cli/backend/src/services/apps/app-open-link.d.ts.map +1 -0
  81. package/dist/cli/backend/src/services/apps/app-open-link.js +112 -0
  82. package/dist/cli/backend/src/services/apps/app-open-link.js.map +1 -0
  83. package/dist/cli/backend/src/services/chat-v2/chat-v2.dispatcher.service.d.ts.map +1 -1
  84. package/dist/cli/backend/src/services/chat-v2/chat-v2.dispatcher.service.js +3 -1
  85. package/dist/cli/backend/src/services/chat-v2/chat-v2.dispatcher.service.js.map +1 -1
  86. package/dist/cli/backend/src/services/core/logger.service.d.ts +5 -0
  87. package/dist/cli/backend/src/services/core/logger.service.d.ts.map +1 -1
  88. package/dist/cli/backend/src/services/core/logger.service.js +8 -0
  89. package/dist/cli/backend/src/services/core/logger.service.js.map +1 -1
  90. package/dist/cli/backend/src/services/slack/slack-thread-context.service.d.ts.map +1 -1
  91. package/dist/cli/backend/src/services/slack/slack-thread-context.service.js +3 -1
  92. package/dist/cli/backend/src/services/slack/slack-thread-context.service.js.map +1 -1
  93. package/package.json +1 -1
@@ -0,0 +1,466 @@
1
+ /**
2
+ * AppsService — publish, roll back and read/write the data of Crewly Apps
3
+ * on behalf of an agent (or the owner), through {@link AppsCloudClient}.
4
+ *
5
+ * Backs `/api/apps` and the publish-app / app-data skills
6
+ * (specs/2026-10-04-crewly-apps-p2.md).
7
+ *
8
+ * @module services/apps/apps.service
9
+ */
10
+ import { AppsCloudClient } from './apps-cloud.client.js';
11
+ import type { AppRegistryEntry, AppsRegistryService } from './apps-registry.service.js';
12
+ import { type OpenLinkInfo } from './app-open-link.js';
13
+ /** Cloud's view of an app (apps/SPEC.md §3.1). */
14
+ export interface CloudAppView {
15
+ appId: string;
16
+ name: string;
17
+ slug: string | null;
18
+ url: string;
19
+ currentVersion: number | null;
20
+ latestVersion: number;
21
+ /** P3: `private` unless the owner approved a public request in the shell */
22
+ visibility?: AppVisibility;
23
+ /** P3: collections anonymous visitors may read */
24
+ publicRead?: string[];
25
+ /** P3: collections anonymous visitors may add to (append-only) */
26
+ publicSubmit?: string[];
27
+ /** P3: a request waiting for the owner, or null */
28
+ publicRequest?: PublicRequestView | null;
29
+ }
30
+ /** Who can open an app without signing in (P3 §2). */
31
+ export type AppVisibility = 'private' | 'public';
32
+ /** A pending request to make an app public, as Cloud shows it. */
33
+ export interface PublicRequestView {
34
+ publicRead: string[];
35
+ publicSubmit: string[];
36
+ note: string | null;
37
+ requestedBy: string | null;
38
+ requestedAt: string | null;
39
+ }
40
+ /** What an agent asks to open to anonymous visitors. */
41
+ export interface PublicRequestInput {
42
+ publicRead?: unknown;
43
+ publicSubmit?: unknown;
44
+ note?: unknown;
45
+ }
46
+ /** Cloud's view of a version. */
47
+ export interface CloudVersionView {
48
+ version: number;
49
+ entry: string;
50
+ files: number;
51
+ totalBytes: number;
52
+ note: string | null;
53
+ createdAt: string;
54
+ current: boolean;
55
+ }
56
+ /** One bundle file as the skill sends it. */
57
+ export interface PublishFile {
58
+ path: string;
59
+ contentBase64: string;
60
+ contentType?: string;
61
+ }
62
+ /** Input of {@link AppsService.publish}. */
63
+ export interface PublishInput {
64
+ files: unknown;
65
+ name?: unknown;
66
+ appId?: unknown;
67
+ source?: unknown;
68
+ entry?: unknown;
69
+ note?: unknown;
70
+ notify?: unknown;
71
+ /** P3: also ask the owner to make the app public */
72
+ publicRequest?: unknown;
73
+ }
74
+ /**
75
+ * What posting the card did. Never the signed URL itself: agents get the
76
+ * plain URL only (P3 §1).
77
+ */
78
+ export interface CardResult {
79
+ notified: boolean;
80
+ /** `signed` = the one-tap open-link card in the owner DM; `plain` = the plain URL */
81
+ card?: 'signed' | 'plain';
82
+ /** Where it went: the agent's owner DM, or wherever its conversation with the owner is */
83
+ cardPlace?: 'owner-dm' | 'conversation';
84
+ /** The minted link (for `--revoke-link`); not a secret */
85
+ linkId?: string;
86
+ linkExpiresAt?: string;
87
+ notifyError?: string;
88
+ /** Why the card carries the plain URL instead of a signed link */
89
+ linkError?: string;
90
+ }
91
+ /** Result of a publish. */
92
+ export interface PublishResult extends CardResult {
93
+ appId: string;
94
+ name: string;
95
+ url: string;
96
+ version: number;
97
+ created: boolean;
98
+ /** P3: the public request was recorded (the owner still has to approve it) */
99
+ publicRequested?: boolean;
100
+ publicError?: string;
101
+ /** The app was public; this version made it private until the owner re-approves (crewly-services #33) */
102
+ publicPaused?: boolean;
103
+ publicPausedMessage?: string;
104
+ }
105
+ /** Result of {@link AppsService.share}. */
106
+ export interface ShareResult extends CardResult {
107
+ appId: string;
108
+ name: string;
109
+ url: string;
110
+ visibility: AppVisibility;
111
+ publicRequestPending: boolean;
112
+ }
113
+ /** Result of a public request. */
114
+ export interface PublicRequestResult extends CardResult {
115
+ appId: string;
116
+ url: string;
117
+ visibility: AppVisibility;
118
+ publicRequest: PublicRequestView | null;
119
+ message: string;
120
+ }
121
+ /** Who is calling: an agent session, or the owner (no session). */
122
+ export interface AppsCaller {
123
+ agentSession?: string;
124
+ }
125
+ /** Outcome of posting a card. */
126
+ export interface CardPostResult {
127
+ ok: boolean;
128
+ error?: string;
129
+ }
130
+ /**
131
+ * Where the "Open app" card can go (P3 §1, destination rule).
132
+ *
133
+ * The signed card goes ONLY to `ownerDm` — the one place that is owner-only
134
+ * by construction. The plain card goes where the agent talks with the owner
135
+ * (the `reply` resolver), as in P2.
136
+ */
137
+ export interface AppCardPoster {
138
+ /** The agent's DM with the owner (chat-v2 conversation id), or null when it has none */
139
+ ownerDm(agentSession: string): Promise<string | null>;
140
+ /** Post into exactly that DM conversation; never anywhere else */
141
+ postToOwnerDm(agentSession: string, conversationId: string, text: string): Promise<CardPostResult>;
142
+ /** Post where the agent's conversation with the owner is (P2 path) */
143
+ postReply(agentSession: string, text: string): Promise<CardPostResult>;
144
+ }
145
+ /** Constructor dependencies. */
146
+ export interface AppsServiceDeps {
147
+ client: AppsCloudClient;
148
+ registry: AppsRegistryService;
149
+ cards?: AppCardPoster;
150
+ /** Whether two agent sessions are in the same team (data access for the publisher's team) */
151
+ sameTeam?: (a: string, b: string) => Promise<boolean>;
152
+ }
153
+ /**
154
+ * Check an app id's shape.
155
+ *
156
+ * @param appId - Candidate
157
+ * @returns The id
158
+ * @throws AppsCloudError validation
159
+ */
160
+ export declare function requireAppId(appId: unknown): string;
161
+ /**
162
+ * The app's plain URL (what agents see; opens the sign-in page without a session).
163
+ *
164
+ * @param appId - App id
165
+ * @returns URL
166
+ */
167
+ export declare function plainAppUrl(appId: string): string;
168
+ /**
169
+ * The "📱 <name> · Open app" card text. Markdown link: the reply path turns
170
+ * it into a Slack link. A pending public request adds one line asking the
171
+ * owner to approve or decline it in the app.
172
+ *
173
+ * @param name - App name
174
+ * @param url - The link (signed or plain)
175
+ * @param pending - The app's pending public request, if any
176
+ * @returns Card text
177
+ */
178
+ export declare function appCardText(name: string, url: string, pending?: PublicRequestView | null): string;
179
+ /**
180
+ * Check a list of collection names for a public request.
181
+ *
182
+ * @param v - Candidate (array of names, or a comma-separated string)
183
+ * @param what - Field name for the message
184
+ * @returns Unique names
185
+ * @throws AppsCloudError validation
186
+ */
187
+ export declare function requireCollectionList(v: unknown, what: string): string[];
188
+ /**
189
+ * Check a public request body.
190
+ *
191
+ * @param input - `{ publicRead?, publicSubmit?, note? }`
192
+ * @returns The body Cloud gets
193
+ * @throws AppsCloudError validation
194
+ */
195
+ export declare function validatePublicRequest(input: unknown): {
196
+ publicRead: string[];
197
+ publicSubmit: string[];
198
+ note?: string;
199
+ };
200
+ /**
201
+ * Check a link lifetime.
202
+ *
203
+ * @param v - Days (number or numeric string), or empty for Cloud's default
204
+ * @returns Days, or undefined
205
+ * @throws AppsCloudError validation
206
+ */
207
+ export declare function requireTtlDays(v: unknown): number | undefined;
208
+ /** The message every public request answers with: only the owner can approve it. */
209
+ export declare const PUBLIC_REQUEST_MESSAGE = "Requested: the owner approves it by opening the app. Until then the app stays private; no agent can make it public.";
210
+ /**
211
+ * Said when publishing or rolling back a public app took it private again
212
+ * (crewly-services #33: every new current version of a public app needs the
213
+ * owner's re-approval).
214
+ */
215
+ export declare const PUBLIC_PAUSED_MESSAGE = "This app was public. Publishing or rolling back a public app makes it private again until the owner re-approves it in the app (they sign in with Google there to approve). Tell the owner; do not say it is public.";
216
+ /**
217
+ * The first word Cloud refuses in a public app's name, if any
218
+ * (crewly-services #33; {@link CREWLY_APPS_CONSTANTS.PUBLIC_REQUEST}.BLOCKED_NAME_WORDS).
219
+ *
220
+ * @param name - App name
221
+ * @returns The blocked word found, or null
222
+ */
223
+ export declare function blockedPublicNameWord(name: string): string | null;
224
+ /**
225
+ * Refuse a public request for an app whose name Cloud would refuse at approval.
226
+ *
227
+ * @param name - App name
228
+ * @throws AppsCloudError validation naming the word
229
+ */
230
+ export declare function assertPublicName(name: string): void;
231
+ /**
232
+ * Publishing and data access for Crewly Apps.
233
+ */
234
+ export declare class AppsService {
235
+ private readonly deps;
236
+ constructor(deps: AppsServiceDeps);
237
+ /**
238
+ * Publish a bundle: find the caller's app (or create one), upload a new
239
+ * version, record it locally, and optionally post the Slack card.
240
+ *
241
+ * @param input - Files and options from the skill
242
+ * @param caller - Agent session or owner
243
+ * @returns appId, url, version, whether it was created / notified
244
+ * @throws AppsCloudError on validation or a Cloud failure
245
+ */
246
+ publish(input: PublishInput, caller: AppsCaller): Promise<PublishResult>;
247
+ /**
248
+ * Post the "Open app" card for the owner.
249
+ *
250
+ * Destination rule (P3 §1): when the agent has a DM with the owner, a
251
+ * fresh signed link is minted and the card goes to that DM only — never
252
+ * to a room, a team channel or a shared room, wherever the conversation
253
+ * happens to be. Without a DM, or when minting or the DM post fails, the
254
+ * card carries the plain URL and goes where the agent talks with the owner
255
+ * (P2). The signed URL is never returned.
256
+ *
257
+ * @param app - App id, name and its pending public request
258
+ * @param caller - Agent or owner
259
+ * @param publisher - The app's recorded agent (posts the card for an owner call)
260
+ * @param ttlDays - Link lifetime (Cloud's default when omitted)
261
+ * @returns What was posted, without the URL
262
+ */
263
+ private sendCard;
264
+ /**
265
+ * Post the card again with a fresh signed link, without publishing (P3 §1, re-share).
266
+ *
267
+ * @param appId - App id
268
+ * @param opts - `ttlDays` (1-30, Cloud's default 7)
269
+ * @param caller - Agent (its own apps) or owner (any; posts as the recorded agent)
270
+ * @returns What was posted; never the signed URL
271
+ */
272
+ share(appId: unknown, opts: {
273
+ ttlDays?: unknown;
274
+ }, caller: AppsCaller): Promise<ShareResult>;
275
+ /**
276
+ * The app's open-links (no tokens).
277
+ *
278
+ * @param appId - App id
279
+ * @param caller - Agent (its own apps) or owner
280
+ * @returns Links, newest as Cloud orders them
281
+ */
282
+ links(appId: unknown, caller: AppsCaller): Promise<OpenLinkInfo[]>;
283
+ /**
284
+ * Revoke one open-link.
285
+ *
286
+ * @param appId - App id
287
+ * @param linkId - Link id
288
+ * @param caller - Agent (its own apps) or owner
289
+ * @returns `{ revoked: true }`; 404 not_found for an unknown link
290
+ */
291
+ revokeLink(appId: unknown, linkId: unknown, caller: AppsCaller): Promise<{
292
+ revoked: boolean;
293
+ }>;
294
+ /**
295
+ * Revoke every open-link of an app.
296
+ *
297
+ * @param appId - App id
298
+ * @param caller - Agent (its own apps) or owner
299
+ * @returns `{ revoked: <count> }`
300
+ */
301
+ revokeLinks(appId: unknown, caller: AppsCaller): Promise<{
302
+ revoked: number;
303
+ }>;
304
+ /**
305
+ * Ask the owner to make an app public (P3 §2). Only records the request:
306
+ * Cloud flips visibility only from the owner's own session in the apps
307
+ * shell, so nothing here can make an app public. An agent's request also
308
+ * posts the card, which tells the owner to approve or decline it.
309
+ *
310
+ * @param appId - App id
311
+ * @param input - Collections to open for reading / anonymous submissions, and a note
312
+ * @param caller - Agent (its own apps) or owner
313
+ * @returns The recorded request and the card result
314
+ */
315
+ requestPublic(appId: unknown, input: unknown, caller: AppsCaller): Promise<PublicRequestResult>;
316
+ /**
317
+ * Withdraw a pending public request.
318
+ *
319
+ * @param appId - App id
320
+ * @param caller - Agent (its own apps) or owner
321
+ * @returns Cloud's answer
322
+ */
323
+ cancelPublicRequest(appId: unknown, caller: AppsCaller): Promise<{
324
+ appId: string;
325
+ cancelled: true;
326
+ visibility: AppVisibility;
327
+ }>;
328
+ /**
329
+ * Make an app private again (instant; always allowed).
330
+ *
331
+ * @param appId - App id
332
+ * @param caller - Agent (its own apps) or owner
333
+ * @returns `{ visibility: 'private' }`
334
+ */
335
+ makePrivate(appId: unknown, caller: AppsCaller): Promise<{
336
+ appId: string;
337
+ visibility: AppVisibility;
338
+ }>;
339
+ /**
340
+ * Make an earlier retained version current.
341
+ *
342
+ * @param appId - App id
343
+ * @param version - Version number
344
+ * @param caller - Agent or owner
345
+ * @returns The app after rollback
346
+ */
347
+ rollback(appId: unknown, version: unknown, caller: AppsCaller): Promise<CloudAppView & {
348
+ publicPaused?: boolean;
349
+ publicPausedMessage?: string;
350
+ }>;
351
+ /**
352
+ * Versions of an app, newest first.
353
+ *
354
+ * @param appId - App id
355
+ * @param caller - Agent or owner
356
+ * @returns Versions
357
+ */
358
+ versions(appId: unknown, caller: AppsCaller): Promise<CloudVersionView[]>;
359
+ /**
360
+ * Agents may manage (publish, roll back, list versions of) only apps they
361
+ * published. The owner may manage any.
362
+ *
363
+ * @param appId - App id
364
+ * @param caller - Agent or owner
365
+ * @throws AppsCloudError 403 not_your_app
366
+ */
367
+ assertPublisher(appId: string, caller: AppsCaller): Promise<void>;
368
+ /**
369
+ * Agents may read and write the data of apps they published, or that a
370
+ * teammate published. The owner may use any.
371
+ *
372
+ * @param appId - App id
373
+ * @param caller - Agent or owner
374
+ * @throws AppsCloudError 403 not_your_app
375
+ */
376
+ assertDataAccess(appId: string, caller: AppsCaller): Promise<void>;
377
+ /**
378
+ * Apps this instance published (local registry, not Cloud).
379
+ *
380
+ * @returns Entries without the poller cursor
381
+ */
382
+ list(caller?: AppsCaller): Promise<Array<Omit<AppRegistryEntry, 'cursor' | 'delivered' | 'wakes' | 'visitorWakes'>>>;
383
+ /**
384
+ * One page of a collection.
385
+ *
386
+ * @param appId - App id
387
+ * @param collection - Collection
388
+ * @param opts - limit / after
389
+ * @param caller - Agent or owner
390
+ * @returns `{ docs, next }`
391
+ */
392
+ listDocs(appId: unknown, collection: unknown, opts: {
393
+ limit?: unknown;
394
+ after?: unknown;
395
+ }, caller: AppsCaller): Promise<unknown>;
396
+ /**
397
+ * One document (`{ id, data, rev, … }`); a missing one throws 404 not_found.
398
+ *
399
+ * @param appId - App id
400
+ * @param collection - Collection
401
+ * @param docId - Document id
402
+ * @param caller - Agent or owner
403
+ * @returns The document
404
+ */
405
+ getDoc(appId: unknown, collection: unknown, docId: unknown, caller: AppsCaller): Promise<unknown>;
406
+ /**
407
+ * Replace (or create) a document.
408
+ *
409
+ * @param appId - App id
410
+ * @param collection - Collection
411
+ * @param docId - Document id
412
+ * @param data - New content
413
+ * @param caller - Agent or owner
414
+ * @returns The stored document
415
+ */
416
+ setDoc(appId: unknown, collection: unknown, docId: unknown, data: unknown, caller: AppsCaller): Promise<unknown>;
417
+ /**
418
+ * Shallow-merge into a document; `ifRev` makes it conditional (409 conflict).
419
+ *
420
+ * @param appId - App id
421
+ * @param collection - Collection
422
+ * @param docId - Document id
423
+ * @param data - Fields to merge
424
+ * @param ifRev - Expected current rev (optional)
425
+ * @param caller - Agent or owner
426
+ * @returns The stored document
427
+ */
428
+ updateDoc(appId: unknown, collection: unknown, docId: unknown, data: unknown, ifRev: unknown, caller: AppsCaller): Promise<unknown>;
429
+ /**
430
+ * Add a document with a generated id.
431
+ *
432
+ * @param appId - App id
433
+ * @param collection - Collection
434
+ * @param data - Content
435
+ * @param caller - Agent or owner
436
+ * @returns The stored document
437
+ */
438
+ addDoc(appId: unknown, collection: unknown, data: unknown, caller: AppsCaller): Promise<unknown>;
439
+ /**
440
+ * Delete a document.
441
+ *
442
+ * @param appId - App id
443
+ * @param collection - Collection
444
+ * @param docId - Document id
445
+ * @param caller - Agent or owner
446
+ * @returns `{ deleted: true }`
447
+ */
448
+ deleteDoc(appId: unknown, collection: unknown, docId: unknown, caller: AppsCaller): Promise<unknown>;
449
+ /**
450
+ * A Cloud data call whose answer is sanitised before it leaves the backend
451
+ * (P3 §4): documents were written by the owner, other agents or anonymous
452
+ * visitors, and an agent prints them into its terminal, where harness
453
+ * markers (`[CHAT_RESPONSE]`, `[DONE]`, fenced blocks), ANSI escapes or
454
+ * bidi characters would act. Every string value and key is cleaned; the
455
+ * structure is kept. Done here, not in the skill, so no caller bypasses it.
456
+ *
457
+ * @param method - HTTP method
458
+ * @param path - Cloud path
459
+ * @param opts - Request options
460
+ * @returns The display-safe answer
461
+ */
462
+ private dataRequest;
463
+ private docPath;
464
+ private validateFiles;
465
+ }
466
+ //# sourceMappingURL=apps.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apps.service.d.ts","sourceRoot":"","sources":["../../../../../../backend/src/services/apps/apps.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,eAAe,EAA2C,MAAM,wBAAwB,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAA0D,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAK/G,kDAAkD;AAClD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,mDAAmD;IACnD,aAAa,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC1C;AAED,sDAAsD;AACtD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEjD,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,GAAG,IAA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