@aifabrix/builder 2.59.0 → 2.61.2

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.
Files changed (145) hide show
  1. package/README.md +14 -11
  2. package/docs/README.md +80 -0
  3. package/docs/builder-help/evidence-patterns.json +155 -0
  4. package/docs/builder-help/golden-examples/crm-company.json +30 -0
  5. package/docs/builder-help/golden-examples/crm-deal.json +29 -0
  6. package/docs/builder-help/golden-examples/document-storage-keyed-get.json +85 -0
  7. package/docs/builder-help/golden-examples/document-storage.json +30 -0
  8. package/docs/builder-help/golden-examples/meeting-transcript.json +29 -0
  9. package/docs/builder-help/golden-examples/repository-template.json +29 -0
  10. package/docs/builder-help/golden-examples/service-ticket.json +29 -0
  11. package/docs/builder-help/platform-roles.json +98 -0
  12. package/docs/builder-help/resource-type-catalog.json +402 -0
  13. package/lib/agent-kit/git-identity.js +180 -0
  14. package/lib/agent-kit/setup.js +3 -0
  15. package/lib/agent-kit/start.js +45 -1
  16. package/lib/api/configuration.api.js +131 -0
  17. package/lib/api/role-assistant-test-job.api.js +60 -0
  18. package/lib/api/system-secrets.api.js +72 -0
  19. package/lib/api/work-search.api.js +13 -6
  20. package/lib/app/deploy.js +8 -1
  21. package/lib/app/run-docker-fallback.js +6 -1
  22. package/lib/app/run-helpers.js +2 -1
  23. package/lib/app/run-parameter-sync.js +142 -0
  24. package/lib/app/show-display.js +1 -0
  25. package/lib/app/show-online.js +15 -0
  26. package/lib/build/docker-build-args.js +5 -2
  27. package/lib/build/index.js +3 -2
  28. package/lib/build/standard-docker-build.js +6 -3
  29. package/lib/cli/setup-app.js +19 -1
  30. package/lib/cli/setup-environment.js +156 -0
  31. package/lib/cli/setup-utility.js +24 -1
  32. package/lib/commands/datasource-capability-upsert-cli.js +112 -0
  33. package/lib/commands/datasource-capability.js +4 -2
  34. package/lib/commands/env-secret-context.js +113 -0
  35. package/lib/commands/env-secret-list.js +200 -0
  36. package/lib/commands/env-secret-push-confirm.js +54 -0
  37. package/lib/commands/env-secret-push-run.js +227 -0
  38. package/lib/commands/env-secret-push.js +168 -0
  39. package/lib/commands/repair-datasource-apply.js +2 -0
  40. package/lib/commands/repair-datasource-keyed-document.js +122 -0
  41. package/lib/commands/repair-datasource-run.js +1 -0
  42. package/lib/commands/role-assistant.js +7 -0
  43. package/lib/commands/setup-modes.js +1 -8
  44. package/lib/commands/setup-prompts.js +2 -180
  45. package/lib/commands/verify-operations-skip-e2e.js +25 -1
  46. package/lib/commands/verify-operations-steps.js +13 -1
  47. package/lib/commands/wizard-config-normalizer.js +7 -4
  48. package/lib/commands/wizard-core.js +5 -157
  49. package/lib/commands/wizard-file-saving.js +163 -0
  50. package/lib/core/env-platform-expand.js +97 -0
  51. package/lib/core/secrets-env-content.js +42 -4
  52. package/lib/core/secrets-env-write.js +10 -3
  53. package/lib/core/secrets-load.js +4 -2
  54. package/lib/datasource/binary-documents-validator.js +190 -0
  55. package/lib/datasource/capability/run-capability-upsert.js +202 -0
  56. package/lib/datasource/capability/upsert-ingredients.js +291 -0
  57. package/lib/datasource/capability/upsert-operations.js +138 -0
  58. package/lib/datasource/capability/upsert-test-scaffold.js +189 -0
  59. package/lib/datasource/validate.js +12 -5
  60. package/lib/deployment/installation/azure-infra-stage.js +3 -1
  61. package/lib/deployment/installation/infra-catalog.js +2 -5
  62. package/lib/generator/builders.js +17 -0
  63. package/lib/generator/helpers.js +23 -2
  64. package/lib/generator/index.js +13 -6
  65. package/lib/lifecycle/product-model.js +4 -3
  66. package/lib/lifecycle/report-display.js +3 -2
  67. package/lib/parameters/infra-parameter-catalog.js +1 -1
  68. package/lib/programmatic/builder-help-enterprise-sync-fabrix.js +1 -1
  69. package/lib/programmatic/builder-help-governance.js +1 -1
  70. package/lib/programmatic/builder-help.js +1 -1
  71. package/lib/role-assistant/test-cases-search.js +3 -0
  72. package/lib/role-assistant/test-job-runner.js +125 -0
  73. package/lib/role-assistant/test-runner-search.js +44 -2
  74. package/lib/role-assistant/test-runner-workhub-answers.js +4 -1
  75. package/lib/role-assistant/test-runner-workhub-missing-fields.js +42 -0
  76. package/lib/role-assistant/test-runner-workhub-wait-stop.js +94 -0
  77. package/lib/role-assistant/test-runner-workhub.js +28 -19
  78. package/lib/schema/application-schema.json +205 -2
  79. package/lib/schema/external-datasource.schema.json +23 -3
  80. package/lib/schema/infra-parameter.schema.json +139 -33
  81. package/lib/schema/infra.parameter.yaml +416 -66
  82. package/lib/schema/infrastructure-schema.json +10 -35
  83. package/lib/utils/compose-generate-docker-compose.js +16 -9
  84. package/lib/utils/datasource-binary-evidence.js +92 -0
  85. package/lib/utils/datasource-test-run-capability-scope.js +44 -1
  86. package/lib/utils/datasource-test-run-debug-display.js +2 -0
  87. package/lib/utils/datasource-test-run-display.js +8 -2
  88. package/lib/utils/datasource-test-run-issue-guidance.js +176 -0
  89. package/lib/utils/datasource-test-run-tty-log.js +2 -0
  90. package/lib/utils/docker-build.js +29 -8
  91. package/lib/utils/docker-manifest-public-port.js +36 -0
  92. package/lib/utils/env-copy.js +11 -10
  93. package/lib/utils/external-system-system-test-tty.js +3 -2
  94. package/lib/utils/image-tags.js +2 -2
  95. package/lib/utils/platform-kv-ref.js +1 -1
  96. package/lib/utils/platform-resolution.js +226 -0
  97. package/lib/utils/prepare-local-data-mount.js +58 -0
  98. package/lib/utils/resolve-docker-image-ref.js +8 -3
  99. package/lib/utils/secrets-helpers.js +0 -1
  100. package/lib/utils/system-secret-mapping.js +125 -0
  101. package/lib/utils/test-log-writer.js +2 -1
  102. package/lib/validation/external-manifest-validator.js +5 -0
  103. package/lib/validation/openapi-contract-surface-validator.js +3 -1
  104. package/lib/validation/validate-external-file.js +5 -1
  105. package/package.json +5 -4
  106. package/templates/README.md +2 -1
  107. package/templates/agent-kit/agent-kit.yaml +4 -1
  108. package/templates/agent-kit/instructions/AGENTKIT.md +1 -1
  109. package/templates/agent-kit/instructions/root.AGENTS.md +2 -0
  110. package/templates/agent-kit/skills/aifabrix-connected-system/SKILL.md +35 -2
  111. package/templates/agent-kit/skills/aifabrix-connected-system/references/delivery-gates.md +15 -0
  112. package/templates/agent-kit/skills/aifabrix-connected-system/scripts/delivery-verdict.js +176 -0
  113. package/templates/agent-kit/skills/aifabrix-plan/SKILL.md +6 -2
  114. package/templates/agent-kit/skills/aifabrix-prove/SKILL.md +28 -2
  115. package/templates/agent-kit/skills/aifabrix-prove/references/evidence-lifecycle.md +22 -0
  116. package/templates/agent-kit/skills/aifabrix-role-assistant/SKILL.md +28 -1
  117. package/templates/agent-kit/skills/aifabrix-role-assistant/references/testing-playbook.md +117 -0
  118. package/templates/agent-kit/skills/shared/feedback.md +31 -0
  119. package/templates/agent-kit/skills/shared/hosts.md +13 -3
  120. package/templates/agent-kit/skills/shared/interaction.md +83 -0
  121. package/templates/agent-kit/skills/shared/status.md +76 -0
  122. package/templates/agent-kit/workspace/BUILDER_IMPROVEMENT_FINDINGS.md +27 -0
  123. package/templates/applications/builder-api/application.yaml +1 -1
  124. package/templates/applications/builder-api/env.template +5 -1
  125. package/templates/applications/dataplane/application.yaml +30 -2
  126. package/templates/applications/dataplane/env.template +36 -5
  127. package/templates/applications/keycloak/application.yaml +6 -1
  128. package/templates/applications/miso-controller/application.yaml +96 -1
  129. package/templates/applications/miso-controller/env.template +63 -37
  130. package/templates/applications/miso-controller/rbac.yaml +17 -0
  131. package/templates/external-system/external-datasource.yaml.hbs +7 -1
  132. package/templates/marketplace/main.json +73 -225
  133. package/templates/python/Dockerfile.hbs +2 -0
  134. package/templates/python/docker-compose.hbs +1 -1
  135. package/templates/typescript/Dockerfile.hbs +2 -0
  136. package/templates/typescript/docker-compose.hbs +12 -0
  137. package/templates/agent-kit/skills/aifabrix-plan/references/interaction.md +0 -34
  138. /package/{lib/programmatic/help-content → docs/builder-help/content}/channel-onboarding.md +0 -0
  139. /package/{lib/programmatic/help-content → docs/builder-help/content}/cip-overview.md +0 -0
  140. /package/{lib/programmatic/help-content → docs/builder-help/content}/connected-system-ui.md +0 -0
  141. /package/{lib/programmatic/help-content → docs/builder-help/content}/dimensions-guide.md +0 -0
  142. /package/{lib/programmatic/help-content → docs/builder-help/content}/enterprise-sync-fabrix.md +0 -0
  143. /package/{lib/programmatic/help-content → docs/builder-help/content}/overview.md +0 -0
  144. /package/{lib/programmatic/help-content → docs/builder-help/content}/subscription-guide.md +0 -0
  145. /package/{lib/programmatic/help-content → docs/builder-help/content}/workflow.md +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aifabrix/builder",
