tryassay 0.21.1 → 0.22.0

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.
Files changed (37) hide show
  1. package/README.md +4 -4
  2. package/demo/.claude/.truth_last_prompt +1 -0
  3. package/demo/.claude/truth_status +1 -0
  4. package/demo/css/style.css +1181 -0
  5. package/demo/data/demo-events.json +103 -0
  6. package/demo/index.html +222 -0
  7. package/demo/js/chat.js +292 -0
  8. package/demo/js/code-panel.js +206 -0
  9. package/demo/js/demo-mode.js +107 -0
  10. package/demo/js/orb.js +634 -0
  11. package/demo/js/question-cards.js +207 -0
  12. package/demo/js/sse-client.js +473 -0
  13. package/demo/js/state.js +162 -0
  14. package/demo/js/timeline.js +394 -0
  15. package/demo/js/voice.js +154 -0
  16. package/dist/api/server.d.ts +1 -0
  17. package/dist/api/server.js +65 -2
  18. package/dist/api/server.js.map +1 -1
  19. package/dist/cli.js +13 -0
  20. package/dist/cli.js.map +1 -1
  21. package/dist/commands/demo.d.ts +5 -0
  22. package/dist/commands/demo.js +107 -0
  23. package/dist/commands/demo.js.map +1 -0
  24. package/dist/commands/runtime.d.ts +4 -0
  25. package/dist/commands/runtime.js +50 -3
  26. package/dist/commands/runtime.js.map +1 -1
  27. package/dist/runtime/agents/planner-agent.d.ts +5 -2
  28. package/dist/runtime/agents/planner-agent.js +232 -1
  29. package/dist/runtime/agents/planner-agent.js.map +1 -1
  30. package/dist/runtime/app-create-orchestrator.d.ts +4 -0
  31. package/dist/runtime/app-create-orchestrator.js +151 -48
  32. package/dist/runtime/app-create-orchestrator.js.map +1 -1
  33. package/dist/runtime/dashboard-sync.d.ts +25 -0
  34. package/dist/runtime/dashboard-sync.js +169 -0
  35. package/dist/runtime/dashboard-sync.js.map +1 -0
  36. package/dist/runtime/types.d.ts +28 -0
  37. package/package.json +3 -2
