@mytegroupinc/myte-core 0.0.46 → 0.0.49

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/README.md CHANGED
@@ -9,22 +9,43 @@ Most users should install the public wrapper instead:
9
9
 
10
10
  This package exists so the public wrapper can stay small and versioned cleanly. It is not the recommended public install target.
11
11
 
12
- ## Requirements
13
-
14
- - Node `18+`
12
+ ## Requirements
13
+
14
+ - Node `18.17+`
15
15
  - `MYTE_API_KEY` for project-scoped commands
16
16
  - `MYTEAI_API_KEY` for `myte ai`
17
17
  - `MYTEAI_API_KEY` for `mytecody`
18
18
  - `git` only when using `query --with-diff`
19
- - No runtime npm dependencies. The CLI uses Node 18+ built-ins for env loading, argument parsing, HTTP, and local context serialization.
19
+ - The CLI uses Node built-ins for env loading, argument parsing, direct HTTP,
20
+ and local serialization. `undici` supplies portable
21
+ `HTTP_PROXY`/`HTTPS_PROXY`/`NO_PROXY` support across the supported Node
22
+ versions.
20
23
 
21
24
  ## Behavior Summary
22
25
 
26
+ - `myte doctor --json` performs read-only package, credential-presence, DNS,
27
+ TCP/TLS, authenticated config, proxy, and workspace checks without exposing
28
+ keys, proxy values, request bodies, or response bodies.
29
+ - `myte info` and `myte --version --verbose` show the wrapper/core topology,
30
+ runtime dependencies, expected npm graph size, and version compatibility.
31
+ - Network diagnostics preserve nested transport causes and distinguish DNS,
32
+ TCP, TLS/certificate, timeout, captive portal/non-JSON, authentication,
33
+ authorization, rate-limit, and server failures.
34
+ - Safe transient reads and query polling use bounded retries. Query creation
35
+ reuses one idempotency key across ambiguous retries.
23
36
  - Snapshot-style commands such as `bootstrap`, `sync-qaqc`, `feedback-sync`, and `suggestions sync` write local `MyteCommandCenter` data.
24
- - `feedback status|edit|assign|archive` writes reviewable local YAML artifacts; `feedback submit|revise|reviews|review` routes them through the backend owner-review membrane.
37
+ - `feedback-sync` prefers stable ObjectId cursor pagination so concurrent
38
+ inserts cannot shift later pages. It remains compatible with older
39
+ offset-only API versions and rejects duplicate cross-page records instead of
40
+ committing an ambiguous local snapshot.
41
+ - `feedback status|edit|assign|archive|refine` writes reviewable local YAML artifacts.
42
+ - `feedback submit|revise|comment` are live writes that require `--confirm-write --approval-artifact <path>`.
43
+ - `feedback review|move|undo|apply` are governed writes with backend permission checks but no approval artifact flags.
44
+ - `feedback-sync|get|history|reviews|prd-versions|prd-diff|validate` are read/sync/validation commands with no approval artifact flags.
25
45
  - `feedback move|comment|undo|prd-versions|prd-diff|history` calls the project-key Feedback API while leaving lifecycle rules and permissions server-side. `feedback move --feedback-ids` sends one batch move request.
26
46
  - `feedback validate|apply` remains available for validation and owner-direct apply paths; live authorization, stale checks, and history stay server-side.
27
- - `query --with-diff` requires project repos to be configured for diff collection and fails fast when no matching local project repo can be resolved.
47
+ - `query --with-diff` requires project repos to be configured for diff collection and fails fast when no matching local project repo can be resolved.
48
+ - `query --json` returns the stable request ID, query job ID, answer, context-block count payload, and telemetry without echoing the query text.
28
49
  - Public package documentation is intentionally minimal. Internal rollout and design notes are not part of the npm package contract.
29
50
  - `mytecody` is a model-agnostic MyteCody team launcher. It supports `doctor`,
30
51
  `doctor --probe-gateway`, `update --dry-run`, and `update`. On first coding
