toga-ai 1.0.465 → 1.0.466

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.
@@ -6,7 +6,7 @@ project: Tools
6
6
  client: shared
7
7
  type: feature
8
8
  status: active
9
- updated: 2026-07-16
9
+ updated: 2026-07-28
10
10
  owners: [jcardinal]
11
11
  files:
12
12
  - tools/mvc/talos/kb-documents/get.php
@@ -108,7 +108,7 @@ Vectors** (the canonical design — see the architecture note below), and the fl
108
108
  3. **S3 Vectors store** — create a dedicated vector bucket + index via
109
109
  `App_Talos_Bedrock::createVectorStore()`, capturing the authoritative **`indexArn`**.
110
110
  4. **VECTOR KB** — `createKnowledgeBase($bedrock, $slug, $indexArn)` (VECTOR + `S3_VECTORS`
111
- storage).
111
+ storage), **tagged** with the mandatory `App_Talos_Bedrock::KB_TAGS` pair (see below).
112
112
  5. **wait for `ACTIVE`** (`waitForKnowledgeBaseActive`).
113
113
  6. **S3 data source** — plain `S3` connector + `BEDROCK_DATA_AUTOMATION` parsing.
114
114
  7. **`Team.KnowledgeBases`** (`db_team`, Team MySQL cluster).
@@ -163,8 +163,16 @@ orphaned KB).
163
163
  float32, euclidean), then **polls `getIndex` for the authoritative index ARN** with a short
164
164
  `NotFound` retry; returns an actionable error on `Conflict`/`AlreadyExists` from an orphaned
165
165
  prior attempt.
166
+ - **`KB_TAGS`** — the **mandatory** tag pair stamped on every new KB:
167
+ `['tenant' => 'True', 'model_role' => 'knowledge_base']`. Passed as the top-level `'tags'`
168
+ parameter of `CreateKnowledgeBase`. Casing is load-bearing: capital-T **`True`**, snake_case
169
+ **`model_role`**. Verified against the live `development-team-toga-desk` KB (`ZOLCCQZZL1`) with
170
+ `aws bedrock-agent list-tags-for-resource --resource-arn
171
+ arn:aws:bedrock:us-east-1:654654170868:knowledge-base/ZOLCCQZZL1 --region us-east-1`. These tags
172
+ drive **cost allocation and model-inventory reporting** in the togaiq account — an untagged KB is
173
+ invisible to those reports.
166
174
  - `createKnowledgeBase($bedrock, string $slug, string $indexArn)` — creates the VECTOR KB with
167
- `S3_VECTORS` storage (signature now takes the index ARN).
175
+ `S3_VECTORS` storage (signature takes the index ARN) and applies `KB_TAGS`.
168
176
  - `waitForKnowledgeBaseActive()` polls `getKnowledgeBase` every `WAIT_INTERVAL_SECONDS` (3s)
169
177
  up to **`WAIT_MAX_SECONDS` = 300**. Exits immediately on `ACTIVE`/`FAILED`. 300s sits well
170
178
  under the 900s Apache/PHP ceiling.
@@ -191,6 +199,12 @@ orphaned KB).
191
199
  `iam:PassRole` on the shared role. Its bedrock create actions were already covered by
192
200
  `AmazonBedrockFullAccess` and S3 by `AmazonS3FullAccess`. **`s3vectors` is a SEPARATE service
193
201
  NOT covered by `AmazonBedrockFullAccess`** — that was the real missing grant.
202
+ - **⚠ `bedrock:TagResource` (new, NOT yet verified as granted).** AWS authorizes
203
+ **tagging-on-create separately from the create action itself**. Now that `createKnowledgeBase()`
204
+ sends `tags`, the `bedrock-model-accessor` user must also hold **`bedrock:TagResource`** on the
205
+ knowledge-base resource, or `CreateKnowledgeBase` fails with `AccessDeniedException` — even
206
+ though the *identical call without tags* would have succeeded. Confirm this grant with devops
207
+ **before the next real KB creation** (see the orphaned-vector-bucket gotcha).
194
208
 
195
209
  ## Helpers
196
210
 
@@ -277,6 +291,17 @@ orphaned KB).
277
291
  `Conflict`/`AlreadyExists` on the vector bucket (surfaced as an actionable error) or creates a
278
292
  **duplicate** Bedrock KB (Bedrock allows same-name KBs with new ids). After a failed create:
279
293
  delete the orphaned vector store + KB and re-run clean, or finish the DB rows manually.
294
+ - **Tagging on create needs its own IAM permission, and failing it orphans a vector bucket.**
295
+ `bedrock:TagResource` is authorized separately from `CreateKnowledgeBase`. Because the KB is
296
+ created at **step 4 — after** the S3 Vectors bucket + index (step 3) — a missing `TagResource`
297
+ grant aborts the flow leaving an **orphaned `bedrock-knowledge-base-{slug}` vector bucket with
298
+ no KB and no DB rows**, and retrying the same slug then hits `Conflict`/`AlreadyExists`. If a
299
+ create suddenly starts failing `AccessDeniedException` right after the vector store succeeds,
300
+ suspect this permission first — not the tag values.
301
+ - **Only the Bedrock KB is tagged — the per-KB S3 Vectors bucket is deliberately NOT.** Scope
302
+ decision (2026-07-28): `createVectorStore()` leaves `bedrock-knowledge-base-{slug}` untagged.
303
+ Known gap: the vector bucket is a **separate billable resource**, so vector-storage cost is not
304
+ attributed by `tenant`/`model_role`. Revisit if cost reporting needs it.
280
305
  - **Two prior KBs use the WRONG (fully-MANAGED) type.** `development-team-craftex` and
281
306
  `development-team-toga-desk` were created by the earlier MANAGED code and were **intentionally
282
307
  left as-is** (this session's scope was code-only). They should be **recreated later** to match
@@ -296,6 +321,14 @@ orphaned KB).
296
321
 
297
322
  ## Change history
298
323
 
324
+ - 2026-07-28 — **Every new Bedrock KB is now tagged** `tenant=True` + `model_role=knowledge_base`
325
+ via the new `App_Talos_Bedrock::KB_TAGS` constant, passed as the `tags` parameter of
326
+ `CreateKnowledgeBase` (required for togaiq cost allocation / model-inventory reporting; values
327
+ and casing verified against the live `toga-desk` KB `ZOLCCQZZL1`). **New IAM prerequisite:**
328
+ tagging-on-create needs `bedrock:TagResource` on the `bedrock-model-accessor` user — *not yet
329
+ verified as granted*; without it `CreateKnowledgeBase` returns `AccessDeniedException` and, with
330
+ no rollback, orphans the already-created S3 Vectors bucket. Scoped decision: the per-KB S3
331
+ Vectors bucket is left **untagged**, so vector-storage cost is not attributed. (jcardinal)
299
332
  - 2026-07-16 — **Corrected the KB-create architecture from MANAGED to VECTOR + S3 Vectors**
300
333
  (the canonical design, from `development-team-dunn`; the earlier code was modeled on the WRONG
301
334
  `craftex`/MANAGED KB). Rewrote `App_Talos_Bedrock`: KB is now `VECTOR` + `S3_VECTORS` storage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.465",
3
+ "version": "1.0.466",
4
4
  "description": "TOGA Technology Team Claude Knowledge System — shared AI coding harness with skills, knowledge base CLI, and project installer for Claude Code.",
5
5
  "keywords": [
6
6
  "claude",