@lotics/app-sdk 0.126.1 → 0.127.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/index.js +4 -1
- package/dist/mock.d.ts +4 -0
- package/docs/runtime.md +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -93,6 +93,9 @@ function getMockAgent(alias) {
|
|
|
93
93
|
if (!isMockMode()) return null;
|
|
94
94
|
return registeredFixture?.agents?.[alias] ?? null;
|
|
95
95
|
}
|
|
96
|
+
function getMockAgentBeat() {
|
|
97
|
+
return registeredFixture?.agentBeatMs;
|
|
98
|
+
}
|
|
96
99
|
function getMockExport(alias) {
|
|
97
100
|
if (!isMockMode()) return null;
|
|
98
101
|
return registeredFixture?.exports?.[alias] ?? null;
|
|
@@ -10824,7 +10827,7 @@ function useAgentRun(alias) {
|
|
|
10824
10827
|
const inflight = streamLeg(
|
|
10825
10828
|
(onText) => mock === null ? rpcAgentRun({ alias, session_id: opts.sessionId, input: input ?? {} }, onText, (runId) => {
|
|
10826
10829
|
runIdRef.current = runId;
|
|
10827
|
-
}) : playMockRun(typeof mock === "function" ? mock(input ?? {}) : mock, onText),
|
|
10830
|
+
}) : playMockRun(typeof mock === "function" ? mock(input ?? {}) : mock, onText, getMockAgentBeat()),
|
|
10828
10831
|
initialAgentRunState()
|
|
10829
10832
|
);
|
|
10830
10833
|
const tracked = inflight.finally(() => {
|
package/dist/mock.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ export interface AppFixture {
|
|
|
43
43
|
exportApps?: Record<string, MockExportApp>;
|
|
44
44
|
/** `useRecording(alias)` reads as available; `start`/`stop` change nothing. */
|
|
45
45
|
recordings?: Record<string, RecordingState>;
|
|
46
|
+
/** How long a played agent run waits before each line it streams; a real run's pace when unset. */
|
|
47
|
+
agentBeatMs?: number;
|
|
46
48
|
}
|
|
47
49
|
export declare function registerMockFixture(fixture: AppFixture | undefined): void;
|
|
48
50
|
/** The raw `?__mock=1` flag, fixture or not; false where `window.location` is absent. */
|
|
@@ -53,6 +55,8 @@ export declare function getMockRows(alias: string, call: MockQueryCall): Array<R
|
|
|
53
55
|
export declare function getMockWorkflow(alias: string): MockWorkflow | null;
|
|
54
56
|
/** Null for an unmocked alias, which runs for real. */
|
|
55
57
|
export declare function getMockAgent(alias: string): MockAgent | null;
|
|
58
|
+
/** The pace the fixture plays agent runs at; undefined for a real run's. */
|
|
59
|
+
export declare function getMockAgentBeat(): number | undefined;
|
|
56
60
|
/** Null for an unmocked alias, which the server exports. */
|
|
57
61
|
export declare function getMockExport(alias: string): MockExport | null;
|
|
58
62
|
/** Null for an unmocked key, which the server exports. */
|
package/docs/runtime.md
CHANGED
|
@@ -68,7 +68,8 @@ Activation is a **two-step gate** — both must hold, so demo data shipping in t
|
|
|
68
68
|
bundle never leaks into normal traffic:
|
|
69
69
|
|
|
70
70
|
1. A fixture is registered via `mount({ fixture })` (`AppFixture` type:
|
|
71
|
-
`dist/mock.d.ts` — `{ queries?, workflows?, agents?, exports?, exportApps?, recordings? }
|
|
71
|
+
`dist/mock.d.ts` — `{ queries?, workflows?, agents?, exports?, exportApps?, recordings?, agentBeatMs? }`;
|
|
72
|
+
`agentBeatMs` paces each line a mocked agent run streams, a real run's pace when unset, `0` in a test).
|
|
72
73
|
2. The page URL carries `?__mock=1` (exactly `1`). Without the flag the fixture
|
|
73
74
|
is completely inert.
|
|
74
75
|
|
package/package.json
CHANGED