3
- "version": "2.59.0",
3
+ "version": "2.61.2",
4
4
  "description": "AI Fabrix Builder — CLI and developer scripts (pnpm + af)",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -10,6 +10,7 @@
10
10
  "files": [
11
11
  "bin/aifabrix.js",
12
12
  "lib/",
13
+ "docs/builder-help/",
13
14
  "templates/",
14
15
  "README.md",
15
16
  "LICENSE"
@@ -24,7 +25,7 @@
24
25
  "dev-deploy": "node scripts/pnpm/dev-deploy.mjs",
25
26
  "af": "node scripts/pnpm/af.mjs",
26
27
  "check-quiet": "node scripts/pnpm/check-quiet.mjs",
27
- "agent-skills:sync": "node scripts/pnpm/agent-skills-sync.mjs",
28
+ "agent-skills:sync": "node scripts/pnpm/agent-skills-sync.mjs --codex-home",
28
29
  "agent-skills:check": "node scripts/pnpm/agent-skills-sync.mjs --check",
29
30
  "agent-skills:sync:codex": "node scripts/pnpm/agent-skills-sync.mjs --codex-home",
30
31
  "agent-skills:test": "node --test scripts/pnpm/agent-skills-sync.test.mjs",
@@ -131,9 +132,9 @@
131
132
  }
