@oh-my-pi/pi-coding-agent 17.2.0 → 17.2.1
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 +18 -0
- package/dist/{CHANGELOG-be1f2t8h.md → CHANGELOG-dj46zzrm.md} +18 -0
- package/dist/cli.js +3340 -3195
- package/dist/types/config/model-discovery.d.ts +12 -0
- package/dist/types/config/settings-schema.d.ts +10 -0
- package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +23 -0
- package/dist/types/internal-urls/index.d.ts +1 -0
- package/dist/types/internal-urls/security-protocol.d.ts +15 -0
- package/dist/types/internal-urls/types.d.ts +1 -1
- package/dist/types/sdk.d.ts +17 -0
- package/dist/types/security/auth.d.ts +30 -0
- package/dist/types/security/cloud.d.ts +79 -0
- package/dist/types/security/comparison.d.ts +49 -0
- package/dist/types/security/contracts/ids.d.ts +15 -0
- package/dist/types/security/contracts/index.d.ts +4 -0
- package/dist/types/security/contracts/schemas.d.ts +660 -0
- package/dist/types/security/contracts/types.d.ts +234 -0
- package/dist/types/security/contracts/validation.d.ts +5 -0
- package/dist/types/security/coordinator.d.ts +100 -0
- package/dist/types/security/importers/codex-security.d.ts +7 -0
- package/dist/types/security/importers/index.d.ts +2 -0
- package/dist/types/security/importers/sarif.d.ts +9 -0
- package/dist/types/security/index.d.ts +13 -0
- package/dist/types/security/preflight.d.ts +61 -0
- package/dist/types/security/provenance.d.ts +24 -0
- package/dist/types/security/publication.d.ts +78 -0
- package/dist/types/security/remediation.d.ts +27 -0
- package/dist/types/security/resource-output.d.ts +8 -0
- package/dist/types/security/sarif.d.ts +2 -0
- package/dist/types/security/store.d.ts +40 -0
- package/dist/types/slash-commands/helpers/security.d.ts +2 -0
- package/dist/types/system-prompt.d.ts +2 -0
- package/dist/types/task/executor.d.ts +3 -0
- package/dist/types/tools/builtin-names.d.ts +1 -1
- package/dist/types/tools/index.d.ts +6 -1
- package/dist/types/tools/security-scan.d.ts +96 -0
- package/package.json +12 -12
- package/scripts/security-compare.ts +40 -0
- package/src/config/model-discovery.ts +32 -5
- package/src/config/model-registry.ts +4 -0
- package/src/config/settings-schema.ts +12 -0
- package/src/eval/py/prelude.py +7 -3
- package/src/extensibility/legacy-pi-coding-agent-shim.ts +53 -0
- package/src/internal-urls/index.ts +1 -0
- package/src/internal-urls/router.ts +4 -1
- package/src/internal-urls/security-protocol.ts +261 -0
- package/src/internal-urls/types.ts +1 -1
- package/src/lsp/index.ts +3 -0
- package/src/modes/rpc/host-uris.ts +6 -0
- package/src/prompts/agents/security-reviewer.md +75 -0
- package/src/prompts/security/scan-coordinator.md +7 -0
- package/src/prompts/security/scan-request.md +21 -0
- package/src/prompts/security/validate-request.md +8 -0
- package/src/prompts/system/system-prompt.md +3 -0
- package/src/prompts/tools/security-publish.md +1 -0
- package/src/prompts/tools/security-scan.md +1 -0
- package/src/sdk.ts +34 -6
- package/src/security/auth.ts +98 -0
- package/src/security/cloud.ts +686 -0
- package/src/security/comparison.ts +255 -0
- package/src/security/contracts/ids.ts +111 -0
- package/src/security/contracts/index.ts +4 -0
- package/src/security/contracts/schemas.ts +201 -0
- package/src/security/contracts/types.ts +254 -0
- package/src/security/contracts/validation.ts +65 -0
- package/src/security/coordinator.ts +708 -0
- package/src/security/importers/codex-security.ts +387 -0
- package/src/security/importers/index.ts +2 -0
- package/src/security/importers/sarif.ts +357 -0
- package/src/security/index.ts +13 -0
- package/src/security/preflight.ts +405 -0
- package/src/security/provenance.ts +106 -0
- package/src/security/publication.ts +326 -0
- package/src/security/remediation.ts +93 -0
- package/src/security/resource-output.ts +50 -0
- package/src/security/sarif.ts +78 -0
- package/src/security/store.ts +430 -0
- package/src/slash-commands/builtin-registry.ts +21 -0
- package/src/slash-commands/helpers/security.ts +451 -0
- package/src/system-prompt.ts +4 -0
- package/src/task/agents.ts +2 -0
- package/src/task/executor.ts +3 -0
- package/src/task/structured-subagent.ts +6 -4
- package/src/tools/builtin-names.ts +1 -0
- package/src/tools/index.ts +9 -1
- package/src/tools/path-utils.ts +3 -0
- package/src/tools/security-scan.ts +287 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
export type SecuritySeverityLevel = "critical" | "high" | "medium" | "low" | "informational";
|
|
2
|
+
export type SecurityConfidenceLevel = "high" | "medium" | "low";
|
|
3
|
+
export type SecurityScanStatus = "planned" | "running" | "completed" | "partial" | "cancelled" | "failed";
|
|
4
|
+
export type SecurityCoverageCompleteness = "complete" | "partial" | "unknown";
|
|
5
|
+
export type SecurityValidationStatus = "unvalidated" | "validated" | "rejected" | "partial" | "error";
|
|
6
|
+
export type SecurityDispositionStatus = "open" | "false_positive" | "accepted_risk" | "fixed" | "wont_fix";
|
|
7
|
+
export type SecurityTargetKind = "repository" | "scoped_path" | "ref_diff" | "working_tree" | "imported";
|
|
8
|
+
export type SecurityProducerKind = "omp-native" | "codex-security-bundle" | "codex-security-cloud" | "sarif-import";
|
|
9
|
+
export interface SecurityProducer {
|
|
10
|
+
kind: SecurityProducerKind;
|
|
11
|
+
name: string;
|
|
12
|
+
version?: string;
|
|
13
|
+
vendor?: string;
|
|
14
|
+
revision?: string;
|
|
15
|
+
pluginVersion?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SecurityUpstreamProvenance {
|
|
18
|
+
repository?: string;
|
|
19
|
+
revision?: string;
|
|
20
|
+
packageVersion?: string;
|
|
21
|
+
pluginVersion?: string;
|
|
22
|
+
archiveSha256?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SecurityProvenance {
|
|
25
|
+
producer: SecurityProducer;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
importedAt?: string;
|
|
28
|
+
sourceIds?: Record<string, string>;
|
|
29
|
+
vendorFingerprints?: Record<string, string>;
|
|
30
|
+
upstream?: SecurityUpstreamProvenance;
|
|
31
|
+
metadata?: Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
export interface SecurityLocation {
|
|
34
|
+
path: string;
|
|
35
|
+
startLine: number;
|
|
36
|
+
endLine?: number;
|
|
37
|
+
startColumn?: number;
|
|
38
|
+
endColumn?: number;
|
|
39
|
+
role?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface SecurityEvidence {
|
|
42
|
+
id: string;
|
|
43
|
+
kind: "code" | "trace" | "validation" | "note";
|
|
44
|
+
label: string;
|
|
45
|
+
explanation: string;
|
|
46
|
+
location?: SecurityLocation;
|
|
47
|
+
excerpt?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface SecurityOccurrence {
|
|
50
|
+
id: string;
|
|
51
|
+
locations: SecurityLocation[];
|
|
52
|
+
evidenceIds: string[];
|
|
53
|
+
}
|
|
54
|
+
export interface SecuritySeverity {
|
|
55
|
+
level: SecuritySeverityLevel;
|
|
56
|
+
score?: number;
|
|
57
|
+
scoringSystem?: string;
|
|
58
|
+
vector?: string;
|
|
59
|
+
rationale?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface SecurityConfidence {
|
|
62
|
+
level: SecurityConfidenceLevel;
|
|
63
|
+
rationale?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface SecurityTaxonomy {
|
|
66
|
+
category: string;
|
|
67
|
+
cwe: string[];
|
|
68
|
+
tags?: string[];
|
|
69
|
+
}
|
|
70
|
+
export interface SecurityValidation {
|
|
71
|
+
status: SecurityValidationStatus;
|
|
72
|
+
summary?: string;
|
|
73
|
+
evidenceIds: string[];
|
|
74
|
+
validatedAt?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface SecurityDisposition {
|
|
77
|
+
status: SecurityDispositionStatus;
|
|
78
|
+
rationale?: string;
|
|
79
|
+
updatedAt?: string;
|
|
80
|
+
actor?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface SecurityFinding {
|
|
83
|
+
id: string;
|
|
84
|
+
scanId: string;
|
|
85
|
+
fingerprint: string;
|
|
86
|
+
ruleId: string;
|
|
87
|
+
anchor?: string;
|
|
88
|
+
title: string;
|
|
89
|
+
summary: string;
|
|
90
|
+
severity: SecuritySeverity;
|
|
91
|
+
confidence: SecurityConfidence;
|
|
92
|
+
taxonomy: SecurityTaxonomy;
|
|
93
|
+
occurrences: SecurityOccurrence[];
|
|
94
|
+
evidence: SecurityEvidence[];
|
|
95
|
+
remediation?: string;
|
|
96
|
+
validation: SecurityValidation;
|
|
97
|
+
disposition: SecurityDisposition;
|
|
98
|
+
provenance: SecurityProvenance;
|
|
99
|
+
extensions?: Record<string, unknown>;
|
|
100
|
+
}
|
|
101
|
+
export interface SecurityCoverageSurface {
|
|
102
|
+
id: string;
|
|
103
|
+
label: string;
|
|
104
|
+
disposition: "reported" | "no_issue_found" | "rejected" | "not_applicable" | "needs_follow_up";
|
|
105
|
+
receiptRefs: string[];
|
|
106
|
+
riskArea?: string;
|
|
107
|
+
notes?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface SecurityCoverageDeferred {
|
|
110
|
+
id: string;
|
|
111
|
+
reason: string;
|
|
112
|
+
paths?: string[];
|
|
113
|
+
surfaceIds?: string[];
|
|
114
|
+
}
|
|
115
|
+
export interface SecurityCoverage {
|
|
116
|
+
mode: "repository" | "scoped_path" | "diff" | "working_tree" | "deep_repository" | "imported";
|
|
117
|
+
completeness: SecurityCoverageCompleteness;
|
|
118
|
+
inventoryStrategy: "repository" | "scoped_path" | "diff" | "directory" | "custom" | "imported";
|
|
119
|
+
includePaths: string[];
|
|
120
|
+
excludePaths: string[];
|
|
121
|
+
surfaces: SecurityCoverageSurface[];
|
|
122
|
+
explicitExclusions: Array<{
|
|
123
|
+
pattern: string;
|
|
124
|
+
reason: string;
|
|
125
|
+
}>;
|
|
126
|
+
deferred: SecurityCoverageDeferred[];
|
|
127
|
+
openQuestions?: Array<{
|
|
128
|
+
question: string;
|
|
129
|
+
followUpPrompt?: string;
|
|
130
|
+
}>;
|
|
131
|
+
}
|
|
132
|
+
export interface SecurityTarget {
|
|
133
|
+
kind: SecurityTargetKind;
|
|
134
|
+
repositoryRoot: string;
|
|
135
|
+
displayName: string;
|
|
136
|
+
revision?: string;
|
|
137
|
+
baseRevision?: string;
|
|
138
|
+
headRevision?: string;
|
|
139
|
+
includePaths: string[];
|
|
140
|
+
excludePaths: string[];
|
|
141
|
+
treeDigest: string;
|
|
142
|
+
}
|
|
143
|
+
export interface SecurityModelRef {
|
|
144
|
+
provider: string;
|
|
145
|
+
modelId: string;
|
|
146
|
+
thinkingLevel?: string;
|
|
147
|
+
}
|
|
148
|
+
export interface SecurityAccountRef {
|
|
149
|
+
provider: string;
|
|
150
|
+
credentialId: number;
|
|
151
|
+
accountId?: string;
|
|
152
|
+
email?: string;
|
|
153
|
+
organizationId?: string;
|
|
154
|
+
organizationName?: string;
|
|
155
|
+
}
|
|
156
|
+
export interface SecurityKnowledgeBaseRef {
|
|
157
|
+
path: string;
|
|
158
|
+
sha256: string;
|
|
159
|
+
size: number;
|
|
160
|
+
}
|
|
161
|
+
export interface SecurityOutputPlan {
|
|
162
|
+
root: string;
|
|
163
|
+
archiveExisting: boolean;
|
|
164
|
+
existingState: "absent" | "empty" | "archivable";
|
|
165
|
+
}
|
|
166
|
+
export interface SecurityScanPlan {
|
|
167
|
+
documentType: "omp-security.scan-plan";
|
|
168
|
+
schemaVersion: "1.0";
|
|
169
|
+
id: string;
|
|
170
|
+
createdAt: string;
|
|
171
|
+
repositoryRoot: string;
|
|
172
|
+
target: SecurityTarget;
|
|
173
|
+
knowledgeBases: SecurityKnowledgeBaseRef[];
|
|
174
|
+
output: SecurityOutputPlan;
|
|
175
|
+
model: SecurityModelRef;
|
|
176
|
+
account: SecurityAccountRef;
|
|
177
|
+
configFingerprint: string;
|
|
178
|
+
workflowFingerprint: string;
|
|
179
|
+
fingerprint: string;
|
|
180
|
+
}
|
|
181
|
+
export interface SecurityScanMetrics {
|
|
182
|
+
runtimeMs?: number;
|
|
183
|
+
tokenUsage?: {
|
|
184
|
+
input: number;
|
|
185
|
+
output: number;
|
|
186
|
+
reasoning: number;
|
|
187
|
+
cacheRead: number;
|
|
188
|
+
cacheWrite: number;
|
|
189
|
+
total: number;
|
|
190
|
+
};
|
|
191
|
+
cost?: number;
|
|
192
|
+
premiumRequests?: number;
|
|
193
|
+
}
|
|
194
|
+
export interface SecurityScan {
|
|
195
|
+
documentType: "omp-security.scan";
|
|
196
|
+
schemaVersion: "1.0";
|
|
197
|
+
id: string;
|
|
198
|
+
projectKey: string;
|
|
199
|
+
status: SecurityScanStatus;
|
|
200
|
+
createdAt: string;
|
|
201
|
+
startedAt?: string;
|
|
202
|
+
completedAt?: string;
|
|
203
|
+
plan?: SecurityScanPlan;
|
|
204
|
+
target: SecurityTarget;
|
|
205
|
+
producer: SecurityProducer;
|
|
206
|
+
provenance: SecurityProvenance;
|
|
207
|
+
findingIds: string[];
|
|
208
|
+
coverage: SecurityCoverage;
|
|
209
|
+
reportRef?: string;
|
|
210
|
+
sarifRef?: string;
|
|
211
|
+
error?: string;
|
|
212
|
+
metrics?: SecurityScanMetrics;
|
|
213
|
+
}
|
|
214
|
+
export interface SecurityScanBundle {
|
|
215
|
+
scan: SecurityScan;
|
|
216
|
+
findings: SecurityFinding[];
|
|
217
|
+
report?: string;
|
|
218
|
+
sarif?: Record<string, unknown>;
|
|
219
|
+
}
|
|
220
|
+
export interface SecurityFindingMatch {
|
|
221
|
+
beforeFindingId?: string;
|
|
222
|
+
afterFindingId?: string;
|
|
223
|
+
fingerprint: string;
|
|
224
|
+
status: "unchanged" | "new" | "resolved";
|
|
225
|
+
matchBasis?: "fingerprint" | "rule_location" | "taxonomy_location";
|
|
226
|
+
}
|
|
227
|
+
export interface SecurityComparisonReport {
|
|
228
|
+
beforeScanId: string;
|
|
229
|
+
afterScanId: string;
|
|
230
|
+
matches: SecurityFindingMatch[];
|
|
231
|
+
unchanged: number;
|
|
232
|
+
introduced: number;
|
|
233
|
+
resolved: number;
|
|
234
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SecurityFinding, SecurityScan, SecurityScanBundle, SecurityScanPlan } from "./types.js";
|
|
2
|
+
export declare function parseSecurityFinding(value: unknown): SecurityFinding;
|
|
3
|
+
export declare function parseSecurityScan(value: unknown): SecurityScan;
|
|
4
|
+
export declare function parseSecurityScanPlan(value: unknown): SecurityScanPlan;
|
|
5
|
+
export declare function parseSecurityScanBundle(value: unknown): SecurityScanBundle;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Model } from "@oh-my-pi/pi-ai";
|
|
2
|
+
import type { AsyncJobManager } from "../async/job-manager.js";
|
|
3
|
+
import type { ModelRegistry } from "../config/model-registry.js";
|
|
4
|
+
import type { Settings } from "../config/settings.js";
|
|
5
|
+
import type { ToolDefinition } from "../extensibility/extensions/index.js";
|
|
6
|
+
import type { AuthStorage } from "../session/auth-storage.js";
|
|
7
|
+
import { SessionManager } from "../session/session-manager.js";
|
|
8
|
+
import type { SecurityScanPlan } from "./contracts/index.js";
|
|
9
|
+
import type { SecurityGitAdapter, SecurityTargetRequest } from "./preflight.js";
|
|
10
|
+
import { SecurityStore } from "./store.js";
|
|
11
|
+
export type SecurityOperationPhase = "queued" | "preparing" | "reviewing" | "publishing" | "completed" | "partial" | "cancelled" | "failed";
|
|
12
|
+
export interface SecurityOperationSnapshot {
|
|
13
|
+
operationId: string;
|
|
14
|
+
planId: string;
|
|
15
|
+
scanId: string;
|
|
16
|
+
phase: SecurityOperationPhase;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
jobId?: string;
|
|
20
|
+
sessionFile?: string;
|
|
21
|
+
findingCount: number;
|
|
22
|
+
error?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SecurityCoordinatorHost {
|
|
25
|
+
cwd: string;
|
|
26
|
+
settings: Settings;
|
|
27
|
+
authStorage: AuthStorage;
|
|
28
|
+
modelRegistry: ModelRegistry;
|
|
29
|
+
activeModel?: Model;
|
|
30
|
+
sessionId?: string;
|
|
31
|
+
agentId?: string;
|
|
32
|
+
asyncJobManager?: AsyncJobManager;
|
|
33
|
+
}
|
|
34
|
+
export interface SecurityPreflightInput {
|
|
35
|
+
target?: SecurityTargetRequest;
|
|
36
|
+
knowledgeBasePaths?: string[];
|
|
37
|
+
outputRoot?: string;
|
|
38
|
+
archiveExisting?: boolean;
|
|
39
|
+
credentialId?: number;
|
|
40
|
+
model?: Model;
|
|
41
|
+
thinkingLevel?: string;
|
|
42
|
+
signal?: AbortSignal;
|
|
43
|
+
}
|
|
44
|
+
export interface SecurityStartInput {
|
|
45
|
+
planId: string;
|
|
46
|
+
}
|
|
47
|
+
export interface SecurityScanSession {
|
|
48
|
+
prompt(text: string, options?: {
|
|
49
|
+
expandPromptTemplates?: boolean;
|
|
50
|
+
synthetic?: boolean;
|
|
51
|
+
userInitiated?: boolean;
|
|
52
|
+
}): Promise<boolean>;
|
|
53
|
+
waitForIdle(): Promise<void>;
|
|
54
|
+
getSessionStats?(): {
|
|
55
|
+
tokens: {
|
|
56
|
+
input: number;
|
|
57
|
+
output: number;
|
|
58
|
+
reasoning: number;
|
|
59
|
+
cacheRead: number;
|
|
60
|
+
cacheWrite: number;
|
|
61
|
+
total: number;
|
|
62
|
+
};
|
|
63
|
+
cost: number;
|
|
64
|
+
premiumRequests: number;
|
|
65
|
+
};
|
|
66
|
+
abort(options?: {
|
|
67
|
+
reason?: string;
|
|
68
|
+
}): Promise<void>;
|
|
69
|
+
dispose(): Promise<void>;
|
|
70
|
+
readonly sessionFile?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface SecurityScanSessionFactoryInput {
|
|
73
|
+
host: SecurityCoordinatorHost;
|
|
74
|
+
plan: SecurityScanPlan;
|
|
75
|
+
executionRoot: string;
|
|
76
|
+
scanId: string;
|
|
77
|
+
model: Model;
|
|
78
|
+
publicationTool: ToolDefinition;
|
|
79
|
+
sessionManager: SessionManager;
|
|
80
|
+
}
|
|
81
|
+
export type SecurityScanSessionFactory = (input: SecurityScanSessionFactoryInput) => Promise<SecurityScanSession>;
|
|
82
|
+
export interface SecurityCoordinatorDependencies {
|
|
83
|
+
createSession?: SecurityScanSessionFactory;
|
|
84
|
+
openStore?: (repositoryRoot: string) => Promise<SecurityStore>;
|
|
85
|
+
gitAdapter?: SecurityGitAdapter;
|
|
86
|
+
now?: () => Date;
|
|
87
|
+
createOperationId?: () => string;
|
|
88
|
+
}
|
|
89
|
+
export declare class SecurityCoordinator {
|
|
90
|
+
#private;
|
|
91
|
+
constructor(host: SecurityCoordinatorHost, dependencies?: SecurityCoordinatorDependencies);
|
|
92
|
+
preflight(input?: SecurityPreflightInput): Promise<SecurityScanPlan>;
|
|
93
|
+
start(input: SecurityStartInput): Promise<SecurityOperationSnapshot>;
|
|
94
|
+
status(operationId: string): Promise<SecurityOperationSnapshot | null>;
|
|
95
|
+
listOperations(): Promise<SecurityOperationSnapshot[]>;
|
|
96
|
+
cancel(operationId: string): Promise<boolean>;
|
|
97
|
+
wait(operationId: string): Promise<SecurityOperationSnapshot>;
|
|
98
|
+
}
|
|
99
|
+
export declare function getSecurityCoordinator(host: SecurityCoordinatorHost): SecurityCoordinator;
|
|
100
|
+
export declare function resetSecurityCoordinatorsForTests(): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SecurityScanBundle } from "../contracts/index.js";
|
|
2
|
+
export interface CodexSecurityImportOptions {
|
|
3
|
+
repositoryRoot: string;
|
|
4
|
+
createdAt?: string;
|
|
5
|
+
createScanId?: () => string;
|
|
6
|
+
}
|
|
7
|
+
export declare function importCodexSecurityBundle(bundleDirectory: string, options: CodexSecurityImportOptions): Promise<SecurityScanBundle>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SecurityScanBundle } from "../contracts/index.js";
|
|
2
|
+
export interface SarifImportOptions {
|
|
3
|
+
repositoryRoot: string;
|
|
4
|
+
sourcePath?: string;
|
|
5
|
+
createdAt?: string;
|
|
6
|
+
createScanId?: () => string;
|
|
7
|
+
}
|
|
8
|
+
export declare function importSarif(input: unknown, options: SarifImportOptions): Promise<SecurityScanBundle>;
|
|
9
|
+
export declare function importSarifFile(filePath: string, options: Omit<SarifImportOptions, "sourcePath">): Promise<SecurityScanBundle>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./auth.js";
|
|
2
|
+
export * from "./cloud.js";
|
|
3
|
+
export * from "./comparison.js";
|
|
4
|
+
export * from "./contracts/index.js";
|
|
5
|
+
export * from "./coordinator.js";
|
|
6
|
+
export * from "./importers/index.js";
|
|
7
|
+
export * from "./preflight.js";
|
|
8
|
+
export * from "./provenance.js";
|
|
9
|
+
export * from "./publication.js";
|
|
10
|
+
export * from "./remediation.js";
|
|
11
|
+
export * from "./resource-output.js";
|
|
12
|
+
export * from "./sarif.js";
|
|
13
|
+
export * from "./store.js";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { SecurityAccountRef, SecurityModelRef, SecurityOutputPlan, SecurityScanPlan } from "./contracts/index.js";
|
|
2
|
+
export type SecurityTargetRequest = {
|
|
3
|
+
kind: "repository";
|
|
4
|
+
includePaths?: string[];
|
|
5
|
+
excludePaths?: string[];
|
|
6
|
+
} | {
|
|
7
|
+
kind: "scoped_path";
|
|
8
|
+
includePaths: string[];
|
|
9
|
+
excludePaths?: string[];
|
|
10
|
+
} | {
|
|
11
|
+
kind: "ref_diff";
|
|
12
|
+
baseRevision: string;
|
|
13
|
+
headRevision: string;
|
|
14
|
+
includePaths?: string[];
|
|
15
|
+
excludePaths?: string[];
|
|
16
|
+
} | {
|
|
17
|
+
kind: "working_tree";
|
|
18
|
+
includePaths?: string[];
|
|
19
|
+
excludePaths?: string[];
|
|
20
|
+
};
|
|
21
|
+
export interface SecurityPlanRequest {
|
|
22
|
+
cwd: string;
|
|
23
|
+
target: SecurityTargetRequest;
|
|
24
|
+
knowledgeBasePaths?: string[];
|
|
25
|
+
outputRoot: string;
|
|
26
|
+
archiveExisting?: boolean;
|
|
27
|
+
model: SecurityModelRef;
|
|
28
|
+
account: SecurityAccountRef;
|
|
29
|
+
config: unknown;
|
|
30
|
+
workflowFingerprint: string;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
createdAt?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface SecurityPlanFreshnessInput {
|
|
35
|
+
config: unknown;
|
|
36
|
+
workflowFingerprint: string;
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
}
|
|
39
|
+
export interface SecurityGitAdapter {
|
|
40
|
+
root(cwd: string, signal?: AbortSignal): Promise<string | null>;
|
|
41
|
+
headSha(cwd: string, signal?: AbortSignal): Promise<string | null>;
|
|
42
|
+
resolveRef(cwd: string, refName: string, signal?: AbortSignal): Promise<string | null>;
|
|
43
|
+
diffTree(cwd: string, base: string, head: string, signal?: AbortSignal): Promise<string>;
|
|
44
|
+
status(cwd: string, signal?: AbortSignal): Promise<string>;
|
|
45
|
+
files(cwd: string, signal?: AbortSignal): Promise<string[]>;
|
|
46
|
+
untracked(cwd: string, signal?: AbortSignal): Promise<string[]>;
|
|
47
|
+
}
|
|
48
|
+
export declare const DEFAULT_SECURITY_GIT_ADAPTER: SecurityGitAdapter;
|
|
49
|
+
export declare class StaleSecurityScanPlanError extends Error {
|
|
50
|
+
readonly expected: string;
|
|
51
|
+
readonly actual: string;
|
|
52
|
+
constructor(expected: string, actual: string);
|
|
53
|
+
}
|
|
54
|
+
export declare function pathMatchesSecurityScope(relativePath: string, includePaths: readonly string[], excludePaths: readonly string[]): boolean;
|
|
55
|
+
export interface PreparedSecurityOutput {
|
|
56
|
+
root: string;
|
|
57
|
+
archivedTo?: string;
|
|
58
|
+
}
|
|
59
|
+
export declare function prepareSecurityOutputDirectory(output: SecurityOutputPlan, archiveSuffix?: string): Promise<PreparedSecurityOutput>;
|
|
60
|
+
export declare function createSecurityScanPlan(request: SecurityPlanRequest, adapter?: SecurityGitAdapter): Promise<SecurityScanPlan>;
|
|
61
|
+
export declare function assertSecurityScanPlanFresh(plan: SecurityScanPlan, freshness: SecurityPlanFreshnessInput, adapter?: SecurityGitAdapter): Promise<void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SecurityAccountRef, SecurityProducer, SecurityProvenance, SecurityScan } from "./contracts/index.js";
|
|
2
|
+
export declare const CODEX_SECURITY_UPSTREAM: {
|
|
3
|
+
readonly repository: "https://github.com/openai/codex-security";
|
|
4
|
+
readonly revision: "f22d4a36f26d16287bcdfd707b369116e02a08c3";
|
|
5
|
+
readonly packageVersion: "0.1.1";
|
|
6
|
+
readonly pluginVersion: "0.1.14";
|
|
7
|
+
readonly archiveSha256: "13745c495b7c5cf5273cf2115df86b9c3ec3056f43151c869e004aa3f30bcffb";
|
|
8
|
+
};
|
|
9
|
+
export declare const OMP_SECURITY_WORKFLOW_VERSION = "1.0.0";
|
|
10
|
+
export declare function createNativeSecurityProducer(): SecurityProducer;
|
|
11
|
+
export declare function createSecurityCredentialAffinity(account: SecurityAccountRef): string;
|
|
12
|
+
export declare function redactPrivateSecurityMetadata(value: unknown): unknown;
|
|
13
|
+
export declare function createPublicSecurityScan(scan: SecurityScan, options?: {
|
|
14
|
+
includePlan?: boolean;
|
|
15
|
+
}): unknown;
|
|
16
|
+
export declare function createNativeSecurityProvenance(options: {
|
|
17
|
+
createdAt: string;
|
|
18
|
+
account: SecurityAccountRef;
|
|
19
|
+
planFingerprint: string;
|
|
20
|
+
workflowFingerprint: string;
|
|
21
|
+
sessionId?: string;
|
|
22
|
+
operationId?: string;
|
|
23
|
+
}): SecurityProvenance;
|
|
24
|
+
export declare function createSecurityWorkflowFingerprint(inputs: readonly string[]): string;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ToolDefinition } from "../extensibility/extensions/index.js";
|
|
2
|
+
import type { SecurityScanBundle, SecurityScanPlan } from "./contracts/index.js";
|
|
3
|
+
import { type SecurityStore } from "./store.js";
|
|
4
|
+
export declare const securityPublishSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
5
|
+
findings: {
|
|
6
|
+
rule_id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
summary: string;
|
|
9
|
+
severity: "critical" | "high" | "informational" | "low" | "medium";
|
|
10
|
+
confidence: "high" | "low" | "medium";
|
|
11
|
+
category: string;
|
|
12
|
+
anchor?: string | undefined;
|
|
13
|
+
cwe?: string[] | undefined;
|
|
14
|
+
locations: {
|
|
15
|
+
path: string;
|
|
16
|
+
start_line: number;
|
|
17
|
+
end_line?: number | undefined;
|
|
18
|
+
start_column?: number | undefined;
|
|
19
|
+
end_column?: number | undefined;
|
|
20
|
+
role?: string | undefined;
|
|
21
|
+
}[];
|
|
22
|
+
evidence?: {
|
|
23
|
+
label: string;
|
|
24
|
+
explanation: string;
|
|
25
|
+
excerpt?: string | undefined;
|
|
26
|
+
location?: {
|
|
27
|
+
path: string;
|
|
28
|
+
start_line: number;
|
|
29
|
+
end_line?: number | undefined;
|
|
30
|
+
start_column?: number | undefined;
|
|
31
|
+
end_column?: number | undefined;
|
|
32
|
+
role?: string | undefined;
|
|
33
|
+
} | undefined;
|
|
34
|
+
}[] | undefined;
|
|
35
|
+
remediation?: string | undefined;
|
|
36
|
+
validation?: "partial" | "unvalidated" | "validated" | undefined;
|
|
37
|
+
}[];
|
|
38
|
+
coverage: {
|
|
39
|
+
completeness: "complete" | "partial" | "unknown";
|
|
40
|
+
surfaces?: {
|
|
41
|
+
label: string;
|
|
42
|
+
disposition: "needs_follow_up" | "no_issue_found" | "not_applicable" | "rejected" | "reported";
|
|
43
|
+
risk_area?: string | undefined;
|
|
44
|
+
notes?: string | undefined;
|
|
45
|
+
receipt_refs?: string[] | undefined;
|
|
46
|
+
}[] | undefined;
|
|
47
|
+
explicit_exclusions?: {
|
|
48
|
+
pattern: string;
|
|
49
|
+
reason: string;
|
|
50
|
+
}[] | undefined;
|
|
51
|
+
deferred?: {
|
|
52
|
+
reason: string;
|
|
53
|
+
paths?: string[] | undefined;
|
|
54
|
+
surface_ids?: string[] | undefined;
|
|
55
|
+
}[] | undefined;
|
|
56
|
+
open_questions?: {
|
|
57
|
+
question: string;
|
|
58
|
+
follow_up_prompt?: string | undefined;
|
|
59
|
+
}[] | undefined;
|
|
60
|
+
};
|
|
61
|
+
report: string;
|
|
62
|
+
}, {}>;
|
|
63
|
+
export type SecurityPublishParams = typeof securityPublishSchema.infer;
|
|
64
|
+
export interface SecurityPublishDetails {
|
|
65
|
+
scanId: string;
|
|
66
|
+
findingCount: number;
|
|
67
|
+
status: "completed";
|
|
68
|
+
}
|
|
69
|
+
export interface SecurityPublicationOptions {
|
|
70
|
+
plan: SecurityScanPlan;
|
|
71
|
+
scanId: string;
|
|
72
|
+
store: SecurityStore;
|
|
73
|
+
startedAt: string;
|
|
74
|
+
sessionId?: string;
|
|
75
|
+
operationId?: string;
|
|
76
|
+
onPublished?: (bundle: SecurityScanBundle) => void | Promise<void>;
|
|
77
|
+
}
|
|
78
|
+
export declare function createSecurityPublicationTool(options: SecurityPublicationOptions): ToolDefinition<typeof securityPublishSchema, SecurityPublishDetails>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IsoBackendKind } from "@oh-my-pi/pi-natives";
|
|
2
|
+
import type { IsolationContext } from "../task/isolation-runner.js";
|
|
3
|
+
import type { IsolationHandle, WorktreeBaseline } from "../task/worktree.js";
|
|
4
|
+
export interface SecurityRemediationRequest {
|
|
5
|
+
cwd: string;
|
|
6
|
+
findingIds: string[];
|
|
7
|
+
isolationId?: string;
|
|
8
|
+
preferredBackend?: IsoBackendKind;
|
|
9
|
+
}
|
|
10
|
+
export interface SecurityRemediationWorkspace {
|
|
11
|
+
id: string;
|
|
12
|
+
repositoryRoot: string;
|
|
13
|
+
worktreePath: string;
|
|
14
|
+
findingIds: string[];
|
|
15
|
+
backend: IsoBackendKind;
|
|
16
|
+
fellBack: boolean;
|
|
17
|
+
fallbackReason: string | null;
|
|
18
|
+
cleanup(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export interface SecurityRemediationDependencies {
|
|
21
|
+
prepareContext?: (cwd: string) => Promise<IsolationContext>;
|
|
22
|
+
createIsolation?: (repositoryRoot: string, id: string, preferred?: IsoBackendKind) => Promise<IsolationHandle>;
|
|
23
|
+
cleanupIsolation?: (handle: IsolationHandle) => Promise<void>;
|
|
24
|
+
createId?: () => string;
|
|
25
|
+
}
|
|
26
|
+
export declare function assertSecurityRemediationBaselineClean(baseline: WorktreeBaseline): void;
|
|
27
|
+
export declare function prepareSecurityRemediationWorkspace(request: SecurityRemediationRequest, dependencies?: SecurityRemediationDependencies): Promise<SecurityRemediationWorkspace>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { InternalResource } from "../internal-urls/index.js";
|
|
2
|
+
export interface SecurityResourceOptions {
|
|
3
|
+
url: string;
|
|
4
|
+
content: string;
|
|
5
|
+
contentType: InternalResource["contentType"];
|
|
6
|
+
isDirectory?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function createSecurityResource(options: SecurityResourceOptions): InternalResource;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { SecurityComparisonReport, SecurityDisposition, SecurityEvidence, SecurityFinding, SecurityScan, SecurityScanBundle, SecurityScanPlan, SecurityValidation } from "./contracts/index.js";
|
|
2
|
+
export interface SecurityScanSummary {
|
|
3
|
+
id: string;
|
|
4
|
+
status: SecurityScan["status"];
|
|
5
|
+
createdAt: string;
|
|
6
|
+
completedAt?: string;
|
|
7
|
+
producer: SecurityScan["producer"];
|
|
8
|
+
findingCount: number;
|
|
9
|
+
target: SecurityScan["target"];
|
|
10
|
+
}
|
|
11
|
+
export interface SecurityStoreOptions {
|
|
12
|
+
stateRoot?: string;
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
}
|
|
15
|
+
export interface SecurityFileWriteOptions {
|
|
16
|
+
hardenParent?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function writeSecurityFileAtomic(filePath: string, content: string, options?: SecurityFileWriteOptions): Promise<void>;
|
|
19
|
+
export declare function writeSecurityBundleToDirectory(directory: string, input: SecurityScanBundle): Promise<void>;
|
|
20
|
+
export declare class SecurityStore {
|
|
21
|
+
#private;
|
|
22
|
+
constructor(repositoryRoot: string, projectKey: string, projectDirectory: string);
|
|
23
|
+
static open(repositoryRoot: string, options?: SecurityStoreOptions): Promise<SecurityStore>;
|
|
24
|
+
static openForCwd(cwd: string, options?: SecurityStoreOptions): Promise<SecurityStore>;
|
|
25
|
+
get repositoryRoot(): string;
|
|
26
|
+
get projectKey(): string;
|
|
27
|
+
get projectDirectory(): string;
|
|
28
|
+
putBundle(input: SecurityScanBundle): Promise<void>;
|
|
29
|
+
putPlan(input: SecurityScanPlan): Promise<void>;
|
|
30
|
+
getPlan(planId: string): Promise<SecurityScanPlan | null>;
|
|
31
|
+
listPlans(): Promise<SecurityScanPlan[]>;
|
|
32
|
+
getScan(scanId: string): Promise<SecurityScan | null>;
|
|
33
|
+
getBundle(scanId: string): Promise<SecurityScanBundle | null>;
|
|
34
|
+
listScans(): Promise<SecurityScanSummary[]>;
|
|
35
|
+
getFinding(scanId: string, findingId: string): Promise<SecurityFinding | null>;
|
|
36
|
+
updateDisposition(scanId: string, findingId: string, disposition: SecurityDisposition): Promise<SecurityFinding>;
|
|
37
|
+
updateValidation(scanId: string, findingId: string, validation: SecurityValidation, evidence?: readonly SecurityEvidence[]): Promise<SecurityFinding>;
|
|
38
|
+
compare(beforeScanId: string, afterScanId: string): Promise<SecurityComparisonReport>;
|
|
39
|
+
storeDigest(): Promise<string>;
|
|
40
|
+
}
|
|
@@ -119,6 +119,8 @@ export interface BuildSystemPromptOptions {
|
|
|
119
119
|
workspaceTree?: WorkspaceTree | Promise<WorkspaceTree>;
|
|
120
120
|
/** Whether the local memory://root summary is active. */
|
|
121
121
|
memoryRootEnabled?: boolean;
|
|
122
|
+
/** Whether the read-only security:// resource namespace is active. */
|
|
123
|
+
securityEnabled?: boolean;
|
|
122
124
|
/** Active model identifier (e.g. "anthropic/claude-opus-4") used by prompt policy and optionally surfaced. */
|
|
123
125
|
model?: string;
|
|
124
126
|
/** Whether to surface `model` in the workstation block. Model-specific prompt policy still uses it. Default: true. */
|
|
@@ -18,6 +18,7 @@ import type { LocalProtocolOptions } from "../internal-urls/index.js";
|
|
|
18
18
|
import type { MCPManager } from "../mcp/manager.js";
|
|
19
19
|
import type { MnemopiSessionState } from "../mnemopi/state.js";
|
|
20
20
|
import { type AgentReviver } from "../registry/agent-lifecycle.js";
|
|
21
|
+
import { type CreateAgentSessionOptions } from "../sdk.js";
|
|
21
22
|
import type { AgentSession } from "../session/agent-session.js";
|
|
22
23
|
import type { ArtifactManager } from "../session/artifacts.js";
|
|
23
24
|
import type { AuthStorage } from "../session/auth-storage.js";
|
|
@@ -56,6 +57,8 @@ export interface ExecutorOptions {
|
|
|
56
57
|
cwd: string;
|
|
57
58
|
/** Additional workspace directories to seed on the subagent session (multi-root). */
|
|
58
59
|
additionalDirectories?: string[];
|
|
60
|
+
/** Exact provider credential resolver inherited from the parent session. */
|
|
61
|
+
getApiKey?: CreateAgentSessionOptions["getApiKey"];
|
|
59
62
|
worktree?: string;
|
|
60
63
|
agent: AgentDefinition;
|
|
61
64
|
task: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const BUILTIN_TOOL_NAMES: readonly ["read", "bash", "edit", "ast_grep", "ast_edit", "ask", "debug", "eval", "github", "glob", "grep", "lsp", "inspect_image", "browser", "computer", "checkpoint", "rewind", "task", "hub", "todo", "web_search", "write", "memory_edit", "retain", "recall", "reflect", "learn", "manage_skill"];
|
|
1
|
+
export declare const BUILTIN_TOOL_NAMES: readonly ["read", "bash", "edit", "ast_grep", "ast_edit", "ask", "debug", "eval", "github", "glob", "grep", "lsp", "inspect_image", "browser", "computer", "checkpoint", "rewind", "security_scan", "task", "hub", "todo", "web_search", "write", "memory_edit", "retain", "recall", "reflect", "learn", "manage_skill"];
|
|
2
2
|
export type BuiltinToolName = (typeof BUILTIN_TOOL_NAMES)[number];
|
|
3
3
|
/** Hidden built-ins: constructible and `--tools`-addressable, but never part of the default active set. */
|
|
4
4
|
export declare const HIDDEN_TOOL_NAMES: readonly ["yield", "goal"];
|