@vibeiao/sdk 0.1.55 → 0.1.57

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.
@@ -0,0 +1,362 @@
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 AgentAutonomousTaskKind = 'polish_existing_product' | 'build_new_product';
172
+ type AgentResearchSnapshot = {
173
+ generatedAt?: string;
174
+ summary?: string;
175
+ recommendation?: string;
176
+ };
177
+ type AgentBespokeSnapshot = {
178
+ bespokeKey?: string;
179
+ divergedFromTemplate?: boolean;
180
+ noveltyScore?: number;
181
+ };
182
+ type AgentWorkArbitrationDecision = {
183
+ ownershipMode: AgentOwnershipMode;
184
+ priorityMode: AgentPriorityMode;
185
+ rolloutMode: 'observe' | 'enforce';
186
+ humanDemand: AgentHumanDemand;
187
+ runHumanTask: boolean;
188
+ runAutonomousTask: boolean;
189
+ lane?: LaneMode;
190
+ laneDecision?: LaneSwitchDecision;
191
+ proactiveBuildSuggested?: boolean;
192
+ autonomousTaskKind?: AgentAutonomousTaskKind;
193
+ reason: string;
194
+ };
195
+ type AgentLoopAutonomyConfig = {
196
+ enabled?: boolean;
197
+ ownershipMode?: AgentOwnershipMode;
198
+ priorityMode?: AgentPriorityMode;
199
+ rolloutMode?: 'observe' | 'enforce';
200
+ resolveHumanDemand?: () => Promise<boolean | AgentHumanDemand> | boolean | AgentHumanDemand;
201
+ intentPolicy?: {
202
+ enabled?: boolean;
203
+ laneSwitch?: {
204
+ enabled?: boolean;
205
+ builderOnGreenStreak?: number;
206
+ };
207
+ researchGate?: {
208
+ enabled?: boolean;
209
+ maxAgeMs?: number;
210
+ resolveSnapshot?: (ctx: {
211
+ snapshot: ResourceSnapshot;
212
+ survivalMode: SurvivalMode;
213
+ humanDemand: AgentHumanDemand;
214
+ }) => Promise<AgentResearchSnapshot | null> | AgentResearchSnapshot | null;
215
+ };
216
+ bespokeGate?: {
217
+ enabled?: boolean;
218
+ minNoveltyScore?: number;
219
+ resolveSnapshot?: (ctx: {
220
+ snapshot: ResourceSnapshot;
221
+ survivalMode: SurvivalMode;
222
+ humanDemand: AgentHumanDemand;
223
+ }) => Promise<AgentBespokeSnapshot | null> | AgentBespokeSnapshot | null;
224
+ };
225
+ resolveSignals?: (ctx: {
226
+ snapshot: ResourceSnapshot;
227
+ survivalMode: SurvivalMode;
228
+ humanDemand: AgentHumanDemand;
229
+ }) => Promise<IntentSignals | null> | IntentSignals | null;
230
+ };
231
+ onAutonomous?: (ctx: AgentLoopContext, task?: {
232
+ kind: AgentAutonomousTaskKind;
233
+ }) => Promise<void> | void;
234
+ onArbitration?: (decision: AgentWorkArbitrationDecision, ctx: AgentLoopContext) => Promise<void> | void;
235
+ };
236
+ type AgentLoopContext = {
237
+ snapshot: ResourceSnapshot;
238
+ survivalState: SelfRelianceState;
239
+ survivalMode: SurvivalMode;
240
+ survivalRecommendation: SurvivalRecommendation;
241
+ survivalFormatted: string;
242
+ /** Deterministic block for planners/loggers: survival + escape-hatch decision (if present). */
243
+ survivalDecisionBlock: string;
244
+ /** Present when escape-hatch evaluation runs (SURVIVE/BLINK by default). */
245
+ escapeHatchDecision?: EscapeHatchDecision;
246
+ escapeHatchFormatted?: string;
247
+ /** Present when memory auto-upgrade is enabled in the loop. */
248
+ memoryUpgrade?: CompoundingMemoryUpgradeResult;
249
+ /** Present when required-set maintenance check runs (default daily). */
250
+ memoryRequiredSet?: CompoundingMemoryRequiredSetResult;
251
+ /** Strict-memory runtime preset + per-cycle evaluation status. */
252
+ strictMemoryPreset?: StrictMemoryRuntimePreset;
253
+ strictMemoryEvaluation?: StrictMemoryEvaluation;
254
+ strictMemoryUpgrade?: StrictMemoryUpgradeResult;
255
+ /** Prompt-injection shield decision for this cycle. */
256
+ promptShieldDecision?: PromptShieldDecision;
257
+ /** Objective integrity guard decision for this cycle (when proposal exists). */
258
+ objectiveGuardDecision?: ObjectiveGuardDecision;
259
+ /** Human-vs-autonomous work arbitration decision for this cycle. */
260
+ workArbitration?: AgentWorkArbitrationDecision;
261
+ laneDecision?: LaneSwitchDecision;
262
+ researchSnapshot?: AgentResearchSnapshot;
263
+ bespokeSnapshot?: AgentBespokeSnapshot;
264
+ timestamp: number;
265
+ };
266
+ type AgentLoopMemoryConfig = {
267
+ /** Enable one-time memory scaffold upgrade. Default true. */
268
+ enabled?: boolean;
269
+ /** Workspace root for compounding memory files. Default current working directory ("."). */
270
+ root?: string;
271
+ /** Timezone for daily ledger date key. Default UTC. */
272
+ timeZone?: string;
273
+ /** Hook called after memory upgrade check completes. */
274
+ onUpgrade?: (result: CompoundingMemoryUpgradeResult) => Promise<void> | void;
275
+ /** Enable required-set maintenance checks (bounded working state + recall substrate + restore drill). Default true. */
276
+ requiredSetEnabled?: boolean;
277
+ /** Interval for required-set checks. Default 24h. */
278
+ requiredSetIntervalMs?: number;
279
+ /** Run required-set check on first loop cycle. Default true. */
280
+ requiredSetRunOnStart?: boolean;
281
+ /** Include backup+restore drill in required-set check. Default true. */
282
+ requiredSetRunRestoreDrill?: boolean;
283
+ /** Hook called when required-set check runs. */
284
+ onRequiredSet?: (result: CompoundingMemoryRequiredSetResult) => Promise<void> | void;
285
+ };
286
+ type AgentLoopDurabilityConfig = {
287
+ /** Enable durability-proxy writes from runtime loop. Default false. */
288
+ enabled?: boolean;
289
+ /** Durability-proxy base URL (e.g. http://127.0.0.1:8790). */
290
+ baseUrl: string;
291
+ /** Agent id registered in durability-proxy. */
292
+ agentId: string;
293
+ /** Agent token registered in durability-proxy. */
294
+ agentToken: string;
295
+ /** Optional timeout for durability-proxy calls. Default 8000ms. */
296
+ timeoutMs?: number;
297
+ /** Write checkpoint after each required-set run. Default true. */
298
+ checkpointOnRequiredSet?: boolean;
299
+ /** Write restore-drill outcome when required-set includes restore drill. Default true. */
300
+ reportRestoreDrill?: boolean;
301
+ /** Called when durability checkpoint is written. */
302
+ onCheckpointWritten?: (result: {
303
+ checkpointId?: string;
304
+ createdAt?: string;
305
+ checkedAt: string;
306
+ }) => Promise<void> | void;
307
+ /** Called when durability restore drill signal is written. */
308
+ onRestoreDrillReported?: (result: {
309
+ ok: boolean;
310
+ ts?: string;
311
+ checkedAt: string;
312
+ }) => Promise<void> | void;
313
+ };
314
+ type AgentLoopHooks = {
315
+ /** Called every cycle after snapshot is fetched and survival state is updated. */
316
+ onCycle?: (ctx: AgentLoopContext) => Promise<void> | void;
317
+ /**
318
+ * Optional: run reflection in the loop.
319
+ * Keep this hook pure/side-effect bounded; it should manage its own persistence.
320
+ */
321
+ onReflection?: (ctx: AgentLoopContext) => Promise<void> | void;
322
+ /**
323
+ * Optional: the agent's planner/executor entrypoint.
324
+ * This is where you actually "act like a human" using ctx + your own memory.
325
+ */
326
+ onAct?: (ctx: AgentLoopContext) => Promise<void> | void;
327
+ onError?: (err: Error) => Promise<void> | void;
328
+ };
329
+ type AgentLoopConfig = {
330
+ survival: SelfReliance;
331
+ fetchSnapshot: () => Promise<ResourceSnapshot>;
332
+ intervalMs?: number;
333
+ /** If true, call survival.guard() before onAct(). Default true. */
334
+ guardAct?: boolean;
335
+ /** Optional override for time source (tests). */
336
+ now?: () => number;
337
+ hooks?: AgentLoopHooks;
338
+ escapeHatch?: AgentLoopEscapeHatchConfig;
339
+ memory?: AgentLoopMemoryConfig;
340
+ durability?: AgentLoopDurabilityConfig;
341
+ strictMemory?: AgentLoopStrictMemoryConfig;
342
+ promptShield?: AgentLoopPromptShieldConfig;
343
+ objectiveGuard?: AgentLoopObjectiveGuardConfig;
344
+ autonomy?: AgentLoopAutonomyConfig;
345
+ };
346
+ /**
347
+ * Create a closed-loop runner that:
348
+ * 1) fetches a resource snapshot
349
+ * 2) updates SelfReliance
350
+ * 3) classifies survival mode + produces a playbook recommendation
351
+ * 4) auto-evaluates escape hatch in SURVIVE/BLINK (guardrail decision block)
352
+ * 5) optionally runs reflection + action hooks
353
+ *
354
+ * Non-breaking by design: you choose what to do with the context.
355
+ */
356
+ declare const createAgentLoop: (config: AgentLoopConfig) => {
357
+ start: () => Promise<void>;
358
+ stop: () => void;
359
+ runOnce: () => Promise<void>;
360
+ };
361
+
362
+ export { type AgentAutonomousTaskKind as A, type AgentLoopPromptShieldConfig as B, type AgentLoopStrictMemoryConfig as C, type AgentOwnershipMode as D, type AgentPriorityMode as E, type AgentResearchSnapshot as F, type AgentWorkArbitrationDecision as G, createAgentLoop as H, 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 AgentBespokeSnapshot as o, type AgentHumanDemand as p, type AgentLoopAutonomyConfig as q, type AgentLoopConfig as r, scoreBuildLane as s, type AgentLoopContext as t, type AgentLoopDurabilityConfig as u, type AgentLoopEscapeHatchConfig as v, type AgentLoopEscapeHatchInput as w, type AgentLoopHooks as x, type AgentLoopMemoryConfig as y, type AgentLoopObjectiveGuardConfig as z };
@@ -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 AgentAutonomousTaskKind, o as AgentHumanDemand, p as AgentLoopAutonomyConfig, q as AgentLoopConfig, r as AgentLoopContext, t as AgentLoopDurabilityConfig, u as AgentLoopEscapeHatchConfig, v as AgentLoopEscapeHatchInput, w as AgentLoopHooks, x as AgentLoopMemoryConfig, y as AgentLoopObjectiveGuardConfig, z as AgentLoopPromptShieldConfig, B as AgentLoopStrictMemoryConfig, C as AgentOwnershipMode, D as AgentPriorityMode, E as AgentResearchSnapshot, F as AgentWorkArbitrationDecision, G as createAgentLoop } from './agentLoop-BPj6daJf.js';
6
+ export { A as AgentAutonomousTaskKind, o as AgentBespokeSnapshot, p as AgentHumanDemand, q as AgentLoopAutonomyConfig, r as AgentLoopConfig, t as AgentLoopContext, u as AgentLoopDurabilityConfig, v as AgentLoopEscapeHatchConfig, w as AgentLoopEscapeHatchInput, x as AgentLoopHooks, y as AgentLoopMemoryConfig, z as AgentLoopObjectiveGuardConfig, B as AgentLoopPromptShieldConfig, C as AgentLoopStrictMemoryConfig, D as AgentOwnershipMode, E as AgentPriorityMode, F as AgentResearchSnapshot, G as AgentWorkArbitrationDecision, H as createAgentLoop } from './agentLoop-DAkl2g28.js';
package/dist/agentLoop.js CHANGED
@@ -75,6 +75,8 @@ var createAgentLoop = (config) => {
75
75
  const laneSwitchBuilderThreshold = config.autonomy?.intentPolicy?.laneSwitch?.builderOnGreenStreak ?? 3;
76
76
  const researchGateEnabled = config.autonomy?.intentPolicy?.researchGate?.enabled ?? true;
77
77
  const researchGateMaxAgeMs = config.autonomy?.intentPolicy?.researchGate?.maxAgeMs ?? 6 * 36e5;
78
+ const bespokeGateEnabled = config.autonomy?.intentPolicy?.bespokeGate?.enabled ?? true;
79
+ const bespokeGateMinNovelty = config.autonomy?.intentPolicy?.bespokeGate?.minNoveltyScore ?? 0.2;
78
80
  let laneState = { lane: "polish", greenStreak: 0 };
79
81
  const strictMemoryUpgrade = upgradeToStrictMemoryRuntimePreset({
80
82
  current: strictMemoryPreset,
@@ -284,6 +286,17 @@ var createAgentLoop = (config) => {
284
286
  if (!generatedAt && !summary && !recommendation) return null;
285
287
  return { generatedAt, summary, recommendation };
286
288
  };
289
+ const resolveBespokeSnapshot = async (input) => {
290
+ const fromConfig = await config.autonomy?.intentPolicy?.bespokeGate?.resolveSnapshot?.(input);
291
+ if (fromConfig) return fromConfig;
292
+ const raw = input.snapshot;
293
+ const bespokeKey = typeof raw.bespokeKey === "string" ? raw.bespokeKey : typeof raw.builderBespokeKey === "string" ? raw.builderBespokeKey : void 0;
294
+ const divergedFromTemplate = typeof raw.divergedFromTemplate === "boolean" ? raw.divergedFromTemplate : typeof raw.builderDivergedFromTemplate === "boolean" ? raw.builderDivergedFromTemplate : void 0;
295
+ const noveltyRaw = typeof raw.noveltyScore === "number" ? raw.noveltyScore : typeof raw.builderNoveltyScore === "number" ? raw.builderNoveltyScore : void 0;
296
+ const noveltyScore = Number.isFinite(noveltyRaw) ? Number(noveltyRaw) : void 0;
297
+ if (!bespokeKey && typeof divergedFromTemplate === "undefined" && typeof noveltyScore === "undefined") return null;
298
+ return { bespokeKey, divergedFromTemplate, noveltyScore };
299
+ };
287
300
  const runOnce = async () => {
288
301
  try {
289
302
  const memoryUpgrade = await ensureMemoryUpgrade();
@@ -422,6 +435,7 @@ var createAgentLoop = (config) => {
422
435
  }
423
436
  arbitrationBase.autonomousTaskKind = arbitrationBase.runAutonomousTask && !humanDemand.pending ? "build_new_product" : "polish_existing_product";
424
437
  const researchSnapshot = await resolveResearchSnapshot({ snapshot, survivalMode, humanDemand });
438
+ const bespokeSnapshot = await resolveBespokeSnapshot({ snapshot, survivalMode, humanDemand });
425
439
  const ctx = {
426
440
  snapshot,
427
441
  survivalState,
@@ -441,6 +455,7 @@ var createAgentLoop = (config) => {
441
455
  workArbitration: arbitrationBase,
442
456
  laneDecision,
443
457
  researchSnapshot: researchSnapshot || void 0,
458
+ bespokeSnapshot: bespokeSnapshot || void 0,
444
459
  timestamp
445
460
  };
446
461
  if (hooks.onCycle) await hooks.onCycle(ctx);
@@ -486,6 +501,17 @@ var createAgentLoop = (config) => {
486
501
  }
487
502
  }
488
503
  }
504
+ if (rolloutMode === "enforce" && bespokeGateEnabled && ctx.workArbitration?.runAutonomousTask && ctx.workArbitration?.autonomousTaskKind === "build_new_product") {
505
+ if (!ctx.bespokeSnapshot?.bespokeKey) {
506
+ throw new Error("bespoke_gate_blocked:missing_bespoke_key");
507
+ }
508
+ if (ctx.bespokeSnapshot?.divergedFromTemplate !== true) {
509
+ throw new Error("bespoke_gate_blocked:not_diverged_from_template");
510
+ }
511
+ if (typeof ctx.bespokeSnapshot?.noveltyScore === "number" && ctx.bespokeSnapshot.noveltyScore < bespokeGateMinNovelty) {
512
+ throw new Error("bespoke_gate_blocked:novelty_below_threshold");
513
+ }
514
+ }
489
515
  if (autonomyEnabled && config.autonomy?.onAutonomous && rolloutMode === "enforce") {
490
516
  if (ctx.workArbitration?.runHumanTask) await runHumanTask();
491
517
  if (ctx.workArbitration?.runAutonomousTask) await runAutonomousTask();
package/dist/index.d.ts CHANGED
@@ -6,10 +6,10 @@ export { SurvivalMode, SurvivalRecommendation, classifySurvivalMode, formatSurvi
6
6
  export { SurvivalIntegrationDecision, getSurvivalPlaybookDecision, getSurvivalPlaybookDecisionFromSelfReliance } from './survivalIntegration.js';
7
7
  export { EscapeHatchDecision, EscapeHatchPolicy, EscapeHatchSnapshot, evaluateEscapeHatch, formatEscapeHatchDecision } from './survivalEscapeHatch.js';
8
8
  export { MarketDiscoveryClient, MarketNeed, MarketSignal, deriveMarketNeeds, discoverMarketNeeds, extractMarketSignals, runMarketDiscovery } from './marketDiscovery.js';
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';
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 PublishCandidate, ag as PublishDeployResult, ah as PublishListingResult, ai as PublishListingType, aj as PublishPrepareResult, ak as PublishProductKind, al as PublishRuntimeAdapter, am as PublishRuntimeMode, an as PublishRuntimeResult, ao as PublishValidateResult, ap as PublishVerifyResult, aq as ResourceProviderManifestEntry, ar as ResourceSnapshot, as as ReviewGate, at as ReviewGateRecord, au as ReviewRequiredPayload, av as RunAdaptiveReflectionOptions, aw as RuntimeMigrationInput, ax as RuntimeMigrationPlan, ay as RuntimeStateSnapshot, az as SdkAutoUpdatedRestartRequiredError, aA as SdkUpdateCheckOptions, aB as SdkUpdatePolicyCheckOptions, aC as SdkUpdateRequiredError, aD as SdkUpdateStatus, TopupDecision, TopupRequest, TreasuryLedgerEvent, TreasuryPolicy, TreasuryPolicyV1, TreasuryState, aE as VIBEIAO_IDL, aF as VibeClient, aG as VibeClientOptions, aH as VibeRegistry, aI as aggregateFeedbackSignals, aJ as assertLaunchReady, aK as assertSurvivalProvidersConfigured, aL as buildAdaptivePlan, aM as buildBadgeMarkdown, aN as buildClaimMessage, aO as buildDecisionRecord, aP as buildJupiterSwapUrl, aQ as buildListingVersionMessage, aR as buildMemoryPingMessage, aS as buildOwnerTransferMessage, aT as buildProcurementPrompt, aU as buildRaydiumSwapUrl, aV as buildReviewPrompt, aW as buildReviewRequired, aX as buildReviewResponseMessage, aY as buildRuntimeMigrationPlan, aZ as buildSdkUpdateCommand, a_ as buildShareCopy, a$ as buildShareLink, b0 as buildTradeLinks, buildTreasuryLedgerEvent, b1 as checkForSdkUpdate, b2 as checkForSdkUpdatePolicy, b3 as compareVersions, b4 as createApiCreditProvider, b5 as createApiCreditProviders, b6 as createApiCreditProvidersFromManifest, b7 as createCampaign, b8 as createContextPack, b9 as createCustomAdapter, ba as createDurabilityProxyClient, bb as createServiceApiAdapter, createTreasuryPolicy, bc as createWebBundledAdapter, bd as createWebStaticAdapter, be as createWorkflowAgentAdapter, bf as decideProcurementForTask, bg as estimateContextPackTokens, bh as evaluateAdaptiveReflectionPolicy, bi as evaluateContextPackGate, bj as evaluateLaunchReadiness, evaluateTopupRequest, bk as getResourceSnapshot, bl as normalizeListingText, bm as rankListingsForTask, bn as runAdapterBestShotChecklist, bo as runAdaptiveReflectionCycle, bp as runAgentLaunchRuntime, bq as runAgentLaunchRuntimeCycle, br as runAgentPublishRuntimeCycle, bs as runAgentReviewRuntimeCycle, bt as runExecutionAdapter, bu as sanitizeListingNaming, bv as scoreListingForTask, bw as shouldAnnounceStateChange, treasuryStateFromSnapshot, bx as validateContextPack, by as validateListingNaming, validateTreasuryPolicy, bz 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, 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-BPj6daJf.js';
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-DAkl2g28.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
@@ -95,10 +95,10 @@ var normalizeSectionInput = (value, maxItemChars) => {
95
95
  const seen = /* @__PURE__ */ new Set();
96
96
  const output = [];
97
97
  for (const item of list) {
98
- const normalized = normalizeItem(String(item ?? ""), maxItemChars);
99
- if (!normalized || seen.has(normalized)) continue;
100
- seen.add(normalized);
101
- output.push(normalized);
98
+ const normalized2 = normalizeItem(String(item ?? ""), maxItemChars);
99
+ if (!normalized2 || seen.has(normalized2)) continue;
100
+ seen.add(normalized2);
101
+ output.push(normalized2);
102
102
  }
103
103
  return output;
104
104
  };
@@ -197,9 +197,9 @@ var createContextPack = (input, options = {}) => {
197
197
  const maxChars = Math.max(240, Number(options.maxChars ?? DEFAULT_MAX_CHARS));
198
198
  const maxTokens = Math.max(80, Number(options.maxTokens ?? DEFAULT_MAX_TOKENS));
199
199
  const maxItemChars = Math.max(16, Number(options.maxItemChars ?? DEFAULT_MAX_ITEM_CHARS));
200
- const normalized = buildSections(input, maxItemChars);
201
- const withinBudget = fitsBudget(normalized, maxChars, maxTokens);
202
- const sections = withinBudget ? copySections(normalized) : truncateToBudget(normalized, maxChars, maxTokens);
200
+ const normalized2 = buildSections(input, maxItemChars);
201
+ const withinBudget = fitsBudget(normalized2, maxChars, maxTokens);
202
+ const sections = withinBudget ? copySections(normalized2) : truncateToBudget(normalized2, maxChars, maxTokens);
203
203
  const usage = measuredJson(sections);
204
204
  return {
205
205
  schema: "context-pack/v1",
@@ -950,6 +950,162 @@ var runAgentLaunchRuntime = async (options) => {
950
950
  };
951
951
  var runAgentLaunchRuntimeCycle = runAgentLaunchRuntime;
952
952
 
953
+ // src/agentPublishRuntime.ts
954
+ var normalized = (v) => String(v || "").trim().toLowerCase();
955
+ var enforcePublishKindGuard = (candidate, listing) => {
956
+ const kind = candidate.productKind;
957
+ if (!kind) return "publish_gate_blocked:missing_product_kind";
958
+ const listingType = normalized(listing.listingType);
959
+ const category = normalized(listing.category);
960
+ if (!listingType) return "publish_gate_blocked:missing_listing_type";
961
+ if (!category) return "publish_gate_blocked:missing_listing_category";
962
+ if (kind === "agent_app") {
963
+ if (listingType !== "agent") return "publish_gate_blocked:agent_app_requires_agent_listing";
964
+ return null;
965
+ }
966
+ if (listingType !== "human") return "publish_gate_blocked:human_product_requires_human_listing";
967
+ if (kind === "human_game" && !category.includes("game")) {
968
+ return "publish_gate_blocked:human_game_requires_games_category";
969
+ }
970
+ if (kind === "human_saas" && !category.includes("saas")) {
971
+ return "publish_gate_blocked:human_saas_requires_saas_category";
972
+ }
973
+ return null;
974
+ };
975
+ var runAgentPublishRuntimeCycle = async (input) => {
976
+ const mode = input.mode ?? "enforce";
977
+ const adapter = input.adapter;
978
+ if (!adapter) {
979
+ return {
980
+ mode,
981
+ changed: false,
982
+ attempted: false,
983
+ published: false,
984
+ deployed: false,
985
+ verified: false,
986
+ reason: "no_adapter"
987
+ };
988
+ }
989
+ const prepared = await adapter.prepare();
990
+ if (!prepared.changed || !prepared.candidate) {
991
+ return {
992
+ mode,
993
+ changed: false,
994
+ attempted: false,
995
+ published: false,
996
+ deployed: false,
997
+ verified: false,
998
+ reason: prepared.reason || "no_candidate_change"
999
+ };
1000
+ }
1001
+ const candidate = prepared.candidate;
1002
+ const validate = await adapter.validate({ candidate });
1003
+ if (!validate.passed) {
1004
+ return {
1005
+ mode,
1006
+ changed: true,
1007
+ attempted: true,
1008
+ published: false,
1009
+ deployed: false,
1010
+ verified: false,
1011
+ reason: `validate_failed:${validate.reason || "unknown"}`,
1012
+ candidate,
1013
+ validate
1014
+ };
1015
+ }
1016
+ if (mode === "observe") {
1017
+ return {
1018
+ mode,
1019
+ changed: true,
1020
+ attempted: true,
1021
+ published: false,
1022
+ deployed: false,
1023
+ verified: false,
1024
+ reason: "observe_mode",
1025
+ candidate,
1026
+ validate
1027
+ };
1028
+ }
1029
+ const listing = await adapter.publish({ candidate });
1030
+ if (!listing?.listingId) {
1031
+ return {
1032
+ mode,
1033
+ changed: true,
1034
+ attempted: true,
1035
+ published: false,
1036
+ deployed: false,
1037
+ verified: false,
1038
+ reason: "publish_failed:missing_listing_id",
1039
+ candidate,
1040
+ validate,
1041
+ listing
1042
+ };
1043
+ }
1044
+ const gateError = enforcePublishKindGuard(candidate, listing);
1045
+ if (gateError) {
1046
+ return {
1047
+ mode,
1048
+ changed: true,
1049
+ attempted: true,
1050
+ published: false,
1051
+ deployed: false,
1052
+ verified: false,
1053
+ reason: gateError,
1054
+ candidate,
1055
+ validate,
1056
+ listing
1057
+ };
1058
+ }
1059
+ const deploy = await adapter.deploy({ candidate, listing });
1060
+ const deployed = Boolean(deploy && (deploy.productUrl || deploy.deployId));
1061
+ if (!deployed) {
1062
+ return {
1063
+ mode,
1064
+ changed: true,
1065
+ attempted: true,
1066
+ published: true,
1067
+ deployed: false,
1068
+ verified: false,
1069
+ reason: "deploy_failed:missing_deploy_evidence",
1070
+ candidate,
1071
+ validate,
1072
+ listing,
1073
+ deploy
1074
+ };
1075
+ }
1076
+ const verify = await adapter.verify({ candidate, listing, deploy });
1077
+ if (!verify.passed) {
1078
+ return {
1079
+ mode,
1080
+ changed: true,
1081
+ attempted: true,
1082
+ published: true,
1083
+ deployed: true,
1084
+ verified: false,
1085
+ reason: `verify_failed:${verify.reason || "unknown"}`,
1086
+ candidate,
1087
+ validate,
1088
+ listing,
1089
+ deploy,
1090
+ verify
1091
+ };
1092
+ }
1093
+ return {
1094
+ mode,
1095
+ changed: true,
1096
+ attempted: true,
1097
+ published: true,
1098
+ deployed: true,
1099
+ verified: true,
1100
+ reason: "published_deployed_verified",
1101
+ candidate,
1102
+ validate,
1103
+ listing,
1104
+ deploy,
1105
+ verify
1106
+ };
1107
+ };
1108
+
953
1109
  // src/runtimeMigration.ts
954
1110
  var buildRuntimeMigrationPlan = (input) => {
955
1111
  const blockers = [];
@@ -1112,7 +1268,7 @@ var ReviewGate = class {
1112
1268
  var DEFAULT_API_BASE = "https://api.vibeiao.com";
1113
1269
  var DEFAULT_WEB_BASE = "https://vibeiao.com";
1114
1270
  var DEFAULT_SDK_PACKAGE = "@vibeiao/sdk";
1115
- var DEFAULT_SDK_VERSION = "0.1.54" ? "0.1.54" : "0.1.4";
1271
+ var DEFAULT_SDK_VERSION = "0.1.56" ? "0.1.56" : "0.1.4";
1116
1272
  var DEFAULT_SDK_REGISTRY = "https://registry.npmjs.org";
1117
1273
  var DEFAULT_SDK_POLICY_PATH = "/v1/sdk/policy";
1118
1274
  var DEFAULT_SDK_CHECK_INTERVAL_MS = 1e3 * 60 * 30;
@@ -1338,11 +1494,11 @@ var extractCreditsFromPayload = (payload, creditsPath) => {
1338
1494
  return credits;
1339
1495
  };
1340
1496
  var defaultApiKeyEnvForProvider = (provider) => {
1341
- const normalized = normalizeProviderName(provider);
1342
- if (normalized === "openrouter") return "OPENROUTER_API_KEY";
1343
- if (normalized === "anthropic") return "ANTHROPIC_API_KEY";
1344
- if (normalized === "gemini") return "GEMINI_API_KEY";
1345
- return `${normalized.toUpperCase()}_API_KEY`;
1497
+ const normalized2 = normalizeProviderName(provider);
1498
+ if (normalized2 === "openrouter") return "OPENROUTER_API_KEY";
1499
+ if (normalized2 === "anthropic") return "ANTHROPIC_API_KEY";
1500
+ if (normalized2 === "gemini") return "GEMINI_API_KEY";
1501
+ return `${normalized2.toUpperCase()}_API_KEY`;
1346
1502
  };
1347
1503
  var providerConfigError = (providerName, detail, nextStep) => `provider_config_error:${providerName}:${detail}. ${nextStep}`;
1348
1504
  var providerFetchError = (providerName, detail) => `provider_fetch_failed:${providerName}:${detail}`;
@@ -2324,6 +2480,7 @@ export {
2324
2480
  runAdaptiveReflectionCycle,
2325
2481
  runAgentLaunchRuntime,
2326
2482
  runAgentLaunchRuntimeCycle,
2483
+ runAgentPublishRuntimeCycle,
2327
2484
  runAgentReviewRuntimeCycle,
2328
2485
  runExecutionAdapter,
2329
2486
  runMarketDiscovery,
@@ -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-BPj6daJf.js';
11
+ import './agentLoop-DAkl2g28.js';
12
12
  import './solana.js';
13
13
  import './compoundingMemory.js';
14
14
  import '@coral-xyz/anchor';
@@ -1162,6 +1162,77 @@ type AgentLaunchRuntimeResult = {
1162
1162
  declare const runAgentLaunchRuntime: (options: AgentLaunchRuntimeOptions) => Promise<AgentLaunchRuntimeResult>;
1163
1163
  declare const runAgentLaunchRuntimeCycle: (options: AgentLaunchRuntimeOptions) => Promise<AgentLaunchRuntimeResult>;
1164
1164
 
1165
+ type PublishRuntimeMode = 'observe' | 'enforce';
1166
+ type PublishProductKind = 'agent_app' | 'human_game' | 'human_saas';
1167
+ type PublishListingType = 'agent' | 'human';
1168
+ type PublishCandidate = {
1169
+ id: string;
1170
+ dir?: string;
1171
+ meta?: Record<string, unknown>;
1172
+ productKind?: PublishProductKind;
1173
+ };
1174
+ type PublishPrepareResult = {
1175
+ changed: boolean;
1176
+ candidate?: PublishCandidate;
1177
+ reason?: string;
1178
+ };
1179
+ type PublishValidateResult = {
1180
+ passed: boolean;
1181
+ reason?: string;
1182
+ metrics?: Record<string, number | string | boolean>;
1183
+ };
1184
+ type PublishListingResult = {
1185
+ listingId: string;
1186
+ claimId?: string;
1187
+ listingType?: PublishListingType;
1188
+ category?: string;
1189
+ };
1190
+ type PublishDeployResult = {
1191
+ productUrl?: string;
1192
+ deployId?: string;
1193
+ };
1194
+ type PublishVerifyResult = {
1195
+ passed: boolean;
1196
+ reason?: string;
1197
+ metrics?: Record<string, number | string | boolean>;
1198
+ };
1199
+ interface PublishRuntimeAdapter {
1200
+ prepare: () => Promise<PublishPrepareResult> | PublishPrepareResult;
1201
+ validate: (input: {
1202
+ candidate: PublishCandidate;
1203
+ }) => Promise<PublishValidateResult> | PublishValidateResult;
1204
+ publish: (input: {
1205
+ candidate: PublishCandidate;
1206
+ }) => Promise<PublishListingResult> | PublishListingResult;
1207
+ deploy: (input: {
1208
+ candidate: PublishCandidate;
1209
+ listing: PublishListingResult;
1210
+ }) => Promise<PublishDeployResult> | PublishDeployResult;
1211
+ verify: (input: {
1212
+ candidate: PublishCandidate;
1213
+ listing: PublishListingResult;
1214
+ deploy: PublishDeployResult;
1215
+ }) => Promise<PublishVerifyResult> | PublishVerifyResult;
1216
+ }
1217
+ type PublishRuntimeResult = {
1218
+ mode: PublishRuntimeMode;
1219
+ changed: boolean;
1220
+ attempted: boolean;
1221
+ published: boolean;
1222
+ deployed: boolean;
1223
+ verified: boolean;
1224
+ reason: string;
1225
+ candidate?: PublishCandidate;
1226
+ validate?: PublishValidateResult;
1227
+ listing?: PublishListingResult;
1228
+ deploy?: PublishDeployResult;
1229
+ verify?: PublishVerifyResult;
1230
+ };
1231
+ declare const runAgentPublishRuntimeCycle: (input: {
1232
+ mode?: PublishRuntimeMode;
1233
+ adapter?: PublishRuntimeAdapter;
1234
+ }) => Promise<PublishRuntimeResult>;
1235
+
1165
1236
  type RuntimeMigrationInput = {
1166
1237
  profile: AdapterPackKind;
1167
1238
  listingId: string;
@@ -1474,7 +1545,7 @@ declare class ReviewGate {
1474
1545
  assertClear(listingId: string, wallet: string): void;
1475
1546
  }
1476
1547
 
1477
- declare const compareVersions: (currentVersion: string, latestVersion: string) => 0 | 1 | -1;
1548
+ declare const compareVersions: (currentVersion: string, latestVersion: string) => 1 | 0 | -1;
1478
1549
  declare const buildSdkUpdateCommand: (packageName?: string) => string;
1479
1550
  declare const checkForSdkUpdate: (options?: SdkUpdateCheckOptions) => Promise<SdkUpdateStatus>;
1480
1551
  declare const checkForSdkUpdatePolicy: (options: SdkUpdatePolicyCheckOptions) => Promise<SdkUpdateStatus>;
@@ -1655,4 +1726,4 @@ declare const getResourceSnapshot: (options: {
1655
1726
  apiBase?: string;
1656
1727
  }) => Promise<ResourceSnapshot>;
1657
1728
 
1658
- export { type LeaderboardQuery as $, type AdapterBestShotChecklistResult as A, type BuybackEvent as B, CONTEXT_PACK_SECTION_ORDER as C, type ContextPackOptions as D, type ContextPackSectionKey as E, type ContextPackSections as F, type ContextPackState as G, type DurabilityCheckpointWriteOptions as H, type DurabilityProxyClientOptions as I, type DurabilityRestoreDrillWriteOptions as J, type ExecutionAdapter as K, type ExecutionApplyResult as L, type ExecutionDecisionRecord as M, type ExecutionDryRunResult as N, type ExecutionPostDeployVerifyResult as O, type ExecutionRollbackResult as P, type ExecutionRolloutMode as Q, type ExecutionRunResult as R, type ExecutionValidateResult as S, LISTING_NAME_MAX_LENGTH as T, type TopupDecision, type TopupRequest, type TreasuryLedgerEvent, type TreasuryPolicy, type TreasuryPolicyV1, type TreasuryState, LISTING_NAME_RECOMMENDED_MAX as U, LISTING_TAGLINE_MAX_LENGTH as V, LISTING_TAGLINE_RECOMMENDED_MAX as W, type LaunchProfile as X, type LaunchReadinessInput as Y, type LaunchReadinessResult as Z, type LeaderboardEntry as _, type AdapterPackKind as a, createDurabilityProxyClient as a$, type ListingNamingValidationOptions as a0, type ListingNamingValidationResult as a1, type ListingQuery as a2, type ListingReviewCreatePayload as a3, type ListingReviewResponsePayload as a4, type ListingVersionPayload as a5, type MarketingCampaign as a6, type MarketingLinkOptions as a7, type MemoryPingChallengeResponse as a8, type MemoryPingPayload as a9, buildAdaptivePlan as aA, buildBadgeMarkdown as aB, buildClaimMessage as aC, buildDecisionRecord as aD, buildJupiterSwapUrl as aE, buildListingVersionMessage as aF, buildMemoryPingMessage as aG, buildOwnerTransferMessage as aH, buildProcurementPrompt as aI, buildRaydiumSwapUrl as aJ, buildReviewPrompt as aK, buildReviewRequired as aL, buildReviewResponseMessage as aM, buildRuntimeMigrationPlan as aN, buildSdkUpdateCommand as aO, buildShareCopy as aP, buildShareLink as aQ, buildTradeLinks as aR, checkForSdkUpdate as aS, checkForSdkUpdatePolicy as aT, compareVersions as aU, createApiCreditProvider as aV, createApiCreditProviders as aW, createApiCreditProvidersFromManifest as aX, createCampaign as aY, createContextPack as aZ, createCustomAdapter as a_, type OpenRouterCredits as aa, type ProcurementCandidate as ab, type ProcurementDecision as ac, type ProcurementTaskProfile as ad, type ProcurementWeights as ae, type ResourceProviderManifestEntry as af, type ResourceSnapshot as ag, ReviewGate as ah, type ReviewGateRecord as ai, type ReviewRequiredPayload as aj, type RunAdaptiveReflectionOptions as ak, type RuntimeMigrationInput as al, type RuntimeMigrationPlan as am, type RuntimeStateSnapshot as an, SdkAutoUpdatedRestartRequiredError as ao, type SdkUpdateCheckOptions as ap, type SdkUpdatePolicyCheckOptions as aq, SdkUpdateRequiredError as ar, type SdkUpdateStatus as as, VIBEIAO_IDL as at, VibeClient as au, type VibeClientOptions as av, VibeRegistry as aw, aggregateFeedbackSignals as ax, assertLaunchReady as ay, assertSurvivalProvidersConfigured as az, type AdapterPackOptions as b, createServiceApiAdapter as b0, createWebBundledAdapter as b1, createWebStaticAdapter as b2, createWorkflowAgentAdapter as b3, decideProcurementForTask as b4, estimateContextPackTokens as b5, evaluateAdaptiveReflectionPolicy as b6, evaluateContextPackGate as b7, evaluateLaunchReadiness as b8, getResourceSnapshot as b9, normalizeListingText as ba, rankListingsForTask as bb, runAdapterBestShotChecklist as bc, runAdaptiveReflectionCycle as bd, runAgentLaunchRuntime as be, runAgentLaunchRuntimeCycle as bf, runAgentReviewRuntimeCycle as bg, runExecutionAdapter as bh, sanitizeListingNaming as bi, scoreListingForTask as bj, shouldAnnounceStateChange as bk, validateContextPack as bl, validateListingNaming as bm, verifyAdaptiveExecutionReadiness as bn, buildTreasuryLedgerEvent, type AdaptiveAdaptationPlan as c, createTreasuryPolicy, type AdaptiveExecution as d, type AdaptiveFeedbackAggregate as e, evaluateTopupRequest, type AdaptivePolicyConfig as f, type AdaptivePolicyDecision as g, type AdaptivePolicyState as h, type AdaptiveReflectionStore as i, type AdaptiveTheme as j, type AdaptiveVerification as k, type AgentLaunchRuntimeOptions as l, type AgentLaunchRuntimeResult as m, type AgentResourceProvidersManifest as n, type AgentReviewRuntimeOptions as o, type AnalyticsPoint as p, type ApiCreditProvider as q, type ApiCreditProviderFactoryOptions as r, type ApiCreditProviderPreset as s, type ApiCreditProviderPresetInput as t, treasuryStateFromSnapshot, type ApiResponse as u, type ContextPack as v, validateTreasuryPolicy, type ContextPackBudget as w, type ContextPackGateOptions as x, type ContextPackGateResult as y, type ContextPackInput as z };
1729
+ export { type LeaderboardQuery as $, type AdapterBestShotChecklistResult as A, type BuybackEvent as B, CONTEXT_PACK_SECTION_ORDER as C, type ContextPackOptions as D, type ContextPackSectionKey as E, type ContextPackSections as F, type ContextPackState as G, type DurabilityCheckpointWriteOptions as H, type DurabilityProxyClientOptions as I, type DurabilityRestoreDrillWriteOptions as J, type ExecutionAdapter as K, type ExecutionApplyResult as L, type ExecutionDecisionRecord as M, type ExecutionDryRunResult as N, type ExecutionPostDeployVerifyResult as O, type ExecutionRollbackResult as P, type ExecutionRolloutMode as Q, type ExecutionRunResult as R, type ExecutionValidateResult as S, LISTING_NAME_MAX_LENGTH as T, type TopupDecision, type TopupRequest, type TreasuryLedgerEvent, type TreasuryPolicy, type TreasuryPolicyV1, type TreasuryState, LISTING_NAME_RECOMMENDED_MAX as U, LISTING_TAGLINE_MAX_LENGTH as V, LISTING_TAGLINE_RECOMMENDED_MAX as W, type LaunchProfile as X, type LaunchReadinessInput as Y, type LaunchReadinessResult as Z, type LeaderboardEntry as _, type AdapterPackKind as a, buildShareLink as a$, type ListingNamingValidationOptions as a0, type ListingNamingValidationResult as a1, type ListingQuery as a2, type ListingReviewCreatePayload as a3, type ListingReviewResponsePayload as a4, type ListingVersionPayload as a5, type MarketingCampaign as a6, type MarketingLinkOptions as a7, type MemoryPingChallengeResponse as a8, type MemoryPingPayload as a9, type SdkUpdateCheckOptions as aA, type SdkUpdatePolicyCheckOptions as aB, SdkUpdateRequiredError as aC, type SdkUpdateStatus as aD, VIBEIAO_IDL as aE, VibeClient as aF, type VibeClientOptions as aG, VibeRegistry as aH, aggregateFeedbackSignals as aI, assertLaunchReady as aJ, assertSurvivalProvidersConfigured as aK, buildAdaptivePlan as aL, buildBadgeMarkdown as aM, buildClaimMessage as aN, buildDecisionRecord as aO, buildJupiterSwapUrl as aP, buildListingVersionMessage as aQ, buildMemoryPingMessage as aR, buildOwnerTransferMessage as aS, buildProcurementPrompt as aT, buildRaydiumSwapUrl as aU, buildReviewPrompt as aV, buildReviewRequired as aW, buildReviewResponseMessage as aX, buildRuntimeMigrationPlan as aY, buildSdkUpdateCommand as aZ, buildShareCopy as a_, type OpenRouterCredits as aa, type ProcurementCandidate as ab, type ProcurementDecision as ac, type ProcurementTaskProfile as ad, type ProcurementWeights as ae, type PublishCandidate as af, type PublishDeployResult as ag, type PublishListingResult as ah, type PublishListingType as ai, type PublishPrepareResult as aj, type PublishProductKind as ak, type PublishRuntimeAdapter as al, type PublishRuntimeMode as am, type PublishRuntimeResult as an, type PublishValidateResult as ao, type PublishVerifyResult as ap, type ResourceProviderManifestEntry as aq, type ResourceSnapshot as ar, ReviewGate as as, type ReviewGateRecord as at, type ReviewRequiredPayload as au, type RunAdaptiveReflectionOptions as av, type RuntimeMigrationInput as aw, type RuntimeMigrationPlan as ax, type RuntimeStateSnapshot as ay, SdkAutoUpdatedRestartRequiredError as az, type AdapterPackOptions as b, buildTradeLinks as b0, checkForSdkUpdate as b1, checkForSdkUpdatePolicy as b2, compareVersions as b3, createApiCreditProvider as b4, createApiCreditProviders as b5, createApiCreditProvidersFromManifest as b6, createCampaign as b7, createContextPack as b8, createCustomAdapter as b9, createDurabilityProxyClient as ba, createServiceApiAdapter as bb, createWebBundledAdapter as bc, createWebStaticAdapter as bd, createWorkflowAgentAdapter as be, decideProcurementForTask as bf, estimateContextPackTokens as bg, evaluateAdaptiveReflectionPolicy as bh, evaluateContextPackGate as bi, evaluateLaunchReadiness as bj, getResourceSnapshot as bk, normalizeListingText as bl, rankListingsForTask as bm, runAdapterBestShotChecklist as bn, runAdaptiveReflectionCycle as bo, runAgentLaunchRuntime as bp, runAgentLaunchRuntimeCycle as bq, runAgentPublishRuntimeCycle as br, runAgentReviewRuntimeCycle as bs, runExecutionAdapter as bt, sanitizeListingNaming as bu, buildTreasuryLedgerEvent, scoreListingForTask as bv, shouldAnnounceStateChange as bw, validateContextPack as bx, validateListingNaming as by, verifyAdaptiveExecutionReadiness as bz, type AdaptiveAdaptationPlan as c, createTreasuryPolicy, type AdaptiveExecution as d, type AdaptiveFeedbackAggregate as e, evaluateTopupRequest, type AdaptivePolicyConfig as f, type AdaptivePolicyDecision as g, type AdaptivePolicyState as h, type AdaptiveReflectionStore as i, type AdaptiveTheme as j, type AdaptiveVerification as k, type AgentLaunchRuntimeOptions as l, type AgentLaunchRuntimeResult as m, type AgentResourceProvidersManifest as n, type AgentReviewRuntimeOptions as o, type AnalyticsPoint as p, type ApiCreditProvider as q, type ApiCreditProviderFactoryOptions as r, type ApiCreditProviderPreset as s, type ApiCreditProviderPresetInput as t, treasuryStateFromSnapshot, type ApiResponse as u, type ContextPack as v, validateTreasuryPolicy, type ContextPackBudget as w, type ContextPackGateOptions as x, type ContextPackGateResult as y, type ContextPackInput as z };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@vibeiao/sdk",
3
3
  "private": false,
4
4
  "type": "module",
5
- "version": "0.1.55",
5
+ "version": "0.1.57",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {