@cliniq360/ondc-cli 1.0.1 → 2.0.2

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.
Files changed (46) hide show
  1. package/README.md +29 -18
  2. package/dist/api-client.d.ts +10 -0
  3. package/dist/api-client.d.ts.map +1 -0
  4. package/dist/api-client.js +72 -0
  5. package/dist/api-client.js.map +1 -0
  6. package/dist/commands/config.d.ts.map +1 -1
  7. package/dist/commands/config.js +12 -7
  8. package/dist/commands/config.js.map +1 -1
  9. package/dist/commands/forms.d.ts.map +1 -1
  10. package/dist/commands/forms.js +2 -2
  11. package/dist/commands/forms.js.map +1 -1
  12. package/dist/commands/journey.d.ts.map +1 -1
  13. package/dist/commands/journey.js +1 -1
  14. package/dist/commands/journey.js.map +1 -1
  15. package/dist/commands/offers.js +1 -1
  16. package/dist/commands/orders.d.ts.map +1 -1
  17. package/dist/commands/orders.js +1 -1
  18. package/dist/commands/orders.js.map +1 -1
  19. package/dist/commands/policy.d.ts.map +1 -1
  20. package/dist/commands/policy.js +1 -1
  21. package/dist/commands/policy.js.map +1 -1
  22. package/dist/commands/tools.js +4 -4
  23. package/dist/commands/tools.js.map +1 -1
  24. package/dist/config.d.ts +8 -4
  25. package/dist/config.d.ts.map +1 -1
  26. package/dist/config.js +62 -10
  27. package/dist/config.js.map +1 -1
  28. package/dist/main.js +4 -4
  29. package/dist/main.js.map +1 -1
  30. package/dist/output.d.ts +4 -3
  31. package/dist/output.d.ts.map +1 -1
  32. package/dist/output.js +1 -38
  33. package/dist/output.js.map +1 -1
  34. package/dist/prompts.d.ts +1 -1
  35. package/dist/prompts.d.ts.map +1 -1
  36. package/dist/prompts.js +8 -11
  37. package/dist/prompts.js.map +1 -1
  38. package/dist/tool-registry.d.ts +38 -0
  39. package/dist/tool-registry.d.ts.map +1 -0
  40. package/dist/tool-registry.js +566 -0
  41. package/dist/tool-registry.js.map +1 -0
  42. package/package.json +3 -4
  43. package/dist/mcp-client.d.ts +0 -7
  44. package/dist/mcp-client.d.ts.map +0 -1
  45. package/dist/mcp-client.js +0 -58
  46. package/dist/mcp-client.js.map +0 -1
package/dist/output.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- import type { CallToolResult, Tool } from "@modelcontextprotocol/sdk/types.js";
1
+ import type { CallToolResult } from "./api-client.js";
2
+ import type { ApiToolDefinition } from "./tool-registry.js";
2
3
  type ColumnDef = [key: string, label: string];
3
4
  export declare function outputJson(data: unknown): void;
4
5
  export declare function outputTable(columns: ColumnDef[], rows: Record<string, unknown>[], title?: string): void;
5
6
  export declare function outputDetail(data: Record<string, unknown>, title?: string): void;
6
7
  export declare function outputPretty(data: unknown): void;
7
8
  export declare function outputToolCallResult(result: CallToolResult, asJson: boolean): void;
8
- export declare function toolListRows(tools: Tool[]): Record<string, unknown>[];
9
- export declare function schemaPropertyRows(tool: Tool): Record<string, unknown>[];
9
+ export declare function toolListRows(tools: ApiToolDefinition[]): Record<string, unknown>[];
10
+ export declare function schemaPropertyRows(tool: ApiToolDefinition): Record<string, unknown>[];
10
11
  export {};
11
12
  //# sourceMappingURL=output.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAI/E,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAoB9C,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE9C;AAED,wBAAgB,WAAW,CACzB,OAAO,EAAE,SAAS,EAAE,EACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAC/B,KAAK,CAAC,EAAE,MAAM,GACb,IAAI,CAgBN;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC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AM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAW3B;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,iBAAiB,GACtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAiB3B"}
package/dist/output.js CHANGED
@@ -42,51 +42,14 @@ export function outputPretty(data) {
42
42
  }
43
43
  console.log(JSON.stringify(data, null, 2));
44
44
  }
