feat(planning): grille hebdomadaire complète avec API et filtres
- Connexion API via proxy Angular (résolution CORS, base path /api) - Import CSS ng-zorro global pour les modales et composants - Filtres Camion/Show câblés sur l'affichage de la grille - Camions affichés via TrucksService (linkés au show du même créneau) - Panneau de détails : spectacles + camions du jour sélectionné - Modale de création de spectacle stylisée avec fond et centrage - Positionnement précis des events à la minute dans leur créneau - Auto-scroll vers l'heure courante au chargement - Ligne "maintenant" sur la colonne du jour actuel - Régénération des services OpenAPI (nouveaux noms de types) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Generated
Vendored
+29
-104
@@ -1,11 +1,14 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const index_js_1 = require("../../client/index.js");
|
||||
const streamableHttp_js_1 = require("../../client/streamableHttp.js");
|
||||
const node_readline_1 = require("node:readline");
|
||||
const types_js_1 = require("../../types.js");
|
||||
const metadataUtils_js_1 = require("../../shared/metadataUtils.js");
|
||||
const ajv_1 = require("ajv");
|
||||
const ajv_1 = __importDefault(require("ajv"));
|
||||
// Create readline interface for user input
|
||||
const readline = (0, node_readline_1.createInterface)({
|
||||
input: process.stdin,
|
||||
@@ -36,10 +39,9 @@ function printHelp() {
|
||||
console.log(' reconnect - Reconnect to the server');
|
||||
console.log(' list-tools - List available tools');
|
||||
console.log(' call-tool <name> [args] - Call a tool with optional JSON arguments');
|
||||
console.log(' call-tool-task <name> [args] - Call a tool with task-based execution (example: call-tool-task delay {"duration":3000})');
|
||||
console.log(' greet [name] - Call the greet tool');
|
||||
console.log(' multi-greet [name] - Call the multi-greet tool with notifications');
|
||||
console.log(' collect-info [type] - Test form elicitation with collect-user-info tool (contact/preferences/feedback)');
|
||||
console.log(' collect-info [type] - Test elicitation with collect-user-info tool (contact/preferences/feedback)');
|
||||
console.log(' start-notifications [interval] [count] - Start periodic notifications');
|
||||
console.log(' run-notifications-tool-with-resumability [interval] [count] - Run notification tool with resumability');
|
||||
console.log(' list-prompts - List available prompts');
|
||||
@@ -51,8 +53,9 @@ function printHelp() {
|
||||
}
|
||||
function commandLoop() {
|
||||
readline.question('\n> ', async (input) => {
|
||||
var _a;
|
||||
const args = input.trim().split(/\s+/);
|
||||
const command = args[0]?.toLowerCase();
|
||||
const command = (_a = args[0]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
||||
try {
|
||||
switch (command) {
|
||||
case 'connect':
|
||||
@@ -81,7 +84,7 @@ function commandLoop() {
|
||||
try {
|
||||
toolArgs = JSON.parse(args.slice(2).join(' '));
|
||||
}
|
||||
catch {
|
||||
catch (_b) {
|
||||
console.log('Invalid JSON arguments. Using empty args.');
|
||||
}
|
||||
}
|
||||
@@ -109,24 +112,6 @@ function commandLoop() {
|
||||
await runNotificationsToolWithResumability(interval, count);
|
||||
break;
|
||||
}
|
||||
case 'call-tool-task':
|
||||
if (args.length < 2) {
|
||||
console.log('Usage: call-tool-task <name> [args]');
|
||||
}
|
||||
else {
|
||||
const toolName = args[1];
|
||||
let toolArgs = {};
|
||||
if (args.length > 2) {
|
||||
try {
|
||||
toolArgs = JSON.parse(args.slice(2).join(' '));
|
||||
}
|
||||
catch {
|
||||
console.log('Invalid JSON arguments. Using empty args.');
|
||||
}
|
||||
}
|
||||
await callToolTask(toolName, toolArgs);
|
||||
}
|
||||
break;
|
||||
case 'list-prompts':
|
||||
await listPrompts();
|
||||
break;
|
||||
@@ -141,7 +126,7 @@ function commandLoop() {
|
||||
try {
|
||||
promptArgs = JSON.parse(args.slice(2).join(' '));
|
||||
}
|
||||
catch {
|
||||
catch (_c) {
|
||||
console.log('Invalid JSON arguments. Using empty args.');
|
||||
}
|
||||
}
|
||||
@@ -190,35 +175,30 @@ async function connect(url) {
|
||||
}
|
||||
console.log(`Connecting to ${serverUrl}...`);
|
||||
try {
|
||||
// Create a new client with form elicitation capability
|
||||
// Create a new client with elicitation capability
|
||||
client = new index_js_1.Client({
|
||||
name: 'example-client',
|
||||
version: '1.0.0'
|
||||
}, {
|
||||
capabilities: {
|
||||
elicitation: {
|
||||
form: {}
|
||||
}
|
||||
}
|
||||
elicitation: {},
|
||||
},
|
||||
});
|
||||
client.onerror = error => {
|
||||
client.onerror = (error) => {
|
||||
console.error('\x1b[31mClient error:', error, '\x1b[0m');
|
||||
};
|
||||
// Set up elicitation request handler with proper validation
|
||||
client.setRequestHandler(types_js_1.ElicitRequestSchema, async (request) => {
|
||||
if (request.params.mode !== 'form') {
|
||||
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Unsupported elicitation mode: ${request.params.mode}`);
|
||||
}
|
||||
console.log('\n🔔 Elicitation (form) Request Received:');
|
||||
var _a;
|
||||
console.log('\n🔔 Elicitation Request Received:');
|
||||
console.log(`Message: ${request.params.message}`);
|
||||
console.log(`Related Task: ${request.params._meta?.[types_js_1.RELATED_TASK_META_KEY]?.taskId}`);
|
||||
console.log('Requested Schema:');
|
||||
console.log(JSON.stringify(request.params.requestedSchema, null, 2));
|
||||
const schema = request.params.requestedSchema;
|
||||
const properties = schema.properties;
|
||||
const required = schema.required || [];
|
||||
// Set up AJV validator for the requested schema
|
||||
const ajv = new ajv_1.Ajv();
|
||||
const ajv = new ajv_1.default();
|
||||
const validate = ajv.compile(schema);
|
||||
let attempts = 0;
|
||||
const maxAttempts = 3;
|
||||
@@ -260,8 +240,8 @@ async function connect(url) {
|
||||
prompt += ` [default: ${field.default}]`;
|
||||
}
|
||||
prompt += ': ';
|
||||
const answer = await new Promise(resolve => {
|
||||
readline.question(prompt, input => {
|
||||
const answer = await new Promise((resolve) => {
|
||||
readline.question(prompt, (input) => {
|
||||
resolve(input.trim());
|
||||
});
|
||||
});
|
||||
@@ -322,8 +302,7 @@ async function connect(url) {
|
||||
return { action: 'cancel' };
|
||||
}
|
||||
// If we didn't complete all fields due to an error, try again
|
||||
if (Object.keys(content).length !==
|
||||
Object.keys(properties).filter(name => required.includes(name) || content[name] !== undefined).length) {
|
||||
if (Object.keys(content).length !== Object.keys(properties).filter(name => required.includes(name) || content[name] !== undefined).length) {
|
||||
if (attempts < maxAttempts) {
|
||||
console.log('Please try again...');
|
||||
continue;
|
||||
@@ -337,8 +316,8 @@ async function connect(url) {
|
||||
const isValid = validate(content);
|
||||
if (!isValid) {
|
||||
console.log('❌ Validation errors:');
|
||||
validate.errors?.forEach(error => {
|
||||
console.log(` - ${error.instancePath || 'root'}: ${error.message}`);
|
||||
(_a = validate.errors) === null || _a === void 0 ? void 0 : _a.forEach(error => {
|
||||
console.log(` - ${error.dataPath || 'root'}: ${error.message}`);
|
||||
});
|
||||
if (attempts < maxAttempts) {
|
||||
console.log('Please correct the errors and try again...');
|
||||
@@ -352,15 +331,15 @@ async function connect(url) {
|
||||
// Show the collected data and ask for confirmation
|
||||
console.log('\n✅ Collected data:');
|
||||
console.log(JSON.stringify(content, null, 2));
|
||||
const confirmAnswer = await new Promise(resolve => {
|
||||
readline.question('\nSubmit this information? (yes/no/cancel): ', input => {
|
||||
const confirmAnswer = await new Promise((resolve) => {
|
||||
readline.question('\nSubmit this information? (yes/no/cancel): ', (input) => {
|
||||
resolve(input.trim().toLowerCase());
|
||||
});
|
||||
});
|
||||
if (confirmAnswer === 'yes' || confirmAnswer === 'y') {
|
||||
return {
|
||||
action: 'accept',
|
||||
content
|
||||
content,
|
||||
};
|
||||
}
|
||||
else if (confirmAnswer === 'cancel' || confirmAnswer === 'c') {
|
||||
@@ -383,7 +362,7 @@ async function connect(url) {
|
||||
sessionId: sessionId
|
||||
});
|
||||
// Set up notification handlers
|
||||
client.setNotificationHandler(types_js_1.LoggingMessageNotificationSchema, notification => {
|
||||
client.setNotificationHandler(types_js_1.LoggingMessageNotificationSchema, (notification) => {
|
||||
notificationCount++;
|
||||
console.log(`\nNotification #${notificationCount}: ${notification.params.level} - ${notification.params.data}`);
|
||||
// Re-display the prompt
|
||||
@@ -402,7 +381,7 @@ async function connect(url) {
|
||||
}, types_js_1.ListResourcesResultSchema);
|
||||
console.log('Available resources count:', resourcesResult.resources.length);
|
||||
}
|
||||
catch {
|
||||
catch (_a) {
|
||||
console.log('Failed to list resources after change notification');
|
||||
}
|
||||
// Re-display the prompt
|
||||
@@ -557,7 +536,7 @@ async function callMultiGreetTool(name) {
|
||||
await callTool('multi-greet', { name });
|
||||
}
|
||||
async function callCollectInfoTool(infoType) {
|
||||
console.log(`Testing form elicitation with collect-user-info tool (${infoType})...`);
|
||||
console.log(`Testing elicitation with collect-user-info tool (${infoType})...`);
|
||||
await callTool('collect-user-info', { infoType });
|
||||
}
|
||||
async function startNotifications(interval, count) {
|
||||
@@ -642,7 +621,7 @@ async function getPrompt(name, args) {
|
||||
const promptResult = await client.request(promptRequest, types_js_1.GetPromptResultSchema);
|
||||
console.log('Prompt template:');
|
||||
promptResult.messages.forEach((msg, index) => {
|
||||
console.log(` [${index + 1}] ${msg.role}: ${msg.content.type === 'text' ? msg.content.text : JSON.stringify(msg.content)}`);
|
||||
console.log(` [${index + 1}] ${msg.role}: ${msg.content.text}`);
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
@@ -695,10 +674,7 @@ async function readResource(uri) {
|
||||
if ('text' in content && typeof content.text === 'string') {
|
||||
console.log(' Content:');
|
||||
console.log(' ---');
|
||||
console.log(content.text
|
||||
.split('\n')
|
||||
.map((line) => ' ' + line)
|
||||
.join('\n'));
|
||||
console.log(content.text.split('\n').map((line) => ' ' + line).join('\n'));
|
||||
console.log(' ---');
|
||||
}
|
||||
else if ('blob' in content && typeof content.blob === 'string') {
|
||||
@@ -710,57 +686,6 @@ async function readResource(uri) {
|
||||
console.log(`Error reading resource ${uri}: ${error}`);
|
||||
}
|
||||
}
|
||||
async function callToolTask(name, args) {
|
||||
if (!client) {
|
||||
console.log('Not connected to server.');
|
||||
return;
|
||||
}
|
||||
console.log(`Calling tool '${name}' with task-based execution...`);
|
||||
console.log('Arguments:', args);
|
||||
// Use task-based execution - call now, fetch later
|
||||
// Using the experimental tasks API - WARNING: may change without notice
|
||||
console.log('This will return immediately while processing continues in the background...');
|
||||
try {
|
||||
// Call the tool with task metadata using streaming API
|
||||
const stream = client.experimental.tasks.callToolStream({
|
||||
name,
|
||||
arguments: args
|
||||
}, types_js_1.CallToolResultSchema, {
|
||||
task: {
|
||||
ttl: 60000 // Keep results for 60 seconds
|
||||
}
|
||||
});
|
||||
console.log('Waiting for task completion...');
|
||||
let lastStatus = '';
|
||||
for await (const message of stream) {
|
||||
switch (message.type) {
|
||||
case 'taskCreated':
|
||||
console.log('Task created successfully with ID:', message.task.taskId);
|
||||
break;
|
||||
case 'taskStatus':
|
||||
if (lastStatus !== message.task.status) {
|
||||
console.log(` ${message.task.status}${message.task.statusMessage ? ` - ${message.task.statusMessage}` : ''}`);
|
||||
}
|
||||
lastStatus = message.task.status;
|
||||
break;
|
||||
case 'result':
|
||||
console.log('Task completed!');
|
||||
console.log('Tool result:');
|
||||
message.result.content.forEach(item => {
|
||||
if (item.type === 'text') {
|
||||
console.log(` ${item.text}`);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'error':
|
||||
throw message.error;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.log(`Error with task-based execution: ${error}`);
|
||||
}
|
||||
}
|
||||
async function cleanup() {
|
||||
if (client && transport) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user