@nimbus-dev/client 0.9.0 → 0.11.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/dist/index.cjs CHANGED
@@ -795,6 +795,18 @@ class MockClient {
795
795
  async cancelStream() {
796
796
  return { ok: true };
797
797
  }
798
+ async sessionAppend(_params) {
799
+ return { ok: true };
800
+ }
801
+ async sessionRecall(_params) {
802
+ return this.fixtures.sessionRecall ?? { chunks: [] };
803
+ }
804
+ async sessionList() {
805
+ return this.fixtures.sessionList ?? { sessions: [] };
806
+ }
807
+ async sessionClear(_params) {
808
+ return { ok: true, cleared: "all" };
809
+ }
798
810
  async queryItems(_params) {
799
811
  const items = this.fixtures.items ?? [];
800
812
  return { items, meta: { limit: items.length, total: items.length } };
@@ -889,6 +901,120 @@ class MockClient {
889
901
  syncFreshnessMs: 0
890
902
  };
891
903
  }
904
+ async metricsDora(_params) {
905
+ return this.fixtures.metricsDora ?? {
906
+ service: "mock",
907
+ since_ms: 0,
908
+ computed_at: new Date(0).toISOString(),
909
+ metrics: {
910
+ deployment_frequency: {
911
+ value: null,
912
+ unit: "deploys_per_day",
913
+ sample: 0,
914
+ gap: "no_repos"
915
+ },
916
+ lead_time_for_changes: {
917
+ value: null,
918
+ unit: "seconds_median",
919
+ sample: 0,
920
+ gap: "no_repos"
921
+ },
922
+ change_failure_rate: { value: null, unit: "ratio", sample: 0, gap: "no_repos" },
923
+ mttr: { value: null, unit: "seconds_median", sample: 0, gap: "no_repos" }
924
+ }
925
+ };
926
+ }
927
+ async deployPreflight(_params) {
928
+ return this.fixtures.deployPreflight ?? {
929
+ service: "mock",
930
+ target_ref: "main",
931
+ computed_at: new Date(0).toISOString(),
932
+ verdict: "ok",
933
+ checks: {
934
+ active_p1_incidents: { count: 0, findings: [], gap: "no_pagerduty_mapping" },
935
+ failing_ci_runs: { count: 0, findings: [], gap: "no_repos" },
936
+ merge_conflicts: { count: 0, findings: [], gap: "no_repos" }
937
+ }
938
+ };
939
+ }
940
+ async connectorListStatus(_params) {
941
+ return this.fixtures.connectorSyncStatuses ?? [];
942
+ }
943
+ defaultConnectorStatus(serviceId) {
944
+ return {
945
+ serviceId,
946
+ status: "ok",
947
+ lastSyncAt: null,
948
+ nextSyncAt: null,
949
+ intervalMs: 0,
950
+ itemCount: 0,
951
+ lastError: null,
952
+ consecutiveFailures: 0,
953
+ depth: "metadata_only",
954
+ enabled: true
955
+ };
956
+ }
957
+ async connectorStatus(params) {
958
+ return this.fixtures.connectorStatus ?? this.defaultConnectorStatus(params.serviceId);
959
+ }
960
+ async connectorHealthHistory(_params) {
961
+ return this.fixtures.connectorHealthHistory ?? [];
962
+ }
963
+ async connectorPause(_params) {
964
+ return { ok: true };
965
+ }
966
+ async connectorResume(_params) {
967
+ return { ok: true };
968
+ }
969
+ async connectorSetInterval(_params) {
970
+ return { ok: true };
971
+ }
972
+ async connectorSetConfig(params) {
973
+ return this.fixtures.connectorSetConfig ?? {
974
+ service: params.serviceId,
975
+ intervalMs: params.intervalMs ?? null,
976
+ depth: params.depth ?? null,
977
+ enabled: params.enabled ?? null
978
+ };
979
+ }
980
+ async connectorSync(_params) {
981
+ return { ok: true };
982
+ }
983
+ async connectorAuth(params) {
984
+ return this.fixtures.connectorAuth ?? { ok: true, serviceId: params.serviceId, scopesGranted: [] };
985
+ }
986
+ async connectorAddMcp(params) {
987
+ return this.fixtures.connectorAddMcp ?? { ok: true, serviceId: params.serviceId };
988
+ }
989
+ async connectorRemove(_params) {
990
+ return this.fixtures.connectorRemove ?? { ok: true, itemsDeleted: 0, vaultKeysRemoved: [] };
991
+ }
992
+ async connectorReindex(params) {
993
+ return this.fixtures.connectorReindex ?? {
994
+ itemsAffected: 0,
995
+ depth: params.depth ?? "metadata_only",
996
+ mode: "shallow"
997
+ };
998
+ }
999
+ async workflowList() {
1000
+ return this.fixtures.workflowList ?? { workflows: [] };
1001
+ }
1002
+ async workflowSave(_params) {
1003
+ return { id: "mock-workflow" };
1004
+ }
1005
+ async workflowDelete(_params) {
1006
+ return { ok: true };
1007
+ }
1008
+ async workflowListRuns(_params) {
1009
+ return this.fixtures.workflowListRuns ?? { runs: [] };
1010
+ }
1011
+ async workflowRun(params) {
1012
+ return this.fixtures.workflowRun ?? {
1013
+ runId: "mock-run",
1014
+ dryRun: params.dryRun ?? false,
1015
+ stepResults: []
1016
+ };
1017
+ }
892
1018
  async close() {}
893
1019
  }