45
- function summarizeContent(result) {
46
- if (!result.content.length) {
47
- return { ok: !result.isError };
48
- }
49
- if (result.content.length === 1 && result.content[0].type === "text") {
50
- const text = result.content[0].text;
51
- try {
52
- return JSON.parse(text);
53
- }
54
- catch {
55
- return text;
56
- }
57
- }
58
- return result.content.map((block) => {
59
- if (block.type === "text") {
60
- try {
61
- return JSON.parse(block.text);
62
- }
63
- catch {
64
- return block.text;
65
- }
66
- }
67
- if (block.type === "image") {
68
- return { type: "image", mimeType: block.mimeType };
69
- }
70
- if (block.type === "resource") {
71
- return { type: "resource", resource: block.resource };
72
- }
73
- if (block.type === "audio") {
74
- return { type: "audio", mimeType: block.mimeType };
75
- }
76
- return block;
77
- });
78
- }
79
45
  export function outputToolCallResult(result, asJson) {
80
- const payload = summarizeContent(result);
46
+ const payload = result.data;
81
47
  if (asJson) {
82
48
  outputJson(payload);
83
49
  }
84
50
  else {
85
51
  outputPretty(payload);
86
52
  }
87
- if (result.isError) {
88
- process.exit(1);
89
- }
90
53
  }
