@cef-ai/agent-sdk 1.1.0 → 1.2.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/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/register.d.ts +18 -7
- package/dist/runtime/register.d.ts.map +1 -1
- package/dist/runtime/register.js +28 -15
- package/dist/runtime/register.js.map +1 -1
- package/package.json +1 -1
package/dist/runtime/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Agent authors never import this directly — `cef build` wires it in.
|
|
11
11
|
*/
|
|
12
|
-
export { handlerKey, LIFECYCLE_CLOSE_KEY, LIFECYCLE_START_KEY, registerHandlers, } from "./register.js";
|
|
12
|
+
export { handlerKey, LIFECYCLE_CLOSE_KEY, LIFECYCLE_START_KEY, registerHandlers, SYNTHETIC_CLOSE_EVENT, SYNTHETIC_START_EVENT, } from "./register.js";
|
|
13
13
|
export type { BuildEngagementMeta, RegisterOptions } from "./register.js";
|
|
14
14
|
export { buildContext } from "./ctx.js";
|
|
15
15
|
export type { InvokeContext, ModelRef } from "./types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,KAAK,SAAS,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/runtime/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Agent authors never import this directly — `cef build` wires it in.
|
|
11
11
|
*/
|
|
12
|
-
export { handlerKey, LIFECYCLE_CLOSE_KEY, LIFECYCLE_START_KEY, registerHandlers, } from "./register.js";
|
|
12
|
+
export { handlerKey, LIFECYCLE_CLOSE_KEY, LIFECYCLE_START_KEY, registerHandlers, SYNTHETIC_CLOSE_EVENT, SYNTHETIC_START_EVENT, } from "./register.js";
|
|
13
13
|
export { buildContext } from "./ctx.js";
|
|
14
14
|
export { RESULT_MODEL_CALLS_KEY, UsageAccumulator } from "./usage.js";
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAkB,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -2,17 +2,28 @@ import type { ModelRef } from "./types.js";
|
|
|
2
2
|
/** Lifecycle handler keys — must match orchestrator marketplace constants. */
|
|
3
3
|
export declare const LIFECYCLE_START_KEY = "onStart";
|
|
4
4
|
export declare const LIFECYCLE_CLOSE_KEY = "onClose";
|
|
5
|
+
/**
|
|
6
|
+
* Synthetic event-type sentinels the orchestrator injects when an engagement
|
|
7
|
+
* starts / closes — must match ddc-node marketplace `EventTypeSyntheticStart`
|
|
8
|
+
* / `EventTypeSyntheticClose`. `cef build` keys lifecycle dispatch in the
|
|
9
|
+
* manifest's `handlers` map under these (mapping them to the fixed
|
|
10
|
+
* `LIFECYCLE_*_KEY` handler names), so the orchestrator resolves lifecycle via
|
|
11
|
+
* the same `handlers[eventType]` lookup as ordinary events.
|
|
12
|
+
*/
|
|
13
|
+
export declare const SYNTHETIC_START_EVENT = "__start__";
|
|
14
|
+
export declare const SYNTHETIC_CLOSE_EVENT = "__close__";
|
|
5
15
|
/**
|
|
6
16
|
* Key under which an engagement's event handler is exposed on `__handlers`
|
|
7
|
-
* (and stored in the manifest's `
|
|
8
|
-
* namespaced by engagement id so two engagements can each declare a
|
|
9
|
-
* of the same name without colliding in the flat map — the
|
|
10
|
-
* returns this string verbatim from `HandlerFor`, so AR looks up
|
|
11
|
-
* this key. Lifecycle
|
|
12
|
-
* `onStart` / `onClose
|
|
17
|
+
* (and stored as a value in the manifest's `handlers` map). Event-handler
|
|
18
|
+
* keys are namespaced by engagement id so two engagements can each declare a
|
|
19
|
+
* method of the same name without colliding in the flat map — the
|
|
20
|
+
* orchestrator returns this string verbatim from `HandlerFor`, so AR looks up
|
|
21
|
+
* exactly this key. Lifecycle handlers are NOT namespaced: the orchestrator
|
|
22
|
+
* resolves them to the fixed `onStart` / `onClose` keys, so those remain
|
|
23
|
+
* agent-global.
|
|
13
24
|
*
|
|
14
25
|
* Used by BOTH the runtime (to build `__handlers`) and `cef build` (to emit
|
|
15
|
-
* `
|
|
26
|
+
* the `handlers` map); the two MUST agree, hence the single helper.
|
|
16
27
|
*/
|
|
17
28
|
export declare function handlerKey(engagementId: string, method: string): string;
|
|
18
29
|
type EngagementClass = new () => Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/runtime/register.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/runtime/register.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,YAAY,CAAC;AAW1D,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,cAAc,CAAC;AACjD,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAEjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,KAAK,eAAe,GAAG,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAGzD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,SAAS,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C;AA0CD,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EAC5C,OAAO,GAAE,eAAoB,GAC5B,IAAI,CAyCN"}
|
package/dist/runtime/register.js
CHANGED
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
* Agent Runtime dispatches against (AR ADR-001: `__handlers[name](event,
|
|
6
6
|
* context)`).
|
|
7
7
|
*
|
|
8
|
-
* Handler-key scheme (must match what the manifest's `
|
|
9
|
-
*
|
|
10
|
-
* - Event handlers are keyed
|
|
11
|
-
* `engagements[].
|
|
12
|
-
* returns it verbatim from `HandlerFor`).
|
|
13
|
-
* - Lifecycle
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
8
|
+
* Handler-key scheme (must match what the manifest's `handlers` map +
|
|
9
|
+
* orchestrator `HandlerFor` expect):
|
|
10
|
+
* - Event handlers are keyed `<engagementId>::<method>` (the value the
|
|
11
|
+
* manifest's `engagements[].handlers{eventType → key}` carries; the
|
|
12
|
+
* orchestrator returns it verbatim from `HandlerFor`).
|
|
13
|
+
* - Lifecycle handlers are keyed by the fixed constants `onStart` /
|
|
14
|
+
* `onClose`; the manifest's `handlers` map points the synthetic
|
|
15
|
+
* `__start__` / `__close__` event types at these keys, so lifecycle
|
|
16
|
+
* dispatch flows through the same `handlers[eventType]` lookup as
|
|
17
|
+
* ordinary events (no separate `hooks` array).
|
|
16
18
|
*
|
|
17
19
|
* Because the key space is flat across all engagements, two engagements
|
|
18
20
|
* declaring the same handler key collide; we throw at registration with a
|
|
@@ -37,17 +39,28 @@ let bakedModels = {};
|
|
|
37
39
|
/** Lifecycle handler keys — must match orchestrator marketplace constants. */
|
|
38
40
|
export const LIFECYCLE_START_KEY = "onStart";
|
|
39
41
|
export const LIFECYCLE_CLOSE_KEY = "onClose";
|
|
42
|
+
/**
|
|
43
|
+
* Synthetic event-type sentinels the orchestrator injects when an engagement
|
|
44
|
+
* starts / closes — must match ddc-node marketplace `EventTypeSyntheticStart`
|
|
45
|
+
* / `EventTypeSyntheticClose`. `cef build` keys lifecycle dispatch in the
|
|
46
|
+
* manifest's `handlers` map under these (mapping them to the fixed
|
|
47
|
+
* `LIFECYCLE_*_KEY` handler names), so the orchestrator resolves lifecycle via
|
|
48
|
+
* the same `handlers[eventType]` lookup as ordinary events.
|
|
49
|
+
*/
|
|
50
|
+
export const SYNTHETIC_START_EVENT = "__start__";
|
|
51
|
+
export const SYNTHETIC_CLOSE_EVENT = "__close__";
|
|
40
52
|
/**
|
|
41
53
|
* Key under which an engagement's event handler is exposed on `__handlers`
|
|
42
|
-
* (and stored in the manifest's `
|
|
43
|
-
* namespaced by engagement id so two engagements can each declare a
|
|
44
|
-
* of the same name without colliding in the flat map — the
|
|
45
|
-
* returns this string verbatim from `HandlerFor`, so AR looks up
|
|
46
|
-
* this key. Lifecycle
|
|
47
|
-
* `onStart` / `onClose
|
|
54
|
+
* (and stored as a value in the manifest's `handlers` map). Event-handler
|
|
55
|
+
* keys are namespaced by engagement id so two engagements can each declare a
|
|
56
|
+
* method of the same name without colliding in the flat map — the
|
|
57
|
+
* orchestrator returns this string verbatim from `HandlerFor`, so AR looks up
|
|
58
|
+
* exactly this key. Lifecycle handlers are NOT namespaced: the orchestrator
|
|
59
|
+
* resolves them to the fixed `onStart` / `onClose` keys, so those remain
|
|
60
|
+
* agent-global.
|
|
48
61
|
*
|
|
49
62
|
* Used by BOTH the runtime (to build `__handlers`) and `cef build` (to emit
|
|
50
|
-
* `
|
|
63
|
+
* the `handlers` map); the two MUST agree, hence the single helper.
|
|
51
64
|
*/
|
|
52
65
|
export function handlerKey(engagementId, method) {
|
|
53
66
|
return `${engagementId}::${method}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/runtime/register.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/runtime/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,mBAAmB,EAAuB,MAAM,eAAe,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC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