@epochtm/sdk 0.1.4

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,1052 @@
1
+ export interface EpochConfig {
2
+ apiKey: string;
3
+ baseUrl?: string;
4
+ }
5
+ export interface MemoryContractInput {
6
+ goal?: string;
7
+ constraints?: string[];
8
+ decisions?: string[];
9
+ open_risks?: string[];
10
+ next_actions?: string[];
11
+ }
12
+ export interface MemoryItem {
13
+ id: string;
14
+ content?: string;
15
+ memory?: string;
16
+ memoryType?: string;
17
+ contractCategory?: string;
18
+ finalScore: number;
19
+ updatedAt?: string;
20
+ metadata?: Record<string, unknown>;
21
+ }
22
+ export interface BeforeModelInput {
23
+ userId: string;
24
+ question: string;
25
+ task?: string;
26
+ task_intent?: string;
27
+ agent_id?: string;
28
+ workspace_id?: string;
29
+ repo_or_task?: string;
30
+ risk_level?: string;
31
+ available_tools?: string[];
32
+ workspace?: string;
33
+ project?: string;
34
+ threadId?: string;
35
+ mode?: "retrieve" | "resume";
36
+ topK?: number;
37
+ includeArchived?: boolean;
38
+ related_reasoning_ids?: string[];
39
+ reasoning_context?: {
40
+ reasoning_id: string;
41
+ task: string;
42
+ source_type: string;
43
+ source_ref: string;
44
+ reasoning_quality?: {
45
+ status: string;
46
+ score: number;
47
+ };
48
+ linked_experiences?: Array<{
49
+ task: string;
50
+ source_ref: string;
51
+ }>;
52
+ recommended_first_action?: string;
53
+ };
54
+ }
55
+ export interface BeforeModelResult {
56
+ contextText: string;
57
+ memories: MemoryItem[];
58
+ source: "retrieve" | "resume";
59
+ traceId?: string;
60
+ workspace_id?: string;
61
+ agent_id?: string;
62
+ task_intent?: string;
63
+ relevant_memories: MemoryIgnitionMemory[];
64
+ executable_skills: MemoryIgnitionExecutableSkill[];
65
+ past_mistakes: MemoryIgnitionMemory[];
66
+ risky_files: string[];
67
+ required_tests: string[];
68
+ forbidden_actions: string[];
69
+ approval_rules: MemoryIgnitionApprovalRules;
70
+ recommended_first_action: string | null;
71
+ trace_proof: MemoryIgnitionTraceProof[];
72
+ outcome_hooks: string[];
73
+ brief_proof_quality: MemoryIgnitionBriefProofQuality;
74
+ evaluation_gate: MemoryIgnitionEvaluationGate;
75
+ task_understanding: MemoryIgnitionTaskUnderstanding;
76
+ target_agent: MemoryIgnitionTargetAgent;
77
+ inheritance_sections: MemoryIgnitionInheritanceSections;
78
+ past_failure_retrieval: MemoryIgnitionPastFailureRetrieval[];
79
+ risky_file_retrieval: MemoryIgnitionRiskyFileRetrieval[];
80
+ required_test_retrieval: MemoryIgnitionRequiredTestRetrieval[];
81
+ approval_rule_retrieval: MemoryIgnitionApprovalRuleRetrieval[];
82
+ skill_inheritance_proofs: MemoryIgnitionSkillInheritanceProof[];
83
+ three_things: MemoryIgnitionThreeThings;
84
+ ready_to_send_prompt: string;
85
+ inheritance_ranking: MemoryIgnitionRankedInheritanceItem[];
86
+ brief_quality_engine: MemoryIgnitionBriefQualityEngine;
87
+ copy_to_agent: MemoryIgnitionCopyToAgent;
88
+ related_experiences: MemoryIgnitionRelatedExperience[];
89
+ experience_promotion_proofs: MemoryIgnitionExperiencePromotionProof[];
90
+ experience_quality_gate: MemoryIgnitionExperienceQualityGate;
91
+ memory_inheritance_readiness: MemoryInheritanceReadinessSummary;
92
+ inheritance_gate: MemoryIgnitionInheritanceGate;
93
+ inherited_memories: MemoryIgnitionGatedMemory[];
94
+ review_memories: MemoryIgnitionGatedMemory[];
95
+ blocked_memories: MemoryIgnitionGatedMemory[];
96
+ skill_gate: MemoryIgnitionSkillSelectionGate;
97
+ executable_skill_records: MemoryIgnitionGatedSkill[];
98
+ review_skills: MemoryIgnitionGatedSkill[];
99
+ blocked_skills: MemoryIgnitionGatedSkill[];
100
+ standard_inheritance_package: MemoryIgnitionStandardInheritancePackage;
101
+ }
102
+ export type InheritanceReadinessStatus = "ready" | "review" | "blocked";
103
+ export interface MemoryInheritanceReadinessStep {
104
+ id: "source" | "memory" | "evidence" | "contract" | "freshness" | "conflict" | "graph" | "brief";
105
+ label: string;
106
+ ok: boolean;
107
+ detail: string;
108
+ }
109
+ export interface MemoryInheritanceReadiness {
110
+ memoryId: string;
111
+ sourceRef: string | null;
112
+ status: InheritanceReadinessStatus;
113
+ readyCount: number;
114
+ totalCount: number;
115
+ readyRatio: number;
116
+ nextAction: string;
117
+ steps: MemoryInheritanceReadinessStep[];
118
+ }
119
+ export interface MemoryInheritanceReadinessSummary {
120
+ version: "inheritance_readiness.v1";
121
+ total: number;
122
+ ready: number;
123
+ review: number;
124
+ blocked: number;
125
+ readyRatio: number;
126
+ status: InheritanceReadinessStatus;
127
+ nextActions: string[];
128
+ memories: MemoryInheritanceReadiness[];
129
+ }
130
+ export interface MemoryIgnitionGatedMemory {
131
+ memory: MemoryIgnitionMemory;
132
+ readiness: MemoryInheritanceReadiness;
133
+ reason: string;
134
+ }
135
+ export interface MemoryIgnitionInheritanceGate {
136
+ version: "phase5.inheritance_gate.v1";
137
+ status: "open" | "review_required" | "blocked";
138
+ can_inherit: boolean;
139
+ inherited_count: number;
140
+ review_count: number;
141
+ blocked_count: number;
142
+ withheld_count: number;
143
+ policy: "ready_and_review_only";
144
+ next_actions: string[];
145
+ }
146
+ export type MemoryIgnitionSkillGateStatus = "executable" | "review" | "blocked";
147
+ export interface MemoryIgnitionSkillGateCheck {
148
+ id: "approval" | "agent_compatibility" | "evidence" | "confidence" | "steps" | "freshness";
149
+ label: string;
150
+ ok: boolean;
151
+ detail: string;
152
+ }
153
+ export interface MemoryIgnitionGatedSkill {
154
+ skill: MemoryIgnitionExecutableSkill;
155
+ status: MemoryIgnitionSkillGateStatus;
156
+ reason: string;
157
+ checks: MemoryIgnitionSkillGateCheck[];
158
+ }
159
+ export interface MemoryIgnitionSkillSelectionGate {
160
+ version: "phase5.skill_gate.v1";
161
+ status: "open" | "review_required" | "blocked";
162
+ can_execute_skills: boolean;
163
+ executable_count: number;
164
+ review_count: number;
165
+ blocked_count: number;
166
+ withheld_count: number;
167
+ policy: "approved_compatible_source_backed_only";
168
+ next_actions: string[];
169
+ }
170
+ export interface MemoryIgnitionStandardInheritancePackage {
171
+ version: "standard_inheritance_package.v1";
172
+ generated_at: string;
173
+ workspace_id: string | null;
174
+ agent_id: string | null;
175
+ delivery: "api" | "sdk" | "mcp" | "copy_prompt";
176
+ task: {
177
+ task: string;
178
+ intent: string;
179
+ risk_level: string;
180
+ target_agent: string;
181
+ source_mode: "retrieve" | "resume";
182
+ };
183
+ context: {
184
+ recommended_first_action: string | null;
185
+ relevant_memory_count: number;
186
+ related_experience_count: number;
187
+ executable_skill_count: number;
188
+ };
189
+ memories: Array<{
190
+ id: string;
191
+ summary: string;
192
+ source_ref: string | null;
193
+ contract_category?: string;
194
+ confidence: number;
195
+ files: string[];
196
+ }>;
197
+ review_memories: Array<{
198
+ id: string;
199
+ summary: string;
200
+ source_ref: string | null;
201
+ reason: string;
202
+ }>;
203
+ withheld_memories: Array<{
204
+ id: string;
205
+ source_ref: string | null;
206
+ status: "ready" | "review" | "blocked";
207
+ reason: string;
208
+ failed_steps: Array<{
209
+ id: string;
210
+ label: string;
211
+ detail: string;
212
+ }>;
213
+ }>;
214
+ experiences: MemoryIgnitionRelatedExperience[];
215
+ executable_skills: MemoryIgnitionExecutableSkill[];
216
+ review_skills: Array<{
217
+ id: string;
218
+ name: string;
219
+ reason: string;
220
+ }>;
221
+ withheld_skills: Array<{
222
+ id: string;
223
+ reason: string;
224
+ }>;
225
+ risk_rules: {
226
+ risky_files: string[];
227
+ forbidden_actions: string[];
228
+ risk_signals: string[];
229
+ };
230
+ approval_rules: MemoryIgnitionApprovalRules;
231
+ required_tests: string[];
232
+ trace_proof: MemoryIgnitionTraceProof[];
233
+ gates: {
234
+ memory: MemoryIgnitionInheritanceGate;
235
+ skill: MemoryIgnitionSkillSelectionGate;
236
+ proof: MemoryIgnitionEvaluationGate;
237
+ };
238
+ outcome_contract: MemoryIgnitionOutcomeContract;
239
+ outcome: {
240
+ hooks: string[];
241
+ save_required: boolean;
242
+ contract: MemoryIgnitionOutcomeContract;
243
+ };
244
+ }
245
+ export interface MemoryIgnitionOutcomeContract {
246
+ version: "outcome_contract.v1";
247
+ required: boolean;
248
+ required_after: "agent_action";
249
+ endpoint: "/api/memory/memoryignition/outcome";
250
+ sdk_method: "memoryos.saveOutcome";
251
+ mcp_tool: "memoryignition_save_outcome";
252
+ required_fields: Array<"outcome_status" | "files_touched" | "tests_passed" | "tests_failed" | "what_worked" | "what_failed" | "future_agent_lesson">;
253
+ optional_fields: Array<"used_skill_ids" | "risky_files_touched" | "approvals_used" | "trace_proof_ids">;
254
+ hooks: string[];
255
+ trace_lineage: "Inheritance Event -> Outcome -> Experience -> Future MemoryIgnition Brief";
256
+ enforcement: "required_for_outcome_learning";
257
+ }
258
+ export interface MemoryIgnitionMemory {
259
+ id: string;
260
+ content: string;
261
+ summary?: string;
262
+ memory_type?: string;
263
+ contract_category?: string;
264
+ final_score: number;
265
+ updated_at?: string;
266
+ source_ref: string | null;
267
+ files: string[];
268
+ reason_tags: string[];
269
+ freshness?: {
270
+ status?: string | null;
271
+ };
272
+ conflict?: {
273
+ status?: string | null;
274
+ };
275
+ }
276
+ export interface MemoryIgnitionExecutableSkill {
277
+ id: string;
278
+ name: string;
279
+ trigger: string;
280
+ steps: string[];
281
+ required_tests: string[];
282
+ past_mistakes: string[];
283
+ tools_allowed: string[];
284
+ forbidden_actions: string[];
285
+ approval_required: boolean;
286
+ risk_level: string;
287
+ evidence: string[];
288
+ confidence: number;
289
+ success_rate: number | null;
290
+ supported_agent_types: string[];
291
+ inheritance_rules: string[];
292
+ status: "approved";
293
+ version: string;
294
+ source_experience_id: string;
295
+ source_ref: string | null;
296
+ }
297
+ export interface MemoryIgnitionApprovalRules {
298
+ risk_level: string;
299
+ derived_risk_level: string;
300
+ approval_required: boolean;
301
+ reason: string;
302
+ allowed_tools: string[];
303
+ risk_signals: string[];
304
+ }
305
+ export interface MemoryIgnitionTraceProof {
306
+ memory_id: string;
307
+ source_type: string;
308
+ source_ref: string | null;
309
+ memory_type?: string;
310
+ contract_category?: string;
311
+ confidence: number;
312
+ retrieved_at: string;
313
+ reason_tags: string[];
314
+ files: string[];
315
+ }
316
+ export interface MemoryIgnitionBriefProofQuality {
317
+ score: number;
318
+ grade: "A" | "B" | "C" | "D";
319
+ status: "trusted" | "caution" | "weak" | "blocked";
320
+ trusted: boolean;
321
+ checks: Array<{
322
+ id: string;
323
+ label: string;
324
+ ok: boolean;
325
+ weight: number;
326
+ detail: string;
327
+ }>;
328
+ missing_requirements: string[];
329
+ recommendations: string[];
330
+ }
331
+ export interface MemoryIgnitionEvaluationGate {
332
+ status: "trusted" | "caution" | "weak" | "blocked";
333
+ can_inherit: boolean;
334
+ can_execute: boolean;
335
+ requires_human_review: boolean;
336
+ reason: string;
337
+ blockers: string[];
338
+ warnings: string[];
339
+ next_required_actions: string[];
340
+ }
341
+ export interface MemoryIgnitionTaskUnderstanding {
342
+ task: string;
343
+ task_intent: string;
344
+ target_agent: string;
345
+ source_mode: "retrieve" | "resume";
346
+ risk_level: string;
347
+ available_tools: string[];
348
+ }
349
+ export interface MemoryIgnitionTargetAgent {
350
+ id: string;
351
+ supported: boolean;
352
+ delivery: "api" | "sdk" | "mcp" | "copy_prompt";
353
+ }
354
+ export interface MemoryIgnitionInheritanceSections {
355
+ relevant_memory_count: number;
356
+ past_failure_count: number;
357
+ risky_file_count: number;
358
+ required_test_count: number;
359
+ approval_rule_count: number;
360
+ trace_proof_count: number;
361
+ approved_skill_count: number;
362
+ outcome_hook_count: number;
363
+ }
364
+ export interface MemoryIgnitionPastFailureRetrieval {
365
+ memory_id: string;
366
+ summary: string;
367
+ source_ref: string | null;
368
+ confidence: number;
369
+ files: string[];
370
+ reason: string;
371
+ }
372
+ export interface MemoryIgnitionRiskyFileRetrieval {
373
+ file: string;
374
+ source_memory_ids: string[];
375
+ approval_required: boolean;
376
+ reason: string;
377
+ }
378
+ export interface MemoryIgnitionRequiredTestRetrieval {
379
+ command: string;
380
+ source: "memory" | "approved_skill";
381
+ source_ids: string[];
382
+ reason: string;
383
+ }
384
+ export interface MemoryIgnitionApprovalRuleRetrieval {
385
+ risk_level: string;
386
+ approval_required: boolean;
387
+ reason: string;
388
+ risk_signals: string[];
389
+ allowed_tools: string[];
390
+ }
391
+ export interface MemoryIgnitionSkillInheritanceProof {
392
+ skill_id: string;
393
+ skill_name: string;
394
+ version: string;
395
+ approval_status: "approved";
396
+ source_experience_id: string;
397
+ source_ref: string | null;
398
+ evidence: string[];
399
+ required_tests: string[];
400
+ inheritance_rules: string[];
401
+ supported_agent_types: string[];
402
+ confidence: number;
403
+ success_rate: number | null;
404
+ lineage: "Experience -> Skill -> Approval -> MemoryIgnition Brief";
405
+ }
406
+ export type MemoryIgnitionRankedInheritanceKind = "memory" | "past_failure" | "risky_file" | "required_test" | "approval_rule" | "approved_skill";
407
+ export interface MemoryIgnitionRankedInheritanceItem {
408
+ id: string;
409
+ kind: MemoryIgnitionRankedInheritanceKind;
410
+ title: string;
411
+ source_ref: string | null;
412
+ score: number;
413
+ confidence: number;
414
+ proof_complete: boolean;
415
+ freshness: "fresh" | "aging" | "stale" | "unknown";
416
+ why_selected: string[];
417
+ agent_instruction: string;
418
+ source_ids: string[];
419
+ files: string[];
420
+ }
421
+ export interface MemoryIgnitionBriefQualityEngine {
422
+ version: "phase3.v1";
423
+ generated_at: string;
424
+ readiness: "trusted" | "review_required" | "blocked";
425
+ task_relevance_score: number;
426
+ proof_coverage: number;
427
+ top_reasons: string[];
428
+ missing_core_sections: string[];
429
+ ranking_policy: string;
430
+ }
431
+ export interface MemoryIgnitionCopyToAgent {
432
+ target_agent: string;
433
+ delivery: "api" | "sdk" | "mcp" | "copy_prompt";
434
+ prompt: string;
435
+ outcome_required: boolean;
436
+ setup_hint: string;
437
+ }
438
+ export interface MemoryIgnitionThreeThings {
439
+ version: "memoryignition_three_things.v1";
440
+ what_agent_needs_to_know: string[];
441
+ what_agent_must_be_careful_about: string[];
442
+ what_agent_should_do_next: string[];
443
+ readiness_summary: string;
444
+ }
445
+ export interface MemoryIgnitionRelatedExperience {
446
+ experience_id: string;
447
+ task: string;
448
+ problem: string | null;
449
+ context: string | null;
450
+ action: string | null;
451
+ mistake: string | null;
452
+ outcome: string | null;
453
+ lesson: string | null;
454
+ future_agent_instruction: string | null;
455
+ evidence: string[];
456
+ files: string[];
457
+ tests: string[];
458
+ risk_level: string | null;
459
+ source_ref: string | null;
460
+ confidence: number;
461
+ quality_status: "ready_for_inheritance" | "needs_evidence" | "stale" | "conflicting";
462
+ why_selected: string[];
463
+ trace_lineage: "Source -> Outcome -> Experience -> Next MemoryIgnition Brief";
464
+ }
465
+ export interface MemoryIgnitionExperiencePromotionProof {
466
+ version: "memoryignition_experience_promotion.v1";
467
+ promoted: boolean;
468
+ experience_record_id: string | null;
469
+ source_outcome_event_id: string | null;
470
+ source_send_event_id: string | null;
471
+ source_ref: string | null;
472
+ lineage: "Outcome Proof -> Experience Record -> MemoryIgnition Brief";
473
+ evidence: string[];
474
+ missing_evidence: string[];
475
+ future_agent_instruction: string | null;
476
+ next_brief_query: string;
477
+ }
478
+ export interface MemoryIgnitionExperienceQualityGate {
479
+ version: "phase5.v1";
480
+ total_related_experiences: number;
481
+ ready_for_inheritance: number;
482
+ needs_evidence: number;
483
+ stale: number;
484
+ conflicting: number;
485
+ selected_experience_ids: string[];
486
+ next_actions: string[];
487
+ }
488
+ export interface AfterModelInput {
489
+ userId: string;
490
+ message?: string;
491
+ threadId?: string;
492
+ modelResponse?: string;
493
+ workspace_id?: string;
494
+ agent_id?: string;
495
+ repo_or_task?: string;
496
+ task_intent?: string;
497
+ outcome?: string;
498
+ outcome_status?: string;
499
+ files_touched?: string[];
500
+ tests_passed?: string[];
501
+ tests_failed?: string[];
502
+ what_worked?: string;
503
+ what_failed?: string;
504
+ future_agent_lesson?: string;
505
+ tool_calls?: string[];
506
+ used_skill_ids?: string[];
507
+ skill_ids?: string[];
508
+ approvals_used?: string[];
509
+ risky_files_touched?: string[];
510
+ trace_proof_ids?: string[];
511
+ relatedReasoningIds?: string[];
512
+ send_event_id?: string;
513
+ target_agent?: string;
514
+ target_format?: string;
515
+ risk_level?: string;
516
+ contract?: MemoryContractInput;
517
+ enforceContract?: boolean;
518
+ }
519
+ export interface AfterModelResult {
520
+ acceptedCount: number;
521
+ rejectedCount: number;
522
+ contractFieldCount?: number;
523
+ traceId?: string;
524
+ governanceApplied?: GovernancePolicyApplied;
525
+ outcome_recorded?: boolean;
526
+ experience_draft?: {
527
+ problem: string | null;
528
+ context: string | null;
529
+ action: string | null;
530
+ mistake: string | null;
531
+ outcome: string | null;
532
+ lesson: string | null;
533
+ status: "draft";
534
+ };
535
+ experience_timeline?: Array<{
536
+ step: "outcome_captured" | "action_memory" | "execution_outcome" | "experience_record" | "skill_outcome";
537
+ status: "recorded" | "skipped";
538
+ detail: string;
539
+ ref?: string;
540
+ recorded_at: string;
541
+ }>;
542
+ trace_proof?: Array<{
543
+ accepted_memory_id?: string;
544
+ action_memory_id?: string;
545
+ execution_outcome_id?: string;
546
+ experience_record_id?: string;
547
+ skill_id?: string;
548
+ source_type: "after_model" | "action_memory" | "execution_outcome" | "experience_record" | "skill_outcome";
549
+ source_ref: string;
550
+ recorded_at: string;
551
+ }>;
552
+ action_memory_id?: string;
553
+ execution_outcome_id?: string;
554
+ experience_record_id?: string;
555
+ skill_outcomes?: Array<{
556
+ skill_id: string;
557
+ status: string;
558
+ confidence: number;
559
+ success_rate: number | null;
560
+ }>;
561
+ outcome_proof: {
562
+ version: "memoryignition_outcome_proof.v1";
563
+ outcome_event_id: string;
564
+ send_event_id: string | null;
565
+ target_agent: string | null;
566
+ target_format: string | null;
567
+ source_ref: string;
568
+ lineage: "Send Now -> Agent Work -> Outcome -> Experience -> Future-Agent Inheritance";
569
+ outcome_recorded: boolean;
570
+ future_inheritance_ready: boolean;
571
+ memory_updated: boolean;
572
+ experience_updated: boolean;
573
+ skill_confidence_updated: boolean;
574
+ approvals_used: string[];
575
+ evidence: string[];
576
+ missing_evidence: string[];
577
+ next_brief_query: string;
578
+ };
579
+ approval_outcome_links?: Array<{
580
+ approval_id: string;
581
+ status: "pending" | "approved" | "rejected";
582
+ outcome_links: MemoryIgnitionApprovalOutcomeLink[];
583
+ }>;
584
+ experience_promotion: MemoryIgnitionExperiencePromotionProof;
585
+ outcome_learning: {
586
+ version: "phase4.v1";
587
+ status: "recorded" | "partial" | "skipped";
588
+ future_inheritance_ready: boolean;
589
+ experience_record_id: string | null;
590
+ lesson_stored: string | null;
591
+ future_agent_instruction: string | null;
592
+ next_brief_query: string;
593
+ trace_complete: boolean;
594
+ learning_signals: string[];
595
+ missing_signals: string[];
596
+ };
597
+ outcome_learning_gate: MemoryIgnitionOutcomeLearningGate;
598
+ }
599
+ export interface MemoryIgnitionOutcomeLearningGateCheck {
600
+ id: "outcome" | "action_memory" | "execution_outcome" | "experience" | "lesson" | "files" | "tests" | "skill_outcome" | "approval";
601
+ label: string;
602
+ ok: boolean;
603
+ required: boolean;
604
+ detail: string;
605
+ }
606
+ export interface MemoryIgnitionOutcomeLearningGate {
607
+ version: "phase4.outcome_gate.v1";
608
+ status: "ready" | "partial" | "blocked";
609
+ future_inheritance_ready: boolean;
610
+ can_update_memory: boolean;
611
+ can_update_experience: boolean;
612
+ can_update_skill_confidence: boolean;
613
+ score: number;
614
+ checks: MemoryIgnitionOutcomeLearningGateCheck[];
615
+ promoted_signals: string[];
616
+ blocked_updates: string[];
617
+ next_actions: string[];
618
+ }
619
+ export interface RetrieveResult {
620
+ memories: MemoryItem[];
621
+ }
622
+ export interface ProcessMemoryResult {
623
+ traceId?: string;
624
+ acceptedMemories: MemoryItem[];
625
+ rejectedMemories: MemoryItem[];
626
+ contract?: MemoryContractInput | null;
627
+ contractFieldCount?: number;
628
+ governance?: GovernancePolicyApplied;
629
+ }
630
+ export interface GovernancePolicyApplied {
631
+ ttlHours: number;
632
+ pinCriticalDecisions: boolean;
633
+ redactSecrets: boolean;
634
+ mode: "balanced" | "strict" | "enterprise";
635
+ }
636
+ export interface ResumeInput {
637
+ userId: string;
638
+ project: string;
639
+ question: string;
640
+ workspace?: string;
641
+ threadId?: string;
642
+ topK?: number;
643
+ includeArchived?: boolean;
644
+ }
645
+ export interface ResumeResult {
646
+ summary: string;
647
+ lastKnownState: string;
648
+ openLoops: string[];
649
+ recommendedNextStep: string;
650
+ usedMemories: MemoryItem[];
651
+ }
652
+ export interface HandoffInput {
653
+ userId: string;
654
+ project: string;
655
+ question: string;
656
+ workspace?: string;
657
+ threadId?: string;
658
+ topK?: number;
659
+ includeArchived?: boolean;
660
+ }
661
+ export interface HandoffResult {
662
+ handoffTitle: string;
663
+ summary: string;
664
+ lastKnownState: string;
665
+ nextRecommendedAction: string;
666
+ openLoops: string[];
667
+ keyDecisions: string[];
668
+ risks: string[];
669
+ usedMemories: MemoryItem[];
670
+ }
671
+ export type MemoryIgnitionBriefInput = Omit<BeforeModelInput, "userId" | "question"> & {
672
+ userId?: string;
673
+ question?: string;
674
+ };
675
+ export type MemoryIgnitionSendNowTargetFormat = "human_prompt" | "agent_prompt" | "codex_prompt" | "cursor_prompt" | "claude_prompt" | "devin_task" | "mcp_response" | "api_json" | "cli_output" | "custom_json";
676
+ export type MemoryIgnitionSendNowInput = MemoryIgnitionBriefInput & {
677
+ target_agent?: string;
678
+ target_format?: MemoryIgnitionSendNowTargetFormat;
679
+ safety_mode?: "fast" | "balanced" | "strict";
680
+ };
681
+ export interface MemoryIgnitionSendNowResult {
682
+ version: "memoryignition_send_now.v1";
683
+ send_event_id: string;
684
+ sent_at: string;
685
+ target_agent: string;
686
+ target_format: MemoryIgnitionSendNowTargetFormat;
687
+ target_format_label: string;
688
+ safety_mode: "fast" | "balanced" | "strict";
689
+ delivery: "api" | "sdk" | "mcp" | "copy_prompt";
690
+ outcome_required: boolean;
691
+ preview: string;
692
+ payload: string;
693
+ json_package: {
694
+ target_agent: string;
695
+ target_format: MemoryIgnitionSendNowTargetFormat;
696
+ safety_mode: "fast" | "balanced" | "strict";
697
+ three_things: MemoryIgnitionThreeThings;
698
+ standard_inheritance_package: MemoryIgnitionStandardInheritancePackage;
699
+ outcome_contract: MemoryIgnitionOutcomeContract;
700
+ reasoning_context?: {
701
+ reasoning_id: string;
702
+ task: string;
703
+ source_type: string;
704
+ source_ref: string;
705
+ reasoning_quality?: {
706
+ status: string;
707
+ score: number;
708
+ };
709
+ linked_experiences?: Array<{
710
+ task: string;
711
+ source_ref: string;
712
+ }>;
713
+ recommended_first_action?: string;
714
+ } | null;
715
+ };
716
+ standard_inheritance_package: MemoryIgnitionStandardInheritancePackage;
717
+ three_things: MemoryIgnitionThreeThings;
718
+ readiness: {
719
+ score: number;
720
+ status: MemoryIgnitionEvaluationGate["status"];
721
+ can_execute: boolean;
722
+ approval_required: boolean;
723
+ risk_level: string;
724
+ };
725
+ next: string;
726
+ brief: BeforeModelResult;
727
+ }
728
+ export type MemoryIgnitionActionInput = MemoryIgnitionBriefInput & {
729
+ current_files?: string[];
730
+ proposed_action?: string;
731
+ action?: string;
732
+ tool_name?: string;
733
+ command?: string;
734
+ };
735
+ export type MemoryIgnitionRiskCheckInput = MemoryIgnitionActionInput;
736
+ export interface MemoryIgnitionApprovalOutcomeLink {
737
+ outcomeEventId: string;
738
+ sourceRef: string;
739
+ sendEventId: string | null;
740
+ targetAgent: string | null;
741
+ targetFormat: string | null;
742
+ futureInheritanceReady: boolean;
743
+ evidence: string[];
744
+ linkedAt: string;
745
+ }
746
+ export interface MemoryIgnitionApprovalRequest {
747
+ id: string;
748
+ userId: string;
749
+ orgId?: string | null;
750
+ source: "memoryignition_guard";
751
+ runtimeEventId: string;
752
+ guardMoment: "before_agent" | "before_action" | "during_action" | "risk_check";
753
+ action: string;
754
+ status: "pending" | "approved" | "rejected";
755
+ riskLevel: string;
756
+ reason: string;
757
+ approvalRequired: boolean;
758
+ blocked: boolean;
759
+ matchedRiskyFiles: string[];
760
+ matchedForbiddenActions: string[];
761
+ missingRequiredTests: string[];
762
+ nextRequiredActions: string[];
763
+ traceProofIds: string[];
764
+ guardProof: Record<string, unknown>;
765
+ outcomeLinks: MemoryIgnitionApprovalOutcomeLink[];
766
+ createdAt: string;
767
+ updatedAt: string;
768
+ reviewedAt: string | null;
769
+ reviewedBy: string | null;
770
+ reviewNote: string | null;
771
+ }
772
+ export interface MemoryIgnitionActionGuard {
773
+ action: string;
774
+ allowed: boolean;
775
+ blocked: boolean;
776
+ approval_required: boolean;
777
+ approval_satisfied?: boolean;
778
+ risk_level: string;
779
+ gate_status: string;
780
+ reason: string;
781
+ risky_files: string[];
782
+ required_tests: string[];
783
+ forbidden_actions: string[];
784
+ recommended_first_action: string | null;
785
+ next_required_actions: string[];
786
+ matched_risky_files: string[];
787
+ matched_forbidden_actions: string[];
788
+ missing_required_tests: string[];
789
+ approval_request?: MemoryIgnitionApprovalRequest | null;
790
+ runtime_policy?: MemoryIgnitionRuntimePolicy;
791
+ guard_proof: {
792
+ version: "memoryignition_guard_proof.v1";
793
+ status: "allowed" | "approval_required" | "blocked";
794
+ moment: "before_agent" | "before_action" | "during_action" | "risk_check";
795
+ action: string;
796
+ allowed: boolean;
797
+ blocked: boolean;
798
+ approval_required: boolean;
799
+ reason: string;
800
+ checks: Array<{
801
+ id: "brief_gate" | "tool_permission" | "risky_files" | "forbidden_actions" | "approval" | "required_tests" | "trace_proof";
802
+ label: string;
803
+ ok: boolean;
804
+ detail: string;
805
+ }>;
806
+ matched_risky_files: string[];
807
+ matched_forbidden_actions: string[];
808
+ missing_required_tests: string[];
809
+ runtime_policy?: MemoryIgnitionRuntimePolicy;
810
+ governance_decision?: MemoryIgnitionGuardianGovernanceDecision;
811
+ trace_proof_ids: string[];
812
+ next_required_actions: string[];
813
+ };
814
+ }
815
+ export interface MemoryIgnitionGuardianGovernanceDecision {
816
+ version: "memoryignition_guardian_governance_decision.v1";
817
+ status: "allowed" | "approval_required" | "blocked";
818
+ allowed: boolean;
819
+ blocked: boolean;
820
+ approval_required: boolean;
821
+ approval_sources: string[];
822
+ blocking_sources: string[];
823
+ runtime_policy_id: string;
824
+ runtime_policy_source?: "request" | "agent_policy" | "risk_policy" | "workspace_default";
825
+ approval_policy_id?: string | null;
826
+ denied_tools: string[];
827
+ matched_risky_files: string[];
828
+ matched_forbidden_actions: string[];
829
+ missing_required_tests: string[];
830
+ reason: string;
831
+ next_required_actions: string[];
832
+ }
833
+ export interface MemoryIgnitionRuntimePolicy {
834
+ version: "memoryignition_runtime_policy.v1";
835
+ moment: "before_agent" | "before_action" | "during_action" | "risk_check";
836
+ policy_settings_version?: "memoryignition_runtime_policy_settings.v1";
837
+ policy_settings_id?: string;
838
+ policy_source?: "request" | "agent_policy" | "risk_policy" | "workspace_default";
839
+ policy_id?: string;
840
+ policy_updated_at?: string;
841
+ approval_required_by_policy?: boolean;
842
+ approval_policy_id?: string | null;
843
+ approval_reason?: string | null;
844
+ agent_id: string | null;
845
+ agent_type: string | null;
846
+ allowed_tools: string[];
847
+ requested_tool: string | null;
848
+ requested_command: string | null;
849
+ tool_permissions_declared: boolean;
850
+ tool_allowed: boolean;
851
+ denied_tools: string[];
852
+ status: "satisfied" | "blocked";
853
+ checks: Array<{
854
+ id: "agent_identity" | "tool_permission";
855
+ label: string;
856
+ ok: boolean;
857
+ detail: string;
858
+ }>;
859
+ next_required_actions: string[];
860
+ }
861
+ export interface MemoryIgnitionInternalAgents {
862
+ intent_agent: {
863
+ status: string;
864
+ task_intent: string;
865
+ target_agent: string;
866
+ risk_level: string;
867
+ };
868
+ retrieval_agent: {
869
+ status: string;
870
+ relevant_memories: number;
871
+ past_failures: number;
872
+ trace_proofs: number;
873
+ };
874
+ skill_selector_agent: {
875
+ status: string;
876
+ approved_skills: number;
877
+ skill_proofs: number;
878
+ };
879
+ guardian_agent: {
880
+ status: string;
881
+ approval_required: boolean;
882
+ risky_files: number;
883
+ required_tests: number;
884
+ forbidden_actions: number;
885
+ denied_tools?: number;
886
+ };
887
+ outcome_agent: {
888
+ status: string;
889
+ hooks: string[];
890
+ };
891
+ }
892
+ export type MemoryIgnitionActionResult = BeforeModelResult & {
893
+ runtime_event_id: string;
894
+ runtime_moment: "before_agent" | "before_action" | "during_action" | "risk_check";
895
+ runtime_policy: MemoryIgnitionRuntimePolicy;
896
+ action_guard: MemoryIgnitionActionGuard;
897
+ internal_agents: MemoryIgnitionInternalAgents;
898
+ };
899
+ export interface MemoryIgnitionRiskCheckResult {
900
+ allowed: boolean;
901
+ risk_level: string;
902
+ approval_required: boolean;
903
+ approval_rules: MemoryIgnitionApprovalRules;
904
+ risky_files: string[];
905
+ required_tests: string[];
906
+ forbidden_actions: string[];
907
+ trace_proof: MemoryIgnitionTraceProof[];
908
+ recommended_first_action: string | null;
909
+ brief_proof_quality?: MemoryIgnitionBriefProofQuality;
910
+ evaluation_gate?: MemoryIgnitionEvaluationGate;
911
+ skill_inheritance_proofs?: MemoryIgnitionSkillInheritanceProof[];
912
+ standard_inheritance_package?: MemoryIgnitionStandardInheritancePackage;
913
+ action_guard?: MemoryIgnitionActionGuard;
914
+ internal_agents?: MemoryIgnitionInternalAgents;
915
+ }
916
+ export type MemoryIgnitionOutcomeInput = Omit<AfterModelInput, "userId"> & {
917
+ userId?: string;
918
+ };
919
+ export type MemoryIgnitionHandoffInput = Omit<HandoffInput, "userId"> & {
920
+ userId?: string;
921
+ };
922
+ export interface MemoryTraceProofResult {
923
+ memoryId: string;
924
+ summary: string;
925
+ contractCategory: string | null;
926
+ companyBrainType: string | null;
927
+ sourceRef: string | null;
928
+ traceProof: unknown;
929
+ freshness: unknown;
930
+ conflict: unknown;
931
+ graph: unknown;
932
+ entities: unknown[];
933
+ relations: unknown[];
934
+ proofQuality: unknown;
935
+ proofComplete: boolean;
936
+ lineage: string;
937
+ }
938
+ export interface MemoryExperienceQueryInput {
939
+ query?: string;
940
+ limit?: number;
941
+ verdict?: "PASS" | "FAIL" | "UNKNOWN";
942
+ }
943
+ export interface MemoryExperienceSearchItem {
944
+ id: string;
945
+ title: string;
946
+ summary: string;
947
+ lesson: string;
948
+ rootCause: string;
949
+ bestPractice: string;
950
+ antiPattern: string;
951
+ correctSolution: string;
952
+ repository: string;
953
+ pullRequestNumber: number;
954
+ pullRequestTitle: string;
955
+ verdict: "PASS" | "FAIL" | "UNKNOWN";
956
+ confidence: number;
957
+ language: string;
958
+ framework: string;
959
+ files: string[];
960
+ wrongAttempts: string[];
961
+ tests: string[];
962
+ createdAt: string;
963
+ updatedAt: string;
964
+ score: number;
965
+ matchReasons: string[];
966
+ }
967
+ export interface MemoryExperienceSearchResult {
968
+ query: string;
969
+ total: number;
970
+ results: MemoryExperienceSearchItem[];
971
+ }
972
+ export interface MemoryExperienceGroupItem {
973
+ id: string;
974
+ title: string;
975
+ count: number;
976
+ confidence: number;
977
+ repositories: string[];
978
+ verdicts: Array<"PASS" | "FAIL" | "UNKNOWN">;
979
+ rootCause: string;
980
+ lesson: string;
981
+ antiPattern: string;
982
+ language: string;
983
+ framework: string;
984
+ files: string[];
985
+ pullRequestNumbers: number[];
986
+ latestAt: string;
987
+ example: {
988
+ id: string;
989
+ repository: string;
990
+ pullRequestTitle: string;
991
+ pullRequestNumber: number;
992
+ } | null;
993
+ }
994
+ export interface MemoryExperienceLessonsResult {
995
+ query: string;
996
+ total: number;
997
+ lessons: MemoryExperienceGroupItem[];
998
+ }
999
+ export interface MemoryExperienceFailurePatternsResult {
1000
+ query: string;
1001
+ total: number;
1002
+ patterns: MemoryExperienceGroupItem[];
1003
+ }
1004
+ export interface MemoryExperienceRootCausesResult {
1005
+ query: string;
1006
+ total: number;
1007
+ rootCauses: MemoryExperienceGroupItem[];
1008
+ }
1009
+ export interface MemoryExperienceSimilarityItem {
1010
+ id: string;
1011
+ title: string;
1012
+ repository: string;
1013
+ pullRequestNumber: number;
1014
+ pullRequestTitle: string;
1015
+ verdict: "PASS" | "FAIL" | "UNKNOWN";
1016
+ confidence: number;
1017
+ score: number;
1018
+ similarity: number;
1019
+ reasoning: string[];
1020
+ rootCause: string;
1021
+ lesson: string;
1022
+ bestPractice: string;
1023
+ antiPattern: string;
1024
+ language: string;
1025
+ framework: string;
1026
+ files: string[];
1027
+ createdAt: string;
1028
+ }
1029
+ export interface MemoryExperienceSimilarityResult {
1030
+ query: string;
1031
+ experienceId: string | null;
1032
+ total: number;
1033
+ results: MemoryExperienceSimilarityItem[];
1034
+ }
1035
+ export interface MemoryExperienceRecommendationItem {
1036
+ id: string;
1037
+ type: "lesson" | "failure_pattern" | "root_cause" | "next_action";
1038
+ title: string;
1039
+ reason: string;
1040
+ recommendedAction: string;
1041
+ confidence: number;
1042
+ count: number;
1043
+ repositories: string[];
1044
+ verdicts: Array<"PASS" | "FAIL" | "UNKNOWN">;
1045
+ exampleExperienceIds: string[];
1046
+ latestAt: string;
1047
+ }
1048
+ export interface MemoryExperienceRecommendationResult {
1049
+ query: string;
1050
+ total: number;
1051
+ recommendations: MemoryExperienceRecommendationItem[];
1052
+ }