@taxdao/fintax-mcp 0.2.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/README.md +220 -0
- package/dist/app/create-server.d.ts +18 -0
- package/dist/app/create-server.js +80 -0
- package/dist/app/create-server.js.map +1 -0
- package/dist/app/register-tools.d.ts +4 -0
- package/dist/app/register-tools.js +18 -0
- package/dist/app/register-tools.js.map +1 -0
- package/dist/audit/audit-context.d.ts +38 -0
- package/dist/audit/audit-context.js +167 -0
- package/dist/audit/audit-context.js.map +1 -0
- package/dist/audit/audit-sink.d.ts +20 -0
- package/dist/audit/audit-sink.js +6 -0
- package/dist/audit/audit-sink.js.map +1 -0
- package/dist/audit/file-audit-sink.d.ts +6 -0
- package/dist/audit/file-audit-sink.js +18 -0
- package/dist/audit/file-audit-sink.js.map +1 -0
- package/dist/auth/auth-session.d.ts +63 -0
- package/dist/auth/auth-session.js +226 -0
- package/dist/auth/auth-session.js.map +1 -0
- package/dist/auth/credentials.d.ts +6 -0
- package/dist/auth/credentials.js +12 -0
- package/dist/auth/credentials.js.map +1 -0
- package/dist/auth/org-token-provider.d.ts +15 -0
- package/dist/auth/org-token-provider.js +62 -0
- package/dist/auth/org-token-provider.js.map +1 -0
- package/dist/capabilities/capability.d.ts +100 -0
- package/dist/capabilities/capability.js +26 -0
- package/dist/capabilities/capability.js.map +1 -0
- package/dist/capabilities/create-capabilities.d.ts +2 -0
- package/dist/capabilities/create-capabilities.js +37 -0
- package/dist/capabilities/create-capabilities.js.map +1 -0
- package/dist/capabilities/define-capability.d.ts +39 -0
- package/dist/capabilities/define-capability.js +64 -0
- package/dist/capabilities/define-capability.js.map +1 -0
- package/dist/capabilities/definitions/accounting-balances.d.ts +4 -0
- package/dist/capabilities/definitions/accounting-balances.js +98 -0
- package/dist/capabilities/definitions/accounting-balances.js.map +1 -0
- package/dist/capabilities/definitions/accounting-context.d.ts +2 -0
- package/dist/capabilities/definitions/accounting-context.js +17 -0
- package/dist/capabilities/definitions/accounting-context.js.map +1 -0
- package/dist/capabilities/definitions/assets.d.ts +2 -0
- package/dist/capabilities/definitions/assets.js +367 -0
- package/dist/capabilities/definitions/assets.js.map +1 -0
- package/dist/capabilities/definitions/business-documents.d.ts +9 -0
- package/dist/capabilities/definitions/business-documents.js +386 -0
- package/dist/capabilities/definitions/business-documents.js.map +1 -0
- package/dist/capabilities/definitions/dashboard.d.ts +2 -0
- package/dist/capabilities/definitions/dashboard.js +153 -0
- package/dist/capabilities/definitions/dashboard.js.map +1 -0
- package/dist/capabilities/definitions/extended-operation-contracts.d.ts +597 -0
- package/dist/capabilities/definitions/extended-operation-contracts.js +1180 -0
- package/dist/capabilities/definitions/extended-operation-contracts.js.map +1 -0
- package/dist/capabilities/definitions/extended-operations.d.ts +2 -0
- package/dist/capabilities/definitions/extended-operations.js +699 -0
- package/dist/capabilities/definitions/extended-operations.js.map +1 -0
- package/dist/capabilities/definitions/financial-reports.d.ts +2 -0
- package/dist/capabilities/definitions/financial-reports.js +100 -0
- package/dist/capabilities/definitions/financial-reports.js.map +1 -0
- package/dist/capabilities/definitions/fnd-import.d.ts +34 -0
- package/dist/capabilities/definitions/fnd-import.js +282 -0
- package/dist/capabilities/definitions/fnd-import.js.map +1 -0
- package/dist/capabilities/definitions/fund-accounts.d.ts +2 -0
- package/dist/capabilities/definitions/fund-accounts.js +188 -0
- package/dist/capabilities/definitions/fund-accounts.js.map +1 -0
- package/dist/capabilities/definitions/fund-balances.d.ts +2 -0
- package/dist/capabilities/definitions/fund-balances.js +84 -0
- package/dist/capabilities/definitions/fund-balances.js.map +1 -0
- package/dist/capabilities/definitions/journals.d.ts +10 -0
- package/dist/capabilities/definitions/journals.js +224 -0
- package/dist/capabilities/definitions/journals.js.map +1 -0
- package/dist/capabilities/definitions/master-data.d.ts +2 -0
- package/dist/capabilities/definitions/master-data.js +451 -0
- package/dist/capabilities/definitions/master-data.js.map +1 -0
- package/dist/capabilities/definitions/pnl.d.ts +2 -0
- package/dist/capabilities/definitions/pnl.js +139 -0
- package/dist/capabilities/definitions/pnl.js.map +1 -0
- package/dist/capabilities/definitions/reference-data.d.ts +2 -0
- package/dist/capabilities/definitions/reference-data.js +169 -0
- package/dist/capabilities/definitions/reference-data.js.map +1 -0
- package/dist/capabilities/definitions/transaction-drafts.d.ts +2 -0
- package/dist/capabilities/definitions/transaction-drafts.js +157 -0
- package/dist/capabilities/definitions/transaction-drafts.js.map +1 -0
- package/dist/capabilities/definitions/transactions.d.ts +168 -0
- package/dist/capabilities/definitions/transactions.js +79 -0
- package/dist/capabilities/definitions/transactions.js.map +1 -0
- package/dist/capabilities/executor.d.ts +19 -0
- package/dist/capabilities/executor.js +134 -0
- package/dist/capabilities/executor.js.map +1 -0
- package/dist/capabilities/registry.d.ts +7 -0
- package/dist/capabilities/registry.js +51 -0
- package/dist/capabilities/registry.js.map +1 -0
- package/dist/clients/base-client.d.ts +5 -0
- package/dist/clients/base-client.js +13 -0
- package/dist/clients/base-client.js.map +1 -0
- package/dist/clients/http-client.d.ts +29 -0
- package/dist/clients/http-client.js +167 -0
- package/dist/clients/http-client.js.map +1 -0
- package/dist/clients/suite-client.d.ts +5 -0
- package/dist/clients/suite-client.js +5 -0
- package/dist/clients/suite-client.js.map +1 -0
- package/dist/concurrency/lock-manager.d.ts +4 -0
- package/dist/concurrency/lock-manager.js +23 -0
- package/dist/concurrency/lock-manager.js.map +1 -0
- package/dist/config/load-config.d.ts +2 -0
- package/dist/config/load-config.js +18 -0
- package/dist/config/load-config.js.map +1 -0
- package/dist/config/schema.d.ts +24 -0
- package/dist/config/schema.js +85 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/errors/fintax-error.d.ts +24 -0
- package/dist/errors/fintax-error.js +21 -0
- package/dist/errors/fintax-error.js.map +1 -0
- package/dist/errors/normalize-error.d.ts +3 -0
- package/dist/errors/normalize-error.js +67 -0
- package/dist/errors/normalize-error.js.map +1 -0
- package/dist/files/artifact-store.d.ts +17 -0
- package/dist/files/artifact-store.js +74 -0
- package/dist/files/artifact-store.js.map +1 -0
- package/dist/files/input-policy.d.ts +28 -0
- package/dist/files/input-policy.js +109 -0
- package/dist/files/input-policy.js.map +1 -0
- package/dist/files/roots-provider.d.ts +14 -0
- package/dist/files/roots-provider.js +47 -0
- package/dist/files/roots-provider.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/logger.d.ts +3 -0
- package/dist/logging/logger.js +13 -0
- package/dist/logging/logger.js.map +1 -0
- package/dist/policies/idempotency.d.ts +32 -0
- package/dist/policies/idempotency.js +155 -0
- package/dist/policies/idempotency.js.map +1 -0
- package/dist/policies/job-reference.d.ts +16 -0
- package/dist/policies/job-reference.js +62 -0
- package/dist/policies/job-reference.js.map +1 -0
- package/dist/policies/operation-plan.d.ts +27 -0
- package/dist/policies/operation-plan.js +99 -0
- package/dist/policies/operation-plan.js.map +1 -0
- package/dist/policies/redaction.d.ts +2 -0
- package/dist/policies/redaction.js +29 -0
- package/dist/policies/redaction.js.map +1 -0
- package/dist/policies/retry.d.ts +8 -0
- package/dist/policies/retry.js +19 -0
- package/dist/policies/retry.js.map +1 -0
- package/dist/responses/tool-response.d.ts +4 -0
- package/dist/responses/tool-response.js +24 -0
- package/dist/responses/tool-response.js.map +1 -0
- package/dist/schemas/common.d.ts +226 -0
- package/dist/schemas/common.js +133 -0
- package/dist/schemas/common.js.map +1 -0
- package/dist/schemas/domains/accounting-balances.d.ts +497 -0
- package/dist/schemas/domains/accounting-balances.js +226 -0
- package/dist/schemas/domains/accounting-balances.js.map +1 -0
- package/dist/schemas/domains/accounting-context.d.ts +118 -0
- package/dist/schemas/domains/accounting-context.js +54 -0
- package/dist/schemas/domains/accounting-context.js.map +1 -0
- package/dist/schemas/domains/assets.d.ts +2508 -0
- package/dist/schemas/domains/assets.js +960 -0
- package/dist/schemas/domains/assets.js.map +1 -0
- package/dist/schemas/domains/business-documents.d.ts +4406 -0
- package/dist/schemas/domains/business-documents.js +1153 -0
- package/dist/schemas/domains/business-documents.js.map +1 -0
- package/dist/schemas/domains/configuration.d.ts +518 -0
- package/dist/schemas/domains/configuration.js +504 -0
- package/dist/schemas/domains/configuration.js.map +1 -0
- package/dist/schemas/domains/dashboard.d.ts +339 -0
- package/dist/schemas/domains/dashboard.js +211 -0
- package/dist/schemas/domains/dashboard.js.map +1 -0
- package/dist/schemas/domains/extended-operation-results.d.ts +1588 -0
- package/dist/schemas/domains/extended-operation-results.js +275 -0
- package/dist/schemas/domains/extended-operation-results.js.map +1 -0
- package/dist/schemas/domains/extended-operations.d.ts +1061 -0
- package/dist/schemas/domains/extended-operations.js +567 -0
- package/dist/schemas/domains/extended-operations.js.map +1 -0
- package/dist/schemas/domains/extended-query-results.d.ts +1688 -0
- package/dist/schemas/domains/extended-query-results.js +337 -0
- package/dist/schemas/domains/extended-query-results.js.map +1 -0
- package/dist/schemas/domains/financial-reports.d.ts +540 -0
- package/dist/schemas/domains/financial-reports.js +206 -0
- package/dist/schemas/domains/financial-reports.js.map +1 -0
- package/dist/schemas/domains/fnd-import.d.ts +912 -0
- package/dist/schemas/domains/fnd-import.js +396 -0
- package/dist/schemas/domains/fnd-import.js.map +1 -0
- package/dist/schemas/domains/fund-accounts.d.ts +1092 -0
- package/dist/schemas/domains/fund-accounts.js +410 -0
- package/dist/schemas/domains/fund-accounts.js.map +1 -0
- package/dist/schemas/domains/fund-balances.d.ts +476 -0
- package/dist/schemas/domains/fund-balances.js +233 -0
- package/dist/schemas/domains/fund-balances.js.map +1 -0
- package/dist/schemas/domains/journals.d.ts +1619 -0
- package/dist/schemas/domains/journals.js +615 -0
- package/dist/schemas/domains/journals.js.map +1 -0
- package/dist/schemas/domains/master-data.d.ts +2010 -0
- package/dist/schemas/domains/master-data.js +799 -0
- package/dist/schemas/domains/master-data.js.map +1 -0
- package/dist/schemas/domains/pnl.d.ts +837 -0
- package/dist/schemas/domains/pnl.js +469 -0
- package/dist/schemas/domains/pnl.js.map +1 -0
- package/dist/schemas/domains/reference-data.d.ts +227 -0
- package/dist/schemas/domains/reference-data.js +144 -0
- package/dist/schemas/domains/reference-data.js.map +1 -0
- package/dist/schemas/domains/transaction-drafts.d.ts +903 -0
- package/dist/schemas/domains/transaction-drafts.js +242 -0
- package/dist/schemas/domains/transaction-drafts.js.map +1 -0
- package/dist/schemas/domains/transactions.d.ts +910 -0
- package/dist/schemas/domains/transactions.js +266 -0
- package/dist/schemas/domains/transactions.js.map +1 -0
- package/dist/schemas/primitives.d.ts +6 -0
- package/dist/schemas/primitives.js +11 -0
- package/dist/schemas/primitives.js.map +1 -0
- package/dist/schemas/public-input.d.ts +3 -0
- package/dist/schemas/public-input.js +524 -0
- package/dist/schemas/public-input.js.map +1 -0
- package/dist/tools/core-edit/idempotent-write.d.ts +23 -0
- package/dist/tools/core-edit/idempotent-write.js +58 -0
- package/dist/tools/core-edit/idempotent-write.js.map +1 -0
- package/dist/tools/core-edit/save-asset.d.ts +5 -0
- package/dist/tools/core-edit/save-asset.js +334 -0
- package/dist/tools/core-edit/save-asset.js.map +1 -0
- package/dist/tools/core-edit/save-business-document-draft.d.ts +2 -0
- package/dist/tools/core-edit/save-business-document-draft.js +128 -0
- package/dist/tools/core-edit/save-business-document-draft.js.map +1 -0
- package/dist/tools/core-edit/save-fund-account.d.ts +2 -0
- package/dist/tools/core-edit/save-fund-account.js +138 -0
- package/dist/tools/core-edit/save-fund-account.js.map +1 -0
- package/dist/tools/core-edit/save-journal-draft.d.ts +2 -0
- package/dist/tools/core-edit/save-journal-draft.js +122 -0
- package/dist/tools/core-edit/save-journal-draft.js.map +1 -0
- package/dist/tools/core-edit/save-master-data.d.ts +2 -0
- package/dist/tools/core-edit/save-master-data.js +153 -0
- package/dist/tools/core-edit/save-master-data.js.map +1 -0
- package/dist/tools/core-edit/save-transaction-draft.d.ts +2 -0
- package/dist/tools/core-edit/save-transaction-draft.js +128 -0
- package/dist/tools/core-edit/save-transaction-draft.js.map +1 -0
- package/dist/tools/core-read/export-business-documents.d.ts +2 -0
- package/dist/tools/core-read/export-business-documents.js +67 -0
- package/dist/tools/core-read/export-business-documents.js.map +1 -0
- package/dist/tools/core-read/export-journals.d.ts +2 -0
- package/dist/tools/core-read/export-journals.js +56 -0
- package/dist/tools/core-read/export-journals.js.map +1 -0
- package/dist/tools/core-read/export-transactions.d.ts +2 -0
- package/dist/tools/core-read/export-transactions.js +67 -0
- package/dist/tools/core-read/export-transactions.js.map +1 -0
- package/dist/tools/core-read/query-accounting-balances.d.ts +2 -0
- package/dist/tools/core-read/query-accounting-balances.js +135 -0
- package/dist/tools/core-read/query-accounting-balances.js.map +1 -0
- package/dist/tools/core-read/query-accounting-context.d.ts +2 -0
- package/dist/tools/core-read/query-accounting-context.js +76 -0
- package/dist/tools/core-read/query-accounting-context.js.map +1 -0
- package/dist/tools/core-read/query-assets.d.ts +2 -0
- package/dist/tools/core-read/query-assets.js +425 -0
- package/dist/tools/core-read/query-assets.js.map +1 -0
- package/dist/tools/core-read/query-business-documents.d.ts +9 -0
- package/dist/tools/core-read/query-business-documents.js +620 -0
- package/dist/tools/core-read/query-business-documents.js.map +1 -0
- package/dist/tools/core-read/query-dashboard.d.ts +2 -0
- package/dist/tools/core-read/query-dashboard.js +144 -0
- package/dist/tools/core-read/query-dashboard.js.map +1 -0
- package/dist/tools/core-read/query-financial-reports.d.ts +2 -0
- package/dist/tools/core-read/query-financial-reports.js +171 -0
- package/dist/tools/core-read/query-financial-reports.js.map +1 -0
- package/dist/tools/core-read/query-fund-accounts.d.ts +2 -0
- package/dist/tools/core-read/query-fund-accounts.js +140 -0
- package/dist/tools/core-read/query-fund-accounts.js.map +1 -0
- package/dist/tools/core-read/query-fund-balances.d.ts +2 -0
- package/dist/tools/core-read/query-fund-balances.js +150 -0
- package/dist/tools/core-read/query-fund-balances.js.map +1 -0
- package/dist/tools/core-read/query-journals.d.ts +2 -0
- package/dist/tools/core-read/query-journals.js +277 -0
- package/dist/tools/core-read/query-journals.js.map +1 -0
- package/dist/tools/core-read/query-master-data.d.ts +2 -0
- package/dist/tools/core-read/query-master-data.js +363 -0
- package/dist/tools/core-read/query-master-data.js.map +1 -0
- package/dist/tools/core-read/query-pnl.d.ts +2 -0
- package/dist/tools/core-read/query-pnl.js +244 -0
- package/dist/tools/core-read/query-pnl.js.map +1 -0
- package/dist/tools/core-read/query-reference-data.d.ts +2 -0
- package/dist/tools/core-read/query-reference-data.js +293 -0
- package/dist/tools/core-read/query-reference-data.js.map +1 -0
- package/dist/tools/core-read/query-transactions.d.ts +2 -0
- package/dist/tools/core-read/query-transactions.js +58 -0
- package/dist/tools/core-read/query-transactions.js.map +1 -0
- package/dist/tools/create-tools.d.ts +3 -0
- package/dist/tools/create-tools.js +88 -0
- package/dist/tools/create-tools.js.map +1 -0
- package/dist/tools/extended/asset-operation-tools.d.ts +9 -0
- package/dist/tools/extended/asset-operation-tools.js +419 -0
- package/dist/tools/extended/asset-operation-tools.js.map +1 -0
- package/dist/tools/extended/automation-tools.d.ts +7 -0
- package/dist/tools/extended/automation-tools.js +333 -0
- package/dist/tools/extended/automation-tools.js.map +1 -0
- package/dist/tools/extended/configuration-tools.d.ts +14 -0
- package/dist/tools/extended/configuration-tools.js +871 -0
- package/dist/tools/extended/configuration-tools.js.map +1 -0
- package/dist/tools/extended/period-end-tools.d.ts +11 -0
- package/dist/tools/extended/period-end-tools.js +480 -0
- package/dist/tools/extended/period-end-tools.js.map +1 -0
- package/dist/tools/extended/query-output.d.ts +2589 -0
- package/dist/tools/extended/query-output.js +610 -0
- package/dist/tools/extended/query-output.js.map +1 -0
- package/dist/tools/extended/tool-support.d.ts +56 -0
- package/dist/tools/extended/tool-support.js +198 -0
- package/dist/tools/extended/tool-support.js.map +1 -0
- package/dist/tools/extended/workflow-tools.d.ts +10 -0
- package/dist/tools/extended/workflow-tools.js +678 -0
- package/dist/tools/extended/workflow-tools.js.map +1 -0
- package/dist/tools/fnd-import/execute-import.d.ts +2 -0
- package/dist/tools/fnd-import/execute-import.js +201 -0
- package/dist/tools/fnd-import/execute-import.js.map +1 -0
- package/dist/tools/fnd-import/get-import-template.d.ts +2 -0
- package/dist/tools/fnd-import/get-import-template.js +66 -0
- package/dist/tools/fnd-import/get-import-template.js.map +1 -0
- package/dist/tools/fnd-import/get-job-status.d.ts +8 -0
- package/dist/tools/fnd-import/get-job-status.js +201 -0
- package/dist/tools/fnd-import/get-job-status.js.map +1 -0
- package/dist/tools/fnd-import/prepare-import.d.ts +31 -0
- package/dist/tools/fnd-import/prepare-import.js +214 -0
- package/dist/tools/fnd-import/prepare-import.js.map +1 -0
- package/dist/tools/fnd-import/public-import-result.d.ts +18 -0
- package/dist/tools/fnd-import/public-import-result.js +35 -0
- package/dist/tools/fnd-import/public-import-result.js.map +1 -0
- package/dist/tools/tool-definition.d.ts +45 -0
- package/dist/tools/tool-definition.js +11 -0
- package/dist/tools/tool-definition.js.map +1 -0
- package/dist/tools/tool-handler.d.ts +27 -0
- package/dist/tools/tool-handler.js +196 -0
- package/dist/tools/tool-handler.js.map +1 -0
- package/dist/tools/transaction-item.d.ts +225 -0
- package/dist/tools/transaction-item.js +109 -0
- package/dist/tools/transaction-item.js.map +1 -0
- package/dist/transport/draining-transport.d.ts +14 -0
- package/dist/transport/draining-transport.js +36 -0
- package/dist/transport/draining-transport.js.map +1 -0
- package/dist/transport/stdio.d.ts +2 -0
- package/dist/transport/stdio.js +5 -0
- package/dist/transport/stdio.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,871 @@
|
|
|
1
|
+
import { accountingRuleQueryInputSchema, accountingRuleSaveInputSchema, allocationConfigSaveInputSchema, allocationQueryInputSchema, generatorConfigSaveInputSchema, mappingConfigQueryInputSchema, mappingConfigSaveInputSchema, pnlConfigSaveInputSchema, runGeneratorOperationInputSchema, } from '../../schemas/domains/configuration.js';
|
|
2
|
+
import { executePlannedInputSchema, previewAllocationInputSchema, previewAllocationOutputSchema, runPnlCalculationInputSchema, } from '../../schemas/domains/extended-operations.js';
|
|
3
|
+
import { operationResultSchemas } from '../../schemas/domains/extended-operation-results.js';
|
|
4
|
+
import { queryAccountingRulesOutputSchema, queryAllocationOutputSchema, queryMappingConfigOutputSchema, } from '../../schemas/domains/extended-query-results.js';
|
|
5
|
+
import { createPublicInputSchema } from '../../schemas/public-input.js';
|
|
6
|
+
import { createPnlCalculationJobId } from '../../policies/job-reference.js';
|
|
7
|
+
import { FinTaxError } from '../../errors/fintax-error.js';
|
|
8
|
+
import { hashOperationValue } from '../../policies/operation-plan.js';
|
|
9
|
+
import { executeIdempotentWrite } from '../core-edit/idempotent-write.js';
|
|
10
|
+
import { asRecord, executePlannedOperation, issueOperationPlan, operationResult, querySummary, requiredUpstreamArray, resultSummary, } from './tool-support.js';
|
|
11
|
+
import { accountingRulesQueryOutput, allocationQueryOutput, mappingConfigQueryOutput, } from './query-output.js';
|
|
12
|
+
const readAnnotations = {
|
|
13
|
+
readOnlyHint: true,
|
|
14
|
+
destructiveHint: false,
|
|
15
|
+
idempotentHint: true,
|
|
16
|
+
openWorldHint: false,
|
|
17
|
+
};
|
|
18
|
+
const writeAnnotations = {
|
|
19
|
+
readOnlyHint: false,
|
|
20
|
+
destructiveHint: false,
|
|
21
|
+
idempotentHint: false,
|
|
22
|
+
openWorldHint: false,
|
|
23
|
+
};
|
|
24
|
+
const mappingCapabilities = {
|
|
25
|
+
attribute_definition: {
|
|
26
|
+
list: 'suite.config.map_attr_definition.list',
|
|
27
|
+
detail: 'suite.config.map_attr_definition.detail',
|
|
28
|
+
create: 'suite.config.map_attr_definition.create',
|
|
29
|
+
update: 'suite.config.map_attr_definition.update',
|
|
30
|
+
},
|
|
31
|
+
attribute_fill: {
|
|
32
|
+
list: 'suite.config.map_attribute_fill.list',
|
|
33
|
+
detail: 'suite.config.map_attribute_fill.detail',
|
|
34
|
+
create: 'suite.config.map_attribute_fill.create',
|
|
35
|
+
update: 'suite.config.map_attribute_fill.update',
|
|
36
|
+
},
|
|
37
|
+
source_handler: {
|
|
38
|
+
list: 'suite.config.map_source_handler.list',
|
|
39
|
+
detail: 'suite.config.map_source_handler.detail',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const queryMappingConfigTool = {
|
|
43
|
+
name: 'query_mapping_config',
|
|
44
|
+
title: 'Query Mapping Configuration',
|
|
45
|
+
description: 'Query attribute-definition, attribute-fill, or source-handler lists and details with stable business fields and pagination. Do not use it to invoke callbacks or internal run entry points or to read connection credentials.',
|
|
46
|
+
risk: 'R0',
|
|
47
|
+
exposurePack: 'configuration',
|
|
48
|
+
capabilityIds: Object.values(mappingCapabilities).flatMap((value) => Object.values(value)),
|
|
49
|
+
fileAccess: 'none',
|
|
50
|
+
publicInputSchema: createPublicInputSchema(mappingConfigQueryInputSchema),
|
|
51
|
+
inputSchema: mappingConfigQueryInputSchema,
|
|
52
|
+
outputSchema: queryMappingConfigOutputSchema,
|
|
53
|
+
annotations: readAnnotations,
|
|
54
|
+
async execute(rawInput, context) {
|
|
55
|
+
const input = mappingConfigQueryInputSchema.parse(rawInput);
|
|
56
|
+
const capability = mappingCapabilities[input.object_type][input.view];
|
|
57
|
+
const raw = await context.callCapability(capability, input.view === 'detail'
|
|
58
|
+
? { object_id: input.object_id }
|
|
59
|
+
: {
|
|
60
|
+
query: {
|
|
61
|
+
search: input.search,
|
|
62
|
+
status: input.status,
|
|
63
|
+
source_key: input.source_key,
|
|
64
|
+
biz_type_no: input.biz_type_no,
|
|
65
|
+
source_category: input.source_category,
|
|
66
|
+
source_code: input.source_code,
|
|
67
|
+
line_type: input.line_type,
|
|
68
|
+
system_type: input.system_type,
|
|
69
|
+
target_field: input.target_field,
|
|
70
|
+
page: input.page,
|
|
71
|
+
page_size: input.page_size,
|
|
72
|
+
},
|
|
73
|
+
}, input.context.org_id);
|
|
74
|
+
return mappingConfigQueryOutput({
|
|
75
|
+
view: input.view,
|
|
76
|
+
objectType: input.object_type,
|
|
77
|
+
raw,
|
|
78
|
+
context,
|
|
79
|
+
capabilityId: capability,
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
summarize: querySummary,
|
|
83
|
+
};
|
|
84
|
+
function resultTargetId(raw, field) {
|
|
85
|
+
const id = asRecord(raw)[field];
|
|
86
|
+
if (typeof id === 'string')
|
|
87
|
+
return id;
|
|
88
|
+
throw new FinTaxError('UPSTREAM_UNAVAILABLE', 'The FinTax save result is missing a valid object ID');
|
|
89
|
+
}
|
|
90
|
+
function configurationIdentityResult(raw) {
|
|
91
|
+
const value = asRecord(raw);
|
|
92
|
+
return { id: value.id, version: value.version };
|
|
93
|
+
}
|
|
94
|
+
function accountingRuleResult(raw) {
|
|
95
|
+
const value = asRecord(raw);
|
|
96
|
+
return {
|
|
97
|
+
id: value.id,
|
|
98
|
+
...(typeof value.version === 'number' ? { version: value.version } : {}),
|
|
99
|
+
...(typeof value.ready_status === 'string'
|
|
100
|
+
? { ready_status: value.ready_status }
|
|
101
|
+
: {}),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function allocationConfigResult(raw) {
|
|
105
|
+
const value = asRecord(raw);
|
|
106
|
+
if (typeof value.cfg_head_id === 'string') {
|
|
107
|
+
return {
|
|
108
|
+
cfg_head_id: value.cfg_head_id,
|
|
109
|
+
version: value.version,
|
|
110
|
+
ratio_total: value.ratio_total,
|
|
111
|
+
line_count: value.line_count,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
id: value.id,
|
|
116
|
+
...(typeof value.version === 'number' ? { version: value.version } : {}),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function pnlConfigResult(raw) {
|
|
120
|
+
const value = asRecord(raw);
|
|
121
|
+
if (typeof value.bucket_id === 'string') {
|
|
122
|
+
return {
|
|
123
|
+
id: value.id,
|
|
124
|
+
bucket_id: value.bucket_id,
|
|
125
|
+
sub_account_id: value.sub_account_id,
|
|
126
|
+
joined_at: value.joined_at,
|
|
127
|
+
active: value.active,
|
|
128
|
+
lock_version: value.lock_version,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
id: value.id,
|
|
133
|
+
status: value.status,
|
|
134
|
+
lock_version: value.lock_version,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function allocationResult(raw) {
|
|
138
|
+
const value = asRecord(raw);
|
|
139
|
+
return {
|
|
140
|
+
hit: value.hit,
|
|
141
|
+
head_ids: value.head_ids,
|
|
142
|
+
already_exists_count: value.already_exists_count,
|
|
143
|
+
line_count: value.line_count,
|
|
144
|
+
total_base_amount: value.total_base_amount,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function pnlCalculationResult(raw) {
|
|
148
|
+
const value = asRecord(raw);
|
|
149
|
+
return {
|
|
150
|
+
id: value.id,
|
|
151
|
+
mode: value.mode,
|
|
152
|
+
status: value.status,
|
|
153
|
+
bucket_id: value.bucket_id,
|
|
154
|
+
symbol: value.symbol ?? null,
|
|
155
|
+
from_date: value.from_date,
|
|
156
|
+
to_date: value.to_date,
|
|
157
|
+
lines_processed: value.lines_processed,
|
|
158
|
+
ins_created: value.ins_created,
|
|
159
|
+
outs_created: value.outs_created,
|
|
160
|
+
transfers_created: value.transfers_created,
|
|
161
|
+
total_realized_gl: value.total_realized_gl ?? null,
|
|
162
|
+
started_at: value.started_at ?? null,
|
|
163
|
+
completed_at: value.completed_at ?? null,
|
|
164
|
+
created_at: value.created_at,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function generatorRunResult(raw) {
|
|
168
|
+
const value = asRecord(raw);
|
|
169
|
+
return {
|
|
170
|
+
success: value.success,
|
|
171
|
+
created_count: value.created_count,
|
|
172
|
+
status: value.status,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function allocationPreviewSnapshot(raw) {
|
|
176
|
+
const value = asRecord(raw);
|
|
177
|
+
const lines = requiredUpstreamArray(value.lines).map(asRecord);
|
|
178
|
+
return {
|
|
179
|
+
journal_number: value.journal_number,
|
|
180
|
+
hit: value.hit,
|
|
181
|
+
lines: lines.map((line) => {
|
|
182
|
+
const expanded = requiredUpstreamArray(line.expanded).map(asRecord);
|
|
183
|
+
return {
|
|
184
|
+
src_line_no: line.src_line_no,
|
|
185
|
+
coa_code: line.coa_code,
|
|
186
|
+
net_base: line.net_base,
|
|
187
|
+
expanded: expanded.map((item) => ({
|
|
188
|
+
ratio: item.ratio,
|
|
189
|
+
coa_code: item.coa_code,
|
|
190
|
+
base_amount: item.base_amount,
|
|
191
|
+
})),
|
|
192
|
+
};
|
|
193
|
+
}),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function allocationPlanSummary(output) {
|
|
197
|
+
const parsed = previewAllocationOutputSchema.parse(output);
|
|
198
|
+
const targetLines = parsed.data.preview.lines.reduce((total, line) => total + line.expanded.length, 0);
|
|
199
|
+
const hit = parsed.data.preview.hit
|
|
200
|
+
? 'matched a configuration'
|
|
201
|
+
: 'did not match a configuration';
|
|
202
|
+
return `The allocation preview ${hit}, with ${parsed.data.preview.lines.length} source lines and ${targetLines} target lines; user confirmation is required before execution.`;
|
|
203
|
+
}
|
|
204
|
+
async function saveConfig(options) {
|
|
205
|
+
const execute = () => executeIdempotentWrite({
|
|
206
|
+
toolName: options.toolName,
|
|
207
|
+
idempotencyKey: options.idempotencyKey,
|
|
208
|
+
orgId: options.orgId,
|
|
209
|
+
fingerprintValue: options.fingerprint,
|
|
210
|
+
capabilityId: options.capabilityId,
|
|
211
|
+
capabilityInput: options.capabilityInput,
|
|
212
|
+
context: options.context,
|
|
213
|
+
outputSchema: options.outputSchema,
|
|
214
|
+
...(options.recovery === undefined ? {} : { recovery: options.recovery }),
|
|
215
|
+
...(options.objectId === undefined
|
|
216
|
+
? {}
|
|
217
|
+
: {
|
|
218
|
+
target: { field: 'object_id', id: options.objectId },
|
|
219
|
+
}),
|
|
220
|
+
buildOutput: (raw) => operationResult({
|
|
221
|
+
operation: options.toolName,
|
|
222
|
+
targetType: options.objectType,
|
|
223
|
+
targetIds: [resultTargetId(raw, options.targetIdField ?? 'id')],
|
|
224
|
+
result: options.projectResult(raw),
|
|
225
|
+
outputSchema: options.outputSchema,
|
|
226
|
+
context: options.context,
|
|
227
|
+
sourceOperation: options.capabilityId.replace(/^suite\./, ''),
|
|
228
|
+
}),
|
|
229
|
+
});
|
|
230
|
+
return options.objectId === undefined
|
|
231
|
+
? execute()
|
|
232
|
+
: options.context.withResourceLock(`${options.objectType}:${options.objectId}`, execute);
|
|
233
|
+
}
|
|
234
|
+
export const saveMappingConfigTool = {
|
|
235
|
+
name: 'save_mapping_config',
|
|
236
|
+
title: 'Save Mapping Configuration',
|
|
237
|
+
description: 'Create or update attribute-definition and attribute-fill configuration. The configuration is saved immediately, but no callback is run. This Tool cannot write source handlers, stored procedures, internal jobs, or delete configuration.',
|
|
238
|
+
risk: 'R1',
|
|
239
|
+
exposurePack: 'configuration',
|
|
240
|
+
capabilityIds: [
|
|
241
|
+
'suite.config.map_attr_definition.create',
|
|
242
|
+
'suite.config.map_attr_definition.update',
|
|
243
|
+
'suite.config.map_attribute_fill.create',
|
|
244
|
+
'suite.config.map_attribute_fill.update',
|
|
245
|
+
],
|
|
246
|
+
fileAccess: 'none',
|
|
247
|
+
publicInputSchema: createPublicInputSchema(mappingConfigSaveInputSchema),
|
|
248
|
+
inputSchema: mappingConfigSaveInputSchema,
|
|
249
|
+
outputSchema: operationResultSchemas.save_mapping_config,
|
|
250
|
+
annotations: writeAnnotations,
|
|
251
|
+
async execute(rawInput, context) {
|
|
252
|
+
const input = mappingConfigSaveInputSchema.parse(rawInput);
|
|
253
|
+
const capability = mappingCapabilities[input.object_type][input.operation];
|
|
254
|
+
const recovery = 'object_id' in input
|
|
255
|
+
? {
|
|
256
|
+
tool: 'query_mapping_config',
|
|
257
|
+
input: {
|
|
258
|
+
context: { org_id: input.context.org_id },
|
|
259
|
+
view: 'detail',
|
|
260
|
+
object_type: input.object_type,
|
|
261
|
+
object_id: input.object_id,
|
|
262
|
+
},
|
|
263
|
+
}
|
|
264
|
+
: {
|
|
265
|
+
tool: 'query_mapping_config',
|
|
266
|
+
input: {
|
|
267
|
+
context: { org_id: input.context.org_id },
|
|
268
|
+
view: 'list',
|
|
269
|
+
object_type: input.object_type,
|
|
270
|
+
...(input.object_type === 'attribute_definition'
|
|
271
|
+
? {
|
|
272
|
+
source_key: input.values.source_key,
|
|
273
|
+
biz_type_no: input.values.biz_type_no,
|
|
274
|
+
}
|
|
275
|
+
: {
|
|
276
|
+
source_category: input.values.source_category,
|
|
277
|
+
source_code: input.values.source_code,
|
|
278
|
+
line_type: input.values.line_type,
|
|
279
|
+
system_type: input.values.system_type,
|
|
280
|
+
target_field: input.values.target_field,
|
|
281
|
+
}),
|
|
282
|
+
page: 1,
|
|
283
|
+
page_size: 20,
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
return saveConfig({
|
|
287
|
+
toolName: 'save_mapping_config',
|
|
288
|
+
objectType: input.object_type,
|
|
289
|
+
...('object_id' in input ? { objectId: input.object_id } : {}),
|
|
290
|
+
idempotencyKey: input.idempotency_key,
|
|
291
|
+
orgId: input.context.org_id,
|
|
292
|
+
capabilityId: capability,
|
|
293
|
+
capabilityInput: {
|
|
294
|
+
...('object_id' in input ? { object_id: input.object_id } : {}),
|
|
295
|
+
...('version' in input ? { version: input.version } : {}),
|
|
296
|
+
values: input.values,
|
|
297
|
+
},
|
|
298
|
+
fingerprint: input,
|
|
299
|
+
context,
|
|
300
|
+
outputSchema: operationResultSchemas.save_mapping_config,
|
|
301
|
+
projectResult: configurationIdentityResult,
|
|
302
|
+
recovery,
|
|
303
|
+
});
|
|
304
|
+
},
|
|
305
|
+
summarize: resultSummary,
|
|
306
|
+
};
|
|
307
|
+
const ruleCapabilities = {
|
|
308
|
+
rule_header: {
|
|
309
|
+
list: 'suite.config.accounting_rule.list',
|
|
310
|
+
detail: 'suite.config.accounting_rule.detail',
|
|
311
|
+
create: 'suite.config.accounting_rule.create',
|
|
312
|
+
update: 'suite.config.accounting_rule.update',
|
|
313
|
+
},
|
|
314
|
+
precheck: {
|
|
315
|
+
list: 'suite.config.precheck_rule.tree',
|
|
316
|
+
detail: 'suite.config.precheck_rule.detail',
|
|
317
|
+
create: 'suite.config.precheck_rule.create',
|
|
318
|
+
update: 'suite.config.precheck_rule.update',
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
export const queryAccountingRulesTool = {
|
|
322
|
+
name: 'query_accounting_rules',
|
|
323
|
+
title: 'Query Accounting Rules',
|
|
324
|
+
description: 'Query accounting-rule headers or precheck configuration lists and details, including status, scope, match conditions, and version. It does not return internal expression implementations or execute rules.',
|
|
325
|
+
risk: 'R0',
|
|
326
|
+
exposurePack: 'configuration',
|
|
327
|
+
capabilityIds: Object.values(ruleCapabilities).flatMap((value) => [
|
|
328
|
+
value.list,
|
|
329
|
+
value.detail,
|
|
330
|
+
]),
|
|
331
|
+
fileAccess: 'none',
|
|
332
|
+
publicInputSchema: createPublicInputSchema(accountingRuleQueryInputSchema),
|
|
333
|
+
inputSchema: accountingRuleQueryInputSchema,
|
|
334
|
+
outputSchema: queryAccountingRulesOutputSchema,
|
|
335
|
+
annotations: readAnnotations,
|
|
336
|
+
async execute(rawInput, context) {
|
|
337
|
+
const input = accountingRuleQueryInputSchema.parse(rawInput);
|
|
338
|
+
const capability = ruleCapabilities[input.object_type][input.view];
|
|
339
|
+
const raw = await context.callCapability(capability, input.view === 'detail'
|
|
340
|
+
? { object_id: input.object_id }
|
|
341
|
+
: {
|
|
342
|
+
query: {
|
|
343
|
+
ledger_id: input.ledger_id,
|
|
344
|
+
keyword: input.search,
|
|
345
|
+
search: input.search,
|
|
346
|
+
is_enabled: input.status,
|
|
347
|
+
ready_status: input.object_type === 'precheck'
|
|
348
|
+
? input.ready_status
|
|
349
|
+
: undefined,
|
|
350
|
+
config_level: input.object_type === 'precheck'
|
|
351
|
+
? input.config_level
|
|
352
|
+
: undefined,
|
|
353
|
+
effective_at: input.object_type === 'precheck'
|
|
354
|
+
? input.effective_at
|
|
355
|
+
: undefined,
|
|
356
|
+
priority_min: input.object_type === 'rule_header'
|
|
357
|
+
? input.priority_min
|
|
358
|
+
: undefined,
|
|
359
|
+
priority_max: input.object_type === 'rule_header'
|
|
360
|
+
? input.priority_max
|
|
361
|
+
: undefined,
|
|
362
|
+
effective_from_start: input.object_type === 'rule_header'
|
|
363
|
+
? input.effective_from_start
|
|
364
|
+
: undefined,
|
|
365
|
+
effective_from_end: input.object_type === 'rule_header'
|
|
366
|
+
? input.effective_from_end
|
|
367
|
+
: undefined,
|
|
368
|
+
page: input.page,
|
|
369
|
+
page_size: input.page_size,
|
|
370
|
+
},
|
|
371
|
+
}, input.context.org_id);
|
|
372
|
+
return accountingRulesQueryOutput({
|
|
373
|
+
view: input.view,
|
|
374
|
+
objectType: input.object_type,
|
|
375
|
+
raw,
|
|
376
|
+
context,
|
|
377
|
+
capabilityId: capability,
|
|
378
|
+
});
|
|
379
|
+
},
|
|
380
|
+
summarize: querySummary,
|
|
381
|
+
};
|
|
382
|
+
function expandAttributes(prefix, values) {
|
|
383
|
+
const key = `${prefix}_attributes`;
|
|
384
|
+
const attributes = values[key];
|
|
385
|
+
if (!Array.isArray(attributes))
|
|
386
|
+
return values;
|
|
387
|
+
const expanded = { ...values };
|
|
388
|
+
Reflect.deleteProperty(expanded, key);
|
|
389
|
+
for (let index = 0; index < 12; index += 1) {
|
|
390
|
+
expanded[`${prefix}_attribute${index + 1}`] = attributes[index] ?? null;
|
|
391
|
+
}
|
|
392
|
+
return expanded;
|
|
393
|
+
}
|
|
394
|
+
export const saveAccountingRuleTool = {
|
|
395
|
+
name: 'save_accounting_rule',
|
|
396
|
+
title: 'Save Accounting Rule',
|
|
397
|
+
description: 'Create or update an accounting-rule header or account precheck configuration, immediately changing subsequent accounting configuration. It cannot maintain rule-line expressions, delete configuration, or execute automatic accounting.',
|
|
398
|
+
risk: 'R2',
|
|
399
|
+
exposurePack: 'configuration',
|
|
400
|
+
capabilityIds: Object.values(ruleCapabilities).flatMap((value) => [
|
|
401
|
+
value.create,
|
|
402
|
+
value.update,
|
|
403
|
+
]),
|
|
404
|
+
fileAccess: 'none',
|
|
405
|
+
publicInputSchema: createPublicInputSchema(accountingRuleSaveInputSchema),
|
|
406
|
+
inputSchema: accountingRuleSaveInputSchema,
|
|
407
|
+
outputSchema: operationResultSchemas.save_accounting_rule,
|
|
408
|
+
annotations: writeAnnotations,
|
|
409
|
+
async execute(rawInput, context) {
|
|
410
|
+
const input = accountingRuleSaveInputSchema.parse(rawInput);
|
|
411
|
+
const capability = ruleCapabilities[input.object_type][input.operation];
|
|
412
|
+
let values = input.values;
|
|
413
|
+
if (input.object_type === 'precheck') {
|
|
414
|
+
values = expandAttributes('counter', expandAttributes('main', values));
|
|
415
|
+
}
|
|
416
|
+
const recovery = 'object_id' in input
|
|
417
|
+
? {
|
|
418
|
+
tool: 'query_accounting_rules',
|
|
419
|
+
input: {
|
|
420
|
+
context: { org_id: input.context.org_id },
|
|
421
|
+
view: 'detail',
|
|
422
|
+
object_type: input.object_type,
|
|
423
|
+
object_id: input.object_id,
|
|
424
|
+
},
|
|
425
|
+
}
|
|
426
|
+
: {
|
|
427
|
+
tool: 'query_accounting_rules',
|
|
428
|
+
input: {
|
|
429
|
+
context: { org_id: input.context.org_id },
|
|
430
|
+
view: 'list',
|
|
431
|
+
object_type: input.object_type,
|
|
432
|
+
ledger_id: input.values.ledger_id,
|
|
433
|
+
...(input.object_type === 'rule_header'
|
|
434
|
+
? { search: input.values.rule_code }
|
|
435
|
+
: { config_level: input.values.config_level }),
|
|
436
|
+
page: 1,
|
|
437
|
+
page_size: 20,
|
|
438
|
+
},
|
|
439
|
+
};
|
|
440
|
+
return saveConfig({
|
|
441
|
+
toolName: 'save_accounting_rule',
|
|
442
|
+
objectType: input.object_type,
|
|
443
|
+
...('object_id' in input ? { objectId: input.object_id } : {}),
|
|
444
|
+
idempotencyKey: input.idempotency_key,
|
|
445
|
+
orgId: input.context.org_id,
|
|
446
|
+
capabilityId: capability,
|
|
447
|
+
capabilityInput: {
|
|
448
|
+
...('object_id' in input ? { object_id: input.object_id } : {}),
|
|
449
|
+
...('version' in input ? { version: input.version } : {}),
|
|
450
|
+
values,
|
|
451
|
+
},
|
|
452
|
+
fingerprint: input,
|
|
453
|
+
context,
|
|
454
|
+
outputSchema: operationResultSchemas.save_accounting_rule,
|
|
455
|
+
projectResult: accountingRuleResult,
|
|
456
|
+
recovery,
|
|
457
|
+
});
|
|
458
|
+
},
|
|
459
|
+
summarize: resultSummary,
|
|
460
|
+
};
|
|
461
|
+
const allocationReadCapabilities = {
|
|
462
|
+
config_list: 'suite.config.allocation_config.list',
|
|
463
|
+
config_detail: 'suite.config.allocation_config.detail',
|
|
464
|
+
result_list: 'suite.aloc.detail.list',
|
|
465
|
+
result_detail: 'suite.aloc.detail.detail',
|
|
466
|
+
summary: 'suite.aloc.detail.summary',
|
|
467
|
+
};
|
|
468
|
+
export const queryAllocationTool = {
|
|
469
|
+
name: 'query_allocation',
|
|
470
|
+
title: 'Query Allocation Configuration and Results',
|
|
471
|
+
description: 'Query allocation headers, configuration details, generated allocation results, or summaries. It adapts existing results and does not recalculate allocations in MCP.',
|
|
472
|
+
risk: 'R0',
|
|
473
|
+
exposurePack: 'configuration',
|
|
474
|
+
capabilityIds: Object.values(allocationReadCapabilities),
|
|
475
|
+
fileAccess: 'none',
|
|
476
|
+
publicInputSchema: createPublicInputSchema(allocationQueryInputSchema),
|
|
477
|
+
inputSchema: allocationQueryInputSchema,
|
|
478
|
+
outputSchema: queryAllocationOutputSchema,
|
|
479
|
+
annotations: readAnnotations,
|
|
480
|
+
async execute(rawInput, context) {
|
|
481
|
+
const input = allocationQueryInputSchema.parse(rawInput);
|
|
482
|
+
const capability = allocationReadCapabilities[input.view];
|
|
483
|
+
const capabilityInput = input.view === 'config_detail'
|
|
484
|
+
? { object_id: input.config_id }
|
|
485
|
+
: input.view === 'result_detail'
|
|
486
|
+
? { object_id: input.result_id }
|
|
487
|
+
: {
|
|
488
|
+
query: {
|
|
489
|
+
ledger_id: input.ledger_id,
|
|
490
|
+
period_name: 'period' in input ? input.period : undefined,
|
|
491
|
+
status: 'status' in input ? input.status : undefined,
|
|
492
|
+
gen_mode: 'gen_mode' in input ? input.gen_mode : undefined,
|
|
493
|
+
coa_code: 'coa_code' in input ? input.coa_code : undefined,
|
|
494
|
+
enabled: 'enabled' in input ? input.enabled : undefined,
|
|
495
|
+
search: 'search' in input ? input.search : undefined,
|
|
496
|
+
page: 'page' in input ? input.page : undefined,
|
|
497
|
+
page_size: 'page_size' in input ? input.page_size : undefined,
|
|
498
|
+
},
|
|
499
|
+
};
|
|
500
|
+
const raw = await context.callCapability(capability, capabilityInput, input.context.org_id);
|
|
501
|
+
return allocationQueryOutput({
|
|
502
|
+
view: input.view,
|
|
503
|
+
raw,
|
|
504
|
+
context,
|
|
505
|
+
capabilityId: capability,
|
|
506
|
+
});
|
|
507
|
+
},
|
|
508
|
+
summarize: querySummary,
|
|
509
|
+
};
|
|
510
|
+
export const saveAllocationConfigTool = {
|
|
511
|
+
name: 'save_allocation_config',
|
|
512
|
+
title: 'Save Allocation Configuration',
|
|
513
|
+
description: 'Create or update an allocation header, or replace its line collection with at least one complete target configuration. Saving does not execute allocation. An empty array cannot clear or delete configuration.',
|
|
514
|
+
risk: 'R1',
|
|
515
|
+
exposurePack: 'configuration',
|
|
516
|
+
capabilityIds: [
|
|
517
|
+
'suite.config.allocation_config.create',
|
|
518
|
+
'suite.config.allocation_config.update',
|
|
519
|
+
'suite.config.allocation_config.lines',
|
|
520
|
+
],
|
|
521
|
+
fileAccess: 'none',
|
|
522
|
+
publicInputSchema: createPublicInputSchema(allocationConfigSaveInputSchema),
|
|
523
|
+
inputSchema: allocationConfigSaveInputSchema,
|
|
524
|
+
outputSchema: operationResultSchemas.save_allocation_config,
|
|
525
|
+
annotations: writeAnnotations,
|
|
526
|
+
async execute(rawInput, context) {
|
|
527
|
+
const input = allocationConfigSaveInputSchema.parse(rawInput);
|
|
528
|
+
const capability = input.object_type === 'config_lines'
|
|
529
|
+
? 'suite.config.allocation_config.lines'
|
|
530
|
+
: input.operation === 'create'
|
|
531
|
+
? 'suite.config.allocation_config.create'
|
|
532
|
+
: 'suite.config.allocation_config.update';
|
|
533
|
+
const recovery = 'object_id' in input
|
|
534
|
+
? {
|
|
535
|
+
tool: 'query_allocation',
|
|
536
|
+
input: {
|
|
537
|
+
context: { org_id: input.context.org_id },
|
|
538
|
+
view: 'config_detail',
|
|
539
|
+
config_id: input.object_id,
|
|
540
|
+
},
|
|
541
|
+
}
|
|
542
|
+
: {
|
|
543
|
+
tool: 'query_allocation',
|
|
544
|
+
input: {
|
|
545
|
+
context: { org_id: input.context.org_id },
|
|
546
|
+
view: 'config_list',
|
|
547
|
+
ledger_id: input.values.ledger_id,
|
|
548
|
+
coa_code: input.values.coa_code,
|
|
549
|
+
page: 1,
|
|
550
|
+
page_size: 20,
|
|
551
|
+
},
|
|
552
|
+
};
|
|
553
|
+
return saveConfig({
|
|
554
|
+
toolName: 'save_allocation_config',
|
|
555
|
+
objectType: input.object_type,
|
|
556
|
+
...('object_id' in input ? { objectId: input.object_id } : {}),
|
|
557
|
+
idempotencyKey: input.idempotency_key,
|
|
558
|
+
orgId: input.context.org_id,
|
|
559
|
+
capabilityId: capability,
|
|
560
|
+
capabilityInput: input.object_type === 'config_lines'
|
|
561
|
+
? {
|
|
562
|
+
object_id: input.object_id,
|
|
563
|
+
version: input.version,
|
|
564
|
+
lines: input.lines,
|
|
565
|
+
}
|
|
566
|
+
: {
|
|
567
|
+
...('object_id' in input ? { object_id: input.object_id } : {}),
|
|
568
|
+
...('version' in input ? { version: input.version } : {}),
|
|
569
|
+
values: input.values,
|
|
570
|
+
},
|
|
571
|
+
fingerprint: input,
|
|
572
|
+
context,
|
|
573
|
+
outputSchema: operationResultSchemas.save_allocation_config,
|
|
574
|
+
projectResult: allocationConfigResult,
|
|
575
|
+
...(input.object_type === 'config_lines'
|
|
576
|
+
? { targetIdField: 'cfg_head_id' }
|
|
577
|
+
: {}),
|
|
578
|
+
recovery,
|
|
579
|
+
});
|
|
580
|
+
},
|
|
581
|
+
summarize: resultSummary,
|
|
582
|
+
};
|
|
583
|
+
export const previewAllocationTool = {
|
|
584
|
+
name: 'preview_allocation',
|
|
585
|
+
title: 'Preview Journal Allocation',
|
|
586
|
+
description: 'Run the native allocation preview for a specified journal_id and create a single-use execution plan without creating allocation results. Call execute_allocation only after confirming the matched configuration, target lines, and amounts.',
|
|
587
|
+
risk: 'R0',
|
|
588
|
+
exposurePack: 'configuration',
|
|
589
|
+
capabilityIds: ['suite.aloc.generate.preview'],
|
|
590
|
+
fileAccess: 'none',
|
|
591
|
+
inputSchema: previewAllocationInputSchema,
|
|
592
|
+
outputSchema: previewAllocationOutputSchema,
|
|
593
|
+
annotations: readAnnotations,
|
|
594
|
+
async execute(rawInput, context) {
|
|
595
|
+
const input = previewAllocationInputSchema.parse(rawInput);
|
|
596
|
+
const preview = await context.callCapability('suite.aloc.generate.preview', { journal_id: input.journal_id }, input.context.org_id);
|
|
597
|
+
const snapshot = allocationPreviewSnapshot(preview);
|
|
598
|
+
return issueOperationPlan({
|
|
599
|
+
context,
|
|
600
|
+
executeTool: 'execute_allocation',
|
|
601
|
+
targetType: 'allocation',
|
|
602
|
+
targetIds: [input.journal_id],
|
|
603
|
+
targetVersions: [],
|
|
604
|
+
orgId: input.context.org_id,
|
|
605
|
+
parameters: input,
|
|
606
|
+
preview: snapshot,
|
|
607
|
+
operation: 'aloc.generate.preview',
|
|
608
|
+
publicPreview: snapshot,
|
|
609
|
+
outputSchema: previewAllocationOutputSchema,
|
|
610
|
+
privatePayload: { journal_id: input.journal_id },
|
|
611
|
+
});
|
|
612
|
+
},
|
|
613
|
+
summarize: allocationPlanSummary,
|
|
614
|
+
};
|
|
615
|
+
export const executeAllocationTool = {
|
|
616
|
+
name: 'execute_allocation',
|
|
617
|
+
title: 'Execute Journal Allocation',
|
|
618
|
+
description: 'Consume a user-confirmed plan issued by preview_allocation and generate the final allocation result for its bound journal_id. This Tool does not roll back results and must not be retried blindly.',
|
|
619
|
+
risk: 'R3',
|
|
620
|
+
exposurePack: 'configuration',
|
|
621
|
+
capabilityIds: ['suite.aloc.generate.preview', 'suite.aloc.generate.execute'],
|
|
622
|
+
fileAccess: 'none',
|
|
623
|
+
inputSchema: executePlannedInputSchema,
|
|
624
|
+
outputSchema: operationResultSchemas.execute_allocation,
|
|
625
|
+
annotations: writeAnnotations,
|
|
626
|
+
async execute(rawInput, context) {
|
|
627
|
+
const input = executePlannedInputSchema.parse(rawInput);
|
|
628
|
+
const binding = context.operationPlans.inspect(input.operation_plan_id, input.confirmation_token, 'execute_allocation');
|
|
629
|
+
return context.withResourceLock(`allocation:${binding.subject_id}`, () => executePlannedOperation({
|
|
630
|
+
toolName: 'execute_allocation',
|
|
631
|
+
operationPlanId: input.operation_plan_id,
|
|
632
|
+
confirmationToken: input.confirmation_token,
|
|
633
|
+
idempotencyKey: input.idempotency_key,
|
|
634
|
+
orgId: input.context.org_id,
|
|
635
|
+
capabilityId: 'suite.aloc.generate.execute',
|
|
636
|
+
context,
|
|
637
|
+
sourceOperation: 'aloc.generate.execute',
|
|
638
|
+
targetType: 'allocation',
|
|
639
|
+
outputSchema: operationResultSchemas.execute_allocation,
|
|
640
|
+
projectResult: allocationResult,
|
|
641
|
+
validatePlan: async (plan) => {
|
|
642
|
+
const preview = await context.callCapability('suite.aloc.generate.preview', { journal_id: plan.payload?.journal_id }, input.context.org_id);
|
|
643
|
+
if (hashOperationValue(allocationPreviewSnapshot(preview)) !==
|
|
644
|
+
plan.preview_hash) {
|
|
645
|
+
throw new FinTaxError('CONFIRMATION_REQUIRED', 'The allocation preview changed; run the preview again');
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
buildCapabilityInput: (plan) => plan.payload ?? {},
|
|
649
|
+
}));
|
|
650
|
+
},
|
|
651
|
+
summarize: resultSummary,
|
|
652
|
+
};
|
|
653
|
+
export const savePnlConfigTool = {
|
|
654
|
+
name: 'save_pnl_config',
|
|
655
|
+
title: 'Save Profit-and-Loss Configuration',
|
|
656
|
+
description: 'Create or update a profit-and-loss bucket, or add a member to an explicit bucket_id. Saving does not start a profit-and-loss calculation. This Tool provides no path to delete buckets or remove members.',
|
|
657
|
+
risk: 'R1',
|
|
658
|
+
exposurePack: 'configuration',
|
|
659
|
+
capabilityIds: [
|
|
660
|
+
'suite.config.pnl_bucket.create',
|
|
661
|
+
'suite.config.pnl_bucket.update',
|
|
662
|
+
'suite.config.pnl_bucket.member_add',
|
|
663
|
+
],
|
|
664
|
+
fileAccess: 'none',
|
|
665
|
+
publicInputSchema: createPublicInputSchema(pnlConfigSaveInputSchema),
|
|
666
|
+
inputSchema: pnlConfigSaveInputSchema,
|
|
667
|
+
outputSchema: operationResultSchemas.save_pnl_config,
|
|
668
|
+
annotations: writeAnnotations,
|
|
669
|
+
async execute(rawInput, context) {
|
|
670
|
+
const input = pnlConfigSaveInputSchema.parse(rawInput);
|
|
671
|
+
const capability = input.object_type === 'member'
|
|
672
|
+
? 'suite.config.pnl_bucket.member_add'
|
|
673
|
+
: input.operation === 'create'
|
|
674
|
+
? 'suite.config.pnl_bucket.create'
|
|
675
|
+
: 'suite.config.pnl_bucket.update';
|
|
676
|
+
const objectId = input.object_type === 'member'
|
|
677
|
+
? input.bucket_id
|
|
678
|
+
: 'object_id' in input
|
|
679
|
+
? input.object_id
|
|
680
|
+
: undefined;
|
|
681
|
+
return saveConfig({
|
|
682
|
+
toolName: 'save_pnl_config',
|
|
683
|
+
objectType: input.object_type,
|
|
684
|
+
...(objectId === undefined ? {} : { objectId }),
|
|
685
|
+
idempotencyKey: input.idempotency_key,
|
|
686
|
+
orgId: input.context.org_id,
|
|
687
|
+
capabilityId: capability,
|
|
688
|
+
capabilityInput: {
|
|
689
|
+
...(input.object_type === 'member'
|
|
690
|
+
? { bucket_id: input.bucket_id }
|
|
691
|
+
: {}),
|
|
692
|
+
...('object_id' in input ? { object_id: input.object_id } : {}),
|
|
693
|
+
...('version' in input ? { version: input.version } : {}),
|
|
694
|
+
values: input.values,
|
|
695
|
+
},
|
|
696
|
+
fingerprint: input,
|
|
697
|
+
context,
|
|
698
|
+
outputSchema: operationResultSchemas.save_pnl_config,
|
|
699
|
+
projectResult: pnlConfigResult,
|
|
700
|
+
...(input.object_type === 'member'
|
|
701
|
+
? {}
|
|
702
|
+
: {
|
|
703
|
+
recovery: {
|
|
704
|
+
tool: 'query_pnl',
|
|
705
|
+
input: {
|
|
706
|
+
context: { org_id: input.context.org_id },
|
|
707
|
+
view: 'buckets',
|
|
708
|
+
filters: { search: input.values.bucket_code },
|
|
709
|
+
page: 1,
|
|
710
|
+
page_size: 20,
|
|
711
|
+
},
|
|
712
|
+
},
|
|
713
|
+
}),
|
|
714
|
+
});
|
|
715
|
+
},
|
|
716
|
+
summarize: resultSummary,
|
|
717
|
+
};
|
|
718
|
+
export const runPnlCalculationTool = {
|
|
719
|
+
name: 'run_pnl_calculation',
|
|
720
|
+
title: 'Run Profit-and-Loss Calculation',
|
|
721
|
+
description: 'Start an asynchronous calculation for an explicit profit-and-loss bucket, mode, and date range and write profit-and-loss results. A successful call returns job_id. Poll with get_job_status and do not resubmit the same idempotency key.',
|
|
722
|
+
risk: 'R2',
|
|
723
|
+
exposurePack: 'configuration',
|
|
724
|
+
capabilityIds: ['suite.pnl.calculation.run'],
|
|
725
|
+
fileAccess: 'none',
|
|
726
|
+
inputSchema: runPnlCalculationInputSchema,
|
|
727
|
+
outputSchema: operationResultSchemas.run_pnl_calculation,
|
|
728
|
+
annotations: writeAnnotations,
|
|
729
|
+
async execute(rawInput, context) {
|
|
730
|
+
const input = runPnlCalculationInputSchema.parse(rawInput);
|
|
731
|
+
return context.withResourceLock(`pnl-bucket:${input.bucket_id}`, () => executeIdempotentWrite({
|
|
732
|
+
toolName: 'run_pnl_calculation',
|
|
733
|
+
idempotencyKey: input.idempotency_key,
|
|
734
|
+
orgId: input.context.org_id,
|
|
735
|
+
fingerprintValue: input,
|
|
736
|
+
capabilityId: 'suite.pnl.calculation.run',
|
|
737
|
+
capabilityInput: {
|
|
738
|
+
body: {
|
|
739
|
+
mode: input.mode,
|
|
740
|
+
bucket_id: input.bucket_id,
|
|
741
|
+
symbol: input.symbol,
|
|
742
|
+
from_date: input.from_date,
|
|
743
|
+
to_date: input.to_date,
|
|
744
|
+
},
|
|
745
|
+
},
|
|
746
|
+
context,
|
|
747
|
+
outputSchema: operationResultSchemas.run_pnl_calculation,
|
|
748
|
+
recovery: {
|
|
749
|
+
tool: 'query_pnl',
|
|
750
|
+
input: { view: 'calculations', page: 1, page_size: 20 },
|
|
751
|
+
},
|
|
752
|
+
target: { field: 'bucket_id', id: input.bucket_id },
|
|
753
|
+
buildOutput: (raw) => {
|
|
754
|
+
const runId = asRecord(raw).id;
|
|
755
|
+
if (typeof runId !== 'string') {
|
|
756
|
+
throw new FinTaxError('UPSTREAM_UNAVAILABLE', 'FinTax did not return a valid profit-and-loss calculation job ID, so its status cannot be queried');
|
|
757
|
+
}
|
|
758
|
+
return operationResult({
|
|
759
|
+
operation: 'run_pnl_calculation',
|
|
760
|
+
targetType: 'pnl_calculation',
|
|
761
|
+
targetIds: [runId],
|
|
762
|
+
result: pnlCalculationResult(raw),
|
|
763
|
+
outputSchema: operationResultSchemas.run_pnl_calculation,
|
|
764
|
+
context,
|
|
765
|
+
sourceOperation: 'pnl.calculation.run',
|
|
766
|
+
jobId: createPnlCalculationJobId(runId),
|
|
767
|
+
});
|
|
768
|
+
},
|
|
769
|
+
}));
|
|
770
|
+
},
|
|
771
|
+
summarize: resultSummary,
|
|
772
|
+
};
|
|
773
|
+
const generatorCapabilities = {
|
|
774
|
+
parameter: {
|
|
775
|
+
create: 'suite.config.generator_parameter.create',
|
|
776
|
+
update: 'suite.config.generator_parameter.update',
|
|
777
|
+
},
|
|
778
|
+
rule: {
|
|
779
|
+
create: 'suite.config.generator_rule.create',
|
|
780
|
+
update: 'suite.config.generator_rule.update',
|
|
781
|
+
},
|
|
782
|
+
};
|
|
783
|
+
export const saveGeneratorConfigTool = {
|
|
784
|
+
name: 'save_generator_config',
|
|
785
|
+
title: 'Save Generator Configuration',
|
|
786
|
+
description: 'Create or update generation parameters and generation-rule configuration without executing rules or maintaining schedules, callbacks, or arbitrary code entry points. Rule types remain restricted by the registered generator_type allowlist.',
|
|
787
|
+
risk: 'R2',
|
|
788
|
+
exposurePack: 'configuration',
|
|
789
|
+
capabilityIds: Object.values(generatorCapabilities).flatMap((value) => Object.values(value)),
|
|
790
|
+
fileAccess: 'none',
|
|
791
|
+
publicInputSchema: createPublicInputSchema(generatorConfigSaveInputSchema),
|
|
792
|
+
inputSchema: generatorConfigSaveInputSchema,
|
|
793
|
+
outputSchema: operationResultSchemas.save_generator_config,
|
|
794
|
+
annotations: writeAnnotations,
|
|
795
|
+
async execute(rawInput, context) {
|
|
796
|
+
const input = generatorConfigSaveInputSchema.parse(rawInput);
|
|
797
|
+
const capability = generatorCapabilities[input.object_type][input.operation];
|
|
798
|
+
return saveConfig({
|
|
799
|
+
toolName: 'save_generator_config',
|
|
800
|
+
objectType: input.object_type,
|
|
801
|
+
...('object_id' in input ? { objectId: input.object_id } : {}),
|
|
802
|
+
idempotencyKey: input.idempotency_key,
|
|
803
|
+
orgId: input.context.org_id,
|
|
804
|
+
capabilityId: capability,
|
|
805
|
+
capabilityInput: {
|
|
806
|
+
...('object_id' in input ? { object_id: input.object_id } : {}),
|
|
807
|
+
...('version' in input ? { version: input.version } : {}),
|
|
808
|
+
values: input.values,
|
|
809
|
+
},
|
|
810
|
+
fingerprint: input,
|
|
811
|
+
context,
|
|
812
|
+
outputSchema: operationResultSchemas.save_generator_config,
|
|
813
|
+
projectResult: configurationIdentityResult,
|
|
814
|
+
});
|
|
815
|
+
},
|
|
816
|
+
summarize: resultSummary,
|
|
817
|
+
};
|
|
818
|
+
export const runGeneratorTool = {
|
|
819
|
+
name: 'run_generator',
|
|
820
|
+
title: 'Run Generator Rule',
|
|
821
|
+
description: 'Immediately run an explicitly selected saved generator rule with an optional business date. This Tool does not accept code, formulas, or dynamic rule definitions; configuration must first be saved through save_generator_config and validated by the service.',
|
|
822
|
+
risk: 'R2',
|
|
823
|
+
exposurePack: 'configuration',
|
|
824
|
+
capabilityIds: ['suite.pgen.rule.run'],
|
|
825
|
+
fileAccess: 'none',
|
|
826
|
+
inputSchema: runGeneratorOperationInputSchema,
|
|
827
|
+
outputSchema: operationResultSchemas.run_generator,
|
|
828
|
+
annotations: writeAnnotations,
|
|
829
|
+
async execute(rawInput, context) {
|
|
830
|
+
const input = runGeneratorOperationInputSchema.parse(rawInput);
|
|
831
|
+
return context.withResourceLock(`generator-rule:${input.rule_id}`, () => executeIdempotentWrite({
|
|
832
|
+
toolName: 'run_generator',
|
|
833
|
+
idempotencyKey: input.idempotency_key,
|
|
834
|
+
orgId: input.context.org_id,
|
|
835
|
+
fingerprintValue: input,
|
|
836
|
+
capabilityId: 'suite.pgen.rule.run',
|
|
837
|
+
capabilityInput: {
|
|
838
|
+
rule_id: input.rule_id,
|
|
839
|
+
business_date: input.business_date,
|
|
840
|
+
},
|
|
841
|
+
context,
|
|
842
|
+
outputSchema: operationResultSchemas.run_generator,
|
|
843
|
+
target: { field: 'rule_id', id: input.rule_id },
|
|
844
|
+
buildOutput: (raw) => operationResult({
|
|
845
|
+
operation: 'run_generator',
|
|
846
|
+
targetType: 'generator_rule',
|
|
847
|
+
targetIds: [input.rule_id],
|
|
848
|
+
result: generatorRunResult(raw),
|
|
849
|
+
outputSchema: operationResultSchemas.run_generator,
|
|
850
|
+
context,
|
|
851
|
+
sourceOperation: 'pgen.rule.run',
|
|
852
|
+
}),
|
|
853
|
+
}));
|
|
854
|
+
},
|
|
855
|
+
summarize: resultSummary,
|
|
856
|
+
};
|
|
857
|
+
export const configurationTools = [
|
|
858
|
+
queryMappingConfigTool,
|
|
859
|
+
saveMappingConfigTool,
|
|
860
|
+
queryAccountingRulesTool,
|
|
861
|
+
saveAccountingRuleTool,
|
|
862
|
+
queryAllocationTool,
|
|
863
|
+
saveAllocationConfigTool,
|
|
864
|
+
previewAllocationTool,
|
|
865
|
+
executeAllocationTool,
|
|
866
|
+
savePnlConfigTool,
|
|
867
|
+
runPnlCalculationTool,
|
|
868
|
+
saveGeneratorConfigTool,
|
|
869
|
+
runGeneratorTool,
|
|
870
|
+
];
|
|
871
|
+
//# sourceMappingURL=configuration-tools.js.map
|