@exellix/ai-tasks 9.1.0 → 10.0.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/CHANGELOG.md +34 -4
- package/README.md +2 -2
- package/RUNTASK_REQUEST.md +32 -17
- package/dist/builders/task-request-builder.d.ts.map +1 -1
- package/dist/builders/task-request-builder.js +2 -1
- package/dist/builders/task-request-builder.js.map +1 -1
- package/dist/compile/compileTaskConfiguration.d.ts.map +1 -1
- package/dist/compile/compileTaskConfiguration.js +3 -0
- package/dist/compile/compileTaskConfiguration.js.map +1 -1
- package/dist/core/task-sdk.d.ts.map +1 -1
- package/dist/core/task-sdk.js +148 -180
- package/dist/core/task-sdk.js.map +1 -1
- package/dist/errors/runTaskExecutionError.d.ts.map +1 -1
- package/dist/errors/runTaskExecutionError.js +0 -2
- package/dist/errors/runTaskExecutionError.js.map +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/invocation/types.d.ts +1 -1
- package/dist/narrix/applyWebScopeToRequest.d.ts +9 -0
- package/dist/narrix/applyWebScopeToRequest.d.ts.map +1 -0
- package/dist/narrix/applyWebScopeToRequest.js +156 -0
- package/dist/narrix/applyWebScopeToRequest.js.map +1 -0
- package/dist/narrix/narrixUnitExecution.d.ts.map +1 -1
- package/dist/narrix/narrixUnitExecution.js +8 -3
- package/dist/narrix/narrixUnitExecution.js.map +1 -1
- package/dist/node-execution/buildRequestFromNodePlan.d.ts +6 -0
- package/dist/node-execution/buildRequestFromNodePlan.d.ts.map +1 -1
- package/dist/node-execution/buildRequestFromNodePlan.js +4 -16
- package/dist/node-execution/buildRequestFromNodePlan.js.map +1 -1
- package/dist/node-execution/compileProfessionalAnswerRequest.d.ts +2 -0
- package/dist/node-execution/compileProfessionalAnswerRequest.d.ts.map +1 -0
- package/dist/node-execution/compileProfessionalAnswerRequest.js +4 -0
- package/dist/node-execution/compileProfessionalAnswerRequest.js.map +1 -0
- package/dist/node-execution/createNodeExecutionHost.d.ts.map +1 -1
- package/dist/node-execution/createNodeExecutionHost.js +97 -26
- package/dist/node-execution/createNodeExecutionHost.js.map +1 -1
- package/dist/node-execution/dispatchExecutionUnit.d.ts.map +1 -1
- package/dist/node-execution/dispatchExecutionUnit.js +4 -2
- package/dist/node-execution/dispatchExecutionUnit.js.map +1 -1
- package/dist/node-execution/orchestration/runPostOrchestration.d.ts +11 -0
- package/dist/node-execution/orchestration/runPostOrchestration.d.ts.map +1 -0
- package/dist/node-execution/orchestration/runPostOrchestration.js +123 -0
- package/dist/node-execution/orchestration/runPostOrchestration.js.map +1 -0
- package/dist/node-execution/orchestration/runPreOrchestration.d.ts +3 -0
- package/dist/node-execution/orchestration/runPreOrchestration.d.ts.map +1 -0
- package/dist/node-execution/orchestration/runPreOrchestration.js +110 -0
- package/dist/node-execution/orchestration/runPreOrchestration.js.map +1 -0
- package/dist/node-execution/orchestration/shardContext.d.ts +12 -0
- package/dist/node-execution/orchestration/shardContext.d.ts.map +1 -0
- package/dist/node-execution/orchestration/shardContext.js +71 -0
- package/dist/node-execution/orchestration/shardContext.js.map +1 -0
- package/dist/node-execution/orchestration/types.d.ts +21 -0
- package/dist/node-execution/orchestration/types.d.ts.map +1 -0
- package/dist/node-execution/orchestration/types.js +2 -0
- package/dist/node-execution/orchestration/types.js.map +1 -0
- package/dist/node-execution/rejectForbiddenWireFields.d.ts +2 -0
- package/dist/node-execution/rejectForbiddenWireFields.d.ts.map +1 -1
- package/dist/node-execution/rejectForbiddenWireFields.js +42 -7
- package/dist/node-execution/rejectForbiddenWireFields.js.map +1 -1
- package/dist/observability/classifyRunTaskFailure.d.ts.map +1 -1
- package/dist/observability/classifyRunTaskFailure.js +4 -3
- package/dist/observability/classifyRunTaskFailure.js.map +1 -1
- package/dist/observability/logRunTaskFailure.d.ts.map +1 -1
- package/dist/observability/logRunTaskFailure.js +0 -2
- package/dist/observability/logRunTaskFailure.js.map +1 -1
- package/dist/post-steps/audit/auditChecklistFuncxEnvelope.d.ts +19 -3
- package/dist/post-steps/audit/auditChecklistFuncxEnvelope.d.ts.map +1 -1
- package/dist/post-steps/audit/auditChecklistFuncxEnvelope.js +7 -1
- package/dist/post-steps/audit/auditChecklistFuncxEnvelope.js.map +1 -1
- package/dist/post-steps/audit/loadAuditTemplates.d.ts +2 -55
- package/dist/post-steps/audit/loadAuditTemplates.d.ts.map +1 -1
- package/dist/post-steps/audit/loadAuditTemplates.js +3 -38
- package/dist/post-steps/audit/loadAuditTemplates.js.map +1 -1
- package/dist/post-steps/audit/parseAuditFuncxOutput.d.ts +8 -0
- package/dist/post-steps/audit/parseAuditFuncxOutput.d.ts.map +1 -0
- package/dist/post-steps/audit/parseAuditFuncxOutput.js +62 -0
- package/dist/post-steps/audit/parseAuditFuncxOutput.js.map +1 -0
- package/dist/post-steps/audit/parseAuditOutput.d.ts +2 -0
- package/dist/post-steps/audit/parseAuditOutput.d.ts.map +1 -1
- package/dist/post-steps/audit/parseAuditOutput.js +56 -0
- package/dist/post-steps/audit/parseAuditOutput.js.map +1 -1
- package/dist/post-steps/audit/runAudit.d.ts.map +1 -1
- package/dist/post-steps/audit/runAudit.js +53 -113
- package/dist/post-steps/audit/runAudit.js.map +1 -1
- package/dist/post-steps/audit/runAuditFuncxCall.d.ts +18 -0
- package/dist/post-steps/audit/runAuditFuncxCall.d.ts.map +1 -0
- package/dist/post-steps/audit/runAuditFuncxCall.js +59 -0
- package/dist/post-steps/audit/runAuditFuncxCall.js.map +1 -0
- package/dist/synthesis/resolveSourceMaterial.d.ts.map +1 -1
- package/dist/synthesis/resolveSourceMaterial.js +14 -0
- package/dist/synthesis/resolveSourceMaterial.js.map +1 -1
- package/dist/synthesis/runStructuredSynthesisRobust.d.ts.map +1 -1
- package/dist/synthesis/runStructuredSynthesisRobust.js +24 -4
- package/dist/synthesis/runStructuredSynthesisRobust.js.map +1 -1
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.d.ts +3 -0
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.d.ts.map +1 -1
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.js +28 -4
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.js.map +1 -1
- package/dist/task-strategies/canonicalInputExecutionStrategies.d.ts +4 -4
- package/dist/task-strategies/canonicalInputExecutionStrategies.d.ts.map +1 -1
- package/dist/task-strategies/canonicalInputExecutionStrategies.js +2 -1
- package/dist/task-strategies/canonicalInputExecutionStrategies.js.map +1 -1
- package/dist/task-strategies/canonicalOrchestrationStrategies.d.ts +42 -0
- package/dist/task-strategies/canonicalOrchestrationStrategies.d.ts.map +1 -0
- package/dist/task-strategies/canonicalOrchestrationStrategies.js +47 -0
- package/dist/task-strategies/canonicalOrchestrationStrategies.js.map +1 -0
- package/dist/task-strategies/canonicalTaskStrategies.d.ts +2 -1
- package/dist/task-strategies/canonicalTaskStrategies.d.ts.map +1 -1
- package/dist/task-strategies/canonicalTaskStrategies.js +2 -1
- package/dist/task-strategies/canonicalTaskStrategies.js.map +1 -1
- package/dist/task-strategies/constants.d.ts +9 -1
- package/dist/task-strategies/constants.d.ts.map +1 -1
- package/dist/task-strategies/constants.js +9 -1
- package/dist/task-strategies/constants.js.map +1 -1
- package/dist/task-strategies/index.d.ts +5 -3
- package/dist/task-strategies/index.d.ts.map +1 -1
- package/dist/task-strategies/index.js +4 -3
- package/dist/task-strategies/index.js.map +1 -1
- package/dist/task-strategies/listAiTaskStrategies.d.ts +10 -1
- package/dist/task-strategies/listAiTaskStrategies.d.ts.map +1 -1
- package/dist/task-strategies/listAiTaskStrategies.js +17 -2
- package/dist/task-strategies/listAiTaskStrategies.js.map +1 -1
- package/dist/types/task-types.d.ts +4 -11
- package/dist/types/task-types.d.ts.map +1 -1
- package/dist/utils/bridgeRunSkillGatewayMemory.d.ts.map +1 -1
- package/dist/utils/bridgeRunSkillGatewayMemory.js +1 -0
- package/dist/utils/bridgeRunSkillGatewayMemory.js.map +1 -1
- package/dist/utils/executionMemoryInputRecord.d.ts +12 -0
- package/dist/utils/executionMemoryInputRecord.d.ts.map +1 -0
- package/dist/utils/executionMemoryInputRecord.js +28 -0
- package/dist/utils/executionMemoryInputRecord.js.map +1 -0
- package/dist/utils/resolveAiProfileModel.d.ts +1 -1
- package/dist/utils/resolveAiProfileModel.d.ts.map +1 -1
- package/dist/utils/resolveRunTaskModelReferences.d.ts.map +1 -1
- package/dist/utils/resolveRunTaskModelReferences.js +0 -32
- package/dist/utils/resolveRunTaskModelReferences.js.map +1 -1
- package/dist/utils/runTaskRequestShape.d.ts.map +1 -1
- package/dist/utils/runTaskRequestShape.js +4 -26
- package/dist/utils/runTaskRequestShape.js.map +1 -1
- package/dist/utils/skillTemplateVariables.d.ts +3 -2
- package/dist/utils/skillTemplateVariables.d.ts.map +1 -1
- package/dist/utils/skillTemplateVariables.js +3 -2
- package/dist/utils/skillTemplateVariables.js.map +1 -1
- package/dist/validation/validateProfessionalAnswerContract.d.ts +8 -0
- package/dist/validation/validateProfessionalAnswerContract.d.ts.map +1 -0
- package/dist/validation/validateProfessionalAnswerContract.js +45 -0
- package/dist/validation/validateProfessionalAnswerContract.js.map +1 -0
- package/dist/validation/validateRunTaskConfig.d.ts.map +1 -1
- package/dist/validation/validateRunTaskConfig.js +3 -66
- package/dist/validation/validateRunTaskConfig.js.map +1 -1
- package/documenations/record-and-template-variables.md +21 -13
- package/documenations/run-task-execution-flow.md +1 -1
- package/documenations/skill-orchestration-strategy-cr-fr.md +147 -0
- package/documenations/upstream-feature-requests/README.md +9 -5
- package/documenations/upstream-feature-requests/ai-skills-orchestrator-invoke-contract-5.9.md +1 -1
- package/documenations/upstream-feature-requests/funcx-4.9.13-open-items.md +62 -0
- package/documenations/upstream-feature-requests/funcx-gap-analysis-cr-fr.md +401 -0
- package/documenations/upstream-feature-requests/funcx-pre-post-sidekick-actions.md +1 -0
- package/documenations/upstream-feature-requests/graph-engine-runtask-contract-alignment-investigation.md +370 -0
- package/documenations/upstream-feature-requests/xynthesis-ai-profiles-2.1-import-break.md +2 -2
- package/documenations/upstream-feature-requests/xynthesis-openrouter-wire-model-double-prefix-bug.md +1 -1
- package/documenations/upstream-feature-requests/xynthesis-orchestrator-invoke-contract-4.2.md +1 -1
- package/package.json +10 -9
- package/.docs/DOWNSTREAM_ENV.md +0 -42
- package/.docs/FEEDBACK_TO_CLIENT_DOWNSTREAM_FIXES.md +0 -64
- package/.docs/INTERMEDIATE_STEPS.md +0 -82
- package/.docs/activity-structure.md +0 -31
- package/.docs/ai-task-ai-scoping-spec.md +0 -338
- package/.docs/ai-tasks-model-profile-aliases-7x.md +0 -96
- package/.docs/blockers-and-issues.md +0 -346
- package/.docs/building-runTask-sdk.md +0 -659
- package/.docs/building-skill-execution-orchestrator.md +0 -968
- package/.docs/code-used-before/run-task.txt +0 -39
- package/.docs/code-used-before/task-executor.ts.old +0 -57
- package/.docs/code-used-before/test-run-task.ts.old +0 -42
- package/.docs/code-used-before/types.txt +0 -23
- package/.docs/env-ready-policy.md +0 -40
- package/.docs/flow-io/flow-README.md +0 -76
- package/.docs/flow-io/narrix.md +0 -124
- package/.docs/flow-io/web-scoping.md +0 -135
- package/.docs/flow-io/xynthesis-post.md +0 -154
- package/.docs/flow-io/xynthesis-pre.md +0 -181
- package/.docs/gap-analysis.md +0 -201
- package/.docs/integration-facts-ai-tasks.md +0 -109
- package/.docs/investigation/ai-skills.md +0 -170
- package/.docs/investigation/external-packages-assignments.md +0 -66
- package/.docs/investigation/integration-summary.md +0 -20
- package/.docs/investigation/narrix-catalox.md +0 -29
- package/.docs/investigation/workplan-close-graph-engine-gaps.md +0 -101
- package/.docs/logging-stack.md +0 -30
- package/.docs/memory-narrix-adapter-developer-guide.md +0 -402
- package/.docs/memory-narrix-adapter-requirements.md +0 -112
- package/.docs/narrix-context-consumption-gap.md +0 -184
- package/.docs/narrix-context-downstream-report.md +0 -30
- package/.docs/narrix-ingest-and-packs-library-spec.md +0 -240
- package/.docs/narrix-record-input-current-design.md +0 -48
- package/.docs/pacakge.md +0 -48
- package/.docs/possible-components/README.md +0 -11
- package/.docs/possible-components/integration/README.md +0 -10
- package/.docs/possible-components/integration/gaps-when-merging.md +0 -16
- package/.docs/possible-components/integration/platform.md +0 -54
- package/.docs/possible-components/integration/reintegrate-into-ai-tasks.md +0 -26
- package/.docs/possible-components/integration/roadmap-and-checklists.md +0 -54
- package/.docs/possible-components/post-component/README.md +0 -18
- package/.docs/possible-components/post-component/builder-guide.md +0 -175
- package/.docs/possible-components/post-component/gaps-and-artifacts.md +0 -52
- package/.docs/possible-components/post-component/handler-audit.md +0 -47
- package/.docs/possible-components/post-component/handler-polish.md +0 -41
- package/.docs/possible-components/post-component/unified-protocol.md +0 -59
- package/.docs/possible-components/pre-component/README.md +0 -22
- package/.docs/possible-components/pre-component/builder-guide.md +0 -127
- package/.docs/possible-components/pre-component/gaps-and-artifacts.md +0 -35
- package/.docs/possible-components/pre-component/handler-ai-scoping.md +0 -45
- package/.docs/possible-components/pre-component/handler-narrix-preprocessor.md +0 -49
- package/.docs/possible-components/pre-component/handler-narrix-system2.md +0 -35
- package/.docs/possible-components/pre-component/handler-synthesized-context.md +0 -65
- package/.docs/possible-components/pre-component/handler-web-scope.md +0 -29
- package/.docs/possible-components/pre-component/unified-protocol.md +0 -89
- package/.docs/prefer-openrouter-routing-policy.md +0 -114
- package/.docs/questions-for-ai-skills.md +0 -123
- package/.docs/realtime-narrixing-gap-analysis.md +0 -40
- package/.docs/realtime-narrixing.md +0 -433
- package/.docs/run-context-object.md +0 -32
- package/.docs/session-id-usage.md +0 -26
- package/.docs/skill-library-spec.md +0 -249
- package/.docs/synthesized-context-strategy-spec.md +0 -906
- package/.docs/upstream-issue/2026-03-21_woroces-ai-tasks_ISSUE-006_web-scope-question-from-cni-entity.md +0 -46
- package/.docs/web-scopper-embed.md +0 -93
- package/.docs/xynthesis-wiring-and-io.md +0 -12
- package/documenations/activix-feature-request-identity.md +0 -123
- package/documenations/bug-report-xynthesis-and-synthesis-call.md +0 -217
- package/documenations/feature-request-ai-skills-raw-template-access.md +0 -82
- package/documenations/feature-request-athenix-core-directive.md +0 -145
- package/documenations/feature-request-athenix-token-extraction.md +0 -124
- package/documenations/funcx-upstream-github-issues-draft.md +0 -153
- package/documenations/identity-metadata-contract.md +0 -165
- package/documenations/run-task-single-run-checklist.md +0 -109
- package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-1-no-concrete-wire-in-graph-plans.md +0 -93
- package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-2-skillModel-profile-only-at-storage.md +0 -88
- package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-3-reject-concrete-models-in-catalog-rows.md +0 -76
- package/documenations/sessions/2026-06-08-subnets-model-resolution/FR-1-suggested-profile-in-catalogs.md +0 -96
- package/documenations/sessions/2026-06-08-subnets-model-resolution/FR-2-graph-engine-failure-phase-attribution.md +0 -92
- package/documenations/sessions/2026-06-08-subnets-model-resolution/INVESTIGATION-original-bug.md +0 -182
- package/documenations/sessions/2026-06-08-subnets-model-resolution/PROBLEM.md +0 -236
- package/documenations/sessions/2026-06-08-subnets-model-resolution/README.md +0 -11
- package/documenations/sessions/2026-06-08-subnets-model-resolution/funcx-test-resolveModel.cheapDefaultWireSlug.test.ts +0 -117
- package/documenations/upstream-feature-requests/ai-tasks-wrap-up-after-upstream.md +0 -129
- package/documenations/upstream-feedback-request-shape-clarification.md +0 -101
- package/documenations/web-context-precedence.md +0 -33
- package/documenations/xynthesis-activix-telemetry.md +0 -28
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# Platform integration: aifunctions-js, Activix, identity, Xynthesis
|
|
2
|
-
|
|
3
|
-
**Single source of truth** for stack rules referenced from [`../pre-component/`](../pre-component/README.md) and [`../post-component/`](../post-component/README.md). Do not copy these sections into handler docs.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Generative AI: aifunctions-js (not ai-gateway)
|
|
8
|
-
|
|
9
|
-
- Use **[aifunctions-js](https://www.npmjs.com/package/aifunctions-js)** for text completions (`Client.ask`, presets, OpenRouter defaults as configured).
|
|
10
|
-
- Do **not** use a legacy **ai-gateway** as the primary API. `{ invoke(instructions, workingMemory) }` shapes are **test/migration shims** only.
|
|
11
|
-
- Parameters: system/user messages, optional `model`, `temperature`, `maxTokens`, `timeoutMs`, usage from response.
|
|
12
|
-
|
|
13
|
-
In this repo, `src/internal/runLlmTextCall.ts` follows the same assumption.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## 1b. Pre-task synthesis: @athenices/xynthesis
|
|
18
|
-
|
|
19
|
-
- **Synthesized-context** is built on **@athenices/xynthesis**: templates, markdown vs structured modes, validation, `setSynthesisInvoker`.
|
|
20
|
-
- **SynthesisInvoker** implementations perform HTTP/LLM via **aifunctions-js**, not ai-gateway.
|
|
21
|
-
- Activix: record **pipeline_pre** / synthesis work with the same **`identity`** as the run (§3).
|
|
22
|
-
|
|
23
|
-
Detail: [`../pre-component/handler-synthesized-context.md`](../pre-component/handler-synthesized-context.md).
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## 2. Activix
|
|
28
|
-
|
|
29
|
-
- Record **LLM-backed** and meaningful sub-steps (scoping, synthesis, audit cycles, polish passes, System-2 plan), not only outer `runTask`.
|
|
30
|
-
- Handlers receive **activix** + **correlationId** or use a shared wrapper (`withPhaseRecord`-style).
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## 3. Identity on Activix records
|
|
35
|
-
|
|
36
|
-
Canonical: **`docs/activix-identity.md`** (repo root).
|
|
37
|
-
|
|
38
|
-
| Rule | Detail |
|
|
39
|
-
|------|--------|
|
|
40
|
-
| Field | Top-level **`identity`** on records. |
|
|
41
|
-
| Merge | `{ ...upstreamIdentity, taskId, skillId }`; runtime overrides duplicate keys. |
|
|
42
|
-
| Propagation | Same `identity` on **every** phase: `narrix`, `pipeline_pre`, `direct`, `audit`, `polish`, `narrix_then_direct`, etc. |
|
|
43
|
-
| Correlation | Prefer **`correlationId === taskId`** for timeline queries. |
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## 4. Summary
|
|
48
|
-
|
|
49
|
-
| Concern | Choice |
|
|
50
|
-
|---------|--------|
|
|
51
|
-
| LLM transport | **aifunctions-js** |
|
|
52
|
-
| Pre synthesis orchestration | **@athenices/xynthesis** + invoker → aifunctions-js |
|
|
53
|
-
| Observability | **Activix** |
|
|
54
|
-
| Task continuity | **`identity`** on all related records |
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# Re-integrating Pre/Post packages into `ai-tasks`
|
|
2
|
-
|
|
3
|
-
When pre/post exist as **separate packages** (or workspaces), this is how they plug back into **this** repo.
|
|
4
|
-
|
|
5
|
-
## Orchestration anchor
|
|
6
|
-
|
|
7
|
-
- **`src/core/task-sdk.ts`** — `WorexClientTasks.runTask`: narrix preprocessor, `executionPipeline` PRE/POST, `_executeDirect`, `_runSynthesizedContextPreStep`, `runAuditPostStep`, `runPolishPostStep`, Activix `withPhaseRecord`, `identity` / `effectiveIdentity`.
|
|
8
|
-
|
|
9
|
-
## Integration steps (checklist)
|
|
10
|
-
|
|
11
|
-
1. **Replace inline calls** with package entrypoints that accept the same **context** shapes as [`../pre-component/unified-protocol.md`](../pre-component/unified-protocol.md) and [`../post-component/unified-protocol.md`](../post-component/unified-protocol.md) (or thin adapters).
|
|
12
|
-
2. **Inject** Activix client + `correlationId` + merged **`identity`** into both engines per [`platform.md`](platform.md).
|
|
13
|
-
3. **Synthesis:** package must register **SynthesisInvoker** using **aifunctions-js**; keep `src/synthesis/synthesisGatewayCompat.ts` only if tests still need legacy `invoke`.
|
|
14
|
-
4. **Types:** re-export or depend on a shared types package; keep `RunTaskRequest`, `ExecutionStep`, `AuditConfig`, `PolishConfig`, `SynthesisConfig` aligned with `src/types/task-types.ts`.
|
|
15
|
-
5. **Templates (post):** ensure `templates/post-steps/**` are on disk or set `AUDIT_TEMPLATES_PATH` / `POLISH_TEMPLATES_PATH` — see [`../post-component/gaps-and-artifacts.md`](../post-component/gaps-and-artifacts.md).
|
|
16
|
-
6. **Tests:** point existing e2e tests at the integrated packages; keep gateway overrides working.
|
|
17
|
-
|
|
18
|
-
## Identity & Activix
|
|
19
|
-
|
|
20
|
-
- Follow **`docs/activix-identity.md`**; ensure every phase record from the imported engine includes **`identity`**.
|
|
21
|
-
- Phase labels to preserve for dashboards: `narrix`, `pipeline_pre`, `direct`, `audit`, `polish`, `narrix_then_direct`, etc.
|
|
22
|
-
|
|
23
|
-
## Related repo docs
|
|
24
|
-
|
|
25
|
-
- `docs/activix-identity.md`
|
|
26
|
-
- `documenations/identity-metadata-contract.md` (if present)
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# Roadmap & checklists (cross-cutting)
|
|
2
|
-
|
|
3
|
-
Phased work for **platform + pre engine + post engine + hardening**. Handler behavior lives only under [`../pre-component/`](../pre-component/README.md) and [`../post-component/`](../post-component/README.md).
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Phase A — Shared foundation
|
|
8
|
-
|
|
9
|
-
- [ ] **A1.** Activix wrapper: start/success/fail with mandatory **`identity`** (upstream + `taskId` / `skillId`).
|
|
10
|
-
- [ ] **A2.** **aifunctions-js** factory (model, timeout, usage).
|
|
11
|
-
- [ ] **A3.** **SynthesisInvoker** → **aifunctions-js** `ask` (see [`platform.md`](platform.md) §1b).
|
|
12
|
-
|
|
13
|
-
## Phase B — Pre-Task engine
|
|
14
|
-
|
|
15
|
-
- [ ] **B1.** Registry + merge `patches` / `prior` — [`../pre-component/unified-protocol.md`](../pre-component/unified-protocol.md).
|
|
16
|
-
- [ ] **B2.** `narrix-preprocessor` + web scope — [`../pre-component/handler-web-scope.md`](../pre-component/handler-web-scope.md).
|
|
17
|
-
- [ ] **B3.** `pipeline.synthesized-context` — [`../pre-component/handler-synthesized-context.md`](../pre-component/handler-synthesized-context.md).
|
|
18
|
-
- [ ] **B4.** `direct.ai-scoping` — [`../pre-component/handler-ai-scoping.md`](../pre-component/handler-ai-scoping.md).
|
|
19
|
-
- [ ] **B5.** Narrix System-2 — [`../pre-component/handler-narrix-system2.md`](../pre-component/handler-narrix-system2.md).
|
|
20
|
-
|
|
21
|
-
## Phase C — Post-Task engine
|
|
22
|
-
|
|
23
|
-
- [ ] **C1.** Runner + `currentOutput` chain — [`../post-component/unified-protocol.md`](../post-component/unified-protocol.md).
|
|
24
|
-
- [ ] **C2.** Audit — [`../post-component/handler-audit.md`](../post-component/handler-audit.md).
|
|
25
|
-
- [ ] **C3.** Polish — [`../post-component/handler-polish.md`](../post-component/handler-polish.md).
|
|
26
|
-
- [ ] **C4.** Audit `reRunMain` paths: same **`identity`** / Activix continuity.
|
|
27
|
-
|
|
28
|
-
## Phase D — Hardening
|
|
29
|
-
|
|
30
|
-
- [ ] **D1.** Env parity — see [`../pre-component/gaps-and-artifacts.md`](../pre-component/gaps-and-artifacts.md) and [`../post-component/gaps-and-artifacts.md`](../post-component/gaps-and-artifacts.md).
|
|
31
|
-
- [ ] **D2.** Test DI: mock clients, invoker, Activix.
|
|
32
|
-
- [ ] **D3.** Drift review vs this spec tree.
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Pre-task layering (reference)
|
|
37
|
-
|
|
38
|
-
```text
|
|
39
|
-
RunTaskRequest + identity
|
|
40
|
-
│
|
|
41
|
-
▼
|
|
42
|
-
┌───────────────────┐
|
|
43
|
-
│ Pre-Task Engine │ Activix + identity per phase
|
|
44
|
-
└─────────┬─────────┘
|
|
45
|
-
│
|
|
46
|
-
┌─────┴─────┬─────────────────┬──────────────────┐
|
|
47
|
-
▼ ▼ ▼ ▼
|
|
48
|
-
narrix synthesized- ai-scoping (extensible)
|
|
49
|
-
context
|
|
50
|
-
│
|
|
51
|
-
├── resolveSourceMaterial (host)
|
|
52
|
-
├── @athenices/xynthesis
|
|
53
|
-
└── SynthesisInvoker ──► aifunctions-js
|
|
54
|
-
```
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Post-Task component — spec pack
|
|
2
|
-
|
|
3
|
-
**Start here to implement:** [`builder-guide.md`](builder-guide.md) (complete `AuditConfig` / `PolishConfig`, LLM output shapes, host prerequisites, file manifest, acceptance).
|
|
4
|
-
Platform rules: [`../integration/platform.md`](../integration/platform.md).
|
|
5
|
-
|
|
6
|
-
## Read order
|
|
7
|
-
|
|
8
|
-
1. [`builder-guide.md`](builder-guide.md) — **full implementation entry**.
|
|
9
|
-
2. [`unified-protocol.md`](unified-protocol.md) — protocol, engine duties.
|
|
10
|
-
3. [`handler-audit.md`](handler-audit.md)
|
|
11
|
-
4. [`handler-polish.md`](handler-polish.md)
|
|
12
|
-
5. [`gaps-and-artifacts.md`](gaps-and-artifacts.md) — template paths, packaging, known gaps.
|
|
13
|
-
|
|
14
|
-
## Outside this folder
|
|
15
|
-
|
|
16
|
-
- **Platform:** [`../integration/platform.md`](../integration/platform.md)
|
|
17
|
-
- **Checklist (Post Phase C):** [`../integration/roadmap-and-checklists.md`](../integration/roadmap-and-checklists.md)
|
|
18
|
-
- **Merge back into repo:** [`../integration/reintegrate-into-ai-tasks.md`](../integration/reintegrate-into-ai-tasks.md)
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
# Post-Task component — **builder guide** (single entry for implementation)
|
|
2
|
-
|
|
3
|
-
Everything required to implement the **pipeline POST** engine. **Full** Activix/identity rules: [`../integration/platform.md`](../integration/platform.md).
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. What you are building
|
|
8
|
-
|
|
9
|
-
An engine that runs **after MAIN** when `executionPipeline` contains `phase: "post"` steps. It:
|
|
10
|
-
|
|
11
|
-
- Takes **MAIN** `RunTaskResponse`, **`contextMarkdown`** actually sent to MAIN, and **`reRunMain(overrideContext)`** for audit loops
|
|
12
|
-
- Runs handlers in **pipeline array order** (e.g. audit then polish)
|
|
13
|
-
- Produces final **`outputText`**, merges **`metadata.postSteps`**, appends **`intermediateSteps`**
|
|
14
|
-
|
|
15
|
-
**Protocol:** [`unified-protocol.md`](unified-protocol.md).
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## 2. Stack (minimum)
|
|
20
|
-
|
|
21
|
-
| Topic | Rule |
|
|
22
|
-
|-------|------|
|
|
23
|
-
| LLM | **aifunctions-js** via shared `runLlmTextCall` pattern; test gateways `setAuditGateway`, `setPolishGateway`. |
|
|
24
|
-
| Xynthesis | **Not** used in default audit/polish. |
|
|
25
|
-
| Observability | **Activix** on post phases `audit`, `polish`; same **`identity`** as parent run; MAIN re-runs from audit must keep identity. |
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## 3. Host prerequisites
|
|
30
|
-
|
|
31
|
-
| Requirement | Why |
|
|
32
|
-
|-------------|-----|
|
|
33
|
-
| **Exactly one** `main` step in `executionPipeline` | Current SDK invariant. |
|
|
34
|
-
| **Capture context** | Host must record the markdown context passed to MAIN (`captureContext` pattern) so audit/polish receive **`contextMarkdown`**. |
|
|
35
|
-
| **`reRunMain`** | Callback re-executes MAIN with **only** context replaced by `contextMarkdown + feedback` (audit). |
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## 4. NPM dependencies (from `@woroces/ai-tasks`)
|
|
40
|
-
|
|
41
|
-
| Package | Role |
|
|
42
|
-
|---------|------|
|
|
43
|
-
| `aifunctions-js` | Audit, polish, audit merge LLM. |
|
|
44
|
-
| `handlebars` | Template render in `loadAuditTemplates` / `loadPolishTemplates`. |
|
|
45
|
-
| `nx-cache` | Optional audit result cache (cycle 1, default guidelines). |
|
|
46
|
-
|
|
47
|
-
Types may come from `@woroces/ai-skills` / shared types package (`ModelConfig`, `RunTaskRequest`, `RunTaskResponse`).
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## 5. Config types (complete)
|
|
52
|
-
|
|
53
|
-
### `AuditConfig` (`src/types/task-types.ts`)
|
|
54
|
-
|
|
55
|
-
| Field | Type | Default / notes |
|
|
56
|
-
|-------|------|------------------|
|
|
57
|
-
| `gateway.must` | `AuditCheck[]` | Required list; `{ check, weight }`. |
|
|
58
|
-
| `gateway.should` | `AuditCheck[]` | Required list. |
|
|
59
|
-
| `threshold` | number | Default **80** (weighted score 0–100). |
|
|
60
|
-
| `minCycles` | number | Default **1**. |
|
|
61
|
-
| `maxCycles` | number | Default **3**. |
|
|
62
|
-
| `selectionStrategy` | `"best"` \| `"synthesis"` | Merge two candidates + re-audit when `synthesis`. |
|
|
63
|
-
| `auditModelConfig` | `ModelConfig?` | Plus env `AUDIT_MODEL`, `POST_STEP_MODEL`. |
|
|
64
|
-
| `synthesisModelConfig` | `ModelConfig?` | Merge step; env `AUDIT_SYNTHESIS_MODEL`, `POST_STEP_MODEL`, main model fallback. |
|
|
65
|
-
| `customAuditGuidelines` | string? | Appended to audit system template. |
|
|
66
|
-
| `customSynthesisGuidelines` | string? | Merge template. |
|
|
67
|
-
| `fallbackToBest` | boolean | Default **true** if merge path loses. |
|
|
68
|
-
| `auditTimeoutMs` | number | Env `AUDIT_TIMEOUT_MS`, `POST_STEP_TIMEOUT_MS` — default **30_000**. |
|
|
69
|
-
|
|
70
|
-
### `PolishConfig`
|
|
71
|
-
|
|
72
|
-
| Field | Type | Notes |
|
|
73
|
-
|-------|------|--------|
|
|
74
|
-
| `checklist` | `PolishChecklistItem[]` | `{ instruction, priority: high\|medium\|low }`. |
|
|
75
|
-
| `maxPasses` | number | Default **1**. |
|
|
76
|
-
| `modelConfig` | `ModelConfig?` | Env `POLISH_MODEL`, `POST_STEP_MODEL`. |
|
|
77
|
-
| `customGuidelines` | string? | |
|
|
78
|
-
| `includeOriginalContext` | boolean? | When true, pass `originalInput` + `promptContext` into user prompt. |
|
|
79
|
-
| `timeoutMs` | number | Env `POLISH_TIMEOUT_MS`, `POST_STEP_TIMEOUT_MS` — default **30_000**. |
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## 6. LLM output contracts
|
|
84
|
-
|
|
85
|
-
### Audit (`parseAuditOutputFromMarkdown`)
|
|
86
|
-
|
|
87
|
-
Model should emit markdown with:
|
|
88
|
-
|
|
89
|
-
- `### Checks` — blocks containing **Check / Kind (must|should) / Passed (yes|no) / Feedback** (see `src/post-steps/audit/parseAuditOutput.ts` regexes).
|
|
90
|
-
- `### Overall feedback` — free text.
|
|
91
|
-
|
|
92
|
-
Parser fills `AuditLLMOutput`; host computes **weighted score** from gateway weights and **must** all-pass.
|
|
93
|
-
|
|
94
|
-
### Polish (`parsePolishOutput`)
|
|
95
|
-
|
|
96
|
-
Model should return **JSON**:
|
|
97
|
-
|
|
98
|
-
```json
|
|
99
|
-
{
|
|
100
|
-
"polishedOutput": "string",
|
|
101
|
-
"changeNotes": [
|
|
102
|
-
{ "instruction": "string", "action": "changed" | "no-change", "note": "string" }
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Parser may need fence stripping (implement as in repo).
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## 7. Environment variables
|
|
112
|
-
|
|
113
|
-
| Variable | Purpose |
|
|
114
|
-
|----------|---------|
|
|
115
|
-
| `AUDIT_MODEL`, `AUDIT_SYNTHESIS_MODEL`, `POST_STEP_MODEL` | Model fallbacks |
|
|
116
|
-
| `AUDIT_TIMEOUT_MS`, `POST_STEP_TIMEOUT_MS` | Audit |
|
|
117
|
-
| `POLISH_MODEL`, `POLISH_TIMEOUT_MS` | Polish |
|
|
118
|
-
| `AUDIT_TEMPLATES_PATH`, `POLISH_TEMPLATES_PATH` | Override cwd base for template discovery |
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## 8. Source file manifest
|
|
123
|
-
|
|
124
|
-
| Path | Role |
|
|
125
|
-
|------|------|
|
|
126
|
-
| `src/post-steps/audit/runAudit.ts` | Orchestration, cycles, synthesis selection |
|
|
127
|
-
| `src/post-steps/audit/runAuditCall.ts` | Single LLM call |
|
|
128
|
-
| `src/post-steps/audit/loadAuditTemplates.ts` | Disk + Handlebars |
|
|
129
|
-
| `src/post-steps/audit/parseAuditOutput.ts` | Markdown → checks |
|
|
130
|
-
| `src/post-steps/polish/runPolish.ts` | Multi-pass |
|
|
131
|
-
| `src/post-steps/polish/runPolishCall.ts` | Single LLM |
|
|
132
|
-
| `src/post-steps/polish/loadPolishTemplates.ts` | Disk + Handlebars |
|
|
133
|
-
| `src/post-steps/polish/parsePolishOutput.ts` | JSON |
|
|
134
|
-
| `src/post-steps/resolvePostStepConfig.ts` | `resolveModel`, `resolveTimeout` |
|
|
135
|
-
| `src/internal/runLlmTextCall.ts` | Shared LLM |
|
|
136
|
-
|
|
137
|
-
Templates: see [`gaps-and-artifacts.md`](gaps-and-artifacts.md).
|
|
138
|
-
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
## 9. Response shaping (host)
|
|
142
|
-
|
|
143
|
-
After post pipeline:
|
|
144
|
-
|
|
145
|
-
- Set `rawText` / `parsed` to final string (current SDK sets both to final text).
|
|
146
|
-
- `metadata.postSteps = { audit?, polish? }` with `AuditPostStepMetadata` / `PolishPostStepMetadata`.
|
|
147
|
-
- Renumber or append `intermediateSteps` (synthesis step from PRE may precede in full response).
|
|
148
|
-
|
|
149
|
-
---
|
|
150
|
-
|
|
151
|
-
## 10. Definition of done
|
|
152
|
-
|
|
153
|
-
- [ ] POST steps run in pipeline order; `currentOutput` chains correctly.
|
|
154
|
-
- [ ] Audit: cache behavior matches spec when `customAuditGuidelines` unset; throws if all cycles fail LLM; `reRunMain` receives extended context.
|
|
155
|
-
- [ ] `selectionStrategy: synthesis` merges top two, re-audits, respects `fallbackToBest`.
|
|
156
|
-
- [ ] Polish: multi-pass with previous notes; parse failure stops pass loop gracefully.
|
|
157
|
-
- [ ] Templates load from disk with env override; ship `templates/post-steps/**` in package.
|
|
158
|
-
- [ ] Activix + identity on audit/polish phases and on MAIN re-entry.
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
## 11. Types (canonical source)
|
|
163
|
-
|
|
164
|
-
`AuditConfig`, `AuditPostStepMetadata`, `AuditCheck`, `AuditResult`, `PolishConfig`, `PolishPostStepMetadata`, `PolishLLMOutput`, `RunTaskResponsePostStepsMetadata`, `ExecutionStep`, `IntermediateStep` — **`src/types/task-types.ts`**.
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## 12. Read next
|
|
169
|
-
|
|
170
|
-
1. [`unified-protocol.md`](unified-protocol.md)
|
|
171
|
-
2. [`handler-audit.md`](handler-audit.md)
|
|
172
|
-
3. [`handler-polish.md`](handler-polish.md)
|
|
173
|
-
4. [`gaps-and-artifacts.md`](gaps-and-artifacts.md)
|
|
174
|
-
5. [`../integration/roadmap-and-checklists.md`](../integration/roadmap-and-checklists.md) Phase C
|
|
175
|
-
6. [`../integration/reintegrate-into-ai-tasks.md`](../integration/reintegrate-into-ai-tasks.md)
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Post-Task component — gaps, code, templates
|
|
2
|
-
|
|
3
|
-
What to **ship, copy, or improve** for a standalone post package. **Complete config, env, contracts, acceptance:** [`builder-guide.md`](builder-guide.md).
|
|
4
|
-
|
|
5
|
-
## On-disk templates (repo — **must ship** with post component)
|
|
6
|
-
|
|
7
|
-
Loaded from `templates/post-steps/` relative to `process.cwd()` unless overridden by env.
|
|
8
|
-
|
|
9
|
-
### Audit (`AUDIT_TEMPLATES_PATH` or cwd)
|
|
10
|
-
|
|
11
|
-
| File | Purpose |
|
|
12
|
-
|------|---------|
|
|
13
|
-
| `templates/post-steps/audit/system.md` | Auditor system prompt (Handlebars). |
|
|
14
|
-
| `templates/post-steps/audit/user.txt` | Auditor user template (`.txt`, not `.md` — matches `loadAuditTemplates.ts`). |
|
|
15
|
-
| `templates/post-steps/audit/feedback-injection.md` | Feedback block appended to context for MAIN re-run. |
|
|
16
|
-
| `templates/post-steps/audit/synthesis.md` | Merge-two-candidates system prompt (`selectionStrategy: synthesis`). |
|
|
17
|
-
|
|
18
|
-
**Fallback:** in-code defaults in `loadAuditTemplates.ts` if files missing (runtime still works; packaging should include files for consistency).
|
|
19
|
-
|
|
20
|
-
### Polish (`POLISH_TEMPLATES_PATH` or cwd)
|
|
21
|
-
|
|
22
|
-
| File | Purpose |
|
|
23
|
-
|------|---------|
|
|
24
|
-
| `templates/post-steps/polish/system.md` | Polish system prompt. |
|
|
25
|
-
| `templates/post-steps/polish/user.txt` | Polish user template (**`.txt`**). |
|
|
26
|
-
|
|
27
|
-
## Code modules (anchors)
|
|
28
|
-
|
|
29
|
-
| Path | Role |
|
|
30
|
-
|------|------|
|
|
31
|
-
| `src/post-steps/audit/runAudit.ts` | Cycle orchestration, synthesis selection |
|
|
32
|
-
| `src/post-steps/audit/runAuditCall.ts` | Single audit LLM |
|
|
33
|
-
| `src/post-steps/audit/loadAuditTemplates.ts` | Disk load + Handlebars compile helpers |
|
|
34
|
-
| `src/post-steps/audit/parseAuditOutput.ts` | Markdown → `AuditLLMOutput` |
|
|
35
|
-
| `src/post-steps/polish/runPolish.ts` | Multi-pass loop |
|
|
36
|
-
| `src/post-steps/polish/runPolishCall.ts` | Single polish LLM |
|
|
37
|
-
| `src/post-steps/polish/loadPolishTemplates.ts` | Disk load |
|
|
38
|
-
| `src/post-steps/polish/parsePolishOutput.ts` | JSON → `PolishLLMOutput` |
|
|
39
|
-
| `src/post-steps/resolvePostStepConfig.ts` | `resolveModel`, `resolveTimeout` |
|
|
40
|
-
| `src/internal/runLlmTextCall.ts` | Shared LLM primitive |
|
|
41
|
-
|
|
42
|
-
## Possible gaps / improvements
|
|
43
|
-
|
|
44
|
-
| Gap | Suggestion |
|
|
45
|
-
|-----|------------|
|
|
46
|
-
| **user.txt** naming | Docs sometimes say “user.md”; code reads **`user.txt`** — keep extension aligned or add fallback read for `.md`. |
|
|
47
|
-
| **nx-cache** | Audit caching is in-memory package `nx-cache`; document TTL (300s) and cache key fields for distributed deployments (may need Redis). |
|
|
48
|
-
| **Strict JSON polish** | No provider JSON mode in spec; consider optional `response_format` when extracting. |
|
|
49
|
-
|
|
50
|
-
## Environment
|
|
51
|
-
|
|
52
|
-
Full list: [`builder-guide.md`](builder-guide.md) §7.
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Handler: audit quality gate
|
|
2
|
-
|
|
3
|
-
> **Platform:** [`../integration/platform.md`](../integration/platform.md).
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
LLM evaluates MAIN output against **must** / **should** checks; weighted score; optional MAIN **re-run** with feedback; optional **merge** of top two candidates + re-audit.
|
|
8
|
-
|
|
9
|
-
## Trigger (current repo)
|
|
10
|
-
|
|
11
|
-
- `executionPipeline` POST `{ type: "audit", config?: AuditConfig }`
|
|
12
|
-
- Needs **captured** `contextMarkdown` from MAIN (`task-sdk` pipeline path).
|
|
13
|
-
- `src/post-steps/audit/runAudit.ts`, `runAuditCall.ts`
|
|
14
|
-
|
|
15
|
-
## Config (`AuditConfig`)
|
|
16
|
-
|
|
17
|
-
Full field list and defaults: [`builder-guide.md`](builder-guide.md) §5.
|
|
18
|
-
|
|
19
|
-
## Loop (detailed)
|
|
20
|
-
|
|
21
|
-
1. **Candidate text** — `mainResult.rawText` or `JSON.stringify(mainResult.parsed ?? …)`.
|
|
22
|
-
2. **Cache (cycle 1 only)** — If `customAuditGuidelines` is unset, SHA-256 key over `originalInput`, `contextMarkdown`, `currentOutput`, serialized must/should lists; **nx-cache** TTL **300_000 ms**. Skip cache when custom guidelines set.
|
|
23
|
-
3. **`runAuditCall`** — `runLlmTextCall` + `setAuditGateway` test override; timeout `auditTimeoutMs` / env.
|
|
24
|
-
4. **Parse** — `parseAuditOutputFromMarkdown`; on hard parse failure use empty checks + placeholder feedback (do not throw).
|
|
25
|
-
5. **Score** — `weightedScore = round((passedWeight / totalWeight) * 100)`; **must** = all `gateway.must` checks have matching parsed row with `passed: true`.
|
|
26
|
-
6. **Exit** when `mustOk && weightedScore >= threshold && cycle >= minCycles`, or `cycle >= maxCycles`.
|
|
27
|
-
7. **Continue** — `renderFeedbackInjection` → append to `contextMarkdown` → `reRunMain(nextContext)` → refresh `currentOutput` from new MAIN result.
|
|
28
|
-
8. **`runAuditCall` throws** — increment failure counter; push failed `intermediateStep`; if failures **≥ maxCycles**, throw `Audit: all cycles failed` with `phase: post:audit`.
|
|
29
|
-
|
|
30
|
-
## Selection after loop
|
|
31
|
-
|
|
32
|
-
- **`best`:** Pick candidate with highest `weightedScore` (implementation may prefer later cycle on tie).
|
|
33
|
-
- **`synthesis`:** If `candidates.length >= 2`, sort by score, take top **A** and **B**; `runLlmTextCall` with **system prompt only** from `renderSynthesis` (`userPrompt: ""`); on error use **A**’s output; **re-audit** merged text; keep merged only if merged score **strictly** beats best single and `fallbackToBest` allows.
|
|
34
|
-
|
|
35
|
-
## LLM markdown shape (for prompt authors)
|
|
36
|
-
|
|
37
|
-
Templates must encourage output compatible with `parseAuditOutputFromMarkdown`: sections `### Checks` and `### Overall feedback`, and per-check lines **Check / Kind / Passed / Feedback** (see `src/post-steps/audit/parseAuditOutput.ts`).
|
|
38
|
-
|
|
39
|
-
## Outputs
|
|
40
|
-
|
|
41
|
-
- **`outputText`:** Final string.
|
|
42
|
-
- **`AuditPostStepMetadata`:** `totalCycles`, `candidateScores`, `selectedCycleIndex`, `allMustPassed`, `synthesisUsed`, `auditResults`, `durationMs`.
|
|
43
|
-
- **`intermediateSteps`:** Per cycle + failures.
|
|
44
|
-
|
|
45
|
-
## Types
|
|
46
|
-
|
|
47
|
-
`AuditCheck`, `AuditResult`, `AuditConfig`, … — `src/types/task-types.ts`.
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Handler: polish / checklist refinement
|
|
2
|
-
|
|
3
|
-
> **Platform:** [`../integration/platform.md`](../integration/platform.md).
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
One or more LLM passes over **currentOutput** with a prioritized checklist; expect JSON `{ polishedOutput, changeNotes }`.
|
|
8
|
-
|
|
9
|
-
## Trigger (current repo)
|
|
10
|
-
|
|
11
|
-
- POST `{ type: "polish", config?: PolishConfig }`
|
|
12
|
-
- Runs **after** audit when both exist (`src/post-steps/polish/runPolish.ts`, `runPolishCall.ts`).
|
|
13
|
-
|
|
14
|
-
## Config (`PolishConfig`)
|
|
15
|
-
|
|
16
|
-
Checklist items with `high` | `medium` | `low`; `maxPasses`; `modelConfig`; `timeoutMs`; `customGuidelines`; `includeOriginalContext` gates `originalInput` + `promptContext` in prompt.
|
|
17
|
-
|
|
18
|
-
## Pass flow
|
|
19
|
-
|
|
20
|
-
`loadPolishTemplates` → `renderPolishSystem` / `renderPolishUser` (Handlebars; system gets `customGuidelines`, `passNumber`, optional `previousPassNotes`) → `runPolishCall` → `parsePolishOutput`.
|
|
21
|
-
**Success:** update working output, accumulate `changeNotes`, push ok `intermediateStep`.
|
|
22
|
-
**Parse or LLM failure:** push failing step, **break** loop; return last good `polishedOutput` (or initial `currentOutput`).
|
|
23
|
-
|
|
24
|
-
## Expected JSON (model)
|
|
25
|
-
|
|
26
|
-
Align prompts with:
|
|
27
|
-
|
|
28
|
-
```json
|
|
29
|
-
{
|
|
30
|
-
"polishedOutput": "<full revised text>",
|
|
31
|
-
"changeNotes": [
|
|
32
|
-
{ "instruction": "<checklist line>", "action": "changed", "note": "…" }
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
`action` is `"changed"` or `"no-change"`. System template in repo defaults asks for this shape explicitly.
|
|
38
|
-
|
|
39
|
-
## Types
|
|
40
|
-
|
|
41
|
-
`PolishConfig`, `PolishLLMOutput`, `PolishPostStepMetadata` — `src/types/task-types.ts`. Full config table: [`builder-guide.md`](builder-guide.md) §5.
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# Post-Task component — unified protocol
|
|
2
|
-
|
|
3
|
-
> **Scope:** Target architecture only.
|
|
4
|
-
> **Shared platform:** [`../integration/platform.md`](../integration/platform.md).
|
|
5
|
-
|
|
6
|
-
## Goal
|
|
7
|
-
|
|
8
|
-
One engine that runs **after MAIN**: consumes MAIN result, **context markdown** used for MAIN, and `reRunMain` for audit loops; outputs final text + `postSteps` metadata + intermediate steps.
|
|
9
|
-
|
|
10
|
-
## Protocol (conceptual)
|
|
11
|
-
|
|
12
|
-
```ts
|
|
13
|
-
type PostHandlerId = "audit" | "polish" | string;
|
|
14
|
-
|
|
15
|
-
interface PostHandlerContext {
|
|
16
|
-
request: RunTaskRequest;
|
|
17
|
-
identity?: Record<string, unknown>;
|
|
18
|
-
mainResult: RunTaskResponse;
|
|
19
|
-
contextMarkdown: string;
|
|
20
|
-
currentOutput: string;
|
|
21
|
-
config: unknown;
|
|
22
|
-
reRunMain: (overrideContext: string) => Promise<RunTaskResponse>;
|
|
23
|
-
jobId?: string;
|
|
24
|
-
agentId?: string;
|
|
25
|
-
correlationId?: string;
|
|
26
|
-
activix?: unknown;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface PostHandlerResult {
|
|
30
|
-
ok: boolean;
|
|
31
|
-
outputText: string;
|
|
32
|
-
metadata?: Record<string, unknown>;
|
|
33
|
-
intermediateSteps?: IntermediateStep[];
|
|
34
|
-
error?: { code: string; message: string };
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface PostTaskHandler {
|
|
38
|
-
id: PostHandlerId;
|
|
39
|
-
order: number;
|
|
40
|
-
shouldRun(ctx: PostHandlerContext): boolean;
|
|
41
|
-
run(ctx: PostHandlerContext): Promise<PostHandlerResult>;
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
**Chaining:** `currentOutput` flows audit → polish. Only **audit** uses `reRunMain`. **@athenices/xynthesis** is **not** in the default post design (audit/polish call **aifunctions-js** directly).
|
|
46
|
-
|
|
47
|
-
## Built-in handlers
|
|
48
|
-
|
|
49
|
-
| id | Pipeline `type` | Spec |
|
|
50
|
-
|----|-----------------|------|
|
|
51
|
-
| `audit` | `audit` | [`handler-audit.md`](handler-audit.md) |
|
|
52
|
-
| `polish` | `polish` | [`handler-polish.md`](handler-polish.md) |
|
|
53
|
-
|
|
54
|
-
## Engine duties
|
|
55
|
-
|
|
56
|
-
- Walk `executionPipeline` POST steps in order.
|
|
57
|
-
- Seed `currentOutput` from MAIN (`rawText` or JSON `parsed`).
|
|
58
|
-
- Merge each handler’s `intermediateSteps` and `metadata` into `response.metadata.postSteps`.
|
|
59
|
-
- Final `rawText` / `parsed` = last `outputText`.
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# Pre-Task component — spec pack
|
|
2
|
-
|
|
3
|
-
**Start here to implement:** [`builder-guide.md`](builder-guide.md) (dependencies, host contract, env, file manifest, acceptance criteria).
|
|
4
|
-
Shared platform (Activix / identity / aifunctions / Xynthesis) is defined **once** in [`../integration/platform.md`](../integration/platform.md); the builder guide summarizes only what you must comply with.
|
|
5
|
-
|
|
6
|
-
## Read order
|
|
7
|
-
|
|
8
|
-
1. [`builder-guide.md`](builder-guide.md) — **full implementation entry**.
|
|
9
|
-
2. [`unified-protocol.md`](unified-protocol.md) — protocol types, handler index, execution order.
|
|
10
|
-
3. Handler specs:
|
|
11
|
-
- [`handler-narrix-preprocessor.md`](handler-narrix-preprocessor.md)
|
|
12
|
-
- [`handler-web-scope.md`](handler-web-scope.md)
|
|
13
|
-
- [`handler-narrix-system2.md`](handler-narrix-system2.md)
|
|
14
|
-
- [`handler-synthesized-context.md`](handler-synthesized-context.md) (**@athenices/xynthesis**)
|
|
15
|
-
- [`handler-ai-scoping.md`](handler-ai-scoping.md)
|
|
16
|
-
4. [`gaps-and-artifacts.md`](gaps-and-artifacts.md) — optional externalizations, open decisions.
|
|
17
|
-
|
|
18
|
-
## Outside this folder
|
|
19
|
-
|
|
20
|
-
- **LLM, Activix, identity, Xynthesis vs aifunctions-js:** [`../integration/platform.md`](../integration/platform.md)
|
|
21
|
-
- **Phased checklist (includes Pre Phase B):** [`../integration/roadmap-and-checklists.md`](../integration/roadmap-and-checklists.md)
|
|
22
|
-
- **Merging back into `ai-tasks`:** [`../integration/reintegrate-into-ai-tasks.md`](../integration/reintegrate-into-ai-tasks.md)
|