toga-ai 1.0.319 → 1.0.320

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.
@@ -7,6 +7,6 @@
7
7
  | [Tools MVC — Routing, CSRF & App_Database Access Patterns](features/mvc-data-access-patterns.md) | The load-bearing 1.0 (`App_`) framework conventions a developer needs when adding a page to the Tools app — URL routing, CSRF, and DB access through `App_Databa | tools/_/app/nav.php, tools/mvc/get.php |
8
8
  | [Tools Persona-Gated Navigation (App_Nav)](features/persona-gated-navigation.md) | `App_Nav` is the Tools app's two-level, **persona-gated** navigation. | tools/_/app/nav.php, tools/mvc/get.php |
9
9
  | [Tools SAML SSO Consumer & Persona-Gated Auth (App_Auth)](features/saml-sso-auth.md) | `App_Auth` is the Tools app's authentication layer: it consumes the SAML gateway `?saml=` handoff (see the 2.0 SAML downstream integration contract), establishe | tools/_/app/auth.php, tools/mvc/sso/initiate/get.php, tools/mvc/sso/get.php, tools/mvc/login/get.php, tools/mvc/login/post.php, tools/mvc/logout/get.php, tools/mvc/get.php, tools/config.production.ini, tools/config.local.ini |
10
- | [Talos Knowledge Base Admin UI (KB Documents + Vocabulary)](features/talos-kb-documents-admin.md) | A Tools (1.0) admin UI to browse/fix the Talos knowledge-base documents and manage the transcript-cleanup vocabulary — without a deploy. | tools/mvc/talos/kb-documents/get.php, tools/mvc/talos/kb-documents/post.php, tools/mvc/talos/vocabulary/get.php, tools/mvc/talos/vocabulary/post.php, tools/_/app/talos/s3.php, tools/_/app/worker.php, tools/_/app/nav.php, tools/config.production.ini, tools/config.alpha.ini |
10
+ | [Talos Knowledge Base Admin UI (KB Documents + Vocabulary)](features/talos-kb-documents-admin.md) | A Tools (1.0) admin UI to browse/fix the Talos knowledge-base documents and manage the transcript-cleanup vocabulary — without a deploy. | tools/mvc/talos/kb-documents/get.php, tools/mvc/talos/kb-documents/post.php, tools/mvc/talos/knowledge-bases/post.php, tools/mvc/talos/vocabulary/get.php, tools/mvc/talos/vocabulary/post.php, tools/_/app/talos/s3.php, tools/_/app/talos/bedrock.php, tools/_/app/worker.php, tools/_/app/nav.php, tools/config.production.ini, tools/config.alpha.ini, tools/.platform/httpd/conf.d/timeouts.conf |
11
11
  | [Talos Pricing UI (Onboarding, Dashboard, Benchmarks, Cost Factors + Estimator)](features/talos-pricing-ui.md) | The 1.0 (tools app) face of the **Talos Pricing Platform** — a "Talos Pricing" nav folder with four pages plus a client-side estimate engine. | tools/_/app/nav.php, tools/_/app/talos/estimator.php, tools/mvc/talos/onboarding/get.php, tools/mvc/talos/onboarding/post.php, tools/mvc/talos/pricing/get.php, tools/mvc/talos/benchmarks/get.php, tools/mvc/talos/factors/get.php, tools/mvc/talos/factors/post.php, tools/assets/css/style.css |
12
12
  | [Deploying Tools to Elastic Beanstalk (PHP 8.5 / Amazon Linux 2023)](workflows/deploy-to-elastic-beanstalk-al2023.md) | How the **Tools** 1.0 app boots on Elastic Beanstalk running `PHP 8.5 on 64bit Amazon Linux 2023/4.13.1 (aarch64)`. | tools/.ebextensions/004_http_to_https.config, tools/.ebextensions/006_mount-s3fs.config, tools/.ebextensions/007_setup_export_cache_folders.config, tools/.ebextensions/008_setup_ldap.config, tools/.ebextensions/009_setup_phpini.config, tools/.ebextensions/020_setup_git_libraries.config, tools/.ebextensions/050_register_instance_to_shared_application_load_balancer.config, tools/ebs/git.json |
@@ -6,18 +6,21 @@ project: Tools
6
6
  client: shared
7
7
  type: feature
8
8
  status: active
9
- updated: 2026-07-09
9
+ updated: 2026-07-13
10
10
  owners: [jcardinal]
11
11
  files:
12
12
  - tools/mvc/talos/kb-documents/get.php
13
13
  - tools/mvc/talos/kb-documents/post.php
14
+ - tools/mvc/talos/knowledge-bases/post.php
14
15
  - tools/mvc/talos/vocabulary/get.php
15
16
  - tools/mvc/talos/vocabulary/post.php
16
17
  - tools/_/app/talos/s3.php
18
+ - tools/_/app/talos/bedrock.php
17
19
  - tools/_/app/worker.php
18
20
  - tools/_/app/nav.php
19
21
  - tools/config.production.ini
20
22
  - tools/config.alpha.ini
23
+ - tools/.platform/httpd/conf.d/timeouts.conf
21
24
  related:
22
25
  - ./mvc-data-access-patterns.md
23
26
  - ./persona-gated-navigation.md
@@ -73,6 +76,33 @@ so they displayed **double-encoded** (e.g. "Grand & Toy"). `vocabulary/post.
73
76
  `html_entity_decode()`s values on save so the DB stores **raw** text; `vocabulary/get.php`
