@event4u/agent-config 1.13.0 → 1.14.0
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/.agent-src/commands/agent-handoff.md +3 -0
- package/.agent-src/commands/agent-status.md +3 -0
- package/.agent-src/commands/agents-audit.md +4 -0
- package/.agent-src/commands/agents-cleanup.md +6 -1
- package/.agent-src/commands/agents-prepare.md +3 -0
- package/.agent-src/commands/analyze-reference-repo.md +4 -0
- package/.agent-src/commands/bug-fix.md +5 -1
- package/.agent-src/commands/bug-investigate.md +4 -0
- package/.agent-src/commands/chat-history-checkpoint.md +126 -0
- package/.agent-src/commands/chat-history-clear.md +5 -0
- package/.agent-src/commands/chat-history-resume.md +5 -0
- package/.agent-src/commands/chat-history.md +5 -0
- package/.agent-src/commands/check-current-md.md +126 -0
- package/.agent-src/commands/commit-in-chunks.md +98 -0
- package/.agent-src/commands/commit.md +4 -0
- package/.agent-src/commands/compress.md +3 -0
- package/.agent-src/commands/context-create.md +4 -0
- package/.agent-src/commands/context-refactor.md +4 -0
- package/.agent-src/commands/copilot-agents-init.md +3 -0
- package/.agent-src/commands/copilot-agents-optimize.md +3 -0
- package/.agent-src/commands/create-pr-description.md +4 -0
- package/.agent-src/commands/create-pr.md +4 -0
- package/.agent-src/commands/do-and-judge.md +4 -1
- package/.agent-src/commands/do-in-steps.md +3 -0
- package/.agent-src/commands/e2e-heal.md +4 -0
- package/.agent-src/commands/e2e-plan.md +4 -0
- package/.agent-src/commands/estimate-ticket.md +4 -1
- package/.agent-src/commands/feature-dev.md +4 -0
- package/.agent-src/commands/feature-explore.md +4 -0
- package/.agent-src/commands/feature-plan.md +4 -0
- package/.agent-src/commands/feature-refactor.md +4 -0
- package/.agent-src/commands/feature-roadmap.md +6 -0
- package/.agent-src/commands/fix-ci.md +4 -0
- package/.agent-src/commands/fix-portability.md +3 -0
- package/.agent-src/commands/fix-pr-bot-comments.md +4 -0
- package/.agent-src/commands/fix-pr-comments.md +4 -0
- package/.agent-src/commands/fix-pr-developer-comments.md +4 -0
- package/.agent-src/commands/fix-references.md +3 -0
- package/.agent-src/commands/fix-seeder.md +4 -0
- package/.agent-src/commands/implement-ticket.md +39 -13
- package/.agent-src/commands/jira-ticket.md +4 -0
- package/.agent-src/commands/judge.md +3 -0
- package/.agent-src/commands/memory-add.md +5 -3
- package/.agent-src/commands/memory-full.md +5 -2
- package/.agent-src/commands/memory-promote.md +7 -6
- package/.agent-src/commands/mode.md +3 -0
- package/.agent-src/commands/module-create.md +4 -0
- package/.agent-src/commands/module-explore.md +4 -0
- package/.agent-src/commands/onboard.md +24 -0
- package/.agent-src/commands/optimize-agents.md +4 -0
- package/.agent-src/commands/optimize-augmentignore.md +3 -0
- package/.agent-src/commands/optimize-rtk-filters.md +3 -0
- package/.agent-src/commands/optimize-skills.md +4 -0
- package/.agent-src/commands/override-create.md +4 -0
- package/.agent-src/commands/override-manage.md +4 -0
- package/.agent-src/commands/package-reset.md +3 -0
- package/.agent-src/commands/package-test.md +3 -0
- package/.agent-src/commands/prepare-for-review.md +4 -0
- package/.agent-src/commands/project-analyze.md +4 -0
- package/.agent-src/commands/project-health.md +4 -0
- package/.agent-src/commands/propose-memory.md +6 -8
- package/.agent-src/commands/quality-fix.md +4 -0
- package/.agent-src/commands/refine-ticket.md +4 -1
- package/.agent-src/commands/review-changes.md +4 -0
- package/.agent-src/commands/review-routing.md +4 -0
- package/.agent-src/commands/roadmap-create.md +7 -0
- package/.agent-src/commands/roadmap-execute.md +12 -1
- package/.agent-src/commands/rule-compliance-audit.md +4 -0
- package/.agent-src/commands/set-cost-profile.md +3 -0
- package/.agent-src/commands/sync-agent-settings.md +3 -0
- package/.agent-src/commands/sync-gitignore.md +3 -0
- package/.agent-src/commands/tests-create.md +4 -0
- package/.agent-src/commands/tests-execute.md +4 -0
- package/.agent-src/commands/threat-model.md +4 -0
- package/.agent-src/commands/update-form-request-messages.md +4 -0
- package/.agent-src/commands/upstream-contribute.md +4 -0
- package/.agent-src/commands/work.md +161 -0
- package/.agent-src/guidelines/agent-infra/engineering-memory-data-format.md +2 -6
- package/.agent-src/guidelines/agent-infra/layered-settings.md +0 -1
- package/.agent-src/guidelines/agent-infra/memory-access.md +0 -7
- package/.agent-src/guidelines/agent-infra/role-contracts.md +2 -4
- package/.agent-src/guidelines/agent-infra/self-improvement-pipeline.md +0 -1
- package/.agent-src/guidelines/php/patterns/strategy.md +180 -2
- package/.agent-src/personas/README.md +0 -1
- package/.agent-src/rules/artifact-drafting-protocol.md +7 -2
- package/.agent-src/rules/artifact-engagement-recording.md +133 -0
- package/.agent-src/rules/ask-when-uncertain.md +18 -13
- package/.agent-src/rules/augment-portability.md +8 -0
- package/.agent-src/rules/autonomous-execution.md +158 -0
- package/.agent-src/rules/chat-history.md +147 -118
- package/.agent-src/rules/cli-output-handling.md +26 -3
- package/.agent-src/rules/command-suggestion.md +133 -0
- package/.agent-src/rules/commit-policy.md +99 -0
- package/.agent-src/rules/direct-answers.md +114 -0
- package/.agent-src/rules/docs-sync.md +36 -0
- package/.agent-src/rules/downstream-changes.md +10 -9
- package/.agent-src/rules/improve-before-implement.md +9 -6
- package/.agent-src/rules/language-and-tone.md +81 -6
- package/.agent-src/rules/non-destructive-by-default.md +117 -0
- package/.agent-src/rules/package-ci-checks.md +4 -0
- package/.agent-src/rules/preservation-guard.md +20 -0
- package/.agent-src/rules/roadmap-progress-sync.md +103 -30
- package/.agent-src/rules/scope-control.md +42 -1
- package/.agent-src/rules/size-enforcement.md +1 -3
- package/.agent-src/rules/skill-quality.md +3 -8
- package/.agent-src/rules/ui-audit-before-build.md +106 -0
- package/.agent-src/rules/user-interaction.md +82 -50
- package/.agent-src/scripts/update_roadmap_progress.py +17 -5
- package/.agent-src/skills/blade-ui/SKILL.md +30 -5
- package/.agent-src/skills/command-routing/SKILL.md +32 -0
- package/.agent-src/skills/command-writing/SKILL.md +41 -2
- package/.agent-src/skills/description-assist/SKILL.md +21 -0
- package/.agent-src/skills/estimate-ticket/SKILL.md +0 -1
- package/.agent-src/skills/existing-ui-audit/SKILL.md +187 -0
- package/.agent-src/skills/fe-design/SKILL.md +72 -60
- package/.agent-src/skills/finishing-a-development-branch/SKILL.md +4 -0
- package/.agent-src/skills/flux/SKILL.md +31 -4
- package/.agent-src/skills/guideline-writing/SKILL.md +24 -2
- package/.agent-src/skills/learning-to-rule-or-skill/SKILL.md +51 -9
- package/.agent-src/skills/livewire/SKILL.md +30 -4
- package/.agent-src/skills/md-language-check/SKILL.md +103 -0
- package/.agent-src/skills/php-coder/SKILL.md +24 -0
- package/.agent-src/skills/react-shadcn-ui/SKILL.md +121 -0
- package/.agent-src/skills/refine-prompt/SKILL.md +220 -0
- package/.agent-src/skills/refine-ticket/SKILL.md +2 -4
- package/.agent-src/skills/roadmap-management/SKILL.md +10 -3
- package/.agent-src/skills/rule-writing/SKILL.md +23 -1
- package/.agent-src/skills/skill-writing/SKILL.md +1 -3
- package/.agent-src/skills/upstream-contribute/SKILL.md +1 -1
- package/.agent-src/skills/using-git-worktrees/SKILL.md +3 -1
- package/.agent-src/templates/AGENTS.md +24 -6
- package/.agent-src/templates/agent-settings.md +149 -0
- package/.agent-src/templates/roadmaps.md +8 -2
- package/.agent-src/templates/scripts/implement_ticket/__init__.py +63 -26
- package/.agent-src/templates/scripts/implement_ticket/__main__.py +8 -2
- package/.agent-src/templates/scripts/telemetry/__init__.py +42 -0
- package/.agent-src/templates/scripts/telemetry/aggregator.py +154 -0
- package/.agent-src/templates/scripts/telemetry/boundary.py +171 -0
- package/.agent-src/templates/scripts/telemetry/engagement.py +238 -0
- package/.agent-src/templates/scripts/telemetry/report_renderer.py +170 -0
- package/.agent-src/templates/scripts/telemetry/settings.py +112 -0
- package/.agent-src/templates/scripts/telemetry_record.py +166 -0
- package/.agent-src/templates/scripts/telemetry_report.py +161 -0
- package/.agent-src/templates/scripts/telemetry_status.py +142 -0
- package/.agent-src/templates/scripts/work_engine/__init__.py +58 -0
- package/.agent-src/templates/scripts/work_engine/__main__.py +9 -0
- package/.agent-src/templates/scripts/work_engine/cli.py +592 -0
- package/.agent-src/templates/scripts/{implement_ticket → work_engine}/delivery_state.py +7 -0
- package/.agent-src/templates/scripts/work_engine/directives/__init__.py +33 -0
- package/.agent-src/templates/scripts/work_engine/directives/backend/__init__.py +98 -0
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/analyze.py +1 -1
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/implement.py +2 -2
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/memory.py +1 -1
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/plan.py +1 -1
- package/.agent-src/templates/scripts/work_engine/directives/backend/refine.py +396 -0
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/report.py +36 -4
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/test.py +2 -2
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/verify.py +2 -2
- package/.agent-src/templates/scripts/work_engine/directives/mixed/__init__.py +116 -0
- package/.agent-src/templates/scripts/work_engine/directives/mixed/contract.py +254 -0
- package/.agent-src/templates/scripts/work_engine/directives/mixed/stitch.py +229 -0
- package/.agent-src/templates/scripts/work_engine/directives/mixed/ui.py +231 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/__init__.py +113 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/_passthrough.py +44 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/apply.py +241 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/audit.py +414 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/design.py +335 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/polish.py +510 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/review.py +468 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui_trivial/__init__.py +119 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui_trivial/_skipped.py +37 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui_trivial/apply.py +165 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui_trivial/refine.py +66 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui_trivial/report.py +62 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui_trivial/test.py +115 -0
- package/.agent-src/templates/scripts/work_engine/dispatcher.py +331 -0
- package/.agent-src/templates/scripts/work_engine/hooks/__init__.py +54 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/__init__.py +32 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/_chat_history_base.py +103 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_append.py +44 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_halt_append.py +42 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_heartbeat.py +50 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_turn_check.py +49 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/directive_set_guard.py +53 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/halt_surface_audit.py +50 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/state_shape_validation.py +52 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/trace.py +84 -0
- package/.agent-src/templates/scripts/work_engine/hooks/context.py +66 -0
- package/.agent-src/templates/scripts/work_engine/hooks/events.py +44 -0
- package/.agent-src/templates/scripts/work_engine/hooks/exceptions.py +79 -0
- package/.agent-src/templates/scripts/work_engine/hooks/registry.py +60 -0
- package/.agent-src/templates/scripts/work_engine/hooks/runner.py +73 -0
- package/.agent-src/templates/scripts/work_engine/hooks/settings.py +141 -0
- package/.agent-src/templates/scripts/work_engine/intent/__init__.py +47 -0
- package/.agent-src/templates/scripts/work_engine/intent/classify.py +280 -0
- package/.agent-src/templates/scripts/work_engine/migration/__init__.py +8 -0
- package/.agent-src/templates/scripts/work_engine/migration/v0_to_v1.py +199 -0
- package/.agent-src/templates/scripts/work_engine/resolvers/__init__.py +22 -0
- package/.agent-src/templates/scripts/work_engine/resolvers/diff.py +106 -0
- package/.agent-src/templates/scripts/work_engine/resolvers/file.py +113 -0
- package/.agent-src/templates/scripts/work_engine/resolvers/prompt.py +90 -0
- package/.agent-src/templates/scripts/work_engine/scoring/__init__.py +14 -0
- package/.agent-src/templates/scripts/work_engine/scoring/confidence.py +300 -0
- package/.agent-src/templates/scripts/work_engine/stack/__init__.py +31 -0
- package/.agent-src/templates/scripts/work_engine/stack/detect.py +187 -0
- package/.agent-src/templates/scripts/work_engine/state.py +641 -0
- package/.claude-plugin/marketplace.json +105 -2
- package/AGENTS.md +36 -8
- package/CHANGELOG.md +534 -0
- package/README.md +125 -4
- package/config/agent-settings.template.yml +45 -0
- package/config/gitignore-block.txt +4 -0
- package/docs/architecture.md +28 -1
- package/docs/development.md +1 -1
- package/docs/getting-started.md +2 -2
- package/docs/installation.md +86 -0
- package/docs/showcase.md +204 -0
- package/package.json +1 -1
- package/scripts/agent-config +199 -0
- package/scripts/audit_cloud_compatibility.py +288 -0
- package/scripts/build_cloud_bundle.py +458 -0
- package/scripts/build_linear_digest.py +263 -0
- package/scripts/chat_history.py +796 -7
- package/scripts/check_compression.py +139 -0
- package/scripts/check_iron_law_prominence.py +143 -0
- package/scripts/check_md_language.py +159 -0
- package/scripts/check_portability.py +36 -0
- package/scripts/check_reply_consistency.py +140 -0
- package/scripts/command_suggester/__init__.py +51 -0
- package/scripts/command_suggester/cooldown.py +132 -0
- package/scripts/command_suggester/loader.py +70 -0
- package/scripts/command_suggester/match.py +180 -0
- package/scripts/command_suggester/rank.py +120 -0
- package/scripts/command_suggester/render.py +86 -0
- package/scripts/command_suggester/sanitize.py +113 -0
- package/scripts/command_suggester/settings.py +125 -0
- package/scripts/command_suggester/types.py +78 -0
- package/scripts/hooks/augment-chat-history.sh +56 -0
- package/scripts/install-hooks.sh +67 -0
- package/scripts/install.py +150 -33
- package/scripts/lint_marketplace.py +27 -0
- package/scripts/migrate_command_suggestions.py +151 -0
- package/scripts/schemas/command.schema.json +41 -0
- package/scripts/skill_linter.py +67 -0
- package/scripts/sync_agent_settings.py +42 -12
- package/templates/consumer-settings/augment-cli-hooks.json +54 -0
- package/templates/consumer-settings/claude-settings.json +55 -1
- package/.agent-src/templates/scripts/implement_ticket/cli.py +0 -171
- package/.agent-src/templates/scripts/implement_ticket/dispatcher.py +0 -134
- package/.agent-src/templates/scripts/implement_ticket/steps/__init__.py +0 -49
- package/.agent-src/templates/scripts/implement_ticket/steps/refine.py +0 -140
- /package/.agent-src/templates/scripts/{implement_ticket → work_engine}/persona_policy.py +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""``./agent-config telemetry:report`` — aggregate the engagement log.
|
|
3
|
+
|
|
4
|
+
Reads ``.agent-engagement.jsonl``, groups events by ``(kind, id)``,
|
|
5
|
+
quartile-buckets the artefacts (essential / useful / retirement
|
|
6
|
+
candidate), and prints a markdown table or JSON document.
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
# Defaults: --since 30d --top 20 markdown
|
|
10
|
+
./agent-config telemetry:report
|
|
11
|
+
|
|
12
|
+
# Last 7 days, JSON, no truncation
|
|
13
|
+
./agent-config telemetry:report --since 7d --format json --top 0
|
|
14
|
+
|
|
15
|
+
# Override log path (tests; consumer copies; reports on archived logs)
|
|
16
|
+
./agent-config telemetry:report --log-path /tmp/snapshot.jsonl
|
|
17
|
+
|
|
18
|
+
Exit codes:
|
|
19
|
+
0 success (empty log → empty-but-valid report)
|
|
20
|
+
2 IO / settings parse error, unparseable --since, or
|
|
21
|
+
redaction-validator failure on a row sourced from the log
|
|
22
|
+
(a path-shaped or extension-shaped id slipped past the write
|
|
23
|
+
gate; the report is refused rather than shared)
|
|
24
|
+
"""
|
|
25
|
+
from __future__ import annotations
|
|
26
|
+
|
|
27
|
+
import argparse
|
|
28
|
+
import re
|
|
29
|
+
import sys
|
|
30
|
+
from datetime import datetime, timedelta, timezone
|
|
31
|
+
from pathlib import Path
|
|
32
|
+
|
|
33
|
+
from telemetry.aggregator import aggregate
|
|
34
|
+
from telemetry.engagement import EngagementSchemaError
|
|
35
|
+
from telemetry.report_renderer import render_json, render_markdown
|
|
36
|
+
from telemetry.settings import read_settings
|
|
37
|
+
|
|
38
|
+
_DURATION_RE = re.compile(r"^\s*(\d+)\s*([dhm])\s*$")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _parse_since(value: str | None) -> tuple[datetime | None, str | None]:
|
|
42
|
+
"""Parse ``30d`` / ``7d`` / ``24h`` / ``60m`` into a UTC cutoff.
|
|
43
|
+
|
|
44
|
+
Returns ``(cutoff_or_None, human_label)``. ``value`` of ``None`` or
|
|
45
|
+
``"all"`` means "no lower bound" — both cutoff and label are
|
|
46
|
+
``None``. Raises ``ValueError`` on malformed input so the CLI can
|
|
47
|
+
surface a clean error and exit 2.
|
|
48
|
+
"""
|
|
49
|
+
if value is None or value.strip().lower() == "all":
|
|
50
|
+
return None, None
|
|
51
|
+
match = _DURATION_RE.match(value)
|
|
52
|
+
if not match:
|
|
53
|
+
raise ValueError(
|
|
54
|
+
f"--since must be <int>{{d,h,m}} or 'all', got {value!r}"
|
|
55
|
+
)
|
|
56
|
+
qty = int(match.group(1))
|
|
57
|
+
unit = match.group(2)
|
|
58
|
+
delta = {
|
|
59
|
+
"d": timedelta(days=qty),
|
|
60
|
+
"h": timedelta(hours=qty),
|
|
61
|
+
"m": timedelta(minutes=qty),
|
|
62
|
+
}[unit]
|
|
63
|
+
cutoff = datetime.now(tz=timezone.utc) - delta
|
|
64
|
+
label = f"last {qty}{unit}"
|
|
65
|
+
return cutoff, label
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def main(argv: list[str] | None = None) -> int:
|
|
69
|
+
parser = argparse.ArgumentParser(
|
|
70
|
+
prog="agent-config telemetry:report",
|
|
71
|
+
description=(
|
|
72
|
+
"Render an artefact-engagement report from the JSONL log. "
|
|
73
|
+
"Read-only; never mutates settings or the log."
|
|
74
|
+
),
|
|
75
|
+
)
|
|
76
|
+
parser.add_argument(
|
|
77
|
+
"--since",
|
|
78
|
+
default="30d",
|
|
79
|
+
help=(
|
|
80
|
+
"Lower-bound time window: <int>{d,h,m} or 'all'. "
|
|
81
|
+
"Default: 30d. Events at or before the cutoff are excluded."
|
|
82
|
+
),
|
|
83
|
+
)
|
|
84
|
+
parser.add_argument(
|
|
85
|
+
"--top",
|
|
86
|
+
type=int,
|
|
87
|
+
default=20,
|
|
88
|
+
help=(
|
|
89
|
+
"Truncate each bucket to N rows. Default: 20. Use 0 to "
|
|
90
|
+
"disable truncation."
|
|
91
|
+
),
|
|
92
|
+
)
|
|
93
|
+
parser.add_argument(
|
|
94
|
+
"--format",
|
|
95
|
+
choices=("markdown", "json"),
|
|
96
|
+
default="markdown",
|
|
97
|
+
)
|
|
98
|
+
parser.add_argument(
|
|
99
|
+
"--log-path",
|
|
100
|
+
type=Path,
|
|
101
|
+
default=None,
|
|
102
|
+
help=(
|
|
103
|
+
"Override the log path. Default: read "
|
|
104
|
+
"telemetry.artifact_engagement.output.path from "
|
|
105
|
+
".agent-settings.yml (falls back to .agent-engagement.jsonl)."
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
parser.add_argument(
|
|
109
|
+
"--settings",
|
|
110
|
+
type=Path,
|
|
111
|
+
default=Path(".agent-settings.yml"),
|
|
112
|
+
help="Override settings path (tests).",
|
|
113
|
+
)
|
|
114
|
+
args = parser.parse_args(argv)
|
|
115
|
+
|
|
116
|
+
try:
|
|
117
|
+
cutoff, since_label = _parse_since(args.since)
|
|
118
|
+
except ValueError as exc:
|
|
119
|
+
print(f"❌ {exc}", file=sys.stderr)
|
|
120
|
+
return 2
|
|
121
|
+
|
|
122
|
+
if args.log_path is not None:
|
|
123
|
+
log_path = args.log_path
|
|
124
|
+
else:
|
|
125
|
+
try:
|
|
126
|
+
settings = read_settings(args.settings)
|
|
127
|
+
except OSError as exc:
|
|
128
|
+
print(f"❌ cannot read settings: {exc}", file=sys.stderr)
|
|
129
|
+
return 2
|
|
130
|
+
log_path = settings.log_path
|
|
131
|
+
|
|
132
|
+
try:
|
|
133
|
+
result = aggregate(log_path, since=cutoff)
|
|
134
|
+
except OSError as exc:
|
|
135
|
+
print(f"❌ cannot read log {log_path}: {exc}", file=sys.stderr)
|
|
136
|
+
return 2
|
|
137
|
+
|
|
138
|
+
top = None if args.top <= 0 else args.top
|
|
139
|
+
try:
|
|
140
|
+
if args.format == "json":
|
|
141
|
+
rendered = render_json(result, top=top, since_label=since_label)
|
|
142
|
+
else:
|
|
143
|
+
rendered = render_markdown(result, top=top, since_label=since_label)
|
|
144
|
+
except EngagementSchemaError as exc:
|
|
145
|
+
print(
|
|
146
|
+
f"❌ redaction validator refused report: {exc}",
|
|
147
|
+
file=sys.stderr,
|
|
148
|
+
)
|
|
149
|
+
return 2
|
|
150
|
+
sys.stdout.write(rendered)
|
|
151
|
+
|
|
152
|
+
if result.skipped_lines:
|
|
153
|
+
print(
|
|
154
|
+
f"⚠️ skipped {result.skipped_lines} malformed line(s)",
|
|
155
|
+
file=sys.stderr,
|
|
156
|
+
)
|
|
157
|
+
return 0
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
if __name__ == "__main__":
|
|
161
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""``./agent-config telemetry:status`` — read-only status report.
|
|
3
|
+
|
|
4
|
+
Prints the current ``telemetry.artifact_engagement`` configuration
|
|
5
|
+
plus log statistics. Safe even when telemetry is disabled — never
|
|
6
|
+
creates the log, never validates, never writes. ``--format json`` is
|
|
7
|
+
the machine-readable contract.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
import json
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Any
|
|
16
|
+
|
|
17
|
+
from telemetry.engagement import EngagementSchemaError, parse_event
|
|
18
|
+
from telemetry.settings import TelemetrySettings, read_settings
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _last_event_ts(log_path: Path) -> str | None:
|
|
22
|
+
"""Return the ``ts`` of the last well-formed event, or None.
|
|
23
|
+
|
|
24
|
+
Reads from the tail to keep the cost bounded on long logs. We
|
|
25
|
+
skip malformed lines silently — Phase 4 surfaces those via the
|
|
26
|
+
aggregator's ``--strict`` flag.
|
|
27
|
+
"""
|
|
28
|
+
if not log_path.is_file():
|
|
29
|
+
return None
|
|
30
|
+
try:
|
|
31
|
+
with log_path.open("rb") as fh:
|
|
32
|
+
fh.seek(0, 2) # EOF
|
|
33
|
+
size = fh.tell()
|
|
34
|
+
chunk_size = min(size, 4096)
|
|
35
|
+
fh.seek(size - chunk_size)
|
|
36
|
+
tail = fh.read().decode("utf-8", errors="replace")
|
|
37
|
+
except OSError:
|
|
38
|
+
return None
|
|
39
|
+
for line in reversed(tail.splitlines()):
|
|
40
|
+
line = line.strip()
|
|
41
|
+
if not line:
|
|
42
|
+
continue
|
|
43
|
+
try:
|
|
44
|
+
event = parse_event(line + "\n")
|
|
45
|
+
except EngagementSchemaError:
|
|
46
|
+
continue
|
|
47
|
+
return event.ts
|
|
48
|
+
return None
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _log_stats(log_path: Path) -> dict[str, Any]:
|
|
52
|
+
if not log_path.is_file():
|
|
53
|
+
return {"exists": False, "size_bytes": 0, "line_count": 0}
|
|
54
|
+
try:
|
|
55
|
+
size = log_path.stat().st_size
|
|
56
|
+
with log_path.open("rb") as fh:
|
|
57
|
+
line_count = sum(1 for _ in fh)
|
|
58
|
+
except OSError as exc:
|
|
59
|
+
return {"exists": True, "error": str(exc)}
|
|
60
|
+
return {"exists": True, "size_bytes": size, "line_count": line_count}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _build_report(settings: TelemetrySettings) -> dict[str, Any]:
|
|
64
|
+
log_path = settings.log_path
|
|
65
|
+
return {
|
|
66
|
+
"enabled": settings.enabled,
|
|
67
|
+
"section_present": settings.section_present,
|
|
68
|
+
"granularity": settings.granularity,
|
|
69
|
+
"record": {
|
|
70
|
+
"consulted": settings.record_consulted,
|
|
71
|
+
"applied": settings.record_applied,
|
|
72
|
+
},
|
|
73
|
+
"log": {
|
|
74
|
+
"path": str(log_path),
|
|
75
|
+
**_log_stats(log_path),
|
|
76
|
+
"last_event_ts": _last_event_ts(log_path),
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _render_text(report: dict[str, Any]) -> str:
|
|
82
|
+
lines: list[str] = []
|
|
83
|
+
enabled = "✅ enabled" if report["enabled"] else "⛔ disabled"
|
|
84
|
+
if not report["section_present"]:
|
|
85
|
+
enabled += " (no telemetry section in .agent-settings.yml — using defaults)"
|
|
86
|
+
lines.append(f" artifact-engagement: {enabled}")
|
|
87
|
+
lines.append(f" granularity: {report['granularity']}")
|
|
88
|
+
rec = report["record"]
|
|
89
|
+
lines.append(
|
|
90
|
+
f" record: consulted={rec['consulted']} "
|
|
91
|
+
f"applied={rec['applied']}"
|
|
92
|
+
)
|
|
93
|
+
log = report["log"]
|
|
94
|
+
lines.append(f" log path: {log['path']}")
|
|
95
|
+
if log.get("exists"):
|
|
96
|
+
if "error" in log:
|
|
97
|
+
lines.append(f" log error: {log['error']}")
|
|
98
|
+
else:
|
|
99
|
+
lines.append(
|
|
100
|
+
f" log size: {log['size_bytes']} bytes "
|
|
101
|
+
f"({log['line_count']} events)"
|
|
102
|
+
)
|
|
103
|
+
if log.get("last_event_ts"):
|
|
104
|
+
lines.append(f" last event ts: {log['last_event_ts']}")
|
|
105
|
+
else:
|
|
106
|
+
lines.append(" log: not yet created")
|
|
107
|
+
return "\n".join(lines)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def main(argv: list[str] | None = None) -> int:
|
|
111
|
+
parser = argparse.ArgumentParser(
|
|
112
|
+
prog="agent-config telemetry:status",
|
|
113
|
+
description=(
|
|
114
|
+
"Print the artifact-engagement telemetry status. Read-only "
|
|
115
|
+
"— never creates the log, never modifies settings."
|
|
116
|
+
),
|
|
117
|
+
)
|
|
118
|
+
parser.add_argument("--format", choices=("text", "json"), default="text")
|
|
119
|
+
parser.add_argument(
|
|
120
|
+
"--settings",
|
|
121
|
+
type=Path,
|
|
122
|
+
default=Path(".agent-settings.yml"),
|
|
123
|
+
help="Override settings path (tests).",
|
|
124
|
+
)
|
|
125
|
+
args = parser.parse_args(argv)
|
|
126
|
+
|
|
127
|
+
try:
|
|
128
|
+
settings = read_settings(args.settings)
|
|
129
|
+
except OSError as exc:
|
|
130
|
+
print(f"❌ cannot read settings: {exc}", file=sys.stderr)
|
|
131
|
+
return 2
|
|
132
|
+
|
|
133
|
+
report = _build_report(settings)
|
|
134
|
+
if args.format == "json":
|
|
135
|
+
print(json.dumps(report, sort_keys=True, indent=2))
|
|
136
|
+
else:
|
|
137
|
+
print(_render_text(report))
|
|
138
|
+
return 0
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
if __name__ == "__main__":
|
|
142
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""``work_engine`` — universal execution engine (R1).
|
|
2
|
+
|
|
3
|
+
The package owns the linear step dispatcher that drives
|
|
4
|
+
``/implement-ticket`` and any future intent-routed flow. Phase 2 added
|
|
5
|
+
the persistent ``state`` schema and the v0→v1 migration; Phase 3 moves
|
|
6
|
+
the dispatcher, CLI and step modules over from the legacy
|
|
7
|
+
``implement_ticket`` package — which is now a thin compatibility shim
|
|
8
|
+
that re-exports from here with a ``DeprecationWarning``.
|
|
9
|
+
|
|
10
|
+
Architectural constraints (from
|
|
11
|
+
``agents/contexts/adr-implement-ticket-runtime.md`` and
|
|
12
|
+
``agents/contexts/implement-ticket-flow.md``):
|
|
13
|
+
|
|
14
|
+
- Runtime is Python 3.10+.
|
|
15
|
+
- The dispatcher is linear, not a DAG. Eight fixed steps, fixed order.
|
|
16
|
+
- ``DeliveryState`` is the only object shared between steps — no
|
|
17
|
+
hidden state, no side channels.
|
|
18
|
+
- Every step terminates in ``success | blocked | partial``. ``blocked``
|
|
19
|
+
and ``partial`` halt the flow and surface numbered questions.
|
|
20
|
+
- The dispatcher never calls git, writes commits, or opens PRs.
|
|
21
|
+
"""
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
from .delivery_state import (
|
|
25
|
+
AGENT_DIRECTIVE_PREFIX,
|
|
26
|
+
DeliveryState,
|
|
27
|
+
Outcome,
|
|
28
|
+
Step,
|
|
29
|
+
StepResult,
|
|
30
|
+
agent_directive,
|
|
31
|
+
is_agent_directive,
|
|
32
|
+
)
|
|
33
|
+
from .cli import DEFAULT_STATE_FILE, main
|
|
34
|
+
from .dispatcher import STEP_ORDER, dispatch
|
|
35
|
+
from .persona_policy import (
|
|
36
|
+
DEFAULT_PERSONA,
|
|
37
|
+
PersonaPolicy,
|
|
38
|
+
known_personas,
|
|
39
|
+
resolve_policy,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
__all__ = [
|
|
43
|
+
"AGENT_DIRECTIVE_PREFIX",
|
|
44
|
+
"DEFAULT_PERSONA",
|
|
45
|
+
"DEFAULT_STATE_FILE",
|
|
46
|
+
"DeliveryState",
|
|
47
|
+
"Outcome",
|
|
48
|
+
"PersonaPolicy",
|
|
49
|
+
"STEP_ORDER",
|
|
50
|
+
"Step",
|
|
51
|
+
"StepResult",
|
|
52
|
+
"agent_directive",
|
|
53
|
+
"dispatch",
|
|
54
|
+
"is_agent_directive",
|
|
55
|
+
"known_personas",
|
|
56
|
+
"main",
|
|
57
|
+
"resolve_policy",
|
|
58
|
+
]
|