894
1020
  // src/ask-stream.ts
@@ -1126,6 +1252,33 @@ function optNum(o, key) {
1126
1252
  const v = o[key];
1127
1253
  return typeof v === "number" && Number.isFinite(v) ? v : undefined;
1128
1254
  }
1255
+ function nullableNum(method, o, key) {
1256
+ const v = o[key];
1257
+ if (v === null)
1258
+ return null;
1259
+ if (typeof v !== "number" || !Number.isFinite(v)) {
1260
+ throw new IpcResponseError(method, `"${key}" must be a number or null`);
1261
+ }
1262
+ return v;
1263
+ }
1264
+ function nullableStr(method, o, key) {
1265
+ const v = o[key];
1266
+ if (v === null)
1267
+ return null;
1268
+ if (typeof v !== "string") {
1269
+ throw new IpcResponseError(method, `"${key}" must be a string or null`);
1270
+ }
1271
+ return v;
1272
+ }
1273
+ function nullableBool(method, o, key) {
1274
+ const v = o[key];
1275
+ if (v === null)
1276
+ return null;
1277
+ if (typeof v !== "boolean") {
1278
+ throw new IpcResponseError(method, `"${key}" must be a boolean or null`);
1279
+ }
1280
+ return v;
1281
+ }
1129
1282
  function validateAgentInvoke(method, v) {
1130
1283
  const o = record(method, v);
1131
1284
  if (o["reply"] !== undefined && typeof o["reply"] !== "string") {
@@ -1156,6 +1309,44 @@ function validateSessionTranscript(method, v) {
1156
1309
  });
1157
1310
  return { sessionId: str(method, o, "sessionId"), turns, hasMore: bool(method, o, "hasMore") };
1158
1311
  }
