@octopi-agent/engine 0.65.0 → 0.70.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.
- package/dist/config-schema/engine.d.ts +84 -0
- package/dist/config-schema/engine.js +4 -1
- package/dist/config-schema/substrate.d.ts +86 -0
- package/dist/config-schema/substrate.js +114 -0
- package/dist/config.d.ts +71 -0
- package/dist/harness/agent/builder.d.ts +1 -1
- package/dist/harness/agent/builder.js +27 -2
- package/dist/harness/agent/config-bridge.js +17 -4
- package/dist/harness/context/capabilities/summary/gate.js +2 -2
- package/dist/harness/context/capabilities/summary/policies.js +5 -5
- package/dist/harness/context/capabilities/summary/registry.js +29 -24
- package/dist/harness/context/layer-health.js +3 -2
- package/dist/harness/context/layers.d.ts +27 -13
- package/dist/harness/context/layers.js +76 -66
- package/dist/harness/context/system-prompt-assembler.d.ts +3 -0
- package/dist/harness/context/system-prompt-assembler.js +11 -1
- package/dist/harness/extension/plugin-ecosystem/client-tools/index.d.ts +4 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/index.js +3 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/invoke.d.ts +56 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/invoke.js +281 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/registry.d.ts +98 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/registry.js +250 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/stream.d.ts +124 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/stream.js +372 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/types.d.ts +109 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/types.js +8 -0
- package/dist/harness/extension/plugin-ecosystem/index.d.ts +1 -0
- package/dist/harness/extension/plugin-ecosystem/index.js +1 -0
- package/dist/harness/extension/plugin-ecosystem/tools/builtin.js +1 -1
- package/dist/harness/extension/plugin-ecosystem/tools/memory.d.ts +11 -1
- package/dist/harness/extension/plugin-ecosystem/tools/memory.js +14 -0
- package/dist/harness/index.d.ts +4 -3
- package/dist/harness/index.js +2 -1
- package/dist/harness/knowledge/query-service.js +5 -5
- package/dist/harness/knowledge/retriever.js +1 -1
- package/dist/harness/knowledge/source-store.d.ts +17 -2
- package/dist/harness/knowledge/source-store.js +6 -5
- package/dist/harness/memory/cognition-decay.d.ts +36 -0
- package/dist/harness/memory/cognition-decay.js +55 -0
- package/dist/harness/memory/cognition-gates.d.ts +60 -0
- package/dist/harness/memory/cognition-gates.js +191 -0
- package/dist/harness/memory/cognition-trigger.d.ts +30 -0
- package/dist/harness/memory/cognition-trigger.js +41 -0
- package/dist/harness/memory/cognition-types.d.ts +1 -1
- package/dist/harness/memory/cognition.d.ts +40 -8
- package/dist/harness/memory/cognition.js +432 -79
- package/dist/harness/memory/conceptualizer.d.ts +66 -0
- package/dist/harness/memory/conceptualizer.js +246 -0
- package/dist/harness/memory/index.d.ts +16 -2
- package/dist/harness/memory/index.js +11 -1
- package/dist/harness/memory/sqlite/agent-db.d.ts +9 -0
- package/dist/harness/memory/sqlite/agent-db.js +118 -15
- package/dist/harness/memory/sqlite/cognition-store.d.ts +55 -16
- package/dist/harness/memory/sqlite/cognition-store.js +591 -144
- package/dist/harness/memory/sqlite/wisdom-store.d.ts +33 -14
- package/dist/harness/memory/sqlite/wisdom-store.js +257 -44
- package/dist/harness/memory/types.d.ts +331 -16
- package/dist/harness/memory/types.js +49 -0
- package/dist/harness/memory/wisdom-formation.d.ts +101 -0
- package/dist/harness/memory/wisdom-formation.js +304 -0
- package/dist/harness/memory/wisdom-gates.d.ts +50 -0
- package/dist/harness/memory/wisdom-gates.js +204 -0
- package/dist/harness/memory/wisdom-policy.d.ts +107 -0
- package/dist/harness/memory/wisdom-policy.js +220 -0
- package/dist/harness/memory/wisdom-types.d.ts +3 -2
- package/dist/harness/memory/wisdom-types.js +2 -2
- package/dist/harness/memory/wisdom.d.ts +27 -0
- package/dist/harness/memory/wisdom.js +181 -0
- package/dist/harness/run/agent/agent.d.ts +9 -0
- package/dist/harness/run/agent/agent.js +19 -0
- package/dist/harness/run/reliability/run-agent.js +6 -2
- package/dist/harness/run/runner.js +2 -1
- package/dist/harness/session/index.d.ts +1 -0
- package/dist/harness/session/index.js +1 -0
- package/dist/harness/session/title.d.ts +86 -0
- package/dist/harness/session/title.js +268 -0
- package/dist/harness/shared/events/agent-event-map.d.ts +8 -0
- package/dist/harness/shared/events/agent-event-map.js +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -0
- package/dist/subsystems/cognition-steward/conceptualize/SUBSYSTEM.md +43 -0
- package/dist/subsystems/cognition-steward/conceptualize/config.yaml +50 -0
- package/dist/subsystems/cognition-steward/conceptualize/handler.d.ts +9 -0
- package/dist/subsystems/cognition-steward/conceptualize/handler.js +125 -0
- package/dist/subsystems/cognition-steward/consolidate/SUBSYSTEM.md +6 -0
- package/dist/subsystems/cognition-steward/consolidate/config.yaml +54 -0
- package/dist/subsystems/cognition-steward/consolidate/handler.d.ts +12 -0
- package/dist/subsystems/cognition-steward/consolidate/handler.js +93 -0
- package/dist/subsystems/wisdom-steward/evaluate/config.yaml +50 -0
- package/dist/subsystems/wisdom-steward/evaluate/handler.d.ts +18 -0
- package/dist/subsystems/wisdom-steward/evaluate/handler.js +91 -0
- package/dist/subsystems/wisdom-steward/formation/SUBSYSTEM.md +42 -0
- package/dist/subsystems/wisdom-steward/formation/config.yaml +54 -0
- package/dist/subsystems/wisdom-steward/formation/handler.d.ts +18 -0
- package/dist/subsystems/wisdom-steward/formation/handler.js +212 -0
- package/dist/subsystems/wisdom-steward/govern/config.yaml +55 -0
- package/dist/subsystems/wisdom-steward/govern/handler.d.ts +17 -0
- package/dist/subsystems/wisdom-steward/govern/handler.js +68 -0
- package/package.json +2 -2
|
@@ -566,6 +566,90 @@ export declare const engineConfigSchema: z.ZodObject<{
|
|
|
566
566
|
}, z.core.$strip>>;
|
|
567
567
|
}, z.core.$strip>>;
|
|
568
568
|
}, z.core.$strip>>;
|
|
569
|
+
cognition: z.ZodOptional<z.ZodObject<{
|
|
570
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
571
|
+
conceptualize: z.ZodOptional<z.ZodObject<{
|
|
572
|
+
onMemoryWrite: z.ZodOptional<z.ZodBoolean>;
|
|
573
|
+
onSessionEnd: z.ZodOptional<z.ZodBoolean>;
|
|
574
|
+
maxNodesPerProposition: z.ZodOptional<z.ZodNumber>;
|
|
575
|
+
maxEdgesPerProposition: z.ZodOptional<z.ZodNumber>;
|
|
576
|
+
}, z.core.$strip>>;
|
|
577
|
+
relations: z.ZodOptional<z.ZodObject<{
|
|
578
|
+
requireCue: z.ZodOptional<z.ZodBoolean>;
|
|
579
|
+
causesMinIndependentMemories: z.ZodOptional<z.ZodNumber>;
|
|
580
|
+
allowCooccurEscalation: z.ZodOptional<z.ZodLiteral<false>>;
|
|
581
|
+
}, z.core.$strip>>;
|
|
582
|
+
identity: z.ZodOptional<z.ZodObject<{
|
|
583
|
+
mergeThreshold: z.ZodOptional<z.ZodNumber>;
|
|
584
|
+
candidateBandLo: z.ZodOptional<z.ZodNumber>;
|
|
585
|
+
candidateBandHi: z.ZodOptional<z.ZodNumber>;
|
|
586
|
+
}, z.core.$strip>>;
|
|
587
|
+
plasticity: z.ZodOptional<z.ZodObject<{
|
|
588
|
+
eta: z.ZodOptional<z.ZodNumber>;
|
|
589
|
+
deltaRetrieval: z.ZodOptional<z.ZodNumber>;
|
|
590
|
+
decayPerDay: z.ZodOptional<z.ZodObject<{
|
|
591
|
+
related: z.ZodOptional<z.ZodNumber>;
|
|
592
|
+
causes: z.ZodOptional<z.ZodNumber>;
|
|
593
|
+
part_of: z.ZodOptional<z.ZodNumber>;
|
|
594
|
+
opposes: z.ZodOptional<z.ZodNumber>;
|
|
595
|
+
similar_to: z.ZodOptional<z.ZodNumber>;
|
|
596
|
+
evolves_to: z.ZodOptional<z.ZodNumber>;
|
|
597
|
+
}, z.core.$strip>>;
|
|
598
|
+
}, z.core.$strip>>;
|
|
599
|
+
consolidation: z.ZodOptional<z.ZodObject<{
|
|
600
|
+
debounceMinutes: z.ZodOptional<z.ZodNumber>;
|
|
601
|
+
ttlHours: z.ZodOptional<z.ZodNumber>;
|
|
602
|
+
}, z.core.$strip>>;
|
|
603
|
+
capacity: z.ZodOptional<z.ZodObject<{
|
|
604
|
+
warnNodes: z.ZodOptional<z.ZodNumber>;
|
|
605
|
+
warnEdges: z.ZodOptional<z.ZodNumber>;
|
|
606
|
+
stopNodes: z.ZodOptional<z.ZodNumber>;
|
|
607
|
+
stopEdges: z.ZodOptional<z.ZodNumber>;
|
|
608
|
+
}, z.core.$strip>>;
|
|
609
|
+
retrieval: z.ZodOptional<z.ZodObject<{
|
|
610
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
611
|
+
delta: z.ZodOptional<z.ZodNumber>;
|
|
612
|
+
tau: z.ZodOptional<z.ZodNumber>;
|
|
613
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
614
|
+
}, z.core.$strip>>;
|
|
615
|
+
}, z.core.$strip>>;
|
|
616
|
+
wisdom: z.ZodOptional<z.ZodObject<{
|
|
617
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
618
|
+
capacity: z.ZodOptional<z.ZodObject<{
|
|
619
|
+
softCap: z.ZodOptional<z.ZodNumber>;
|
|
620
|
+
hardCap: z.ZodOptional<z.ZodNumber>;
|
|
621
|
+
}, z.core.$strip>>;
|
|
622
|
+
formation: z.ZodOptional<z.ZodObject<{
|
|
623
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
624
|
+
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
625
|
+
ttlHours: z.ZodOptional<z.ZodNumber>;
|
|
626
|
+
minMemorySupport: z.ZodOptional<z.ZodNumber>;
|
|
627
|
+
minClusterSize: z.ZodOptional<z.ZodNumber>;
|
|
628
|
+
minPromotionStack: z.ZodOptional<z.ZodNumber>;
|
|
629
|
+
maxItemsPerRun: z.ZodOptional<z.ZodNumber>;
|
|
630
|
+
maxEvidenceChars: z.ZodOptional<z.ZodNumber>;
|
|
631
|
+
}, z.core.$strip>>;
|
|
632
|
+
evaluation: z.ZodOptional<z.ZodObject<{
|
|
633
|
+
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
634
|
+
windowHours: z.ZodOptional<z.ZodNumber>;
|
|
635
|
+
minAppliesForActive: z.ZodOptional<z.ZodNumber>;
|
|
636
|
+
contestRate: z.ZodOptional<z.ZodNumber>;
|
|
637
|
+
counterevidenceWeight: z.ZodOptional<z.ZodNumber>;
|
|
638
|
+
strengthenMinApplies: z.ZodOptional<z.ZodNumber>;
|
|
639
|
+
}, z.core.$strip>>;
|
|
640
|
+
injection: z.ZodOptional<z.ZodObject<{
|
|
641
|
+
coreMaxItems: z.ZodOptional<z.ZodNumber>;
|
|
642
|
+
coreMaxTokens: z.ZodOptional<z.ZodNumber>;
|
|
643
|
+
scenarioMaxItems: z.ZodOptional<z.ZodNumber>;
|
|
644
|
+
trialVisible: z.ZodOptional<z.ZodBoolean>;
|
|
645
|
+
}, z.core.$strip>>;
|
|
646
|
+
govern: z.ZodOptional<z.ZodObject<{
|
|
647
|
+
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
648
|
+
zeroApplyIdleMs: z.ZodOptional<z.ZodNumber>;
|
|
649
|
+
priorityDecayStep: z.ZodOptional<z.ZodNumber>;
|
|
650
|
+
priorityFloor: z.ZodOptional<z.ZodNumber>;
|
|
651
|
+
}, z.core.$strip>>;
|
|
652
|
+
}, z.core.$strip>>;
|
|
569
653
|
security: z.ZodOptional<z.ZodObject<{
|
|
570
654
|
enforce: z.ZodOptional<z.ZodEnum<{
|
|
571
655
|
block: "block";
|
|
@@ -8,7 +8,7 @@ import { AgentConfigSchema, ChannelConfigSchema, PluginConfigSchema } from './ag
|
|
|
8
8
|
import { ModelsConfigSchema } from './models.js';
|
|
9
9
|
import { AgentRuntimeJsonConfigSchema, BudgetPolicyJsonConfigSchema, ConcurrencyConfigSchema, RunGuardJsonConfigSchema, } from './run.js';
|
|
10
10
|
import { CompactCapabilityConfigSchema, ConstitutionConfigSchema, ContextAssemblerConfigSchema, ContextEngineConfigSchema, DocumentsConfigSchema, SummaryConfigSchema, } from './context.js';
|
|
11
|
-
import { KnowledgeConfigSchema, MemoryConfigSchema } from './substrate.js';
|
|
11
|
+
import { CognitionConfigSchema, KnowledgeConfigSchema, MemoryConfigSchema, WisdomConfigSchema, } from './substrate.js';
|
|
12
12
|
import { SecurityConfigSchema, SessionAclConfigSchema, SessionConfigSchema, ToolIsolationConfigSchema, } from './governance.js';
|
|
13
13
|
import { ObservabilityConfigSchema, ObserverConfigSchema } from './observability.js';
|
|
14
14
|
import { WebSearchConfigSchema } from './web-search.js';
|
|
@@ -43,6 +43,9 @@ export const engineConfigSchema = z.object({
|
|
|
43
43
|
.optional(),
|
|
44
44
|
constitution: ConstitutionConfigSchema.optional(),
|
|
45
45
|
memory: MemoryConfigSchema.optional(),
|
|
46
|
+
cognition: CognitionConfigSchema.optional(),
|
|
47
|
+
/** Wisdom 判断范式(maxim) */
|
|
48
|
+
wisdom: WisdomConfigSchema.optional(),
|
|
46
49
|
security: SecurityConfigSchema.optional(),
|
|
47
50
|
channels: z.array(ChannelConfigSchema).optional(),
|
|
48
51
|
session: SessionConfigSchema.optional(),
|
|
@@ -196,3 +196,89 @@ export declare const MemoryConfigSchema: z.ZodObject<{
|
|
|
196
196
|
}, z.core.$strip>>;
|
|
197
197
|
}, z.core.$strip>>;
|
|
198
198
|
}, z.core.$strip>;
|
|
199
|
+
/** Cognition 概念图谱(arch/cognition-graph-formation.md) */
|
|
200
|
+
export declare const CognitionConfigSchema: z.ZodObject<{
|
|
201
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
202
|
+
conceptualize: z.ZodOptional<z.ZodObject<{
|
|
203
|
+
onMemoryWrite: z.ZodOptional<z.ZodBoolean>;
|
|
204
|
+
onSessionEnd: z.ZodOptional<z.ZodBoolean>;
|
|
205
|
+
maxNodesPerProposition: z.ZodOptional<z.ZodNumber>;
|
|
206
|
+
maxEdgesPerProposition: z.ZodOptional<z.ZodNumber>;
|
|
207
|
+
}, z.core.$strip>>;
|
|
208
|
+
relations: z.ZodOptional<z.ZodObject<{
|
|
209
|
+
requireCue: z.ZodOptional<z.ZodBoolean>;
|
|
210
|
+
causesMinIndependentMemories: z.ZodOptional<z.ZodNumber>;
|
|
211
|
+
allowCooccurEscalation: z.ZodOptional<z.ZodLiteral<false>>;
|
|
212
|
+
}, z.core.$strip>>;
|
|
213
|
+
identity: z.ZodOptional<z.ZodObject<{
|
|
214
|
+
mergeThreshold: z.ZodOptional<z.ZodNumber>;
|
|
215
|
+
candidateBandLo: z.ZodOptional<z.ZodNumber>;
|
|
216
|
+
candidateBandHi: z.ZodOptional<z.ZodNumber>;
|
|
217
|
+
}, z.core.$strip>>;
|
|
218
|
+
plasticity: z.ZodOptional<z.ZodObject<{
|
|
219
|
+
eta: z.ZodOptional<z.ZodNumber>;
|
|
220
|
+
deltaRetrieval: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
decayPerDay: z.ZodOptional<z.ZodObject<{
|
|
222
|
+
related: z.ZodOptional<z.ZodNumber>;
|
|
223
|
+
causes: z.ZodOptional<z.ZodNumber>;
|
|
224
|
+
part_of: z.ZodOptional<z.ZodNumber>;
|
|
225
|
+
opposes: z.ZodOptional<z.ZodNumber>;
|
|
226
|
+
similar_to: z.ZodOptional<z.ZodNumber>;
|
|
227
|
+
evolves_to: z.ZodOptional<z.ZodNumber>;
|
|
228
|
+
}, z.core.$strip>>;
|
|
229
|
+
}, z.core.$strip>>;
|
|
230
|
+
consolidation: z.ZodOptional<z.ZodObject<{
|
|
231
|
+
debounceMinutes: z.ZodOptional<z.ZodNumber>;
|
|
232
|
+
ttlHours: z.ZodOptional<z.ZodNumber>;
|
|
233
|
+
}, z.core.$strip>>;
|
|
234
|
+
capacity: z.ZodOptional<z.ZodObject<{
|
|
235
|
+
warnNodes: z.ZodOptional<z.ZodNumber>;
|
|
236
|
+
warnEdges: z.ZodOptional<z.ZodNumber>;
|
|
237
|
+
stopNodes: z.ZodOptional<z.ZodNumber>;
|
|
238
|
+
stopEdges: z.ZodOptional<z.ZodNumber>;
|
|
239
|
+
}, z.core.$strip>>;
|
|
240
|
+
retrieval: z.ZodOptional<z.ZodObject<{
|
|
241
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
242
|
+
delta: z.ZodOptional<z.ZodNumber>;
|
|
243
|
+
tau: z.ZodOptional<z.ZodNumber>;
|
|
244
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
245
|
+
}, z.core.$strip>>;
|
|
246
|
+
}, z.core.$strip>;
|
|
247
|
+
/** Wisdom 判断范式(arch/wisdom-layer-formation.md) */
|
|
248
|
+
export declare const WisdomConfigSchema: z.ZodObject<{
|
|
249
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
250
|
+
capacity: z.ZodOptional<z.ZodObject<{
|
|
251
|
+
softCap: z.ZodOptional<z.ZodNumber>;
|
|
252
|
+
hardCap: z.ZodOptional<z.ZodNumber>;
|
|
253
|
+
}, z.core.$strip>>;
|
|
254
|
+
formation: z.ZodOptional<z.ZodObject<{
|
|
255
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
256
|
+
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
257
|
+
ttlHours: z.ZodOptional<z.ZodNumber>;
|
|
258
|
+
minMemorySupport: z.ZodOptional<z.ZodNumber>;
|
|
259
|
+
minClusterSize: z.ZodOptional<z.ZodNumber>;
|
|
260
|
+
minPromotionStack: z.ZodOptional<z.ZodNumber>;
|
|
261
|
+
maxItemsPerRun: z.ZodOptional<z.ZodNumber>;
|
|
262
|
+
maxEvidenceChars: z.ZodOptional<z.ZodNumber>;
|
|
263
|
+
}, z.core.$strip>>;
|
|
264
|
+
evaluation: z.ZodOptional<z.ZodObject<{
|
|
265
|
+
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
266
|
+
windowHours: z.ZodOptional<z.ZodNumber>;
|
|
267
|
+
minAppliesForActive: z.ZodOptional<z.ZodNumber>;
|
|
268
|
+
contestRate: z.ZodOptional<z.ZodNumber>;
|
|
269
|
+
counterevidenceWeight: z.ZodOptional<z.ZodNumber>;
|
|
270
|
+
strengthenMinApplies: z.ZodOptional<z.ZodNumber>;
|
|
271
|
+
}, z.core.$strip>>;
|
|
272
|
+
injection: z.ZodOptional<z.ZodObject<{
|
|
273
|
+
coreMaxItems: z.ZodOptional<z.ZodNumber>;
|
|
274
|
+
coreMaxTokens: z.ZodOptional<z.ZodNumber>;
|
|
275
|
+
scenarioMaxItems: z.ZodOptional<z.ZodNumber>;
|
|
276
|
+
trialVisible: z.ZodOptional<z.ZodBoolean>;
|
|
277
|
+
}, z.core.$strip>>;
|
|
278
|
+
govern: z.ZodOptional<z.ZodObject<{
|
|
279
|
+
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
280
|
+
zeroApplyIdleMs: z.ZodOptional<z.ZodNumber>;
|
|
281
|
+
priorityDecayStep: z.ZodOptional<z.ZodNumber>;
|
|
282
|
+
priorityFloor: z.ZodOptional<z.ZodNumber>;
|
|
283
|
+
}, z.core.$strip>>;
|
|
284
|
+
}, z.core.$strip>;
|
|
@@ -247,3 +247,117 @@ export const MemoryConfigSchema = z.object({
|
|
|
247
247
|
})
|
|
248
248
|
.optional(),
|
|
249
249
|
});
|
|
250
|
+
/** Cognition 概念图谱(arch/cognition-graph-formation.md) */
|
|
251
|
+
export const CognitionConfigSchema = z.object({
|
|
252
|
+
enabled: z.boolean().optional(),
|
|
253
|
+
conceptualize: z
|
|
254
|
+
.object({
|
|
255
|
+
onMemoryWrite: z.boolean().optional(),
|
|
256
|
+
onSessionEnd: z.boolean().optional(),
|
|
257
|
+
maxNodesPerProposition: z.number().int().positive().max(20).optional(),
|
|
258
|
+
maxEdgesPerProposition: z.number().int().positive().max(40).optional(),
|
|
259
|
+
})
|
|
260
|
+
.optional(),
|
|
261
|
+
relations: z
|
|
262
|
+
.object({
|
|
263
|
+
requireCue: z.boolean().optional(),
|
|
264
|
+
causesMinIndependentMemories: z.number().int().positive().min(1).max(10).optional(),
|
|
265
|
+
allowCooccurEscalation: z.literal(false).optional(),
|
|
266
|
+
})
|
|
267
|
+
.optional(),
|
|
268
|
+
identity: z
|
|
269
|
+
.object({
|
|
270
|
+
mergeThreshold: z.number().min(0).max(1).optional(),
|
|
271
|
+
candidateBandLo: z.number().min(0).max(1).optional(),
|
|
272
|
+
candidateBandHi: z.number().min(0).max(1).optional(),
|
|
273
|
+
})
|
|
274
|
+
.optional(),
|
|
275
|
+
plasticity: z
|
|
276
|
+
.object({
|
|
277
|
+
eta: z.number().gt(0).lt(1).optional(),
|
|
278
|
+
deltaRetrieval: z.number().gt(0).lt(1).optional(),
|
|
279
|
+
decayPerDay: z
|
|
280
|
+
.object({
|
|
281
|
+
related: z.number().min(0).lt(1).optional(),
|
|
282
|
+
causes: z.number().min(0).lt(1).optional(),
|
|
283
|
+
part_of: z.number().min(0).lt(1).optional(),
|
|
284
|
+
opposes: z.number().min(0).lt(1).optional(),
|
|
285
|
+
similar_to: z.number().min(0).lt(1).optional(),
|
|
286
|
+
evolves_to: z.number().min(0).lt(1).optional(),
|
|
287
|
+
})
|
|
288
|
+
.optional(),
|
|
289
|
+
})
|
|
290
|
+
.optional(),
|
|
291
|
+
consolidation: z
|
|
292
|
+
.object({
|
|
293
|
+
debounceMinutes: z.number().int().nonnegative().optional(),
|
|
294
|
+
ttlHours: z.number().int().positive().optional(),
|
|
295
|
+
})
|
|
296
|
+
.optional(),
|
|
297
|
+
capacity: z
|
|
298
|
+
.object({
|
|
299
|
+
warnNodes: z.number().int().positive().optional(),
|
|
300
|
+
warnEdges: z.number().int().positive().optional(),
|
|
301
|
+
stopNodes: z.number().int().positive().optional(),
|
|
302
|
+
stopEdges: z.number().int().positive().optional(),
|
|
303
|
+
})
|
|
304
|
+
.optional(),
|
|
305
|
+
retrieval: z
|
|
306
|
+
.object({
|
|
307
|
+
depth: z.number().int().positive().max(5).optional(),
|
|
308
|
+
delta: z.number().gt(0).lt(1).optional(),
|
|
309
|
+
tau: z.number().min(0).max(1).optional(),
|
|
310
|
+
limit: z.number().int().positive().max(100).optional(),
|
|
311
|
+
})
|
|
312
|
+
.optional(),
|
|
313
|
+
});
|
|
314
|
+
/** Wisdom 判断范式(arch/wisdom-layer-formation.md) */
|
|
315
|
+
export const WisdomConfigSchema = z.object({
|
|
316
|
+
enabled: z.boolean().optional(),
|
|
317
|
+
capacity: z
|
|
318
|
+
.object({
|
|
319
|
+
/** 存活面软顶(govern 淘汰);默认 50 */
|
|
320
|
+
softCap: z.number().int().positive().optional(),
|
|
321
|
+
/** admit 硬顶;默认 80 */
|
|
322
|
+
hardCap: z.number().int().positive().optional(),
|
|
323
|
+
})
|
|
324
|
+
.optional(),
|
|
325
|
+
formation: z
|
|
326
|
+
.object({
|
|
327
|
+
enabled: z.boolean().optional(),
|
|
328
|
+
dryRun: z.boolean().optional(),
|
|
329
|
+
ttlHours: z.number().int().positive().optional(),
|
|
330
|
+
minMemorySupport: z.number().int().positive().min(1).max(10).optional(),
|
|
331
|
+
minClusterSize: z.number().int().positive().min(2).max(50).optional(),
|
|
332
|
+
minPromotionStack: z.number().int().positive().min(1).max(20).optional(),
|
|
333
|
+
maxItemsPerRun: z.number().int().positive().max(10).optional(),
|
|
334
|
+
maxEvidenceChars: z.number().int().positive().optional(),
|
|
335
|
+
})
|
|
336
|
+
.optional(),
|
|
337
|
+
evaluation: z
|
|
338
|
+
.object({
|
|
339
|
+
dryRun: z.boolean().optional(),
|
|
340
|
+
windowHours: z.number().int().positive().optional(),
|
|
341
|
+
minAppliesForActive: z.number().int().positive().optional(),
|
|
342
|
+
contestRate: z.number().min(0).max(1).optional(),
|
|
343
|
+
counterevidenceWeight: z.number().positive().optional(),
|
|
344
|
+
strengthenMinApplies: z.number().int().positive().optional(),
|
|
345
|
+
})
|
|
346
|
+
.optional(),
|
|
347
|
+
injection: z
|
|
348
|
+
.object({
|
|
349
|
+
coreMaxItems: z.number().int().positive().max(32).optional(),
|
|
350
|
+
coreMaxTokens: z.number().int().positive().optional(),
|
|
351
|
+
scenarioMaxItems: z.number().int().positive().max(32).optional(),
|
|
352
|
+
trialVisible: z.boolean().optional(),
|
|
353
|
+
})
|
|
354
|
+
.optional(),
|
|
355
|
+
govern: z
|
|
356
|
+
.object({
|
|
357
|
+
dryRun: z.boolean().optional(),
|
|
358
|
+
zeroApplyIdleMs: z.number().int().positive().optional(),
|
|
359
|
+
priorityDecayStep: z.number().int().positive().optional(),
|
|
360
|
+
priorityFloor: z.number().int().nonnegative().optional(),
|
|
361
|
+
})
|
|
362
|
+
.optional(),
|
|
363
|
+
});
|
package/dist/config.d.ts
CHANGED
|
@@ -773,6 +773,77 @@ export interface HarnessConfig {
|
|
|
773
773
|
maxLength?: Partial<Record<'fact' | 'method' | 'norm', number>>;
|
|
774
774
|
};
|
|
775
775
|
};
|
|
776
|
+
/** Cognition 概念图谱(arch/cognition-graph-formation.md) */
|
|
777
|
+
cognition?: {
|
|
778
|
+
enabled?: boolean;
|
|
779
|
+
conceptualize?: {
|
|
780
|
+
onMemoryWrite?: boolean;
|
|
781
|
+
maxNodesPerProposition?: number;
|
|
782
|
+
maxEdgesPerProposition?: number;
|
|
783
|
+
};
|
|
784
|
+
relations?: {
|
|
785
|
+
requireCue?: boolean;
|
|
786
|
+
causesMinIndependentMemories?: number;
|
|
787
|
+
};
|
|
788
|
+
identity?: {
|
|
789
|
+
mergeThreshold?: number;
|
|
790
|
+
candidateBandHi?: number;
|
|
791
|
+
};
|
|
792
|
+
capacity?: {
|
|
793
|
+
warnNodes?: number;
|
|
794
|
+
warnEdges?: number;
|
|
795
|
+
stopNodes?: number;
|
|
796
|
+
stopEdges?: number;
|
|
797
|
+
};
|
|
798
|
+
retrieval?: {
|
|
799
|
+
depth?: number;
|
|
800
|
+
delta?: number;
|
|
801
|
+
tau?: number;
|
|
802
|
+
limit?: number;
|
|
803
|
+
};
|
|
804
|
+
consolidation?: {
|
|
805
|
+
debounceMinutes?: number;
|
|
806
|
+
ttlHours?: number;
|
|
807
|
+
};
|
|
808
|
+
};
|
|
809
|
+
/** Wisdom 判断范式(arch/wisdom-layer-formation.md) */
|
|
810
|
+
wisdom?: {
|
|
811
|
+
enabled?: boolean;
|
|
812
|
+
capacity?: {
|
|
813
|
+
softCap?: number;
|
|
814
|
+
hardCap?: number;
|
|
815
|
+
};
|
|
816
|
+
formation?: {
|
|
817
|
+
enabled?: boolean;
|
|
818
|
+
dryRun?: boolean;
|
|
819
|
+
ttlHours?: number;
|
|
820
|
+
minMemorySupport?: number;
|
|
821
|
+
minClusterSize?: number;
|
|
822
|
+
minPromotionStack?: number;
|
|
823
|
+
maxItemsPerRun?: number;
|
|
824
|
+
maxEvidenceChars?: number;
|
|
825
|
+
};
|
|
826
|
+
evaluation?: {
|
|
827
|
+
dryRun?: boolean;
|
|
828
|
+
windowHours?: number;
|
|
829
|
+
minAppliesForActive?: number;
|
|
830
|
+
contestRate?: number;
|
|
831
|
+
counterevidenceWeight?: number;
|
|
832
|
+
strengthenMinApplies?: number;
|
|
833
|
+
};
|
|
834
|
+
injection?: {
|
|
835
|
+
coreMaxItems?: number;
|
|
836
|
+
coreMaxTokens?: number;
|
|
837
|
+
scenarioMaxItems?: number;
|
|
838
|
+
trialVisible?: boolean;
|
|
839
|
+
};
|
|
840
|
+
govern?: {
|
|
841
|
+
dryRun?: boolean;
|
|
842
|
+
zeroApplyIdleMs?: number;
|
|
843
|
+
priorityDecayStep?: number;
|
|
844
|
+
priorityFloor?: number;
|
|
845
|
+
};
|
|
846
|
+
};
|
|
776
847
|
/** Knowledge 检索/召回(全局缺省;agents[].knowledge.recall 可覆盖) */
|
|
777
848
|
knowledge?: KnowledgeRuntimeConfig;
|
|
778
849
|
/**
|
|
@@ -303,7 +303,7 @@ export declare class AgentBuilder {
|
|
|
303
303
|
}): this;
|
|
304
304
|
/** 注入 WisdomStore(半静态思维范式,进 system prompt WisdomLayer) */
|
|
305
305
|
wisdomStore(store: import('../memory/types.js').WisdomStore): this;
|
|
306
|
-
/** 注入 ConceptGraphStore
|
|
306
|
+
/** 注入 ConceptGraphStore(spreadingActivate 召回概念子图,进 system prompt CognitionLayer) */
|
|
307
307
|
cognitionStore(store: import('../memory/types.js').ConceptGraphStore): this;
|
|
308
308
|
/**
|
|
309
309
|
* system prompt 装配器调参
|
|
@@ -538,7 +538,7 @@ export class AgentBuilder {
|
|
|
538
538
|
this._wisdomStore = store;
|
|
539
539
|
return this;
|
|
540
540
|
}
|
|
541
|
-
/** 注入 ConceptGraphStore
|
|
541
|
+
/** 注入 ConceptGraphStore(spreadingActivate 召回概念子图,进 system prompt CognitionLayer) */
|
|
542
542
|
cognitionStore(store) {
|
|
543
543
|
this._cognitionStore = store;
|
|
544
544
|
return this;
|
|
@@ -785,6 +785,25 @@ export class AgentBuilder {
|
|
|
785
785
|
gates: memCfg?.gates?.maxLength
|
|
786
786
|
? { maxLength: memCfg.gates.maxLength }
|
|
787
787
|
: undefined,
|
|
788
|
+
onStored: this._cognitionStore && events
|
|
789
|
+
? (info) => {
|
|
790
|
+
void import('../memory/cognition-trigger.js')
|
|
791
|
+
.then(({ emitConceptualizeRequest }) => {
|
|
792
|
+
emitConceptualizeRequest(events, {
|
|
793
|
+
memoryId: info.id,
|
|
794
|
+
proposition: info.proposition,
|
|
795
|
+
evidence: info.evidence,
|
|
796
|
+
memoryType: info.type,
|
|
797
|
+
memoryStatus: info.status,
|
|
798
|
+
channel: info.channel,
|
|
799
|
+
sessionId: info.sessionId,
|
|
800
|
+
});
|
|
801
|
+
})
|
|
802
|
+
.catch(() => {
|
|
803
|
+
// 动态加载失败不阻断 memory 写
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
: undefined,
|
|
788
807
|
})) {
|
|
789
808
|
this._toolBus.register(tool);
|
|
790
809
|
}
|
|
@@ -974,10 +993,16 @@ export class AgentBuilder {
|
|
|
974
993
|
tryRegister(spec);
|
|
975
994
|
}
|
|
976
995
|
}
|
|
977
|
-
// 依赖注入:memoryStore / sessionStore / constitution / backfillCoverage
|
|
996
|
+
// 依赖注入:memoryStore / wisdomStore / conceptGraphStore / sessionStore / constitution / backfillCoverage
|
|
978
997
|
if (this._memoryStore) {
|
|
979
998
|
subsystemRuntime.registerDependency('memoryStore', this._memoryStore);
|
|
980
999
|
}
|
|
1000
|
+
if (this._wisdomStore) {
|
|
1001
|
+
subsystemRuntime.registerDependency('wisdomStore', this._wisdomStore);
|
|
1002
|
+
}
|
|
1003
|
+
if (this._cognitionStore) {
|
|
1004
|
+
subsystemRuntime.registerDependency('conceptGraphStore', this._cognitionStore);
|
|
1005
|
+
}
|
|
981
1006
|
{
|
|
982
1007
|
const { InMemoryBackfillCoverageStore } = await import('../memory/backfill-coverage.js');
|
|
983
1008
|
let coverage = this._backfillCoverage;
|
|
@@ -196,6 +196,8 @@ export async function buildFromConfig(config) {
|
|
|
196
196
|
contextAssemblerConfig,
|
|
197
197
|
constitutionConfig,
|
|
198
198
|
memoryConfig: config.memory,
|
|
199
|
+
cognitionConfig: config.cognition,
|
|
200
|
+
wisdomConfig: config.wisdom,
|
|
199
201
|
flatModels,
|
|
200
202
|
levelMap: config.levelMap,
|
|
201
203
|
modelsConfig: config.models,
|
|
@@ -294,10 +296,21 @@ async function buildAgent(agentConfig, shared) {
|
|
|
294
296
|
similarityWeight: shared.memoryConfig?.retrieval?.similarityWeight,
|
|
295
297
|
minKeywordScore: shared.memoryConfig?.retrieval?.minKeywordScore,
|
|
296
298
|
}));
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
299
|
+
const wis = shared.wisdomConfig;
|
|
300
|
+
if (wis?.enabled !== false) {
|
|
301
|
+
builder.wisdomStore(new SqliteWisdomStore(db, { hardCap: wis?.capacity?.hardCap }));
|
|
302
|
+
}
|
|
303
|
+
const cog = shared.cognitionConfig;
|
|
304
|
+
if (cog?.enabled !== false) {
|
|
305
|
+
builder.cognitionStore(new SqliteConceptGraph(db, {
|
|
306
|
+
embeddingProvider: embRuntime?.provider ?? null,
|
|
307
|
+
mergeThreshold: cog?.identity?.mergeThreshold,
|
|
308
|
+
candidateBandHi: cog?.identity?.candidateBandHi,
|
|
309
|
+
stopNodes: cog?.capacity?.stopNodes,
|
|
310
|
+
stopEdges: cog?.capacity?.stopEdges,
|
|
311
|
+
causesMinIndependentMemories: cog?.relations?.causesMinIndependentMemories,
|
|
312
|
+
}));
|
|
313
|
+
}
|
|
301
314
|
// Knowledge catalog / 索引归独立 Knowledge 服务(arch/knowledge-layer.md);P1 前不挂
|
|
302
315
|
}
|
|
303
316
|
catch (err) {
|
|
@@ -38,7 +38,7 @@ export function createDefaultSummaryPolicies() {
|
|
|
38
38
|
],
|
|
39
39
|
},
|
|
40
40
|
preserve: ['full URLs', 'error codes', 'version numbers', 'prices and dates'],
|
|
41
|
-
budget: { maxInputTokens: 24000, maxOutputTokens:
|
|
41
|
+
budget: { maxInputTokens: 24000, maxOutputTokens: 6000 },
|
|
42
42
|
output: 'text',
|
|
43
43
|
oversized: DEFAULT_OVERSIZE,
|
|
44
44
|
},
|
|
@@ -62,7 +62,7 @@ export function createDefaultSummaryPolicies() {
|
|
|
62
62
|
exclude: ['Boilerplate repeats'],
|
|
63
63
|
},
|
|
64
64
|
preserve: ['paths', 'config keys', 'literal values'],
|
|
65
|
-
budget: { maxInputTokens: 20000, maxOutputTokens:
|
|
65
|
+
budget: { maxInputTokens: 20000, maxOutputTokens: 5400 },
|
|
66
66
|
output: 'text',
|
|
67
67
|
oversized: DEFAULT_OVERSIZE,
|
|
68
68
|
},
|
|
@@ -74,7 +74,7 @@ export function createDefaultSummaryPolicies() {
|
|
|
74
74
|
exclude: ['Full source paste', 'Generated noise'],
|
|
75
75
|
},
|
|
76
76
|
preserve: ['export names', 'file paths', 'error strings'],
|
|
77
|
-
budget: { maxInputTokens: 20000, maxOutputTokens:
|
|
77
|
+
budget: { maxInputTokens: 20000, maxOutputTokens: 4800 },
|
|
78
78
|
output: 'text',
|
|
79
79
|
oversized: DEFAULT_OVERSIZE,
|
|
80
80
|
},
|
|
@@ -86,7 +86,7 @@ export function createDefaultSummaryPolicies() {
|
|
|
86
86
|
exclude: ['Marketing fluff'],
|
|
87
87
|
},
|
|
88
88
|
preserve: ['procedure order', 'exact option names'],
|
|
89
|
-
budget: { maxInputTokens: 20000, maxOutputTokens:
|
|
89
|
+
budget: { maxInputTokens: 20000, maxOutputTokens: 5400 },
|
|
90
90
|
output: 'text',
|
|
91
91
|
oversized: DEFAULT_OVERSIZE,
|
|
92
92
|
},
|
|
@@ -98,7 +98,7 @@ export function createDefaultSummaryPolicies() {
|
|
|
98
98
|
exclude: ['Repetitive healthy heartbeats unless asked'],
|
|
99
99
|
},
|
|
100
100
|
preserve: ['error codes', 'timestamps', 'request ids'],
|
|
101
|
-
budget: { maxInputTokens: 16000, maxOutputTokens:
|
|
101
|
+
budget: { maxInputTokens: 16000, maxOutputTokens: 4200 },
|
|
102
102
|
output: 'text',
|
|
103
103
|
oversized: TOOL_WINDOW_OVERSIZE,
|
|
104
104
|
},
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module harness/context/capabilities/summary/registry
|
|
5
5
|
*/
|
|
6
|
-
/** 文件扩展名 → ContentKind
|
|
6
|
+
/** 文件扩展名 → ContentKind(声明式路由,非正文抽取;code 优先走 CODE_EXTS) */
|
|
7
7
|
const EXT_KIND = {
|
|
8
8
|
'.md': 'file_text',
|
|
9
9
|
'.markdown': 'file_text',
|
|
@@ -11,31 +11,36 @@ const EXT_KIND = {
|
|
|
11
11
|
'.log': 'log',
|
|
12
12
|
'.html': 'web_page',
|
|
13
13
|
'.htm': 'web_page',
|
|
14
|
-
'.json': 'api_json',
|
|
15
|
-
'.ts': 'code',
|
|
16
|
-
'.tsx': 'code',
|
|
17
|
-
'.js': 'code',
|
|
18
|
-
'.jsx': 'code',
|
|
19
|
-
'.mjs': 'code',
|
|
20
|
-
'.cjs': 'code',
|
|
21
|
-
'.py': 'code',
|
|
22
|
-
'.go': 'code',
|
|
23
|
-
'.rs': 'code',
|
|
24
|
-
'.java': 'code',
|
|
25
|
-
'.kt': 'code',
|
|
26
|
-
'.c': 'code',
|
|
27
|
-
'.h': 'code',
|
|
28
|
-
'.cpp': 'code',
|
|
29
|
-
'.css': 'code',
|
|
30
|
-
'.yml': 'file_text',
|
|
31
|
-
'.yaml': 'file_text',
|
|
32
|
-
'.toml': 'file_text',
|
|
33
|
-
'.xml': 'file_text',
|
|
34
14
|
'.csv': 'file_text',
|
|
35
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* 可编辑源码/配置/结构化源:kind=code。
|
|
18
|
+
* 含语言、样式、脚本、配置序列化、IDL/构建——agent 通常需要可编辑原文,不走 L2 摘要。
|
|
19
|
+
*/
|
|
36
20
|
const CODE_EXTS = new Set([
|
|
37
|
-
|
|
38
|
-
'.
|
|
21
|
+
// languages
|
|
22
|
+
'.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs',
|
|
23
|
+
'.py', '.pyi', '.pyw',
|
|
24
|
+
'.go', '.rs', '.java', '.kt', '.kts',
|
|
25
|
+
'.c', '.h', '.cc', '.cpp', '.cxx', '.hpp', '.hh', '.hxx',
|
|
26
|
+
'.cs', '.fs', '.fsx', '.vb',
|
|
27
|
+
'.swift', '.scala', '.lua', '.php', '.rb', '.r', '.dart',
|
|
28
|
+
'.pl', '.pm', '.ex', '.exs', '.erl', '.hrl', '.hs',
|
|
29
|
+
'.clj', '.cljs', '.cljc', '.edn',
|
|
30
|
+
'.zig', '.nim', '.cr', '.jl', '.groovy', '.gradle',
|
|
31
|
+
'.vue', '.svelte', '.astro',
|
|
32
|
+
// styles
|
|
33
|
+
'.css', '.scss', '.sass', '.less', '.styl',
|
|
34
|
+
// shell / scripts
|
|
35
|
+
'.sh', '.bash', '.zsh', '.ksh', '.fish', '.ps1', '.bat', '.cmd', '.awk',
|
|
36
|
+
// config / structured source
|
|
37
|
+
'.json', '.jsonl', '.ndjson', '.json5', '.jsonc',
|
|
38
|
+
'.yml', '.yaml', '.toml', '.xml', '.plist',
|
|
39
|
+
'.ini', '.cfg', '.conf', '.config', '.properties',
|
|
40
|
+
'.tf', '.tfvars', '.hcl',
|
|
41
|
+
'.proto', '.thrift', '.graphql', '.gql', '.avsc', '.avdl',
|
|
42
|
+
// build / query
|
|
43
|
+
'.sql', '.cmake', '.mk', '.bazel', '.bzl', '.ninja',
|
|
39
44
|
]);
|
|
40
45
|
/**
|
|
41
46
|
* 从 MIME 推断 ContentKind
|
|
@@ -129,7 +134,7 @@ export function createDefaultToolBindings() {
|
|
|
129
134
|
file_read: {
|
|
130
135
|
tool: 'file_read',
|
|
131
136
|
mode: 'kind_sensitive',
|
|
132
|
-
maxReturnChars:
|
|
137
|
+
maxReturnChars: 36000,
|
|
133
138
|
kindFromSource: true,
|
|
134
139
|
// code 默认不 L2,保护「需要可编辑原文」的场景
|
|
135
140
|
informationalKinds: ['document', 'log', 'file_text', 'web_page'],
|
|
@@ -96,8 +96,9 @@ export async function probeContextLayerHealth(deps) {
|
|
|
96
96
|
let wisdomEntries;
|
|
97
97
|
if (deps.wisdomStore) {
|
|
98
98
|
try {
|
|
99
|
-
const
|
|
100
|
-
|
|
99
|
+
const stats = await deps.wisdomStore.stats();
|
|
100
|
+
// 未退役条目(含 trial/contested);不是注入命中数
|
|
101
|
+
wisdomEntries = stats.total - (stats.byStatus.retired ?? 0) - (stats.byStatus.superseded ?? 0);
|
|
101
102
|
summary.wisdom = wisdomEntries;
|
|
102
103
|
}
|
|
103
104
|
catch {
|