qlogicagent 2.16.5 → 2.16.7

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 (74) hide show
  1. package/dist/agent.js +20 -20
  2. package/dist/cli.js +375 -370
  3. package/dist/index.js +374 -369
  4. package/dist/orchestration.js +10 -10
  5. package/dist/protocol.js +1 -1
  6. package/dist/types/agent/tool-loop/loop-helpers.d.ts +1 -4
  7. package/dist/types/agent/tool-loop/pseudo-tool-output.d.ts +8 -0
  8. package/dist/types/agent/tool-loop/tool-failure-policy.d.ts +0 -1
  9. package/dist/types/agent/tool-loop/tool-guardrails.d.ts +24 -0
  10. package/dist/types/agent/tool-loop/tool-result-classification.d.ts +10 -0
  11. package/dist/types/cli/acp-commands.d.ts +1 -2
  12. package/dist/types/cli/base-tool-bootstrap.d.ts +1 -0
  13. package/dist/types/cli/handlers/files-handler.d.ts +5 -0
  14. package/dist/types/cli/handlers/message-feedback-handler.d.ts +29 -0
  15. package/dist/types/cli/handlers/pinned-skill-context.d.ts +2 -0
  16. package/dist/types/cli/handlers/project-handler.d.ts +1 -0
  17. package/dist/types/cli/handlers/turn-baseline-handler.d.ts +8 -0
  18. package/dist/types/cli/handlers/turn-handler.d.ts +5 -0
  19. package/dist/types/cli/handlers/working-materials-handler.d.ts +9 -0
  20. package/dist/types/cli/idle-dream-coordinator.d.ts +6 -0
  21. package/dist/types/cli/mcp-bootstrap.d.ts +1 -0
  22. package/dist/types/cli/rpc-registry.d.ts +6 -0
  23. package/dist/types/cli/skill-invocation-service.d.ts +2 -0
  24. package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +1 -0
  25. package/dist/types/cli/stdio-runtime-bootstrap.d.ts +1 -0
  26. package/dist/types/cli/tool-bootstrap-core-registration.d.ts +1 -0
  27. package/dist/types/cli/tool-bootstrap.d.ts +1 -0
  28. package/dist/types/protocol/methods.d.ts +24 -0
  29. package/dist/types/protocol/wire/agent-events.d.ts +2 -2
  30. package/dist/types/protocol/wire/gateway-rpc.d.ts +160 -0
  31. package/dist/types/protocol/wire/notification-payloads.d.ts +27 -0
  32. package/dist/types/runtime/execution/untrusted-tool-result.d.ts +2 -0
  33. package/dist/types/runtime/infra/feedback-distillation-worker.d.ts +20 -0
  34. package/dist/types/runtime/infra/feedback-distillation.d.ts +30 -0
  35. package/dist/types/runtime/infra/feedback-event-store.d.ts +160 -0
  36. package/dist/types/runtime/infra/feedback-outbox.d.ts +26 -0
  37. package/dist/types/runtime/infra/feedback-redaction.d.ts +71 -0
  38. package/dist/types/runtime/infra/feedback-upload-client.d.ts +39 -0
  39. package/dist/types/runtime/infra/feedback-upload-worker.d.ts +11 -0
  40. package/dist/types/runtime/infra/skill-resolver.d.ts +8 -2
  41. package/dist/types/runtime/infra/turn-baseline-store.d.ts +102 -0
  42. package/dist/types/runtime/infra/turn-telemetry-store.d.ts +59 -0
  43. package/dist/types/runtime/infra/working-materials-store.d.ts +35 -0
  44. package/dist/types/runtime/ports/memory-provider.d.ts +6 -0
  45. package/dist/types/runtime/ports/tool-contracts.d.ts +1 -0
  46. package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +14 -0
  47. package/dist/types/skills/mcp/mcp-manager.d.ts +31 -2
  48. package/dist/types/skills/memory/local-memory-provider.d.ts +3 -3
  49. package/dist/types/skills/memory/local-store-records.d.ts +18 -1
  50. package/dist/types/skills/memory/local-store.d.ts +8 -195
  51. package/dist/types/skills/memory/memory-consolidation.d.ts +14 -0
  52. package/dist/types/skills/memory/sqlite-memory-schema.d.ts +1 -1
  53. package/dist/types/skills/skill-system/skill-bundles.d.ts +8 -0
  54. package/dist/types/skills/skill-system/skill-frontmatter.d.ts +1 -5
  55. package/dist/types/skills/skill-system/skill-lifecycle.d.ts +13 -1
  56. package/dist/types/skills/skill-system/skill-preprocessing.d.ts +11 -0
  57. package/dist/types/skills/skill-system/skill-types.d.ts +0 -75
  58. package/dist/types/skills/skill-system/skill-validation.d.ts +1 -0
  59. package/dist/types/skills/tools/skill-tool.d.ts +3 -2
  60. package/dist/vendor/hatch-pet/LICENSE.txt +201 -201
  61. package/dist/vendor/hatch-pet/NOTICE.md +25 -25
  62. package/dist/vendor/hatch-pet/references/animation-rows.md +29 -29
  63. package/dist/vendor/hatch-pet/references/codex-pet-contract.md +35 -35
  64. package/dist/vendor/hatch-pet/references/qa-rubric.md +66 -66
  65. package/dist/vendor/hatch-pet/scripts/compose_atlas.py +169 -169
  66. package/dist/vendor/hatch-pet/scripts/derive_running_left_from_running_right.py +150 -150
  67. package/dist/vendor/hatch-pet/scripts/extract_strip_frames.py +408 -408
  68. package/dist/vendor/hatch-pet/scripts/inspect_frames.py +256 -256
  69. package/dist/vendor/hatch-pet/scripts/make_contact_sheet.py +96 -96
  70. package/dist/vendor/hatch-pet/scripts/prepare_pet_run.py +834 -834
  71. package/dist/vendor/hatch-pet/scripts/render_animation_previews.py +78 -78
  72. package/dist/vendor/hatch-pet/scripts/validate_atlas.py +157 -157
  73. package/package.json +3 -2
  74. package/dist/types/skills/skill-system/skill-source.d.ts +0 -38