74
77
  already escapes once at display. Do not re-add encoding on save.
75
78
 
79
+ ### `POST /talos/knowledge-bases` — create a new KB (synchronous provisioning)
80
+
81
+ Admin action that provisions a brand-new Talos knowledge base end to end in **one
82
+ synchronous request**: creates the S3 prefix, creates the Bedrock KB and **waits for it to
83
+ reach `ACTIVE`**, creates the Bedrock data source (`MANAGED_KNOWLEDGE_BASE_CONNECTOR`), and
84
+ inserts 2 MySQL (`Team.KnowledgeBases`, `Team.VectorIndexes`) + 2 Postgres rows. This flow
85
+ **stays synchronous by design** — moving it to worker2/SQS async was explicitly rejected;
86
+ the fix path is to raise timeouts, never to background the work.
87
+
88
+ The handler is **best-effort with no rollback**: on a mid-flow failure it stops and returns
89
+ a `steps[]` report **without tearing down** already-created AWS resources (see Gotchas —
90
+ orphaned KB).
91
+
92
+ **`App_Talos_Bedrock`** (`_/app/talos/bedrock.php`) — Bedrock Agent client:
93
+ - `waitForKnowledgeBaseActive()` polls `getKnowledgeBase` every `WAIT_INTERVAL_SECONDS` (3s)
94
+ up to **`WAIT_MAX_SECONDS` = 300** (raised from 90; MANAGED KBs were observed taking ~3 min
95
+ to leave `CREATING`). Exits immediately on `ACTIVE`/`FAILED`, so fast activations are
96
+ unaffected. 300s sits well under the 900s Apache/PHP ceiling.
97
+ - `createDataSource()` — `connectorParameters` for `managedKnowledgeBaseConnectorConfiguration`
98
+ is a **`Document` shape (free-form JSON)** in the AWS PHP SDK model and **must be passed as a
99
+ native PHP array** so the SDK serializes a JSON *object*. Passing a pre-`json_encode()`d
100
+ **string** fails `ValidationException "Invalid connector parameters format"`. Working object
101
+ shape (matches the craftex data source):
102
+ `{type:S3, filterConfiguration:{maxFileSizeInMegaBytes:"500",
103
+ inclusionPrefixes:["development-team/{slug}/approved/"]}, connectionConfiguration:{bucketName:togaiq,
104
+ bucketOwnerAccountId:654654170868, bucketArn:arn:aws:s3:::togaiq}, aclEnabled:false, version:"1"}`.
105
+
76
106
  ## Helpers
77
107
 
78
108
  - **`App_Talos_S3`** (`_/app/talos/s3.php`) — S3 client; list KB slugs; list/count approved
@@ -116,11 +146,45 @@ already escapes once at display. Do not re-add encoding on save.
116
146
  within the same bucket; move/edit copy via get+put.
