@vibeiao/sdk 0.1.35 → 0.1.37
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 +14 -0
- package/dist/agentLoop.d.ts +28 -1
- package/dist/agentLoop.js +43 -3
- package/dist/chunk-BQVU67TR.js +63 -0
- package/dist/chunk-RUKN3KQ2.js +158 -0
- package/dist/humanAppLoop.d.ts +73 -0
- package/dist/humanAppLoop.js +316 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +38 -548
- package/dist/outcomeBoundFlow.d.ts +38 -0
- package/dist/outcomeBoundFlow.js +12 -0
- package/dist/strictMemoryRuntime.d.ts +57 -0
- package/dist/strictMemoryRuntime.js +14 -0
- package/dist/treasuryGuardian.d.ts +3 -166
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
VIBEIAO_IDL,
|
|
3
|
+
fetchSolBalance,
|
|
4
|
+
fetchTokenBalance,
|
|
5
|
+
fetchTokenBalances,
|
|
6
|
+
normalizeHumanAppCategory
|
|
7
|
+
} from "./chunk-2U6HLZEF.js";
|
|
1
8
|
import {
|
|
2
9
|
getSurvivalPlaybookDecision,
|
|
3
10
|
getSurvivalPlaybookDecisionFromSelfReliance
|
|
@@ -12,6 +19,21 @@ import {
|
|
|
12
19
|
import {
|
|
13
20
|
createDurabilityProxyClient
|
|
14
21
|
} from "./chunk-PVCW4MAY.js";
|
|
22
|
+
import {
|
|
23
|
+
SelfReliance,
|
|
24
|
+
createAutoSelfReliance,
|
|
25
|
+
createSelfRelianceMonitor,
|
|
26
|
+
createSelfReliancePolicy,
|
|
27
|
+
createSurvivalMiddleware,
|
|
28
|
+
withSurvival
|
|
29
|
+
} from "./chunk-M7DQTU5R.js";
|
|
30
|
+
import {
|
|
31
|
+
STRICT_MEMORY_RUNTIME_SCHEMA,
|
|
32
|
+
createStrictMemoryRuntimePreset,
|
|
33
|
+
evaluateStrictMemoryExecution,
|
|
34
|
+
isComplexTask,
|
|
35
|
+
upgradeToStrictMemoryRuntimePreset
|
|
36
|
+
} from "./chunk-RUKN3KQ2.js";
|
|
15
37
|
import {
|
|
16
38
|
evaluateEscapeHatch,
|
|
17
39
|
formatEscapeHatchDecision
|
|
@@ -27,6 +49,12 @@ import {
|
|
|
27
49
|
extractMarketSignals,
|
|
28
50
|
runMarketDiscovery
|
|
29
51
|
} from "./chunk-ZMUFCYW6.js";
|
|
52
|
+
import {
|
|
53
|
+
OUTCOME_BOUND_FLOW_SCHEMA,
|
|
54
|
+
OUTCOME_BOUND_REQUIRED_GATES,
|
|
55
|
+
assertOutcomeBoundCompleted,
|
|
56
|
+
evaluateOutcomeBoundRun
|
|
57
|
+
} from "./chunk-BQVU67TR.js";
|
|
30
58
|
import {
|
|
31
59
|
buildReflectionBacklog,
|
|
32
60
|
buildReflectionCandidate,
|
|
@@ -36,21 +64,6 @@ import {
|
|
|
36
64
|
runReflectionCycle,
|
|
37
65
|
scoreReviewPriority
|
|
38
66
|
} from "./chunk-BS7WZWNB.js";
|
|
39
|
-
import {
|
|
40
|
-
SelfReliance,
|
|
41
|
-
createAutoSelfReliance,
|
|
42
|
-
createSelfRelianceMonitor,
|
|
43
|
-
createSelfReliancePolicy,
|
|
44
|
-
createSurvivalMiddleware,
|
|
45
|
-
withSurvival
|
|
46
|
-
} from "./chunk-M7DQTU5R.js";
|
|
47
|
-
import {
|
|
48
|
-
VIBEIAO_IDL,
|
|
49
|
-
fetchSolBalance,
|
|
50
|
-
fetchTokenBalance,
|
|
51
|
-
fetchTokenBalances,
|
|
52
|
-
normalizeHumanAppCategory
|
|
53
|
-
} from "./chunk-2U6HLZEF.js";
|
|
54
67
|
|
|
55
68
|
// src/contextPack.ts
|
|
56
69
|
var SECTION_ORDER = [
|
|
@@ -233,524 +246,6 @@ var validateContextPack = (value) => {
|
|
|
233
246
|
var CONTEXT_PACK_SECTION_ORDER = [...SECTION_ORDER];
|
|
234
247
|
var estimateContextPackTokens = (textOrChars) => estimateTokensFromChars(typeof textOrChars === "number" ? textOrChars : textOrChars.length);
|
|
235
248
|
|
|
236
|
-
// src/humanAppLoop.ts
|
|
237
|
-
import { promises as fs } from "fs";
|
|
238
|
-
import path from "path";
|
|
239
|
-
var HUMAN_APP_LOOP_SCHEMA = "human-app-reflective-loop/v1";
|
|
240
|
-
var HUMAN_APP_LOOP_PHASES = [
|
|
241
|
-
"research",
|
|
242
|
-
"hypothesis",
|
|
243
|
-
"build",
|
|
244
|
-
"launch",
|
|
245
|
-
"observe",
|
|
246
|
-
"reflect",
|
|
247
|
-
"iterate"
|
|
248
|
-
];
|
|
249
|
-
var nowIso = () => (/* @__PURE__ */ new Date()).toISOString();
|
|
250
|
-
var createHumanAppLoopSpec = (createdAt = nowIso()) => ({
|
|
251
|
-
schema: HUMAN_APP_LOOP_SCHEMA,
|
|
252
|
-
createdAt,
|
|
253
|
-
phases: [
|
|
254
|
-
{
|
|
255
|
-
phase: "research",
|
|
256
|
-
requiredInputs: ["problem statement", "target users", "constraints (time/budget/risk)"],
|
|
257
|
-
requiredOutputs: ["evidence log", "competitor/alternative scan", "top unresolved assumptions"],
|
|
258
|
-
goNoGoCriteria: [">=3 independent evidence points", "clear user pain identified"],
|
|
259
|
-
stopOrRollbackConditions: ["no meaningful user pain found", "constraints make task infeasible"],
|
|
260
|
-
kpis: ["evidence_count", "source_diversity", "problem_clarity_score"]
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
phase: "hypothesis",
|
|
264
|
-
requiredInputs: ["research outputs"],
|
|
265
|
-
requiredOutputs: ["testable hypotheses", "success/failure thresholds", "experiment plan"],
|
|
266
|
-
goNoGoCriteria: ["each hypothesis is falsifiable", "each has measurable KPI target"],
|
|
267
|
-
stopOrRollbackConditions: ["hypothesis not measurable", "missing baseline"],
|
|
268
|
-
kpis: ["hypothesis_count", "kpi_defined_ratio"]
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
phase: "build",
|
|
272
|
-
requiredInputs: ["approved hypothesis", "scope boundary"],
|
|
273
|
-
requiredOutputs: ["MVP artifact", "change log", "known limitations list"],
|
|
274
|
-
goNoGoCriteria: ["MVP covers core user path", "critical defects resolved"],
|
|
275
|
-
stopOrRollbackConditions: ["critical bug unresolved", "scope creep beyond budget"],
|
|
276
|
-
kpis: ["mvp_completion", "critical_bug_count", "time_to_mvp_hours"]
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
phase: "launch",
|
|
280
|
-
requiredInputs: ["MVP artifact", "release checklist"],
|
|
281
|
-
requiredOutputs: ["launch record", "segment/channel", "baseline metrics snapshot"],
|
|
282
|
-
goNoGoCriteria: ["launch checklist passed", "monitoring ready"],
|
|
283
|
-
stopOrRollbackConditions: ["monitoring absent", "compliance/safety issue found"],
|
|
284
|
-
kpis: ["launch_readiness_score", "time_to_first_user_feedback_hours"]
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
phase: "observe",
|
|
288
|
-
requiredInputs: ["launch metrics", "feedback stream"],
|
|
289
|
-
requiredOutputs: ["observation report", "anomaly list", "KPI trend summary"],
|
|
290
|
-
goNoGoCriteria: ["minimum observation window met", "KPI deltas measurable"],
|
|
291
|
-
stopOrRollbackConditions: ["harmful regressions", "rollback threshold crossed"],
|
|
292
|
-
kpis: ["retention_d1", "task_success_rate", "error_rate", "feedback_signal_ratio"]
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
phase: "reflect",
|
|
296
|
-
requiredInputs: ["observation report", "hypothesis outcomes"],
|
|
297
|
-
requiredOutputs: ["lessons learned", "root-cause analysis", "decision log"],
|
|
298
|
-
goNoGoCriteria: ["at least one actionable insight", "root cause linked to evidence"],
|
|
299
|
-
stopOrRollbackConditions: ["insufficient evidence quality"],
|
|
300
|
-
kpis: ["insight_actionability_score", "decision_traceability_ratio"]
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
phase: "iterate",
|
|
304
|
-
requiredInputs: ["reflection decisions", "prioritized backlog"],
|
|
305
|
-
requiredOutputs: ["next-cycle plan", "versioned experiment backlog", "risk updates"],
|
|
306
|
-
goNoGoCriteria: ["next cycle has explicit KPI targets", "owner and timeline assigned"],
|
|
307
|
-
stopOrRollbackConditions: ["no measurable improvement path"],
|
|
308
|
-
kpis: ["iteration_cycle_time", "kpi_improvement_rate", "rollback_incident_count"]
|
|
309
|
-
}
|
|
310
|
-
],
|
|
311
|
-
optionalToolUsePolicy: {
|
|
312
|
-
enabled: true,
|
|
313
|
-
rules: [
|
|
314
|
-
"Tool choice is optional, but each phase must record a one-line rationale for selected tools.",
|
|
315
|
-
"Prefer the least-privilege/lowest-cost tool that can satisfy evidence quality.",
|
|
316
|
-
"If external tools are skipped, document why manual reasoning is sufficient."
|
|
317
|
-
]
|
|
318
|
-
},
|
|
319
|
-
overlapWithAgentListingLoops: {
|
|
320
|
-
overlap: [
|
|
321
|
-
"Both loops require measurable KPI targets and decision gates.",
|
|
322
|
-
"Both run observe -> reflect -> iterate compounding cycles.",
|
|
323
|
-
"Both benefit from versioned changelogs and user/review feedback integration."
|
|
324
|
-
],
|
|
325
|
-
differences: [
|
|
326
|
-
"Human app loop starts with product problem discovery; agent-listing loops start with listing/distribution economics.",
|
|
327
|
-
"Human app loop emphasizes user value and usability outcomes; agent-listing loops emphasize market visibility, conversion, and listing operations.",
|
|
328
|
-
"Human app loop gates include stop/rollback on product harm/usability regressions before growth mechanics."
|
|
329
|
-
]
|
|
330
|
-
},
|
|
331
|
-
evaluationRubric: {
|
|
332
|
-
dimensions: [
|
|
333
|
-
{
|
|
334
|
-
id: "researchDepth",
|
|
335
|
-
description: "Evidence quality, source diversity, and assumption clarity.",
|
|
336
|
-
weight: 0.35,
|
|
337
|
-
passThreshold: 3
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
id: "iterationQuality",
|
|
341
|
-
description: "Strength of hypothesis-to-build-to-reflect loop with measurable changes.",
|
|
342
|
-
weight: 0.35,
|
|
343
|
-
passThreshold: 3
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
id: "outcomeUsefulness",
|
|
347
|
-
description: "Practical utility of outputs for a human owner/builder.",
|
|
348
|
-
weight: 0.3,
|
|
349
|
-
passThreshold: 3
|
|
350
|
-
}
|
|
351
|
-
],
|
|
352
|
-
overallPassThreshold: 3.2
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
var clamp = (v, min, max) => Math.max(min, Math.min(max, v));
|
|
356
|
-
var evaluateHumanAppTrial = (trial, spec = createHumanAppLoopSpec("1970-01-01T00:00:00.000Z")) => {
|
|
357
|
-
const notes = [];
|
|
358
|
-
const r = trial.evidence;
|
|
359
|
-
const researchDepth = clamp(
|
|
360
|
-
(r.researchNotesCount >= 4 ? 2 : r.researchNotesCount >= 2 ? 1 : 0) + (r.hypothesisCount >= 2 ? 1 : 0) + (r.measurableKpiCount >= 2 ? 1 : 0),
|
|
361
|
-
1,
|
|
362
|
-
5
|
|
363
|
-
);
|
|
364
|
-
const iterationQuality = clamp(
|
|
365
|
-
(r.experimentsRun >= 2 ? 2 : r.experimentsRun >= 1 ? 1 : 0) + (r.iterationSteps >= 2 ? 2 : r.iterationSteps >= 1 ? 1 : 0) + (r.rollbackPlanPresent ? 1 : 0),
|
|
366
|
-
1,
|
|
367
|
-
5
|
|
368
|
-
);
|
|
369
|
-
const outcomeUsefulness = clamp(
|
|
370
|
-
(r.shippedArtifactPresent ? 2 : 0) + (r.measurableKpiCount >= 2 ? 2 : r.measurableKpiCount >= 1 ? 1 : 0) + (r.rollbackPlanPresent ? 1 : 0),
|
|
371
|
-
1,
|
|
372
|
-
5
|
|
373
|
-
);
|
|
374
|
-
const weights = Object.fromEntries(spec.evaluationRubric.dimensions.map((d) => [d.id, d.weight]));
|
|
375
|
-
const weightedScore = researchDepth * (weights.researchDepth || 0) + iterationQuality * (weights.iterationQuality || 0) + outcomeUsefulness * (weights.outcomeUsefulness || 0);
|
|
376
|
-
if (!r.rollbackPlanPresent) notes.push("Missing rollback plan evidence.");
|
|
377
|
-
if (r.measurableKpiCount < 2) notes.push("Insufficient measurable KPI coverage.");
|
|
378
|
-
if (r.experimentsRun < 1) notes.push("No experiment run evidence.");
|
|
379
|
-
const dimensionThresholds = Object.fromEntries(
|
|
380
|
-
spec.evaluationRubric.dimensions.map((d) => [d.id, d.passThreshold])
|
|
381
|
-
);
|
|
382
|
-
const pass = researchDepth >= (dimensionThresholds.researchDepth || 0) && iterationQuality >= (dimensionThresholds.iterationQuality || 0) && outcomeUsefulness >= (dimensionThresholds.outcomeUsefulness || 0) && weightedScore >= spec.evaluationRubric.overallPassThreshold;
|
|
383
|
-
return {
|
|
384
|
-
id: trial.id,
|
|
385
|
-
scores: { researchDepth, iterationQuality, outcomeUsefulness },
|
|
386
|
-
weightedScore: Number(weightedScore.toFixed(2)),
|
|
387
|
-
pass,
|
|
388
|
-
notes
|
|
389
|
-
};
|
|
390
|
-
};
|
|
391
|
-
var ensureDir = async (dir) => {
|
|
392
|
-
await fs.mkdir(dir, { recursive: true });
|
|
393
|
-
};
|
|
394
|
-
var writeIfAllowed = async (filePath, content, overwrite) => {
|
|
395
|
-
if (!overwrite) {
|
|
396
|
-
try {
|
|
397
|
-
await fs.access(filePath);
|
|
398
|
-
return false;
|
|
399
|
-
} catch {
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
await fs.writeFile(filePath, content, "utf-8");
|
|
403
|
-
return true;
|
|
404
|
-
};
|
|
405
|
-
var buildLoopRunTemplate = () => `# Human App Reflective Loop Run Template
|
|
406
|
-
|
|
407
|
-
Use this in order: research -> hypothesis -> build -> launch -> observe -> reflect -> iterate
|
|
408
|
-
|
|
409
|
-
## 0) Metadata
|
|
410
|
-
- App idea:
|
|
411
|
-
- Target user:
|
|
412
|
-
- Owner:
|
|
413
|
-
- Date:
|
|
414
|
-
- Version/cycle:
|
|
415
|
-
|
|
416
|
-
## 1) Research
|
|
417
|
-
- Inputs used:
|
|
418
|
-
- Evidence notes (>=3):
|
|
419
|
-
- Output summary:
|
|
420
|
-
- Go/No-Go decision:
|
|
421
|
-
|
|
422
|
-
## 2) Hypothesis
|
|
423
|
-
- Hypothesis H1:
|
|
424
|
-
- KPI targets + baseline:
|
|
425
|
-
- Experiment plan:
|
|
426
|
-
- Go/No-Go decision:
|
|
427
|
-
|
|
428
|
-
## 3) Build
|
|
429
|
-
- Scope:
|
|
430
|
-
- Artifact shipped:
|
|
431
|
-
- Known limitations:
|
|
432
|
-
- Go/No-Go decision:
|
|
433
|
-
|
|
434
|
-
## 4) Launch
|
|
435
|
-
- Channel/audience:
|
|
436
|
-
- Launch checklist:
|
|
437
|
-
- Baseline metric snapshot:
|
|
438
|
-
- Go/No-Go decision:
|
|
439
|
-
|
|
440
|
-
## 5) Observe
|
|
441
|
-
- Observation window:
|
|
442
|
-
- KPI deltas:
|
|
443
|
-
- Risks/anomalies:
|
|
444
|
-
- Stop/Rollback triggered? why/why not:
|
|
445
|
-
|
|
446
|
-
## 6) Reflect
|
|
447
|
-
- What worked:
|
|
448
|
-
- What failed:
|
|
449
|
-
- Root cause evidence:
|
|
450
|
-
- Decisions recorded:
|
|
451
|
-
|
|
452
|
-
## 7) Iterate
|
|
453
|
-
- Next-cycle plan:
|
|
454
|
-
- Backlog prioritization:
|
|
455
|
-
- KPI delta target:
|
|
456
|
-
- Rollback guardrails:
|
|
457
|
-
`;
|
|
458
|
-
var buildSubagentTaskTemplate = () => `# Subagent Task Template \u2014 Human App Reflective Loop
|
|
459
|
-
|
|
460
|
-
You are tasked to run ONE full human-app reflective loop cycle on a small app/game idea.
|
|
461
|
-
|
|
462
|
-
Required order (do not skip):
|
|
463
|
-
1. research
|
|
464
|
-
2. hypothesis
|
|
465
|
-
3. build (MVP spec or mock implementation)
|
|
466
|
-
4. launch (simulated launch plan)
|
|
467
|
-
5. observe (expected metrics + monitoring)
|
|
468
|
-
6. reflect
|
|
469
|
-
7. iterate
|
|
470
|
-
|
|
471
|
-
Requirements:
|
|
472
|
-
- Include measurable KPIs and thresholds.
|
|
473
|
-
- Include explicit go/no-go decision at each phase.
|
|
474
|
-
- Include stop/rollback conditions.
|
|
475
|
-
- If you use tools, add one-line justification per tool.
|
|
476
|
-
- Output using LOOP_RUN_TEMPLATE.md headings.
|
|
477
|
-
`;
|
|
478
|
-
var buildScorecardTemplate = () => `# Human App Loop Trial Scorecard
|
|
479
|
-
|
|
480
|
-
## Trial ID
|
|
481
|
-
-
|
|
482
|
-
|
|
483
|
-
## Scores (1-5)
|
|
484
|
-
- researchDepth:
|
|
485
|
-
- iterationQuality:
|
|
486
|
-
- outcomeUsefulness:
|
|
487
|
-
- weightedScore:
|
|
488
|
-
- pass/fail:
|
|
489
|
-
|
|
490
|
-
## Evidence
|
|
491
|
-
- research notes count:
|
|
492
|
-
- hypotheses count:
|
|
493
|
-
- experiments run:
|
|
494
|
-
- measurable KPI count:
|
|
495
|
-
- rollback plan present:
|
|
496
|
-
- shipped artifact present:
|
|
497
|
-
- iteration steps:
|
|
498
|
-
|
|
499
|
-
## Issues / Fixes
|
|
500
|
-
-
|
|
501
|
-
`;
|
|
502
|
-
var buildReadme = () => `# Human App Reflective Loop Pack
|
|
503
|
-
|
|
504
|
-
This pack is first-class scaffold for human app lifecycle execution.
|
|
505
|
-
|
|
506
|
-
## Files
|
|
507
|
-
- LOOP_RUN_TEMPLATE.md
|
|
508
|
-
- SUBAGENT_TASK_TEMPLATE.md
|
|
509
|
-
- TRIAL_SCORECARD_TEMPLATE.md
|
|
510
|
-
- SPEC.snapshot.json
|
|
511
|
-
|
|
512
|
-
## Quick usage
|
|
513
|
-
1) Fill LOOP_RUN_TEMPLATE.md for a cycle.
|
|
514
|
-
2) For delegated runs, paste SUBAGENT_TASK_TEMPLATE.md into a subagent task.
|
|
515
|
-
3) Evaluate trial outputs with TRIAL_SCORECARD_TEMPLATE.md and the SDK evaluator.
|
|
516
|
-
`;
|
|
517
|
-
var scaffoldHumanAppLoopPack = async (options = {}) => {
|
|
518
|
-
const root = path.resolve(options.root || ".");
|
|
519
|
-
const outputDir = path.resolve(root, options.outputDir || "projects/vibeiao/human-app-loop-pack");
|
|
520
|
-
const overwrite = Boolean(options.overwrite);
|
|
521
|
-
const createdAt = nowIso();
|
|
522
|
-
const files = [];
|
|
523
|
-
await ensureDir(outputDir);
|
|
524
|
-
const spec = createHumanAppLoopSpec(createdAt);
|
|
525
|
-
const writes = [
|
|
526
|
-
["LOOP_RUN_TEMPLATE.md", buildLoopRunTemplate()],
|
|
527
|
-
["SUBAGENT_TASK_TEMPLATE.md", buildSubagentTaskTemplate()],
|
|
528
|
-
["TRIAL_SCORECARD_TEMPLATE.md", buildScorecardTemplate()],
|
|
529
|
-
["README.md", buildReadme()],
|
|
530
|
-
["SPEC.snapshot.json", `${JSON.stringify(spec, null, 2)}
|
|
531
|
-
`]
|
|
532
|
-
];
|
|
533
|
-
for (const [name, content] of writes) {
|
|
534
|
-
const full = path.join(outputDir, name);
|
|
535
|
-
const written = await writeIfAllowed(full, content, overwrite);
|
|
536
|
-
if (written) files.push(full);
|
|
537
|
-
}
|
|
538
|
-
return {
|
|
539
|
-
root,
|
|
540
|
-
outputDir,
|
|
541
|
-
files,
|
|
542
|
-
createdAt
|
|
543
|
-
};
|
|
544
|
-
};
|
|
545
|
-
|
|
546
|
-
// src/outcomeBoundFlow.ts
|
|
547
|
-
var OUTCOME_BOUND_FLOW_SCHEMA = "outcome-bound-autonomous-flow/v1";
|
|
548
|
-
var OUTCOME_BOUND_REQUIRED_GATES = [
|
|
549
|
-
"public_deploy_url",
|
|
550
|
-
"listing_updated",
|
|
551
|
-
"external_smoke_check",
|
|
552
|
-
"evidence_log",
|
|
553
|
-
"context_pack_preflight"
|
|
554
|
-
];
|
|
555
|
-
var isNonEmpty = (v) => typeof v === "string" && v.trim().length > 0;
|
|
556
|
-
var evaluateOutcomeBoundRun = (input) => {
|
|
557
|
-
const failedGates = [];
|
|
558
|
-
const reasons = [];
|
|
559
|
-
if (!isNonEmpty(input.publicDeployUrl)) {
|
|
560
|
-
failedGates.push("public_deploy_url");
|
|
561
|
-
reasons.push("Missing public deploy URL.");
|
|
562
|
-
}
|
|
563
|
-
if (!input.listingUpdated || !isNonEmpty(input.listingId)) {
|
|
564
|
-
failedGates.push("listing_updated");
|
|
565
|
-
reasons.push("Listing update is incomplete (listingUpdated/listingId required).");
|
|
566
|
-
}
|
|
567
|
-
if (!input.externalSmokeCheck?.passed) {
|
|
568
|
-
failedGates.push("external_smoke_check");
|
|
569
|
-
reasons.push("External smoke check did not pass.");
|
|
570
|
-
}
|
|
571
|
-
if (!isNonEmpty(input.evidenceLogPath)) {
|
|
572
|
-
failedGates.push("evidence_log");
|
|
573
|
-
reasons.push("Missing evidence log path.");
|
|
574
|
-
}
|
|
575
|
-
if (!input.contextPackPreflight?.passed) {
|
|
576
|
-
failedGates.push("context_pack_preflight");
|
|
577
|
-
reasons.push("Context-pack preflight did not pass.");
|
|
578
|
-
}
|
|
579
|
-
const passedCount = OUTCOME_BOUND_REQUIRED_GATES.length - failedGates.length;
|
|
580
|
-
const score = Number((passedCount / OUTCOME_BOUND_REQUIRED_GATES.length).toFixed(2));
|
|
581
|
-
const completed = failedGates.length === 0;
|
|
582
|
-
return {
|
|
583
|
-
schema: OUTCOME_BOUND_FLOW_SCHEMA,
|
|
584
|
-
runId: input.runId,
|
|
585
|
-
objective: input.objective,
|
|
586
|
-
completed,
|
|
587
|
-
failedGates,
|
|
588
|
-
score,
|
|
589
|
-
status: completed ? "pass" : "fail",
|
|
590
|
-
reasons,
|
|
591
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
592
|
-
};
|
|
593
|
-
};
|
|
594
|
-
var assertOutcomeBoundCompleted = (input) => {
|
|
595
|
-
const status = evaluateOutcomeBoundRun(input);
|
|
596
|
-
if (!status.completed) {
|
|
597
|
-
const details = status.reasons.join(" ");
|
|
598
|
-
throw new Error(`outcome_bound_incomplete:${status.failedGates.join(",")}${details ? `:${details}` : ""}`);
|
|
599
|
-
}
|
|
600
|
-
return status;
|
|
601
|
-
};
|
|
602
|
-
|
|
603
|
-
// src/strictMemoryRuntime.ts
|
|
604
|
-
var STRICT_MEMORY_RUNTIME_SCHEMA = "strict-memory-runtime/v1";
|
|
605
|
-
var DEFAULT_MUTATION_KEYWORDS = [
|
|
606
|
-
"deploy",
|
|
607
|
-
"restart",
|
|
608
|
-
"install",
|
|
609
|
-
"delete",
|
|
610
|
-
"remove",
|
|
611
|
-
"push",
|
|
612
|
-
"publish",
|
|
613
|
-
"release",
|
|
614
|
-
"migrate",
|
|
615
|
-
"config",
|
|
616
|
-
"cron",
|
|
617
|
-
"service",
|
|
618
|
-
"production",
|
|
619
|
-
"prod"
|
|
620
|
-
];
|
|
621
|
-
var DEFAULT_COMPLEX_KEYWORDS = [
|
|
622
|
-
"multi-step",
|
|
623
|
-
"cross-day",
|
|
624
|
-
"production",
|
|
625
|
-
"owner",
|
|
626
|
-
"id",
|
|
627
|
-
"listing",
|
|
628
|
-
"migration",
|
|
629
|
-
"incident",
|
|
630
|
-
"release",
|
|
631
|
-
"rollout",
|
|
632
|
-
"infra",
|
|
633
|
-
"security"
|
|
634
|
-
];
|
|
635
|
-
var uniq = (arr) => [...new Set(arr.map((s) => String(s).trim()).filter(Boolean))];
|
|
636
|
-
var createStrictMemoryRuntimePreset = (overrides = {}) => {
|
|
637
|
-
const base = {
|
|
638
|
-
schema: STRICT_MEMORY_RUNTIME_SCHEMA,
|
|
639
|
-
enabled: true,
|
|
640
|
-
requireContextPackForComplex: true,
|
|
641
|
-
requireSemanticRecallForComplex: true,
|
|
642
|
-
requireApprovalPreflightForMutations: true,
|
|
643
|
-
maxContextPackAgeMin: 180,
|
|
644
|
-
mutationKeywords: [...DEFAULT_MUTATION_KEYWORDS],
|
|
645
|
-
complexTaskTrigger: {
|
|
646
|
-
keywords: [...DEFAULT_COMPLEX_KEYWORDS],
|
|
647
|
-
minTaskChars: 80
|
|
648
|
-
},
|
|
649
|
-
upgradePolicy: {
|
|
650
|
-
mode: "observe",
|
|
651
|
-
safeUpgrade: {
|
|
652
|
-
backupBeforeEnable: true,
|
|
653
|
-
requireHealthcheckPass: true,
|
|
654
|
-
rollbackOnBlockRateAbove: 0.35
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
};
|
|
658
|
-
return {
|
|
659
|
-
...base,
|
|
660
|
-
...overrides,
|
|
661
|
-
mutationKeywords: uniq(overrides.mutationKeywords || base.mutationKeywords),
|
|
662
|
-
complexTaskTrigger: {
|
|
663
|
-
...base.complexTaskTrigger,
|
|
664
|
-
...overrides.complexTaskTrigger || {},
|
|
665
|
-
keywords: uniq(overrides.complexTaskTrigger?.keywords || base.complexTaskTrigger.keywords)
|
|
666
|
-
},
|
|
667
|
-
upgradePolicy: {
|
|
668
|
-
...base.upgradePolicy,
|
|
669
|
-
...overrides.upgradePolicy || {},
|
|
670
|
-
safeUpgrade: {
|
|
671
|
-
...base.upgradePolicy.safeUpgrade,
|
|
672
|
-
...overrides.upgradePolicy?.safeUpgrade || {}
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
};
|
|
676
|
-
};
|
|
677
|
-
var includesAny = (text, words) => {
|
|
678
|
-
const low = text.toLowerCase();
|
|
679
|
-
return words.some((w) => low.includes(w.toLowerCase()));
|
|
680
|
-
};
|
|
681
|
-
var isComplexTask = (taskText, preset = createStrictMemoryRuntimePreset()) => {
|
|
682
|
-
const text = String(taskText || "").trim();
|
|
683
|
-
if (!text) return false;
|
|
684
|
-
if (text.length >= preset.complexTaskTrigger.minTaskChars) return true;
|
|
685
|
-
return includesAny(text, preset.complexTaskTrigger.keywords);
|
|
686
|
-
};
|
|
687
|
-
var evaluateStrictMemoryExecution = (input, preset = createStrictMemoryRuntimePreset()) => {
|
|
688
|
-
const complex = isComplexTask(input.taskText, preset);
|
|
689
|
-
const shouldEnforce = preset.enabled && (complex || input.isMutation);
|
|
690
|
-
const requiredSteps = [];
|
|
691
|
-
const missingSteps = [];
|
|
692
|
-
const reasons = [];
|
|
693
|
-
if (!shouldEnforce) {
|
|
694
|
-
return { complex, shouldEnforce, allowed: true, requiredSteps, missingSteps, reasons };
|
|
695
|
-
}
|
|
696
|
-
if (preset.requireContextPackForComplex && complex) {
|
|
697
|
-
requiredSteps.push("context_pack_prepared");
|
|
698
|
-
if (!input.contextPackPrepared) {
|
|
699
|
-
missingSteps.push("context_pack_prepared");
|
|
700
|
-
reasons.push("Missing context pack for complex task.");
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
if (preset.requireSemanticRecallForComplex && complex) {
|
|
704
|
-
requiredSteps.push("semantic_recall_confirmed");
|
|
705
|
-
if (!input.semanticRecallConfirmed) {
|
|
706
|
-
missingSteps.push("semantic_recall_confirmed");
|
|
707
|
-
reasons.push("Missing semantic recall confirmation for complex task.");
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
if (preset.requireApprovalPreflightForMutations && input.isMutation) {
|
|
711
|
-
requiredSteps.push("approval_preflight_passed");
|
|
712
|
-
if (!input.approvalPreflightPassed) {
|
|
713
|
-
missingSteps.push("approval_preflight_passed");
|
|
714
|
-
reasons.push("Mutation preflight approval did not pass.");
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
return {
|
|
718
|
-
complex,
|
|
719
|
-
shouldEnforce,
|
|
720
|
-
allowed: missingSteps.length === 0,
|
|
721
|
-
requiredSteps,
|
|
722
|
-
missingSteps,
|
|
723
|
-
reasons
|
|
724
|
-
};
|
|
725
|
-
};
|
|
726
|
-
var upgradeToStrictMemoryRuntimePreset = (input = {}) => {
|
|
727
|
-
const current = createStrictMemoryRuntimePreset(input.current || {});
|
|
728
|
-
const targetMode = input.targetMode || current.upgradePolicy.mode || "observe";
|
|
729
|
-
const next = createStrictMemoryRuntimePreset({
|
|
730
|
-
...current,
|
|
731
|
-
upgradePolicy: {
|
|
732
|
-
...current.upgradePolicy,
|
|
733
|
-
mode: targetMode
|
|
734
|
-
}
|
|
735
|
-
});
|
|
736
|
-
const reasons = [];
|
|
737
|
-
const safeCfg = next.upgradePolicy.safeUpgrade;
|
|
738
|
-
if (safeCfg.backupBeforeEnable && !input.backupCreated) {
|
|
739
|
-
reasons.push("Backup not confirmed.");
|
|
740
|
-
}
|
|
741
|
-
if (safeCfg.requireHealthcheckPass && !input.healthcheckPassed) {
|
|
742
|
-
reasons.push("Healthcheck not confirmed.");
|
|
743
|
-
}
|
|
744
|
-
if (typeof input.recentBlockRate === "number" && input.recentBlockRate > safeCfg.rollbackOnBlockRateAbove && targetMode === "enforce") {
|
|
745
|
-
reasons.push("Recent block rate is too high for enforce mode; keep observe mode first.");
|
|
746
|
-
}
|
|
747
|
-
return {
|
|
748
|
-
next,
|
|
749
|
-
safe: reasons.length === 0,
|
|
750
|
-
reasons
|
|
751
|
-
};
|
|
752
|
-
};
|
|
753
|
-
|
|
754
249
|
// src/index.ts
|
|
755
250
|
var SdkUpdateRequiredError = class extends Error {
|
|
756
251
|
status;
|
|
@@ -867,7 +362,7 @@ var ReviewGate = class {
|
|
|
867
362
|
var DEFAULT_API_BASE = "https://api.vibeiao.com";
|
|
868
363
|
var DEFAULT_WEB_BASE = "https://vibeiao.com";
|
|
869
364
|
var DEFAULT_SDK_PACKAGE = "@vibeiao/sdk";
|
|
870
|
-
var DEFAULT_SDK_VERSION = "0.1.
|
|
365
|
+
var DEFAULT_SDK_VERSION = "0.1.36" ? "0.1.36" : "0.1.4";
|
|
871
366
|
var DEFAULT_SDK_REGISTRY = "https://registry.npmjs.org";
|
|
872
367
|
var DEFAULT_SDK_POLICY_PATH = "/v1/sdk/policy";
|
|
873
368
|
var DEFAULT_SDK_CHECK_INTERVAL_MS = 1e3 * 60 * 30;
|
|
@@ -1059,9 +554,9 @@ var unwrap = (response) => {
|
|
|
1059
554
|
return response.data;
|
|
1060
555
|
};
|
|
1061
556
|
var normalizeProviderName = (value) => value.trim().toLowerCase().replace(/[^a-z0-9_-]/g, "");
|
|
1062
|
-
var getByPath = (payload,
|
|
1063
|
-
if (!
|
|
1064
|
-
const segments =
|
|
557
|
+
var getByPath = (payload, path) => {
|
|
558
|
+
if (!path) return void 0;
|
|
559
|
+
const segments = path.split(".").map((part) => part.trim()).filter(Boolean);
|
|
1065
560
|
let current = payload;
|
|
1066
561
|
for (const segment of segments) {
|
|
1067
562
|
if (!current || typeof current !== "object" || !(segment in current)) {
|
|
@@ -1362,9 +857,9 @@ var VibeClient = class {
|
|
|
1362
857
|
};
|
|
1363
858
|
}
|
|
1364
859
|
}
|
|
1365
|
-
async get(
|
|
860
|
+
async get(path) {
|
|
1366
861
|
await this.ensureLatestVersion();
|
|
1367
|
-
const response = await this.fetcher(`${this.baseUrl}${
|
|
862
|
+
const response = await this.fetcher(`${this.baseUrl}${path}`);
|
|
1368
863
|
let payload = null;
|
|
1369
864
|
try {
|
|
1370
865
|
payload = await readJson(response);
|
|
@@ -1380,9 +875,9 @@ var VibeClient = class {
|
|
|
1380
875
|
}
|
|
1381
876
|
return payload;
|
|
1382
877
|
}
|
|
1383
|
-
async post(
|
|
878
|
+
async post(path, body) {
|
|
1384
879
|
await this.ensureLatestVersion();
|
|
1385
|
-
const response = await this.fetcher(`${this.baseUrl}${
|
|
880
|
+
const response = await this.fetcher(`${this.baseUrl}${path}`, {
|
|
1386
881
|
method: "POST",
|
|
1387
882
|
headers: { "Content-Type": "application/json" },
|
|
1388
883
|
body: JSON.stringify(body)
|
|
@@ -1402,9 +897,9 @@ var VibeClient = class {
|
|
|
1402
897
|
}
|
|
1403
898
|
return payload;
|
|
1404
899
|
}
|
|
1405
|
-
async del(
|
|
900
|
+
async del(path, body) {
|
|
1406
901
|
await this.ensureLatestVersion();
|
|
1407
|
-
const response = await this.fetcher(`${this.baseUrl}${
|
|
902
|
+
const response = await this.fetcher(`${this.baseUrl}${path}`, {
|
|
1408
903
|
method: "DELETE",
|
|
1409
904
|
headers: { "Content-Type": "application/json" },
|
|
1410
905
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
@@ -1984,8 +1479,6 @@ var getResourceSnapshot = async (options) => {
|
|
|
1984
1479
|
};
|
|
1985
1480
|
export {
|
|
1986
1481
|
CONTEXT_PACK_SECTION_ORDER,
|
|
1987
|
-
HUMAN_APP_LOOP_PHASES,
|
|
1988
|
-
HUMAN_APP_LOOP_SCHEMA,
|
|
1989
1482
|
LISTING_NAME_MAX_LENGTH,
|
|
1990
1483
|
LISTING_NAME_RECOMMENDED_MAX,
|
|
1991
1484
|
LISTING_TAGLINE_MAX_LENGTH,
|
|
@@ -2033,7 +1526,6 @@ export {
|
|
|
2033
1526
|
createCampaign,
|
|
2034
1527
|
createContextPack,
|
|
2035
1528
|
createDurabilityProxyClient,
|
|
2036
|
-
createHumanAppLoopSpec,
|
|
2037
1529
|
createInMemoryReflectionStore,
|
|
2038
1530
|
createSelfRelianceMonitor,
|
|
2039
1531
|
createSelfReliancePolicy,
|
|
@@ -2045,7 +1537,6 @@ export {
|
|
|
2045
1537
|
discoverMarketNeeds,
|
|
2046
1538
|
estimateContextPackTokens,
|
|
2047
1539
|
evaluateEscapeHatch,
|
|
2048
|
-
evaluateHumanAppTrial,
|
|
2049
1540
|
evaluateOutcomeBoundRun,
|
|
2050
1541
|
evaluateStrictMemoryExecution,
|
|
2051
1542
|
evaluateTopupRequest,
|
|
@@ -2065,7 +1556,6 @@ export {
|
|
|
2065
1556
|
runMarketDiscovery,
|
|
2066
1557
|
runReflectionCycle,
|
|
2067
1558
|
sanitizeListingNaming,
|
|
2068
|
-
scaffoldHumanAppLoopPack,
|
|
2069
1559
|
scoreListingForTask,
|
|
2070
1560
|
scoreReviewPriority,
|
|
2071
1561
|
treasuryStateFromSnapshot,
|