91
54
  export function toolListRows(tools) {
92
55
  return tools.map((tool) => {
@@ -1 +1 @@
1
- {"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,YAAY,CAAC;AAU/B,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC1C,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAA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const INSURANCE_WORKFLOW_TEMPLATE = "# ONDC Insurance Journey \u2014 Strict Sequential Workflow\n\nYou are an insurance assistant operating through ONDC MCP tools. Execute the\nsteps below in strict order. Never skip, reorder, or parallelize steps. Each\nstep depends on the output of the previous one. Wait for the user to provide\nall required information before calling each tool.\n\nIMPORTANT \u2014 User-driven external steps:\nKYC and Payment happen in an external browser window. Do not poll for their\ncompletion. Wait for the user to tell you they have completed the step, then\nverify once with check-insurance-transaction-status before moving on.\n\nIMPORTANT \u2014 Generative UI (interactive pages):\nSome tools open an interactive UI page for the user (offer selection, final\npolicy). When a tool opens a generative UI, you must stop immediately. Do not\ncall any more tools, ask follow-up questions, or start processing the next\nstep. The user is interacting with the UI directly. You will receive a context\nupdate from the UI when the user completes their action, or the user will send\na chat message to continue. Yield control to the user.\n\nRules\n\nALWAYS:\n- Execute steps strictly one after another. Never jump ahead.\n- Collect all required fields from the user before calling a tool.\n- Store txn_id and offer_item_id from responses. They are needed in every subsequent call.\n- Send boolean values as the strings \"true\" or \"false\".\n- Send all numeric values (amount, pincode, weight, height) as strings.\n- If a step returns form_status: \"Failed\" for a single-member form, stop and inform the user. Do not continue.\n- For family floater submissions, if at least one member succeeded, proceed to the next step but inform the user which members failed.\n- Remember the applicant details from Step 2. You will need them in Step 7 (Buyer Form).\n\nNEVER:\n- Call list-insurance-offers without first calling trigger-insurance-search after form submission.\n- Call list-insurance-offers directly after start-insurance-journey.\n- Call submit-buyer-form before init-insurance-order.\n- Call submit-nominee-form before submit-buyer-form succeeds.\n- Call confirm-insurance-order before the user confirms payment is complete.\n- Guess or fabricate user data.\n- Use submit-applicant-form when there are multiple members. Use submit-family-floater-form instead.\n- Skip trigger-insurance-search after form submission.\n- Poll in a loop for KYC or Payment status.\n- Call additional tools after opening a generative UI.\n\nStrict Tool Execution Order\n\n1. start-insurance-journey -> save txn_id\n2. submit-applicant-form OR submit-family-floater-form\n3. trigger-insurance-search -> verify ack\n4. list-insurance-offers -> stop for generative UI or continue via chat\n5. select-insurance-offer -> save offer_item_id if chat path\n6. get-insurance-form-url (KYC) -> wait for user\n7. check-insurance-transaction-status -> verify KYC approved\n8. init-insurance-order\n9. check-insurance-transaction-status -> confirm ON_INIT_BUYER_FORM\n10. submit-buyer-form\n11. init-insurance-order\n12. check-insurance-transaction-status -> confirm ON_INIT_NOMINEE\n13. submit-nominee-form\n14. get-insurance-form-url (PAYMENT) -> wait for user\n15. check-insurance-transaction-status -> verify PAYMENT_APPROVED\n16. confirm-insurance-order\n17. fetch-insurance-order-status\n18. send-insurance-notification (optional)\n\nCritical gates\n\n- After applicant submission, trigger-insurance-search is mandatory.\n- After KYC completion, verify status once before init.\n- After first init, verify current_action == ON_INIT_BUYER_FORM.\n- After second init, verify current_action == ON_INIT_NOMINEE.\n- After payment completion, verify payment approval before confirm.\n\nReference symbol: INSURANCE_WORKFLOW_TEMPLATE";
1
+ export declare const INSURANCE_WORKFLOW_TEMPLATE = "# ONDC Insurance Journey \u2014 Strict Sequential Workflow\n\nYou are an insurance assistant operating through the ONDC insurance CLI and direct API tools. Execute the\nsteps below in strict order. Never skip, reorder, or parallelize steps. Each\nstep depends on the output of the previous one. Wait for the user to provide\nall required information before calling each tool.\n\nIMPORTANT \u2014 User-driven external steps:\nKYC and Payment happen in an external browser window. Do not poll for their\ncompletion. Wait for the user to tell you they have completed the step, then\nverify once with check-insurance-transaction-status before moving on.\n\nIMPORTANT \u2014 User handoff steps:\nOffer review, KYC, and payment may require the user to inspect a response or\ncomplete work outside the CLI. When that happens, stop and wait for user input\nbefore continuing.\n\nRules\n\nALWAYS:\n- Execute steps strictly one after another. Never jump ahead.\n- Collect all required fields from the user before calling a tool.\n- Store txn_id and offer_item_id from responses. They are needed in every subsequent call.\n- Send boolean values as the strings \"true\" or \"false\".\n- Send all numeric values (amount, pincode, weight, height) as strings.\n- If a step returns form_status: \"Failed\" for a single-member form, stop and inform the user. Do not continue.\n- For family floater submissions, if at least one member succeeded, proceed to the next step but inform the user which members failed.\n- Remember the applicant details from Step 2. You will need them in Step 7 (Buyer Form).\n\nNEVER:\n- Call list-insurance-offers without first calling trigger-insurance-search after form submission.\n- Call list-insurance-offers directly after start-insurance-journey.\n- Call submit-buyer-form before init-insurance-order.\n- Call submit-nominee-form before submit-buyer-form succeeds.\n- Call confirm-insurance-order before the user confirms payment is complete.\n- Guess or fabricate user data.\n- Use submit-applicant-form when there are multiple members. Use submit-family-floater-form instead.\n- Skip trigger-insurance-search after form submission.\n- Poll in a loop for KYC or Payment status.\n- Continue automatically when the user still needs to review a response or complete an external step.\n\nStrict Tool Execution Order\n\n1. start-insurance-journey -> save txn_id\n2. submit-applicant-form OR submit-family-floater-form\n3. trigger-insurance-search -> verify ack\n4. list-insurance-offers -> stop for user review and selection\n5. select-insurance-offer -> save offer_item_id\n6. get-insurance-form-url (KYC) -> wait for user\n7. check-insurance-transaction-status -> verify KYC approved\n8. init-insurance-order\n9. check-insurance-transaction-status -> confirm ON_INIT_BUYER_FORM\n10. submit-buyer-form\n11. init-insurance-order\n12. check-insurance-transaction-status -> confirm ON_INIT_NOMINEE\n13. submit-nominee-form\n14. get-insurance-form-url (PAYMENT) -> wait for user\n15. check-insurance-transaction-status -> verify PAYMENT_APPROVED\n16. confirm-insurance-order\n17. fetch-insurance-order-status\n18. send-insurance-notification (optional)\n\nCritical gates\n\n- After applicant submission, trigger-insurance-search is mandatory.\n- After KYC completion, verify status once before init.\n- After first init, verify current_action == ON_INIT_BUYER_FORM.\n- After second init, verify current_action == ON_INIT_NOMINEE.\n- After payment completion, verify payment approval before confirm.\n\nReference symbol: INSURANCE_WORKFLOW_TEMPLATE";
2
2
  //# sourceMappingURL=prompts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,ktHAyEM,CAAC"}
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,2+GAsEM,CAAC"}
package/dist/prompts.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export const INSURANCE_WORKFLOW_TEMPLATE = `# ONDC Insurance Journey — Strict Sequential Workflow
2
2
 
3
- You are an insurance assistant operating through ONDC MCP tools. Execute the
3
+ You are an insurance assistant operating through the ONDC insurance CLI and direct API tools. Execute the
4
4
  steps below in strict order. Never skip, reorder, or parallelize steps. Each
5
5
  step depends on the output of the previous one. Wait for the user to provide
6
6
  all required information before calling each tool.
@@ -10,13 +10,10 @@ KYC and Payment happen in an external browser window. Do not poll for their
10
10
  completion. Wait for the user to tell you they have completed the step, then
11
11
  verify once with check-insurance-transaction-status before moving on.
12
12
 
13
- IMPORTANT — Generative UI (interactive pages):
14
- Some tools open an interactive UI page for the user (offer selection, final
15
- policy). When a tool opens a generative UI, you must stop immediately. Do not
16
- call any more tools, ask follow-up questions, or start processing the next
17
- step. The user is interacting with the UI directly. You will receive a context
18
- update from the UI when the user completes their action, or the user will send
19
- a chat message to continue. Yield control to the user.
13
+ IMPORTANT — User handoff steps:
14
+ Offer review, KYC, and payment may require the user to inspect a response or
15
+ complete work outside the CLI. When that happens, stop and wait for user input
16
+ before continuing.
20
17
 
21
18
  Rules
22
19
 
@@ -40,15 +37,15 @@ NEVER:
40
37
  - Use submit-applicant-form when there are multiple members. Use submit-family-floater-form instead.
41
38
  - Skip trigger-insurance-search after form submission.
42
39
  - Poll in a loop for KYC or Payment status.
43
- - Call additional tools after opening a generative UI.
40
+ - Continue automatically when the user still needs to review a response or complete an external step.
44
41
 
45
42
  Strict Tool Execution Order
46
43
 
47
44
  1. start-insurance-journey -> save txn_id
48
45
  2. submit-applicant-form OR submit-family-floater-form
49
46
  3. trigger-insurance-search -> verify ack
50
- 4. list-insurance-offers -> stop for generative UI or continue via chat
51
- 5. select-insurance-offer -> save offer_item_id if chat path
47
+ 4. list-insurance-offers -> stop for user review and selection
48
+ 5. select-insurance-offer -> save offer_item_id
52
49
  6. get-insurance-form-url (KYC) -> wait for user
53
50
  7. check-insurance-transaction-status -> verify KYC approved
54
51
  8. init-insurance-order
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CAyEG,CAAC"}
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CAsEG,CAAC"}
@@ -0,0 +1,38 @@
1
+ type ToolAnnotations = {
2
+ readOnlyHint?: boolean;
3
+ destructiveHint?: boolean;
4
+ openWorldHint?: boolean;
5
+ };
6
+ type SchemaValueType = "string" | "number" | "boolean" | "object" | "array";
7
+ type ToolSchemaProperty = {
8
+ type: SchemaValueType;
9
+ description?: string;
10
+ default?: string | number | boolean;
11
+ items?: {
12
+ type: Exclude<SchemaValueType, "array">;
13
+ };
14
+ };
15
+ export type ToolInputSchema = {
16
+ type: "object";
17
+ properties: Record<string, ToolSchemaProperty>;
18
+ required?: string[];
19
+ };
20
+ export type ApiToolDefinition = {
21
+ name: string;
22
+ title: string;
23
+ description: string;
24
+ inputSchema: ToolInputSchema;
25
+ annotations?: ToolAnnotations;
26
+ };
27
+ type ApiClient = {
28
+ get<T = unknown>(endpoint: string, query?: Record<string, string | number | boolean | undefined>): Promise<T>;
29
+ post<T = unknown>(endpoint: string, query?: Record<string, string | number | boolean | undefined>, body?: unknown): Promise<T>;
30
+ };
31
+ type RegisteredToolDefinition = ApiToolDefinition & {
32
+ execute: (client: ApiClient, args: Record<string, unknown>) => Promise<unknown>;
33
+ };
34
+ export declare function listToolDefinitions(): ApiToolDefinition[];
35
+ export declare function getToolDefinition(name: string): ApiToolDefinition | undefined;
36
+ export declare function getRegisteredTool(name: string): RegisteredToolDefinition | undefined;
37
+ export {};
38
+ //# sourceMappingURL=tool-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../src/tool-registry.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,KAAK,eAAe,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE5E,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,eAAe,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACpC,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC/C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,eAAe,CAAC;IAC7B,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,GAAG,CAAC,CAAC,GAAG,OAAO,EACb,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,CAAC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