@mrc2204/agent-smart-memo 5.1.2 → 5.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.
@@ -120,6 +120,10 @@ export class DefaultMemoryUseCasePort {
120
120
  return this.handleProjectFeaturePackQuery(payload, req);
121
121
  case "project.developer_query":
122
122
  return this.handleProjectDeveloperQuery(payload, req);
123
+ case "project.routing_contract":
124
+ return this.handleProjectRoutingContract(payload, req);
125
+ case "project.coding_packet":
126
+ return this.handleProjectCodingPacket(payload, req);
123
127
  case "graph.entity.get":
124
128
  return this.handleGraphEntityGet(payload, req);
125
129
  case "graph.entity.set":
@@ -423,6 +427,99 @@ export class DefaultMemoryUseCasePort {
423
427
  errors: [],
424
428
  };
425
429
  }
430
+ normalizeWorkstreamType(raw) {
431
+ const normalized = String(raw || "").trim().toLowerCase();
432
+ if (normalized === "research_execution" || normalized === "coding_execution" || normalized === "review_execution") {
433
+ return normalized;
434
+ }
435
+ return "coding_execution";
436
+ }
437
+ handleProjectRoutingContract(payload, req) {
438
+ const identity = normalizePrivateIdentity(req.context);
439
+ const project = this.resolveProjectRef(identity.userId, identity.agentId, {
440
+ project_id: payload.project_id,
441
+ project_alias: payload.project_alias,
442
+ });
443
+ const workstreamType = this.normalizeWorkstreamType(payload.workstream_type);
444
+ const reasonByWorkstream = {
445
+ coding_execution: "OpenClaw orchestrates and routes coding execution to OpenCode lane foundation.",
446
+ research_execution: "Research execution keeps OpenCode lane ready through project/code-aware retrieval foundation.",
447
+ review_execution: "Review execution can reuse OpenCode coding lane foundation with project-aware packet context.",
448
+ };
449
+ return {
450
+ routing_contract_version: "asm-routing-v1",
451
+ workstream_type: workstreamType,
452
+ project_id: project.project_id,
453
+ project_alias: payload.project_alias || null,
454
+ route_target: {
455
+ lane: "opencode",
456
+ mode: "foundation",
457
+ reason: reasonByWorkstream[workstreamType],
458
+ },
459
+ retrieval_profile: {
460
+ project_aware: true,
461
+ code_aware: true,
462
+ primary_usecase: "project.developer_query",
463
+ },
464
+ generated_at: new Date().toISOString(),
465
+ };
466
+ }
467
+ handleProjectCodingPacket(payload, req) {
468
+ const routing = this.handleProjectRoutingContract({
469
+ project_id: payload.project_id,
470
+ project_alias: payload.project_alias,
471
+ query: payload.query,
472
+ objective: payload.objective,
473
+ workstream_type: "coding_execution",
474
+ }, req);
475
+ const query = String(payload.query || payload.objective || payload.task_title || "").trim();
476
+ const objective = String(payload.objective || payload.query || "").trim() || "Implement requested coding change with project-aware/code-aware context.";
477
+ const developerQuery = this.handleProjectDeveloperQuery({
478
+ project_id: routing.project_id,
479
+ project_alias: routing.project_alias || undefined,
480
+ query,
481
+ task_id: payload.task_id,
482
+ tracker_issue_key: payload.tracker_issue_key,
483
+ task_title: payload.task_title,
484
+ symbol_name: payload.symbol_name,
485
+ relative_path: payload.relative_path,
486
+ route_path: payload.route_path,
487
+ limit: payload.limit,
488
+ }, req);
489
+ const primaryFiles = developerQuery.files.slice(0, 12);
490
+ const primarySymbols = developerQuery.symbols.slice(0, 16);
491
+ return {
492
+ packet_version: "asm-coding-packet-v1",
493
+ routing,
494
+ objective,
495
+ project: {
496
+ project_id: routing.project_id,
497
+ project_alias: routing.project_alias,
498
+ },
499
+ selectors: {
500
+ ...(payload.task_id ? { task_id: payload.task_id } : {}),
501
+ ...(payload.tracker_issue_key ? { tracker_issue_key: payload.tracker_issue_key } : {}),
502
+ ...(payload.task_title ? { task_title: payload.task_title } : {}),
503
+ ...(payload.symbol_name ? { symbol_name: payload.symbol_name } : {}),
504
+ ...(payload.relative_path ? { relative_path: payload.relative_path } : {}),
505
+ ...(payload.route_path ? { route_path: payload.route_path } : {}),
506
+ },
507
+ context: {
508
+ developer_query: developerQuery,
509
+ primary_files: primaryFiles,
510
+ primary_symbols: primarySymbols,
511
+ change_context: developerQuery.change_context,
512
+ },
513
+ execution_hints: {
514
+ acceptance_criteria: payload.acceptance_criteria || [],
515
+ constraints: payload.constraints || [],
516
+ out_of_scope: payload.out_of_scope || [],
517
+ validation_commands: payload.validation_commands || [],
518
+ handoff_language: "vi",
519
+ },
520
+ generated_at: new Date().toISOString(),
521
+ };
522
+ }
426
523
  handleProjectSetRegistrationState(payload, req) {
427
524
  const identity = normalizePrivateIdentity(req.context);
428
525
  if (!payload.project_id) {