@jini-ai/diagnostics 0.7.3-next.2 → 0.7.3-next.3
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/README.md +41 -0
- package/dist/browser-diagnostics.d.ts +43 -0
- package/dist/browser-diagnostics.js +92 -0
- package/dist/console-tee.d.ts +21 -6
- package/dist/console-tee.js +16 -4
- package/dist/domain-dns/index.d.ts +6 -14
- package/dist/domain-dns/index.js +4 -6
- package/dist/local-text.d.ts +4 -1
- package/dist/local-text.js +3 -2
- package/dist/observability/error-events.d.ts +32 -0
- package/dist/observability/error-events.js +32 -0
- package/dist/observability/fanout.js +9 -1
- package/dist/observability/index.d.ts +2 -1
- package/dist/observability/index.js +1 -0
- package/dist/observability/report-error.d.ts +9 -4
- package/dist/observability/report-error.js +7 -6
- package/dist/observability/telemetry-test.d.ts +1 -1
- package/dist/observability/tool-registrations.d.ts +21 -0
- package/dist/observability/tool-registrations.js +38 -0
- package/dist/observability/tracker-noop.d.ts +1 -1
- package/dist/observability/tracker-types.d.ts +2 -57
- package/dist/observability/tracker.d.ts +2 -1
- package/dist/observability/tracker.js +5 -1
- package/dist/redaction/repo-secret-scan.d.ts +48 -0
- package/dist/redaction/repo-secret-scan.js +77 -0
- package/dist/redaction/repo-secret-scan.node.d.ts +56 -0
- package/dist/redaction/repo-secret-scan.node.js +174 -0
- package/dist/redaction/secret-scan.d.ts +15 -0
- package/dist/redaction/secret-scan.js +18 -0
- package/dist/redaction/secrets-only.d.ts +1 -0
- package/dist/redaction/secrets-only.js +2 -0
- package/dist/redaction.d.ts +6 -0
- package/dist/redaction.js +9 -5
- package/dist/server-logs/agent-tools.d.ts +34 -0
- package/dist/server-logs/agent-tools.js +19 -0
- package/dist/server-logs/read-server-logs.d.ts +49 -0
- package/dist/server-logs/read-server-logs.js +90 -0
- package/dist/server-logs/tool-registrations.d.ts +25 -0
- package/dist/server-logs/tool-registrations.js +39 -0
- package/dist/tool-audit/repo.d.ts +107 -0
- package/dist/tool-audit/repo.js +117 -0
- package/dist/tool-audit/repo.memory.d.ts +31 -0
- package/dist/tool-audit/repo.memory.js +30 -0
- package/dist/tool-audit/repo.rows.d.ts +19 -0
- package/dist/tool-audit/repo.rows.js +2 -0
- package/dist/tool-audit/tool-gaps.repo.d.ts +22 -0
- package/dist/tool-audit/tool-gaps.repo.js +36 -0
- package/dist/web-evidence/agent-tools.d.ts +31 -0
- package/dist/web-evidence/agent-tools.js +61 -0
- package/dist/web-evidence/capture-budget.d.ts +3 -10
- package/dist/web-evidence/live-url.d.ts +86 -0
- package/dist/web-evidence/live-url.js +191 -0
- package/dist/web-evidence/page-performance-script.js +30 -32
- package/dist/web-evidence/playwright-browser.d.ts +2 -0
- package/dist/web-evidence/playwright-page-capture.d.ts +129 -0
- package/dist/web-evidence/playwright-page-capture.js +226 -0
- package/dist/web-evidence/public-page.d.ts +2 -1
- package/dist/web-evidence/published-page.d.ts +180 -0
- package/dist/web-evidence/published-page.js +172 -0
- package/dist/web-evidence/request-guard.d.ts +1 -31
- package/dist/web-evidence/site-path-policy.d.ts +20 -0
- package/dist/web-evidence/site-path-policy.js +54 -0
- package/dist/web-evidence/web-screenshot/agent-tools.d.ts +28 -0
- package/dist/web-evidence/web-screenshot/agent-tools.js +34 -0
- package/dist/web-evidence/web-screenshot/tool-registrations.d.ts +79 -0
- package/dist/web-evidence/web-screenshot/tool-registrations.js +47 -0
- package/package.json +114 -6
package/README.md
CHANGED
|
@@ -95,6 +95,30 @@ and `buildRunEventLogSources` / `buildAgentCliLogSources` are conveniences rathe
|
|
|
95
95
|
path) and every field of `DiagnosticsContext`. There are no DI tokens and no injected filesystem —
|
|
96
96
|
collection uses `node:fs` directly.
|
|
97
97
|
|
|
98
|
+
## Wiring
|
|
99
|
+
|
|
100
|
+
`@jini-ai/diagnostics/console-tee` (architecture: [`extraction-plan.md`](../../ADS-memory/reports/jini-port/extraction-plan.md)).
|
|
101
|
+
|
|
102
|
+
- **Needs injected:** a `ConsoleTeeBuffer` (for `installConsoleTee`); for `createRedactedOutputSink`, the parent
|
|
103
|
+
sink (`Pick<Writable, "write">`), the host's `redact` function, and optionally a shared
|
|
104
|
+
`RetainedOutputTail` record plus `tailKeepChars`, `maxLength`, `maxLineLength` and a `CaptureFailureReporter`.
|
|
105
|
+
- **Provides:** a line-framed child-output writable that redacts before anything is mirrored or retained, and keeps
|
|
106
|
+
a bounded, interleaved tail of all of one child's streams for a boot-failure message.
|
|
107
|
+
- **Never imports:** a host logger or console formatter, product names or CLI wording, or any other `@jini-ai/*`
|
|
108
|
+
implementation. Failure copy (what to call the child, how to parse its error line) stays in the host.
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import { createRedactedOutputSink } from "@jini-ai/diagnostics/console-tee";
|
|
112
|
+
|
|
113
|
+
const state = { outputTail: "" }; // read by the host's failure message
|
|
114
|
+
for (const stream of ["stdout", "stderr"] as const) {
|
|
115
|
+
child[stream].pipe(createRedactedOutputSink(
|
|
116
|
+
{ sink: process[stream], redact: ({ text }) => hostRedact({ text }) },
|
|
117
|
+
{ maxLength: 2_000, retain: state, tailKeepChars: 16_384 },
|
|
118
|
+
));
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
98
122
|
## Runtime
|
|
99
123
|
|
|
100
124
|
`jini.runtime: "node"` — reads real files via `node:fs`, and `buildMachineInfo` reads `node:os`.
|
|
@@ -112,3 +136,20 @@ See [API.md](https://github.com/AINSEP/Jini/blob/main/packages/diagnostics/API.m
|
|
|
112
136
|
- [Build evidence URLs from verified host configuration](docs/decisions/DR-001-trusted-evidence-addresses.md).
|
|
113
137
|
|
|
114
138
|
Bundle collection, inbound request hooks and web evidence share `Clock` from `@jini-ai/core/primitives` (`nowMs()` with no empty argument); the old package-local clock types are removed. Credential regexes come only from core's eleven-entry `SECRET_SHAPE_PATTERNS`; diagnostics keeps its own redaction policies and existing scanner/redactor export names. See [API.md](https://github.com/AINSEP/Jini/blob/main/packages/diagnostics/API.md) for migration details.
|
|
139
|
+
|
|
140
|
+
## Wiring (site browser diagnostics)
|
|
141
|
+
|
|
142
|
+
`@jini-ai/diagnostics/browser-diagnostics`: the host injects `consentSetting` (the settings
|
|
143
|
+
`{ namespace, key }` whose explicit `true` is the operator's telemetry consent) into
|
|
144
|
+
`browserDiagnosticsEnabled`'s first arg and `receiveBrowserDiagnostics`'s `deps`, plus its settings repo,
|
|
145
|
+
workspace id and observability port; it serves `siteBrowserDiagnosticsModule` at the bridge's `src` and
|
|
146
|
+
mounts the intake route itself.
|
|
147
|
+
|
|
148
|
+
## Wiring
|
|
149
|
+
|
|
150
|
+
**Global error reporting** (`installGlobalErrorReporting` from `./observability`). The host injects
|
|
151
|
+
`target` (its `window`) and `report` — its own sink that maps `{ message, stack }` onto its telemetry
|
|
152
|
+
vocabulary (payload kind, IPC channel, bridge) and swallows bridge failures. Optional
|
|
153
|
+
`maxMessageLength`/`maxStackLength`/`rejectionFallback` override the 1000/8000/"Unhandled rejection"
|
|
154
|
+
defaults. The host's renderer boot module calls it once before the UI mounts and keeps the teardown
|
|
155
|
+
for tests.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Site browser diagnostics: the consent-bridge module that, only under full analytics consent,
|
|
3
|
+
* reports one buffered navigation timing and error/unhandled-rejection codes to the host's
|
|
4
|
+
* `/_jini/browser-analytics/site/diagnostics` endpoint, and the server half that admits a report as a
|
|
5
|
+
* fixed-name observability metric. Off unless the observability adapter admits metrics AND the
|
|
6
|
+
* host's telemetry consent setting is an explicit `true` (a read error means off).
|
|
7
|
+
*
|
|
8
|
+
* Host-injected: `consentSetting` (which settings key holds the operator's telemetry consent).
|
|
9
|
+
*/
|
|
10
|
+
import { type SettingsRepoPort } from '@jini-ai/core/settings';
|
|
11
|
+
import type { ObservabilityPort } from '@jini-ai/core/contracts/observability';
|
|
12
|
+
/** The settings key (namespace + key) whose explicit `true` turns diagnostics on. */
|
|
13
|
+
export interface BrowserDiagnosticsConsentSetting {
|
|
14
|
+
namespace: string;
|
|
15
|
+
key: string;
|
|
16
|
+
}
|
|
17
|
+
export interface BrowserDiagnosticsDeps {
|
|
18
|
+
settingsRepo?: SettingsRepoPort;
|
|
19
|
+
workspaceId?: string;
|
|
20
|
+
observability?: ObservabilityPort;
|
|
21
|
+
}
|
|
22
|
+
export declare function browserDiagnosticsEnabled({ observability, consentSetting }: {
|
|
23
|
+
observability?: ObservabilityPort;
|
|
24
|
+
consentSetting: BrowserDiagnosticsConsentSetting;
|
|
25
|
+
}, { settingsRepo, workspaceId }?: Pick<BrowserDiagnosticsDeps, 'settingsRepo' | 'workspaceId'>): Promise<boolean>;
|
|
26
|
+
export declare function receiveBrowserDiagnostics({ body, contentType }: {
|
|
27
|
+
body: Uint8Array;
|
|
28
|
+
contentType: string;
|
|
29
|
+
}, { deps }: {
|
|
30
|
+
deps: Required<Pick<BrowserDiagnosticsDeps, 'observability'>> & Pick<BrowserDiagnosticsDeps, 'settingsRepo' | 'workspaceId'> & {
|
|
31
|
+
consentSetting: BrowserDiagnosticsConsentSetting;
|
|
32
|
+
};
|
|
33
|
+
}): Promise<{
|
|
34
|
+
status: number;
|
|
35
|
+
body: string;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const siteBrowserDiagnosticsBridge: {
|
|
38
|
+
id: string;
|
|
39
|
+
kind: string;
|
|
40
|
+
src: string;
|
|
41
|
+
};
|
|
42
|
+
export declare const siteBrowserDiagnosticsModule: string;
|
|
43
|
+
//# sourceMappingURL=browser-diagnostics.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Site browser diagnostics: the consent-bridge module that, only under full analytics consent,
|
|
3
|
+
* reports one buffered navigation timing and error/unhandled-rejection codes to the host's
|
|
4
|
+
* `/_jini/browser-analytics/site/diagnostics` endpoint, and the server half that admits a report as a
|
|
5
|
+
* fixed-name observability metric. Off unless the observability adapter admits metrics AND the
|
|
6
|
+
* host's telemetry consent setting is an explicit `true` (a read error means off).
|
|
7
|
+
*
|
|
8
|
+
* Host-injected: `consentSetting` (which settings key holds the operator's telemetry consent).
|
|
9
|
+
*/
|
|
10
|
+
import { getEffective } from '@jini-ai/core/settings';
|
|
11
|
+
import { orFallback, orFallbackSync } from '@jini-ai/core/errors/idioms';
|
|
12
|
+
export async function browserDiagnosticsEnabled({ observability, consentSetting }, { settingsRepo, workspaceId } = {}) {
|
|
13
|
+
if (observability?.supportsMetric !== true || !settingsRepo || !workspaceId)
|
|
14
|
+
return false;
|
|
15
|
+
return orFallback({ work: async () => (await getEffective({ deps: { repo: settingsRepo }, namespace: consentSetting.namespace, key: consentSetting.key, scopeContext: { workspaceId } }))?.value === true,
|
|
16
|
+
fallback: false, step: 'Read browser diagnostics enablement' });
|
|
17
|
+
}
|
|
18
|
+
export async function receiveBrowserDiagnostics({ body, contentType }, { deps }) {
|
|
19
|
+
if (!(await browserDiagnosticsEnabled({ observability: deps.observability, consentSetting: deps.consentSetting }, deps)))
|
|
20
|
+
return { status: 404, body: '' };
|
|
21
|
+
if ((contentType.split(';', 1)[0] ?? '').trim().toLowerCase() !== 'application/json')
|
|
22
|
+
return { status: 415, body: '' };
|
|
23
|
+
if (body.byteLength > 256)
|
|
24
|
+
return { status: 413, body: '' };
|
|
25
|
+
const entries = orFallbackSync({ work: () => {
|
|
26
|
+
const parsed = JSON.parse(Buffer.from(body).toString('utf8'));
|
|
27
|
+
if (typeof parsed !== 'object' || parsed === null)
|
|
28
|
+
return [];
|
|
29
|
+
return Object.entries(parsed);
|
|
30
|
+
}, fallback: [], step: 'Read browser diagnostics payload' });
|
|
31
|
+
if (entries.length !== 1)
|
|
32
|
+
return { status: 400, body: '' };
|
|
33
|
+
const accepted = await entries.map(async ([key, value]) => {
|
|
34
|
+
if (key === 'navigationMs' && typeof value === 'number' && Number.isFinite(value) && value > 0 && value <= 600_000) {
|
|
35
|
+
await deps.observability.metric({ name: 'browser.navigation.duration', value }, { kind: 'histogram', unit: 'ms', attributes: { surface: 'site' } });
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
if (key === 'errorKind' && (value === 1 || value === 2)) {
|
|
39
|
+
await deps.observability.metric({ name: value === 1 ? 'browser.error' : 'browser.unhandled_rejection', value: 1 }, { kind: 'counter', attributes: { surface: 'site' } });
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
})[0];
|
|
44
|
+
return { status: accepted ? 204 : 400, body: '' };
|
|
45
|
+
}
|
|
46
|
+
const browserDiagnosticsSource = String.raw `function({ target, report }, options = {}) {
|
|
47
|
+
const controller = new target.AbortController();
|
|
48
|
+
let observer, navigationSent = false;
|
|
49
|
+
if (target.PerformanceObserver) {
|
|
50
|
+
observer = new target.PerformanceObserver(list => {
|
|
51
|
+
for (const entry of list.getEntries()) {
|
|
52
|
+
const navigationMs = entry.duration;
|
|
53
|
+
if (navigationSent || !Number.isFinite(navigationMs) || navigationMs <= 0) continue;
|
|
54
|
+
navigationSent = true;
|
|
55
|
+
report({ body: { navigationMs }, signal: controller.signal });
|
|
56
|
+
observer.disconnect();
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
observer.observe({ type: 'navigation', buffered: true });
|
|
61
|
+
}
|
|
62
|
+
const error = () => report({ body: { errorKind: 1 }, signal: controller.signal });
|
|
63
|
+
const rejection = () => report({ body: { errorKind: 2 }, signal: controller.signal });
|
|
64
|
+
target.addEventListener('error', error);
|
|
65
|
+
target.addEventListener('unhandledrejection', rejection);
|
|
66
|
+
return () => {
|
|
67
|
+
target.removeEventListener('error', error);
|
|
68
|
+
target.removeEventListener('unhandledrejection', rejection);
|
|
69
|
+
observer?.disconnect();
|
|
70
|
+
controller.abort();
|
|
71
|
+
};
|
|
72
|
+
}`;
|
|
73
|
+
export const siteBrowserDiagnosticsBridge = { id: 'site-browser-diagnostics', kind: 'consent-bridge', src: '/_jini/browser-analytics/site/diagnostics.js' };
|
|
74
|
+
export const siteBrowserDiagnosticsModule = `const collect = ${browserDiagnosticsSource};
|
|
75
|
+
export default {
|
|
76
|
+
id: 'site-browser-diagnostics', kind: 'consent-bridge',
|
|
77
|
+
mount({ api, doc }) {
|
|
78
|
+
let dispose;
|
|
79
|
+
const reconcile = state => {
|
|
80
|
+
if (state.analyticsLevel === 'full') {
|
|
81
|
+
if (!dispose) dispose = collect({ target: doc.defaultView, report: ({ body, signal }) => {
|
|
82
|
+
void doc.defaultView.fetch('/_jini/browser-analytics/site/diagnostics', { method: 'POST', credentials: 'same-origin',
|
|
83
|
+
headers: { 'content-type': 'application/json' }, body: JSON.stringify(body), signal }).catch(() => undefined);
|
|
84
|
+
} });
|
|
85
|
+
} else { dispose?.(); dispose = undefined; }
|
|
86
|
+
};
|
|
87
|
+
const unsubscribe = api.subscribe({ listener: reconcile });
|
|
88
|
+
reconcile(api.get());
|
|
89
|
+
return () => { unsubscribe(); dispose?.(); };
|
|
90
|
+
}
|
|
91
|
+
};`;
|
|
92
|
+
//# sourceMappingURL=browser-diagnostics.js.map
|
package/dist/console-tee.d.ts
CHANGED
|
@@ -19,12 +19,31 @@ export interface CaptureFailure {
|
|
|
19
19
|
}
|
|
20
20
|
/** Receives each {@link CaptureFailure}; must not throw. Defaults to ignoring them (the output still degrades safely). */
|
|
21
21
|
export type CaptureFailureReporter = (failure: CaptureFailure) => void;
|
|
22
|
+
/**
|
|
23
|
+
* A host-owned record of one child's latest redacted output. Every sink of that child (stdout and stderr)
|
|
24
|
+
* shares the same record, so the tail keeps their real interleaving for a boot-failure message.
|
|
25
|
+
*/
|
|
26
|
+
export interface RetainedOutputTail {
|
|
27
|
+
outputTail: string;
|
|
28
|
+
}
|
|
29
|
+
export interface RedactedOutputSinkOptional {
|
|
30
|
+
/** Longest input line kept for redaction; longer lines are dropped whole. */
|
|
31
|
+
readonly maxLineLength?: number;
|
|
32
|
+
/** Longest rendered line, in characters, before the newline. */
|
|
33
|
+
readonly maxLength?: number;
|
|
34
|
+
readonly onFailure?: CaptureFailureReporter;
|
|
35
|
+
/** Receives each emitted (already redacted and bounded) line before the parent sink does. */
|
|
36
|
+
readonly retain?: RetainedOutputTail;
|
|
37
|
+
/** Characters of tail kept after a trim; defaults to 16 KiB. */
|
|
38
|
+
readonly tailKeepChars?: number;
|
|
39
|
+
}
|
|
22
40
|
/**
|
|
23
41
|
* Frames child output before invoking the caller's existing redactor, including an unterminated
|
|
24
42
|
* final line. Never closes the parent sink. Oversized lines are discarded whole so cutting a
|
|
25
43
|
* credential before redaction cannot expose a fragment. Redactor failures emit fixed copy.
|
|
26
44
|
* @param required Parent sink and redaction policy; no process globals are read.
|
|
27
|
-
* @param optional Input-line and rendered-line limits, in characters; `onFailure` hears each redactor failure
|
|
45
|
+
* @param optional Input-line and rendered-line limits, in characters; `onFailure` hears each redactor failure;
|
|
46
|
+
* `retain` receives every emitted line (shared by all of one child's sinks), trimmed per `tailKeepChars`.
|
|
28
47
|
* @returns A writable for one child stream; ending it, or its source unpiping at EOF, flushes the last line.
|
|
29
48
|
* @complexity O(n) time for n input characters; O(maxLineLength) retained space.
|
|
30
49
|
* @example child.stderr.pipe(createRedactedOutputSink({ sink: process.stderr, redact }));
|
|
@@ -34,11 +53,7 @@ export declare function createRedactedOutputSink({ sink, redact }: {
|
|
|
34
53
|
redact: (required: {
|
|
35
54
|
text: string;
|
|
36
55
|
}) => string;
|
|
37
|
-
}, { maxLineLength, maxLength, onFailure }?:
|
|
38
|
-
maxLineLength?: number;
|
|
39
|
-
maxLength?: number;
|
|
40
|
-
onFailure?: CaptureFailureReporter;
|
|
41
|
-
}): Writable;
|
|
56
|
+
}, { maxLineLength, maxLength, onFailure, retain, tailKeepChars }?: RedactedOutputSinkOptional): Writable;
|
|
42
57
|
/** Severity of a captured line; `log` and `info` both map to `info`. */
|
|
43
58
|
export type ConsoleTeeLevel = "debug" | "info" | "warn" | "error";
|
|
44
59
|
/**
|
package/dist/console-tee.js
CHANGED
|
@@ -2,17 +2,25 @@ import { format } from "node:util";
|
|
|
2
2
|
import { Writable } from "node:stream";
|
|
3
3
|
import { StringDecoder } from "node:string_decoder";
|
|
4
4
|
const ignoreFailure = () => undefined;
|
|
5
|
+
const DEFAULT_TAIL_KEEP_CHARS = 16_384;
|
|
6
|
+
function retainTail({ retain, line }, { tailKeepChars = DEFAULT_TAIL_KEEP_CHARS } = {}) {
|
|
7
|
+
retain.outputTail += line;
|
|
8
|
+
// Amortize tail copies across small log lines: trim only once the tail doubles, then keep the latest window.
|
|
9
|
+
if (retain.outputTail.length > 2 * tailKeepChars)
|
|
10
|
+
retain.outputTail = retain.outputTail.slice(-tailKeepChars);
|
|
11
|
+
}
|
|
5
12
|
/**
|
|
6
13
|
* Frames child output before invoking the caller's existing redactor, including an unterminated
|
|
7
14
|
* final line. Never closes the parent sink. Oversized lines are discarded whole so cutting a
|
|
8
15
|
* credential before redaction cannot expose a fragment. Redactor failures emit fixed copy.
|
|
9
16
|
* @param required Parent sink and redaction policy; no process globals are read.
|
|
10
|
-
* @param optional Input-line and rendered-line limits, in characters; `onFailure` hears each redactor failure
|
|
17
|
+
* @param optional Input-line and rendered-line limits, in characters; `onFailure` hears each redactor failure;
|
|
18
|
+
* `retain` receives every emitted line (shared by all of one child's sinks), trimmed per `tailKeepChars`.
|
|
11
19
|
* @returns A writable for one child stream; ending it, or its source unpiping at EOF, flushes the last line.
|
|
12
20
|
* @complexity O(n) time for n input characters; O(maxLineLength) retained space.
|
|
13
21
|
* @example child.stderr.pipe(createRedactedOutputSink({ sink: process.stderr, redact }));
|
|
14
22
|
*/
|
|
15
|
-
export function createRedactedOutputSink({ sink, redact }, { maxLineLength = 65_536, maxLength = 2_000, onFailure = ignoreFailure } = {}) {
|
|
23
|
+
export function createRedactedOutputSink({ sink, redact }, { maxLineLength = 65_536, maxLength = 2_000, onFailure = ignoreFailure, retain, tailKeepChars = DEFAULT_TAIL_KEEP_CHARS } = {}) {
|
|
16
24
|
const decoder = new StringDecoder("utf8");
|
|
17
25
|
let pending = "";
|
|
18
26
|
let oversized = false;
|
|
@@ -24,8 +32,12 @@ export function createRedactedOutputSink({ sink, redact }, { maxLineLength = 65_
|
|
|
24
32
|
catch (error) {
|
|
25
33
|
onFailure({ stage: "redact", error });
|
|
26
34
|
} // Raw child bytes must never be the fallback.
|
|
27
|
-
if (safe)
|
|
28
|
-
|
|
35
|
+
if (safe) {
|
|
36
|
+
const line = `${safe.slice(0, maxLength)}\n`;
|
|
37
|
+
if (retain)
|
|
38
|
+
retainTail({ retain, line }, { tailKeepChars });
|
|
39
|
+
sink.write(line);
|
|
40
|
+
}
|
|
29
41
|
pending = "";
|
|
30
42
|
oversized = false;
|
|
31
43
|
};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
/** Public DNS only. The composition root supplies a resolver that cannot inspect internal DNS. */
|
|
8
|
-
export declare const DNS_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS"];
|
|
9
|
-
export type DnsRecordType = typeof DNS_TYPES[number];
|
|
1
|
+
import type { TlsStatus } from "@jini-ai/core/contracts/site/diagnostics-domain-dns";
|
|
2
|
+
/** Deprecated re-export: import these from `@jini-ai/core/contracts/site/diagnostics-domain-dns`; removed at the next major. */
|
|
3
|
+
export type { TlsStatus } from "@jini-ai/core/contracts/site/diagnostics-domain-dns";
|
|
4
|
+
import { DNS_TYPES, DomainDnsInputError, type DnsRecordType } from "@jini-ai/core/net/public-dns-vocabulary";
|
|
5
|
+
export { DNS_TYPES, DomainDnsInputError };
|
|
6
|
+
export type { DnsRecordType };
|
|
10
7
|
export interface DnsQuery {
|
|
11
8
|
type: DnsRecordType;
|
|
12
9
|
status: "ok" | "not-found" | "no-data";
|
|
@@ -21,10 +18,6 @@ export interface PublicDnsResolver {
|
|
|
21
18
|
type: DnsRecordType;
|
|
22
19
|
}): Promise<DnsQuery>;
|
|
23
20
|
}
|
|
24
|
-
export interface TlsStatus {
|
|
25
|
-
status: "verified" | "invalid" | "unavailable";
|
|
26
|
-
httpStatus: number | null;
|
|
27
|
-
}
|
|
28
21
|
export type DomainDnsOperation = 'lookup-dns' | 'check-dns' | 'tls-status';
|
|
29
22
|
export interface DomainDnsDependencies {
|
|
30
23
|
authorize(required: {
|
|
@@ -132,5 +125,4 @@ export interface DomainDnsChecks {
|
|
|
132
125
|
* @throws DomainDnsInputError for invalid inputs; authorization and transport failures propagate.
|
|
133
126
|
*/
|
|
134
127
|
export declare function createDomainDnsChecks(deps: DomainDnsDependencies): DomainDnsChecks;
|
|
135
|
-
export {};
|
|
136
128
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/domain-dns/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { isIP } from "node:net";
|
|
2
2
|
import { domainToASCII } from "node:url";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
/** Public DNS only. The composition root supplies a resolver that cannot inspect internal DNS. */
|
|
8
|
-
export const DNS_TYPES = ["A", "AAAA", "CNAME", "MX", "TXT", "NS"];
|
|
3
|
+
import { DNS_TYPES, DomainDnsInputError } from "@jini-ai/core/net/public-dns-vocabulary";
|
|
4
|
+
// The error class and record-type vocabulary live in core so the DNS agent tools share one
|
|
5
|
+
// `DomainDnsInputError` class identity; this entry keeps exporting them unchanged.
|
|
6
|
+
export { DNS_TYPES, DomainDnsInputError };
|
|
9
7
|
function hostDnsStatus({ hasExpected, differs }) {
|
|
10
8
|
if (!hasExpected)
|
|
11
9
|
return "unknown";
|
package/dist/local-text.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { type RedactionOptions } from "./redaction.js";
|
|
2
3
|
/**
|
|
3
4
|
* Credential and home-path redaction for local child, native and gate output before it is shown or stored.
|
|
4
5
|
* Jini's username policy masks only `/Users/<u>`, `/home/<u>` and `\Users\<u>`; a home outside those
|
|
@@ -8,14 +9,16 @@ import path from "node:path";
|
|
|
8
9
|
* @param optional.homeDir Home directory to mask; `os.homedir()` by default.
|
|
9
10
|
* @param optional.platformPath Path flavour used to read the home's basename and root; the host's by
|
|
10
11
|
* default, injectable so a Windows home (`C:\Users\ada`, `C:\`) is exercised on any host.
|
|
12
|
+
* @param optional.extraPatterns Host-owned credential shapes, forwarded to `redactText`.
|
|
11
13
|
* @returns The redacted text; a filesystem-root home is left to the username policy alone,
|
|
12
14
|
* since masking it would erase every absolute path.
|
|
13
15
|
* @complexity O(n) time and space for n text characters.
|
|
14
16
|
*/
|
|
15
17
|
export declare function redactLocalText({ text }: {
|
|
16
18
|
text: string;
|
|
17
|
-
}, { homeDir, platformPath }?: {
|
|
19
|
+
}, { homeDir, platformPath, extraPatterns }?: {
|
|
18
20
|
homeDir?: string;
|
|
19
21
|
platformPath?: Pick<typeof path, "basename" | "parse">;
|
|
22
|
+
extraPatterns?: RedactionOptions["extraPatterns"];
|
|
20
23
|
}): string;
|
|
21
24
|
//# sourceMappingURL=local-text.d.ts.map
|
package/dist/local-text.js
CHANGED
|
@@ -12,12 +12,13 @@ const NOT_PATH_CONTINUATION = "(?![A-Za-z0-9._-])";
|
|
|
12
12
|
* @param optional.homeDir Home directory to mask; `os.homedir()` by default.
|
|
13
13
|
* @param optional.platformPath Path flavour used to read the home's basename and root; the host's by
|
|
14
14
|
* default, injectable so a Windows home (`C:\Users\ada`, `C:\`) is exercised on any host.
|
|
15
|
+
* @param optional.extraPatterns Host-owned credential shapes, forwarded to `redactText`.
|
|
15
16
|
* @returns The redacted text; a filesystem-root home is left to the username policy alone,
|
|
16
17
|
* since masking it would erase every absolute path.
|
|
17
18
|
* @complexity O(n) time and space for n text characters.
|
|
18
19
|
*/
|
|
19
|
-
export function redactLocalText({ text }, { homeDir = os.homedir(), platformPath = path } = {}) {
|
|
20
|
-
const redacted = redactText({ text }, { username: platformPath.basename(homeDir) });
|
|
20
|
+
export function redactLocalText({ text }, { homeDir = os.homedir(), platformPath = path, extraPatterns } = {}) {
|
|
21
|
+
const redacted = redactText({ text }, { username: platformPath.basename(homeDir), extraPatterns });
|
|
21
22
|
let end = homeDir.length;
|
|
22
23
|
while (end > 0 && (homeDir[end - 1] === "/" || homeDir[end - 1] === "\\"))
|
|
23
24
|
end -= 1;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The window-level error lifecycle a UI shell installs once: `error` and `unhandledrejection`
|
|
3
|
+
* listeners that turn whatever was thrown into a capped `{ message, stack }` pair and hand it to a
|
|
4
|
+
* host-supplied `report`. The host owns the vocabulary (payload kind, channel, bridge); this module
|
|
5
|
+
* owns only the capping, the fallback text and the teardown. Only the universal `EventTarget`/`Event`
|
|
6
|
+
* globals are used (no DOM lib), so a `Window`, a bare `EventTarget` or a test fake all fit.
|
|
7
|
+
*/
|
|
8
|
+
/** Anything with `addEventListener`/`removeEventListener` — a `Window` in a real shell. */
|
|
9
|
+
export type GlobalErrorTarget = Pick<EventTarget, 'addEventListener' | 'removeEventListener'>;
|
|
10
|
+
/** One captured failure, already capped. Never DOM text, URLs or arguments: only what was thrown. */
|
|
11
|
+
export interface GlobalErrorReport {
|
|
12
|
+
readonly message: string;
|
|
13
|
+
readonly stack: string;
|
|
14
|
+
}
|
|
15
|
+
export interface GlobalErrorReportingArgs {
|
|
16
|
+
readonly target: GlobalErrorTarget;
|
|
17
|
+
/** The host's sink; it must not throw (wrap the bridge call), or a broken IPC would recurse. */
|
|
18
|
+
readonly report: (required: GlobalErrorReport, optional?: Record<string, never>) => void;
|
|
19
|
+
}
|
|
20
|
+
export interface GlobalErrorReportingOptions {
|
|
21
|
+
readonly maxMessageLength?: number;
|
|
22
|
+
readonly maxStackLength?: number;
|
|
23
|
+
/** Message for a rejection whose reason is not a string or an `Error`. */
|
|
24
|
+
readonly rejectionFallback?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Install once at boot, before the UI mounts. Native browser events retain normal handling: the
|
|
28
|
+
* listeners never call `preventDefault`, so the console still shows the failure.
|
|
29
|
+
* @returns Teardown for host/tests. @complexity O(n) capped error text, two listeners only.
|
|
30
|
+
*/
|
|
31
|
+
export declare function installGlobalErrorReporting(required: GlobalErrorReportingArgs, { maxMessageLength, maxStackLength, rejectionFallback }?: GlobalErrorReportingOptions): () => void;
|
|
32
|
+
//# sourceMappingURL=error-events.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The window-level error lifecycle a UI shell installs once: `error` and `unhandledrejection`
|
|
3
|
+
* listeners that turn whatever was thrown into a capped `{ message, stack }` pair and hand it to a
|
|
4
|
+
* host-supplied `report`. The host owns the vocabulary (payload kind, channel, bridge); this module
|
|
5
|
+
* owns only the capping, the fallback text and the teardown. Only the universal `EventTarget`/`Event`
|
|
6
|
+
* globals are used (no DOM lib), so a `Window`, a bare `EventTarget` or a test fake all fit.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Install once at boot, before the UI mounts. Native browser events retain normal handling: the
|
|
10
|
+
* listeners never call `preventDefault`, so the console still shows the failure.
|
|
11
|
+
* @returns Teardown for host/tests. @complexity O(n) capped error text, two listeners only.
|
|
12
|
+
*/
|
|
13
|
+
export function installGlobalErrorReporting(required, { maxMessageLength = 1000, maxStackLength = 8000, rejectionFallback = 'Unhandled rejection' } = {}) {
|
|
14
|
+
const { target, report } = required;
|
|
15
|
+
const send = ({ failure, fallback }, _options = {}) => {
|
|
16
|
+
const message = typeof failure === 'string' ? failure : fallback;
|
|
17
|
+
const error = failure instanceof Error ? failure : new Error(message);
|
|
18
|
+
report({ message: error.message.slice(0, maxMessageLength), stack: (error.stack ?? '').slice(0, maxStackLength) });
|
|
19
|
+
};
|
|
20
|
+
const onError = (event) => {
|
|
21
|
+
const { error, message } = event;
|
|
22
|
+
send({ failure: error, fallback: message ?? '' });
|
|
23
|
+
};
|
|
24
|
+
const onRejection = (event) => send({ failure: event.reason, fallback: rejectionFallback });
|
|
25
|
+
target.addEventListener('error', onError);
|
|
26
|
+
target.addEventListener('unhandledrejection', onRejection);
|
|
27
|
+
return () => {
|
|
28
|
+
target.removeEventListener('error', onError);
|
|
29
|
+
target.removeEventListener('unhandledrejection', onRejection);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=error-events.js.map
|
|
@@ -74,7 +74,15 @@ function combine(trackers, failed) {
|
|
|
74
74
|
failed(); /* settle the rest */
|
|
75
75
|
}
|
|
76
76
|
} };
|
|
77
|
-
|
|
77
|
+
const traceIds = () => {
|
|
78
|
+
for (const tracker of trackers) {
|
|
79
|
+
const ids = tracker.traceIds?.();
|
|
80
|
+
if (ids !== undefined)
|
|
81
|
+
return ids;
|
|
82
|
+
}
|
|
83
|
+
return undefined;
|
|
84
|
+
};
|
|
85
|
+
return { ...trackers[0], run, end, traceIds };
|
|
78
86
|
}
|
|
79
87
|
/** Starts the same signal on every live adapter, each isolated, and combines the trackers. */
|
|
80
88
|
function fanOut(live, signal, args, failed) {
|
|
@@ -3,12 +3,13 @@ export * from './export-policy.js';
|
|
|
3
3
|
export * from './ports.js';
|
|
4
4
|
export { redactOperationAttributes, errorType, redactLabel } from './otel.js';
|
|
5
5
|
export * from './errors.js';
|
|
6
|
+
export { installGlobalErrorReporting, type GlobalErrorReport, type GlobalErrorReportingArgs, type GlobalErrorReportingOptions, type GlobalErrorTarget, } from './error-events.js';
|
|
6
7
|
export * from './fanout.js';
|
|
7
8
|
export * from './hooks.js';
|
|
8
9
|
export * from './instrumentation.js';
|
|
9
10
|
export * from './delivery.js';
|
|
10
11
|
export { observabilityProviderContract } from './provider-contract.js';
|
|
11
12
|
export type { TelemetryTestResult, TelemetryTestSignal } from './telemetry-test.js';
|
|
12
|
-
export type
|
|
13
|
+
export type { TrackerOptions, TrackerProviders } from "./tracker-types.js";
|
|
13
14
|
export { createNoopTracker } from "./tracker-noop.js";
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -3,6 +3,7 @@ export * from './export-policy.js';
|
|
|
3
3
|
export * from './ports.js';
|
|
4
4
|
export { redactOperationAttributes, errorType, redactLabel } from './otel.js';
|
|
5
5
|
export * from './errors.js';
|
|
6
|
+
export { installGlobalErrorReporting, } from './error-events.js';
|
|
6
7
|
export * from './fanout.js';
|
|
7
8
|
export * from './hooks.js';
|
|
8
9
|
export * from './instrumentation.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SecretRedactionPattern } from "@jini-ai/core";
|
|
1
2
|
import type { ObservabilityPort } from "@jini-ai/core/contracts/observability";
|
|
2
3
|
/**
|
|
3
4
|
* @file The shared way a host hands an error to `ObservabilityPort.reportError` (provider wave 2,
|
|
@@ -29,17 +30,21 @@ export declare function runWithErrorReportScope<T>({ scope, work }: {
|
|
|
29
30
|
reuseCurrent?: boolean;
|
|
30
31
|
}): T;
|
|
31
32
|
type ExactSecrets = readonly string[] | undefined;
|
|
33
|
+
type ExtraPatterns = readonly SecretRedactionPattern[] | undefined;
|
|
34
|
+
interface RedactOptions {
|
|
35
|
+
exactSecrets?: ExactSecrets;
|
|
36
|
+
extraPatterns?: ExtraPatterns;
|
|
37
|
+
}
|
|
32
38
|
/**
|
|
33
39
|
* A copy of `error` with its message and stack redacted, or the original when nothing needed
|
|
34
40
|
* redacting (so identity survives for callers that compare). Non-Error throws become an Error.
|
|
35
|
-
* `exactSecrets` (e.g. the credential a failing call used) are blanked even without a known shape
|
|
41
|
+
* `exactSecrets` (e.g. the credential a failing call used) are blanked even without a known shape;
|
|
42
|
+
* `extraPatterns` are host-owned credential shapes (a product's own key format) Jini cannot know.
|
|
36
43
|
* @complexity O(n) in message + stack length.
|
|
37
44
|
*/
|
|
38
45
|
export declare function redactedError({ error }: {
|
|
39
46
|
error: unknown;
|
|
40
|
-
},
|
|
41
|
-
exactSecrets?: ExactSecrets;
|
|
42
|
-
}): Error;
|
|
47
|
+
}, options?: RedactOptions): Error;
|
|
43
48
|
/**
|
|
44
49
|
* Reports once per port and occurrence, after redaction. Without a request/trace scope each call
|
|
45
50
|
* is an independent occurrence. Failed/noop delivery leaves both dedup and bare-5xx fallback open.
|
|
@@ -9,18 +9,19 @@ const requestScope = new AsyncLocalStorage();
|
|
|
9
9
|
export function runWithErrorReportScope({ scope, work }, { reuseCurrent = false } = {}) {
|
|
10
10
|
return requestScope.run(reuseCurrent ? requestScope.getStore() ?? scope : scope, work);
|
|
11
11
|
}
|
|
12
|
-
const redact = (text, exactSecrets) => redactSecrets({ input: text }, exactSecrets ? { exactSecrets } : {});
|
|
12
|
+
const redact = (text, { exactSecrets, extraPatterns }) => redactSecrets({ input: text }, { ...(exactSecrets ? { exactSecrets } : {}), ...(extraPatterns ? { extraPatterns } : {}) });
|
|
13
13
|
/**
|
|
14
14
|
* A copy of `error` with its message and stack redacted, or the original when nothing needed
|
|
15
15
|
* redacting (so identity survives for callers that compare). Non-Error throws become an Error.
|
|
16
|
-
* `exactSecrets` (e.g. the credential a failing call used) are blanked even without a known shape
|
|
16
|
+
* `exactSecrets` (e.g. the credential a failing call used) are blanked even without a known shape;
|
|
17
|
+
* `extraPatterns` are host-owned credential shapes (a product's own key format) Jini cannot know.
|
|
17
18
|
* @complexity O(n) in message + stack length.
|
|
18
19
|
*/
|
|
19
|
-
export function redactedError({ error },
|
|
20
|
+
export function redactedError({ error }, options = {}) {
|
|
20
21
|
if (!(error instanceof Error))
|
|
21
|
-
return new Error(redact(typeof error === "string" ? error : `non-Error thrown: ${typeof error}`,
|
|
22
|
-
const message = redact(error.message,
|
|
23
|
-
const stack = error.stack === undefined ? undefined : redact(error.stack,
|
|
22
|
+
return new Error(redact(typeof error === "string" ? error : `non-Error thrown: ${typeof error}`, options));
|
|
23
|
+
const message = redact(error.message, options);
|
|
24
|
+
const stack = error.stack === undefined ? undefined : redact(error.stack, options);
|
|
24
25
|
if (message === error.message && stack === error.stack)
|
|
25
26
|
return error;
|
|
26
27
|
const copy = new Error(message);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Tracker } from "
|
|
1
|
+
import type { Tracker } from "@jini-ai/core/contracts/site/diagnostics-observability";
|
|
2
2
|
export type TelemetryTestSignal = "error" | "span" | "analytics" | "metric";
|
|
3
3
|
export interface TelemetryTestResult {
|
|
4
4
|
/** Local provider acceptance, not confirmation of remote delivery. Consent can refuse analytics. */
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type AgentToolSideEffect, type AgentToolDefinition, type ToolContributor, type ToolRegistration } from "@jini-ai/core";
|
|
2
|
+
import type { TelemetryTestResult } from "./telemetry-test.js";
|
|
3
|
+
import type { AuthorizeFn } from "@jini-ai/core/contracts/events";
|
|
4
|
+
export interface ObservabilityToolDeps {
|
|
5
|
+
workspaceId: string;
|
|
6
|
+
authorize: AuthorizeFn;
|
|
7
|
+
sendTelemetryTest?: (required: Record<string, never>, optional?: Record<string, never>) => Promise<TelemetryTestResult>;
|
|
8
|
+
}
|
|
9
|
+
/** The fixed diagnostic message the host's `sendTelemetryTest` reports; the description names it verbatim. */
|
|
10
|
+
export interface ObservabilityCatalogArgs {
|
|
11
|
+
testErrorMessage: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function createObservabilityAgentToolCatalog({ testErrorMessage }: ObservabilityCatalogArgs, _optional?: Record<string, never>): AgentToolDefinition[];
|
|
14
|
+
export declare const observabilityDerivedRisk: ReadonlyMap<string, AgentToolSideEffect>;
|
|
15
|
+
/** Thin admin adapter over the same diagnostic action as the HTTP surface.
|
|
16
|
+
* @returns One registration. @throws ToolInputError for unavailable service or extra input.
|
|
17
|
+
* @complexity O(1) excluding the injected authorization and diagnostic action.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildObservabilityRegistrations(deps: ObservabilityToolDeps & ObservabilityCatalogArgs, _options?: {}): ToolRegistration[];
|
|
20
|
+
export declare function contributeObservabilityTools(required: ObservabilityCatalogArgs, _options?: {}): ToolContributor<ObservabilityToolDeps, object>;
|
|
21
|
+
//# sourceMappingURL=tool-registrations.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { adaptLegacyAuthorize, buildDomainRegistrations, indexCatalogById, requireInputRecord, requireToolPermission, ToolInputError, ToolPermissionDeniedError as ForbiddenError } from "@jini-ai/core";
|
|
2
|
+
import { forbiddenRule, withModelFacingErrors } from "@jini-ai/core/model-facing-tool-errors";
|
|
3
|
+
import { toolMetadata } from "@jini-ai/core/tool-metadata/observability";
|
|
4
|
+
export function createObservabilityAgentToolCatalog({ testErrorMessage }, _optional = {}) {
|
|
5
|
+
return [{
|
|
6
|
+
name: "observability_send_test_error",
|
|
7
|
+
description: `Send the fixed diagnostic '${testErrorMessage}', one test span and one telemetry_test analytics event through this site's tracker. Requires admin system.write. No confirmation needed. Returns provider ids and signals accepted locally; this is not proof of remote delivery. Analytics still requires telemetry consent. Takes no arguments.`,
|
|
8
|
+
sideEffects: "mutates-durable-state", authorization: { permission: "system.write" },
|
|
9
|
+
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
10
|
+
}];
|
|
11
|
+
}
|
|
12
|
+
export const observabilityDerivedRisk = new Map([["observability_send_test_error", "mutates-durable-state"]]);
|
|
13
|
+
/** Thin admin adapter over the same diagnostic action as the HTTP surface.
|
|
14
|
+
* @returns One registration. @throws ToolInputError for unavailable service or extra input.
|
|
15
|
+
* @complexity O(1) excluding the injected authorization and diagnostic action.
|
|
16
|
+
*/
|
|
17
|
+
export function buildObservabilityRegistrations(deps, _options = {}) {
|
|
18
|
+
return buildDomainRegistrations({ metadata: toolMetadata, domain: "observability",
|
|
19
|
+
catalogModule: "observability/tool-registrations.ts", catalog: indexCatalogById({ catalog: createObservabilityAgentToolCatalog({ testErrorMessage: deps.testErrorMessage }) }), derivedRisk: observabilityDerivedRisk,
|
|
20
|
+
handlers: withModelFacingErrors({ handlers: {
|
|
21
|
+
observability_send_test_error: async (ctx) => {
|
|
22
|
+
const input = ctx.input === undefined ? {} : requireInputRecord({ input: ctx.input });
|
|
23
|
+
if (Object.keys(input).length)
|
|
24
|
+
throw new ToolInputError({ message: "observability_send_test_error takes no arguments." });
|
|
25
|
+
await requireToolPermission({ authorize: adaptLegacyAuthorize({ authorize: deps.authorize }), workspaceId: deps.workspaceId,
|
|
26
|
+
principalId: ctx.principal.id, permission: "system.write" }, { entityType: "observability" });
|
|
27
|
+
if (!deps.sendTelemetryTest)
|
|
28
|
+
throw new ToolInputError({ message: "Telemetry test is unavailable on this server." });
|
|
29
|
+
ctx.signal.throwIfAborted();
|
|
30
|
+
return deps.sendTelemetryTest({});
|
|
31
|
+
},
|
|
32
|
+
}, rules: [forbiddenRule({ domainPrefix: "OBSERVABILITY", error: ForbiddenError })] }),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export function contributeObservabilityTools(required, _options = {}) {
|
|
36
|
+
return { domain: "observability", build: deps => buildObservabilityRegistrations({ ...deps, testErrorMessage: required.testErrorMessage }), risk: observabilityDerivedRisk };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=tool-registrations.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Tracker } from "
|
|
1
|
+
import type { Tracker } from "@jini-ai/core/contracts/site/diagnostics-observability";
|
|
2
2
|
/** Shared inert facade for unconfigured hosts and optional collaborators. Work still runs once,
|
|
3
3
|
* returning its result or original application error. No provider or process state is touched.
|
|
4
4
|
* @complexity O(1) around the supplied callback. */
|