@nexusclawhq/cli 0.3.53 → 0.3.55
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/dist/build-info.json +4 -4
- package/dist/nexus-cli/src/cli.js +0 -0
- package/dist/nexus-cli/src/commands/source/pull.js +10 -5
- package/dist/nexus-cli/src/commands/source/pull.js.map +1 -1
- package/dist/nexus-cli/src/services/api-client.js +5 -1
- package/dist/nexus-cli/src/services/api-client.js.map +1 -1
- package/dist/nexus-cli/src/services/workforce-bundle-remote.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/cognitive-policy.schemas.d.ts +0 -38
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/cognitive-policy.schemas.js +0 -502
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/cognitive-policy.schemas.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/cognitive-policy.types.d.ts +0 -191
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/cognitive-policy.types.js +0 -3
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/cognitive-policy.types.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/context-selection.schemas.d.ts +0 -4
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/context-selection.schemas.js +0 -53
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/context-selection.schemas.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/context-selection.types.d.ts +0 -37
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/context-selection.types.js +0 -3
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/context-selection.types.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/contract-versions.d.ts +0 -19
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/contract-versions.js +0 -42
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/contract-versions.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/controlled-memory.schemas.d.ts +0 -12
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/controlled-memory.schemas.js +0 -161
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/controlled-memory.schemas.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/controlled-memory.types.d.ts +0 -44
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/controlled-memory.types.js +0 -3
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/controlled-memory.types.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/goal-snapshot.schemas.d.ts +0 -5
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/goal-snapshot.schemas.js +0 -81
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/goal-snapshot.schemas.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/goal-snapshot.types.d.ts +0 -61
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/goal-snapshot.types.js +0 -3
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/goal-snapshot.types.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/index.d.ts +0 -15
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/index.js +0 -32
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/index.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/proactive-decision.schemas.d.ts +0 -9
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/proactive-decision.schemas.js +0 -170
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/proactive-decision.schemas.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/proactive-decision.types.d.ts +0 -98
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/proactive-decision.types.js +0 -3
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/proactive-decision.types.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/success-evaluation.schemas.d.ts +0 -21
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/success-evaluation.schemas.js +0 -157
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/success-evaluation.schemas.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/success-evaluation.types.d.ts +0 -47
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/success-evaluation.types.js +0 -3
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/success-evaluation.types.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/training-evidence.schemas.d.ts +0 -19
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/training-evidence.schemas.js +0 -177
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/training-evidence.schemas.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/training-evidence.types.d.ts +0 -66
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/training-evidence.types.js +0 -3
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-cognition/training-evidence.types.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-runtime/index.d.ts +0 -53
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-runtime/index.js +0 -42
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-employee-runtime/index.js.map +0 -1
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-workforce-learning/index.d.ts +0 -743
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-workforce-learning/index.js +0 -1261
- package/dist/nexus-cli/node_modules/@nexusclaw/shared/dist/ai-workforce-learning/index.js.map +0 -1
|
@@ -1,743 +0,0 @@
|
|
|
1
|
-
export declare const AI_WORKFORCE_BEHAVIOR_EVENT_TYPES: readonly ["execution_started", "user_input_received", "context_retrieved", "knowledge_retrieved", "agent_output_generated", "tool_call_started", "tool_call_completed", "tool_call_failed", "policy_checked", "guardrail_triggered", "approval_requested", "approval_approved", "approval_rejected", "human_edit_applied", "human_handoff_triggered", "execution_completed", "execution_failed", "outcome_verified", "feedback_received", "learning_signal_generated", "improvement_recommendation_generated"];
|
|
2
|
-
export type AiWorkforceBehaviorEventType = typeof AI_WORKFORCE_BEHAVIOR_EVENT_TYPES[number];
|
|
3
|
-
export declare const AI_WORKFORCE_LEARNING_SIGNAL_TYPES: readonly ["successful_behavior_pattern", "failed_behavior_pattern", "human_correction_pattern", "approval_pattern", "rejection_pattern", "knowledge_gap", "knowledge_conflict", "missing_tool", "tool_failure_pattern", "prompt_policy_gap", "guardrail_gap", "workflow_bottleneck", "sop_drift", "model_routing_issue", "cost_optimization_opportunity", "autonomy_upgrade_candidate", "autonomy_downgrade_candidate", "test_case_candidate", "regression_case_candidate", "template_candidate", "auto_approval_candidate"];
|
|
4
|
-
export type AiWorkforceLearningSignalType = typeof AI_WORKFORCE_LEARNING_SIGNAL_TYPES[number];
|
|
5
|
-
export declare const AI_WORKFORCE_IMPROVEMENT_RECOMMENDATION_TYPES: readonly ["hire_new_employee", "improve_existing_employee", "create_workflow", "update_workflow", "add_guardrail", "relax_guardrail", "add_tool", "change_tool_permission", "update_sop", "update_knowledge", "generate_test_suite", "upgrade_autonomy", "downgrade_autonomy", "change_model_routing", "auto_approval_policy", "prompt_policy_update"];
|
|
6
|
-
export type AiWorkforceImprovementRecommendationType = typeof AI_WORKFORCE_IMPROVEMENT_RECOMMENDATION_TYPES[number];
|
|
7
|
-
export declare const AI_WORKFORCE_IMPROVEMENT_RECOMMENDATION_SOURCE_TYPES: readonly ["learning_signal", "learned_pattern", "behavior_event", "goal_blueprint", "advisor_recommendation"];
|
|
8
|
-
export type AiWorkforceImprovementRecommendationSourceType = typeof AI_WORKFORCE_IMPROVEMENT_RECOMMENDATION_SOURCE_TYPES[number];
|
|
9
|
-
export declare const AI_WORKFORCE_ARTIFACT_CANDIDATE_TYPES: readonly ["prompt_policy_update", "prompt_template_update", "guardrail_update", "workflow_update", "sop_update", "knowledge_update", "tool_permission_update", "approval_policy_update", "model_routing_update", "employee_template", "test_case", "eval_suite", "skill_recommendation"];
|
|
10
|
-
export type AiWorkforceArtifactCandidateType = typeof AI_WORKFORCE_ARTIFACT_CANDIDATE_TYPES[number];
|
|
11
|
-
export declare const AI_WORKFORCE_TARGET_ARTIFACT_TYPES: readonly ["agent", "agent_version", "prompt_policy", "prompt_template", "guardrail", "workflow", "sop", "knowledge", "tool_permission", "approval_policy", "model_routing", "employee_template", "test_case", "eval_suite"];
|
|
12
|
-
export type AiWorkforceTargetArtifactType = typeof AI_WORKFORCE_TARGET_ARTIFACT_TYPES[number];
|
|
13
|
-
export declare const AI_WORKFORCE_LEARNING_PIPELINE_STATUSES: readonly ["captured", "redaction_pending", "redacted", "ineligible", "eligible", "signal_extracted", "pattern_generated", "recommendation_generated", "draft_created", "tests_required", "simulation_running", "simulation_failed", "approval_required", "approved", "rejected", "ready_to_publish", "published", "rolled_back"];
|
|
14
|
-
export type AiWorkforceLearningPipelineStatus = typeof AI_WORKFORCE_LEARNING_PIPELINE_STATUSES[number];
|
|
15
|
-
export declare const AI_WORKFORCE_REDACTION_STATUSES: readonly ["not_required", "pending", "redacted", "failed", "blocked"];
|
|
16
|
-
export type AiWorkforceRedactionStatus = typeof AI_WORKFORCE_REDACTION_STATUSES[number];
|
|
17
|
-
export declare const AI_WORKFORCE_RELEASE_GATE_STATUSES: readonly ["not_started", "tests_required", "tests_running", "tests_failed", "simulation_required", "simulation_running", "simulation_failed", "approval_required", "ready_to_publish", "published", "blocked", "rolled_back"];
|
|
18
|
-
export type AiWorkforceReleaseGateStatus = typeof AI_WORKFORCE_RELEASE_GATE_STATUSES[number];
|
|
19
|
-
export declare const AI_WORKFORCE_APPROVAL_STATUSES: readonly ["not_required", "required", "pending", "approved", "rejected", "expired"];
|
|
20
|
-
export type AiWorkforceApprovalStatus = typeof AI_WORKFORCE_APPROVAL_STATUSES[number];
|
|
21
|
-
export declare const AI_WORKFORCE_RISK_LEVELS: readonly ["L0", "L1", "L2", "L3", "L4"];
|
|
22
|
-
export type AiWorkforceRiskLevel = typeof AI_WORKFORCE_RISK_LEVELS[number];
|
|
23
|
-
/**
|
|
24
|
-
* code-quality-audit-remediation-v1 R6 (P1-9) — single source of truth for
|
|
25
|
-
* "which risk levels are learning-eligible". Before this, three call sites
|
|
26
|
-
* each independently hand-wrote this same rule with drifted literal
|
|
27
|
-
* expressions: `behavior-learning-capture.service.ts` used
|
|
28
|
-
* `['L0','L1','L2'].includes(riskLevel)`, `behavior-learning-pipeline
|
|
29
|
-
* .service.ts` independently rewrote the identical whitelist for its
|
|
30
|
-
* `risk_not_allowed` gate, and `behavior-learning-governance-route
|
|
31
|
-
* .service.ts` used the logically-equivalent-but-differently-written
|
|
32
|
-
* complement `riskLevel !== 'L0' && riskLevel !== 'L1'` for its
|
|
33
|
-
* `approvalRequired` gate (see `requiresApprovalRiskLevel` below — a
|
|
34
|
-
* DIFFERENT rule, not a duplicate of this one; the two happen to be
|
|
35
|
-
* complements of each other today but govern different decisions and must
|
|
36
|
-
* stay as two named functions, not be collapsed into one).
|
|
37
|
-
*/
|
|
38
|
-
export declare const LEARNING_ELIGIBLE_RISK_LEVELS: readonly AiWorkforceRiskLevel[];
|
|
39
|
-
export declare function isLearningEligibleRiskLevel(riskLevel: AiWorkforceRiskLevel): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* code-quality-audit-remediation-v1 R6 (P1-9) — single source of truth for
|
|
42
|
-
* "which risk levels require approval before publication". Governs
|
|
43
|
-
* `behavior-learning-governance-route.service.ts`'s `approvalRequired`
|
|
44
|
-
* decision. See `isLearningEligibleRiskLevel` above for why this is a
|
|
45
|
-
* separate function rather than reusing/negating that one.
|
|
46
|
-
*/
|
|
47
|
-
export declare function requiresApprovalRiskLevel(riskLevel: AiWorkforceRiskLevel): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* learning-content-generation-v1 R2.2 (rollback mutation) — closed set of
|
|
50
|
-
* stable reasonCode values a caller may pass to `rollbackLearningPublication`.
|
|
51
|
-
*
|
|
52
|
-
* Prior to this (Phase 0 finding), `rollback_reason_code`
|
|
53
|
-
* (`behavior-learning-rollback-execution.entity.ts`) and every owner
|
|
54
|
-
* rollback service only enforced the generic stable-code SHAPE regex
|
|
55
|
-
* (`^[a-z][a-z0-9_]*$`, see `normalizeRequiredStableCode()` in
|
|
56
|
-
* `behavior-learning-rollback-execution.service.ts`) — there was no closed
|
|
57
|
-
* vocabulary. This is a genuinely new contract, not a pre-existing word
|
|
58
|
-
* list being "discovered". The DB column stays free-form varchar to remain
|
|
59
|
-
* compatible with any pre-existing rows; this enum is enforced at the
|
|
60
|
-
* GraphQL/class-validator layer only (see
|
|
61
|
-
* `RollbackLearningPublicationInput.reasonCode` in
|
|
62
|
-
* `ai-workforce-learning-rollback.input.ts`).
|
|
63
|
-
*
|
|
64
|
-
* `cost_regression` / `safety_regression` added by
|
|
65
|
-
* model-routing-learning-publication-v1 Phase 5 (requirements.md R6,
|
|
66
|
-
* design.md §6): the three model_routing monitoring regression triggers
|
|
67
|
-
* (cost/quality/safety) each produce a rollback RECOMMENDATION carrying one
|
|
68
|
-
* of these stable codes. `quality_regression` already existed and is reused
|
|
69
|
-
* verbatim for the quality trigger — it is not a new concept, just a new
|
|
70
|
-
* (real) producer of an existing code. Per Q4 (signed): every trigger only
|
|
71
|
-
* ever produces a recommendation; a human must still separately call
|
|
72
|
-
* `rollbackLearningPublication` with this same reasonCode for the EXISTING
|
|
73
|
-
* Phase 4 rollback path to actually run — no trigger, including safety,
|
|
74
|
-
* calls that mutation itself (see
|
|
75
|
-
* `model-routing-monitoring-regression.service.ts`).
|
|
76
|
-
*/
|
|
77
|
-
export declare const AI_WORKFORCE_ROLLBACK_REASON_CODES: readonly ["quality_regression", "cost_regression", "safety_regression", "incident_rollback", "manual_operator_decision", "policy_violation"];
|
|
78
|
-
export type AiWorkforceRollbackReasonCode = typeof AI_WORKFORCE_ROLLBACK_REASON_CODES[number];
|
|
79
|
-
/**
|
|
80
|
-
* model-routing-learning-publication-v1 R2/R3/R5 — new stable reason codes
|
|
81
|
-
* the (Phase 4) `ModelRoutingPublicationAdapter` and its R2 safety guard /
|
|
82
|
-
* R3 budget guard / R5 simulation-evidence gate return via
|
|
83
|
-
* `BehaviorLearningPublicationAdapterRefusal.reasonCode`
|
|
84
|
-
* (`behavior-learning-publication-adapter.registry.ts`'s
|
|
85
|
-
* `reasonCode: string` field). The 4 existing adapters (guardrail/
|
|
86
|
-
* tool_permission/approval_policy/sop) reuse a shared *generic* rejection
|
|
87
|
-
* vocabulary (`target_missing` / `content_missing` / `content_invalid` /
|
|
88
|
-
* `rollback_owner_rejected`) as inline literals scattered per-adapter-file
|
|
89
|
-
* — there is no dedicated shared-package constant for that generic set
|
|
90
|
-
* today, and this spec does not introduce one (out of scope). What IS new
|
|
91
|
-
* here is a set of reason codes specific to a single artifact type's own
|
|
92
|
-
* guard logic (safety/budget/simulation-evidence gates unique to
|
|
93
|
-
* `model_routing`, requirements.md R2/R3/R5) — those get a named closed-set
|
|
94
|
-
* export so Phase 2's guards and Phase 4's adapter both reference the same
|
|
95
|
-
* stable codes instead of re-typing string literals in multiple files.
|
|
96
|
-
* Chinese/English copy for these lives only in
|
|
97
|
-
* `packages/shared/src/locales/{zh-CN,en-US}.ts`
|
|
98
|
-
* (`aiWorkforceLearningCopy.contentPanel.modelRoutingGuardReasonCode`,
|
|
99
|
-
* requirements.md R8) — never re-derive display text from the code string
|
|
100
|
-
* itself.
|
|
101
|
-
*/
|
|
102
|
-
export declare const AI_WORKFORCE_MODEL_ROUTING_GUARD_REASON_CODES: readonly ["safety_guard_rejected", "budget_guard_rejected", "simulation_evidence_missing"];
|
|
103
|
-
export type AiWorkforceModelRoutingGuardReasonCode = typeof AI_WORKFORCE_MODEL_ROUTING_GUARD_REASON_CODES[number];
|
|
104
|
-
/**
|
|
105
|
-
* learning-content-generation-v1 R3.6/R4 — content-generation posture per
|
|
106
|
-
* `AiWorkforceTargetArtifactType`. Drives both the `generateLearningDraftContent`
|
|
107
|
-
* mutation's structured-rejection branch and the front-end's per-type
|
|
108
|
-
* rendering (design.md §7):
|
|
109
|
-
*
|
|
110
|
-
* - `llm_patch`: the 7 patch-type owners (guardrail/knowledge/tool_permission/
|
|
111
|
-
* approval_policy/employee_template/sop/model_routing) — LLM drafts a patch
|
|
112
|
-
* payload against the type's content contract, subject to the full
|
|
113
|
-
* evidence/validator/generation pipeline. NOTE (Phase 0 finding for the
|
|
114
|
-
* first 6, do not re-litigate; model-routing-learning-publication-v1
|
|
115
|
-
* Phase 4 for the 7th): 5 of these 7 (guardrail/tool_permission/
|
|
116
|
-
* approval_policy/sop/model_routing) have zero real `targetArtifactId` in
|
|
117
|
-
* the current pipeline (`BehaviorLearningTargetIdentityService` does not
|
|
118
|
-
* resolve `model_routing` — see `model-routing-publication.adapter.ts`'s
|
|
119
|
-
* class doc) and will therefore always terminate at a "target missing"
|
|
120
|
-
* outcome before an LLM call is ever made — this posture only says "the
|
|
121
|
-
* content SHAPE is patch-like", not "a real candidate of this type can
|
|
122
|
-
* reach `generated`" via the fully-automated pipeline. Honesty note
|
|
123
|
-
* specific to `model_routing` (do not conflate with the publish/rollback
|
|
124
|
-
* chain below, which IS fully real): `learning-draft-content-generator
|
|
125
|
-
* .service.ts`'s internal `describeSchemaForType()`/`validateForType()`
|
|
126
|
-
* switches also have no `model_routing` case yet (both fall to their
|
|
127
|
-
* generic default), so even a hand-supplied `targetArtifactId` reaching
|
|
128
|
-
* the real `generateLearningDraftContent` mutation would terminate at
|
|
129
|
-
* `validation_failed`, not `generated` — wiring that LLM-drafting path is
|
|
130
|
-
* a real, separate, still-open gap, not required by
|
|
131
|
-
* model-routing-learning-publication-v1 (R1-R7 only cover PUBLISHING an
|
|
132
|
-
* already-generated candidate, not drafting one). What IS fully real and
|
|
133
|
-
* proven end-to-end: a candidate whose `generatedContent` is set directly
|
|
134
|
-
* (bypassing the LLM generator, the same "hand-built content" idiom the
|
|
135
|
-
* other four adapters' own e2e coverage already uses) flows through the
|
|
136
|
-
* real R1 re-validator, R2/R3/R5 guards, R4 canary overlay, and real
|
|
137
|
-
* `setOrgPolicy` publish/rollback — see the real-Postgres full-lifecycle
|
|
138
|
-
* integration test in `model-routing-publication-adapter.e2e.integration
|
|
139
|
-
* .spec.ts`.
|
|
140
|
-
* - `reference_no_content`: `test_case`/`eval_suite` — the artifact already
|
|
141
|
-
* has real, publishable content (a materialized `AgentTestCase` /
|
|
142
|
-
* `AgentTestSuite`); there is nothing for an LLM to draft.
|
|
143
|
-
* - `reference_draft_pending`: `workflow`/`prompt_policy`/`prompt_template`/
|
|
144
|
-
* `agent` — drafting requires materializing a non-active draft entity
|
|
145
|
-
* through the owning module's own creation path, not just writing
|
|
146
|
-
* `generated_content` on the candidate row. `prompt_template` moved INTO
|
|
147
|
-
* this bucket in prompt-template-learning-publication-v1 Phase 2
|
|
148
|
-
* (requirements.md R1/R7): `PromptTemplateVersionService`'s snapshot/
|
|
149
|
-
* archive path is still not treated as the draft boundary (that judgment
|
|
150
|
-
* from learning-content-generation-v2 phase-5 stands unchanged) — the NEW
|
|
151
|
-
* `PromptTemplateLearningDraft` table is the real pending→activated→
|
|
152
|
-
* rolled_back draft boundary instead. `agent` moved INTO this bucket in
|
|
153
|
-
* agent-learning-publication-v1 Phase 2 (requirements.md R1/R3/R7, Q9
|
|
154
|
-
* signed): ONLY `improve_existing_employee`-sourced candidates can reach
|
|
155
|
-
* `generated` — `upgrade_autonomy`/`downgrade_autonomy` candidates share
|
|
156
|
-
* this same `targetArtifactType`/posture but are still honestly deferred
|
|
157
|
-
* by the generator's own R3 sub-gate (posture cannot distinguish
|
|
158
|
-
* recommendationType; see `learning-draft-content-generator.service.ts`'s
|
|
159
|
-
* `checkAgentAutonomySubGate()`) — autonomy-level semantics have no data
|
|
160
|
-
* model in this codebase (Phase 0 finding) and remain out of scope for a
|
|
161
|
-
* future, independent spec.
|
|
162
|
-
* - `deferred`: `agent_version` only — v2 product-decision defer, now
|
|
163
|
-
* permanent (agent-version-learning-publication-v1 closed by decision,
|
|
164
|
-
* 2026-07-09: standalone publication is not needed — the existing
|
|
165
|
-
* rollback owner already IS "publish a historical AgentVersion" in
|
|
166
|
-
* substance). `model_routing` moved OUT of this bucket in model-routing-
|
|
167
|
-
* learning-publication-v1 Phase 4 (requirements.md R7) — it is now
|
|
168
|
-
* `llm_patch`, real adapter, real owner, real publish/rollback (see
|
|
169
|
-
* `ModelRoutingPublicationAdapter`).
|
|
170
|
-
*/
|
|
171
|
-
export declare const AI_WORKFORCE_LEARNING_CONTENT_POSTURES: readonly ["llm_patch", "reference_no_content", "reference_draft_pending", "deferred"];
|
|
172
|
-
export type AiWorkforceLearningContentPosture = typeof AI_WORKFORCE_LEARNING_CONTENT_POSTURES[number];
|
|
173
|
-
/**
|
|
174
|
-
* Per-type posture lookup — single source of truth consumed by both the
|
|
175
|
-
* backend (`generateLearningDraftContent` mutation's non-`llm_patch`
|
|
176
|
-
* structured rejection) and the front-end (design.md §7 per-posture
|
|
177
|
-
* rendering). Every one of the 14 `AiWorkforceTargetArtifactType`s must
|
|
178
|
-
* appear exactly once here.
|
|
179
|
-
*/
|
|
180
|
-
export declare const AI_WORKFORCE_TARGET_ARTIFACT_CONTENT_POSTURE: Readonly<Record<AiWorkforceTargetArtifactType, AiWorkforceLearningContentPosture>>;
|
|
181
|
-
export declare function getAiWorkforceLearningContentPosture(targetArtifactType: AiWorkforceTargetArtifactType): AiWorkforceLearningContentPosture;
|
|
182
|
-
/**
|
|
183
|
-
* learning-content-generation-v1 R3/R4 — closed set of terminal
|
|
184
|
-
* `content_status` values a candidate's generated-content lifecycle can
|
|
185
|
-
* reach, plus the one non-terminal starting value. Exactly 4 terminal
|
|
186
|
-
* states per design.md §5.5 — do not add a 5th without updating the
|
|
187
|
-
* migration/entity/GraphQL object type together.
|
|
188
|
-
*/
|
|
189
|
-
export declare const AI_WORKFORCE_LEARNING_CONTENT_STATUSES: readonly ["not_generated", "generated", "insufficient_evidence", "validation_failed", "generation_failed"];
|
|
190
|
-
export type AiWorkforceLearningContentStatus = typeof AI_WORKFORCE_LEARNING_CONTENT_STATUSES[number];
|
|
191
|
-
/**
|
|
192
|
-
* learning-content-generation-v2 Phase 2 — persisted Goal-to-Agent blueprint
|
|
193
|
-
* lifecycle. These rows are draft planning artifacts only; none of these
|
|
194
|
-
* statuses may be interpreted as "active employee created" or "published".
|
|
195
|
-
*/
|
|
196
|
-
export declare const AI_WORKFORCE_GOAL_TO_AGENT_BLUEPRINT_STATUSES: readonly ["draft", "insufficient_evidence", "validation_failed"];
|
|
197
|
-
export type AiWorkforceGoalToAgentBlueprintStatus = typeof AI_WORKFORCE_GOAL_TO_AGENT_BLUEPRINT_STATUSES[number];
|
|
198
|
-
export interface AiWorkforceGoalToAgentLearningPlan {
|
|
199
|
-
captureSources: string[];
|
|
200
|
-
redactionPolicy: string;
|
|
201
|
-
learningOutputs: string[];
|
|
202
|
-
releaseControl: string;
|
|
203
|
-
approvalCheckpoints: string[];
|
|
204
|
-
}
|
|
205
|
-
export interface AiWorkforceGoalToAgentReleasePlan {
|
|
206
|
-
generatedTests: string[];
|
|
207
|
-
replayRequired: boolean;
|
|
208
|
-
riskReview: string;
|
|
209
|
-
approvalCheckpoints: string[];
|
|
210
|
-
versioningRequirement: string;
|
|
211
|
-
monitoringMetrics: string[];
|
|
212
|
-
rollbackRequirement: string;
|
|
213
|
-
releaseGateStatus: AiWorkforceReleaseGateStatus;
|
|
214
|
-
blockedReason?: string | null;
|
|
215
|
-
}
|
|
216
|
-
export interface AiWorkforceGoalToAgentBlueprint {
|
|
217
|
-
id: string;
|
|
218
|
-
status: AiWorkforceGoalToAgentBlueprintStatus;
|
|
219
|
-
businessGoal: string;
|
|
220
|
-
mission: string;
|
|
221
|
-
role: string;
|
|
222
|
-
scope: string[];
|
|
223
|
-
outOfScope: string[];
|
|
224
|
-
successMetrics: string[];
|
|
225
|
-
autonomyLevel: string;
|
|
226
|
-
tools: string[];
|
|
227
|
-
knowledge: string[];
|
|
228
|
-
guardrails: string[];
|
|
229
|
-
behaviorPolicy: string[];
|
|
230
|
-
tests: string[];
|
|
231
|
-
releasePlan: AiWorkforceGoalToAgentReleasePlan;
|
|
232
|
-
learningPlan: AiWorkforceGoalToAgentLearningPlan;
|
|
233
|
-
evidenceSourceIds: string[];
|
|
234
|
-
missingEvidence: string[];
|
|
235
|
-
riskLevel: AiWorkforceRiskLevel;
|
|
236
|
-
confidence: number;
|
|
237
|
-
/**
|
|
238
|
-
* Advisory-only success-contract seed. It is deliberately not an
|
|
239
|
-
* AgentCognitivePolicyV1 and cannot enter AgentVersion until a human manager
|
|
240
|
-
* confirms and converts it through the candidate owner API.
|
|
241
|
-
*/
|
|
242
|
-
draftSuccessContract?: {
|
|
243
|
-
status: 'draft_success_contract';
|
|
244
|
-
mission: string;
|
|
245
|
-
metricCandidates: string[];
|
|
246
|
-
requiresHumanConfirmation: true;
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* learning-content-generation-v2 Phase 3 — Hiring Marketplace candidate
|
|
251
|
-
* read-model contract. This is a query/view contract only: a marketplace
|
|
252
|
-
* candidate is not an active employee and does not by itself publish any
|
|
253
|
-
* owner configuration.
|
|
254
|
-
*/
|
|
255
|
-
export declare const AI_WORKFORCE_HIRING_MARKETPLACE_SOURCE_TYPES: readonly ["behavior_candidate", "goal_blueprint", "advisor_recommendation"];
|
|
256
|
-
export type AiWorkforceHiringMarketplaceSourceType = typeof AI_WORKFORCE_HIRING_MARKETPLACE_SOURCE_TYPES[number];
|
|
257
|
-
export declare const AI_WORKFORCE_HIRING_MARKETPLACE_CANDIDATE_TYPES: readonly ["employee_template", "goal_to_agent_blueprint"];
|
|
258
|
-
export type AiWorkforceHiringMarketplaceCandidateType = typeof AI_WORKFORCE_HIRING_MARKETPLACE_CANDIDATE_TYPES[number];
|
|
259
|
-
export declare const AI_WORKFORCE_HIRING_MARKETPLACE_RELEASE_READINESS: readonly ["needs_tests", "needs_approval", "ready_for_draft", "blocked"];
|
|
260
|
-
export type AiWorkforceHiringMarketplaceReleaseReadiness = typeof AI_WORKFORCE_HIRING_MARKETPLACE_RELEASE_READINESS[number];
|
|
261
|
-
export interface AiWorkforceHiringMarketplaceCandidate {
|
|
262
|
-
id: string;
|
|
263
|
-
sourceType: AiWorkforceHiringMarketplaceSourceType;
|
|
264
|
-
sourceId: string;
|
|
265
|
-
candidateType: AiWorkforceHiringMarketplaceCandidateType;
|
|
266
|
-
releaseReadiness: AiWorkforceHiringMarketplaceReleaseReadiness;
|
|
267
|
-
title: string;
|
|
268
|
-
roleName: string;
|
|
269
|
-
mission: string;
|
|
270
|
-
sourceWorkPattern: string;
|
|
271
|
-
learnedFromWork: string;
|
|
272
|
-
whyNow: string;
|
|
273
|
-
autonomyLevel: string;
|
|
274
|
-
requiredTools: string[];
|
|
275
|
-
requiredKnowledge: string[];
|
|
276
|
-
guardrails: string[];
|
|
277
|
-
successMetrics: string[];
|
|
278
|
-
learningPlan: AiWorkforceGoalToAgentLearningPlan;
|
|
279
|
-
generatedTests: number;
|
|
280
|
-
riskLevel: AiWorkforceRiskLevel;
|
|
281
|
-
impactScore: number;
|
|
282
|
-
confidence: number;
|
|
283
|
-
releaseGateStatus: AiWorkforceReleaseGateStatus;
|
|
284
|
-
approvalStatus: AiWorkforceApprovalStatus;
|
|
285
|
-
evidenceSourceIds: string[];
|
|
286
|
-
targetArtifactId: string;
|
|
287
|
-
draftArtifactIds: string[];
|
|
288
|
-
recommendationId?: string | null;
|
|
289
|
-
blueprintId?: string | null;
|
|
290
|
-
}
|
|
291
|
-
export declare const AI_WORKFORCE_REDACTED_VALUE: "[REDACTED]";
|
|
292
|
-
export type AiWorkforceJsonObject = Record<string, unknown>;
|
|
293
|
-
export interface AiWorkforceToolCallSnapshot {
|
|
294
|
-
toolName: string;
|
|
295
|
-
input?: AiWorkforceJsonObject | null;
|
|
296
|
-
output?: AiWorkforceJsonObject | null;
|
|
297
|
-
success?: boolean | null;
|
|
298
|
-
errorCode?: string | null;
|
|
299
|
-
durationMs?: number | null;
|
|
300
|
-
retryCount?: number | null;
|
|
301
|
-
rollbackTriggered?: boolean | null;
|
|
302
|
-
approvalRequired?: boolean | null;
|
|
303
|
-
policyBlocked?: boolean | null;
|
|
304
|
-
guardrailCheck?: 'passed' | 'escalated' | 'blocked' | null;
|
|
305
|
-
permissionCheck?: 'passed' | 'denied' | null;
|
|
306
|
-
}
|
|
307
|
-
export interface AiWorkforceKnowledgeReferenceSnapshot {
|
|
308
|
-
sourceId: string;
|
|
309
|
-
chunkId?: string | null;
|
|
310
|
-
sourceRef?: string | null;
|
|
311
|
-
score?: number | null;
|
|
312
|
-
cited?: boolean | null;
|
|
313
|
-
verified?: boolean | null;
|
|
314
|
-
gapDetected?: boolean | null;
|
|
315
|
-
conflictDetected?: boolean | null;
|
|
316
|
-
}
|
|
317
|
-
export interface AiWorkforceApprovalSnapshot {
|
|
318
|
-
approvalId: string;
|
|
319
|
-
suggestedAction?: string | null;
|
|
320
|
-
approverId?: string | null;
|
|
321
|
-
decision?: 'approved' | 'rejected' | 'pending' | null;
|
|
322
|
-
rationale?: string | null;
|
|
323
|
-
agreementWithAi?: boolean | null;
|
|
324
|
-
durationMs?: number | null;
|
|
325
|
-
negativeOutcomeDetected?: boolean | null;
|
|
326
|
-
}
|
|
327
|
-
export interface AiWorkforceHumanEditSnapshot {
|
|
328
|
-
before?: string | AiWorkforceJsonObject | null;
|
|
329
|
-
after?: string | AiWorkforceJsonObject | null;
|
|
330
|
-
changedFields?: string[] | null;
|
|
331
|
-
deletedContent?: string[] | null;
|
|
332
|
-
addedContent?: string[] | null;
|
|
333
|
-
reason?: string | null;
|
|
334
|
-
improvedOutcome?: boolean | null;
|
|
335
|
-
}
|
|
336
|
-
export interface AiWorkforceOutcomeSnapshot {
|
|
337
|
-
status: 'completed' | 'failed' | 'reworked' | 'escalated' | 'unknown';
|
|
338
|
-
outcomeVerified?: boolean | null;
|
|
339
|
-
outcomeType?: string | null;
|
|
340
|
-
outcomeRecordId?: string | null;
|
|
341
|
-
savedMinutes?: number | null;
|
|
342
|
-
costReduction?: number | null;
|
|
343
|
-
revenueImpact?: number | null;
|
|
344
|
-
customerSatisfactionScore?: number | null;
|
|
345
|
-
riskIncident?: boolean | null;
|
|
346
|
-
}
|
|
347
|
-
export interface AiWorkforceFeedbackSnapshot {
|
|
348
|
-
rating?: 'up' | 'down' | 'neutral' | null;
|
|
349
|
-
reviewerFeedback?: string | null;
|
|
350
|
-
customerFeedback?: string | null;
|
|
351
|
-
qualityScore?: number | null;
|
|
352
|
-
}
|
|
353
|
-
export interface AiWorkforceBehaviorEvent {
|
|
354
|
-
id: string;
|
|
355
|
-
tenantId: string;
|
|
356
|
-
employeeId?: string | null;
|
|
357
|
-
agentId?: string | null;
|
|
358
|
-
workflowId?: string | null;
|
|
359
|
-
executionId: string;
|
|
360
|
-
spanId?: string | null;
|
|
361
|
-
correlationId: string;
|
|
362
|
-
eventType: AiWorkforceBehaviorEventType;
|
|
363
|
-
eventSource: string;
|
|
364
|
-
userId?: string | null;
|
|
365
|
-
department?: string | null;
|
|
366
|
-
channel?: string | null;
|
|
367
|
-
businessObjectType?: string | null;
|
|
368
|
-
businessObjectId?: string | null;
|
|
369
|
-
riskLevel: AiWorkforceRiskLevel;
|
|
370
|
-
inputSnapshot?: string | AiWorkforceJsonObject | null;
|
|
371
|
-
outputSnapshot?: string | AiWorkforceJsonObject | null;
|
|
372
|
-
contextSnapshot?: AiWorkforceJsonObject | null;
|
|
373
|
-
toolCalls?: AiWorkforceToolCallSnapshot[];
|
|
374
|
-
knowledgeRefs?: AiWorkforceKnowledgeReferenceSnapshot[];
|
|
375
|
-
approvals?: AiWorkforceApprovalSnapshot[];
|
|
376
|
-
humanEdits?: AiWorkforceHumanEditSnapshot[];
|
|
377
|
-
finalOutcome?: AiWorkforceOutcomeSnapshot | null;
|
|
378
|
-
feedback?: AiWorkforceFeedbackSnapshot | null;
|
|
379
|
-
labels?: string[];
|
|
380
|
-
redactionStatus: AiWorkforceRedactionStatus;
|
|
381
|
-
piiDetected: boolean;
|
|
382
|
-
learningEligible: boolean;
|
|
383
|
-
createdAt: string;
|
|
384
|
-
}
|
|
385
|
-
export interface AiWorkforceLearningSignal {
|
|
386
|
-
id: string;
|
|
387
|
-
tenantId: string;
|
|
388
|
-
signalType: AiWorkforceLearningSignalType;
|
|
389
|
-
sourceEventIds: string[];
|
|
390
|
-
employeeId?: string | null;
|
|
391
|
-
workflowId?: string | null;
|
|
392
|
-
affectedArtifactType?: AiWorkforceTargetArtifactType | null;
|
|
393
|
-
affectedArtifactId?: string | null;
|
|
394
|
-
title: string;
|
|
395
|
-
summary: string;
|
|
396
|
-
evidence: AiWorkforceJsonObject[];
|
|
397
|
-
confidence: number;
|
|
398
|
-
impactScore: number;
|
|
399
|
-
riskScore: number;
|
|
400
|
-
suggestedAction: string;
|
|
401
|
-
status: AiWorkforceLearningPipelineStatus;
|
|
402
|
-
createdAt: string;
|
|
403
|
-
updatedAt: string;
|
|
404
|
-
}
|
|
405
|
-
export interface AiWorkforceLearnedBehaviorPattern {
|
|
406
|
-
id: string;
|
|
407
|
-
tenantId: string;
|
|
408
|
-
patternType: AiWorkforceLearningSignalType;
|
|
409
|
-
title: string;
|
|
410
|
-
description: string;
|
|
411
|
-
derivedFromEventCount: number;
|
|
412
|
-
positiveExamples: string[];
|
|
413
|
-
negativeExamples: string[];
|
|
414
|
-
humanCorrectionExamples: string[];
|
|
415
|
-
applicableAgents: string[];
|
|
416
|
-
applicableWorkflows: string[];
|
|
417
|
-
suggestedPolicySnippet?: string | null;
|
|
418
|
-
suggestedTestCases: string[];
|
|
419
|
-
successMetrics: AiWorkforceJsonObject;
|
|
420
|
-
confidence: number;
|
|
421
|
-
status: AiWorkforceLearningPipelineStatus;
|
|
422
|
-
createdAt: string;
|
|
423
|
-
}
|
|
424
|
-
export interface AiWorkforceImprovementRecommendation {
|
|
425
|
-
id: string;
|
|
426
|
-
tenantId: string;
|
|
427
|
-
sourceType: AiWorkforceImprovementRecommendationSourceType;
|
|
428
|
-
sourceId: string;
|
|
429
|
-
targetArtifactType: AiWorkforceTargetArtifactType;
|
|
430
|
-
targetArtifactId?: string | null;
|
|
431
|
-
recommendationType: AiWorkforceImprovementRecommendationType;
|
|
432
|
-
title: string;
|
|
433
|
-
rationale: string;
|
|
434
|
-
/** Structured rationale metadata for i18n rendering — see the entity's
|
|
435
|
-
* `source_signal_type`/`source_event_count` column docs. `undefined` in
|
|
436
|
-
* shapes built before this field existed (e.g. some test fixtures). */
|
|
437
|
-
sourceSignalType?: AiWorkforceLearningSignalType | null;
|
|
438
|
-
sourceEventCount?: number | null;
|
|
439
|
-
evidence: AiWorkforceJsonObject[];
|
|
440
|
-
expectedImpact: AiWorkforceJsonObject;
|
|
441
|
-
riskAssessment: {
|
|
442
|
-
riskLevel: AiWorkforceRiskLevel;
|
|
443
|
-
reason: string;
|
|
444
|
-
riskScore: number;
|
|
445
|
-
};
|
|
446
|
-
proposedChange: AiWorkforceJsonObject;
|
|
447
|
-
generatedTests: string[];
|
|
448
|
-
simulationResult?: AiWorkforceJsonObject | null;
|
|
449
|
-
status: AiWorkforceLearningPipelineStatus;
|
|
450
|
-
createdAt: string;
|
|
451
|
-
updatedAt: string;
|
|
452
|
-
}
|
|
453
|
-
export interface AiWorkforceLearningArtifactCandidate {
|
|
454
|
-
id: string;
|
|
455
|
-
tenantId: string;
|
|
456
|
-
candidateType: AiWorkforceArtifactCandidateType;
|
|
457
|
-
generatedFrom: {
|
|
458
|
-
sourceType: 'learning_signal' | 'learned_pattern' | 'improvement_recommendation';
|
|
459
|
-
sourceId: string;
|
|
460
|
-
};
|
|
461
|
-
targetArtifactType: AiWorkforceTargetArtifactType;
|
|
462
|
-
targetArtifactId?: string | null;
|
|
463
|
-
draftPayload: AiWorkforceJsonObject;
|
|
464
|
-
testSuiteId?: string | null;
|
|
465
|
-
releaseGateStatus: AiWorkforceReleaseGateStatus;
|
|
466
|
-
approvalStatus: AiWorkforceApprovalStatus;
|
|
467
|
-
version: number;
|
|
468
|
-
createdAt: string;
|
|
469
|
-
updatedAt: string;
|
|
470
|
-
/** learning-content-generation-v1 (R3/R4) — LLM-generated draft content
|
|
471
|
-
* lifecycle. `contentStatus` defaults to `not_generated` for every
|
|
472
|
-
* candidate created before this phase (migration default). */
|
|
473
|
-
contentStatus?: AiWorkforceLearningContentStatus;
|
|
474
|
-
generatedContent?: AiWorkforceJsonObject | null;
|
|
475
|
-
contentEvidence?: AiWorkforceLearningContentEvidence | null;
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* learning-content-generation-v1 §5.5 — the `content_evidence` jsonb
|
|
479
|
-
* envelope stored alongside `generated_content`. `usedEvidenceSourceIds` is
|
|
480
|
-
* the audit trail proving every generated fact traces back to a real
|
|
481
|
-
* behavior-event/target-snapshot id; `missingEvidence` is populated only on
|
|
482
|
-
* the `insufficient_evidence` terminal (including the LLM's own honest
|
|
483
|
-
* `cannotGenerate` protocol response); `truncation` records whether the
|
|
484
|
-
* event-snapshot volume cap (design.md §5.1 step 6) was hit.
|
|
485
|
-
*/
|
|
486
|
-
export interface AiWorkforceLearningContentEvidence {
|
|
487
|
-
usedEvidenceSourceIds: string[];
|
|
488
|
-
missingEvidence?: string[];
|
|
489
|
-
modelRef?: string | null;
|
|
490
|
-
generatedAt: string;
|
|
491
|
-
truncation?: {
|
|
492
|
-
truncatedEventCount: number;
|
|
493
|
-
totalEventCount: number;
|
|
494
|
-
maxEvents: number;
|
|
495
|
-
maxBytesPerEvent: number;
|
|
496
|
-
} | null;
|
|
497
|
-
}
|
|
498
|
-
/** Mirrors `LearningGuardrailRuleCandidatePatch`
|
|
499
|
-
* (`guardrail/services/guardrail-learning-publication-owner.service.ts`).
|
|
500
|
-
* Guardrail is a v1 patch-only, update-only target — Phase 0 confirmed the
|
|
501
|
-
* pipeline never produces a real `targetArtifactId` for this type (see
|
|
502
|
-
* `AI_WORKFORCE_TARGET_ARTIFACT_CONTENT_POSTURE` doc comment); this contract
|
|
503
|
-
* still exists so the adapter/validator can honestly report "target
|
|
504
|
-
* missing" rather than silently skip the type. */
|
|
505
|
-
export interface LearningGuardrailRuleCandidatePatchContract {
|
|
506
|
-
name?: string | null;
|
|
507
|
-
description?: string | null;
|
|
508
|
-
isActive?: boolean | null;
|
|
509
|
-
priority?: number | null;
|
|
510
|
-
conditions?: Record<string, unknown> | null;
|
|
511
|
-
riskLevel?: AiWorkforceRiskLevel | null;
|
|
512
|
-
action?: Record<string, unknown> | null;
|
|
513
|
-
}
|
|
514
|
-
/** Mirrors `LearningKnowledgeSourceCandidatePatch`
|
|
515
|
-
* (`knowledge/services/knowledge-learning-publication-owner.service.ts`).
|
|
516
|
-
* `content` is required + non-empty (the owner service's
|
|
517
|
-
* `normalizeCandidateSourcePatch()` throws on empty/whitespace-only
|
|
518
|
-
* content) — this is the one patch-type contract where v1's real pipeline
|
|
519
|
-
* usually DOES have a real `targetArtifactId` (Phase 0 finding). */
|
|
520
|
-
export interface LearningKnowledgeSourceCandidatePatchContract {
|
|
521
|
-
title?: string | null;
|
|
522
|
-
content: string;
|
|
523
|
-
sourceType?: string | null;
|
|
524
|
-
sourceObject?: string | null;
|
|
525
|
-
accessLevel?: 'public' | 'private' | 'org_subtree' | null;
|
|
526
|
-
orgNodeId?: string | null;
|
|
527
|
-
metadata?: Record<string, unknown> | null;
|
|
528
|
-
}
|
|
529
|
-
/** Mirrors `LearningToolPermissionCandidateConfig`
|
|
530
|
-
* (`agent-permission/services/tool-permission-learning-publication-owner.service.ts`).
|
|
531
|
-
* `allowedTools`/`blockedTools` are both required arrays; every tool name
|
|
532
|
-
* must match `STABLE_TOOL_NAME` (`/^[A-Za-z0-9:._/-]+$/`, exported below as
|
|
533
|
-
* {@link AI_WORKFORCE_STABLE_TOOL_NAME_PATTERN}) and a name may not appear
|
|
534
|
-
* in both arrays. Phase 0: 100% target-missing in the real v1 pipeline. */
|
|
535
|
-
export interface LearningToolPermissionCandidateConfigContract {
|
|
536
|
-
allowedTools: string[];
|
|
537
|
-
blockedTools: string[];
|
|
538
|
-
maxQueriesPerMinute?: number | null;
|
|
539
|
-
maxWritesPerMinute?: number | null;
|
|
540
|
-
maxBatchSize?: number | null;
|
|
541
|
-
}
|
|
542
|
-
/** Regex the tool-permission owner service enforces on every entry of
|
|
543
|
-
* `allowedTools`/`blockedTools` (`STABLE_TOOL_NAME` in
|
|
544
|
-
* `tool-permission-learning-publication-owner.service.ts`). Exported so the
|
|
545
|
-
* shared validator and any front-end input validation use the exact same
|
|
546
|
-
* pattern rather than a hand-copied approximation. */
|
|
547
|
-
export declare const AI_WORKFORCE_STABLE_TOOL_NAME_PATTERN: RegExp;
|
|
548
|
-
/** Mirrors `LearningApprovalPolicyCandidatePatch`
|
|
549
|
-
* (`approval/services/approval-policy-learning-publication-owner.service.ts`).
|
|
550
|
-
* `steps`, when provided, must be a non-empty array of objects each carrying
|
|
551
|
-
* a stable `id`/`name`/`approverType`/`approverName` (owner service's
|
|
552
|
-
* `normalizeSteps()`). Phase 0: 100% target-missing in the real v1
|
|
553
|
-
* pipeline. */
|
|
554
|
-
export interface LearningApprovalPolicyCandidatePatchContract {
|
|
555
|
-
name?: string | null;
|
|
556
|
-
description?: string | null;
|
|
557
|
-
entryCondition?: string | null;
|
|
558
|
-
steps?: Array<{
|
|
559
|
-
id: string;
|
|
560
|
-
name: string;
|
|
561
|
-
approverType: string;
|
|
562
|
-
approverName: string;
|
|
563
|
-
[key: string]: unknown;
|
|
564
|
-
}> | null;
|
|
565
|
-
riskAssessmentConfig?: Record<string, unknown> | null;
|
|
566
|
-
finalApprovalAction?: string | null;
|
|
567
|
-
finalRejectionAction?: string | null;
|
|
568
|
-
}
|
|
569
|
-
/** Mirrors `LearningEmployeeTemplateCandidatePatch`
|
|
570
|
-
* (`agent-builder/employee-template-learning-publication-owner.service.ts`).
|
|
571
|
-
* All 5 fields are required by the owner service's
|
|
572
|
-
* `normalizeCandidateTemplate()`. `templateKey` and `blueprint` are
|
|
573
|
-
* "constructed fields" (design.md §5.2) — the LLM never outputs
|
|
574
|
-
* `templateKey` directly (the generator service slugifies it from
|
|
575
|
-
* `roleName`), and only fills the semantic portion of `blueprint`; the rest
|
|
576
|
-
* of this contract (`title`/`roleName`/`mission`) IS real LLM output,
|
|
577
|
-
* subject to the evidence-closure prompt rules like every other patch
|
|
578
|
-
* type. */
|
|
579
|
-
export interface LearningEmployeeTemplateCandidatePatchContract {
|
|
580
|
-
templateKey: string;
|
|
581
|
-
title: string;
|
|
582
|
-
roleName: string;
|
|
583
|
-
mission: string;
|
|
584
|
-
blueprint: Record<string, unknown>;
|
|
585
|
-
}
|
|
586
|
-
/** Regex the employee-template owner service enforces on `templateKey`
|
|
587
|
-
* (`TEMPLATE_KEY` in `employee-template-learning-publication-owner.service.ts`).
|
|
588
|
-
* Exported so the generator's slugify step and the shared validator use the
|
|
589
|
-
* exact same pattern. */
|
|
590
|
-
export declare const AI_WORKFORCE_TEMPLATE_KEY_PATTERN: RegExp;
|
|
591
|
-
/** Mirrors `LearningSopDocumentCandidatePatch`
|
|
592
|
-
* (`knowledge-distillation/sop-generator/sop-learning-publication-owner.service.ts`).
|
|
593
|
-
* All fields optional (owner service's `normalizeCandidateDocumentPatch()`
|
|
594
|
-
* only requires at least one field to be set). Phase 0: 100% target-missing
|
|
595
|
-
* in the real v1 pipeline (`sop_drift` signals carry no id field at all). */
|
|
596
|
-
export interface LearningSopDocumentCandidatePatchContract {
|
|
597
|
-
title?: string | null;
|
|
598
|
-
category?: string | null;
|
|
599
|
-
applicableObjects?: string[] | null;
|
|
600
|
-
steps?: Record<string, unknown>[] | null;
|
|
601
|
-
}
|
|
602
|
-
/** A single flow node in a drafted `workflow` definition. Deliberately a
|
|
603
|
-
* looser structural shape than the backend's full `FlowNode`/`FlowNodeType`
|
|
604
|
-
* union (`packages/backend/.../workflow-version/types/flow-definition.types.ts`)
|
|
605
|
-
* — `FlowService.saveVersion()` is the real, authoritative validator
|
|
606
|
-
* (`validateGraph()`) and already runs on whatever this contract's `data`
|
|
607
|
-
* decodes to; this shared contract only needs to be strict enough to catch
|
|
608
|
-
* an LLM output that isn't even shaped like a node before it's ever handed
|
|
609
|
-
* to `saveVersion()`. `type` intentionally accepts any non-empty string
|
|
610
|
-
* (not a closed enum) so this contract never has to be kept in lockstep
|
|
611
|
-
* with the backend's node-type list — `saveVersion()` rejects unknown types
|
|
612
|
-
* on its own. */
|
|
613
|
-
export interface LearningWorkflowDraftNodeContract {
|
|
614
|
-
id: string;
|
|
615
|
-
type: string;
|
|
616
|
-
name: string;
|
|
617
|
-
position?: {
|
|
618
|
-
x: number;
|
|
619
|
-
y: number;
|
|
620
|
-
} | null;
|
|
621
|
-
settings: Record<string, unknown>;
|
|
622
|
-
}
|
|
623
|
-
export interface LearningWorkflowDraftEdgeContract {
|
|
624
|
-
id: string;
|
|
625
|
-
source: string;
|
|
626
|
-
target: string;
|
|
627
|
-
sourceHandle?: string | null;
|
|
628
|
-
targetHandle?: string | null;
|
|
629
|
-
label?: string | null;
|
|
630
|
-
}
|
|
631
|
-
/** Mirrors `FlowVersionDefinition`
|
|
632
|
-
* (`workflow-version/types/flow-definition.types.ts`) — the exact shape
|
|
633
|
-
* `FlowService.saveVersion(versionId, definition, ...)` accepts as its
|
|
634
|
-
* `definition` argument. Only the `update_workflow` scenario is in v1 scope
|
|
635
|
-
* (requirements.md R5.3 — `create_workflow`'s trigger hint is confirmed
|
|
636
|
-
* dead code); this contract still models `trigger` since `saveVersion()`
|
|
637
|
-
* accepts and persists it regardless of which recommendation type produced
|
|
638
|
-
* the candidate. */
|
|
639
|
-
export interface LearningWorkflowDraftDefinitionContract {
|
|
640
|
-
version: string;
|
|
641
|
-
nodes: LearningWorkflowDraftNodeContract[];
|
|
642
|
-
edges: LearningWorkflowDraftEdgeContract[];
|
|
643
|
-
trigger?: Record<string, unknown> | null;
|
|
644
|
-
}
|
|
645
|
-
/** Mirrors `CreatePromptStrategyInput`
|
|
646
|
-
* (`ai-service/prompt-strategy.service.ts`) — the exact shape
|
|
647
|
-
* `PromptStrategyService.create(data)` accepts, minus `workspaceId` (always
|
|
648
|
-
* supplied by the generator from the caller's context, never from LLM
|
|
649
|
-
* output, same rule as every other type in this file). `create()` hardcodes
|
|
650
|
-
* `isActive: false`, so this contract's fields never influence activation
|
|
651
|
-
* state — activation only ever happens later via
|
|
652
|
-
* `PromptStrategyService.activate()`, called exclusively by
|
|
653
|
-
* `PromptPolicyLearningPublicationOwnerService` during real publication. */
|
|
654
|
-
export interface LearningPromptPolicyDraftContentContract {
|
|
655
|
-
name: string;
|
|
656
|
-
description?: string | null;
|
|
657
|
-
industry?: string | null;
|
|
658
|
-
templateOverrides?: Record<string, unknown> | null;
|
|
659
|
-
}
|
|
660
|
-
export declare const AI_WORKFORCE_LEARNING_STATUS_TRANSITIONS: Readonly<Record<AiWorkforceLearningPipelineStatus, readonly AiWorkforceLearningPipelineStatus[]>>;
|
|
661
|
-
export declare function canTransitionAiWorkforceLearningStatus(from: AiWorkforceLearningPipelineStatus, to: AiWorkforceLearningPipelineStatus): boolean;
|
|
662
|
-
export declare function getAiWorkforceLearningReadinessIssues(event: Pick<AiWorkforceBehaviorEvent, 'learningEligible' | 'redactionStatus'>): string[];
|
|
663
|
-
export declare function isAiWorkforceBehaviorEventLearningReady(event: Pick<AiWorkforceBehaviorEvent, 'learningEligible' | 'redactionStatus'>): boolean;
|
|
664
|
-
export declare function createRedactedAiWorkforceBehaviorEventSample(overrides?: Partial<AiWorkforceBehaviorEvent>): AiWorkforceBehaviorEvent;
|
|
665
|
-
export type LearningContentValidationResult<T> = {
|
|
666
|
-
valid: true;
|
|
667
|
-
data: T;
|
|
668
|
-
} | {
|
|
669
|
-
valid: false;
|
|
670
|
-
errors: string[];
|
|
671
|
-
};
|
|
672
|
-
export declare function validateLearningGuardrailRuleCandidatePatch(raw: unknown): LearningContentValidationResult<LearningGuardrailRuleCandidatePatchContract>;
|
|
673
|
-
export declare function validateLearningKnowledgeSourceCandidatePatch(raw: unknown): LearningContentValidationResult<LearningKnowledgeSourceCandidatePatchContract>;
|
|
674
|
-
export declare function validateLearningToolPermissionCandidateConfig(raw: unknown): LearningContentValidationResult<LearningToolPermissionCandidateConfigContract>;
|
|
675
|
-
export declare function validateLearningApprovalPolicyCandidatePatch(raw: unknown): LearningContentValidationResult<LearningApprovalPolicyCandidatePatchContract>;
|
|
676
|
-
export declare function validateLearningEmployeeTemplateCandidatePatch(raw: unknown): LearningContentValidationResult<LearningEmployeeTemplateCandidatePatchContract>;
|
|
677
|
-
export declare function validateLearningSopDocumentCandidatePatch(raw: unknown): LearningContentValidationResult<LearningSopDocumentCandidatePatchContract>;
|
|
678
|
-
export declare function validateLearningWorkflowDraftDefinition(raw: unknown): LearningContentValidationResult<LearningWorkflowDraftDefinitionContract>;
|
|
679
|
-
export declare function validateLearningPromptPolicyDraftContent(raw: unknown): LearningContentValidationResult<LearningPromptPolicyDraftContentContract>;
|
|
680
|
-
/** v1 whitelist subset of `OrgAIProviderModelPolicy`
|
|
681
|
-
* (`org-ai-provider-policy.entity.ts:43-50`) — only the two mapping fields
|
|
682
|
-
* a learning-generated candidate patch may set (requirements.md R1, Q2
|
|
683
|
-
* signed: "不扩展,仅 modelPolicy 两个映射字段"). */
|
|
684
|
-
export interface LearningModelRoutingCandidatePatchContract {
|
|
685
|
-
modelPolicy: {
|
|
686
|
-
defaultModelByCapability?: Record<string, string>;
|
|
687
|
-
defaultModelByScenario?: Record<string, string>;
|
|
688
|
-
};
|
|
689
|
-
}
|
|
690
|
-
/** Convenience alias matching the exact name requirements.md R1 / tasks.md
|
|
691
|
-
* Phase 1 use ("新增 `LearningModelRoutingCandidatePatch` +
|
|
692
|
-
* `validateLearningModelRoutingCandidatePatch()`") — same type as
|
|
693
|
-
* {@link LearningModelRoutingCandidatePatchContract}, which follows this
|
|
694
|
-
* file's established `*Contract` naming convention for every other
|
|
695
|
-
* patch-type contract above. */
|
|
696
|
-
export type LearningModelRoutingCandidatePatch = LearningModelRoutingCandidatePatchContract;
|
|
697
|
-
/**
|
|
698
|
-
* mirrors the v1 whitelist described in the block comment above — takes the
|
|
699
|
-
* LLM's raw (already `JSON.parse`d) candidate patch and either narrows it
|
|
700
|
-
* to exactly `{ modelPolicy: { defaultModelByCapability?, defaultModelByScenario? } }`
|
|
701
|
-
* or reports every whitelist violation / shape error found. Never throws
|
|
702
|
-
* (same discriminated-union contract as every other validator in this
|
|
703
|
-
* file).
|
|
704
|
-
*/
|
|
705
|
-
export declare function validateLearningModelRoutingCandidatePatch(raw: unknown): LearningContentValidationResult<LearningModelRoutingCandidatePatchContract>;
|
|
706
|
-
export interface LearningPromptTemplateCandidatePatchContract {
|
|
707
|
-
template: string;
|
|
708
|
-
}
|
|
709
|
-
/** Convenience alias matching requirements.md R2 / tasks.md Phase 1 naming
|
|
710
|
-
* (`LearningPromptTemplateCandidatePatch`), same convention as
|
|
711
|
-
* {@link LearningModelRoutingCandidatePatch} above. */
|
|
712
|
-
export type LearningPromptTemplateCandidatePatch = LearningPromptTemplateCandidatePatchContract;
|
|
713
|
-
/**
|
|
714
|
-
* Body-only whitelist validator — narrows the LLM's raw (already
|
|
715
|
-
* `JSON.parse`d) output to exactly `{ template: string }` or reports every
|
|
716
|
-
* whitelist violation / shape error found. Never throws (same
|
|
717
|
-
* discriminated-union contract as every other validator in this file).
|
|
718
|
-
* The body is intentionally NOT trimmed — leading/trailing whitespace can
|
|
719
|
-
* be meaningful in a prompt template; only the "effectively empty" check
|
|
720
|
-
* uses a trimmed view.
|
|
721
|
-
*/
|
|
722
|
-
export declare function validateLearningPromptTemplateCandidatePatch(raw: unknown): LearningContentValidationResult<LearningPromptTemplateCandidatePatchContract>;
|
|
723
|
-
export interface LearningAgentCandidatePatchContract {
|
|
724
|
-
persona?: string;
|
|
725
|
-
systemInstructions?: string;
|
|
726
|
-
identityPolicy?: string;
|
|
727
|
-
}
|
|
728
|
-
/** Convenience alias matching requirements.md R2 / tasks.md Phase 1 naming
|
|
729
|
-
* (`LearningAgentCandidatePatch`), same convention as
|
|
730
|
-
* {@link LearningPromptTemplateCandidatePatch} above. */
|
|
731
|
-
export type LearningAgentCandidatePatch = LearningAgentCandidatePatchContract;
|
|
732
|
-
/**
|
|
733
|
-
* Three-field whitelist validator — narrows the LLM's raw (already
|
|
734
|
-
* `JSON.parse`d) output to a subset of `{ persona?, systemInstructions?,
|
|
735
|
-
* identityPolicy? }` (each, when present, a non-empty string) or reports
|
|
736
|
-
* every whitelist violation / shape error found. Never throws (same
|
|
737
|
-
* discriminated-union contract as every other validator in this file).
|
|
738
|
-
* Bodies are intentionally NOT trimmed for the same reason
|
|
739
|
-
* `validateLearningPromptTemplateCandidatePatch` does not trim `template` —
|
|
740
|
-
* leading/trailing whitespace can be meaningful in prompt-adjacent text;
|
|
741
|
-
* only the "effectively empty" check uses a trimmed view.
|
|
742
|
-
*/
|
|
743
|
-
export declare function validateLearningAgentCandidatePatch(raw: unknown): LearningContentValidationResult<LearningAgentCandidatePatchContract>;
|