@@ -0,0 +1,169 @@
1
+ export class DashboardSync {
2
+ config;
3
+ sessionId = null;
4
+ pendingExperiences = [];
5
+ pendingAudit = [];
6
+ syncInProgress = false;
7
+ constructor(apiKey, baseUrl = 'https://tryassay.ai') {
8
+ this.config = {
9
+ apiKey,
10
+ baseUrl: baseUrl.replace(/\/$/, ''),
11
+ };
12
+ }
13
+ async sync(session) {
14
+ if (this.syncInProgress)
15
+ return;
16
+ this.syncInProgress = true;
17
+ try {
18
+ const body = {
19
+ session: {
20
+ id: this.sessionId,
21
+ name: session.name,
22
+ model: session.model,
23
+ status: session.status,
24
+ cwd: session.cwd,
25
+ total_cycles: session.totalCycles,
26
+ total_cost_cents: session.totalCostCents,
27
+ },
28
+ };
29
+ if (this.pendingExperiences.length > 0) {
30
+ body.experiences = [...this.pendingExperiences];
31
+ }
32
+ if (this.pendingAudit.length > 0) {
33
+ body.audit_entries = [...this.pendingAudit];
34
+ }
35
+ const response = await fetch(`${this.config.baseUrl}/api/v1/runtime/sync`, {
36
+ method: 'POST',
37
+ headers: {
38
+ 'Content-Type': 'application/json',
39
+ 'Authorization': `Bearer ${this.config.apiKey}`,
40
+ },
41
+ body: JSON.stringify(body),
42
+ });
43
+ if (!response.ok) {
44
+ const text = await response.text().catch(() => 'unknown error');
45
+ console.error(`[sync] Failed (${response.status}): ${text}`);
46
+ return;
47
+ }
48
+ const result = await response.json();
49
+ this.sessionId = result.session_id;
50
+ // Clear pending buffers only on success
51
+ this.pendingExperiences = [];
52
+ this.pendingAudit = [];
53
+ }
54
+ catch (err) {
55
+ // Network error — keep pending buffers for next sync
56
+ console.error(`[sync] Network error: ${err.message}`);
57
+ }
58
+ finally {
59
+ this.syncInProgress = false;
60
+ }
61
+ }
62
+ addExperience(experience) {
63
+ this.pendingExperiences.push({
64
+ id: experience.id,
65
+ domain: experience.domain,
66
+ outcome: experience.outcome,
67
+ lessons: experience.lessons,
68
+ tags: experience.tags,
69
+ observation_summary: experience.observation
70
+ ? `${experience.observation.source}: ${experience.observation.urgency}`
71
+ : '',
72
+ decision_confidence: experience.decision?.confidence,
73
+ plan_step_count: experience.plan?.steps?.length,
74
+ verification_passed: experience.verification?.passedClaims,
75
+ verification_total: experience.verification?.totalClaims,
76
+ raw: experience,
77
+ created_at: experience.timestamp,
78
+ });
79
+ }
80
+ addAuditEntry(entry) {
81
+ this.pendingAudit.push({
82
+ event_type: entry.eventType,
83
+ agent_name: entry.agentName,
84
+ details: entry.details,
85
+ prev_hash: entry.prevHash,
86
+ created_at: entry.timestamp,
87
+ });
88
+ }
89
+ async syncSafety(session, report) {
90
+ const body = {
91
+ session: {
92
+ id: this.sessionId,
93
+ name: session.name,
94
+ model: session.model,
95
+ status: session.status,
96
+ cwd: session.cwd,
97
+ total_cycles: session.totalCycles,
98
+ total_cost_cents: session.totalCostCents,
99
+ },
100
+ safety: {
101
+ overall_status: report.overall_status,
102
+ components_checked: report.layer2?.integrity?.components_checked ?? 0,
103
+ components_valid: report.layer2?.integrity?.components_valid ?? 0,
104
+ manifest_hash: '',
105
+ suspended_count: report.kill_switch?.suspended_count ?? 0,
106
+ recommendations: report.recommendations.slice(),
107
+ raw: report,
108
+ },
109
+ };
110
+ try {
111
+ await fetch(`${this.config.baseUrl}/api/v1/runtime/sync`, {
112
+ method: 'POST',
113
+ headers: {
114
+ 'Content-Type': 'application/json',
115
+ 'Authorization': `Bearer ${this.config.apiKey}`,
116
+ },
117
+ body: JSON.stringify(body),
118
+ });
119
+ }
120
+ catch (err) {
121
+ console.error(`[sync] Safety sync failed: ${err.message}`);
122
+ }
123
+ }
124
+ async syncTeam(session, result) {
125
+ const body = {
126
+ session: {
127
+ id: this.sessionId,
128
+ name: session.name,
129
+ model: session.model,
130
+ status: 'stopped',
131
+ cwd: session.cwd,
132
+ total_cycles: session.totalCycles,
133
+ total_cost_cents: session.totalCostCents,
134
+ },
135
+ team: {
136
+ goal: result.goalId,
137
+ status: result.status,
138
+ task_count: result.taskGraph ? result.taskGraph.tasks.length : 0,
139
+ completed_count: result.taskGraph
140
+ ? result.taskGraph.tasks.filter(t => t.status === 'completed').length
141
+ : 0,
142
+ failed_count: result.taskGraph
143
+ ? result.taskGraph.tasks.filter(t => t.status === 'failed').length
144
+ : 0,
145
+ handoffs_verified: result.artifacts?.length ?? 0,
146
+ agents: Array.from(new Set(result.auditTrail?.map((e) => e.agentName) ?? [])),
147
+ duration_ms: result.totalDurationMs,
148
+ task_graph: result.taskGraph,
149
+ },
150
+ };
151
+ try {
152
+ await fetch(`${this.config.baseUrl}/api/v1/runtime/sync`, {
153
+ method: 'POST',
154
+ headers: {
155
+ 'Content-Type': 'application/json',
156
+ 'Authorization': `Bearer ${this.config.apiKey}`,
157
+ },
158
+ body: JSON.stringify(body),
159
+ });
160
+ }
161
+ catch (err) {
162
+ console.error(`[sync] Team sync failed: ${err.message}`);
163
+ }
164
+ }
165
+ getSessionId() {
166
+ return this.sessionId;
167
+ }
168
+ }
169
+ //# sourceMappingURL=dashboard-sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard-sync.js","sourceRoot":"","sources":["../../src/runtime/dashboard-sync.ts"],"names":[],"mappings":"AAiBA,MAAM,OAAO,aAAa;IAChB,MAAM,CAAa;IACnB,SAAS,GAAkB,IAAI,CAAC;IAChC,kBAAkB,GAAmC,EAAE,CAAC;IACxD,YAAY,GAAmC,EAAE,CAAC;IAClD,cAAc,GAAG,KAAK,CAAC;IAE/B,YAAY,MAAc,EAAE,OAAO,GAAG,qBAAqB;QACzD,IAAI,CAAC,MAAM,GAAG;YACZ,MAAM;YACN,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;SACpC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC7B,IAAI,IAAI,CAAC,cAAc;YAAE,OAAO;QAChC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAE3B,IAAI,CAAC;YACH,MAAM,IAAI,GAA4B;gBACpC,OAAO,EAAE;oBACP,EAAE,EAAE,IAAI,CAAC,SAAS;oBAClB,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,KA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,WAAW,EAAE,MAAM,CAAC,eAAe;gBACnC,UAAU,EAAE,MAAM,CAAC,SAAS;aAC7B;SACF,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,sBAAsB,EAAE;gBACxD,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,eAAe,EAAE,UAAU,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;iBAChD;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;aAC3B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,4BAA6B,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
@@ -1367,6 +1367,17 @@ export type AppCreatePhase = {
1367
1367
  } | {
1368
1368
  readonly phase: 'plan_refining';
1369
1369
  readonly round: number;
1370
+ } | {
1371
+ readonly phase: 'plan_readiness';
1372
+ readonly confidence: number;
1373
+ readonly gaps: readonly string[];
1374
+ readonly summary: string;
1375
+ readonly ready: boolean;
1376
+ } | {
1377
+ readonly phase: 'chat_message';
1378
+ readonly message: string;
1379
+ readonly cards?: readonly PlanQuestion[];
1380
+ readonly readiness: ReadinessEvaluation;
1370
1381
  } | {
1371
1382
  readonly phase: 'awaiting_approval';
1372
1383
  readonly planSummary: PlanSummary;
@@ -1544,6 +1555,23 @@ export interface PlanRefinementRound {
1544
1555
  answers: PlanAnswer[];
1545
1556
  confidence: number;
1546
1557
  }
1558
+ export interface ReadinessEvaluation {
1559
+ readonly confidence: number;
1560
+ readonly ready: boolean;
1561
+ readonly gaps: readonly string[];
1562
+ readonly summary: string;
1563
+ }
1564
+ export interface ChatMessage {
1565
+ readonly role: 'user' | 'architect';
1566
+ readonly content: string;
1567
+ readonly cards?: readonly PlanQuestion[];
1568
+ readonly cardAnswers?: readonly PlanAnswer[];
1569
+ }
1570
+ export interface ChatResponse {
1571
+ readonly message: string;
1572
+ readonly cards?: readonly PlanQuestion[];
1573
+ readonly readiness: ReadinessEvaluation;
1574
+ }
1547
1575
  export interface PlanModeState {
1548
1576
  rounds: PlanRefinementRound[];
1549
1577
  currentConfidence: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tryassay",
3
- "version": "0.21.1",
3
+ "version": "0.22.0",
4
4
  "description": "AI code verification CLI — find bugs that tests miss, linters ignore, and code review overlooks",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,6 +24,7 @@
24
24
  },
25
25
  "files": [
26
26
  "dist/",
27
+ "demo/",
27
28
  "README.md",
28
29
  "LICENSE"
29
30
  ],
@@ -39,7 +40,7 @@
39
40
  "verification",
40
41
  "hallucination",
41
42
  "code-quality",
42
- "formal-verification",
43
+ "claim-verification",
43
44
  "cli"
44
45
  ],
45
46
  "dependencies": {