@@ -41,15 +62,33 @@ This package exists so the public wrapper can stay small and versioned cleanly.
41
62
 
42
63
  ## Live Write Approval
43
64
 
44
- Project-key write commands add a server-validated approval envelope only after the caller supplies `--confirm-write --approval-artifact <path>`.
65
+ Only selected project-key writes require a server-validated approval envelope. The CLI adds `write_approval` metadata only for those commands after the caller supplies `--confirm-write --approval-artifact <path>`.
45
66
 
46
- - The approval artifact must be a local `.md`, `.yml`, `.yaml`, or `.json` file shown to and approved by the user.
67
+ | Category | Commands | Artifact |
68
+ | --- | --- | --- |
69
+ | Required | `create-prd`, `update-team`, `update-owner`, `update-client`, `feedback submit`, `feedback revise`, `feedback comment`, `suggestions create`, `suggestions revise` | Yes |
70
+ | Not required | `run-qaqc`, `mission status`, `mission archive`, `suggestions review`, `feedback review`, `feedback move`, `feedback undo`, `feedback apply` | No |
71
+ | Never required | `config`, `query`, `bootstrap`, `sync-qaqc`, `feedback-sync`, `suggestions sync`, `feedback get/history/reviews/prd-versions/prd-diff/validate`, local feedback draft commands | No |
72
+
73
+ - The approval artifact must be a local `.md`, `.markdown`, `.yml`, `.yaml`, or `.json` file shown to and approved by the user.
47
74
  - The artifact must list the exact operation, proposed change, and every target id or PRD item.
48
- - Batch writes must enumerate every item and the CLI sends the matching batch count to the API.
49
- - The API validates the payload hash after stripping transport metadata, so direct HTTP writes with only the API key do not bypass approval.
50
- - The package does not bundle the large MyteCody engine binary or the async
51
- Responses bridge implementation. See `THIRD_PARTY_NOTICES.md` and
52
- `TRADEMARKS.md` for Codex lineage and Myte brand notices.
75
+ - Batch artifacts for required actions must enumerate every item and the CLI sends the matching batch count to the API.
76
+ - For required actions, the API validates the payload hash after stripping transport metadata, so direct HTTP writes with only the API key do not bypass approval.
77
+ - For actions marked `Not required`, the backend still enforces project-key authentication, idempotency, owner/delegate capability rules, stale-state guards, validation, rate limits, and audit history.
78
+ - In plain language, the artifact is the human-reviewed record of the exact write the agent is about to send. It is not a permission grant and it does not bypass project owner/delegate checks, idempotency, stale-state guards, validation, or audit.
79
+ - Minimum artifact contents are the exact command, every target id or PRD item, a complete proposed-change summary, a reason, and `batch_count` when one command sends multiple items.
80
+ - Mission edit/create batches use `suggestions create` or `suggestions revise`; list every item, including `change_type`, `mission_id` for updates, proposed title/description for creates, and `suggestion_id` plus expected revision for revisions.
81
+ - Without `--document-set`, `create-prd fileA.md fileB.md ...` creates
82
+ independent Feedback items as before. With `--document-set`, one to three
83
+ Markdown files of at most 250,000 characters each create one parent Feedback
84
+ with ordered PRD documents. List every file/title/client ref and the matching
85
+ count in the approval artifact.
86
+ - Feedback submit/revise/comment artifacts are usually the same YAML or markdown file being submitted. For inline text or stdin, use a separate approval memo with the feedback id or request id and exact content.
87
+ - Team, owner, and client update artifacts should name the audience and include the exact message body or a complete summary. Client updates should include target contact ids when used.
88
+ - `feedback review --request-ids`, `feedback move --feedback-ids`, `mission status --mission-ids`, `mission archive --mission-ids`, and `run-qaqc --mission-ids` are batched governed writes, but they are marked `Not required` and should not receive approval artifact flags.
89
+ - The package does not bundle the large MyteCody engine binary or the async
90
+ Responses bridge implementation. See `THIRD_PARTY_NOTICES.md` and
91
+ `TRADEMARKS.md` for Codex lineage and Myte brand notices.
53
92
 
