@proveanything/smartlinks 2.1.19 → 2.1.22
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/aiGuide.d.ts +2 -0
- package/dist/api/aiGuide.js +1 -0
- package/dist/api/contact.d.ts +60 -1
- package/dist/api/contact.js +74 -0
- package/dist/api/realtime.d.ts +19 -0
- package/dist/api/realtime.js +26 -1
- package/dist/docs/API_SUMMARY.md +101 -3
- package/dist/docs/app-manifest.md +19 -0
- package/dist/docs/assistant-apps.md +4 -0
- package/dist/docs/assistant-context.md +119 -0
- package/dist/docs/realtime.md +20 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +0 -1
- package/dist/live.d.ts +8 -0
- package/dist/live.js +50 -8
- package/dist/openapi.yaml +247 -0
- package/dist/types/appManifest.d.ts +64 -1
- package/dist/types/contact.d.ts +55 -0
- package/dist/types/realtime.d.ts +7 -1
- package/docs/API_SUMMARY.md +101 -3
- package/docs/app-manifest.md +19 -0
- package/docs/assistant-apps.md +4 -0
- package/docs/assistant-context.md +119 -0
- package/docs/realtime.md +20 -0
- package/openapi.yaml +247 -0
- package/package.json +1 -1
package/dist/live.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
// Voice: microphone in, speech out, captions of what the assistant says. Text: no microphone, the person
|
|
12
12
|
// types (`send`), the assistant answers in text (captions carry it).
|
|
13
13
|
const CALLS_URL = 'https://api.openai.com/v1/realtime/calls';
|
|
14
|
+
/** The service's answers that mean "there was nothing to cancel or clear": not shown as errors. */
|
|
15
|
+
const HARMLESS = /response_cancel_not_active|no active response|output_audio_buffer|nothing to clear/i;
|
|
14
16
|
function meter(ctx, stream) {
|
|
15
17
|
const analyser = ctx.createAnalyser();
|
|
16
18
|
analyser.fftSize = 256;
|
|
@@ -42,6 +44,9 @@ export async function startLive(opts) {
|
|
|
42
44
|
let replyOwed = false;
|
|
43
45
|
let micTrack = null;
|
|
44
46
|
let micSender = null;
|
|
47
|
+
// A reply is being made (between response.created and response.done): only then is there one to cancel.
|
|
48
|
+
let responding = false;
|
|
49
|
+
let muted = false;
|
|
45
50
|
let micLevel = () => 0;
|
|
46
51
|
let voiceLevel = () => 0;
|
|
47
52
|
const log = (e) => {
|
|
@@ -119,12 +124,12 @@ export async function startLive(opts) {
|
|
|
119
124
|
send({ type: 'conversation.item.create', item: { type: 'function_call_output', call_id: call.call_id, output: JSON.stringify(output !== null && output !== void 0 ? output : {}) } });
|
|
120
125
|
}
|
|
121
126
|
dc.onmessage = (e) => {
|
|
122
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
127
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
123
128
|
let ev;
|
|
124
129
|
try {
|
|
125
130
|
ev = JSON.parse(String(e.data));
|
|
126
131
|
}
|
|
127
|
-
catch (
|
|
132
|
+
catch (_l) {
|
|
128
133
|
return;
|
|
129
134
|
}
|
|
130
135
|
const type = String((_a = ev['type']) !== null && _a !== void 0 ? _a : '');
|
|
@@ -133,6 +138,7 @@ export async function startLive(opts) {
|
|
|
133
138
|
else if (type === 'input_audio_buffer.speech_stopped')
|
|
134
139
|
setState('thinking');
|
|
135
140
|
else if (type === 'response.created') {
|
|
141
|
+
responding = true;
|
|
136
142
|
caption = '';
|
|
137
143
|
if (textMode)
|
|
138
144
|
setState('thinking');
|
|
@@ -148,6 +154,7 @@ export async function startLive(opts) {
|
|
|
148
154
|
(_c = opts.onCaption) === null || _c === void 0 ? void 0 : _c.call(opts, caption);
|
|
149
155
|
}
|
|
150
156
|
else if (type === 'response.done') {
|
|
157
|
+
responding = false;
|
|
151
158
|
if (caption.trim()) {
|
|
152
159
|
replies++;
|
|
153
160
|
(_d = opts.onReply) === null || _d === void 0 ? void 0 : _d.call(opts, caption.trim());
|
|
@@ -167,9 +174,13 @@ export async function startLive(opts) {
|
|
|
167
174
|
setState('listening');
|
|
168
175
|
}
|
|
169
176
|
else if (type === 'error') {
|
|
170
|
-
const
|
|
177
|
+
const err = ((_g = ev['error']) !== null && _g !== void 0 ? _g : {});
|
|
178
|
+
const message = String((_h = err['message']) !== null && _h !== void 0 ? _h : 'The assistant hit a problem');
|
|
179
|
+
// "Nothing to cancel" (a pause or a stop between replies) is not a problem: say nothing.
|
|
180
|
+
if (HARMLESS.test(String((_j = err['code']) !== null && _j !== void 0 ? _j : '')) || HARMLESS.test(message))
|
|
181
|
+
return;
|
|
171
182
|
log({ kind: 'error', error: message, detail: 'realtime service' });
|
|
172
|
-
(
|
|
183
|
+
(_k = opts.onError) === null || _k === void 0 ? void 0 : _k.call(opts, message);
|
|
173
184
|
}
|
|
174
185
|
};
|
|
175
186
|
pc.onconnectionstatechange = () => {
|
|
@@ -266,8 +277,9 @@ export async function startLive(opts) {
|
|
|
266
277
|
paused = true;
|
|
267
278
|
void (micSender === null || micSender === void 0 ? void 0 : micSender.replaceTrack(null).catch(() => undefined));
|
|
268
279
|
send({ type: 'input_audio_buffer.clear' });
|
|
269
|
-
|
|
270
|
-
|
|
280
|
+
if (responding)
|
|
281
|
+
send({ type: 'response.cancel' });
|
|
282
|
+
if (!textMode && state === 'speaking')
|
|
271
283
|
send({ type: 'output_audio_buffer.clear' });
|
|
272
284
|
if (audio)
|
|
273
285
|
audio.muted = true;
|
|
@@ -280,7 +292,8 @@ export async function startLive(opts) {
|
|
|
280
292
|
if (stopped || !paused)
|
|
281
293
|
return;
|
|
282
294
|
paused = false;
|
|
283
|
-
|
|
295
|
+
if (!muted)
|
|
296
|
+
void (micSender === null || micSender === void 0 ? void 0 : micSender.replaceTrack(micTrack).catch(() => undefined));
|
|
284
297
|
if (audio)
|
|
285
298
|
audio.muted = false;
|
|
286
299
|
state = 'listening';
|
|
@@ -293,6 +306,35 @@ export async function startLive(opts) {
|
|
|
293
306
|
replyOwed = false;
|
|
294
307
|
log({ kind: 'resume', detail: waiting.length ? `${waiting.length} message(s) held while paused` : '' });
|
|
295
308
|
},
|
|
309
|
+
mute: () => {
|
|
310
|
+
var _a;
|
|
311
|
+
if (stopped || muted || state === 'connecting' || textMode)
|
|
312
|
+
return;
|
|
313
|
+
muted = true;
|
|
314
|
+
void (micSender === null || micSender === void 0 ? void 0 : micSender.replaceTrack(null).catch(() => undefined));
|
|
315
|
+
send({ type: 'input_audio_buffer.clear' });
|
|
316
|
+
(_a = opts.onMuted) === null || _a === void 0 ? void 0 : _a.call(opts, true);
|
|
317
|
+
log({ kind: 'pause', detail: 'mic muted' });
|
|
318
|
+
},
|
|
319
|
+
unmute: () => {
|
|
320
|
+
var _a;
|
|
321
|
+
if (stopped || !muted)
|
|
322
|
+
return;
|
|
323
|
+
muted = false;
|
|
324
|
+
if (!paused)
|
|
325
|
+
void (micSender === null || micSender === void 0 ? void 0 : micSender.replaceTrack(micTrack).catch(() => undefined));
|
|
326
|
+
(_a = opts.onMuted) === null || _a === void 0 ? void 0 : _a.call(opts, false);
|
|
327
|
+
log({ kind: 'resume', detail: 'mic on' });
|
|
328
|
+
},
|
|
329
|
+
muted: () => muted,
|
|
330
|
+
hush: () => {
|
|
331
|
+
if (stopped)
|
|
332
|
+
return;
|
|
333
|
+
if (responding)
|
|
334
|
+
send({ type: 'response.cancel' });
|
|
335
|
+
if (!textMode && state === 'speaking')
|
|
336
|
+
send({ type: 'output_audio_buffer.clear' });
|
|
337
|
+
},
|
|
296
338
|
send: (text) => { if (text.trim())
|
|
297
339
|
answer(text.trim()); },
|
|
298
340
|
tell: (what) => answer(`[On screen] ${what}`),
|
|
@@ -308,7 +350,7 @@ export async function startLive(opts) {
|
|
|
308
350
|
},
|
|
309
351
|
session: () => sessionId,
|
|
310
352
|
state: () => state,
|
|
311
|
-
level: () => (state === 'speaking' ? voiceLevel() : state === 'hearing' || state === 'listening' ? micLevel() : 0),
|
|
353
|
+
level: () => (state === 'speaking' ? voiceLevel() : !muted && (state === 'hearing' || state === 'listening') ? micLevel() : 0),
|
|
312
354
|
};
|
|
313
355
|
}
|
|
314
356
|
return handle();
|
package/dist/openapi.yaml
CHANGED
|
@@ -3223,6 +3223,70 @@ paths:
|
|
|
3223
3223
|
application/json:
|
|
3224
3224
|
schema:
|
|
3225
3225
|
$ref: "#/components/schemas/ContactCreateRequest"
|
|
3226
|
+
/admin/collection/{collectionId}/contacts/duplicates:
|
|
3227
|
+
get:
|
|
3228
|
+
tags:
|
|
3229
|
+
- contact
|
|
3230
|
+
summary: "Admin: pairs of contacts that look like one person."
|
|
3231
|
+
operationId: contact_findDuplicates
|
|
3232
|
+
security:
|
|
3233
|
+
- bearerAuth: []
|
|
3234
|
+
parameters:
|
|
3235
|
+
- name: collectionId
|
|
3236
|
+
in: path
|
|
3237
|
+
required: true
|
|
3238
|
+
schema:
|
|
3239
|
+
type: string
|
|
3240
|
+
- name: limit
|
|
3241
|
+
in: query
|
|
3242
|
+
required: false
|
|
3243
|
+
schema:
|
|
3244
|
+
type: string
|
|
3245
|
+
- name: offset
|
|
3246
|
+
in: query
|
|
3247
|
+
required: false
|
|
3248
|
+
schema:
|
|
3249
|
+
type: string
|
|
3250
|
+
responses:
|
|
3251
|
+
200:
|
|
3252
|
+
description: Success
|
|
3253
|
+
content:
|
|
3254
|
+
application/json:
|
|
3255
|
+
schema:
|
|
3256
|
+
$ref: "#/components/schemas/ContactDuplicatesResponse"
|
|
3257
|
+
400:
|
|
3258
|
+
description: Bad request
|
|
3259
|
+
401:
|
|
3260
|
+
description: Unauthorized
|
|
3261
|
+
404:
|
|
3262
|
+
description: Not found
|
|
3263
|
+
/admin/collection/{collectionId}/contacts/link-login:
|
|
3264
|
+
post:
|
|
3265
|
+
tags:
|
|
3266
|
+
- contact
|
|
3267
|
+
summary: "Admin: the contact that carries a sign-in, attaching the sign-in first to the contact that already holds its verified email or phone."
|
|
3268
|
+
operationId: contact_linkLogin
|
|
3269
|
+
security:
|
|
3270
|
+
- bearerAuth: []
|
|
3271
|
+
parameters:
|
|
3272
|
+
- name: collectionId
|
|
3273
|
+
in: path
|
|
3274
|
+
required: true
|
|
3275
|
+
schema:
|
|
3276
|
+
type: string
|
|
3277
|
+
responses:
|
|
3278
|
+
200:
|
|
3279
|
+
description: Success
|
|
3280
|
+
content:
|
|
3281
|
+
application/json:
|
|
3282
|
+
schema:
|
|
3283
|
+
$ref: "#/components/schemas/ContactLinkLoginResponse"
|
|
3284
|
+
400:
|
|
3285
|
+
description: Bad request
|
|
3286
|
+
401:
|
|
3287
|
+
description: Unauthorized
|
|
3288
|
+
404:
|
|
3289
|
+
description: Not found
|
|
3226
3290
|
/admin/collection/{collectionId}/contacts/lookup:
|
|
3227
3291
|
get:
|
|
3228
3292
|
tags:
|
|
@@ -3538,6 +3602,38 @@ paths:
|
|
|
3538
3602
|
description: Unauthorized
|
|
3539
3603
|
404:
|
|
3540
3604
|
description: Not found
|
|
3605
|
+
/admin/collection/{collectionId}/contacts/{keepContactId}/merge:
|
|
3606
|
+
post:
|
|
3607
|
+
tags:
|
|
3608
|
+
- contact
|
|
3609
|
+
summary: "Admin: fold contact `fromContactId` INTO contact `keepContactId`."
|
|
3610
|
+
operationId: contact_merge
|
|
3611
|
+
security:
|
|
3612
|
+
- bearerAuth: []
|
|
3613
|
+
parameters:
|
|
3614
|
+
- name: collectionId
|
|
3615
|
+
in: path
|
|
3616
|
+
required: true
|
|
3617
|
+
schema:
|
|
3618
|
+
type: string
|
|
3619
|
+
- name: keepContactId
|
|
3620
|
+
in: path
|
|
3621
|
+
required: true
|
|
3622
|
+
schema:
|
|
3623
|
+
type: string
|
|
3624
|
+
responses:
|
|
3625
|
+
200:
|
|
3626
|
+
description: Success
|
|
3627
|
+
content:
|
|
3628
|
+
application/json:
|
|
3629
|
+
schema:
|
|
3630
|
+
$ref: "#/components/schemas/ContactMergeResponse"
|
|
3631
|
+
400:
|
|
3632
|
+
description: Bad request
|
|
3633
|
+
401:
|
|
3634
|
+
description: Unauthorized
|
|
3635
|
+
404:
|
|
3636
|
+
description: Not found
|
|
3541
3637
|
/admin/collection/{collectionId}/containers:
|
|
3542
3638
|
get:
|
|
3543
3639
|
tags:
|
|
@@ -21669,6 +21765,8 @@ components:
|
|
|
21669
21765
|
type: string
|
|
21670
21766
|
admin:
|
|
21671
21767
|
type: string
|
|
21768
|
+
adminPage:
|
|
21769
|
+
type: string
|
|
21672
21770
|
widgets:
|
|
21673
21771
|
$ref: "#/components/schemas/AppManifestWidgets"
|
|
21674
21772
|
containers:
|
|
@@ -21699,6 +21797,14 @@ components:
|
|
|
21699
21797
|
realtime:
|
|
21700
21798
|
type: object
|
|
21701
21799
|
additionalProperties: true
|
|
21800
|
+
channels:
|
|
21801
|
+
type: array
|
|
21802
|
+
items:
|
|
21803
|
+
$ref: "#/components/schemas/RealtimeChannelDeclaration"
|
|
21804
|
+
staff:
|
|
21805
|
+
type: array
|
|
21806
|
+
items:
|
|
21807
|
+
type: string
|
|
21702
21808
|
adminCards:
|
|
21703
21809
|
$ref: "#/components/schemas/AppManifestAdminCards"
|
|
21704
21810
|
data:
|
|
@@ -21741,6 +21847,55 @@ components:
|
|
|
21741
21847
|
$ref: "#/components/schemas/AppAssistantFile"
|
|
21742
21848
|
preview:
|
|
21743
21849
|
type: string
|
|
21850
|
+
purpose:
|
|
21851
|
+
type: string
|
|
21852
|
+
objects:
|
|
21853
|
+
type: array
|
|
21854
|
+
items:
|
|
21855
|
+
$ref: "#/components/schemas/AssistantObject"
|
|
21856
|
+
words:
|
|
21857
|
+
type: object
|
|
21858
|
+
additionalProperties:
|
|
21859
|
+
type: string
|
|
21860
|
+
recipes:
|
|
21861
|
+
type: array
|
|
21862
|
+
items:
|
|
21863
|
+
$ref: "#/components/schemas/AssistantRecipe"
|
|
21864
|
+
AssistantObject:
|
|
21865
|
+
type: object
|
|
21866
|
+
properties:
|
|
21867
|
+
object:
|
|
21868
|
+
type: string
|
|
21869
|
+
where:
|
|
21870
|
+
type: object
|
|
21871
|
+
additionalProperties:
|
|
21872
|
+
type: object
|
|
21873
|
+
additionalProperties: true
|
|
21874
|
+
means:
|
|
21875
|
+
type: string
|
|
21876
|
+
fields:
|
|
21877
|
+
type: object
|
|
21878
|
+
additionalProperties:
|
|
21879
|
+
type: string
|
|
21880
|
+
write:
|
|
21881
|
+
type: string
|
|
21882
|
+
enum:
|
|
21883
|
+
- direct
|
|
21884
|
+
- actions
|
|
21885
|
+
- none
|
|
21886
|
+
required:
|
|
21887
|
+
- object
|
|
21888
|
+
- means
|
|
21889
|
+
AssistantRecipe:
|
|
21890
|
+
type: object
|
|
21891
|
+
properties:
|
|
21892
|
+
question:
|
|
21893
|
+
type: string
|
|
21894
|
+
answer:
|
|
21895
|
+
type: string
|
|
21896
|
+
required:
|
|
21897
|
+
- question
|
|
21898
|
+
- answer
|
|
21744
21899
|
ConnectorConnectionField:
|
|
21745
21900
|
type: object
|
|
21746
21901
|
properties:
|
|
@@ -28537,6 +28692,91 @@ components:
|
|
|
28537
28692
|
- items
|
|
28538
28693
|
- limit
|
|
28539
28694
|
- offset
|
|
28695
|
+
ContactDuplicatePair:
|
|
28696
|
+
type: object
|
|
28697
|
+
properties:
|
|
28698
|
+
keep:
|
|
28699
|
+
$ref: "#/components/schemas/Contact"
|
|
28700
|
+
merge:
|
|
28701
|
+
$ref: "#/components/schemas/Contact"
|
|
28702
|
+
matchedOn:
|
|
28703
|
+
type: object
|
|
28704
|
+
additionalProperties: true
|
|
28705
|
+
required:
|
|
28706
|
+
- keep
|
|
28707
|
+
- merge
|
|
28708
|
+
- matchedOn
|
|
28709
|
+
ContactDuplicatesResponse:
|
|
28710
|
+
type: object
|
|
28711
|
+
properties:
|
|
28712
|
+
pairs:
|
|
28713
|
+
type: array
|
|
28714
|
+
items:
|
|
28715
|
+
$ref: "#/components/schemas/ContactDuplicatePair"
|
|
28716
|
+
scanned:
|
|
28717
|
+
type: number
|
|
28718
|
+
more:
|
|
28719
|
+
type: boolean
|
|
28720
|
+
required:
|
|
28721
|
+
- pairs
|
|
28722
|
+
- scanned
|
|
28723
|
+
- more
|
|
28724
|
+
ContactMergeResponse:
|
|
28725
|
+
type: object
|
|
28726
|
+
properties:
|
|
28727
|
+
contactId:
|
|
28728
|
+
type: string
|
|
28729
|
+
mergedFrom:
|
|
28730
|
+
type: string
|
|
28731
|
+
moved:
|
|
28732
|
+
type: object
|
|
28733
|
+
additionalProperties: true
|
|
28734
|
+
login:
|
|
28735
|
+
type: boolean
|
|
28736
|
+
identities:
|
|
28737
|
+
type: number
|
|
28738
|
+
records:
|
|
28739
|
+
type: number
|
|
28740
|
+
cases:
|
|
28741
|
+
type: number
|
|
28742
|
+
threads:
|
|
28743
|
+
type: number
|
|
28744
|
+
bookings:
|
|
28745
|
+
type: number
|
|
28746
|
+
loyaltyMembers:
|
|
28747
|
+
type: number
|
|
28748
|
+
assets:
|
|
28749
|
+
type: number
|
|
28750
|
+
uploadTokens:
|
|
28751
|
+
type: number
|
|
28752
|
+
aiSessions:
|
|
28753
|
+
type: number
|
|
28754
|
+
messages:
|
|
28755
|
+
type: number
|
|
28756
|
+
conversations:
|
|
28757
|
+
type: number
|
|
28758
|
+
contact:
|
|
28759
|
+
$ref: "#/components/schemas/Contact"
|
|
28760
|
+
required:
|
|
28761
|
+
- contactId
|
|
28762
|
+
- mergedFrom
|
|
28763
|
+
- moved
|
|
28764
|
+
- login
|
|
28765
|
+
- identities
|
|
28766
|
+
- contact
|
|
28767
|
+
ContactLinkLoginResponse:
|
|
28768
|
+
type: object
|
|
28769
|
+
properties:
|
|
28770
|
+
contactId:
|
|
28771
|
+
type: string
|
|
28772
|
+
linked:
|
|
28773
|
+
type: boolean
|
|
28774
|
+
contact:
|
|
28775
|
+
$ref: "#/components/schemas/Contact"
|
|
28776
|
+
required:
|
|
28777
|
+
- contactId
|
|
28778
|
+
- linked
|
|
28779
|
+
- contact
|
|
28540
28780
|
ContactSearchParams:
|
|
28541
28781
|
type: object
|
|
28542
28782
|
properties:
|
|
@@ -28904,6 +29144,9 @@ components:
|
|
|
28904
29144
|
$ref: "#/components/schemas/Contact"
|
|
28905
29145
|
ContactUpdateRequest:
|
|
28906
29146
|
$ref: "#/components/schemas/ContactCreateRequest"
|
|
29147
|
+
ContactMergeErrorCode:
|
|
29148
|
+
type: object
|
|
29149
|
+
additionalProperties: true
|
|
28907
29150
|
PublicContactUpsertRequest:
|
|
28908
29151
|
$ref: "#/components/schemas/Contact"
|
|
28909
29152
|
ContactPatch:
|
|
@@ -35373,6 +35616,8 @@ components:
|
|
|
35373
35616
|
type: string
|
|
35374
35617
|
status:
|
|
35375
35618
|
type: string
|
|
35619
|
+
kind:
|
|
35620
|
+
type: string
|
|
35376
35621
|
at:
|
|
35377
35622
|
type: number
|
|
35378
35623
|
required:
|
|
@@ -35393,6 +35638,8 @@ components:
|
|
|
35393
35638
|
type: string
|
|
35394
35639
|
proofId:
|
|
35395
35640
|
type: string
|
|
35641
|
+
kind:
|
|
35642
|
+
type: string
|
|
35396
35643
|
RealtimeChannelDeclaration:
|
|
35397
35644
|
type: object
|
|
35398
35645
|
properties:
|
|
@@ -1244,6 +1244,14 @@ export interface AppManifest {
|
|
|
1244
1244
|
* Absent when the app has no admin UI.
|
|
1245
1245
|
*/
|
|
1246
1246
|
admin?: string;
|
|
1247
|
+
/**
|
|
1248
|
+
* The page a host opens as this app's ADMIN screen, from the app's root: `"admin.html"` or
|
|
1249
|
+
* `"index.html"`. Hosts (Studio, the console, Forge's preview) read it instead of guessing.
|
|
1250
|
+
* Absent → the host's default: `admin.html` for an installed app, the root page (`index.html`) for a
|
|
1251
|
+
* core app. Declare it when that default is wrong — e.g. AuthKit (`core-account`), whose root page
|
|
1252
|
+
* is the PUBLIC sign-in screen every site redirects to, and whose admin is `admin.html`.
|
|
1253
|
+
*/
|
|
1254
|
+
adminPage?: string;
|
|
1247
1255
|
/** Widget bundle definition. Presence means a widget bundle exists for this app. */
|
|
1248
1256
|
widgets?: AppManifestWidgets;
|
|
1249
1257
|
/** Container bundle definition. Presence means a container bundle exists. */
|
|
@@ -1297,7 +1305,13 @@ export interface AppManifest {
|
|
|
1297
1305
|
* ```
|
|
1298
1306
|
*/
|
|
1299
1307
|
realtime?: {
|
|
1300
|
-
channels
|
|
1308
|
+
channels?: RealtimeChannelDeclaration[];
|
|
1309
|
+
/**
|
|
1310
|
+
* Who hears changes to what this app works on (`realtime.onStaffChange`: its work orders, the
|
|
1311
|
+
* containers and stock it moves), as user group keys. Absent: every user group the app's server
|
|
1312
|
+
* functions are limited to. `[]`: nobody but collection admins.
|
|
1313
|
+
*/
|
|
1314
|
+
staff?: string[];
|
|
1301
1315
|
};
|
|
1302
1316
|
/**
|
|
1303
1317
|
* Cards this app adds to the collection's dashboard in Studio. A `data` card names an ADMIN server
|
|
@@ -1376,6 +1390,55 @@ export interface AppAssistantDeclaration {
|
|
|
1376
1390
|
* Relative to the app's admin surface, e.g. `"/admin/preview?changeSet={id}"`.
|
|
1377
1391
|
*/
|
|
1378
1392
|
preview?: string;
|
|
1393
|
+
/**
|
|
1394
|
+
* One line (≤ 200 characters): what this app or site is for. Always in the assistant's view, in the
|
|
1395
|
+
* line for this app: "Production manager for a fragrance filling and decorating factory".
|
|
1396
|
+
*/
|
|
1397
|
+
purpose?: string;
|
|
1398
|
+
/**
|
|
1399
|
+
* What each standard object MEANS in this app ("a work order here is a job"), and whether the
|
|
1400
|
+
* assistant may change it directly or only through one of the app's actions. Up to 20. Record types
|
|
1401
|
+
* declared in the manifest's `data` block needn't be repeated: the assistant gets their titles and
|
|
1402
|
+
* fields from there. @see AssistantObject
|
|
1403
|
+
*/
|
|
1404
|
+
objects?: AssistantObject[];
|
|
1405
|
+
/** The business's own terms: `{ "GMP": "the batch manufacturing record printed for each job" }`. Up to 40. */
|
|
1406
|
+
words?: Record<string, string>;
|
|
1407
|
+
/** How to answer the questions people actually ask. Up to 30. @see AssistantRecipe */
|
|
1408
|
+
recipes?: AssistantRecipe[];
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* What one standard object means in this app. A SITE may also describe objects other installed apps
|
|
1412
|
+
* keep (narrow them with `where: { appId }`); there, what the site says wins over the app's own words.
|
|
1413
|
+
*/
|
|
1414
|
+
export interface AssistantObject {
|
|
1415
|
+
/** The standard object: `workOrder`, `workOrderStage`, `container`, `stock`, `booking`, `record`, `contact`, `product`, `history`. */
|
|
1416
|
+
object: string;
|
|
1417
|
+
/**
|
|
1418
|
+
* Which ones, with the same filters the SDK takes: `{ appId: "accord-production" }`,
|
|
1419
|
+
* `{ containerType: "drum" }`, `{ recordType: "smell-test" }`, `{ "data.event": "christmas-fair" }`.
|
|
1420
|
+
*/
|
|
1421
|
+
where?: Record<string, string | number | boolean>;
|
|
1422
|
+
/** What it is here, in a sentence (≤ 300 characters): "A job." */
|
|
1423
|
+
means: string;
|
|
1424
|
+
/** What its fields hold, where the name doesn't say: `{ "ref": "job number", "data.stage": "the stage shown on screen" }`. Up to 20. */
|
|
1425
|
+
fields?: Record<string, string>;
|
|
1426
|
+
/**
|
|
1427
|
+
* May the assistant change it?
|
|
1428
|
+
* - `direct`: through the API, as a planned change the person applies;
|
|
1429
|
+
* - `actions`: ONLY through one of this app's actions (functions with `agent.tool`), because the
|
|
1430
|
+
* app's rules live in its code (numbering, checks, who is told);
|
|
1431
|
+
* - `none`: never.
|
|
1432
|
+
* Absent: nothing is said (the platform's usual rules apply).
|
|
1433
|
+
*/
|
|
1434
|
+
write?: 'direct' | 'actions' | 'none';
|
|
1435
|
+
}
|
|
1436
|
+
/** One common question and how to answer it: an object query in plain words, or the action that knows. */
|
|
1437
|
+
export interface AssistantRecipe {
|
|
1438
|
+
/** The question as people ask it (≤ 160 characters): "What's on tomorrow?" */
|
|
1439
|
+
question: string;
|
|
1440
|
+
/** How to answer (≤ 400 characters): "work order stages of this app planned for that day, by stage; show machine or crew". */
|
|
1441
|
+
answer: string;
|
|
1379
1442
|
}
|
|
1380
1443
|
/** One field of a connector's "Connect" form. */
|
|
1381
1444
|
export interface ConnectorConnectionField {
|
package/dist/types/contact.d.ts
CHANGED
|
@@ -34,6 +34,61 @@ export interface ContactListResponse {
|
|
|
34
34
|
limit: number;
|
|
35
35
|
offset: number;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Two contacts that look like one person (`contact.findDuplicates`): `keep` has a sign-in but no email
|
|
39
|
+
* (or phone); `merge` has no sign-in and holds that sign-in's verified email (or phone).
|
|
40
|
+
*/
|
|
41
|
+
export interface ContactDuplicatePair {
|
|
42
|
+
/** The contact with the sign-in — the one `contact.merge` should keep. */
|
|
43
|
+
keep: Contact;
|
|
44
|
+
/** The contact holding the address — the one to fold into `keep`. */
|
|
45
|
+
merge: Contact;
|
|
46
|
+
/** What ties them together. */
|
|
47
|
+
matchedOn: "email" | "phone";
|
|
48
|
+
}
|
|
49
|
+
export interface ContactDuplicatesResponse {
|
|
50
|
+
pairs: ContactDuplicatePair[];
|
|
51
|
+
/** How many contacts with a sign-in were checked in this call. */
|
|
52
|
+
scanned: number;
|
|
53
|
+
/** More contacts remain beyond this window: call again with `offset` + `scanned`. */
|
|
54
|
+
more: boolean;
|
|
55
|
+
}
|
|
56
|
+
/** What `contact.merge` did. */
|
|
57
|
+
export interface ContactMergeResponse {
|
|
58
|
+
/** The contact that was kept. */
|
|
59
|
+
contactId: string;
|
|
60
|
+
/** The contact that was retired (soft-deleted, marked `customFields.mergedInto`). */
|
|
61
|
+
mergedFrom: string;
|
|
62
|
+
moved: {
|
|
63
|
+
/** The sign-in moved onto the kept contact. */
|
|
64
|
+
login: boolean;
|
|
65
|
+
/** Emails and phones moved across. */
|
|
66
|
+
identities: number;
|
|
67
|
+
records?: number;
|
|
68
|
+
cases?: number;
|
|
69
|
+
threads?: number;
|
|
70
|
+
bookings?: number;
|
|
71
|
+
loyaltyMembers?: number;
|
|
72
|
+
assets?: number;
|
|
73
|
+
uploadTokens?: number;
|
|
74
|
+
aiSessions?: number;
|
|
75
|
+
/** One-to-one messages and Inbox conversations with them. */
|
|
76
|
+
messages?: number;
|
|
77
|
+
conversations?: number;
|
|
78
|
+
};
|
|
79
|
+
/** The kept contact after the merge. */
|
|
80
|
+
contact: Contact;
|
|
81
|
+
}
|
|
82
|
+
/** What `contact.linkLogin` found. */
|
|
83
|
+
export interface ContactLinkLoginResponse {
|
|
84
|
+
/** The contact that carries the sign-in. */
|
|
85
|
+
contactId: string;
|
|
86
|
+
/** True when this call attached the sign-in to that contact (or merged a duplicate into it). */
|
|
87
|
+
linked: boolean;
|
|
88
|
+
contact: Contact;
|
|
89
|
+
}
|
|
90
|
+
/** `error` codes `contact.merge` can refuse with. */
|
|
91
|
+
export type ContactMergeErrorCode = "INVALID_CONTACT" | "SAME_CONTACT" | "NOT_FOUND" | "KEEP_DELETED" | "LOGIN_CONFLICT" | "LOYALTY_CONFLICT";
|
|
37
92
|
export interface ContactSearchParams {
|
|
38
93
|
collectionId: string;
|
|
39
94
|
q?: string;
|
package/dist/types/realtime.d.ts
CHANGED
|
@@ -57,7 +57,10 @@ export interface RealtimeMessage {
|
|
|
57
57
|
}
|
|
58
58
|
/** "This changed" — ids only; refetch through the normal API. */
|
|
59
59
|
export interface RealtimeChangeEvent {
|
|
60
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* 'product' | 'proof' | 'asset' | 'record' | 'collection' | 'collection.apps' | 'settings' | …
|
|
62
|
+
* and, on an app's staff feed (`onStaffChange`): 'workOrder' | 'container' | 'stock'.
|
|
63
|
+
*/
|
|
61
64
|
type: string;
|
|
62
65
|
id?: string;
|
|
63
66
|
appId?: string;
|
|
@@ -66,6 +69,8 @@ export interface RealtimeChangeEvent {
|
|
|
66
69
|
proofId?: string;
|
|
67
70
|
/** 'created' | 'updated' | 'deleted' (records) or 'create' | 'update' | 'delete' (products, proofs…) */
|
|
68
71
|
status?: string;
|
|
72
|
+
/** A container's type ("drum", "pallet"), on a 'container' change. */
|
|
73
|
+
kind?: string;
|
|
69
74
|
at: number;
|
|
70
75
|
}
|
|
71
76
|
/** Which changes to hear about — every field given must match. */
|
|
@@ -76,6 +81,7 @@ export interface RealtimeChangeFilter {
|
|
|
76
81
|
recordType?: string;
|
|
77
82
|
productId?: string;
|
|
78
83
|
proofId?: string;
|
|
84
|
+
kind?: string;
|
|
79
85
|
}
|
|
80
86
|
/** A channel an app declares in its manifest (`realtime.channels`). */
|
|
81
87
|
export interface RealtimeChannelDeclaration {
|