@tineira/apc-web 0.0.0-stage → 0.7.1
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/LICENSE +21 -0
- package/README.md +29 -2
- package/dist/agents-bar.d.ts +110 -0
- package/dist/agents-bar.js +498 -0
- package/dist/direct-agents.d.ts +39 -0
- package/dist/direct-agents.js +205 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/pin-badge.d.ts +45 -0
- package/dist/pin-badge.js +174 -0
- package/dist/pinning.d.ts +160 -0
- package/dist/pinning.js +598 -0
- package/dist/presence.d.ts +18 -0
- package/dist/presence.js +50 -0
- package/dist/view.d.ts +15 -0
- package/dist/view.js +32 -0
- package/package.json +44 -3
package/dist/view.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FocusParams } from "@tineira/apc-protocol";
|
|
2
|
+
export interface ReportedView {
|
|
3
|
+
screen: string;
|
|
4
|
+
params: FocusParams;
|
|
5
|
+
selection: {
|
|
6
|
+
kind: string;
|
|
7
|
+
id: string;
|
|
8
|
+
} | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Report the screen as identifiers, debounced (1 s by default) and only while
|
|
12
|
+
* the tab is visible. The host's endpoint applies the allowlist; this only
|
|
13
|
+
* avoids sending what would be dropped anyway.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createViewReporter(send: (view: ReportedView) => void, debounceMs?: number): (view: ReportedView) => void;
|
package/dist/view.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Report the screen as identifiers, debounced (1 s by default) and only while
|
|
3
|
+
* the tab is visible. The host's endpoint applies the allowlist; this only
|
|
4
|
+
* avoids sending what would be dropped anyway.
|
|
5
|
+
*/
|
|
6
|
+
export function createViewReporter(send, debounceMs = 1000) {
|
|
7
|
+
let timer = null;
|
|
8
|
+
let last = "";
|
|
9
|
+
let pending = null;
|
|
10
|
+
const flush = () => {
|
|
11
|
+
timer = null;
|
|
12
|
+
if (!pending || document.visibilityState !== "visible")
|
|
13
|
+
return;
|
|
14
|
+
const key = JSON.stringify(pending);
|
|
15
|
+
if (key === last)
|
|
16
|
+
return;
|
|
17
|
+
last = key;
|
|
18
|
+
send(pending);
|
|
19
|
+
};
|
|
20
|
+
document.addEventListener("visibilitychange", () => {
|
|
21
|
+
if (document.visibilityState === "visible" && pending) {
|
|
22
|
+
last = "";
|
|
23
|
+
flush();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return (view) => {
|
|
27
|
+
pending = view;
|
|
28
|
+
if (timer)
|
|
29
|
+
clearTimeout(timer);
|
|
30
|
+
timer = setTimeout(flush, debounceMs);
|
|
31
|
+
};
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tineira/apc-web",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.7.1",
|
|
4
|
+
"description": "Agent Pointed Context (APC) for an app's page, in the browser: pinning agents to what the person sees, the agent bar (<apc-agents>), the pin badge, presence and the Direct agents list.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"apc",
|
|
7
|
+
"agent-pointed-context",
|
|
8
|
+
"mcp",
|
|
9
|
+
"ai-agents",
|
|
10
|
+
"web-components",
|
|
11
|
+
"browser"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://apc.tineira.com/docs",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/tineira/agent-pointed-context/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/tineira/agent-pointed-context",
|
|
20
|
+
"directory": "packages/web"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE"
|
|
34
|
+
],
|
|
35
|
+
"sideEffects": false,
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=20"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@tineira/apc-protocol": "^0.7.1"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {},
|
|
46
|
+
"types": "./dist/index.d.ts"
|
|
6
47
|
}
|