@wrongstack/core 0.302.2 → 0.303.0
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 +1 -1
- package/dist/chronicle/index.js +117 -30
- package/dist/chronicle/project-server.js +12 -5
- package/dist/coordination/agents/index.js +4313 -3516
- package/dist/coordination/agents/project-agent-auto-optimize.d.ts +116 -0
- package/dist/coordination/agents/project-agent-capture-window.d.ts +29 -0
- package/dist/coordination/agents/project-agent-config-io.d.ts +11 -0
- package/dist/coordination/agents/project-agent-consolidation.d.ts +29 -2
- package/dist/coordination/agents/project-agent-files.d.ts +12 -3
- package/dist/coordination/agents/project-agent-identity-types.d.ts +4 -0
- package/dist/coordination/agents/project-agent-identity.d.ts +22 -9
- package/dist/coordination/agents/project-agent-learning-entries.d.ts +8 -2
- package/dist/coordination/agents/project-agent-learning-structured.d.ts +27 -1
- package/dist/coordination/agents/project-agent-optimizer.d.ts +49 -0
- package/dist/coordination/agents/project-agent-skill-layer.d.ts +101 -0
- package/dist/coordination/agents/role-skills.d.ts +11 -1
- package/dist/coordination/index.d.ts +1 -1
- package/dist/coordination/index.js +2322 -1526
- package/dist/coordination/mail-tools.d.ts +1 -1
- package/dist/core/context.d.ts +4 -0
- package/dist/core/index.js +9 -0
- package/dist/defaults/index.js +895 -597
- package/dist/execution/index.js +2915 -2621
- package/dist/goal/index.js +7 -0
- package/dist/index.js +2406 -1331
- package/dist/kernel/events/agent-events.d.ts +28 -0
- package/dist/plugin/index.js +10 -4
- package/dist/security/index.js +69 -3
- package/dist/security/kanban-boundary.d.ts +5 -1
- package/dist/session-catalog/index.js +24 -2
- package/dist/session-catalog/project-server.js +27 -4
- package/dist/session-catalog/protocol.d.ts +9 -0
- package/dist/session-catalog/store.d.ts +17 -1
- package/dist/storage/index.js +81 -2
- package/dist/storage/plan-store.d.ts +1 -1
- package/dist/tasking/index.js +5 -0
- package/dist/tools/index.js +2824 -2604
- package/dist/types/config/root.d.ts +11 -1
- package/dist/types/config/skills-fleet-brain.d.ts +34 -0
- package/dist/types/config/ui.d.ts +14 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +20 -0
- package/dist/types/multi-agent.d.ts +7 -0
- package/dist/types/task-graph.d.ts +2 -0
- package/dist/types/tool-executor.d.ts +2 -0
- package/dist/utils/index.js +3 -0
- package/instructions/system-lite.md +14 -8
- package/instructions/system-pro.md +17 -11
- package/instructions/system.md +17 -11
- package/package.json +3 -3
- package/skills/wrongstack-kanban/SKILL.md +39 -8
package/README.md
CHANGED
|
@@ -148,7 +148,7 @@ See [docs/plugin-author-guide.md](../../docs/plugin-author-guide.md).
|
|
|
148
148
|
|
|
149
149
|
## Path layout
|
|
150
150
|
|
|
151
|
-
All developer-level state lives under `~/.wrongstack/`. Per-project state is keyed by `sha256(absoluteProjectRoot).slice(0,12)` under `~/.wrongstack/projects/<hash>/`. The only
|
|
151
|
+
All developer-level state lives under `~/.wrongstack/`. Per-project state is keyed by `sha256(absoluteProjectRoot).slice(0,12)` under `~/.wrongstack/projects/<hash>/`. The only things inside the project tree itself are the optional, committable `.wrongstack/AGENTS.md`, `.wrongstack/skills/` and `.wrongstack/agents/` (roster-agent identity, learned directives and project-developed skill addenda). See `WstackPaths` in [utils/wstack-paths.ts](src/utils/wstack-paths.ts) for the full layout.
|
|
152
152
|
|
|
153
153
|
## Security model
|
|
154
154
|
|
package/dist/chronicle/index.js
CHANGED
|
@@ -3608,7 +3608,9 @@ var ChronicleMetricsStore = class _ChronicleMetricsStore {
|
|
|
3608
3608
|
const agentRange = dayFilter("day");
|
|
3609
3609
|
const uniqueAgents = this.db.prepare(`SELECT COUNT(DISTINCT agent_id) n FROM agent_daily${agentRange.where}`).get(...agentRange.params).n;
|
|
3610
3610
|
const requestRange = dayFilter("day");
|
|
3611
|
-
const logicalRequests = this.db.prepare(
|
|
3611
|
+
const logicalRequests = this.db.prepare(
|
|
3612
|
+
`SELECT COUNT(DISTINCT logical_request_id) n FROM logical_request_daily${requestRange.where}`
|
|
3613
|
+
).get(...requestRange.params).n;
|
|
3612
3614
|
const fileRange = dayFilter("day");
|
|
3613
3615
|
const uniqueFiles = this.db.prepare(`SELECT COUNT(DISTINCT path_key) n FROM file_seen_daily${fileRange.where}`).get(...fileRange.params).n;
|
|
3614
3616
|
const costRange = dayFilter("day");
|
|
@@ -3917,10 +3919,13 @@ var ChronicleMetricsStore = class _ChronicleMetricsStore {
|
|
|
3917
3919
|
ON CONFLICT(day, family) DO UPDATE SET count = count + 1, failure_count = failure_count + excluded.failure_count`
|
|
3918
3920
|
).run(day, family, failed);
|
|
3919
3921
|
if (failed) bump("failures = failures + 1");
|
|
3920
|
-
if (event.outcome === "cancelled" || event.outcome === "abandoned")
|
|
3922
|
+
if (event.outcome === "cancelled" || event.outcome === "abandoned")
|
|
3923
|
+
bump("cancellations = cancellations + 1");
|
|
3921
3924
|
if (family === "agent") bump("agent_events = agent_events + 1");
|
|
3922
3925
|
if (event.correlation.logicalRequestId) {
|
|
3923
|
-
this.db.prepare(
|
|
3926
|
+
this.db.prepare(
|
|
3927
|
+
"INSERT OR IGNORE INTO logical_request_daily (day, logical_request_id) VALUES (?, ?)"
|
|
3928
|
+
).run(day, event.correlation.logicalRequestId);
|
|
3924
3929
|
}
|
|
3925
3930
|
if (event.scope.agentId) {
|
|
3926
3931
|
this.db.prepare("INSERT OR IGNORE INTO agent_daily (day, agent_id) VALUES (?, ?)").run(day, event.scope.agentId);
|
|
@@ -3940,7 +3945,8 @@ var ChronicleMetricsStore = class _ChronicleMetricsStore {
|
|
|
3940
3945
|
durationCount
|
|
3941
3946
|
);
|
|
3942
3947
|
} else if (type === "process.started") bump("processes = processes + 1");
|
|
3943
|
-
else if (type === "process.completed" && event.outcome === "failure")
|
|
3948
|
+
else if (type === "process.completed" && event.outcome === "failure")
|
|
3949
|
+
bump("failed_processes = failed_processes + 1");
|
|
3944
3950
|
if (event.resource?.kind === "file" || type.startsWith("file.")) {
|
|
3945
3951
|
bump("file_events_all = file_events_all + 1");
|
|
3946
3952
|
if (event.resource?.path) {
|
|
@@ -5550,14 +5556,19 @@ function stringField(value, key) {
|
|
|
5550
5556
|
function eventTime(value) {
|
|
5551
5557
|
const raw = value.at ?? value.ts ?? value.timestamp;
|
|
5552
5558
|
if (typeof raw === "number" && Number.isFinite(raw)) return new Date(raw).toISOString();
|
|
5553
|
-
if (typeof raw === "string" && Number.isFinite(Date.parse(raw)))
|
|
5559
|
+
if (typeof raw === "string" && Number.isFinite(Date.parse(raw)))
|
|
5560
|
+
return new Date(raw).toISOString();
|
|
5554
5561
|
return void 0;
|
|
5555
5562
|
}
|
|
5556
5563
|
function inferOutcome(name, payload) {
|
|
5557
|
-
if (payload.ok === false || /(?:failed|error|damaged|conflict|deadlock|denied|rejected|blocked)$/.test(name))
|
|
5564
|
+
if (payload.ok === false || /(?:failed|error|damaged|conflict|deadlock|denied|rejected|blocked)$/.test(name))
|
|
5565
|
+
return "failure";
|
|
5558
5566
|
if (/(?:started|starting|retrying|threshold_reached)$/.test(name)) return "started";
|
|
5559
5567
|
if (/(?:cancelled|aborted)$/.test(name)) return "cancelled";
|
|
5560
|
-
if (/(?:completed|finished|committed|merged|written|persisted|accepted|recovered|verified|connected|success)$/.test(
|
|
5568
|
+
if (/(?:completed|finished|committed|merged|written|persisted|accepted|recovered|verified|connected|success)$/.test(
|
|
5569
|
+
name
|
|
5570
|
+
) || payload.ok === true)
|
|
5571
|
+
return "success";
|
|
5561
5572
|
return "unknown";
|
|
5562
5573
|
}
|
|
5563
5574
|
function inferResource(payload, eventName) {
|
|
@@ -5585,7 +5596,8 @@ function sanitize(value, key = "", depth = 0, seen = /* @__PURE__ */ new WeakSet
|
|
|
5585
5596
|
if (typeof value === "function") return { type: "function" };
|
|
5586
5597
|
if (typeof value === "string") {
|
|
5587
5598
|
if (PRESERVE_STRING_KEY.test(key) && !SENSITIVE_KEY.test(key)) return value.slice(0, 512);
|
|
5588
|
-
if (SENSITIVE_KEY.test(key))
|
|
5599
|
+
if (SENSITIVE_KEY.test(key))
|
|
5600
|
+
return { hash: digest(value), length: value.length, redacted: true };
|
|
5589
5601
|
return value.length <= 256 ? value : { hash: digest(value), length: value.length, truncated: true };
|
|
5590
5602
|
}
|
|
5591
5603
|
if (typeof value !== "object") return String(value);
|
|
@@ -5600,7 +5612,8 @@ function sanitize(value, key = "", depth = 0, seen = /* @__PURE__ */ new WeakSet
|
|
|
5600
5612
|
const output = {};
|
|
5601
5613
|
const entries = Object.entries(value);
|
|
5602
5614
|
for (const [childKey, child] of entries.slice(0, 100)) {
|
|
5603
|
-
if (childKey === "ctx" || childKey === "provider" || childKey === "resolve" || childKey === "extend" || childKey === "deny")
|
|
5615
|
+
if (childKey === "ctx" || childKey === "provider" || childKey === "resolve" || childKey === "extend" || childKey === "deny")
|
|
5616
|
+
continue;
|
|
5604
5617
|
output[childKey] = sanitize(child, childKey, depth + 1, seen);
|
|
5605
5618
|
}
|
|
5606
5619
|
if (entries.length > 100) output._truncatedKeys = entries.length - 100;
|
|
@@ -6043,7 +6056,12 @@ function wireRollupsToChronicle(options) {
|
|
|
6043
6056
|
target.updatedAt = Date.now();
|
|
6044
6057
|
for (const [name, value] of Object.entries(values)) {
|
|
6045
6058
|
const metric = target.metrics[name];
|
|
6046
|
-
target.metrics[name] = metric ? {
|
|
6059
|
+
target.metrics[name] = metric ? {
|
|
6060
|
+
sum: metric.sum + value,
|
|
6061
|
+
min: Math.min(metric.min, value),
|
|
6062
|
+
max: Math.max(metric.max, value),
|
|
6063
|
+
last: value
|
|
6064
|
+
} : { sum: value, min: value, max: value, last: value };
|
|
6047
6065
|
}
|
|
6048
6066
|
if (category) target.categories[category] = (target.categories[category] ?? 0) + 1;
|
|
6049
6067
|
if (digest2) target.digest.update(digest2);
|
|
@@ -6053,14 +6071,26 @@ function wireRollupsToChronicle(options) {
|
|
|
6053
6071
|
if (!value || value.count === 0) return;
|
|
6054
6072
|
buckets.delete(key);
|
|
6055
6073
|
const context = typeof options.context === "function" ? options.context() : options.context;
|
|
6056
|
-
const stats = Object.fromEntries(
|
|
6074
|
+
const stats = Object.fromEntries(
|
|
6075
|
+
Object.entries(value.metrics).map(([name, metric]) => [
|
|
6076
|
+
name,
|
|
6077
|
+
{ ...metric, avg: metric.sum / value.count }
|
|
6078
|
+
])
|
|
6079
|
+
);
|
|
6057
6080
|
const resources = value.resources.size > 0 ? [...value.resources].slice(0, MAX_ROLLUP_RESOURCES).map(([id, r]) => ({ id, kind: r.kind, ...r.path ? { path: r.path } : {} })) : void 0;
|
|
6058
6081
|
const input = {
|
|
6059
6082
|
eventType: "metrics.rollup",
|
|
6060
6083
|
outcome: "success",
|
|
6061
6084
|
occurredAt: new Date(value.updatedAt).toISOString(),
|
|
6062
|
-
scope: {
|
|
6063
|
-
|
|
6085
|
+
scope: {
|
|
6086
|
+
...context.scope,
|
|
6087
|
+
...value.sessionId ? { sessionId: value.sessionId } : {},
|
|
6088
|
+
...value.agentId ? { agentId: value.agentId } : {}
|
|
6089
|
+
},
|
|
6090
|
+
correlation: {
|
|
6091
|
+
...context.correlation,
|
|
6092
|
+
...value.toolCallId ? { toolCallId: value.toolCallId } : {}
|
|
6093
|
+
},
|
|
6064
6094
|
durationNs: String(Math.max(0, value.updatedAt - value.startedAt) * 1e6),
|
|
6065
6095
|
attributes: {
|
|
6066
6096
|
signal: value.signal,
|
|
@@ -6081,8 +6111,19 @@ function wireRollupsToChronicle(options) {
|
|
|
6081
6111
|
const sessionId = text(event.sessionId);
|
|
6082
6112
|
const dimensionValue = dimension ? text(event[dimension]) : void 0;
|
|
6083
6113
|
const key = `${signal}\0${sessionId ?? ""}\0${dimensionValue ?? ""}`;
|
|
6084
|
-
const target = bucket(key, {
|
|
6085
|
-
|
|
6114
|
+
const target = bucket(key, {
|
|
6115
|
+
signal,
|
|
6116
|
+
aggregateMs: gaugeWindowMs,
|
|
6117
|
+
...sessionId ? { sessionId } : {},
|
|
6118
|
+
...dimensionValue ? { agentId: dimensionValue } : {},
|
|
6119
|
+
dimensions: dimensionValue && dimension ? { [dimension]: dimensionValue } : {}
|
|
6120
|
+
});
|
|
6121
|
+
sample(
|
|
6122
|
+
target,
|
|
6123
|
+
Object.fromEntries(
|
|
6124
|
+
Object.entries(event).filter(([, value]) => typeof value === "number")
|
|
6125
|
+
)
|
|
6126
|
+
);
|
|
6086
6127
|
};
|
|
6087
6128
|
const offs = [
|
|
6088
6129
|
options.events.on("process.output", (event) => {
|
|
@@ -6092,23 +6133,40 @@ function wireRollupsToChronicle(options) {
|
|
|
6092
6133
|
sessionId: event.sessionId,
|
|
6093
6134
|
...event.agentId ? { agentId: event.agentId } : {},
|
|
6094
6135
|
toolCallId: event.toolCallId,
|
|
6095
|
-
dimensions: {
|
|
6136
|
+
dimensions: {
|
|
6137
|
+
stream: event.stream,
|
|
6138
|
+
toolName: event.toolName,
|
|
6139
|
+
pid: String(event.pid ?? "")
|
|
6140
|
+
}
|
|
6096
6141
|
});
|
|
6097
6142
|
sample(target, { bytes: event.bytes }, event.stream, event.chunkHash);
|
|
6098
6143
|
}),
|
|
6099
6144
|
options.events.on("process.completed", (event) => {
|
|
6100
|
-
for (const key of [...buckets.keys()])
|
|
6145
|
+
for (const key of [...buckets.keys()])
|
|
6146
|
+
if (key.startsWith(`process.output\0${event.sessionId}\0${event.toolCallId}\0`)) flush(key);
|
|
6101
6147
|
}),
|
|
6102
6148
|
options.events.on("tool.progress", (event) => {
|
|
6103
6149
|
if (event.event.type === "file_changed") return;
|
|
6104
6150
|
const key = `tool.progress\0${event.sessionId ?? ""}\0${event.id}`;
|
|
6105
|
-
const target = bucket(key, {
|
|
6106
|
-
|
|
6151
|
+
const target = bucket(key, {
|
|
6152
|
+
signal: "tool.progress",
|
|
6153
|
+
...event.sessionId ? { sessionId: event.sessionId } : {},
|
|
6154
|
+
...event.agentId ? { agentId: event.agentId } : {},
|
|
6155
|
+
toolCallId: event.id,
|
|
6156
|
+
dimensions: { toolName: event.name }
|
|
6157
|
+
});
|
|
6158
|
+
sample(
|
|
6159
|
+
target,
|
|
6160
|
+
{ textBytes: Buffer.byteLength(event.event.text ?? "") },
|
|
6161
|
+
event.event.type,
|
|
6162
|
+
safeDigest(event.event)
|
|
6163
|
+
);
|
|
6107
6164
|
}),
|
|
6108
6165
|
options.events.on("tool.executed", (event) => {
|
|
6109
6166
|
flush(`tool.progress\0${event.sessionId ?? ""}\0${event.id ?? ""}`);
|
|
6110
6167
|
const metadata = event.metadata;
|
|
6111
|
-
if (!metadata || metadata.files.length === 0 && metadata.symbols.length === 0 && metadata.commands.length === 0)
|
|
6168
|
+
if (!metadata || metadata.files.length === 0 && metadata.symbols.length === 0 && metadata.commands.length === 0)
|
|
6169
|
+
return;
|
|
6112
6170
|
const key = `tool.resource\0${event.sessionId ?? ""}\0${event.id ?? ""}`;
|
|
6113
6171
|
const target = bucket(key, {
|
|
6114
6172
|
signal: "tool.resource.observed",
|
|
@@ -6131,16 +6189,27 @@ function wireRollupsToChronicle(options) {
|
|
|
6131
6189
|
}
|
|
6132
6190
|
flush(key);
|
|
6133
6191
|
}),
|
|
6134
|
-
options.events.on(
|
|
6192
|
+
options.events.on(
|
|
6193
|
+
"tool.failed",
|
|
6194
|
+
(event) => flush(`tool.progress\0${event.sessionId}\0${event.id}`)
|
|
6195
|
+
),
|
|
6135
6196
|
options.events.on("ctx.pct", (event) => gauge("ctx.pct", event)),
|
|
6136
|
-
options.events.on(
|
|
6197
|
+
options.events.on(
|
|
6198
|
+
"subagent.ctx_pct",
|
|
6199
|
+
(event) => gauge("subagent.ctx_pct", event, "subagentId")
|
|
6200
|
+
),
|
|
6137
6201
|
options.events.on("countdown.tick", (event) => gauge("countdown.tick", event)),
|
|
6138
6202
|
options.events.on("coordinator.stats", (event) => gauge("coordinator.stats", event)),
|
|
6139
6203
|
// Periodic self-observation gauge (nested fields, so the flat gauge()
|
|
6140
6204
|
// helper can't be reused directly — flatten before sampling).
|
|
6141
6205
|
options.events.on("runtime.health.sampled", (event) => {
|
|
6142
6206
|
const key = `runtime.health\0${event.sessionId ?? ""}`;
|
|
6143
|
-
const target = bucket(key, {
|
|
6207
|
+
const target = bucket(key, {
|
|
6208
|
+
signal: "runtime.health",
|
|
6209
|
+
aggregateMs: gaugeWindowMs,
|
|
6210
|
+
...event.sessionId ? { sessionId: event.sessionId } : {},
|
|
6211
|
+
dimensions: {}
|
|
6212
|
+
});
|
|
6144
6213
|
const chronicle = event.chronicle;
|
|
6145
6214
|
sample(target, {
|
|
6146
6215
|
"eventLoop.utilization": event.eventLoop.utilization,
|
|
@@ -6161,8 +6230,21 @@ function wireRollupsToChronicle(options) {
|
|
|
6161
6230
|
// from the domain adapter. Sums preserve the fleet-level metric trail.
|
|
6162
6231
|
options.events.on("session.agents_updated", (event) => {
|
|
6163
6232
|
const key = `session.agents\0${event.sessionId ?? ""}`;
|
|
6164
|
-
const target = bucket(key, {
|
|
6165
|
-
|
|
6233
|
+
const target = bucket(key, {
|
|
6234
|
+
signal: "session.agents",
|
|
6235
|
+
aggregateMs: gaugeWindowMs,
|
|
6236
|
+
...event.sessionId ? { sessionId: event.sessionId } : {},
|
|
6237
|
+
dimensions: {}
|
|
6238
|
+
});
|
|
6239
|
+
const sums = {
|
|
6240
|
+
agents: 0,
|
|
6241
|
+
running: 0,
|
|
6242
|
+
iterations: 0,
|
|
6243
|
+
toolCalls: 0,
|
|
6244
|
+
costUsd: 0,
|
|
6245
|
+
tokensIn: 0,
|
|
6246
|
+
tokensOut: 0
|
|
6247
|
+
};
|
|
6166
6248
|
for (const agent of event.agents) {
|
|
6167
6249
|
sums.agents++;
|
|
6168
6250
|
if (agent.status === "running") sums.running++;
|
|
@@ -6184,11 +6266,16 @@ function wireRollupsToChronicle(options) {
|
|
|
6184
6266
|
sessionId: event.sessionId,
|
|
6185
6267
|
dimensions: { initiator: event.initiator, serverAddress: event.serverAddress }
|
|
6186
6268
|
});
|
|
6187
|
-
sample(
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6269
|
+
sample(
|
|
6270
|
+
target,
|
|
6271
|
+
{
|
|
6272
|
+
durationMs: event.durationMs,
|
|
6273
|
+
...event.requestBytes !== void 0 ? { requestBytes: event.requestBytes } : {},
|
|
6274
|
+
...event.responseBytes !== void 0 ? { responseBytes: event.responseBytes } : {}
|
|
6275
|
+
},
|
|
6276
|
+
`${Math.floor(event.statusCode / 100)}xx`,
|
|
6277
|
+
event.requestId
|
|
6278
|
+
);
|
|
6192
6279
|
})
|
|
6193
6280
|
];
|
|
6194
6281
|
const timer = setInterval(() => {
|
|
@@ -4246,7 +4246,9 @@ var ChronicleMetricsStore = class _ChronicleMetricsStore {
|
|
|
4246
4246
|
const agentRange = dayFilter("day");
|
|
4247
4247
|
const uniqueAgents = this.db.prepare(`SELECT COUNT(DISTINCT agent_id) n FROM agent_daily${agentRange.where}`).get(...agentRange.params).n;
|
|
4248
4248
|
const requestRange = dayFilter("day");
|
|
4249
|
-
const logicalRequests = this.db.prepare(
|
|
4249
|
+
const logicalRequests = this.db.prepare(
|
|
4250
|
+
`SELECT COUNT(DISTINCT logical_request_id) n FROM logical_request_daily${requestRange.where}`
|
|
4251
|
+
).get(...requestRange.params).n;
|
|
4250
4252
|
const fileRange = dayFilter("day");
|
|
4251
4253
|
const uniqueFiles = this.db.prepare(`SELECT COUNT(DISTINCT path_key) n FROM file_seen_daily${fileRange.where}`).get(...fileRange.params).n;
|
|
4252
4254
|
const costRange = dayFilter("day");
|
|
@@ -4555,10 +4557,13 @@ var ChronicleMetricsStore = class _ChronicleMetricsStore {
|
|
|
4555
4557
|
ON CONFLICT(day, family) DO UPDATE SET count = count + 1, failure_count = failure_count + excluded.failure_count`
|
|
4556
4558
|
).run(day, family, failed);
|
|
4557
4559
|
if (failed) bump("failures = failures + 1");
|
|
4558
|
-
if (event.outcome === "cancelled" || event.outcome === "abandoned")
|
|
4560
|
+
if (event.outcome === "cancelled" || event.outcome === "abandoned")
|
|
4561
|
+
bump("cancellations = cancellations + 1");
|
|
4559
4562
|
if (family === "agent") bump("agent_events = agent_events + 1");
|
|
4560
4563
|
if (event.correlation.logicalRequestId) {
|
|
4561
|
-
this.db.prepare(
|
|
4564
|
+
this.db.prepare(
|
|
4565
|
+
"INSERT OR IGNORE INTO logical_request_daily (day, logical_request_id) VALUES (?, ?)"
|
|
4566
|
+
).run(day, event.correlation.logicalRequestId);
|
|
4562
4567
|
}
|
|
4563
4568
|
if (event.scope.agentId) {
|
|
4564
4569
|
this.db.prepare("INSERT OR IGNORE INTO agent_daily (day, agent_id) VALUES (?, ?)").run(day, event.scope.agentId);
|
|
@@ -4578,7 +4583,8 @@ var ChronicleMetricsStore = class _ChronicleMetricsStore {
|
|
|
4578
4583
|
durationCount
|
|
4579
4584
|
);
|
|
4580
4585
|
} else if (type === "process.started") bump("processes = processes + 1");
|
|
4581
|
-
else if (type === "process.completed" && event.outcome === "failure")
|
|
4586
|
+
else if (type === "process.completed" && event.outcome === "failure")
|
|
4587
|
+
bump("failed_processes = failed_processes + 1");
|
|
4582
4588
|
if (event.resource?.kind === "file" || type.startsWith("file.")) {
|
|
4583
4589
|
bump("file_events_all = file_events_all + 1");
|
|
4584
4590
|
if (event.resource?.path) {
|
|
@@ -5143,7 +5149,8 @@ function send(state, message) {
|
|
|
5143
5149
|
}
|
|
5144
5150
|
async function sendAcknowledgement(state, message) {
|
|
5145
5151
|
const encoded = encodeResponse(state, message);
|
|
5146
|
-
if (encoded === void 0)
|
|
5152
|
+
if (encoded === void 0)
|
|
5153
|
+
throw new Error("Chronicle client disconnected before acknowledgement");
|
|
5147
5154
|
await new Promise((resolve12, reject) => {
|
|
5148
5155
|
state.socket.write(encoded, (error) => {
|
|
5149
5156
|
if (error) reject(error);
|