@jskit-ai/assistant-core 0.1.31 → 0.1.32
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/package.descriptor.mjs +9 -5
- package/package.json +11 -6
- package/src/server/lib/serviceToolCatalog.js +9 -2
- package/src/shared/assistantResource.js +265 -267
- package/src/shared/assistantSettingsResource.js +48 -76
- package/test/assistantResource.test.js +38 -15
- package/test/assistantSettingsResource.test.js +17 -16
- package/test/packageDescriptor.test.js +13 -0
- package/test/serviceToolCatalog.test.js +243 -262
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import test from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
|
-
import {
|
|
3
|
+
import { createSchema } from "json-rest-schema";
|
|
4
4
|
import { createContainer } from "@jskit-ai/kernel/_testable";
|
|
5
5
|
import { ActionRuntimeServiceProvider } from "@jskit-ai/kernel/server/actions";
|
|
6
6
|
import { installServiceRegistrationApi } from "@jskit-ai/kernel/server/runtime";
|
|
@@ -17,6 +17,32 @@ function createApp() {
|
|
|
17
17
|
return app;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
function createEmptyInputSchema() {
|
|
21
|
+
return createSchema({});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function createListOutputSchema() {
|
|
25
|
+
return createSchema({
|
|
26
|
+
items: {
|
|
27
|
+
type: "array",
|
|
28
|
+
required: true,
|
|
29
|
+
items: {
|
|
30
|
+
type: "object",
|
|
31
|
+
additionalProperties: true
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function createOkOutputSchema() {
|
|
38
|
+
return createSchema({
|
|
39
|
+
ok: {
|
|
40
|
+
type: "boolean",
|
|
41
|
+
required: true
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
20
46
|
test("service tool catalog hides methods user cannot execute", () => {
|
|
21
47
|
const app = createApp();
|
|
22
48
|
const actionRuntimeProvider = new ActionRuntimeServiceProvider();
|
|
@@ -48,17 +74,11 @@ test("service tool catalog hides methods user cannot execute", () => {
|
|
|
48
74
|
dependencies: {
|
|
49
75
|
customersService: "demo.customers.service"
|
|
50
76
|
},
|
|
51
|
-
|
|
52
|
-
schema:
|
|
77
|
+
input: {
|
|
78
|
+
schema: createEmptyInputSchema()
|
|
53
79
|
},
|
|
54
|
-
|
|
55
|
-
schema:
|
|
56
|
-
type: "array",
|
|
57
|
-
items: {
|
|
58
|
-
type: "object",
|
|
59
|
-
additionalProperties: true
|
|
60
|
-
}
|
|
61
|
-
}
|
|
80
|
+
output: {
|
|
81
|
+
schema: createListOutputSchema()
|
|
62
82
|
},
|
|
63
83
|
idempotency: "none",
|
|
64
84
|
audit: {
|
|
@@ -83,14 +103,11 @@ test("service tool catalog hides methods user cannot execute", () => {
|
|
|
83
103
|
dependencies: {
|
|
84
104
|
customersService: "demo.customers.service"
|
|
85
105
|
},
|
|
86
|
-
|
|
87
|
-
schema:
|
|
106
|
+
input: {
|
|
107
|
+
schema: createEmptyInputSchema()
|
|
88
108
|
},
|
|
89
|
-
|
|
90
|
-
schema:
|
|
91
|
-
type: "object",
|
|
92
|
-
additionalProperties: true
|
|
93
|
-
}
|
|
109
|
+
output: {
|
|
110
|
+
schema: createOkOutputSchema()
|
|
94
111
|
},
|
|
95
112
|
idempotency: "optional",
|
|
96
113
|
audit: {
|
|
@@ -210,11 +227,11 @@ test("service tool catalog hides actions that are not automation-enabled", () =>
|
|
|
210
227
|
dependencies: {
|
|
211
228
|
nonAutomationService: "demo.non_automation.service"
|
|
212
229
|
},
|
|
213
|
-
|
|
214
|
-
schema:
|
|
230
|
+
input: {
|
|
231
|
+
schema: createSchema({})
|
|
215
232
|
},
|
|
216
|
-
|
|
217
|
-
schema:
|
|
233
|
+
output: {
|
|
234
|
+
schema: createListOutputSchema()
|
|
218
235
|
},
|
|
219
236
|
idempotency: "none",
|
|
220
237
|
audit: {
|
|
@@ -268,11 +285,11 @@ test("service tool catalog honors barred action ids", () => {
|
|
|
268
285
|
dependencies: {
|
|
269
286
|
auditService: "demo.audit.service"
|
|
270
287
|
},
|
|
271
|
-
|
|
272
|
-
schema:
|
|
288
|
+
input: {
|
|
289
|
+
schema: createEmptyInputSchema()
|
|
273
290
|
},
|
|
274
|
-
|
|
275
|
-
schema:
|
|
291
|
+
output: {
|
|
292
|
+
schema: createListOutputSchema()
|
|
276
293
|
},
|
|
277
294
|
idempotency: "none",
|
|
278
295
|
audit: {
|
|
@@ -326,8 +343,8 @@ test("service tool catalog materializes action tools once and filters per reques
|
|
|
326
343
|
dependencies: {
|
|
327
344
|
cachedService: "demo.cached.service"
|
|
328
345
|
},
|
|
329
|
-
|
|
330
|
-
schema:
|
|
346
|
+
input: {
|
|
347
|
+
schema: createEmptyInputSchema()
|
|
331
348
|
},
|
|
332
349
|
idempotency: "none",
|
|
333
350
|
audit: {
|
|
@@ -374,43 +391,26 @@ test("service tool catalog uses action-backed schemas for tool contracts", () =>
|
|
|
374
391
|
const actionRuntimeProvider = new ActionRuntimeServiceProvider();
|
|
375
392
|
actionRuntimeProvider.register(app);
|
|
376
393
|
|
|
377
|
-
const inputSchema =
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
},
|
|
390
|
-
required: ["displayName"],
|
|
391
|
-
additionalProperties: false
|
|
392
|
-
}
|
|
393
|
-
],
|
|
394
|
-
minItems: 1,
|
|
395
|
-
maxItems: 1
|
|
396
|
-
},
|
|
397
|
-
options: {
|
|
398
|
-
type: "object",
|
|
399
|
-
additionalProperties: true
|
|
400
|
-
}
|
|
401
|
-
},
|
|
402
|
-
additionalProperties: false
|
|
403
|
-
});
|
|
404
|
-
const outputSchema = Object.freeze({
|
|
405
|
-
type: "object",
|
|
406
|
-
properties: {
|
|
407
|
-
ok: {
|
|
408
|
-
type: "boolean"
|
|
409
|
-
}
|
|
394
|
+
const inputSchema = createSchema({
|
|
395
|
+
args: {
|
|
396
|
+
type: "array",
|
|
397
|
+
required: true,
|
|
398
|
+
minItems: 1,
|
|
399
|
+
maxItems: 1,
|
|
400
|
+
items: createSchema({
|
|
401
|
+
displayName: {
|
|
402
|
+
type: "string",
|
|
403
|
+
required: true
|
|
404
|
+
}
|
|
405
|
+
})
|
|
410
406
|
},
|
|
411
|
-
|
|
412
|
-
|
|
407
|
+
options: {
|
|
408
|
+
type: "object",
|
|
409
|
+
required: false,
|
|
410
|
+
additionalProperties: true
|
|
411
|
+
}
|
|
413
412
|
});
|
|
413
|
+
const outputSchema = createOkOutputSchema();
|
|
414
414
|
|
|
415
415
|
app.service(
|
|
416
416
|
"demo.schemas.service",
|
|
@@ -437,10 +437,10 @@ test("service tool catalog uses action-backed schemas for tool contracts", () =>
|
|
|
437
437
|
dependencies: {
|
|
438
438
|
schemasService: "demo.schemas.service"
|
|
439
439
|
},
|
|
440
|
-
|
|
440
|
+
input: {
|
|
441
441
|
schema: inputSchema
|
|
442
442
|
},
|
|
443
|
-
|
|
443
|
+
output: {
|
|
444
444
|
schema: outputSchema
|
|
445
445
|
},
|
|
446
446
|
idempotency: "optional",
|
|
@@ -469,24 +469,24 @@ test("service tool catalog uses action-backed schemas for tool contracts", () =>
|
|
|
469
469
|
|
|
470
470
|
assert.equal(toolSet.tools.length, 1);
|
|
471
471
|
assert.equal(toolSet.tools[0].description, "Update profile display name.");
|
|
472
|
-
assert.
|
|
473
|
-
assert.
|
|
472
|
+
assert.deepEqual(toolSet.tools[0].parameters, inputSchema.toJsonSchema({ mode: "patch" }));
|
|
473
|
+
assert.deepEqual(toolSet.tools[0].outputSchema, outputSchema.toJsonSchema({ mode: "replace" }));
|
|
474
474
|
});
|
|
475
475
|
|
|
476
|
-
test("service tool catalog rejects
|
|
476
|
+
test("service tool catalog rejects unsupported assistantTool field at assistant layer", () => {
|
|
477
477
|
const app = createApp();
|
|
478
478
|
const actionRuntimeProvider = new ActionRuntimeServiceProvider();
|
|
479
479
|
actionRuntimeProvider.register(app);
|
|
480
480
|
|
|
481
481
|
app.service(
|
|
482
|
-
"demo.
|
|
482
|
+
"demo.assistant_tool_shape.service",
|
|
483
483
|
() => ({
|
|
484
|
-
|
|
484
|
+
createWithAssistantToolField(input = {}) {
|
|
485
485
|
return {
|
|
486
486
|
ok: Boolean(input)
|
|
487
487
|
};
|
|
488
488
|
},
|
|
489
|
-
|
|
489
|
+
createWithAssistantExtension(input = {}) {
|
|
490
490
|
return {
|
|
491
491
|
ok: Boolean(input)
|
|
492
492
|
};
|
|
@@ -494,24 +494,12 @@ test("service tool catalog rejects legacy assistantTool field at assistant layer
|
|
|
494
494
|
})
|
|
495
495
|
);
|
|
496
496
|
|
|
497
|
-
const schema =
|
|
498
|
-
|
|
499
|
-
additionalProperties: false
|
|
500
|
-
});
|
|
501
|
-
const outputSchema = Object.freeze({
|
|
502
|
-
type: "object",
|
|
503
|
-
properties: {
|
|
504
|
-
ok: {
|
|
505
|
-
type: "boolean"
|
|
506
|
-
}
|
|
507
|
-
},
|
|
508
|
-
required: ["ok"],
|
|
509
|
-
additionalProperties: false
|
|
510
|
-
});
|
|
497
|
+
const schema = createEmptyInputSchema();
|
|
498
|
+
const outputSchema = createOkOutputSchema();
|
|
511
499
|
|
|
512
500
|
app.actions([
|
|
513
501
|
{
|
|
514
|
-
id: "demo.
|
|
502
|
+
id: "demo.assistant_tool_shape.create",
|
|
515
503
|
domain: "demo",
|
|
516
504
|
version: 1,
|
|
517
505
|
kind: "command",
|
|
@@ -521,28 +509,28 @@ test("service tool catalog rejects legacy assistantTool field at assistant layer
|
|
|
521
509
|
require: "authenticated"
|
|
522
510
|
},
|
|
523
511
|
dependencies: {
|
|
524
|
-
|
|
512
|
+
assistantToolShapeService: "demo.assistant_tool_shape.service"
|
|
525
513
|
},
|
|
526
|
-
|
|
514
|
+
input: {
|
|
527
515
|
schema
|
|
528
516
|
},
|
|
529
|
-
|
|
517
|
+
output: {
|
|
530
518
|
schema: outputSchema
|
|
531
519
|
},
|
|
532
520
|
idempotency: "optional",
|
|
533
521
|
audit: {
|
|
534
|
-
actionName: "demo.
|
|
522
|
+
actionName: "demo.assistant_tool_shape.create"
|
|
535
523
|
},
|
|
536
524
|
observability: {},
|
|
537
525
|
assistantTool: {
|
|
538
|
-
description: "
|
|
526
|
+
description: "Unsupported assistant tool metadata."
|
|
539
527
|
},
|
|
540
528
|
async execute(input, _context, deps) {
|
|
541
|
-
return deps.
|
|
529
|
+
return deps.assistantToolShapeService.createWithAssistantToolField(input);
|
|
542
530
|
}
|
|
543
531
|
},
|
|
544
532
|
{
|
|
545
|
-
id: "demo.
|
|
533
|
+
id: "demo.assistant_extension_shape.create",
|
|
546
534
|
domain: "demo",
|
|
547
535
|
version: 1,
|
|
548
536
|
kind: "command",
|
|
@@ -552,26 +540,26 @@ test("service tool catalog rejects legacy assistantTool field at assistant layer
|
|
|
552
540
|
require: "authenticated"
|
|
553
541
|
},
|
|
554
542
|
dependencies: {
|
|
555
|
-
|
|
543
|
+
assistantToolShapeService: "demo.assistant_tool_shape.service"
|
|
556
544
|
},
|
|
557
|
-
|
|
545
|
+
input: {
|
|
558
546
|
schema
|
|
559
547
|
},
|
|
560
|
-
|
|
548
|
+
output: {
|
|
561
549
|
schema: outputSchema
|
|
562
550
|
},
|
|
563
551
|
idempotency: "optional",
|
|
564
552
|
audit: {
|
|
565
|
-
actionName: "demo.
|
|
553
|
+
actionName: "demo.assistant_extension_shape.create"
|
|
566
554
|
},
|
|
567
555
|
observability: {},
|
|
568
556
|
extensions: {
|
|
569
557
|
assistant: {
|
|
570
|
-
description: "
|
|
558
|
+
description: "Assistant extension metadata."
|
|
571
559
|
}
|
|
572
560
|
},
|
|
573
561
|
async execute(input, _context, deps) {
|
|
574
|
-
return deps.
|
|
562
|
+
return deps.assistantToolShapeService.createWithAssistantExtension(input);
|
|
575
563
|
}
|
|
576
564
|
}
|
|
577
565
|
]);
|
|
@@ -585,7 +573,7 @@ test("service tool catalog rejects legacy assistantTool field at assistant layer
|
|
|
585
573
|
});
|
|
586
574
|
const actionIds = toolSet.tools.map((tool) => tool.actionId).sort();
|
|
587
575
|
|
|
588
|
-
assert.deepEqual(actionIds, ["demo.
|
|
576
|
+
assert.deepEqual(actionIds, ["demo.assistant_extension_shape.create"]);
|
|
589
577
|
});
|
|
590
578
|
|
|
591
579
|
test("service tool catalog can require input/output schemas for tool exposure", () => {
|
|
@@ -623,23 +611,11 @@ test("service tool catalog can require input/output schemas for tool exposure",
|
|
|
623
611
|
dependencies: {
|
|
624
612
|
strictService: "demo.strict.service"
|
|
625
613
|
},
|
|
626
|
-
|
|
627
|
-
schema:
|
|
628
|
-
type: "object",
|
|
629
|
-
additionalProperties: false
|
|
630
|
-
}
|
|
614
|
+
input: {
|
|
615
|
+
schema: createEmptyInputSchema()
|
|
631
616
|
},
|
|
632
|
-
|
|
633
|
-
schema:
|
|
634
|
-
type: "object",
|
|
635
|
-
properties: {
|
|
636
|
-
ok: {
|
|
637
|
-
type: "boolean"
|
|
638
|
-
}
|
|
639
|
-
},
|
|
640
|
-
required: ["ok"],
|
|
641
|
-
additionalProperties: false
|
|
642
|
-
}
|
|
617
|
+
output: {
|
|
618
|
+
schema: createOkOutputSchema()
|
|
643
619
|
},
|
|
644
620
|
idempotency: "none",
|
|
645
621
|
audit: {
|
|
@@ -669,30 +645,25 @@ test("service tool catalog derives tool schemas from action contributors", () =>
|
|
|
669
645
|
const actionRuntimeProvider = new ActionRuntimeServiceProvider();
|
|
670
646
|
actionRuntimeProvider.register(app);
|
|
671
647
|
|
|
672
|
-
const inputSchema =
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
type: "string"
|
|
677
|
-
},
|
|
678
|
-
name: {
|
|
679
|
-
type: "string"
|
|
680
|
-
},
|
|
681
|
-
surname: {
|
|
682
|
-
type: "string"
|
|
683
|
-
}
|
|
648
|
+
const inputSchema = createSchema({
|
|
649
|
+
workspaceSlug: {
|
|
650
|
+
type: "string",
|
|
651
|
+
required: false
|
|
684
652
|
},
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
type: "object",
|
|
689
|
-
properties: {
|
|
690
|
-
id: {
|
|
691
|
-
type: "integer"
|
|
692
|
-
}
|
|
653
|
+
name: {
|
|
654
|
+
type: "string",
|
|
655
|
+
required: false
|
|
693
656
|
},
|
|
694
|
-
|
|
695
|
-
|
|
657
|
+
surname: {
|
|
658
|
+
type: "string",
|
|
659
|
+
required: false
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
const outputSchema = createSchema({
|
|
663
|
+
id: {
|
|
664
|
+
type: "integer",
|
|
665
|
+
required: true
|
|
666
|
+
}
|
|
696
667
|
});
|
|
697
668
|
|
|
698
669
|
app.service(
|
|
@@ -721,10 +692,10 @@ test("service tool catalog derives tool schemas from action contributors", () =>
|
|
|
721
692
|
dependencies: {
|
|
722
693
|
customersService: "demo.customers.service"
|
|
723
694
|
},
|
|
724
|
-
|
|
695
|
+
input: {
|
|
725
696
|
schema: inputSchema
|
|
726
697
|
},
|
|
727
|
-
|
|
698
|
+
output: {
|
|
728
699
|
schema: outputSchema
|
|
729
700
|
},
|
|
730
701
|
idempotency: "optional",
|
|
@@ -750,11 +721,11 @@ test("service tool catalog derives tool schemas from action contributors", () =>
|
|
|
750
721
|
const createTool = toolSet.tools.find((tool) => tool.actionId === "demo.customers.create");
|
|
751
722
|
|
|
752
723
|
assert.ok(createTool);
|
|
753
|
-
assert.
|
|
754
|
-
assert.
|
|
724
|
+
assert.deepEqual(createTool.parameters, inputSchema.toJsonSchema({ mode: "patch" }));
|
|
725
|
+
assert.deepEqual(createTool.outputSchema, outputSchema.toJsonSchema({ mode: "replace" }));
|
|
755
726
|
});
|
|
756
727
|
|
|
757
|
-
test("service tool catalog derives input schema from
|
|
728
|
+
test("service tool catalog derives input schema from a composed action schema", () => {
|
|
758
729
|
const app = createApp();
|
|
759
730
|
const actionRuntimeProvider = new ActionRuntimeServiceProvider();
|
|
760
731
|
actionRuntimeProvider.register(app);
|
|
@@ -785,32 +756,36 @@ test("service tool catalog derives input schema from array action validators", (
|
|
|
785
756
|
dependencies: {
|
|
786
757
|
arraySchemaService: "demo.array_schema.service"
|
|
787
758
|
},
|
|
788
|
-
|
|
789
|
-
{
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
schema:
|
|
809
|
-
{
|
|
810
|
-
|
|
759
|
+
input: {
|
|
760
|
+
schema: createSchema({
|
|
761
|
+
workspaceSlug: {
|
|
762
|
+
type: "string",
|
|
763
|
+
required: true,
|
|
764
|
+
minLength: 1
|
|
765
|
+
},
|
|
766
|
+
name: {
|
|
767
|
+
type: "string",
|
|
768
|
+
required: true,
|
|
769
|
+
minLength: 1
|
|
770
|
+
},
|
|
771
|
+
surname: {
|
|
772
|
+
type: "string",
|
|
773
|
+
required: true,
|
|
774
|
+
minLength: 1
|
|
775
|
+
}
|
|
776
|
+
})
|
|
777
|
+
},
|
|
778
|
+
output: {
|
|
779
|
+
schema: createSchema({
|
|
780
|
+
id: {
|
|
781
|
+
type: "integer",
|
|
782
|
+
required: true
|
|
811
783
|
},
|
|
812
|
-
|
|
813
|
-
|
|
784
|
+
payload: {
|
|
785
|
+
type: "object",
|
|
786
|
+
required: true
|
|
787
|
+
}
|
|
788
|
+
})
|
|
814
789
|
},
|
|
815
790
|
idempotency: "optional",
|
|
816
791
|
audit: {
|
|
@@ -843,7 +818,7 @@ test("service tool catalog derives input schema from array action validators", (
|
|
|
843
818
|
assert.equal(typeof createTool.parameters?.properties?.surname, "object");
|
|
844
819
|
});
|
|
845
820
|
|
|
846
|
-
test("service tool catalog
|
|
821
|
+
test("service tool catalog derives direct tool schemas from composed action inputs", () => {
|
|
847
822
|
const app = createApp();
|
|
848
823
|
const actionRuntimeProvider = new ActionRuntimeServiceProvider();
|
|
849
824
|
actionRuntimeProvider.register(app);
|
|
@@ -857,15 +832,6 @@ test("service tool catalog preserves section-map validators in tool schemas", ()
|
|
|
857
832
|
})
|
|
858
833
|
);
|
|
859
834
|
|
|
860
|
-
const patchValidator = Object.freeze({
|
|
861
|
-
schema: Type.Object(
|
|
862
|
-
{
|
|
863
|
-
name: Type.String({ minLength: 1 })
|
|
864
|
-
},
|
|
865
|
-
{ additionalProperties: false }
|
|
866
|
-
)
|
|
867
|
-
});
|
|
868
|
-
|
|
869
835
|
app.actions([
|
|
870
836
|
{
|
|
871
837
|
id: "demo.workspace.settings.update",
|
|
@@ -880,26 +846,27 @@ test("service tool catalog preserves section-map validators in tool schemas", ()
|
|
|
880
846
|
dependencies: {
|
|
881
847
|
workspaceSettingsService: "demo.workspace_settings.service"
|
|
882
848
|
},
|
|
883
|
-
|
|
884
|
-
{
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
{ additionalProperties: false }
|
|
890
|
-
)
|
|
891
|
-
},
|
|
892
|
-
{
|
|
893
|
-
patch: patchValidator
|
|
894
|
-
}
|
|
895
|
-
],
|
|
896
|
-
outputValidator: {
|
|
897
|
-
schema: Type.Object(
|
|
898
|
-
{
|
|
899
|
-
ok: Type.Boolean()
|
|
849
|
+
input: {
|
|
850
|
+
schema: createSchema({
|
|
851
|
+
workspaceSlug: {
|
|
852
|
+
type: "string",
|
|
853
|
+
required: true,
|
|
854
|
+
minLength: 1
|
|
900
855
|
},
|
|
901
|
-
|
|
902
|
-
|
|
856
|
+
name: {
|
|
857
|
+
type: "string",
|
|
858
|
+
required: true,
|
|
859
|
+
minLength: 1
|
|
860
|
+
}
|
|
861
|
+
})
|
|
862
|
+
},
|
|
863
|
+
output: {
|
|
864
|
+
schema: createSchema({
|
|
865
|
+
ok: {
|
|
866
|
+
type: "boolean",
|
|
867
|
+
required: true
|
|
868
|
+
}
|
|
869
|
+
})
|
|
903
870
|
},
|
|
904
871
|
idempotency: "optional",
|
|
905
872
|
audit: {
|
|
@@ -939,9 +906,7 @@ test("service tool catalog preserves section-map validators in tool schemas", ()
|
|
|
939
906
|
assert.ok(updateTool);
|
|
940
907
|
assert.equal(updateTool.parameters?.type, "object");
|
|
941
908
|
assert.equal(Object.hasOwn(updateTool.parameters?.properties || {}, "workspaceSlug"), false);
|
|
942
|
-
assert.equal(typeof updateTool.parameters?.properties?.
|
|
943
|
-
assert.equal(updateTool.parameters?.properties?.patch.type, "object");
|
|
944
|
-
assert.equal(typeof updateTool.parameters?.properties?.patch.properties?.name, "object");
|
|
909
|
+
assert.equal(typeof updateTool.parameters?.properties?.name, "object");
|
|
945
910
|
});
|
|
946
911
|
|
|
947
912
|
test("service tool catalog hides workspaceSlug parameter when workspace context is already resolved", () => {
|
|
@@ -972,23 +937,33 @@ test("service tool catalog hides workspaceSlug parameter when workspace context
|
|
|
972
937
|
dependencies: {
|
|
973
938
|
workspaceScopeService: "demo.workspace_scope.service"
|
|
974
939
|
},
|
|
975
|
-
|
|
976
|
-
schema:
|
|
977
|
-
{
|
|
978
|
-
|
|
979
|
-
|
|
940
|
+
input: {
|
|
941
|
+
schema: createSchema({
|
|
942
|
+
workspaceSlug: {
|
|
943
|
+
type: "string",
|
|
944
|
+
required: true,
|
|
945
|
+
minLength: 1
|
|
980
946
|
},
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
947
|
+
name: {
|
|
948
|
+
type: "string",
|
|
949
|
+
required: true,
|
|
950
|
+
minLength: 1
|
|
951
|
+
}
|
|
952
|
+
})
|
|
953
|
+
},
|
|
954
|
+
output: {
|
|
955
|
+
schema: createSchema({
|
|
956
|
+
workspaceSlug: {
|
|
957
|
+
type: "string",
|
|
958
|
+
required: true,
|
|
959
|
+
minLength: 1
|
|
989
960
|
},
|
|
990
|
-
|
|
991
|
-
|
|
961
|
+
name: {
|
|
962
|
+
type: "string",
|
|
963
|
+
required: true,
|
|
964
|
+
minLength: 1
|
|
965
|
+
}
|
|
966
|
+
})
|
|
992
967
|
},
|
|
993
968
|
idempotency: "optional",
|
|
994
969
|
audit: {
|
|
@@ -1056,23 +1031,33 @@ test("service tool catalog injects workspaceSlug from requestMeta request params
|
|
|
1056
1031
|
dependencies: {
|
|
1057
1032
|
workspaceInjectionService: "demo.workspace_injection.service"
|
|
1058
1033
|
},
|
|
1059
|
-
|
|
1060
|
-
schema:
|
|
1061
|
-
{
|
|
1062
|
-
|
|
1063
|
-
|
|
1034
|
+
input: {
|
|
1035
|
+
schema: createSchema({
|
|
1036
|
+
workspaceSlug: {
|
|
1037
|
+
type: "string",
|
|
1038
|
+
required: true,
|
|
1039
|
+
minLength: 1
|
|
1064
1040
|
},
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1041
|
+
name: {
|
|
1042
|
+
type: "string",
|
|
1043
|
+
required: true,
|
|
1044
|
+
minLength: 1
|
|
1045
|
+
}
|
|
1046
|
+
})
|
|
1047
|
+
},
|
|
1048
|
+
output: {
|
|
1049
|
+
schema: createSchema({
|
|
1050
|
+
workspaceSlug: {
|
|
1051
|
+
type: "string",
|
|
1052
|
+
required: true,
|
|
1053
|
+
minLength: 1
|
|
1073
1054
|
},
|
|
1074
|
-
|
|
1075
|
-
|
|
1055
|
+
name: {
|
|
1056
|
+
type: "string",
|
|
1057
|
+
required: true,
|
|
1058
|
+
minLength: 1
|
|
1059
|
+
}
|
|
1060
|
+
})
|
|
1076
1061
|
},
|
|
1077
1062
|
idempotency: "optional",
|
|
1078
1063
|
audit: {
|
|
@@ -1158,33 +1143,29 @@ test("service tool catalog executes action-backed tools with object payloads", a
|
|
|
1158
1143
|
dependencies: {
|
|
1159
1144
|
customersService: "demo.customers.service"
|
|
1160
1145
|
},
|
|
1161
|
-
|
|
1162
|
-
schema: {
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
minimum: 1
|
|
1168
|
-
},
|
|
1169
|
-
name: {
|
|
1170
|
-
type: "string"
|
|
1171
|
-
}
|
|
1146
|
+
input: {
|
|
1147
|
+
schema: createSchema({
|
|
1148
|
+
recordId: {
|
|
1149
|
+
type: "integer",
|
|
1150
|
+
required: true,
|
|
1151
|
+
min: 1
|
|
1172
1152
|
},
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1153
|
+
name: {
|
|
1154
|
+
type: "string"
|
|
1155
|
+
}
|
|
1156
|
+
})
|
|
1176
1157
|
},
|
|
1177
|
-
|
|
1178
|
-
schema: {
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
type: "integer"
|
|
1183
|
-
}
|
|
1158
|
+
output: {
|
|
1159
|
+
schema: createSchema({
|
|
1160
|
+
id: {
|
|
1161
|
+
type: "integer",
|
|
1162
|
+
required: true
|
|
1184
1163
|
},
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1164
|
+
payload: {
|
|
1165
|
+
type: "object",
|
|
1166
|
+
required: true
|
|
1167
|
+
}
|
|
1168
|
+
})
|
|
1188
1169
|
},
|
|
1189
1170
|
idempotency: "optional",
|
|
1190
1171
|
audit: {
|
|
@@ -1250,11 +1231,11 @@ test("service tool catalog hides automation actions from other surfaces", () =>
|
|
|
1250
1231
|
permission: {
|
|
1251
1232
|
require: "authenticated"
|
|
1252
1233
|
},
|
|
1253
|
-
|
|
1254
|
-
schema:
|
|
1234
|
+
input: {
|
|
1235
|
+
schema: createSchema({})
|
|
1255
1236
|
},
|
|
1256
|
-
|
|
1257
|
-
schema:
|
|
1237
|
+
output: {
|
|
1238
|
+
schema: createListOutputSchema()
|
|
1258
1239
|
},
|
|
1259
1240
|
idempotency: "none",
|
|
1260
1241
|
audit: {
|
|
@@ -1275,11 +1256,11 @@ test("service tool catalog hides automation actions from other surfaces", () =>
|
|
|
1275
1256
|
permission: {
|
|
1276
1257
|
require: "authenticated"
|
|
1277
1258
|
},
|
|
1278
|
-
|
|
1279
|
-
schema:
|
|
1259
|
+
input: {
|
|
1260
|
+
schema: createSchema({})
|
|
1280
1261
|
},
|
|
1281
|
-
|
|
1282
|
-
schema:
|
|
1262
|
+
output: {
|
|
1263
|
+
schema: createListOutputSchema()
|
|
1283
1264
|
},
|
|
1284
1265
|
idempotency: "none",
|
|
1285
1266
|
audit: {
|