@agent-watch-ai/edge 0.3.1 → 0.5.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/CHANGELOG.md +75 -0
- package/README.md +10 -6
- package/SECURITY.md +7 -4
- package/dist/cli/constants/cli.constants.d.ts +2 -0
- package/dist/cli/constants/cli.constants.js +3 -1
- package/dist/cli/doctor.js +13 -2
- package/dist/cli/setup.js +138 -29
- package/dist/cli/toggle.js +5 -1
- package/dist/cli/types/cli.types.d.ts +6 -0
- package/dist/cli/uninstall.js +1 -1
- package/dist/cli.js +14 -3
- package/dist/config/config-store.d.ts +1 -1
- package/dist/config/config-store.js +2 -2
- package/dist/config/constants/config.constants.d.ts +4 -1
- package/dist/config/constants/config.constants.js +7 -2
- package/dist/config/repo-config.js +1 -1
- package/dist/config/schemas/config.schema.d.ts +113 -767
- package/dist/config/schemas/config.schema.js +17 -8
- package/dist/credentials/constants/credentials.constants.d.ts +8 -0
- package/dist/credentials/constants/credentials.constants.js +9 -1
- package/dist/credentials/credential-status.js +8 -4
- package/dist/credentials/credentials.d.ts +16 -2
- package/dist/credentials/credentials.js +30 -5
- package/dist/credentials/device-api.d.ts +10 -1
- package/dist/credentials/device-api.js +12 -1
- package/dist/credentials/identity.d.ts +12 -1
- package/dist/credentials/identity.js +12 -1
- package/dist/credentials/migration.d.ts +1 -1
- package/dist/credentials/migration.js +1 -1
- package/dist/credentials/schemas/device-api.schema.d.ts +4 -51
- package/dist/credentials/schemas/device-state.schema.d.ts +3 -38
- package/dist/credentials/sign-in.d.ts +14 -1
- package/dist/credentials/sign-in.js +24 -5
- package/dist/credentials/types/credentials.types.d.ts +12 -1
- package/dist/enforcement/decision-client.js +2 -1
- package/dist/enforcement/enforcement.js +7 -5
- package/dist/enforcement/types/enforcement.types.d.ts +2 -2
- package/dist/git/code-state.d.ts +33 -0
- package/dist/git/code-state.js +44 -0
- package/dist/git/constants/git.constants.d.ts +6 -0
- package/dist/git/constants/git.constants.js +6 -0
- package/dist/git/index.d.ts +2 -1
- package/dist/git/index.js +1 -0
- package/dist/git/types/git.types.d.ts +6 -0
- package/dist/pipeline/constants/pipeline.constants.d.ts +3 -0
- package/dist/pipeline/constants/pipeline.constants.js +3 -0
- package/dist/pipeline/hook-pipeline.js +56 -7
- package/dist/privacy/command-fingerprint.d.ts +42 -0
- package/dist/privacy/command-fingerprint.js +249 -0
- package/dist/privacy/constants/command-fingerprint.constants.d.ts +34 -0
- package/dist/privacy/constants/command-fingerprint.constants.js +38 -0
- package/dist/privacy/index.d.ts +3 -1
- package/dist/privacy/index.js +2 -0
- package/dist/privacy/product-capture.js +20 -0
- package/dist/privacy/types/privacy.types.d.ts +7 -0
- package/dist/providers/antigravity/antigravity.adapter.js +3 -0
- package/dist/providers/antigravity/schemas/antigravity.schema.d.ts +18 -492
- package/dist/providers/claude/claude.adapter.js +12 -1
- package/dist/providers/claude/constants/claude.constants.d.ts +6 -0
- package/dist/providers/claude/constants/claude.constants.js +6 -0
- package/dist/providers/claude/schemas/claude.schema.d.ts +1 -43
- package/dist/providers/codex/codex.adapter.js +14 -0
- package/dist/providers/codex/codex.otel.d.ts +12 -1
- package/dist/providers/codex/codex.otel.js +61 -11
- package/dist/providers/codex/constants/codex.otel.constants.d.ts +5 -0
- package/dist/providers/codex/constants/codex.otel.constants.js +5 -0
- package/dist/providers/codex/schemas/codex.schema.d.ts +1 -41
- package/dist/providers/constants/provider.constants.d.ts +8 -0
- package/dist/providers/constants/provider.constants.js +8 -0
- package/dist/providers/cursor/constants/cursor.constants.d.ts +2 -0
- package/dist/providers/cursor/constants/cursor.constants.js +2 -0
- package/dist/providers/cursor/cursor.adapter.js +84 -5
- package/dist/providers/cursor/schemas/cursor.schema.d.ts +5 -85
- package/dist/providers/gemini/constants/gemini.constants.d.ts +2 -0
- package/dist/providers/gemini/constants/gemini.constants.js +2 -0
- package/dist/providers/gemini/constants/gemini.otel.constants.d.ts +16 -1
- package/dist/providers/gemini/constants/gemini.otel.constants.js +16 -1
- package/dist/providers/gemini/gemini.detect.d.ts +11 -0
- package/dist/providers/gemini/gemini.detect.js +14 -1
- package/dist/providers/gemini/gemini.hooks.d.ts +3 -3
- package/dist/providers/gemini/gemini.hooks.js +5 -5
- package/dist/providers/gemini/gemini.otel.d.ts +14 -4
- package/dist/providers/gemini/gemini.otel.js +418 -107
- package/dist/providers/gemini/schemas/gemini.schema.d.ts +1 -49
- package/dist/providers/shared/bearer-rewrite.d.ts +19 -0
- package/dist/providers/shared/bearer-rewrite.js +46 -0
- package/dist/providers/shared/constants/tooling.constants.d.ts +6 -0
- package/dist/providers/shared/constants/tooling.constants.js +6 -0
- package/dist/providers/shared/event-builder.d.ts +17 -2
- package/dist/providers/shared/event-builder.js +43 -3
- package/dist/providers/shared/install-record.d.ts +2 -0
- package/dist/providers/shared/install-record.js +3 -2
- package/dist/providers/shared/tooling.d.ts +35 -0
- package/dist/providers/shared/tooling.js +61 -1
- package/dist/providers/shared/types/adapter.types.d.ts +18 -0
- package/dist/providers/types/provider.types.d.ts +24 -0
- package/dist/storage/atomic-file.d.ts +14 -0
- package/dist/storage/atomic-file.js +19 -0
- package/dist/storage/constants/storage.constants.d.ts +2 -0
- package/dist/storage/constants/storage.constants.js +2 -0
- package/dist/storage/schemas/storage.schema.d.ts +11 -175
- package/dist/storage/schemas/storage.schema.js +7 -1
- package/dist/transport/schemas/queue.schema.d.ts +1 -16
- package/dist/transport/schemas/queue.schema.js +1 -1
- package/dist/turns/constants/turns.constants.d.ts +17 -0
- package/dist/turns/constants/turns.constants.js +17 -0
- package/dist/turns/index.d.ts +3 -2
- package/dist/turns/index.js +1 -0
- package/dist/turns/tool-events.d.ts +15 -0
- package/dist/turns/tool-events.js +59 -0
- package/dist/turns/turn-state.js +2 -2
- package/dist/turns/turn-summary.d.ts +1 -1
- package/dist/turns/turn-summary.js +1 -0
- package/dist/turns/turn-tracker.js +138 -7
- package/dist/turns/types/turn-state.types.d.ts +28 -1
- package/dist/turns/types/turn-summary.types.d.ts +30 -0
- package/dist/turns/types/turn-tracker.types.d.ts +10 -0
- package/dist/turns/work-checkout.d.ts +5 -3
- package/dist/turns/work-checkout.js +46 -12
- package/docs/AUDIT_PROMPT.md +11 -0
- package/docs/DATA_HANDLING.md +69 -14
- package/docs/ENTERPRISE_DEPLOYMENT.md +21 -5
- package/package.json +9 -8
|
@@ -9,192 +9,28 @@ import { z } from 'zod';
|
|
|
9
9
|
export declare const agentInstallSchema: z.ZodObject<{
|
|
10
10
|
hooksInstalledAt: z.ZodOptional<z.ZodString>;
|
|
11
11
|
hookConfigPath: z.ZodOptional<z.ZodString>;
|
|
12
|
-
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString
|
|
12
|
+
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
13
13
|
hookCommand: z.ZodOptional<z.ZodString>;
|
|
14
14
|
otelConfiguredAt: z.ZodOptional<z.ZodString>;
|
|
15
15
|
otelConfigPath: z.ZodOptional<z.ZodString>;
|
|
16
|
-
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString
|
|
17
|
-
/**
|
|
18
|
-
* Permission bits the agent's own config file carried before AgentWatch
|
|
19
|
-
* tightened it, so uninstall can put them back. Absent when the file was
|
|
20
|
-
* never tightened, or when AgentWatch created it.
|
|
21
|
-
*/
|
|
16
|
+
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
22
17
|
otelPriorMode: z.ZodOptional<z.ZodNumber>;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
hookConfigPath: z.ZodOptional<z.ZodString>;
|
|
27
|
-
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
28
|
-
hookCommand: z.ZodOptional<z.ZodString>;
|
|
29
|
-
otelConfiguredAt: z.ZodOptional<z.ZodString>;
|
|
30
|
-
otelConfigPath: z.ZodOptional<z.ZodString>;
|
|
31
|
-
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
32
|
-
/**
|
|
33
|
-
* Permission bits the agent's own config file carried before AgentWatch
|
|
34
|
-
* tightened it, so uninstall can put them back. Absent when the file was
|
|
35
|
-
* never tightened, or when AgentWatch created it.
|
|
36
|
-
*/
|
|
37
|
-
otelPriorMode: z.ZodOptional<z.ZodNumber>;
|
|
38
|
-
notes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
39
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
40
|
-
hooksInstalledAt: z.ZodOptional<z.ZodString>;
|
|
41
|
-
hookConfigPath: z.ZodOptional<z.ZodString>;
|
|
42
|
-
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
43
|
-
hookCommand: z.ZodOptional<z.ZodString>;
|
|
44
|
-
otelConfiguredAt: z.ZodOptional<z.ZodString>;
|
|
45
|
-
otelConfigPath: z.ZodOptional<z.ZodString>;
|
|
46
|
-
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
47
|
-
/**
|
|
48
|
-
* Permission bits the agent's own config file carried before AgentWatch
|
|
49
|
-
* tightened it, so uninstall can put them back. Absent when the file was
|
|
50
|
-
* never tightened, or when AgentWatch created it.
|
|
51
|
-
*/
|
|
52
|
-
otelPriorMode: z.ZodOptional<z.ZodNumber>;
|
|
53
|
-
notes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
54
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
18
|
+
otelPriorValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
19
|
+
notes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
20
|
+
}, z.core.$loose>;
|
|
55
21
|
/** The whole install-state file: one entry per agent. */
|
|
56
22
|
export declare const installStateSchema: z.ZodObject<{
|
|
57
23
|
schemaVersion: z.ZodDefault<z.ZodLiteral<1>>;
|
|
58
24
|
agents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
59
25
|
hooksInstalledAt: z.ZodOptional<z.ZodString>;
|
|
60
26
|
hookConfigPath: z.ZodOptional<z.ZodString>;
|
|
61
|
-
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString
|
|
62
|
-
hookCommand: z.ZodOptional<z.ZodString>;
|
|
63
|
-
otelConfiguredAt: z.ZodOptional<z.ZodString>;
|
|
64
|
-
otelConfigPath: z.ZodOptional<z.ZodString>;
|
|
65
|
-
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
66
|
-
/**
|
|
67
|
-
* Permission bits the agent's own config file carried before AgentWatch
|
|
68
|
-
* tightened it, so uninstall can put them back. Absent when the file was
|
|
69
|
-
* never tightened, or when AgentWatch created it.
|
|
70
|
-
*/
|
|
71
|
-
otelPriorMode: z.ZodOptional<z.ZodNumber>;
|
|
72
|
-
notes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
73
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
74
|
-
hooksInstalledAt: z.ZodOptional<z.ZodString>;
|
|
75
|
-
hookConfigPath: z.ZodOptional<z.ZodString>;
|
|
76
|
-
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
77
|
-
hookCommand: z.ZodOptional<z.ZodString>;
|
|
78
|
-
otelConfiguredAt: z.ZodOptional<z.ZodString>;
|
|
79
|
-
otelConfigPath: z.ZodOptional<z.ZodString>;
|
|
80
|
-
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
81
|
-
/**
|
|
82
|
-
* Permission bits the agent's own config file carried before AgentWatch
|
|
83
|
-
* tightened it, so uninstall can put them back. Absent when the file was
|
|
84
|
-
* never tightened, or when AgentWatch created it.
|
|
85
|
-
*/
|
|
86
|
-
otelPriorMode: z.ZodOptional<z.ZodNumber>;
|
|
87
|
-
notes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
88
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
89
|
-
hooksInstalledAt: z.ZodOptional<z.ZodString>;
|
|
90
|
-
hookConfigPath: z.ZodOptional<z.ZodString>;
|
|
91
|
-
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
92
|
-
hookCommand: z.ZodOptional<z.ZodString>;
|
|
93
|
-
otelConfiguredAt: z.ZodOptional<z.ZodString>;
|
|
94
|
-
otelConfigPath: z.ZodOptional<z.ZodString>;
|
|
95
|
-
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
96
|
-
/**
|
|
97
|
-
* Permission bits the agent's own config file carried before AgentWatch
|
|
98
|
-
* tightened it, so uninstall can put them back. Absent when the file was
|
|
99
|
-
* never tightened, or when AgentWatch created it.
|
|
100
|
-
*/
|
|
101
|
-
otelPriorMode: z.ZodOptional<z.ZodNumber>;
|
|
102
|
-
notes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
103
|
-
}, z.ZodTypeAny, "passthrough">>>>;
|
|
104
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
105
|
-
schemaVersion: z.ZodDefault<z.ZodLiteral<1>>;
|
|
106
|
-
agents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
107
|
-
hooksInstalledAt: z.ZodOptional<z.ZodString>;
|
|
108
|
-
hookConfigPath: z.ZodOptional<z.ZodString>;
|
|
109
|
-
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
110
|
-
hookCommand: z.ZodOptional<z.ZodString>;
|
|
111
|
-
otelConfiguredAt: z.ZodOptional<z.ZodString>;
|
|
112
|
-
otelConfigPath: z.ZodOptional<z.ZodString>;
|
|
113
|
-
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
114
|
-
/**
|
|
115
|
-
* Permission bits the agent's own config file carried before AgentWatch
|
|
116
|
-
* tightened it, so uninstall can put them back. Absent when the file was
|
|
117
|
-
* never tightened, or when AgentWatch created it.
|
|
118
|
-
*/
|
|
119
|
-
otelPriorMode: z.ZodOptional<z.ZodNumber>;
|
|
120
|
-
notes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
121
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
122
|
-
hooksInstalledAt: z.ZodOptional<z.ZodString>;
|
|
123
|
-
hookConfigPath: z.ZodOptional<z.ZodString>;
|
|
124
|
-
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
125
|
-
hookCommand: z.ZodOptional<z.ZodString>;
|
|
126
|
-
otelConfiguredAt: z.ZodOptional<z.ZodString>;
|
|
127
|
-
otelConfigPath: z.ZodOptional<z.ZodString>;
|
|
128
|
-
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
129
|
-
/**
|
|
130
|
-
* Permission bits the agent's own config file carried before AgentWatch
|
|
131
|
-
* tightened it, so uninstall can put them back. Absent when the file was
|
|
132
|
-
* never tightened, or when AgentWatch created it.
|
|
133
|
-
*/
|
|
134
|
-
otelPriorMode: z.ZodOptional<z.ZodNumber>;
|
|
135
|
-
notes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
136
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
137
|
-
hooksInstalledAt: z.ZodOptional<z.ZodString>;
|
|
138
|
-
hookConfigPath: z.ZodOptional<z.ZodString>;
|
|
139
|
-
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
140
|
-
hookCommand: z.ZodOptional<z.ZodString>;
|
|
141
|
-
otelConfiguredAt: z.ZodOptional<z.ZodString>;
|
|
142
|
-
otelConfigPath: z.ZodOptional<z.ZodString>;
|
|
143
|
-
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
144
|
-
/**
|
|
145
|
-
* Permission bits the agent's own config file carried before AgentWatch
|
|
146
|
-
* tightened it, so uninstall can put them back. Absent when the file was
|
|
147
|
-
* never tightened, or when AgentWatch created it.
|
|
148
|
-
*/
|
|
149
|
-
otelPriorMode: z.ZodOptional<z.ZodNumber>;
|
|
150
|
-
notes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
151
|
-
}, z.ZodTypeAny, "passthrough">>>>;
|
|
152
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
153
|
-
schemaVersion: z.ZodDefault<z.ZodLiteral<1>>;
|
|
154
|
-
agents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
155
|
-
hooksInstalledAt: z.ZodOptional<z.ZodString>;
|
|
156
|
-
hookConfigPath: z.ZodOptional<z.ZodString>;
|
|
157
|
-
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
158
|
-
hookCommand: z.ZodOptional<z.ZodString>;
|
|
159
|
-
otelConfiguredAt: z.ZodOptional<z.ZodString>;
|
|
160
|
-
otelConfigPath: z.ZodOptional<z.ZodString>;
|
|
161
|
-
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
162
|
-
/**
|
|
163
|
-
* Permission bits the agent's own config file carried before AgentWatch
|
|
164
|
-
* tightened it, so uninstall can put them back. Absent when the file was
|
|
165
|
-
* never tightened, or when AgentWatch created it.
|
|
166
|
-
*/
|
|
167
|
-
otelPriorMode: z.ZodOptional<z.ZodNumber>;
|
|
168
|
-
notes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
169
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
170
|
-
hooksInstalledAt: z.ZodOptional<z.ZodString>;
|
|
171
|
-
hookConfigPath: z.ZodOptional<z.ZodString>;
|
|
172
|
-
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
173
|
-
hookCommand: z.ZodOptional<z.ZodString>;
|
|
174
|
-
otelConfiguredAt: z.ZodOptional<z.ZodString>;
|
|
175
|
-
otelConfigPath: z.ZodOptional<z.ZodString>;
|
|
176
|
-
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
177
|
-
/**
|
|
178
|
-
* Permission bits the agent's own config file carried before AgentWatch
|
|
179
|
-
* tightened it, so uninstall can put them back. Absent when the file was
|
|
180
|
-
* never tightened, or when AgentWatch created it.
|
|
181
|
-
*/
|
|
182
|
-
otelPriorMode: z.ZodOptional<z.ZodNumber>;
|
|
183
|
-
notes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
184
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
185
|
-
hooksInstalledAt: z.ZodOptional<z.ZodString>;
|
|
186
|
-
hookConfigPath: z.ZodOptional<z.ZodString>;
|
|
187
|
-
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
27
|
+
hookEvents: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
188
28
|
hookCommand: z.ZodOptional<z.ZodString>;
|
|
189
29
|
otelConfiguredAt: z.ZodOptional<z.ZodString>;
|
|
190
30
|
otelConfigPath: z.ZodOptional<z.ZodString>;
|
|
191
|
-
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString
|
|
192
|
-
/**
|
|
193
|
-
* Permission bits the agent's own config file carried before AgentWatch
|
|
194
|
-
* tightened it, so uninstall can put them back. Absent when the file was
|
|
195
|
-
* never tightened, or when AgentWatch created it.
|
|
196
|
-
*/
|
|
31
|
+
otelOwnedKeys: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
197
32
|
otelPriorMode: z.ZodOptional<z.ZodNumber>;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}, z.
|
|
33
|
+
otelPriorValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
34
|
+
notes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
35
|
+
}, z.core.$loose>>>;
|
|
36
|
+
}, z.core.$loose>;
|
|
@@ -21,6 +21,12 @@ export const agentInstallSchema = z
|
|
|
21
21
|
* never tightened, or when AgentWatch created it.
|
|
22
22
|
*/
|
|
23
23
|
otelPriorMode: z.number().int().optional(),
|
|
24
|
+
/**
|
|
25
|
+
* What each owned key held before AgentWatch set it (the agent's own text
|
|
26
|
+
* for that entry), so uninstall puts the developer's value back instead of
|
|
27
|
+
* deleting it. Keys absent here were not there before.
|
|
28
|
+
*/
|
|
29
|
+
otelPriorValues: z.record(z.string(), z.string()).optional(),
|
|
24
30
|
notes: z.array(z.string()).default([])
|
|
25
31
|
})
|
|
26
32
|
.passthrough();
|
|
@@ -28,6 +34,6 @@ export const agentInstallSchema = z
|
|
|
28
34
|
export const installStateSchema = z
|
|
29
35
|
.object({
|
|
30
36
|
schemaVersion: z.literal(1).default(1),
|
|
31
|
-
agents: z.record(agentInstallSchema).default({})
|
|
37
|
+
agents: z.record(z.string(), agentInstallSchema).default({})
|
|
32
38
|
})
|
|
33
39
|
.passthrough();
|
|
@@ -11,20 +11,5 @@ export declare const queueEntrySchema: z.ZodObject<{
|
|
|
11
11
|
attempts: z.ZodDefault<z.ZodNumber>;
|
|
12
12
|
firstQueuedAt: z.ZodString;
|
|
13
13
|
nextAttemptAt: z.ZodString;
|
|
14
|
-
/** Events URL this entry was queued for; absent on pre-destination entries. */
|
|
15
14
|
destination: z.ZodOptional<z.ZodString>;
|
|
16
|
-
},
|
|
17
|
-
event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
18
|
-
attempts: z.ZodDefault<z.ZodNumber>;
|
|
19
|
-
firstQueuedAt: z.ZodString;
|
|
20
|
-
nextAttemptAt: z.ZodString;
|
|
21
|
-
/** Events URL this entry was queued for; absent on pre-destination entries. */
|
|
22
|
-
destination: z.ZodOptional<z.ZodString>;
|
|
23
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
24
|
-
event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
25
|
-
attempts: z.ZodDefault<z.ZodNumber>;
|
|
26
|
-
firstQueuedAt: z.ZodString;
|
|
27
|
-
nextAttemptAt: z.ZodString;
|
|
28
|
-
/** Events URL this entry was queued for; absent on pre-destination entries. */
|
|
29
|
-
destination: z.ZodOptional<z.ZodString>;
|
|
30
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
15
|
+
}, z.core.$loose>;
|
|
@@ -8,7 +8,7 @@ import { z } from 'zod';
|
|
|
8
8
|
*/
|
|
9
9
|
export const queueEntrySchema = z
|
|
10
10
|
.object({
|
|
11
|
-
event: z.record(z.unknown()),
|
|
11
|
+
event: z.record(z.string(), z.unknown()),
|
|
12
12
|
attempts: z.number().int().nonnegative().default(0),
|
|
13
13
|
firstQueuedAt: z.string(),
|
|
14
14
|
nextAttemptAt: z.string(),
|
|
@@ -142,6 +142,23 @@ export declare const MAX_TURN_FILES = 500;
|
|
|
142
142
|
export declare const MAX_PROMPT_TEXT_LENGTH = 4000;
|
|
143
143
|
export declare const MAX_TOOL_INPUT_LENGTH = 2000;
|
|
144
144
|
export declare const MAX_TURN_TOOL_INPUTS = 50;
|
|
145
|
+
/**
|
|
146
|
+
* Tool calls one summary sends as `tool_events`; core clamps at the same
|
|
147
|
+
* count. A longer turn sends its first calls, and `tool_calls` and
|
|
148
|
+
* `tools_used` still count every one.
|
|
149
|
+
*/
|
|
150
|
+
export declare const MAX_TURN_TOOL_EVENTS = 200;
|
|
151
|
+
/** Core's bound on a tool name and a call id. */
|
|
152
|
+
export declare const MAX_TOOL_EVENT_ID_LENGTH = 200;
|
|
153
|
+
/** The exit codes core accepts. */
|
|
154
|
+
export declare const INT32_MIN = -2147483648;
|
|
155
|
+
export declare const INT32_MAX = 2147483647;
|
|
156
|
+
/** An unkeyed digest as core takes one. */
|
|
157
|
+
export declare const RE_SHA256_HEX: RegExp;
|
|
158
|
+
/** Metadata key of the content-free tool-call block an adapter puts on a tool event. */
|
|
159
|
+
export declare const TOOL_CALL_KEY = "toolCall";
|
|
160
|
+
/** Every turn record kind this release reads back; a file of any other kind is skipped. */
|
|
161
|
+
export declare const TURN_RECORD_KINDS: ReadonlySet<string>;
|
|
145
162
|
/**
|
|
146
163
|
* The longest session title sent, in UTF-16 units — what core cuts at — and
|
|
147
164
|
* never through a code point. Scrubbed whole first, like prompt text.
|
|
@@ -163,6 +163,23 @@ export const MAX_TURN_FILES = 500;
|
|
|
163
163
|
export const MAX_PROMPT_TEXT_LENGTH = 4000;
|
|
164
164
|
export const MAX_TOOL_INPUT_LENGTH = 2000;
|
|
165
165
|
export const MAX_TURN_TOOL_INPUTS = 50;
|
|
166
|
+
/**
|
|
167
|
+
* Tool calls one summary sends as `tool_events`; core clamps at the same
|
|
168
|
+
* count. A longer turn sends its first calls, and `tool_calls` and
|
|
169
|
+
* `tools_used` still count every one.
|
|
170
|
+
*/
|
|
171
|
+
export const MAX_TURN_TOOL_EVENTS = 200;
|
|
172
|
+
/** Core's bound on a tool name and a call id. */
|
|
173
|
+
export const MAX_TOOL_EVENT_ID_LENGTH = 200;
|
|
174
|
+
/** The exit codes core accepts. */
|
|
175
|
+
export const INT32_MIN = -2_147_483_648;
|
|
176
|
+
export const INT32_MAX = 2_147_483_647;
|
|
177
|
+
/** An unkeyed digest as core takes one. */
|
|
178
|
+
export const RE_SHA256_HEX = /^[0-9a-f]{64}$/;
|
|
179
|
+
/** Metadata key of the content-free tool-call block an adapter puts on a tool event. */
|
|
180
|
+
export const TOOL_CALL_KEY = 'toolCall';
|
|
181
|
+
/** Every turn record kind this release reads back; a file of any other kind is skipped. */
|
|
182
|
+
export const TURN_RECORD_KINDS = new Set(['prompt', 'tool', 'tool-start', 'response', 'checkout']);
|
|
166
183
|
/**
|
|
167
184
|
* The longest session title sent, in UTF-16 units — what core cuts at — and
|
|
168
185
|
* never through a code point. Scrubbed whole first, like prompt text.
|
package/dist/turns/index.d.ts
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
* closes the turn into one flat summary, and the backend finalizes its usage
|
|
4
4
|
* from the atomic llm.call ledger.
|
|
5
5
|
*/
|
|
6
|
-
export type { AgentUsageSummary, BuildTurnSummaryInput, TouchedFiles, TurnSummaryEvent, TurnUsageStatus } from './types/turn-summary.types.js';
|
|
7
|
-
export type { PromptRecord, ResponseRecord, SessionModelRecord, ToolRecord, TurnRecord, TurnStateEntry } from './types/turn-state.types.js';
|
|
6
|
+
export type { AgentUsageSummary, BuildTurnSummaryInput, ToolEvent, TouchedFiles, TurnSummaryEvent, TurnUsageStatus } from './types/turn-summary.types.js';
|
|
7
|
+
export type { PromptRecord, ResponseRecord, SessionModelRecord, ToolRecord, ToolStartRecord, TurnRecord, TurnStateEntry } from './types/turn-state.types.js';
|
|
8
8
|
export type { ReadTurnUsageRetry, TranscriptReader, TranscriptUsageEntry, TurnUsage } from './types/transcript.types.js';
|
|
9
9
|
export type { TrackTurnOptions, TurnWindow } from './types/turn-tracker.types.js';
|
|
10
10
|
export type { AggregateTurnUsageOptions, UsageTotals } from './types/aggregate-usage.types.js';
|
|
11
11
|
export { PROVIDER_LABELS, TURN_STATE_TTL_MS, USAGE_RETRY } from './constants/turns.constants.js';
|
|
12
|
+
export { buildToolEvents } from './tool-events.js';
|
|
12
13
|
export { buildTurnSummary } from './turn-summary.js';
|
|
13
14
|
export { TurnStateStore } from './turn-state.js';
|
|
14
15
|
export { readTurnUsage } from './claude-transcript.js';
|
package/dist/turns/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { PROVIDER_LABELS, TURN_STATE_TTL_MS, USAGE_RETRY } from './constants/turns.constants.js';
|
|
2
|
+
export { buildToolEvents } from './tool-events.js';
|
|
2
3
|
export { buildTurnSummary } from './turn-summary.js';
|
|
3
4
|
export { TurnStateStore } from './turn-state.js';
|
|
4
5
|
export { readTurnUsage } from './claude-transcript.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TurnRecord } from './types/turn-state.types.js';
|
|
2
|
+
import type { ToolEvent } from './types/turn-summary.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The turn's tool calls as `tool_events`: each completion dated by its start,
|
|
5
|
+
* in call order, the first {@link MAX_TURN_TOOL_EVENTS} only.
|
|
6
|
+
*
|
|
7
|
+
* Pure over the turn's records, so a duplicate Stop sends the same list. A
|
|
8
|
+
* completion with no status was written by an older release and sends no
|
|
9
|
+
* event; a start that came after its completion (a clock step) dates nothing.
|
|
10
|
+
* The caller decides whether the list may leave: it rides `capture.git`.
|
|
11
|
+
*
|
|
12
|
+
* @param records - The closing turn's records, oldest first.
|
|
13
|
+
* @returns The events, possibly empty.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildToolEvents(records: readonly TurnRecord[]): ToolEvent[];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { compact } from '../core/object.js';
|
|
2
|
+
import { MAX_TOOL_EVENT_ID_LENGTH, MAX_TURN_TOOL_EVENTS, UNKNOWN_TOOL_NAME } from './constants/turns.constants.js';
|
|
3
|
+
/**
|
|
4
|
+
* The turn's tool calls as `tool_events`: each completion dated by its start,
|
|
5
|
+
* in call order, the first {@link MAX_TURN_TOOL_EVENTS} only.
|
|
6
|
+
*
|
|
7
|
+
* Pure over the turn's records, so a duplicate Stop sends the same list. A
|
|
8
|
+
* completion with no status was written by an older release and sends no
|
|
9
|
+
* event; a start that came after its completion (a clock step) dates nothing.
|
|
10
|
+
* The caller decides whether the list may leave: it rides `capture.git`.
|
|
11
|
+
*
|
|
12
|
+
* @param records - The closing turn's records, oldest first.
|
|
13
|
+
* @returns The events, possibly empty.
|
|
14
|
+
*/
|
|
15
|
+
export function buildToolEvents(records) {
|
|
16
|
+
const starts = new Map();
|
|
17
|
+
const calls = [];
|
|
18
|
+
for (const record of records) {
|
|
19
|
+
if (record.kind !== 'tool-start' || starts.has(record.pairingKey))
|
|
20
|
+
continue;
|
|
21
|
+
starts.set(record.pairingKey, record.at);
|
|
22
|
+
}
|
|
23
|
+
for (const record of records) {
|
|
24
|
+
if (record.kind !== 'tool' || record.status === undefined)
|
|
25
|
+
continue;
|
|
26
|
+
const start = record.startedAt ?? (record.pairingKey === undefined ? undefined : starts.get(record.pairingKey));
|
|
27
|
+
calls.push({ record, startedAt: start !== undefined && start <= record.at ? start : undefined });
|
|
28
|
+
}
|
|
29
|
+
// Call order is start order; a call with no start sorts by its end. Stable,
|
|
30
|
+
// so calls that tie keep the order their records were written in.
|
|
31
|
+
calls.sort((a, b) => (a.startedAt ?? a.record.at).localeCompare(b.startedAt ?? b.record.at));
|
|
32
|
+
const events = [];
|
|
33
|
+
for (const { record, startedAt } of calls) {
|
|
34
|
+
if (events.length >= MAX_TURN_TOOL_EVENTS)
|
|
35
|
+
break;
|
|
36
|
+
events.push(toolEvent(record, startedAt, events.length));
|
|
37
|
+
}
|
|
38
|
+
return events;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* One record on the wire, by field: never a spread, so nothing a record
|
|
42
|
+
* holds besides these fields (its paths, its input) can ride along.
|
|
43
|
+
*/
|
|
44
|
+
function toolEvent(record, startedAt, seq) {
|
|
45
|
+
return compact({
|
|
46
|
+
seq,
|
|
47
|
+
tool: (record.tool ?? UNKNOWN_TOOL_NAME).slice(0, MAX_TOOL_EVENT_ID_LENGTH),
|
|
48
|
+
tool_call_id: record.callId?.slice(0, MAX_TOOL_EVENT_ID_LENGTH),
|
|
49
|
+
status: record.status ?? 'ok',
|
|
50
|
+
exit_code: record.exitCode,
|
|
51
|
+
started_at: startedAt,
|
|
52
|
+
ended_at: record.at,
|
|
53
|
+
input_fp: record.inputFp,
|
|
54
|
+
// A check needs its start: without one it ran for no known time.
|
|
55
|
+
check: record.check === true && startedAt !== undefined ? true : undefined,
|
|
56
|
+
commit: record.commit,
|
|
57
|
+
diff_fp: record.diffFp
|
|
58
|
+
});
|
|
59
|
+
}
|
package/dist/turns/turn-state.js
CHANGED
|
@@ -7,7 +7,7 @@ import { writeFileAtomic } from '../storage/atomic-file.js';
|
|
|
7
7
|
import { readJsonFile } from '../storage/json-file.js';
|
|
8
8
|
import { SECRET_FILE_MODE, SWEEP_MARKER_FILE } from '../storage/constants/storage.constants.js';
|
|
9
9
|
import { claimSweep } from '../storage/sweep-marker.js';
|
|
10
|
-
import { AGENT_PIDS_DIR, AGENT_PROCESS_FILE, BILLING_SENT_FILE, INHERITED_CHECKOUT_FILE, LIVENESS_IGNORED_FILES, PROMPT_TICKETS_FILE, RE_UNSAFE_NAME_CHARS, SESSION_DIR_HASH_LENGTH, SESSION_FILES, SESSION_MODEL_FILE, SESSION_START_FILE, SESSION_TITLE_FILE, TURN_STATE_SWEEP_INTERVAL_MS, UNTRACED_MARKER_PREFIX, USAGE_CLAIM_PREFIX, WORK_CHECKOUT_FILE } from './constants/turns.constants.js';
|
|
10
|
+
import { AGENT_PIDS_DIR, AGENT_PROCESS_FILE, BILLING_SENT_FILE, INHERITED_CHECKOUT_FILE, LIVENESS_IGNORED_FILES, PROMPT_TICKETS_FILE, RE_UNSAFE_NAME_CHARS, SESSION_DIR_HASH_LENGTH, SESSION_FILES, SESSION_MODEL_FILE, SESSION_START_FILE, SESSION_TITLE_FILE, TURN_RECORD_KINDS, TURN_STATE_SWEEP_INTERVAL_MS, UNTRACED_MARKER_PREFIX, USAGE_CLAIM_PREFIX, WORK_CHECKOUT_FILE } from './constants/turns.constants.js';
|
|
11
11
|
/**
|
|
12
12
|
* Per-session accumulator for turn summaries.
|
|
13
13
|
*
|
|
@@ -665,5 +665,5 @@ function isTurnRecord(value) {
|
|
|
665
665
|
const record = asRecord(value);
|
|
666
666
|
if (!record || typeof record['at'] !== 'string')
|
|
667
667
|
return false;
|
|
668
|
-
return record['kind']
|
|
668
|
+
return TURN_RECORD_KINDS.has(String(record['kind']));
|
|
669
669
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BuildTurnSummaryInput, TurnSummaryEvent } from './types/turn-summary.types.js';
|
|
2
|
-
export type { AgentUsageSummary, BuildTurnSummaryInput, TouchedFiles, TurnSummaryEvent, TurnUsageStatus, WorkEvidence } from './types/turn-summary.types.js';
|
|
2
|
+
export type { AgentUsageSummary, BuildTurnSummaryInput, ToolEvent, TouchedFiles, TurnSummaryEvent, TurnUsageStatus, WorkEvidence } from './types/turn-summary.types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Flatten one turn's accumulated state into the single product record the hook
|
|
5
5
|
* path emits.
|
|
@@ -64,6 +64,7 @@ export function buildTurnSummary(input) {
|
|
|
64
64
|
response_evidence: input.response,
|
|
65
65
|
tool_calls: input.tools.length,
|
|
66
66
|
tools_used: files.toolsUsed,
|
|
67
|
+
tool_events: input.toolEvents?.length ? input.toolEvents : undefined,
|
|
67
68
|
model: input.usage?.model ?? input.model,
|
|
68
69
|
// 'unknown' is the absence of a verdict, not a billing mode.
|
|
69
70
|
billing_mode: input.billingMode && input.billingMode !== 'unknown' ? input.billingMode : undefined,
|