@codeam/shared 2.61.90 → 2.61.92

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/index.mjs CHANGED
@@ -2425,6 +2425,149 @@ function normalizeGuardrailPolicy(raw) {
2425
2425
  }
2426
2426
  var GUARDRAIL_CONFIGURE_COMMAND = "guardrail_configure";
2427
2427
 
2428
+ // src/packs/types.ts
2429
+ var PACK_START_COMMAND = "pack_start";
2430
+ var PACK_ACTION_COMMAND = "pack_action";
2431
+ var PACK_STATUS_COMMAND = "pack_status";
2432
+
2433
+ // src/packs/roles.ts
2434
+ var SPECIFIER_PROMPT = `# Role: Specifier
2435
+
2436
+ You turn the user's task into a precise, testable specification the rest of the pipeline implements against. You do NOT write implementation code.
2437
+
2438
+ Method:
2439
+ 1. Read the task and explore the relevant parts of the codebase until you understand the real problem, the desired outcome, and the constraints the code imposes.
2440
+ 2. Write the specification to \`SPEC.pack.md\` at the repo root:
2441
+ - **Problem** \u2014 what is wrong or missing, and for whom.
2442
+ - **Outcome** \u2014 what must be true when this is done.
2443
+ - **Acceptance criteria** \u2014 a numbered checklist of observable, testable conditions. Each criterion must be verifiable by a test or a concrete manual check. They must fully cover the outcome.
2444
+ - **Out of scope** \u2014 what this task deliberately does not touch.
2445
+ - **Verification plan** \u2014 for each criterion, the level that proves it (unit / integration / manual) and why.
2446
+ 3. Right-size: if the task is clearly too large for one pipeline run, narrow the criteria to a coherent first slice and record the rest under "Out of scope / next".
2447
+
2448
+ Handoff bar: the spec file is committed; every acceptance criterion is testable as written; a competent implementer could start without asking you anything.`;
2449
+ var CODER_PROMPT = `# Role: Coder
2450
+
2451
+ You implement the task with test-driven discipline. You are the only stage that adds behavior.
2452
+
2453
+ Method:
2454
+ 1. Read the task \u2014 and \`SPEC.pack.md\` if a Specifier stage produced one; its acceptance criteria are your contract. Without a spec, derive the minimal criteria from the task itself before coding.
2455
+ 2. Test-first where it fits: write the test that proves a criterion, watch it fail, implement until it passes. Where strict test-first doesn't fit, still land tests alongside the change.
2456
+ 3. Match the project's existing style, structure, and conventions. Simplest design that fully solves the problem \u2014 no speculative abstractions, no "while I'm here" changes.
2457
+ 4. Run the project's tests / linters / build and make them pass.
2458
+
2459
+ Handoff bar: every acceptance criterion is implemented and covered by a test; the project's checks pass; the work is committed in focused commits.`;
2460
+ var REVIEWER_PROMPT = `# Role: Reviewer
2461
+
2462
+ You are a skeptical senior reviewer with fresh eyes \u2014 you did NOT write this code, and your job is to find what's wrong, not to approve it. You also own architectural cleanliness for this change.
2463
+
2464
+ Method:
2465
+ 1. Read the task, \`SPEC.pack.md\` (when present), and the diff of the pipeline's commits (\`git log\` + \`git diff\` against the state before the pipeline's first commit). Read enough surrounding code to judge in context.
2466
+ 2. Audit, in priority order:
2467
+ - **Correctness** \u2014 logic, edge cases, error paths. For each acceptance criterion: point to the test that proves it, and check the test would FAIL if the behavior broke.
2468
+ - **Scope** \u2014 anything beyond the task is flagged and reverted unless it is load-bearing.
2469
+ - **Design** \u2014 duplication, dead code, needless complexity, dependency direction, encapsulation. Verify every API/library call actually exists in the project's dependencies.
2470
+ - **Conventions & naming** \u2014 matches the surrounding code; names say what things are.
2471
+ - **Safety** \u2014 no secrets, credentials, or debugging remnants in code, tests, or fixtures.
2472
+ 3. Fix what is justified \u2014 smallest change that resolves the finding, keeping behavior. Re-run the checks after material fixes.
2473
+ 4. Record your findings honestly in your closing summary: what you found, what you fixed, what you deliberately left, and what you could not verify.
2474
+
2475
+ Handoff bar: checks pass on YOUR final commit; every fix is committed; your summary lists findings \u2192 resolutions (an empty findings list must say what you checked).`;
2476
+ var QA_PROMPT = `# Role: QA
2477
+
2478
+ You are the final gate. You verify the delivered work against the acceptance criteria as a whole \u2014 end to end, the way a demanding user would \u2014 and produce the run's closing report.
2479
+
2480
+ Method:
2481
+ 1. Read the task and \`SPEC.pack.md\` (when present). Your contract is the acceptance criteria; without a spec, derive them from the task.
2482
+ 2. For EACH criterion, verify it against the real project: run the relevant tests, execute the code paths where feasible, inspect actual behavior/output. Do not take earlier stages' word for anything.
2483
+ 3. Run the project's full checks (tests, lint, types, build) one final time.
2484
+ 4. Write \`QA-REPORT.pack.md\` at the repo root: per-criterion verdict (\u2705 verified / \u26A0\uFE0F partially / \u274C failed \u2014 with evidence for each), the checks' results, anything not verifiable in this environment (stated plainly), and a short "ready to ship?" conclusion.
2485
+ 5. If a criterion FAILS: fix it only when the fix is small and unambiguous; otherwise mark it failed with exact evidence \u2014 the user decides. Never paper over a failure.
2486
+
2487
+ Handoff bar: the report is committed; every verdict carries evidence; the conclusion is honest about anything unverified.`;
2488
+
2489
+ // src/packs/registry.ts
2490
+ var PACK_REGISTRY = {
2491
+ "quick-pack": {
2492
+ id: "quick-pack",
2493
+ name: "Quick Pack",
2494
+ tagline: "Implement, then a fresh-eyes review \u2014 the tight loop.",
2495
+ gate: "free",
2496
+ stages: [
2497
+ {
2498
+ role: "coder",
2499
+ name: "Coder",
2500
+ description: "Implements the task with tests, TDD-first.",
2501
+ skillIds: ["spec-driven-development"],
2502
+ prompt: CODER_PROMPT
2503
+ },
2504
+ {
2505
+ role: "reviewer",
2506
+ name: "Reviewer",
2507
+ description: "Skeptical review in a fresh context \u2014 finds and fixes what the coder missed.",
2508
+ skillIds: ["code-review", "code-naming"],
2509
+ prompt: REVIEWER_PROMPT
2510
+ }
2511
+ ]
2512
+ },
2513
+ "full-pack": {
2514
+ id: "full-pack",
2515
+ name: "Full Pack",
2516
+ tagline: "Spec \u2192 implement \u2192 review \u2192 verify. Every quality gate, one run.",
2517
+ gate: "pro",
2518
+ stages: [
2519
+ {
2520
+ role: "specifier",
2521
+ name: "Specifier",
2522
+ description: "Turns the task into testable acceptance criteria before any code.",
2523
+ skillIds: ["spec-driven-development"],
2524
+ prompt: SPECIFIER_PROMPT
2525
+ },
2526
+ {
2527
+ role: "coder",
2528
+ name: "Coder",
2529
+ description: "Implements the acceptance criteria with tests, TDD-first.",
2530
+ skillIds: [],
2531
+ prompt: CODER_PROMPT
2532
+ },
2533
+ {
2534
+ role: "reviewer",
2535
+ name: "Reviewer",
2536
+ description: "Audits correctness, scope, design, and conventions with fresh eyes.",
2537
+ skillIds: ["code-review", "code-naming"],
2538
+ prompt: REVIEWER_PROMPT
2539
+ },
2540
+ {
2541
+ role: "qa",
2542
+ name: "QA",
2543
+ description: "Verifies every acceptance criterion end to end and writes the final report.",
2544
+ skillIds: [],
2545
+ prompt: QA_PROMPT
2546
+ }
2547
+ ]
2548
+ }
2549
+ };
2550
+ function isPackId(id) {
2551
+ return Object.prototype.hasOwnProperty.call(PACK_REGISTRY, id);
2552
+ }
2553
+ function getPackDefinition(id) {
2554
+ return isPackId(id) ? PACK_REGISTRY[id] : null;
2555
+ }
2556
+
2557
+ // src/packs/workflow-article.ts
2558
+ var PACK_WORKFLOW_ARTICLE = `## Pipeline rules (you are one stage of an assembly line)
2559
+
2560
+ You are ONE specialist role in a multi-role pipeline running on this repository. Other specialist roles ran before you and/or run after you, each in a separate conversation. Follow these rules exactly:
2561
+
2562
+ - **Do only your role's job.** The next stage exists for a reason \u2014 don't do its work, and don't redo a previous stage's work unless your role explicitly calls for correcting it.
2563
+ - **Work from the handoff.** The previous stage's handoff (commit + summary) is your input. Start by reading the current state of the working tree \u2014 it already contains all prior stages' work.
2564
+ - **Commit your work when your stage is complete.** One or more focused commits; the final state of the tree IS your handoff to the next stage. End every commit message with your role byline on its own line: \`By <role>.\`
2565
+ - **Never leave the tree broken.** Run the project's checks before finishing when the project has them; your stage ends with a working tree the next role can build on.
2566
+ - **Do not push, force-push, or touch remotes** \u2014 the pipeline works locally; publishing is the user's call at the end.
2567
+ - **Never read, edit, or commit anything under \`.codeam/\`** \u2014 that is the pipeline's own ledger, not project code.
2568
+ - **Finish decisively.** When your stage's job is done and committed, say so in 2-4 lines (what you did, what you verified, anything the next stage should know) and stop. Don't ask "should I continue?" \u2014 the pipeline advances automatically.
2569
+ - **If you are genuinely blocked** (contradictory requirements, missing access), say exactly what is blocking you and stop \u2014 the user is supervising and will decide.`;
2570
+
2428
2571
  // src/api-url.ts