132
133
  },
133
134
  "dependencies": {
134
- "@aifabrix/miso-client": "4.23.1",
135
+ "@aifabrix/miso-client": "5.0.3",
135
136
  "@azure/identity": "4.11.1",
136
- "adm-zip": "^0.6.0",
137
+ "adm-zip": "^0.6.1",
137
138
  "ajv": "^8.20.0",
138
139
  "ajv-formats": "^3.0.1",
139
140
  "axios": "^1.18.1",
@@ -23,9 +23,10 @@ Application templates are folder-based and located under `templates/applications
23
23
  | `aifabrix-miso/builder/miso-controller/` (`env.template`, `rbac.yaml`, `application.yaml`) | `templates/applications/miso-controller/` |
24
24
  | `aifabrix-miso/builder/keycloak/` (`env.template`, `application.yaml`, `Dockerfile`, `cimd-lenient-parse/`) | `templates/applications/keycloak/` |
25
25
  | `aifabrix-miso/infrastructure/marketplace/` (`main.json`, `createUiDefinition.json`) | `templates/marketplace/` |
26
+ | `aifabrix-miso/packages/miso-controller/configs/infra.parameter.yaml` | `lib/schema/infra.parameter.yaml` |
26
27
  | `aifabrix-dataplane/builder/dataplane/` (`env.template`, `rbac.yaml`, `application.yaml`) | `templates/applications/dataplane/` |
27
28
 
28
- **Schema master (dataplane):** Also copies dataplane `app/schemas/json/` core integration schemas + `type/*` and `configs/deployment-rules.yaml` into `lib/schema/` (same contract as dataplane `make sync-json`). Do not hand-edit those mirrors — edit dataplane SSOT, then sync. Builder-owned schemas in `lib/schema/` (wizard, infra, etc.) are left alone.
29
+ **Schema master (dataplane):** Also copies dataplane `app/schemas/json/` core integration schemas + `type/*` and `configs/deployment-rules.yaml` into `lib/schema/` (same contract as dataplane `make sync-json`). Do not hand-edit those mirrors — edit dataplane SSOT, then sync. `lib/schema/infra.parameter.yaml` is the Miso catalog mirror above; other Builder-owned schemas in `lib/schema/` (wizard and the rest) are left alone.
29
30
 
30
31
  Overrides: `AIFABRIX_MISO_SRC`, `AIFABRIX_DATAPLANE_SRC` / `AIFABRIX_DATAPLANE_ROOT` (repo roots). Install with `aifabrix up-platform` / `up-builder-api` — do not hand-edit the template copies as primary.
31
32
 
@@ -1,5 +1,5 @@
1
1
  schemaVersion: "1"
2
- kitVersion: "1.1.2"
2
+ kitVersion: "1.2.1"
3
3
  minimumBuilderVersion: "2.54.2"
4
4
  skills:
5
5
  - aifabrix-plan
@@ -26,6 +26,9 @@ managed:
26
26
  - source: workspace/README.md
27
27
  target: README.md
28
28
  mode: if-missing
29
+ - source: workspace/BUILDER_IMPROVEMENT_FINDINGS.md
30
+ target: BUILDER_IMPROVEMENT_FINDINGS.md
31
+ mode: if-missing
29
32
  optional:
30
33
  - source: adapters/cursor/commands
31
34
  target: .cursor/commands
@@ -97,7 +97,7 @@ mobile app (Code). That is not `claude --cloud` (a separate cloud VM). Claude
97
97
  aifabrix agent-kit start claude
98
98
  ```
99
99
 
100
- tmux session name defaults to this folder. Remote Control name is `hostname-user-folder` (for example `builder01-dev03-aifabrix-docs`). Override with `--name`; opt out with `--no-remote-control` and/or `--skip-approve-all`. Detach: `Ctrl-b` then `d`. Reattach: `tmux attach -t <folder>`. Use `aifabrix agent-kit list` and `agent-kit kill <folder>` to manage sessions. Same account on phone and PC (`claude auth login`, Pro/Max/Team — not an API key). On the phone: Claude app → **Code**. Skills: `/aifabrix-plan` (and the other `/aifabrix-*` names). First `claude` must run inside this workspace, not your home directory. Full notes: `.agents/skills/shared/hosts.md`.
100
+ tmux session name defaults to this folder. Remote Control name is `hostname-user-folder` (for example `devhost-alice-acme-workspace`). Override with `--name`; opt out with `--no-remote-control` and/or `--skip-approve-all`. Detach: `Ctrl-b` then `d`. Reattach: `tmux attach -t <folder>`. Use `aifabrix agent-kit list` and `agent-kit kill <folder>` to manage sessions. Same account on phone and PC (`claude auth login`, Pro/Max/Team — not an API key). On the phone: Claude app → **Code**. Skills: `/aifabrix-plan` (and the other `/aifabrix-*` names). First `claude` must run inside this workspace, not your home directory. Full notes: `.agents/skills/shared/hosts.md`.
101
101
  {{/if}}
102
102
  {{#if codex}}
103
103
 
@@ -14,6 +14,8 @@ Do not edit platform product source (`aifabrix-dataplane`, `aifabrix-miso`, `aif
14
14
 
15
15
  Vendor limits, tenant ids, credentials, PII stance, partitions, and the designated mutation subject live only in `integration/<systemKey>/README.md`.
16
16
 
17
+ `agent-kit update` rewrites `.agents/skills/**`, `AGENTKIT.md`, and managed sections; `--force` discards local edits. Do not edit them: file gaps in `BUILDER_IMPROVEMENT_FINDINGS.md`, sanitized. Never weaken a gate to clear one. Routing: `.agents/skills/shared/feedback.md`.
18
+
17
19
  ## First greeting
18
20
 
19
21
  On a first “Hi”, start with the business problem in plain language. Explain
@@ -10,10 +10,17 @@ description: >
10
10
  # aifabrix-connected-system
11
11
 
12
12
  Phases: `plan` | `validate` | `build` | `publish`.
13
- Resolve phase: explicit argument → plan/package state → safe next → ask once.
13
+
14
+ **No phase argument means report only.** Inspect, print the combined status matrix,
15
+ recommend one next phase, and stop. Do not upload, deploy, advance a plan task, create
16
+ proof assets, run cases, or mutate anything until the user names a phase or picks a route:
17
+ [status.md](../shared/status.md).
18
+
19
+ Resolve phase: explicit argument → ask. Package state informs the recommendation, never
20
+ the action.
14
21
 
15
22
  Stop at the phase gate. Do not run the next phase without `next-yes`
16
- ([interaction.md](../aifabrix-plan/references/interaction.md)).
23
+ ([interaction.md](../shared/interaction.md)).
17
24
 
18
25
  | Phase | Entry | Success |
19
26
  | --- | --- | --- |
@@ -22,6 +29,28 @@ Stop at the phase gate. Do not run the next phase without `next-yes`
22
29
  | build | READY | BUILT |
23
30
  | publish | package exists and local validate passes | PASS or PASS_WITH_SKIPS |
24
31
 
32
+ READY and BUILT are **package** gates: they describe files on disk, not a working or
33
+ published system. Report them qualified, beside the Delivery row
34
+ ([status.md](../shared/status.md)).
35
+
36
+ ## Publish and certification verdicts
37
+
38
+ Compute the verdict with
39
+ [scripts/delivery-verdict.js](scripts/delivery-verdict.js) from what you observed; do not
40
+ choose it by narrative.
41
+
42
+ | Observation | Verdict |
43
+ | --- | --- |
44
+ | Online state Draft | publish incomplete; prove BLOCKED; Delivery NEEDS_FIXES |
45
+ | Operations FAILED | NEEDS_FIXES |
46
+ | Known ABAC, persistence, capability, or live-evidence failure | NEEDS_FIXES while open |
47
+ | Bronze or TECHNICALLY_READY alone | not PASS |
48
+ | Online Published **and** acceptable Operations, Trust, Governance and live evidence | PASS |
49
+ | The above with only explicitly allowed skips | PASS_WITH_SKIPS |
50
+
51
+ `PASS_WITH_SKIPS` covers skips the user allowed by name. It may never cover a known
52
+ failure, an unrun gate, or a gate whose result you did not see.
53
+
25
54
  Read current CLI help before composing commands. You own orchestration, not CLI implementation.
26
55
  Host runtimes (local vs SSH): [hosts.md](../shared/hosts.md).
27
56
  CLI login from chat: [login.md](../shared/login.md).
@@ -38,6 +67,8 @@ System key: argument → active plan → sole `integration/` folder → ask once
38
67
 
39
68
  ## References
40
69
 
70
+ - [interaction.md](../shared/interaction.md) — native selection controls, routes, and phase gates
71
+ - [status.md](../shared/status.md) — read-only default, route options, status matrix
41
72
  - [delivery-gates.md](references/delivery-gates.md) — BID/wizard/repair, upload vs deploy, tests, identity, protection
42
73
  - [contract-checklist.md](references/contract-checklist.md) — exposed, FK, viewpoints, RBAC/ABAC
43
74
  - [production-safety.md](references/production-safety.md) — designated subject, credential-deferred E2E
@@ -52,6 +83,8 @@ System key: argument → active plan → sole `integration/` folder → ask once
52
83
  - Upload without deploy is not published and not PASS
53
84
  - No system-level sync of views
54
85
  - No publish continuation after an unresolved hard failure
86
+ - A known failure stays open until that same concern is rerun and passes
87
+ - No bare READY/BUILT/PASS headline when Delivery is NEEDS_FIXES or BLOCKED
55
88
 
56
89
  ## Trigger examples
57
90
 
@@ -39,6 +39,21 @@ If `integration/<systemKey>/deploy.js` exists, you may run it as the publish lad
39
39
 
40
40
  Never mark live E2E pass when it did not run.
41
41
 
42
+ ## Upsert authoring and warnings
43
+
44
+ When upsert is explicitly required, first run
45
+ `aifabrix datasource capability upsert <file-or-key> --dry-run --json`. Apply a
46
+ fix automatically only when the finding identifies a deterministic local
47
+ manifest change and the active phase authorizes mutation. Rerun the exact
48
+ failed command before broader validation.
49
+
50
+ Every open finding must state the observed condition, business consequence,
51
+ safe action, prevention, residual risk, and exact rerun. A source API that
52
+ cannot constrain the complete business identity is not AI-fixable: keep valid
53
+ separate create/update capabilities, report duplicate or wrong-update risk,
54
+ and withhold verified upsert. Never invent a lookup, weaken the two-write
55
+ no-duplicate assertion, or hide the warning behind another passing test.
56
+
42
57
  ## Identity and protection order
43
58
 
44
59
  1. `aifabrix auth status` — if unauthenticated, [login.md](../../shared/login.md)
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Delivery verdict for a customer Connected System and Role Assistant.
3
+ *
4
+ * The agent records what it observed; this decides the verdict. Keeping the decision here
5
+ * rather than in skill prose means a passing package cannot be narrated into a passing
6
+ * delivery: precedence is computed, not chosen.
7
+ *
8
+ * Gates are reported separately on purpose. A package can be BUILT while the delivery
9
+ * needs fixes and prove is blocked, and all three are true at once.
10
+ *
11
+ * @fileoverview Deterministic status matrix and overall verdict for customer delivery skills
12
+ */
13
+
14
+ 'use strict';
15
+
16
+ /** Worst-first. A later gate never improves an earlier one. */
17
+ const RANK = ['BLOCKED', 'NEEDS_FIXES', 'PASS_WITH_SKIPS', 'PASS'];
18
+ const UNKNOWN = 'UNKNOWN';
19
+
20
+ /**
21
+ * @param {string} a First verdict
22
+ * @param {string} b Second verdict
23
+ * @returns {string} The worse of the two
24
+ */
25
+ function worse(a, b) {
26
+ const left = RANK.indexOf(a);
27
+ const right = RANK.indexOf(b);
28
+ if (left < 0) return b;
29
+ if (right < 0) return a;
30
+ return left <= right ? a : b;
31
+ }
32
+
33
+ /**
34
+ * Trim and uppercase an observed field. Missing values become an empty string.
35
+ * @param {*} value Observed field
36
+ * @returns {string} Normalized token
37
+ */
38
+ function norm(value) {
39
+ return String(value === undefined || value === null ? '' : value).trim().toUpperCase();
40
+ }
41
+
42
+ /**
43
+ * Published is the only online state that permits publish completion or live prove.
44
+ * @param {object} signals Observed signals
45
+ * @returns {{ state: string, published: boolean, known: boolean }} Online state
46
+ */
47
+ function onlineState(signals) {
48
+ const state = norm(signals.onlineState) || UNKNOWN;
49
+ return {
50
+ state,
51
+ published: state === 'PUBLISHED',
52
+ known: state === 'PUBLISHED' || state === 'DRAFT'
53
+ };
54
+ }
55
+
56
+ /**
57
+ * Builder's pillar verdicts are VERIFIED, FAILED, NOT_VERIFIED and NOT_APPLICABLE
58
+ * (`lib/lifecycle/product-model.js`). NOT_VERIFIED is not a pass — it is the state a pillar
59
+ * sits in until it has actually been proved, and treating it as neutral is how an
60
+ * unverified system gets reported as delivered. A gate that was never run is UNKNOWN.
61
+ * @param {object} gate Observed gate result
62
+ * @returns {string} Normalized verdict
63
+ */
64
+ function gateVerdict(gate) {
65
+ if (!gate) return UNKNOWN;
66
+ const verdict = norm(gate.verdict);
67
+ if (!verdict || verdict === 'NOT_RUN' || verdict === 'SKIPPED') return UNKNOWN;
68
+ if (verdict === 'VERIFIED' || verdict === 'PASSED' || verdict === 'PASS') return 'PASS';
69
+ if (verdict === 'NOT_APPLICABLE') return 'PASS';
70
+ if (verdict === 'FAILED' || verdict === 'FAIL' || verdict === 'NOT_VERIFIED') return 'NEEDS_FIXES';
71
+ return 'NEEDS_FIXES';
72
+ }
73
+
74
+ /**
75
+ * Failures stay active until the same concern is rerun and passes, so a later structural
76
+ * success cannot clear an earlier runtime, governance, persistence, or E2E failure.
77
+ * @param {Array} knownFailures Recorded failures
78
+ * @returns {Array} Failures still open
79
+ */
80
+ function openFailures(knownFailures) {
81
+ const rows = Array.isArray(knownFailures) ? knownFailures : [];
82
+ return rows.filter(row => row && row.resolved !== true && norm(row.resolved) !== 'TRUE');
83
+ }
84
+
85
+ /**
86
+ * One status-matrix cell: verdict plus an optional percent.
87
+ * @param {object} gate Observed gate result
88
+ * @returns {string} Display text
89
+ */
90
+ function describeScore(gate) {
91
+ if (!gate) return UNKNOWN;
92
+ const verdict = norm(gate.verdict) || norm(gate.category) || UNKNOWN;
93
+ const percent = gate.percent === undefined || gate.percent === null ? '' : ` ${gate.percent}%`;
94
+ return `${verdict}${percent}`;
95
+ }
96
+
97
+ /**
98
+ * Overall delivery verdict. PASS needs a published system and acceptable Operations,
99
+ * Trust, Governance and live-evidence results; an unrun gate is not a pass. BLOCKED is
100
+ * reserved for a delivery that cannot be assessed or was explicitly stopped — a draft
101
+ * system is fixable work, so it reports NEEDS_FIXES.
102
+ * @param {object} signals Observed signals
103
+ * @returns {string} BLOCKED | NEEDS_FIXES | PASS_WITH_SKIPS | PASS
104
+ */
105
+ function overallVerdict(signals) {
106
+ const online = onlineState(signals);
107
+ if (!online.known || signals.blocked === true) return 'BLOCKED';
108
+ let verdict = online.published ? 'PASS' : 'NEEDS_FIXES';
109
+ for (const gate of [signals.operations, signals.trust, signals.governance, signals.liveEvidence]) {
110
+ const result = gateVerdict(gate);
111
+ verdict = worse(verdict, result === UNKNOWN ? 'NEEDS_FIXES' : result);
112
+ }
113
+ if (openFailures(signals.knownFailures).length > 0) verdict = worse(verdict, 'NEEDS_FIXES');
114
+ const skips = Array.isArray(signals.allowedSkips) ? signals.allowedSkips : [];
115
+ if (verdict === 'PASS' && skips.length > 0) return 'PASS_WITH_SKIPS';
116
+ return verdict;
117
+ }
118
+
119
+ /**
120
+ * Prove readiness is a business-case gate. Package validation, pipeline checks, a Bronze
121
+ * certification or TECHNICALLY_READY never establish it on their own.
122
+ * @param {object} signals Observed signals
123
+ * @returns {string} READY | BLOCKED
124
+ */
125
+ function proveReadiness(signals) {
126
+ const overall = overallVerdict(signals);
127
+ if (overall !== 'PASS' && overall !== 'PASS_WITH_SKIPS') return 'BLOCKED';
128
+ const ra = signals.roleAssistant || {};
129
+ // `role-assistant test --json` gives the verdict. Availability is an operator action with
130
+ // no CLI surface, so it must be confirmed explicitly; unconfirmed is not available.
131
+ if (gateVerdict(ra) !== 'PASS' || norm(ra.availability) !== 'AVAILABLE') return 'BLOCKED';
132
+ const cases = signals.cases || {};
133
+ if (cases.happy !== true || cases.safeStop !== true) return 'BLOCKED';
134
+ if (signals.authorityConfirmed !== true) return 'BLOCKED';
135
+ return 'READY';
136
+ }
137
+
138
+ /**
139
+ * Every row the skills must report, in a fixed order.
140
+ * @param {object} signals Observed signals
141
+ * @returns {Array<{ gate: string, value: string }>} Status matrix rows
142
+ */
143
+ function statusMatrix(signals) {
144
+ const ra = signals.roleAssistant || {};
145
+ const availability = `${norm(ra.availability) || UNKNOWN}/${norm(ra.verdict) || UNKNOWN}`;
146
+ return [
147
+ { gate: 'Package', value: norm(signals.packageGate) || UNKNOWN },
148
+ { gate: 'Online', value: onlineState(signals).state },
149
+ { gate: 'AI Readiness', value: describeScore(signals.aiReadiness) },
150
+ { gate: 'Operations', value: describeScore(signals.operations) },
151
+ { gate: 'Trust', value: describeScore(signals.trust) },
152
+ { gate: 'Governance', value: describeScore(signals.governance) },
153
+ { gate: 'Role Assistant', value: availability },
154
+ { gate: 'Prove readiness', value: proveReadiness(signals) },
155
+ { gate: 'Delivery', value: overallVerdict(signals) }
156
+ ];
157
+ }
158
+
159
+ /**
160
+ * A headline may not claim success the overall verdict does not support.
161
+ * @param {object} signals Observed signals
162
+ * @returns {boolean} True when a bare READY, BUILT or PASS headline is forbidden
163
+ */
164
+ function forbidsSuccessHeadline(signals) {
165
+ const overall = overallVerdict(signals);
166
+ return overall === 'BLOCKED' || overall === 'NEEDS_FIXES';
167
+ }
168
+
169
+ module.exports = {
170
+ worse,
171
+ statusMatrix,
172
+ overallVerdict,
173
+ proveReadiness,
174
+ openFailures,
175
+ forbidsSuccessHeadline
176
+ };
@@ -12,8 +12,11 @@ description: >
12
12
  Input: business specification and optional `systemKey`.
13
13
  Output: one delivery plan from [plan-template.md](references/plan-template.md).
14
14
 
15
+ Named with no specification, report what exists and ask; do not start writing a plan from
16
+ an inferred spec ([status.md](../shared/status.md)).
17
+
15
18
  Score completeness with [challenge-checklist.md](references/challenge-checklist.md).
16
- Next-step interaction: [interaction.md](references/interaction.md).
19
+ Structured choices and phase gates: [interaction.md](../shared/interaction.md).
17
20
  Host runtimes (local vs SSH): [hosts.md](../shared/hosts.md).
18
21
  CLI login from chat: [login.md](../shared/login.md).
19
22
 
@@ -29,7 +32,8 @@ Do not start Connected System validate until **PLAN_READY** and the user picks `
29
32
 
30
33
  1. Collect the spec the user named. Do not mine platform repos as the spec.
31
34
  2. Inventory without adding: purpose, sources, entities, relationships, role labels, operations, Viewpoints, Evidence, identity join. Missing sections → `TBD` plus an Open question.
32
- 3. Challenge required rows. AskQuestion every MISSING required row. Authority and identity cannot be guessed.
35
+ 3. Challenge required rows. Use the structured question control for every MISSING required
36
+ row. Authority and identity cannot be guessed.
33
37
  4. Write or update `.cursor/plans/{major}.0-{slug}.plan.md` using the template H2 order. Same capability updates in place.
34
38
  5. Report status and path. On PLAN_READY, offer validate — do not run it without `next-yes`.
35
39
 
@@ -12,12 +12,36 @@ description: >
12
12
  Phases: `validate` | `build` | `prove`.
13
13
  Loop: validate ↔ build ↔ prove ↔ learn.
14
14
 
15
+ **No phase argument means run prove-readiness validation only.** Report the combined status
16
+ matrix and the readiness verdict, recommend one next phase, and stop. Do not build proof
17
+ assets, run cases, publish, or promote: [status.md](../shared/status.md).
18
+
15
19
  `READY` means prove-ready, not permission to stop authoring. Build may run without READY.
16
20
 
21
+ ## Prove readiness
22
+
23
+ READY requires **all** of:
24
+
25
+ - Connected System PASS, or PASS_WITH_SKIPS whose skips the user allowed by name
26
+ - online state Published
27
+ - Operations not failed
28
+ - relevant governance scenarios passed
29
+ - Role Assistant available and verified
30
+ - happy and safe-stop cases present for the scenarios in scope
31
+ - authority, test subjects, and required business inputs confirmed
32
+
33
+ Anything short of all of them is BLOCKED, reported with the row that blocks it.
34
+ [delivery-verdict.js](../aifabrix-connected-system/scripts/delivery-verdict.js) computes it.
35
+
36
+ Package validation, pipeline checks, Bronze certification and TECHNICALLY_READY are **not**
37
+ business-case readiness. None of them, alone or together, makes prove READY.
38
+
17
39
  Every phase **must** update [learning-template.md](references/learning-template.md).
18
40
  Evidence rules: [evidence-lifecycle.md](references/evidence-lifecycle.md).
41
+ Role Assistant test execution and diagnosis:
42
+ [testing-playbook.md](../aifabrix-role-assistant/references/testing-playbook.md).
19
43
  Demo shape: [demo-template.md](references/demo-template.md).
20
- Next-step: [interaction.md](../aifabrix-plan/references/interaction.md).
44
+ Structured choices and phase gates: [interaction.md](../shared/interaction.md).
21
45
  Host runtimes (local vs SSH): [hosts.md](../shared/hosts.md).
22
46
  CLI login from chat: [login.md](../shared/login.md).
23
47
 
@@ -38,7 +62,9 @@ Repeatable: demo, Knowledge, candidate Evidence, tests. Do not refuse because va
38
62
 
39
63
  ## Prove
40
64
 
41
- Run assistant tests. Record observations and gap owner (`none` | `product-gap` | `missing-customer-fact` | `scope-decision`).
65
+ Run assistant tests using the testing playbook. Record the business verdict,
66
+ execution reference, and gap owner (`none` | `product-gap` |
67
+ `missing-customer-fact` | `scope-decision`).
42
68
  Happy + safe-stop coverage for authority scenarios.
43
69
  Never report candidates as certified.
44
70
 
@@ -49,6 +49,25 @@ Promote candidate → governed Evidence only when:
49
49
  3. Contract validation + certification path for Evidence completed (public Evidence Fabrix / operate-first RA docs)
50
50
  4. learning.md records promotion date + commit
51
51
 
52
+ ## Human authority and applied proof
53
+
54
+ Keep these states distinct:
55
+
56
+ | State | What it proves |
57
+ | --- | --- |
58
+ | Candidate or proposal | Draft content exists; it is not governed Evidence |
59
+ | Certified | The applicable human governance decision completed |
60
+ | Active | The product may supply the Evidence to execution |
61
+ | Applied | A recorded execution shows the Evidence affected the result |
62
+
63
+ An agent may prepare candidates, execute authorized source cases, and inspect a
64
+ proposal. It must pause before certifying, activating, rejecting, or
65
+ deactivating Evidence unless the current user explicitly authorizes that action
66
+ and the product workflow permits it. Record the pause as `BLOCKED_BY_HUMAN`, not
67
+ as a failed test. After the human gate, rerun the case and prove Applied Evidence
68
+ from execution evidence; catalog presence is not Applied proof. Follow the
69
+ [Role Assistant testing playbook](../../aifabrix-role-assistant/references/testing-playbook.md).
70
+
52
71
  ## Tests
53
72
 
54
73
  For each in-scope scenario ID:
@@ -66,3 +85,6 @@ Prefer `role-assistant/ra-<roleKey>/tests/<suiteId>/` in this customer repo (pac
66
85
  - Hiding process law in Knowledge
67
86
  - Uploading candidates as if certified
68
87
  - Skipping safe-stop coverage for authority scenarios
88
+ - Certifying, activating, rejecting, or deactivating Evidence without the
89
+ current user's explicit authority
90
+ - Reporting catalog presence as proof that Evidence was Applied
@@ -9,8 +9,13 @@ description: >
9
9
  # aifabrix-role-assistant
10
10
 
11
11
  See [package-boundary.md](references/package-boundary.md) and nested `role-assistant/AGENTS.md`.
12
+ For test execution, verdicts, fixtures, and diagnosis, follow
13
+ [testing-playbook.md](references/testing-playbook.md).
12
14
  Host runtimes (local vs SSH): [hosts.md](../shared/hosts.md).
13
15
  CLI login from chat: [login.md](../shared/login.md).
16
+ Structured choices and phase gates: [interaction.md](../shared/interaction.md).
17
+
18
+ Named with no task, report status and stop: [status.md](../shared/status.md).
14
19
 
15
20
  ## Preconditions
16
21
 
@@ -22,11 +27,32 @@ aifabrix role list --page-size 1000
22
27
  Catalog Business Role and an active user binding are prerequisites.
23
28
  Connected Systems this assistant needs must be dataplane **published** (deploy, not upload-only).
24
29
 
30
+ ## Readiness gate
31
+
32
+ Report the assistant as available and verified only when every row holds. Any missing row
33
+ means NOT_VERIFIED, named by row — never a blanket claim.
34
+
35
+ | Row | Established by |
36
+ | --- | --- |
37
+ | Active catalog role | `aifabrix role list --page-size 1000` |
38
+ | Required Connected Systems published **and** certified | `show --online` plus their Delivery verdict |
39
+ | Subscribed capabilities available | capability check against those systems |
40
+ | OpenAPI published | `role-assistant test --json` → `openApiPublished` |
41
+ | Lifecycle verified | `role-assistant test --json` → `verdict` is `VERIFIED` |
42
+ | Worker available | operator "Make available"; **no CLI surface** — confirm explicitly or report UNKNOWN |
43
+ | Happy and safe-stop cases discoverable | cases present for the scenarios in scope |
44
+
45
+ A published Connected System that is not certified does not satisfy row two. `verdict`
46
+ `NOT_VERIFIED` is not a pass, and a `certification.level` such as `BRONZE` never
47
+ substitutes for it.
48
+
25
49
  ## Workflow
26
50
 
27
51
  1. `aifabrix download <catalogRoleOrRaKey>` before editing an existing assistant.
28
52
  2. Author settings, Knowledge, Evidence, tests, and sidecars per current Builder contracts. Read `aifabrix role-assistant --help`.
29
- 3. `aifabrix role-assistant test …` is allowed without local RA publish.
53
+ 3. `aifabrix role-assistant test …` is allowed without local RA publish. Apply
54
+ the testing playbook and inspect hard business assertions before reporting
55
+ READY or VERIFIED.
30
56
  4. Upload/deploy RA only when the user explicitly asks in this turn.
31
57
  5. Report results honestly.
32
58
 
@@ -41,3 +67,4 @@ Connected Systems this assistant needs must be dataplane **published** (deploy,
41
67
  ## Trigger examples
42
68
 
43
69
  - Create or update the Finance Controller Role Assistant
70
+ - Test or diagnose the Finance Controller Role Assistant
@@ -0,0 +1,117 @@
1
+ # Role Assistant testing and diagnosis
2
+
3
+ Public concepts: https://docs.aifabrix.ai/docs/role-assistants
4
+ Exact commands, fields, and flags: run `aifabrix role-assistant test --help` with
5
+ the installed Builder version.
6
+
7
+ Use this playbook for live Role Assistant cases. A successful command is not
8
+ enough: the observed business outcome, authority boundary, capabilities, Work
9
+ Result, and resource changes must match the case.
10
+
11
+ ## Preconditions
12
+
13
+ - Authenticate to the intended environment and identify the package and cases
14
+ root before execution.
15
+ - Confirm every required Connected System is published and certified, its
16
+ required capabilities are available, and worker availability is known.
17
+ - Record the actor and business role, mutation scope, designated test subjects,
18
+ and cleanup rule before a mutating case.
19
+ - Treat missing auth, worker availability, capability, fixture, or required
20
+ human action as `BLOCKED` with the exact prerequisite.
21
+
22
+ ## Execution ladder
23
+
24
+ 1. Validate the package and use `--list-cases` to confirm discovery.
25
+ 2. Run one focused case with `--case ... --json`.
26
+ 3. Inspect lifecycle and final Runtime status, questions or approvals,
27
+ `expected.capabilities`, Work Result completion, resource changes, and
28
+ Evidence use. Do not rely on the process exit or wrapper verdict alone.
29
+ 4. Correct the owning layer, rerun the exact case, and then run its suite.
30
+ 5. Run broader suites only after the focused case is stable.
31
+ 6. Record environment, timestamp, package/source revision, command,
32
+ execution/correlation reference, verdict class, and gap owner in
33
+ `learning/learning.md` or the plan-defined evidence location.
34
+
35
+ ## Verdict law
36
+
37
+ | Observation | Verdict |
38
+ | --- | --- |
39
+ | Hard assertions and intended business outcome pass | `PASS` |
40
+ | Intended denial or safe stop occurs with no forbidden mutation | `PASS_EXPECTED_STOP` |
41
+ | `expected.soft: true` turns a mismatch into a warning | `GAP`; never `VERIFIED` |
42
+ | A prerequisite or required human action is absent | `BLOCKED` with the missing row |
43
+ | Runtime or CLI is defective and the run is reproducible | `PRODUCT_GAP` |
44
+ | Role Assistant, Knowledge, or Evidence content is wrong while the product behaves correctly | `PACKAGE_GAP` |
45
+
46
+ An exit code `0`, CLI `PASS`, lifecycle smoke, or certification level cannot
47
+ replace the applicable business verdict. An expected safe stop is not ordinary
48
+ success: name the denied or waiting state and prove that no forbidden mutation
49
+ occurred.
50
+
51
+ ## Assertion quality
52
+
53
+ - Release and prove cases use hard lifecycle and Result assertions. Soft cases
54
+ are exploratory and cannot establish READY or VERIFIED.
55
+ - Mutation cases assert the exact required and forbidden capabilities,
56
+ `expected.honesty.requireWorkResult`, completion, and a meaningful
57
+ `expected.honesty.minResourceChanges` value.
58
+ - Read-only cases forbid mutation capabilities. Authority cases assert the
59
+ intended denial, question, approval wait, or safe stop.
60
+ - Do not weaken an assertion to accommodate a failure. Classify the gap and
61
+ repair its owner.
62
+
63
+ ## Fixtures, identity, and cleanup
64
+
65
+ - Stable shared identities are read-only unless the integration README names
66
+ them as approved mutable subjects.
67
+ - Give mutable cases collision-safe explicit values. Generate and write those
68
+ values into the case through normal repository editing before the run; do not
69
+ claim that an interpolation token exists unless current CLI help, schema,
70
+ source, and tests establish it.
71
+ - Share an identity across cases only for a documented suite dependency.
72
+ - Never inject a hidden primary key, actor, business role, API key, or
73
+ authorization dimension to make a case pass.
74
+ - Cleanup must be explicit, bounded to the designated subject, and separately
75
+ authorized when destructive.
76
+
77
+ ## ABAC and replay
78
+
79
+ Every authority-sensitive scenario needs an allowed case and an outside-scope
80
+ or denied case. Nested calls must preserve the same actor and business-role
81
+ context. Ambiguous identity must ask or stop safely, never select a convenient
82
+ record. Retry and replay cases must prove there is no duplicate resource and no
83
+ double-counted Evidence.
84
+
85
+ ## Human Evidence boundary
86
+
87
+ Agents may author candidates, run source executions, and inspect proposals when
88
+ authorized. They must not certify, activate, reject, or deactivate Evidence for
89
+ a human unless the current user explicitly authorizes that product action and
90
+ the product workflow permits it. A run paused at certification or activation is
91
+ `BLOCKED_BY_HUMAN`, not failed. Later proof must show Evidence was actually
92
+ Applied in execution; catalog presence alone is insufficient. See
93
+ [Evidence lifecycle](../../aifabrix-prove/references/evidence-lifecycle.md).
94
+
95
+ ## Root-cause routing
96
+
97
+ | Finding | Owner / next action |
98
+ | --- | --- |
99
+ | Auth, environment, or worker unavailable | Report the exact prerequisite |
100
+ | Duplicate or stale test data | Fixture owner; preserve the trail and repair safely |
101
+ | Soft or incomplete expectation | Case author; strengthen without changing product behavior |
102
+ | Missing operation, certification, or capability | Connected System package |
103
+ | Runtime loop, wrong identity binding, or false success | Product gap with execution evidence |
104
+ | Wrong prompt, Knowledge, or Evidence definition | Role Assistant package |
105
+ | Evidence certification or activation required | Human governance gate |
106
+
107
+ Do not conceal a lower-layer gap in Knowledge or build a Role Assistant-local
108
+ imitation of a missing Connected System capability.
109
+
110
+ For an upsert finding, route local manifest repair to Connected System
111
+ ownership and rerun the exact failed proof. If the external source cannot
112
+ support exact business-identity lookup or uniqueness, state what happened,
113
+ what cannot be repaired by AI, the duplicate or wrong-record-update risk, the
114
+ safe alternative, and how future connectors should prevent it. Keep readiness
115
+ blocked or qualified as reported by validation; never substitute create,
116
+ weaken the no-duplicate assertion, or clear the warning because an unrelated
117
+ case passed.