@vibeiao/sdk 0.1.51 → 0.1.52
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/dist/agentLoop-BPdoysXH.d.ts +327 -0
- package/dist/agentLoop.d.ts +1 -1
- package/dist/agentLoop.js +41 -3
- package/dist/chunk-N3J6WQ72.js +319 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -2
- package/dist/treasuryGuardian.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { ResourceSnapshot, SelfRelianceState, SelfReliance } from './selfReliance.js';
|
|
2
|
+
import { SurvivalMode, SurvivalRecommendation } from './survivalPlaybook.js';
|
|
3
|
+
import { EscapeHatchDecision, EscapeHatchPolicy, EscapeHatchSnapshot } from './survivalEscapeHatch.js';
|
|
4
|
+
import { CompoundingMemoryUpgradeResult, CompoundingMemoryRequiredSetResult } from './compoundingMemory.js';
|
|
5
|
+
import { StrictMemoryRuntimePreset, StrictMemoryEvaluation, StrictMemoryUpgradeResult } from './strictMemoryRuntime.js';
|
|
6
|
+
|
|
7
|
+
type PromptShieldTrustLevel = 'trusted_human' | 'internal_system' | 'external_untrusted';
|
|
8
|
+
type PromptShieldInput = {
|
|
9
|
+
source: string;
|
|
10
|
+
trust: PromptShieldTrustLevel;
|
|
11
|
+
content: string;
|
|
12
|
+
};
|
|
13
|
+
type PromptShieldFlag = 'instruction_override' | 'credential_exfiltration' | 'destructive_command' | 'authority_spoof' | 'sensitive_action_without_trust';
|
|
14
|
+
type PromptShieldRisk = 'low' | 'medium' | 'high';
|
|
15
|
+
type PromptShieldDecision = {
|
|
16
|
+
allow: boolean;
|
|
17
|
+
risk: PromptShieldRisk;
|
|
18
|
+
flags: PromptShieldFlag[];
|
|
19
|
+
rationale: string[];
|
|
20
|
+
blockedInputs: PromptShieldInput[];
|
|
21
|
+
};
|
|
22
|
+
type PromptShieldPolicy = {
|
|
23
|
+
blockOnFlags?: PromptShieldFlag[];
|
|
24
|
+
allowUntrustedForAnalysisOnly?: boolean;
|
|
25
|
+
};
|
|
26
|
+
declare const evaluatePromptShield: (inputs: PromptShieldInput[], options?: {
|
|
27
|
+
isSensitiveAction?: boolean;
|
|
28
|
+
policy?: PromptShieldPolicy;
|
|
29
|
+
}) => PromptShieldDecision;
|
|
30
|
+
|
|
31
|
+
type ObjectiveChangeSourceTrust = 'trusted_human' | 'internal_system' | 'external_untrusted';
|
|
32
|
+
type ObjectiveChangeProposal = {
|
|
33
|
+
source: string;
|
|
34
|
+
trust: ObjectiveChangeSourceTrust;
|
|
35
|
+
currentObjective: string;
|
|
36
|
+
proposedObjective: string;
|
|
37
|
+
rationale?: string;
|
|
38
|
+
evidence?: Array<{
|
|
39
|
+
claim: string;
|
|
40
|
+
verified?: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
};
|
|
43
|
+
type ObjectiveGuardDecision = {
|
|
44
|
+
allowObjectiveChange: boolean;
|
|
45
|
+
reason: string;
|
|
46
|
+
checks: {
|
|
47
|
+
explicitInstruction: boolean;
|
|
48
|
+
missionAligned: boolean;
|
|
49
|
+
evidenceProvided: boolean;
|
|
50
|
+
evidenceVerified: boolean;
|
|
51
|
+
};
|
|
52
|
+
risk: 'low' | 'medium' | 'high';
|
|
53
|
+
};
|
|
54
|
+
type ObjectiveGuardPolicy = {
|
|
55
|
+
requireMissionAlignment?: boolean;
|
|
56
|
+
requireEvidenceVerification?: boolean;
|
|
57
|
+
allowExternalExplicitInstruction?: boolean;
|
|
58
|
+
};
|
|
59
|
+
declare const evaluateObjectiveChange: (proposal: ObjectiveChangeProposal, policy?: ObjectiveGuardPolicy) => ObjectiveGuardDecision;
|
|
60
|
+
|
|
61
|
+
type IntentSignals = {
|
|
62
|
+
expectedBuildValue?: number;
|
|
63
|
+
expectedBuildRevenue?: number;
|
|
64
|
+
expectedPolishValue?: number;
|
|
65
|
+
expectedPolishRevenueProtection?: number;
|
|
66
|
+
urgentUserDemand?: boolean;
|
|
67
|
+
releaseReady?: boolean;
|
|
68
|
+
criticalPolishSignal?: boolean;
|
|
69
|
+
builderObjectiveAvailable?: boolean;
|
|
70
|
+
};
|
|
71
|
+
type LaneMode = 'polish' | 'builder';
|
|
72
|
+
type LaneSwitchDecision = {
|
|
73
|
+
lane: LaneMode;
|
|
74
|
+
greenStreak: number;
|
|
75
|
+
switched: boolean;
|
|
76
|
+
reason: string;
|
|
77
|
+
};
|
|
78
|
+
declare const scoreBuildLane: (signals: IntentSignals, survivalMode: SurvivalMode) => number;
|
|
79
|
+
declare const scorePolishLane: (signals: IntentSignals, survivalMode: SurvivalMode, humanDemand: AgentHumanDemand) => number;
|
|
80
|
+
declare const evaluateLaneSwitch: (input: {
|
|
81
|
+
previousLane?: LaneMode;
|
|
82
|
+
previousGreenStreak?: number;
|
|
83
|
+
releaseReady: boolean;
|
|
84
|
+
criticalPolishSignal?: boolean;
|
|
85
|
+
builderObjectiveAvailable?: boolean;
|
|
86
|
+
builderOnGreenStreak?: number;
|
|
87
|
+
}) => LaneSwitchDecision;
|
|
88
|
+
declare const applyIntentArbitration: (input: {
|
|
89
|
+
base: AgentWorkArbitrationDecision;
|
|
90
|
+
survivalMode: SurvivalMode;
|
|
91
|
+
signals?: IntentSignals;
|
|
92
|
+
}) => AgentWorkArbitrationDecision;
|
|
93
|
+
|
|
94
|
+
type AgentLoopEscapeHatchInput = {
|
|
95
|
+
snapshot: ResourceSnapshot;
|
|
96
|
+
survivalState: SelfRelianceState;
|
|
97
|
+
survivalMode: SurvivalMode;
|
|
98
|
+
timestamp: number;
|
|
99
|
+
};
|
|
100
|
+
type AgentLoopEscapeHatchConfig = {
|
|
101
|
+
/** Enable auto escape-hatch evaluation (default true, only in SURVIVE/BLINK). */
|
|
102
|
+
enabled?: boolean;
|
|
103
|
+
policy?: EscapeHatchPolicy;
|
|
104
|
+
resolveEnv?: (name: string) => string | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Optional mapper from loop context -> escape hatch snapshot.
|
|
107
|
+
* If omitted, a default mapper reads optional fields from snapshot.
|
|
108
|
+
*/
|
|
109
|
+
buildSnapshot?: (input: AgentLoopEscapeHatchInput) => EscapeHatchSnapshot | null | undefined;
|
|
110
|
+
/** Called when an escape-hatch decision is produced. */
|
|
111
|
+
onDecision?: (decision: EscapeHatchDecision, input: AgentLoopEscapeHatchInput) => Promise<void> | void;
|
|
112
|
+
};
|
|
113
|
+
type AgentLoopStrictMemoryConfig = {
|
|
114
|
+
/** Enable strict memory runtime checks in loop. Default true. */
|
|
115
|
+
enabled?: boolean;
|
|
116
|
+
/** observe (default) records decisions; enforce blocks onAct when checks fail. */
|
|
117
|
+
mode?: 'observe' | 'enforce';
|
|
118
|
+
/** Optional preset overrides. */
|
|
119
|
+
preset?: Partial<StrictMemoryRuntimePreset>;
|
|
120
|
+
/** Build per-cycle evaluation input. Defaults to best-effort snapshot fields. */
|
|
121
|
+
buildInput?: (ctx: {
|
|
122
|
+
snapshot: ResourceSnapshot;
|
|
123
|
+
timestamp: number;
|
|
124
|
+
}) => {
|
|
125
|
+
taskText: string;
|
|
126
|
+
isMutation: boolean;
|
|
127
|
+
contextPackPrepared: boolean;
|
|
128
|
+
semanticRecallConfirmed: boolean;
|
|
129
|
+
approvalPreflightPassed: boolean;
|
|
130
|
+
};
|
|
131
|
+
/** Optional hook when strict-memory evaluation runs. */
|
|
132
|
+
onEvaluation?: (ev: StrictMemoryEvaluation) => Promise<void> | void;
|
|
133
|
+
};
|
|
134
|
+
type AgentLoopPromptShieldConfig = {
|
|
135
|
+
/** Enable prompt-injection shield over untrusted external content. Default true. */
|
|
136
|
+
enabled?: boolean;
|
|
137
|
+
/** observe logs/records only; enforce blocks actions when shield fails. Default observe. */
|
|
138
|
+
mode?: 'observe' | 'enforce';
|
|
139
|
+
/** Optional policy overrides for blocked flags. */
|
|
140
|
+
policy?: PromptShieldPolicy;
|
|
141
|
+
/** Optional mapper from snapshot to trust-labeled inputs. */
|
|
142
|
+
buildInputs?: (ctx: {
|
|
143
|
+
snapshot: ResourceSnapshot;
|
|
144
|
+
timestamp: number;
|
|
145
|
+
}) => PromptShieldInput[];
|
|
146
|
+
/** Optional hook when prompt shield decision is produced. */
|
|
147
|
+
onDecision?: (decision: PromptShieldDecision) => Promise<void> | void;
|
|
148
|
+
};
|
|
149
|
+
type AgentLoopObjectiveGuardConfig = {
|
|
150
|
+
/** Enable objective integrity checks for external objective-change attempts. Default true. */
|
|
151
|
+
enabled?: boolean;
|
|
152
|
+
/** observe logs only; enforce blocks actions when objective mutation is denied. Default observe. */
|
|
153
|
+
mode?: 'observe' | 'enforce';
|
|
154
|
+
/** Policy requirements for external objective mutation acceptance. */
|
|
155
|
+
policy?: ObjectiveGuardPolicy;
|
|
156
|
+
/** Build proposed objective change from snapshot. Return null when no proposal is present. */
|
|
157
|
+
buildProposal?: (ctx: {
|
|
158
|
+
snapshot: ResourceSnapshot;
|
|
159
|
+
timestamp: number;
|
|
160
|
+
}) => ObjectiveChangeProposal | null;
|
|
161
|
+
/** Optional hook when objective decision is produced. */
|
|
162
|
+
onDecision?: (decision: ObjectiveGuardDecision) => Promise<void> | void;
|
|
163
|
+
};
|
|
164
|
+
type AgentOwnershipMode = 'owner_bound' | 'unbound';
|
|
165
|
+
type AgentPriorityMode = 'human_first' | 'autonomous_first';
|
|
166
|
+
type AgentHumanDemand = {
|
|
167
|
+
pending: boolean;
|
|
168
|
+
count?: number;
|
|
169
|
+
source?: string;
|
|
170
|
+
};
|
|
171
|
+
type AgentWorkArbitrationDecision = {
|
|
172
|
+
ownershipMode: AgentOwnershipMode;
|
|
173
|
+
priorityMode: AgentPriorityMode;
|
|
174
|
+
rolloutMode: 'observe' | 'enforce';
|
|
175
|
+
humanDemand: AgentHumanDemand;
|
|
176
|
+
runHumanTask: boolean;
|
|
177
|
+
runAutonomousTask: boolean;
|
|
178
|
+
lane?: LaneMode;
|
|
179
|
+
laneDecision?: LaneSwitchDecision;
|
|
180
|
+
reason: string;
|
|
181
|
+
};
|
|
182
|
+
type AgentLoopAutonomyConfig = {
|
|
183
|
+
enabled?: boolean;
|
|
184
|
+
ownershipMode?: AgentOwnershipMode;
|
|
185
|
+
priorityMode?: AgentPriorityMode;
|
|
186
|
+
rolloutMode?: 'observe' | 'enforce';
|
|
187
|
+
resolveHumanDemand?: () => Promise<boolean | AgentHumanDemand> | boolean | AgentHumanDemand;
|
|
188
|
+
intentPolicy?: {
|
|
189
|
+
enabled?: boolean;
|
|
190
|
+
laneSwitch?: {
|
|
191
|
+
enabled?: boolean;
|
|
192
|
+
builderOnGreenStreak?: number;
|
|
193
|
+
};
|
|
194
|
+
resolveSignals?: (ctx: {
|
|
195
|
+
snapshot: ResourceSnapshot;
|
|
196
|
+
survivalMode: SurvivalMode;
|
|
197
|
+
humanDemand: AgentHumanDemand;
|
|
198
|
+
}) => Promise<IntentSignals | null> | IntentSignals | null;
|
|
199
|
+
};
|
|
200
|
+
onAutonomous?: (ctx: AgentLoopContext) => Promise<void> | void;
|
|
201
|
+
onArbitration?: (decision: AgentWorkArbitrationDecision, ctx: AgentLoopContext) => Promise<void> | void;
|
|
202
|
+
};
|
|
203
|
+
type AgentLoopContext = {
|
|
204
|
+
snapshot: ResourceSnapshot;
|
|
205
|
+
survivalState: SelfRelianceState;
|
|
206
|
+
survivalMode: SurvivalMode;
|
|
207
|
+
survivalRecommendation: SurvivalRecommendation;
|
|
208
|
+
survivalFormatted: string;
|
|
209
|
+
/** Deterministic block for planners/loggers: survival + escape-hatch decision (if present). */
|
|
210
|
+
survivalDecisionBlock: string;
|
|
211
|
+
/** Present when escape-hatch evaluation runs (SURVIVE/BLINK by default). */
|
|
212
|
+
escapeHatchDecision?: EscapeHatchDecision;
|
|
213
|
+
escapeHatchFormatted?: string;
|
|
214
|
+
/** Present when memory auto-upgrade is enabled in the loop. */
|
|
215
|
+
memoryUpgrade?: CompoundingMemoryUpgradeResult;
|
|
216
|
+
/** Present when required-set maintenance check runs (default daily). */
|
|
217
|
+
memoryRequiredSet?: CompoundingMemoryRequiredSetResult;
|
|
218
|
+
/** Strict-memory runtime preset + per-cycle evaluation status. */
|
|
219
|
+
strictMemoryPreset?: StrictMemoryRuntimePreset;
|
|
220
|
+
strictMemoryEvaluation?: StrictMemoryEvaluation;
|
|
221
|
+
strictMemoryUpgrade?: StrictMemoryUpgradeResult;
|
|
222
|
+
/** Prompt-injection shield decision for this cycle. */
|
|
223
|
+
promptShieldDecision?: PromptShieldDecision;
|
|
224
|
+
/** Objective integrity guard decision for this cycle (when proposal exists). */
|
|
225
|
+
objectiveGuardDecision?: ObjectiveGuardDecision;
|
|
226
|
+
/** Human-vs-autonomous work arbitration decision for this cycle. */
|
|
227
|
+
workArbitration?: AgentWorkArbitrationDecision;
|
|
228
|
+
laneDecision?: LaneSwitchDecision;
|
|
229
|
+
timestamp: number;
|
|
230
|
+
};
|
|
231
|
+
type AgentLoopMemoryConfig = {
|
|
232
|
+
/** Enable one-time memory scaffold upgrade. Default true. */
|
|
233
|
+
enabled?: boolean;
|
|
234
|
+
/** Workspace root for compounding memory files. Default current working directory ("."). */
|
|
235
|
+
root?: string;
|
|
236
|
+
/** Timezone for daily ledger date key. Default UTC. */
|
|
237
|
+
timeZone?: string;
|
|
238
|
+
/** Hook called after memory upgrade check completes. */
|
|
239
|
+
onUpgrade?: (result: CompoundingMemoryUpgradeResult) => Promise<void> | void;
|
|
240
|
+
/** Enable required-set maintenance checks (bounded working state + recall substrate + restore drill). Default true. */
|
|
241
|
+
requiredSetEnabled?: boolean;
|
|
242
|
+
/** Interval for required-set checks. Default 24h. */
|
|
243
|
+
requiredSetIntervalMs?: number;
|
|
244
|
+
/** Run required-set check on first loop cycle. Default true. */
|
|
245
|
+
requiredSetRunOnStart?: boolean;
|
|
246
|
+
/** Include backup+restore drill in required-set check. Default true. */
|
|
247
|
+
requiredSetRunRestoreDrill?: boolean;
|
|
248
|
+
/** Hook called when required-set check runs. */
|
|
249
|
+
onRequiredSet?: (result: CompoundingMemoryRequiredSetResult) => Promise<void> | void;
|
|
250
|
+
};
|
|
251
|
+
type AgentLoopDurabilityConfig = {
|
|
252
|
+
/** Enable durability-proxy writes from runtime loop. Default false. */
|
|
253
|
+
enabled?: boolean;
|
|
254
|
+
/** Durability-proxy base URL (e.g. http://127.0.0.1:8790). */
|
|
255
|
+
baseUrl: string;
|
|
256
|
+
/** Agent id registered in durability-proxy. */
|
|
257
|
+
agentId: string;
|
|
258
|
+
/** Agent token registered in durability-proxy. */
|
|
259
|
+
agentToken: string;
|
|
260
|
+
/** Optional timeout for durability-proxy calls. Default 8000ms. */
|
|
261
|
+
timeoutMs?: number;
|
|
262
|
+
/** Write checkpoint after each required-set run. Default true. */
|
|
263
|
+
checkpointOnRequiredSet?: boolean;
|
|
264
|
+
/** Write restore-drill outcome when required-set includes restore drill. Default true. */
|
|
265
|
+
reportRestoreDrill?: boolean;
|
|
266
|
+
/** Called when durability checkpoint is written. */
|
|
267
|
+
onCheckpointWritten?: (result: {
|
|
268
|
+
checkpointId?: string;
|
|
269
|
+
createdAt?: string;
|
|
270
|
+
checkedAt: string;
|
|
271
|
+
}) => Promise<void> | void;
|
|
272
|
+
/** Called when durability restore drill signal is written. */
|
|
273
|
+
onRestoreDrillReported?: (result: {
|
|
274
|
+
ok: boolean;
|
|
275
|
+
ts?: string;
|
|
276
|
+
checkedAt: string;
|
|
277
|
+
}) => Promise<void> | void;
|
|
278
|
+
};
|
|
279
|
+
type AgentLoopHooks = {
|
|
280
|
+
/** Called every cycle after snapshot is fetched and survival state is updated. */
|
|
281
|
+
onCycle?: (ctx: AgentLoopContext) => Promise<void> | void;
|
|
282
|
+
/**
|
|
283
|
+
* Optional: run reflection in the loop.
|
|
284
|
+
* Keep this hook pure/side-effect bounded; it should manage its own persistence.
|
|
285
|
+
*/
|
|
286
|
+
onReflection?: (ctx: AgentLoopContext) => Promise<void> | void;
|
|
287
|
+
/**
|
|
288
|
+
* Optional: the agent's planner/executor entrypoint.
|
|
289
|
+
* This is where you actually "act like a human" using ctx + your own memory.
|
|
290
|
+
*/
|
|
291
|
+
onAct?: (ctx: AgentLoopContext) => Promise<void> | void;
|
|
292
|
+
onError?: (err: Error) => Promise<void> | void;
|
|
293
|
+
};
|
|
294
|
+
type AgentLoopConfig = {
|
|
295
|
+
survival: SelfReliance;
|
|
296
|
+
fetchSnapshot: () => Promise<ResourceSnapshot>;
|
|
297
|
+
intervalMs?: number;
|
|
298
|
+
/** If true, call survival.guard() before onAct(). Default true. */
|
|
299
|
+
guardAct?: boolean;
|
|
300
|
+
/** Optional override for time source (tests). */
|
|
301
|
+
now?: () => number;
|
|
302
|
+
hooks?: AgentLoopHooks;
|
|
303
|
+
escapeHatch?: AgentLoopEscapeHatchConfig;
|
|
304
|
+
memory?: AgentLoopMemoryConfig;
|
|
305
|
+
durability?: AgentLoopDurabilityConfig;
|
|
306
|
+
strictMemory?: AgentLoopStrictMemoryConfig;
|
|
307
|
+
promptShield?: AgentLoopPromptShieldConfig;
|
|
308
|
+
objectiveGuard?: AgentLoopObjectiveGuardConfig;
|
|
309
|
+
autonomy?: AgentLoopAutonomyConfig;
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Create a closed-loop runner that:
|
|
313
|
+
* 1) fetches a resource snapshot
|
|
314
|
+
* 2) updates SelfReliance
|
|
315
|
+
* 3) classifies survival mode + produces a playbook recommendation
|
|
316
|
+
* 4) auto-evaluates escape hatch in SURVIVE/BLINK (guardrail decision block)
|
|
317
|
+
* 5) optionally runs reflection + action hooks
|
|
318
|
+
*
|
|
319
|
+
* Non-breaking by design: you choose what to do with the context.
|
|
320
|
+
*/
|
|
321
|
+
declare const createAgentLoop: (config: AgentLoopConfig) => {
|
|
322
|
+
start: () => Promise<void>;
|
|
323
|
+
stop: () => void;
|
|
324
|
+
runOnce: () => Promise<void>;
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
export { type AgentHumanDemand as A, type AgentOwnershipMode as B, type AgentPriorityMode as C, type AgentWorkArbitrationDecision as D, createAgentLoop as E, type IntentSignals as I, type LaneMode as L, type ObjectiveChangeProposal as O, type PromptShieldDecision as P, type LaneSwitchDecision as a, type ObjectiveChangeSourceTrust as b, type ObjectiveGuardDecision as c, type ObjectiveGuardPolicy as d, type PromptShieldFlag as e, type PromptShieldInput as f, type PromptShieldPolicy as g, type PromptShieldRisk as h, type PromptShieldTrustLevel as i, applyIntentArbitration as j, evaluateLaneSwitch as k, evaluateObjectiveChange as l, evaluatePromptShield as m, scorePolishLane as n, type AgentLoopAutonomyConfig as o, type AgentLoopConfig as p, type AgentLoopContext as q, type AgentLoopDurabilityConfig as r, scoreBuildLane as s, type AgentLoopEscapeHatchConfig as t, type AgentLoopEscapeHatchInput as u, type AgentLoopHooks as v, type AgentLoopMemoryConfig as w, type AgentLoopObjectiveGuardConfig as x, type AgentLoopPromptShieldConfig as y, type AgentLoopStrictMemoryConfig as z };
|
package/dist/agentLoop.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ import './survivalPlaybook.js';
|
|
|
3
3
|
import './survivalEscapeHatch.js';
|
|
4
4
|
import './compoundingMemory.js';
|
|
5
5
|
import './strictMemoryRuntime.js';
|
|
6
|
-
export { A as AgentHumanDemand,
|
|
6
|
+
export { A as AgentHumanDemand, o as AgentLoopAutonomyConfig, p as AgentLoopConfig, q as AgentLoopContext, r as AgentLoopDurabilityConfig, t as AgentLoopEscapeHatchConfig, u as AgentLoopEscapeHatchInput, v as AgentLoopHooks, w as AgentLoopMemoryConfig, x as AgentLoopObjectiveGuardConfig, y as AgentLoopPromptShieldConfig, z as AgentLoopStrictMemoryConfig, B as AgentOwnershipMode, C as AgentPriorityMode, D as AgentWorkArbitrationDecision, E as createAgentLoop } from './agentLoop-BPdoysXH.js';
|
package/dist/agentLoop.js
CHANGED
|
@@ -5,9 +5,10 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
applyIntentArbitration,
|
|
7
7
|
createDurabilityProxyClient,
|
|
8
|
+
evaluateLaneSwitch,
|
|
8
9
|
evaluateObjectiveChange,
|
|
9
10
|
evaluatePromptShield
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-N3J6WQ72.js";
|
|
11
12
|
import {
|
|
12
13
|
createSelfRelianceMonitor
|
|
13
14
|
} from "./chunk-M7DQTU5R.js";
|
|
@@ -70,6 +71,9 @@ var createAgentLoop = (config) => {
|
|
|
70
71
|
const ownershipMode = config.autonomy?.ownershipMode ?? "owner_bound";
|
|
71
72
|
const priorityMode = config.autonomy?.priorityMode ?? (ownershipMode === "unbound" ? "autonomous_first" : "human_first");
|
|
72
73
|
const rolloutMode = config.autonomy?.rolloutMode ?? "enforce";
|
|
74
|
+
const laneSwitchEnabled = config.autonomy?.intentPolicy?.laneSwitch?.enabled ?? true;
|
|
75
|
+
const laneSwitchBuilderThreshold = config.autonomy?.intentPolicy?.laneSwitch?.builderOnGreenStreak ?? 3;
|
|
76
|
+
let laneState = { lane: "polish", greenStreak: 0 };
|
|
73
77
|
const strictMemoryUpgrade = upgradeToStrictMemoryRuntimePreset({
|
|
74
78
|
current: strictMemoryPreset,
|
|
75
79
|
targetMode: strictMode,
|
|
@@ -262,7 +266,10 @@ var createAgentLoop = (config) => {
|
|
|
262
266
|
expectedBuildRevenue: asFiniteNumber(raw.expectedBuildRevenue),
|
|
263
267
|
expectedPolishValue: asFiniteNumber(raw.expectedPolishValue),
|
|
264
268
|
expectedPolishRevenueProtection: asFiniteNumber(raw.expectedPolishRevenueProtection),
|
|
265
|
-
urgentUserDemand: asBoolean(raw.urgentUserDemand)
|
|
269
|
+
urgentUserDemand: asBoolean(raw.urgentUserDemand),
|
|
270
|
+
releaseReady: asBoolean(raw.releaseReady) ?? asBoolean(raw.ready),
|
|
271
|
+
criticalPolishSignal: asBoolean(raw.criticalPolishSignal),
|
|
272
|
+
builderObjectiveAvailable: asBoolean(raw.builderObjectiveAvailable)
|
|
266
273
|
};
|
|
267
274
|
};
|
|
268
275
|
const runOnce = async () => {
|
|
@@ -345,6 +352,7 @@ var createAgentLoop = (config) => {
|
|
|
345
352
|
runAutonomousTask: false,
|
|
346
353
|
reason: "legacy_onAct"
|
|
347
354
|
};
|
|
355
|
+
let laneDecision;
|
|
348
356
|
if (autonomyEnabled && config.autonomy?.onAutonomous) {
|
|
349
357
|
if (priorityMode === "human_first") {
|
|
350
358
|
arbitrationBase.runHumanTask = humanDemand.pending;
|
|
@@ -356,8 +364,26 @@ var createAgentLoop = (config) => {
|
|
|
356
364
|
arbitrationBase.reason = humanDemand.pending ? "autonomous_first_with_human_pending" : "autonomous_first_idle";
|
|
357
365
|
}
|
|
358
366
|
const intentEnabled = config.autonomy?.intentPolicy?.enabled ?? true;
|
|
367
|
+
const intentSignals = intentEnabled ? await resolveIntentSignals({ snapshot, survivalMode, humanDemand }) : null;
|
|
368
|
+
if (laneSwitchEnabled) {
|
|
369
|
+
laneDecision = evaluateLaneSwitch({
|
|
370
|
+
previousLane: laneState.lane,
|
|
371
|
+
previousGreenStreak: laneState.greenStreak,
|
|
372
|
+
releaseReady: intentSignals?.releaseReady ?? true,
|
|
373
|
+
criticalPolishSignal: intentSignals?.criticalPolishSignal ?? false,
|
|
374
|
+
builderObjectiveAvailable: intentSignals?.builderObjectiveAvailable,
|
|
375
|
+
builderOnGreenStreak: laneSwitchBuilderThreshold
|
|
376
|
+
});
|
|
377
|
+
laneState = { lane: laneDecision.lane, greenStreak: laneDecision.greenStreak };
|
|
378
|
+
arbitrationBase.lane = laneDecision.lane;
|
|
379
|
+
arbitrationBase.laneDecision = laneDecision;
|
|
380
|
+
if (laneDecision.lane === "polish") {
|
|
381
|
+
arbitrationBase.runHumanTask = true;
|
|
382
|
+
arbitrationBase.runAutonomousTask = false;
|
|
383
|
+
arbitrationBase.reason = `lane_polish:${laneDecision.reason}`;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
359
386
|
if (intentEnabled) {
|
|
360
|
-
const intentSignals = await resolveIntentSignals({ snapshot, survivalMode, humanDemand });
|
|
361
387
|
Object.assign(
|
|
362
388
|
arbitrationBase,
|
|
363
389
|
applyIntentArbitration({
|
|
@@ -366,6 +392,17 @@ var createAgentLoop = (config) => {
|
|
|
366
392
|
signals: intentSignals || void 0
|
|
367
393
|
})
|
|
368
394
|
);
|
|
395
|
+
if (laneDecision?.lane === "builder") {
|
|
396
|
+
arbitrationBase.runAutonomousTask = true;
|
|
397
|
+
arbitrationBase.reason = `lane_builder:${laneDecision.reason}`;
|
|
398
|
+
if (humanDemand.pending && ownershipMode === "owner_bound" && priorityMode === "human_first") {
|
|
399
|
+
arbitrationBase.runHumanTask = true;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (laneDecision?.lane === "polish") {
|
|
403
|
+
arbitrationBase.runHumanTask = true;
|
|
404
|
+
arbitrationBase.runAutonomousTask = false;
|
|
405
|
+
}
|
|
369
406
|
}
|
|
370
407
|
}
|
|
371
408
|
const ctx = {
|
|
@@ -385,6 +422,7 @@ var createAgentLoop = (config) => {
|
|
|
385
422
|
promptShieldDecision,
|
|
386
423
|
objectiveGuardDecision,
|
|
387
424
|
workArbitration: arbitrationBase,
|
|
425
|
+
laneDecision,
|
|
388
426
|
timestamp
|
|
389
427
|
};
|
|
390
428
|
if (hooks.onCycle) await hooks.onCycle(ctx);
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
// src/durabilityProxy.ts
|
|
2
|
+
var withTimeout = async (fetcher, input, init, timeoutMs) => {
|
|
3
|
+
const controller = new AbortController();
|
|
4
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
5
|
+
try {
|
|
6
|
+
return await fetcher(input, { ...init, signal: controller.signal });
|
|
7
|
+
} finally {
|
|
8
|
+
clearTimeout(timer);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
var readJson = async (response) => {
|
|
12
|
+
const text = await response.text();
|
|
13
|
+
if (!text) return null;
|
|
14
|
+
try {
|
|
15
|
+
return JSON.parse(text);
|
|
16
|
+
} catch {
|
|
17
|
+
return { raw: text };
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var createDurabilityProxyClient = (options) => {
|
|
21
|
+
const fetcher = options.fetcher || fetch;
|
|
22
|
+
const timeoutMs = Number.isFinite(Number(options.timeoutMs)) ? Math.max(500, Number(options.timeoutMs)) : 8e3;
|
|
23
|
+
const base = String(options.baseUrl || "").replace(/\/+$/, "");
|
|
24
|
+
const agentId = String(options.agentId || "").trim();
|
|
25
|
+
const agentToken = String(options.agentToken || "").trim();
|
|
26
|
+
if (!base) throw new Error("durability_proxy_base_missing");
|
|
27
|
+
if (!agentId) throw new Error("durability_proxy_agent_id_missing");
|
|
28
|
+
if (!agentToken) throw new Error("durability_proxy_agent_token_missing");
|
|
29
|
+
const headers = {
|
|
30
|
+
"content-type": "application/json",
|
|
31
|
+
"x-agent-id": agentId,
|
|
32
|
+
"x-agent-token": agentToken
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
async writeCheckpoint(payloadJson, opts = {}) {
|
|
36
|
+
const response = await withTimeout(
|
|
37
|
+
fetcher,
|
|
38
|
+
`${base}/v1/checkpoints`,
|
|
39
|
+
{
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers,
|
|
42
|
+
body: JSON.stringify({
|
|
43
|
+
payloadJson,
|
|
44
|
+
sha256: opts.sha256,
|
|
45
|
+
contentType: opts.contentType,
|
|
46
|
+
metadata: opts.metadata
|
|
47
|
+
})
|
|
48
|
+
},
|
|
49
|
+
timeoutMs
|
|
50
|
+
);
|
|
51
|
+
const body = await readJson(response);
|
|
52
|
+
if (!response.ok) {
|
|
53
|
+
const detail = body?.error || `http_${response.status}`;
|
|
54
|
+
throw new Error(`durability_checkpoint_write_failed:${detail}`);
|
|
55
|
+
}
|
|
56
|
+
return body;
|
|
57
|
+
},
|
|
58
|
+
async latestCheckpoint() {
|
|
59
|
+
const response = await withTimeout(
|
|
60
|
+
fetcher,
|
|
61
|
+
`${base}/v1/checkpoints/latest`,
|
|
62
|
+
{ method: "GET", headers: { "x-agent-id": agentId, "x-agent-token": agentToken } },
|
|
63
|
+
timeoutMs
|
|
64
|
+
);
|
|
65
|
+
const body = await readJson(response);
|
|
66
|
+
if (!response.ok) {
|
|
67
|
+
const detail = body?.error || `http_${response.status}`;
|
|
68
|
+
throw new Error(`durability_checkpoint_latest_failed:${detail}`);
|
|
69
|
+
}
|
|
70
|
+
return body;
|
|
71
|
+
},
|
|
72
|
+
async writeRestoreDrill(ok, opts = {}) {
|
|
73
|
+
const response = await withTimeout(
|
|
74
|
+
fetcher,
|
|
75
|
+
`${base}/v1/checkpoints/restore-drill`,
|
|
76
|
+
{
|
|
77
|
+
method: "POST",
|
|
78
|
+
headers,
|
|
79
|
+
body: JSON.stringify({
|
|
80
|
+
checkpointId: opts.checkpointId,
|
|
81
|
+
ok,
|
|
82
|
+
details: opts.details
|
|
83
|
+
})
|
|
84
|
+
},
|
|
85
|
+
timeoutMs
|
|
86
|
+
);
|
|
87
|
+
const body = await readJson(response);
|
|
88
|
+
if (!response.ok) {
|
|
89
|
+
const detail = body?.error || `http_${response.status}`;
|
|
90
|
+
throw new Error(`durability_restore_drill_write_failed:${detail}`);
|
|
91
|
+
}
|
|
92
|
+
return body;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// src/promptShield.ts
|
|
98
|
+
var RULES = [
|
|
99
|
+
{
|
|
100
|
+
flag: "instruction_override",
|
|
101
|
+
risk: "high",
|
|
102
|
+
test: [/ignore\s+(all\s+)?previous/i, /disregard\s+instructions/i, /new\s+system\s+prompt/i]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
flag: "credential_exfiltration",
|
|
106
|
+
risk: "high",
|
|
107
|
+
test: [/api\s*key/i, /private\s*key/i, /seed\s*phrase/i, /wallet\s*secret/i, /send\s+me\s+your\s+token/i]
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
flag: "destructive_command",
|
|
111
|
+
risk: "high",
|
|
112
|
+
test: [/\brm\s+-rf\b/i, /drop\s+database/i, /delete\s+all/i, /overwrite\s+memory/i]
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
flag: "authority_spoof",
|
|
116
|
+
risk: "medium",
|
|
117
|
+
test: [/as\s+your\s+owner/i, /authorized\s+admin/i, /from\s+charles/i]
|
|
118
|
+
}
|
|
119
|
+
];
|
|
120
|
+
var rankRisk = (a, b) => {
|
|
121
|
+
const w = { low: 1, medium: 2, high: 3 };
|
|
122
|
+
return w[a] >= w[b] ? a : b;
|
|
123
|
+
};
|
|
124
|
+
var toDefaultBlockSet = () => /* @__PURE__ */ new Set(["instruction_override", "credential_exfiltration", "destructive_command", "authority_spoof", "sensitive_action_without_trust"]);
|
|
125
|
+
var evaluatePromptShield = (inputs, options = {}) => {
|
|
126
|
+
const policy = options.policy || {};
|
|
127
|
+
const blockSet = policy.blockOnFlags ? new Set(policy.blockOnFlags) : toDefaultBlockSet();
|
|
128
|
+
const rationale = [];
|
|
129
|
+
const blockedInputs = [];
|
|
130
|
+
const flags = /* @__PURE__ */ new Set();
|
|
131
|
+
let risk = "low";
|
|
132
|
+
for (const input of inputs) {
|
|
133
|
+
if (input.trust !== "external_untrusted") continue;
|
|
134
|
+
const text = String(input.content || "");
|
|
135
|
+
for (const rule of RULES) {
|
|
136
|
+
if (rule.test.some((rx) => rx.test(text))) {
|
|
137
|
+
flags.add(rule.flag);
|
|
138
|
+
risk = rankRisk(risk, rule.risk);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (options.isSensitiveAction) {
|
|
143
|
+
const hasTrusted = inputs.some((i) => i.trust === "trusted_human" || i.trust === "internal_system");
|
|
144
|
+
if (!hasTrusted) {
|
|
145
|
+
flags.add("sensitive_action_without_trust");
|
|
146
|
+
risk = rankRisk(risk, "high");
|
|
147
|
+
rationale.push("Sensitive action lacks trusted human/system intent; external input cannot authorize mutation.");
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const blocked = [...flags].some((f) => blockSet.has(f));
|
|
151
|
+
if (blocked) {
|
|
152
|
+
for (const input of inputs) {
|
|
153
|
+
if (input.trust === "external_untrusted") blockedInputs.push(input);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (!flags.size) {
|
|
157
|
+
rationale.push("No injection indicators detected in untrusted sources.");
|
|
158
|
+
} else {
|
|
159
|
+
rationale.push(`Detected prompt-shield flags: ${[...flags].join(",")}`);
|
|
160
|
+
}
|
|
161
|
+
if (policy.allowUntrustedForAnalysisOnly && blocked) {
|
|
162
|
+
rationale.push("Untrusted content may be used for analysis only; execution remains blocked.");
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
allow: !blocked,
|
|
166
|
+
risk,
|
|
167
|
+
flags: [...flags],
|
|
168
|
+
rationale,
|
|
169
|
+
blockedInputs
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// src/objectiveGuard.ts
|
|
174
|
+
var normalize = (v) => String(v || "").trim().toLowerCase();
|
|
175
|
+
var isExplicitInstruction = (text) => /\b(do this instead|switch objective|change objective|stop current objective|ignore current objective)\b/i.test(
|
|
176
|
+
text || ""
|
|
177
|
+
);
|
|
178
|
+
var missionAlignment = (currentObjective, proposedObjective) => {
|
|
179
|
+
const a = new Set(normalize(currentObjective).split(/\W+/).filter(Boolean));
|
|
180
|
+
const b = new Set(normalize(proposedObjective).split(/\W+/).filter(Boolean));
|
|
181
|
+
if (!a.size || !b.size) return false;
|
|
182
|
+
let overlap = 0;
|
|
183
|
+
for (const tok of b) if (a.has(tok)) overlap += 1;
|
|
184
|
+
return overlap / Math.max(1, b.size) >= 0.2;
|
|
185
|
+
};
|
|
186
|
+
var evaluateObjectiveChange = (proposal, policy = {}) => {
|
|
187
|
+
const requireMissionAlignment = policy.requireMissionAlignment ?? true;
|
|
188
|
+
const requireEvidenceVerification = policy.requireEvidenceVerification ?? true;
|
|
189
|
+
const allowExternalExplicitInstruction = policy.allowExternalExplicitInstruction ?? false;
|
|
190
|
+
const explicitInstruction = isExplicitInstruction(proposal.proposedObjective) || isExplicitInstruction(proposal.rationale || "");
|
|
191
|
+
const missionAligned = missionAlignment(proposal.currentObjective, proposal.proposedObjective);
|
|
192
|
+
const evidence = Array.isArray(proposal.evidence) ? proposal.evidence : [];
|
|
193
|
+
const evidenceProvided = evidence.length > 0;
|
|
194
|
+
const evidenceVerified = evidenceProvided && evidence.every((e) => e.verified === true);
|
|
195
|
+
if (proposal.trust === "trusted_human" || proposal.trust === "internal_system") {
|
|
196
|
+
return {
|
|
197
|
+
allowObjectiveChange: true,
|
|
198
|
+
reason: "trusted_source_override",
|
|
199
|
+
checks: { explicitInstruction, missionAligned, evidenceProvided, evidenceVerified },
|
|
200
|
+
risk: "low"
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
if (explicitInstruction && !allowExternalExplicitInstruction) {
|
|
204
|
+
return {
|
|
205
|
+
allowObjectiveChange: false,
|
|
206
|
+
reason: "external_explicit_instruction_blocked",
|
|
207
|
+
checks: { explicitInstruction, missionAligned, evidenceProvided, evidenceVerified },
|
|
208
|
+
risk: "high"
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
if (requireMissionAlignment && !missionAligned) {
|
|
212
|
+
return {
|
|
213
|
+
allowObjectiveChange: false,
|
|
214
|
+
reason: "mission_alignment_failed",
|
|
215
|
+
checks: { explicitInstruction, missionAligned, evidenceProvided, evidenceVerified },
|
|
216
|
+
risk: "high"
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
if (!evidenceProvided) {
|
|
220
|
+
return {
|
|
221
|
+
allowObjectiveChange: false,
|
|
222
|
+
reason: "evidence_missing",
|
|
223
|
+
checks: { explicitInstruction, missionAligned, evidenceProvided, evidenceVerified },
|
|
224
|
+
risk: "medium"
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
if (requireEvidenceVerification && !evidenceVerified) {
|
|
228
|
+
return {
|
|
229
|
+
allowObjectiveChange: false,
|
|
230
|
+
reason: "evidence_unverified",
|
|
231
|
+
checks: { explicitInstruction, missionAligned, evidenceProvided, evidenceVerified },
|
|
232
|
+
risk: "high"
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
return {
|
|
236
|
+
allowObjectiveChange: true,
|
|
237
|
+
reason: "reasoned_external_change_allowed",
|
|
238
|
+
checks: { explicitInstruction, missionAligned, evidenceProvided, evidenceVerified },
|
|
239
|
+
risk: "low"
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
// src/intentArbitration.ts
|
|
244
|
+
var clamp = (n) => Math.max(0, Math.min(1, n));
|
|
245
|
+
var scoreBuildLane = (signals, survivalMode) => {
|
|
246
|
+
const value = clamp(signals.expectedBuildValue ?? 0.5);
|
|
247
|
+
const revenue = clamp(signals.expectedBuildRevenue ?? 0.5);
|
|
248
|
+
const base = value * 0.55 + revenue * 0.45;
|
|
249
|
+
if (survivalMode === "SURVIVE") return clamp(base + 0.1 * revenue);
|
|
250
|
+
if (survivalMode === "BLINK") return clamp(base * 0.6);
|
|
251
|
+
return base;
|
|
252
|
+
};
|
|
253
|
+
var scorePolishLane = (signals, survivalMode, humanDemand) => {
|
|
254
|
+
const value = clamp(signals.expectedPolishValue ?? (humanDemand.pending ? 0.8 : 0.4));
|
|
255
|
+
const protect = clamp(signals.expectedPolishRevenueProtection ?? (humanDemand.pending ? 0.7 : 0.4));
|
|
256
|
+
const demandBoost = humanDemand.pending || signals.urgentUserDemand ? 0.2 : 0;
|
|
257
|
+
const base = clamp(value * 0.6 + protect * 0.4 + demandBoost);
|
|
258
|
+
if (survivalMode === "BLINK") return clamp(base * 0.8);
|
|
259
|
+
return base;
|
|
260
|
+
};
|
|
261
|
+
var evaluateLaneSwitch = (input) => {
|
|
262
|
+
const prevLane = input.previousLane ?? "polish";
|
|
263
|
+
const prevGreen = Number(input.previousGreenStreak ?? 0);
|
|
264
|
+
const threshold = Math.max(1, Number(input.builderOnGreenStreak ?? 3));
|
|
265
|
+
const critical = Boolean(input.criticalPolishSignal);
|
|
266
|
+
const objective = input.builderObjectiveAvailable !== false;
|
|
267
|
+
if (!input.releaseReady) {
|
|
268
|
+
return { lane: "polish", greenStreak: 0, switched: prevLane !== "polish", reason: "release_not_ready" };
|
|
269
|
+
}
|
|
270
|
+
const greenStreak = prevGreen + 1;
|
|
271
|
+
if (critical) {
|
|
272
|
+
return { lane: "polish", greenStreak, switched: prevLane !== "polish", reason: "critical_polish_signal" };
|
|
273
|
+
}
|
|
274
|
+
if (prevLane === "builder") {
|
|
275
|
+
return { lane: objective ? "builder" : "polish", greenStreak, switched: !objective, reason: objective ? "builder_hold" : "builder_objective_missing" };
|
|
276
|
+
}
|
|
277
|
+
if (greenStreak < threshold) {
|
|
278
|
+
return { lane: "polish", greenStreak, switched: false, reason: `green_streak_below_threshold:${greenStreak}/${threshold}` };
|
|
279
|
+
}
|
|
280
|
+
if (!objective) {
|
|
281
|
+
return { lane: "polish", greenStreak, switched: false, reason: "builder_objective_missing" };
|
|
282
|
+
}
|
|
283
|
+
return { lane: "builder", greenStreak, switched: true, reason: `green_streak_promote:${greenStreak}/${threshold}` };
|
|
284
|
+
};
|
|
285
|
+
var applyIntentArbitration = (input) => {
|
|
286
|
+
const { base, survivalMode } = input;
|
|
287
|
+
const signals = input.signals || {};
|
|
288
|
+
const buildScore = scoreBuildLane(signals, survivalMode);
|
|
289
|
+
const polishScore = scorePolishLane(signals, survivalMode, base.humanDemand);
|
|
290
|
+
const out = { ...base };
|
|
291
|
+
if (base.ownershipMode === "owner_bound" && base.humanDemand.pending) {
|
|
292
|
+
out.runHumanTask = true;
|
|
293
|
+
out.runAutonomousTask = base.priorityMode === "autonomous_first" ? buildScore >= 0.5 : buildScore >= 0.65;
|
|
294
|
+
out.reason = out.runAutonomousTask ? "intent_parallel_build_and_polish" : "intent_polish_preempts_build";
|
|
295
|
+
return out;
|
|
296
|
+
}
|
|
297
|
+
if (!base.humanDemand.pending) {
|
|
298
|
+
out.runHumanTask = false;
|
|
299
|
+
out.runAutonomousTask = buildScore >= 0.45 || polishScore >= 0.45;
|
|
300
|
+
out.reason = out.runAutonomousTask ? "intent_build_or_polish_window" : "intent_hold_low_expected_value";
|
|
301
|
+
return out;
|
|
302
|
+
}
|
|
303
|
+
if (base.ownershipMode === "unbound") {
|
|
304
|
+
out.runAutonomousTask = true;
|
|
305
|
+
out.runHumanTask = true;
|
|
306
|
+
out.reason = "intent_unbound_parallel";
|
|
307
|
+
}
|
|
308
|
+
return out;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
export {
|
|
312
|
+
createDurabilityProxyClient,
|
|
313
|
+
evaluatePromptShield,
|
|
314
|
+
evaluateObjectiveChange,
|
|
315
|
+
scoreBuildLane,
|
|
316
|
+
scorePolishLane,
|
|
317
|
+
evaluateLaneSwitch,
|
|
318
|
+
applyIntentArbitration
|
|
319
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { MarketDiscoveryClient, MarketNeed, MarketSignal, deriveMarketNeeds, dis
|
|
|
9
9
|
export { A as AdapterBestShotChecklistResult, a as AdapterPackKind, b as AdapterPackOptions, c as AdaptiveAdaptationPlan, d as AdaptiveExecution, e as AdaptiveFeedbackAggregate, f as AdaptivePolicyConfig, g as AdaptivePolicyDecision, h as AdaptivePolicyState, i as AdaptiveReflectionStore, j as AdaptiveTheme, k as AdaptiveVerification, l as AgentLaunchRuntimeOptions, m as AgentLaunchRuntimeResult, n as AgentResourceProvidersManifest, o as AgentReviewRuntimeOptions, p as AnalyticsPoint, q as ApiCreditProvider, r as ApiCreditProviderFactoryOptions, s as ApiCreditProviderPreset, t as ApiCreditProviderPresetInput, u as ApiResponse, B as BuybackEvent, C as CONTEXT_PACK_SECTION_ORDER, v as ContextPack, w as ContextPackBudget, x as ContextPackGateOptions, y as ContextPackGateResult, z as ContextPackInput, D as ContextPackOptions, E as ContextPackSectionKey, F as ContextPackSections, G as ContextPackState, H as DurabilityCheckpointWriteOptions, I as DurabilityProxyClientOptions, J as DurabilityRestoreDrillWriteOptions, K as ExecutionAdapter, L as ExecutionApplyResult, M as ExecutionDecisionRecord, N as ExecutionDryRunResult, O as ExecutionPostDeployVerifyResult, P as ExecutionRollbackResult, Q as ExecutionRolloutMode, R as ExecutionRunResult, S as ExecutionValidateResult, T as LISTING_NAME_MAX_LENGTH, U as LISTING_NAME_RECOMMENDED_MAX, V as LISTING_TAGLINE_MAX_LENGTH, W as LISTING_TAGLINE_RECOMMENDED_MAX, X as LaunchProfile, Y as LaunchReadinessInput, Z as LaunchReadinessResult, _ as LeaderboardEntry, $ as LeaderboardQuery, a0 as ListingNamingValidationOptions, a1 as ListingNamingValidationResult, a2 as ListingQuery, a3 as ListingReviewCreatePayload, a4 as ListingReviewResponsePayload, a5 as ListingVersionPayload, a6 as MarketingCampaign, a7 as MarketingLinkOptions, a8 as MemoryPingChallengeResponse, a9 as MemoryPingPayload, aa as OpenRouterCredits, ab as ProcurementCandidate, ac as ProcurementDecision, ad as ProcurementTaskProfile, ae as ProcurementWeights, af as ResourceProviderManifestEntry, ag as ResourceSnapshot, ah as ReviewGate, ai as ReviewGateRecord, aj as ReviewRequiredPayload, ak as RunAdaptiveReflectionOptions, al as RuntimeMigrationInput, am as RuntimeMigrationPlan, an as RuntimeStateSnapshot, ao as SdkAutoUpdatedRestartRequiredError, ap as SdkUpdateCheckOptions, aq as SdkUpdatePolicyCheckOptions, ar as SdkUpdateRequiredError, as as SdkUpdateStatus, TopupDecision, TopupRequest, TreasuryLedgerEvent, TreasuryPolicy, TreasuryPolicyV1, TreasuryState, at as VIBEIAO_IDL, au as VibeClient, av as VibeClientOptions, aw as VibeRegistry, ax as aggregateFeedbackSignals, ay as assertLaunchReady, az as assertSurvivalProvidersConfigured, aA as buildAdaptivePlan, aB as buildBadgeMarkdown, aC as buildClaimMessage, aD as buildDecisionRecord, aE as buildJupiterSwapUrl, aF as buildListingVersionMessage, aG as buildMemoryPingMessage, aH as buildOwnerTransferMessage, aI as buildProcurementPrompt, aJ as buildRaydiumSwapUrl, aK as buildReviewPrompt, aL as buildReviewRequired, aM as buildReviewResponseMessage, aN as buildRuntimeMigrationPlan, aO as buildSdkUpdateCommand, aP as buildShareCopy, aQ as buildShareLink, aR as buildTradeLinks, buildTreasuryLedgerEvent, aS as checkForSdkUpdate, aT as checkForSdkUpdatePolicy, aU as compareVersions, aV as createApiCreditProvider, aW as createApiCreditProviders, aX as createApiCreditProvidersFromManifest, aY as createCampaign, aZ as createContextPack, a_ as createCustomAdapter, a$ as createDurabilityProxyClient, b0 as createServiceApiAdapter, createTreasuryPolicy, b1 as createWebBundledAdapter, b2 as createWebStaticAdapter, b3 as createWorkflowAgentAdapter, b4 as decideProcurementForTask, b5 as estimateContextPackTokens, b6 as evaluateAdaptiveReflectionPolicy, b7 as evaluateContextPackGate, b8 as evaluateLaunchReadiness, evaluateTopupRequest, b9 as getResourceSnapshot, ba as normalizeListingText, bb as rankListingsForTask, bc as runAdapterBestShotChecklist, bd as runAdaptiveReflectionCycle, be as runAgentLaunchRuntime, bf as runAgentLaunchRuntimeCycle, bg as runAgentReviewRuntimeCycle, bh as runExecutionAdapter, bi as sanitizeListingNaming, bj as scoreListingForTask, bk as shouldAnnounceStateChange, treasuryStateFromSnapshot, bl as validateContextPack, bm as validateListingNaming, validateTreasuryPolicy, bn as verifyAdaptiveExecutionReadiness } from './treasuryGuardian.js';
|
|
10
10
|
export { OUTCOME_BOUND_FLOW_SCHEMA, OUTCOME_BOUND_REQUIRED_GATES, OutcomeBoundRequiredGate, OutcomeBoundRunInput, OutcomeBoundRunStatus, assertOutcomeBoundCompleted, evaluateOutcomeBoundRun } from './outcomeBoundFlow.js';
|
|
11
11
|
export { STRICT_MEMORY_RUNTIME_SCHEMA, StrictMemoryEvaluation, StrictMemoryEvaluationInput, StrictMemoryRuntimePreset, StrictMemoryTriggerSet, StrictMemoryUpgradeInput, StrictMemoryUpgradePolicy, StrictMemoryUpgradeResult, createStrictMemoryRuntimePreset, evaluateStrictMemoryExecution, isComplexTask, upgradeToStrictMemoryRuntimePreset } from './strictMemoryRuntime.js';
|
|
12
|
-
export { I as IntentSignals, O as ObjectiveChangeProposal,
|
|
12
|
+
export { I as IntentSignals, L as LaneMode, a as LaneSwitchDecision, O as ObjectiveChangeProposal, b as ObjectiveChangeSourceTrust, c as ObjectiveGuardDecision, d as ObjectiveGuardPolicy, P as PromptShieldDecision, e as PromptShieldFlag, f as PromptShieldInput, g as PromptShieldPolicy, h as PromptShieldRisk, i as PromptShieldTrustLevel, j as applyIntentArbitration, k as evaluateLaneSwitch, l as evaluateObjectiveChange, m as evaluatePromptShield, s as scoreBuildLane, n as scorePolishLane } from './agentLoop-BPdoysXH.js';
|
|
13
13
|
export { fetchSolBalance, fetchTokenBalance, fetchTokenBalances } from './solana.js';
|
|
14
14
|
import './compoundingMemory.js';
|
|
15
15
|
import '@coral-xyz/anchor';
|
package/dist/index.js
CHANGED
|
@@ -19,11 +19,12 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
applyIntentArbitration,
|
|
21
21
|
createDurabilityProxyClient,
|
|
22
|
+
evaluateLaneSwitch,
|
|
22
23
|
evaluateObjectiveChange,
|
|
23
24
|
evaluatePromptShield,
|
|
24
25
|
scoreBuildLane,
|
|
25
26
|
scorePolishLane
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-N3J6WQ72.js";
|
|
27
28
|
import {
|
|
28
29
|
SelfReliance,
|
|
29
30
|
createAutoSelfReliance,
|
|
@@ -1111,7 +1112,7 @@ var ReviewGate = class {
|
|
|
1111
1112
|
var DEFAULT_API_BASE = "https://api.vibeiao.com";
|
|
1112
1113
|
var DEFAULT_WEB_BASE = "https://vibeiao.com";
|
|
1113
1114
|
var DEFAULT_SDK_PACKAGE = "@vibeiao/sdk";
|
|
1114
|
-
var DEFAULT_SDK_VERSION = "0.1.
|
|
1115
|
+
var DEFAULT_SDK_VERSION = "0.1.51" ? "0.1.51" : "0.1.4";
|
|
1115
1116
|
var DEFAULT_SDK_REGISTRY = "https://registry.npmjs.org";
|
|
1116
1117
|
var DEFAULT_SDK_POLICY_PATH = "/v1/sdk/policy";
|
|
1117
1118
|
var DEFAULT_SDK_CHECK_INTERVAL_MS = 1e3 * 60 * 30;
|
|
@@ -2299,6 +2300,7 @@ export {
|
|
|
2299
2300
|
evaluateAdaptiveReflectionPolicy,
|
|
2300
2301
|
evaluateContextPackGate,
|
|
2301
2302
|
evaluateEscapeHatch,
|
|
2303
|
+
evaluateLaneSwitch,
|
|
2302
2304
|
evaluateLaunchReadiness,
|
|
2303
2305
|
evaluateObjectiveChange,
|
|
2304
2306
|
evaluateOutcomeBoundRun,
|
|
@@ -8,7 +8,7 @@ import './survivalEscapeHatch.js';
|
|
|
8
8
|
import './marketDiscovery.js';
|
|
9
9
|
import './outcomeBoundFlow.js';
|
|
10
10
|
import './strictMemoryRuntime.js';
|
|
11
|
-
import './agentLoop-
|
|
11
|
+
import './agentLoop-BPdoysXH.js';
|
|
12
12
|
import './solana.js';
|
|
13
13
|
import './compoundingMemory.js';
|
|
14
14
|
import '@coral-xyz/anchor';
|
|
@@ -1474,7 +1474,7 @@ declare class ReviewGate {
|
|
|
1474
1474
|
assertClear(listingId: string, wallet: string): void;
|
|
1475
1475
|
}
|
|
1476
1476
|
|
|
1477
|
-
declare const compareVersions: (currentVersion: string, latestVersion: string) =>
|
|
1477
|
+
declare const compareVersions: (currentVersion: string, latestVersion: string) => 1 | 0 | -1;
|
|
1478
1478
|
declare const buildSdkUpdateCommand: (packageName?: string) => string;
|
|
1479
1479
|
declare const checkForSdkUpdate: (options?: SdkUpdateCheckOptions) => Promise<SdkUpdateStatus>;
|
|
1480
1480
|
declare const checkForSdkUpdatePolicy: (options: SdkUpdatePolicyCheckOptions) => Promise<SdkUpdateStatus>;
|