@blue-labs/sdk-dsl 3.8.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/LICENSE +21 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4936 -0
- package/dist/lib/ai/ai-builder.d.ts +32 -0
- package/dist/lib/ai/ai-builder.d.ts.map +1 -0
- package/dist/lib/ai/ai-types.d.ts +40 -0
- package/dist/lib/ai/ai-types.d.ts.map +1 -0
- package/dist/lib/ai/index.d.ts +3 -0
- package/dist/lib/ai/index.d.ts.map +1 -0
- package/dist/lib/core/basic-blue-types.d.ts +10 -0
- package/dist/lib/core/basic-blue-types.d.ts.map +1 -0
- package/dist/lib/core/doc-json-state.d.ts +28 -0
- package/dist/lib/core/doc-json-state.d.ts.map +1 -0
- package/dist/lib/core/index.d.ts +8 -0
- package/dist/lib/core/index.d.ts.map +1 -0
- package/dist/lib/core/pointers.d.ts +6 -0
- package/dist/lib/core/pointers.d.ts.map +1 -0
- package/dist/lib/core/runtime-type-support.d.ts +6 -0
- package/dist/lib/core/runtime-type-support.d.ts.map +1 -0
- package/dist/lib/core/serialization.d.ts +11 -0
- package/dist/lib/core/serialization.d.ts.map +1 -0
- package/dist/lib/core/type-alias.d.ts +7 -0
- package/dist/lib/core/type-alias.d.ts.map +1 -0
- package/dist/lib/core/types.d.ts +23 -0
- package/dist/lib/core/types.d.ts.map +1 -0
- package/dist/lib/doc-builder/doc-builder.d.ts +136 -0
- package/dist/lib/doc-builder/doc-builder.d.ts.map +1 -0
- package/dist/lib/doc-builder/field-builder.d.ts +41 -0
- package/dist/lib/doc-builder/field-builder.d.ts.map +1 -0
- package/dist/lib/doc-builder/index.d.ts +5 -0
- package/dist/lib/doc-builder/index.d.ts.map +1 -0
- package/dist/lib/doc-builder/operation-builder.d.ts +38 -0
- package/dist/lib/doc-builder/operation-builder.d.ts.map +1 -0
- package/dist/lib/doc-builder/simple-doc-builder.d.ts +10 -0
- package/dist/lib/doc-builder/simple-doc-builder.d.ts.map +1 -0
- package/dist/lib/index.d.ts +10 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/interactions/access-builder.d.ts +38 -0
- package/dist/lib/interactions/access-builder.d.ts.map +1 -0
- package/dist/lib/interactions/agency-bindings-builder.d.ts +11 -0
- package/dist/lib/interactions/agency-bindings-builder.d.ts.map +1 -0
- package/dist/lib/interactions/agency-builder.d.ts +30 -0
- package/dist/lib/interactions/agency-builder.d.ts.map +1 -0
- package/dist/lib/interactions/agency-options-builder.d.ts +20 -0
- package/dist/lib/interactions/agency-options-builder.d.ts.map +1 -0
- package/dist/lib/interactions/index.d.ts +7 -0
- package/dist/lib/interactions/index.d.ts.map +1 -0
- package/dist/lib/interactions/linked-access-builder.d.ts +45 -0
- package/dist/lib/interactions/linked-access-builder.d.ts.map +1 -0
- package/dist/lib/interactions/types.d.ts +62 -0
- package/dist/lib/interactions/types.d.ts.map +1 -0
- package/dist/lib/patch/blue-change-compiler.d.ts +61 -0
- package/dist/lib/patch/blue-change-compiler.d.ts.map +1 -0
- package/dist/lib/patch/diff.d.ts +15 -0
- package/dist/lib/patch/diff.d.ts.map +1 -0
- package/dist/lib/patch/doc-patch.d.ts +25 -0
- package/dist/lib/patch/doc-patch.d.ts.map +1 -0
- package/dist/lib/patch/index.d.ts +4 -0
- package/dist/lib/patch/index.d.ts.map +1 -0
- package/dist/lib/paynote/index.d.ts +3 -0
- package/dist/lib/paynote/index.d.ts.map +1 -0
- package/dist/lib/paynote/paynote-builder.d.ts +33 -0
- package/dist/lib/paynote/paynote-builder.d.ts.map +1 -0
- package/dist/lib/paynote/paynotes.d.ts +5 -0
- package/dist/lib/paynote/paynotes.d.ts.map +1 -0
- package/dist/lib/samples/java-sandbox-samples.d.ts +29 -0
- package/dist/lib/samples/java-sandbox-samples.d.ts.map +1 -0
- package/dist/lib/steps/access-steps.d.ts +44 -0
- package/dist/lib/steps/access-steps.d.ts.map +1 -0
- package/dist/lib/steps/agency-steps.d.ts +28 -0
- package/dist/lib/steps/agency-steps.d.ts.map +1 -0
- package/dist/lib/steps/bootstrap-bindings.d.ts +4 -0
- package/dist/lib/steps/bootstrap-bindings.d.ts.map +1 -0
- package/dist/lib/steps/index.d.ts +7 -0
- package/dist/lib/steps/index.d.ts.map +1 -0
- package/dist/lib/steps/myos-permissions.d.ts +16 -0
- package/dist/lib/steps/myos-permissions.d.ts.map +1 -0
- package/dist/lib/steps/myos-steps.d.ts +23 -0
- package/dist/lib/steps/myos-steps.d.ts.map +1 -0
- package/dist/lib/steps/steps-builder.d.ts +137 -0
- package/dist/lib/steps/steps-builder.d.ts.map +1 -0
- package/dist/lib/structure/doc-structure.d.ts +62 -0
- package/dist/lib/structure/doc-structure.d.ts.map +1 -0
- package/dist/lib/structure/index.d.ts +2 -0
- package/dist/lib/structure/index.d.ts.map +1 -0
- package/dist/test-harness/runtime.d.ts +14 -0
- package/dist/test-harness/runtime.d.ts.map +1 -0
- package/dist/test-support/editing-support.d.ts +10 -0
- package/dist/test-support/editing-support.d.ts.map +1 -0
- package/package.json +36 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4936 @@
|
|
|
1
|
+
import { Blue as Xe, BlueNode as N, applyBlueNodePatch as et } from "@blue-labs/language";
|
|
2
|
+
import { repository as me } from "@blue-repository/types";
|
|
3
|
+
const K = {
|
|
4
|
+
Text: "Text",
|
|
5
|
+
Integer: "Integer",
|
|
6
|
+
Double: "Double",
|
|
7
|
+
Boolean: "Boolean",
|
|
8
|
+
List: "List",
|
|
9
|
+
Dictionary: "Dictionary"
|
|
10
|
+
};
|
|
11
|
+
function z(n) {
|
|
12
|
+
return typeof n == "object" && n !== null && !Array.isArray(n);
|
|
13
|
+
}
|
|
14
|
+
function tt(n) {
|
|
15
|
+
const e = n.trim();
|
|
16
|
+
if (e.length === 0)
|
|
17
|
+
throw new Error("Pointer cannot be empty");
|
|
18
|
+
if (!e.startsWith("/"))
|
|
19
|
+
throw new Error(`Pointer must start with '/': ${e}`);
|
|
20
|
+
return e;
|
|
21
|
+
}
|
|
22
|
+
function ee(n) {
|
|
23
|
+
if (!/^\d+$/.test(n))
|
|
24
|
+
throw new Error(`Expected numeric array segment but got '${n}'`);
|
|
25
|
+
return Number.parseInt(n, 10);
|
|
26
|
+
}
|
|
27
|
+
function W(n) {
|
|
28
|
+
return n.replace(/~/gu, "~0").replace(/\//gu, "~1");
|
|
29
|
+
}
|
|
30
|
+
function nt(n) {
|
|
31
|
+
return n.replace(/~1/gu, "/").replace(/~0/gu, "~");
|
|
32
|
+
}
|
|
33
|
+
function ke(n) {
|
|
34
|
+
const e = tt(n);
|
|
35
|
+
return e === "/" ? [] : e.split("/").slice(1).map(nt);
|
|
36
|
+
}
|
|
37
|
+
function st(n, e) {
|
|
38
|
+
const t = n[e];
|
|
39
|
+
if (z(t))
|
|
40
|
+
return t;
|
|
41
|
+
const s = {};
|
|
42
|
+
return n[e] = s, s;
|
|
43
|
+
}
|
|
44
|
+
function rt(n, e) {
|
|
45
|
+
const t = n[e];
|
|
46
|
+
if (Array.isArray(t))
|
|
47
|
+
return t;
|
|
48
|
+
const s = [];
|
|
49
|
+
return n[e] = s, s;
|
|
50
|
+
}
|
|
51
|
+
function it(n, e, t, s) {
|
|
52
|
+
if (!t && e >= n.length)
|
|
53
|
+
throw new Error(`Array index out of bounds while traversing: ${e}`);
|
|
54
|
+
for (; n.length <= e; )
|
|
55
|
+
n.push(s && /^\d+$/.test(s) ? [] : {});
|
|
56
|
+
const r = n[e];
|
|
57
|
+
if (z(r))
|
|
58
|
+
return r;
|
|
59
|
+
if (Array.isArray(r))
|
|
60
|
+
throw new Error(
|
|
61
|
+
"Array-in-array traversal is not supported for object hops"
|
|
62
|
+
);
|
|
63
|
+
if (!t)
|
|
64
|
+
throw new Error(`Cannot traverse scalar array element at index ${e}`);
|
|
65
|
+
const i = {};
|
|
66
|
+
return n[e] = i, i;
|
|
67
|
+
}
|
|
68
|
+
function Z(n, e, t, s = {}) {
|
|
69
|
+
const { createMissing: r = !0 } = s, i = ke(e);
|
|
70
|
+
if (i.length === 0)
|
|
71
|
+
throw new Error("Pointer cannot target document root");
|
|
72
|
+
let o = n, c = null;
|
|
73
|
+
for (let p = 0; p < i.length - 1; p += 1) {
|
|
74
|
+
const g = i[p], k = i[p + 1], l = /^\d+$/.test(k);
|
|
75
|
+
if (c) {
|
|
76
|
+
const d = ee(g);
|
|
77
|
+
o = it(
|
|
78
|
+
c,
|
|
79
|
+
d,
|
|
80
|
+
r,
|
|
81
|
+
k
|
|
82
|
+
), c = null;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const a = o[g];
|
|
86
|
+
if (l) {
|
|
87
|
+
if (!r && !Array.isArray(a))
|
|
88
|
+
throw new Error(`Missing array segment '${g}'`);
|
|
89
|
+
c = rt(o, g);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (!r && !z(a))
|
|
93
|
+
throw new Error(`Missing object segment '${g}'`);
|
|
94
|
+
o = st(o, g);
|
|
95
|
+
}
|
|
96
|
+
const h = i[i.length - 1];
|
|
97
|
+
if (c) {
|
|
98
|
+
const p = ee(h);
|
|
99
|
+
if (!r && p >= c.length)
|
|
100
|
+
throw new Error(`Array index out of bounds while writing: ${p}`);
|
|
101
|
+
for (; c.length <= p; )
|
|
102
|
+
c.push(null);
|
|
103
|
+
c[p] = t;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
o[h] = t;
|
|
107
|
+
}
|
|
108
|
+
function H(n, e) {
|
|
109
|
+
const t = ke(e);
|
|
110
|
+
if (t.length === 0)
|
|
111
|
+
throw new Error("Pointer cannot target document root");
|
|
112
|
+
let s = n;
|
|
113
|
+
for (let i = 0; i < t.length - 1; i += 1) {
|
|
114
|
+
const o = t[i];
|
|
115
|
+
if (Array.isArray(s)) {
|
|
116
|
+
s = s[ee(o)];
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (!z(s))
|
|
120
|
+
return;
|
|
121
|
+
s = s[o];
|
|
122
|
+
}
|
|
123
|
+
const r = t[t.length - 1];
|
|
124
|
+
if (Array.isArray(s)) {
|
|
125
|
+
const i = ee(r);
|
|
126
|
+
i >= 0 && i < s.length && s.splice(i, 1);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
z(s) && delete s[r];
|
|
130
|
+
}
|
|
131
|
+
function ot(n, e) {
|
|
132
|
+
const t = ke(e);
|
|
133
|
+
if (t.length === 0)
|
|
134
|
+
return n;
|
|
135
|
+
let s = n;
|
|
136
|
+
for (const r of t) {
|
|
137
|
+
if (Array.isArray(s)) {
|
|
138
|
+
const i = ee(r);
|
|
139
|
+
s = s[i];
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (!z(s))
|
|
143
|
+
return;
|
|
144
|
+
s = s[r];
|
|
145
|
+
}
|
|
146
|
+
return s;
|
|
147
|
+
}
|
|
148
|
+
const at = /* @__PURE__ */ new Set([
|
|
149
|
+
"name",
|
|
150
|
+
"description",
|
|
151
|
+
"type",
|
|
152
|
+
"contracts",
|
|
153
|
+
"policies"
|
|
154
|
+
]);
|
|
155
|
+
function Ne(n, e, t, s = [], r = []) {
|
|
156
|
+
return {
|
|
157
|
+
key: n,
|
|
158
|
+
title: e,
|
|
159
|
+
summary: t,
|
|
160
|
+
relatedFields: new Set(s),
|
|
161
|
+
relatedContracts: new Set(r)
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function V(n, e) {
|
|
165
|
+
const t = n.trim();
|
|
166
|
+
if (t.length === 0)
|
|
167
|
+
throw new Error(`${e} is required`);
|
|
168
|
+
return t;
|
|
169
|
+
}
|
|
170
|
+
function ct(n, e) {
|
|
171
|
+
if (!n || typeof n != "object" || Array.isArray(n))
|
|
172
|
+
return null;
|
|
173
|
+
const t = n;
|
|
174
|
+
if (t.type !== "Conversation/Document Section")
|
|
175
|
+
return null;
|
|
176
|
+
const s = typeof t.title == "string" ? t.title : e, r = typeof t.summary == "string" ? t.summary : void 0, i = Array.isArray(t.relatedFields) ? t.relatedFields.filter(
|
|
177
|
+
(c) => typeof c == "string"
|
|
178
|
+
) : [], o = Array.isArray(t.relatedContracts) ? t.relatedContracts.filter(
|
|
179
|
+
(c) => typeof c == "string"
|
|
180
|
+
) : [];
|
|
181
|
+
return Ne(
|
|
182
|
+
e,
|
|
183
|
+
s,
|
|
184
|
+
r,
|
|
185
|
+
i,
|
|
186
|
+
o
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
class ut {
|
|
190
|
+
document;
|
|
191
|
+
sections = /* @__PURE__ */ new Map();
|
|
192
|
+
currentSection = null;
|
|
193
|
+
constructor(e) {
|
|
194
|
+
this.document = e ? structuredClone(e) : {};
|
|
195
|
+
}
|
|
196
|
+
setName(e) {
|
|
197
|
+
return this.document.name = V(e, "name"), this;
|
|
198
|
+
}
|
|
199
|
+
setDescription(e) {
|
|
200
|
+
return this.document.description = V(e, "description"), this;
|
|
201
|
+
}
|
|
202
|
+
setType(e) {
|
|
203
|
+
return this.document.type = V(e, "type"), this;
|
|
204
|
+
}
|
|
205
|
+
setValue(e, t) {
|
|
206
|
+
return Z(this.document, e, t), this.trackField(e), this;
|
|
207
|
+
}
|
|
208
|
+
removeValue(e) {
|
|
209
|
+
return H(this.document, e), this.untrackField(e), this;
|
|
210
|
+
}
|
|
211
|
+
getValue(e) {
|
|
212
|
+
return ot(this.document, e);
|
|
213
|
+
}
|
|
214
|
+
ensureContractsRoot() {
|
|
215
|
+
const e = this.document.contracts;
|
|
216
|
+
if (e && typeof e == "object" && !Array.isArray(e))
|
|
217
|
+
return e;
|
|
218
|
+
const t = {};
|
|
219
|
+
return this.document.contracts = t, t;
|
|
220
|
+
}
|
|
221
|
+
getContract(e) {
|
|
222
|
+
const t = V(e, "contract key"), s = this.document.contracts;
|
|
223
|
+
if (!s || typeof s != "object" || Array.isArray(s))
|
|
224
|
+
return;
|
|
225
|
+
const r = s[t];
|
|
226
|
+
return r && typeof r == "object" && !Array.isArray(r) ? r : void 0;
|
|
227
|
+
}
|
|
228
|
+
setContract(e, t) {
|
|
229
|
+
const s = V(e, "contract key");
|
|
230
|
+
if (this.currentSection?.key === s)
|
|
231
|
+
throw new Error(
|
|
232
|
+
`Contract key '${s}' conflicts with the active section key.`
|
|
233
|
+
);
|
|
234
|
+
return this.ensureContractsRoot()[s] = structuredClone(t), this.trackContract(s), this;
|
|
235
|
+
}
|
|
236
|
+
removeContract(e) {
|
|
237
|
+
const t = V(e, "contract key"), s = this.document.contracts;
|
|
238
|
+
if (!s || typeof s != "object" || Array.isArray(s))
|
|
239
|
+
return this;
|
|
240
|
+
const r = s;
|
|
241
|
+
return delete r[t], this.untrackContract(t), Object.keys(r).length === 0 && delete this.document.contracts, this;
|
|
242
|
+
}
|
|
243
|
+
section(e, t, s) {
|
|
244
|
+
if (this.currentSection)
|
|
245
|
+
throw new Error(
|
|
246
|
+
`Already in section '${this.currentSection.key}'. Call endSection() first.`
|
|
247
|
+
);
|
|
248
|
+
const r = V(e, "section key"), i = this.sections.get(r), o = this.ensureContractsRoot()[r], c = i ?? ct(o, r);
|
|
249
|
+
if (!i && o !== void 0 && !c)
|
|
250
|
+
throw new Error(
|
|
251
|
+
`Section key '${r}' conflicts with an existing non-section contract.`
|
|
252
|
+
);
|
|
253
|
+
return this.currentSection = c ?? Ne(
|
|
254
|
+
r,
|
|
255
|
+
V(t ?? r, "section title"),
|
|
256
|
+
s?.trim() || void 0
|
|
257
|
+
), this;
|
|
258
|
+
}
|
|
259
|
+
endSection() {
|
|
260
|
+
if (!this.currentSection)
|
|
261
|
+
throw new Error("Not in a section.");
|
|
262
|
+
return this.sections.set(this.currentSection.key, this.currentSection), this.syncPersistedSection(this.currentSection), this.currentSection = null, this;
|
|
263
|
+
}
|
|
264
|
+
trackField(e) {
|
|
265
|
+
if (!this.currentSection)
|
|
266
|
+
return this;
|
|
267
|
+
const t = e.trim();
|
|
268
|
+
return t.startsWith("/") && this.currentSection.relatedFields.add(t), this;
|
|
269
|
+
}
|
|
270
|
+
untrackField(e) {
|
|
271
|
+
const t = e.trim();
|
|
272
|
+
if (!t.startsWith("/"))
|
|
273
|
+
return this;
|
|
274
|
+
this.currentSection?.relatedFields.delete(t);
|
|
275
|
+
for (const s of this.sections.values())
|
|
276
|
+
s.relatedFields.delete(t), this.syncPersistedSection(s);
|
|
277
|
+
return this;
|
|
278
|
+
}
|
|
279
|
+
trackContract(e) {
|
|
280
|
+
if (!this.currentSection)
|
|
281
|
+
return this;
|
|
282
|
+
const t = e.trim();
|
|
283
|
+
return t.length > 0 && this.currentSection.relatedContracts.add(t), this;
|
|
284
|
+
}
|
|
285
|
+
untrackContract(e) {
|
|
286
|
+
const t = e.trim();
|
|
287
|
+
if (t.length === 0)
|
|
288
|
+
return this;
|
|
289
|
+
this.currentSection?.relatedContracts.delete(t);
|
|
290
|
+
for (const s of this.sections.values())
|
|
291
|
+
s.relatedContracts.delete(t), this.syncPersistedSection(s);
|
|
292
|
+
return this;
|
|
293
|
+
}
|
|
294
|
+
snapshotSection(e) {
|
|
295
|
+
const t = this.sections.get(e) ?? this.currentSection;
|
|
296
|
+
if (!t || t.key !== e)
|
|
297
|
+
throw new Error(`Section '${e}' is not available`);
|
|
298
|
+
return {
|
|
299
|
+
key: t.key,
|
|
300
|
+
title: t.title,
|
|
301
|
+
summary: t.summary,
|
|
302
|
+
relatedFields: [...t.relatedFields],
|
|
303
|
+
relatedContracts: [...t.relatedContracts]
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
build() {
|
|
307
|
+
if (this.currentSection)
|
|
308
|
+
throw new Error(
|
|
309
|
+
`Unclosed section '${this.currentSection.key}'. Call endSection() before build.`
|
|
310
|
+
);
|
|
311
|
+
return structuredClone(this.document);
|
|
312
|
+
}
|
|
313
|
+
validateRootPath(e) {
|
|
314
|
+
const t = e.trim();
|
|
315
|
+
if (!t.startsWith("/"))
|
|
316
|
+
return;
|
|
317
|
+
const s = t.split("/")[1];
|
|
318
|
+
if (s && at.has(s))
|
|
319
|
+
throw new Error(`Path points at reserved root key: /${s}`);
|
|
320
|
+
}
|
|
321
|
+
syncPersistedSection(e) {
|
|
322
|
+
this.ensureContractsRoot()[e.key] = {
|
|
323
|
+
type: "Conversation/Document Section",
|
|
324
|
+
title: e.title,
|
|
325
|
+
...e.summary ? { summary: e.summary } : {},
|
|
326
|
+
...e.relatedFields.size > 0 ? { relatedFields: [...e.relatedFields] } : {},
|
|
327
|
+
...e.relatedContracts.size > 0 ? { relatedContracts: [...e.relatedContracts] } : {}
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
const te = new Xe({
|
|
332
|
+
repositories: [me]
|
|
333
|
+
});
|
|
334
|
+
function re(n) {
|
|
335
|
+
return te.jsonValueToNode(n);
|
|
336
|
+
}
|
|
337
|
+
function ae(n) {
|
|
338
|
+
if (Le(n))
|
|
339
|
+
return structuredClone(n);
|
|
340
|
+
const e = te.restoreInlineTypes(We(n));
|
|
341
|
+
return te.nodeToJson(e, "simple");
|
|
342
|
+
}
|
|
343
|
+
function ns(n) {
|
|
344
|
+
const e = te.restoreInlineTypes(
|
|
345
|
+
Le(n) ? re(n) : We(n)
|
|
346
|
+
);
|
|
347
|
+
return te.nodeToYaml(e, "simple");
|
|
348
|
+
}
|
|
349
|
+
function A(n) {
|
|
350
|
+
const e = n.trim();
|
|
351
|
+
return e.startsWith("${") && e.endsWith("}") ? e : `\${${e}}`;
|
|
352
|
+
}
|
|
353
|
+
function We(n) {
|
|
354
|
+
return lt(n) ? n.buildDocument() : n;
|
|
355
|
+
}
|
|
356
|
+
function lt(n) {
|
|
357
|
+
return typeof n == "object" && n !== null && typeof n.buildDocument == "function";
|
|
358
|
+
}
|
|
359
|
+
function Le(n) {
|
|
360
|
+
return typeof n == "object" && n !== null && !Array.isArray(n) && !(n instanceof N) && typeof n.buildDocument != "function";
|
|
361
|
+
}
|
|
362
|
+
function m(n) {
|
|
363
|
+
if (typeof n == "string") {
|
|
364
|
+
const t = n.trim();
|
|
365
|
+
if (!t)
|
|
366
|
+
throw new Error("Cannot resolve type alias from empty string");
|
|
367
|
+
return t;
|
|
368
|
+
}
|
|
369
|
+
const e = n.name?.trim();
|
|
370
|
+
if (!e)
|
|
371
|
+
throw new Error("Cannot resolve type alias from unnamed constructor");
|
|
372
|
+
switch (e) {
|
|
373
|
+
case "String":
|
|
374
|
+
return K.Text;
|
|
375
|
+
case "Number":
|
|
376
|
+
return K.Integer;
|
|
377
|
+
case "Boolean":
|
|
378
|
+
return K.Boolean;
|
|
379
|
+
case "Array":
|
|
380
|
+
return K.List;
|
|
381
|
+
case "Object":
|
|
382
|
+
return K.Dictionary;
|
|
383
|
+
default:
|
|
384
|
+
return e;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function ue(n) {
|
|
388
|
+
return typeof n == "object" && n !== null;
|
|
389
|
+
}
|
|
390
|
+
function ht() {
|
|
391
|
+
if (!ue(me))
|
|
392
|
+
return [];
|
|
393
|
+
const n = me.packages;
|
|
394
|
+
return ue(n) ? Object.values(n).filter(ue) : [];
|
|
395
|
+
}
|
|
396
|
+
function pt() {
|
|
397
|
+
const n = new Set(Object.values(K));
|
|
398
|
+
for (const e of ht())
|
|
399
|
+
if (e.aliases)
|
|
400
|
+
for (const t of Object.keys(e.aliases))
|
|
401
|
+
n.add(t);
|
|
402
|
+
return n;
|
|
403
|
+
}
|
|
404
|
+
const dt = pt(), Y = {
|
|
405
|
+
NamedEvent: "Common/Named Event"
|
|
406
|
+
};
|
|
407
|
+
function mt(n) {
|
|
408
|
+
return dt.has(n.trim());
|
|
409
|
+
}
|
|
410
|
+
function Ue(n, e) {
|
|
411
|
+
const t = n.trim();
|
|
412
|
+
if (!mt(t))
|
|
413
|
+
throw new Error(
|
|
414
|
+
`${e} requires repository type alias '${t}', but this alias is not available in the currently installed @blue-repository/types package.`
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
function Fe(n) {
|
|
418
|
+
return m(n);
|
|
419
|
+
}
|
|
420
|
+
function v(n, e) {
|
|
421
|
+
const t = n?.trim();
|
|
422
|
+
if (!t)
|
|
423
|
+
throw new Error(`${e} is required`);
|
|
424
|
+
return t;
|
|
425
|
+
}
|
|
426
|
+
function le(n) {
|
|
427
|
+
return n.replace(/[^A-Za-z0-9]+/gu, "_").replace(/^_+|_+$/gu, "").toUpperCase();
|
|
428
|
+
}
|
|
429
|
+
class ft {
|
|
430
|
+
constructor(e, t) {
|
|
431
|
+
this.parent = e, this.taskName = t;
|
|
432
|
+
}
|
|
433
|
+
instructions = [];
|
|
434
|
+
expectedResponses = [];
|
|
435
|
+
instruction(e) {
|
|
436
|
+
const t = e.trim();
|
|
437
|
+
return t.length > 0 && this.instructions.push(t), this;
|
|
438
|
+
}
|
|
439
|
+
expects(e) {
|
|
440
|
+
return this.expectedResponses.push(Fe(e)), this;
|
|
441
|
+
}
|
|
442
|
+
done() {
|
|
443
|
+
if (this.instructions.length === 0)
|
|
444
|
+
throw new Error(
|
|
445
|
+
`Task '${this.taskName}' must define at least one instruction`
|
|
446
|
+
);
|
|
447
|
+
return this.parent.registerTask({
|
|
448
|
+
name: this.taskName,
|
|
449
|
+
instructions: [...this.instructions],
|
|
450
|
+
expectedResponses: [...this.expectedResponses]
|
|
451
|
+
}), this.parent;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
class gt {
|
|
455
|
+
constructor(e, t) {
|
|
456
|
+
this.parent = e;
|
|
457
|
+
const s = v(t, "ai name");
|
|
458
|
+
this.definition = {
|
|
459
|
+
name: s,
|
|
460
|
+
statusPath: `/ai/${s}/status`,
|
|
461
|
+
contextPath: `/ai/${s}/context`,
|
|
462
|
+
requesterId: le(s),
|
|
463
|
+
requestId: `REQ_${le(s)}`,
|
|
464
|
+
subscriptionId: `SUB_${le(s)}`,
|
|
465
|
+
permissionTiming: "onInit",
|
|
466
|
+
tasks: {}
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
definition;
|
|
470
|
+
sessionId(e) {
|
|
471
|
+
return this.definition.sessionId = v(e, "sessionId"), this;
|
|
472
|
+
}
|
|
473
|
+
permissionFrom(e) {
|
|
474
|
+
return this.definition.permissionFrom = v(e, "permissionFrom"), this;
|
|
475
|
+
}
|
|
476
|
+
statusPath(e) {
|
|
477
|
+
return this.definition.statusPath = v(e, "statusPath"), this;
|
|
478
|
+
}
|
|
479
|
+
contextPath(e) {
|
|
480
|
+
return this.definition.contextPath = v(e, "contextPath"), this;
|
|
481
|
+
}
|
|
482
|
+
requesterId(e) {
|
|
483
|
+
return this.definition.requesterId = v(e, "requesterId"), this;
|
|
484
|
+
}
|
|
485
|
+
requestId(e) {
|
|
486
|
+
return this.definition.requestId = v(e, "requestId"), this;
|
|
487
|
+
}
|
|
488
|
+
subscriptionId(e) {
|
|
489
|
+
return this.definition.subscriptionId = v(
|
|
490
|
+
e,
|
|
491
|
+
"subscriptionId"
|
|
492
|
+
), this;
|
|
493
|
+
}
|
|
494
|
+
requestPermissionOnInit() {
|
|
495
|
+
return this.definition.permissionTiming = "onInit", this.definition.permissionTriggerEventType = void 0, this.definition.permissionTriggerDocPath = void 0, this;
|
|
496
|
+
}
|
|
497
|
+
requestPermissionOnEvent(e) {
|
|
498
|
+
return this.definition.permissionTiming = "onEvent", this.definition.permissionTriggerEventType = Fe(e), this.definition.permissionTriggerDocPath = void 0, this;
|
|
499
|
+
}
|
|
500
|
+
requestPermissionOnDocChange(e) {
|
|
501
|
+
return this.definition.permissionTiming = "onDocChange", this.definition.permissionTriggerDocPath = v(
|
|
502
|
+
e,
|
|
503
|
+
"permission trigger doc path"
|
|
504
|
+
), this.definition.permissionTriggerEventType = void 0, this;
|
|
505
|
+
}
|
|
506
|
+
requestPermissionManually() {
|
|
507
|
+
return this.definition.permissionTiming = "manual", this.definition.permissionTriggerDocPath = void 0, this.definition.permissionTriggerEventType = void 0, this;
|
|
508
|
+
}
|
|
509
|
+
task(e) {
|
|
510
|
+
return new ft(this, v(e, "task name"));
|
|
511
|
+
}
|
|
512
|
+
registerTask(e) {
|
|
513
|
+
if (this.definition.tasks[e.name])
|
|
514
|
+
throw new Error(`Duplicate AI task name: ${e.name}`);
|
|
515
|
+
this.definition.tasks[e.name] = e;
|
|
516
|
+
}
|
|
517
|
+
done() {
|
|
518
|
+
return v(this.definition.sessionId, "sessionId"), v(this.definition.permissionFrom, "permissionFrom"), v(this.definition.statusPath, "statusPath"), v(this.definition.contextPath, "contextPath"), v(this.definition.requesterId, "requesterId"), this.parent.registerAiIntegration(this.definition);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
function D(n, e) {
|
|
522
|
+
const t = n?.trim();
|
|
523
|
+
if (!t)
|
|
524
|
+
throw new Error(`${e} is required`);
|
|
525
|
+
return t;
|
|
526
|
+
}
|
|
527
|
+
function yt(n) {
|
|
528
|
+
const e = n.replace(/[^A-Za-z0-9]+/gu, "_").replace(/^_+|_+$/gu, "").toUpperCase();
|
|
529
|
+
return e.length > 0 ? e : "ACCESS";
|
|
530
|
+
}
|
|
531
|
+
class Ct {
|
|
532
|
+
constructor(e, t) {
|
|
533
|
+
this.parent = e, this.name = t;
|
|
534
|
+
}
|
|
535
|
+
onBehalfOfValue;
|
|
536
|
+
targetSessionIdValue;
|
|
537
|
+
requestIdValue;
|
|
538
|
+
subscriptionIdValue;
|
|
539
|
+
readValue = !0;
|
|
540
|
+
operationsValue = [];
|
|
541
|
+
statusPathValue;
|
|
542
|
+
subscribeAfterGrantedValue = !1;
|
|
543
|
+
subscriptionEventsValue = [];
|
|
544
|
+
subscribeToCreatedSessionsValue = !1;
|
|
545
|
+
permissionTimingValue = "onInit";
|
|
546
|
+
permissionTriggerEventTypeValue;
|
|
547
|
+
permissionTriggerDocPathValue;
|
|
548
|
+
onBehalfOf(e) {
|
|
549
|
+
return this.onBehalfOfValue = D(e, "onBehalfOf"), this;
|
|
550
|
+
}
|
|
551
|
+
permissionFrom(e) {
|
|
552
|
+
return this.onBehalfOf(e), this;
|
|
553
|
+
}
|
|
554
|
+
targetSessionId(e) {
|
|
555
|
+
return this.targetSessionIdValue = D(e, "targetSessionId"), this;
|
|
556
|
+
}
|
|
557
|
+
requestId(e) {
|
|
558
|
+
return this.requestIdValue = D(e, "requestId"), this;
|
|
559
|
+
}
|
|
560
|
+
subscriptionId(e) {
|
|
561
|
+
return this.subscriptionIdValue = D(e, "subscriptionId"), this;
|
|
562
|
+
}
|
|
563
|
+
read(e) {
|
|
564
|
+
if (e === !1)
|
|
565
|
+
throw new Error(
|
|
566
|
+
"access(...).read(false) is not supported; MyOS single-document permissions require read=true"
|
|
567
|
+
);
|
|
568
|
+
return this.readValue = e, this;
|
|
569
|
+
}
|
|
570
|
+
operations(...e) {
|
|
571
|
+
for (const t of e) {
|
|
572
|
+
const s = t?.trim();
|
|
573
|
+
s && this.operationsValue.push(s);
|
|
574
|
+
}
|
|
575
|
+
return this;
|
|
576
|
+
}
|
|
577
|
+
statusPath(e) {
|
|
578
|
+
return this.statusPathValue = D(e, "statusPath"), this;
|
|
579
|
+
}
|
|
580
|
+
subscribeAfterGranted() {
|
|
581
|
+
return this.subscribeAfterGrantedValue = !0, this;
|
|
582
|
+
}
|
|
583
|
+
subscriptionEvents(...e) {
|
|
584
|
+
return this.subscriptionEventsValue.length = 0, this.subscriptionEventsValue.push(
|
|
585
|
+
...e.map((t) => m(t))
|
|
586
|
+
), this;
|
|
587
|
+
}
|
|
588
|
+
subscribeToCreatedSessions(e = !0) {
|
|
589
|
+
if (e)
|
|
590
|
+
throw new Error(
|
|
591
|
+
"access(...).subscribeToCreatedSessions(true) is not supported on the current public runtime"
|
|
592
|
+
);
|
|
593
|
+
return this.subscribeToCreatedSessionsValue = e, this;
|
|
594
|
+
}
|
|
595
|
+
requestPermissionOnInit() {
|
|
596
|
+
return this.permissionTimingValue = "onInit", this.permissionTriggerEventTypeValue = void 0, this.permissionTriggerDocPathValue = void 0, this;
|
|
597
|
+
}
|
|
598
|
+
requestPermissionOnEvent(e) {
|
|
599
|
+
return this.permissionTimingValue = "onEvent", this.permissionTriggerEventTypeValue = m(e), this.permissionTriggerDocPathValue = void 0, this;
|
|
600
|
+
}
|
|
601
|
+
requestPermissionOnDocChange(e) {
|
|
602
|
+
return this.permissionTimingValue = "onDocChange", this.permissionTriggerDocPathValue = D(e, "permission path"), this.permissionTriggerEventTypeValue = void 0, this;
|
|
603
|
+
}
|
|
604
|
+
requestPermissionManually() {
|
|
605
|
+
return this.permissionTimingValue = "manual", this.permissionTriggerDocPathValue = void 0, this.permissionTriggerEventTypeValue = void 0, this;
|
|
606
|
+
}
|
|
607
|
+
done() {
|
|
608
|
+
const e = yt(this.name), t = {
|
|
609
|
+
name: this.name,
|
|
610
|
+
token: e,
|
|
611
|
+
targetSessionId: D(
|
|
612
|
+
this.targetSessionIdValue,
|
|
613
|
+
"targetSessionId"
|
|
614
|
+
),
|
|
615
|
+
onBehalfOf: D(this.onBehalfOfValue, "onBehalfOf"),
|
|
616
|
+
requestId: this.requestIdValue ?? `REQ_ACCESS_${e}`,
|
|
617
|
+
subscriptionId: this.subscriptionIdValue ?? `SUB_ACCESS_${e}`,
|
|
618
|
+
read: this.readValue,
|
|
619
|
+
operations: [...new Set(this.operationsValue)],
|
|
620
|
+
...this.statusPathValue ? { statusPath: this.statusPathValue } : {},
|
|
621
|
+
subscribeAfterGranted: this.subscribeAfterGrantedValue,
|
|
622
|
+
subscriptionEvents: [...this.subscriptionEventsValue],
|
|
623
|
+
subscribeToCreatedSessions: this.subscribeToCreatedSessionsValue,
|
|
624
|
+
permissionTiming: this.permissionTimingValue,
|
|
625
|
+
...this.permissionTriggerEventTypeValue ? { permissionTriggerEventType: this.permissionTriggerEventTypeValue } : {},
|
|
626
|
+
...this.permissionTriggerDocPathValue ? { permissionTriggerDocPath: this.permissionTriggerDocPathValue } : {},
|
|
627
|
+
permissionFrom: this.onBehalfOfValue
|
|
628
|
+
}, s = this.parent.registerAccessConfig(t);
|
|
629
|
+
return this.applyAutoWiring(t, s), s;
|
|
630
|
+
}
|
|
631
|
+
applyAutoWiring(e, t) {
|
|
632
|
+
e.statusPath && t.field(e.statusPath, "pending");
|
|
633
|
+
const s = `access${e.token}`, r = (i) => {
|
|
634
|
+
const o = {};
|
|
635
|
+
e.read && (o.read = !0), e.operations.length > 0 && (o.singleOps = [...e.operations]), i.myOs().requestSingleDocPermission(
|
|
636
|
+
e.onBehalfOf,
|
|
637
|
+
e.requestId,
|
|
638
|
+
e.targetSessionId,
|
|
639
|
+
o
|
|
640
|
+
);
|
|
641
|
+
};
|
|
642
|
+
e.permissionTiming === "onInit" ? t.onInit(
|
|
643
|
+
`${s}RequestPermission`,
|
|
644
|
+
r
|
|
645
|
+
) : e.permissionTiming === "onEvent" ? t.onEvent(
|
|
646
|
+
`${s}RequestPermission`,
|
|
647
|
+
e.permissionTriggerEventType ?? "Conversation/Event",
|
|
648
|
+
r
|
|
649
|
+
) : e.permissionTiming === "onDocChange" && t.onDocChange(
|
|
650
|
+
`${s}RequestPermission`,
|
|
651
|
+
e.permissionTriggerDocPath ?? "/",
|
|
652
|
+
r
|
|
653
|
+
), t.onMyOsResponse(
|
|
654
|
+
`${s}Granted`,
|
|
655
|
+
"MyOS/Single Document Permission Granted",
|
|
656
|
+
e.requestId,
|
|
657
|
+
(i) => {
|
|
658
|
+
e.statusPath && i.replaceValue("MarkAccessGranted", e.statusPath, "granted"), e.subscribeAfterGranted && i.myOs().subscribeToSession(
|
|
659
|
+
e.targetSessionId,
|
|
660
|
+
e.subscriptionId,
|
|
661
|
+
...e.subscriptionEvents
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
), t.onMyOsResponse(
|
|
665
|
+
`${s}Rejected`,
|
|
666
|
+
"MyOS/Single Document Permission Rejected",
|
|
667
|
+
e.requestId,
|
|
668
|
+
(i) => {
|
|
669
|
+
e.statusPath && i.replaceValue(
|
|
670
|
+
"MarkAccessRejected",
|
|
671
|
+
e.statusPath,
|
|
672
|
+
"rejected"
|
|
673
|
+
);
|
|
674
|
+
}
|
|
675
|
+
), t.onMyOsResponse(
|
|
676
|
+
`${s}Revoked`,
|
|
677
|
+
"MyOS/Single Document Permission Revoked",
|
|
678
|
+
e.requestId,
|
|
679
|
+
(i) => {
|
|
680
|
+
e.statusPath && i.replaceValue("MarkAccessRevoked", e.statusPath, "revoked");
|
|
681
|
+
}
|
|
682
|
+
), e.subscribeAfterGranted && (t.onMyOsResponse(
|
|
683
|
+
`${s}SubscriptionReady`,
|
|
684
|
+
"MyOS/Subscription to Session Initiated",
|
|
685
|
+
{
|
|
686
|
+
subscriptionId: e.subscriptionId
|
|
687
|
+
},
|
|
688
|
+
(i) => {
|
|
689
|
+
e.statusPath && i.replaceValue(
|
|
690
|
+
"MarkAccessSubscribed",
|
|
691
|
+
e.statusPath,
|
|
692
|
+
"subscribed"
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
), t.onMyOsResponse(
|
|
696
|
+
`${s}SubscriptionFailed`,
|
|
697
|
+
"MyOS/Subscription to Session Failed",
|
|
698
|
+
{
|
|
699
|
+
subscriptionId: e.subscriptionId
|
|
700
|
+
},
|
|
701
|
+
(i) => {
|
|
702
|
+
e.statusPath && i.replaceValue(
|
|
703
|
+
"MarkAccessSubscriptionFailed",
|
|
704
|
+
e.statusPath,
|
|
705
|
+
"subscription-failed"
|
|
706
|
+
);
|
|
707
|
+
}
|
|
708
|
+
));
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
function R(n, e) {
|
|
712
|
+
const t = n?.trim();
|
|
713
|
+
if (!t)
|
|
714
|
+
throw new Error(`${e} is required`);
|
|
715
|
+
return t;
|
|
716
|
+
}
|
|
717
|
+
function vt(n) {
|
|
718
|
+
const e = n.replace(/[^A-Za-z0-9]+/gu, "_").replace(/^_+|_+$/gu, "").toUpperCase();
|
|
719
|
+
return e.length > 0 ? e : "LINKED_ACCESS";
|
|
720
|
+
}
|
|
721
|
+
class St {
|
|
722
|
+
constructor(e, t) {
|
|
723
|
+
this.parent = e, this.name = t;
|
|
724
|
+
}
|
|
725
|
+
onBehalfOfValue;
|
|
726
|
+
targetSessionIdValue;
|
|
727
|
+
requestIdValue;
|
|
728
|
+
subscriptionIdValue;
|
|
729
|
+
statusPathValue;
|
|
730
|
+
linksValue = /* @__PURE__ */ new Map();
|
|
731
|
+
permissionTimingValue = "onInit";
|
|
732
|
+
permissionTriggerEventTypeValue;
|
|
733
|
+
permissionTriggerDocPathValue;
|
|
734
|
+
subscriptionEventsValue = [];
|
|
735
|
+
onBehalfOf(e) {
|
|
736
|
+
return this.onBehalfOfValue = R(e, "onBehalfOf"), this;
|
|
737
|
+
}
|
|
738
|
+
permissionFrom(e) {
|
|
739
|
+
return this.onBehalfOf(e), this;
|
|
740
|
+
}
|
|
741
|
+
targetSessionId(e) {
|
|
742
|
+
return this.targetSessionIdValue = R(e, "targetSessionId"), this;
|
|
743
|
+
}
|
|
744
|
+
requestId(e) {
|
|
745
|
+
return this.requestIdValue = R(e, "requestId"), this;
|
|
746
|
+
}
|
|
747
|
+
subscriptionId(e) {
|
|
748
|
+
return this.subscriptionIdValue = R(e, "subscriptionId"), this;
|
|
749
|
+
}
|
|
750
|
+
statusPath(e) {
|
|
751
|
+
return this.statusPathValue = R(e, "statusPath"), this;
|
|
752
|
+
}
|
|
753
|
+
link(e) {
|
|
754
|
+
const t = R(e, "link name"), s = this.linksValue.get(t) ?? {
|
|
755
|
+
read: !0,
|
|
756
|
+
operations: []
|
|
757
|
+
};
|
|
758
|
+
return this.linksValue.set(t, s), new kt(this, s);
|
|
759
|
+
}
|
|
760
|
+
requestPermissionOnInit() {
|
|
761
|
+
return this.permissionTimingValue = "onInit", this.permissionTriggerEventTypeValue = void 0, this.permissionTriggerDocPathValue = void 0, this;
|
|
762
|
+
}
|
|
763
|
+
requestPermissionOnEvent(e) {
|
|
764
|
+
return this.permissionTimingValue = "onEvent", this.permissionTriggerEventTypeValue = m(e), this.permissionTriggerDocPathValue = void 0, this;
|
|
765
|
+
}
|
|
766
|
+
requestPermissionOnDocChange(e) {
|
|
767
|
+
return this.permissionTimingValue = "onDocChange", this.permissionTriggerDocPathValue = R(e, "permission path"), this.permissionTriggerEventTypeValue = void 0, this;
|
|
768
|
+
}
|
|
769
|
+
requestPermissionManually() {
|
|
770
|
+
return this.permissionTimingValue = "manual", this.permissionTriggerDocPathValue = void 0, this.permissionTriggerEventTypeValue = void 0, this;
|
|
771
|
+
}
|
|
772
|
+
subscriptionEvents(...e) {
|
|
773
|
+
return this.subscriptionEventsValue.length = 0, this.subscriptionEventsValue.push(
|
|
774
|
+
...e.map((t) => m(t))
|
|
775
|
+
), this;
|
|
776
|
+
}
|
|
777
|
+
done() {
|
|
778
|
+
const e = vt(this.name);
|
|
779
|
+
if (this.linksValue.size === 0)
|
|
780
|
+
throw new Error("At least one linked access link must be configured");
|
|
781
|
+
const t = {};
|
|
782
|
+
for (const [i, o] of this.linksValue.entries())
|
|
783
|
+
t[i] = {
|
|
784
|
+
read: o.read,
|
|
785
|
+
operations: [...new Set(o.operations)]
|
|
786
|
+
};
|
|
787
|
+
const s = {
|
|
788
|
+
name: this.name,
|
|
789
|
+
token: e,
|
|
790
|
+
targetSessionId: R(
|
|
791
|
+
this.targetSessionIdValue,
|
|
792
|
+
"targetSessionId"
|
|
793
|
+
),
|
|
794
|
+
onBehalfOf: R(this.onBehalfOfValue, "onBehalfOf"),
|
|
795
|
+
requestId: this.requestIdValue ?? `REQ_LINKED_${e}`,
|
|
796
|
+
subscriptionId: this.subscriptionIdValue ?? `SUB_LINKED_${e}`,
|
|
797
|
+
...this.statusPathValue ? { statusPath: this.statusPathValue } : {},
|
|
798
|
+
links: t,
|
|
799
|
+
permissionTiming: this.permissionTimingValue,
|
|
800
|
+
...this.permissionTriggerEventTypeValue ? { permissionTriggerEventType: this.permissionTriggerEventTypeValue } : {},
|
|
801
|
+
...this.permissionTriggerDocPathValue ? { permissionTriggerDocPath: this.permissionTriggerDocPathValue } : {},
|
|
802
|
+
permissionFrom: this.onBehalfOfValue,
|
|
803
|
+
subscriptionEvents: [...this.subscriptionEventsValue]
|
|
804
|
+
}, r = this.parent.registerLinkedAccessConfig(s);
|
|
805
|
+
return this.applyAutoWiring(s, r), r;
|
|
806
|
+
}
|
|
807
|
+
applyAutoWiring(e, t) {
|
|
808
|
+
e.statusPath && t.field(e.statusPath, "pending");
|
|
809
|
+
const s = `linkedAccess${e.token}`, r = (i) => {
|
|
810
|
+
const o = {};
|
|
811
|
+
for (const [c, h] of Object.entries(e.links)) {
|
|
812
|
+
const p = {};
|
|
813
|
+
h.read && (p.read = !0), h.operations.length > 0 && (p.singleOps = [...h.operations]), o[c] = p;
|
|
814
|
+
}
|
|
815
|
+
i.myOs().requestLinkedDocsPermission(
|
|
816
|
+
e.onBehalfOf,
|
|
817
|
+
e.requestId,
|
|
818
|
+
e.targetSessionId,
|
|
819
|
+
o
|
|
820
|
+
);
|
|
821
|
+
};
|
|
822
|
+
e.permissionTiming === "onInit" ? t.onInit(
|
|
823
|
+
`${s}RequestPermission`,
|
|
824
|
+
r
|
|
825
|
+
) : e.permissionTiming === "onEvent" ? t.onEvent(
|
|
826
|
+
`${s}RequestPermission`,
|
|
827
|
+
e.permissionTriggerEventType ?? "Conversation/Event",
|
|
828
|
+
r
|
|
829
|
+
) : e.permissionTiming === "onDocChange" && t.onDocChange(
|
|
830
|
+
`${s}RequestPermission`,
|
|
831
|
+
e.permissionTriggerDocPath ?? "/",
|
|
832
|
+
r
|
|
833
|
+
), t.onMyOsResponse(
|
|
834
|
+
`${s}Granted`,
|
|
835
|
+
"MyOS/Linked Documents Permission Granted",
|
|
836
|
+
e.requestId,
|
|
837
|
+
(i) => {
|
|
838
|
+
e.statusPath && i.replaceValue(
|
|
839
|
+
"MarkLinkedAccessGranted",
|
|
840
|
+
e.statusPath,
|
|
841
|
+
"granted"
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
), t.onMyOsResponse(
|
|
845
|
+
`${s}Rejected`,
|
|
846
|
+
"MyOS/Linked Documents Permission Rejected",
|
|
847
|
+
e.requestId,
|
|
848
|
+
(i) => {
|
|
849
|
+
e.statusPath && i.replaceValue(
|
|
850
|
+
"MarkLinkedAccessRejected",
|
|
851
|
+
e.statusPath,
|
|
852
|
+
"rejected"
|
|
853
|
+
);
|
|
854
|
+
}
|
|
855
|
+
), t.onMyOsResponse(
|
|
856
|
+
`${s}Revoked`,
|
|
857
|
+
"MyOS/Linked Documents Permission Revoked",
|
|
858
|
+
e.requestId,
|
|
859
|
+
(i) => {
|
|
860
|
+
e.statusPath && i.replaceValue(
|
|
861
|
+
"MarkLinkedAccessRevoked",
|
|
862
|
+
e.statusPath,
|
|
863
|
+
"revoked"
|
|
864
|
+
);
|
|
865
|
+
}
|
|
866
|
+
);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
class kt {
|
|
870
|
+
constructor(e, t) {
|
|
871
|
+
this.parent = e, this.draft = t;
|
|
872
|
+
}
|
|
873
|
+
read(e) {
|
|
874
|
+
if (e === !1)
|
|
875
|
+
throw new Error(
|
|
876
|
+
"accessLinked(...).link(...).read(false) is not supported; MyOS linked-document permissions require read=true"
|
|
877
|
+
);
|
|
878
|
+
return this.draft.read = e, this;
|
|
879
|
+
}
|
|
880
|
+
operations(...e) {
|
|
881
|
+
return this.draft.operations = e.map((t) => t?.trim()).filter((t) => !!t), this;
|
|
882
|
+
}
|
|
883
|
+
done() {
|
|
884
|
+
return this.parent;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
function U(n, e) {
|
|
888
|
+
const t = n?.trim();
|
|
889
|
+
if (!t)
|
|
890
|
+
throw new Error(`${e} is required`);
|
|
891
|
+
return t;
|
|
892
|
+
}
|
|
893
|
+
function Ot(n) {
|
|
894
|
+
const e = n.replace(/[^A-Za-z0-9]+/gu, "_").replace(/^_+|_+$/gu, "").toUpperCase();
|
|
895
|
+
return e.length > 0 ? e : "AGENCY";
|
|
896
|
+
}
|
|
897
|
+
function bt(n, e) {
|
|
898
|
+
return n.map((t) => ({
|
|
899
|
+
type: "MyOS/Worker Agency Permission",
|
|
900
|
+
workerType: t,
|
|
901
|
+
permissions: {
|
|
902
|
+
read: !0,
|
|
903
|
+
...e.length > 0 ? { singleOps: [...e] } : {}
|
|
904
|
+
}
|
|
905
|
+
}));
|
|
906
|
+
}
|
|
907
|
+
class It {
|
|
908
|
+
constructor(e, t) {
|
|
909
|
+
this.parent = e, this.name = t;
|
|
910
|
+
}
|
|
911
|
+
onBehalfOfValue;
|
|
912
|
+
requestIdValue;
|
|
913
|
+
targetSessionIdValue;
|
|
914
|
+
allowedTypesValue = [];
|
|
915
|
+
allowedOperationsValue = [];
|
|
916
|
+
statusPathValue;
|
|
917
|
+
permissionTimingValue = "onInit";
|
|
918
|
+
permissionTriggerEventTypeValue;
|
|
919
|
+
permissionTriggerDocPathValue;
|
|
920
|
+
onBehalfOf(e) {
|
|
921
|
+
return this.onBehalfOfValue = U(e, "onBehalfOf"), this;
|
|
922
|
+
}
|
|
923
|
+
permissionFrom(e) {
|
|
924
|
+
return this.onBehalfOf(e), this;
|
|
925
|
+
}
|
|
926
|
+
requestId(e) {
|
|
927
|
+
return this.requestIdValue = U(e, "requestId"), this;
|
|
928
|
+
}
|
|
929
|
+
targetSessionId(e) {
|
|
930
|
+
return this.targetSessionIdValue = U(e, "targetSessionId"), this;
|
|
931
|
+
}
|
|
932
|
+
allowedTypes(...e) {
|
|
933
|
+
return this.allowedTypesValue.length = 0, this.allowedTypesValue.push(...e.map((t) => m(t))), this;
|
|
934
|
+
}
|
|
935
|
+
allowedOperations(...e) {
|
|
936
|
+
return this.allowedOperationsValue.length = 0, this.allowedOperationsValue.push(
|
|
937
|
+
...e.map((t) => t?.trim()).filter((t) => !!t)
|
|
938
|
+
), this;
|
|
939
|
+
}
|
|
940
|
+
statusPath(e) {
|
|
941
|
+
return this.statusPathValue = U(e, "statusPath"), this;
|
|
942
|
+
}
|
|
943
|
+
requestPermissionOnInit() {
|
|
944
|
+
return this.permissionTimingValue = "onInit", this.permissionTriggerEventTypeValue = void 0, this.permissionTriggerDocPathValue = void 0, this;
|
|
945
|
+
}
|
|
946
|
+
requestPermissionOnEvent(e) {
|
|
947
|
+
return this.permissionTimingValue = "onEvent", this.permissionTriggerEventTypeValue = m(e), this.permissionTriggerDocPathValue = void 0, this;
|
|
948
|
+
}
|
|
949
|
+
requestPermissionOnDocChange(e) {
|
|
950
|
+
return this.permissionTimingValue = "onDocChange", this.permissionTriggerDocPathValue = U(e, "permission path"), this.permissionTriggerEventTypeValue = void 0, this;
|
|
951
|
+
}
|
|
952
|
+
requestPermissionManually() {
|
|
953
|
+
return this.permissionTimingValue = "manual", this.permissionTriggerDocPathValue = void 0, this.permissionTriggerEventTypeValue = void 0, this;
|
|
954
|
+
}
|
|
955
|
+
done() {
|
|
956
|
+
const e = Ot(this.name);
|
|
957
|
+
if (this.allowedTypesValue.length === 0)
|
|
958
|
+
throw new Error("agency(...).allowedTypes(...) is required");
|
|
959
|
+
const t = {
|
|
960
|
+
name: this.name,
|
|
961
|
+
token: e,
|
|
962
|
+
onBehalfOf: U(this.onBehalfOfValue, "onBehalfOf"),
|
|
963
|
+
requestId: this.requestIdValue ?? `REQ_AGENCY_${e}`,
|
|
964
|
+
allowedTypes: [...new Set(this.allowedTypesValue)],
|
|
965
|
+
allowedOperations: [...new Set(this.allowedOperationsValue)],
|
|
966
|
+
...this.statusPathValue ? { statusPath: this.statusPathValue } : {},
|
|
967
|
+
permissionTiming: this.permissionTimingValue,
|
|
968
|
+
...this.permissionTriggerEventTypeValue ? { permissionTriggerEventType: this.permissionTriggerEventTypeValue } : {},
|
|
969
|
+
...this.permissionTriggerDocPathValue ? { permissionTriggerDocPath: this.permissionTriggerDocPathValue } : {},
|
|
970
|
+
permissionFrom: this.onBehalfOfValue,
|
|
971
|
+
...this.targetSessionIdValue ? { targetSessionId: this.targetSessionIdValue } : {}
|
|
972
|
+
}, s = this.parent.registerAgencyConfig(t);
|
|
973
|
+
return this.applyAutoWiring(t, s), s;
|
|
974
|
+
}
|
|
975
|
+
applyAutoWiring(e, t) {
|
|
976
|
+
e.statusPath && t.field(e.statusPath, "pending");
|
|
977
|
+
const s = `agency${e.token}`, r = (i) => {
|
|
978
|
+
const o = bt(
|
|
979
|
+
e.allowedTypes,
|
|
980
|
+
e.allowedOperations
|
|
981
|
+
);
|
|
982
|
+
i.myOs().grantWorkerAgencyPermission(
|
|
983
|
+
e.onBehalfOf,
|
|
984
|
+
e.requestId,
|
|
985
|
+
o,
|
|
986
|
+
e.targetSessionId
|
|
987
|
+
);
|
|
988
|
+
};
|
|
989
|
+
e.permissionTiming === "onInit" ? t.onInit(
|
|
990
|
+
`${s}RequestPermission`,
|
|
991
|
+
r
|
|
992
|
+
) : e.permissionTiming === "onEvent" ? t.onEvent(
|
|
993
|
+
`${s}RequestPermission`,
|
|
994
|
+
e.permissionTriggerEventType ?? "Conversation/Event",
|
|
995
|
+
r
|
|
996
|
+
) : e.permissionTiming === "onDocChange" && t.onDocChange(
|
|
997
|
+
`${s}RequestPermission`,
|
|
998
|
+
e.permissionTriggerDocPath ?? "/",
|
|
999
|
+
r
|
|
1000
|
+
), t.onMyOsResponse(
|
|
1001
|
+
`${s}Granted`,
|
|
1002
|
+
"MyOS/Worker Agency Permission Granted",
|
|
1003
|
+
e.requestId,
|
|
1004
|
+
(i) => {
|
|
1005
|
+
e.statusPath && i.replaceValue("MarkAgencyGranted", e.statusPath, "granted");
|
|
1006
|
+
}
|
|
1007
|
+
), t.onMyOsResponse(
|
|
1008
|
+
`${s}Rejected`,
|
|
1009
|
+
"MyOS/Worker Agency Permission Rejected",
|
|
1010
|
+
e.requestId,
|
|
1011
|
+
(i) => {
|
|
1012
|
+
e.statusPath && i.replaceValue(
|
|
1013
|
+
"MarkAgencyRejected",
|
|
1014
|
+
e.statusPath,
|
|
1015
|
+
"rejected"
|
|
1016
|
+
);
|
|
1017
|
+
}
|
|
1018
|
+
), t.onMyOsResponse(
|
|
1019
|
+
`${s}Revoked`,
|
|
1020
|
+
"MyOS/Worker Agency Permission Revoked",
|
|
1021
|
+
e.requestId,
|
|
1022
|
+
(i) => {
|
|
1023
|
+
e.statusPath && i.replaceValue("MarkAgencyRevoked", e.statusPath, "revoked");
|
|
1024
|
+
}
|
|
1025
|
+
);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
class Pt {
|
|
1029
|
+
bindings = {};
|
|
1030
|
+
bind(e, t) {
|
|
1031
|
+
const s = e.trim();
|
|
1032
|
+
if (s.length === 0)
|
|
1033
|
+
throw new Error("channelKey is required");
|
|
1034
|
+
return this.bindings[s] = {
|
|
1035
|
+
...t.accountId ? { accountId: t.accountId } : {},
|
|
1036
|
+
...t.timelineId ? { timelineId: t.timelineId } : {},
|
|
1037
|
+
...t.documentId ? { documentId: t.documentId } : {}
|
|
1038
|
+
}, this;
|
|
1039
|
+
}
|
|
1040
|
+
build() {
|
|
1041
|
+
return structuredClone(this.bindings);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
function _e(n, e) {
|
|
1045
|
+
const t = n.trim();
|
|
1046
|
+
if (t.length === 0)
|
|
1047
|
+
throw new Error(`${e} is required`);
|
|
1048
|
+
return t;
|
|
1049
|
+
}
|
|
1050
|
+
class qt {
|
|
1051
|
+
values = {};
|
|
1052
|
+
set(e, t) {
|
|
1053
|
+
return this.values[_e(e, "capability name")] = t, this;
|
|
1054
|
+
}
|
|
1055
|
+
participantsOrchestration(e) {
|
|
1056
|
+
return this.set("participantsOrchestration", e);
|
|
1057
|
+
}
|
|
1058
|
+
sessionInteraction(e) {
|
|
1059
|
+
return this.set("sessionInteraction", e);
|
|
1060
|
+
}
|
|
1061
|
+
workerAgency(e) {
|
|
1062
|
+
return this.set("workerAgency", e);
|
|
1063
|
+
}
|
|
1064
|
+
build() {
|
|
1065
|
+
return structuredClone(this.values);
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
class At {
|
|
1069
|
+
defaultMessageValue;
|
|
1070
|
+
perChannelMessages = {};
|
|
1071
|
+
capabilitiesValue = {};
|
|
1072
|
+
bootstrapAssignee(e) {
|
|
1073
|
+
throw _e(e, "bootstrapAssignee channelKey"), new Error(
|
|
1074
|
+
"agency start worker session options do not support bootstrapAssignee; use the agency onBehalfOf channel plus initialMessages/capabilities"
|
|
1075
|
+
);
|
|
1076
|
+
}
|
|
1077
|
+
defaultMessage(e) {
|
|
1078
|
+
return this.defaultMessageValue = e, this;
|
|
1079
|
+
}
|
|
1080
|
+
channelMessage(e, t) {
|
|
1081
|
+
const s = e.trim();
|
|
1082
|
+
if (s.length === 0)
|
|
1083
|
+
throw new Error("channelKey is required");
|
|
1084
|
+
return this.perChannelMessages[s] = t, this;
|
|
1085
|
+
}
|
|
1086
|
+
capabilities(e) {
|
|
1087
|
+
if (typeof e != "function")
|
|
1088
|
+
throw new Error("capabilities customizer is required");
|
|
1089
|
+
const t = new qt();
|
|
1090
|
+
return e(t), Object.assign(this.capabilitiesValue, t.build()), this;
|
|
1091
|
+
}
|
|
1092
|
+
build() {
|
|
1093
|
+
const e = {};
|
|
1094
|
+
return (this.defaultMessageValue !== void 0 || Object.keys(this.perChannelMessages).length > 0) && (e.initialMessages = {
|
|
1095
|
+
...this.defaultMessageValue !== void 0 ? { defaultMessage: this.defaultMessageValue } : {},
|
|
1096
|
+
...Object.keys(this.perChannelMessages).length > 0 ? { perChannel: structuredClone(this.perChannelMessages) } : {}
|
|
1097
|
+
}), Object.keys(this.capabilitiesValue).length > 0 && (e.capabilities = structuredClone(this.capabilitiesValue)), e;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
class Rt {
|
|
1101
|
+
constructor(e, t) {
|
|
1102
|
+
this.parent = e, this.path = t;
|
|
1103
|
+
}
|
|
1104
|
+
typeAlias;
|
|
1105
|
+
descriptionValue;
|
|
1106
|
+
currentValue;
|
|
1107
|
+
hasExplicitValue = !1;
|
|
1108
|
+
requiredValue;
|
|
1109
|
+
minimumValueRef;
|
|
1110
|
+
maximumValueRef;
|
|
1111
|
+
type(e) {
|
|
1112
|
+
return this.typeAlias = m(e), this;
|
|
1113
|
+
}
|
|
1114
|
+
descriptionText(e) {
|
|
1115
|
+
return this.descriptionValue = e, this;
|
|
1116
|
+
}
|
|
1117
|
+
description(e) {
|
|
1118
|
+
return this.descriptionText(e);
|
|
1119
|
+
}
|
|
1120
|
+
valueOf(e) {
|
|
1121
|
+
return this.currentValue = e, this.hasExplicitValue = !0, this;
|
|
1122
|
+
}
|
|
1123
|
+
value(e) {
|
|
1124
|
+
return this.valueOf(e);
|
|
1125
|
+
}
|
|
1126
|
+
requiredFlag(e) {
|
|
1127
|
+
return this.requiredValue = e, this;
|
|
1128
|
+
}
|
|
1129
|
+
required(e) {
|
|
1130
|
+
return this.requiredFlag(e);
|
|
1131
|
+
}
|
|
1132
|
+
minimumValue(e) {
|
|
1133
|
+
return this.minimumValueRef = e, this;
|
|
1134
|
+
}
|
|
1135
|
+
minimum(e) {
|
|
1136
|
+
return this.minimumValue(e);
|
|
1137
|
+
}
|
|
1138
|
+
maximumValue(e) {
|
|
1139
|
+
return this.maximumValueRef = e, this;
|
|
1140
|
+
}
|
|
1141
|
+
maximum(e) {
|
|
1142
|
+
return this.maximumValue(e);
|
|
1143
|
+
}
|
|
1144
|
+
done() {
|
|
1145
|
+
return this.parent.applyFieldMetadata({
|
|
1146
|
+
path: this.path,
|
|
1147
|
+
typeAlias: this.typeAlias,
|
|
1148
|
+
description: this.descriptionValue,
|
|
1149
|
+
value: this.currentValue,
|
|
1150
|
+
hasExplicitValue: this.hasExplicitValue,
|
|
1151
|
+
required: this.requiredValue,
|
|
1152
|
+
minimum: this.minimumValueRef,
|
|
1153
|
+
maximum: this.maximumValueRef
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
function Tt(n) {
|
|
1158
|
+
return { type: n };
|
|
1159
|
+
}
|
|
1160
|
+
class wt {
|
|
1161
|
+
constructor(e, t) {
|
|
1162
|
+
this.parent = e, this.key = t;
|
|
1163
|
+
}
|
|
1164
|
+
channelKey;
|
|
1165
|
+
descriptionValue;
|
|
1166
|
+
requestSchemaValue;
|
|
1167
|
+
clearRequest = !1;
|
|
1168
|
+
stepsValue;
|
|
1169
|
+
channel(e) {
|
|
1170
|
+
return this.channelKey = e.trim(), this;
|
|
1171
|
+
}
|
|
1172
|
+
descriptionText(e) {
|
|
1173
|
+
return this.descriptionValue = e, this;
|
|
1174
|
+
}
|
|
1175
|
+
description(e) {
|
|
1176
|
+
return this.descriptionText(e);
|
|
1177
|
+
}
|
|
1178
|
+
requestType(e) {
|
|
1179
|
+
return this.requestSchemaValue = Tt(m(e)), this.clearRequest = !1, this;
|
|
1180
|
+
}
|
|
1181
|
+
requestSchema(e) {
|
|
1182
|
+
return this.requestSchemaValue = structuredClone(e), this.clearRequest = !1, this;
|
|
1183
|
+
}
|
|
1184
|
+
request(e) {
|
|
1185
|
+
return this.requestSchema(e);
|
|
1186
|
+
}
|
|
1187
|
+
requestDescription(e) {
|
|
1188
|
+
const t = this.requestSchemaValue ? structuredClone(this.requestSchemaValue) : {};
|
|
1189
|
+
return t.description = e, this.requestSchemaValue = t, this.clearRequest = !1, this;
|
|
1190
|
+
}
|
|
1191
|
+
noRequest() {
|
|
1192
|
+
return this.requestSchemaValue = void 0, this.clearRequest = !0, this;
|
|
1193
|
+
}
|
|
1194
|
+
stepsList(e) {
|
|
1195
|
+
return this.stepsValue = structuredClone(e), this;
|
|
1196
|
+
}
|
|
1197
|
+
steps(e, t) {
|
|
1198
|
+
const s = t ?? this.parent.createStepsBuilder();
|
|
1199
|
+
return e(s), this.stepsValue = s.build(), this;
|
|
1200
|
+
}
|
|
1201
|
+
done() {
|
|
1202
|
+
return this.parent.applyOperationDefinition({
|
|
1203
|
+
key: this.key,
|
|
1204
|
+
channelKey: this.channelKey,
|
|
1205
|
+
description: this.descriptionValue,
|
|
1206
|
+
request: this.requestSchemaValue,
|
|
1207
|
+
clearRequest: this.clearRequest,
|
|
1208
|
+
steps: this.stepsValue
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
function Et(n) {
|
|
1213
|
+
return structuredClone(n);
|
|
1214
|
+
}
|
|
1215
|
+
function Oe(n) {
|
|
1216
|
+
return Et(n);
|
|
1217
|
+
}
|
|
1218
|
+
class x {
|
|
1219
|
+
readValue;
|
|
1220
|
+
shareValue;
|
|
1221
|
+
allOpsValue;
|
|
1222
|
+
singleOpsValue = [];
|
|
1223
|
+
singleOpsSet = !1;
|
|
1224
|
+
static create() {
|
|
1225
|
+
return new x();
|
|
1226
|
+
}
|
|
1227
|
+
read(e) {
|
|
1228
|
+
return this.readValue = e, this;
|
|
1229
|
+
}
|
|
1230
|
+
share(e) {
|
|
1231
|
+
return this.shareValue = e, this;
|
|
1232
|
+
}
|
|
1233
|
+
allOps(e) {
|
|
1234
|
+
return this.allOpsValue = e, this;
|
|
1235
|
+
}
|
|
1236
|
+
singleOps(...e) {
|
|
1237
|
+
return this.singleOpsSet = !0, this.singleOpsValue = e.filter((t) => typeof t == "string").map((t) => t.trim()).filter((t) => t.length > 0), this;
|
|
1238
|
+
}
|
|
1239
|
+
build() {
|
|
1240
|
+
const e = {};
|
|
1241
|
+
return this.readValue !== void 0 && (e.read = this.readValue), this.shareValue !== void 0 && (e.share = this.shareValue), this.allOpsValue !== void 0 && (e.allOps = this.allOpsValue), this.singleOpsSet && (e.singleOps = [...this.singleOpsValue]), e;
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
function Vt(n) {
|
|
1245
|
+
return n instanceof x ? n.build() : n == null ? {} : typeof n == "object" ? Oe(n) : n;
|
|
1246
|
+
}
|
|
1247
|
+
function Dt(n) {
|
|
1248
|
+
const e = {};
|
|
1249
|
+
for (const [t, s] of Object.entries(n))
|
|
1250
|
+
e[t] = typeof s == "object" && s !== null ? Oe(s) : s;
|
|
1251
|
+
return e;
|
|
1252
|
+
}
|
|
1253
|
+
function B(n) {
|
|
1254
|
+
return n.onBehalfOf ?? n.permissionFrom ?? "ownerChannel";
|
|
1255
|
+
}
|
|
1256
|
+
function M(n) {
|
|
1257
|
+
return n.onBehalfOf ?? n.permissionFrom ?? "ownerChannel";
|
|
1258
|
+
}
|
|
1259
|
+
class Mt {
|
|
1260
|
+
constructor(e, t) {
|
|
1261
|
+
this.parent = e, this.config = t;
|
|
1262
|
+
}
|
|
1263
|
+
defaultPermissions() {
|
|
1264
|
+
const e = {};
|
|
1265
|
+
return this.config.read && (e.read = !0), this.config.operations.length > 0 && (e.singleOps = [...this.config.operations]), e;
|
|
1266
|
+
}
|
|
1267
|
+
emitRequestPermission(e, t, s) {
|
|
1268
|
+
return this.parent.emitType(
|
|
1269
|
+
e,
|
|
1270
|
+
"MyOS/Single Document Permission Grant Requested",
|
|
1271
|
+
(r) => {
|
|
1272
|
+
r.put("onBehalfOf", B(this.config)), r.put("requestId", this.config.requestId), r.put("targetSessionId", t), r.put("permissions", Vt(s));
|
|
1273
|
+
}
|
|
1274
|
+
);
|
|
1275
|
+
}
|
|
1276
|
+
requestPermission(e) {
|
|
1277
|
+
if (typeof e == "string")
|
|
1278
|
+
return this.emitRequestPermission(
|
|
1279
|
+
e,
|
|
1280
|
+
this.config.targetSessionId,
|
|
1281
|
+
this.defaultPermissions()
|
|
1282
|
+
);
|
|
1283
|
+
const t = e ?? this.defaultPermissions();
|
|
1284
|
+
return this.parent.myOs().requestSingleDocPermission(
|
|
1285
|
+
B(this.config),
|
|
1286
|
+
this.config.requestId,
|
|
1287
|
+
this.config.targetSessionId,
|
|
1288
|
+
t
|
|
1289
|
+
);
|
|
1290
|
+
}
|
|
1291
|
+
requestPermissionForTarget(e, t = { read: !0 }) {
|
|
1292
|
+
return this.parent.myOs().requestSingleDocPermission(
|
|
1293
|
+
B(this.config),
|
|
1294
|
+
this.config.requestId,
|
|
1295
|
+
e,
|
|
1296
|
+
t
|
|
1297
|
+
);
|
|
1298
|
+
}
|
|
1299
|
+
revokePermission() {
|
|
1300
|
+
return this.parent.myOs().revokeSingleDocPermission(
|
|
1301
|
+
B(this.config),
|
|
1302
|
+
this.config.requestId,
|
|
1303
|
+
this.config.targetSessionId
|
|
1304
|
+
);
|
|
1305
|
+
}
|
|
1306
|
+
revokePermissionForTarget(e) {
|
|
1307
|
+
return this.parent.myOs().revokeSingleDocPermission(
|
|
1308
|
+
B(this.config),
|
|
1309
|
+
this.config.requestId,
|
|
1310
|
+
e
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
subscribe(e = "SubscribeToSession") {
|
|
1314
|
+
const t = this.config.subscriptionEvents;
|
|
1315
|
+
return this.parent.emitType(
|
|
1316
|
+
e,
|
|
1317
|
+
"MyOS/Subscribe to Session Requested",
|
|
1318
|
+
(s) => {
|
|
1319
|
+
const r = {
|
|
1320
|
+
id: this.config.subscriptionId
|
|
1321
|
+
};
|
|
1322
|
+
t.length > 0 && (r.events = t.map((i) => ({
|
|
1323
|
+
type: m(i)
|
|
1324
|
+
}))), s.put("targetSessionId", this.config.targetSessionId), s.put("subscription", r);
|
|
1325
|
+
}
|
|
1326
|
+
);
|
|
1327
|
+
}
|
|
1328
|
+
call(e, t) {
|
|
1329
|
+
return this.parent.myOs().callOperation(
|
|
1330
|
+
B(this.config),
|
|
1331
|
+
this.config.targetSessionId,
|
|
1332
|
+
e,
|
|
1333
|
+
t,
|
|
1334
|
+
this.config.requestId
|
|
1335
|
+
);
|
|
1336
|
+
}
|
|
1337
|
+
callOnTarget(e, t, s) {
|
|
1338
|
+
return this.parent.myOs().callOperation(
|
|
1339
|
+
B(this.config),
|
|
1340
|
+
e,
|
|
1341
|
+
t,
|
|
1342
|
+
s,
|
|
1343
|
+
this.config.requestId
|
|
1344
|
+
);
|
|
1345
|
+
}
|
|
1346
|
+
callExpr(e, t, s) {
|
|
1347
|
+
return this.callOnTarget(
|
|
1348
|
+
{ $eval: e },
|
|
1349
|
+
t,
|
|
1350
|
+
s
|
|
1351
|
+
);
|
|
1352
|
+
}
|
|
1353
|
+
subscribeForTarget(e, t, ...s) {
|
|
1354
|
+
const r = s.length > 0 ? s : ["Conversation/Event"];
|
|
1355
|
+
return this.parent.myOs().subscribeToSession(
|
|
1356
|
+
e,
|
|
1357
|
+
t,
|
|
1358
|
+
...r
|
|
1359
|
+
);
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
class $t {
|
|
1363
|
+
constructor(e, t) {
|
|
1364
|
+
this.parent = e, this.config = t;
|
|
1365
|
+
}
|
|
1366
|
+
defaultLinks() {
|
|
1367
|
+
const e = {};
|
|
1368
|
+
for (const [t, s] of Object.entries(this.config.links)) {
|
|
1369
|
+
const r = {};
|
|
1370
|
+
s.read && (r.read = !0), s.operations.length > 0 && (r.singleOps = [...s.operations]), e[t] = r;
|
|
1371
|
+
}
|
|
1372
|
+
return e;
|
|
1373
|
+
}
|
|
1374
|
+
emitRequestLinkedPermission(e, t, s) {
|
|
1375
|
+
return this.parent.emitType(
|
|
1376
|
+
e,
|
|
1377
|
+
"MyOS/Linked Documents Permission Grant Requested",
|
|
1378
|
+
(r) => {
|
|
1379
|
+
r.put("onBehalfOf", M(this.config)), r.put("requestId", this.config.requestId), r.put("targetSessionId", t), r.put("links", Dt(s));
|
|
1380
|
+
}
|
|
1381
|
+
);
|
|
1382
|
+
}
|
|
1383
|
+
requestPermission(e) {
|
|
1384
|
+
return typeof e == "string" ? this.emitRequestLinkedPermission(
|
|
1385
|
+
e,
|
|
1386
|
+
this.config.targetSessionId,
|
|
1387
|
+
this.defaultLinks()
|
|
1388
|
+
) : e === void 0 ? this.parent.myOs().requestLinkedDocsPermission(
|
|
1389
|
+
M(this.config),
|
|
1390
|
+
this.config.requestId,
|
|
1391
|
+
this.config.targetSessionId,
|
|
1392
|
+
this.defaultLinks()
|
|
1393
|
+
) : this.parent.myOs().requestLinkedDocsPermission(
|
|
1394
|
+
M(this.config),
|
|
1395
|
+
this.config.requestId,
|
|
1396
|
+
this.config.targetSessionId,
|
|
1397
|
+
e
|
|
1398
|
+
);
|
|
1399
|
+
}
|
|
1400
|
+
requestPermissionForTarget(e, t) {
|
|
1401
|
+
return this.parent.myOs().requestLinkedDocsPermission(
|
|
1402
|
+
M(this.config),
|
|
1403
|
+
this.config.requestId,
|
|
1404
|
+
e,
|
|
1405
|
+
t
|
|
1406
|
+
);
|
|
1407
|
+
}
|
|
1408
|
+
revokePermission() {
|
|
1409
|
+
return this.parent.myOs().revokeLinkedDocsPermission(
|
|
1410
|
+
M(this.config),
|
|
1411
|
+
this.config.requestId,
|
|
1412
|
+
this.config.targetSessionId
|
|
1413
|
+
);
|
|
1414
|
+
}
|
|
1415
|
+
revokePermissionForTarget(e) {
|
|
1416
|
+
return this.parent.myOs().revokeLinkedDocsPermission(
|
|
1417
|
+
M(this.config),
|
|
1418
|
+
this.config.requestId,
|
|
1419
|
+
e
|
|
1420
|
+
);
|
|
1421
|
+
}
|
|
1422
|
+
subscribe(e = "SubscribeToSession") {
|
|
1423
|
+
const t = this.config.subscriptionId ?? `SUB_LINKED_${this.config.token}`, s = (this.config.subscriptionEvents?.length ?? 0) > 0 ? this.config.subscriptionEvents : [];
|
|
1424
|
+
return this.parent.emitType(
|
|
1425
|
+
e,
|
|
1426
|
+
"MyOS/Subscribe to Session Requested",
|
|
1427
|
+
(r) => {
|
|
1428
|
+
const i = {
|
|
1429
|
+
id: t
|
|
1430
|
+
};
|
|
1431
|
+
s.length > 0 && (i.events = s.map((o) => ({
|
|
1432
|
+
type: m(o)
|
|
1433
|
+
}))), r.put("targetSessionId", this.config.targetSessionId), r.put("subscription", i);
|
|
1434
|
+
}
|
|
1435
|
+
);
|
|
1436
|
+
}
|
|
1437
|
+
call(e, t) {
|
|
1438
|
+
return this.parent.myOs().callOperation(
|
|
1439
|
+
M(this.config),
|
|
1440
|
+
this.config.targetSessionId,
|
|
1441
|
+
e,
|
|
1442
|
+
t,
|
|
1443
|
+
this.config.requestId
|
|
1444
|
+
);
|
|
1445
|
+
}
|
|
1446
|
+
callOnTarget(e, t, s) {
|
|
1447
|
+
return this.parent.myOs().callOperation(
|
|
1448
|
+
M(this.config),
|
|
1449
|
+
e,
|
|
1450
|
+
t,
|
|
1451
|
+
s,
|
|
1452
|
+
this.config.requestId
|
|
1453
|
+
);
|
|
1454
|
+
}
|
|
1455
|
+
callExpr(e, t, s) {
|
|
1456
|
+
return this.callOnTarget(
|
|
1457
|
+
{ $eval: e },
|
|
1458
|
+
t,
|
|
1459
|
+
s
|
|
1460
|
+
);
|
|
1461
|
+
}
|
|
1462
|
+
subscribeForTarget(e, t, ...s) {
|
|
1463
|
+
const r = s.length > 0 ? s : ["Conversation/Event"];
|
|
1464
|
+
return this.parent.myOs().subscribeToSession(
|
|
1465
|
+
e,
|
|
1466
|
+
t,
|
|
1467
|
+
...r
|
|
1468
|
+
);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
function Q(n) {
|
|
1472
|
+
return n.onBehalfOf ?? n.permissionFrom ?? "ownerChannel";
|
|
1473
|
+
}
|
|
1474
|
+
function xt(n, e) {
|
|
1475
|
+
return n.map((t) => ({
|
|
1476
|
+
type: "MyOS/Worker Agency Permission",
|
|
1477
|
+
workerType: t,
|
|
1478
|
+
permissions: {
|
|
1479
|
+
read: !0,
|
|
1480
|
+
...e.length > 0 ? { singleOps: [...e] } : {}
|
|
1481
|
+
}
|
|
1482
|
+
}));
|
|
1483
|
+
}
|
|
1484
|
+
function Bt(n) {
|
|
1485
|
+
return Array.isArray(n.allowedWorkerAgencyPermissions) ? n.allowedWorkerAgencyPermissions : typeof n.workerType == "string" || n.type === "MyOS/Worker Agency Permission" ? [n] : n;
|
|
1486
|
+
}
|
|
1487
|
+
class jt {
|
|
1488
|
+
constructor(e, t) {
|
|
1489
|
+
this.parent = e, this.config = t;
|
|
1490
|
+
}
|
|
1491
|
+
defaultPermissions() {
|
|
1492
|
+
return xt(
|
|
1493
|
+
this.config.allowedTypes,
|
|
1494
|
+
this.config.allowedOperations
|
|
1495
|
+
);
|
|
1496
|
+
}
|
|
1497
|
+
requestPermission(e, t) {
|
|
1498
|
+
if (typeof e == "string")
|
|
1499
|
+
return this.parent.emitType(
|
|
1500
|
+
e,
|
|
1501
|
+
"MyOS/Worker Agency Permission Grant Requested",
|
|
1502
|
+
(i) => {
|
|
1503
|
+
i.put("onBehalfOf", Q(this.config)), i.put("requestId", this.config.requestId), i.put(
|
|
1504
|
+
"allowedWorkerAgencyPermissions",
|
|
1505
|
+
this.defaultPermissions()
|
|
1506
|
+
);
|
|
1507
|
+
}
|
|
1508
|
+
);
|
|
1509
|
+
const s = e === void 0 ? this.defaultPermissions() : Bt(e), r = t;
|
|
1510
|
+
return this.parent.myOs().grantWorkerAgencyPermission(
|
|
1511
|
+
Q(this.config),
|
|
1512
|
+
this.config.requestId,
|
|
1513
|
+
s,
|
|
1514
|
+
r ?? this.config.targetSessionId
|
|
1515
|
+
);
|
|
1516
|
+
}
|
|
1517
|
+
requestPermissionForTarget(e, t) {
|
|
1518
|
+
return this.requestPermission(t, e);
|
|
1519
|
+
}
|
|
1520
|
+
revokePermission(e) {
|
|
1521
|
+
return this.parent.myOs().revokeWorkerAgencyPermission(
|
|
1522
|
+
Q(this.config),
|
|
1523
|
+
this.config.requestId,
|
|
1524
|
+
e ?? this.config.targetSessionId
|
|
1525
|
+
);
|
|
1526
|
+
}
|
|
1527
|
+
revokePermissionForTarget(e) {
|
|
1528
|
+
return this.revokePermission(e);
|
|
1529
|
+
}
|
|
1530
|
+
call(e, t) {
|
|
1531
|
+
return this.parent.myOs().callOperation(
|
|
1532
|
+
Q(this.config),
|
|
1533
|
+
this.requireTargetSessionId(),
|
|
1534
|
+
e,
|
|
1535
|
+
t,
|
|
1536
|
+
this.config.requestId
|
|
1537
|
+
);
|
|
1538
|
+
}
|
|
1539
|
+
callOnTarget(e, t, s) {
|
|
1540
|
+
return this.parent.myOs().callOperation(
|
|
1541
|
+
Q(this.config),
|
|
1542
|
+
e,
|
|
1543
|
+
t,
|
|
1544
|
+
s,
|
|
1545
|
+
this.config.requestId
|
|
1546
|
+
);
|
|
1547
|
+
}
|
|
1548
|
+
subscribe(e, ...t) {
|
|
1549
|
+
return this.parent.myOs().subscribeToSession(
|
|
1550
|
+
this.requireTargetSessionId(),
|
|
1551
|
+
e,
|
|
1552
|
+
...t
|
|
1553
|
+
);
|
|
1554
|
+
}
|
|
1555
|
+
subscribeForTarget(e, t, ...s) {
|
|
1556
|
+
return this.parent.myOs().subscribeToSession(e, t, ...s);
|
|
1557
|
+
}
|
|
1558
|
+
startSession(e, t) {
|
|
1559
|
+
throw new Error(
|
|
1560
|
+
"viaAgency(...).startSession(...) requires channel bindings; use startSessionWith(...)"
|
|
1561
|
+
);
|
|
1562
|
+
}
|
|
1563
|
+
startSessionWith(e, t, s, r) {
|
|
1564
|
+
const i = new Pt();
|
|
1565
|
+
s?.(i);
|
|
1566
|
+
const o = new At();
|
|
1567
|
+
return r?.(o), this.parent.myOs().startWorkerSession(
|
|
1568
|
+
e,
|
|
1569
|
+
t,
|
|
1570
|
+
i.build(),
|
|
1571
|
+
o.build()
|
|
1572
|
+
);
|
|
1573
|
+
}
|
|
1574
|
+
startWorkerSession(e, t) {
|
|
1575
|
+
return this.startSession(e, t);
|
|
1576
|
+
}
|
|
1577
|
+
startWorkerSessionWith(e, t, s, r) {
|
|
1578
|
+
return this.startSessionWith(
|
|
1579
|
+
e,
|
|
1580
|
+
t,
|
|
1581
|
+
s,
|
|
1582
|
+
r
|
|
1583
|
+
);
|
|
1584
|
+
}
|
|
1585
|
+
requireTargetSessionId() {
|
|
1586
|
+
if (!this.config.targetSessionId)
|
|
1587
|
+
throw new Error(
|
|
1588
|
+
`agency('${this.config.name}') requires targetSessionId for this step helper`
|
|
1589
|
+
);
|
|
1590
|
+
return this.config.targetSessionId;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
function S(n, e) {
|
|
1594
|
+
if (typeof n != "string")
|
|
1595
|
+
throw new Error(e);
|
|
1596
|
+
const t = n.trim();
|
|
1597
|
+
if (t.length === 0)
|
|
1598
|
+
throw new Error(e);
|
|
1599
|
+
return t;
|
|
1600
|
+
}
|
|
1601
|
+
function fe(n, e = !1) {
|
|
1602
|
+
return n == null ? e ? x.create().build() : null : n instanceof x ? n.build() : typeof n == "object" ? structuredClone(n) : n;
|
|
1603
|
+
}
|
|
1604
|
+
function Ie(n, e = !1) {
|
|
1605
|
+
return n == null ? e ? x.create().build() : null : n instanceof x ? n.build() : typeof n == "object" ? Oe(n) : n;
|
|
1606
|
+
}
|
|
1607
|
+
function j(n, e, t) {
|
|
1608
|
+
n.put("onBehalfOf", S(e, "onBehalfOf is required")), ge(n, t);
|
|
1609
|
+
}
|
|
1610
|
+
function ge(n, e) {
|
|
1611
|
+
e !== void 0 && n.put("targetSessionId", fe(e));
|
|
1612
|
+
}
|
|
1613
|
+
function Pe(n, e) {
|
|
1614
|
+
const t = {
|
|
1615
|
+
id: S(n, "subscriptionId is required")
|
|
1616
|
+
};
|
|
1617
|
+
return e && e.length > 0 && (t.events = e), t;
|
|
1618
|
+
}
|
|
1619
|
+
function Nt(n) {
|
|
1620
|
+
if (typeof n == "string" || typeof n == "function")
|
|
1621
|
+
return { type: m(n) };
|
|
1622
|
+
if (typeof n == "object" && n !== null && !Array.isArray(n)) {
|
|
1623
|
+
const e = {
|
|
1624
|
+
...n
|
|
1625
|
+
}, t = e.type;
|
|
1626
|
+
return t === void 0 ? e : {
|
|
1627
|
+
...e,
|
|
1628
|
+
type: typeof t == "string" ? t : m(t)
|
|
1629
|
+
};
|
|
1630
|
+
}
|
|
1631
|
+
return { type: m(n) };
|
|
1632
|
+
}
|
|
1633
|
+
class Wt {
|
|
1634
|
+
constructor(e, t = "myOsAdminChannel") {
|
|
1635
|
+
this.parent = e, this.adminChannelKey = t;
|
|
1636
|
+
}
|
|
1637
|
+
requestSingleDocPermission(e, t, s, r) {
|
|
1638
|
+
return this.parent.emitType(
|
|
1639
|
+
"RequestSingleDocumentPermission",
|
|
1640
|
+
"MyOS/Single Document Permission Grant Requested",
|
|
1641
|
+
(i) => {
|
|
1642
|
+
j(i, e, s), i.put(
|
|
1643
|
+
"requestId",
|
|
1644
|
+
S(t, "requestId is required")
|
|
1645
|
+
), i.put("permissions", Ie(r, !0));
|
|
1646
|
+
}
|
|
1647
|
+
);
|
|
1648
|
+
}
|
|
1649
|
+
requestLinkedDocsPermission(e, t, s, r) {
|
|
1650
|
+
return this.parent.emitType(
|
|
1651
|
+
"RequestLinkedDocumentsPermission",
|
|
1652
|
+
"MyOS/Linked Documents Permission Grant Requested",
|
|
1653
|
+
(i) => {
|
|
1654
|
+
j(i, e, s), i.put(
|
|
1655
|
+
"requestId",
|
|
1656
|
+
S(t, "requestId is required")
|
|
1657
|
+
);
|
|
1658
|
+
const o = {};
|
|
1659
|
+
for (const [c, h] of Object.entries(r)) {
|
|
1660
|
+
const p = c.trim();
|
|
1661
|
+
p.length !== 0 && (o[p] = Ie(h, !0));
|
|
1662
|
+
}
|
|
1663
|
+
i.put("links", o);
|
|
1664
|
+
}
|
|
1665
|
+
);
|
|
1666
|
+
}
|
|
1667
|
+
revokeSingleDocPermission(e, t, s) {
|
|
1668
|
+
return this.parent.emitType(
|
|
1669
|
+
"RevokeSingleDocumentPermission",
|
|
1670
|
+
"MyOS/Single Document Permission Revoke Requested",
|
|
1671
|
+
(r) => {
|
|
1672
|
+
j(r, e, s), r.put(
|
|
1673
|
+
"requestId",
|
|
1674
|
+
S(t, "requestId is required")
|
|
1675
|
+
);
|
|
1676
|
+
}
|
|
1677
|
+
);
|
|
1678
|
+
}
|
|
1679
|
+
revokeLinkedDocsPermission(e, t, s) {
|
|
1680
|
+
return this.parent.emitType(
|
|
1681
|
+
"RevokeLinkedDocumentsPermission",
|
|
1682
|
+
"MyOS/Linked Documents Permission Revoke Requested",
|
|
1683
|
+
(r) => {
|
|
1684
|
+
j(r, e, s), r.put(
|
|
1685
|
+
"requestId",
|
|
1686
|
+
S(t, "requestId is required")
|
|
1687
|
+
);
|
|
1688
|
+
}
|
|
1689
|
+
);
|
|
1690
|
+
}
|
|
1691
|
+
addParticipant(e, t) {
|
|
1692
|
+
return this.parent.emitType(
|
|
1693
|
+
"AddParticipant",
|
|
1694
|
+
"MyOS/Adding Participant Requested",
|
|
1695
|
+
(s) => {
|
|
1696
|
+
if (s.put(
|
|
1697
|
+
"channelName",
|
|
1698
|
+
S(e, "channelName is required")
|
|
1699
|
+
), typeof t == "string") {
|
|
1700
|
+
s.put("participantBinding", {
|
|
1701
|
+
email: S(
|
|
1702
|
+
t,
|
|
1703
|
+
"email binding is required"
|
|
1704
|
+
)
|
|
1705
|
+
});
|
|
1706
|
+
return;
|
|
1707
|
+
}
|
|
1708
|
+
s.put(
|
|
1709
|
+
"participantBinding",
|
|
1710
|
+
fe(t)
|
|
1711
|
+
);
|
|
1712
|
+
}
|
|
1713
|
+
);
|
|
1714
|
+
}
|
|
1715
|
+
removeParticipant(e) {
|
|
1716
|
+
return this.parent.emitType(
|
|
1717
|
+
"RemoveParticipant",
|
|
1718
|
+
"MyOS/Removing Participant Requested",
|
|
1719
|
+
(t) => {
|
|
1720
|
+
t.put(
|
|
1721
|
+
"channelName",
|
|
1722
|
+
S(e, "channelName is required")
|
|
1723
|
+
);
|
|
1724
|
+
}
|
|
1725
|
+
);
|
|
1726
|
+
}
|
|
1727
|
+
callOperation(e, t, s, r, i) {
|
|
1728
|
+
return this.parent.emitType(
|
|
1729
|
+
"CallOperation",
|
|
1730
|
+
"MyOS/Call Operation Requested",
|
|
1731
|
+
(o) => {
|
|
1732
|
+
j(o, e, t), o.put(
|
|
1733
|
+
"operation",
|
|
1734
|
+
S(s, "operation is required")
|
|
1735
|
+
), r !== void 0 && o.put("request", r), i !== void 0 && o.put(
|
|
1736
|
+
"requestId",
|
|
1737
|
+
S(i, "requestId is required")
|
|
1738
|
+
);
|
|
1739
|
+
}
|
|
1740
|
+
);
|
|
1741
|
+
}
|
|
1742
|
+
subscribeToSession(e, t, ...s) {
|
|
1743
|
+
return this.parent.emitType(
|
|
1744
|
+
"SubscribeToSession",
|
|
1745
|
+
"MyOS/Subscribe to Session Requested",
|
|
1746
|
+
(r) => {
|
|
1747
|
+
ge(r, e), r.put(
|
|
1748
|
+
"subscription",
|
|
1749
|
+
Pe(
|
|
1750
|
+
t,
|
|
1751
|
+
s.map((i) => ({ type: m(i) }))
|
|
1752
|
+
)
|
|
1753
|
+
);
|
|
1754
|
+
}
|
|
1755
|
+
);
|
|
1756
|
+
}
|
|
1757
|
+
subscribeToSessionWithMatchers(e, t, s) {
|
|
1758
|
+
return this.parent.emitType(
|
|
1759
|
+
"SubscribeToSession",
|
|
1760
|
+
"MyOS/Subscribe to Session Requested",
|
|
1761
|
+
(r) => {
|
|
1762
|
+
ge(r, e), r.put(
|
|
1763
|
+
"subscription",
|
|
1764
|
+
Pe(
|
|
1765
|
+
t,
|
|
1766
|
+
s.map(
|
|
1767
|
+
(i) => Nt(i)
|
|
1768
|
+
)
|
|
1769
|
+
)
|
|
1770
|
+
);
|
|
1771
|
+
}
|
|
1772
|
+
);
|
|
1773
|
+
}
|
|
1774
|
+
startWorkerSession(e, t, s, r) {
|
|
1775
|
+
if (!s || Object.keys(s).length === 0)
|
|
1776
|
+
throw new Error(
|
|
1777
|
+
"MyOS/Start Worker Session Requested requires non-empty channelBindings"
|
|
1778
|
+
);
|
|
1779
|
+
return this.parent.emitType(
|
|
1780
|
+
"StartWorkerSession",
|
|
1781
|
+
"MyOS/Start Worker Session Requested",
|
|
1782
|
+
(i) => {
|
|
1783
|
+
if (i.put(
|
|
1784
|
+
"onBehalfOf",
|
|
1785
|
+
S(e, "onBehalfOf is required")
|
|
1786
|
+
), i.put("document", structuredClone(t)), i.put("channelBindings", structuredClone(s)), r && Object.keys(r).length > 0) {
|
|
1787
|
+
const o = structuredClone(r);
|
|
1788
|
+
if (Object.prototype.hasOwnProperty.call(
|
|
1789
|
+
o,
|
|
1790
|
+
"bootstrapAssignee"
|
|
1791
|
+
))
|
|
1792
|
+
throw new Error(
|
|
1793
|
+
"MyOS/Start Worker Session Requested does not support bootstrapAssignee; use onBehalfOf plus initialMessages/capabilities"
|
|
1794
|
+
);
|
|
1795
|
+
const c = o.initialMessages, h = o.capabilities;
|
|
1796
|
+
c !== void 0 && i.put("initialMessages", c), h !== void 0 && i.put("capabilities", h);
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
);
|
|
1800
|
+
}
|
|
1801
|
+
grantWorkerAgencyPermission(e, t, s, r) {
|
|
1802
|
+
return this.parent.emitType(
|
|
1803
|
+
"GrantWorkerAgencyPermission",
|
|
1804
|
+
"MyOS/Worker Agency Permission Grant Requested",
|
|
1805
|
+
(i) => {
|
|
1806
|
+
j(i, e, r), i.put(
|
|
1807
|
+
"requestId",
|
|
1808
|
+
S(t, "requestId is required")
|
|
1809
|
+
), i.put(
|
|
1810
|
+
"allowedWorkerAgencyPermissions",
|
|
1811
|
+
fe(s)
|
|
1812
|
+
);
|
|
1813
|
+
}
|
|
1814
|
+
);
|
|
1815
|
+
}
|
|
1816
|
+
revokeWorkerAgencyPermission(e, t, s) {
|
|
1817
|
+
return this.parent.emitType(
|
|
1818
|
+
"RevokeWorkerAgencyPermission",
|
|
1819
|
+
"MyOS/Worker Agency Permission Revoke Requested",
|
|
1820
|
+
(r) => {
|
|
1821
|
+
j(r, e, s), r.put(
|
|
1822
|
+
"requestId",
|
|
1823
|
+
S(t, "requestId is required")
|
|
1824
|
+
);
|
|
1825
|
+
}
|
|
1826
|
+
);
|
|
1827
|
+
}
|
|
1828
|
+
bootstrapDocument(e, t, s, r, i) {
|
|
1829
|
+
return this.parent.bootstrapDocument(
|
|
1830
|
+
e,
|
|
1831
|
+
t,
|
|
1832
|
+
s,
|
|
1833
|
+
r,
|
|
1834
|
+
(o) => {
|
|
1835
|
+
o.put("bootstrapAssignee", this.adminChannelKey), i?.(o);
|
|
1836
|
+
}
|
|
1837
|
+
);
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
class Lt {
|
|
1841
|
+
entries = [];
|
|
1842
|
+
replaceValue(e, t) {
|
|
1843
|
+
return this.entries.push({ op: "replace", path: e, val: t }), this;
|
|
1844
|
+
}
|
|
1845
|
+
replaceExpression(e, t) {
|
|
1846
|
+
return this.entries.push({
|
|
1847
|
+
op: "replace",
|
|
1848
|
+
path: e,
|
|
1849
|
+
val: A(t)
|
|
1850
|
+
}), this;
|
|
1851
|
+
}
|
|
1852
|
+
addValue(e, t) {
|
|
1853
|
+
return this.entries.push({ op: "add", path: e, val: t }), this;
|
|
1854
|
+
}
|
|
1855
|
+
remove(e) {
|
|
1856
|
+
return this.entries.push({ op: "remove", path: e }), this;
|
|
1857
|
+
}
|
|
1858
|
+
build() {
|
|
1859
|
+
return structuredClone(this.entries);
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
class qe {
|
|
1863
|
+
payload = {};
|
|
1864
|
+
put(e, t) {
|
|
1865
|
+
return this.payload[e] = t, this;
|
|
1866
|
+
}
|
|
1867
|
+
putExpression(e, t) {
|
|
1868
|
+
return this.payload[e] = A(t), this;
|
|
1869
|
+
}
|
|
1870
|
+
build() {
|
|
1871
|
+
return structuredClone(this.payload);
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
function Ut(n) {
|
|
1875
|
+
const e = n.trim();
|
|
1876
|
+
if (e.length === 0)
|
|
1877
|
+
throw new Error("step name is required");
|
|
1878
|
+
return e;
|
|
1879
|
+
}
|
|
1880
|
+
function F(n, e, t) {
|
|
1881
|
+
return { name: Ut(n), type: e, ...t };
|
|
1882
|
+
}
|
|
1883
|
+
function Ft(n, e) {
|
|
1884
|
+
return {
|
|
1885
|
+
type: m(n),
|
|
1886
|
+
...e
|
|
1887
|
+
};
|
|
1888
|
+
}
|
|
1889
|
+
function _t(n) {
|
|
1890
|
+
if (!n.processorName())
|
|
1891
|
+
throw new Error("payment payload requires processor");
|
|
1892
|
+
}
|
|
1893
|
+
function ye(n) {
|
|
1894
|
+
return structuredClone(n);
|
|
1895
|
+
}
|
|
1896
|
+
function Ae(n, e) {
|
|
1897
|
+
if (typeof n != "string")
|
|
1898
|
+
throw new Error(e);
|
|
1899
|
+
const t = n.trim();
|
|
1900
|
+
if (t.length === 0)
|
|
1901
|
+
throw new Error(e);
|
|
1902
|
+
return t;
|
|
1903
|
+
}
|
|
1904
|
+
class Kt {
|
|
1905
|
+
constructor(e) {
|
|
1906
|
+
this.parent = e;
|
|
1907
|
+
}
|
|
1908
|
+
done() {
|
|
1909
|
+
return this.parent;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
class $ extends Kt {
|
|
1913
|
+
constructor(e, t) {
|
|
1914
|
+
super(e), this.putValue = t;
|
|
1915
|
+
}
|
|
1916
|
+
put(e, t) {
|
|
1917
|
+
return this.putValue(e, t), this;
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
class Gt {
|
|
1921
|
+
payload = {};
|
|
1922
|
+
processorValue;
|
|
1923
|
+
processor(e) {
|
|
1924
|
+
return this.processorValue = e.trim(), this.payload.processor = this.processorValue, this;
|
|
1925
|
+
}
|
|
1926
|
+
payer(e) {
|
|
1927
|
+
return this.payload.payer = e, this;
|
|
1928
|
+
}
|
|
1929
|
+
payee(e) {
|
|
1930
|
+
return this.payload.payee = e, this;
|
|
1931
|
+
}
|
|
1932
|
+
from(e) {
|
|
1933
|
+
return this.payload.from = e, this;
|
|
1934
|
+
}
|
|
1935
|
+
to(e) {
|
|
1936
|
+
return this.payload.to = e, this;
|
|
1937
|
+
}
|
|
1938
|
+
currency(e) {
|
|
1939
|
+
return this.payload.currency = e, this;
|
|
1940
|
+
}
|
|
1941
|
+
amountMinor(e) {
|
|
1942
|
+
return this.payload.amount = e, this;
|
|
1943
|
+
}
|
|
1944
|
+
amountMinorExpression(e) {
|
|
1945
|
+
return this.payload.amount = A(e), this;
|
|
1946
|
+
}
|
|
1947
|
+
attachPayNote(e) {
|
|
1948
|
+
return this.payload.attachedPayNote = ye(e), this;
|
|
1949
|
+
}
|
|
1950
|
+
reason(e) {
|
|
1951
|
+
return this.payload.reason = e, this;
|
|
1952
|
+
}
|
|
1953
|
+
putCustom(e, t) {
|
|
1954
|
+
if (e === "processor")
|
|
1955
|
+
throw new Error("use processor(...) to set processor");
|
|
1956
|
+
return this.payload[e] = t, this;
|
|
1957
|
+
}
|
|
1958
|
+
putCustomExpression(e, t) {
|
|
1959
|
+
return this.putCustom(e, A(t));
|
|
1960
|
+
}
|
|
1961
|
+
viaAch() {
|
|
1962
|
+
return new $(this, (e, t) => {
|
|
1963
|
+
(e === "routingNumber" || e === "accountNumber" || e === "accountType" || e === "network" || e === "companyEntryDescription") && (this.payload[e] = t);
|
|
1964
|
+
});
|
|
1965
|
+
}
|
|
1966
|
+
viaSepa() {
|
|
1967
|
+
return new $(this, (e, t) => {
|
|
1968
|
+
(e === "ibanFrom" || e === "ibanTo" || e === "bicTo" || e === "remittanceInformation") && (this.payload[e] = t);
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1971
|
+
viaWire() {
|
|
1972
|
+
return new $(this, (e, t) => {
|
|
1973
|
+
(e === "bankSwift" || e === "bankName" || e === "accountNumber" || e === "beneficiaryName" || e === "beneficiaryAddress") && (this.payload[e] = t);
|
|
1974
|
+
});
|
|
1975
|
+
}
|
|
1976
|
+
viaCard() {
|
|
1977
|
+
return new $(this, (e, t) => {
|
|
1978
|
+
(e === "cardOnFileRef" || e === "merchantDescriptor") && (this.payload[e] = t);
|
|
1979
|
+
});
|
|
1980
|
+
}
|
|
1981
|
+
viaTokenizedCard() {
|
|
1982
|
+
return new $(this, (e, t) => {
|
|
1983
|
+
(e === "networkToken" || e === "tokenProvider" || e === "cryptogram") && (this.payload[e] = t);
|
|
1984
|
+
});
|
|
1985
|
+
}
|
|
1986
|
+
viaCreditLine() {
|
|
1987
|
+
return new $(this, (e, t) => {
|
|
1988
|
+
(e === "creditLineId" || e === "merchantAccountId" || e === "cardholderAccountId") && (this.payload[e] = t);
|
|
1989
|
+
});
|
|
1990
|
+
}
|
|
1991
|
+
viaLedger() {
|
|
1992
|
+
return new $(this, (e, t) => {
|
|
1993
|
+
(e === "ledgerAccountFrom" || e === "ledgerAccountTo" || e === "memo") && (this.payload[e] = t);
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
viaCrypto() {
|
|
1997
|
+
return new $(this, (e, t) => {
|
|
1998
|
+
(e === "asset" || e === "chain" || e === "fromWalletRef" || e === "toAddress" || e === "txPolicy") && (this.payload[e] = t);
|
|
1999
|
+
});
|
|
2000
|
+
}
|
|
2001
|
+
build() {
|
|
2002
|
+
return ye(this.payload);
|
|
2003
|
+
}
|
|
2004
|
+
processorName() {
|
|
2005
|
+
return this.processorValue;
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
class Jt {
|
|
2009
|
+
constructor(e) {
|
|
2010
|
+
this.parent = e;
|
|
2011
|
+
}
|
|
2012
|
+
lock() {
|
|
2013
|
+
return this.parent.triggerEvent("RequestCaptureLock", {
|
|
2014
|
+
type: "PayNote/Card Transaction Capture Lock Requested"
|
|
2015
|
+
});
|
|
2016
|
+
}
|
|
2017
|
+
unlock() {
|
|
2018
|
+
return this.parent.triggerEvent("RequestCaptureUnlock", {
|
|
2019
|
+
type: "PayNote/Card Transaction Capture Unlock Requested"
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
markLocked() {
|
|
2023
|
+
return this.parent.triggerEvent("CaptureLocked", {
|
|
2024
|
+
type: "PayNote/Card Transaction Capture Locked"
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2027
|
+
markUnlocked() {
|
|
2028
|
+
return this.parent.triggerEvent("CaptureUnlocked", {
|
|
2029
|
+
type: "PayNote/Card Transaction Capture Unlocked"
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
requestNow() {
|
|
2033
|
+
return this.parent.triggerEvent("RequestCapture", {
|
|
2034
|
+
type: "PayNote/Capture Funds Requested",
|
|
2035
|
+
amount: A("document('/amount/total')")
|
|
2036
|
+
});
|
|
2037
|
+
}
|
|
2038
|
+
requestPartial(e) {
|
|
2039
|
+
return this.parent.triggerEvent("RequestCapture", {
|
|
2040
|
+
type: "PayNote/Capture Funds Requested",
|
|
2041
|
+
amount: A(e)
|
|
2042
|
+
});
|
|
2043
|
+
}
|
|
2044
|
+
releaseFull() {
|
|
2045
|
+
return this.parent.triggerEvent("RequestRelease", {
|
|
2046
|
+
type: "PayNote/Reservation Release Requested",
|
|
2047
|
+
amount: A("document('/amount/total')")
|
|
2048
|
+
});
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
class Re {
|
|
2052
|
+
constructor(e, t, s) {
|
|
2053
|
+
this.parent = e, this.integration = t, this.stepName = s;
|
|
2054
|
+
}
|
|
2055
|
+
instructions = [];
|
|
2056
|
+
expectedResponses = [];
|
|
2057
|
+
taskName;
|
|
2058
|
+
task(e) {
|
|
2059
|
+
return this.taskName = e.trim(), this;
|
|
2060
|
+
}
|
|
2061
|
+
instruction(e) {
|
|
2062
|
+
const t = e.trim();
|
|
2063
|
+
return t.length > 0 && this.instructions.push(t), this;
|
|
2064
|
+
}
|
|
2065
|
+
expects(e) {
|
|
2066
|
+
return this.expectedResponses.push(m(e)), this;
|
|
2067
|
+
}
|
|
2068
|
+
done() {
|
|
2069
|
+
const e = this.taskName ? this.integration.tasks[this.taskName] : void 0, t = [
|
|
2070
|
+
...e?.instructions ?? [],
|
|
2071
|
+
...this.instructions
|
|
2072
|
+
];
|
|
2073
|
+
if (t.length === 0)
|
|
2074
|
+
throw new Error(
|
|
2075
|
+
`askAI('${this.integration.name}') requires instructions`
|
|
2076
|
+
);
|
|
2077
|
+
const s = [
|
|
2078
|
+
...e?.expectedResponses ?? [],
|
|
2079
|
+
...this.expectedResponses
|
|
2080
|
+
];
|
|
2081
|
+
return this.parent.emitType(
|
|
2082
|
+
this.stepName,
|
|
2083
|
+
"MyOS/Call Operation Requested",
|
|
2084
|
+
(r) => {
|
|
2085
|
+
r.put("onBehalfOf", this.integration.permissionFrom), r.put("targetSessionId", this.integration.sessionId), r.put("operation", "provideInstructions"), r.put("request", {
|
|
2086
|
+
requester: this.integration.requesterId,
|
|
2087
|
+
instructions: t.join(`
|
|
2088
|
+
`),
|
|
2089
|
+
context: A(
|
|
2090
|
+
`document('${this.integration.contextPath}')`
|
|
2091
|
+
),
|
|
2092
|
+
...this.taskName ? { taskName: this.taskName } : {},
|
|
2093
|
+
...s.length > 0 ? {
|
|
2094
|
+
expectedResponses: s.map((i) => ({
|
|
2095
|
+
type: i
|
|
2096
|
+
}))
|
|
2097
|
+
} : {}
|
|
2098
|
+
});
|
|
2099
|
+
}
|
|
2100
|
+
);
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
class zt {
|
|
2104
|
+
constructor(e, t) {
|
|
2105
|
+
this.parent = e, this.integration = t;
|
|
2106
|
+
}
|
|
2107
|
+
requestPermission(e = "RequestPermission") {
|
|
2108
|
+
return this.parent.emitType(
|
|
2109
|
+
e,
|
|
2110
|
+
"MyOS/Single Document Permission Grant Requested",
|
|
2111
|
+
(t) => {
|
|
2112
|
+
t.put("onBehalfOf", this.integration.permissionFrom), t.put("requestId", this.integration.requestId), t.put("targetSessionId", this.integration.sessionId), t.put(
|
|
2113
|
+
"permissions",
|
|
2114
|
+
x.create().read(!0).singleOps("provideInstructions").build()
|
|
2115
|
+
);
|
|
2116
|
+
}
|
|
2117
|
+
);
|
|
2118
|
+
}
|
|
2119
|
+
subscribe(e = "Subscribe") {
|
|
2120
|
+
return this.parent.emitType(
|
|
2121
|
+
e,
|
|
2122
|
+
"MyOS/Subscribe to Session Requested",
|
|
2123
|
+
(t) => {
|
|
2124
|
+
t.put("onBehalfOf", this.integration.permissionFrom), t.put("targetSessionId", this.integration.sessionId), t.put("subscription", {
|
|
2125
|
+
id: this.integration.subscriptionId
|
|
2126
|
+
});
|
|
2127
|
+
}
|
|
2128
|
+
);
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
class Qt {
|
|
2132
|
+
steps = [];
|
|
2133
|
+
aiIntegrations;
|
|
2134
|
+
accessConfigs;
|
|
2135
|
+
linkedAccessConfigs;
|
|
2136
|
+
agencyConfigs;
|
|
2137
|
+
constructor(e = {}) {
|
|
2138
|
+
this.aiIntegrations = structuredClone(e.aiIntegrations ?? {}), this.accessConfigs = structuredClone(e.accessConfigs ?? {}), this.linkedAccessConfigs = structuredClone(
|
|
2139
|
+
e.linkedAccessConfigs ?? {}
|
|
2140
|
+
), this.agencyConfigs = structuredClone(e.agencyConfigs ?? {});
|
|
2141
|
+
}
|
|
2142
|
+
jsRaw(e, t) {
|
|
2143
|
+
return this.steps.push(F(e, "Conversation/JavaScript Code", { code: t })), this;
|
|
2144
|
+
}
|
|
2145
|
+
updateDocument(e, t) {
|
|
2146
|
+
const s = new Lt();
|
|
2147
|
+
return t(s), this.steps.push(
|
|
2148
|
+
F(e, "Conversation/Update Document", {
|
|
2149
|
+
changeset: s.build()
|
|
2150
|
+
})
|
|
2151
|
+
), this;
|
|
2152
|
+
}
|
|
2153
|
+
updateDocumentFromExpression(e, t) {
|
|
2154
|
+
return this.steps.push(
|
|
2155
|
+
F(e, "Conversation/Update Document", {
|
|
2156
|
+
changeset: A(t)
|
|
2157
|
+
})
|
|
2158
|
+
), this;
|
|
2159
|
+
}
|
|
2160
|
+
triggerEvent(e, t) {
|
|
2161
|
+
return this.steps.push(F(e, "Conversation/Trigger Event", { event: t })), this;
|
|
2162
|
+
}
|
|
2163
|
+
emit(e, t) {
|
|
2164
|
+
return this.triggerEvent(e, t);
|
|
2165
|
+
}
|
|
2166
|
+
emitType(e, t, s) {
|
|
2167
|
+
const r = new qe();
|
|
2168
|
+
return s?.(r), this.steps.push(
|
|
2169
|
+
F(e, "Conversation/Trigger Event", {
|
|
2170
|
+
event: Ft(t, r.build())
|
|
2171
|
+
})
|
|
2172
|
+
), this;
|
|
2173
|
+
}
|
|
2174
|
+
namedEvent(e, t, s) {
|
|
2175
|
+
const r = new qe();
|
|
2176
|
+
s?.(r);
|
|
2177
|
+
const i = r.build();
|
|
2178
|
+
return this.steps.push(
|
|
2179
|
+
F(e, "Conversation/Trigger Event", {
|
|
2180
|
+
event: {
|
|
2181
|
+
...i,
|
|
2182
|
+
type: Y.NamedEvent,
|
|
2183
|
+
name: t
|
|
2184
|
+
}
|
|
2185
|
+
})
|
|
2186
|
+
), this;
|
|
2187
|
+
}
|
|
2188
|
+
replaceValue(e, t, s) {
|
|
2189
|
+
return this.updateDocument(
|
|
2190
|
+
e,
|
|
2191
|
+
(r) => r.replaceValue(t, s)
|
|
2192
|
+
);
|
|
2193
|
+
}
|
|
2194
|
+
replaceExpression(e, t, s) {
|
|
2195
|
+
return this.updateDocument(
|
|
2196
|
+
e,
|
|
2197
|
+
(r) => r.replaceExpression(t, s)
|
|
2198
|
+
);
|
|
2199
|
+
}
|
|
2200
|
+
triggerPayment(e, t, s) {
|
|
2201
|
+
return s === void 0 ? this.emitPaymentRequest(
|
|
2202
|
+
"TriggerPayment",
|
|
2203
|
+
e,
|
|
2204
|
+
t
|
|
2205
|
+
) : this.emitPaymentRequest(
|
|
2206
|
+
e,
|
|
2207
|
+
t,
|
|
2208
|
+
s
|
|
2209
|
+
);
|
|
2210
|
+
}
|
|
2211
|
+
requestBackwardPayment(e, t) {
|
|
2212
|
+
return Ue(
|
|
2213
|
+
"PayNote/Backward Payment Requested",
|
|
2214
|
+
"steps.requestBackwardPayment(...)"
|
|
2215
|
+
), typeof e == "function" ? this.emitPaymentRequest(
|
|
2216
|
+
"RequestBackwardPayment",
|
|
2217
|
+
"PayNote/Backward Payment Requested",
|
|
2218
|
+
e
|
|
2219
|
+
) : this.emitPaymentRequest(
|
|
2220
|
+
e,
|
|
2221
|
+
"PayNote/Backward Payment Requested",
|
|
2222
|
+
t
|
|
2223
|
+
);
|
|
2224
|
+
}
|
|
2225
|
+
bootstrapDocument(e, t, s, r, i) {
|
|
2226
|
+
return this.emitType(
|
|
2227
|
+
e,
|
|
2228
|
+
"Conversation/Document Bootstrap Requested",
|
|
2229
|
+
(o) => {
|
|
2230
|
+
o.put("document", ye(t)), o.put("channelBindings", structuredClone(s)), o.put(
|
|
2231
|
+
"onBehalfOf",
|
|
2232
|
+
Ae(r, "onBehalfOf is required")
|
|
2233
|
+
), i?.(o);
|
|
2234
|
+
}
|
|
2235
|
+
);
|
|
2236
|
+
}
|
|
2237
|
+
bootstrapDocumentExpr(e, t, s, r, i) {
|
|
2238
|
+
return this.emitType(
|
|
2239
|
+
e,
|
|
2240
|
+
"Conversation/Document Bootstrap Requested",
|
|
2241
|
+
(o) => {
|
|
2242
|
+
o.putExpression("document", t), o.put("channelBindings", structuredClone(s)), o.put(
|
|
2243
|
+
"onBehalfOf",
|
|
2244
|
+
Ae(r, "onBehalfOf is required")
|
|
2245
|
+
), i?.(o);
|
|
2246
|
+
}
|
|
2247
|
+
);
|
|
2248
|
+
}
|
|
2249
|
+
capture() {
|
|
2250
|
+
return new Jt(this);
|
|
2251
|
+
}
|
|
2252
|
+
myOs(e = "myOsAdminChannel") {
|
|
2253
|
+
return new Wt(this, e);
|
|
2254
|
+
}
|
|
2255
|
+
askAI(e, t, s) {
|
|
2256
|
+
if (typeof t == "function") {
|
|
2257
|
+
const i = new Re(
|
|
2258
|
+
this,
|
|
2259
|
+
this.requireAiIntegration(e),
|
|
2260
|
+
"AskAI"
|
|
2261
|
+
);
|
|
2262
|
+
return t(i), i.done(), this;
|
|
2263
|
+
}
|
|
2264
|
+
const r = new Re(
|
|
2265
|
+
this,
|
|
2266
|
+
this.requireAiIntegration(e),
|
|
2267
|
+
t
|
|
2268
|
+
);
|
|
2269
|
+
return s(r), r.done(), this;
|
|
2270
|
+
}
|
|
2271
|
+
ai(e) {
|
|
2272
|
+
return new zt(this, this.requireAiIntegration(e));
|
|
2273
|
+
}
|
|
2274
|
+
access(e) {
|
|
2275
|
+
return new Mt(this, this.requireAccessConfig(e));
|
|
2276
|
+
}
|
|
2277
|
+
accessLinked(e) {
|
|
2278
|
+
return new $t(
|
|
2279
|
+
this,
|
|
2280
|
+
this.requireLinkedAccessConfig(e)
|
|
2281
|
+
);
|
|
2282
|
+
}
|
|
2283
|
+
viaAgency(e) {
|
|
2284
|
+
return new jt(this, this.requireAgencyConfig(e));
|
|
2285
|
+
}
|
|
2286
|
+
raw(e) {
|
|
2287
|
+
return this.steps.push(structuredClone(e)), this;
|
|
2288
|
+
}
|
|
2289
|
+
build() {
|
|
2290
|
+
return structuredClone(this.steps);
|
|
2291
|
+
}
|
|
2292
|
+
emitPaymentRequest(e, t, s) {
|
|
2293
|
+
const r = new Gt();
|
|
2294
|
+
return s(r), _t(r), this.emitType(e, t, (i) => {
|
|
2295
|
+
for (const [o, c] of Object.entries(r.build()))
|
|
2296
|
+
i.put(o, c);
|
|
2297
|
+
});
|
|
2298
|
+
}
|
|
2299
|
+
requireAiIntegration(e) {
|
|
2300
|
+
const t = e.trim(), s = this.aiIntegrations[t];
|
|
2301
|
+
if (!s)
|
|
2302
|
+
throw new Error(`Unknown AI integration: ${e}`);
|
|
2303
|
+
return s;
|
|
2304
|
+
}
|
|
2305
|
+
requireAccessConfig(e) {
|
|
2306
|
+
const t = e.trim(), s = this.accessConfigs[t];
|
|
2307
|
+
if (!s)
|
|
2308
|
+
throw new Error(`Unknown access: ${e}`);
|
|
2309
|
+
return s;
|
|
2310
|
+
}
|
|
2311
|
+
requireLinkedAccessConfig(e) {
|
|
2312
|
+
const t = e.trim(), s = this.linkedAccessConfigs[t];
|
|
2313
|
+
if (!s)
|
|
2314
|
+
throw new Error(`Unknown linked access: ${e}`);
|
|
2315
|
+
return s;
|
|
2316
|
+
}
|
|
2317
|
+
requireAgencyConfig(e) {
|
|
2318
|
+
const t = e.trim(), s = this.agencyConfigs[t];
|
|
2319
|
+
if (!s)
|
|
2320
|
+
throw new Error(`Unknown agency: ${e}`);
|
|
2321
|
+
return s;
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
function P(n) {
|
|
2325
|
+
return typeof n == "object" && n !== null && !Array.isArray(n);
|
|
2326
|
+
}
|
|
2327
|
+
function C(n) {
|
|
2328
|
+
return structuredClone(n);
|
|
2329
|
+
}
|
|
2330
|
+
function f(n, e) {
|
|
2331
|
+
const t = n.trim();
|
|
2332
|
+
if (t.length === 0)
|
|
2333
|
+
throw new Error(`${e} is required`);
|
|
2334
|
+
return t;
|
|
2335
|
+
}
|
|
2336
|
+
function Yt(n) {
|
|
2337
|
+
n.jsRaw("EmitEvents", "return { events: event.message.request };");
|
|
2338
|
+
}
|
|
2339
|
+
function Ke(n) {
|
|
2340
|
+
return n.replace(/[^A-Za-z0-9]+/gu, "_").replace(/^_+|_+$/gu, "").toUpperCase();
|
|
2341
|
+
}
|
|
2342
|
+
function Zt(n) {
|
|
2343
|
+
return n.endsWith("Channel") ? n.replace(/Channel$/u, "Update") : `${n}Update`;
|
|
2344
|
+
}
|
|
2345
|
+
function Ht(n) {
|
|
2346
|
+
return P(n);
|
|
2347
|
+
}
|
|
2348
|
+
function Xt(n) {
|
|
2349
|
+
if (!Ht(n))
|
|
2350
|
+
return {
|
|
2351
|
+
eventType: m(n),
|
|
2352
|
+
matcher: {}
|
|
2353
|
+
};
|
|
2354
|
+
const e = structuredClone(n), t = e.type;
|
|
2355
|
+
return delete e.type, {
|
|
2356
|
+
eventType: t === void 0 ? "Conversation/Response" : m(t),
|
|
2357
|
+
matcher: e
|
|
2358
|
+
};
|
|
2359
|
+
}
|
|
2360
|
+
function en(n) {
|
|
2361
|
+
return `${n}OnCallResponseEnvelope`;
|
|
2362
|
+
}
|
|
2363
|
+
function tn(n) {
|
|
2364
|
+
return `Emit${Ke(n)}OnCallResponseItems`;
|
|
2365
|
+
}
|
|
2366
|
+
function nn(n, e) {
|
|
2367
|
+
const t = structuredClone(n);
|
|
2368
|
+
t.requestId = e;
|
|
2369
|
+
const s = P(
|
|
2370
|
+
t.inResponseTo
|
|
2371
|
+
) ? structuredClone(t.inResponseTo) : {};
|
|
2372
|
+
return s.requestId = e, t.inResponseTo = s, t;
|
|
2373
|
+
}
|
|
2374
|
+
function sn() {
|
|
2375
|
+
return `const responses = Array.isArray(event.events) ? event.events : [];
|
|
2376
|
+
return {
|
|
2377
|
+
events: responses.filter(
|
|
2378
|
+
(response) => response && typeof response === 'object' && !Array.isArray(response),
|
|
2379
|
+
),
|
|
2380
|
+
};`;
|
|
2381
|
+
}
|
|
2382
|
+
class u {
|
|
2383
|
+
state;
|
|
2384
|
+
aiIntegrations = /* @__PURE__ */ new Map();
|
|
2385
|
+
accessConfigs = /* @__PURE__ */ new Map();
|
|
2386
|
+
linkedAccessConfigs = /* @__PURE__ */ new Map();
|
|
2387
|
+
agencyConfigs = /* @__PURE__ */ new Map();
|
|
2388
|
+
callResponseEnvelopeWorkflows = /* @__PURE__ */ new Map();
|
|
2389
|
+
constructor(e) {
|
|
2390
|
+
this.state = new ut(e);
|
|
2391
|
+
}
|
|
2392
|
+
static doc() {
|
|
2393
|
+
return new u();
|
|
2394
|
+
}
|
|
2395
|
+
static edit(e) {
|
|
2396
|
+
return new u(u.documentToJson(e));
|
|
2397
|
+
}
|
|
2398
|
+
static from(e) {
|
|
2399
|
+
return new u(u.documentToJson(e));
|
|
2400
|
+
}
|
|
2401
|
+
static expr(e) {
|
|
2402
|
+
return A(e);
|
|
2403
|
+
}
|
|
2404
|
+
static documentToJson(e) {
|
|
2405
|
+
return e instanceof N ? ae(e) : C(e);
|
|
2406
|
+
}
|
|
2407
|
+
name(e) {
|
|
2408
|
+
return this.state.setName(e), this;
|
|
2409
|
+
}
|
|
2410
|
+
description(e) {
|
|
2411
|
+
return this.state.setDescription(e), this;
|
|
2412
|
+
}
|
|
2413
|
+
type(e) {
|
|
2414
|
+
return this.state.setType(m(e)), this;
|
|
2415
|
+
}
|
|
2416
|
+
field(e, t) {
|
|
2417
|
+
return arguments.length === 1 ? new Rt(this, e) : (this.state.setValue(e, t), this);
|
|
2418
|
+
}
|
|
2419
|
+
replace(e, t) {
|
|
2420
|
+
return this.state.setValue(e, t), this;
|
|
2421
|
+
}
|
|
2422
|
+
remove(e) {
|
|
2423
|
+
return this.state.removeValue(e), this;
|
|
2424
|
+
}
|
|
2425
|
+
section(e, t, s) {
|
|
2426
|
+
return this.state.section(e, t, s), this;
|
|
2427
|
+
}
|
|
2428
|
+
endSection() {
|
|
2429
|
+
return this.state.endSection(), this;
|
|
2430
|
+
}
|
|
2431
|
+
channel(e, t) {
|
|
2432
|
+
const s = f(e, "channel key"), r = t ? { ...C(t), type: t.type ?? "Core/Channel" } : { type: "Core/Channel" };
|
|
2433
|
+
return this.state.setContract(s, r), this;
|
|
2434
|
+
}
|
|
2435
|
+
channels(...e) {
|
|
2436
|
+
for (const t of e)
|
|
2437
|
+
this.channel(t);
|
|
2438
|
+
return this;
|
|
2439
|
+
}
|
|
2440
|
+
compositeChannel(e, ...t) {
|
|
2441
|
+
return this.state.setContract(f(e, "composite channel key"), {
|
|
2442
|
+
type: "Conversation/Composite Timeline Channel",
|
|
2443
|
+
channels: t.map(
|
|
2444
|
+
(s) => f(s, "channel key")
|
|
2445
|
+
)
|
|
2446
|
+
}), this;
|
|
2447
|
+
}
|
|
2448
|
+
contract(e, t) {
|
|
2449
|
+
return this.state.setContract(
|
|
2450
|
+
f(e, "contract key"),
|
|
2451
|
+
C(t)
|
|
2452
|
+
), this;
|
|
2453
|
+
}
|
|
2454
|
+
contracts(e) {
|
|
2455
|
+
for (const [t, s] of Object.entries(e))
|
|
2456
|
+
this.contract(t, s);
|
|
2457
|
+
return this;
|
|
2458
|
+
}
|
|
2459
|
+
operation(e, t, s, r, i) {
|
|
2460
|
+
if (t === void 0)
|
|
2461
|
+
return new wt(
|
|
2462
|
+
this,
|
|
2463
|
+
f(e, "operation key")
|
|
2464
|
+
);
|
|
2465
|
+
if (s === void 0) {
|
|
2466
|
+
const p = typeof r == "function" ? r : i;
|
|
2467
|
+
return this.applyOperationDefinition({
|
|
2468
|
+
key: e,
|
|
2469
|
+
channelKey: t,
|
|
2470
|
+
clearRequest: !1,
|
|
2471
|
+
steps: p ? this.buildSteps(p) : void 0
|
|
2472
|
+
});
|
|
2473
|
+
}
|
|
2474
|
+
if (typeof s == "string") {
|
|
2475
|
+
if (typeof r == "string")
|
|
2476
|
+
return this.applyOperationDefinition({
|
|
2477
|
+
key: e,
|
|
2478
|
+
channelKey: t,
|
|
2479
|
+
description: r,
|
|
2480
|
+
request: { type: s },
|
|
2481
|
+
clearRequest: !1,
|
|
2482
|
+
steps: i ? this.buildSteps(i) : void 0
|
|
2483
|
+
});
|
|
2484
|
+
const p = s, g = typeof r == "function" ? r : i;
|
|
2485
|
+
return this.applyOperationDefinition({
|
|
2486
|
+
key: e,
|
|
2487
|
+
channelKey: t,
|
|
2488
|
+
description: p,
|
|
2489
|
+
clearRequest: !1,
|
|
2490
|
+
steps: g ? this.buildSteps(g) : void 0
|
|
2491
|
+
});
|
|
2492
|
+
}
|
|
2493
|
+
const o = s, c = typeof r == "string" ? r : void 0, h = typeof r == "function" ? r : i;
|
|
2494
|
+
return this.applyOperationDefinition({
|
|
2495
|
+
key: e,
|
|
2496
|
+
channelKey: t,
|
|
2497
|
+
description: c,
|
|
2498
|
+
request: { type: m(o) },
|
|
2499
|
+
clearRequest: !1,
|
|
2500
|
+
steps: h ? this.buildSteps(h) : void 0
|
|
2501
|
+
});
|
|
2502
|
+
}
|
|
2503
|
+
requestDescription(e, t) {
|
|
2504
|
+
const s = this.state.getContract(e);
|
|
2505
|
+
if (!s)
|
|
2506
|
+
return this;
|
|
2507
|
+
const r = P(s.request) ? C(s.request) : {};
|
|
2508
|
+
return r.description = t, s.request = r, this.state.setContract(e, s), this;
|
|
2509
|
+
}
|
|
2510
|
+
onInit(e, t) {
|
|
2511
|
+
return this.ensureInitLifecycleChannel(), this.state.setContract(f(e, "workflow key"), {
|
|
2512
|
+
type: "Conversation/Sequential Workflow",
|
|
2513
|
+
channel: "initLifecycleChannel",
|
|
2514
|
+
steps: this.buildSteps(t)
|
|
2515
|
+
}), this;
|
|
2516
|
+
}
|
|
2517
|
+
onEvent(e, t, s) {
|
|
2518
|
+
return this.ensureTriggeredEventChannel(), this.state.setContract(f(e, "workflow key"), {
|
|
2519
|
+
type: "Conversation/Sequential Workflow",
|
|
2520
|
+
channel: "triggeredEventChannel",
|
|
2521
|
+
event: { type: m(t) },
|
|
2522
|
+
steps: this.buildSteps(s)
|
|
2523
|
+
}), this;
|
|
2524
|
+
}
|
|
2525
|
+
onNamedEvent(e, t, s) {
|
|
2526
|
+
return this.onTriggeredWithMatcher(
|
|
2527
|
+
e,
|
|
2528
|
+
Y.NamedEvent,
|
|
2529
|
+
{ name: t },
|
|
2530
|
+
s
|
|
2531
|
+
);
|
|
2532
|
+
}
|
|
2533
|
+
onChannelEvent(e, t, s, r) {
|
|
2534
|
+
const i = f(t, "channel key");
|
|
2535
|
+
return this.state.setContract(f(e, "workflow key"), {
|
|
2536
|
+
type: "Conversation/Sequential Workflow",
|
|
2537
|
+
channel: i,
|
|
2538
|
+
event: this.resolveChannelEventMatcher(i, s),
|
|
2539
|
+
steps: this.buildSteps(r)
|
|
2540
|
+
}), this;
|
|
2541
|
+
}
|
|
2542
|
+
onDocChange(e, t, s) {
|
|
2543
|
+
const r = f(e, "workflow key"), i = `${r}DocUpdateChannel`;
|
|
2544
|
+
return this.state.setContract(i, {
|
|
2545
|
+
type: "Core/Document Update Channel",
|
|
2546
|
+
path: t
|
|
2547
|
+
}), this.state.setContract(r, {
|
|
2548
|
+
type: "Conversation/Sequential Workflow",
|
|
2549
|
+
channel: i,
|
|
2550
|
+
event: { type: "Core/Document Update" },
|
|
2551
|
+
steps: this.buildSteps(s)
|
|
2552
|
+
}), this;
|
|
2553
|
+
}
|
|
2554
|
+
workflow(e, t, s, r) {
|
|
2555
|
+
return this.state.setContract(f(e, "workflow key"), {
|
|
2556
|
+
type: "Conversation/Sequential Workflow",
|
|
2557
|
+
channel: f(t, "channel key"),
|
|
2558
|
+
...r ? { event: C(r) } : {},
|
|
2559
|
+
steps: this.buildSteps(s)
|
|
2560
|
+
}), this;
|
|
2561
|
+
}
|
|
2562
|
+
onTriggeredWithId(e, t, s, r, i) {
|
|
2563
|
+
return s === "requestId" ? this.onTriggeredWithMatcher(
|
|
2564
|
+
e,
|
|
2565
|
+
t,
|
|
2566
|
+
{
|
|
2567
|
+
requestId: r,
|
|
2568
|
+
inResponseTo: { requestId: r }
|
|
2569
|
+
},
|
|
2570
|
+
i
|
|
2571
|
+
) : this.onTriggeredWithMatcher(
|
|
2572
|
+
e,
|
|
2573
|
+
t,
|
|
2574
|
+
{ subscriptionId: r },
|
|
2575
|
+
i
|
|
2576
|
+
);
|
|
2577
|
+
}
|
|
2578
|
+
onTriggeredWithMatcher(e, t, s, r) {
|
|
2579
|
+
return this.ensureTriggeredEventChannel(), this.state.setContract(f(e, "workflow key"), {
|
|
2580
|
+
type: "Conversation/Sequential Workflow",
|
|
2581
|
+
channel: "triggeredEventChannel",
|
|
2582
|
+
event: {
|
|
2583
|
+
type: m(t),
|
|
2584
|
+
...C(s)
|
|
2585
|
+
},
|
|
2586
|
+
steps: this.buildSteps(r)
|
|
2587
|
+
}), this;
|
|
2588
|
+
}
|
|
2589
|
+
onMyOsResponse(e, t, s, r) {
|
|
2590
|
+
if (typeof s == "function")
|
|
2591
|
+
return this.onTriggeredWithMatcher(
|
|
2592
|
+
e,
|
|
2593
|
+
t,
|
|
2594
|
+
{},
|
|
2595
|
+
s
|
|
2596
|
+
);
|
|
2597
|
+
const i = r;
|
|
2598
|
+
return typeof s != "string" ? this.onTriggeredWithMatcher(
|
|
2599
|
+
e,
|
|
2600
|
+
t,
|
|
2601
|
+
s,
|
|
2602
|
+
i
|
|
2603
|
+
) : this.onTriggeredWithMatcher(
|
|
2604
|
+
e,
|
|
2605
|
+
t,
|
|
2606
|
+
{
|
|
2607
|
+
inResponseTo: {
|
|
2608
|
+
requestId: s
|
|
2609
|
+
}
|
|
2610
|
+
},
|
|
2611
|
+
i
|
|
2612
|
+
);
|
|
2613
|
+
}
|
|
2614
|
+
onSubscriptionUpdate(e, t, s, r) {
|
|
2615
|
+
const i = {
|
|
2616
|
+
subscriptionId: f(t, "subscription id")
|
|
2617
|
+
};
|
|
2618
|
+
return r === void 0 ? this.onTriggeredWithMatcher(
|
|
2619
|
+
e,
|
|
2620
|
+
"MyOS/Subscription Update",
|
|
2621
|
+
i,
|
|
2622
|
+
s
|
|
2623
|
+
) : this.onTriggeredWithMatcher(
|
|
2624
|
+
e,
|
|
2625
|
+
"MyOS/Subscription Update",
|
|
2626
|
+
{
|
|
2627
|
+
...i,
|
|
2628
|
+
update: { type: m(s) }
|
|
2629
|
+
},
|
|
2630
|
+
r
|
|
2631
|
+
);
|
|
2632
|
+
}
|
|
2633
|
+
ai(e) {
|
|
2634
|
+
return this.myOsAdmin(), new gt(this, e);
|
|
2635
|
+
}
|
|
2636
|
+
access(e) {
|
|
2637
|
+
return this.myOsAdmin(), new Ct(
|
|
2638
|
+
this,
|
|
2639
|
+
f(e, "access name")
|
|
2640
|
+
);
|
|
2641
|
+
}
|
|
2642
|
+
accessLinked(e) {
|
|
2643
|
+
return this.myOsAdmin(), new St(
|
|
2644
|
+
this,
|
|
2645
|
+
f(e, "linked access name")
|
|
2646
|
+
);
|
|
2647
|
+
}
|
|
2648
|
+
agency(e) {
|
|
2649
|
+
return this.myOsAdmin(), new It(
|
|
2650
|
+
this,
|
|
2651
|
+
f(e, "agency name")
|
|
2652
|
+
);
|
|
2653
|
+
}
|
|
2654
|
+
onAIResponse(e, t, s, r) {
|
|
2655
|
+
const i = this.requireAiIntegration(e);
|
|
2656
|
+
return r === void 0 ? this.onAIResponse(
|
|
2657
|
+
e,
|
|
2658
|
+
t,
|
|
2659
|
+
"Conversation/Response",
|
|
2660
|
+
s
|
|
2661
|
+
) : this.onAIResponseWithMatcher(
|
|
2662
|
+
i,
|
|
2663
|
+
t,
|
|
2664
|
+
m(s),
|
|
2665
|
+
void 0,
|
|
2666
|
+
void 0,
|
|
2667
|
+
r
|
|
2668
|
+
);
|
|
2669
|
+
}
|
|
2670
|
+
onAIResponseForTask(e, t, s, r, i) {
|
|
2671
|
+
const o = this.requireAiIntegration(e);
|
|
2672
|
+
if (i === void 0) {
|
|
2673
|
+
const c = s;
|
|
2674
|
+
return this.onAIResponseWithMatcher(
|
|
2675
|
+
o,
|
|
2676
|
+
t,
|
|
2677
|
+
"Conversation/Response",
|
|
2678
|
+
c,
|
|
2679
|
+
void 0,
|
|
2680
|
+
r
|
|
2681
|
+
);
|
|
2682
|
+
}
|
|
2683
|
+
return this.onAIResponseWithMatcher(
|
|
2684
|
+
o,
|
|
2685
|
+
t,
|
|
2686
|
+
m(s),
|
|
2687
|
+
r,
|
|
2688
|
+
void 0,
|
|
2689
|
+
i
|
|
2690
|
+
);
|
|
2691
|
+
}
|
|
2692
|
+
onAINamedResponse(e, t, s, r, i) {
|
|
2693
|
+
const o = this.requireAiIntegration(e);
|
|
2694
|
+
return i === void 0 ? this.onAIResponseWithMatcher(
|
|
2695
|
+
o,
|
|
2696
|
+
t,
|
|
2697
|
+
Y.NamedEvent,
|
|
2698
|
+
void 0,
|
|
2699
|
+
s,
|
|
2700
|
+
r
|
|
2701
|
+
) : this.onAIResponseWithMatcher(
|
|
2702
|
+
o,
|
|
2703
|
+
t,
|
|
2704
|
+
Y.NamedEvent,
|
|
2705
|
+
r,
|
|
2706
|
+
s,
|
|
2707
|
+
i
|
|
2708
|
+
);
|
|
2709
|
+
}
|
|
2710
|
+
onAccessGranted(e, t, s) {
|
|
2711
|
+
const r = this.requireAccessConfig(e);
|
|
2712
|
+
return this.onMyOsResponse(
|
|
2713
|
+
t,
|
|
2714
|
+
"MyOS/Single Document Permission Granted",
|
|
2715
|
+
r.requestId,
|
|
2716
|
+
s
|
|
2717
|
+
);
|
|
2718
|
+
}
|
|
2719
|
+
onAccessRejected(e, t, s) {
|
|
2720
|
+
const r = this.requireAccessConfig(e);
|
|
2721
|
+
return this.onMyOsResponse(
|
|
2722
|
+
t,
|
|
2723
|
+
"MyOS/Single Document Permission Rejected",
|
|
2724
|
+
r.requestId,
|
|
2725
|
+
s
|
|
2726
|
+
);
|
|
2727
|
+
}
|
|
2728
|
+
onAccessRevoked(e, t, s) {
|
|
2729
|
+
const r = this.requireAccessConfig(e);
|
|
2730
|
+
return this.onMyOsResponse(
|
|
2731
|
+
t,
|
|
2732
|
+
"MyOS/Single Document Permission Revoked",
|
|
2733
|
+
r.requestId,
|
|
2734
|
+
s
|
|
2735
|
+
);
|
|
2736
|
+
}
|
|
2737
|
+
onUpdate(e, t, s, r) {
|
|
2738
|
+
const i = this.requireAccessConfig(e);
|
|
2739
|
+
return r === void 0 ? this.onSubscriptionUpdate(
|
|
2740
|
+
t,
|
|
2741
|
+
i.subscriptionId,
|
|
2742
|
+
s
|
|
2743
|
+
) : this.onSubscriptionUpdate(
|
|
2744
|
+
t,
|
|
2745
|
+
i.subscriptionId,
|
|
2746
|
+
s,
|
|
2747
|
+
r
|
|
2748
|
+
);
|
|
2749
|
+
}
|
|
2750
|
+
onLinkedUpdate(e, t, s, r) {
|
|
2751
|
+
const i = this.requireLinkedAccessConfig(e), o = i.subscriptionId ?? `SUB_LINKED_${i.token}`;
|
|
2752
|
+
return r === void 0 ? this.onSubscriptionUpdate(
|
|
2753
|
+
t,
|
|
2754
|
+
o,
|
|
2755
|
+
s
|
|
2756
|
+
) : this.onSubscriptionUpdate(
|
|
2757
|
+
t,
|
|
2758
|
+
o,
|
|
2759
|
+
s,
|
|
2760
|
+
r
|
|
2761
|
+
);
|
|
2762
|
+
}
|
|
2763
|
+
onLinkedAccessGranted(e, t, s) {
|
|
2764
|
+
const r = this.requireLinkedAccessConfig(e);
|
|
2765
|
+
return this.onMyOsResponse(
|
|
2766
|
+
t,
|
|
2767
|
+
"MyOS/Linked Documents Permission Granted",
|
|
2768
|
+
r.requestId,
|
|
2769
|
+
s
|
|
2770
|
+
);
|
|
2771
|
+
}
|
|
2772
|
+
onLinkedAccessRejected(e, t, s) {
|
|
2773
|
+
const r = this.requireLinkedAccessConfig(e);
|
|
2774
|
+
return this.onMyOsResponse(
|
|
2775
|
+
t,
|
|
2776
|
+
"MyOS/Linked Documents Permission Rejected",
|
|
2777
|
+
r.requestId,
|
|
2778
|
+
s
|
|
2779
|
+
);
|
|
2780
|
+
}
|
|
2781
|
+
onLinkedAccessRevoked(e, t, s) {
|
|
2782
|
+
const r = this.requireLinkedAccessConfig(e);
|
|
2783
|
+
return this.onMyOsResponse(
|
|
2784
|
+
t,
|
|
2785
|
+
"MyOS/Linked Documents Permission Revoked",
|
|
2786
|
+
r.requestId,
|
|
2787
|
+
s
|
|
2788
|
+
);
|
|
2789
|
+
}
|
|
2790
|
+
onAgencyGranted(e, t, s) {
|
|
2791
|
+
const r = this.requireAgencyConfig(e);
|
|
2792
|
+
return this.onMyOsResponse(
|
|
2793
|
+
t,
|
|
2794
|
+
"MyOS/Worker Agency Permission Granted",
|
|
2795
|
+
r.requestId,
|
|
2796
|
+
s
|
|
2797
|
+
);
|
|
2798
|
+
}
|
|
2799
|
+
onAgencyRejected(e, t, s) {
|
|
2800
|
+
const r = this.requireAgencyConfig(e);
|
|
2801
|
+
return this.onMyOsResponse(
|
|
2802
|
+
t,
|
|
2803
|
+
"MyOS/Worker Agency Permission Rejected",
|
|
2804
|
+
r.requestId,
|
|
2805
|
+
s
|
|
2806
|
+
);
|
|
2807
|
+
}
|
|
2808
|
+
onAgencyRevoked(e, t, s) {
|
|
2809
|
+
const r = this.requireAgencyConfig(e);
|
|
2810
|
+
return this.onMyOsResponse(
|
|
2811
|
+
t,
|
|
2812
|
+
"MyOS/Worker Agency Permission Revoked",
|
|
2813
|
+
r.requestId,
|
|
2814
|
+
s
|
|
2815
|
+
);
|
|
2816
|
+
}
|
|
2817
|
+
onCallResponse(e, t, s, r) {
|
|
2818
|
+
const i = this.requireAccessConfig(e);
|
|
2819
|
+
if (r === void 0)
|
|
2820
|
+
return this.onTriggeredWithMatcher(
|
|
2821
|
+
t,
|
|
2822
|
+
"MyOS/Call Operation Responded",
|
|
2823
|
+
{
|
|
2824
|
+
inResponseTo: {
|
|
2825
|
+
requestId: i.requestId
|
|
2826
|
+
}
|
|
2827
|
+
},
|
|
2828
|
+
s
|
|
2829
|
+
);
|
|
2830
|
+
const o = f(t, "workflow key"), c = Xt(
|
|
2831
|
+
s
|
|
2832
|
+
);
|
|
2833
|
+
return this.ensureCallResponseEnvelopeWorkflow(e, o), this.onTriggeredWithMatcher(
|
|
2834
|
+
o,
|
|
2835
|
+
c.eventType,
|
|
2836
|
+
nn(c.matcher, i.requestId),
|
|
2837
|
+
r
|
|
2838
|
+
);
|
|
2839
|
+
}
|
|
2840
|
+
onSessionCreated(e, t, s) {
|
|
2841
|
+
const r = this.requireAccessConfig(e);
|
|
2842
|
+
return this.onTriggeredWithId(
|
|
2843
|
+
t,
|
|
2844
|
+
"MyOS/Subscription to Session Initiated",
|
|
2845
|
+
"subscriptionId",
|
|
2846
|
+
r.subscriptionId,
|
|
2847
|
+
s
|
|
2848
|
+
);
|
|
2849
|
+
}
|
|
2850
|
+
onAgencyUpdate(e, t, s, r, i) {
|
|
2851
|
+
return this.requireAgencyConfig(e), i === void 0 ? this.onSubscriptionUpdate(
|
|
2852
|
+
t,
|
|
2853
|
+
s,
|
|
2854
|
+
r
|
|
2855
|
+
) : this.onSubscriptionUpdate(
|
|
2856
|
+
t,
|
|
2857
|
+
s,
|
|
2858
|
+
r,
|
|
2859
|
+
i
|
|
2860
|
+
);
|
|
2861
|
+
}
|
|
2862
|
+
onLinkedDocGranted(e, t, s) {
|
|
2863
|
+
const r = this.requireLinkedAccessConfig(e);
|
|
2864
|
+
return this.onTriggeredWithMatcher(
|
|
2865
|
+
t,
|
|
2866
|
+
"MyOS/Single Document Permission Granted",
|
|
2867
|
+
{
|
|
2868
|
+
inResponseTo: {
|
|
2869
|
+
requestId: r.requestId
|
|
2870
|
+
}
|
|
2871
|
+
},
|
|
2872
|
+
s
|
|
2873
|
+
);
|
|
2874
|
+
}
|
|
2875
|
+
onLinkedDocRevoked(e, t, s) {
|
|
2876
|
+
const r = this.requireLinkedAccessConfig(e);
|
|
2877
|
+
return this.onTriggeredWithMatcher(
|
|
2878
|
+
t,
|
|
2879
|
+
"MyOS/Single Document Permission Revoked",
|
|
2880
|
+
{
|
|
2881
|
+
inResponseTo: {
|
|
2882
|
+
requestId: r.requestId
|
|
2883
|
+
}
|
|
2884
|
+
},
|
|
2885
|
+
s
|
|
2886
|
+
);
|
|
2887
|
+
}
|
|
2888
|
+
onSessionStarting(e, t, s) {
|
|
2889
|
+
const r = this.requireAgencyConfig(e);
|
|
2890
|
+
return this.onTriggeredWithMatcher(
|
|
2891
|
+
t,
|
|
2892
|
+
"MyOS/Worker Session Starting",
|
|
2893
|
+
{
|
|
2894
|
+
inResponseTo: {
|
|
2895
|
+
requestId: r.requestId
|
|
2896
|
+
}
|
|
2897
|
+
},
|
|
2898
|
+
s
|
|
2899
|
+
);
|
|
2900
|
+
}
|
|
2901
|
+
onSessionStarted(e, t, s) {
|
|
2902
|
+
return this.requireAgencyConfig(e), this.onEvent(
|
|
2903
|
+
t,
|
|
2904
|
+
"MyOS/Target Document Session Started",
|
|
2905
|
+
s
|
|
2906
|
+
);
|
|
2907
|
+
}
|
|
2908
|
+
onSessionFailed(e, t, s) {
|
|
2909
|
+
return this.requireAgencyConfig(e), this.onEvent(t, "MyOS/Bootstrap Failed", s);
|
|
2910
|
+
}
|
|
2911
|
+
onParticipantResolved(e, t) {
|
|
2912
|
+
return this.onEvent(e, "MyOS/Participant Resolved", t);
|
|
2913
|
+
}
|
|
2914
|
+
onAllParticipantsReady(e, t) {
|
|
2915
|
+
return this.onEvent(e, "MyOS/All Participants Ready", t);
|
|
2916
|
+
}
|
|
2917
|
+
participantsOrchestration(e = "participantsOrchestration", t) {
|
|
2918
|
+
return this.setMyOsMarkerContract(
|
|
2919
|
+
e,
|
|
2920
|
+
"MyOS/MyOS Participants Orchestration",
|
|
2921
|
+
t
|
|
2922
|
+
);
|
|
2923
|
+
}
|
|
2924
|
+
sessionInteraction(e = "sessionInteraction", t) {
|
|
2925
|
+
return this.setMyOsMarkerContract(
|
|
2926
|
+
e,
|
|
2927
|
+
"MyOS/MyOS Session Interaction",
|
|
2928
|
+
t
|
|
2929
|
+
);
|
|
2930
|
+
}
|
|
2931
|
+
workerAgency(e = "workerAgency", t) {
|
|
2932
|
+
return this.setMyOsMarkerContract(
|
|
2933
|
+
e,
|
|
2934
|
+
"MyOS/MyOS Worker Agency",
|
|
2935
|
+
t
|
|
2936
|
+
);
|
|
2937
|
+
}
|
|
2938
|
+
myOsAdmin(e = "myOsAdminChannel") {
|
|
2939
|
+
return this.channel(e, { type: "MyOS/MyOS Timeline Channel" }), this.canEmit(e), this;
|
|
2940
|
+
}
|
|
2941
|
+
registerAiIntegration(e) {
|
|
2942
|
+
const t = e.name.trim(), s = (e.sessionId ?? "").trim(), r = (e.permissionFrom ?? "").trim();
|
|
2943
|
+
if (!s || !r)
|
|
2944
|
+
throw new Error(`ai('${t}') requires sessionId and permissionFrom`);
|
|
2945
|
+
const i = {
|
|
2946
|
+
name: t,
|
|
2947
|
+
sessionId: s,
|
|
2948
|
+
permissionFrom: r,
|
|
2949
|
+
statusPath: e.statusPath,
|
|
2950
|
+
contextPath: e.contextPath,
|
|
2951
|
+
requesterId: e.requesterId,
|
|
2952
|
+
requestId: e.requestId,
|
|
2953
|
+
subscriptionId: e.subscriptionId,
|
|
2954
|
+
permissionTiming: e.permissionTiming,
|
|
2955
|
+
permissionTriggerEventType: e.permissionTriggerEventType,
|
|
2956
|
+
permissionTriggerDocPath: e.permissionTriggerDocPath,
|
|
2957
|
+
tasks: structuredClone(e.tasks)
|
|
2958
|
+
};
|
|
2959
|
+
this.aiIntegrations.set(t, i), this.state.setValue(i.statusPath, "idle"), this.state.setValue(i.contextPath, {});
|
|
2960
|
+
const o = Ke(t), c = (h) => {
|
|
2961
|
+
h.myOs().requestSingleDocPermission(
|
|
2962
|
+
i.permissionFrom,
|
|
2963
|
+
i.requestId,
|
|
2964
|
+
i.sessionId,
|
|
2965
|
+
{
|
|
2966
|
+
read: !0,
|
|
2967
|
+
singleOps: ["provideInstructions"]
|
|
2968
|
+
}
|
|
2969
|
+
).replaceValue(
|
|
2970
|
+
"SetAIPermissionStatusPending",
|
|
2971
|
+
i.statusPath,
|
|
2972
|
+
"pending"
|
|
2973
|
+
);
|
|
2974
|
+
};
|
|
2975
|
+
switch (i.permissionTiming) {
|
|
2976
|
+
case "onInit":
|
|
2977
|
+
this.onInit(`request${o}Permission`, c);
|
|
2978
|
+
break;
|
|
2979
|
+
case "onEvent":
|
|
2980
|
+
this.onEvent(
|
|
2981
|
+
`request${o}Permission`,
|
|
2982
|
+
i.permissionTriggerEventType ?? "Conversation/Event",
|
|
2983
|
+
c
|
|
2984
|
+
);
|
|
2985
|
+
break;
|
|
2986
|
+
case "onDocChange":
|
|
2987
|
+
this.onDocChange(
|
|
2988
|
+
`request${o}Permission`,
|
|
2989
|
+
i.permissionTriggerDocPath ?? "/",
|
|
2990
|
+
c
|
|
2991
|
+
);
|
|
2992
|
+
break;
|
|
2993
|
+
}
|
|
2994
|
+
return i.permissionTiming !== "manual" && this.onMyOsResponse(
|
|
2995
|
+
`subscribe${o}OnGranted`,
|
|
2996
|
+
"MyOS/Single Document Permission Granted",
|
|
2997
|
+
i.requestId,
|
|
2998
|
+
(h) => h.myOs().subscribeToSessionWithMatchers(
|
|
2999
|
+
i.sessionId,
|
|
3000
|
+
i.subscriptionId,
|
|
3001
|
+
[
|
|
3002
|
+
"Conversation/Response",
|
|
3003
|
+
{
|
|
3004
|
+
type: Y.NamedEvent
|
|
3005
|
+
}
|
|
3006
|
+
]
|
|
3007
|
+
)
|
|
3008
|
+
), this.onTriggeredWithId(
|
|
3009
|
+
`mark${o}SubscriptionReady`,
|
|
3010
|
+
"MyOS/Subscription to Session Initiated",
|
|
3011
|
+
"subscriptionId",
|
|
3012
|
+
i.subscriptionId,
|
|
3013
|
+
(h) => h.replaceValue("SetAIStatusReady", i.statusPath, "ready")
|
|
3014
|
+
), this;
|
|
3015
|
+
}
|
|
3016
|
+
registerAccessConfig(e) {
|
|
3017
|
+
return this.accessConfigs.set(e.name, structuredClone(e)), this;
|
|
3018
|
+
}
|
|
3019
|
+
registerLinkedAccessConfig(e) {
|
|
3020
|
+
return this.linkedAccessConfigs.set(e.name, structuredClone(e)), this;
|
|
3021
|
+
}
|
|
3022
|
+
registerAgencyConfig(e) {
|
|
3023
|
+
return this.agencyConfigs.set(e.name, structuredClone(e)), this;
|
|
3024
|
+
}
|
|
3025
|
+
canEmit(e, ...t) {
|
|
3026
|
+
const s = f(e, "channel key"), r = Zt(s), i = { type: "List" };
|
|
3027
|
+
return t.length > 0 && (i.events = t.map((o) => ({
|
|
3028
|
+
type: m(o)
|
|
3029
|
+
}))), this.applyOperationDefinition({
|
|
3030
|
+
key: r,
|
|
3031
|
+
channelKey: s,
|
|
3032
|
+
description: "Operation for emitting events through channel",
|
|
3033
|
+
request: i,
|
|
3034
|
+
clearRequest: !1,
|
|
3035
|
+
steps: this.buildSteps(Yt)
|
|
3036
|
+
}), this;
|
|
3037
|
+
}
|
|
3038
|
+
contractsPolicy(e = !0, t = "contractsPolicy") {
|
|
3039
|
+
return this.state.setContract(t, {
|
|
3040
|
+
type: "Conversation/Contracts Change Policy",
|
|
3041
|
+
requireSectionChanges: e
|
|
3042
|
+
}), this;
|
|
3043
|
+
}
|
|
3044
|
+
directChange(e = "changeDocument", t = "ownerChannel", s = "Apply Conversation/Change Request directly") {
|
|
3045
|
+
return this.contractsPolicy(!0), this.state.setContract(e, {
|
|
3046
|
+
type: "Conversation/Change Operation",
|
|
3047
|
+
channel: t,
|
|
3048
|
+
description: s,
|
|
3049
|
+
request: {
|
|
3050
|
+
type: "Conversation/Change Request"
|
|
3051
|
+
}
|
|
3052
|
+
}), this.state.setContract(`${e}Impl`, {
|
|
3053
|
+
type: "Conversation/Change Workflow",
|
|
3054
|
+
operation: e
|
|
3055
|
+
}), this;
|
|
3056
|
+
}
|
|
3057
|
+
proposeChange(e = "proposeChange", t = "ownerChannel", s = "") {
|
|
3058
|
+
return this.contractsPolicy(!0), this.state.setContract(e, {
|
|
3059
|
+
type: "Conversation/Propose Change Operation",
|
|
3060
|
+
channel: t
|
|
3061
|
+
}), this.state.setContract(`${e}Impl`, {
|
|
3062
|
+
type: "Conversation/Propose Change Workflow",
|
|
3063
|
+
operation: e,
|
|
3064
|
+
...s ? { postfix: s } : {}
|
|
3065
|
+
}), this;
|
|
3066
|
+
}
|
|
3067
|
+
acceptChange(e = "acceptChange", t = "ownerChannel", s = "") {
|
|
3068
|
+
return this.contractsPolicy(!0), this.state.setContract(e, {
|
|
3069
|
+
type: "Conversation/Accept Change Operation",
|
|
3070
|
+
channel: t
|
|
3071
|
+
}), this.state.setContract(`${e}Impl`, {
|
|
3072
|
+
type: "Conversation/Accept Change Workflow",
|
|
3073
|
+
operation: e,
|
|
3074
|
+
...s ? { postfix: s } : {}
|
|
3075
|
+
}), this;
|
|
3076
|
+
}
|
|
3077
|
+
rejectChange(e = "rejectChange", t = "ownerChannel", s = "") {
|
|
3078
|
+
return this.contractsPolicy(!0), this.state.setContract(e, {
|
|
3079
|
+
type: "Conversation/Reject Change Operation",
|
|
3080
|
+
channel: t
|
|
3081
|
+
}), this.state.setContract(`${e}Impl`, {
|
|
3082
|
+
type: "Conversation/Reject Change Workflow",
|
|
3083
|
+
operation: e,
|
|
3084
|
+
...s ? { postfix: s } : {}
|
|
3085
|
+
}), this;
|
|
3086
|
+
}
|
|
3087
|
+
documentAnchors(e, t = "anchors") {
|
|
3088
|
+
const s = this.state.ensureContractsRoot()[t], r = P(s) && typeof s.type == "string" ? C(s) : {
|
|
3089
|
+
type: "MyOS/Document Anchors"
|
|
3090
|
+
};
|
|
3091
|
+
if (r.type = "MyOS/Document Anchors", Array.isArray(e))
|
|
3092
|
+
for (const i of e) {
|
|
3093
|
+
const o = f(i, "anchor name");
|
|
3094
|
+
r[o] = { type: "MyOS/Document Anchor" };
|
|
3095
|
+
}
|
|
3096
|
+
else if (typeof e == "function")
|
|
3097
|
+
e(r);
|
|
3098
|
+
else
|
|
3099
|
+
for (const [i, o] of Object.entries(e)) {
|
|
3100
|
+
const c = f(i, "anchor name");
|
|
3101
|
+
r[c] = C(o);
|
|
3102
|
+
}
|
|
3103
|
+
return this.state.setContract(t, r), this;
|
|
3104
|
+
}
|
|
3105
|
+
documentLinks(e, t = "links") {
|
|
3106
|
+
const s = this.state.ensureContractsRoot()[t], r = P(s) && typeof s.type == "string" ? C(s) : {
|
|
3107
|
+
type: "MyOS/Document Links"
|
|
3108
|
+
};
|
|
3109
|
+
r.type = "MyOS/Document Links";
|
|
3110
|
+
for (const [i, o] of Object.entries(e))
|
|
3111
|
+
r[f(i, "link name")] = C(o);
|
|
3112
|
+
return this.state.setContract(t, r), this;
|
|
3113
|
+
}
|
|
3114
|
+
sessionLink(e, t, s, r = "links") {
|
|
3115
|
+
return this.documentLinks(
|
|
3116
|
+
{
|
|
3117
|
+
[e]: {
|
|
3118
|
+
type: "MyOS/MyOS Session Link",
|
|
3119
|
+
anchor: t,
|
|
3120
|
+
sessionId: s
|
|
3121
|
+
}
|
|
3122
|
+
},
|
|
3123
|
+
r
|
|
3124
|
+
);
|
|
3125
|
+
}
|
|
3126
|
+
documentLink(e, t, s, r = "links") {
|
|
3127
|
+
return this.documentLinks(
|
|
3128
|
+
{
|
|
3129
|
+
[e]: {
|
|
3130
|
+
type: "MyOS/Document Link",
|
|
3131
|
+
anchor: t,
|
|
3132
|
+
documentId: s
|
|
3133
|
+
}
|
|
3134
|
+
},
|
|
3135
|
+
r
|
|
3136
|
+
);
|
|
3137
|
+
}
|
|
3138
|
+
documentTypeLink(e, t, s, r = "links") {
|
|
3139
|
+
return this.documentLinks(
|
|
3140
|
+
{
|
|
3141
|
+
[e]: {
|
|
3142
|
+
type: "MyOS/Document Type Link",
|
|
3143
|
+
anchor: t,
|
|
3144
|
+
documentType: {
|
|
3145
|
+
blueId: s
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
},
|
|
3149
|
+
r
|
|
3150
|
+
);
|
|
3151
|
+
}
|
|
3152
|
+
buildJson() {
|
|
3153
|
+
return this.state.build();
|
|
3154
|
+
}
|
|
3155
|
+
buildDocument() {
|
|
3156
|
+
return re(this.buildJson());
|
|
3157
|
+
}
|
|
3158
|
+
applyFieldMetadata(e) {
|
|
3159
|
+
const t = this.state.getValue(e.path), s = P(t) ? C(t) : {};
|
|
3160
|
+
!P(t) && t !== void 0 && !e.hasExplicitValue && (s.value = t), e.hasExplicitValue && (s.value = e.value), e.typeAlias && (s.type = e.typeAlias), e.description && (s.description = e.description);
|
|
3161
|
+
const r = P(s.constraints) ? C(s.constraints) : {};
|
|
3162
|
+
let i = !1;
|
|
3163
|
+
return e.required !== void 0 && (r.required = e.required, i = !0), e.minimum !== void 0 && (r.minimum = e.minimum, i = !0), e.maximum !== void 0 && (r.maximum = e.maximum, i = !0), i && (s.constraints = r), Object.keys(s).length === 0 ? this : (this.state.setValue(e.path, s), this);
|
|
3164
|
+
}
|
|
3165
|
+
applyOperationDefinition(e) {
|
|
3166
|
+
const t = f(e.key, "operation key"), r = this.state.ensureContractsRoot()[t], i = P(r) ? C(r) : {};
|
|
3167
|
+
if (i.type = "Conversation/Operation", i.channel = e.channelKey ?? i.channel, !i.channel)
|
|
3168
|
+
throw new Error(
|
|
3169
|
+
`Operation '${t}' has no channel. Set it via operation(...channel...)`
|
|
3170
|
+
);
|
|
3171
|
+
if (e.description !== void 0 && (i.description = e.description), e.request !== void 0) {
|
|
3172
|
+
const o = P(i.request) ? C(i.request) : {};
|
|
3173
|
+
i.request = {
|
|
3174
|
+
...o,
|
|
3175
|
+
...C(e.request)
|
|
3176
|
+
};
|
|
3177
|
+
} else e.clearRequest && delete i.request;
|
|
3178
|
+
return this.state.setContract(t, i), e.steps !== void 0 && this.state.setContract(`${t}Impl`, {
|
|
3179
|
+
type: "Conversation/Sequential Workflow Operation",
|
|
3180
|
+
operation: t,
|
|
3181
|
+
steps: structuredClone(e.steps)
|
|
3182
|
+
}), this;
|
|
3183
|
+
}
|
|
3184
|
+
buildSteps(e) {
|
|
3185
|
+
const t = this.createStepsBuilder();
|
|
3186
|
+
return e(t), t.build();
|
|
3187
|
+
}
|
|
3188
|
+
createStepsBuilder() {
|
|
3189
|
+
return new Qt({
|
|
3190
|
+
aiIntegrations: Object.fromEntries(this.aiIntegrations.entries()),
|
|
3191
|
+
accessConfigs: Object.fromEntries(this.accessConfigs.entries()),
|
|
3192
|
+
linkedAccessConfigs: Object.fromEntries(
|
|
3193
|
+
this.linkedAccessConfigs.entries()
|
|
3194
|
+
),
|
|
3195
|
+
agencyConfigs: Object.fromEntries(this.agencyConfigs.entries())
|
|
3196
|
+
});
|
|
3197
|
+
}
|
|
3198
|
+
onAIResponseWithMatcher(e, t, s, r, i, o) {
|
|
3199
|
+
r && this.assertAiTaskExists(e, r);
|
|
3200
|
+
const c = r?.trim();
|
|
3201
|
+
return this.onTriggeredWithMatcher(
|
|
3202
|
+
t,
|
|
3203
|
+
"MyOS/Subscription Update",
|
|
3204
|
+
{
|
|
3205
|
+
subscriptionId: e.subscriptionId,
|
|
3206
|
+
update: {
|
|
3207
|
+
type: s,
|
|
3208
|
+
...i ? { name: i } : {},
|
|
3209
|
+
inResponseTo: {
|
|
3210
|
+
incomingEvent: {
|
|
3211
|
+
requester: e.requesterId,
|
|
3212
|
+
...c ? { taskName: c } : {}
|
|
3213
|
+
}
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
3216
|
+
},
|
|
3217
|
+
(h) => {
|
|
3218
|
+
h.replaceExpression(
|
|
3219
|
+
"_SaveAIContext",
|
|
3220
|
+
e.contextPath,
|
|
3221
|
+
"event.update.context"
|
|
3222
|
+
), o(h);
|
|
3223
|
+
}
|
|
3224
|
+
);
|
|
3225
|
+
}
|
|
3226
|
+
requireAiIntegration(e) {
|
|
3227
|
+
const t = e.trim(), s = this.aiIntegrations.get(t);
|
|
3228
|
+
if (!s)
|
|
3229
|
+
throw new Error(`Unknown AI integration: ${e}`);
|
|
3230
|
+
return s;
|
|
3231
|
+
}
|
|
3232
|
+
assertAiTaskExists(e, t) {
|
|
3233
|
+
const s = t.trim();
|
|
3234
|
+
if (!e.tasks[s])
|
|
3235
|
+
throw new Error(
|
|
3236
|
+
`Unknown AI task '${s}' for integration '${e.name}'`
|
|
3237
|
+
);
|
|
3238
|
+
}
|
|
3239
|
+
requireAccessConfig(e) {
|
|
3240
|
+
const t = this.accessConfigs.get(e.trim());
|
|
3241
|
+
if (!t)
|
|
3242
|
+
throw new Error(`Unknown access: ${e}`);
|
|
3243
|
+
return t;
|
|
3244
|
+
}
|
|
3245
|
+
requireLinkedAccessConfig(e) {
|
|
3246
|
+
const t = this.linkedAccessConfigs.get(e.trim());
|
|
3247
|
+
if (!t)
|
|
3248
|
+
throw new Error(`Unknown linked access: ${e}`);
|
|
3249
|
+
return t;
|
|
3250
|
+
}
|
|
3251
|
+
requireAgencyConfig(e) {
|
|
3252
|
+
const t = this.agencyConfigs.get(e.trim());
|
|
3253
|
+
if (!t)
|
|
3254
|
+
throw new Error(`Unknown agency: ${e}`);
|
|
3255
|
+
return t;
|
|
3256
|
+
}
|
|
3257
|
+
ensureCallResponseEnvelopeWorkflow(e, t) {
|
|
3258
|
+
const s = f(e, "access name"), r = this.callResponseEnvelopeWorkflows.get(s);
|
|
3259
|
+
if (r)
|
|
3260
|
+
return r;
|
|
3261
|
+
const i = en(t);
|
|
3262
|
+
return this.onEvent(
|
|
3263
|
+
i,
|
|
3264
|
+
"MyOS/Call Operation Responded",
|
|
3265
|
+
(o) => o.jsRaw(
|
|
3266
|
+
tn(t),
|
|
3267
|
+
sn()
|
|
3268
|
+
)
|
|
3269
|
+
), this.callResponseEnvelopeWorkflows.set(
|
|
3270
|
+
s,
|
|
3271
|
+
i
|
|
3272
|
+
), i;
|
|
3273
|
+
}
|
|
3274
|
+
ensureTriggeredEventChannel() {
|
|
3275
|
+
this.state.setContract("triggeredEventChannel", {
|
|
3276
|
+
type: "Core/Triggered Event Channel"
|
|
3277
|
+
});
|
|
3278
|
+
}
|
|
3279
|
+
ensureInitLifecycleChannel() {
|
|
3280
|
+
this.state.setContract("initLifecycleChannel", {
|
|
3281
|
+
type: "Core/Lifecycle Event Channel",
|
|
3282
|
+
event: { type: "Core/Document Processing Initiated" }
|
|
3283
|
+
});
|
|
3284
|
+
}
|
|
3285
|
+
resolveChannelEventMatcher(e, t) {
|
|
3286
|
+
const s = { type: m(t) };
|
|
3287
|
+
return !this.isTimelineLikeChannel(e) || this.isTimelineEntryMatcher(s.type) ? s : {
|
|
3288
|
+
message: s
|
|
3289
|
+
};
|
|
3290
|
+
}
|
|
3291
|
+
isTimelineLikeChannel(e) {
|
|
3292
|
+
const t = this.state.ensureContractsRoot()[e];
|
|
3293
|
+
if (!t || typeof t != "object" || Array.isArray(t))
|
|
3294
|
+
return !1;
|
|
3295
|
+
const s = t.type;
|
|
3296
|
+
return s === "Conversation/Timeline Channel" || s === "Conversation/Composite Timeline Channel" || s === "MyOS/MyOS Timeline Channel";
|
|
3297
|
+
}
|
|
3298
|
+
isTimelineEntryMatcher(e) {
|
|
3299
|
+
return e === "Conversation/Timeline Entry" || e === "MyOS/MyOS Timeline Entry";
|
|
3300
|
+
}
|
|
3301
|
+
setMyOsMarkerContract(e, t, s) {
|
|
3302
|
+
return this.state.setContract(f(e, "contract key"), {
|
|
3303
|
+
...s ? C(s) : {},
|
|
3304
|
+
type: t
|
|
3305
|
+
}), this;
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
class y extends u {
|
|
3309
|
+
constructor(e) {
|
|
3310
|
+
super(e);
|
|
3311
|
+
}
|
|
3312
|
+
static doc() {
|
|
3313
|
+
return new y();
|
|
3314
|
+
}
|
|
3315
|
+
static edit(e) {
|
|
3316
|
+
return new y(this.documentToJson(e));
|
|
3317
|
+
}
|
|
3318
|
+
static from(e) {
|
|
3319
|
+
return new y(this.documentToJson(e));
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
function rn(n) {
|
|
3323
|
+
const e = n.trim();
|
|
3324
|
+
if (e.length === 0)
|
|
3325
|
+
throw new Error("channelKey is required");
|
|
3326
|
+
return e;
|
|
3327
|
+
}
|
|
3328
|
+
function Ge(n, e) {
|
|
3329
|
+
const t = W(rn(n));
|
|
3330
|
+
return {
|
|
3331
|
+
[e]: "${document('/contracts/" + t + "/" + e + "')}"
|
|
3332
|
+
};
|
|
3333
|
+
}
|
|
3334
|
+
function Te(n) {
|
|
3335
|
+
return Ge(n, "accountId");
|
|
3336
|
+
}
|
|
3337
|
+
function ss(n) {
|
|
3338
|
+
return Ge(n, "email");
|
|
3339
|
+
}
|
|
3340
|
+
const on = /* @__PURE__ */ new Set([
|
|
3341
|
+
"name",
|
|
3342
|
+
"description",
|
|
3343
|
+
"type",
|
|
3344
|
+
"contracts",
|
|
3345
|
+
"policies"
|
|
3346
|
+
]);
|
|
3347
|
+
function an(n) {
|
|
3348
|
+
return Array.isArray(n.fields) && Array.isArray(n.contracts) && Array.isArray(n.sections) && Array.isArray(n.policies) && Array.isArray(n.unclassifiedContracts);
|
|
3349
|
+
}
|
|
3350
|
+
function we(n) {
|
|
3351
|
+
return structuredClone(n);
|
|
3352
|
+
}
|
|
3353
|
+
function _(n) {
|
|
3354
|
+
return !n || typeof n != "object" || Array.isArray(n) ? null : n;
|
|
3355
|
+
}
|
|
3356
|
+
function X(n) {
|
|
3357
|
+
return Object.keys(n).sort((e, t) => e.localeCompare(t));
|
|
3358
|
+
}
|
|
3359
|
+
function cn(n) {
|
|
3360
|
+
return Array.isArray(n) ? "array" : !n || typeof n != "object" ? "primitive" : typeof n.type == "string" ? "typed-node-like object" : "object";
|
|
3361
|
+
}
|
|
3362
|
+
function un(n) {
|
|
3363
|
+
if (n === null)
|
|
3364
|
+
return "null";
|
|
3365
|
+
if (typeof n == "string")
|
|
3366
|
+
return n.length > 80 ? `${n.slice(0, 77)}...` : n;
|
|
3367
|
+
if (typeof n == "number" || typeof n == "boolean")
|
|
3368
|
+
return String(n);
|
|
3369
|
+
if (Array.isArray(n))
|
|
3370
|
+
return `[${n.length} items]`;
|
|
3371
|
+
const e = n;
|
|
3372
|
+
return typeof e.type == "string" ? `<${e.type}>` : `{${Object.keys(e).length} keys}`;
|
|
3373
|
+
}
|
|
3374
|
+
function Je(n, e, t) {
|
|
3375
|
+
const s = cn(n);
|
|
3376
|
+
if (s === "primitive" || s === "array" || s === "typed-node-like object") {
|
|
3377
|
+
t.push({
|
|
3378
|
+
path: e,
|
|
3379
|
+
value: structuredClone(n),
|
|
3380
|
+
kind: s,
|
|
3381
|
+
valuePreview: un(n)
|
|
3382
|
+
});
|
|
3383
|
+
return;
|
|
3384
|
+
}
|
|
3385
|
+
const r = n, i = X(r);
|
|
3386
|
+
if (i.length === 0) {
|
|
3387
|
+
t.push({
|
|
3388
|
+
path: e,
|
|
3389
|
+
value: {},
|
|
3390
|
+
kind: "object",
|
|
3391
|
+
valuePreview: "{0 keys}"
|
|
3392
|
+
});
|
|
3393
|
+
return;
|
|
3394
|
+
}
|
|
3395
|
+
for (const o of i)
|
|
3396
|
+
Je(
|
|
3397
|
+
r[o],
|
|
3398
|
+
`${e}/${W(o)}`,
|
|
3399
|
+
t
|
|
3400
|
+
);
|
|
3401
|
+
}
|
|
3402
|
+
function Ce(n) {
|
|
3403
|
+
if (Array.isArray(n))
|
|
3404
|
+
return `[${n.map((t) => Ce(t)).join(",")}]`;
|
|
3405
|
+
if (!n || typeof n != "object")
|
|
3406
|
+
return JSON.stringify(n);
|
|
3407
|
+
const e = n;
|
|
3408
|
+
return `{${X(e).map(
|
|
3409
|
+
(t) => `${JSON.stringify(t)}:${Ce(e[t])}`
|
|
3410
|
+
).join(",")}}`;
|
|
3411
|
+
}
|
|
3412
|
+
function ln(n) {
|
|
3413
|
+
const e = Ce(n);
|
|
3414
|
+
let t = 2166136261, s = 2166136261;
|
|
3415
|
+
for (let o = 0; o < e.length; o += 1) {
|
|
3416
|
+
const c = e.charCodeAt(o);
|
|
3417
|
+
t ^= c, t = Math.imul(t, 16777619), s ^= c * 97, s = Math.imul(s, 16777619);
|
|
3418
|
+
}
|
|
3419
|
+
const r = (t >>> 0).toString(16).padStart(8, "0"), i = (s >>> 0).toString(16).padStart(8, "0");
|
|
3420
|
+
return `${r}${i}${r}${i}${r}${i}${r}${i}`;
|
|
3421
|
+
}
|
|
3422
|
+
function hn(n) {
|
|
3423
|
+
return n ? n === "Conversation/Document Section" ? "section" : n.includes("Policy") ? "policy" : n.includes("Channel") ? "channel" : n.includes("Sequential Workflow Operation") ? "operationImpl" : n.includes("Operation") || n.includes("Change Operation") ? "operation" : n.includes("Workflow") ? "workflow" : "other" : "other";
|
|
3424
|
+
}
|
|
3425
|
+
function pn(n) {
|
|
3426
|
+
const e = {};
|
|
3427
|
+
for (const t of n)
|
|
3428
|
+
for (const s of t.relatedContracts)
|
|
3429
|
+
e[s] || (e[s] = /* @__PURE__ */ new Set()), e[s]?.add(t.key);
|
|
3430
|
+
return e;
|
|
3431
|
+
}
|
|
3432
|
+
function Ee(n) {
|
|
3433
|
+
const e = [], t = n.requireSectionChanges;
|
|
3434
|
+
return typeof t == "boolean" && e.push(`requireSectionChanges=${String(t)}`), e.length === 0 ? `keys=${Object.keys(n).length}` : e.join(", ");
|
|
3435
|
+
}
|
|
3436
|
+
function dn(n) {
|
|
3437
|
+
return `Document: ${n ?? "(unnamed)"}`;
|
|
3438
|
+
}
|
|
3439
|
+
class J {
|
|
3440
|
+
name;
|
|
3441
|
+
description;
|
|
3442
|
+
type;
|
|
3443
|
+
fields;
|
|
3444
|
+
contracts;
|
|
3445
|
+
sections;
|
|
3446
|
+
policies;
|
|
3447
|
+
unclassifiedContracts;
|
|
3448
|
+
unknownContracts;
|
|
3449
|
+
constructor(e) {
|
|
3450
|
+
const t = we(e);
|
|
3451
|
+
this.name = t.name, this.description = t.description, this.type = t.type, this.fields = t.fields, this.contracts = t.contracts, this.sections = t.sections, this.policies = t.policies, this.unclassifiedContracts = t.unclassifiedContracts, this.unknownContracts = t.unclassifiedContracts;
|
|
3452
|
+
}
|
|
3453
|
+
static from(e) {
|
|
3454
|
+
if (e instanceof J)
|
|
3455
|
+
return e;
|
|
3456
|
+
if (!(e instanceof N) && an(e))
|
|
3457
|
+
return new J(e);
|
|
3458
|
+
const t = e instanceof N ? ae(e) : structuredClone(e), s = [];
|
|
3459
|
+
for (const a of X(t))
|
|
3460
|
+
on.has(a) || Je(
|
|
3461
|
+
t[a],
|
|
3462
|
+
`/${W(a)}`,
|
|
3463
|
+
s
|
|
3464
|
+
);
|
|
3465
|
+
const r = _(t.contracts) ?? {}, i = [];
|
|
3466
|
+
for (const a of X(r)) {
|
|
3467
|
+
const d = _(r[a]) ?? {}, O = typeof d.type == "string" ? d.type : void 0;
|
|
3468
|
+
i.push({
|
|
3469
|
+
key: a,
|
|
3470
|
+
type: O,
|
|
3471
|
+
kind: hn(O),
|
|
3472
|
+
raw: structuredClone(d)
|
|
3473
|
+
});
|
|
3474
|
+
}
|
|
3475
|
+
const o = i.filter((a) => a.kind === "section").map((a) => {
|
|
3476
|
+
const d = typeof a.raw.title == "string" ? a.raw.title : a.key, O = typeof a.raw.summary == "string" ? a.raw.summary : void 0, w = Array.isArray(a.raw.relatedFields) ? a.raw.relatedFields.filter(
|
|
3477
|
+
(b) => typeof b == "string"
|
|
3478
|
+
) : [], E = Array.isArray(
|
|
3479
|
+
a.raw.relatedContracts
|
|
3480
|
+
) ? a.raw.relatedContracts.filter(
|
|
3481
|
+
(b) => typeof b == "string"
|
|
3482
|
+
) : [];
|
|
3483
|
+
return {
|
|
3484
|
+
key: a.key,
|
|
3485
|
+
title: d,
|
|
3486
|
+
summary: O,
|
|
3487
|
+
relatedFields: [...new Set(w)].sort(
|
|
3488
|
+
(b, ce) => b.localeCompare(ce)
|
|
3489
|
+
),
|
|
3490
|
+
relatedContracts: [...new Set(E)].sort(
|
|
3491
|
+
(b, ce) => b.localeCompare(ce)
|
|
3492
|
+
)
|
|
3493
|
+
};
|
|
3494
|
+
}).sort((a, d) => a.key.localeCompare(d.key)), c = pn(o), h = i.map(
|
|
3495
|
+
(a) => {
|
|
3496
|
+
const d = _(a.raw.request), O = _(a.raw.event);
|
|
3497
|
+
return {
|
|
3498
|
+
key: a.key,
|
|
3499
|
+
type: a.type,
|
|
3500
|
+
kind: a.kind,
|
|
3501
|
+
raw: structuredClone(a.raw),
|
|
3502
|
+
fingerprint: ln(a.raw),
|
|
3503
|
+
sectionKeys: [
|
|
3504
|
+
...c[a.key] ?? /* @__PURE__ */ new Set()
|
|
3505
|
+
].sort((w, E) => w.localeCompare(E)),
|
|
3506
|
+
channelBinding: typeof a.raw.channel == "string" ? a.raw.channel : void 0,
|
|
3507
|
+
requestType: typeof d?.type == "string" ? d.type : void 0,
|
|
3508
|
+
operationTarget: typeof a.raw.operation == "string" ? a.raw.operation : void 0,
|
|
3509
|
+
matcherType: typeof O?.type == "string" ? O.type : void 0
|
|
3510
|
+
};
|
|
3511
|
+
}
|
|
3512
|
+
), p = [
|
|
3513
|
+
...h.filter((a) => a.kind === "policy").map((a) => ({
|
|
3514
|
+
key: a.key,
|
|
3515
|
+
type: a.type,
|
|
3516
|
+
summary: Ee(a.raw)
|
|
3517
|
+
}))
|
|
3518
|
+
], g = _(t.policies);
|
|
3519
|
+
if (g)
|
|
3520
|
+
for (const a of X(g)) {
|
|
3521
|
+
const d = _(g[a]) ?? {};
|
|
3522
|
+
p.push({
|
|
3523
|
+
key: a,
|
|
3524
|
+
type: typeof d.type == "string" ? d.type : void 0,
|
|
3525
|
+
summary: Ee(d)
|
|
3526
|
+
});
|
|
3527
|
+
}
|
|
3528
|
+
const k = new Set(o.map((a) => a.key)), l = h.filter(
|
|
3529
|
+
(a) => !k.has(a.key)
|
|
3530
|
+
);
|
|
3531
|
+
return new J({
|
|
3532
|
+
name: typeof t.name == "string" ? t.name : void 0,
|
|
3533
|
+
description: typeof t.description == "string" ? t.description : void 0,
|
|
3534
|
+
type: typeof t.type == "string" ? t.type : void 0,
|
|
3535
|
+
fields: s,
|
|
3536
|
+
contracts: h,
|
|
3537
|
+
sections: o,
|
|
3538
|
+
policies: p.sort(
|
|
3539
|
+
(a, d) => a.key.localeCompare(d.key)
|
|
3540
|
+
),
|
|
3541
|
+
unclassifiedContracts: l
|
|
3542
|
+
});
|
|
3543
|
+
}
|
|
3544
|
+
getContract(e) {
|
|
3545
|
+
return this.contracts.find((t) => t.key === e);
|
|
3546
|
+
}
|
|
3547
|
+
getSection(e) {
|
|
3548
|
+
return this.sections.find((t) => t.key === e);
|
|
3549
|
+
}
|
|
3550
|
+
toSummaryJson() {
|
|
3551
|
+
return we({
|
|
3552
|
+
name: this.name,
|
|
3553
|
+
description: this.description,
|
|
3554
|
+
type: this.type,
|
|
3555
|
+
fields: this.fields,
|
|
3556
|
+
contracts: this.contracts,
|
|
3557
|
+
sections: this.sections,
|
|
3558
|
+
policies: this.policies,
|
|
3559
|
+
unclassifiedContracts: this.unclassifiedContracts
|
|
3560
|
+
});
|
|
3561
|
+
}
|
|
3562
|
+
toPromptText() {
|
|
3563
|
+
const e = [dn(this.name)];
|
|
3564
|
+
if (e.push(`Type: ${this.type ?? "n/a"}`), this.description && e.push(`Description: ${this.description}`), e.push(""), e.push(`Fields (${this.fields.length})`), this.fields.length === 0)
|
|
3565
|
+
e.push("- none");
|
|
3566
|
+
else
|
|
3567
|
+
for (const t of this.fields)
|
|
3568
|
+
e.push(
|
|
3569
|
+
`- ${t.path} [${t.kind}] = ${t.valuePreview} (${t.valuePreview.length} chars preview)`
|
|
3570
|
+
);
|
|
3571
|
+
if (e.push(""), e.push(`Contracts (${this.contracts.length})`), this.contracts.length === 0)
|
|
3572
|
+
e.push("- none");
|
|
3573
|
+
else
|
|
3574
|
+
for (const t of this.contracts) {
|
|
3575
|
+
const s = [];
|
|
3576
|
+
t.channelBinding && s.push(`channel=${t.channelBinding}`), t.requestType && s.push(`request=${t.requestType}`), t.operationTarget && s.push(`operation=${t.operationTarget}`), t.matcherType && s.push(`matcher=${t.matcherType}`), t.sectionKeys.length > 0 && s.push(`sections=${t.sectionKeys.join(",")}`), e.push(
|
|
3577
|
+
`- ${t.key} [${t.kind}] ${t.type ?? "unknown"}${s.length > 0 ? ` | ${s.join(" | ")}` : ""}`
|
|
3578
|
+
);
|
|
3579
|
+
}
|
|
3580
|
+
if (e.push(""), e.push(`Sections (${this.sections.length})`), this.sections.length === 0)
|
|
3581
|
+
e.push("- none");
|
|
3582
|
+
else
|
|
3583
|
+
for (const t of this.sections)
|
|
3584
|
+
e.push(
|
|
3585
|
+
`- ${t.key}: ${t.title} | fields=${t.relatedFields.length} contracts=${t.relatedContracts.length}`
|
|
3586
|
+
);
|
|
3587
|
+
return e.join(`
|
|
3588
|
+
`);
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
function ie(n) {
|
|
3592
|
+
return typeof n == "object" && n !== null && !Array.isArray(n);
|
|
3593
|
+
}
|
|
3594
|
+
function he(n, e) {
|
|
3595
|
+
return n === "" ? `/${W(e)}` : `${n}/${W(e)}`;
|
|
3596
|
+
}
|
|
3597
|
+
function Ve(n) {
|
|
3598
|
+
return Object.keys(n).sort((e, t) => e.localeCompare(t));
|
|
3599
|
+
}
|
|
3600
|
+
function ve(n, e) {
|
|
3601
|
+
if (n === e)
|
|
3602
|
+
return !0;
|
|
3603
|
+
if (Array.isArray(n) && Array.isArray(e)) {
|
|
3604
|
+
if (n.length !== e.length)
|
|
3605
|
+
return !1;
|
|
3606
|
+
for (let t = 0; t < n.length; t += 1)
|
|
3607
|
+
if (!ve(n[t], e[t]))
|
|
3608
|
+
return !1;
|
|
3609
|
+
return !0;
|
|
3610
|
+
}
|
|
3611
|
+
if (ie(n) && ie(e)) {
|
|
3612
|
+
const t = Object.keys(n), s = Object.keys(e);
|
|
3613
|
+
if (t.length !== s.length)
|
|
3614
|
+
return !1;
|
|
3615
|
+
for (const r of t)
|
|
3616
|
+
if (!ve(n[r], e[r]))
|
|
3617
|
+
return !1;
|
|
3618
|
+
return !0;
|
|
3619
|
+
}
|
|
3620
|
+
return !1;
|
|
3621
|
+
}
|
|
3622
|
+
function ze(n, e, t, s) {
|
|
3623
|
+
if (!ve(n, e)) {
|
|
3624
|
+
if (Array.isArray(n) || Array.isArray(e)) {
|
|
3625
|
+
s.push({
|
|
3626
|
+
op: "replace",
|
|
3627
|
+
path: t,
|
|
3628
|
+
val: structuredClone(e)
|
|
3629
|
+
});
|
|
3630
|
+
return;
|
|
3631
|
+
}
|
|
3632
|
+
if (ie(n) && ie(e)) {
|
|
3633
|
+
const r = new Set(Ve(n)), i = new Set(Ve(e));
|
|
3634
|
+
for (const o of [...r].sort(
|
|
3635
|
+
(c, h) => c.localeCompare(h)
|
|
3636
|
+
))
|
|
3637
|
+
i.has(o) || s.push({
|
|
3638
|
+
op: "remove",
|
|
3639
|
+
path: he(t, o)
|
|
3640
|
+
});
|
|
3641
|
+
for (const o of [...i].sort(
|
|
3642
|
+
(c, h) => c.localeCompare(h)
|
|
3643
|
+
)) {
|
|
3644
|
+
if (!r.has(o)) {
|
|
3645
|
+
s.push({
|
|
3646
|
+
op: "add",
|
|
3647
|
+
path: he(t, o),
|
|
3648
|
+
val: structuredClone(e[o])
|
|
3649
|
+
});
|
|
3650
|
+
continue;
|
|
3651
|
+
}
|
|
3652
|
+
ze(
|
|
3653
|
+
n[o],
|
|
3654
|
+
e[o],
|
|
3655
|
+
he(t, o),
|
|
3656
|
+
s
|
|
3657
|
+
);
|
|
3658
|
+
}
|
|
3659
|
+
return;
|
|
3660
|
+
}
|
|
3661
|
+
s.push({
|
|
3662
|
+
op: "replace",
|
|
3663
|
+
path: t,
|
|
3664
|
+
val: structuredClone(e)
|
|
3665
|
+
});
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
function Qe(n, e) {
|
|
3669
|
+
const t = [];
|
|
3670
|
+
return ze(n, e, "", t), t;
|
|
3671
|
+
}
|
|
3672
|
+
function pe(n) {
|
|
3673
|
+
return n instanceof N ? ae(n) : structuredClone(n);
|
|
3674
|
+
}
|
|
3675
|
+
function mn(n) {
|
|
3676
|
+
for (const e of n)
|
|
3677
|
+
if (!e.path.startsWith("/"))
|
|
3678
|
+
throw new Error(
|
|
3679
|
+
`Invalid patch path '${e.path}'. Root replacement is unsupported.`
|
|
3680
|
+
);
|
|
3681
|
+
}
|
|
3682
|
+
function De(n) {
|
|
3683
|
+
return `/contracts/${W(n)}`;
|
|
3684
|
+
}
|
|
3685
|
+
class Ye {
|
|
3686
|
+
originalJson;
|
|
3687
|
+
nextJson;
|
|
3688
|
+
constructor(e) {
|
|
3689
|
+
this.originalJson = structuredClone(e), this.nextJson = structuredClone(e);
|
|
3690
|
+
}
|
|
3691
|
+
static from(e) {
|
|
3692
|
+
return new Ye(pe(e));
|
|
3693
|
+
}
|
|
3694
|
+
diff(e) {
|
|
3695
|
+
return this.nextJson = pe(e), this;
|
|
3696
|
+
}
|
|
3697
|
+
mutate(e) {
|
|
3698
|
+
const t = u.from(this.nextJson);
|
|
3699
|
+
return e(t), this.nextJson = t.buildJson(), this;
|
|
3700
|
+
}
|
|
3701
|
+
field(e, t) {
|
|
3702
|
+
return Z(this.nextJson, e, t), this;
|
|
3703
|
+
}
|
|
3704
|
+
remove(e) {
|
|
3705
|
+
return H(this.nextJson, e), this;
|
|
3706
|
+
}
|
|
3707
|
+
contract(e, t) {
|
|
3708
|
+
return Z(
|
|
3709
|
+
this.nextJson,
|
|
3710
|
+
De(e),
|
|
3711
|
+
structuredClone(t)
|
|
3712
|
+
), this;
|
|
3713
|
+
}
|
|
3714
|
+
removeContract(e) {
|
|
3715
|
+
return H(this.nextJson, De(e)), this;
|
|
3716
|
+
}
|
|
3717
|
+
build() {
|
|
3718
|
+
const e = Qe(this.originalJson, this.nextJson);
|
|
3719
|
+
return mn(e), e;
|
|
3720
|
+
}
|
|
3721
|
+
apply(e) {
|
|
3722
|
+
if (e === void 0)
|
|
3723
|
+
return this.nextDocumentNode();
|
|
3724
|
+
if (e instanceof N)
|
|
3725
|
+
return this.applyTo(e);
|
|
3726
|
+
const t = pe(e);
|
|
3727
|
+
for (const s of this.build()) {
|
|
3728
|
+
if (s.op === "remove") {
|
|
3729
|
+
H(t, s.path);
|
|
3730
|
+
continue;
|
|
3731
|
+
}
|
|
3732
|
+
Z(t, s.path, structuredClone(s.val));
|
|
3733
|
+
}
|
|
3734
|
+
return re(t);
|
|
3735
|
+
}
|
|
3736
|
+
applyTo(e, t = !1) {
|
|
3737
|
+
const s = this.build();
|
|
3738
|
+
let r = t ? e : e.clone();
|
|
3739
|
+
for (const i of s)
|
|
3740
|
+
r = et(
|
|
3741
|
+
r,
|
|
3742
|
+
i,
|
|
3743
|
+
!0
|
|
3744
|
+
);
|
|
3745
|
+
return r;
|
|
3746
|
+
}
|
|
3747
|
+
nextDocumentJson() {
|
|
3748
|
+
return structuredClone(this.nextJson);
|
|
3749
|
+
}
|
|
3750
|
+
toTargetJson() {
|
|
3751
|
+
return this.nextDocumentJson();
|
|
3752
|
+
}
|
|
3753
|
+
nextDocumentNode() {
|
|
3754
|
+
return re(this.nextDocumentJson());
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
function L(n) {
|
|
3758
|
+
return n instanceof N ? ae(n) : structuredClone(n);
|
|
3759
|
+
}
|
|
3760
|
+
function G(n) {
|
|
3761
|
+
return !n || typeof n != "object" || Array.isArray(n) ? null : n;
|
|
3762
|
+
}
|
|
3763
|
+
function Se(n) {
|
|
3764
|
+
return Object.keys(n).sort((e, t) => e.localeCompare(t));
|
|
3765
|
+
}
|
|
3766
|
+
function oe(n) {
|
|
3767
|
+
if (Array.isArray(n))
|
|
3768
|
+
return `[${n.map((t) => oe(t)).join(",")}]`;
|
|
3769
|
+
if (!n || typeof n != "object")
|
|
3770
|
+
return JSON.stringify(n);
|
|
3771
|
+
const e = n;
|
|
3772
|
+
return `{${Se(e).map(
|
|
3773
|
+
(t) => `${JSON.stringify(t)}:${oe(e[t])}`
|
|
3774
|
+
).join(",")}}`;
|
|
3775
|
+
}
|
|
3776
|
+
function Me(n) {
|
|
3777
|
+
return `/contracts/${W(n)}`;
|
|
3778
|
+
}
|
|
3779
|
+
function $e(n, e) {
|
|
3780
|
+
const t = structuredClone(n);
|
|
3781
|
+
return delete t[e], t;
|
|
3782
|
+
}
|
|
3783
|
+
function fn(n) {
|
|
3784
|
+
const e = n.key.toLowerCase(), t = (n.type ?? "").toLowerCase();
|
|
3785
|
+
return n.kind === "channel" ? "participants" : e.includes("ai") || t.includes("/ai") || e.includes("llm") ? "ai" : t.startsWith("paynote/") ? "paynote" : e.includes("payment") || e.includes("reserve") || e.includes("release") || e.includes("capture") || e.includes("voucher") ? "payments" : n.kind === "operation" || n.kind === "operationImpl" || n.kind === "workflow" || n.kind === "policy" ? "logic" : "misc";
|
|
3786
|
+
}
|
|
3787
|
+
function gn(n, e) {
|
|
3788
|
+
return e ? fn(e) : n.toLowerCase().includes("channel") ? "participants" : "misc";
|
|
3789
|
+
}
|
|
3790
|
+
function xe(n) {
|
|
3791
|
+
const e = {};
|
|
3792
|
+
for (const t of n)
|
|
3793
|
+
e[t.key] = t;
|
|
3794
|
+
return e;
|
|
3795
|
+
}
|
|
3796
|
+
function yn(n, e, t) {
|
|
3797
|
+
const s = e?.sectionKeys ?? [];
|
|
3798
|
+
if (s.length > 0)
|
|
3799
|
+
return [...s].sort(
|
|
3800
|
+
(i, o) => i.localeCompare(o)
|
|
3801
|
+
)[0];
|
|
3802
|
+
const r = n?.sectionKeys ?? [];
|
|
3803
|
+
return r.length > 0 ? [...r].sort(
|
|
3804
|
+
(i, o) => i.localeCompare(o)
|
|
3805
|
+
)[0] : t;
|
|
3806
|
+
}
|
|
3807
|
+
function Cn(n, e) {
|
|
3808
|
+
const t = L(n), s = L(e), r = $e(t, "contracts"), i = $e(s, "contracts");
|
|
3809
|
+
return Qe(r, i);
|
|
3810
|
+
}
|
|
3811
|
+
function vn(n, e) {
|
|
3812
|
+
const t = L(n), s = L(e), r = G(t.contracts) ?? {}, i = G(s.contracts) ?? {}, o = [
|
|
3813
|
+
.../* @__PURE__ */ new Set([
|
|
3814
|
+
...Se(r),
|
|
3815
|
+
...Se(i)
|
|
3816
|
+
])
|
|
3817
|
+
].sort((l, a) => l.localeCompare(a)), c = J.from(t), h = J.from(s), p = xe(c.contracts), g = xe(h.contracts), k = [];
|
|
3818
|
+
for (const l of o) {
|
|
3819
|
+
const a = G(
|
|
3820
|
+
r[l]
|
|
3821
|
+
), d = G(
|
|
3822
|
+
i[l]
|
|
3823
|
+
), O = p[l], w = g[l], E = gn(l, w ?? O), b = yn(O, w, E);
|
|
3824
|
+
if (!a && d) {
|
|
3825
|
+
k.push({
|
|
3826
|
+
op: "add",
|
|
3827
|
+
key: l,
|
|
3828
|
+
contractKey: l,
|
|
3829
|
+
bucket: E,
|
|
3830
|
+
sectionKey: b,
|
|
3831
|
+
contract: structuredClone(d),
|
|
3832
|
+
after: structuredClone(d),
|
|
3833
|
+
afterFingerprint: w?.fingerprint
|
|
3834
|
+
});
|
|
3835
|
+
continue;
|
|
3836
|
+
}
|
|
3837
|
+
if (a && !d) {
|
|
3838
|
+
k.push({
|
|
3839
|
+
op: "remove",
|
|
3840
|
+
key: l,
|
|
3841
|
+
contractKey: l,
|
|
3842
|
+
bucket: E,
|
|
3843
|
+
sectionKey: b,
|
|
3844
|
+
contract: structuredClone(a),
|
|
3845
|
+
before: structuredClone(a),
|
|
3846
|
+
beforeFingerprint: O?.fingerprint
|
|
3847
|
+
});
|
|
3848
|
+
continue;
|
|
3849
|
+
}
|
|
3850
|
+
!a || !d || oe(a) !== oe(d) && k.push({
|
|
3851
|
+
op: "replace",
|
|
3852
|
+
key: l,
|
|
3853
|
+
contractKey: l,
|
|
3854
|
+
bucket: E,
|
|
3855
|
+
sectionKey: b,
|
|
3856
|
+
contract: structuredClone(d),
|
|
3857
|
+
before: structuredClone(a),
|
|
3858
|
+
after: structuredClone(d),
|
|
3859
|
+
beforeFingerprint: O?.fingerprint,
|
|
3860
|
+
afterFingerprint: w?.fingerprint
|
|
3861
|
+
});
|
|
3862
|
+
}
|
|
3863
|
+
return k.sort((l, a) => {
|
|
3864
|
+
if (l.sectionKey !== a.sectionKey)
|
|
3865
|
+
return l.sectionKey.localeCompare(a.sectionKey);
|
|
3866
|
+
if (l.contractKey !== a.contractKey)
|
|
3867
|
+
return l.contractKey.localeCompare(a.contractKey);
|
|
3868
|
+
const d = { remove: 1, add: 2, replace: 3 };
|
|
3869
|
+
return d[l.op] - d[a.op];
|
|
3870
|
+
});
|
|
3871
|
+
}
|
|
3872
|
+
function Sn(n) {
|
|
3873
|
+
const e = {};
|
|
3874
|
+
for (const t of n)
|
|
3875
|
+
e[t.sectionKey] || (e[t.sectionKey] = []), e[t.sectionKey]?.push(t);
|
|
3876
|
+
return Object.keys(e).sort((t, s) => t.localeCompare(s)).map((t) => {
|
|
3877
|
+
const s = (e[t] ?? []).sort((r, i) => {
|
|
3878
|
+
const o = r.contractKey.localeCompare(i.contractKey);
|
|
3879
|
+
if (o !== 0)
|
|
3880
|
+
return o;
|
|
3881
|
+
const c = { remove: 1, add: 2, replace: 3 };
|
|
3882
|
+
return c[r.op] - c[i.op];
|
|
3883
|
+
});
|
|
3884
|
+
return {
|
|
3885
|
+
sectionKey: t,
|
|
3886
|
+
contractKeys: [
|
|
3887
|
+
...new Set(s.map((r) => r.contractKey))
|
|
3888
|
+
].sort((r, i) => r.localeCompare(i)),
|
|
3889
|
+
changes: s
|
|
3890
|
+
};
|
|
3891
|
+
});
|
|
3892
|
+
}
|
|
3893
|
+
function kn(n) {
|
|
3894
|
+
const e = /* @__PURE__ */ new Map();
|
|
3895
|
+
for (const t of n) {
|
|
3896
|
+
const s = t.sectionKey !== t.bucket, r = s ? `section:${t.sectionKey}` : `bucket:${t.bucket}`, i = e.get(r);
|
|
3897
|
+
if (i) {
|
|
3898
|
+
i.changes.push(t);
|
|
3899
|
+
continue;
|
|
3900
|
+
}
|
|
3901
|
+
e.set(r, {
|
|
3902
|
+
key: r,
|
|
3903
|
+
title: s ? `Section ${t.sectionKey}` : `Bucket ${t.bucket}`,
|
|
3904
|
+
...s ? { sectionKey: t.sectionKey } : { bucket: t.bucket },
|
|
3905
|
+
changes: [t]
|
|
3906
|
+
});
|
|
3907
|
+
}
|
|
3908
|
+
return [...e.values()].map((t) => ({
|
|
3909
|
+
...t,
|
|
3910
|
+
changes: [...t.changes].sort(
|
|
3911
|
+
(s, r) => s.contractKey.localeCompare(r.contractKey)
|
|
3912
|
+
)
|
|
3913
|
+
})).sort((t, s) => t.key.localeCompare(s.key));
|
|
3914
|
+
}
|
|
3915
|
+
function On(n, e) {
|
|
3916
|
+
const t = [];
|
|
3917
|
+
return n.length > 0 && t.push("Root-field changes are emitted as generic patch operations."), e.length > 0 && t.push("Contract changes are emitted as whole-contract atomic units."), t;
|
|
3918
|
+
}
|
|
3919
|
+
function bn(n, e, t, s) {
|
|
3920
|
+
const r = L(n), i = L(e), o = !!G(r.contracts), c = !!G(i.contracts), h = [...t], p = s.filter(
|
|
3921
|
+
(l) => l.op === "add" || l.op === "replace"
|
|
3922
|
+
);
|
|
3923
|
+
!o && c && h.push({
|
|
3924
|
+
op: "add",
|
|
3925
|
+
path: "/contracts",
|
|
3926
|
+
val: {}
|
|
3927
|
+
});
|
|
3928
|
+
const g = s.filter((l) => l.op === "remove").sort((l, a) => l.contractKey.localeCompare(a.contractKey));
|
|
3929
|
+
for (const l of g)
|
|
3930
|
+
h.push({
|
|
3931
|
+
op: "remove",
|
|
3932
|
+
path: Me(l.contractKey)
|
|
3933
|
+
});
|
|
3934
|
+
o && !c && p.length === 0 && h.push({
|
|
3935
|
+
op: "remove",
|
|
3936
|
+
path: "/contracts"
|
|
3937
|
+
});
|
|
3938
|
+
const k = s.filter((l) => l.op !== "remove").sort((l, a) => l.contractKey.localeCompare(a.contractKey));
|
|
3939
|
+
for (const l of k) {
|
|
3940
|
+
const a = Me(l.contractKey);
|
|
3941
|
+
h.push({
|
|
3942
|
+
op: l.op,
|
|
3943
|
+
path: a,
|
|
3944
|
+
val: structuredClone(l.after ?? {})
|
|
3945
|
+
});
|
|
3946
|
+
}
|
|
3947
|
+
return h;
|
|
3948
|
+
}
|
|
3949
|
+
function q(n) {
|
|
3950
|
+
return {
|
|
3951
|
+
...n,
|
|
3952
|
+
contract: n.contract === void 0 ? void 0 : structuredClone(n.contract),
|
|
3953
|
+
before: n.before === void 0 ? void 0 : structuredClone(n.before),
|
|
3954
|
+
after: n.after === void 0 ? void 0 : structuredClone(n.after)
|
|
3955
|
+
};
|
|
3956
|
+
}
|
|
3957
|
+
function ne(n) {
|
|
3958
|
+
return n.op === "remove" ? { ...n } : {
|
|
3959
|
+
...n,
|
|
3960
|
+
val: structuredClone(n.val)
|
|
3961
|
+
};
|
|
3962
|
+
}
|
|
3963
|
+
function Be(n) {
|
|
3964
|
+
return {
|
|
3965
|
+
sectionKey: n.sectionKey,
|
|
3966
|
+
contractKeys: [...n.contractKeys],
|
|
3967
|
+
changes: n.changes.map(q)
|
|
3968
|
+
};
|
|
3969
|
+
}
|
|
3970
|
+
function je(n) {
|
|
3971
|
+
return {
|
|
3972
|
+
...n,
|
|
3973
|
+
changes: n.changes.map(q)
|
|
3974
|
+
};
|
|
3975
|
+
}
|
|
3976
|
+
class In {
|
|
3977
|
+
rootChanges;
|
|
3978
|
+
contractChanges;
|
|
3979
|
+
sectionChanges;
|
|
3980
|
+
patchOperations;
|
|
3981
|
+
contractAdds;
|
|
3982
|
+
contractReplacements;
|
|
3983
|
+
contractRemovals;
|
|
3984
|
+
groups;
|
|
3985
|
+
notes;
|
|
3986
|
+
constructor(e) {
|
|
3987
|
+
this.rootChanges = e.rootChanges.map(ne), this.contractChanges = e.contractChanges.map(q), this.sectionChanges = e.sectionChanges.map(Be), this.patchOperations = e.patchOperations.map(ne), this.contractAdds = e.contractAdds.map(q), this.contractReplacements = e.contractReplacements.map(q), this.contractRemovals = e.contractRemovals.map(q), this.groups = e.groups.map(je), this.notes = [...e.notes];
|
|
3988
|
+
}
|
|
3989
|
+
toSummaryJson() {
|
|
3990
|
+
return {
|
|
3991
|
+
rootChanges: this.rootChanges.map(ne),
|
|
3992
|
+
contractChanges: this.contractChanges.map(q),
|
|
3993
|
+
sectionChanges: this.sectionChanges.map(Be),
|
|
3994
|
+
patchOperations: this.patchOperations.map(ne),
|
|
3995
|
+
contractAdds: this.contractAdds.map(q),
|
|
3996
|
+
contractReplacements: this.contractReplacements.map(q),
|
|
3997
|
+
contractRemovals: this.contractRemovals.map(q),
|
|
3998
|
+
groups: this.groups.map(je),
|
|
3999
|
+
notes: [...this.notes]
|
|
4000
|
+
};
|
|
4001
|
+
}
|
|
4002
|
+
toPromptText() {
|
|
4003
|
+
const e = [];
|
|
4004
|
+
e.push(`Root changes: ${this.rootChanges.length}`);
|
|
4005
|
+
for (const t of this.rootChanges)
|
|
4006
|
+
e.push(`- ${t.op} ${t.path}`);
|
|
4007
|
+
e.push(""), e.push(`Contract adds: ${this.contractAdds.length}`);
|
|
4008
|
+
for (const t of this.contractAdds)
|
|
4009
|
+
e.push(`- add ${t.contractKey} [${t.bucket}]`);
|
|
4010
|
+
e.push(""), e.push(`Contract replacements: ${this.contractReplacements.length}`);
|
|
4011
|
+
for (const t of this.contractReplacements)
|
|
4012
|
+
e.push(`- replace ${t.contractKey} [${t.bucket}]`);
|
|
4013
|
+
e.push(""), e.push(`Contract removals: ${this.contractRemovals.length}`);
|
|
4014
|
+
for (const t of this.contractRemovals)
|
|
4015
|
+
e.push(`- remove ${t.contractKey} [${t.bucket}]`);
|
|
4016
|
+
e.push(""), e.push(`Groups: ${this.groups.length}`);
|
|
4017
|
+
for (const t of this.groups)
|
|
4018
|
+
e.push(`- ${t.key}: ${t.title} (${t.changes.length})`);
|
|
4019
|
+
if (this.notes.length > 0) {
|
|
4020
|
+
e.push(""), e.push("Notes:");
|
|
4021
|
+
for (const t of this.notes)
|
|
4022
|
+
e.push(`- ${t}`);
|
|
4023
|
+
}
|
|
4024
|
+
return e.join(`
|
|
4025
|
+
`);
|
|
4026
|
+
}
|
|
4027
|
+
}
|
|
4028
|
+
function rs(n, e) {
|
|
4029
|
+
const t = L(n);
|
|
4030
|
+
for (const s of e.patchOperations) {
|
|
4031
|
+
if (s.op === "remove") {
|
|
4032
|
+
H(t, s.path);
|
|
4033
|
+
continue;
|
|
4034
|
+
}
|
|
4035
|
+
Z(t, s.path, structuredClone(s.val));
|
|
4036
|
+
}
|
|
4037
|
+
return t;
|
|
4038
|
+
}
|
|
4039
|
+
class is {
|
|
4040
|
+
static compile(e, t) {
|
|
4041
|
+
const s = Cn(e, t), r = vn(
|
|
4042
|
+
e,
|
|
4043
|
+
t
|
|
4044
|
+
), i = Sn(r), o = r.filter(
|
|
4045
|
+
(l) => l.op === "add"
|
|
4046
|
+
), c = r.filter(
|
|
4047
|
+
(l) => l.op === "replace"
|
|
4048
|
+
), h = r.filter(
|
|
4049
|
+
(l) => l.op === "remove"
|
|
4050
|
+
), p = kn(r), g = On(s, r), k = bn(
|
|
4051
|
+
e,
|
|
4052
|
+
t,
|
|
4053
|
+
s,
|
|
4054
|
+
r
|
|
4055
|
+
);
|
|
4056
|
+
return new In({
|
|
4057
|
+
rootChanges: s,
|
|
4058
|
+
contractChanges: r,
|
|
4059
|
+
sectionChanges: i,
|
|
4060
|
+
patchOperations: k,
|
|
4061
|
+
contractAdds: o,
|
|
4062
|
+
contractReplacements: c,
|
|
4063
|
+
contractRemovals: h,
|
|
4064
|
+
groups: p,
|
|
4065
|
+
notes: g
|
|
4066
|
+
});
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
function se(n) {
|
|
4070
|
+
return m(n).replace(/[^A-Za-z0-9]+/gu, " ").trim().replace(/\s+/gu, "");
|
|
4071
|
+
}
|
|
4072
|
+
function Pn(n) {
|
|
4073
|
+
const e = Number(n);
|
|
4074
|
+
if (Number.isNaN(e))
|
|
4075
|
+
throw new Error(`invalid major amount: ${n}`);
|
|
4076
|
+
return Math.round(e * 100);
|
|
4077
|
+
}
|
|
4078
|
+
function T(n, e) {
|
|
4079
|
+
const t = (s) => (Ue(
|
|
4080
|
+
s,
|
|
4081
|
+
`payNotes.${n}().${e} helper`
|
|
4082
|
+
), s);
|
|
4083
|
+
return t(n === "capture" ? e === "lock" ? "PayNote/Card Transaction Capture Lock Requested" : e === "unlock" ? "PayNote/Card Transaction Capture Unlock Requested" : "PayNote/Capture Funds Requested" : n === "reserve" ? e === "lock" ? "PayNote/Reserve Lock Requested" : e === "unlock" ? "PayNote/Reserve Unlock Requested" : "PayNote/Reserve Funds Requested" : e === "lock" ? "PayNote/Reservation Release Lock Requested" : e === "unlock" ? "PayNote/Reservation Release Unlock Requested" : "PayNote/Reservation Release Requested");
|
|
4084
|
+
}
|
|
4085
|
+
class de {
|
|
4086
|
+
constructor(e, t) {
|
|
4087
|
+
this.parent = e, this.mode = t;
|
|
4088
|
+
}
|
|
4089
|
+
lockOnInit() {
|
|
4090
|
+
return this.parent.onInit(
|
|
4091
|
+
`${this.mode}LockOnInit`,
|
|
4092
|
+
(e) => e.triggerEvent("Lock", { type: T(this.mode, "lock") })
|
|
4093
|
+
), this;
|
|
4094
|
+
}
|
|
4095
|
+
unlockOnEvent(e) {
|
|
4096
|
+
const t = se(e);
|
|
4097
|
+
return this.parent.onEvent(
|
|
4098
|
+
`${this.mode}UnlockOn${t}`,
|
|
4099
|
+
e,
|
|
4100
|
+
(s) => s.triggerEvent("Unlock", { type: T(this.mode, "unlock") })
|
|
4101
|
+
), this;
|
|
4102
|
+
}
|
|
4103
|
+
requestOnInit() {
|
|
4104
|
+
return this.parent.onInit(
|
|
4105
|
+
`${this.mode}RequestOnInit`,
|
|
4106
|
+
(e) => e.triggerEvent("Request", {
|
|
4107
|
+
type: T(this.mode, "request"),
|
|
4108
|
+
amount: "${document('/amount/total')}"
|
|
4109
|
+
})
|
|
4110
|
+
), this;
|
|
4111
|
+
}
|
|
4112
|
+
requestPartialOnOperation(e, t, s, r) {
|
|
4113
|
+
return this.parent.operationTrigger(
|
|
4114
|
+
e,
|
|
4115
|
+
t,
|
|
4116
|
+
void 0,
|
|
4117
|
+
r,
|
|
4118
|
+
{
|
|
4119
|
+
type: T(this.mode, "request"),
|
|
4120
|
+
amount: u.expr(s)
|
|
4121
|
+
}
|
|
4122
|
+
), this;
|
|
4123
|
+
}
|
|
4124
|
+
unlockOnOperation(e, t, s, r) {
|
|
4125
|
+
return this.parent.operationTrigger(
|
|
4126
|
+
e,
|
|
4127
|
+
t,
|
|
4128
|
+
void 0,
|
|
4129
|
+
s,
|
|
4130
|
+
{
|
|
4131
|
+
type: T(this.mode, "unlock")
|
|
4132
|
+
},
|
|
4133
|
+
r
|
|
4134
|
+
), this;
|
|
4135
|
+
}
|
|
4136
|
+
requestOnOperation(e, t, s, r) {
|
|
4137
|
+
return this.parent.operationTrigger(
|
|
4138
|
+
e,
|
|
4139
|
+
t,
|
|
4140
|
+
void 0,
|
|
4141
|
+
s,
|
|
4142
|
+
{
|
|
4143
|
+
type: T(this.mode, "request"),
|
|
4144
|
+
amount: "${document('/amount/total')}"
|
|
4145
|
+
},
|
|
4146
|
+
r
|
|
4147
|
+
), this;
|
|
4148
|
+
}
|
|
4149
|
+
unlockOnDocPathChange(e) {
|
|
4150
|
+
return this.parent.onDocChange(
|
|
4151
|
+
`${this.mode}UnlockOnPath${se(e)}`,
|
|
4152
|
+
e,
|
|
4153
|
+
(t) => t.triggerEvent("Unlock", { type: T(this.mode, "unlock") })
|
|
4154
|
+
), this;
|
|
4155
|
+
}
|
|
4156
|
+
requestOnDocPathChange(e) {
|
|
4157
|
+
return this.parent.onDocChange(
|
|
4158
|
+
`${this.mode}RequestOnPath${se(e)}`,
|
|
4159
|
+
e,
|
|
4160
|
+
(t) => t.triggerEvent("Request", {
|
|
4161
|
+
type: T(this.mode, "request"),
|
|
4162
|
+
amount: "${document('/amount/total')}"
|
|
4163
|
+
})
|
|
4164
|
+
), this;
|
|
4165
|
+
}
|
|
4166
|
+
requestOnEvent(e) {
|
|
4167
|
+
const t = se(e);
|
|
4168
|
+
return this.parent.onEvent(
|
|
4169
|
+
`${this.mode}RequestOn${t}`,
|
|
4170
|
+
e,
|
|
4171
|
+
(s) => s.triggerEvent("Request", {
|
|
4172
|
+
type: T(this.mode, "request"),
|
|
4173
|
+
amount: "${document('/amount/total')}"
|
|
4174
|
+
})
|
|
4175
|
+
), this;
|
|
4176
|
+
}
|
|
4177
|
+
done() {
|
|
4178
|
+
return this.parent;
|
|
4179
|
+
}
|
|
4180
|
+
}
|
|
4181
|
+
class be extends u {
|
|
4182
|
+
constructor(e) {
|
|
4183
|
+
super(), this.name(e).type("PayNote/PayNote"), this.channel("payerChannel", {
|
|
4184
|
+
type: "MyOS/MyOS Timeline Channel"
|
|
4185
|
+
}), this.channel("payeeChannel", {
|
|
4186
|
+
type: "MyOS/MyOS Timeline Channel"
|
|
4187
|
+
}), this.channel("guarantorChannel", {
|
|
4188
|
+
type: "MyOS/MyOS Timeline Channel"
|
|
4189
|
+
});
|
|
4190
|
+
}
|
|
4191
|
+
static create(e) {
|
|
4192
|
+
return new be(e);
|
|
4193
|
+
}
|
|
4194
|
+
currency(e) {
|
|
4195
|
+
return this.field("/currency", e), this;
|
|
4196
|
+
}
|
|
4197
|
+
amountMinor(e) {
|
|
4198
|
+
return this.field("/amount/total", e), this;
|
|
4199
|
+
}
|
|
4200
|
+
amountMajor(e) {
|
|
4201
|
+
return this.field("/amount/total", Pn(e)), this;
|
|
4202
|
+
}
|
|
4203
|
+
capture() {
|
|
4204
|
+
return new de(this, "capture");
|
|
4205
|
+
}
|
|
4206
|
+
reserve() {
|
|
4207
|
+
return new de(this, "reserve");
|
|
4208
|
+
}
|
|
4209
|
+
release() {
|
|
4210
|
+
return new de(this, "release");
|
|
4211
|
+
}
|
|
4212
|
+
operationTrigger(e, t, s, r, i, o) {
|
|
4213
|
+
const c = this.operation(e).channel(t);
|
|
4214
|
+
r && c.description(r), s && c.request(s), c.steps((h) => {
|
|
4215
|
+
h.triggerEvent("Trigger", i), o?.(h);
|
|
4216
|
+
}).done();
|
|
4217
|
+
}
|
|
4218
|
+
}
|
|
4219
|
+
class I {
|
|
4220
|
+
static payNote(e) {
|
|
4221
|
+
return be.create(e);
|
|
4222
|
+
}
|
|
4223
|
+
}
|
|
4224
|
+
function qn() {
|
|
4225
|
+
return y.doc().name("Simple Permission Agent").description("Requests read access to provider session on init.").channel("ownerChannel").myOsAdmin("myOsAdminChannel").field("/providerSessionId", "session-abc-123").onInit(
|
|
4226
|
+
"requestProviderAccess",
|
|
4227
|
+
(n) => n.myOs().requestSingleDocPermission(
|
|
4228
|
+
"ownerChannel",
|
|
4229
|
+
"REQ_PROVIDER",
|
|
4230
|
+
u.expr("document('/providerSessionId')"),
|
|
4231
|
+
{ read: !0, singleOps: ["getStatus"] }
|
|
4232
|
+
)
|
|
4233
|
+
).onMyOsResponse(
|
|
4234
|
+
"onProviderAccessGranted",
|
|
4235
|
+
"MyOS/Single Document Permission Granted",
|
|
4236
|
+
"REQ_PROVIDER",
|
|
4237
|
+
(n) => n.myOs().subscribeToSession(
|
|
4238
|
+
u.expr("document('/providerSessionId')"),
|
|
4239
|
+
"SUB_PROVIDER"
|
|
4240
|
+
).replaceValue("MarkReady", "/status", "ready")
|
|
4241
|
+
).buildDocument();
|
|
4242
|
+
}
|
|
4243
|
+
function An() {
|
|
4244
|
+
return y.doc().name("Collaboration Setup Agent").description("Adds Bob as participant and marks setup progress.").channel("aliceChannel").myOsAdmin("myOsAdminChannel").onInit(
|
|
4245
|
+
"addBob",
|
|
4246
|
+
(n) => n.myOs().addParticipant("bobChannel", "bob@gmail.com")
|
|
4247
|
+
).onEvent(
|
|
4248
|
+
"onBobAdded",
|
|
4249
|
+
"MyOS/Adding Participant Requested",
|
|
4250
|
+
(n) => n.replaceValue("MarkBobAdded", "/participants/bob", "added")
|
|
4251
|
+
).onEvent(
|
|
4252
|
+
"onEpochAdvanced",
|
|
4253
|
+
"MyOS/Session Epoch Advanced",
|
|
4254
|
+
(n) => n.replaceValue("Activate", "/status", "active")
|
|
4255
|
+
).buildDocument();
|
|
4256
|
+
}
|
|
4257
|
+
function Rn() {
|
|
4258
|
+
return y.doc().name("Remote Operation Caller").description("Calls operation on linked session when /trigger changes.").channel("ownerChannel").myOsAdmin("myOsAdminChannel").field("/linkedSessionId", "session-xyz-789").onDocChange(
|
|
4259
|
+
"onTriggerChanged",
|
|
4260
|
+
"/trigger",
|
|
4261
|
+
(n) => n.myOs().callOperation(
|
|
4262
|
+
"ownerChannel",
|
|
4263
|
+
u.expr("document('/linkedSessionId')"),
|
|
4264
|
+
"processData"
|
|
4265
|
+
)
|
|
4266
|
+
).onEvent(
|
|
4267
|
+
"onCallQueued",
|
|
4268
|
+
"MyOS/Call Operation Requested",
|
|
4269
|
+
(n) => n.replaceValue("MarkQueued", "/remoteCallStatus", "queued")
|
|
4270
|
+
).buildDocument();
|
|
4271
|
+
}
|
|
4272
|
+
function Tn() {
|
|
4273
|
+
return y.doc().name("CV Classifier Agent").description("Classifies linked CVs via llm-provider.").channel("recruitmentChannel").myOsAdmin("myOsAdminChannel").field("/llmProviderSessionId", "session-llm-001").field("/recruitmentSessionId", "session-recruitment-001").field("/cvSubscriptionId", "SUB_CV_UPDATES").onInit(
|
|
4274
|
+
"requestAccess",
|
|
4275
|
+
(n) => n.myOs().requestSingleDocPermission(
|
|
4276
|
+
"recruitmentChannel",
|
|
4277
|
+
"REQ_RECRUITMENT_PROVIDER",
|
|
4278
|
+
u.expr("document('/llmProviderSessionId')"),
|
|
4279
|
+
{ read: !0, singleOps: ["provideInstructions"] }
|
|
4280
|
+
).myOs().requestLinkedDocsPermission(
|
|
4281
|
+
"recruitmentChannel",
|
|
4282
|
+
"REQ_RECRUITMENT_CVS",
|
|
4283
|
+
u.expr("document('/recruitmentSessionId')"),
|
|
4284
|
+
{ cvs: { read: !0, allOps: !0 } }
|
|
4285
|
+
)
|
|
4286
|
+
).onMyOsResponse(
|
|
4287
|
+
"onLlmProviderAccessGranted",
|
|
4288
|
+
"MyOS/Single Document Permission Granted",
|
|
4289
|
+
"REQ_RECRUITMENT_PROVIDER",
|
|
4290
|
+
(n) => n.myOs().subscribeToSession(
|
|
4291
|
+
u.expr("document('/llmProviderSessionId')"),
|
|
4292
|
+
"SUB_RECRUITMENT_PROVIDER"
|
|
4293
|
+
)
|
|
4294
|
+
).buildDocument();
|
|
4295
|
+
}
|
|
4296
|
+
function wn() {
|
|
4297
|
+
return u.doc().name("Procurement Orchestrator").description(
|
|
4298
|
+
"Accesses catalog data and starts worker sessions through agency."
|
|
4299
|
+
).section("participants", "Participants", "User-facing channels").channel("userChannel").endSection().section("state", "State", "Session references and tracking").field("/catalogSessionId", "session-catalog-001").field("/plannerSessionId", "session-planner-001").field("/currentTask", "").field("/negotiations/count", 0).endSection().section("capabilities", "Capabilities", "Access + AI + agency").access("catalog").targetSessionId(u.expr("document('/catalogSessionId')")).onBehalfOf("userChannel").read(!0).operations("search", "getDetails").requestPermissionOnInit().subscribeAfterGranted().statusPath("/catalog/status").done().ai("planner").sessionId(u.expr("document('/plannerSessionId')")).permissionFrom("userChannel").task("findBestDeal").instruction("Find the best deal across catalog results.").expects("Conversation/Event").done().done().agency("procurement").onBehalfOf("userChannel").allowedTypes("MyOS/MyOS Admin Base").allowedOperations("proposeOffer", "accept", "reject").requestPermissionOnInit().statusPath("/agency/status").done().endSection().section("workflow", "Workflow", "Find, analyze, negotiate").operation("findAndBuy").channel("userChannel").requestType(String).description("Find and buy a product").steps(
|
|
4300
|
+
(n) => n.replaceExpression("SaveTask", "/currentTask", "event.message.request").myOs().callOperation(
|
|
4301
|
+
"userChannel",
|
|
4302
|
+
u.expr("document('/catalogSessionId')"),
|
|
4303
|
+
"search",
|
|
4304
|
+
u.expr("event.message.request")
|
|
4305
|
+
)
|
|
4306
|
+
).done().onCallResponse(
|
|
4307
|
+
"catalog",
|
|
4308
|
+
"onSearchResults",
|
|
4309
|
+
(n) => n.replaceExpression(
|
|
4310
|
+
"SaveResults",
|
|
4311
|
+
"/catalog/lastResults",
|
|
4312
|
+
"event.message.response"
|
|
4313
|
+
).askAI(
|
|
4314
|
+
"planner",
|
|
4315
|
+
"Analyze",
|
|
4316
|
+
(e) => e.task("findBestDeal").instruction("Results: ${document('/catalog/lastResults')}").instruction("User wants: ${document('/currentTask')}")
|
|
4317
|
+
)
|
|
4318
|
+
).onAINamedResponse(
|
|
4319
|
+
"planner",
|
|
4320
|
+
"onDealFound",
|
|
4321
|
+
"deal-found",
|
|
4322
|
+
(n) => n.replaceExpression("SaveDeal", "/lastDeal", "event.update.payload").viaAgency("procurement").startSessionWith(
|
|
4323
|
+
"userChannel",
|
|
4324
|
+
u.doc().name("Auto-Purchase").channel("buyerChannel").channel("sellerChannel").field("/maxPrice", u.expr("event.update.payload.price")).buildJson(),
|
|
4325
|
+
(e) => e.bind("sellerChannel", {
|
|
4326
|
+
accountId: "event.update.payload.vendorEmail"
|
|
4327
|
+
}).bind("buyerChannel", { accountId: "userChannel" }),
|
|
4328
|
+
(e) => e.defaultMessage("Purchase negotiation started.")
|
|
4329
|
+
)
|
|
4330
|
+
).onSessionStarted(
|
|
4331
|
+
"procurement",
|
|
4332
|
+
"onNegotiationStarted",
|
|
4333
|
+
(n) => n.replaceExpression(
|
|
4334
|
+
"Track",
|
|
4335
|
+
"/negotiations/count",
|
|
4336
|
+
"document('/negotiations/count') + 1"
|
|
4337
|
+
)
|
|
4338
|
+
).endSection().buildDocument();
|
|
4339
|
+
}
|
|
4340
|
+
function En() {
|
|
4341
|
+
return u.doc().name("Linked Access Monitor").channel("ownerChannel").field("/projectSessionId", "session-project-99").accessLinked("projectData").targetSessionId(u.expr("document('/projectSessionId')")).onBehalfOf("ownerChannel").link("invoices").read(!0).operations("list", "get").done().link("shipments").read(!0).operations("track").done().statusPath("/projectData/status").done().onLinkedAccessGranted(
|
|
4342
|
+
"projectData",
|
|
4343
|
+
"onLinkedGranted",
|
|
4344
|
+
(n) => n.replaceValue("MarkReady", "/projectData/ready", !0)
|
|
4345
|
+
).buildDocument();
|
|
4346
|
+
}
|
|
4347
|
+
function Vn() {
|
|
4348
|
+
return y.doc().name("Weather Monitor Agent").description("Requests access and subscribes to a provider session.").channel("ownerChannel").myOsAdmin("myOsAdminChannel").field("/weatherSessionId", "session-weather-prod").field("/status", "initializing").onInit(
|
|
4349
|
+
"requestWeatherAccess",
|
|
4350
|
+
(n) => n.myOs().requestSingleDocPermission(
|
|
4351
|
+
"ownerChannel",
|
|
4352
|
+
"REQ_WEATHER",
|
|
4353
|
+
u.expr("document('/weatherSessionId')"),
|
|
4354
|
+
{ read: !0 }
|
|
4355
|
+
)
|
|
4356
|
+
).onMyOsResponse(
|
|
4357
|
+
"onWeatherAccessGranted",
|
|
4358
|
+
"MyOS/Single Document Permission Granted",
|
|
4359
|
+
"REQ_WEATHER",
|
|
4360
|
+
(n) => n.myOs().subscribeToSession(
|
|
4361
|
+
u.expr("document('/weatherSessionId')"),
|
|
4362
|
+
"SUB_WEATHER"
|
|
4363
|
+
).replaceValue("MarkSubscribing", "/status", "subscribing")
|
|
4364
|
+
).onSubscriptionUpdate(
|
|
4365
|
+
"onWeatherReady",
|
|
4366
|
+
"SUB_WEATHER",
|
|
4367
|
+
"MyOS/Subscription to Session Initiated",
|
|
4368
|
+
(n) => n.replaceValue("MarkReady", "/status", "monitoring")
|
|
4369
|
+
).buildDocument();
|
|
4370
|
+
}
|
|
4371
|
+
function Dn() {
|
|
4372
|
+
return y.doc().name("Data Analyzer Agent").description("Calls a provider operation after permission is granted.").channel("ownerChannel").myOsAdmin("myOsAdminChannel").field("/llmSessionId", "session-llm-prod").field("/analysisStatus", "idle").onInit(
|
|
4373
|
+
"requestLlmAccess",
|
|
4374
|
+
(n) => n.myOs().requestSingleDocPermission(
|
|
4375
|
+
"ownerChannel",
|
|
4376
|
+
"REQ_LLM",
|
|
4377
|
+
u.expr("document('/llmSessionId')"),
|
|
4378
|
+
{ read: !0, singleOps: ["provideInstructions"] }
|
|
4379
|
+
)
|
|
4380
|
+
).onMyOsResponse(
|
|
4381
|
+
"onLlmAccessGranted",
|
|
4382
|
+
"MyOS/Single Document Permission Granted",
|
|
4383
|
+
"REQ_LLM",
|
|
4384
|
+
(n) => n.myOs().subscribeToSession(
|
|
4385
|
+
u.expr("document('/llmSessionId')"),
|
|
4386
|
+
"SUB_LLM_PROVIDER"
|
|
4387
|
+
)
|
|
4388
|
+
).operation("analyze").channel("ownerChannel").description("Analyze input with remote provider.").steps(
|
|
4389
|
+
(n) => n.replaceValue("MarkAnalyzing", "/analysisStatus", "analyzing").myOs().callOperation(
|
|
4390
|
+
"ownerChannel",
|
|
4391
|
+
u.expr("document('/llmSessionId')"),
|
|
4392
|
+
"provideInstructions",
|
|
4393
|
+
{
|
|
4394
|
+
requestId: "REQ_ANALYZE_001",
|
|
4395
|
+
requester: "DATA_ANALYZER",
|
|
4396
|
+
instructions: "Analyze the provided input."
|
|
4397
|
+
}
|
|
4398
|
+
)
|
|
4399
|
+
).done().onEvent(
|
|
4400
|
+
"onCallResponded",
|
|
4401
|
+
"MyOS/Call Operation Responded",
|
|
4402
|
+
(n) => n.replaceValue("MarkDone", "/analysisStatus", "complete")
|
|
4403
|
+
).onEvent(
|
|
4404
|
+
"onCallFailed",
|
|
4405
|
+
"MyOS/Call Operation Failed",
|
|
4406
|
+
(n) => n.replaceValue("MarkFailed", "/analysisStatus", "failed")
|
|
4407
|
+
).buildDocument();
|
|
4408
|
+
}
|
|
4409
|
+
function Mn() {
|
|
4410
|
+
return y.doc().name("Team Setup Agent").description("Adds participants and marks setup progress.").channel("managerChannel").myOsAdmin("myOsAdminChannel").field("/status", "setting-up").onInit(
|
|
4411
|
+
"addTeamMembers",
|
|
4412
|
+
(n) => n.myOs().addParticipant("aliceChannel", "alice@company.com").myOs().addParticipant("bobChannel", "bob@company.com")
|
|
4413
|
+
).onEvent(
|
|
4414
|
+
"onParticipantAdded",
|
|
4415
|
+
"MyOS/Adding Participant Responded",
|
|
4416
|
+
(n) => n.replaceValue(
|
|
4417
|
+
"MarkParticipantsAdded",
|
|
4418
|
+
"/status",
|
|
4419
|
+
"participants-added"
|
|
4420
|
+
)
|
|
4421
|
+
).onEvent(
|
|
4422
|
+
"onEpochAdvanced",
|
|
4423
|
+
"MyOS/Session Epoch Advanced",
|
|
4424
|
+
(n) => n.replaceValue("MarkReady", "/status", "ready")
|
|
4425
|
+
).buildDocument();
|
|
4426
|
+
}
|
|
4427
|
+
function $n() {
|
|
4428
|
+
return y.doc().name("Invoice Monitor Agent").description("Requests linked-docs permission and tracks invoice totals.").channel("accountingChannel").myOsAdmin("myOsAdminChannel").field("/projectSessionId", "session-project-42").field("/invoiceSubscriptionId", "SUB_INVOICES").field("/totalInvoiced", 0).onInit(
|
|
4429
|
+
"requestInvoiceAccess",
|
|
4430
|
+
(n) => n.myOs().requestLinkedDocsPermission(
|
|
4431
|
+
"accountingChannel",
|
|
4432
|
+
"REQ_INVOICES",
|
|
4433
|
+
u.expr("document('/projectSessionId')"),
|
|
4434
|
+
{ invoices: { read: !0, allOps: !0 } }
|
|
4435
|
+
)
|
|
4436
|
+
).onMyOsResponse(
|
|
4437
|
+
"onInvoiceAccessGranted",
|
|
4438
|
+
"MyOS/Linked Documents Permission Granted",
|
|
4439
|
+
"REQ_INVOICES",
|
|
4440
|
+
(n) => n.myOs().subscribeToSession(
|
|
4441
|
+
u.expr("event.targetSessionId"),
|
|
4442
|
+
u.expr("document('/invoiceSubscriptionId')")
|
|
4443
|
+
)
|
|
4444
|
+
).onSubscriptionUpdate(
|
|
4445
|
+
"onInvoiceUpdate",
|
|
4446
|
+
"SUB_INVOICES",
|
|
4447
|
+
(n) => n.jsRaw(
|
|
4448
|
+
"ProcessInvoiceUpdate",
|
|
4449
|
+
"const amount = Number(event.update?.amount ?? 0); const current = Number(document('/totalInvoiced') ?? 0); return { changeset: [{ op:'replace', path:'/totalInvoiced', val: current + amount }] };"
|
|
4450
|
+
).updateDocumentFromExpression(
|
|
4451
|
+
"PersistInvoiceTotal",
|
|
4452
|
+
"steps.ProcessInvoiceUpdate.changeset"
|
|
4453
|
+
)
|
|
4454
|
+
).buildDocument();
|
|
4455
|
+
}
|
|
4456
|
+
function xn() {
|
|
4457
|
+
return y.doc().name("Recruitment Classifier").description(
|
|
4458
|
+
"Requests access, subscribes, and invokes provider classification."
|
|
4459
|
+
).channel("recruitmentChannel").myOsAdmin("myOsAdminChannel").field("/recruitmentSessionId", "session-recruitment-001").field("/llmProviderSessionId", "session-llm-001").field("/cvSubscriptionId", "SUB_RECRUITMENT_CVS").onInit(
|
|
4460
|
+
"requestAccess",
|
|
4461
|
+
(n) => n.myOs().requestSingleDocPermission(
|
|
4462
|
+
"recruitmentChannel",
|
|
4463
|
+
"REQ_RECRUITMENT_PROVIDER",
|
|
4464
|
+
u.expr("document('/llmProviderSessionId')"),
|
|
4465
|
+
{ read: !0, singleOps: ["provideInstructions"] }
|
|
4466
|
+
).myOs().requestLinkedDocsPermission(
|
|
4467
|
+
"recruitmentChannel",
|
|
4468
|
+
"REQ_RECRUITMENT_CVS",
|
|
4469
|
+
u.expr("document('/recruitmentSessionId')"),
|
|
4470
|
+
{ cvs: { read: !0, allOps: !0 } }
|
|
4471
|
+
)
|
|
4472
|
+
).onMyOsResponse(
|
|
4473
|
+
"onCvAccessGranted",
|
|
4474
|
+
"MyOS/Linked Documents Permission Granted",
|
|
4475
|
+
"REQ_RECRUITMENT_CVS",
|
|
4476
|
+
(n) => n.myOs().subscribeToSession(
|
|
4477
|
+
u.expr("event.targetSessionId"),
|
|
4478
|
+
u.expr("document('/cvSubscriptionId')")
|
|
4479
|
+
)
|
|
4480
|
+
).onMyOsResponse(
|
|
4481
|
+
"onLlmProviderAccessGranted",
|
|
4482
|
+
"MyOS/Single Document Permission Granted",
|
|
4483
|
+
"REQ_RECRUITMENT_PROVIDER",
|
|
4484
|
+
(n) => n.myOs().subscribeToSession(
|
|
4485
|
+
u.expr("document('/llmProviderSessionId')"),
|
|
4486
|
+
"SUB_RECRUITMENT_PROVIDER"
|
|
4487
|
+
)
|
|
4488
|
+
).onSubscriptionUpdate(
|
|
4489
|
+
"onCvArrived",
|
|
4490
|
+
"SUB_RECRUITMENT_CVS",
|
|
4491
|
+
(n) => n.myOs().callOperation(
|
|
4492
|
+
"recruitmentChannel",
|
|
4493
|
+
u.expr("document('/llmProviderSessionId')"),
|
|
4494
|
+
"provideInstructions",
|
|
4495
|
+
{
|
|
4496
|
+
requestId: "REQ_CV_CLASSIFY",
|
|
4497
|
+
requester: "RECRUITMENT_CLASSIFIER",
|
|
4498
|
+
instructions: "Classify candidate seniority based on CV update."
|
|
4499
|
+
}
|
|
4500
|
+
)
|
|
4501
|
+
).onSubscriptionUpdate(
|
|
4502
|
+
"onClassificationResult",
|
|
4503
|
+
"SUB_RECRUITMENT_PROVIDER",
|
|
4504
|
+
"Conversation/Response",
|
|
4505
|
+
(n) => n.jsRaw(
|
|
4506
|
+
"ProcessResult",
|
|
4507
|
+
"const response = event.update ?? {}; const requestId = response.inResponseTo?.requestId ?? 'unknown'; return { changeset: [{ op:'replace', path:'/lastClassificationRequestId', val: requestId }] };"
|
|
4508
|
+
).updateDocumentFromExpression(
|
|
4509
|
+
"PersistResult",
|
|
4510
|
+
"steps.ProcessResult.changeset"
|
|
4511
|
+
)
|
|
4512
|
+
).buildDocument();
|
|
4513
|
+
}
|
|
4514
|
+
function Bn() {
|
|
4515
|
+
return u.doc().name("Access + Agency Orchestrator").description("Uses access(), ai(), and agency() together in one flow.").channel("userChannel").field("/catalogSessionId", "session-catalog-007").field("/plannerSessionId", "session-planner-007").field("/lastDeal", {}).access("catalog").targetSessionId(u.expr("document('/catalogSessionId')")).onBehalfOf("userChannel").read(!0).operations("search", "getDetails").subscribeAfterGranted().statusPath("/catalog/status").done().ai("planner").sessionId(u.expr("document('/plannerSessionId')")).permissionFrom("userChannel").task("findDeal").instruction("Find the best deal from provided catalog results.").expects("Conversation/Event").done().done().agency("procurement").onBehalfOf("userChannel").allowedTypes("MyOS/MyOS Admin Base").allowedOperations("proposeOffer", "accept").statusPath("/agency/status").done().operation("findAndStart").channel("userChannel").requestType(String).description("Search catalog and start worker session for negotiation.").steps(
|
|
4516
|
+
(n) => n.myOs().callOperation(
|
|
4517
|
+
"userChannel",
|
|
4518
|
+
u.expr("document('/catalogSessionId')"),
|
|
4519
|
+
"search",
|
|
4520
|
+
u.expr("event.message.request")
|
|
4521
|
+
)
|
|
4522
|
+
).done().onCallResponse(
|
|
4523
|
+
"catalog",
|
|
4524
|
+
"onCatalogResults",
|
|
4525
|
+
(n) => n.replaceExpression(
|
|
4526
|
+
"SaveResults",
|
|
4527
|
+
"/catalog/results",
|
|
4528
|
+
"event.message.response"
|
|
4529
|
+
).askAI(
|
|
4530
|
+
"planner",
|
|
4531
|
+
"Analyze",
|
|
4532
|
+
(e) => e.task("findDeal").instruction("Catalog results: ${document('/catalog/results')}")
|
|
4533
|
+
)
|
|
4534
|
+
).onAINamedResponse(
|
|
4535
|
+
"planner",
|
|
4536
|
+
"onDealFound",
|
|
4537
|
+
"deal-found",
|
|
4538
|
+
(n) => n.replaceExpression("StoreDeal", "/lastDeal", "event.update.payload").viaAgency("procurement").startSessionWith(
|
|
4539
|
+
"userChannel",
|
|
4540
|
+
u.doc().name("Negotiation").channel("buyerChannel").channel("sellerChannel").field(
|
|
4541
|
+
"/targetPrice",
|
|
4542
|
+
u.expr("event.update.payload.price")
|
|
4543
|
+
).buildJson(),
|
|
4544
|
+
(e) => e.bind("buyerChannel", { accountId: "userChannel" }).bind("sellerChannel", {
|
|
4545
|
+
accountId: "event.update.payload.vendorEmail"
|
|
4546
|
+
})
|
|
4547
|
+
)
|
|
4548
|
+
).onSessionStarted(
|
|
4549
|
+
"procurement",
|
|
4550
|
+
"onSessionStarted",
|
|
4551
|
+
(n) => n.replaceValue("MarkStarted", "/negotiation/status", "started")
|
|
4552
|
+
).buildDocument();
|
|
4553
|
+
}
|
|
4554
|
+
function jn() {
|
|
4555
|
+
return u.doc().name("Linked Access Permissions").description("Shows accessLinked() with multiple link permission blocks.").channel("ownerChannel").field("/projectSessionId", "session-project-88").accessLinked("projectData").targetSessionId(u.expr("document('/projectSessionId')")).onBehalfOf("ownerChannel").statusPath("/projectData/status").link("invoices").read(!0).operations("list", "get").done().link("shipments").read(!0).operations("track").done().done().onLinkedAccessGranted(
|
|
4556
|
+
"projectData",
|
|
4557
|
+
"onProjectDataGranted",
|
|
4558
|
+
(n) => n.replaceValue("MarkGranted", "/projectData/granted", !0)
|
|
4559
|
+
).onLinkedAccessRevoked(
|
|
4560
|
+
"projectData",
|
|
4561
|
+
"onProjectDataRevoked",
|
|
4562
|
+
(n) => n.replaceValue("MarkRevoked", "/projectData/revoked", !0)
|
|
4563
|
+
).buildDocument();
|
|
4564
|
+
}
|
|
4565
|
+
function Ze() {
|
|
4566
|
+
return I.payNote("Balanced Bowl Voucher - 100 USD").description(
|
|
4567
|
+
"Reserve voucher budget and capture spending reported by merchant monitoring."
|
|
4568
|
+
).currency("USD").amountMinor(1e4).channel("merchantChannel", {
|
|
4569
|
+
type: "Conversation/Timeline Channel",
|
|
4570
|
+
timelineId: "merchant-timeline"
|
|
4571
|
+
}).capture().lockOnInit().unlockOnEvent("Conversation/Event").requestPartialOnOperation(
|
|
4572
|
+
"captureReportedSpend",
|
|
4573
|
+
"merchantChannel",
|
|
4574
|
+
"event.message.request.amount",
|
|
4575
|
+
"Capture reported amount."
|
|
4576
|
+
).done().onEvent(
|
|
4577
|
+
"onMonitoringApproved",
|
|
4578
|
+
"Conversation/Event",
|
|
4579
|
+
(n) => n.emitType("StartMonitoring", "Conversation/Event", (e) => {
|
|
4580
|
+
e.put("merchantId", "balanced_bowl_001"), e.put("scope", "merchant-only"), e.put("subject", "payeeChannel");
|
|
4581
|
+
})
|
|
4582
|
+
);
|
|
4583
|
+
}
|
|
4584
|
+
function He() {
|
|
4585
|
+
return Ze().buildJson();
|
|
4586
|
+
}
|
|
4587
|
+
function Nn() {
|
|
4588
|
+
return Ze().buildDocument();
|
|
4589
|
+
}
|
|
4590
|
+
function Wn() {
|
|
4591
|
+
return I.payNote("Armchair Protection + Voucher").description(
|
|
4592
|
+
"Capture unlocks after buyer satisfaction, then a voucher payment is requested."
|
|
4593
|
+
).currency("USD").amountMinor(1e4).capture().lockOnInit().unlockOnOperation(
|
|
4594
|
+
"confirmSatisfaction",
|
|
4595
|
+
"payerChannel",
|
|
4596
|
+
"Buyer confirms satisfaction.",
|
|
4597
|
+
(n) => n.emitType("SatisfactionConfirmed", "Conversation/Event")
|
|
4598
|
+
).done().onEvent(
|
|
4599
|
+
"requestVoucherPayment",
|
|
4600
|
+
"PayNote/Funds Captured",
|
|
4601
|
+
(n) => n.triggerPayment(
|
|
4602
|
+
"VoucherCredit",
|
|
4603
|
+
"Conversation/Event",
|
|
4604
|
+
(e) => e.processor("guarantorChannel").from("payeeChannel").to("payerChannel").currency("USD").amountMinor(1e4).reason("voucher-activation").attachPayNote(He())
|
|
4605
|
+
)
|
|
4606
|
+
).buildDocument();
|
|
4607
|
+
}
|
|
4608
|
+
function Ln() {
|
|
4609
|
+
return I.payNote("Shipment Escrow - Simple").description("Capture is locked until guarantor confirms delivery.").currency("USD").amountMinor(12e4).channel("shipmentCompanyChannel", {
|
|
4610
|
+
type: "Conversation/Timeline Channel",
|
|
4611
|
+
timelineId: "shipment-timeline"
|
|
4612
|
+
}).capture().lockOnInit().unlockOnOperation(
|
|
4613
|
+
"confirmDelivery",
|
|
4614
|
+
"shipmentCompanyChannel",
|
|
4615
|
+
"Shipment Company confirms delivery.",
|
|
4616
|
+
(n) => n.emitType("DeliveryConfirmed", "Conversation/Event")
|
|
4617
|
+
).done().buildDocument();
|
|
4618
|
+
}
|
|
4619
|
+
function Un() {
|
|
4620
|
+
return I.payNote("Capture Triggered From Channel Event").description(
|
|
4621
|
+
"Shipment channel emits shipment confirmation, then the document captures funds."
|
|
4622
|
+
).currency("USD").amountMinor(9e4).channel("shipmentCompanyChannel", {
|
|
4623
|
+
type: "Conversation/Timeline Channel",
|
|
4624
|
+
timelineId: "shipment-timeline"
|
|
4625
|
+
}).capture().lockOnInit().unlockOnEvent("Conversation/Event").done().onChannelEvent(
|
|
4626
|
+
"onShipmentConfirmed",
|
|
4627
|
+
"shipmentCompanyChannel",
|
|
4628
|
+
"Conversation/Event",
|
|
4629
|
+
(n) => n.emitType("DeliveryConfirmed", "Conversation/Event")
|
|
4630
|
+
).onEvent(
|
|
4631
|
+
"onDeliveryConfirmed",
|
|
4632
|
+
"Conversation/Event",
|
|
4633
|
+
(n) => n.capture().requestNow()
|
|
4634
|
+
).buildDocument();
|
|
4635
|
+
}
|
|
4636
|
+
function Fn() {
|
|
4637
|
+
return I.payNote("Capture Triggered From Document Update").description("When delivery confirmation path appears, unlock and capture.").currency("EUR").amountMinor(49900).capture().lockOnInit().unlockOnDocPathChange("/delivery/confirmedAt").done().onDocChange(
|
|
4638
|
+
"captureAfterDeliveryPathUpdate",
|
|
4639
|
+
"/delivery/confirmedAt",
|
|
4640
|
+
(n) => n.capture().requestNow()
|
|
4641
|
+
).buildDocument();
|
|
4642
|
+
}
|
|
4643
|
+
function _n() {
|
|
4644
|
+
return I.payNote("Reserve On Approval Then Capture On Confirmation").description(
|
|
4645
|
+
"Reserve unlocks when /approved changes; capture unlocks on delivery confirmation."
|
|
4646
|
+
).currency("USD").amountMinor(25e4).reserve().requestOnInit().done().onEvent(
|
|
4647
|
+
"lockCaptureWhenReserved",
|
|
4648
|
+
"PayNote/Funds Reserved",
|
|
4649
|
+
(n) => n.capture().lock()
|
|
4650
|
+
).capture().unlockOnOperation(
|
|
4651
|
+
"confirmDelivery",
|
|
4652
|
+
"payerChannel",
|
|
4653
|
+
"Payer confirms delivery."
|
|
4654
|
+
).requestOnOperation(
|
|
4655
|
+
"requestCapture",
|
|
4656
|
+
"guarantorChannel",
|
|
4657
|
+
"Request full capture after confirmation."
|
|
4658
|
+
).done().buildDocument();
|
|
4659
|
+
}
|
|
4660
|
+
function Kn() {
|
|
4661
|
+
return I.payNote("Reserve Immediately Release On Dispute").description(
|
|
4662
|
+
"Reserve on init; payer can open dispute for full reservation release."
|
|
4663
|
+
).currency("EUR").amountMinor(75e3).reserve().requestOnInit().done().capture().requestOnOperation(
|
|
4664
|
+
"capturePayment",
|
|
4665
|
+
"guarantorChannel",
|
|
4666
|
+
"Capture after service rendered."
|
|
4667
|
+
).done().release().requestOnOperation(
|
|
4668
|
+
"openDispute",
|
|
4669
|
+
"payerChannel",
|
|
4670
|
+
"Payer opens dispute for full release."
|
|
4671
|
+
).done().buildDocument();
|
|
4672
|
+
}
|
|
4673
|
+
function Gn() {
|
|
4674
|
+
return I.payNote("Milestone Reserve Partial Capture").description("Reserve full amount; guarantor approves milestone captures.").currency("USD").amountMinor(2e6).reserve().requestOnInit().done().capture().requestPartialOnOperation(
|
|
4675
|
+
"approveMilestone1",
|
|
4676
|
+
"guarantorChannel",
|
|
4677
|
+
"500000",
|
|
4678
|
+
"Approve milestone 1 (25%)"
|
|
4679
|
+
).requestPartialOnOperation(
|
|
4680
|
+
"approveMilestone2",
|
|
4681
|
+
"guarantorChannel",
|
|
4682
|
+
"500000",
|
|
4683
|
+
"Approve milestone 2 (25%)"
|
|
4684
|
+
).requestPartialOnOperation(
|
|
4685
|
+
"approveMilestone3",
|
|
4686
|
+
"guarantorChannel",
|
|
4687
|
+
"500000",
|
|
4688
|
+
"Approve milestone 3 (25%)"
|
|
4689
|
+
).requestPartialOnOperation(
|
|
4690
|
+
"approveMilestone4",
|
|
4691
|
+
"guarantorChannel",
|
|
4692
|
+
"500000",
|
|
4693
|
+
"Approve milestone 4 (25%)"
|
|
4694
|
+
).done().release().requestPartialOnOperation(
|
|
4695
|
+
"releaseUnfinishedWork",
|
|
4696
|
+
"payerChannel",
|
|
4697
|
+
"event.message.request.amount",
|
|
4698
|
+
"Release unfinished work."
|
|
4699
|
+
).done().buildDocument();
|
|
4700
|
+
}
|
|
4701
|
+
function Jn() {
|
|
4702
|
+
return I.payNote("Reserve After KYC Capture On Settlement").description(
|
|
4703
|
+
"Reserve unlocks after KYC; capture unlocks on settlement confirmation."
|
|
4704
|
+
).currency("CHF").amountMinor(5e6).reserve().requestOnInit().done().capture().lockOnInit().unlockOnDocPathChange("/settlement/confirmed").requestOnDocPathChange("/settlement/confirmed").done().release().requestOnOperation(
|
|
4705
|
+
"rejectKyc",
|
|
4706
|
+
"guarantorChannel",
|
|
4707
|
+
"Reject and release if KYC fails."
|
|
4708
|
+
).done().buildDocument();
|
|
4709
|
+
}
|
|
4710
|
+
function zn() {
|
|
4711
|
+
return I.payNote("Release Locked Until Window Opens").description(
|
|
4712
|
+
"Capture runs on init; release unlocks only after guarantor opens a window."
|
|
4713
|
+
).currency("USD").amountMinor(19900).reserve().requestOnInit().done().capture().requestOnInit().done().release().requestOnOperation(
|
|
4714
|
+
"openReleaseWindow",
|
|
4715
|
+
"guarantorChannel",
|
|
4716
|
+
"Guarantor opens release window."
|
|
4717
|
+
).requestOnOperation(
|
|
4718
|
+
"requestRelease",
|
|
4719
|
+
"payerChannel",
|
|
4720
|
+
"Payer requests full release."
|
|
4721
|
+
).done().buildDocument();
|
|
4722
|
+
}
|
|
4723
|
+
function Qn() {
|
|
4724
|
+
return I.payNote("Armchair With Voucher Bootstrap").currency("USD").amountMinor(8e4).capture().lockOnInit().unlockOnOperation(
|
|
4725
|
+
"confirmSatisfaction",
|
|
4726
|
+
"payerChannel",
|
|
4727
|
+
"Confirm armchair is satisfactory."
|
|
4728
|
+
).done().onEvent(
|
|
4729
|
+
"bootstrapVoucher",
|
|
4730
|
+
"PayNote/Funds Captured",
|
|
4731
|
+
(n) => n.myOs().bootstrapDocument(
|
|
4732
|
+
"BootstrapVoucherDoc",
|
|
4733
|
+
He(),
|
|
4734
|
+
{
|
|
4735
|
+
payerChannel: {
|
|
4736
|
+
type: "Conversation/Timeline Channel",
|
|
4737
|
+
timelineId: "voucher-payer"
|
|
4738
|
+
},
|
|
4739
|
+
payeeChannel: {
|
|
4740
|
+
type: "Conversation/Timeline Channel",
|
|
4741
|
+
timelineId: "voucher-payee"
|
|
4742
|
+
},
|
|
4743
|
+
merchantChannel: {
|
|
4744
|
+
type: "Conversation/Timeline Channel",
|
|
4745
|
+
timelineId: "voucher-payee"
|
|
4746
|
+
}
|
|
4747
|
+
},
|
|
4748
|
+
"payeeChannel"
|
|
4749
|
+
)
|
|
4750
|
+
).onMyOsResponse(
|
|
4751
|
+
"onVoucherReady",
|
|
4752
|
+
"Conversation/Document Bootstrap Completed",
|
|
4753
|
+
(n) => n.replaceExpression(
|
|
4754
|
+
"SaveSession",
|
|
4755
|
+
"/voucher/sessionId",
|
|
4756
|
+
"event.message.sessionId"
|
|
4757
|
+
).replaceValue("MarkActive", "/voucher/status", "active")
|
|
4758
|
+
).onMyOsResponse(
|
|
4759
|
+
"onVoucherFailed",
|
|
4760
|
+
"Conversation/Document Bootstrap Failed",
|
|
4761
|
+
(n) => n.replaceValue("MarkFailed", "/voucher/status", "failed")
|
|
4762
|
+
).buildDocument();
|
|
4763
|
+
}
|
|
4764
|
+
function Yn() {
|
|
4765
|
+
return y.doc().name("Orchestrated Document").channel("orchestratorChannel").channel("aliceChannel").channel("bobChannel").onInit(
|
|
4766
|
+
"bootstrapChild",
|
|
4767
|
+
(n) => n.bootstrapDocument(
|
|
4768
|
+
"BootstrapChildDoc",
|
|
4769
|
+
Hn(),
|
|
4770
|
+
{
|
|
4771
|
+
participantA: {
|
|
4772
|
+
type: "Conversation/Timeline Channel",
|
|
4773
|
+
timelineId: "alice-participant"
|
|
4774
|
+
},
|
|
4775
|
+
participantB: {
|
|
4776
|
+
type: "Conversation/Timeline Channel",
|
|
4777
|
+
timelineId: "bob-participant"
|
|
4778
|
+
}
|
|
4779
|
+
},
|
|
4780
|
+
"orchestratorChannel",
|
|
4781
|
+
(e) => {
|
|
4782
|
+
e.put("bootstrapAssignee", "orchestratorChannel"), e.put("initialMessages", {
|
|
4783
|
+
defaultMessage: "You have been added to a collaboration."
|
|
4784
|
+
});
|
|
4785
|
+
}
|
|
4786
|
+
)
|
|
4787
|
+
).onEvent(
|
|
4788
|
+
"onChildReady",
|
|
4789
|
+
"Conversation/Document Bootstrap Completed",
|
|
4790
|
+
(n) => n.replaceExpression(
|
|
4791
|
+
"SaveChild",
|
|
4792
|
+
"/child/sessionId",
|
|
4793
|
+
"event.message.sessionId"
|
|
4794
|
+
)
|
|
4795
|
+
).buildDocument();
|
|
4796
|
+
}
|
|
4797
|
+
function Zn() {
|
|
4798
|
+
return y.doc().name("With Messages").channel("sellerChannel", { type: "MyOS/MyOS Timeline Channel" }).channel("buyerChannel", { type: "MyOS/MyOS Timeline Channel" }).myOsAdmin("myOsAdminChannel").onInit(
|
|
4799
|
+
"bootstrapDeal",
|
|
4800
|
+
(n) => n.myOs().bootstrapDocument(
|
|
4801
|
+
"BootstrapDeal",
|
|
4802
|
+
Xn(),
|
|
4803
|
+
{
|
|
4804
|
+
sellerChannel: Te("sellerChannel"),
|
|
4805
|
+
buyerChannel: Te("buyerChannel")
|
|
4806
|
+
},
|
|
4807
|
+
"sellerChannel",
|
|
4808
|
+
(e) => {
|
|
4809
|
+
e.put("initialMessages", {
|
|
4810
|
+
defaultMessage: "A new deal has been created.",
|
|
4811
|
+
perChannel: {
|
|
4812
|
+
buyerChannel: "You have a new purchase to review."
|
|
4813
|
+
}
|
|
4814
|
+
});
|
|
4815
|
+
}
|
|
4816
|
+
)
|
|
4817
|
+
).buildDocument();
|
|
4818
|
+
}
|
|
4819
|
+
function Hn() {
|
|
4820
|
+
return y.doc().name("Child Collaboration").channel("participantA").channel("participantB").buildJson();
|
|
4821
|
+
}
|
|
4822
|
+
function Xn() {
|
|
4823
|
+
return y.doc().name("Deal").channel("sellerChannel").channel("buyerChannel").field("/status", "draft").buildJson();
|
|
4824
|
+
}
|
|
4825
|
+
function os() {
|
|
4826
|
+
return {
|
|
4827
|
+
simpleAgentWithPermissions: qn(),
|
|
4828
|
+
agentAddsParticipantAndWaits: An(),
|
|
4829
|
+
agentCallsRemoteOperation: Rn(),
|
|
4830
|
+
cvClassifierAgent: Tn(),
|
|
4831
|
+
orchestratorWithAccessAndAgency: wn(),
|
|
4832
|
+
linkedAccessMonitor: En(),
|
|
4833
|
+
simplePermissionAndSubscribe: Vn(),
|
|
4834
|
+
callRemoteOperation: Dn(),
|
|
4835
|
+
addParticipantsDynamically: Mn(),
|
|
4836
|
+
linkedDocsWithUpdates: $n(),
|
|
4837
|
+
cvClassifierFull: xn(),
|
|
4838
|
+
accessAndAgencyOrchestrator: Bn(),
|
|
4839
|
+
linkedAccessPermissions: jn(),
|
|
4840
|
+
bootstrapVoucherOnCapture: Qn(),
|
|
4841
|
+
bootstrapViaOrchestrator: Yn(),
|
|
4842
|
+
bootstrapWithMessages: Zn(),
|
|
4843
|
+
shipmentEscrowSimple: Ln(),
|
|
4844
|
+
captureTriggeredFromChannelEvent: Un(),
|
|
4845
|
+
captureTriggeredFromDocUpdate: Fn(),
|
|
4846
|
+
reserveOnApprovalThenCaptureOnConfirmation: _n(),
|
|
4847
|
+
reserveImmediatelyReleaseOnDispute: Kn(),
|
|
4848
|
+
milestoneReservePartialCapture: Gn(),
|
|
4849
|
+
reserveLockedUntilKycThenCaptureOnSettlement: Jn(),
|
|
4850
|
+
releaseLockedUntilWindowOpens: zn(),
|
|
4851
|
+
armchairProtectionWithVoucherPayNoteTemplate: Wn(),
|
|
4852
|
+
balancedBowlVoucherPayNoteTemplate: Nn()
|
|
4853
|
+
};
|
|
4854
|
+
}
|
|
4855
|
+
export {
|
|
4856
|
+
zt as AISteps,
|
|
4857
|
+
Ct as AccessBuilder,
|
|
4858
|
+
Mt as AccessSteps,
|
|
4859
|
+
Pt as AgencyBindingsBuilder,
|
|
4860
|
+
It as AgencyBuilder,
|
|
4861
|
+
qt as AgencyCapabilitiesBuilder,
|
|
4862
|
+
At as AgencyOptionsBuilder,
|
|
4863
|
+
jt as AgencySteps,
|
|
4864
|
+
gt as AiIntegrationBuilder,
|
|
4865
|
+
ft as AiTaskBuilder,
|
|
4866
|
+
K as BasicBlueTypes,
|
|
4867
|
+
is as BlueChangeCompiler,
|
|
4868
|
+
In as BlueChangePlan,
|
|
4869
|
+
Jt as CaptureStepBuilder,
|
|
4870
|
+
Lt as ChangesetBuilder,
|
|
4871
|
+
u as DocBuilder,
|
|
4872
|
+
ut as DocJsonState,
|
|
4873
|
+
Ye as DocPatch,
|
|
4874
|
+
J as DocStructure,
|
|
4875
|
+
qe as EventPayloadBuilder,
|
|
4876
|
+
Rt as FieldBuilder,
|
|
4877
|
+
St as LinkedAccessBuilder,
|
|
4878
|
+
$t as LinkedAccessSteps,
|
|
4879
|
+
x as MyOsPermissions,
|
|
4880
|
+
Wt as MyOsSteps,
|
|
4881
|
+
wt as OperationBuilder,
|
|
4882
|
+
de as PayNoteActionBuilder,
|
|
4883
|
+
be as PayNoteBuilder,
|
|
4884
|
+
I as PayNotes,
|
|
4885
|
+
Gt as PaymentRequestPayloadBuilder,
|
|
4886
|
+
Y as RuntimeEventTypes,
|
|
4887
|
+
y as SimpleDocBuilder,
|
|
4888
|
+
Qt as StepsBuilder,
|
|
4889
|
+
Bn as accessAndAgencyOrchestrator,
|
|
4890
|
+
Mn as addParticipantsDynamically,
|
|
4891
|
+
An as agentAddsParticipantAndWaits,
|
|
4892
|
+
Rn as agentCallsRemoteOperation,
|
|
4893
|
+
os as allJavaSandboxSampleDocs,
|
|
4894
|
+
rs as applyBlueChangePlan,
|
|
4895
|
+
Wn as armchairProtectionWithVoucherPayNoteTemplate,
|
|
4896
|
+
Ue as assertRepositoryTypeAliasAvailable,
|
|
4897
|
+
Nn as balancedBowlVoucherPayNoteTemplate,
|
|
4898
|
+
Yn as bootstrapViaOrchestrator,
|
|
4899
|
+
Qn as bootstrapVoucherOnCapture,
|
|
4900
|
+
Zn as bootstrapWithMessages,
|
|
4901
|
+
Dn as callRemoteOperationSample,
|
|
4902
|
+
Un as captureTriggeredFromChannelEvent,
|
|
4903
|
+
Fn as captureTriggeredFromDocUpdate,
|
|
4904
|
+
vn as compileContractChanges,
|
|
4905
|
+
Cn as compileRootChanges,
|
|
4906
|
+
Tn as cvClassifierAgent,
|
|
4907
|
+
xn as cvClassifierFull,
|
|
4908
|
+
Qe as diffJsonDocuments,
|
|
4909
|
+
A as ensureExpression,
|
|
4910
|
+
W as escapePointerSegment,
|
|
4911
|
+
Te as fromChannel,
|
|
4912
|
+
ss as fromEmail,
|
|
4913
|
+
re as fromJsonDocument,
|
|
4914
|
+
ot as getPointer,
|
|
4915
|
+
mt as isRepositoryTypeAliasAvailable,
|
|
4916
|
+
En as linkedAccessMonitor,
|
|
4917
|
+
jn as linkedAccessPermissions,
|
|
4918
|
+
$n as linkedDocsWithUpdates,
|
|
4919
|
+
Gn as milestoneReservePartialCapture,
|
|
4920
|
+
Oe as normalizeMyOsPermissionObject,
|
|
4921
|
+
Fe as normalizeTypeLike,
|
|
4922
|
+
wn as orchestratorWithAccessAndAgency,
|
|
4923
|
+
zn as releaseLockedUntilWindowOpens,
|
|
4924
|
+
H as removePointer,
|
|
4925
|
+
Kn as reserveImmediatelyReleaseOnDispute,
|
|
4926
|
+
Jn as reserveLockedUntilKycThenCaptureOnSettlement,
|
|
4927
|
+
_n as reserveOnApprovalThenCaptureOnConfirmation,
|
|
4928
|
+
te as sdkBlue,
|
|
4929
|
+
Z as setPointer,
|
|
4930
|
+
Ln as shipmentEscrowSimple,
|
|
4931
|
+
qn as simpleAgentWithPermissions,
|
|
4932
|
+
Vn as simplePermissionAndSubscribe,
|
|
4933
|
+
ae as toOfficialJson,
|
|
4934
|
+
ns as toOfficialYaml,
|
|
4935
|
+
m as toTypeAlias
|
|
4936
|
+
};
|