@jini-ai/diagnostics 0.7.2 → 0.7.3-next.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/CHANGELOG.md +2 -8
- package/dist/agent-logs/amr/index.d.ts +8 -0
- package/dist/agent-logs/amr/index.js +16 -0
- package/dist/agent-logs/claude/index.d.ts +8 -0
- package/dist/agent-logs/claude/index.js +8 -0
- package/dist/agent-logs/codex/index.d.ts +8 -0
- package/dist/agent-logs/codex/index.js +8 -0
- package/dist/agent-logs/opencode/index.d.ts +8 -0
- package/dist/agent-logs/opencode/index.js +10 -0
- package/dist/agent-logs.js +12 -39
- package/dist/console-tee.d.ts +83 -0
- package/dist/console-tee.js +108 -0
- package/dist/local-text.d.ts +21 -0
- package/dist/local-text.js +30 -0
- package/dist/observability/delivery.js +4 -3
- package/dist/observability/errors.d.ts +4 -1
- package/dist/observability/errors.js +2 -2
- package/dist/observability/fanout.d.ts +1 -1
- package/dist/observability/fanout.js +1 -1
- package/dist/observability/hooks.d.ts +2 -1
- package/dist/observability/hooks.js +1 -1
- package/dist/observability/index.d.ts +2 -12
- package/dist/observability/index.js +2 -11
- package/dist/observability/instrumentation.d.ts +4 -4
- package/dist/observability/instrumentation.js +1 -1
- package/dist/observability/node.d.ts +4 -0
- package/dist/observability/node.js +2 -0
- package/dist/observability/otel.d.ts +19 -25
- package/dist/observability/otel.js +20 -195
- package/dist/observability/ports.d.ts +1 -184
- package/dist/observability/provider-contract.d.ts +22 -0
- package/dist/observability/provider-contract.js +19 -0
- package/dist/observability/report-error.d.ts +1 -1
- package/dist/observability/tracker-types.d.ts +2 -2
- package/dist/observability/tracker.js +3 -2
- package/dist/sources.js +2 -1
- package/dist/web-evidence/bounded-body.d.ts +22 -0
- package/dist/web-evidence/bounded-body.js +60 -0
- package/dist/web-evidence/capture-budget.d.ts +29 -0
- package/dist/web-evidence/capture-budget.js +14 -0
- package/dist/web-evidence/capture-clock.d.ts +12 -0
- package/dist/web-evidence/capture-clock.js +8 -0
- package/dist/web-evidence/cookie-shapes.d.ts +22 -0
- package/dist/web-evidence/cookie-shapes.js +26 -0
- package/dist/web-evidence/index.d.ts +3 -0
- package/dist/web-evidence/index.js +3 -0
- package/dist/web-evidence/page-body.d.ts +37 -0
- package/dist/web-evidence/page-body.js +112 -0
- package/dist/web-evidence/page-work-budget.d.ts +17 -1
- package/dist/web-evidence/page-work-budget.js +30 -8
- package/dist/web-evidence/path-guard.d.ts +119 -0
- package/dist/web-evidence/path-guard.js +200 -0
- package/dist/web-evidence/playwright-browser.js +18 -15
- package/dist/web-evidence/playwright-runtime.d.ts +0 -45
- package/dist/web-evidence/playwright-runtime.js +48 -2
- package/dist/web-evidence/render-page.d.ts +14 -0
- package/dist/web-evidence/render-page.js +65 -20
- package/dist/web-evidence/request-guard.js +19 -15
- package/dist/web-evidence/same-origin.d.ts +1 -1
- package/dist/web-evidence/same-origin.js +4 -4
- package/dist/web-evidence/testing/fake-clock.d.ts +19 -0
- package/dist/web-evidence/testing/fake-clock.js +47 -0
- package/package.json +54 -6
- package/dist/observability/noop.d.ts +0 -7
- package/dist/observability/noop.js +0 -27
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CaptureClock } from "../capture-clock.js";
|
|
2
|
+
/** A virtual clock for `renderPage` tests. Time moves only through `advance`, which fires due timers in
|
|
3
|
+
* time order and lets every promise they release settle before moving on. */
|
|
4
|
+
export declare class FakeCaptureClock implements CaptureClock {
|
|
5
|
+
private current;
|
|
6
|
+
private nextId;
|
|
7
|
+
private timers;
|
|
8
|
+
now(): number;
|
|
9
|
+
setTimeout(fn: () => void, ms: number): number;
|
|
10
|
+
clearTimeout(handle: unknown): void;
|
|
11
|
+
deadlineSignal(ms: number): AbortSignal;
|
|
12
|
+
/** Timers still waiting. A finished capture leaves none behind. */
|
|
13
|
+
pendingTimers(): number;
|
|
14
|
+
/** Move virtual time forward by `ms`, firing each due timer at its own instant. */
|
|
15
|
+
advance(ms: number): Promise<void>;
|
|
16
|
+
/** Remove and return the earliest timer due at or before `target`; ties keep creation order. */
|
|
17
|
+
private takeDue;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=fake-clock.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Reads the host's real timer once, at load: a fake clock must be able to wait for real macrotasks. */
|
|
2
|
+
const hostSetTimeout = globalThis.setTimeout.bind(globalThis);
|
|
3
|
+
const nextMacrotask = () => new Promise(resolve => hostSetTimeout(resolve, 0));
|
|
4
|
+
/** A virtual clock for `renderPage` tests. Time moves only through `advance`, which fires due timers in
|
|
5
|
+
* time order and lets every promise they release settle before moving on. */
|
|
6
|
+
export class FakeCaptureClock {
|
|
7
|
+
current = 0;
|
|
8
|
+
nextId = 1;
|
|
9
|
+
timers = [];
|
|
10
|
+
now() { return this.current; }
|
|
11
|
+
setTimeout(fn, ms) {
|
|
12
|
+
const id = this.nextId;
|
|
13
|
+
this.nextId += 1;
|
|
14
|
+
this.timers.push({ id, at: this.current + Math.max(0, ms), fn });
|
|
15
|
+
return id;
|
|
16
|
+
}
|
|
17
|
+
clearTimeout(handle) {
|
|
18
|
+
this.timers = this.timers.filter(timer => timer.id !== handle);
|
|
19
|
+
}
|
|
20
|
+
deadlineSignal(ms) {
|
|
21
|
+
const controller = new AbortController();
|
|
22
|
+
this.setTimeout(() => controller.abort(new DOMException("The operation timed out.", "TimeoutError")), ms);
|
|
23
|
+
return controller.signal;
|
|
24
|
+
}
|
|
25
|
+
/** Timers still waiting. A finished capture leaves none behind. */
|
|
26
|
+
pendingTimers() { return this.timers.length; }
|
|
27
|
+
/** Move virtual time forward by `ms`, firing each due timer at its own instant. */
|
|
28
|
+
async advance(ms) {
|
|
29
|
+
const target = this.current + ms;
|
|
30
|
+
await nextMacrotask();
|
|
31
|
+
for (let due = this.takeDue(target); due; due = this.takeDue(target)) {
|
|
32
|
+
this.current = Math.max(this.current, due.at);
|
|
33
|
+
due.fn();
|
|
34
|
+
await nextMacrotask();
|
|
35
|
+
}
|
|
36
|
+
this.current = target;
|
|
37
|
+
await nextMacrotask();
|
|
38
|
+
}
|
|
39
|
+
/** Remove and return the earliest timer due at or before `target`; ties keep creation order. */
|
|
40
|
+
takeDue(target) {
|
|
41
|
+
const due = this.timers.filter(timer => timer.at <= target).sort((a, b) => a.at - b.at || a.id - b.id)[0];
|
|
42
|
+
if (due)
|
|
43
|
+
this.timers = this.timers.filter(timer => timer !== due);
|
|
44
|
+
return due;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=fake-clock.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/diagnostics",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3-next.1",
|
|
4
4
|
"description": "Diagnostics-bundle tooling: JSON/text secret redaction, log-source collection, manifest building, and zip packaging for support exports.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -18,9 +18,18 @@
|
|
|
18
18
|
"./observability/node": "node",
|
|
19
19
|
"./web-evidence": "universal",
|
|
20
20
|
"./web-evidence/playwright": "node",
|
|
21
|
-
"./
|
|
21
|
+
"./web-evidence/page-body": "node",
|
|
22
|
+
"./web-evidence/testing": "universal",
|
|
23
|
+
"./web-evidence/capture-budget": "universal",
|
|
24
|
+
"./web-evidence/capture-clock": "universal",
|
|
25
|
+
"./domain-dns": "node",
|
|
26
|
+
"./local-text": "node",
|
|
27
|
+
"./console-tee": "node"
|
|
22
28
|
},
|
|
23
|
-
"runtime": "node"
|
|
29
|
+
"runtime": "node",
|
|
30
|
+
"optionalPeers": {
|
|
31
|
+
"parse5": "opt-in: page body projection; import @jini-ai/diagnostics/web-evidence/page-body — The page body projection could not load parse5. Install parse5@7.3.0 to enable this feature, or check its installed version."
|
|
32
|
+
}
|
|
24
33
|
},
|
|
25
34
|
"type": "module",
|
|
26
35
|
"sideEffects": false,
|
|
@@ -57,10 +66,40 @@
|
|
|
57
66
|
"import": "./dist/web-evidence/playwright-browser.js",
|
|
58
67
|
"default": "./dist/web-evidence/playwright-browser.js"
|
|
59
68
|
},
|
|
69
|
+
"./web-evidence/page-body": {
|
|
70
|
+
"types": "./dist/web-evidence/page-body.d.ts",
|
|
71
|
+
"import": "./dist/web-evidence/page-body.js",
|
|
72
|
+
"default": "./dist/web-evidence/page-body.js"
|
|
73
|
+
},
|
|
74
|
+
"./web-evidence/testing": {
|
|
75
|
+
"types": "./dist/web-evidence/testing/fake-clock.d.ts",
|
|
76
|
+
"import": "./dist/web-evidence/testing/fake-clock.js",
|
|
77
|
+
"default": "./dist/web-evidence/testing/fake-clock.js"
|
|
78
|
+
},
|
|
79
|
+
"./web-evidence/capture-budget": {
|
|
80
|
+
"types": "./dist/web-evidence/capture-budget.d.ts",
|
|
81
|
+
"import": "./dist/web-evidence/capture-budget.js",
|
|
82
|
+
"default": "./dist/web-evidence/capture-budget.js"
|
|
83
|
+
},
|
|
84
|
+
"./web-evidence/capture-clock": {
|
|
85
|
+
"types": "./dist/web-evidence/capture-clock.d.ts",
|
|
86
|
+
"import": "./dist/web-evidence/capture-clock.js",
|
|
87
|
+
"default": "./dist/web-evidence/capture-clock.js"
|
|
88
|
+
},
|
|
60
89
|
"./domain-dns": {
|
|
61
90
|
"types": "./dist/domain-dns/index.d.ts",
|
|
62
91
|
"import": "./dist/domain-dns/index.js",
|
|
63
92
|
"default": "./dist/domain-dns/index.js"
|
|
93
|
+
},
|
|
94
|
+
"./local-text": {
|
|
95
|
+
"types": "./dist/local-text.d.ts",
|
|
96
|
+
"import": "./dist/local-text.js",
|
|
97
|
+
"default": "./dist/local-text.js"
|
|
98
|
+
},
|
|
99
|
+
"./console-tee": {
|
|
100
|
+
"types": "./dist/console-tee.d.ts",
|
|
101
|
+
"import": "./dist/console-tee.js",
|
|
102
|
+
"default": "./dist/console-tee.js"
|
|
64
103
|
}
|
|
65
104
|
},
|
|
66
105
|
"files": [
|
|
@@ -82,13 +121,22 @@
|
|
|
82
121
|
"devDependencies": {
|
|
83
122
|
"@vitest/coverage-v8": "^2.1.9",
|
|
84
123
|
"jszip": "^3.10.1",
|
|
85
|
-
"
|
|
86
|
-
"@jini-ai/core": "^0.7.
|
|
124
|
+
"parse5": "7.3.0",
|
|
125
|
+
"@jini-ai/core": "^0.7.3-next.1",
|
|
126
|
+
"@jini-ai/analytics": "^0.7.3-next.1"
|
|
87
127
|
},
|
|
88
128
|
"dependencies": {
|
|
89
129
|
"js-tokens": "^9.0.1",
|
|
90
130
|
"jszip": "^3.10.1",
|
|
91
|
-
"@jini-ai/core": "^0.7.
|
|
131
|
+
"@jini-ai/core": "^0.7.3-next.1"
|
|
132
|
+
},
|
|
133
|
+
"peerDependencies": {
|
|
134
|
+
"parse5": "7.3.0"
|
|
135
|
+
},
|
|
136
|
+
"peerDependenciesMeta": {
|
|
137
|
+
"parse5": {
|
|
138
|
+
"optional": true
|
|
139
|
+
}
|
|
92
140
|
},
|
|
93
141
|
"scripts": {
|
|
94
142
|
"build": "tsc -p tsconfig.json",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ObservabilityPort } from './ports.js';
|
|
2
|
-
/** Creates disabled telemetry; every request shares one frozen tracker without allocation. */
|
|
3
|
-
export declare function createNoopObservabilityPort(_required: Record<string, never>): ObservabilityPort;
|
|
4
|
-
/** True for a port this module built. Decorators use it to skip wrapping entirely when telemetry is
|
|
5
|
-
* off, so a disabled install pays no per-query or per-call indirection, not merely no export. */
|
|
6
|
-
export declare function isNoopObservabilityPort(port: ObservabilityPort): boolean;
|
|
7
|
-
//# sourceMappingURL=noop.d.ts.map
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const run = (fn) => fn();
|
|
2
|
-
const NOOP_TRACKER = Object.freeze({ end() { }, run });
|
|
3
|
-
// One frozen tracker serves every non-request signal too: their end() outcomes differ only in type.
|
|
4
|
-
const NOOP_SIGNAL_TRACKER = Object.freeze({ end() { }, run });
|
|
5
|
-
const NOOP_PORTS = new WeakSet();
|
|
6
|
-
/** Creates disabled telemetry; every request shares one frozen tracker without allocation. */
|
|
7
|
-
export function createNoopObservabilityPort(_required) {
|
|
8
|
-
const port = {
|
|
9
|
-
supportsMetric: false,
|
|
10
|
-
activeTraceIds: () => undefined,
|
|
11
|
-
trackRequest: () => NOOP_TRACKER,
|
|
12
|
-
trackDbQuery: () => NOOP_SIGNAL_TRACKER,
|
|
13
|
-
trackOutboundCall: () => NOOP_SIGNAL_TRACKER,
|
|
14
|
-
trackAgentRun: () => NOOP_SIGNAL_TRACKER,
|
|
15
|
-
trackOperation: () => NOOP_SIGNAL_TRACKER,
|
|
16
|
-
reportError: () => false,
|
|
17
|
-
metric: () => { },
|
|
18
|
-
};
|
|
19
|
-
NOOP_PORTS.add(port);
|
|
20
|
-
return port;
|
|
21
|
-
}
|
|
22
|
-
/** True for a port this module built. Decorators use it to skip wrapping entirely when telemetry is
|
|
23
|
-
* off, so a disabled install pays no per-query or per-call indirection, not merely no export. */
|
|
24
|
-
export function isNoopObservabilityPort(port) {
|
|
25
|
-
return NOOP_PORTS.has(port);
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=noop.js.map
|