2429
2572
  var DEFAULT_API_BASE_URL = "https://api.codeagent-mobile.com";
2430
2573
  var DEV_API_BASE_URL = "https://dev-api.codeagent-mobile.com";
@@ -2575,7 +2718,12 @@ var USER_EVENTS = {
2575
2718
  * toast when the review runs server-side (Inngest). Mobile-only surface,
2576
2719
  * produced by api-v2 (the CLI neither produces nor consumes it). Mirrored in
2577
2720
  * repo A. */
2578
- PR_REVIEW_LAUNCH: "pr_review_launch"
2721
+ PR_REVIEW_LAUNCH: "pr_review_launch",
2722
+ /** Agent Packs — full `PackRunState` republished by the backend on every
2723
+ * pipeline transition (stage start/done, pause, stall, completion). CLI
2724
+ * posts to /api/packs/events; mobile's pack.store renders the pipeline.
2725
+ * Mirrored in repo A's app-shared events.ts. */
2726
+ PACK_STATE: "pack_state"
2579
2727
  };
2580
2728
 
2581
2729
  // src/preview-prompts.ts
@@ -2629,6 +2777,7 @@ export {
2629
2777
  AGENT_STANDARD_BLOCK,
2630
2778
  AGENT_STANDARD_MARKER,
2631
2779
  AGENT_STANDARD_TEXT,
2780
+ CODER_PROMPT,
2632
2781
  DEFAULT_API_BASE_URL,
2633
2782
  DEFAULT_GUARDRAIL_POLICY,
2634
2783
  DEP_TO_INTEGRATION,
@@ -2655,10 +2804,18 @@ export {
2655
2804
  MODEL_CONTEXT_WINDOW,
2656
2805
  MODEL_PRICING,
2657
2806
  OBSERVER_BRIDGE_PORT,
2807
+ PACK_ACTION_COMMAND,
2808
+ PACK_REGISTRY,
2809
+ PACK_START_COMMAND,
2810
+ PACK_STATUS_COMMAND,
2811
+ PACK_WORKFLOW_ARTICLE,
2658
2812
  PREVIEW_DETECT_PROMPT,
2659
2813
  PROTOCOL_VERSION,
2660
2814
  PUBLIC_TO_INTERNAL,
2815
+ QA_PROMPT,
2816
+ REVIEWER_PROMPT,
2661
2817
  SKILL_REGISTRY,
2818
+ SPECIFIER_PROMPT,
2662
2819
  SSE_SOCKET_TIMEOUT_MS,
2663
2820
  STACK_TO_RECOMMENDED,
2664
2821
  TERMINAL_AGENT_PREFIX,
@@ -2674,6 +2831,7 @@ export {
2674
2831
  getIntegration,
2675
2832
  getIntegrationBranding,
2676
2833
  getIntegrationsByCategory,
2834
+ getPackDefinition,
2677
2835
  getPricing,
2678
2836
  getSkillDefinition,
2679
2837
  headroomKindFor,
@@ -2687,6 +2845,7 @@ export {
2687
2845
  isKnownIntegrationId,
2688
2846
  isKnownModel,
2689
2847
  isLinkedAgentId,
2848
+ isPackId,
2690
2849
  isSkillId,
2691
2850
  normalizeAgentId,
2692
2851
  normalizeGuardrailPolicy,