1312
+ function validateSessionMemoryRole(method, o, key) {
1313
+ const v = o[key];
1314
+ if (v !== "user" && v !== "assistant" && v !== "tool") {
1315
+ throw new IpcResponseError(method, `"${key}" must be "user", "assistant", or "tool"`);
1316
+ }
1317
+ return v;
1318
+ }
1319
+ function validateSessionRecallHit(method, v) {
1320
+ const o = record(method, v);
1321
+ return {
1322
+ chunkText: str(method, o, "chunkText"),
1323
+ role: validateSessionMemoryRole(method, o, "role"),
1324
+ createdAt: num(method, o, "createdAt"),
1325
+ distance: num(method, o, "distance")
1326
+ };
1327
+ }
1328
+ function validateSessionRecall(method, v) {
1329
+ const o = record(method, v);
1330
+ return { chunks: arr(method, o["chunks"]).map((c) => validateSessionRecallHit(method, c)) };
1331
+ }
1332
+ function validateSessionListEntry(method, v) {
1333
+ const o = record(method, v);
1334
+ return {
1335
+ sessionId: str(method, o, "sessionId"),
1336
+ lastWriteAt: num(method, o, "lastWriteAt"),
1337
+ chunkCount: num(method, o, "chunkCount")
1338
+ };
1339
+ }
1340
+ function validateSessionList(method, v) {
1341
+ const o = record(method, v);
1342
+ return {
1343
+ sessions: arr(method, o["sessions"]).map((s) => validateSessionListEntry(method, s))
1344
+ };
1345
+ }
1346
+ function validateSessionClear(method, v) {
1347
+ const o = record(method, v);
1348
+ return { ok: bool(method, o, "ok"), cleared: str(method, o, "cleared") };
1349
+ }
1159
1350
  function validateQueryItems(method, v) {
1160
1351
  const o = record(method, v);
1161
1352
  const items = arr(method, o["items"]).map((raw) => {
@@ -1577,6 +1768,340 @@ function validateGatewayStatus(method, v) {
1577
1768
  syncFreshnessMs: num(method, o, "syncFreshnessMs")
1578
1769
  };
1579
1770
  }
1771
+ var DORA_GAP_VALUES = new Set([
1772
+ "no_pagerduty_mapping",
1773
+ "no_repos",
1774
+ "no_deployment_data",
1775
+ "low_sample",
1776
+ "approximate_lead_time",
1777
+ "mixed_source"
1778
+ ]);
1779
+ function validateDoraGap(method, v, field) {
1780
+ if (v === null)
1781
+ return null;
1782
+ if (typeof v === "string" && DORA_GAP_VALUES.has(v))
1783
+ return v;
1784
+ throw new IpcResponseError(method, `"${field}" must be a recognised DORA gap code or null`);
1785
+ }
1786
+ function validateDoraMetricValue(method, v, field) {
1787
+ const o = record(method, v);
1788
+ const value = o["value"];
1789
+ if (value !== null && (typeof value !== "number" || !Number.isFinite(value))) {
1790
+ throw new IpcResponseError(method, `"${field}.value" must be a number or null`);
1791
+ }
1792
+ return {
1793
+ value,
1794
+ unit: str(method, o, "unit"),
1795
+ sample: num(method, o, "sample"),
1796
+ gap: validateDoraGap(method, o["gap"], `${field}.gap`)
1797
+ };
1798
+ }
1799
+ function validateDoraMetrics(method, v) {
1800
+ const o = record(method, v);
1801
+ const metrics = record(method, o["metrics"]);
1802
+ return {
1803
+ service: str(method, o, "service"),
1804
+ since_ms: num(method, o, "since_ms"),
1805
+ computed_at: str(method, o, "computed_at"),
1806
+ metrics: {
1807
+ deployment_frequency: validateDoraMetricValue(method, metrics["deployment_frequency"], "deployment_frequency"),
1808
+ lead_time_for_changes: validateDoraMetricValue(method, metrics["lead_time_for_changes"], "lead_time_for_changes"),
1809
+ change_failure_rate: validateDoraMetricValue(method, metrics["change_failure_rate"], "change_failure_rate"),
1810
+ mttr: validateDoraMetricValue(method, metrics["mttr"], "mttr")
1811
+ }
1812
+ };
1813
+ }
1814
+ var PREFLIGHT_GAP_VALUES = new Set([
1815
+ "no_pagerduty_mapping",
1816
+ "no_repos",
1817
+ "unknown_mergeable_state",
1818
+ "pagerduty_urgency_without_priority"
1819
+ ]);
1820
+ function validatePreflightGap(method, v, field) {
1821
+ if (v === null)
1822
+ return null;
1823
+ if (typeof v === "string" && PREFLIGHT_GAP_VALUES.has(v))
1824
+ return v;
1825
+ throw new IpcResponseError(method, `"${field}" must be a recognised preflight gap code or null`);
1826
+ }
1827
+ function optUrl(method, o, field) {
1828
+ const url = o["url"];
1829
+ if (url !== null && typeof url !== "string") {
1830
+ throw new IpcResponseError(method, `${field} "url" must be a string or null`);
1831
+ }
1832
+ return url;
1833
+ }
1834
+ function validateIncidentFinding(method, v) {
1835
+ const o = record(method, v);
1836
+ const status = o["status"];
1837
+ if (status !== "triggered" && status !== "acknowledged") {
1838
+ throw new IpcResponseError(method, `incident finding "status" must be "triggered" or "acknowledged"`);
1839
+ }
1840
+ return {
1841
+ id: str(method, o, "id"),
1842
+ title: str(method, o, "title"),
1843
+ status,
1844
+ severity: str(method, o, "severity"),
1845
+ opened_at_ms: num(method, o, "opened_at_ms"),
1846
+ pagerduty_service_id: str(method, o, "pagerduty_service_id"),
1847
+ url: optUrl(method, o, "incident finding")
1848
+ };
1849
+ }
1850
+ function validateCiFinding(method, v) {
1851
+ const o = record(method, v);
1852
+ const conclusion = o["conclusion"];
1853
+ if (conclusion !== "failure" && conclusion !== "cancelled" && conclusion !== "timed_out") {
1854
+ throw new IpcResponseError(method, `ci finding "conclusion" must be "failure", "cancelled", or "timed_out"`);
1855
+ }
1856
+ const headSha = o["head_sha"];
1857
+ if (headSha !== null && typeof headSha !== "string") {
1858
+ throw new IpcResponseError(method, `ci finding "head_sha" must be a string or null`);
1859
+ }
1860
+ return {
1861
+ id: str(method, o, "id"),
1862
+ title: str(method, o, "title"),
1863
+ conclusion,
1864
+ modified_at_ms: num(method, o, "modified_at_ms"),
1865
+ branch: str(method, o, "branch"),
1866
+ head_sha: headSha,
1867
+ url: optUrl(method, o, "ci finding")
1868
+ };
1869
+ }
1870
+ function validatePrFinding(method, v) {
1871
+ const o = record(method, v);
1872
+ return {
1873
+ id: str(method, o, "id"),
1874
+ title: str(method, o, "title"),
1875
+ number: num(method, o, "number"),
1876
+ mergeable_state: str(method, o, "mergeable_state"),
1877
+ modified_at_ms: num(method, o, "modified_at_ms"),
1878
+ url: optUrl(method, o, "pr finding")
1879
+ };
1880
+ }
1881
+ function validatePreflightCheck(method, v, field, validateFinding) {
1882
+ const o = record(method, v);
1883
+ return {
1884
+ count: num(method, o, "count"),
1885
+ findings: arr(method, o["findings"]).map((f) => validateFinding(method, f)),
1886
+ gap: validatePreflightGap(method, o["gap"], `${field}.gap`)
1887
+ };
1888
+ }
1889
+ function validateDeployPreflight(method, v) {
1890
+ const o = record(method, v);
1891
+ const verdict = o["verdict"];
1892
+ if (verdict !== "ok" && verdict !== "warn") {
1893
+ throw new IpcResponseError(method, `"verdict" must be "ok" or "warn"`);
1894
+ }
1895
+ const checks = record(method, o["checks"]);
1896
+ return {
1897
+ service: str(method, o, "service"),
1898
+ target_ref: str(method, o, "target_ref"),
1899
+ computed_at: str(method, o, "computed_at"),
1900
+ verdict,
1901
+ checks: {
1902
+ active_p1_incidents: validatePreflightCheck(method, checks["active_p1_incidents"], "active_p1_incidents", validateIncidentFinding),
1903
+ failing_ci_runs: validatePreflightCheck(method, checks["failing_ci_runs"], "failing_ci_runs", validateCiFinding),
1904
+ merge_conflicts: validatePreflightCheck(method, checks["merge_conflicts"], "merge_conflicts", validatePrFinding)
1905
+ }
1906
+ };
1907
+ }
1908
+ var CONNECTOR_STATUS_VALUES = new Set(["ok", "syncing", "paused", "backoff", "error"]);
1909
+ var CONNECTOR_DEPTH_VALUES = new Set(["metadata_only", "summary", "full"]);
1910
+ function validateConnectorSyncStatus(method, v) {
1911
+ const o = record(method, v);
1912
+ const status = o["status"];
1913
+ if (typeof status !== "string" || !CONNECTOR_STATUS_VALUES.has(status)) {
1914
+ throw new IpcResponseError(method, `"status" must be a recognised connector status`);
1915
+ }
1916
+ const depth = o["depth"];
1917
+ if (typeof depth !== "string" || !CONNECTOR_DEPTH_VALUES.has(depth)) {
1918
+ throw new IpcResponseError(method, `"depth" must be "metadata_only", "summary", or "full"`);
1919
+ }
1920
+ const result = {
1921
+ serviceId: str(method, o, "serviceId"),
1922
+ status,
1923
+ lastSyncAt: nullableNum(method, o, "lastSyncAt"),
1924
+ nextSyncAt: nullableNum(method, o, "nextSyncAt"),
1925
+ intervalMs: num(method, o, "intervalMs"),
1926
+ itemCount: num(method, o, "itemCount"),
1927
+ lastError: nullableStr(method, o, "lastError"),
1928
+ consecutiveFailures: num(method, o, "consecutiveFailures"),
1929
+ depth,
1930
+ enabled: bool(method, o, "enabled")
1931
+ };
1932
+ const healthState = optStr(o, "healthState");
1933
+ if (healthState !== undefined)
1934
+ result.healthState = healthState;
1935
+ if (o["healthRetryAfterMs"] !== undefined) {
1936
+ result.healthRetryAfterMs = nullableNum(method, o, "healthRetryAfterMs");
1937
+ }
1938
+ return result;
1939
+ }
1940
+ function validateConnectorSyncStatusList(method, v) {
1941
+ return arr(method, v).map((r) => validateConnectorSyncStatus(method, r));
1942
+ }
1943
+ function validateConnectorSyncTelemetry(method, v) {
1944
+ const o = record(method, v);
1945
+ return {
1946
+ startedAt: num(method, o, "startedAt"),
1947
+ durationMs: num(method, o, "durationMs"),
1948
+ itemsUpserted: num(method, o, "itemsUpserted"),
1949
+ itemsDeleted: num(method, o, "itemsDeleted"),
1950
+ bytesTransferred: nullableNum(method, o, "bytesTransferred"),
1951
+ hadMore: bool(method, o, "hadMore"),
1952
+ errorMsg: nullableStr(method, o, "errorMsg")
1953
+ };
1954
+ }
1955
+ function validateConnectorStatusResult(method, v) {
1956
+ const base = validateConnectorSyncStatus(method, v);
1957
+ const o = record(method, v);
1958
+ if (o["telemetry"] === undefined)
1959
+ return base;
1960
+ return {
1961
+ ...base,
1962
+ telemetry: arr(method, o["telemetry"]).map((t) => validateConnectorSyncTelemetry(method, t))
1963
+ };
1964
+ }
1965
+ function validateConnectorHealthHistoryEntry(method, v) {
1966
+ const o = record(method, v);
1967
+ return {
1968
+ id: num(method, o, "id"),
1969
+ connectorId: str(method, o, "connectorId"),
1970
+ fromState: nullableStr(method, o, "fromState"),
1971
+ toState: str(method, o, "toState"),
1972
+ reason: nullableStr(method, o, "reason"),
1973
+ occurredAtMs: num(method, o, "occurredAtMs")
1974
+ };
1975
+ }
1976
+ function validateConnectorHealthHistory(method, v) {
1977
+ return arr(method, v).map((r) => validateConnectorHealthHistoryEntry(method, r));
1978
+ }
1979
+ function validateConnectorSetConfig(method, v) {
1980
+ const o = record(method, v);
1981
+ return {
1982
+ service: str(method, o, "service"),
1983
+ intervalMs: nullableNum(method, o, "intervalMs"),
1984
+ depth: nullableStr(method, o, "depth"),
1985
+ enabled: nullableBool(method, o, "enabled")
1986
+ };
1987
+ }
1988
+ function validateConnectorReindex(method, v) {
1989
+ const o = record(method, v);
1990
+ const depth = o["depth"];
1991
+ if (typeof depth !== "string" || !CONNECTOR_DEPTH_VALUES.has(depth)) {
1992
+ throw new IpcResponseError(method, `"depth" must be "metadata_only", "summary", or "full"`);
1993
+ }
1994
+ const mode = o["mode"];
1995
+ if (mode !== "shallow" && mode !== "deepen" && mode !== "same") {
1996
+ throw new IpcResponseError(method, `"mode" must be "shallow", "deepen", or "same"`);
1997
+ }
1998
+ return {
1999
+ itemsAffected: num(method, o, "itemsAffected"),
2000
+ depth,
2001
+ mode
2002
+ };
2003
+ }
2004
+ function validateConnectorAuth(method, v) {
2005
+ const o = record(method, v);
2006
+ if (!bool(method, o, "ok")) {
2007
+ throw new IpcResponseError(method, `"ok" must be true`);
2008
+ }
2009
+ const scopesGranted = arr(method, o["scopesGranted"]).map((s) => {
2010
+ if (typeof s !== "string") {
2011
+ throw new IpcResponseError(method, `"scopesGranted" must contain only strings`);
2012
+ }
2013
+ return s;
2014
+ });
2015
+ return { ok: true, serviceId: str(method, o, "serviceId"), scopesGranted };
2016
+ }
2017
+ function validateGatedOrElse(method, v, validateSuccess) {
2018
+ const o = record(method, v);
2019
+ if (o["status"] === "rejected") {
2020
+ return { status: "rejected", reason: str(method, o, "reason") };
2021
+ }
2022
+ return validateSuccess(method, o);
2023
+ }
2024
+ function validateConnectorAddMcp(method, v) {
2025
+ return validateGatedOrElse(method, v, (m, o) => {
2026
+ if (!bool(m, o, "ok")) {
2027
+ throw new IpcResponseError(m, `"ok" must be true`);
2028
+ }
2029
+ return { ok: true, serviceId: str(m, o, "serviceId") };
2030
+ });
2031
+ }
2032
+ function validateConnectorRemove(method, v) {
2033
+ return validateGatedOrElse(method, v, (m, o) => {
2034
+ if (!bool(m, o, "ok")) {
2035
+ throw new IpcResponseError(m, `"ok" must be true`);
2036
+ }
2037
+ const vaultKeysRemoved = arr(m, o["vaultKeysRemoved"]).map((k) => {
2038
+ if (typeof k !== "string") {
2039
+ throw new IpcResponseError(m, `"vaultKeysRemoved" must contain only strings`);
2040
+ }
2041
+ return k;
2042
+ });
2043
+ return { ok: true, itemsDeleted: num(m, o, "itemsDeleted"), vaultKeysRemoved };
2044
+ });
2045
+ }
2046
+ function validateWorkflowRow(method, v) {
2047
+ const o = record(method, v);
2048
+ return {
2049
+ id: str(method, o, "id"),
2050
+ name: str(method, o, "name"),
2051
+ description: nullableStr(method, o, "description"),
2052
+ steps_json: str(method, o, "steps_json"),
2053
+ created_at: num(method, o, "created_at"),
2054
+ updated_at: num(method, o, "updated_at")
2055
+ };
2056
+ }
2057
+ function validateWorkflowList(method, v) {
2058
+ const o = record(method, v);
2059
+ return { workflows: arr(method, o["workflows"]).map((w) => validateWorkflowRow(method, w)) };
2060
+ }
2061
+ function validateWorkflowSave(method, v) {
2062
+ const o = record(method, v);
2063
+ return { id: str(method, o, "id") };
2064
+ }
2065
+ function validateWorkflowRunHistoryRow(method, v) {
2066
+ const o = record(method, v);
2067
+ return {
2068
+ id: str(method, o, "id"),
2069
+ startedAt: num(method, o, "startedAt"),
2070
+ finishedAt: nullableNum(method, o, "finishedAt"),
2071
+ durationMs: nullableNum(method, o, "durationMs"),
2072
+ status: str(method, o, "status"),
2073
+ errorMsg: nullableStr(method, o, "errorMsg"),
2074
+ dryRun: bool(method, o, "dryRun"),
2075
+ paramsOverrideJson: nullableStr(method, o, "paramsOverrideJson"),
2076
+ triggeredBy: str(method, o, "triggeredBy")
2077
+ };
2078
+ }
2079
+ function validateWorkflowListRuns(method, v) {
2080
+ const o = record(method, v);
2081
+ return { runs: arr(method, o["runs"]).map((r) => validateWorkflowRunHistoryRow(method, r)) };
2082
+ }
2083
+ function validateWorkflowStepResult(method, v) {
2084
+ const o = record(method, v);
2085
+ const result = { status: str(method, o, "status") };
2086
+ const label = optStr(o, "label");
2087
+ if (label !== undefined)
2088
+ result.label = label;
2089
+ const output = optStr(o, "output");
2090
+ if (output !== undefined)
2091
+ result.output = output;
2092
+ const error = optStr(o, "error");
2093
+ if (error !== undefined)
2094
+ result.error = error;
2095
+ return result;
2096
+ }
2097
+ function validateWorkflowRun(method, v) {
2098
+ const o = record(method, v);
2099
+ return {
2100
+ runId: str(method, o, "runId"),
2101
+ dryRun: bool(method, o, "dryRun"),
2102
+ stepResults: arr(method, o["stepResults"]).map((s) => validateWorkflowStepResult(method, s))
2103
+ };
2104
+ }
1580
2105
 
1581
2106
  // src/nimbus-client.ts
1582
2107
  class NimbusClient {
@@ -1718,6 +2243,44 @@ class NimbusClient {
1718
2243
  const raw = await this.ipc.call("engine.cancelStream", { streamId });
1719
2244
  return validateOk("engine.cancelStream", raw);
1720
2245
  }
2246
+ async sessionAppend(params) {
2247
+ const raw = await this.ipc.call("session.append", {
2248
+ sessionId: params.sessionId,
2249
+ chunkText: params.chunkText,
2250
+ role: params.role
2251
+ });
2252
+ return validateOk("session.append", raw);
2253
+ }
2254
+ async sessionRecall(params) {
2255
+ const raw = await this.ipc.call("session.recall", {
2256
+ sessionId: params.sessionId,
2257
+ query: params.query,
2258
+ topK: params.topK
2259
+ });
2260
+ return validateSessionRecall("session.recall", raw);
2261
+ }
2262
+ async sessionList() {
2263
+ return validateSessionList("session.list", await this.ipc.call("session.list"));
2264
+ }
2265
+ async sessionClear(params = {}) {
2266
+ const raw = await this.ipc.call("session.clear", { sessionId: params.sessionId });
2267
+ return validateSessionClear("session.clear", raw);
2268
+ }
2269
+ async metricsDora(params) {
2270
+ const raw = await this.ipc.call("metrics.dora", {
2271
+ service: params.service,
2272
+ since: params.since
2273
+ });
2274
+ return validateDoraMetrics("metrics.dora", raw);
2275
+ }
2276
+ async deployPreflight(params) {
2277
+ const raw = await this.ipc.call("deploy.preflight", {
2278
+ service: params.service,
2279
+ target_ref: params.targetRef,
2280
+ max_findings: params.maxFindings
2281
+ });
2282
+ return validateDeployPreflight("deploy.preflight", raw);
2283
+ }
1721
2284
  async queryItems(params) {
1722
2285
  const raw = await this.ipc.call("index.queryItems", {
1723
2286
  services: params.services,
@@ -1811,6 +2374,114 @@ class NimbusClient {
1811
2374
  async adminStatus() {
1812
2375
  return validateGatewayStatus("admin.status", await this.ipc.call("admin.status"));
1813
2376
  }
2377
+ async connectorListStatus(params = {}) {
2378
+ const raw = await this.ipc.call("connector.listStatus", { serviceId: params.serviceId });
2379
+ return validateConnectorSyncStatusList("connector.listStatus", raw);
2380
+ }
2381
+ async connectorStatus(params) {
2382
+ const raw = await this.ipc.call("connector.status", {
2383
+ serviceId: params.serviceId,
2384
+ includeStats: params.includeStats
2385
+ });
2386
+ return validateConnectorStatusResult("connector.status", raw);
2387
+ }
2388
+ async connectorHealthHistory(params) {
2389
+ const raw = await this.ipc.call("connector.healthHistory", {
2390
+ service: params.service,
2391
+ limit: params.limit
2392
+ });
2393
+ return validateConnectorHealthHistory("connector.healthHistory", raw);
2394
+ }
2395
+ async connectorPause(params) {
2396
+ const raw = await this.ipc.call("connector.pause", { serviceId: params.serviceId });
2397
+ return validateOk("connector.pause", raw);
2398
+ }
2399
+ async connectorResume(params) {
2400
+ const raw = await this.ipc.call("connector.resume", { serviceId: params.serviceId });
2401
+ return validateOk("connector.resume", raw);
2402
+ }
2403
+ async connectorSetInterval(params) {
2404
+ const raw = await this.ipc.call("connector.setInterval", {
2405
+ serviceId: params.serviceId,
2406
+ intervalMs: params.intervalMs
2407
+ });
2408
+ return validateOk("connector.setInterval", raw);
2409
+ }
2410
+ async connectorSetConfig(params) {
2411
+ const raw = await this.ipc.call("connector.setConfig", {
2412
+ serviceId: params.serviceId,
2413
+ intervalMs: params.intervalMs,
2414
+ depth: params.depth,
2415
+ enabled: params.enabled
2416
+ });
2417
+ return validateConnectorSetConfig("connector.setConfig", raw);
2418
+ }
2419
+ async connectorSync(params) {
2420
+ const raw = await this.ipc.call("connector.sync", {
2421
+ serviceId: params.serviceId,
2422
+ full: params.full
2423
+ });
2424
+ return validateOk("connector.sync", raw);
2425
+ }
2426
+ async connectorAuth(params) {
2427
+ const raw = await this.ipc.call("connector.auth", params);
2428
+ return validateConnectorAuth("connector.auth", raw);
2429
+ }
2430
+ async connectorAddMcp(params) {
2431
+ const raw = await this.ipc.call("connector.addMcp", {
2432
+ serviceId: params.serviceId,
2433
+ commandLine: params.commandLine
2434
+ });
2435
+ return validateConnectorAddMcp("connector.addMcp", raw);
2436
+ }
2437
+ async connectorRemove(params) {
2438
+ const raw = await this.ipc.call("connector.remove", {
2439
+ serviceId: params.serviceId,
2440
+ service: params.serviceId
2441
+ });
2442
+ return validateConnectorRemove("connector.remove", raw);
2443
+ }
2444
+ async connectorReindex(params) {
2445
+ const raw = await this.ipc.call("connector.reindex", {
2446
+ service: params.service,
2447
+ depth: params.depth
2448
+ });
2449
+ return validateConnectorReindex("connector.reindex", raw);
2450
+ }
2451
+ async workflowList() {
2452
+ return validateWorkflowList("workflow.list", await this.ipc.call("workflow.list"));
2453
+ }
2454
+ async workflowSave(params) {
2455
+ const raw = await this.ipc.call("workflow.save", {
2456
+ name: params.name,
2457
+ description: params.description,
2458
+ stepsJson: params.stepsJson
2459
+ });
2460
+ return validateWorkflowSave("workflow.save", raw);
2461
+ }
2462
+ async workflowDelete(params) {
2463
+ const raw = await this.ipc.call("workflow.delete", { name: params.name });
2464
+ return validateOk("workflow.delete", raw);
2465
+ }
2466
+ async workflowListRuns(params) {
2467
+ const raw = await this.ipc.call("workflow.listRuns", {
2468
+ workflowName: params.workflowName,
2469
+ limit: params.limit
2470
+ });
2471
+ return validateWorkflowListRuns("workflow.listRuns", raw);
2472
+ }
2473
+ async workflowRun(params) {
2474
+ const raw = await this.ipc.call("workflow.run", {
2475
+ name: params.name,
2476
+ triggeredBy: params.triggeredBy,
2477
+ dryRun: params.dryRun,
2478
+ stream: params.stream,
2479
+ sessionId: params.sessionId,
2480
+ agent: params.agent,
2481
+ paramsOverride: params.paramsOverride
2482
+ });
2483
+ return validateWorkflowRun("workflow.run", raw);
2484
+ }
1814
2485
  async close() {
1815
2486
  await this.ipc.disconnect();
1816
2487
  }