54
93
  ## Agent Usage Contract
55
94
 
@@ -57,20 +96,23 @@ Coding agents should treat `MYTE_API_KEY` as a project-scoped Project Assistant
57
96
 
58
97
  - Load it from the workspace `.env` or environment. `MYTE_PROJECT_API_KEY` is accepted as a compatibility fallback.
59
98
  - Call `myte config --json` first when project identity or local repo detection is uncertain.
60
- - Hydrate mission context with `bootstrap` first instead of scraping the web UI. `bootstrap` writes mission cards and mission suggestion thread state.
99
+ - Hydrate mission context with `bootstrap` first instead of scraping the web UI. `bootstrap` writes mission cards, mission suggestion thread state, and `MyteCommandCenter/AgentsMyteAPI.md`.
61
100
  - Use `suggestions sync` only when you need to refresh mission review-thread state without refreshing the full board.
62
101
  - Use `query --with-diff` for project-scoped code review, planning, and implementation questions.
63
- - Use `create-prd` only with reviewed markdown files. The markdown file body is the PRD document; `description` is only the short board/card summary.
64
- - Use `feedback status|edit|assign|archive` for reviewable local artifacts, `feedback submit` for owner review, and `feedback review` for owner/delegate decisions.
102
+ - Use `create-prd` only with reviewed markdown files and `--confirm-write --approval-artifact <path>`. The markdown file body is the PRD document; `description` is only the short board/card summary.
103
+ - Use `create-prd --document-set` only when the explicit intent is one parent
104
+ Feedback with one to three ordered documents; omitting it preserves
105
+ independent multi-file creation.
106
+ - Use `feedback status|edit|assign|archive|refine` for reviewable local artifacts. `feedback submit` and `feedback revise` require an approval artifact; `feedback review` does not because the backend owner/delegate decision is the approval control.
65
107
  - Use `feedback review --request-ids` for batch owner/delegate decisions; it sends one grouped backend batch, not one request per item.
66
- - Use `suggestions create` for both existing-mission edits and new-mission proposals. The only valid `change_type` values are `update` and `create`.
67
- - Use `suggestions revise` only against an existing `suggestion_id`; do not send `change_type` on revisions because the backend keeps the thread's original type.
68
- - Use `suggestions review` for owner/elevated mission-review decisions: `approve`, `request_changes`, or `reject`.
108
+ - Use `suggestions create` for both existing-mission edits and new-mission proposals, with `--confirm-write --approval-artifact <path>`. The only valid `change_type` values are `update` and `create`.
109
+ - Use `suggestions revise` only against an existing `suggestion_id`, with `--confirm-write --approval-artifact <path>`; do not send `change_type` on revisions because the backend keeps the thread's original type.
110
+ - Use `suggestions review` for owner/elevated mission-review decisions: `approve`, `request_changes`, or `reject`. No approval artifact is required for review decisions.
69
111
  - Use `mission archive` for project-key lifecycle archival. Do not send `Archived` through `mission status`; restore archived missions from the web archived-board view.
70
112
  - Use `feedback move` only when a direct audited state move is intended and include a concrete `--reason`. Use `--feedback-ids` for batch active-state moves or authorized batch archive.
71
- - Use `feedback comment --feedback-id <id> --body-file ./comment.md` for text-only feedback-specific implementation notes. Attachments remain web UI only for this project-key endpoint.
113
+ - Use `feedback comment --feedback-id <id> --body-file ./comment.md --confirm-write --approval-artifact ./comment.md` for text-only feedback-specific implementation notes. Attachments remain web UI only for this project-key endpoint.
72
114
  - Do not use the project-key API/CLI to unarchive Feedback. Normal `feedback-sync` excludes archived Feedback; unarchive from the web archived Feedback view.
