@bilalimamoglu/sift 0.4.4 → 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.
Files changed (5) hide show
  1. package/README.md +103 -76
  2. package/dist/cli.js +11005 -7333
  3. package/dist/index.d.ts +62 -4
  4. package/dist/index.js +1009 -57
  5. package/package.json +14 -3
package/dist/index.d.ts CHANGED
@@ -13,7 +13,8 @@ type RawSliceStrategy = "none" | "bucket_evidence" | "traceback_window" | "head_
13
13
  type TestStatusRemainingMode = "none" | "subset_rerun" | "full_rerun_diff";
14
14
  type ResponseMode = "text" | "json";
15
15
  type JsonResponseFormatMode = "auto" | "on" | "off";
16
- type PromptPolicyName = "test-status" | "audit-critical" | "diff-summary" | "build-failure" | "log-errors" | "infra-risk" | "typecheck-summary" | "lint-failures";
16
+ type OperationMode = "agent-escalation" | "provider-assisted" | "local-only";
17
+ type PromptPolicyName = "test-status" | "audit-critical" | "diff-summary" | "build-failure" | "contract-drift" | "log-errors" | "infra-risk" | "typecheck-summary" | "lint-failures";
17
18
  interface ProviderConfig {
18
19
  provider: ProviderName;
19
20
  model: string;
@@ -34,9 +35,19 @@ interface InputConfig {
34
35
  tailChars: number;
35
36
  }
36
37
  interface RuntimeConfig {
38
+ operationMode: OperationMode;
37
39
  rawFallback: boolean;
38
40
  verbose: boolean;
39
41
  }
42
+ interface SafetyConfig {
43
+ enabled: boolean;
44
+ extraRiskPatterns: string[];
45
+ ignoredRiskPatterns: string[];
46
+ }
47
+ interface HistoryConfig {
48
+ enabled: boolean;
49
+ retentionDays: number;
50
+ }
40
51
  interface PresetDefinition {
41
52
  question: string;
42
53
  format: OutputFormat;
@@ -48,6 +59,8 @@ interface SiftConfig {
48
59
  provider: ProviderConfig;
49
60
  input: InputConfig;
50
61
  runtime: RuntimeConfig;
62
+ safety: SafetyConfig;
63
+ history: HistoryConfig;
51
64
  presets: Record<string, PresetDefinition>;
52
65
  providerProfiles?: ProviderProfiles;
53
66
  }
@@ -55,6 +68,8 @@ interface PartialSiftConfig {
55
68
  provider?: Partial<ProviderConfig>;
56
69
  input?: Partial<InputConfig>;
57
70
  runtime?: Partial<RuntimeConfig>;
71
+ safety?: Partial<SafetyConfig>;
72
+ history?: Partial<HistoryConfig>;
58
73
  presets?: Record<string, PresetDefinition>;
59
74
  providerProfiles?: ProviderProfiles;
60
75
  }
@@ -104,6 +119,7 @@ interface PreparedInput {
104
119
  sanitized: string;
105
120
  redacted: string;
106
121
  truncated: string;
122
+ safety: SafetyReport | null;
107
123
  meta: {
108
124
  originalLength: number;
109
125
  finalLength: number;
@@ -111,6 +127,40 @@ interface PreparedInput {
111
127
  truncatedApplied: boolean;
112
128
  };
113
129
  }
130
+ interface SafetySignal {
131
+ category: "instruction-like" | "shell-like" | "exfiltration-like" | "unicode-control";
132
+ snippet: string;
133
+ source: "builtin" | "override";
134
+ }
135
+ interface SafetyReport {
136
+ suppressedLineCount: number;
137
+ signals: SafetySignal[];
138
+ }
139
+ type HistoryEntrypoint = "pipe" | "exec" | "hook" | "rerun" | "escalate" | "watch";
140
+ type HistoryResultKind = "reduced" | "insufficient" | "pass-through" | "watch-summary";
141
+ interface HistoryEvent {
142
+ version: 1;
143
+ timestamp: string;
144
+ cwdHash: string;
145
+ cwdLabel: string;
146
+ entrypoint: HistoryEntrypoint;
147
+ operationMode: OperationMode;
148
+ commandFamily: string | null;
149
+ presetName: string | null;
150
+ candidatePresetName: string | null;
151
+ providerCalled: boolean;
152
+ layer: RunLayer;
153
+ detail: DetailLevel | null;
154
+ resultKind: HistoryResultKind;
155
+ inputChars: number;
156
+ outputChars: number;
157
+ estimatedInputTokens: number;
158
+ estimatedOutputTokens: number;
159
+ exactProviderTokens: number | null;
160
+ durationMs: number | null;
161
+ safetySuppressedLineCount: number;
162
+ }
163
+ type RunLayer = "heuristic" | "provider" | "fallback" | "none";
114
164
 
115
165
  declare class BoundedCapture {
116
166
  private readonly headBudget;
@@ -141,17 +191,24 @@ interface ExecRequest extends Omit<RunRequest, "stdin"> {
141
191
  readCachedBaseline?: boolean;
142
192
  writeCachedBaseline?: boolean;
143
193
  watch?: boolean;
194
+ historyEntrypoint?: HistoryEntrypoint;
144
195
  }
145
196
  declare function buildCommandPreview(request: ExecRequest): string;
197
+ type PackageManagerScriptKind = "npm" | "pnpm" | "yarn" | "bun";
198
+ declare function detectPackageManagerScriptKind(commandPreview: string): PackageManagerScriptKind | null;
199
+ declare function normalizeScriptWrapperOutput(args: {
200
+ commandPreview: string;
201
+ capturedOutput: string;
202
+ }): string;
146
203
  declare function getExecSuccessShortcut(args: {
147
204
  presetName?: string;
148
205
  exitCode: number;
149
- capturedOutput: string;
206
+ normalizedOutput: string;
150
207
  }): string | null;
151
208
  declare function runExec(request: ExecRequest): Promise<number>;
152
209
 
153
210
  interface RunStats {
154
- layer: "heuristic" | "provider" | "fallback";
211
+ layer: RunLayer;
155
212
  providerCalled: boolean;
156
213
  totalTokens: number | null;
157
214
  durationMs: number;
@@ -178,5 +235,6 @@ interface ResolveOptions {
178
235
  cliOverrides?: PartialSiftConfig;
179
236
  }
180
237
  declare function resolveConfig(options?: ResolveOptions): SiftConfig;
238
+ declare function resolveEffectiveOperationMode(config: SiftConfig): OperationMode;
181
239
 
182
- export { BoundedCapture, type DetailLevel, type ExecRequest, type GenerateInput, type GenerateResult, type Goal, type InputConfig, type JsonResponseFormatMode, type LLMProvider, type NativeProviderName, type OutputFormat, type PartialSiftConfig, type PreparedInput, type PresetDefinition, type PromptPolicyName, type ProviderConfig, type ProviderName, type ProviderProfile, type ProviderProfiles, type RawSliceStrategy, type ResolveOptions, type ResponseMode, type RunRequest, type RuntimeConfig, type SiftConfig, type TestStatusRemainingMode, type UsageInfo, buildCommandPreview, getExecSuccessShortcut, looksInteractivePrompt, mergeDefined, normalizeChildExitCode, resolveConfig, runExec, runSift, runSiftWithStats, startPendingNotice };
240
+ export { BoundedCapture, type DetailLevel, type ExecRequest, type GenerateInput, type GenerateResult, type Goal, type HistoryConfig, type HistoryEntrypoint, type HistoryEvent, type HistoryResultKind, type InputConfig, type JsonResponseFormatMode, type LLMProvider, type NativeProviderName, type OperationMode, type OutputFormat, type PackageManagerScriptKind, type PartialSiftConfig, type PreparedInput, type PresetDefinition, type PromptPolicyName, type ProviderConfig, type ProviderName, type ProviderProfile, type ProviderProfiles, type RawSliceStrategy, type ResolveOptions, type ResponseMode, type RunLayer, type RunRequest, type RuntimeConfig, type SafetyConfig, type SafetyReport, type SafetySignal, type SiftConfig, type TestStatusRemainingMode, type UsageInfo, buildCommandPreview, detectPackageManagerScriptKind, getExecSuccessShortcut, looksInteractivePrompt, mergeDefined, normalizeChildExitCode, normalizeScriptWrapperOutput, resolveConfig, resolveEffectiveOperationMode, runExec, runSift, runSiftWithStats, startPendingNotice };