@@ -12,36 +12,9 @@
12
12
  * - memories_fts: FTS5 full-text index for keyword search
13
13
  * - profiles: user profile KV (future)
14
14
  */
15
+ import type { MemoryAtlasResult, MemoryClaimInput, MemoryClaimRecord, MemoryClaimStatus, MemoryConflictRecord, MemoryInsertInput, MemoryObservationInput, MemoryProposalInput, MemoryProposalStatus, MemoryRecord, MemorySearchHit, MemoryUpdateInput, SqliteDatabase } from "./local-store-records.js";
15
16
  export { resolveMemoryDbPath } from "./memory-db-path.js";
16
- export interface MemoryRecord {
17
- id: string;
18
- text: string;
19
- userId: string;
20
- category: string;
21
- importance: number;
22
- confidence: number;
23
- source: string;
24
- sessionId: string;
25
- eventDate: string;
26
- tags: string[];
27
- embedding: Float32Array | null;
28
- createdAt: number;
29
- updatedAt: number;
30
- accessCount: number;
31
- lastAccessedAt: number;
32
- isArchived: boolean;
33
- /** Lightweight attachment refs (populated by the provider for atlas/detail). */
34
- attachments?: MemoryAttachmentRef[];
35
- }
36
- /** Lightweight attachment reference carried on records / atlas wire (no bytes, no extractedText). */
37
- export interface MemoryAttachmentRef {
38
- id: string;
39
- kind: string;
40
- filename: string;
41
- mimeType: string;
42
- size: number;
43
- url: string;
44
- }
17
+ export type { MemoryAtlasBucket, MemoryAtlasCluster, MemoryAtlasResult, MemoryAtlasWindowCursor, MemoryAttachmentRef, MemoryClaimInput, MemoryClaimRecord, MemoryClaimStatus, MemoryConflictRecord, MemoryInsertInput, MemoryObservationInput, MemoryObservationRecord, MemoryProposalInput, MemoryProposalRecord, MemoryProposalStatus, MemoryRecord, MemorySearchHit, MemorySourceKind, MemoryUpdateInput, SqliteDatabase, SqliteStatement, } from "./local-store-records.js";
45
18
  /** Full attachment index row (DB-backed; file bytes live on disk under the attachments dir). */