117
147
  - **Move/edit re-sync must be one `SyncKb("source,dest")` job**, not two parallel jobs — Bedrock
118
148
  allows only one in-flight ingestion per KB and parallel syncs race.
149
+ - **KB create is synchronous and long (~minutes).** It must run under a raised timeout — see
150
+ the EB Apache 504 gotcha below. Do **not** re-architect it to worker2/SQS (explicitly
151
+ rejected).
152
+ - **EB AL2023 PHP platform → 60s default proxy timeout → 504.** The tools app runs on Elastic
153
+ Beanstalk PHP 8.5 / Amazon Linux 2023, where **Apache proxies to php-fpm via
154
+ `mod_proxy_fcgi`** and the proxy read timeout defaults to `Timeout` = **60s**. A long
155
+ synchronous request (KB create) returns **504 after exactly 60s**. Raising the **ALB idle
156
+ timeout does not help** (it's upstream of Apache), and PHP `set_time_limit(900)` is
157
+ irrelevant (Apache emits the 504, and on Linux `max_execution_time` does not count time
158
+ blocked in network I/O). Fix: an EB platform Apache drop-in at
159
+ **`.platform/httpd/conf.d/timeouts.conf`** setting `Timeout 900` and **`ProxyTimeout 900`**
160
+ (`ProxyTimeout` is the `mod_proxy_fcgi` read timeout; matches the framework's
161
+ `set_time_limit(900)`). Applied on deploy.
162
+ - **php-fpm `request_terminate_timeout` can still kill the request.** If
163
+ `/etc/php-fpm.d/www.conf`'s `request_terminate_timeout` is ever set to 60 it terminates the
164
+ request regardless of Apache — it must be `0` or `>= 900`.
165
+ - **`get-data-source` echoes `connectorParameters` back as a quoted STRING** even though the
166
+ create input must be a JSON **object** — the GET representation is misleading and does NOT
167
+ indicate the required input shape.
168
+ - **KB create has no rollback → orphaned KB risk.** A failure at the data-source step leaves an
169
+ orphaned Bedrock KB with **no DB rows** (`Team.KnowledgeBases`/`VectorIndexes`/Postgres never
170
+ inserted). Blindly re-running with the same name creates a **duplicate** Bedrock KB (Bedrock
171
+ allows same-name KBs with new ids). After a failed create: either
172
+ `aws bedrock-agent delete-knowledge-base` the orphan and re-run clean, or finish the DB rows
173
+ manually.
119
174
  - No new secret literals introduced; credentials live in the config sections above (documented by
120
- section/account, never by value).
175
+ section/account, never by value). AWS account id `654654170868`, bucket `togaiq`, and the KB
176
+ execution-role ARN are non-secret resource identifiers.
121
177
 
122
178
  ## Change history
123
179
 
180
+ - 2026-07-13 — Added the **synchronous KB-create flow** (`POST /talos/knowledge-bases`) via new
181
+ `App_Talos_Bedrock` helper. Fixed the **504 at 60s**: EB AL2023 PHP = Apache→php-fpm over
182
+ `mod_proxy_fcgi` with a 60s default proxy read timeout; added
183
+ `.platform/httpd/conf.d/timeouts.conf` (`Timeout 900` + `ProxyTimeout 900`). Raised
184
+ `WAIT_MAX_SECONDS` 90→300 (MANAGED KBs take ~3 min to go `ACTIVE`). Fixed `createDataSource`
185
+ `ValidationException` by passing `connectorParameters` as a native array (`Document` shape),
186
+ not a `json_encode`d string. Documented the no-rollback orphaned-KB caveat and the misleading
187
+ `get-data-source` string echo. Flow stays synchronous (worker2 async rejected). (jcardinal)
124
188
  - 2026-07-09 — Fixed `App_Talos_S3::sanitizeTitle()` to convert `/`,`\` to hyphens (was
125
189
  spaces) so a slashed meeting title no longer creates a stray S3 sub-folder — matches
126
190
  worker2's `filenameSafeTitle()`; `updateApprovedDocument()` already renames the S3 object and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.319",
3
+ "version": "1.0.320",
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",