@adobe/data 0.9.33 → 0.9.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LICENSE +21 -0
- package/dist/README.md +296 -0
- package/dist/cache/functions/hashing/blob-to-hash.d.ts +0 -8
- package/dist/cache/functions/hashing/blob-to-hash.js +17 -46
- package/dist/cache/functions/hashing/blob-to-hash.js.map +1 -1
- package/dist/cache/functions/hashing/hashing.test.js +12 -209
- package/dist/cache/functions/hashing/hashing.test.js.map +1 -1
- package/dist/functions/serialization/serialize-to-json.js +4 -3
- package/dist/functions/serialization/serialize-to-json.js.map +1 -1
- package/dist/package.json +183 -0
- package/dist/service/agentic-service/create-from-config.d.ts +45 -0
- package/dist/service/agentic-service/create-from-config.js +85 -0
- package/dist/service/agentic-service/create-from-config.js.map +1 -0
- package/dist/service/agentic-service/create.d.ts +8 -8
- package/dist/service/agentic-service/create.interface-first-spike.type-test.js +119 -0
- package/dist/service/agentic-service/create.interface-first-spike.type-test.js.map +1 -0
- package/dist/service/agentic-service/create.js +3 -5
- package/dist/service/agentic-service/create.js.map +1 -1
- package/dist/service/agentic-service/create.test.js +131 -31
- package/dist/service/agentic-service/create.test.js.map +1 -1
- package/dist/service/agentic-service/create.type-test.js +21 -18
- package/dist/service/agentic-service/create.type-test.js.map +1 -1
- package/dist/service/agentic-service/index.d.ts +1 -0
- package/dist/service/agentic-service/index.js +3 -0
- package/dist/service/agentic-service/index.js.map +1 -0
- package/dist/service/dynamic-service/create.interface-first-spike.type-test.d.ts +1 -0
- package/dist/service/dynamic-service/create.interface-first-spike.type-test.js +118 -0
- package/dist/service/dynamic-service/create.interface-first-spike.type-test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/dist/ecs/database/observe-select-deep.d.ts +0 -23
- package/dist/ecs/database/observe-select-deep.js +0 -15
- package/dist/ecs/database/observe-select-deep.js.map +0 -1
- package/dist/ecs/database/observe-select-deep.type-test.js +0 -111
- package/dist/ecs/database/observe-select-deep.type-test.js.map +0 -1
- package/dist/service/agentic-service/link.d.ts +0 -15
- package/dist/service/agentic-service/link.js +0 -3
- package/dist/service/agentic-service/link.js.map +0 -1
- package/dist/service/dynamic-service/semantic-service.d.ts +0 -19
- package/dist/service/dynamic-service/semantic-service.js +0 -2
- package/dist/service/dynamic-service/semantic-service.js.map +0 -1
- package/dist/service/semantic-service/semantic-service.d.ts +0 -19
- package/dist/service/semantic-service/semantic-service.js +0 -2
- package/dist/service/semantic-service/semantic-service.js.map +0 -1
- /package/dist/{ecs/database/observe-select-deep.type-test.d.ts → service/agentic-service/create.interface-first-spike.type-test.d.ts} +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
import { Observe } from "../../observe/index.js";
|
|
3
|
+
function isStateDeclaration(entry) {
|
|
4
|
+
return "type" in entry && typeof entry.type === "string";
|
|
5
|
+
}
|
|
6
|
+
function getActionSchema(entry) {
|
|
7
|
+
if (isStateDeclaration(entry))
|
|
8
|
+
return false;
|
|
9
|
+
const actionEntry = entry;
|
|
10
|
+
return actionEntry.input ?? false;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates an AgenticService from a config with interface, implementation, and optional conditional.
|
|
14
|
+
*
|
|
15
|
+
* Interface: flat map of states (have `type`) and actions (have `description`, optional `input`).
|
|
16
|
+
* Implementation: same keys, states → Observe<...>, actions → (input?) => ...
|
|
17
|
+
* Conditional: optional per-key Observe<boolean> for enablement.
|
|
18
|
+
*/
|
|
19
|
+
export function create(config) {
|
|
20
|
+
const { interface: iface, implementation, conditional } = config;
|
|
21
|
+
const alwaysEnabled = Observe.fromConstant(true);
|
|
22
|
+
const stateKeys = [];
|
|
23
|
+
const actionKeys = [];
|
|
24
|
+
const stateSchemas = {};
|
|
25
|
+
const actionMeta = {};
|
|
26
|
+
for (const [key, entry] of Object.entries(iface)) {
|
|
27
|
+
if (isStateDeclaration(entry)) {
|
|
28
|
+
stateKeys.push(key);
|
|
29
|
+
stateSchemas[key] = entry;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
actionKeys.push(key);
|
|
33
|
+
const a = entry;
|
|
34
|
+
actionMeta[key] = {
|
|
35
|
+
description: a.description,
|
|
36
|
+
schema: getActionSchema(entry),
|
|
37
|
+
execute: implementation[key],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const perStateObservables = {};
|
|
42
|
+
for (const key of stateKeys) {
|
|
43
|
+
const valueObs = implementation[key];
|
|
44
|
+
const enabledObs = conditional?.[key] ?? alwaysEnabled;
|
|
45
|
+
perStateObservables[key] = Observe.fromProperties({
|
|
46
|
+
enabled: enabledObs,
|
|
47
|
+
value: valueObs,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const enabledObservables = {};
|
|
51
|
+
for (const key of actionKeys) {
|
|
52
|
+
enabledObservables[key] = conditional?.[key] ?? alwaysEnabled;
|
|
53
|
+
}
|
|
54
|
+
const states = Observe.withMap(Observe.fromProperties(perStateObservables), (raw) => {
|
|
55
|
+
const result = {};
|
|
56
|
+
for (const [key, entry] of Object.entries(raw)) {
|
|
57
|
+
const { enabled, value } = entry;
|
|
58
|
+
if (enabled) {
|
|
59
|
+
result[key] = { schema: stateSchemas[key], value };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
});
|
|
64
|
+
const actions = Observe.withMap(Observe.fromProperties(enabledObservables), (enabledMap) => {
|
|
65
|
+
const result = {};
|
|
66
|
+
for (const [key, enabled] of Object.entries(enabledMap)) {
|
|
67
|
+
if (!enabled)
|
|
68
|
+
continue;
|
|
69
|
+
const meta = actionMeta[key];
|
|
70
|
+
if (meta)
|
|
71
|
+
result[key] = meta;
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
});
|
|
75
|
+
let currentActions = {};
|
|
76
|
+
actions((a) => { currentActions = a; });
|
|
77
|
+
const execute = async (actionName, input) => {
|
|
78
|
+
const entry = currentActions[actionName];
|
|
79
|
+
if (!entry)
|
|
80
|
+
return `Action "${actionName}" is not available`;
|
|
81
|
+
return entry.execute(input);
|
|
82
|
+
};
|
|
83
|
+
return { serviceName: "agentic-service", states, actions, execute };
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=create-from-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-from-config.js","sourceRoot":"","sources":["../../../src/service/agentic-service/create-from-config.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAuBjD,SAAS,kBAAkB,CAAC,KAAuB;IAC/C,OAAO,MAAM,IAAI,KAAK,IAAI,OAAQ,KAA0B,CAAC,IAAI,KAAK,QAAQ,CAAC;AACnF,CAAC;AAED,SAAS,eAAe,CAAC,KAAuB;IAC5C,IAAI,kBAAkB,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,WAAW,GAAG,KAA0B,CAAC;IAC/C,OAAO,WAAW,CAAC,KAAK,IAAI,KAAK,CAAC;AACtC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAA+B,MAKpD;IACG,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IACjE,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAEjD,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,YAAY,GAA2B,EAAE,CAAC;IAChD,MAAM,UAAU,GAAuF,EAAE,CAAC;IAE1G,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/C,IAAI,kBAAkB,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EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -5,20 +5,20 @@ import { AgenticService } from "./agentic-service.js";
|
|
|
5
5
|
type StateDeclaration<S extends Schema = Schema> = {
|
|
6
6
|
type: "state";
|
|
7
7
|
schema: S;
|
|
8
|
-
description
|
|
8
|
+
description?: string;
|
|
9
9
|
};
|
|
10
10
|
/** Action declaration: kind + description + optional input schema */
|
|
11
|
-
type ActionDeclaration<
|
|
11
|
+
type ActionDeclaration<P extends readonly Schema[] = readonly Schema[]> = {
|
|
12
12
|
type: "action";
|
|
13
|
-
description
|
|
14
|
-
|
|
13
|
+
description?: string;
|
|
14
|
+
parameters: P;
|
|
15
15
|
};
|
|
16
16
|
/** Link declaration: kind + optional description */
|
|
17
17
|
type LinkDeclaration = {
|
|
18
18
|
type: "link";
|
|
19
19
|
description?: string;
|
|
20
20
|
};
|
|
21
|
-
type DeclarationEntry = StateDeclaration | ActionDeclaration
|
|
21
|
+
type DeclarationEntry = StateDeclaration | ActionDeclaration | LinkDeclaration;
|
|
22
22
|
type Declarations = Record<string, DeclarationEntry>;
|
|
23
23
|
type ConditionalFromDeclarations<D extends Declarations> = Partial<{
|
|
24
24
|
[K in keyof D]: Observe<boolean>;
|
|
@@ -44,10 +44,10 @@ export type ImplementationFromDeclarations<D extends Declarations> = {
|
|
|
44
44
|
schema: infer S extends Schema;
|
|
45
45
|
} ? Observe<Schema.ToType<S>> : D[K] extends {
|
|
46
46
|
type: "action";
|
|
47
|
-
|
|
48
|
-
} ?
|
|
47
|
+
parameters: infer P extends readonly Schema[];
|
|
48
|
+
} ? ExecuteFromParameters<P> : D[K] extends {
|
|
49
49
|
type: "link";
|
|
50
50
|
} ? AgenticService | Observe<AgenticService> : never;
|
|
51
51
|
};
|
|
52
|
-
type
|
|
52
|
+
type ExecuteFromParameters<P extends readonly Schema[]> = P extends readonly [] ? (() => Promise<void | AgenticService.ActionError> | void) : P extends readonly [infer S extends Schema, ...readonly Schema[]] ? ((input: Schema.ToType<S>) => Promise<void | AgenticService.ActionError> | void) : never;
|
|
53
53
|
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
import { Observe } from "../../observe/index.js";
|
|
3
|
+
import { createFromConfig, } from "./create-from-config.js";
|
|
4
|
+
const iface = {
|
|
5
|
+
health: {
|
|
6
|
+
type: "number",
|
|
7
|
+
description: "Current health points",
|
|
8
|
+
},
|
|
9
|
+
stats: {
|
|
10
|
+
type: "object",
|
|
11
|
+
description: "Current player stats",
|
|
12
|
+
properties: {
|
|
13
|
+
hp: { type: "number" },
|
|
14
|
+
label: { type: "string" },
|
|
15
|
+
},
|
|
16
|
+
required: ["hp"],
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
},
|
|
19
|
+
heal: {
|
|
20
|
+
description: "Increase health by amount",
|
|
21
|
+
input: { type: "number" },
|
|
22
|
+
},
|
|
23
|
+
configure: {
|
|
24
|
+
description: "Configure stats",
|
|
25
|
+
input: {
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: {
|
|
28
|
+
hp: { type: "number" },
|
|
29
|
+
label: { type: "string" },
|
|
30
|
+
},
|
|
31
|
+
required: ["hp"],
|
|
32
|
+
additionalProperties: false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
reset: {
|
|
36
|
+
description: "Reset values",
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
createFromConfig({
|
|
40
|
+
description: "Player health and actions for agentic access",
|
|
41
|
+
declaration: iface,
|
|
42
|
+
implementation: {
|
|
43
|
+
health: Observe.fromConstant(42),
|
|
44
|
+
stats: Observe.fromConstant({ hp: 100, label: "ok" }),
|
|
45
|
+
heal: (input) => {
|
|
46
|
+
},
|
|
47
|
+
configure: (input) => {
|
|
48
|
+
},
|
|
49
|
+
reset: () => { },
|
|
50
|
+
},
|
|
51
|
+
conditional: {
|
|
52
|
+
health: Observe.fromConstant(true),
|
|
53
|
+
heal: Observe.fromConstant(false),
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
createFromConfig({
|
|
57
|
+
description: "Player health and actions for agentic access",
|
|
58
|
+
declaration: iface,
|
|
59
|
+
implementation: {
|
|
60
|
+
// @ts-expect-error - health state requires Observe<number>
|
|
61
|
+
health: Observe.fromConstant("wrong"),
|
|
62
|
+
stats: Observe.fromConstant({ hp: 100 }),
|
|
63
|
+
heal: (input) => { },
|
|
64
|
+
configure: (input) => { },
|
|
65
|
+
reset: () => { },
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
createFromConfig({
|
|
69
|
+
description: "Player health and actions for agentic access",
|
|
70
|
+
declaration: iface,
|
|
71
|
+
implementation: {
|
|
72
|
+
health: Observe.fromConstant(100),
|
|
73
|
+
stats: Observe.fromConstant({ hp: 100 }),
|
|
74
|
+
// @ts-expect-error - heal input schema requires number
|
|
75
|
+
heal: (input) => { },
|
|
76
|
+
configure: (input) => { },
|
|
77
|
+
reset: () => { },
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
createFromConfig({
|
|
81
|
+
description: "Player health and actions for agentic access",
|
|
82
|
+
declaration: iface,
|
|
83
|
+
implementation: {
|
|
84
|
+
health: Observe.fromConstant(100),
|
|
85
|
+
stats: Observe.fromConstant({ hp: 100 }),
|
|
86
|
+
heal: (input) => { },
|
|
87
|
+
configure: (input) => { },
|
|
88
|
+
// @ts-expect-error - reset action has no input schema
|
|
89
|
+
reset: (input) => { },
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
createFromConfig({
|
|
93
|
+
description: "Player health and actions for agentic access",
|
|
94
|
+
declaration: iface,
|
|
95
|
+
// @ts-expect-error - implementation must include every definition key
|
|
96
|
+
implementation: {
|
|
97
|
+
health: Observe.fromConstant(100),
|
|
98
|
+
stats: Observe.fromConstant({ hp: 100 }),
|
|
99
|
+
heal: (input) => { },
|
|
100
|
+
configure: (input) => { },
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
createFromConfig({
|
|
104
|
+
description: "Player health and actions for agentic access",
|
|
105
|
+
declaration: iface,
|
|
106
|
+
implementation: {
|
|
107
|
+
health: Observe.fromConstant(100),
|
|
108
|
+
stats: Observe.fromConstant({ hp: 100 }),
|
|
109
|
+
heal: (input) => { },
|
|
110
|
+
configure: (input) => { },
|
|
111
|
+
reset: () => { },
|
|
112
|
+
},
|
|
113
|
+
conditional: {
|
|
114
|
+
health: Observe.fromConstant(true),
|
|
115
|
+
// @ts-expect-error - conditional values must be Observe<boolean>
|
|
116
|
+
heal: Observe.fromConstant(1),
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
//# sourceMappingURL=create.interface-first-spike.type-test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.interface-first-spike.type-test.js","sourceRoot":"","sources":["../../../src/service/agentic-service/create.interface-first-spike.type-test.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EACH,gBAAgB,GAEnB,MAAM,yBAAyB,CAAC;AAyBjC,MAAM,KAAK,GAAG;IACV,MAAM,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,uBAAuB;KACvC;IACD,KAAK,EAAE;QACH,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,sBAAsB;QACnC,UAAU,EAAE;YACR,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACtB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC5B;QACD,QAAQ,EAAE,CAAC,IAAI,CAAC;QAChB,oBAAoB,EAAE,KAAK;KAC9B;IACD,IAAI,EAAE;QACF,WAAW,EAAE,2BAA2B;QACxC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC5B;IACD,SAAS,EAAE;QACP,WAAW,EAAE,iBAAiB;QAC9B,KAAK,EAAE;YACH,IAAI,EAAE,QAAQ;YACd,UAAU,EAA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W,EAAE,KAAK;IAClB,cAAc,EAAE;QACZ,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC;QACjC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC;QACxC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,GAAE,CAAC;QACnB,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,GAAE,CAAC;QACxB,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;KAClB;IACD,WAAW,EAAE;QACT,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC;QAClC,iEAAiE;QACjE,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;KAChC;CACJ,CAAC,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
2
|
import { Observe } from "../../observe/index.js";
|
|
3
|
-
function getActionSchema(entry) {
|
|
4
|
-
return entry.input ?? false;
|
|
5
|
-
}
|
|
6
3
|
/**
|
|
7
4
|
* Creates an AgenticService from a config with interface, implementation, and optional conditional.
|
|
8
5
|
*
|
|
@@ -29,7 +26,7 @@ export function create(config) {
|
|
|
29
26
|
actionKeys.push(key);
|
|
30
27
|
actionMeta[key] = {
|
|
31
28
|
description: entry.description,
|
|
32
|
-
schema:
|
|
29
|
+
schema: entry.parameters[0] ?? false,
|
|
33
30
|
execute: implementation[key],
|
|
34
31
|
};
|
|
35
32
|
}
|
|
@@ -74,8 +71,9 @@ export function create(config) {
|
|
|
74
71
|
if (!enabled)
|
|
75
72
|
continue;
|
|
76
73
|
const meta = actionMeta[key];
|
|
77
|
-
if (meta)
|
|
74
|
+
if (meta) {
|
|
78
75
|
result[key] = meta;
|
|
76
|
+
}
|
|
79
77
|
}
|
|
80
78
|
return result;
|
|
81
79
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/service/agentic-service/create.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAgCjD
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/service/agentic-service/create.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAgCjD;;;;;;;;GAQG;AACH,MAAM,UAAU,MAAM,CAA+B,MAIpD;IACG,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IACjE,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAEjD,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,YAAY,GAA2B,EAAE,CAAC;IAChD,MAAM,UAAU,GAAwF,EAAE,CAAC;IAE3G,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/C,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YACzB,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACpB,YAAY,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;QACrC,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACjC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACrB,UAAU,CAAC,GAAG,CAAC,GAAG;gBACd,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,KAAK;gBACpC,OAAO,EAAG,cAA2C,CAAC,GAAG,CAAC;aAC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;IAExC,MAAM,OAAO,GAAG,KAAK,EAAE,UAAkB,EAAE,KAAc,EAAwC,EAAE;QAC/F,MAAM,KAAK,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK;YAAE,OAAO,WAAW,UAAU,oBAAoB,CAAC;QAC7D,OAAQ,KAAK,CAAC,OAAoB,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC,CAAC;IAEF,MAAM,KAAK,GACP,QAAQ,CAAC,MAAM,GAAG,CAAC;QACf,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE;YAClE,MAAM,MAAM,GAAwB,EAAE,CAAC;YACvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC7C,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAoD,CAAC;gBAChF,IAAI,OAAO,IAAI,KAAK;oBAAE,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAC9C,CAAC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC;QACF,CAAC,CAAC,SAAS,CAAC;IACpB,OAAO;QACH,WAAW,EAAE,iBAAiB;QAC9B,MAAM;QACN,OAAO;QACP,OAAO;QACP,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;KACxC,CAAC;AACN,CAAC"}
|
|
@@ -54,7 +54,11 @@ describe("AgenticService.create", () => {
|
|
|
54
54
|
it("should accept action with schema-typed input", () => {
|
|
55
55
|
create({
|
|
56
56
|
interface: {
|
|
57
|
-
setHealth: {
|
|
57
|
+
setHealth: {
|
|
58
|
+
type: "action",
|
|
59
|
+
description: "Set health",
|
|
60
|
+
parameters: [{ type: "number" }],
|
|
61
|
+
},
|
|
58
62
|
},
|
|
59
63
|
implementation: {
|
|
60
64
|
setHealth: async (_input) => { },
|
|
@@ -64,7 +68,11 @@ describe("AgenticService.create", () => {
|
|
|
64
68
|
it("should accept action with schema: false (void execute)", () => {
|
|
65
69
|
create({
|
|
66
70
|
interface: {
|
|
67
|
-
reset: {
|
|
71
|
+
reset: {
|
|
72
|
+
type: "action",
|
|
73
|
+
description: "Reset to defaults",
|
|
74
|
+
parameters: [],
|
|
75
|
+
},
|
|
68
76
|
},
|
|
69
77
|
implementation: {
|
|
70
78
|
reset: async () => { },
|
|
@@ -99,15 +107,17 @@ describe("AgenticService.create", () => {
|
|
|
99
107
|
configure: {
|
|
100
108
|
type: "action",
|
|
101
109
|
description: "Configure",
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
110
|
+
parameters: [
|
|
111
|
+
{
|
|
112
|
+
type: "object",
|
|
113
|
+
properties: {
|
|
114
|
+
hp: { type: "number" },
|
|
115
|
+
name: { type: "string" },
|
|
116
|
+
},
|
|
117
|
+
required: ["hp", "name"],
|
|
118
|
+
additionalProperties: false,
|
|
107
119
|
},
|
|
108
|
-
|
|
109
|
-
additionalProperties: false,
|
|
110
|
-
},
|
|
120
|
+
],
|
|
111
121
|
},
|
|
112
122
|
},
|
|
113
123
|
implementation: {
|
|
@@ -118,8 +128,16 @@ describe("AgenticService.create", () => {
|
|
|
118
128
|
it("should accept mixed actions with and without schemas", () => {
|
|
119
129
|
create({
|
|
120
130
|
interface: {
|
|
121
|
-
heal: {
|
|
122
|
-
|
|
131
|
+
heal: {
|
|
132
|
+
type: "action",
|
|
133
|
+
description: "Heal",
|
|
134
|
+
parameters: [{ type: "number" }],
|
|
135
|
+
},
|
|
136
|
+
reset: {
|
|
137
|
+
type: "action",
|
|
138
|
+
description: "Reset",
|
|
139
|
+
parameters: [],
|
|
140
|
+
},
|
|
123
141
|
},
|
|
124
142
|
implementation: {
|
|
125
143
|
heal: async (_amount) => { },
|
|
@@ -130,8 +148,16 @@ describe("AgenticService.create", () => {
|
|
|
130
148
|
it("should accept synchronous void-returning execute", () => {
|
|
131
149
|
create({
|
|
132
150
|
interface: {
|
|
133
|
-
sync: {
|
|
134
|
-
|
|
151
|
+
sync: {
|
|
152
|
+
type: "action",
|
|
153
|
+
description: "Sync",
|
|
154
|
+
parameters: [],
|
|
155
|
+
},
|
|
156
|
+
syncWithInput: {
|
|
157
|
+
type: "action",
|
|
158
|
+
description: "Sync with input",
|
|
159
|
+
parameters: [{ type: "number" }],
|
|
160
|
+
},
|
|
135
161
|
},
|
|
136
162
|
implementation: {
|
|
137
163
|
sync: () => { },
|
|
@@ -144,7 +170,11 @@ describe("AgenticService.create", () => {
|
|
|
144
170
|
create({
|
|
145
171
|
interface: {
|
|
146
172
|
health: { type: "state", schema: { type: "number" }, description: "Health" },
|
|
147
|
-
heal: {
|
|
173
|
+
heal: {
|
|
174
|
+
type: "action",
|
|
175
|
+
description: "Heal",
|
|
176
|
+
parameters: [{ type: "number" }],
|
|
177
|
+
},
|
|
148
178
|
},
|
|
149
179
|
implementation: {
|
|
150
180
|
health: db.observe.resources.health,
|
|
@@ -264,7 +294,11 @@ describe("AgenticService.create", () => {
|
|
|
264
294
|
it("should default action enabled to always true when omitted", async () => {
|
|
265
295
|
const service = create({
|
|
266
296
|
interface: {
|
|
267
|
-
heal: {
|
|
297
|
+
heal: {
|
|
298
|
+
type: "action",
|
|
299
|
+
description: "Heal",
|
|
300
|
+
parameters: [{ type: "number" }],
|
|
301
|
+
},
|
|
268
302
|
},
|
|
269
303
|
implementation: {
|
|
270
304
|
heal: async () => { },
|
|
@@ -280,9 +314,15 @@ describe("AgenticService.create", () => {
|
|
|
280
314
|
const service = create({
|
|
281
315
|
interface: {
|
|
282
316
|
currentHealth: { type: "state", schema: { type: "number" }, description: "Health" },
|
|
317
|
+
refresh: {
|
|
318
|
+
type: "action",
|
|
319
|
+
description: "Refresh",
|
|
320
|
+
parameters: [],
|
|
321
|
+
},
|
|
283
322
|
},
|
|
284
323
|
implementation: {
|
|
285
324
|
currentHealth: db.observe.resources.health,
|
|
325
|
+
refresh: async () => { },
|
|
286
326
|
},
|
|
287
327
|
});
|
|
288
328
|
const states = await Observe.toPromise(service.states);
|
|
@@ -351,7 +391,11 @@ describe("AgenticService.create", () => {
|
|
|
351
391
|
it("should emit enabled actions with bound execute", async () => {
|
|
352
392
|
const service = create({
|
|
353
393
|
interface: {
|
|
354
|
-
heal: {
|
|
394
|
+
heal: {
|
|
395
|
+
type: "action",
|
|
396
|
+
description: "Heal player",
|
|
397
|
+
parameters: [{ type: "number" }],
|
|
398
|
+
},
|
|
355
399
|
},
|
|
356
400
|
implementation: {
|
|
357
401
|
heal: async (_amount) => { },
|
|
@@ -366,8 +410,16 @@ describe("AgenticService.create", () => {
|
|
|
366
410
|
it("should omit disabled actions", async () => {
|
|
367
411
|
const service = create({
|
|
368
412
|
interface: {
|
|
369
|
-
available: {
|
|
370
|
-
|
|
413
|
+
available: {
|
|
414
|
+
type: "action",
|
|
415
|
+
description: "Available",
|
|
416
|
+
parameters: [{ type: "number" }],
|
|
417
|
+
},
|
|
418
|
+
unavailable: {
|
|
419
|
+
type: "action",
|
|
420
|
+
description: "Unavailable",
|
|
421
|
+
parameters: [],
|
|
422
|
+
},
|
|
371
423
|
},
|
|
372
424
|
implementation: {
|
|
373
425
|
available: async () => { },
|
|
@@ -386,7 +438,11 @@ describe("AgenticService.create", () => {
|
|
|
386
438
|
const [enabledObserve, setEnabled] = Observe.createState(true);
|
|
387
439
|
const service = create({
|
|
388
440
|
interface: {
|
|
389
|
-
heal: {
|
|
441
|
+
heal: {
|
|
442
|
+
type: "action",
|
|
443
|
+
description: "Heal",
|
|
444
|
+
parameters: [{ type: "number" }],
|
|
445
|
+
},
|
|
390
446
|
},
|
|
391
447
|
implementation: {
|
|
392
448
|
heal: async () => { },
|
|
@@ -405,7 +461,11 @@ describe("AgenticService.create", () => {
|
|
|
405
461
|
let received;
|
|
406
462
|
const service = create({
|
|
407
463
|
interface: {
|
|
408
|
-
setHealth: {
|
|
464
|
+
setHealth: {
|
|
465
|
+
type: "action",
|
|
466
|
+
description: "Set health",
|
|
467
|
+
parameters: [{ type: "number" }],
|
|
468
|
+
},
|
|
409
469
|
},
|
|
410
470
|
implementation: {
|
|
411
471
|
setHealth: async (input) => { received = input; },
|
|
@@ -419,7 +479,11 @@ describe("AgenticService.create", () => {
|
|
|
419
479
|
let called = false;
|
|
420
480
|
const service = create({
|
|
421
481
|
interface: {
|
|
422
|
-
reset: {
|
|
482
|
+
reset: {
|
|
483
|
+
type: "action",
|
|
484
|
+
description: "Reset",
|
|
485
|
+
parameters: [],
|
|
486
|
+
},
|
|
423
487
|
},
|
|
424
488
|
implementation: {
|
|
425
489
|
reset: async () => { called = true; },
|
|
@@ -432,7 +496,11 @@ describe("AgenticService.create", () => {
|
|
|
432
496
|
let called = false;
|
|
433
497
|
const service = create({
|
|
434
498
|
interface: {
|
|
435
|
-
sync: {
|
|
499
|
+
sync: {
|
|
500
|
+
type: "action",
|
|
501
|
+
description: "Sync",
|
|
502
|
+
parameters: [],
|
|
503
|
+
},
|
|
436
504
|
},
|
|
437
505
|
implementation: {
|
|
438
506
|
sync: () => { called = true; },
|
|
@@ -444,7 +512,11 @@ describe("AgenticService.create", () => {
|
|
|
444
512
|
it("should return error for unavailable action", async () => {
|
|
445
513
|
const service = create({
|
|
446
514
|
interface: {
|
|
447
|
-
heal: {
|
|
515
|
+
heal: {
|
|
516
|
+
type: "action",
|
|
517
|
+
description: "Heal",
|
|
518
|
+
parameters: [{ type: "number" }],
|
|
519
|
+
},
|
|
448
520
|
},
|
|
449
521
|
implementation: {
|
|
450
522
|
heal: async () => { },
|
|
@@ -465,7 +537,11 @@ describe("AgenticService.create", () => {
|
|
|
465
537
|
it("should propagate ActionError from execute", async () => {
|
|
466
538
|
const service = create({
|
|
467
539
|
interface: {
|
|
468
|
-
fail: {
|
|
540
|
+
fail: {
|
|
541
|
+
type: "action",
|
|
542
|
+
description: "Fail",
|
|
543
|
+
parameters: [],
|
|
544
|
+
},
|
|
469
545
|
},
|
|
470
546
|
implementation: {
|
|
471
547
|
fail: async () => "something went wrong",
|
|
@@ -479,7 +555,11 @@ describe("AgenticService.create", () => {
|
|
|
479
555
|
let called = false;
|
|
480
556
|
const service = create({
|
|
481
557
|
interface: {
|
|
482
|
-
heal: {
|
|
558
|
+
heal: {
|
|
559
|
+
type: "action",
|
|
560
|
+
description: "Heal",
|
|
561
|
+
parameters: [{ type: "number" }],
|
|
562
|
+
},
|
|
483
563
|
},
|
|
484
564
|
implementation: {
|
|
485
565
|
heal: async () => { called = true; },
|
|
@@ -529,8 +609,16 @@ describe("AgenticService.create", () => {
|
|
|
529
609
|
const [enableReset, setEnableReset] = Observe.createState(true);
|
|
530
610
|
const service = create({
|
|
531
611
|
interface: {
|
|
532
|
-
heal: {
|
|
533
|
-
|
|
612
|
+
heal: {
|
|
613
|
+
type: "action",
|
|
614
|
+
description: "Heal",
|
|
615
|
+
parameters: [{ type: "number" }],
|
|
616
|
+
},
|
|
617
|
+
reset: {
|
|
618
|
+
type: "action",
|
|
619
|
+
description: "Reset",
|
|
620
|
+
parameters: [],
|
|
621
|
+
},
|
|
534
622
|
},
|
|
535
623
|
implementation: {
|
|
536
624
|
heal: async () => { },
|
|
@@ -556,7 +644,11 @@ describe("AgenticService.create", () => {
|
|
|
556
644
|
let received;
|
|
557
645
|
const service = create({
|
|
558
646
|
interface: {
|
|
559
|
-
heal: {
|
|
647
|
+
heal: {
|
|
648
|
+
type: "action",
|
|
649
|
+
description: "Heal",
|
|
650
|
+
parameters: [{ type: "number" }],
|
|
651
|
+
},
|
|
560
652
|
},
|
|
561
653
|
implementation: {
|
|
562
654
|
heal: async (input) => { received = input; },
|
|
@@ -570,7 +662,11 @@ describe("AgenticService.create", () => {
|
|
|
570
662
|
let called = false;
|
|
571
663
|
const service = create({
|
|
572
664
|
interface: {
|
|
573
|
-
reset: {
|
|
665
|
+
reset: {
|
|
666
|
+
type: "action",
|
|
667
|
+
description: "Reset",
|
|
668
|
+
parameters: [],
|
|
669
|
+
},
|
|
574
670
|
},
|
|
575
671
|
implementation: {
|
|
576
672
|
reset: async () => { called = true; },
|
|
@@ -583,7 +679,11 @@ describe("AgenticService.create", () => {
|
|
|
583
679
|
it("should propagate ActionError from bound action execute", async () => {
|
|
584
680
|
const service = create({
|
|
585
681
|
interface: {
|
|
586
|
-
fail: {
|
|
682
|
+
fail: {
|
|
683
|
+
type: "action",
|
|
684
|
+
description: "Fail",
|
|
685
|
+
parameters: [],
|
|
686
|
+
},
|
|
587
687
|
},
|
|
588
688
|
implementation: {
|
|
589
689
|
fail: async () => "bound error",
|