73
- - Use `update-team` when an agent needs to leave a project-level implementation note or verification comment.
115
+ - Use `update-team --confirm-write --approval-artifact <path>` when an agent needs to leave a project-level implementation note or verification comment.
74
116
 
75
117
  Do not use `MYTE_API_KEY` against account/JWT web endpoints. The direct project-key surface is `/api/project-assistant/*`.
76
118
 
@@ -85,13 +127,29 @@ PRD document contract:
85
127
  - The UI renders the PRD from stored PRD text/document content, not from `description`.
86
128
  - Renderer-friendly PRDs should use one `# Title`, `##` sections, concise paragraphs, bullets, GitHub tables/checklists where useful, and fenced code blocks only for real code/config.
87
129
  - Do not wrap the whole PRD in a ` ```markdown ` fence. Do not use raw HTML, inline style blocks, or decorative banners.
88
- - PRD identity is explicit: `myte create-prd` creates a PRD asset with PRD metadata. Generic uploaded `.md`, `.docx`, `.pdf`, and `.txt` files remain normal attachments unless explicitly created as PRDs.
130
+ - PRD identity is explicit: `myte create-prd` creates a PRD asset with PRD metadata. Generic uploaded `.md`, `.docx`, `.pdf`, and `.txt` files remain normal attachments unless explicitly created as PRDs.
131
+ - Document sets retain exact source Markdown plus canonical rendering
132
+ Markdown, stable document IDs, per-document hashes, and independent
133
+ download/read targets.
134
+
135
+ ## Project Assistant Connectivity
136
+
137
+ `myte doctor --json` should be the first diagnostic when a command reports
138
+ `fetch failed`. A DNS or TCP result means the request did not reach HTTP. A
139
+ TLS reset means the secure connection was interrupted before Myte could
140
+ receive the API key. Authentication and authorization are reported only when
141
+ the API actually returns those responses.
142
+
143
+ The CLI honors `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`. It does not log
144
+ their values and does not disable TLS verification. Captive portals and
145
+ intercepting gateways are reported as non-JSON/HTML transport failures rather
146
+ than as malformed Myte API responses.
89
147
 
90
148
  Feedback comment support:
91
149
 
92
150
  - `feedback-sync` includes existing feedback comment turns in local context.
93
151
  - Feedback-specific comment creation exists in the web backend at `/api/feedbacks/<feedback_id>/comments`, protected by JWT/project assignment.
94
- - Project-key comment creation is available through `myte feedback comment --feedback-id <id> --body "..."` or `--body-file ./comment.md`.
152
+ - Project-key comment creation is available through `myte feedback comment --feedback-id <id> --body "..." --confirm-write --approval-artifact ./comment.md` or `--body-file ./comment.md --confirm-write --approval-artifact ./comment.md`.
95
153
  - The project-key feedback comment endpoint is text-only in this slice and caps content at 500,000 characters. Use the web UI when comment attachments are required.
96
154
 
97
155
  ## Mission Action Map
@@ -100,12 +158,12 @@ Feedback comment support:
100
158
  | --- | --- | --- |
101
159
  | Sync mission cards and review threads | `myte bootstrap --json` | Refreshes `MyteCommandCenter/data/missions/*.yml`, project structure, and `MyteCommandCenter/data/mission-ops.yml`. |
102
160
  | Sync only mission review threads | `myte suggestions sync --json` | Refreshes `MyteCommandCenter/data/mission-ops.yml` while preserving local workspace drafts. |
103
- | Suggest edit to existing mission | `myte suggestions create` with `change_type: update` and `mission_id` | Creates or appends to an active review thread; live mission is unchanged until approval. |
104
- | Suggest new mission | `myte suggestions create` with `change_type: create` | Requires `change_set.title` and `change_set.description`; creates a review thread only; the mission card is created only after approval. |
105
- | Revise a suggestion | `myte suggestions revise` with `suggestion_id` | Adds another revision to the same thread. Do not include `change_type`. |
106
- | Review a suggestion | `myte suggestions review` with `review_action: approve|request_changes|reject` | Project Owner or elevated mission-review delegate required. Approval mutates/creates the mission once; reject archives the thread only; request_changes keeps it actionable. |
107
- | Update mission status | `myte mission status --mission-ids "M001" --status todo|in_progress|done` | Project-key surface updates canonical mission status for active cards and refreshes local bootstrap + mission-ops by default. |
108
- | Archive mission | `myte mission archive --mission-ids "M001[,M002]" --reason "..."` | Project Owner or elevated delegate required. Sets `Archived`, removes cards from normal bootstrap/board state, writes mission activity, and refreshes local bootstrap + mission-ops by default. |
161
+ | Suggest edit to existing mission | `myte suggestions create --file ./create.yml --confirm-write --approval-artifact ./create.yml` with `change_type: update` and `mission_id` | Creates or appends to an active review thread; live mission is unchanged until approval. |
162
+ | Suggest new mission | `myte suggestions create --file ./create.yml --confirm-write --approval-artifact ./create.yml` with `change_type: create` | Requires `change_set.title` and `change_set.description`; creates a review thread only; the mission card is created only after approval. |
163
+ | Revise a suggestion | `myte suggestions revise --file ./revise.yml --confirm-write --approval-artifact ./revise.yml` with `suggestion_id` | Adds another revision to the same thread. Do not include `change_type`. |
164
+ | Review a suggestion | `myte suggestions review` with `review_action: approve|request_changes|reject` | Project Owner or elevated mission-review delegate required; no approval artifact required. Approval mutates/creates the mission once; reject archives the thread only; request_changes keeps it actionable. |
165
+ | Update mission status | `myte mission status --mission-ids "M001" --status todo|in_progress|done` | Project-key surface updates canonical mission status for active cards; no approval artifact required; refreshes local bootstrap + mission-ops by default. |
166
+ | Archive mission | `myte mission archive --mission-ids "M001[,M002]" --reason "..."` | Project Owner or elevated delegate required; no approval artifact required. Sets `Archived`, removes cards from normal bootstrap/board state, writes mission activity, and refreshes local bootstrap + mission-ops by default. |
109
167
 
110
168
  Create payloads:
111
169
 
@@ -171,18 +229,18 @@ Agent rule: never guess `suggestion_id`. If `mission-ops.yml` is missing or stal
171
229
  | `feedback edit` / `feedback refine` | Creates a local YAML proposal for title, description/body, priority, due date, tags, or notes. | Content changes go through owner-review membrane. |
172
230
  | `feedback assign` | Creates a local YAML proposal to change assignee. | Goes through review unless applied through owner-direct path. |
173
231
  | `feedback archive` | Creates a local YAML proposal to archive. | Archive is governed by backend owner/delegate capability. |
174
- | `feedback submit` | Sends a local proposal artifact to the backend as a review request. | Does not mutate live feedback before approval. |
175
- | `feedback revise` | Resubmits the original submitter's request after `request_changes`. | Only valid for the original submitter and `needs_changes` requests. |
232
+ | `feedback submit` | Sends a local proposal artifact to the backend as a review request. | Requires `--confirm-write --approval-artifact <path>`; does not mutate live feedback before approval. |
233
+ | `feedback revise` | Resubmits the original submitter's request after `request_changes`. | Requires `--confirm-write --approval-artifact <path>`; only valid for the original submitter and `needs_changes` requests. |
176
234
  | `feedback reviews` | Lists review requests or fetches one request by `--request-id`. | Read-only; response includes backend permissions. |
177
- | `feedback review` | Approves, rejects, requests changes, or cancels one review request, or a batch with `--request-ids`. | Backend restricts approval/review decisions to Project Owner or elevated delegate for Feedback scope; batch review uses one grouped notification path. |
178
- | `feedback move` | Moves a card or batch of cards across allowed board states directly with an audit event. | `--feedback-ids` sends one batch request. Blocked with `pending_feedback_review` while an active linked review request exists; governed states such as archive/reject/deploy/freeze remain backend-authorized. Project-key unarchive is not supported. |
179
- | `feedback comment` | Creates a text-only comment on one Feedback item. | Backend checks project-key access, owner/assigned permission, idempotency, and the 500,000-character content cap. Attachments remain web UI only. |
180
- | `feedback undo` | Reverses an audited board event when there is no conflict. | Backend validates event ownership/project scope and conflict state. |
235
+ | `feedback review` | Approves, rejects, requests changes, or cancels one review request, or a batch with `--request-ids`. | No approval artifact required; backend restricts approval/review decisions to Project Owner or elevated delegate for Feedback scope; batch review uses one grouped notification path. |
236
+ | `feedback move` | Moves a card or batch of cards across allowed board states directly with an audit event. | No approval artifact required. `--feedback-ids` sends one batch request. Blocked with `pending_feedback_review` while an active linked review request exists; governed states such as archive/reject/deploy/freeze remain backend-authorized. Project-key unarchive is not supported. |
237
+ | `feedback comment` | Creates a text-only comment on one Feedback item. | Requires `--confirm-write --approval-artifact <path>`; backend checks project-key access, owner/assigned permission, idempotency, and the 500,000-character content cap. Attachments remain web UI only. |
238
+ | `feedback undo` | Reverses an audited board event when there is no conflict. | No approval artifact required; backend validates event ownership/project scope and conflict state. |
181
239
  | `feedback prd-versions` | Lists retained PRD baselines/revisions for a feedback item. | Read-only; old S3 objects are retained by reference. |
182
240
  | `feedback prd-diff` | Fetches backend-generated text diff for PRD versions. | Read-only; backend controls version access. |
183
241
  | `feedback history` | Lists audited feedback board/refinement events. | Read-only; backend checks project access. |
184
242
  | `feedback validate` | Sends an artifact to backend validation without mutation. | Useful before submit or owner-direct apply. |
185
- | `feedback apply` | Applies an artifact through the owner-direct/emergency path. | Not the normal collaborator flow; normal flow is `submit` -> `review`. |
243
+ | `feedback apply` | Applies an artifact through the owner-direct/emergency path. | No approval artifact required; not the normal collaborator flow; normal flow is `submit` -> `review`. |
186
244
 
187
245
  Canonical feedback lifecycle states are `frozen`, `todo`, `in_progress`, `in_review`, `completed`, `deployed`, `rejected`, and `archived`.
188
246
 
@@ -194,13 +252,16 @@ node ./scripts/feedback-live-full-harness.js --confirm-live --base-url https://a
194
252
 
195
253
  The harness creates five disposable `TEST` feedback items from markdown, verifies batch review and batch board movement, batch archives the disposable items, verifies normal `feedback-sync` excludes archived items, and verifies the project-key surface does not expose Feedback unarchive/restore.
196
254
 
197
- ## Direct Project API Surface
198
-
199
- All routes use `Authorization: Bearer <MYTE_API_KEY>`. The CLI adds idempotency and client-session headers on mutation routes.
200
-
201
- Read/sync routes:
202
-
203
- - `GET /api/project-assistant/config`
255
+ ## Direct Project API Surface
256
+
257
+ All routes use `Authorization: Bearer <MYTE_API_KEY>`. The CLI adds idempotency and client-session headers on mutation routes.
258
+
259
+ `myte ai` is separate from this project-scoped surface. It uses `MYTEAI_API_KEY` and calls `POST https://api.myte.ai/v1/chat/completions`, or `${MYTEAI_API_BASE}/v1/chat/completions` when that base is configured.
260
+
261
+ Read/sync routes:
262
+
263
+ - `GET /api/project-assistant/query/<job_id>`
264
+ - `GET /api/project-assistant/config`
204
265
  - `GET /api/project-assistant/bootstrap`
205
266
  - `GET /api/project-assistant/qaqc-sync`
206
267
  - `GET /api/project-assistant/feedback-sync`