agentpostmortem 0.1.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/INSTALL.md +96 -0
- package/LICENSE +21 -0
- package/README.md +116 -0
- package/dist/chunk-Q7YDLORD.js +547 -0
- package/dist/eval-EOZA44ZZ.js +63 -0
- package/dist/index.d.ts +208 -0
- package/dist/index.js +2964 -0
- package/dist/postmortem.plugin.js +16537 -0
- package/dist/scripts/init.js +119 -0
- package/package.json +70 -0
- package/src/templates/commands/disable-lessons.md +12 -0
- package/src/templates/commands/failures.md +10 -0
- package/src/templates/commands/forget.md +11 -0
- package/src/templates/commands/inspect.md +10 -0
- package/src/templates/commands/postmortem-config.md +11 -0
- package/src/templates/commands/postmortem-eval.md +14 -0
- package/src/templates/commands/record-failure.md +10 -0
- package/src/templates/commands/retry.md +12 -0
- package/src/templates/commands/rules.md +10 -0
- package/src/templates/commands/why-failed.md +10 -0
- package/src/templates/skills/disable-lessons/SKILL.md +34 -0
- package/src/templates/skills/failures/SKILL.md +38 -0
- package/src/templates/skills/inspect/SKILL.md +31 -0
- package/src/templates/skills/postmortem-config/SKILL.md +32 -0
- package/src/templates/skills/postmortem-eval/SKILL.md +29 -0
- package/src/templates/skills/record-failure/SKILL.md +31 -0
- package/src/templates/skills/retry/SKILL.md +34 -0
- package/src/templates/skills/rules/SKILL.md +39 -0
- package/src/templates/skills/why-failed/SKILL.md +32 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { Plugin } from '@opencode-ai/plugin';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const REDACTED_SENTINEL = "[REDACTED]";
|
|
5
|
+
declare const DEFAULT_EVIDENCE_ITEM_BYTES: number;
|
|
6
|
+
declare const DEFAULT_SNAPSHOT_TOTAL_BYTES: number;
|
|
7
|
+
declare const DEFAULT_FAILURE_TOTAL_BYTES: number;
|
|
8
|
+
declare const DEFAULT_GUARDRAIL_TOKEN_CAP = 400;
|
|
9
|
+
type PatternCount = Record<string, number>;
|
|
10
|
+
type RedactionReport = {
|
|
11
|
+
totalReplacements: number;
|
|
12
|
+
patterns: PatternCount;
|
|
13
|
+
droppedDueToCaps: boolean;
|
|
14
|
+
};
|
|
15
|
+
type RedactOptions = {
|
|
16
|
+
sentinel?: string;
|
|
17
|
+
maxBytes?: number;
|
|
18
|
+
};
|
|
19
|
+
type CapReport = {
|
|
20
|
+
droppedDueToCaps: boolean;
|
|
21
|
+
truncatedItems: number;
|
|
22
|
+
droppedItems: number;
|
|
23
|
+
bytesIn: number;
|
|
24
|
+
bytesOut: number;
|
|
25
|
+
};
|
|
26
|
+
type GuardrailCapReport = {
|
|
27
|
+
droppedDueToCaps: boolean;
|
|
28
|
+
tokenEstimateIn: number;
|
|
29
|
+
tokenEstimateOut: number;
|
|
30
|
+
};
|
|
31
|
+
declare function redact(text: string, options?: RedactOptions): {
|
|
32
|
+
text: string;
|
|
33
|
+
report: {
|
|
34
|
+
totalReplacements: number;
|
|
35
|
+
patterns: PatternCount;
|
|
36
|
+
droppedDueToCaps: boolean;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
declare function enforceCaps(items: string[], options?: {
|
|
40
|
+
perItemBytes?: number;
|
|
41
|
+
totalBytes?: number;
|
|
42
|
+
}): {
|
|
43
|
+
items: string[];
|
|
44
|
+
report: {
|
|
45
|
+
droppedDueToCaps: boolean;
|
|
46
|
+
truncatedItems: number;
|
|
47
|
+
droppedItems: number;
|
|
48
|
+
bytesIn: number;
|
|
49
|
+
bytesOut: number;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
declare function enforceEvidenceCaps(items: string[], perItemBytes?: number): {
|
|
53
|
+
items: string[];
|
|
54
|
+
report: {
|
|
55
|
+
droppedDueToCaps: boolean;
|
|
56
|
+
truncatedItems: number;
|
|
57
|
+
droppedItems: number;
|
|
58
|
+
bytesIn: number;
|
|
59
|
+
bytesOut: number;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
declare function enforceSnapshotCaps(items: string[], totalBytes?: number): {
|
|
63
|
+
items: string[];
|
|
64
|
+
report: {
|
|
65
|
+
droppedDueToCaps: boolean;
|
|
66
|
+
truncatedItems: number;
|
|
67
|
+
droppedItems: number;
|
|
68
|
+
bytesIn: number;
|
|
69
|
+
bytesOut: number;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
declare function enforceFailureCaps(items: string[], totalBytes?: number): {
|
|
73
|
+
items: string[];
|
|
74
|
+
report: {
|
|
75
|
+
droppedDueToCaps: boolean;
|
|
76
|
+
truncatedItems: number;
|
|
77
|
+
droppedItems: number;
|
|
78
|
+
bytesIn: number;
|
|
79
|
+
bytesOut: number;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
declare function enforceGuardrailTokenCap(text: string, tokenCap?: number): {
|
|
83
|
+
text: string;
|
|
84
|
+
report: {
|
|
85
|
+
droppedDueToCaps: false;
|
|
86
|
+
tokenEstimateIn: number;
|
|
87
|
+
tokenEstimateOut: number;
|
|
88
|
+
};
|
|
89
|
+
} | {
|
|
90
|
+
text: string;
|
|
91
|
+
report: {
|
|
92
|
+
droppedDueToCaps: true;
|
|
93
|
+
tokenEstimateIn: number;
|
|
94
|
+
tokenEstimateOut: number;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
declare const SNAPSHOT_SCHEMA_VERSION = 1;
|
|
99
|
+
declare const SnapshotToolStatus: z.ZodEnum<{
|
|
100
|
+
error: "error";
|
|
101
|
+
pending: "pending";
|
|
102
|
+
running: "running";
|
|
103
|
+
completed: "completed";
|
|
104
|
+
}>;
|
|
105
|
+
type SnapshotToolStatus = z.infer<typeof SnapshotToolStatus>;
|
|
106
|
+
declare const SnapshotDropSection: z.ZodEnum<{
|
|
107
|
+
tools: "tools";
|
|
108
|
+
git_status: "git_status";
|
|
109
|
+
errors: "errors";
|
|
110
|
+
diff_files: "diff_files";
|
|
111
|
+
context_gaps: "context_gaps";
|
|
112
|
+
}>;
|
|
113
|
+
type SnapshotDropSection = z.infer<typeof SnapshotDropSection>;
|
|
114
|
+
declare const SnapshotTool: z.ZodObject<{
|
|
115
|
+
tool: z.ZodString;
|
|
116
|
+
status: z.ZodEnum<{
|
|
117
|
+
error: "error";
|
|
118
|
+
pending: "pending";
|
|
119
|
+
running: "running";
|
|
120
|
+
completed: "completed";
|
|
121
|
+
}>;
|
|
122
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
type SnapshotTool = z.infer<typeof SnapshotTool>;
|
|
125
|
+
declare const SnapshotError: z.ZodObject<{
|
|
126
|
+
tool: z.ZodString;
|
|
127
|
+
snippet: z.ZodString;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
type SnapshotError = z.infer<typeof SnapshotError>;
|
|
130
|
+
declare const SnapshotDiffFile: z.ZodObject<{
|
|
131
|
+
file: z.ZodString;
|
|
132
|
+
additions: z.ZodNumber;
|
|
133
|
+
deletions: z.ZodNumber;
|
|
134
|
+
}, z.core.$strip>;
|
|
135
|
+
type SnapshotDiffFile = z.infer<typeof SnapshotDiffFile>;
|
|
136
|
+
declare const SnapshotDiff: z.ZodObject<{
|
|
137
|
+
totalFiles: z.ZodNumber;
|
|
138
|
+
additions: z.ZodNumber;
|
|
139
|
+
deletions: z.ZodNumber;
|
|
140
|
+
files: z.ZodArray<z.ZodObject<{
|
|
141
|
+
file: z.ZodString;
|
|
142
|
+
additions: z.ZodNumber;
|
|
143
|
+
deletions: z.ZodNumber;
|
|
144
|
+
}, z.core.$strip>>;
|
|
145
|
+
}, z.core.$strip>;
|
|
146
|
+
type SnapshotDiff = z.infer<typeof SnapshotDiff>;
|
|
147
|
+
declare const SnapshotGitStatus: z.ZodObject<{
|
|
148
|
+
lines: z.ZodArray<z.ZodString>;
|
|
149
|
+
truncated: z.ZodBoolean;
|
|
150
|
+
}, z.core.$strip>;
|
|
151
|
+
type SnapshotGitStatus = z.infer<typeof SnapshotGitStatus>;
|
|
152
|
+
declare const LastRunSnapshot: z.ZodObject<{
|
|
153
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
154
|
+
projectId: z.ZodString;
|
|
155
|
+
sessionID: z.ZodString;
|
|
156
|
+
capturedAt: z.ZodString;
|
|
157
|
+
errorSignature: z.ZodOptional<z.ZodString>;
|
|
158
|
+
tools: z.ZodArray<z.ZodObject<{
|
|
159
|
+
tool: z.ZodString;
|
|
160
|
+
status: z.ZodEnum<{
|
|
161
|
+
error: "error";
|
|
162
|
+
pending: "pending";
|
|
163
|
+
running: "running";
|
|
164
|
+
completed: "completed";
|
|
165
|
+
}>;
|
|
166
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
167
|
+
}, z.core.$strip>>;
|
|
168
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
169
|
+
tool: z.ZodString;
|
|
170
|
+
snippet: z.ZodString;
|
|
171
|
+
}, z.core.$strip>>;
|
|
172
|
+
diff: z.ZodObject<{
|
|
173
|
+
totalFiles: z.ZodNumber;
|
|
174
|
+
additions: z.ZodNumber;
|
|
175
|
+
deletions: z.ZodNumber;
|
|
176
|
+
files: z.ZodArray<z.ZodObject<{
|
|
177
|
+
file: z.ZodString;
|
|
178
|
+
additions: z.ZodNumber;
|
|
179
|
+
deletions: z.ZodNumber;
|
|
180
|
+
}, z.core.$strip>>;
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
gitStatus: z.ZodOptional<z.ZodObject<{
|
|
183
|
+
lines: z.ZodArray<z.ZodString>;
|
|
184
|
+
truncated: z.ZodBoolean;
|
|
185
|
+
}, z.core.$strip>>;
|
|
186
|
+
contextGaps: z.ZodArray<z.ZodString>;
|
|
187
|
+
meta: z.ZodObject<{
|
|
188
|
+
droppedDueToCaps: z.ZodBoolean;
|
|
189
|
+
droppedSections: z.ZodArray<z.ZodEnum<{
|
|
190
|
+
tools: "tools";
|
|
191
|
+
git_status: "git_status";
|
|
192
|
+
errors: "errors";
|
|
193
|
+
diff_files: "diff_files";
|
|
194
|
+
context_gaps: "context_gaps";
|
|
195
|
+
}>>;
|
|
196
|
+
source: z.ZodObject<{
|
|
197
|
+
messageCount: z.ZodNumber;
|
|
198
|
+
toolCallCount: z.ZodNumber;
|
|
199
|
+
diffFileCount: z.ZodNumber;
|
|
200
|
+
gitRepo: z.ZodBoolean;
|
|
201
|
+
}, z.core.$strip>;
|
|
202
|
+
}, z.core.$strip>;
|
|
203
|
+
}, z.core.$strip>;
|
|
204
|
+
type LastRunSnapshot = z.infer<typeof LastRunSnapshot>;
|
|
205
|
+
|
|
206
|
+
declare const postmortemPlugin: Plugin;
|
|
207
|
+
|
|
208
|
+
export { type CapReport, DEFAULT_EVIDENCE_ITEM_BYTES, DEFAULT_FAILURE_TOTAL_BYTES, DEFAULT_GUARDRAIL_TOKEN_CAP, DEFAULT_SNAPSHOT_TOTAL_BYTES, type GuardrailCapReport, LastRunSnapshot, type PatternCount, REDACTED_SENTINEL, type RedactOptions, type RedactionReport, SNAPSHOT_SCHEMA_VERSION, SnapshotDiff, SnapshotDiffFile, SnapshotDropSection, SnapshotError, SnapshotGitStatus, SnapshotTool, SnapshotToolStatus, postmortemPlugin as default, enforceCaps, enforceEvidenceCaps, enforceFailureCaps, enforceGuardrailTokenCap, enforceSnapshotCaps, postmortemPlugin, redact };
|