46
19
  export interface MemoryAttachmentRow {
47
20
  id: string;
@@ -66,172 +39,6 @@ export interface MemoryAttachmentInsert {
66
39
  extractedText?: string;
67
40
  memoryId?: string;
68
41
  }
69
- export interface MemoryInsertInput {
70
- text: string;
71
- userId: string;
72
- category?: string;
73
- importance?: number;
74
- confidence?: number;
75
- source?: string;
76
- sessionId?: string;
77
- eventDate?: string;
78
- tags?: string[];
79
- embedding?: Float32Array;
80
- }
81
- export interface MemoryUpdateInput {
82
- text?: string;
83
- category?: string;
84
- importance?: number;
85
- source?: string;
86
- eventDate?: string;
87
- tags?: string[];
88
- embedding?: Float32Array | null;
89
- }
90
- export interface MemorySearchHit {
91
- id: string;
92
- text: string;
93
- score: number;
94
- category: string;
95
- importance: number;
96
- metadata: Record<string, unknown>;
97
- }
98
- export interface MemoryAtlasBucket {
99
- id: string;
100
- startAt: number;
101
- endAt: number;
102
- count: number;
103
- avgImportance: number;
104
- avgConfidence: number;
105
- topCategory: string;
106
- }
107
- export interface MemoryAtlasCluster {
108
- id: string;
109
- label: string;
110
- kind: "source" | "category" | "tag";
111
- count: number;
112
- startAt: number;
113
- endAt: number;
114
- avgImportance: number;
115
- avgConfidence: number;
116
- topCategory: string;
117
- }
118
- export interface MemoryAtlasWindowCursor {
119
- startAt: number;
120
- endAt: number;
121
- centerAt: number;
122
- pageSize: number;
123
- hasBefore: boolean;
124
- hasAfter: boolean;
125
- }
126
- export interface MemoryAtlasResult {
127
- totalCount: number;
128
- records: MemoryRecord[];
129
- buckets: MemoryAtlasBucket[];
130
- clusters: MemoryAtlasCluster[];
131
- windowCursor: MemoryAtlasWindowCursor | null;
132
- timeRange: {
133
- startAt: number;
134
- endAt: number;
135
- } | null;
136
- }
137
- export type MemorySourceKind = "manual" | "explicit" | "document" | "image" | "video" | "auto" | "turn" | "dream" | "agent";
138
- export type MemoryClaimStatus = "active" | "superseded" | "conflicted" | "archived" | "pending_confirmation";
139
- export type MemoryProposalStatus = "pending" | "accepted" | "merged" | "conflicted" | "rejected";
140
- export interface MemoryObservationInput {
141
- userId: string;
142
- text: string;
143
- source: string;
144
- sourcePriority: number;
145
- sessionId?: string;
146
- evidenceType?: string;
147
- payload?: Record<string, unknown>;
148
- }
149
- export interface MemoryObservationRecord extends Required<Omit<MemoryObservationInput, "payload" | "sessionId" | "evidenceType">> {
150
- id: string;
151
- sessionId: string;
152
- evidenceType: string;
153
- payload: Record<string, unknown>;
154
- createdAt: number;
155
- }
156
- export interface MemoryProposalInput {
157
- userId: string;
158
- observationIds: string[];
159
- text: string;
160
- category: string;
161
- importance: number;
162
- confidence: number;
163
- source: string;
164
- sourcePriority: number;
165
- entity: string;
166
- predicate: string;
167
- value: Record<string, unknown>;
168
- validTime?: string;
169
- tags?: string[];
170
- status?: MemoryProposalStatus;
171
- relatedClaimIds?: string[];
172
- }
173
- export interface MemoryProposalRecord extends Omit<MemoryProposalInput, "value" | "validTime" | "tags" | "status" | "relatedClaimIds"> {
174
- id: string;
175
- value: Record<string, unknown>;
176
- validTime: string;
177
- tags: string[];
178
- status: MemoryProposalStatus;
179
- relatedClaimIds: string[];
180
- createdAt: number;
181
- updatedAt: number;
182
- }
183
- export interface MemoryClaimInput {
184
- userId: string;
185
- memoryId?: string;
186
- entity: string;
187
- predicate: string;
188
- value: Record<string, unknown>;
189
- text: string;
190
- category: string;
191
- importance: number;
192
- confidence: number;
193
- source: string;
194
- sourcePriority: number;
195
- status: MemoryClaimStatus;
196
- validTime?: string;
197
- evidenceIds: string[];
198
- supersedesClaimId?: string;
199
- conflictGroupId?: string;
200
- }
201
- export interface MemoryClaimRecord extends Omit<MemoryClaimInput, "memoryId" | "value" | "validTime" | "supersedesClaimId" | "conflictGroupId"> {
202
- id: string;
203
- memoryId: string;
204
- value: Record<string, unknown>;
205
- validTime: string;
206
- supersedesClaimId: string;
207
- conflictGroupId: string;
208
- createdAt: number;
209
- updatedAt: number;
210
- }
211
- export interface MemoryConflictRecord {
212
- id: string;
213
- userId: string;
214
- claimAId: string;
215
- claimBId: string;
216
- reason: string;
217
- status: "open" | "resolved" | "dismissed";
218
- createdAt: number;
219
- updatedAt: number;
220
- }
221
- export interface SqliteDatabase {
222
- exec(sql: string): void;
223
- prepare(sql: string): SqliteStatement;
224
- pragma(pragma: string): unknown;
225
- close(): void;
226
- }
227
- export interface SqliteStatement {
228
- run(...params: unknown[]): {
229
- changes: number;
230
- lastInsertRowid: number | bigint;
231
- };
232
- get(...params: unknown[]): unknown;
233
- all(...params: unknown[]): unknown[];
234
- }
235
42
  export declare class LocalMemoryStore {
236
43
  private db;
237
44
  constructor(db: SqliteDatabase);
@@ -438,6 +245,12 @@ export declare class LocalMemoryStore {
438
245
  enforceCapacityLimit(userId: string, maxCount?: number): number;
439
246
  insertObservation(input: MemoryObservationInput): string;
440
247
  insertProposal(input: MemoryProposalInput): string;
248
+ /**
249
+ * Look up an existing proposal by its idempotency key (feedback distillation — §10). Returns the
250
+ * proposal id if one already exists for this user + key, else null, letting proposeExtracted skip
251
+ * a duplicate crash-safely (the key survives a worker restart mid-sweep).
252
+ */
253
+ findProposalByIdempotencyKey(userId: string, idempotencyKey: string): string | null;
441
254
  updateProposalStatus(id: string, status: MemoryProposalStatus, relatedClaimIds?: string[]): boolean;
442
255
  insertClaim(input: MemoryClaimInput): string;
443
256
  listClaims(userId: string, statuses?: MemoryClaimStatus[]): MemoryClaimRecord[];
@@ -9,6 +9,20 @@ export interface ExtractedMemoryItem {
9
9
  tags?: string[];
10
10
  /** Ids of already-uploaded attachments to link to this memory on commit. */
11
11
  attachmentIds?: string[];
12
+ /**
13
+ * Explicit confidence for evidence-bearing sources (feedback distillation — §10). When set,
14
+ * proposeExtracted uses it verbatim instead of the source-derived default. Other callers omit it.
15
+ */
16
+ confidence?: number;
17
+ /**
18
+ * Evidence trail for distillation-style sources. `refs` (e.g. feedbackIds + turn:<id>) is stored
19
+ * on the observation for audit; `idempotencyKey` makes the proposal insert crash-safe + dedup'd.
20
+ */
21
+ evidence?: {
22
+ kind: string;
23
+ refs: string[];
24
+ idempotencyKey: string;
25
+ };
12
26
  }
13
27
  export interface MemoryConsolidationOptions {
14
28
  source?: string;
@@ -1,3 +1,3 @@
1
1
  import type { SqliteDatabase } from "./local-store-records.js";
2
- export declare const MEMORY_SCHEMA_SQL = "\nCREATE TABLE IF NOT EXISTS memories (\n id TEXT PRIMARY KEY,\n text TEXT NOT NULL,\n user_id TEXT NOT NULL,\n category TEXT NOT NULL DEFAULT 'general',\n importance REAL NOT NULL DEFAULT 0.5,\n confidence REAL NOT NULL DEFAULT 1.0,\n source TEXT NOT NULL DEFAULT 'agent',\n session_id TEXT NOT NULL DEFAULT '',\n event_date TEXT NOT NULL DEFAULT '',\n tags TEXT NOT NULL DEFAULT '[]',\n embedding BLOB,\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL,\n access_count INTEGER NOT NULL DEFAULT 0,\n last_accessed_at INTEGER NOT NULL DEFAULT 0,\n is_archived INTEGER NOT NULL DEFAULT 0\n);\n\nCREATE INDEX IF NOT EXISTS idx_memories_user ON memories(user_id);\nCREATE INDEX IF NOT EXISTS idx_memories_user_category ON memories(user_id, category);\nCREATE INDEX IF NOT EXISTS idx_memories_user_importance ON memories(user_id, importance DESC);\nCREATE INDEX IF NOT EXISTS idx_memories_created ON memories(created_at DESC);\n\nCREATE TABLE IF NOT EXISTS memory_observations (\n id TEXT PRIMARY KEY,\n user_id TEXT NOT NULL,\n text TEXT NOT NULL,\n source TEXT NOT NULL,\n source_priority INTEGER NOT NULL DEFAULT 0,\n session_id TEXT NOT NULL DEFAULT '',\n evidence_type TEXT NOT NULL DEFAULT 'text',\n payload TEXT NOT NULL DEFAULT '{}',\n created_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_observations_user_created ON memory_observations(user_id, created_at DESC);\nCREATE INDEX IF NOT EXISTS idx_memory_observations_source ON memory_observations(user_id, source);\n\nCREATE TABLE IF NOT EXISTS memory_proposals (\n id TEXT PRIMARY KEY,\n user_id TEXT NOT NULL,\n observation_ids TEXT NOT NULL DEFAULT '[]',\n text TEXT NOT NULL,\n category TEXT NOT NULL DEFAULT 'general',\n importance REAL NOT NULL DEFAULT 0.5,\n confidence REAL NOT NULL DEFAULT 0.5,\n source TEXT NOT NULL DEFAULT 'agent',\n source_priority INTEGER NOT NULL DEFAULT 0,\n entity TEXT NOT NULL DEFAULT '',\n predicate TEXT NOT NULL DEFAULT '',\n value_json TEXT NOT NULL DEFAULT '{}',\n valid_time TEXT NOT NULL DEFAULT '',\n tags TEXT NOT NULL DEFAULT '[]',\n status TEXT NOT NULL DEFAULT 'pending',\n related_claim_ids TEXT NOT NULL DEFAULT '[]',\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_proposals_user_status ON memory_proposals(user_id, status);\nCREATE INDEX IF NOT EXISTS idx_memory_proposals_fact ON memory_proposals(user_id, entity, predicate, valid_time);\n\nCREATE TABLE IF NOT EXISTS memory_claims (\n id TEXT PRIMARY KEY,\n memory_id TEXT NOT NULL DEFAULT '',\n user_id TEXT NOT NULL,\n entity TEXT NOT NULL DEFAULT '',\n predicate TEXT NOT NULL DEFAULT '',\n value_json TEXT NOT NULL DEFAULT '{}',\n text TEXT NOT NULL,\n category TEXT NOT NULL DEFAULT 'general',\n importance REAL NOT NULL DEFAULT 0.5,\n confidence REAL NOT NULL DEFAULT 0.5,\n source TEXT NOT NULL DEFAULT 'agent',\n source_priority INTEGER NOT NULL DEFAULT 0,\n status TEXT NOT NULL DEFAULT 'active',\n valid_time TEXT NOT NULL DEFAULT '',\n evidence_ids TEXT NOT NULL DEFAULT '[]',\n supersedes_claim_id TEXT NOT NULL DEFAULT '',\n conflict_group_id TEXT NOT NULL DEFAULT '',\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_claims_user_status ON memory_claims(user_id, status);\nCREATE INDEX IF NOT EXISTS idx_memory_claims_memory ON memory_claims(memory_id);\nCREATE INDEX IF NOT EXISTS idx_memory_claims_fact ON memory_claims(user_id, entity, predicate, valid_time);\n\nCREATE TABLE IF NOT EXISTS memory_conflicts (\n id TEXT PRIMARY KEY,\n user_id TEXT NOT NULL,\n claim_a_id TEXT NOT NULL,\n claim_b_id TEXT NOT NULL,\n reason TEXT NOT NULL,\n status TEXT NOT NULL DEFAULT 'open',\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_conflicts_user_status ON memory_conflicts(user_id, status);\n\nCREATE TABLE IF NOT EXISTS memory_attachments (\n id TEXT PRIMARY KEY,\n memory_id TEXT NOT NULL DEFAULT '',\n user_id TEXT NOT NULL,\n kind TEXT NOT NULL DEFAULT 'file',\n filename TEXT NOT NULL DEFAULT '',\n mime_type TEXT NOT NULL DEFAULT '',\n size INTEGER NOT NULL DEFAULT 0,\n rel_path TEXT NOT NULL,\n extracted_text TEXT NOT NULL DEFAULT '',\n created_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_attachments_memory ON memory_attachments(memory_id);\nCREATE INDEX IF NOT EXISTS idx_memory_attachments_orphan ON memory_attachments(user_id, memory_id, created_at);\n\nCREATE VIRTUAL TABLE IF NOT EXISTS memories_fts USING fts5(\n id UNINDEXED,\n user_id UNINDEXED,\n text,\n category,\n tags,\n content=memories,\n content_rowid=rowid,\n tokenize='unicode61 remove_diacritics 2'\n);\n\nCREATE TRIGGER IF NOT EXISTS memories_ai AFTER INSERT ON memories BEGIN\n INSERT INTO memories_fts(rowid, id, user_id, text, category, tags)\n VALUES (new.rowid, new.id, new.user_id, new.text, new.category, new.tags);\nEND;\n\nCREATE TRIGGER IF NOT EXISTS memories_ad AFTER DELETE ON memories BEGIN\n INSERT INTO memories_fts(memories_fts, rowid, id, user_id, text, category, tags)\n VALUES ('delete', old.rowid, old.id, old.user_id, old.text, old.category, old.tags);\nEND;\n\nCREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE ON memories BEGIN\n INSERT INTO memories_fts(memories_fts, rowid, id, user_id, text, category, tags)\n VALUES ('delete', old.rowid, old.id, old.user_id, old.text, old.category, old.tags);\n INSERT INTO memories_fts(rowid, id, user_id, text, category, tags)\n VALUES (new.rowid, new.id, new.user_id, new.text, new.category, new.tags);\nEND;\n";
2
+ export declare const MEMORY_SCHEMA_SQL = "\nCREATE TABLE IF NOT EXISTS memories (\n id TEXT PRIMARY KEY,\n text TEXT NOT NULL,\n user_id TEXT NOT NULL,\n category TEXT NOT NULL DEFAULT 'general',\n importance REAL NOT NULL DEFAULT 0.5,\n confidence REAL NOT NULL DEFAULT 1.0,\n source TEXT NOT NULL DEFAULT 'agent',\n session_id TEXT NOT NULL DEFAULT '',\n event_date TEXT NOT NULL DEFAULT '',\n tags TEXT NOT NULL DEFAULT '[]',\n embedding BLOB,\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL,\n access_count INTEGER NOT NULL DEFAULT 0,\n last_accessed_at INTEGER NOT NULL DEFAULT 0,\n is_archived INTEGER NOT NULL DEFAULT 0\n);\n\nCREATE INDEX IF NOT EXISTS idx_memories_user ON memories(user_id);\nCREATE INDEX IF NOT EXISTS idx_memories_user_category ON memories(user_id, category);\nCREATE INDEX IF NOT EXISTS idx_memories_user_importance ON memories(user_id, importance DESC);\nCREATE INDEX IF NOT EXISTS idx_memories_created ON memories(created_at DESC);\n\nCREATE TABLE IF NOT EXISTS memory_observations (\n id TEXT PRIMARY KEY,\n user_id TEXT NOT NULL,\n text TEXT NOT NULL,\n source TEXT NOT NULL,\n source_priority INTEGER NOT NULL DEFAULT 0,\n session_id TEXT NOT NULL DEFAULT '',\n evidence_type TEXT NOT NULL DEFAULT 'text',\n payload TEXT NOT NULL DEFAULT '{}',\n created_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_observations_user_created ON memory_observations(user_id, created_at DESC);\nCREATE INDEX IF NOT EXISTS idx_memory_observations_source ON memory_observations(user_id, source);\n\nCREATE TABLE IF NOT EXISTS memory_proposals (\n id TEXT PRIMARY KEY,\n user_id TEXT NOT NULL,\n observation_ids TEXT NOT NULL DEFAULT '[]',\n text TEXT NOT NULL,\n category TEXT NOT NULL DEFAULT 'general',\n importance REAL NOT NULL DEFAULT 0.5,\n confidence REAL NOT NULL DEFAULT 0.5,\n source TEXT NOT NULL DEFAULT 'agent',\n source_priority INTEGER NOT NULL DEFAULT 0,\n entity TEXT NOT NULL DEFAULT '',\n predicate TEXT NOT NULL DEFAULT '',\n value_json TEXT NOT NULL DEFAULT '{}',\n valid_time TEXT NOT NULL DEFAULT '',\n tags TEXT NOT NULL DEFAULT '[]',\n status TEXT NOT NULL DEFAULT 'pending',\n related_claim_ids TEXT NOT NULL DEFAULT '[]',\n idempotency_key TEXT,\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_proposals_user_status ON memory_proposals(user_id, status);\nCREATE INDEX IF NOT EXISTS idx_memory_proposals_fact ON memory_proposals(user_id, entity, predicate, valid_time);\n\nCREATE TABLE IF NOT EXISTS memory_claims (\n id TEXT PRIMARY KEY,\n memory_id TEXT NOT NULL DEFAULT '',\n user_id TEXT NOT NULL,\n entity TEXT NOT NULL DEFAULT '',\n predicate TEXT NOT NULL DEFAULT '',\n value_json TEXT NOT NULL DEFAULT '{}',\n text TEXT NOT NULL,\n category TEXT NOT NULL DEFAULT 'general',\n importance REAL NOT NULL DEFAULT 0.5,\n confidence REAL NOT NULL DEFAULT 0.5,\n source TEXT NOT NULL DEFAULT 'agent',\n source_priority INTEGER NOT NULL DEFAULT 0,\n status TEXT NOT NULL DEFAULT 'active',\n valid_time TEXT NOT NULL DEFAULT '',\n evidence_ids TEXT NOT NULL DEFAULT '[]',\n supersedes_claim_id TEXT NOT NULL DEFAULT '',\n conflict_group_id TEXT NOT NULL DEFAULT '',\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_claims_user_status ON memory_claims(user_id, status);\nCREATE INDEX IF NOT EXISTS idx_memory_claims_memory ON memory_claims(memory_id);\nCREATE INDEX IF NOT EXISTS idx_memory_claims_fact ON memory_claims(user_id, entity, predicate, valid_time);\n\nCREATE TABLE IF NOT EXISTS memory_conflicts (\n id TEXT PRIMARY KEY,\n user_id TEXT NOT NULL,\n claim_a_id TEXT NOT NULL,\n claim_b_id TEXT NOT NULL,\n reason TEXT NOT NULL,\n status TEXT NOT NULL DEFAULT 'open',\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_conflicts_user_status ON memory_conflicts(user_id, status);\n\nCREATE TABLE IF NOT EXISTS memory_attachments (\n id TEXT PRIMARY KEY,\n memory_id TEXT NOT NULL DEFAULT '',\n user_id TEXT NOT NULL,\n kind TEXT NOT NULL DEFAULT 'file',\n filename TEXT NOT NULL DEFAULT '',\n mime_type TEXT NOT NULL DEFAULT '',\n size INTEGER NOT NULL DEFAULT 0,\n rel_path TEXT NOT NULL,\n extracted_text TEXT NOT NULL DEFAULT '',\n created_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_attachments_memory ON memory_attachments(memory_id);\nCREATE INDEX IF NOT EXISTS idx_memory_attachments_orphan ON memory_attachments(user_id, memory_id, created_at);\n\nCREATE VIRTUAL TABLE IF NOT EXISTS memories_fts USING fts5(\n id UNINDEXED,\n user_id UNINDEXED,\n text,\n category,\n tags,\n content=memories,\n content_rowid=rowid,\n tokenize='unicode61 remove_diacritics 2'\n);\n\nCREATE TRIGGER IF NOT EXISTS memories_ai AFTER INSERT ON memories BEGIN\n INSERT INTO memories_fts(rowid, id, user_id, text, category, tags)\n VALUES (new.rowid, new.id, new.user_id, new.text, new.category, new.tags);\nEND;\n\nCREATE TRIGGER IF NOT EXISTS memories_ad AFTER DELETE ON memories BEGIN\n INSERT INTO memories_fts(memories_fts, rowid, id, user_id, text, category, tags)\n VALUES ('delete', old.rowid, old.id, old.user_id, old.text, old.category, old.tags);\nEND;\n\nCREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE ON memories BEGIN\n INSERT INTO memories_fts(memories_fts, rowid, id, user_id, text, category, tags)\n VALUES ('delete', old.rowid, old.id, old.user_id, old.text, old.category, old.tags);\n INSERT INTO memories_fts(rowid, id, user_id, text, category, tags)\n VALUES (new.rowid, new.id, new.user_id, new.text, new.category, new.tags);\nEND;\n";
3
3
  export declare function initializeMemorySchema(db: SqliteDatabase): void;
@@ -0,0 +1,8 @@
1
+ export interface SkillBundle {
2
+ name: string;
3
+ skills: string[];
4
+ filePath: string;
5
+ }
6
+ export declare function getSkillBundlesDir(): string;
7
+ export declare function listSkillBundles(bundleDir?: string): SkillBundle[];
8
+ export declare function resolveSkillBundle(name: string, bundleDir?: string): SkillBundle | undefined;
@@ -1,4 +1,4 @@
1
- import type { ParsedSkillFrontmatter, SkillInvocationPolicy, SkillMetadata } from "./skill-types.js";
1
+ import type { ParsedSkillFrontmatter, SkillMetadata } from "./skill-types.js";
2
2
  /**
3
3
  * Parse a YAML-like frontmatter block into a flat key→value record.
4
4
  * Uses a lightweight line parser to avoid a YAML library dependency.
@@ -9,10 +9,6 @@ export declare function parseFrontmatter(content: string): ParsedSkillFrontmatte
9
9
  * Expects `metadata: {"openclaw": {...}}` (JSON format).
10
10
  */
11
11
  export declare function resolveSkillMetadata(frontmatter: ParsedSkillFrontmatter): SkillMetadata | undefined;
12
- /**
13
- * Resolve invocation policy from frontmatter fields.
14
- */
15
- export declare function resolveSkillInvocationPolicy(frontmatter: ParsedSkillFrontmatter): SkillInvocationPolicy;
16
12
  /**
17
13
  * Get the canonical key for a skill (metadata.skillKey or skill.name).
18
14
  */
@@ -10,6 +10,8 @@ export interface SkillLifecycleRecord {
10
10
  archivedAt?: string;
11
11
  pinned: boolean;
12
12
  useCount: number;
13
+ positiveCount?: number;
14
+ negativeCount?: number;
13
15
  source: "learned" | "created" | "installed" | "promoted";
14
16
  resourceType?: string;
15
17
  launcherRequired?: boolean;
@@ -28,6 +30,14 @@ export interface SkillLifecycleStore {
28
30
  version: 1;
29
31
  records: Record<string, SkillLifecycleRecord>;
30
32
  }
33
+ export interface SkillUsageStats {
34
+ invokeCount: number;
35
+ activeCount: number;
36
+ positiveCount: number;
37
+ negativeCount: number;
38
+ lastUsedAt?: string;
39
+ successRate?: number;
40
+ }
31
41
  export interface CuratorResult {
32
42
  transitioned: Array<{
33
43
  name: string;
@@ -45,7 +55,7 @@ export declare function ensureRecord(store: SkillLifecycleStore, name: string, s
45
55
  /**
46
56
  * Record a skill invocation — resets to active if stale.
47
57
  */
48
- export declare function recordInvocation(store: SkillLifecycleStore, name: string): void;
58
+ export declare function recordInvocation(store: SkillLifecycleStore, name: string, success?: boolean): void;
49
59
  /**
50
60
  * Record that a skill was viewed/listed.
51
61
  */
@@ -87,6 +97,8 @@ export declare function getSkillsByState(store: SkillLifecycleStore, state: Skil
87
97
  * Get lifecycle record for a skill. Returns undefined if not tracked.
88
98
  */
89
99
  export declare function getLifecycleRecord(store: SkillLifecycleStore, name: string): SkillLifecycleRecord | undefined;
100
+ export declare function getLifecycleSkillStats(store: SkillLifecycleStore, name: string): SkillUsageStats | undefined;
101
+ export declare function getAllLifecycleSkillStats(store: SkillLifecycleStore): Record<string, SkillUsageStats>;
90
102
  /**
91
103
  * Remove a lifecycle record (e.g., when skill is deleted).
92
104
  */
@@ -0,0 +1,11 @@
1
+ export interface SkillTemplateVars {
2
+ skillDir?: string;
3
+ sessionId?: string;
4
+ }
5
+ export interface SkillPreprocessOptions extends SkillTemplateVars {
6
+ inlineShell?: boolean;
7
+ runInlineShellCommand?: (command: string) => Promise<string>;
8
+ maxInlineShellOutput?: number;
9
+ }
10
+ export declare function preprocessSkillContent(content: string, options?: SkillPreprocessOptions): Promise<string>;
11
+ export declare function substituteSkillTemplateVars(content: string, vars?: SkillTemplateVars): string;
@@ -63,78 +63,3 @@ export interface SkillMetadata {
63
63
  };
64
64
  install?: SkillInstallSpec[];
65
65
  }
66
- /**
67
- * Controls how a skill may be activated by user commands or model tool calls.
68
- */
69
- export interface SkillInvocationPolicy {
70
- /** Whether users can directly invoke this skill via slash-command. */
71
- userInvocable: boolean;
72
- /** If true, the model cannot trigger this skill autonomously. */
73
- disableModelInvocation: boolean;
74
- }
75
- /**
76
- * Slash-command dispatch specification for a skill.
77
- */
78
- export interface SkillCommandDispatchSpec {
79
- kind: "tool";
80
- toolName: string;
81
- argMode?: "raw";
82
- }
83
- /**
84
- * A skill-derived slash-command for IM platforms.
85
- */
86
- export interface SkillCommandSpec {
87
- name: string;
88
- skillName: string;
89
- description: string;
90
- dispatch?: SkillCommandDispatchSpec;
91
- }
92
- export type SkillScanSeverity = "info" | "warn" | "critical";
93
- export interface SkillScanFinding {
94
- ruleId: string;
95
- severity: SkillScanSeverity;
96
- file: string;
97
- line: number;
98
- message: string;
99
- evidence: string;
100
- }
101
- export interface SkillScanSummary {
102
- scannedFiles: number;
103
- critical: number;
104
- warn: number;
105
- info: number;
106
- findings: SkillScanFinding[];
107
- }
108
- export interface SkillScanOptions {
109
- includeFiles?: string[];
110
- maxFiles?: number;
111
- maxFileBytes?: number;
112
- }
113
- /**
114
- * Filesystem dependencies injected by the host runtime.
115
- * Keeps the skill system decoupled from Node.js `fs` / `path`.
116
- */
117
- export interface SkillFsDeps {
118
- readFileSync(path: string, encoding: "utf-8"): string;
119
- readFile(path: string, encoding: "utf-8"): Promise<string>;
120
- existsSync(path: string): boolean;
121
- statSync(path: string): {
122
- size: number;
123
- mtimeMs: number;
124
- isDirectory(): boolean;
125
- };
126
- readdirSync(path: string, opts: {
127
- withFileTypes: true;
128
- }): Array<{
129
- name: string;
130
- isDirectory(): boolean;
131
- isSymbolicLink(): boolean;
132
- }>;
133
- realpathSync(path: string): string;
134
- }
135
- export interface SkillPathDeps {
136
- join(...segments: string[]): string;
137
- resolve(...segments: string[]): string;
138
- extname(p: string): string;
139
- sep: string;
140
- }
@@ -5,6 +5,7 @@ export interface FrontmatterValidationResult {
5
5
  /** Parsed frontmatter if valid. */
6
6
  parsed?: Record<string, string>;
7
7
  }
8
+ export declare const MAX_DESCRIPTION_LENGTH = 60;
8
9
  /**
9
10
  * Validate SKILL.md content for required frontmatter structure.
10
11
  * Used before persisting agent-created skills.
@@ -27,7 +27,7 @@ export declare const SKILL_VIEW_TOOL_SCHEMA: {
27
27
  readonly properties: {
28
28
  readonly name: {
29
29
  readonly type: "string";
30
- readonly description: "The skill to use. Calling skill_view(name='X') loads that skill and you follow its instructions in THIS turn that single call is all you need to USE a skill.";
30
+ readonly description: "The skill to use. For a matching workflow, call skill_view before read/search/exec/MCP. Calling skill_view(name='X') loads that skill and you follow its instructions in THIS turn - that single call is all you need to USE a skill.";
31
31
  };
32
32
  readonly args: {
33
33
  readonly type: "string";
@@ -104,6 +104,7 @@ export interface SkillListOutput {
104
104
  export interface SkillViewOutput {
105
105
  name: string;
106
106
  content: string;
107
+ skillDir?: string;
107
108
  referenceFiles?: string[];
108
109
  }
109
110
  export interface SkillManageResult {
@@ -121,7 +122,7 @@ export interface SkillToolDeps {
121
122
  /** View skill with optional file path. */
122
123
  viewSkill(name: string, filePath?: string): Promise<SkillViewOutput | null>;
123
124
  /** Run a skill — returns its instructions for the main model to follow inline (mainstream, no sub-turn). */
124
- runSkillInvocation?(skillName: string, skillContent: string, userArgs: string | undefined, signal?: AbortSignal): Promise<string>;
125
+ runSkillInvocation(skillName: string, skillContent: string, userArgs: string | undefined, skillDir: string | undefined, signal?: AbortSignal): Promise<string>;
125
126
  /** Manage skill (create/edit/patch/delete). */
126
127
  manageSkill(params: {
127
128
  action: string;