@gamekits/ai-core 0.1.0-alpha.6
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/composition/create-ai-module.d.ts +5 -0
- package/dist/composition/create-ai-module.d.ts.map +1 -0
- package/dist/composition/create-ai-runtime.d.ts +4 -0
- package/dist/composition/create-ai-runtime.d.ts.map +1 -0
- package/dist/composition/index.d.ts +4 -0
- package/dist/composition/index.d.ts.map +1 -0
- package/dist/composition/options.d.ts +48 -0
- package/dist/composition/options.d.ts.map +1 -0
- package/dist/composition/registry.d.ts +4 -0
- package/dist/composition/registry.d.ts.map +1 -0
- package/dist/composition/runtime-config.d.ts +26 -0
- package/dist/composition/runtime-config.d.ts.map +1 -0
- package/dist/contracts/agent-binding.d.ts +9 -0
- package/dist/contracts/agent-binding.d.ts.map +1 -0
- package/dist/contracts/agent-context.d.ts +21 -0
- package/dist/contracts/agent-context.d.ts.map +1 -0
- package/dist/contracts/blackboard-value.d.ts +5 -0
- package/dist/contracts/blackboard-value.d.ts.map +1 -0
- package/dist/contracts/clone-binding.d.ts +3 -0
- package/dist/contracts/clone-binding.d.ts.map +1 -0
- package/dist/contracts/clone-runtime-value.d.ts +3 -0
- package/dist/contracts/clone-runtime-value.d.ts.map +1 -0
- package/dist/contracts/errors.d.ts +8 -0
- package/dist/contracts/errors.d.ts.map +1 -0
- package/dist/contracts/index.d.ts +10 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/intent.d.ts +42 -0
- package/dist/contracts/intent.d.ts.map +1 -0
- package/dist/contracts/navigation-access.d.ts +16 -0
- package/dist/contracts/navigation-access.d.ts.map +1 -0
- package/dist/contracts/navigation-queries.d.ts +3 -0
- package/dist/contracts/navigation-queries.d.ts.map +1 -0
- package/dist/contracts/physics-queries.d.ts +3 -0
- package/dist/contracts/physics-queries.d.ts.map +1 -0
- package/dist/contracts/shared-fact-queries.d.ts +7 -0
- package/dist/contracts/shared-fact-queries.d.ts.map +1 -0
- package/dist/contracts/world-read-model.d.ts +9 -0
- package/dist/contracts/world-read-model.d.ts.map +1 -0
- package/dist/controller/agent-context-factory.d.ts +23 -0
- package/dist/controller/agent-context-factory.d.ts.map +1 -0
- package/dist/controller/agent-state.d.ts +29 -0
- package/dist/controller/agent-state.d.ts.map +1 -0
- package/dist/controller/create-agent-state.d.ts +12 -0
- package/dist/controller/create-agent-state.d.ts.map +1 -0
- package/dist/controller/create-ai-handle.d.ts +8 -0
- package/dist/controller/create-ai-handle.d.ts.map +1 -0
- package/dist/controller/goal-controller.d.ts +21 -0
- package/dist/controller/goal-controller.d.ts.map +1 -0
- package/dist/controller/index.d.ts +3 -0
- package/dist/controller/index.d.ts.map +1 -0
- package/dist/controller/runtime.d.ts +29 -0
- package/dist/controller/runtime.d.ts.map +1 -0
- package/dist/create-ai-runtime-Cd-h8AF9.js +1867 -0
- package/dist/decision/cooldowns.d.ts +2 -0
- package/dist/decision/cooldowns.d.ts.map +1 -0
- package/dist/decision/goal-scoring.d.ts +12 -0
- package/dist/decision/goal-scoring.d.ts.map +1 -0
- package/dist/decision/goal-selection.d.ts +17 -0
- package/dist/decision/goal-selection.d.ts.map +1 -0
- package/dist/decision/index.d.ts +3 -0
- package/dist/decision/index.d.ts.map +1 -0
- package/dist/decision/utility-curve.d.ts +4 -0
- package/dist/decision/utility-curve.d.ts.map +1 -0
- package/dist/decision/utility.d.ts +47 -0
- package/dist/decision/utility.d.ts.map +1 -0
- package/dist/definition/agent-definition-compiler.d.ts +12 -0
- package/dist/definition/agent-definition-compiler.d.ts.map +1 -0
- package/dist/definition/agent-definition.d.ts +12 -0
- package/dist/definition/agent-definition.d.ts.map +1 -0
- package/dist/definition/ai-data-types.d.ts +16 -0
- package/dist/definition/ai-data-types.d.ts.map +1 -0
- package/dist/definition/clone-definitions.d.ts +9 -0
- package/dist/definition/clone-definitions.d.ts.map +1 -0
- package/dist/definition/compiled-agent-definition.d.ts +23 -0
- package/dist/definition/compiled-agent-definition.d.ts.map +1 -0
- package/dist/definition/goal-definition.d.ts +14 -0
- package/dist/definition/goal-definition.d.ts.map +1 -0
- package/dist/definition/index.d.ts +6 -0
- package/dist/definition/index.d.ts.map +1 -0
- package/dist/definition/sensor-definition.d.ts +8 -0
- package/dist/definition/sensor-definition.d.ts.map +1 -0
- package/dist/definition/task-definition.d.ts +10 -0
- package/dist/definition/task-definition.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +205 -0
- package/dist/memory/blackboard.d.ts +24 -0
- package/dist/memory/blackboard.d.ts.map +1 -0
- package/dist/memory/index.d.ts +3 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/observability/index.d.ts +3 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/snapshot-projection.d.ts +17 -0
- package/dist/observability/snapshot-projection.d.ts.map +1 -0
- package/dist/observability/snapshot.d.ts +32 -0
- package/dist/observability/snapshot.d.ts.map +1 -0
- package/dist/observability/trace-recorder.d.ts +17 -0
- package/dist/observability/trace-recorder.d.ts.map +1 -0
- package/dist/observability/trace-store.d.ts +15 -0
- package/dist/observability/trace-store.d.ts.map +1 -0
- package/dist/observability/trace.d.ts +29 -0
- package/dist/observability/trace.d.ts.map +1 -0
- package/dist/perception/index.d.ts +3 -0
- package/dist/perception/index.d.ts.map +1 -0
- package/dist/perception/perception-controller.d.ts +27 -0
- package/dist/perception/perception-controller.d.ts.map +1 -0
- package/dist/perception/perception-fact.d.ts +12 -0
- package/dist/perception/perception-fact.d.ts.map +1 -0
- package/dist/perception/perception-memory.d.ts +8 -0
- package/dist/perception/perception-memory.d.ts.map +1 -0
- package/dist/perception/sensor-sampler.d.ts +8 -0
- package/dist/perception/sensor-sampler.d.ts.map +1 -0
- package/dist/persistence/checkpoint-compatibility.d.ts +4 -0
- package/dist/persistence/checkpoint-compatibility.d.ts.map +1 -0
- package/dist/persistence/checkpoint-projection.d.ts +5 -0
- package/dist/persistence/checkpoint-projection.d.ts.map +1 -0
- package/dist/persistence/checkpoint-validation.d.ts +3 -0
- package/dist/persistence/checkpoint-validation.d.ts.map +1 -0
- package/dist/persistence/checkpoint.d.ts +30 -0
- package/dist/persistence/checkpoint.d.ts.map +1 -0
- package/dist/persistence/index.d.ts +3 -0
- package/dist/persistence/index.d.ts.map +1 -0
- package/dist/persistence/restore-binding.d.ts +4 -0
- package/dist/persistence/restore-binding.d.ts.map +1 -0
- package/dist/persistence/restore-task-state.d.ts +4 -0
- package/dist/persistence/restore-task-state.d.ts.map +1 -0
- package/dist/persistence/save-contributor.d.ts +15 -0
- package/dist/persistence/save-contributor.d.ts.map +1 -0
- package/dist/scheduler/decision-scheduler.d.ts +20 -0
- package/dist/scheduler/decision-scheduler.d.ts.map +1 -0
- package/dist/scheduler/due-work.d.ts +8 -0
- package/dist/scheduler/due-work.d.ts.map +1 -0
- package/dist/scheduler/index.d.ts +2 -0
- package/dist/scheduler/index.d.ts.map +1 -0
- package/dist/scheduler/reclassify-agent.d.ts +13 -0
- package/dist/scheduler/reclassify-agent.d.ts.map +1 -0
- package/dist/scheduler/scheduler-class.d.ts +7 -0
- package/dist/scheduler/scheduler-class.d.ts.map +1 -0
- package/dist/scheduler/timing.d.ts +3 -0
- package/dist/scheduler/timing.d.ts.map +1 -0
- package/dist/task/clone-task-state.d.ts +3 -0
- package/dist/task/clone-task-state.d.ts.map +1 -0
- package/dist/task/index.d.ts +2 -0
- package/dist/task/index.d.ts.map +1 -0
- package/dist/task/task-controller.d.ts +41 -0
- package/dist/task/task-controller.d.ts.map +1 -0
- package/dist/task/task-executor.d.ts +37 -0
- package/dist/task/task-executor.d.ts.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +126 -0
- package/dist/testing/memory-runtime-fixture.d.ts +17 -0
- package/dist/testing/memory-runtime-fixture.d.ts.map +1 -0
- package/dist/testing/runtime-conformance.d.ts +14 -0
- package/dist/testing/runtime-conformance.d.ts.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-recorder.d.ts","sourceRoot":"","sources":["../../src/observability/trace-recorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,IAAI,IAAI,CAAC;IACpB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,GAAG,IAAI,CAAC;IAC1E,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,OAAO,IAAI,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;CAC1B,GAAG,eAAe,CAkDlB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AiTraceEntry, AiTraceKind, AiTraceRetentionOptions } from "./trace";
|
|
2
|
+
export type AiTraceStore = {
|
|
3
|
+
push(entry: Omit<AiTraceEntry, "sequence"> & {
|
|
4
|
+
kind: AiTraceKind;
|
|
5
|
+
}): void;
|
|
6
|
+
snapshot(): AiTraceEntry[];
|
|
7
|
+
clear(): void;
|
|
8
|
+
size(): number;
|
|
9
|
+
};
|
|
10
|
+
export type CreateAiTraceStoreOptions = AiTraceRetentionOptions & {
|
|
11
|
+
onEntry?: ((entry: AiTraceEntry) => void) | undefined;
|
|
12
|
+
onEntryError?: ((error: unknown, entry: AiTraceEntry) => void) | undefined;
|
|
13
|
+
};
|
|
14
|
+
export declare function createAiTraceStore(options?: CreateAiTraceStoreOptions): AiTraceStore;
|
|
15
|
+
//# sourceMappingURL=trace-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-store.d.ts","sourceRoot":"","sources":["../../src/observability/trace-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAElF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,GAAG,IAAI,CAAC;IAC1E,QAAQ,IAAI,YAAY,EAAE,CAAC;IAC3B,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,uBAAuB,GAAG;IAChE,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACtD,YAAY,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAC5E,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,yBAA8B,GAAG,YAAY,CAiDxF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AiAgentId } from "../contracts/agent-binding";
|
|
2
|
+
export declare const AI_TRACE_KINDS: readonly ["lifecycle", "perception", "decision", "goal", "task", "intent", "budget"];
|
|
3
|
+
export type AiTraceKind = (typeof AI_TRACE_KINDS)[number];
|
|
4
|
+
export type AiTraceRetentionOptions = {
|
|
5
|
+
/** Global hard limit for retained entries. */
|
|
6
|
+
limit?: number | undefined;
|
|
7
|
+
/** Optional allow-list. Omit it to retain every trace kind. */
|
|
8
|
+
kinds?: readonly AiTraceKind[] | undefined;
|
|
9
|
+
/** Optional caps applied before the global hard limit. Zero disables retention for that kind. */
|
|
10
|
+
kindLimits?: Partial<Record<AiTraceKind, number>> | undefined;
|
|
11
|
+
};
|
|
12
|
+
export type AiGoalScoreTraceDetail = "summary" | "winner" | "all";
|
|
13
|
+
export type AiTraceProductionOptions = {
|
|
14
|
+
/** Hard cap for trace entries produced by one runtime update. */
|
|
15
|
+
maxEntriesPerUpdate?: number | undefined;
|
|
16
|
+
/** Controls whether utility consideration details are copied into decision trace. */
|
|
17
|
+
goalScoreDetail?: AiGoalScoreTraceDetail | undefined;
|
|
18
|
+
/** Emits one budget summary when entries are dropped during an update. */
|
|
19
|
+
emitDropSummary?: boolean | undefined;
|
|
20
|
+
};
|
|
21
|
+
export type AiTraceEntry = {
|
|
22
|
+
sequence: number;
|
|
23
|
+
kind: AiTraceKind;
|
|
24
|
+
label: string;
|
|
25
|
+
timestamp: number;
|
|
26
|
+
agentId?: AiAgentId | undefined;
|
|
27
|
+
payload?: Record<string, unknown> | undefined;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/observability/trace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,eAAO,MAAM,cAAc,sFAQjB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,uBAAuB,GAAG;IACpC,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,+DAA+D;IAC/D,KAAK,CAAC,EAAE,SAAS,WAAW,EAAE,GAAG,SAAS,CAAC;IAC3C,iGAAiG;IACjG,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;AAElE,MAAM,MAAM,wBAAwB,GAAG;IACrC,iEAAiE;IACjE,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,qFAAqF;IACrF,eAAe,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;IACrD,0EAA0E;IAC1E,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAC/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/perception/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AiAgentBinding } from "../contracts/agent-binding";
|
|
2
|
+
import type { AiAgentReadContext } from "../contracts/agent-context";
|
|
3
|
+
import type { AiAgentDefinition } from "../definition/agent-definition";
|
|
4
|
+
import type { AiSensorDefinition } from "../definition/sensor-definition";
|
|
5
|
+
import type { AiSchedulerClass } from "../scheduler/scheduler-class";
|
|
6
|
+
import type { AiPerceptionFact } from "./perception-fact";
|
|
7
|
+
import type { AiSensorSampler } from "./sensor-sampler";
|
|
8
|
+
export type AiPerceptionAgent = {
|
|
9
|
+
binding: AiAgentBinding;
|
|
10
|
+
definition: AiAgentDefinition;
|
|
11
|
+
sensors: AiSensorDefinition[];
|
|
12
|
+
schedulerClass: AiSchedulerClass;
|
|
13
|
+
memory: Map<string, AiPerceptionFact>;
|
|
14
|
+
nextSensorAt: Map<string, number>;
|
|
15
|
+
};
|
|
16
|
+
export type AiPerceptionController<TAgent extends AiPerceptionAgent> = {
|
|
17
|
+
sample(agents: readonly TAgent[]): number;
|
|
18
|
+
};
|
|
19
|
+
export declare function createAiPerceptionController<TAgent extends AiPerceptionAgent>(options: {
|
|
20
|
+
elapsed(): number;
|
|
21
|
+
maxSamplesPerTick: number;
|
|
22
|
+
samplerFor(samplerId: string): AiSensorSampler | undefined;
|
|
23
|
+
contextFor(agent: TAgent): AiAgentReadContext;
|
|
24
|
+
onSample(agent: TAgent, sensor: AiSensorDefinition, facts: readonly AiPerceptionFact[]): void;
|
|
25
|
+
onDelayed(agent: TAgent, sensor: AiSensorDefinition): void;
|
|
26
|
+
}): AiPerceptionController<TAgent>;
|
|
27
|
+
//# sourceMappingURL=perception-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perception-controller.d.ts","sourceRoot":"","sources":["../../src/perception/perception-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,cAAc,EAAE,gBAAgB,CAAC;IACjC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACtC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,MAAM,SAAS,iBAAiB,IAAI;IACrE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC;CAC3C,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,MAAM,SAAS,iBAAiB,EAAE,OAAO,EAAE;IACtF,OAAO,IAAI,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;IAC3D,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;IAC9F,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC5D,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAmDjC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NavigationPoint } from "@gamekits/navigation-core";
|
|
2
|
+
export type AiPerceptionFact = {
|
|
3
|
+
key: string;
|
|
4
|
+
subjectId?: string | undefined;
|
|
5
|
+
position?: NavigationPoint | undefined;
|
|
6
|
+
value?: number | string | boolean | undefined;
|
|
7
|
+
observedAt: number;
|
|
8
|
+
expiresAt?: number | undefined;
|
|
9
|
+
confidence?: number | undefined;
|
|
10
|
+
metadata?: Record<string, unknown> | undefined;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=perception-fact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perception-fact.d.ts","sourceRoot":"","sources":["../../src/perception/perception-fact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IACvC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAChD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AiPerceptionFact } from "./perception-fact";
|
|
2
|
+
export type AiPerceptionMemory = Map<string, AiPerceptionFact>;
|
|
3
|
+
export declare function retainAiPerceptionFacts(memory: AiPerceptionMemory, facts: AiPerceptionFact[], limit: number): void;
|
|
4
|
+
export declare function pruneAiPerceptionMemory(memory: AiPerceptionMemory, elapsed: number): void;
|
|
5
|
+
export declare function listAiPerceptionFacts(memory: AiPerceptionMemory): AiPerceptionFact[];
|
|
6
|
+
export declare function readAiPerceptionFact(memory: AiPerceptionMemory, key: string, subjectId?: string | undefined): AiPerceptionFact | undefined;
|
|
7
|
+
export declare function cloneAiPerceptionFact(fact: AiPerceptionFact): AiPerceptionFact;
|
|
8
|
+
//# sourceMappingURL=perception-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perception-memory.d.ts","sourceRoot":"","sources":["../../src/perception/perception-memory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAE/D,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,gBAAgB,EAAE,EACzB,KAAK,EAAE,MAAM,GACZ,IAAI,CA2BN;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAMzF;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,gBAAgB,EAAE,CAQpF;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,kBAAkB,EAC1B,GAAG,EAAE,MAAM,EACX,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,GAC7B,gBAAgB,GAAG,SAAS,CAG9B;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAM9E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AiAgentReadContext } from "../contracts/agent-context";
|
|
2
|
+
import type { AiSensorDefinition } from "../definition/sensor-definition";
|
|
3
|
+
import type { AiPerceptionFact } from "./perception-fact";
|
|
4
|
+
export type AiSensorSampler = {
|
|
5
|
+
id: string;
|
|
6
|
+
sample(context: AiAgentReadContext, definition: AiSensorDefinition): AiPerceptionFact[];
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=sensor-sampler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sensor-sampler.d.ts","sourceRoot":"","sources":["../../src/perception/sensor-sampler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,kBAAkB,GAAG,gBAAgB,EAAE,CAAC;CACzF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AiAgentState } from "../controller/agent-state";
|
|
2
|
+
import type { AiAgentCheckpoint } from "./checkpoint";
|
|
3
|
+
export declare function validateAiCheckpointCompatibility(state: AiAgentState, checkpoint: AiAgentCheckpoint): void;
|
|
4
|
+
//# sourceMappingURL=checkpoint-compatibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint-compatibility.d.ts","sourceRoot":"","sources":["../../src/persistence/checkpoint-compatibility.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,iBAAiB,GAC5B,IAAI,CAyBN"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AiAgentState } from "../controller/agent-state";
|
|
2
|
+
import type { AiAgentCheckpoint } from "./checkpoint";
|
|
3
|
+
export declare function projectAiAgentCheckpoint(state: AiAgentState): AiAgentCheckpoint;
|
|
4
|
+
export declare function restoreAiAgentCheckpoint(state: AiAgentState, checkpoint: AiAgentCheckpoint): void;
|
|
5
|
+
//# sourceMappingURL=checkpoint-projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint-projection.d.ts","sourceRoot":"","sources":["../../src/persistence/checkpoint-projection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAiB/E;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAYjG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint-validation.d.ts","sourceRoot":"","sources":["../../src/persistence/checkpoint-validation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE3E,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI,CA+CjF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { EntityId } from "@gamekits/world";
|
|
2
|
+
import type { AiAgentBinding } from "../contracts/agent-binding";
|
|
3
|
+
import type { AiBlackboardValue } from "../contracts/blackboard-value";
|
|
4
|
+
import type { AiPerceptionFact } from "../perception/perception-fact";
|
|
5
|
+
import type { AiTaskState } from "../task/task-executor";
|
|
6
|
+
export type AiAgentCheckpoint = {
|
|
7
|
+
binding: AiAgentBinding;
|
|
8
|
+
schedulerClassId?: string | undefined;
|
|
9
|
+
memory: AiPerceptionFact[];
|
|
10
|
+
blackboard: Record<string, AiBlackboardValue>;
|
|
11
|
+
currentGoalId?: string | undefined;
|
|
12
|
+
currentGoalScore?: number | undefined;
|
|
13
|
+
committedUntil?: number | undefined;
|
|
14
|
+
task?: AiTaskState | undefined;
|
|
15
|
+
cooldowns: Array<[string, number]>;
|
|
16
|
+
nextDecisionAt: number;
|
|
17
|
+
nextSensorAt: Array<[string, number]>;
|
|
18
|
+
delayedDecisions: number;
|
|
19
|
+
};
|
|
20
|
+
export type AiRuntimeCheckpoint = {
|
|
21
|
+
version: 1;
|
|
22
|
+
elapsed: number;
|
|
23
|
+
agents: AiAgentCheckpoint[];
|
|
24
|
+
};
|
|
25
|
+
export type AiRestoreOptions = {
|
|
26
|
+
resolveEntityId?: ((savedEntityId: EntityId) => EntityId | undefined) | undefined;
|
|
27
|
+
resolveActorId?: ((savedActorId: string) => string | undefined) | undefined;
|
|
28
|
+
resolveTaskState?: ((savedState: Readonly<Record<string, unknown>>, binding: Readonly<AiAgentBinding>) => Record<string, unknown> | undefined) | undefined;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=checkpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../src/persistence/checkpoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,cAAc,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC9C,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,SAAS,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACtC,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,iBAAiB,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,eAAe,CAAC,EAAE,CAAC,CAAC,aAAa,EAAE,QAAQ,KAAK,QAAQ,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IAClF,cAAc,CAAC,EAAE,CAAC,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IAC5E,gBAAgB,CAAC,EACb,CAAC,CACC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC7C,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,KAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,GACzC,SAAS,CAAC;CACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/persistence/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,KAAK,8BAA8B,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AiAgentBinding } from "../contracts/agent-binding";
|
|
2
|
+
import type { AiRestoreOptions } from "./checkpoint";
|
|
3
|
+
export declare function restoreAiAgentBinding(binding: AiAgentBinding, options: AiRestoreOptions | undefined): AiAgentBinding | undefined;
|
|
4
|
+
//# sourceMappingURL=restore-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore-binding.d.ts","sourceRoot":"","sources":["../../src/persistence/restore-binding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,gBAAgB,GAAG,SAAS,GACpC,cAAc,GAAG,SAAS,CAiB5B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AiAgentBinding } from "../contracts/agent-binding";
|
|
2
|
+
import type { AiAgentCheckpoint, AiRestoreOptions } from "./checkpoint";
|
|
3
|
+
export declare function restoreAiTaskState(checkpoint: AiAgentCheckpoint, binding: AiAgentBinding, elapsed: number, options: AiRestoreOptions | undefined): AiAgentCheckpoint;
|
|
4
|
+
//# sourceMappingURL=restore-task-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore-task-state.d.ts","sourceRoot":"","sources":["../../src/persistence/restore-task-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAExE,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,iBAAiB,EAC7B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,gBAAgB,GAAG,SAAS,GACpC,iBAAiB,CAqBnB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SaveContributor, SaveRestoreContext } from "@gamekits/save";
|
|
2
|
+
import type { AiAgentBinding } from "../contracts/agent-binding";
|
|
3
|
+
import type { AiHandle } from "../controller/runtime";
|
|
4
|
+
import type { AiRuntimeCheckpoint } from "./checkpoint";
|
|
5
|
+
export type CreateAiSaveContributorOptions = {
|
|
6
|
+
handle: AiHandle;
|
|
7
|
+
id?: string | undefined;
|
|
8
|
+
version?: string | undefined;
|
|
9
|
+
order?: number | undefined;
|
|
10
|
+
required?: boolean | undefined;
|
|
11
|
+
resolveActorId?: ((savedActorId: string, context: SaveRestoreContext) => string | undefined) | undefined;
|
|
12
|
+
resolveTaskState?: ((savedState: Readonly<Record<string, unknown>>, binding: Readonly<AiAgentBinding>, context: SaveRestoreContext) => Record<string, unknown> | undefined) | undefined;
|
|
13
|
+
};
|
|
14
|
+
export declare function createAiSaveContributor(options: CreateAiSaveContributorOptions): SaveContributor<AiRuntimeCheckpoint>;
|
|
15
|
+
//# sourceMappingURL=save-contributor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-contributor.d.ts","sourceRoot":"","sources":["../../src/persistence/save-contributor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAGnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,MAAM,EAAE,QAAQ,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,cAAc,CAAC,EACX,CAAC,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,KAAK,MAAM,GAAG,SAAS,CAAC,GAC3E,SAAS,CAAC;IACd,gBAAgB,CAAC,EACb,CAAC,CACC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC7C,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,EACjC,OAAO,EAAE,kBAAkB,KACxB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,GACzC,SAAS,CAAC;CACf,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,8BAA8B,GACtC,eAAe,CAAC,mBAAmB,CAAC,CA0CtC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AiAgentBinding } from "../contracts/agent-binding";
|
|
2
|
+
import type { AiAgentDefinition } from "../definition/agent-definition";
|
|
3
|
+
import type { AiSchedulerClass } from "./scheduler-class";
|
|
4
|
+
export type AiDecisionAgent = {
|
|
5
|
+
binding: AiAgentBinding;
|
|
6
|
+
definition: AiAgentDefinition;
|
|
7
|
+
schedulerClass: AiSchedulerClass;
|
|
8
|
+
nextDecisionAt: number;
|
|
9
|
+
delayedDecisions: number;
|
|
10
|
+
};
|
|
11
|
+
export type AiDecisionScheduler<TAgent extends AiDecisionAgent> = {
|
|
12
|
+
run(agents: readonly TAgent[]): number;
|
|
13
|
+
};
|
|
14
|
+
export declare function createAiDecisionScheduler<TAgent extends AiDecisionAgent>(options: {
|
|
15
|
+
elapsed(): number;
|
|
16
|
+
maxDecisionsPerTick: number;
|
|
17
|
+
onDecision(agent: TAgent): void;
|
|
18
|
+
onDelayed(agent: TAgent): void;
|
|
19
|
+
}): AiDecisionScheduler<TAgent>;
|
|
20
|
+
//# sourceMappingURL=decision-scheduler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision-scheduler.d.ts","sourceRoot":"","sources":["../../src/scheduler/decision-scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAExE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,cAAc,EAAE,gBAAgB,CAAC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,MAAM,SAAS,eAAe,IAAI;IAChE,GAAG,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC;CACxC,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,MAAM,SAAS,eAAe,EAAE,OAAO,EAAE;IACjF,OAAO,IAAI,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAyC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"due-work.d.ts","sourceRoot":"","sources":["../../src/scheduler/due-work.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,CAYhF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scheduler/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AiSensorDefinition } from "../definition/sensor-definition";
|
|
2
|
+
import type { AiSchedulerClass } from "./scheduler-class";
|
|
3
|
+
export type AiReclassifiableAgent = {
|
|
4
|
+
definition: {
|
|
5
|
+
decisionIntervalMs: number;
|
|
6
|
+
};
|
|
7
|
+
sensors: readonly AiSensorDefinition[];
|
|
8
|
+
schedulerClass: AiSchedulerClass;
|
|
9
|
+
nextDecisionAt: number;
|
|
10
|
+
nextSensorAt: Map<string, number>;
|
|
11
|
+
};
|
|
12
|
+
export declare function reclassifyAiAgent(agent: AiReclassifiableAgent, schedulerClass: AiSchedulerClass, elapsed: number): void;
|
|
13
|
+
//# sourceMappingURL=reclassify-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reclassify-agent.d.ts","sourceRoot":"","sources":["../../src/scheduler/reclassify-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,EAAE;QAAE,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACvC,cAAc,EAAE,gBAAgB,CAAC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,qBAAqB,EAC5B,cAAc,EAAE,gBAAgB,EAChC,OAAO,EAAE,MAAM,GACd,IAAI,CA8BN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler-class.d.ts","sourceRoot":"","sources":["../../src/scheduler/scheduler-class.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,0BAA0B,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,wBAAwB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../../src/scheduler/timing.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAExF;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAO5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone-task-state.d.ts","sourceRoot":"","sources":["../../src/task/clone-task-state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAE/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/task/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { AiAgentDefinition } from "../definition/agent-definition";
|
|
2
|
+
import type { AiGoalDefinition } from "../definition/goal-definition";
|
|
3
|
+
import type { AiTaskDefinition } from "../definition/task-definition";
|
|
4
|
+
import type { AiTaskContext, AiTaskExecutor, AiTaskState } from "./task-executor";
|
|
5
|
+
export type AiTaskControllerAgent = {
|
|
6
|
+
definition: AiAgentDefinition;
|
|
7
|
+
currentGoalId: string | undefined;
|
|
8
|
+
currentGoalScore: number | undefined;
|
|
9
|
+
committedUntil: number | undefined;
|
|
10
|
+
task: AiTaskState | undefined;
|
|
11
|
+
cooldowns: Map<string, number>;
|
|
12
|
+
nextDecisionAt: number;
|
|
13
|
+
};
|
|
14
|
+
export type AiTaskTransition = {
|
|
15
|
+
status: "started";
|
|
16
|
+
taskId: string;
|
|
17
|
+
executorId: string;
|
|
18
|
+
goalId: string;
|
|
19
|
+
} | {
|
|
20
|
+
status: "succeeded" | "failed" | "cancelled";
|
|
21
|
+
taskId: string;
|
|
22
|
+
goalId: string | undefined;
|
|
23
|
+
reason: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
export type AiTaskController<TAgent extends AiTaskControllerAgent> = {
|
|
26
|
+
update(agent: TAgent, deltaMs: number): void;
|
|
27
|
+
start(agent: TAgent, goal: AiGoalDefinition): void;
|
|
28
|
+
cancel(agent: TAgent, reason: string): void;
|
|
29
|
+
canInterrupt(agent: TAgent): boolean;
|
|
30
|
+
};
|
|
31
|
+
export declare function createAiTaskController<TAgent extends AiTaskControllerAgent>(options: {
|
|
32
|
+
elapsed(): number;
|
|
33
|
+
failureBackoffMs: number;
|
|
34
|
+
decisionInterval(agent: TAgent): number;
|
|
35
|
+
taskFor(agent: TAgent, taskId: string): AiTaskDefinition;
|
|
36
|
+
goalFor(agent: TAgent, goalId: string): AiGoalDefinition;
|
|
37
|
+
executorFor(executorId: string): AiTaskExecutor | undefined;
|
|
38
|
+
contextFor(agent: TAgent, goal: AiGoalDefinition, task: AiTaskDefinition, state: AiTaskState): AiTaskContext;
|
|
39
|
+
onTransition(agent: TAgent, transition: AiTaskTransition): void;
|
|
40
|
+
}): AiTaskController<TAgent>;
|
|
41
|
+
//# sourceMappingURL=task-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-controller.d.ts","sourceRoot":"","sources":["../../src/task/task-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAc,MAAM,iBAAiB,CAAC;AAE9F,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC;IAC9B,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACxB;IACE,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,GACD;IACE,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEN,MAAM,MAAM,gBAAgB,CAAC,MAAM,SAAS,qBAAqB,IAAI;IACnE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACnD,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,MAAM,SAAS,qBAAqB,EAAE,OAAO,EAAE;IACpF,OAAO,IAAI,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACxC,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACzD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACzD,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;IAC5D,UAAU,CACR,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,WAAW,GACjB,aAAa,CAAC;IACjB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACjE,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAgJ3B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AiAgentReadContext } from "../contracts/agent-context";
|
|
2
|
+
import type { AiBlackboardValue } from "../contracts/blackboard-value";
|
|
3
|
+
import type { AiIntentInput } from "../contracts/intent";
|
|
4
|
+
import type { AiGoalDefinition } from "../definition/goal-definition";
|
|
5
|
+
import type { AiTaskDefinition } from "../definition/task-definition";
|
|
6
|
+
export type AiTaskStatus = "starting" | "running" | "succeeded" | "failed" | "cancelled";
|
|
7
|
+
export type AiTaskStep = {
|
|
8
|
+
status: "running" | "succeeded" | "failed";
|
|
9
|
+
state?: Record<string, unknown> | undefined;
|
|
10
|
+
safeToInterrupt?: boolean | undefined;
|
|
11
|
+
reason?: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type AiTaskContext = AiAgentReadContext & {
|
|
14
|
+
goal: AiGoalDefinition;
|
|
15
|
+
task: AiTaskDefinition;
|
|
16
|
+
state: Record<string, unknown>;
|
|
17
|
+
emit(intent: AiIntentInput): void;
|
|
18
|
+
setBlackboard(key: string, value: AiBlackboardValue): void;
|
|
19
|
+
deleteBlackboard(key: string): void;
|
|
20
|
+
};
|
|
21
|
+
export type AiTaskExecutor = {
|
|
22
|
+
id: string;
|
|
23
|
+
start(context: AiTaskContext): AiTaskStep;
|
|
24
|
+
update(context: AiTaskContext, deltaMs: number): AiTaskStep;
|
|
25
|
+
cancel?(context: AiTaskContext, reason: string): void;
|
|
26
|
+
};
|
|
27
|
+
export type AiTaskState = {
|
|
28
|
+
taskId: string;
|
|
29
|
+
executorId: string;
|
|
30
|
+
status: AiTaskStatus;
|
|
31
|
+
startedAt: number;
|
|
32
|
+
updatedAt: number;
|
|
33
|
+
safeToInterrupt: boolean;
|
|
34
|
+
state: Record<string, unknown>;
|
|
35
|
+
failureReason?: string | undefined;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=task-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-executor.d.ts","sourceRoot":"","sources":["../../src/task/task-executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEzF,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC5C,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG;IAC/C,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IAClC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC3D,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,UAAU,CAAC;IAC1C,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5D,MAAM,CAAC,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { createMemoryAiRuntimeFixture, createMemoryAiWorld, type CreateMemoryAiRuntimeFixtureOptions, type MemoryAiRuntimeFixture } from "./memory-runtime-fixture";
|
|
2
|
+
export { runAiRuntimeConformance, type AiConformanceHarness, type AiConformanceReport } from "./runtime-conformance";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,mBAAmB,EACnB,KAAK,mCAAmC,EACxC,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,uBAAuB,EACvB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { t as createAiRuntime } from "../create-ai-runtime-Cd-h8AF9.js";
|
|
2
|
+
//#region src/testing/memory-runtime-fixture.ts
|
|
3
|
+
function createMemoryAiRuntimeFixture(options) {
|
|
4
|
+
const { world = createMemoryAiWorld(), onIntent, ...runtimeOptions } = options;
|
|
5
|
+
const intents = [];
|
|
6
|
+
const runtime = createAiRuntime({
|
|
7
|
+
...runtimeOptions,
|
|
8
|
+
world,
|
|
9
|
+
intentSink: { emit(intent) {
|
|
10
|
+
intents.push(intent);
|
|
11
|
+
onIntent?.(intent);
|
|
12
|
+
} }
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
runtime,
|
|
16
|
+
world,
|
|
17
|
+
intents,
|
|
18
|
+
dispose() {
|
|
19
|
+
runtime.dispose();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function createMemoryAiWorld() {
|
|
24
|
+
const componentData = /* @__PURE__ */ new Map();
|
|
25
|
+
let nextId = 0;
|
|
26
|
+
const requireEntity = (entity) => {
|
|
27
|
+
const components = componentData.get(entity);
|
|
28
|
+
if (components === void 0) throw new Error(`Missing entity: ${String(entity)}`);
|
|
29
|
+
return components;
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
spawn() {
|
|
33
|
+
const entity = `ai-memory-entity-${nextId}`;
|
|
34
|
+
nextId += 1;
|
|
35
|
+
componentData.set(entity, /* @__PURE__ */ new Map());
|
|
36
|
+
return entity;
|
|
37
|
+
},
|
|
38
|
+
despawn(entity) {
|
|
39
|
+
componentData.delete(entity);
|
|
40
|
+
},
|
|
41
|
+
has(entity) {
|
|
42
|
+
return componentData.has(entity);
|
|
43
|
+
},
|
|
44
|
+
add(entity, component, data) {
|
|
45
|
+
requireEntity(entity).set(component.id, component.create(data));
|
|
46
|
+
},
|
|
47
|
+
get(entity, component) {
|
|
48
|
+
return requireEntity(entity).get(component.id);
|
|
49
|
+
},
|
|
50
|
+
set(entity, component, data) {
|
|
51
|
+
const components = requireEntity(entity);
|
|
52
|
+
const current = components.get(component.id) ?? component.create();
|
|
53
|
+
components.set(component.id, {
|
|
54
|
+
...current,
|
|
55
|
+
...data
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
remove(entity, component) {
|
|
59
|
+
requireEntity(entity).delete(component.id);
|
|
60
|
+
},
|
|
61
|
+
query(components = []) {
|
|
62
|
+
return [...componentData.entries()].filter(([, values]) => components.every((component) => values.has(component.id))).map(([entity]) => entity);
|
|
63
|
+
},
|
|
64
|
+
count() {
|
|
65
|
+
return componentData.size;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/testing/runtime-conformance.ts
|
|
71
|
+
function runAiRuntimeConformance(createHarness) {
|
|
72
|
+
const harness = createHarness();
|
|
73
|
+
try {
|
|
74
|
+
harness.runtime.bind(harness.binding);
|
|
75
|
+
const scores = harness.runtime.scoreGoals(harness.binding.agentId);
|
|
76
|
+
assertConformance(scores.find((score) => score.eligible) !== void 0, "utility scoring exposes an eligible goal");
|
|
77
|
+
assertConformance(JSON.stringify(harness.runtime.scoreGoals(harness.binding.agentId)) === JSON.stringify(scores), "utility scoring is deterministic for unchanged state");
|
|
78
|
+
harness.runtime.update(1e3, 1e3);
|
|
79
|
+
const snapshot = harness.runtime.getAgent(harness.binding.agentId);
|
|
80
|
+
assertConformance(snapshot !== void 0, "bound agent remains queryable");
|
|
81
|
+
assertConformance(snapshot.goalId !== void 0, "scheduled decision selects a goal");
|
|
82
|
+
const checkpoint = harness.runtime.captureCheckpoint();
|
|
83
|
+
assertConformance(checkpoint.version === 1, "checkpoint has a stable version");
|
|
84
|
+
assertConformance(checkpoint.agents.length === 1, "checkpoint captures bound agents");
|
|
85
|
+
const invalidCheckpoint = {
|
|
86
|
+
...checkpoint,
|
|
87
|
+
agents: [...checkpoint.agents, checkpoint.agents[0]]
|
|
88
|
+
};
|
|
89
|
+
let rejectedInvalidCheckpoint = false;
|
|
90
|
+
try {
|
|
91
|
+
harness.runtime.restoreCheckpoint(invalidCheckpoint);
|
|
92
|
+
} catch {
|
|
93
|
+
rejectedInvalidCheckpoint = true;
|
|
94
|
+
}
|
|
95
|
+
assertConformance(rejectedInvalidCheckpoint && harness.runtime.hasAgent(harness.binding.agentId), "invalid checkpoint rejection is atomic");
|
|
96
|
+
harness.runtime.restoreCheckpoint(checkpoint);
|
|
97
|
+
assertConformance(harness.runtime.hasAgent(harness.binding.agentId), "checkpoint restores agents");
|
|
98
|
+
harness.runtime.unbind(harness.binding.agentId);
|
|
99
|
+
assertConformance(!harness.runtime.hasAgent(harness.binding.agentId), "unbind releases agents");
|
|
100
|
+
harness.runtime.bind(harness.binding);
|
|
101
|
+
harness.runtime.dispose();
|
|
102
|
+
const disposed = harness.runtime.snapshot();
|
|
103
|
+
assertConformance(disposed.disposed && disposed.agents.length === 0 && disposed.memoryFacts === 0 && disposed.activeTasks === 0 && disposed.traceEntries === 0, "dispose releases retained runtime state");
|
|
104
|
+
return {
|
|
105
|
+
checks: [
|
|
106
|
+
"utility scoring exposes an eligible goal",
|
|
107
|
+
"utility scoring is deterministic for unchanged state",
|
|
108
|
+
"scheduled decision selects a goal",
|
|
109
|
+
"checkpoint captures bound agents",
|
|
110
|
+
"invalid checkpoint rejection is atomic",
|
|
111
|
+
"checkpoint restores agents",
|
|
112
|
+
"unbind releases agents",
|
|
113
|
+
"dispose releases retained runtime state"
|
|
114
|
+
],
|
|
115
|
+
selectedGoalId: snapshot.goalId,
|
|
116
|
+
checkpointAgents: checkpoint.agents.length
|
|
117
|
+
};
|
|
118
|
+
} finally {
|
|
119
|
+
harness.dispose();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function assertConformance(condition, message) {
|
|
123
|
+
if (!condition) throw new Error(`AI conformance failed: ${message}`);
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
export { createMemoryAiRuntimeFixture, createMemoryAiWorld, runAiRuntimeConformance };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { GameWorld } from "@gamekits/world";
|
|
2
|
+
import type { CreateAiRuntimeOptions } from "../composition/options";
|
|
3
|
+
import type { AiIntent } from "../contracts/intent";
|
|
4
|
+
import type { AiRuntime } from "../controller/runtime";
|
|
5
|
+
export type CreateMemoryAiRuntimeFixtureOptions = Omit<CreateAiRuntimeOptions, "world" | "intentSink"> & {
|
|
6
|
+
world?: GameWorld | undefined;
|
|
7
|
+
onIntent?: ((intent: AiIntent) => void) | undefined;
|
|
8
|
+
};
|
|
9
|
+
export type MemoryAiRuntimeFixture = {
|
|
10
|
+
runtime: AiRuntime;
|
|
11
|
+
world: GameWorld;
|
|
12
|
+
intents: AiIntent[];
|
|
13
|
+
dispose(): void;
|
|
14
|
+
};
|
|
15
|
+
export declare function createMemoryAiRuntimeFixture(options: CreateMemoryAiRuntimeFixtureOptions): MemoryAiRuntimeFixture;
|
|
16
|
+
export declare function createMemoryAiWorld(): GameWorld;
|
|
17
|
+
//# sourceMappingURL=memory-runtime-fixture.d.ts.map
|