@cspeach/cli 1.1.43 → 1.1.44
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/tools/transport.js +19 -71
- package/package.json +1 -1
- package/.cspeach/project.json +0 -4
package/dist/tools/transport.js
CHANGED
|
@@ -15,8 +15,6 @@ import { registerTool } from './index.js';
|
|
|
15
15
|
import { verifyAndSpendApprovalId } from '../approvals/jwt.js';
|
|
16
16
|
import { auditLog } from '@cspeach/sap-client';
|
|
17
17
|
import { ERR } from '../errors/codes.js';
|
|
18
|
-
import { presentSafetyConfirmation } from '../repl/safety-confirm.js';
|
|
19
|
-
import { isSafetyConfirmEnabled } from '../repl/safety-mode-state.js';
|
|
20
18
|
import { setCurrentTransport, noteConfirmedTransport } from '../repl/current-transport.js';
|
|
21
19
|
import { enrichTransportList } from './transport-fit.js';
|
|
22
20
|
import { reusedRequestRefusal } from './transport-fit-check.js';
|
|
@@ -476,15 +474,16 @@ registerTool({
|
|
|
476
474
|
});
|
|
477
475
|
// ── sap_transport_release ────────────────────────────────────────────────────
|
|
478
476
|
//
|
|
479
|
-
//
|
|
480
|
-
//
|
|
481
|
-
//
|
|
482
|
-
//
|
|
477
|
+
// 1.1.44 hotfix: not available. The request this tool used to send never
|
|
478
|
+
// released anything (SAP routes it to the create-request handler), and the
|
|
479
|
+
// tool then reported "released". Until the proper release ships, the tool
|
|
480
|
+
// refuses before anything else: no approval spent, no card, no SAP request.
|
|
481
|
+
const RELEASE_UNAVAILABLE = 'Releasing a transport is not available in this version of CSPeach. '
|
|
482
|
+
+ 'Release it in SE09 or Eclipse. Nothing was sent to SAP.';
|
|
483
483
|
registerTool({
|
|
484
484
|
name: 'sap_transport_release',
|
|
485
|
-
description: '
|
|
486
|
-
+ '
|
|
487
|
-
+ 'Requires approval_id.',
|
|
485
|
+
description: 'Releasing a transport is not available in this version of CSPeach. '
|
|
486
|
+
+ 'This tool sends nothing to SAP; tell the user to release the transport in SE09 or Eclipse.',
|
|
488
487
|
isMutating: true,
|
|
489
488
|
requiresSap: true,
|
|
490
489
|
input_schema: {
|
|
@@ -492,72 +491,21 @@ registerTool({
|
|
|
492
491
|
properties: {
|
|
493
492
|
transport: {
|
|
494
493
|
type: 'string',
|
|
495
|
-
description: 'Transport request number
|
|
494
|
+
description: 'Transport request number (e.g. DEVK900123)',
|
|
496
495
|
},
|
|
497
496
|
approval_id: {
|
|
498
497
|
type: 'string',
|
|
499
|
-
description: 'JWT from request_approval',
|
|
498
|
+
description: 'JWT from request_approval (not used: release is not available)',
|
|
500
499
|
},
|
|
501
500
|
},
|
|
502
|
-
required: ['transport'
|
|
503
|
-
},
|
|
504
|
-
handler: async (args, ctx) => {
|
|
505
|
-
// ── Gate 1: Approval ────────────────────────────────────────────────────
|
|
506
|
-
const verify = await verifyAndSpendApprovalId(args.approval_id, args.transport, 'release');
|
|
507
|
-
if (!verify.ok) {
|
|
508
|
-
return {
|
|
509
|
-
content: JSON.stringify({ error: ERR.APPROVAL_INVALID, reason: verify.reason }),
|
|
510
|
-
is_error: true,
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
const startedAt = Date.now();
|
|
514
|
-
// ── Gate 2: Safety confirmation (Rule 9 — transport release is irreversible) ──
|
|
515
|
-
if (isSafetyConfirmEnabled()) {
|
|
516
|
-
const r = await presentSafetyConfirmation({
|
|
517
|
-
rule: 'RULE_9_TRANSPORT_RELEASE',
|
|
518
|
-
op: 'transport_release',
|
|
519
|
-
object: { type: 'TRANSPORT', name: args.transport },
|
|
520
|
-
what_will_happen: `Releases ${args.transport}; objects move to QA queue, transport becomes immutable.`,
|
|
521
|
-
rollback_available: false,
|
|
522
|
-
transport: args.transport,
|
|
523
|
-
args: { ...args },
|
|
524
|
-
});
|
|
525
|
-
if (!r.confirmed) {
|
|
526
|
-
return {
|
|
527
|
-
content: JSON.stringify({ error: 'cancelled_by_user', reason: r.reason }),
|
|
528
|
-
is_error: true,
|
|
529
|
-
};
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
// ── Release transport ────────────────────────────────────────────────────
|
|
533
|
-
// transportRelease(transportNumber)
|
|
534
|
-
try {
|
|
535
|
-
const result = await ctx.adt.transportRelease(args.transport);
|
|
536
|
-
await auditLog('transportRelease', 'CTS', args.transport, result.status === 'released' ? 'success' : 'error', Date.now() - startedAt);
|
|
537
|
-
if (result.error) {
|
|
538
|
-
return {
|
|
539
|
-
content: JSON.stringify({
|
|
540
|
-
error: 'transport_release_failed',
|
|
541
|
-
detail: result.error,
|
|
542
|
-
status: result.status,
|
|
543
|
-
}),
|
|
544
|
-
is_error: true,
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
return {
|
|
548
|
-
content: JSON.stringify({
|
|
549
|
-
released: result.status === 'released',
|
|
550
|
-
transport_number: result.transportNumber,
|
|
551
|
-
status: result.status,
|
|
552
|
-
}),
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
catch (err) {
|
|
556
|
-
await auditLog('transportRelease', 'CTS', args.transport, 'error', Date.now() - startedAt);
|
|
557
|
-
return {
|
|
558
|
-
content: JSON.stringify({ error: 'transport_release_failed', detail: String(err) }),
|
|
559
|
-
is_error: true,
|
|
560
|
-
};
|
|
561
|
-
}
|
|
501
|
+
required: ['transport'],
|
|
562
502
|
},
|
|
503
|
+
handler: async (args) => ({
|
|
504
|
+
content: JSON.stringify({
|
|
505
|
+
error: 'release_unavailable',
|
|
506
|
+
transport: args.transport,
|
|
507
|
+
message: RELEASE_UNAVAILABLE,
|
|
508
|
+
}),
|
|
509
|
+
is_error: true,
|
|
510
|
+
}),
|
|
563
511
|
});
|
package/package.json
CHANGED
package/.cspeach/project.json
DELETED