@codetelemetry/connect 0.1.1 → 0.1.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/LICENSE +1 -1
- package/README.md +8 -24
- package/dist/agent.d.ts +699 -0
- package/dist/agent.js +435 -0
- package/dist/assistants.d.ts +4 -0
- package/dist/assistants.js +5 -0
- package/dist/bin.js +3 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +567 -0
- package/dist/clients.d.ts +34 -0
- package/dist/clients.js +74 -0
- package/dist/{src/codexConfig.d.ts → codexConfig.d.ts} +1 -0
- package/dist/{src/codexConfig.js → codexConfig.js} +5 -0
- package/dist/{src/config.d.ts → config.d.ts} +16 -0
- package/dist/{src/config.js → config.js} +16 -0
- package/dist/connectivity.d.ts +51 -0
- package/dist/connectivity.js +118 -0
- package/dist/{src/deviceClient.d.ts → deviceClient.d.ts} +9 -2
- package/dist/{src/deviceClient.js → deviceClient.js} +45 -13
- package/dist/graderSeed.d.ts +50 -0
- package/dist/graderSeed.js +289 -0
- package/dist/hostMetrics.d.ts +54 -0
- package/dist/hostMetrics.js +425 -0
- package/dist/import/browser.d.ts +30 -0
- package/dist/import/browser.js +157 -0
- package/dist/import/convert.d.ts +20 -0
- package/dist/import/convert.js +165 -0
- package/dist/import/core.d.ts +143 -0
- package/dist/import/core.js +441 -0
- package/dist/import/ledger.d.ts +52 -0
- package/dist/import/ledger.js +161 -0
- package/dist/import/model.d.ts +70 -0
- package/dist/import/model.js +42 -0
- package/dist/import/options.d.ts +24 -0
- package/dist/import/options.js +71 -0
- package/dist/import/otlpImport.d.ts +7 -0
- package/dist/import/otlpImport.js +81 -0
- package/dist/import/protocol.d.ts +35 -0
- package/dist/import/protocol.js +51 -0
- package/dist/import/run.d.ts +30 -0
- package/dist/import/run.js +127 -0
- package/dist/import/sources/claudeCodeText.d.ts +19 -0
- package/dist/import/sources/claudeCodeText.js +214 -0
- package/dist/import/sources/codexText.d.ts +20 -0
- package/dist/import/sources/codexText.js +319 -0
- package/dist/import/sources/files.d.ts +24 -0
- package/dist/import/sources/files.js +129 -0
- package/dist/import/transport.d.ts +76 -0
- package/dist/import/transport.js +141 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/kiro/collector.d.ts +88 -0
- package/dist/kiro/collector.js +577 -0
- package/dist/kiro/command.d.ts +3 -0
- package/dist/kiro/command.js +109 -0
- package/dist/kiro/config.d.ts +39 -0
- package/dist/kiro/config.js +107 -0
- package/dist/kiro/records.d.ts +52 -0
- package/dist/kiro/records.js +206 -0
- package/dist/kiro/service.d.ts +21 -0
- package/dist/kiro/service.js +183 -0
- package/dist/kiro/state.d.ts +45 -0
- package/dist/kiro/state.js +205 -0
- package/dist/kiro/transport.d.ts +9 -0
- package/dist/kiro/transport.js +90 -0
- package/dist/{src/onboard.d.ts → onboard.d.ts} +8 -2
- package/dist/onboard.js +116 -0
- package/dist/piConfig.d.ts +29 -0
- package/dist/piConfig.js +112 -0
- package/dist/plan.d.ts +53 -0
- package/dist/plan.js +113 -0
- package/dist/{src/repositoryHook.d.ts → repositoryHook.d.ts} +0 -1
- package/dist/{src/repositoryHook.js → repositoryHook.js} +5 -38
- package/dist/{src/settings.d.ts → settings.d.ts} +4 -0
- package/dist/{src/settings.js → settings.js} +17 -0
- package/dist/yaml.d.ts +5 -0
- package/dist/yaml.js +72 -0
- package/package.json +27 -18
- package/dist/bin/connect.js +0 -6
- package/dist/src/cli.d.ts +0 -10
- package/dist/src/cli.js +0 -172
- package/dist/src/connectivity.d.ts +0 -27
- package/dist/src/connectivity.js +0 -54
- package/dist/src/index.d.ts +0 -8
- package/dist/src/index.js +0 -8
- package/dist/src/onboard.js +0 -84
- /package/dist/{bin/connect.d.ts → bin.d.ts} +0 -0
- /package/dist/{src/keys.d.ts → keys.d.ts} +0 -0
- /package/dist/{src/keys.js → keys.js} +0 -0
- /package/dist/{src/otlp.d.ts → otlp.d.ts} +0 -0
- /package/dist/{src/otlp.js → otlp.js} +0 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
const SKIP = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "__pycache__", "venv", "env"]);
|
|
6
|
+
const TASK_FILES = new Set([
|
|
7
|
+
"package.json", "Makefile", "makefile", "GNUmakefile", "justfile", "Justfile",
|
|
8
|
+
"pyproject.toml", "tox.ini", "noxfile.py", "go.mod", "Cargo.toml", "pom.xml",
|
|
9
|
+
"build.gradle", "build.gradle.kts", "composer.json", "Rakefile", "mix.exs", "Package.swift", "CMakeLists.txt",
|
|
10
|
+
]);
|
|
11
|
+
const MAX_FILE_BYTES = 64 * 1024;
|
|
12
|
+
const MAX_ENTRIES = 4000;
|
|
13
|
+
const MAX_CANDIDATES = 30;
|
|
14
|
+
const MAX_SOURCE_CHARS = 6000;
|
|
15
|
+
const MAX_DEPTH = 6;
|
|
16
|
+
function readSource(file) {
|
|
17
|
+
const fd = fs.openSync(file, fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW | fs.constants.O_NONBLOCK);
|
|
18
|
+
try {
|
|
19
|
+
const stat = fs.fstatSync(fd);
|
|
20
|
+
if (!stat.isFile() || stat.size > MAX_FILE_BYTES)
|
|
21
|
+
throw new Error("not a regular file of at most 64 KiB");
|
|
22
|
+
const data = Buffer.alloc(MAX_FILE_BYTES + 1);
|
|
23
|
+
const bytes = fs.readSync(fd, data, 0, data.length, 0);
|
|
24
|
+
if (bytes > MAX_FILE_BYTES)
|
|
25
|
+
throw new Error("file exceeds 64 KiB");
|
|
26
|
+
return data.subarray(0, bytes).toString("utf8");
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
fs.closeSync(fd);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function category(name) {
|
|
33
|
+
if (/(?:^|[:_\-])(deploy|publish|release|install|watch|dev|serve|clean|fix)(?:$|[:_\-])/.test(name))
|
|
34
|
+
return undefined;
|
|
35
|
+
if (/(?:e2e|end.to.end)/.test(name))
|
|
36
|
+
return "end_to_end_test";
|
|
37
|
+
if (/integration/.test(name))
|
|
38
|
+
return "integration_test";
|
|
39
|
+
if (/coverage|cov$/.test(name))
|
|
40
|
+
return "coverage";
|
|
41
|
+
if (/(?:^|[:_\-])(test|tests|spec|unit)(?:$|[:_\-])/.test(name))
|
|
42
|
+
return "unit_test";
|
|
43
|
+
if (/audit|security/.test(name))
|
|
44
|
+
return "security_validation";
|
|
45
|
+
if (/lint|check|typecheck|type-check|format|verify/.test(name))
|
|
46
|
+
return "static_analysis";
|
|
47
|
+
if (/^build$|^compile$/.test(name))
|
|
48
|
+
return "environment_validation";
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
const condition = (field, value) => ({
|
|
52
|
+
field, operator: Array.isArray(value) ? "contains" : "equals", value,
|
|
53
|
+
});
|
|
54
|
+
const shell = (executable, args = [], operation) => ({ all: [
|
|
55
|
+
condition("source", "shell"), condition("executable", executable),
|
|
56
|
+
...(operation ? [condition("operation", operation)] : []),
|
|
57
|
+
...args.map((arg) => condition("normalizedArguments", [arg])),
|
|
58
|
+
] });
|
|
59
|
+
const targetMatcher = (executable, target) => ({ all: [
|
|
60
|
+
condition("source", "shell"), condition("executable", executable),
|
|
61
|
+
{ any: [condition("operation", target), condition("normalizedArguments", [target])] },
|
|
62
|
+
] });
|
|
63
|
+
export function seedGraderConfig(options) {
|
|
64
|
+
const root = fs.realpathSync(options.root);
|
|
65
|
+
const home = fs.realpathSync(os.homedir());
|
|
66
|
+
if (root === home || root === path.parse(root).root)
|
|
67
|
+
throw new Error("Choose a project directory as repositoryPath; select global SKILL.md files explicitly with skillPaths.");
|
|
68
|
+
if (!fs.statSync(root).isDirectory())
|
|
69
|
+
throw new Error("repositoryPath must be a directory");
|
|
70
|
+
const result = { features: options.features, sources: [], candidates: [], warnings: [], truncated: false };
|
|
71
|
+
let entries = 0;
|
|
72
|
+
let sourceChars = 0;
|
|
73
|
+
const visited = new Set();
|
|
74
|
+
const seenCandidates = new Set();
|
|
75
|
+
const warn = (message) => { if (result.warnings.length < 12)
|
|
76
|
+
result.warnings.push(message); result.truncated = true; };
|
|
77
|
+
const add = (file, command, label, matcher, inferred = false) => {
|
|
78
|
+
const kind = category(label.toLowerCase());
|
|
79
|
+
if (!kind || command.length > 256 || /[\r\n\x00]/.test(command))
|
|
80
|
+
return;
|
|
81
|
+
const source = path.relative(root, file).split(path.sep).join("/");
|
|
82
|
+
const identity = `${options.repositoryId ?? root}\0${source}\0${command}`;
|
|
83
|
+
if (seenCandidates.has(identity))
|
|
84
|
+
return;
|
|
85
|
+
seenCandidates.add(identity);
|
|
86
|
+
if (result.candidates.length >= MAX_CANDIDATES) {
|
|
87
|
+
warn("Command candidate limit reached; narrow repositoryPath to inspect another package.");
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const directory = path.dirname(file);
|
|
91
|
+
if (directory.length > 200)
|
|
92
|
+
warn("Working-directory scope exceeds matcher limits; set repositoryId before saving.");
|
|
93
|
+
result.candidates.push({ source, command, inferred, check: {
|
|
94
|
+
id: `seed-${createHash("sha256").update(identity).digest("hex").slice(0, 16)}`,
|
|
95
|
+
name: `${source}: ${label}`.slice(0, 120), category: kind,
|
|
96
|
+
description: `Seeded from ${source}. ${inferred ? "Conventional command; confirm project support." : "Declared project task."}`.slice(0, 500),
|
|
97
|
+
weight: 1, satisfactionMode: "successful", minimumOccurrences: 1, aggregationMode: "once", enabled: true,
|
|
98
|
+
...(options.repositoryId ? { repositoryId: options.repositoryId } : {}),
|
|
99
|
+
matcherRule: { include: { all: [matcher, ...(directory.length <= 200 ? [condition("workingDirectory", directory)] : [])] },
|
|
100
|
+
exclude: { field: "normalizedArguments", operator: "contains", value: ["--watch", "--watchAll", "--collect-only", "--listTests", "--dry-run", "--no-run", "--help", "--version"] } },
|
|
101
|
+
} });
|
|
102
|
+
};
|
|
103
|
+
const inspect = (file) => {
|
|
104
|
+
if (visited.has(file))
|
|
105
|
+
return;
|
|
106
|
+
visited.add(file);
|
|
107
|
+
const name = path.basename(file);
|
|
108
|
+
let text;
|
|
109
|
+
try {
|
|
110
|
+
text = readSource(file);
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
warn(`Skipped unreadable, linked, or oversized source: ${path.relative(root, file)}`);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (/^agents\.md$/i.test(name) || name === "SKILL.md") {
|
|
117
|
+
const remaining = MAX_SOURCE_CHARS - sourceChars;
|
|
118
|
+
if (remaining <= 0 || result.sources.length >= 12) {
|
|
119
|
+
warn("Instruction budget reached; use a narrower repositoryPath or fewer skillPaths.");
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const clipped = text.slice(0, Math.min(3000, remaining));
|
|
123
|
+
sourceChars += clipped.length;
|
|
124
|
+
const truncated = clipped.length !== text.length;
|
|
125
|
+
if (truncated)
|
|
126
|
+
result.truncated = true;
|
|
127
|
+
result.sources.push({ path: path.relative(root, file).split(path.sep).join("/"), kind: name === "SKILL.md" ? "skill" : "instructions", text: clipped, truncated });
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (name === "package.json" || name === "composer.json") {
|
|
131
|
+
try {
|
|
132
|
+
const data = JSON.parse(text);
|
|
133
|
+
let runner = "npm";
|
|
134
|
+
if (typeof data.packageManager === "string")
|
|
135
|
+
runner = /^(pnpm|yarn|bun)@/.exec(data.packageManager)?.[1] ?? "npm";
|
|
136
|
+
else
|
|
137
|
+
for (const [lock, manager] of [["pnpm-lock.yaml", "pnpm"], ["yarn.lock", "yarn"], ["bun.lock", "bun"], ["bun.lockb", "bun"]]) {
|
|
138
|
+
if (fs.existsSync(path.join(path.dirname(file), lock))) {
|
|
139
|
+
runner = manager;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (data.scripts && typeof data.scripts === "object" && !Array.isArray(data.scripts))
|
|
144
|
+
for (const [task, body] of Object.entries(data.scripts)) {
|
|
145
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9:_\-.]{0,79}$/.test(task) || typeof body !== "string")
|
|
146
|
+
continue;
|
|
147
|
+
if (/--(?:watch|fix|collect-only|listTests|dry-run)\b|no test specified|echo\s+["']?no tests/i.test(body))
|
|
148
|
+
continue;
|
|
149
|
+
if (/format/i.test(task) && !/--check|--list-different|--check-formatted/.test(body))
|
|
150
|
+
continue;
|
|
151
|
+
add(file, `${name === "composer.json" ? "composer" : runner} run ${task}`, task, name === "composer.json" ? shell("composer", [task], "run") : { all: [
|
|
152
|
+
condition("source", "shell"), { field: "executable", operator: "in", value: ["npm", "pnpm", "yarn", "bun"] }, condition("packageScript", task),
|
|
153
|
+
] });
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
warn(`Invalid JSON in ${path.relative(root, file)}`);
|
|
158
|
+
}
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (/^(?:GNUmakefile|[Mm]akefile|[Jj]ustfile|Rakefile)$/.test(name)) {
|
|
162
|
+
const just = /justfile/i.test(name);
|
|
163
|
+
const rake = name === "Rakefile";
|
|
164
|
+
const targetPattern = rake ? /^\s*task\s+[:"']([\w:-]+)/gm : /^([A-Za-z][\w.\-]*(?:[ \t]+[A-Za-z][\w.\-]*)*)[ \t]*:(?!=)/gm;
|
|
165
|
+
for (const match of text.matchAll(targetPattern))
|
|
166
|
+
for (const task of match[1].split(/\s+/)) {
|
|
167
|
+
const runner = rake ? "rake" : just ? "just" : "make";
|
|
168
|
+
add(file, `${runner} ${task}`, task, targetMatcher(runner, task));
|
|
169
|
+
}
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const conventional = (command, label, exe, args = [], operation) => add(file, command, label, shell(exe, args, operation), true);
|
|
173
|
+
if (name === "pyproject.toml") {
|
|
174
|
+
if (/^\[tool\.pytest(?:\.|\])/m.test(text) || /["']pytest(?:["'\s><=~!\[])/m.test(text))
|
|
175
|
+
conventional("python -m pytest", "test", "pytest");
|
|
176
|
+
if (/^\[tool\.ruff(?:\.|\])/m.test(text))
|
|
177
|
+
conventional("ruff check .", "lint", "ruff", ["check", "<path>"]);
|
|
178
|
+
if (/^\[tool\.mypy\]/m.test(text))
|
|
179
|
+
conventional("mypy .", "typecheck", "mypy");
|
|
180
|
+
}
|
|
181
|
+
else if (name === "tox.ini")
|
|
182
|
+
conventional("tox", "test", "tox");
|
|
183
|
+
else if (name === "noxfile.py") {
|
|
184
|
+
for (const match of text.matchAll(/^@nox\.session(?:\([^\n]*\))?\s*\n(?:@[^\n]*\n)*def\s+(\w+)\s*\(/gm))
|
|
185
|
+
conventional(`nox -s ${match[1]}`, match[1], "nox", ["-s", match[1]]);
|
|
186
|
+
}
|
|
187
|
+
else if (name === "go.mod") {
|
|
188
|
+
conventional("go test ./...", "test", "go", ["<path>"], "test");
|
|
189
|
+
conventional("go vet ./...", "lint", "go", ["<path>"], "vet");
|
|
190
|
+
}
|
|
191
|
+
else if (name === "Cargo.toml") {
|
|
192
|
+
conventional("cargo test", "test", "cargo", [], "test");
|
|
193
|
+
conventional("cargo check", "check", "cargo", [], "check");
|
|
194
|
+
}
|
|
195
|
+
else if (name === "pom.xml")
|
|
196
|
+
conventional("mvn test", "test", "mvn", [], "test");
|
|
197
|
+
else if (/^build\.gradle/.test(name)) {
|
|
198
|
+
const wrapper = fs.existsSync(path.join(path.dirname(file), "gradlew"));
|
|
199
|
+
conventional(`${wrapper ? "./gradlew" : "gradle"} test`, "test", wrapper ? "gradlew" : "gradle", wrapper ? ["test"] : [], wrapper ? undefined : "test");
|
|
200
|
+
}
|
|
201
|
+
else if (name === "mix.exs")
|
|
202
|
+
conventional("mix test", "test", "mix", [], "test");
|
|
203
|
+
else if (name === "Package.swift")
|
|
204
|
+
conventional("swift test", "test", "swift", [], "test");
|
|
205
|
+
else if (name.endsWith(".csproj") || name.endsWith(".fsproj"))
|
|
206
|
+
conventional(`dotnet test ${name}`, "test", "dotnet", ["<path>"], "test");
|
|
207
|
+
else if (name === "CMakeLists.txt" && /enable_testing\s*\(|include\s*\(\s*CTest\s*\)/i.test(text))
|
|
208
|
+
conventional("ctest --test-dir build", "test", "ctest", ["--test-dir", "build"]);
|
|
209
|
+
};
|
|
210
|
+
const walk = (directory, depth, skillsOnly = false) => {
|
|
211
|
+
if (depth > MAX_DEPTH) {
|
|
212
|
+
warn("Directory depth limit reached.");
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const children = [];
|
|
216
|
+
try {
|
|
217
|
+
const handle = fs.opendirSync(directory);
|
|
218
|
+
try {
|
|
219
|
+
let entry;
|
|
220
|
+
while ((entry = handle.readSync()) !== null) {
|
|
221
|
+
if (++entries > MAX_ENTRIES) {
|
|
222
|
+
warn("File discovery limit reached.");
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
children.push(entry);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
finally {
|
|
229
|
+
handle.closeSync();
|
|
230
|
+
}
|
|
231
|
+
children.sort((a, b) => a.name.localeCompare(b.name));
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
warn(`Skipped unreadable directory: ${path.relative(root, directory)}`);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
for (const entry of children) {
|
|
238
|
+
const file = path.join(directory, entry.name);
|
|
239
|
+
if (entry.isFile() && (skillsOnly ? entry.name === "SKILL.md" : /^agents\.md$/i.test(entry.name) || entry.name === "SKILL.md" || TASK_FILES.has(entry.name) || /\.(?:csproj|fsproj)$/.test(entry.name)))
|
|
240
|
+
inspect(file);
|
|
241
|
+
}
|
|
242
|
+
for (const entry of children) {
|
|
243
|
+
if (entries >= MAX_ENTRIES)
|
|
244
|
+
return;
|
|
245
|
+
if (!entry.isDirectory() || SKIP.has(entry.name))
|
|
246
|
+
continue;
|
|
247
|
+
const child = path.join(directory, entry.name);
|
|
248
|
+
if (entry.name.startsWith(".")) {
|
|
249
|
+
if ([".claude", ".codex", ".agents"].includes(entry.name)) {
|
|
250
|
+
const skills = path.join(child, "skills");
|
|
251
|
+
try {
|
|
252
|
+
if (fs.lstatSync(skills).isDirectory())
|
|
253
|
+
walk(skills, depth + 1, true);
|
|
254
|
+
}
|
|
255
|
+
catch { }
|
|
256
|
+
}
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
walk(child, depth + 1, skillsOnly);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
walk(root, 0);
|
|
263
|
+
for (const selected of options.skillPaths ?? []) {
|
|
264
|
+
const absolute = path.resolve(root, selected);
|
|
265
|
+
if (fs.realpathSync(absolute) !== absolute)
|
|
266
|
+
throw new Error("skillPaths must not contain symbolic links");
|
|
267
|
+
if (path.basename(absolute) !== "SKILL.md")
|
|
268
|
+
throw new Error("skillPaths must name SKILL.md files");
|
|
269
|
+
inspect(absolute);
|
|
270
|
+
}
|
|
271
|
+
const wireBytes = () => Buffer.byteLength(JSON.stringify(result)) + Buffer.byteLength(JSON.stringify(JSON.stringify(result, null, 2)));
|
|
272
|
+
while (wireBytes() > 52 * 1024) {
|
|
273
|
+
warn("Response budget reached; narrow repositoryPath or select fewer sources.");
|
|
274
|
+
if (result.candidates.length > 1)
|
|
275
|
+
result.candidates.pop();
|
|
276
|
+
else if (result.sources.length) {
|
|
277
|
+
const source = result.sources[result.sources.length - 1];
|
|
278
|
+
if (source.text.length > 256) {
|
|
279
|
+
source.text = source.text.slice(0, Math.floor(source.text.length / 2));
|
|
280
|
+
source.truncated = true;
|
|
281
|
+
}
|
|
282
|
+
else
|
|
283
|
+
result.sources.pop();
|
|
284
|
+
}
|
|
285
|
+
else
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
return result;
|
|
289
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type YamlValue } from "./yaml.ts";
|
|
2
|
+
export declare const DEFAULT_KEY_ENV = "CODETELEMETRY_INGEST_KEY";
|
|
3
|
+
export declare const DEFAULT_SERVICE_NAME = "agentd-host";
|
|
4
|
+
export declare const SERVICE_NAMESPACE = "codetelemetry";
|
|
5
|
+
export declare const HOST_METRIC_CONTRACT: readonly string[];
|
|
6
|
+
export declare const PSEUDO_FS_TYPES: readonly string[];
|
|
7
|
+
export declare const VOLUME_KEY_STATEMENT: string;
|
|
8
|
+
export declare const REDACTED_RESOURCE_ATTRIBUTES: readonly string[];
|
|
9
|
+
export declare const DEFAULT_PROCESS_NAMES: readonly string[];
|
|
10
|
+
export type HostMetricsMode = "direct" | "gateway";
|
|
11
|
+
export type HostMetricsOptions = {
|
|
12
|
+
mode?: HostMetricsMode;
|
|
13
|
+
endpoint: string;
|
|
14
|
+
keyEnvVar?: string;
|
|
15
|
+
noAuth?: boolean;
|
|
16
|
+
serviceName?: string;
|
|
17
|
+
instanceId: string;
|
|
18
|
+
environment?: string;
|
|
19
|
+
intervalSec?: number;
|
|
20
|
+
processNames?: readonly string[];
|
|
21
|
+
includeInterfaceNames?: boolean;
|
|
22
|
+
includeMountPoints?: boolean;
|
|
23
|
+
queueDir?: string;
|
|
24
|
+
queueSize?: number;
|
|
25
|
+
allowInsecure?: boolean;
|
|
26
|
+
memoryLimitMib?: number;
|
|
27
|
+
};
|
|
28
|
+
export declare function buildHostMetricsConfig(opts: HostMetricsOptions): Record<string, YamlValue>;
|
|
29
|
+
export declare function renderHostMetricsConfig(opts: HostMetricsOptions): string;
|
|
30
|
+
export type CliFlags = Record<string, string | boolean>;
|
|
31
|
+
export declare function hostMetricsOptionsFromFlags(flags: CliFlags, defaults: {
|
|
32
|
+
ingestEndpoint: string;
|
|
33
|
+
paths: HostMetricsPaths;
|
|
34
|
+
instanceId: string;
|
|
35
|
+
}): HostMetricsOptions & {
|
|
36
|
+
configPath: string;
|
|
37
|
+
};
|
|
38
|
+
export type HostMetricsPaths = {
|
|
39
|
+
configPath: string;
|
|
40
|
+
queueDir: string;
|
|
41
|
+
};
|
|
42
|
+
export declare function defaultHostMetricsPaths(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): HostMetricsPaths;
|
|
43
|
+
export declare function defaultInstanceId(hostname?: string): string;
|
|
44
|
+
export type HostMetricsWriteResult = {
|
|
45
|
+
path: string;
|
|
46
|
+
created: boolean;
|
|
47
|
+
backupPath: string | null;
|
|
48
|
+
requiredEnv: string[];
|
|
49
|
+
};
|
|
50
|
+
export type HostMetricsWriteOptions = HostMetricsOptions & {
|
|
51
|
+
configPath: string;
|
|
52
|
+
backup?: boolean;
|
|
53
|
+
};
|
|
54
|
+
export declare function writeHostMetricsConfig(opts: HostMetricsWriteOptions): HostMetricsWriteResult;
|