@buoy-gg/events 4.0.1 → 4.0.2
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/lib/commonjs/sync/eventsSyncAdapter.js +28 -0
- package/lib/commonjs/sync/eventsSyncAdapter.js.map +1 -1
- package/lib/module/sync/eventsSyncAdapter.js +28 -0
- package/lib/module/sync/eventsSyncAdapter.js.map +1 -1
- package/lib/typescript/sync/eventsSyncAdapter.d.ts +15 -0
- package/lib/typescript/sync/eventsSyncAdapter.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/sync/eventsSyncAdapter.ts +43 -0
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.eventsSyncAdapter = void 0;
|
|
7
7
|
var _unifiedEventStore = require("../stores/unifiedEventStore");
|
|
8
|
+
var _eventExportFormatter = require("../utils/eventExportFormatter");
|
|
9
|
+
var _copySettings = require("../types/copySettings");
|
|
8
10
|
/**
|
|
9
11
|
* Sync adapter for the events tool, consumed by @buoy-gg/external-sync's
|
|
10
12
|
* `useExternalSync` (structurally matches its ToolSyncAdapter interface so
|
|
@@ -56,6 +58,32 @@ const eventsSyncAdapter = exports.eventsSyncAdapter = {
|
|
|
56
58
|
return {
|
|
57
59
|
enabledSources: sources
|
|
58
60
|
};
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Format the captured events using the SAME "Copy Settings" formatter the
|
|
64
|
+
* on-device copy button uses — driven by toggles instead of taps. Heavy raw
|
|
65
|
+
* payloads (`originalEvent`) stay on the device unless the caller opts in
|
|
66
|
+
* (`includeEventData`), so a remote driver (MCP/LLM) gets a compact result
|
|
67
|
+
* by default and only pulls more detail when it asks. Returns the formatted
|
|
68
|
+
* string + metadata so the caller knows how much was returned.
|
|
69
|
+
*/
|
|
70
|
+
exportEvents: params => {
|
|
71
|
+
const p = params ?? {};
|
|
72
|
+
const base = p.preset && _copySettings.COPY_PRESETS[p.preset] ? _copySettings.COPY_PRESETS[p.preset] : _copySettings.DEFAULT_COPY_SETTINGS;
|
|
73
|
+
const settings = {
|
|
74
|
+
...base,
|
|
75
|
+
...(p.settings ?? {})
|
|
76
|
+
};
|
|
77
|
+
const all = _unifiedEventStore.unifiedEventStore.getEvents(); // newest-first, capped by the store
|
|
78
|
+
const limit = typeof p.limit === "number" && p.limit > 0 ? p.limit : all.length;
|
|
79
|
+
const events = all.slice(0, limit); // newest N (generateExport re-sorts ascending)
|
|
80
|
+
return {
|
|
81
|
+
output: (0, _eventExportFormatter.generateExport)(events, settings),
|
|
82
|
+
returned: events.length,
|
|
83
|
+
totalAvailable: all.length,
|
|
84
|
+
includedData: settings.includeEventData,
|
|
85
|
+
format: settings.format
|
|
86
|
+
};
|
|
59
87
|
}
|
|
60
88
|
}
|
|
61
89
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_unifiedEventStore","require","eventsSyncAdapter","exports","version","getSnapshot","events","unifiedEventStore","getEvents","availableSources","Array","from","getAvailableEventSources","subscribe","onChange","ensureRemoteSourcesDefault","unsubscribe","clearRemoteSources","actions","clearEvents","setEnabledSources","params","sources","setRemoteEnabledSources","enabledSources"],"sourceRoot":"../../../src","sources":["sync/eventsSyncAdapter.ts"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;
|
|
1
|
+
{"version":3,"names":["_unifiedEventStore","require","_eventExportFormatter","_copySettings","eventsSyncAdapter","exports","version","getSnapshot","events","unifiedEventStore","getEvents","availableSources","Array","from","getAvailableEventSources","subscribe","onChange","ensureRemoteSourcesDefault","unsubscribe","clearRemoteSources","actions","clearEvents","setEnabledSources","params","sources","setRemoteEnabledSources","enabledSources","exportEvents","p","base","preset","COPY_PRESETS","DEFAULT_COPY_SETTINGS","settings","all","limit","length","slice","output","generateExport","returned","totalAvailable","includedData","includeEventData","format"],"sourceRoot":"../../../src","sources":["sync/eventsSyncAdapter.ts"],"mappings":";;;;;;AA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M,IAAIC,0BAAY,CAACH,CAAC,CAACE,MAAM,CAAC,GAC9BC,0BAAY,CAACH,CAAC,CAACE,MAAM,CAAC,GACtBE,mCAAqB;MAC3B,MAAMC,QAAQ,GAAG;QAAE,GAAGJ,IAAI;QAAE,IAAID,CAAC,CAACK,QAAQ,IAAI,CAAC,CAAC;MAAE,CAAuB;MACzE,MAAMC,GAAG,GAAGzB,oCAAiB,CAACC,SAAS,CAAC,CAAC,CAAC,CAAC;MAC3C,MAAMyB,KAAK,GACT,OAAOP,CAAC,CAACO,KAAK,KAAK,QAAQ,IAAIP,CAAC,CAACO,KAAK,GAAG,CAAC,GAAGP,CAAC,CAACO,KAAK,GAAGD,GAAG,CAACE,MAAM;MACnE,MAAM5B,MAAM,GAAG0B,GAAG,CAACG,KAAK,CAAC,CAAC,EAAEF,KAAK,CAAC,CAAC,CAAC;MACpC,OAAO;QACLG,MAAM,EAAE,IAAAC,oCAAc,EAAC/B,MAAM,EAAEyB,QAAQ,CAAC;QACxCO,QAAQ,EAAEhC,MAAM,CAAC4B,MAAM;QACvBK,cAAc,EAAEP,GAAG,CAACE,MAAM;QAC1BM,YAAY,EAAET,QAAQ,CAACU,gBAAgB;QACvCC,MAAM,EAAEX,QAAQ,CAACW;MACnB,CAAC;IACH;EACF;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { unifiedEventStore } from "../stores/unifiedEventStore";
|
|
4
|
+
import { generateExport } from "../utils/eventExportFormatter";
|
|
5
|
+
import { DEFAULT_COPY_SETTINGS, COPY_PRESETS } from "../types/copySettings";
|
|
4
6
|
/**
|
|
5
7
|
* Sync adapter for the events tool, consumed by @buoy-gg/external-sync's
|
|
6
8
|
* `useExternalSync` (structurally matches its ToolSyncAdapter interface so
|
|
@@ -52,6 +54,32 @@ export const eventsSyncAdapter = {
|
|
|
52
54
|
return {
|
|
53
55
|
enabledSources: sources
|
|
54
56
|
};
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Format the captured events using the SAME "Copy Settings" formatter the
|
|
60
|
+
* on-device copy button uses — driven by toggles instead of taps. Heavy raw
|
|
61
|
+
* payloads (`originalEvent`) stay on the device unless the caller opts in
|
|
62
|
+
* (`includeEventData`), so a remote driver (MCP/LLM) gets a compact result
|
|
63
|
+
* by default and only pulls more detail when it asks. Returns the formatted
|
|
64
|
+
* string + metadata so the caller knows how much was returned.
|
|
65
|
+
*/
|
|
66
|
+
exportEvents: params => {
|
|
67
|
+
const p = params ?? {};
|
|
68
|
+
const base = p.preset && COPY_PRESETS[p.preset] ? COPY_PRESETS[p.preset] : DEFAULT_COPY_SETTINGS;
|
|
69
|
+
const settings = {
|
|
70
|
+
...base,
|
|
71
|
+
...(p.settings ?? {})
|
|
72
|
+
};
|
|
73
|
+
const all = unifiedEventStore.getEvents(); // newest-first, capped by the store
|
|
74
|
+
const limit = typeof p.limit === "number" && p.limit > 0 ? p.limit : all.length;
|
|
75
|
+
const events = all.slice(0, limit); // newest N (generateExport re-sorts ascending)
|
|
76
|
+
return {
|
|
77
|
+
output: generateExport(events, settings),
|
|
78
|
+
returned: events.length,
|
|
79
|
+
totalAvailable: all.length,
|
|
80
|
+
includedData: settings.includeEventData,
|
|
81
|
+
format: settings.format
|
|
82
|
+
};
|
|
55
83
|
}
|
|
56
84
|
}
|
|
57
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["unifiedEventStore","eventsSyncAdapter","version","getSnapshot","events","getEvents","availableSources","Array","from","getAvailableEventSources","subscribe","onChange","ensureRemoteSourcesDefault","unsubscribe","clearRemoteSources","actions","clearEvents","setEnabledSources","params","sources","setRemoteEnabledSources","enabledSources"],"sourceRoot":"../../../src","sources":["sync/eventsSyncAdapter.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,6BAA6B;
|
|
1
|
+
{"version":3,"names":["unifiedEventStore","generateExport","DEFAULT_COPY_SETTINGS","COPY_PRESETS","eventsSyncAdapter","version","getSnapshot","events","getEvents","availableSources","Array","from","getAvailableEventSources","subscribe","onChange","ensureRemoteSourcesDefault","unsubscribe","clearRemoteSources","actions","clearEvents","setEnabledSources","params","sources","setRemoteEnabledSources","enabledSources","exportEvents","p","base","preset","settings","all","limit","length","slice","output","returned","totalAvailable","includedData","includeEventData","format"],"sourceRoot":"../../../src","sources":["sync/eventsSyncAdapter.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,6BAA6B;AAE/D,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SACEC,qBAAqB,EACrBC,YAAY,QAGP,uBAAuB;AAW9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG;EAC/BC,OAAO,EAAE,CAAC;EACVC,WAAW,EAAEA,CAAA,MAAO;IAClBC,MAAM,EAAEP,iBAAiB,CAACQ,SAAS,CAAC,CAAC;IACrCC,gBAAgB,EAAEC,KAAK,CAACC,IAAI,CAACX,iBAAiB,CAACY,wBAAwB,CAAC,CAAC;EAC3E,CAAC,CAAC;EACFC,SAAS,EAAGC,QAAoB,IAAK;IACnC;IACA;IACA;IACA;IACAd,iBAAiB,CAACe,0BAA0B,CAAC,CAAC;IAC9C,MAAMC,WAAW,GAAGhB,iBAAiB,CAACa,SAAS,CAAC,MAAMC,QAAQ,CAAC,CAAC,CAAC;IACjE,OAAO,MAAM;MACXE,WAAW,CAAC,CAAC;MACb;MACA;MACAhB,iBAAiB,CAACiB,kBAAkB,CAAC,CAAC;IACxC,CAAC;EACH,CAAC;EACDC,OAAO,EAAE;IACPC,WAAW,EAAEA,CAAA,KAAM;MACjBnB,iBAAiB,CAACmB,WAAW,CAAC,CAAC;IACjC,CAAC;IACD;AACJ;AACA;AACA;AACA;IACIC,iBAAiB,EAAGC,MAAe,IAAK;MACtC,MAAMC,OAAO,GACVD,MAAM,EAA8CC,OAAO,IAAI,EAAE;MACpEtB,iBAAiB,CAACuB,uBAAuB,CAACD,OAAO,CAAC;MAClD,OAAO;QAAEE,cAAc,EAAEF;MAAQ,CAAC;IACpC,CAAC;IACD;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACIG,YAAY,EAAGJ,MAAe,IAAK;MACjC,MAAMK,CAAC,GAAIL,MAAM,IAAuC,CAAC,CAAC;MAC1D,MAAMM,IAAI,GACRD,CAAC,CAACE,MAAM,IAAIzB,YAAY,CAACuB,CAAC,CAACE,MAAM,CAAC,GAC9BzB,YAAY,CAACuB,CAAC,CAACE,MAAM,CAAC,GACtB1B,qBAAqB;MAC3B,MAAM2B,QAAQ,GAAG;QAAE,GAAGF,IAAI;QAAE,IAAID,CAAC,CAACG,QAAQ,IAAI,CAAC,CAAC;MAAE,CAAuB;MACzE,MAAMC,GAAG,GAAG9B,iBAAiB,CAACQ,SAAS,CAAC,CAAC,CAAC,CAAC;MAC3C,MAAMuB,KAAK,GACT,OAAOL,CAAC,CAACK,KAAK,KAAK,QAAQ,IAAIL,CAAC,CAACK,KAAK,GAAG,CAAC,GAAGL,CAAC,CAACK,KAAK,GAAGD,GAAG,CAACE,MAAM;MACnE,MAAMzB,MAAM,GAAGuB,GAAG,CAACG,KAAK,CAAC,CAAC,EAAEF,KAAK,CAAC,CAAC,CAAC;MACpC,OAAO;QACLG,MAAM,EAAEjC,cAAc,CAACM,MAAM,EAAEsB,QAAQ,CAAC;QACxCM,QAAQ,EAAE5B,MAAM,CAACyB,MAAM;QACvBI,cAAc,EAAEN,GAAG,CAACE,MAAM;QAC1BK,YAAY,EAAER,QAAQ,CAACS,gBAAgB;QACvCC,MAAM,EAAEV,QAAQ,CAACU;MACnB,CAAC;IACH;EACF;AACF,CAAC","ignoreList":[]}
|
|
@@ -32,6 +32,21 @@ export declare const eventsSyncAdapter: {
|
|
|
32
32
|
setEnabledSources: (params: unknown) => {
|
|
33
33
|
enabledSources: EventSource[];
|
|
34
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Format the captured events using the SAME "Copy Settings" formatter the
|
|
37
|
+
* on-device copy button uses — driven by toggles instead of taps. Heavy raw
|
|
38
|
+
* payloads (`originalEvent`) stay on the device unless the caller opts in
|
|
39
|
+
* (`includeEventData`), so a remote driver (MCP/LLM) gets a compact result
|
|
40
|
+
* by default and only pulls more detail when it asks. Returns the formatted
|
|
41
|
+
* string + metadata so the caller knows how much was returned.
|
|
42
|
+
*/
|
|
43
|
+
exportEvents: (params: unknown) => {
|
|
44
|
+
output: string;
|
|
45
|
+
returned: number;
|
|
46
|
+
totalAvailable: number;
|
|
47
|
+
includedData: boolean;
|
|
48
|
+
format: "markdown" | "json" | "plaintext" | "mermaid";
|
|
49
|
+
};
|
|
35
50
|
};
|
|
36
51
|
};
|
|
37
52
|
//# sourceMappingURL=eventsSyncAdapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventsSyncAdapter.d.ts","sourceRoot":"","sources":["../../../src/sync/eventsSyncAdapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"eventsSyncAdapter.d.ts","sourceRoot":"","sources":["../../../src/sync/eventsSyncAdapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAkB5C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB;;;;;;0BAMN,MAAM,IAAI;;;QAkB9B;;;;WAIG;oCACyB,OAAO;;;QAMnC;;;;;;;WAOG;+BACoB,OAAO;;;;;;;;CAoBjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/events",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "events package",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
],
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@buoy-gg/floating-tools-core": "4.0.
|
|
31
|
-
"@buoy-gg/shared-ui": "4.0.
|
|
30
|
+
"@buoy-gg/floating-tools-core": "4.0.2",
|
|
31
|
+
"@buoy-gg/shared-ui": "4.0.2"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": "*",
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { unifiedEventStore } from "../stores/unifiedEventStore";
|
|
2
2
|
import type { EventSource } from "../types";
|
|
3
|
+
import { generateExport } from "../utils/eventExportFormatter";
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_COPY_SETTINGS,
|
|
6
|
+
COPY_PRESETS,
|
|
7
|
+
type EventsCopySettings,
|
|
8
|
+
type CopyPresetName,
|
|
9
|
+
} from "../types/copySettings";
|
|
10
|
+
|
|
11
|
+
interface ExportEventsParams {
|
|
12
|
+
/** A named preset (llm, errors, minimal, …) as the base; defaults to the compact default. */
|
|
13
|
+
preset?: CopyPresetName;
|
|
14
|
+
/** Field/format overrides merged over the preset/default (the Copy Settings toggles). */
|
|
15
|
+
settings?: Partial<EventsCopySettings>;
|
|
16
|
+
/** Cap to the most-recent N events (before formatting). */
|
|
17
|
+
limit?: number;
|
|
18
|
+
}
|
|
3
19
|
|
|
4
20
|
/**
|
|
5
21
|
* Sync adapter for the events tool, consumed by @buoy-gg/external-sync's
|
|
@@ -52,5 +68,32 @@ export const eventsSyncAdapter = {
|
|
|
52
68
|
unifiedEventStore.setRemoteEnabledSources(sources);
|
|
53
69
|
return { enabledSources: sources };
|
|
54
70
|
},
|
|
71
|
+
/**
|
|
72
|
+
* Format the captured events using the SAME "Copy Settings" formatter the
|
|
73
|
+
* on-device copy button uses — driven by toggles instead of taps. Heavy raw
|
|
74
|
+
* payloads (`originalEvent`) stay on the device unless the caller opts in
|
|
75
|
+
* (`includeEventData`), so a remote driver (MCP/LLM) gets a compact result
|
|
76
|
+
* by default and only pulls more detail when it asks. Returns the formatted
|
|
77
|
+
* string + metadata so the caller knows how much was returned.
|
|
78
|
+
*/
|
|
79
|
+
exportEvents: (params: unknown) => {
|
|
80
|
+
const p = (params as ExportEventsParams | undefined) ?? {};
|
|
81
|
+
const base =
|
|
82
|
+
p.preset && COPY_PRESETS[p.preset]
|
|
83
|
+
? COPY_PRESETS[p.preset]
|
|
84
|
+
: DEFAULT_COPY_SETTINGS;
|
|
85
|
+
const settings = { ...base, ...(p.settings ?? {}) } as EventsCopySettings;
|
|
86
|
+
const all = unifiedEventStore.getEvents(); // newest-first, capped by the store
|
|
87
|
+
const limit =
|
|
88
|
+
typeof p.limit === "number" && p.limit > 0 ? p.limit : all.length;
|
|
89
|
+
const events = all.slice(0, limit); // newest N (generateExport re-sorts ascending)
|
|
90
|
+
return {
|
|
91
|
+
output: generateExport(events, settings),
|
|
92
|
+
returned: events.length,
|
|
93
|
+
totalAvailable: all.length,
|
|
94
|
+
includedData: settings.includeEventData,
|
|
95
|
+
format: settings.format,
|
|
96
|
+
};
|
|
97
|
+
},
|
|
55
98
|
},
|
|
56
99
|
};
|