@vibeiao/sdk 0.1.45 → 0.1.46

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/README.md CHANGED
@@ -689,6 +689,7 @@ Adaptive reflection policy is available for cadence-based adaptation (not per-re
689
689
  - aggregate feedback over time windows and score recurring themes
690
690
  - evaluate thresholds + cooldown + daily adaptation caps
691
691
  - output `hold|observe|adapt` decision and optional bounded adaptation plan
692
+ - enforce `verify -> execute` sequencing in apply mode (no verify pass => no execution)
692
693
 
693
694
  You can also enforce dual-mode work arbitration:
694
695
  - `owner_bound` agents: human-first (owner work preempts autonomous work)
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ 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 AdaptiveAdaptationPlan, a as AdaptiveFeedbackAggregate, b as AdaptivePolicyConfig, c as AdaptivePolicyDecision, d as AdaptivePolicyState, e as AdaptiveReflectionStore, f as AdaptiveTheme, g as AgentResourceProvidersManifest, h as AnalyticsPoint, i as ApiCreditProvider, j as ApiCreditProviderFactoryOptions, k as ApiCreditProviderPreset, l as ApiCreditProviderPresetInput, m as ApiResponse, B as BuybackEvent, C as CONTEXT_PACK_SECTION_ORDER, n as ContextPack, o as ContextPackBudget, p as ContextPackInput, q as ContextPackOptions, r as ContextPackSectionKey, s as ContextPackSections, D as DurabilityCheckpointWriteOptions, t as DurabilityProxyClientOptions, u as DurabilityRestoreDrillWriteOptions, L as LISTING_NAME_MAX_LENGTH, v as LISTING_NAME_RECOMMENDED_MAX, w as LISTING_TAGLINE_MAX_LENGTH, x as LISTING_TAGLINE_RECOMMENDED_MAX, y as LeaderboardEntry, z as LeaderboardQuery, E as ListingNamingValidationOptions, F as ListingNamingValidationResult, G as ListingQuery, H as ListingReviewCreatePayload, I as ListingReviewResponsePayload, J as ListingVersionPayload, M as MarketingCampaign, K as MarketingLinkOptions, N as MemoryPingChallengeResponse, O as MemoryPingPayload, P as OpenRouterCredits, Q as ProcurementCandidate, R as ProcurementDecision, S as ProcurementTaskProfile, T as ProcurementWeights, U as ResourceProviderManifestEntry, V as ResourceSnapshot, W as ReviewGate, X as ReviewGateRecord, Y as ReviewRequiredPayload, Z as RunAdaptiveReflectionOptions, _ as SdkAutoUpdatedRestartRequiredError, $ as SdkUpdateCheckOptions, a0 as SdkUpdatePolicyCheckOptions, a1 as SdkUpdateRequiredError, a2 as SdkUpdateStatus, TopupDecision, TopupRequest, TreasuryLedgerEvent, TreasuryPolicy, TreasuryPolicyV1, TreasuryState, a3 as VIBEIAO_IDL, a4 as VibeClient, a5 as VibeClientOptions, a6 as VibeRegistry, a7 as aggregateFeedbackSignals, a8 as assertSurvivalProvidersConfigured, a9 as buildAdaptivePlan, aa as buildBadgeMarkdown, ab as buildClaimMessage, ac as buildJupiterSwapUrl, ad as buildListingVersionMessage, ae as buildMemoryPingMessage, af as buildOwnerTransferMessage, ag as buildProcurementPrompt, ah as buildRaydiumSwapUrl, ai as buildReviewPrompt, aj as buildReviewRequired, ak as buildReviewResponseMessage, al as buildSdkUpdateCommand, am as buildShareCopy, an as buildShareLink, ao as buildTradeLinks, buildTreasuryLedgerEvent, ap as checkForSdkUpdate, aq as checkForSdkUpdatePolicy, ar as compareVersions, as as createApiCreditProvider, at as createApiCreditProviders, au as createApiCreditProvidersFromManifest, av as createCampaign, aw as createContextPack, ax as createDurabilityProxyClient, createTreasuryPolicy, ay as decideProcurementForTask, az as estimateContextPackTokens, aA as evaluateAdaptiveReflectionPolicy, evaluateTopupRequest, aB as getResourceSnapshot, aC as normalizeListingText, aD as rankListingsForTask, aE as runAdaptiveReflectionCycle, aF as sanitizeListingNaming, aG as scoreListingForTask, treasuryStateFromSnapshot, aH as validateContextPack, aI as validateListingNaming, validateTreasuryPolicy } from './treasuryGuardian.js';
9
+ export { A as AdaptiveAdaptationPlan, a as AdaptiveExecution, b as AdaptiveFeedbackAggregate, c as AdaptivePolicyConfig, d as AdaptivePolicyDecision, e as AdaptivePolicyState, f as AdaptiveReflectionStore, g as AdaptiveTheme, h as AdaptiveVerification, i as AgentResourceProvidersManifest, j as AnalyticsPoint, k as ApiCreditProvider, l as ApiCreditProviderFactoryOptions, m as ApiCreditProviderPreset, n as ApiCreditProviderPresetInput, o as ApiResponse, B as BuybackEvent, C as CONTEXT_PACK_SECTION_ORDER, p as ContextPack, q as ContextPackBudget, r as ContextPackInput, s as ContextPackOptions, t as ContextPackSectionKey, u as ContextPackSections, D as DurabilityCheckpointWriteOptions, v as DurabilityProxyClientOptions, w as DurabilityRestoreDrillWriteOptions, E as ExecutionAdapter, x as ExecutionApplyResult, y as ExecutionDecisionRecord, z as ExecutionDryRunResult, F as ExecutionRollbackResult, G as ExecutionRolloutMode, H as ExecutionRunResult, I as ExecutionValidateResult, L as LISTING_NAME_MAX_LENGTH, J as LISTING_NAME_RECOMMENDED_MAX, K as LISTING_TAGLINE_MAX_LENGTH, M as LISTING_TAGLINE_RECOMMENDED_MAX, N as LeaderboardEntry, O as LeaderboardQuery, P as ListingNamingValidationOptions, Q as ListingNamingValidationResult, R as ListingQuery, S as ListingReviewCreatePayload, T as ListingReviewResponsePayload, U as ListingVersionPayload, V as MarketingCampaign, W as MarketingLinkOptions, X as MemoryPingChallengeResponse, Y as MemoryPingPayload, Z as OpenRouterCredits, _ as ProcurementCandidate, $ as ProcurementDecision, a0 as ProcurementTaskProfile, a1 as ProcurementWeights, a2 as ResourceProviderManifestEntry, a3 as ResourceSnapshot, a4 as ReviewGate, a5 as ReviewGateRecord, a6 as ReviewRequiredPayload, a7 as RunAdaptiveReflectionOptions, a8 as SdkAutoUpdatedRestartRequiredError, a9 as SdkUpdateCheckOptions, aa as SdkUpdatePolicyCheckOptions, ab as SdkUpdateRequiredError, ac as SdkUpdateStatus, TopupDecision, TopupRequest, TreasuryLedgerEvent, TreasuryPolicy, TreasuryPolicyV1, TreasuryState, ad as VIBEIAO_IDL, ae as VibeClient, af as VibeClientOptions, ag as VibeRegistry, ah as aggregateFeedbackSignals, ai as assertSurvivalProvidersConfigured, aj as buildAdaptivePlan, ak as buildBadgeMarkdown, al as buildClaimMessage, am as buildDecisionRecord, an as buildJupiterSwapUrl, ao as buildListingVersionMessage, ap as buildMemoryPingMessage, aq as buildOwnerTransferMessage, ar as buildProcurementPrompt, as as buildRaydiumSwapUrl, at as buildReviewPrompt, au as buildReviewRequired, av as buildReviewResponseMessage, aw as buildSdkUpdateCommand, ax as buildShareCopy, ay as buildShareLink, az as buildTradeLinks, buildTreasuryLedgerEvent, aA as checkForSdkUpdate, aB as checkForSdkUpdatePolicy, aC as compareVersions, aD as createApiCreditProvider, aE as createApiCreditProviders, aF as createApiCreditProvidersFromManifest, aG as createCampaign, aH as createContextPack, aI as createDurabilityProxyClient, createTreasuryPolicy, aJ as decideProcurementForTask, aK as estimateContextPackTokens, aL as evaluateAdaptiveReflectionPolicy, evaluateTopupRequest, aM as getResourceSnapshot, aN as normalizeListingText, aO as rankListingsForTask, aP as runAdaptiveReflectionCycle, aQ as runExecutionAdapter, aR as sanitizeListingNaming, aS as scoreListingForTask, treasuryStateFromSnapshot, aT as validateContextPack, aU as validateListingNaming, validateTreasuryPolicy, aV 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
12
  export { d as ObjectiveChangeProposal, e as ObjectiveChangeSourceTrust, O as ObjectiveGuardDecision, c as ObjectiveGuardPolicy, P as PromptShieldDecision, f as PromptShieldFlag, b as PromptShieldInput, a as PromptShieldPolicy, g as PromptShieldRisk, h as PromptShieldTrustLevel, i as evaluateObjectiveChange, j as evaluatePromptShield } from './objectiveGuard-d1x0xgAD.js';
package/dist/index.js CHANGED
@@ -248,6 +248,63 @@ var validateContextPack = (value) => {
248
248
  var CONTEXT_PACK_SECTION_ORDER = [...SECTION_ORDER];
249
249
  var estimateContextPackTokens = (textOrChars) => estimateTokensFromChars(typeof textOrChars === "number" ? textOrChars : textOrChars.length);
250
250
 
251
+ // src/executionAdapter.ts
252
+ var buildDecisionRecord = (input) => {
253
+ const nowMs = input.nowMs ?? Date.now();
254
+ return {
255
+ id: `decision-${nowMs}-${Math.random().toString(36).slice(2, 8)}`,
256
+ createdAt: new Date(nowMs).toISOString(),
257
+ decision: input.decision,
258
+ confidence: input.confidence,
259
+ verified: input.verified,
260
+ reasons: input.reasons,
261
+ objective: input.objective
262
+ };
263
+ };
264
+ var runExecutionAdapter = async (input) => {
265
+ const { mode, record, adapter } = input;
266
+ if (mode === "observe") {
267
+ return { mode, attempted: false, applied: false, validated: false, rolledBack: false, reason: "observe_mode" };
268
+ }
269
+ if (!adapter) {
270
+ return { mode, attempted: false, applied: false, validated: false, rolledBack: false, reason: "no_adapter" };
271
+ }
272
+ const dryRun = await adapter.dryRun({ record });
273
+ if (!dryRun.feasible) {
274
+ return { mode, attempted: false, applied: false, validated: false, rolledBack: false, reason: `dry_run_failed:${dryRun.reasons.join(",")}`, dryRun };
275
+ }
276
+ if (mode === "shadow") {
277
+ return { mode, attempted: true, applied: false, validated: false, rolledBack: false, reason: "shadow_mode", dryRun };
278
+ }
279
+ if (mode === "apply_limited" && record.confidence < 0.85) {
280
+ return { mode, attempted: true, applied: false, validated: false, rolledBack: false, reason: "limited_mode_confidence_gate", dryRun };
281
+ }
282
+ const apply = await adapter.apply({ record });
283
+ if (!apply.applied) {
284
+ return { mode, attempted: true, applied: false, validated: false, rolledBack: false, reason: apply.reason || "apply_not_applied", dryRun, apply };
285
+ }
286
+ const validate = await adapter.validate({ record, apply });
287
+ if (validate.passed) {
288
+ return { mode, attempted: true, applied: true, validated: true, rolledBack: false, reason: "applied_and_validated", dryRun, apply, validate };
289
+ }
290
+ if (adapter.rollback) {
291
+ const rollback = await adapter.rollback({ record, apply, validate });
292
+ return {
293
+ mode,
294
+ attempted: true,
295
+ applied: true,
296
+ validated: false,
297
+ rolledBack: rollback.rolledBack,
298
+ reason: rollback.rolledBack ? "rolled_back_after_validation_fail" : "validation_fail_rollback_failed",
299
+ dryRun,
300
+ apply,
301
+ validate,
302
+ rollback
303
+ };
304
+ }
305
+ return { mode, attempted: true, applied: true, validated: false, rolledBack: false, reason: "validation_failed_no_rollback", dryRun, apply, validate };
306
+ };
307
+
251
308
  // src/adaptiveReflection.ts
252
309
  var clamp01 = (n) => Math.max(0, Math.min(1, n));
253
310
  var recencyWeight = (createdAt, nowMs) => {
@@ -262,18 +319,20 @@ var recencyWeight = (createdAt, nowMs) => {
262
319
  };
263
320
  var inferTheme = (r) => {
264
321
  const t = `${String(r.comment || "")} ${String(r.agent_response_comment || "")}`.toLowerCase();
265
- if (/bug|broken|error|crash|fail/.test(t)) return "bug";
322
+ const rating = Number(r.rating);
323
+ if (/bug|broken|error|crash|fail|trash|awful|terrible|unplayable|unusable|only a page of code|only code|don\'t see any game|dont see any game|no game/.test(t)) return "bug";
266
324
  if (/downtime|timeout|unavailable|latency|disconnect/.test(t)) return "reliability";
267
325
  if (/confusing|hard|ux|ui|friction/.test(t)) return "ux";
268
326
  if (/price|expensive|cost|value/.test(t)) return "pricing";
269
327
  if (/feature|add|request|support/.test(t)) return "feature";
270
328
  if (/great|love|awesome|excellent/.test(t)) return "praise";
329
+ if (Number.isFinite(rating) && rating <= 2) return "bug";
271
330
  return "noise";
272
331
  };
273
332
  var classifyIssueSignal = (r) => {
274
333
  const text = `${String(r.comment || "")} ${String(r.agent_response_comment || "")}`.toLowerCase();
275
334
  const rating = Number(r.rating);
276
- const criticalHint = /crash|broken|error|fail|unusable|cannot|can't|doesn't work|not work|timeout|data loss/.test(text);
335
+ const criticalHint = /crash|broken|error|fail|trash|awful|terrible|unplayable|unusable|cannot|can't|doesn't work|not work|timeout|data loss|only a page of code|only code|don\'t see any game|dont see any game|no game/.test(text);
277
336
  const prefHint = /prefer|would like|i wish|could you|nice to have|personally|for me/.test(text);
278
337
  if (criticalHint || Number.isFinite(rating) && rating <= 2 && /bug|reliability|ux|pricing|feature/.test(inferTheme(r))) {
279
338
  return "critical_issue";
@@ -354,7 +413,7 @@ var evaluateAdaptiveReflectionPolicy = (aggregate, state, policy = {}, nowMs = D
354
413
  return { decision: "hold", immediate: false, rationale, confidence: 0.85, topTheme: aggregate.topTheme, topScore: aggregate.topScore };
355
414
  }
356
415
  const top = aggregate.themes.find((t) => t.theme === aggregate.topTheme);
357
- const immediate = Boolean(top && (top.theme === "bug" || top.theme === "reliability") && top.criticalCount >= 2 && top.weightedScore >= Math.max(3, minTopScore));
416
+ const immediate = Boolean(top && (top.theme === "bug" || top.theme === "reliability") && top.criticalCount >= 1 && top.weightedScore >= Math.max(2.2, minTopScore));
358
417
  if (immediate) rationale.push("immediate_fix_recommended");
359
418
  rationale.push("aggregate_signal_passed");
360
419
  return { decision: "adapt", immediate, rationale, confidence: immediate ? 0.9 : 0.8, topTheme: aggregate.topTheme, topScore: aggregate.topScore };
@@ -408,6 +467,32 @@ var buildAdaptivePlan = (decision) => {
408
467
  };
409
468
  return { id, theme: decision.topTheme, ...byTheme[decision.topTheme], urgency: decision.immediate ? "immediate" : "normal" };
410
469
  };
470
+ var verifyAdaptiveExecutionReadiness = (input, options = {}) => {
471
+ const minConfidence = options.minConfidence ?? 0.75;
472
+ const reasons = [];
473
+ const hasPlan = Boolean(input.plan);
474
+ if (!hasPlan) reasons.push("missing_plan");
475
+ const confidenceOk = input.decision.confidence >= minConfidence;
476
+ if (!confidenceOk) reasons.push("confidence_below_threshold");
477
+ const notNoiseTheme = input.decision.topTheme !== "noise";
478
+ if (!notNoiseTheme) reasons.push("noise_theme_blocked");
479
+ const policyAllowsAdapt = input.decision.decision === "adapt";
480
+ if (!policyAllowsAdapt) reasons.push("policy_not_adapt");
481
+ const allowImmediateOnly = options.allowImmediateOnly ?? false;
482
+ const urgencyAllowed = !allowImmediateOnly || Boolean(input.decision.immediate);
483
+ if (!urgencyAllowed) reasons.push("immediate_required");
484
+ return {
485
+ passed: hasPlan && confidenceOk && notNoiseTheme && policyAllowsAdapt && urgencyAllowed,
486
+ checks: {
487
+ hasPlan,
488
+ confidenceOk,
489
+ notNoiseTheme,
490
+ policyAllowsAdapt,
491
+ urgencyAllowed
492
+ },
493
+ reasons
494
+ };
495
+ };
411
496
  var runAdaptiveReflectionCycle = async (opts) => {
412
497
  const now = opts.now || (() => Date.now());
413
498
  const nowMs = now();
@@ -420,6 +505,13 @@ var runAdaptiveReflectionCycle = async (opts) => {
420
505
  });
421
506
  const decision = evaluateAdaptiveReflectionPolicy(aggregate, state, opts.policy, nowMs);
422
507
  const plan = buildAdaptivePlan(decision);
508
+ const verification = verifyAdaptiveExecutionReadiness(
509
+ { decision, plan },
510
+ {
511
+ minConfidence: 0.75,
512
+ allowImmediateOnly: opts.execution?.allowImmediateOnly ?? false
513
+ }
514
+ );
423
515
  const reflection = await runReflectionCycle({
424
516
  client: opts.client,
425
517
  listingId: opts.listingId,
@@ -428,11 +520,57 @@ var runAdaptiveReflectionCycle = async (opts) => {
428
520
  store: opts.reflectionStore,
429
521
  ...opts.reflectionOptions || {}
430
522
  });
523
+ const mode = opts.execution?.mode ?? "observe";
524
+ const rolloutMode = opts.execution?.rolloutMode || (mode === "apply" ? "apply_full" : "observe");
525
+ let execution = {
526
+ attempted: false,
527
+ applied: false,
528
+ mode,
529
+ reason: mode === "apply" ? "awaiting_verification" : "observe_mode"
530
+ };
531
+ if (mode === "apply") {
532
+ if (!verification.passed) {
533
+ execution = {
534
+ attempted: false,
535
+ applied: false,
536
+ mode,
537
+ reason: `verify_failed:${verification.reasons.join(",")}`
538
+ };
539
+ } else if (opts.execution?.adapter && plan) {
540
+ const record = buildDecisionRecord({
541
+ decision: decision.decision,
542
+ confidence: decision.confidence,
543
+ verified: verification.passed,
544
+ reasons: verification.reasons,
545
+ objective: plan.objectiveDelta,
546
+ nowMs
547
+ });
548
+ const run = await runExecutionAdapter({
549
+ mode: rolloutMode,
550
+ record,
551
+ adapter: opts.execution.adapter
552
+ });
553
+ execution = {
554
+ attempted: run.attempted,
555
+ applied: run.applied,
556
+ mode,
557
+ reason: run.reason
558
+ };
559
+ } else {
560
+ execution = {
561
+ attempted: false,
562
+ applied: false,
563
+ mode,
564
+ reason: "no_execution_adapter"
565
+ };
566
+ }
567
+ }
431
568
  const next = {
432
569
  ...state,
433
570
  lastEvaluatedAt: nowMs
434
571
  };
435
- if (decision.decision === "adapt" && plan) {
572
+ const adaptationCounted = decision.decision === "adapt" && plan && (mode === "observe" || execution.applied);
573
+ if (adaptationCounted) {
436
574
  next.lastAdaptedAtByTheme = { ...state.lastAdaptedAtByTheme || {}, [plan.theme]: nowMs };
437
575
  next.adaptationEvents = [...state.adaptationEvents || [], { ts: nowMs, theme: plan.theme, actionId: plan.id }].slice(-500);
438
576
  }
@@ -443,6 +581,8 @@ var runAdaptiveReflectionCycle = async (opts) => {
443
581
  generatedAt: new Date(nowMs).toISOString(),
444
582
  aggregate,
445
583
  decision,
584
+ verification,
585
+ execution,
446
586
  plan,
447
587
  reflection,
448
588
  policyState: next
@@ -565,7 +705,7 @@ var ReviewGate = class {
565
705
  var DEFAULT_API_BASE = "https://api.vibeiao.com";
566
706
  var DEFAULT_WEB_BASE = "https://vibeiao.com";
567
707
  var DEFAULT_SDK_PACKAGE = "@vibeiao/sdk";
568
- var DEFAULT_SDK_VERSION = "0.1.44" ? "0.1.44" : "0.1.4";
708
+ var DEFAULT_SDK_VERSION = "0.1.45" ? "0.1.45" : "0.1.4";
569
709
  var DEFAULT_SDK_REGISTRY = "https://registry.npmjs.org";
570
710
  var DEFAULT_SDK_POLICY_PATH = "/v1/sdk/policy";
571
711
  var DEFAULT_SDK_CHECK_INTERVAL_MS = 1e3 * 60 * 30;
@@ -1702,6 +1842,7 @@ export {
1702
1842
  buildAdaptivePlan,
1703
1843
  buildBadgeMarkdown,
1704
1844
  buildClaimMessage,
1845
+ buildDecisionRecord,
1705
1846
  buildJupiterSwapUrl,
1706
1847
  buildListingVersionMessage,
1707
1848
  buildMemoryPingMessage,
@@ -1762,6 +1903,7 @@ export {
1762
1903
  normalizeListingText,
1763
1904
  rankListingsForTask,
1764
1905
  runAdaptiveReflectionCycle,
1906
+ runExecutionAdapter,
1765
1907
  runMarketDiscovery,
1766
1908
  runReflectionCycle,
1767
1909
  sanitizeListingNaming,
@@ -1772,5 +1914,6 @@ export {
1772
1914
  validateContextPack,
1773
1915
  validateListingNaming,
1774
1916
  validateTreasuryPolicy,
1917
+ verifyAdaptiveExecutionReadiness,
1775
1918
  withSurvival
1776
1919
  };
@@ -828,6 +828,77 @@ declare const createDurabilityProxyClient: (options: DurabilityProxyClientOption
828
828
  }>;
829
829
  };
830
830
 
831
+ type ExecutionRolloutMode = 'observe' | 'shadow' | 'apply_limited' | 'apply_full';
832
+ type ExecutionDecisionRecord = {
833
+ id: string;
834
+ createdAt: string;
835
+ decision: 'hold' | 'observe' | 'adapt';
836
+ confidence: number;
837
+ verified: boolean;
838
+ reasons: string[];
839
+ objective?: string;
840
+ };
841
+ type ExecutionDryRunResult = {
842
+ feasible: boolean;
843
+ reasons: string[];
844
+ };
845
+ type ExecutionApplyResult = {
846
+ applied: boolean;
847
+ evidence?: string;
848
+ reason?: string;
849
+ };
850
+ type ExecutionValidateResult = {
851
+ passed: boolean;
852
+ metrics?: Record<string, number | string | boolean>;
853
+ reason?: string;
854
+ };
855
+ type ExecutionRollbackResult = {
856
+ rolledBack: boolean;
857
+ reason?: string;
858
+ };
859
+ interface ExecutionAdapter {
860
+ dryRun: (input: {
861
+ record: ExecutionDecisionRecord;
862
+ }) => Promise<ExecutionDryRunResult> | ExecutionDryRunResult;
863
+ apply: (input: {
864
+ record: ExecutionDecisionRecord;
865
+ }) => Promise<ExecutionApplyResult> | ExecutionApplyResult;
866
+ validate: (input: {
867
+ record: ExecutionDecisionRecord;
868
+ apply: ExecutionApplyResult;
869
+ }) => Promise<ExecutionValidateResult> | ExecutionValidateResult;
870
+ rollback?: (input: {
871
+ record: ExecutionDecisionRecord;
872
+ apply: ExecutionApplyResult;
873
+ validate: ExecutionValidateResult;
874
+ }) => Promise<ExecutionRollbackResult> | ExecutionRollbackResult;
875
+ }
876
+ type ExecutionRunResult = {
877
+ mode: ExecutionRolloutMode;
878
+ attempted: boolean;
879
+ applied: boolean;
880
+ validated: boolean;
881
+ rolledBack: boolean;
882
+ reason: string;
883
+ dryRun?: ExecutionDryRunResult;
884
+ apply?: ExecutionApplyResult;
885
+ validate?: ExecutionValidateResult;
886
+ rollback?: ExecutionRollbackResult;
887
+ };
888
+ declare const buildDecisionRecord: (input: {
889
+ decision: "hold" | "observe" | "adapt";
890
+ confidence: number;
891
+ verified: boolean;
892
+ reasons: string[];
893
+ objective?: string;
894
+ nowMs?: number;
895
+ }) => ExecutionDecisionRecord;
896
+ declare const runExecutionAdapter: (input: {
897
+ mode: ExecutionRolloutMode;
898
+ record: ExecutionDecisionRecord;
899
+ adapter?: ExecutionAdapter;
900
+ }) => Promise<ExecutionRunResult>;
901
+
831
902
  type AdaptiveTheme = 'bug' | 'reliability' | 'ux' | 'pricing' | 'feature' | 'praise' | 'noise';
832
903
  type AdaptiveFeedbackAggregate = {
833
904
  generatedAt: string;
@@ -877,6 +948,23 @@ type AdaptiveAdaptationPlan = {
877
948
  rollbackCriteria: string;
878
949
  urgency?: 'normal' | 'immediate';
879
950
  };
951
+ type AdaptiveVerification = {
952
+ passed: boolean;
953
+ checks: {
954
+ hasPlan: boolean;
955
+ confidenceOk: boolean;
956
+ notNoiseTheme: boolean;
957
+ policyAllowsAdapt: boolean;
958
+ urgencyAllowed: boolean;
959
+ };
960
+ reasons: string[];
961
+ };
962
+ type AdaptiveExecution = {
963
+ attempted: boolean;
964
+ applied: boolean;
965
+ mode: 'observe' | 'apply';
966
+ reason: string;
967
+ };
880
968
  type AdaptiveReflectionStore = ReflectionStore & {
881
969
  loadPolicyState?: () => Promise<AdaptivePolicyState | null> | AdaptivePolicyState | null;
882
970
  savePolicyState?: (s: AdaptivePolicyState) => Promise<void> | void;
@@ -889,6 +977,12 @@ type RunAdaptiveReflectionOptions = {
889
977
  reflectionStore?: AdaptiveReflectionStore;
890
978
  reflectionOptions?: Omit<ReflectionCycleOptions, 'client' | 'listingId' | 'wallet' | 'signMessage' | 'store'>;
891
979
  policy?: AdaptivePolicyConfig;
980
+ execution?: {
981
+ mode?: 'observe' | 'apply';
982
+ rolloutMode?: ExecutionRolloutMode;
983
+ allowImmediateOnly?: boolean;
984
+ adapter?: ExecutionAdapter;
985
+ };
892
986
  now?: () => number;
893
987
  };
894
988
  declare const aggregateFeedbackSignals: (reviews: ListingReviewRecord[], options?: {
@@ -897,10 +991,19 @@ declare const aggregateFeedbackSignals: (reviews: ListingReviewRecord[], options
897
991
  }) => AdaptiveFeedbackAggregate;
898
992
  declare const evaluateAdaptiveReflectionPolicy: (aggregate: AdaptiveFeedbackAggregate, state: AdaptivePolicyState, policy?: AdaptivePolicyConfig, nowMs?: number) => AdaptivePolicyDecision;
899
993
  declare const buildAdaptivePlan: (decision: AdaptivePolicyDecision) => AdaptiveAdaptationPlan | null;
994
+ declare const verifyAdaptiveExecutionReadiness: (input: {
995
+ decision: AdaptivePolicyDecision;
996
+ plan: AdaptiveAdaptationPlan | null;
997
+ }, options?: {
998
+ minConfidence?: number;
999
+ allowImmediateOnly?: boolean;
1000
+ }) => AdaptiveVerification;
900
1001
  declare const runAdaptiveReflectionCycle: (opts: RunAdaptiveReflectionOptions) => Promise<{
901
1002
  generatedAt: string;
902
1003
  aggregate: AdaptiveFeedbackAggregate;
903
1004
  decision: AdaptivePolicyDecision;
1005
+ verification: AdaptiveVerification;
1006
+ execution: AdaptiveExecution;
904
1007
  plan: AdaptiveAdaptationPlan;
905
1008
  reflection: ReflectionCycleResult;
906
1009
  policyState: AdaptivePolicyState;
@@ -1184,7 +1287,7 @@ declare class ReviewGate {
1184
1287
  assertClear(listingId: string, wallet: string): void;
1185
1288
  }
1186
1289
 
1187
- declare const compareVersions: (currentVersion: string, latestVersion: string) => 1 | 0 | -1;
1290
+ declare const compareVersions: (currentVersion: string, latestVersion: string) => 0 | 1 | -1;
1188
1291
  declare const buildSdkUpdateCommand: (packageName?: string) => string;
1189
1292
  declare const checkForSdkUpdate: (options?: SdkUpdateCheckOptions) => Promise<SdkUpdateStatus>;
1190
1293
  declare const checkForSdkUpdatePolicy: (options: SdkUpdatePolicyCheckOptions) => Promise<SdkUpdateStatus>;
@@ -1365,4 +1468,4 @@ declare const getResourceSnapshot: (options: {
1365
1468
  apiBase?: string;
1366
1469
  }) => Promise<ResourceSnapshot>;
1367
1470
 
1368
- export { type SdkUpdateCheckOptions as $, type AdaptiveAdaptationPlan as A, type BuybackEvent as B, CONTEXT_PACK_SECTION_ORDER as C, type DurabilityCheckpointWriteOptions as D, type ListingNamingValidationOptions as E, type ListingNamingValidationResult as F, type ListingQuery as G, type ListingReviewCreatePayload as H, type ListingReviewResponsePayload as I, type ListingVersionPayload as J, type MarketingLinkOptions as K, LISTING_NAME_MAX_LENGTH as L, type MarketingCampaign as M, type MemoryPingChallengeResponse as N, type MemoryPingPayload as O, type OpenRouterCredits as P, type ProcurementCandidate as Q, type ProcurementDecision as R, type ProcurementTaskProfile as S, type ProcurementWeights as T, type TopupDecision, type TopupRequest, type TreasuryLedgerEvent, type TreasuryPolicy, type TreasuryPolicyV1, type TreasuryState, type ResourceProviderManifestEntry as U, type ResourceSnapshot as V, ReviewGate as W, type ReviewGateRecord as X, type ReviewRequiredPayload as Y, type RunAdaptiveReflectionOptions as Z, SdkAutoUpdatedRestartRequiredError as _, type AdaptiveFeedbackAggregate as a, type SdkUpdatePolicyCheckOptions as a0, SdkUpdateRequiredError as a1, type SdkUpdateStatus as a2, VIBEIAO_IDL as a3, VibeClient as a4, type VibeClientOptions as a5, VibeRegistry as a6, aggregateFeedbackSignals as a7, assertSurvivalProvidersConfigured as a8, buildAdaptivePlan as a9, evaluateAdaptiveReflectionPolicy as aA, getResourceSnapshot as aB, normalizeListingText as aC, rankListingsForTask as aD, runAdaptiveReflectionCycle as aE, sanitizeListingNaming as aF, scoreListingForTask as aG, validateContextPack as aH, validateListingNaming as aI, buildBadgeMarkdown as aa, buildClaimMessage as ab, buildJupiterSwapUrl as ac, buildListingVersionMessage as ad, buildMemoryPingMessage as ae, buildOwnerTransferMessage as af, buildProcurementPrompt as ag, buildRaydiumSwapUrl as ah, buildReviewPrompt as ai, buildReviewRequired as aj, buildReviewResponseMessage as ak, buildSdkUpdateCommand as al, buildShareCopy as am, buildShareLink as an, buildTradeLinks as ao, checkForSdkUpdate as ap, checkForSdkUpdatePolicy as aq, compareVersions as ar, createApiCreditProvider as as, createApiCreditProviders as at, createApiCreditProvidersFromManifest as au, createCampaign as av, createContextPack as aw, createDurabilityProxyClient as ax, decideProcurementForTask as ay, estimateContextPackTokens as az, type AdaptivePolicyConfig as b, buildTreasuryLedgerEvent, type AdaptivePolicyDecision as c, createTreasuryPolicy, type AdaptivePolicyState as d, type AdaptiveReflectionStore as e, evaluateTopupRequest, type AdaptiveTheme as f, type AgentResourceProvidersManifest as g, type AnalyticsPoint as h, type ApiCreditProvider as i, type ApiCreditProviderFactoryOptions as j, type ApiCreditProviderPreset as k, type ApiCreditProviderPresetInput as l, type ApiResponse as m, type ContextPack as n, type ContextPackBudget as o, type ContextPackInput as p, type ContextPackOptions as q, type ContextPackSectionKey as r, type ContextPackSections as s, type DurabilityProxyClientOptions as t, treasuryStateFromSnapshot, type DurabilityRestoreDrillWriteOptions as u, LISTING_NAME_RECOMMENDED_MAX as v, validateTreasuryPolicy, LISTING_TAGLINE_MAX_LENGTH as w, LISTING_TAGLINE_RECOMMENDED_MAX as x, type LeaderboardEntry as y, type LeaderboardQuery as z };
1471
+ export { type ProcurementDecision as $, type AdaptiveAdaptationPlan as A, type BuybackEvent as B, CONTEXT_PACK_SECTION_ORDER as C, type DurabilityCheckpointWriteOptions as D, type ExecutionAdapter as E, type ExecutionRollbackResult as F, type ExecutionRolloutMode as G, type ExecutionRunResult as H, type ExecutionValidateResult as I, LISTING_NAME_RECOMMENDED_MAX as J, LISTING_TAGLINE_MAX_LENGTH as K, LISTING_NAME_MAX_LENGTH as L, LISTING_TAGLINE_RECOMMENDED_MAX as M, type LeaderboardEntry as N, type LeaderboardQuery as O, type ListingNamingValidationOptions as P, type ListingNamingValidationResult as Q, type ListingQuery as R, type ListingReviewCreatePayload as S, type ListingReviewResponsePayload as T, type TopupDecision, type TopupRequest, type TreasuryLedgerEvent, type TreasuryPolicy, type TreasuryPolicyV1, type TreasuryState, type ListingVersionPayload as U, type MarketingCampaign as V, type MarketingLinkOptions as W, type MemoryPingChallengeResponse as X, type MemoryPingPayload as Y, type OpenRouterCredits as Z, type ProcurementCandidate as _, type AdaptiveExecution as a, type ProcurementTaskProfile as a0, type ProcurementWeights as a1, type ResourceProviderManifestEntry as a2, type ResourceSnapshot as a3, ReviewGate as a4, type ReviewGateRecord as a5, type ReviewRequiredPayload as a6, type RunAdaptiveReflectionOptions as a7, SdkAutoUpdatedRestartRequiredError as a8, type SdkUpdateCheckOptions as a9, checkForSdkUpdate as aA, checkForSdkUpdatePolicy as aB, compareVersions as aC, createApiCreditProvider as aD, createApiCreditProviders as aE, createApiCreditProvidersFromManifest as aF, createCampaign as aG, createContextPack as aH, createDurabilityProxyClient as aI, decideProcurementForTask as aJ, estimateContextPackTokens as aK, evaluateAdaptiveReflectionPolicy as aL, getResourceSnapshot as aM, normalizeListingText as aN, rankListingsForTask as aO, runAdaptiveReflectionCycle as aP, runExecutionAdapter as aQ, sanitizeListingNaming as aR, scoreListingForTask as aS, validateContextPack as aT, validateListingNaming as aU, verifyAdaptiveExecutionReadiness as aV, type SdkUpdatePolicyCheckOptions as aa, SdkUpdateRequiredError as ab, type SdkUpdateStatus as ac, VIBEIAO_IDL as ad, VibeClient as ae, type VibeClientOptions as af, VibeRegistry as ag, aggregateFeedbackSignals as ah, assertSurvivalProvidersConfigured as ai, buildAdaptivePlan as aj, buildBadgeMarkdown as ak, buildClaimMessage as al, buildDecisionRecord as am, buildJupiterSwapUrl as an, buildListingVersionMessage as ao, buildMemoryPingMessage as ap, buildOwnerTransferMessage as aq, buildProcurementPrompt as ar, buildRaydiumSwapUrl as as, buildReviewPrompt as at, buildReviewRequired as au, buildReviewResponseMessage as av, buildSdkUpdateCommand as aw, buildShareCopy as ax, buildShareLink as ay, buildTradeLinks as az, type AdaptiveFeedbackAggregate as b, buildTreasuryLedgerEvent, type AdaptivePolicyConfig as c, createTreasuryPolicy, type AdaptivePolicyDecision as d, type AdaptivePolicyState as e, evaluateTopupRequest, type AdaptiveReflectionStore as f, type AdaptiveTheme as g, type AdaptiveVerification as h, type AgentResourceProvidersManifest as i, type AnalyticsPoint as j, type ApiCreditProvider as k, type ApiCreditProviderFactoryOptions as l, type ApiCreditProviderPreset as m, type ApiCreditProviderPresetInput as n, type ApiResponse as o, type ContextPack as p, type ContextPackBudget as q, type ContextPackInput as r, type ContextPackOptions as s, type ContextPackSectionKey as t, treasuryStateFromSnapshot, type ContextPackSections as u, type DurabilityProxyClientOptions as v, validateTreasuryPolicy, type DurabilityRestoreDrillWriteOptions as w, type ExecutionApplyResult as x, type ExecutionDecisionRecord as y, type ExecutionDryRunResult 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.45",
5
+ "version": "0.1.46",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {