@zivis/mcp 0.1.0-alpha.21 → 0.1.0-alpha.22

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 (175) hide show
  1. package/dist/pattern-pack/index.d.ts +133 -0
  2. package/dist/pattern-pack/index.js +212 -0
  3. package/dist/pattern-pack/index.js.map +1 -0
  4. package/dist/pattern-packs/zivis-public-0.1.0/capsules/agents/privilege-separation.yaml +228 -0
  5. package/dist/pattern-packs/zivis-public-0.1.0/capsules/prompting/self-consistency-no-isolation.yaml +240 -0
  6. package/dist/pattern-packs/zivis-public-0.1.0/capsules/security/late-org-filter.yaml +270 -0
  7. package/dist/pattern-packs/zivis-public-0.1.0/manifest.json +68 -0
  8. package/dist/pattern-packs/zivis-public-0.1.0/prompts/agents/privilege-separation/identify.md +54 -0
  9. package/dist/pattern-packs/zivis-public-0.1.0/prompts/prompting/self-consistency-no-isolation/identify.md +60 -0
  10. package/dist/pattern-packs/zivis-public-0.1.0/prompts/security/late-org-filter/identify.md +78 -0
  11. package/dist/prompts/index.d.ts +1 -1
  12. package/dist/prompts/index.js +1 -7
  13. package/dist/prompts/index.js.map +1 -1
  14. package/dist/server.js +26 -166
  15. package/dist/server.js.map +1 -1
  16. package/dist/tools/enterprise/get-threat-model-artifact.d.ts +30 -0
  17. package/dist/tools/enterprise/get-threat-model-artifact.js +80 -0
  18. package/dist/tools/enterprise/get-threat-model-artifact.js.map +1 -0
  19. package/dist/tools/enterprise/get-threat-model.d.ts +1 -1
  20. package/dist/tools/enterprise/get-threat-model.js +59 -11
  21. package/dist/tools/enterprise/get-threat-model.js.map +1 -1
  22. package/dist/tools/enterprise/list-threat-model-artifacts.d.ts +67 -0
  23. package/dist/tools/enterprise/list-threat-model-artifacts.js +121 -0
  24. package/dist/tools/enterprise/list-threat-model-artifacts.js.map +1 -0
  25. package/dist/tools/enterprise/manage-data-asset.d.ts +1 -1
  26. package/dist/tools/enterprise/manage-data-flow.d.ts +1 -1
  27. package/dist/tools/enterprise/manage-test-case.d.ts +1 -1
  28. package/dist/tools/inspect.d.ts +31 -0
  29. package/dist/tools/inspect.js +100 -0
  30. package/dist/tools/inspect.js.map +1 -0
  31. package/dist/tools/manage-application.d.ts +1 -1
  32. package/dist/tools/security-review.js +67 -50
  33. package/dist/tools/security-review.js.map +1 -1
  34. package/dist/tools/threat-get-capsule.d.ts +25 -0
  35. package/dist/tools/threat-get-capsule.js +64 -0
  36. package/dist/tools/threat-get-capsule.js.map +1 -0
  37. package/dist/tools/threat-get-inference-prompt.d.ts +32 -0
  38. package/dist/tools/threat-get-inference-prompt.js +91 -0
  39. package/dist/tools/threat-get-inference-prompt.js.map +1 -0
  40. package/dist/tools/threat-list-relevant-capsules.d.ts +30 -0
  41. package/dist/tools/threat-list-relevant-capsules.js +176 -0
  42. package/dist/tools/threat-list-relevant-capsules.js.map +1 -0
  43. package/package.json +10 -3
  44. package/dist/prompts/prep-for-launch.d.ts +0 -9
  45. package/dist/prompts/prep-for-launch.js +0 -62
  46. package/dist/prompts/prep-for-launch.js.map +0 -1
  47. package/dist/prompts/secure-my-app.d.ts +0 -9
  48. package/dist/prompts/secure-my-app.js +0 -70
  49. package/dist/prompts/secure-my-app.js.map +0 -1
  50. package/dist/prompts/weekly-check.d.ts +0 -9
  51. package/dist/prompts/weekly-check.js +0 -48
  52. package/dist/prompts/weekly-check.js.map +0 -1
  53. package/dist/tools/enterprise/capture-evidence.d.ts +0 -54
  54. package/dist/tools/enterprise/capture-evidence.js +0 -72
  55. package/dist/tools/enterprise/capture-evidence.js.map +0 -1
  56. package/dist/tools/enterprise/create-report-ticket.d.ts +0 -34
  57. package/dist/tools/enterprise/create-report-ticket.js +0 -44
  58. package/dist/tools/enterprise/create-report-ticket.js.map +0 -1
  59. package/dist/tools/enterprise/end-pentest-session.d.ts +0 -33
  60. package/dist/tools/enterprise/end-pentest-session.js +0 -42
  61. package/dist/tools/enterprise/end-pentest-session.js.map +0 -1
  62. package/dist/tools/enterprise/generate-report.d.ts +0 -55
  63. package/dist/tools/enterprise/generate-report.js +0 -111
  64. package/dist/tools/enterprise/generate-report.js.map +0 -1
  65. package/dist/tools/enterprise/get-campaign.d.ts +0 -27
  66. package/dist/tools/enterprise/get-campaign.js +0 -31
  67. package/dist/tools/enterprise/get-campaign.js.map +0 -1
  68. package/dist/tools/enterprise/get-report-status.d.ts +0 -27
  69. package/dist/tools/enterprise/get-report-status.js +0 -38
  70. package/dist/tools/enterprise/get-report-status.js.map +0 -1
  71. package/dist/tools/enterprise/list-agents.d.ts +0 -42
  72. package/dist/tools/enterprise/list-agents.js +0 -95
  73. package/dist/tools/enterprise/list-agents.js.map +0 -1
  74. package/dist/tools/enterprise/list-campaigns.d.ts +0 -37
  75. package/dist/tools/enterprise/list-campaigns.js +0 -60
  76. package/dist/tools/enterprise/list-campaigns.js.map +0 -1
  77. package/dist/tools/enterprise/list-report-issues.d.ts +0 -36
  78. package/dist/tools/enterprise/list-report-issues.js +0 -50
  79. package/dist/tools/enterprise/list-report-issues.js.map +0 -1
  80. package/dist/tools/enterprise/manage-campaign-agent-instance.d.ts +0 -42
  81. package/dist/tools/enterprise/manage-campaign-agent-instance.js +0 -68
  82. package/dist/tools/enterprise/manage-campaign-agent-instance.js.map +0 -1
  83. package/dist/tools/enterprise/manage-campaign-target.d.ts +0 -44
  84. package/dist/tools/enterprise/manage-campaign-target.js +0 -70
  85. package/dist/tools/enterprise/manage-campaign-target.js.map +0 -1
  86. package/dist/tools/enterprise/manage-campaign.d.ts +0 -62
  87. package/dist/tools/enterprise/manage-campaign.js +0 -114
  88. package/dist/tools/enterprise/manage-campaign.js.map +0 -1
  89. package/dist/tools/enterprise/manage-finding.d.ts +0 -69
  90. package/dist/tools/enterprise/manage-finding.js +0 -106
  91. package/dist/tools/enterprise/manage-finding.js.map +0 -1
  92. package/dist/tools/enterprise/promote-finding-to-issue.d.ts +0 -36
  93. package/dist/tools/enterprise/promote-finding-to-issue.js +0 -65
  94. package/dist/tools/enterprise/promote-finding-to-issue.js.map +0 -1
  95. package/dist/tools/enterprise/publish-report-version.d.ts +0 -34
  96. package/dist/tools/enterprise/publish-report-version.js +0 -75
  97. package/dist/tools/enterprise/publish-report-version.js.map +0 -1
  98. package/dist/tools/enterprise/publish-test-to-library.d.ts +0 -31
  99. package/dist/tools/enterprise/publish-test-to-library.js +0 -40
  100. package/dist/tools/enterprise/publish-test-to-library.js.map +0 -1
  101. package/dist/tools/enterprise/record-test-result.d.ts +0 -67
  102. package/dist/tools/enterprise/record-test-result.js +0 -75
  103. package/dist/tools/enterprise/record-test-result.js.map +0 -1
  104. package/dist/tools/enterprise/start-pentest-session.d.ts +0 -35
  105. package/dist/tools/enterprise/start-pentest-session.js +0 -50
  106. package/dist/tools/enterprise/start-pentest-session.js.map +0 -1
  107. package/dist/tools/enterprise/sync-report-section.d.ts +0 -41
  108. package/dist/tools/enterprise/sync-report-section.js +0 -79
  109. package/dist/tools/enterprise/sync-report-section.js.map +0 -1
  110. package/dist/tools/enterprise/update-report-issue.d.ts +0 -55
  111. package/dist/tools/enterprise/update-report-issue.js +0 -69
  112. package/dist/tools/enterprise/update-report-issue.js.map +0 -1
  113. package/dist/tools/get-agent-test-results.d.ts +0 -41
  114. package/dist/tools/get-agent-test-results.js +0 -86
  115. package/dist/tools/get-agent-test-results.js.map +0 -1
  116. package/dist/tools/get-application-auth-config.d.ts +0 -27
  117. package/dist/tools/get-application-auth-config.js +0 -44
  118. package/dist/tools/get-application-auth-config.js.map +0 -1
  119. package/dist/tools/get-artifact-content.d.ts +0 -29
  120. package/dist/tools/get-artifact-content.js +0 -86
  121. package/dist/tools/get-artifact-content.js.map +0 -1
  122. package/dist/tools/get-finding-details.d.ts +0 -22
  123. package/dist/tools/get-finding-details.js +0 -61
  124. package/dist/tools/get-finding-details.js.map +0 -1
  125. package/dist/tools/get-findings.d.ts +0 -51
  126. package/dist/tools/get-findings.js +0 -124
  127. package/dist/tools/get-findings.js.map +0 -1
  128. package/dist/tools/get-recon-scan.d.ts +0 -27
  129. package/dist/tools/get-recon-scan.js +0 -46
  130. package/dist/tools/get-recon-scan.js.map +0 -1
  131. package/dist/tools/get-scan-output.d.ts +0 -27
  132. package/dist/tools/get-scan-output.js +0 -64
  133. package/dist/tools/get-scan-output.js.map +0 -1
  134. package/dist/tools/get-scenario-details.d.ts +0 -27
  135. package/dist/tools/get-scenario-details.js +0 -46
  136. package/dist/tools/get-scenario-details.js.map +0 -1
  137. package/dist/tools/get-test-case-results.d.ts +0 -37
  138. package/dist/tools/get-test-case-results.js +0 -66
  139. package/dist/tools/get-test-case-results.js.map +0 -1
  140. package/dist/tools/get-test-details.d.ts +0 -29
  141. package/dist/tools/get-test-details.js +0 -49
  142. package/dist/tools/get-test-details.js.map +0 -1
  143. package/dist/tools/list-agent-test-cases.d.ts +0 -41
  144. package/dist/tools/list-agent-test-cases.js +0 -73
  145. package/dist/tools/list-agent-test-cases.js.map +0 -1
  146. package/dist/tools/list-recon-scans.d.ts +0 -36
  147. package/dist/tools/list-recon-scans.js +0 -74
  148. package/dist/tools/list-recon-scans.js.map +0 -1
  149. package/dist/tools/list-scan-artifacts.d.ts +0 -41
  150. package/dist/tools/list-scan-artifacts.js +0 -63
  151. package/dist/tools/list-scan-artifacts.js.map +0 -1
  152. package/dist/tools/list-scans.d.ts +0 -38
  153. package/dist/tools/list-scans.js +0 -125
  154. package/dist/tools/list-scans.js.map +0 -1
  155. package/dist/tools/list-test-library.d.ts +0 -44
  156. package/dist/tools/list-test-library.js +0 -83
  157. package/dist/tools/list-test-library.js.map +0 -1
  158. package/dist/tools/list-test-scenarios.d.ts +0 -25
  159. package/dist/tools/list-test-scenarios.js +0 -94
  160. package/dist/tools/list-test-scenarios.js.map +0 -1
  161. package/dist/tools/local-scan.d.ts +0 -40
  162. package/dist/tools/local-scan.js +0 -261
  163. package/dist/tools/local-scan.js.map +0 -1
  164. package/dist/tools/run-test-scenario.d.ts +0 -37
  165. package/dist/tools/run-test-scenario.js +0 -70
  166. package/dist/tools/run-test-scenario.js.map +0 -1
  167. package/dist/tools/scan-pr.d.ts +0 -27
  168. package/dist/tools/scan-pr.js +0 -51
  169. package/dist/tools/scan-pr.js.map +0 -1
  170. package/dist/tools/setup-red-team-target.d.ts +0 -73
  171. package/dist/tools/setup-red-team-target.js +0 -461
  172. package/dist/tools/setup-red-team-target.js.map +0 -1
  173. package/dist/tools/triage-finding.d.ts +0 -41
  174. package/dist/tools/triage-finding.js +0 -125
  175. package/dist/tools/triage-finding.js.map +0 -1
