@oh-my-pi/pi-coding-agent 17.2.5 → 17.2.7
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 +35 -1
- package/dist/{CHANGELOG-q2w43aw3.md → CHANGELOG-1p8yvde7.md} +35 -1
- package/dist/cli.js +3340 -3339
- package/dist/types/advisor/advise-tool.d.ts +10 -4
- package/dist/types/autoresearch/tools/init-experiment.d.ts +19 -7
- package/dist/types/autoresearch/tools/log-experiment.d.ts +19 -11
- package/dist/types/autoresearch/tools/run-experiment.d.ts +4 -2
- package/dist/types/autoresearch/tools/update-notes.d.ts +5 -2
- package/dist/types/cli/gc-cli.d.ts +1 -0
- package/dist/types/commit/agentic/tools/analyze-file.d.ts +5 -2
- package/dist/types/commit/agentic/tools/git-file-diff.d.ts +5 -2
- package/dist/types/commit/agentic/tools/git-hunk.d.ts +6 -2
- package/dist/types/commit/agentic/tools/git-overview.d.ts +5 -2
- package/dist/types/commit/agentic/tools/propose-changelog.d.ts +29 -7
- package/dist/types/commit/agentic/tools/propose-commit.d.ts +14 -4
- package/dist/types/commit/agentic/tools/recent-commits.d.ts +4 -2
- package/dist/types/commit/agentic/tools/schemas.d.ts +7 -3
- package/dist/types/commit/agentic/tools/split-commit.d.ts +37 -10
- package/dist/types/commit/changelog/generate.d.ts +13 -3
- package/dist/types/commit/shared-llm.d.ts +13 -4
- package/dist/types/config/config-file.d.ts +1 -1
- package/dist/types/config/models-config-schema-bundle.d.ts +1992 -981
- package/dist/types/config/models-config-schema.d.ts +1201 -580
- package/dist/types/config/models-config.d.ts +355 -371
- package/dist/types/edit/hashline/params.d.ts +4 -2
- package/dist/types/edit/modes/apply-patch.d.ts +4 -2
- package/dist/types/edit/modes/patch.d.ts +16 -5
- package/dist/types/edit/modes/replace.d.ts +8 -3
- package/dist/types/eval/bridge-timeout.d.ts +5 -2
- package/dist/types/eval/completion-bridge.d.ts +13 -0
- package/dist/types/eval/py/tool-bridge.d.ts +12 -0
- package/dist/types/extensibility/custom-commands/types.d.ts +4 -4
- package/dist/types/extensibility/custom-tools/types.d.ts +4 -4
- package/dist/types/extensibility/extensions/types.d.ts +4 -4
- package/dist/types/extensibility/hooks/types.d.ts +4 -4
- package/dist/types/extensibility/legacy-pi-ai-shim.d.ts +1 -1
- package/dist/types/extensibility/legacy-pi-coding-agent-shim.d.ts +1 -1
- package/dist/types/extensibility/legacy-typebox.d.ts +8 -0
- package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +6 -13
- package/dist/types/goals/tools/goal-tool.d.ts +12 -4
- package/dist/types/launch/client.d.ts +9 -1
- package/dist/types/launch/protocol.d.ts +17 -0
- package/dist/types/lsp/index.d.ts +15 -5
- package/dist/types/lsp/types.d.ts +15 -5
- package/dist/types/modes/components/btw-panel.d.ts +3 -0
- package/dist/types/modes/controllers/btw-controller.d.ts +2 -0
- package/dist/types/modes/controllers/command-controller.d.ts +1 -0
- package/dist/types/modes/interactive-mode.d.ts +4 -1
- package/dist/types/modes/types.d.ts +3 -1
- package/dist/types/security/contracts/schemas.d.ts +1115 -537
- package/dist/types/security/publication.d.ts +92 -34
- package/dist/types/session/agent-session-types.d.ts +5 -0
- package/dist/types/session/agent-session.d.ts +26 -2
- package/dist/types/session/launch-completion.d.ts +10 -0
- package/dist/types/session/session-entries.d.ts +15 -1
- package/dist/types/session/session-manager.d.ts +7 -0
- package/dist/types/session/yield-queue.d.ts +6 -1
- package/dist/types/task/types.d.ts +63 -18
- package/dist/types/tools/ask.d.ts +34 -8
- package/dist/types/tools/ast-edit.d.ts +16 -4
- package/dist/types/tools/ast-grep.d.ts +12 -4
- package/dist/types/tools/bash.d.ts +20 -11
- package/dist/types/tools/browser.d.ts +64 -20
- package/dist/types/tools/checkpoint.d.ts +16 -8
- package/dist/types/tools/computer.d.ts +1 -1
- package/dist/types/tools/debug.d.ts +118 -48
- package/dist/types/tools/eval.d.ts +11 -5
- package/dist/types/tools/gh.d.ts +74 -26
- package/dist/types/tools/glob.d.ts +16 -6
- package/dist/types/tools/grep.d.ts +18 -6
- package/dist/types/tools/hub/index.d.ts +116 -46
- package/dist/types/tools/image-gen.d.ts +25 -8
- package/dist/types/tools/index.d.ts +9 -0
- package/dist/types/tools/inspect-image.d.ts +10 -4
- package/dist/types/tools/learn.d.ts +26 -8
- package/dist/types/tools/manage-skill.d.ts +16 -6
- package/dist/types/tools/memory-edit.d.ts +18 -6
- package/dist/types/tools/memory-recall.d.ts +8 -4
- package/dist/types/tools/memory-reflect.d.ts +10 -4
- package/dist/types/tools/memory-retain.d.ts +14 -4
- package/dist/types/tools/read.d.ts +8 -4
- package/dist/types/tools/security-scan.d.ts +82 -30
- package/dist/types/tools/todo.d.ts +30 -10
- package/dist/types/tools/tts.d.ts +12 -5
- package/dist/types/tools/vibe.d.ts +42 -18
- package/dist/types/tools/write.d.ts +10 -4
- package/dist/types/web/search/index.d.ts +20 -6
- package/package.json +13 -13
- package/scripts/legacy-pi-virtual-module.ts +2 -2
- package/src/advisor/advise-tool.ts +1 -1
- package/src/advisor/config.ts +1 -1
- package/src/autoresearch/tools/init-experiment.ts +1 -2
- package/src/autoresearch/tools/log-experiment.ts +1 -2
- package/src/autoresearch/tools/run-experiment.ts +1 -1
- package/src/autoresearch/tools/update-notes.ts +1 -1
- package/src/cli/gc-cli.ts +641 -21
- package/src/commit/agentic/tools/analyze-file.ts +1 -1
- package/src/commit/agentic/tools/git-file-diff.ts +1 -1
- package/src/commit/agentic/tools/git-hunk.ts +1 -1
- package/src/commit/agentic/tools/git-overview.ts +1 -1
- package/src/commit/agentic/tools/propose-changelog.ts +1 -1
- package/src/commit/agentic/tools/propose-commit.ts +1 -1
- package/src/commit/agentic/tools/recent-commits.ts +1 -1
- package/src/commit/agentic/tools/schemas.ts +1 -1
- package/src/commit/agentic/tools/split-commit.ts +1 -1
- package/src/commit/analysis/summary.ts +1 -1
- package/src/commit/changelog/generate.ts +1 -1
- package/src/config/config-file.ts +2 -2
- package/src/config/model-discovery.ts +14 -14
- package/src/config/model-registry.ts +10 -8
- package/src/config/models-config-schema-bundle.ts +1 -8
- package/src/config/settings.ts +1 -1
- package/src/discovery/codex.ts +22 -9
- package/src/edit/hashline/params.ts +1 -1
- package/src/edit/modes/apply-patch.ts +1 -1
- package/src/edit/modes/patch.ts +1 -1
- package/src/edit/modes/replace.ts +2 -1
- package/src/eval/agent-bridge.ts +4 -2
- package/src/eval/bridge-timeout.ts +5 -2
- package/src/eval/completion-bridge.ts +3 -2
- package/src/eval/executor-base.ts +20 -1
- package/src/eval/js/context-manager.ts +94 -6
- package/src/eval/py/tool-bridge.ts +29 -9
- package/src/export/html/index.ts +10 -3
- package/src/export/share.ts +4 -0
- package/src/extensibility/custom-commands/loader.ts +3 -3
- package/src/extensibility/custom-commands/types.ts +4 -4
- package/src/extensibility/custom-tools/loader.ts +3 -3
- package/src/extensibility/custom-tools/types.ts +5 -4
- package/src/extensibility/extensions/loader.ts +3 -3
- package/src/extensibility/extensions/types.ts +5 -4
- package/src/extensibility/hooks/loader.ts +3 -3
- package/src/extensibility/hooks/types.ts +4 -4
- package/src/extensibility/legacy-pi-ai-shim.ts +1 -1
- package/src/extensibility/legacy-pi-coding-agent-shim.ts +2 -2
- package/src/extensibility/legacy-typebox.ts +101 -0
- package/src/extensibility/plugins/legacy-pi-compat.ts +13 -22
- package/src/goals/tools/goal-tool.ts +1 -1
- package/src/launch/broker.ts +222 -6
- package/src/launch/client.ts +161 -9
- package/src/launch/protocol.ts +52 -0
- package/src/lsp/types.ts +1 -1
- package/src/main.ts +13 -6
- package/src/mcp/config-writer.ts +1 -1
- package/src/modes/components/btw-panel.ts +41 -4
- package/src/modes/controllers/btw-controller.ts +55 -7
- package/src/modes/controllers/command-controller.ts +31 -0
- package/src/modes/controllers/input-controller.ts +24 -7
- package/src/modes/interactive-mode.ts +16 -2
- package/src/modes/theme/theme.ts +3 -3
- package/src/modes/types.ts +8 -1
- package/src/prompts/session/launch-completion.md +1 -0
- package/src/sdk.ts +15 -0
- package/src/security/contracts/schemas.ts +202 -184
- package/src/security/contracts/validation.ts +6 -2
- package/src/security/publication.ts +1 -1
- package/src/security/store.ts +2 -2
- package/src/session/agent-session-types.ts +6 -0
- package/src/session/agent-session.ts +190 -14
- package/src/session/launch-completion.ts +37 -0
- package/src/session/session-context.ts +26 -0
- package/src/session/session-entries.ts +17 -1
- package/src/session/session-manager.ts +21 -0
- package/src/session/yield-queue.ts +121 -16
- package/src/slash-commands/builtin-registry.ts +10 -1
- package/src/task/types.ts +1 -1
- package/src/tools/ask.ts +1 -1
- package/src/tools/ast-edit.ts +1 -1
- package/src/tools/ast-grep.ts +1 -1
- package/src/tools/bash.ts +61 -3
- package/src/tools/browser/cmux/cmux-tab.ts +92 -4
- package/src/tools/browser.ts +1 -1
- package/src/tools/checkpoint.ts +1 -1
- package/src/tools/computer.ts +1 -1
- package/src/tools/debug.ts +1 -1
- package/src/tools/eval.ts +1 -1
- package/src/tools/gh.ts +1 -2
- package/src/tools/glob.ts +1 -1
- package/src/tools/grep.ts +1 -1
- package/src/tools/hub/index.ts +1 -1
- package/src/tools/hub/launch.ts +122 -6
- package/src/tools/image-gen.ts +1 -1
- package/src/tools/index.ts +9 -0
- package/src/tools/inspect-image.ts +1 -1
- package/src/tools/learn.ts +1 -1
- package/src/tools/manage-skill.ts +1 -1
- package/src/tools/memory-edit.ts +1 -1
- package/src/tools/memory-recall.ts +1 -1
- package/src/tools/memory-reflect.ts +1 -1
- package/src/tools/memory-retain.ts +1 -1
- package/src/tools/read.ts +1 -1
- package/src/tools/security-scan.ts +1 -1
- package/src/tools/todo.ts +1 -1
- package/src/tools/tts.ts +1 -1
- package/src/tools/vibe.ts +2 -1
- package/src/tools/write.ts +1 -1
- package/src/web/search/index.ts +2 -1
- package/dist/types/config/file-lock.d.ts +0 -29
- package/dist/types/extensibility/typebox.d.ts +0 -181
- package/src/config/file-lock.ts +0 -164
- package/src/extensibility/typebox.ts +0 -958
|
@@ -1,201 +1,219 @@
|
|
|
1
|
-
import { type } from "
|
|
1
|
+
import { type } from "@oh-my-pi/omptype";
|
|
2
|
+
import { once } from "@oh-my-pi/pi-utils";
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
4
|
+
export const getSecurityContractSchemas = once(() => {
|
|
5
|
+
const stringRecordSchema = type({ "[string]": "string" });
|
|
6
|
+
const unknownRecordSchema = type({ "[string]": "unknown" });
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"revision?": "string",
|
|
12
|
-
"pluginVersion?": "string",
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const securityProvenanceSchema = type({
|
|
16
|
-
producer: securityProducerSchema,
|
|
17
|
-
createdAt: "string > 0",
|
|
18
|
-
"importedAt?": "string",
|
|
19
|
-
"sourceIds?": stringRecordSchema,
|
|
20
|
-
"vendorFingerprints?": stringRecordSchema,
|
|
21
|
-
"upstream?": {
|
|
22
|
-
"repository?": "string",
|
|
8
|
+
const securityProducerSchema = type({
|
|
9
|
+
kind: "'omp-native' | 'codex-security-bundle' | 'codex-security-cloud' | 'sarif-import'",
|
|
10
|
+
name: "string > 0",
|
|
11
|
+
"version?": "string",
|
|
12
|
+
"vendor?": "string",
|
|
23
13
|
"revision?": "string",
|
|
24
|
-
"packageVersion?": "string",
|
|
25
14
|
"pluginVersion?": "string",
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
"metadata?": unknownRecordSchema,
|
|
29
|
-
});
|
|
15
|
+
});
|
|
30
16
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
const securityProvenanceSchema = type({
|
|
18
|
+
producer: securityProducerSchema,
|
|
19
|
+
createdAt: "string > 0",
|
|
20
|
+
"importedAt?": "string",
|
|
21
|
+
"sourceIds?": stringRecordSchema,
|
|
22
|
+
"vendorFingerprints?": stringRecordSchema,
|
|
23
|
+
"upstream?": {
|
|
24
|
+
"repository?": "string",
|
|
25
|
+
"revision?": "string",
|
|
26
|
+
"packageVersion?": "string",
|
|
27
|
+
"pluginVersion?": "string",
|
|
28
|
+
"archiveSha256?": "string",
|
|
29
|
+
},
|
|
30
|
+
"metadata?": unknownRecordSchema,
|
|
31
|
+
});
|
|
39
32
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
33
|
+
const securityLocationSchema = type({
|
|
34
|
+
path: "string > 0",
|
|
35
|
+
startLine: "number.integer >= 1",
|
|
36
|
+
"endLine?": "number.integer >= 1",
|
|
37
|
+
"startColumn?": "number.integer >= 1",
|
|
38
|
+
"endColumn?": "number.integer >= 1",
|
|
39
|
+
"role?": "string",
|
|
40
|
+
});
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
const securityEvidenceSchema = type({
|
|
43
|
+
id: "string > 0",
|
|
44
|
+
kind: "'code' | 'trace' | 'validation' | 'note'",
|
|
45
|
+
label: "string > 0",
|
|
46
|
+
explanation: "string",
|
|
47
|
+
"location?": securityLocationSchema,
|
|
48
|
+
"excerpt?": "string",
|
|
49
|
+
});
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
fingerprint: "string > 0",
|
|
59
|
-
ruleId: "string > 0",
|
|
60
|
-
"anchor?": "string",
|
|
61
|
-
title: "string > 0",
|
|
62
|
-
summary: "string",
|
|
63
|
-
severity: {
|
|
64
|
-
level: "'critical' | 'high' | 'medium' | 'low' | 'informational'",
|
|
65
|
-
"score?": "number",
|
|
66
|
-
"scoringSystem?": "string",
|
|
67
|
-
"vector?": "string",
|
|
68
|
-
"rationale?": "string",
|
|
69
|
-
},
|
|
70
|
-
confidence: {
|
|
71
|
-
level: "'high' | 'medium' | 'low'",
|
|
72
|
-
"rationale?": "string",
|
|
73
|
-
},
|
|
74
|
-
taxonomy: {
|
|
75
|
-
category: "string > 0",
|
|
76
|
-
cwe: "string[]",
|
|
77
|
-
"tags?": "string[]",
|
|
78
|
-
},
|
|
79
|
-
occurrences: securityOccurrenceSchema.array().atLeastLength(1),
|
|
80
|
-
evidence: securityEvidenceSchema.array(),
|
|
81
|
-
"remediation?": "string",
|
|
82
|
-
validation: {
|
|
83
|
-
status: "'unvalidated' | 'validated' | 'rejected' | 'partial' | 'error'",
|
|
84
|
-
"summary?": "string",
|
|
51
|
+
const securityOccurrenceSchema = type({
|
|
52
|
+
id: "string > 0",
|
|
53
|
+
locations: securityLocationSchema.array().atLeastLength(1),
|
|
85
54
|
evidenceIds: "string[]",
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
disposition: {
|
|
89
|
-
status: "'open' | 'false_positive' | 'accepted_risk' | 'fixed' | 'wont_fix'",
|
|
90
|
-
"rationale?": "string",
|
|
91
|
-
"updatedAt?": "string",
|
|
92
|
-
"actor?": "string",
|
|
93
|
-
},
|
|
94
|
-
provenance: securityProvenanceSchema,
|
|
95
|
-
"extensions?": unknownRecordSchema,
|
|
96
|
-
});
|
|
55
|
+
});
|
|
97
56
|
|
|
98
|
-
|
|
99
|
-
mode: "'repository' | 'scoped_path' | 'diff' | 'working_tree' | 'deep_repository' | 'imported'",
|
|
100
|
-
completeness: "'complete' | 'partial' | 'unknown'",
|
|
101
|
-
inventoryStrategy: "'repository' | 'scoped_path' | 'diff' | 'directory' | 'custom' | 'imported'",
|
|
102
|
-
includePaths: "string[]",
|
|
103
|
-
excludePaths: "string[]",
|
|
104
|
-
surfaces: type({
|
|
105
|
-
id: "string > 0",
|
|
106
|
-
label: "string > 0",
|
|
107
|
-
disposition: "'reported' | 'no_issue_found' | 'rejected' | 'not_applicable' | 'needs_follow_up'",
|
|
108
|
-
receiptRefs: "string[]",
|
|
109
|
-
"riskArea?": "string",
|
|
110
|
-
"notes?": "string",
|
|
111
|
-
}).array(),
|
|
112
|
-
explicitExclusions: type({ pattern: "string", reason: "string" }).array(),
|
|
113
|
-
deferred: type({
|
|
57
|
+
const securityFindingSchema = type({
|
|
114
58
|
id: "string > 0",
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
59
|
+
scanId: "string > 0",
|
|
60
|
+
fingerprint: "string > 0",
|
|
61
|
+
ruleId: "string > 0",
|
|
62
|
+
"anchor?": "string",
|
|
63
|
+
title: "string > 0",
|
|
64
|
+
summary: "string",
|
|
65
|
+
severity: {
|
|
66
|
+
level: "'critical' | 'high' | 'medium' | 'low' | 'informational'",
|
|
67
|
+
"score?": "number",
|
|
68
|
+
"scoringSystem?": "string",
|
|
69
|
+
"vector?": "string",
|
|
70
|
+
"rationale?": "string",
|
|
71
|
+
},
|
|
72
|
+
confidence: {
|
|
73
|
+
level: "'high' | 'medium' | 'low'",
|
|
74
|
+
"rationale?": "string",
|
|
75
|
+
},
|
|
76
|
+
taxonomy: {
|
|
77
|
+
category: "string > 0",
|
|
78
|
+
cwe: "string[]",
|
|
79
|
+
"tags?": "string[]",
|
|
80
|
+
},
|
|
81
|
+
occurrences: securityOccurrenceSchema.array().atLeastLength(1),
|
|
82
|
+
evidence: securityEvidenceSchema.array(),
|
|
83
|
+
"remediation?": "string",
|
|
84
|
+
validation: {
|
|
85
|
+
status: "'unvalidated' | 'validated' | 'rejected' | 'partial' | 'error'",
|
|
86
|
+
"summary?": "string",
|
|
87
|
+
evidenceIds: "string[]",
|
|
88
|
+
"validatedAt?": "string",
|
|
89
|
+
},
|
|
90
|
+
disposition: {
|
|
91
|
+
status: "'open' | 'false_positive' | 'accepted_risk' | 'fixed' | 'wont_fix'",
|
|
92
|
+
"rationale?": "string",
|
|
93
|
+
"updatedAt?": "string",
|
|
94
|
+
"actor?": "string",
|
|
95
|
+
},
|
|
96
|
+
provenance: securityProvenanceSchema,
|
|
97
|
+
"extensions?": unknownRecordSchema,
|
|
98
|
+
});
|
|
121
99
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
100
|
+
const securityCoverageSchema = type({
|
|
101
|
+
mode: "'repository' | 'scoped_path' | 'diff' | 'working_tree' | 'deep_repository' | 'imported'",
|
|
102
|
+
completeness: "'complete' | 'partial' | 'unknown'",
|
|
103
|
+
inventoryStrategy: "'repository' | 'scoped_path' | 'diff' | 'directory' | 'custom' | 'imported'",
|
|
104
|
+
includePaths: "string[]",
|
|
105
|
+
excludePaths: "string[]",
|
|
106
|
+
surfaces: type({
|
|
107
|
+
id: "string > 0",
|
|
108
|
+
label: "string > 0",
|
|
109
|
+
disposition: "'reported' | 'no_issue_found' | 'rejected' | 'not_applicable' | 'needs_follow_up'",
|
|
110
|
+
receiptRefs: "string[]",
|
|
111
|
+
"riskArea?": "string",
|
|
112
|
+
"notes?": "string",
|
|
113
|
+
}).array(),
|
|
114
|
+
explicitExclusions: type({ pattern: "string", reason: "string" }).array(),
|
|
115
|
+
deferred: type({
|
|
116
|
+
id: "string > 0",
|
|
117
|
+
reason: "string > 0",
|
|
118
|
+
"paths?": "string[]",
|
|
119
|
+
"surfaceIds?": "string[]",
|
|
120
|
+
}).array(),
|
|
121
|
+
"openQuestions?": type({ question: "string > 0", "followUpPrompt?": "string" }).array(),
|
|
122
|
+
});
|
|
133
123
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
existingState: "'absent' | 'empty' | 'archivable'",
|
|
146
|
-
},
|
|
147
|
-
model: { provider: "string > 0", modelId: "string > 0", "thinkingLevel?": "string" },
|
|
148
|
-
account: {
|
|
149
|
-
provider: "string > 0",
|
|
150
|
-
credentialId: "number.integer >= 1",
|
|
151
|
-
"accountId?": "string",
|
|
152
|
-
"email?": "string",
|
|
153
|
-
"organizationId?": "string",
|
|
154
|
-
"organizationName?": "string",
|
|
155
|
-
},
|
|
156
|
-
configFingerprint: "string > 0",
|
|
157
|
-
workflowFingerprint: "string > 0",
|
|
158
|
-
fingerprint: "string > 0",
|
|
159
|
-
});
|
|
124
|
+
const securityTargetSchema = type({
|
|
125
|
+
kind: "'repository' | 'scoped_path' | 'ref_diff' | 'working_tree' | 'imported'",
|
|
126
|
+
repositoryRoot: "string > 0",
|
|
127
|
+
displayName: "string > 0",
|
|
128
|
+
"revision?": "string",
|
|
129
|
+
"baseRevision?": "string",
|
|
130
|
+
"headRevision?": "string",
|
|
131
|
+
includePaths: "string[]",
|
|
132
|
+
excludePaths: "string[]",
|
|
133
|
+
treeDigest: "string > 0",
|
|
134
|
+
});
|
|
160
135
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
136
|
+
const securityScanPlanSchema = type({
|
|
137
|
+
documentType: "'omp-security.scan-plan'",
|
|
138
|
+
schemaVersion: "'1.0'",
|
|
139
|
+
id: "string > 0",
|
|
140
|
+
createdAt: "string > 0",
|
|
141
|
+
repositoryRoot: "string > 0",
|
|
142
|
+
target: securityTargetSchema,
|
|
143
|
+
knowledgeBases: type({ path: "string > 0", sha256: "string > 0", size: "number.integer >= 0" }).array(),
|
|
144
|
+
output: {
|
|
145
|
+
root: "string > 0",
|
|
146
|
+
archiveExisting: "boolean",
|
|
147
|
+
existingState: "'absent' | 'empty' | 'archivable'",
|
|
148
|
+
},
|
|
149
|
+
model: { provider: "string > 0", modelId: "string > 0", "thinkingLevel?": "string" },
|
|
150
|
+
account: {
|
|
151
|
+
provider: "string > 0",
|
|
152
|
+
credentialId: "number.integer >= 1",
|
|
153
|
+
"accountId?": "string",
|
|
154
|
+
"email?": "string",
|
|
155
|
+
"organizationId?": "string",
|
|
156
|
+
"organizationName?": "string",
|
|
157
|
+
},
|
|
158
|
+
configFingerprint: "string > 0",
|
|
159
|
+
workflowFingerprint: "string > 0",
|
|
160
|
+
fingerprint: "string > 0",
|
|
161
|
+
});
|
|
174
162
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
163
|
+
const securityScanMetricsSchema = type({
|
|
164
|
+
"runtimeMs?": "number >= 0",
|
|
165
|
+
"tokenUsage?": {
|
|
166
|
+
input: "number >= 0",
|
|
167
|
+
output: "number >= 0",
|
|
168
|
+
reasoning: "number >= 0",
|
|
169
|
+
cacheRead: "number >= 0",
|
|
170
|
+
cacheWrite: "number >= 0",
|
|
171
|
+
total: "number >= 0",
|
|
172
|
+
},
|
|
173
|
+
"cost?": "number >= 0",
|
|
174
|
+
"premiumRequests?": "number >= 0",
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const securityScanSchema = type({
|
|
178
|
+
documentType: "'omp-security.scan'",
|
|
179
|
+
schemaVersion: "'1.0'",
|
|
180
|
+
id: "string > 0",
|
|
181
|
+
projectKey: "string > 0",
|
|
182
|
+
status: "'planned' | 'running' | 'completed' | 'partial' | 'cancelled' | 'failed'",
|
|
183
|
+
createdAt: "string > 0",
|
|
184
|
+
"startedAt?": "string",
|
|
185
|
+
"completedAt?": "string",
|
|
186
|
+
"plan?": securityScanPlanSchema,
|
|
187
|
+
target: securityTargetSchema,
|
|
188
|
+
producer: securityProducerSchema,
|
|
189
|
+
provenance: securityProvenanceSchema,
|
|
190
|
+
findingIds: "string[]",
|
|
191
|
+
coverage: securityCoverageSchema,
|
|
192
|
+
"reportRef?": "string",
|
|
193
|
+
"sarifRef?": "string",
|
|
194
|
+
"error?": "string",
|
|
195
|
+
"metrics?": securityScanMetricsSchema,
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
const securityScanBundleSchema = type({
|
|
199
|
+
scan: securityScanSchema,
|
|
200
|
+
findings: securityFindingSchema.array(),
|
|
201
|
+
"report?": "string",
|
|
202
|
+
"sarif?": unknownRecordSchema,
|
|
203
|
+
});
|
|
195
204
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
205
|
+
return {
|
|
206
|
+
securityProducerSchema,
|
|
207
|
+
securityProvenanceSchema,
|
|
208
|
+
securityLocationSchema,
|
|
209
|
+
securityEvidenceSchema,
|
|
210
|
+
securityOccurrenceSchema,
|
|
211
|
+
securityFindingSchema,
|
|
212
|
+
securityCoverageSchema,
|
|
213
|
+
securityTargetSchema,
|
|
214
|
+
securityScanPlanSchema,
|
|
215
|
+
securityScanMetricsSchema,
|
|
216
|
+
securityScanSchema,
|
|
217
|
+
securityScanBundleSchema,
|
|
218
|
+
};
|
|
201
219
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type } from "
|
|
2
|
-
import {
|
|
1
|
+
import { type } from "@oh-my-pi/omptype";
|
|
2
|
+
import { getSecurityContractSchemas } from "./schemas";
|
|
3
3
|
import type { SecurityFinding, SecurityScan, SecurityScanBundle, SecurityScanPlan } from "./types";
|
|
4
4
|
|
|
5
5
|
function schemaError(label: string, errors: type.errors): Error {
|
|
@@ -7,24 +7,28 @@ function schemaError(label: string, errors: type.errors): Error {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function parseSecurityFinding(value: unknown): SecurityFinding {
|
|
10
|
+
const { securityFindingSchema } = getSecurityContractSchemas();
|
|
10
11
|
const result = securityFindingSchema(value);
|
|
11
12
|
if (result instanceof type.errors) throw schemaError("Security finding", result);
|
|
12
13
|
return result as SecurityFinding;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export function parseSecurityScan(value: unknown): SecurityScan {
|
|
17
|
+
const { securityScanSchema } = getSecurityContractSchemas();
|
|
16
18
|
const result = securityScanSchema(value);
|
|
17
19
|
if (result instanceof type.errors) throw schemaError("Security scan", result);
|
|
18
20
|
return result as SecurityScan;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export function parseSecurityScanPlan(value: unknown): SecurityScanPlan {
|
|
24
|
+
const { securityScanPlanSchema } = getSecurityContractSchemas();
|
|
22
25
|
const result = securityScanPlanSchema(value);
|
|
23
26
|
if (result instanceof type.errors) throw schemaError("Security scan plan", result);
|
|
24
27
|
return result as SecurityScanPlan;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
export function parseSecurityScanBundle(value: unknown): SecurityScanBundle {
|
|
31
|
+
const { securityScanBundleSchema } = getSecurityContractSchemas();
|
|
28
32
|
const result = securityScanBundleSchema(value);
|
|
29
33
|
if (result instanceof type.errors) throw schemaError("Security scan bundle", result);
|
|
30
34
|
const bundle = result as SecurityScanBundle;
|
package/src/security/store.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { getSecurityProjectDir, isEnoent } from "@oh-my-pi/pi-utils";
|
|
4
|
-
import { withFileLock } from "
|
|
4
|
+
import { withFileLock } from "@oh-my-pi/pi-utils/file-lock";
|
|
5
5
|
import * as git from "../utils/git";
|
|
6
6
|
import { compareSecurityLineage } from "./comparison";
|
|
7
7
|
import type {
|
|
@@ -34,7 +34,7 @@ const SECURITY_STORE_WRITE_CHAINS = new Map<string, Promise<unknown>>();
|
|
|
34
34
|
async function withSecurityStoreWrite<T>(key: string, operation: () => Promise<T>): Promise<T> {
|
|
35
35
|
const lockTarget = path.join(key, "index.json");
|
|
36
36
|
const run = (SECURITY_STORE_WRITE_CHAINS.get(key) ?? Promise.resolve()).then(() =>
|
|
37
|
-
withFileLock(lockTarget, operation, {
|
|
37
|
+
withFileLock(lockTarget, operation, { retries: 200, retryDelayMs: 50 }),
|
|
38
38
|
);
|
|
39
39
|
const guarded = run.catch(() => undefined);
|
|
40
40
|
SECURITY_STORE_WRITE_CHAINS.set(key, guarded);
|
|
@@ -389,5 +389,11 @@ export interface FreshSessionResult {
|
|
|
389
389
|
closedProviderSessions: number;
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
+
/** Outcome of an in-place `/clear` conversation-context reset. */
|
|
393
|
+
export interface ResetSessionContextResult {
|
|
394
|
+
/** Number of live messages dropped from the model's context. */
|
|
395
|
+
droppedCount: number;
|
|
396
|
+
}
|
|
397
|
+
|
|
392
398
|
/** Queued user content restored to the editor. */
|
|
393
399
|
export type RestoredQueuedMessage = { text: string; images?: ImageContent[] };
|