@sema-agent/core 5.17.0 → 5.18.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 +121 -0
- package/dist/agents/subagent.js +24 -0
- package/dist/core/auto-compaction.d.ts +6 -0
- package/dist/core/auto-compaction.js +15 -1
- package/dist/core/checkpoint-store.d.ts +4 -2
- package/dist/core/governance-codes.js +1 -0
- package/dist/core/hooks.d.ts +9 -0
- package/dist/core/hooks.js +21 -0
- package/dist/core/mcp.js +3 -0
- package/dist/core/memory-engine/content-origin.d.ts +27 -0
- package/dist/core/memory-engine/content-origin.js +38 -0
- package/dist/core/memory-engine/engine.d.ts +12 -2
- package/dist/core/memory-engine/engine.js +172 -12
- package/dist/core/memory-engine/file-backend.d.ts +4 -0
- package/dist/core/memory-engine/file-backend.js +25 -3
- package/dist/core/memory-engine/index.d.ts +2 -1
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +16 -0
- package/dist/core/memory-engine/layout.js +90 -2
- package/dist/core/memory-engine/sync-client.d.ts +1 -0
- package/dist/core/memory-engine/sync-client.js +23 -5
- package/dist/core/memory-engine/tools.d.ts +55 -0
- package/dist/core/memory-engine/tools.js +307 -0
- package/dist/core/memory-engine/types.d.ts +1 -1
- package/dist/core/memory.d.ts +4 -0
- package/dist/core/memory.js +15 -2
- package/dist/core/permission-rule-consent.d.ts +138 -0
- package/dist/core/permission-rule-consent.js +318 -0
- package/dist/core/permission-rule-model.d.ts +66 -0
- package/dist/core/permission-rule-model.js +135 -0
- package/dist/core/permission-rule-store.d.ts +89 -0
- package/dist/core/permission-rule-store.js +145 -0
- package/dist/core/permission-rules.d.ts +3 -2
- package/dist/core/permission-rules.js +9 -4
- package/dist/core/runner/prepare-memory.d.ts +3 -1
- package/dist/core/runner/prepare-memory.js +54 -14
- package/dist/core/runner/prepare-task.d.ts +12 -0
- package/dist/core/runner/prepare-task.js +206 -12
- package/dist/core/runner/runtask.d.ts +3 -1
- package/dist/core/runner/runtask.js +47 -5
- package/dist/core/runner/tool-output-projection.js +1 -1
- package/dist/core/tool-policy.d.ts +13 -1
- package/dist/core/tool-policy.js +93 -12
- package/dist/core/tools.js +1 -0
- package/dist/core/trace.d.ts +20 -0
- package/dist/core/types.d.ts +15 -0
- package/dist/core/wiring-manifest.d.ts +5 -1
- package/dist/core/wiring-manifest.js +2 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +6 -2
- package/dist/stores/file/permission-rule-store.d.ts +32 -0
- package/dist/stores/file/permission-rule-store.js +213 -0
- package/dist/tools/fs/fs-bash.js +12 -5
- package/dist/tools/fs/fs-shared.d.ts +12 -0
- package/dist/tools/fs/fs-shared.js +65 -1
- package/dist/tools/web.js +2 -0
- package/package.json +1 -1
package/dist/core/tool-policy.js
CHANGED
|
@@ -3,7 +3,12 @@ import { isAbsolute, join, normalize as normalizePath, sep } from "node:path";
|
|
|
3
3
|
import { BASH_READONLY_DEFAULT_ALLOW, parseLeadingCommandName } from "../tools/fs/index.js";
|
|
4
4
|
import { boundInputHashOf } from "./canonical-json.js";
|
|
5
5
|
import { inlineUntrusted } from "./untrusted-text.js";
|
|
6
|
+
import { parsePermissionRule } from "./permission-rules.js";
|
|
6
7
|
import { writeTargetPath } from "../tools/fs/safety.js";
|
|
8
|
+
export const APPROVAL_SETTLED_BY_VALUES = ["human", "timeout", "aborted"];
|
|
9
|
+
export function isApprovalSettledBy(v) {
|
|
10
|
+
return typeof v === "string" && APPROVAL_SETTLED_BY_VALUES.includes(v);
|
|
11
|
+
}
|
|
7
12
|
export function decisionText(d) {
|
|
8
13
|
return d.message;
|
|
9
14
|
}
|
|
@@ -18,6 +23,7 @@ export function refuseOutOfContractDecision(d) {
|
|
|
18
23
|
return d;
|
|
19
24
|
return { action: "deny", message: RETIRED_TEXT_FIELD_DENY_MESSAGE, decisionReason: "rule" };
|
|
20
25
|
}
|
|
26
|
+
const DEADLINE_ELAPSED = Symbol("approval.deadline_elapsed");
|
|
21
27
|
function withTimeout(p, ms, onTimeout) {
|
|
22
28
|
if (ms === undefined) {
|
|
23
29
|
return p;
|
|
@@ -44,6 +50,53 @@ export function toolPolicyNameSets(p) {
|
|
|
44
50
|
return Array.isArray(sets) ? sets : [];
|
|
45
51
|
}
|
|
46
52
|
export function createAllowDenyPolicy(opts) {
|
|
53
|
+
const invalid = [];
|
|
54
|
+
const screen = (entries, list) => {
|
|
55
|
+
if (entries === undefined)
|
|
56
|
+
return undefined;
|
|
57
|
+
const kept = [];
|
|
58
|
+
for (const entry of entries) {
|
|
59
|
+
if (entry.startsWith("mcp__")) {
|
|
60
|
+
const segments = entry.slice("mcp__".length).split("__");
|
|
61
|
+
if (segments.some((seg) => seg.length === 0)) {
|
|
62
|
+
invalid.push({
|
|
63
|
+
entry,
|
|
64
|
+
list,
|
|
65
|
+
message: `"${entry}" is a malformed MCP tool name (empty segment) — it can never match any mounted tool. ` +
|
|
66
|
+
`Use \`mcp__<server>\` for every tool of a server, or \`mcp__<server>__<tool>\` for one tool.`,
|
|
67
|
+
});
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (parsePermissionRule(entry).ruleContent === undefined) {
|
|
72
|
+
kept.push(entry);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
invalid.push({
|
|
76
|
+
entry,
|
|
77
|
+
list,
|
|
78
|
+
message: `"${entry}" is a rule CONTENT form, not a tool name — a name set matches raw tool names, so this entry ` +
|
|
79
|
+
`can never match any mounted tool (in an allow list it removes the tool entirely). Use the tool NAME here, ` +
|
|
80
|
+
`and route the narrowing through the lane that speaks this grammar: parameter rules via ` +
|
|
81
|
+
`createPermissionRulePolicy, Bash command prefixes via the persisted allow-rule lane.`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return kept;
|
|
85
|
+
};
|
|
86
|
+
const screenedAllow = screen(opts.allow, "allow");
|
|
87
|
+
const screenedDeny = screen(opts.deny, "deny");
|
|
88
|
+
if (invalid.length > 0) {
|
|
89
|
+
if ((opts.onInvalidName ?? "throw") === "throw") {
|
|
90
|
+
const e = new Error(`createAllowDenyPolicy: ${invalid.length} entr${invalid.length === 1 ? "y is" : "ies are"} not tool name(s):\n` +
|
|
91
|
+
invalid.map((i) => ` [${i.list}] ${i.message}`).join("\n"));
|
|
92
|
+
e.code = "config.invalid_tool_name_set";
|
|
93
|
+
e.issues = invalid;
|
|
94
|
+
throw e;
|
|
95
|
+
}
|
|
96
|
+
for (const issue of invalid)
|
|
97
|
+
opts.onInvalidNameIssue?.(issue);
|
|
98
|
+
}
|
|
99
|
+
opts = { ...opts, ...(screenedAllow ? { allow: screenedAllow } : {}), ...(screenedDeny ? { deny: screenedDeny } : {}) };
|
|
47
100
|
const allow = opts.allow ? new Set(opts.allow) : undefined;
|
|
48
101
|
const deny = new Set(opts.deny ?? []);
|
|
49
102
|
return {
|
|
@@ -82,25 +135,37 @@ export function createApprovalPolicy(opts) {
|
|
|
82
135
|
}
|
|
83
136
|
if (need.has(toolName)) {
|
|
84
137
|
if (signal?.aborted) {
|
|
85
|
-
return { action: "deny", message: `approval aborted for "${req.toolName}" (task ended)
|
|
138
|
+
return { action: "deny", message: `approval aborted for "${req.toolName}" (task ended)`, settledBy: "aborted" };
|
|
86
139
|
}
|
|
87
140
|
let ok;
|
|
88
141
|
try {
|
|
89
|
-
ok = await withTimeout(Promise.resolve(opts.approve(req, signal)), opts.approvalTimeoutMs, () =>
|
|
142
|
+
ok = await withTimeout(Promise.resolve(opts.approve(req, signal)), opts.approvalTimeoutMs, () => DEADLINE_ELAPSED);
|
|
90
143
|
}
|
|
91
144
|
catch (err) {
|
|
92
145
|
return {
|
|
93
146
|
action: "deny",
|
|
94
147
|
message: `approval errored for "${req.toolName}": ${describeThrown(err)}`,
|
|
148
|
+
settledBy: "aborted",
|
|
95
149
|
};
|
|
96
150
|
}
|
|
151
|
+
if (ok === DEADLINE_ELAPSED) {
|
|
152
|
+
return {
|
|
153
|
+
action: "deny",
|
|
154
|
+
message: `no one answered the approval request for "${req.toolName}" — the approval window elapsed ` +
|
|
155
|
+
`(${opts.approvalTimeoutMs}ms) with no answer; denied fail-closed`,
|
|
156
|
+
settledBy: "timeout",
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if (signal?.aborted) {
|
|
160
|
+
return { action: "deny", message: `approval aborted for "${req.toolName}" (task ended)`, settledBy: "aborted" };
|
|
161
|
+
}
|
|
97
162
|
const okRaw = ok;
|
|
98
163
|
if (okRaw === true)
|
|
99
|
-
return
|
|
164
|
+
return { action: "allow", settledBy: "human" };
|
|
100
165
|
if (okRaw !== false) {
|
|
101
|
-
return { action: "deny", message: `approval callback for "${req.toolName}" returned an out-of-contract value (${typeof ok}) — denied fail-closed (this policy's \`approve\` returns a boolean: return true or false)
|
|
166
|
+
return { action: "deny", message: `approval callback for "${req.toolName}" returned an out-of-contract value (${typeof ok}) — denied fail-closed (this policy's \`approve\` returns a boolean: return true or false)`, settledBy: "aborted" };
|
|
102
167
|
}
|
|
103
|
-
return { action: "deny", message: `approval denied for "${req.toolName}"
|
|
168
|
+
return { action: "deny", message: `approval denied for "${req.toolName}"`, settledBy: "human" };
|
|
104
169
|
}
|
|
105
170
|
if (opts.denyByDefault && !auto.has(toolName)) {
|
|
106
171
|
return { action: "deny", message: `tool "${req.toolName}" requires explicit allow` };
|
|
@@ -117,6 +182,7 @@ export function combinePolicies(...policies) {
|
|
|
117
182
|
let asked;
|
|
118
183
|
let current = req;
|
|
119
184
|
let rewrite;
|
|
185
|
+
let settled;
|
|
120
186
|
for (const p of policies) {
|
|
121
187
|
const d = refuseOutOfContractDecision(await p.check(current, signal));
|
|
122
188
|
if (d.action === "deny") {
|
|
@@ -126,6 +192,11 @@ export function combinePolicies(...policies) {
|
|
|
126
192
|
current = { ...current, args: d.updatedInput };
|
|
127
193
|
rewrite = d;
|
|
128
194
|
}
|
|
195
|
+
if (d.action === "allow") {
|
|
196
|
+
const supplied = d.settledBy;
|
|
197
|
+
if (supplied !== undefined)
|
|
198
|
+
settled = supplied;
|
|
199
|
+
}
|
|
129
200
|
if (d.action === "ask" && (asked === undefined || (d.requiresRealApproval === true && asked.requiresRealApproval !== true))) {
|
|
130
201
|
asked = d;
|
|
131
202
|
}
|
|
@@ -134,7 +205,8 @@ export function combinePolicies(...policies) {
|
|
|
134
205
|
const merged = rewrite?.updatedInput;
|
|
135
206
|
return merged !== undefined ? { ...asked, updatedInput: merged } : asked;
|
|
136
207
|
}
|
|
137
|
-
|
|
208
|
+
const allowed = rewrite ?? ALLOW;
|
|
209
|
+
return settled !== undefined ? { ...allowed, settledBy: settled } : allowed;
|
|
138
210
|
},
|
|
139
211
|
};
|
|
140
212
|
}
|
|
@@ -607,7 +679,7 @@ export async function resolveAsk(req, onAsk, signal) {
|
|
|
607
679
|
};
|
|
608
680
|
}
|
|
609
681
|
if (signal?.aborted) {
|
|
610
|
-
return { action: "deny", message: `approval aborted for "${req.toolName}" (task ended)`, decisionReason: "mode" };
|
|
682
|
+
return { action: "deny", message: `approval aborted for "${req.toolName}" (task ended)`, decisionReason: "mode", settledBy: "aborted" };
|
|
611
683
|
}
|
|
612
684
|
const presented = tryCloneArgs(req.args);
|
|
613
685
|
if (!presented.ok) {
|
|
@@ -615,6 +687,7 @@ export async function resolveAsk(req, onAsk, signal) {
|
|
|
615
687
|
action: "deny",
|
|
616
688
|
message: `approval for "${req.toolName}" could not present the args safely (unclonable value: ${presented.reason}) — denied fail-closed`,
|
|
617
689
|
decisionReason: "mode",
|
|
690
|
+
settledBy: "aborted",
|
|
618
691
|
};
|
|
619
692
|
}
|
|
620
693
|
let ok;
|
|
@@ -625,6 +698,7 @@ export async function resolveAsk(req, onAsk, signal) {
|
|
|
625
698
|
action: "deny",
|
|
626
699
|
message: `approval for "${req.toolName}" could not present the args safely (unclonable value: ${approverView.reason}) — denied fail-closed`,
|
|
627
700
|
decisionReason: "mode",
|
|
701
|
+
settledBy: "aborted",
|
|
628
702
|
};
|
|
629
703
|
}
|
|
630
704
|
ok = await onAsk({ ...req, boundInputHash: boundInputHashOf(presented.value), args: approverView.value }, signal);
|
|
@@ -634,42 +708,49 @@ export async function resolveAsk(req, onAsk, signal) {
|
|
|
634
708
|
action: "deny",
|
|
635
709
|
message: `approval errored for "${req.toolName}": ${describeThrown(err)}`,
|
|
636
710
|
decisionReason: "mode",
|
|
711
|
+
settledBy: "aborted",
|
|
637
712
|
};
|
|
638
713
|
}
|
|
714
|
+
if (signal?.aborted) {
|
|
715
|
+
return { action: "deny", message: `approval aborted for "${req.toolName}" (task ended)`, decisionReason: "mode", settledBy: "aborted" };
|
|
716
|
+
}
|
|
639
717
|
if (ok === "unavailable") {
|
|
640
718
|
return {
|
|
641
719
|
action: "deny",
|
|
642
720
|
message: `approval required for "${req.toolName}" but the approver reported unavailable (no reachable ` +
|
|
643
721
|
`operator for this ask) and no durable approval gate is armed — denied fail-closed: ${req.message}`,
|
|
644
722
|
decisionReason: "mode",
|
|
723
|
+
settledBy: "aborted",
|
|
645
724
|
approverUnavailable: true,
|
|
646
725
|
};
|
|
647
726
|
}
|
|
648
727
|
if (typeof ok === "object" && ok !== null) {
|
|
649
728
|
if (ok.allow !== true) {
|
|
650
|
-
return { action: "deny", message: `approval denied for "${req.toolName}": ${req.message}`, decisionReason: "mode" };
|
|
729
|
+
return { action: "deny", message: `approval denied for "${req.toolName}": ${req.message}`, decisionReason: "mode", settledBy: "human" };
|
|
651
730
|
}
|
|
652
731
|
if (ok.updatedInput === undefined)
|
|
653
|
-
return { action: "allow", decisionReason: "mode", presentedInput: presented.value };
|
|
732
|
+
return { action: "allow", decisionReason: "mode", presentedInput: presented.value, settledBy: "human" };
|
|
654
733
|
const edit = tryCloneArgs(ok.updatedInput);
|
|
655
734
|
if (!edit.ok) {
|
|
656
735
|
return {
|
|
657
736
|
action: "deny",
|
|
658
737
|
message: `the approved edit for "${req.toolName}" is not safely clonable (${edit.reason}) — denied fail-closed`,
|
|
659
738
|
decisionReason: "mode",
|
|
739
|
+
settledBy: "aborted",
|
|
660
740
|
};
|
|
661
741
|
}
|
|
662
|
-
return { action: "allow", updatedInput: edit.value, decisionReason: "mode" };
|
|
742
|
+
return { action: "allow", updatedInput: edit.value, decisionReason: "mode", settledBy: "human" };
|
|
663
743
|
}
|
|
664
744
|
const okRaw = ok;
|
|
665
745
|
if (okRaw === true)
|
|
666
|
-
return { action: "allow", decisionReason: "mode", presentedInput: presented.value };
|
|
746
|
+
return { action: "allow", decisionReason: "mode", presentedInput: presented.value, settledBy: "human" };
|
|
667
747
|
if (okRaw !== false) {
|
|
668
748
|
return {
|
|
669
749
|
action: "deny",
|
|
670
750
|
message: `the approver for "${req.toolName}" returned an out-of-contract value (${typeof ok}) — denied fail-closed (return true, false, "unavailable", or the {allow} object)`,
|
|
671
751
|
decisionReason: "mode",
|
|
752
|
+
settledBy: "aborted",
|
|
672
753
|
};
|
|
673
754
|
}
|
|
674
|
-
return { action: "deny", message: `approval denied for "${req.toolName}": ${req.message}`, decisionReason: "mode" };
|
|
755
|
+
return { action: "deny", message: `approval denied for "${req.toolName}": ${req.message}`, decisionReason: "mode", settledBy: "human" };
|
|
675
756
|
}
|
package/dist/core/tools.js
CHANGED
|
@@ -45,6 +45,7 @@ export function defineTool(spec, options) {
|
|
|
45
45
|
executionMode,
|
|
46
46
|
...(spec.isConcurrencySafe ? { isConcurrencySafe: spec.isConcurrencySafe } : {}),
|
|
47
47
|
...(spec.effect ? { effect: spec.effect } : {}),
|
|
48
|
+
...(spec.contentOrigin ? { contentOrigin: spec.contentOrigin } : {}),
|
|
48
49
|
...(spec.prepareArguments ? { prepareArguments: spec.prepareArguments } : {}),
|
|
49
50
|
...(spec.approvalPreview ? { approvalPreview: spec.approvalPreview } : {}),
|
|
50
51
|
execute: async (toolCallId, rawParams, signal) => {
|
package/dist/core/trace.d.ts
CHANGED
|
@@ -181,6 +181,20 @@ export type TraceEvent = {
|
|
|
181
181
|
site: string;
|
|
182
182
|
message: string;
|
|
183
183
|
ts: number;
|
|
184
|
+
} | {
|
|
185
|
+
kind: "permission.persisted_rule_allowed";
|
|
186
|
+
version: 1;
|
|
187
|
+
taskId: string;
|
|
188
|
+
toolName: string;
|
|
189
|
+
toolCallId: string;
|
|
190
|
+
rule: string;
|
|
191
|
+
ts: number;
|
|
192
|
+
} | {
|
|
193
|
+
kind: "permission.rule_store_unreadable";
|
|
194
|
+
version: 1;
|
|
195
|
+
taskId: string;
|
|
196
|
+
message: string;
|
|
197
|
+
ts: number;
|
|
184
198
|
} | {
|
|
185
199
|
kind: "brain.failover";
|
|
186
200
|
version: 1;
|
|
@@ -217,6 +231,12 @@ export type TraceEvent = {
|
|
|
217
231
|
estTokens: number;
|
|
218
232
|
floor: number;
|
|
219
233
|
ts: number;
|
|
234
|
+
} | {
|
|
235
|
+
kind: "compaction.unevaluable";
|
|
236
|
+
version: 1;
|
|
237
|
+
taskId: string;
|
|
238
|
+
estTokens: number;
|
|
239
|
+
ts: number;
|
|
220
240
|
} | {
|
|
221
241
|
kind: "compaction.blocked";
|
|
222
242
|
version: 1;
|
package/dist/core/types.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export interface Brain {
|
|
|
20
20
|
complete?: CompleteSimpleFn;
|
|
21
21
|
}
|
|
22
22
|
export type ToolEffect = "read" | "write" | "idempotent";
|
|
23
|
+
export type ToolContentOrigin = "external" | "execution" | "local";
|
|
23
24
|
export interface ToolSpec<TParams extends TSchema = TSchema> {
|
|
24
25
|
name: string;
|
|
25
26
|
aliases?: string[];
|
|
@@ -30,6 +31,17 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
|
|
|
30
31
|
name: string;
|
|
31
32
|
description: string;
|
|
32
33
|
}>;
|
|
34
|
+
agentToolFaces?: ReadonlyArray<{
|
|
35
|
+
name: string;
|
|
36
|
+
allowTools?: readonly string[];
|
|
37
|
+
denyTools?: readonly string[];
|
|
38
|
+
canRedelegate?: boolean;
|
|
39
|
+
}>;
|
|
40
|
+
agentToolPool?: ReadonlyArray<{
|
|
41
|
+
name: string;
|
|
42
|
+
aliases?: readonly string[];
|
|
43
|
+
contentOrigin?: ToolContentOrigin;
|
|
44
|
+
}>;
|
|
33
45
|
approvalPreview?: (args: unknown) => unknown;
|
|
34
46
|
agentModels?: readonly string[];
|
|
35
47
|
withAgents?: (agents: ReadonlyArray<AgentDefinition>) => ToolSpec;
|
|
@@ -42,6 +54,7 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
|
|
|
42
54
|
} | Promise<{
|
|
43
55
|
reversible: boolean;
|
|
44
56
|
}>;
|
|
57
|
+
contentOrigin?: ToolContentOrigin;
|
|
45
58
|
executionMode?: "sequential" | "parallel";
|
|
46
59
|
isConcurrencySafe?: (args: unknown) => boolean;
|
|
47
60
|
parameters: TParams;
|
|
@@ -555,6 +568,7 @@ export type TaskEvent = ({
|
|
|
555
568
|
output?: unknown;
|
|
556
569
|
structured?: unknown;
|
|
557
570
|
errorCode?: string;
|
|
571
|
+
settledBy?: import("./tool-policy.js").ApprovalSettledBy;
|
|
558
572
|
truncated?: boolean;
|
|
559
573
|
totalChars?: number;
|
|
560
574
|
} & TaskEventIdentity) | ({
|
|
@@ -772,6 +786,7 @@ export interface RunnerDeps {
|
|
|
772
786
|
checkpointStore?: import("./checkpoint-store.js").CheckpointStore;
|
|
773
787
|
fileSnapshotStore?: import("./file-snapshot-store.js").FileSnapshotStore;
|
|
774
788
|
sessionPolicyStore?: import("./session-policy-store.js").SessionPolicyStore;
|
|
789
|
+
permissionRuleStore?: import("./permission-rule-store.js").PermissionRuleStoreProvider;
|
|
775
790
|
runtimeCapsResolver?: (principal: string | undefined) => RuntimeCaps | undefined | Promise<RuntimeCaps | undefined>;
|
|
776
791
|
lockedConfig?: import("./locked-config.js").LockedConfig;
|
|
777
792
|
compliancePostureResolver?: (principal: string | undefined) => import("./compliance.js").CompliancePosture | undefined | Promise<import("./compliance.js").CompliancePosture | undefined>;
|
|
@@ -43,6 +43,9 @@ export interface WiringManifest {
|
|
|
43
43
|
backgroundAgentStore: boolean;
|
|
44
44
|
hostChildEventSink: boolean;
|
|
45
45
|
};
|
|
46
|
+
permissionRules: {
|
|
47
|
+
storeWired: boolean;
|
|
48
|
+
};
|
|
46
49
|
governance: {
|
|
47
50
|
audience: "operator";
|
|
48
51
|
lockedConfig: boolean;
|
|
@@ -71,13 +74,14 @@ export interface WiringFacts {
|
|
|
71
74
|
checkpointDurability?: StoreDurability;
|
|
72
75
|
sessionDurability: StoreDurability;
|
|
73
76
|
backgroundAgentStoreWired: boolean;
|
|
77
|
+
permissionRuleStoreWired: boolean;
|
|
74
78
|
hostChildEventSinkWired: boolean;
|
|
75
79
|
lockedConfigWired: boolean;
|
|
76
80
|
complianceWired: boolean;
|
|
77
81
|
memoryAdmissionWired: boolean;
|
|
78
82
|
retentionPolicyWired: boolean;
|
|
79
83
|
}
|
|
80
|
-
export type StaticWiringDeps = Pick<RunnerDeps, "onAsk" | "onQuestion" | "interactionPosture" | "onElicit" | "checkpointStore" | "sessionStore" | "backgroundAgentStore" | "onBackgroundChildEvent" | "lockedConfig" | "compliancePostureResolver" | "memoryScopeAdmission" | "retentionPolicy">;
|
|
84
|
+
export type StaticWiringDeps = Pick<RunnerDeps, "onAsk" | "onQuestion" | "interactionPosture" | "onElicit" | "checkpointStore" | "sessionStore" | "backgroundAgentStore" | "onBackgroundChildEvent" | "lockedConfig" | "compliancePostureResolver" | "memoryScopeAdmission" | "retentionPolicy" | "permissionRuleStore">;
|
|
81
85
|
export type StaticWiringSpec = Pick<TaskSpec, "onAsk" | "onQuestion" | "checkpointStore" | "durableApproval" | "mcp" | "interactiveTools" | "interactionPosture">;
|
|
82
86
|
export declare function resolveDeclaredDurability(store: {
|
|
83
87
|
readonly durability?: StoreDurability;
|
|
@@ -86,6 +86,7 @@ export function deriveWiringManifest(facts) {
|
|
|
86
86
|
parkLane,
|
|
87
87
|
session: { store: manifestDurabilityOf(facts.sessionDurability) },
|
|
88
88
|
fleet: { backgroundAgentStore: facts.backgroundAgentStoreWired, hostChildEventSink: facts.hostChildEventSinkWired },
|
|
89
|
+
permissionRules: { storeWired: facts.permissionRuleStoreWired },
|
|
89
90
|
governance: {
|
|
90
91
|
audience: "operator",
|
|
91
92
|
lockedConfig: facts.lockedConfigWired,
|
|
@@ -177,6 +178,7 @@ export function describeStaticWiring(deps, spec = {}) {
|
|
|
177
178
|
...(capable ? { checkpointDurability: resolveDeclaredDurability(checkpointStore, "checkpointStore") } : {}),
|
|
178
179
|
sessionDurability: resolveDeclaredDurability(deps.sessionStore, "sessionStore"),
|
|
179
180
|
backgroundAgentStoreWired: deps.backgroundAgentStore !== undefined,
|
|
181
|
+
permissionRuleStoreWired: deps.permissionRuleStore !== undefined,
|
|
180
182
|
hostChildEventSinkWired: deps.onBackgroundChildEvent !== undefined,
|
|
181
183
|
lockedConfigWired: deps.lockedConfig !== undefined,
|
|
182
184
|
complianceWired: deps.compliancePostureResolver !== undefined,
|
package/dist/index.d.ts
CHANGED
|
@@ -122,14 +122,18 @@ export type { SchedulerCapability, SchedulerErrorCode, ScheduledIntent, Schedule
|
|
|
122
122
|
export { createSchedulerTools, type SchedulerToolContext, SCHEDULE_WAKEUP_TOOL_NAME, AUTONOMOUS_LOOP_SENTINEL, AUTONOMOUS_LOOP_DYNAMIC_SENTINEL, } from "./tools/scheduler-tools.js";
|
|
123
123
|
export { resolveAutonomousLoopPrompt, AUTONOMOUS_LOOP_PREAMBLE, AUTONOMOUS_LOOP_PREAMBLE_PERSISTENT, type AutonomousLoopPromptOptions, } from "./tools/loop-tick.js";
|
|
124
124
|
export { tightenTaskSpec, TaskSpecTightenError } from "./core/tighten-task-spec.js";
|
|
125
|
-
export { createAllowDenyPolicy, createApprovalPolicy, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, findUnverifiableRecursiveDelete, combinePolicies, decisionText, resolveAsk, toolPolicyNameSets, type ToolPolicyNameSets, type NamedToolPolicy, type ToolPolicy, type ToolCallRequest, type PermissionResult, type DecisionReason, type OnAsk, type AskOutcome, type ResolvedAsk, type AskRequest, type AskDelegationProvenance, } from "./core/tool-policy.js";
|
|
125
|
+
export { createAllowDenyPolicy, createApprovalPolicy, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, findUnverifiableRecursiveDelete, combinePolicies, decisionText, resolveAsk, toolPolicyNameSets, type ToolPolicyNameSets, type NamedToolPolicy, type ToolPolicy, type ToolCallRequest, type PermissionResult, type DecisionReason, type ApprovalSettledBy, APPROVAL_SETTLED_BY_VALUES, isApprovalSettledBy, type OnAsk, type AskOutcome, type ResolvedAsk, type AskRequest, type AskDelegationProvenance, } from "./core/tool-policy.js";
|
|
126
126
|
export { parseAutoModeResponse, createAutoModeDecider, type AutoModeVerdict, type AutoModeDecider, type AutoModeDeciderOptions, type AutoModeClassifyFn, type AutoModeClassifyInput, } from "./core/auto-mode.js";
|
|
127
127
|
export { buildAutoModePrompt, renderAutoModeWindow, renderAutoModeAction, AUTO_MODE_DEFAULTS_SENTINEL, type AutoModeRules, type BuildAutoModePromptOptions, type AutoModeWindowOptions, } from "./core/auto-mode-prompt.js";
|
|
128
128
|
export { AUTO_MODE_BASE_PROMPT, AUTO_MODE_PERMISSIONS_EXTERNAL } from "./core/auto-mode-prompt-assets.js";
|
|
129
129
|
export { createPermissionRulePolicy, validatePermissionRules, parsePermissionRule, wildcardMatch, type PermissionRule, type ParsedPermissionRule, type PermissionRuleIssue, type PermissionRuleCaps, type PermissionRulePolicyOptions, } from "./core/permission-rules.js";
|
|
130
|
+
export { parseAllowRuleText, formatAllowRuleText, ruleAdmitsCommand, findAdmittingRule, suggestRulesForCommand, scopeCoversCwd, pathWithinRoot, isRuleLive, BARE_INTERPRETER_NAMES, MAX_RULE_TEXT_CHARS, type PersistedAllowRule, type RuleTombstone, type RuleScope, type RuleDot, type RuleAdd, type RuleAddOrigin, type RuleSuggestion, type RuleReject, type RuleRejectCode, type ParsedAllowRule, type PersistedRuleTool, type PersistedRuleMatch, } from "./core/permission-rule-model.js";
|
|
131
|
+
export { removePersistedRule, applyTombstones, sameScope, InMemoryPermissionRuleStore, EMPTY_RULE_STORE, type PermissionRuleStore, type PermissionRuleStoreProvider, type StoredAllowRules, type RemoveResult, type PutResult, } from "./core/permission-rule-store.js";
|
|
132
|
+
export { prepareCardApproval, confirmRuleApproval, type ConfirmResult, type ConfirmRefusalReason, redeemRuleTicket, redeemRuleBatch, prepareCcImport, prepareStarterBatch, mintRuleTicket, STARTER_RULES, InMemoryRuleApprovalRecordStore, type RuleTicket, type RuleCandidate, type RuleApprovalKind, type RuleApprovalRecord, type RuleApprovalRecordStore, type RuleConsentDeps, type RedeemResult, type CcImportLayer, type ImportedSettingsLayer, type ImportPreview, type ImportResult, } from "./core/permission-rule-consent.js";
|
|
133
|
+
export { FilePermissionRuleStoreProvider } from "./stores/file/permission-rule-store.js";
|
|
130
134
|
export { formatHookFeedback, runToolGate, createHookEnvCapabilities, type Hooks, type HookToolContext, type HookEnvCapabilities, type HookToolOutput, type PreToolUseResult, type PostToolUseResult, type UserPromptSubmitResult, type HookToolFailure, type PostToolUseFailureResult, type PostToolBatchCall, type PostToolBatchResult, type PreCompactContext, type PreCompactResult, type PostCompactContext, type StopFailureContext, type PermissionDeniedPayload, type PermissionDeniedSource, } from "./core/hooks.js";
|
|
131
135
|
export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, type NormalizedMemorySpec, type MemorySpecInput, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, type Embedder, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, type UtilityGate, type MemoryStore, type MemoryVectorMode, type ScoredMemory, type MemoryNoteHeader, type MemoryNoteRecord, type MemoryNoteType, type StructuredNoteInput, } from "./core/memory.js";
|
|
132
|
-
export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, type MemoryAnnouncement, type ScanFinding, type MemoryEngineOptions, type MemoryInjection, type MemoryBackend, type MemoryEntry, type MemoryEntryFrontmatter, type MemoryEntryHeader, type ScoredMemoryEntry, type NotePatch, type PatchReport, type MaterializedFile, type MemorySessionHandle, type HarvestReport, type HarvestRejection, type HarvestRejectionCode, type ParsedEntryFile, type ScannedEntryFile, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, type ParsedScopeKey, migrateScope, type MigrateScopeReport, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, type RemoteMemoryFile, type RemoteMemoryBaseline, type RemoteMaterialization, type RemoteHarvestResult, type InboundEntryFinding, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, type MemorySyncCursor, type MemorySyncConflict, type MemorySyncPlan, type RecallSource, syncMemoryScope, type MemorySyncTransport, type MemorySyncRequestBody, type MemorySyncResponseBody, type MemorySyncClientConflict, type SyncMemoryScopeOptions, type MemorySyncClientResult, } from "./core/memory-engine/index.js";
|
|
136
|
+
export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, type MemorySearchDetails, type MemorySearchHit, type MemoryGetDetails, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, type MemoryAnnouncement, type ScanFinding, type MemoryEngineOptions, type MemoryInjection, type MemoryBackend, type MemoryEntry, type MemoryEntryFrontmatter, type MemoryEntryHeader, type ScoredMemoryEntry, type NotePatch, type PatchReport, type MaterializedFile, type MemorySessionHandle, type HarvestReport, type HarvestRejection, type HarvestRejectionCode, type ParsedEntryFile, type ScannedEntryFile, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, type ParsedScopeKey, migrateScope, type MigrateScopeReport, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, type RemoteMemoryFile, type RemoteMemoryBaseline, type RemoteMaterialization, type RemoteHarvestResult, type InboundEntryFinding, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, type MemorySyncCursor, type MemorySyncConflict, type MemorySyncPlan, type RecallSource, syncMemoryScope, type MemorySyncTransport, type MemorySyncRequestBody, type MemorySyncResponseBody, type MemorySyncClientConflict, type SyncMemoryScopeOptions, type MemorySyncClientResult, } from "./core/memory-engine/index.js";
|
|
133
137
|
export { SHARED_MEMORY_READ_CAP_BYTES, SHARED_MEMORY_LIST_PAGE_SIZE, SharedMemoryStoreError, type SharedMemoryStoreProvider, type SharedMemoryStoreReader, type SharedMemoryStoreInfo, type SharedMemoryDocumentEntry, type SharedMemorySnapshot, type SharedMemoryRequestContext, type MemoryListDetails, type MemoryReadDetails, } from "./core/shared-memory/types.js";
|
|
134
138
|
export { sharedMemoryStoreContract, type SharedMemoryFixture, type SharedMemoryStoreContractHooks, } from "./core/shared-memory/contract.js";
|
|
135
139
|
export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
|
|
@@ -218,7 +222,7 @@ export { retryBackoffMs, parseRetryAfter } from "./brain/retry.js";
|
|
|
218
222
|
export { type BrainTimeoutConfig } from "./brain/timeout.js";
|
|
219
223
|
export { createAssistantMessageEventStream } from "./internal/llm.js";
|
|
220
224
|
export type { AssistantMessage, AssistantMessageEvent, CompleteSimpleFn, Context, DocumentContent, ImageContent, Message, StopReason, StreamFn, TextContent, ThinkingContent, ToolCall, ToolResultMessage, Usage, UserMessage, } from "./internal/llm.js";
|
|
221
|
-
export type { AgentDefinition, BeforeWriteHook, BeforeWriteRequest, BeforeWriteResult, HandsBandOptions, Brain, BrainStatus, BrainStatusPhase, ImageInput, McpElicitRequest, McpElicitResponse, McpServerSpec, A2aServerSpec, OnElicit, Model, ModelRef, ProjectMemoryLoad, RunnerDeps, RuntimeCaps, BackgroundChildEvent, SkillManifest, SkillSpec, TaskEvent, TaskEventIdentity, ToolActivity, TaskLimits, StaleToolResultOffloadOptions, TaskResult, RemoteEnvFailureNote, TaskSpec, TaskStatus, TaskStream, CompactOutcome, ThinkingLevel, ToolExecuteContext, ToolReturn, ToolSpec, ToolEffect, WorkflowGovernanceBaseline, DelegationTaskType, } from "./core/types.js";
|
|
225
|
+
export type { AgentDefinition, BeforeWriteHook, BeforeWriteRequest, BeforeWriteResult, HandsBandOptions, Brain, BrainStatus, BrainStatusPhase, ImageInput, McpElicitRequest, McpElicitResponse, McpServerSpec, A2aServerSpec, OnElicit, Model, ModelRef, ProjectMemoryLoad, RunnerDeps, RuntimeCaps, BackgroundChildEvent, SkillManifest, SkillSpec, TaskEvent, TaskEventIdentity, ToolActivity, TaskLimits, StaleToolResultOffloadOptions, TaskResult, RemoteEnvFailureNote, TaskSpec, TaskStatus, TaskStream, CompactOutcome, ThinkingLevel, ToolExecuteContext, ToolReturn, ToolSpec, ToolEffect, ToolContentOrigin, WorkflowGovernanceBaseline, DelegationTaskType, } from "./core/types.js";
|
|
222
226
|
export { Type } from "typebox";
|
|
223
227
|
export type { TSchema, Static } from "typebox";
|
|
224
228
|
export { explainPromptAssembly, describeDefaultPack, type DefaultPackDescription, type ExplainInput } from "./prompt-assembly/explain.js";
|
package/dist/index.js
CHANGED
|
@@ -107,14 +107,18 @@ export { hasScheduler, isValidCronExpr, SchedulerError } from "./core/scheduler.
|
|
|
107
107
|
export { createSchedulerTools, SCHEDULE_WAKEUP_TOOL_NAME, AUTONOMOUS_LOOP_SENTINEL, AUTONOMOUS_LOOP_DYNAMIC_SENTINEL, } from "./tools/scheduler-tools.js";
|
|
108
108
|
export { resolveAutonomousLoopPrompt, AUTONOMOUS_LOOP_PREAMBLE, AUTONOMOUS_LOOP_PREAMBLE_PERSISTENT, } from "./tools/loop-tick.js";
|
|
109
109
|
export { tightenTaskSpec, TaskSpecTightenError } from "./core/tighten-task-spec.js";
|
|
110
|
-
export { createAllowDenyPolicy, createApprovalPolicy, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, findUnverifiableRecursiveDelete, combinePolicies, decisionText, resolveAsk, toolPolicyNameSets, } from "./core/tool-policy.js";
|
|
110
|
+
export { createAllowDenyPolicy, createApprovalPolicy, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, findUnverifiableRecursiveDelete, combinePolicies, decisionText, resolveAsk, toolPolicyNameSets, APPROVAL_SETTLED_BY_VALUES, isApprovalSettledBy, } from "./core/tool-policy.js";
|
|
111
111
|
export { parseAutoModeResponse, createAutoModeDecider, } from "./core/auto-mode.js";
|
|
112
112
|
export { buildAutoModePrompt, renderAutoModeWindow, renderAutoModeAction, AUTO_MODE_DEFAULTS_SENTINEL, } from "./core/auto-mode-prompt.js";
|
|
113
113
|
export { AUTO_MODE_BASE_PROMPT, AUTO_MODE_PERMISSIONS_EXTERNAL } from "./core/auto-mode-prompt-assets.js";
|
|
114
114
|
export { createPermissionRulePolicy, validatePermissionRules, parsePermissionRule, wildcardMatch, } from "./core/permission-rules.js";
|
|
115
|
+
export { parseAllowRuleText, formatAllowRuleText, ruleAdmitsCommand, findAdmittingRule, suggestRulesForCommand, scopeCoversCwd, pathWithinRoot, isRuleLive, BARE_INTERPRETER_NAMES, MAX_RULE_TEXT_CHARS, } from "./core/permission-rule-model.js";
|
|
116
|
+
export { removePersistedRule, applyTombstones, sameScope, InMemoryPermissionRuleStore, EMPTY_RULE_STORE, } from "./core/permission-rule-store.js";
|
|
117
|
+
export { prepareCardApproval, confirmRuleApproval, redeemRuleTicket, redeemRuleBatch, prepareCcImport, prepareStarterBatch, mintRuleTicket, STARTER_RULES, InMemoryRuleApprovalRecordStore, } from "./core/permission-rule-consent.js";
|
|
118
|
+
export { FilePermissionRuleStoreProvider } from "./stores/file/permission-rule-store.js";
|
|
115
119
|
export { formatHookFeedback, runToolGate, createHookEnvCapabilities, } from "./core/hooks.js";
|
|
116
120
|
export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, } from "./core/memory.js";
|
|
117
|
-
export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, migrateScope, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, syncMemoryScope, } from "./core/memory-engine/index.js";
|
|
121
|
+
export { MemoryEngine, FileMemoryEngineBackend, memoryBackendContract, assertMemoryBackendSearchEquivalence, buildMemoryInstruction, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, migrateScope, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, syncMemoryScope, } from "./core/memory-engine/index.js";
|
|
118
122
|
export { SHARED_MEMORY_READ_CAP_BYTES, SHARED_MEMORY_LIST_PAGE_SIZE, SharedMemoryStoreError, } from "./core/shared-memory/types.js";
|
|
119
123
|
export { sharedMemoryStoreContract, } from "./core/shared-memory/contract.js";
|
|
120
124
|
export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { PermissionRuleStore, PermissionRuleStoreProvider, PermissionRuleWriter, StoredAllowRules, WritablePermissionRuleStore } from "../../core/permission-rule-store.js";
|
|
2
|
+
import { PERMISSION_RULE_WRITER } from "../../core/permission-rule-store.js";
|
|
3
|
+
import type { StoreDurability, StoreFidelity } from "../../core/checkpoint-store.js";
|
|
4
|
+
declare class FilePermissionRuleStore implements WritablePermissionRuleStore {
|
|
5
|
+
private readonly dir;
|
|
6
|
+
private readonly file;
|
|
7
|
+
private readonly acquireWriteLock;
|
|
8
|
+
private readonly onError?;
|
|
9
|
+
readonly durability: StoreDurability;
|
|
10
|
+
readonly fidelity: StoreFidelity;
|
|
11
|
+
constructor(dir: string, file: string, acquireWriteLock: () => void, onError?: ((message: string) => void) | undefined);
|
|
12
|
+
private read;
|
|
13
|
+
private disclose;
|
|
14
|
+
private write;
|
|
15
|
+
list(): Promise<StoredAllowRules>;
|
|
16
|
+
private current;
|
|
17
|
+
private writeAndVerify;
|
|
18
|
+
private writeChain;
|
|
19
|
+
private serialize;
|
|
20
|
+
get [PERMISSION_RULE_WRITER](): PermissionRuleWriter;
|
|
21
|
+
private readonly writer;
|
|
22
|
+
}
|
|
23
|
+
export declare class FilePermissionRuleStoreProvider implements PermissionRuleStoreProvider {
|
|
24
|
+
private readonly dir;
|
|
25
|
+
private readonly onError?;
|
|
26
|
+
private lock;
|
|
27
|
+
constructor(dir: string, onError?: ((message: string) => void) | undefined);
|
|
28
|
+
private acquireWriteLock;
|
|
29
|
+
forPrincipal(principal: string | undefined): PermissionRuleStore;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
}
|
|
32
|
+
export type { FilePermissionRuleStore };
|