@@ -6,7 +6,7 @@
6
6
  import { z } from "zod";
7
7
  import type { ApiClient } from "../../api-client.js";
8
8
  export declare const GET_THREAT_MODEL_NAME = "zivis_get_threat_model";
9
- export declare const GET_THREAT_MODEL_DESCRIPTION = "Get a threat model with ALL its entities \u2014 actors, components, data flows, attack scenarios, security controls, data assets, test cases, findings, AND any linked diagrams.\n\nReturns the complete threat model including:\n- **Actors**: Who interacts with the system (external users, attackers, internal services)\n- **Components**: System parts (APIs, databases, frontends, services) with technology and trust level\n- **Data Flows**: How data moves between components (protocol, encryption, auth mechanism)\n- **Attack Scenarios**: STRIDE-categorized threats with severity, likelihood, attack vectors\n- **Security Controls**: Existing mitigations (preventive, detective, corrective) with effectiveness\n- **Data Assets**: What sensitive data exists and how it's classified\n- **Test Cases**: Security tests with results (pass/fail/partial/not_tested)\n- **Findings**: Discovered vulnerabilities with severity and remediation recommendations\n- **Linked Diagrams**: Architecture, data flow, trust boundary, and other diagrams associated with this threat model\n\nIMPORTANT: The threat_model_id must be a threat model UUID from zivis_list_threat_models, NOT a scan ID or agent instance ID.\n\nUse this to understand the full security posture before making changes, adding entities, or running pen tests.\nAfter viewing, use zivis_manage_actor, zivis_manage_component, zivis_manage_data_flow, etc. to add or update entities.\nUse zivis_get_diagram with a diagram_id from the linked_diagrams to view full diagram details (nodes, connections, boundaries).";
9
+ export declare const GET_THREAT_MODEL_DESCRIPTION = "Get a threat model with ALL its entities \u2014 actors, components, data flows, attack scenarios, security controls, data assets, test cases, findings, AND any linked diagrams/artifacts.\n\nReturns the complete threat model. Sub-entities live on the latest ThreatModelVersion. For convenience this tool surfaces them at BOTH levels:\n- Top-level: `actors`, `components`, `dataFlows`, `attackScenarios`, `securityControls`, `dataAssets`, `testCases`, `findings` \u2014 copied from the latest version\n- Nested: `versions[0].<entity>` \u2014 authoritative source. Older versions in `versions[N]` (N\u22651) only carry summary metrics, not entities.\n\nEntity contents:\n- **Actors**: Who interacts with the system (external users, attackers, internal services)\n- **Components**: System parts (APIs, databases, frontends, services) with technology and trust level\n- **Data Flows**: How data moves between components (protocol, encryption, auth mechanism)\n- **Attack Scenarios**: STRIDE-categorized threats with severity, likelihood, narrative\n- **Security Controls**: Existing mitigations (preventive, detective, corrective) with effectiveness\n- **Data Assets**: What sensitive data exists and how it's classified\n- **Test Cases**: Security tests with results (pass/fail/partial/not_tested)\n- **Findings**: Discovered vulnerabilities with severity and remediation recommendations\n- **Linked Diagrams** (`linked_diagrams`): First-class `Diagram` entities \u2014 used for app-level / cross-TM views.\n- **Artifacts** (`artifacts_summary`): The diagrams the TM detail page itself displays (Mermaid, canvas state, attack chains, asset inventories). Use `zivis_list_threat_model_artifacts` and `zivis_get_threat_model_artifact` for full content. NOTE: the platform is mid-migration from artifacts \u2192 first-class diagrams; today most TM-internal diagrams live as artifacts.\n\nIMPORTANT: The threat_model_id must be a threat model UUID from zivis_list_threat_models, NOT a scan ID or agent instance ID.\n\nUse this to understand the full security posture before making changes, adding entities, or running pen tests.\nAfter viewing, use zivis_manage_actor, zivis_manage_component, zivis_manage_data_flow, etc. to add or update entities.";
10
10
  export declare const GET_THREAT_MODEL_SCHEMA: {
11
11
  threat_model_id: z.ZodString;
12
12
  include_test_cases: z.ZodDefault<z.ZodBoolean>;
@@ -6,24 +6,28 @@
6
6
  import { z } from "zod";
7
7
  import { sanitizeResponse } from "../../sanitize.js";
8
8
  export const GET_THREAT_MODEL_NAME = "zivis_get_threat_model";
9
- export const GET_THREAT_MODEL_DESCRIPTION = `Get a threat model with ALL its entities — actors, components, data flows, attack scenarios, security controls, data assets, test cases, findings, AND any linked diagrams.
9
+ export const GET_THREAT_MODEL_DESCRIPTION = `Get a threat model with ALL its entities — actors, components, data flows, attack scenarios, security controls, data assets, test cases, findings, AND any linked diagrams/artifacts.
10
10
 
11
- Returns the complete threat model including:
11
+ Returns the complete threat model. Sub-entities live on the latest ThreatModelVersion. For convenience this tool surfaces them at BOTH levels:
12
+ - Top-level: \`actors\`, \`components\`, \`dataFlows\`, \`attackScenarios\`, \`securityControls\`, \`dataAssets\`, \`testCases\`, \`findings\` — copied from the latest version
13
+ - Nested: \`versions[0].<entity>\` — authoritative source. Older versions in \`versions[N]\` (N≥1) only carry summary metrics, not entities.
14
+
15
+ Entity contents:
12
16
  - **Actors**: Who interacts with the system (external users, attackers, internal services)
13
17
  - **Components**: System parts (APIs, databases, frontends, services) with technology and trust level
14
18
  - **Data Flows**: How data moves between components (protocol, encryption, auth mechanism)
15
- - **Attack Scenarios**: STRIDE-categorized threats with severity, likelihood, attack vectors
19
+ - **Attack Scenarios**: STRIDE-categorized threats with severity, likelihood, narrative
16
20
  - **Security Controls**: Existing mitigations (preventive, detective, corrective) with effectiveness
17
21
  - **Data Assets**: What sensitive data exists and how it's classified
18
22
  - **Test Cases**: Security tests with results (pass/fail/partial/not_tested)
19
23
  - **Findings**: Discovered vulnerabilities with severity and remediation recommendations
20
- - **Linked Diagrams**: Architecture, data flow, trust boundary, and other diagrams associated with this threat model
24
+ - **Linked Diagrams** (\`linked_diagrams\`): First-class \`Diagram\` entities used for app-level / cross-TM views.
25
+ - **Artifacts** (\`artifacts_summary\`): The diagrams the TM detail page itself displays (Mermaid, canvas state, attack chains, asset inventories). Use \`zivis_list_threat_model_artifacts\` and \`zivis_get_threat_model_artifact\` for full content. NOTE: the platform is mid-migration from artifacts → first-class diagrams; today most TM-internal diagrams live as artifacts.
21
26
 
22
27
  IMPORTANT: The threat_model_id must be a threat model UUID from zivis_list_threat_models, NOT a scan ID or agent instance ID.
23
28
 
24
29
  Use this to understand the full security posture before making changes, adding entities, or running pen tests.
25
- After viewing, use zivis_manage_actor, zivis_manage_component, zivis_manage_data_flow, etc. to add or update entities.
26
- Use zivis_get_diagram with a diagram_id from the linked_diagrams to view full diagram details (nodes, connections, boundaries).`;
30
+ After viewing, use zivis_manage_actor, zivis_manage_component, zivis_manage_data_flow, etc. to add or update entities.`;
27
31
  export const GET_THREAT_MODEL_SCHEMA = {
28
32
  threat_model_id: z
29
33
  .string()
@@ -36,16 +40,39 @@ export const GET_THREAT_MODEL_SCHEMA = {
36
40
  export function createGetThreatModelHandler(apiClient) {
37
41
  return async (params) => {
38
42
  try {
39
- // Fetch threat model and linked diagrams in parallel
40
- const [threatModelData, diagramsData] = await Promise.all([
43
+ // Fetch threat model, linked diagrams, and the latest version's artifacts in parallel.
44
+ // Artifacts are the diagram surface the TM detail page itself uses; first-class
45
+ // diagrams are an org-scoped overlay (mid-migration today).
46
+ const [threatModelData, diagramsData, artifactsData] = await Promise.all([
41
47
  apiClient.get(`/api/threat-models/${params.threat_model_id}?include=all`),
42
48
  apiClient
43
49
  .get(`/api/diagrams?linkedThreatModelId=${params.threat_model_id}&take=50`)
44
50
  .catch(() => ({ diagrams: [], total: 0 })),
51
+ apiClient
52
+ .get(`/api/threat-models/${params.threat_model_id}/artifacts`)
53
+ .catch(() => []),
45
54
  ]);
46
55
  const sanitized = sanitizeResponse(threatModelData);
47
- // Attach linked diagrams summary to the response
48
- const diagrams = Array.isArray(diagramsData.diagrams)
56
+ // Lift sub-entities from versions[0] to the top level for LLM convenience.
57
+ // Authoritative location remains versions[0]; this is a non-destructive shim.
58
+ const versions = Array.isArray(sanitized.versions) ? sanitized.versions : [];
59
+ const latestVersion = (versions[0] || {});
60
+ const lifted = {};
61
+ for (const key of [
62
+ "actors",
63
+ "components",
64
+ "dataFlows",
65
+ "attackScenarios",
66
+ "securityControls",
67
+ "dataAssets",
68
+ "testCases",
69
+ "findings",
70
+ ]) {
71
+ if (Array.isArray(latestVersion[key])) {
72
+ lifted[key] = latestVersion[key];
73
+ }
74
+ }
75
+ const linkedDiagrams = Array.isArray(diagramsData.diagrams)
49
76
  ? diagramsData.diagrams.map((d) => ({
50
77
  diagram_id: d.id,
51
78
  name: d.name,
@@ -57,10 +84,31 @@ export function createGetThreatModelHandler(apiClient) {
57
84
  updated_at: d.updatedAt,
58
85
  }))
59
86
  : [];
87
+ // Artifact summary — content omitted to keep the payload light. Use
88
+ // zivis_get_threat_model_artifact for the Mermaid / canvas content.
89
+ const artifactsRaw = Array.isArray(artifactsData) ? artifactsData : [];
90
+ const artifactsSummary = artifactsRaw.map((a) => ({
91
+ artifact_id: a.id,
92
+ title: a.title,
93
+ artifact_type: a.artifactType,
94
+ content_type: a.contentType,
95
+ tags: a.tags || [],
96
+ description: a.description || null,
97
+ is_stale: a.isStale ?? false,
98
+ stale_reason: a.staleReason || null,
99
+ is_edited: a.isEdited ?? false,
100
+ group_id: a.groupId || null,
101
+ scope_id: a.scopeId || null,
102
+ promoted_diagram_id: a.diagramId || null,
103
+ sort_order: a.sortOrder ?? 0,
104
+ }));
60
105
  const result = {
61
106
  ...sanitized,
62
- linked_diagrams: diagrams,
107
+ ...lifted,
108
+ linked_diagrams: linkedDiagrams,
63
109
  linked_diagrams_count: diagramsData.total,
110
+ artifacts_summary: artifactsSummary,
111
+ artifacts_count: artifactsSummary.length,
64
112
  };
65
113
  return {
66
114
  content: [
@@ -1 +1 @@
1
- {"version":3,"file":"get-threat-model.js","sourceRoot":"","sources":["../../../src/tools/enterprise/get-threat-model.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,CAAC,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AAE9D,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;gIAiBoF,CAAC;A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CAAC,OAAO,IAAI,KAAK;gBAC5B,YAAY,EAAE,CAAC,CAAC,WAAW,IAAI,IAAI;gBACnC,SAAS,EAAE,CAAC,CAAC,QAAQ,IAAI,KAAK;gBAC9B,QAAQ,EAAE,CAAC,CAAC,OAAO,IAAI,IAAI;gBAC3B,QAAQ,EAAE,CAAC,CAAC,OAAO,IAAI,IAAI;gBAC3B,mBAAmB,EAAE,CAAC,CAAC,SAAS,IAAI,IAAI;gBACxC,UAAU,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC;aAC7B,CAAC,CAAC,CAAC;YAEJ,MAAM,MAAM,GAAS;gBACnB,GAAG,SAAS;gBACZ,GAAG,MAAM;gBACT,eAAe,EAAE,cAAc;gBAC/B,qBAAqB,EAAE,YAAY,CAAC,KAAK;gBACzC,iBAAiB,EAAE,gBAAgB;gBACnC,eAAe,EAAE,gBAAgB,CAAC,MAAM;aACzC,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;qBACtC;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC;YAClF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE,EAAE,CAAC;gBAC/D,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * zivis_list_threat_model_artifacts — List the diagrams/artifacts attached to a
3
+ * threat model version (Mermaid diagrams, attack chains, asset inventories,
4
+ * canvas state, etc.).
5
+ *
6
+ * IMPORTANT: This is the surface the TM detail page itself reads. It is
7
+ * distinct from `zivis_list_diagrams`, which queries the org-wide first-class
8
+ * `Diagram` table. The platform is mid-migration — for any TM today, look here
9
+ * first; only fall back to `zivis_list_diagrams` for app-level / cross-TM views.
10
+ *
11
+ * Maps to: GET /api/threat-models/:id/artifacts[?versionId=...&artifactType=...]
12
+ */
13
+ import { z } from "zod";
14
+ import type { ApiClient } from "../../api-client.js";
15
+ export declare const LIST_THREAT_MODEL_ARTIFACTS_NAME = "zivis_list_threat_model_artifacts";
16
+ export declare const LIST_THREAT_MODEL_ARTIFACTS_DESCRIPTION = "List the diagrams/artifacts attached to a threat model \u2014 these are the diagrams the TM detail page actually displays (Mermaid code, canvas state, attack-chain diagrams, asset inventories, trust boundaries, sequence diagrams, etc.).\n\nIf you are looking for \"the diagrams for a threat model\" \u2014 start here, NOT `zivis_list_diagrams`. The platform is mid-migration from this artifact model to a first-class `Diagram` entity; today most TM-internal diagrams still live as artifacts.\n\nReturns a summary list (no content blob). Use `zivis_get_threat_model_artifact` to fetch the full Mermaid source or canvas JSON for a specific artifact.\n\nBy default scopes to the threat model's CURRENT version. Pass `version_id` to inspect a historical version.";
17
+ export declare const LIST_THREAT_MODEL_ARTIFACTS_SCHEMA: {
18
+ threat_model_id: z.ZodString;
19
+ version_id: z.ZodOptional<z.ZodString>;
20
+ artifact_type: z.ZodOptional<z.ZodEnum<{
21
+ trust_boundary: "trust_boundary";
22
+ data_flow_diagram: "data_flow_diagram";
23
+ dfd_level_1: "dfd_level_1";
24
+ dfd_level_2: "dfd_level_2";
25
+ system_context: "system_context";
26
+ asset_inventory: "asset_inventory";
27
+ sequence_diagram: "sequence_diagram";
28
+ network_topology: "network_topology";
29
+ cloud_architecture: "cloud_architecture";
30
+ component_diagram: "component_diagram";
31
+ api_integration: "api_integration";
32
+ identity_access_flow: "identity_access_flow";
33
+ deployment_diagram: "deployment_diagram";
34
+ ci_cd_pipeline: "ci_cd_pipeline";
35
+ secrets_flow: "secrets_flow";
36
+ attack_tree: "attack_tree";
37
+ kill_chain: "kill_chain";
38
+ swimlane_process: "swimlane_process";
39
+ entity_relationship: "entity_relationship";
40
+ state_machine: "state_machine";
41
+ misuse_case: "misuse_case";
42
+ stride_annotated: "stride_annotated";
43
+ encryption_boundary: "encryption_boundary";
44
+ backup_recovery: "backup_recovery";
45
+ logging_monitoring: "logging_monitoring";
46
+ entry_point: "entry_point";
47
+ assumption: "assumption";
48
+ canvas_state: "canvas_state";
49
+ }>>;
50
+ };
51
+ export declare function createListThreatModelArtifactsHandler(apiClient: ApiClient): (params: {
52
+ threat_model_id: string;
53
+ version_id?: string;
54
+ artifact_type?: string;
55
+ }) => Promise<{
56
+ content: {
57
+ type: "text";
58
+ text: string;
59
+ }[];
60
+ isError?: undefined;
61
+ } | {
62
+ content: {
63
+ type: "text";
64
+ text: string;
65
+ }[];
66
+ isError: boolean;
67
+ }>;
@@ -0,0 +1,121 @@
1
+ /**
2
+ * zivis_list_threat_model_artifacts — List the diagrams/artifacts attached to a
3
+ * threat model version (Mermaid diagrams, attack chains, asset inventories,
4
+ * canvas state, etc.).
5
+ *
6
+ * IMPORTANT: This is the surface the TM detail page itself reads. It is
7
+ * distinct from `zivis_list_diagrams`, which queries the org-wide first-class
8
+ * `Diagram` table. The platform is mid-migration — for any TM today, look here
9
+ * first; only fall back to `zivis_list_diagrams` for app-level / cross-TM views.
10
+ *
11
+ * Maps to: GET /api/threat-models/:id/artifacts[?versionId=...&artifactType=...]
12
+ */
13
+ import { z } from "zod";
14
+ import { sanitizeResponse } from "../../sanitize.js";
15
+ export const LIST_THREAT_MODEL_ARTIFACTS_NAME = "zivis_list_threat_model_artifacts";
16
+ export const LIST_THREAT_MODEL_ARTIFACTS_DESCRIPTION = `List the diagrams/artifacts attached to a threat model — these are the diagrams the TM detail page actually displays (Mermaid code, canvas state, attack-chain diagrams, asset inventories, trust boundaries, sequence diagrams, etc.).
17
+
18
+ If you are looking for "the diagrams for a threat model" — start here, NOT \`zivis_list_diagrams\`. The platform is mid-migration from this artifact model to a first-class \`Diagram\` entity; today most TM-internal diagrams still live as artifacts.
19
+
20
+ Returns a summary list (no content blob). Use \`zivis_get_threat_model_artifact\` to fetch the full Mermaid source or canvas JSON for a specific artifact.
21
+
22
+ By default scopes to the threat model's CURRENT version. Pass \`version_id\` to inspect a historical version.`;
23
+ export const LIST_THREAT_MODEL_ARTIFACTS_SCHEMA = {
24
+ threat_model_id: z
25
+ .string()
26
+ .describe("Threat model UUID (from zivis_list_threat_models)"),
27
+ version_id: z
28
+ .string()
29
+ .optional()
30
+ .describe("Optional ThreatModelVersion UUID. If omitted, the threat model's current/latest version is used."),
31
+ artifact_type: z
32
+ .enum([
33
+ "data_flow_diagram",
34
+ "dfd_level_1",
35
+ "dfd_level_2",
36
+ "trust_boundary",
37
+ "system_context",
38
+ "asset_inventory",
39
+ "sequence_diagram",
40
+ "network_topology",
41
+ "cloud_architecture",
42
+ "component_diagram",
43
+ "api_integration",
44
+ "identity_access_flow",
45
+ "deployment_diagram",
46
+ "ci_cd_pipeline",
47
+ "secrets_flow",
48
+ "attack_tree",
49
+ "kill_chain",
50
+ "swimlane_process",
51
+ "entity_relationship",
52
+ "state_machine",
53
+ "misuse_case",
54
+ "stride_annotated",
55
+ "encryption_boundary",
56
+ "backup_recovery",
57
+ "logging_monitoring",
58
+ "entry_point",
59
+ "assumption",
60
+ "canvas_state",
61
+ ])
62
+ .optional()
63
+ .describe("Filter by artifact type (e.g., data_flow_diagram, attack_tree, canvas_state). Note: artifactType is being deprecated in favor of free-form tags; filter by tag client-side if needed."),
64
+ };
65
+ export function createListThreatModelArtifactsHandler(apiClient) {
66
+ return async (params) => {
67
+ try {
68
+ const query = new URLSearchParams();
69
+ if (params.version_id)
70
+ query.set("versionId", params.version_id);
71
+ if (params.artifact_type)
72
+ query.set("artifactType", params.artifact_type);
73
+ const queryStr = query.toString();
74
+ const path = `/api/threat-models/${params.threat_model_id}/artifacts${queryStr ? `?${queryStr}` : ""}`;
75
+ const artifacts = await apiClient.get(path);
76
+ const rows = Array.isArray(artifacts) ? artifacts : [];
77
+ const summary = rows.map((a) => ({
78
+ artifact_id: a.id,
79
+ version_id: a.versionId,
80
+ title: a.title,
81
+ artifact_type: a.artifactType,
82
+ content_type: a.contentType,
83
+ tags: a.tags || [],
84
+ description: a.description || null,
85
+ sort_order: a.sortOrder ?? 0,
86
+ is_stale: a.isStale ?? false,
87
+ stale_reason: a.staleReason || null,
88
+ is_edited: a.isEdited ?? false,
89
+ edited_at: a.editedAt || null,
90
+ last_generated_at: a.lastGeneratedAt || null,
91
+ changed_files_since: a.changedFilesSince ?? null,
92
+ source_type: a.sourceType,
93
+ source_agent_instance_id: a.sourceAgentInstanceId || null,
94
+ source_run_id: a.sourceRunId || null,
95
+ scope_id: a.scopeId || null,
96
+ group_id: a.groupId || null,
97
+ promoted_diagram_id: a.diagramId || null,
98
+ canvas_version: a.canvasVersion ?? null,
99
+ approval_status: a.approvalStatus || null,
100
+ created_at: a.createdAt,
101
+ }));
102
+ const sanitized = sanitizeResponse({
103
+ threat_model_id: params.threat_model_id,
104
+ version_id: params.version_id || null,
105
+ total: summary.length,
106
+ artifacts: summary,
107
+ });
108
+ return {
109
+ content: [{ type: "text", text: JSON.stringify(sanitized, null, 2) }],
110
+ };
111
+ }
112
+ catch (err) {
113
+ const message = err instanceof Error ? err.message : "Failed to list threat model artifacts";
114
+ return {
115
+ content: [{ type: "text", text: `Error: ${message}` }],
116
+ isError: true,
117
+ };
118
+ }
119
+ };
120
+ }
121
+ //# sourceMappingURL=list-threat-model-artifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-threat-model-artifacts.js","sourceRoot":"","sources":["../../../src/tools/enterprise/list-threat-model-artifacts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,CAAC,MAAM,gCAAgC,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C,OAAO,IAAI,IAAI;gBAC3B,mBAAmB,EAAE,CAAC,CAAC,SAAS,IAAI,IAAI;gBACxC,cAAc,EAAE,CAAC,CAAC,aAAa,IAAI,IAAI;gBACvC,eAAe,EAAE,CAAC,CAAC,cAAc,IAAI,IAAI;gBACzC,UAAU,EAAE,CAAC,CAAC,SAAS;aACxB,CAAC,CAAC,CAAC;YAEJ,MAAM,SAAS,GAAG,gBAAgB,CAAC;gBACjC,eAAe,EAAE,MAAM,CAAC,eAAe;gBACvC,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,IAAI;gBACrC,KAAK,EAAE,OAAO,CAAC,MAAM;gBACrB,SAAS,EAAE,OAAO;aACnB,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aAC/E,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GACX,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,uCAAuC,CAAC;YAC/E,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE,EAAE,CAAC;gBAC/D,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -18,8 +18,8 @@ export declare const MANAGE_DATA_ASSET_SCHEMA: {
18
18
  name: z.ZodOptional<z.ZodString>;
19
19
  classification: z.ZodOptional<z.ZodEnum<{
20
20
  critical: "critical";
21
- internal: "internal";
22
21
  public: "public";
22
+ internal: "internal";
23
23
  confidential: "confidential";
24
24
  restricted: "restricted";
25
25
  }>>;
@@ -22,8 +22,8 @@ export declare const MANAGE_DATA_FLOW_SCHEMA: {
22
22
  protocol: z.ZodOptional<z.ZodString>;
23
23
  data_classification: z.ZodOptional<z.ZodEnum<{
24
24
  critical: "critical";
25
- internal: "internal";
26
25
  public: "public";
26
+ internal: "internal";
27
27
  confidential: "confidential";
28
28
  restricted: "restricted";
29
29
  }>>;
@@ -28,10 +28,10 @@ export declare const MANAGE_TEST_CASE_SCHEMA: {
28
28
  success_criteria: z.ZodOptional<z.ZodString>;
29
29
  evidence_type: z.ZodOptional<z.ZodEnum<{
30
30
  code_snippet: "code_snippet";
31
- video: "video";
32
31
  screenshot: "screenshot";
33
32
  http_request: "http_request";
34
33
  log_entry: "log_entry";
34
+ video: "video";
35
35
  manual_notes: "manual_notes";
36
36
  }>>;
37
37
  result: z.ZodOptional<z.ZodEnum<{
@@ -0,0 +1,31 @@
1
+ /**
2
+ * zivis_inspect — STUB
3
+ *
4
+ * Threat-model-first entry point. Will build a local repo graph and ship it
5
+ * to the platform for pattern evaluation, then seed/enrich a draft threat
6
+ * model on the bound Application.
7
+ *
8
+ * Today this is a stub: it validates the project binding and returns a
9
+ * structured preview of what `/inspect` will do once the local-graph
10
+ * implementation lands. The real handler will replace this in a follow-up
11
+ * session — see docs/plans/LOCAL-REPO-GRAPH-IMPLEMENTATION.md.
12
+ */
13
+ import { z } from "zod";
14
+ import type { ApiClient } from "../api-client.js";
15
+ import type { ZivisConfig } from "../types.js";
16
+ export declare const INSPECT_NAME = "zivis_inspect";
17
+ export declare const INSPECT_DESCRIPTION = "Build a local repo graph and use it to seed or enrich a threat model for this application. The conversion event for the threat-model-first sidekick.\n\nUse this when the user says any of:\n- \"model this app\" / \"threat model this repo\"\n- \"what should we be worried about in this code\"\n- \"set up security for this project\" (after auth/binding is done)\n- \"/inspect\"\n\nToday this tool is a STUB and returns a structured preview only. It does NOT yet build the graph or call the platform \u2014 the real implementation is being built in a follow-up session and replaces this handler in place.\n\nWhen implemented, /inspect will:\n 1. Walk the bound repo locally (no source code leaves the machine by default).\n 2. Build a typed graph (components, endpoints, datastores, external deps, auth boundaries, dataflow hints).\n 3. Run local deterministic + inference matchers against published pattern packs.\n 4. Send graph IR + match candidates to the ZIVIS API for proprietary pattern evaluation.\n 5. Auto-create a draft threat model (or enrich the existing one) on the bound Application using only the trusted lane.\n 6. Surface inferred-lane hypotheses for analyst review via /review.\n\nThe local/cloud boundary is locked: graph extraction is local-first, proprietary pattern logic stays server-side, and only the trusted lane influences automated scoring. See docs/plans/LOCAL-REPO-GRAPH-IMPLEMENTATION.md for the full spec.";
18
+ export declare const INSPECT_SCHEMA: {
19
+ cwd: z.ZodOptional<z.ZodString>;
20
+ application_id: z.ZodOptional<z.ZodString>;
21
+ };
22
+ export declare function createInspectHandler(_apiClient: ApiClient, _config: ZivisConfig): (params: {
23
+ cwd?: string;
24
+ application_id?: string;
25
+ }) => Promise<{
26
+ content: Array<{
27
+ type: "text";
28
+ text: string;
29
+ }>;
30
+ isError?: boolean;
31
+ }>;
@@ -0,0 +1,100 @@
1
+ /**
2
+ * zivis_inspect — STUB
3
+ *
4
+ * Threat-model-first entry point. Will build a local repo graph and ship it
5
+ * to the platform for pattern evaluation, then seed/enrich a draft threat
6
+ * model on the bound Application.
7
+ *
8
+ * Today this is a stub: it validates the project binding and returns a
9
+ * structured preview of what `/inspect` will do once the local-graph
10
+ * implementation lands. The real handler will replace this in a follow-up
11
+ * session — see docs/plans/LOCAL-REPO-GRAPH-IMPLEMENTATION.md.
12
+ */
13
+ import { z } from "zod";
14
+ import { detectProjectBinding } from "../project-binding.js";
15
+ import { withNextSteps, withNextStepsError } from "../lib/next-steps.js";
16
+ export const INSPECT_NAME = "zivis_inspect";
17
+ export const INSPECT_DESCRIPTION = `Build a local repo graph and use it to seed or enrich a threat model for this application. The conversion event for the threat-model-first sidekick.
18
+
19
+ Use this when the user says any of:
20
+ - "model this app" / "threat model this repo"
21
+ - "what should we be worried about in this code"
22
+ - "set up security for this project" (after auth/binding is done)
23
+ - "/inspect"
24
+
25
+ Today this tool is a STUB and returns a structured preview only. It does NOT yet build the graph or call the platform — the real implementation is being built in a follow-up session and replaces this handler in place.
26
+
27
+ When implemented, /inspect will:
28
+ 1. Walk the bound repo locally (no source code leaves the machine by default).
29
+ 2. Build a typed graph (components, endpoints, datastores, external deps, auth boundaries, dataflow hints).
30
+ 3. Run local deterministic + inference matchers against published pattern packs.
31
+ 4. Send graph IR + match candidates to the ZIVIS API for proprietary pattern evaluation.
32
+ 5. Auto-create a draft threat model (or enrich the existing one) on the bound Application using only the trusted lane.
33
+ 6. Surface inferred-lane hypotheses for analyst review via /review.
34
+
35
+ The local/cloud boundary is locked: graph extraction is local-first, proprietary pattern logic stays server-side, and only the trusted lane influences automated scoring. See docs/plans/LOCAL-REPO-GRAPH-IMPLEMENTATION.md for the full spec.`;
36
+ export const INSPECT_SCHEMA = {
37
+ cwd: z
38
+ .string()
39
+ .optional()
40
+ .describe("Working directory to inspect (defaults to server working directory)."),
41
+ application_id: z
42
+ .string()
43
+ .optional()
44
+ .describe("Target application id. If omitted, /inspect resolves it from the project binding. " +
45
+ "Required if the binding is ambiguous or maps to multiple applications."),
46
+ };
47
+ export function createInspectHandler(_apiClient, _config) {
48
+ return async (params) => {
49
+ const cwd = params.cwd || process.cwd();
50
+ const detected = detectProjectBinding(cwd);
51
+ if (!detected) {
52
+ return withNextStepsError("No .zivis/project.json found for this directory. /inspect needs a project binding so the resulting threat model attaches to the correct application and org.", [
53
+ {
54
+ id: "run_auth_init",
55
+ label: "Connect this project to your ZIVIS org",
56
+ tool: "zivis_check_project",
57
+ why: "Run 'zivis auth init' or 'zivis auth login' to create the binding, then re-run /inspect.",
58
+ },
59
+ ], "Project not bound — run zivis auth login then re-run /inspect.");
60
+ }
61
+ return withNextSteps({
62
+ status: "stub",
63
+ message: "/inspect is the threat-model-first entry point but is not yet implemented. This response is a preview of what it will do.",
64
+ binding: {
65
+ orgName: detected.binding.orgName,
66
+ workosOrgId: detected.binding.workosOrgId,
67
+ applicationId: params.application_id ?? detected.binding.applicationId ?? null,
68
+ bindingPath: detected.filePath,
69
+ },
70
+ planned_phases: [
71
+ "walk_repo_local",
72
+ "build_graph_ir",
73
+ "run_local_pattern_matchers",
74
+ "send_graph_to_platform_for_proprietary_eval",
75
+ "create_or_enrich_draft_threat_model",
76
+ "queue_inferred_hypotheses_for_review",
77
+ ],
78
+ boundary: {
79
+ local_only: "Repo walk, graph IR construction, and public-pack matching all run on this machine.",
80
+ sent_to_platform: "Graph IR features and local match candidates (not raw source by default).",
81
+ stays_on_platform: "Proprietary pattern definitions and final scoring logic.",
82
+ },
83
+ spec: "docs/plans/LOCAL-REPO-GRAPH-IMPLEMENTATION.md",
84
+ }, [
85
+ {
86
+ id: "wait_for_inspect_impl",
87
+ label: "Wait for /inspect to be implemented",
88
+ tool: "zivis_inspect",
89
+ why: "The full handler lands in a follow-up session and replaces this stub.",
90
+ },
91
+ {
92
+ id: "discover_local_infra_now",
93
+ label: "In the meantime, sniff AI/LLM SDKs in the project",
94
+ tool: "zivis_discover_local_infra",
95
+ why: "Existing local-only tool that gives a partial preview of what /inspect will detect.",
96
+ },
97
+ ], "STUB: /inspect preview only — real handler coming in a follow-up session.");
98
+ };
99
+ }
100
+ //# sourceMappingURL=inspect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../src/tools/inspect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAEzE,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAC;AAE5C,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;+OAkB4M,CAAC;AAEhP,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,Q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uBAAuB;gBAC3B,KAAK,EAAE,qCAAqC;gBAC5C,IAAI,EAAE,eAAe;gBACrB,GAAG,EAAE,uEAAuE;aAC7E;YACD;gBACE,EAAE,EAAE,0BAA0B;gBAC9B,KAAK,EAAE,mDAAmD;gBAC1D,IAAI,EAAE,4BAA4B;gBAClC,GAAG,EAAE,qFAAqF;aAC3F;SACF,EACD,2EAA2E,CAC5E,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -23,8 +23,8 @@ export declare const MANAGE_APPLICATION_SCHEMA: {
23
23
  api_url: z.ZodOptional<z.ZodString>;
24
24
  auth_type: z.ZodOptional<z.ZodEnum<{
25
25
  none: "none";
26
- static_token: "static_token";
27
26
  oauth_pkce: "oauth_pkce";
27
+ static_token: "static_token";
28
28
  client_credentials: "client_credentials";
29
29
  bearer_refresh: "bearer_refresh";
30
30
  }>>;