@eng-ai/sdk 2.8.1 → 2.8.3

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/CHANGELOG.md CHANGED
@@ -2,13 +2,28 @@
2
2
 
3
3
  All notable changes to `@eng-ai/sdk` will be documented in this file.
4
4
 
5
- ## 2.8.1 - 2026-04-09
5
+ ## 2.8.3 - 2026-04-09
6
+
7
+ ### Added
8
+
9
+ - External Project Context Suggestion confirmation API (v2) in SDK:
10
+ - `confirmProjectContextSuggestion(projectId, suggestionId, { summary, proposedPatch, expiresAt, checksum })`
11
+ - Enables external API/SDK consumers to confirm `context_update_suggestion` from project chat and apply canonical context updates safely.
12
+
13
+ ### Changed
14
+
15
+ - README updated with end-to-end project chat suggestion confirmation example.
16
+
17
+ ## 2.8.2 - 2026-04-09
6
18
 
7
19
  ### Added
8
20
 
9
21
  - External Project Knowledge pages API (v2) in SDK:
10
22
  - `listProjectKnowledgePages(projectId, { limit? })`
11
23
  - Enables external integrations to inspect compiled knowledge pages (`wiki/index/log`) for user-facing observability.
24
+ - External Project Intake APIs (v2) in SDK:
25
+ - `getProjectIntakeStatus(projectId)`
26
+ - `runProjectIntake(projectId, { mode?: "initial_full" | "delta_refresh" })`
12
27
 
13
28
  ## 2.8.0 - 2026-04-09
14
29
 
package/README.md CHANGED
@@ -81,6 +81,17 @@ const context = await client.getProjectContext(project.id);
81
81
  console.log(context.autonomous_tasks_mode);
82
82
  ```
83
83
 
84
+ Project intake (initial_full and delta_refresh):
85
+
86
+ ```js
87
+ const intakeStatus = await client.getProjectIntakeStatus(project.id);
88
+ if (intakeStatus.intake_status === "ready") {
89
+ await client.runProjectIntake(project.id, { mode: "delta_refresh" });
90
+ } else {
91
+ await client.runProjectIntake(project.id, { mode: "initial_full" });
92
+ }
93
+ ```
94
+
84
95
  Project knowledge (status, lint issues, manual rebuild):
85
96
 
86
97
  ```js
@@ -99,6 +110,25 @@ await client.rebuildProjectKnowledge(project.id, {
99
110
  console.log(knowledgeStatus.status, knowledgePages.length, knowledgeIssues.length);
100
111
  ```
101
112
 
113
+ Project chat suggestion confirmation (when response includes `context_update_suggestion`):
114
+
115
+ ```js
116
+ const response = await client.invokeAgent({
117
+ message: "A ART e licenças foram entregues, estamos em dia agora.",
118
+ projectId: project.id,
119
+ });
120
+
121
+ const suggestion = response?.context_update_suggestion;
122
+ if (suggestion) {
123
+ await client.confirmProjectContextSuggestion(project.id, suggestion.suggestion_id, {
124
+ summary: suggestion.summary,
125
+ proposedPatch: suggestion.proposed_patch,
126
+ expiresAt: suggestion.expires_at,
127
+ checksum: suggestion.checksum,
128
+ });
129
+ }
130
+ ```
131
+
102
132
  Project documents (tags, filters, upload, update):
103
133
 
104
134
  ```js
@@ -147,10 +177,13 @@ Supported automation plan actions:
147
177
 
148
178
  Supported project knowledge actions:
149
179
 
180
+ - `getProjectIntakeStatus(projectId)`
181
+ - `runProjectIntake(projectId, { mode? })`
150
182
  - `getProjectKnowledgeStatus(projectId)`
151
183
  - `listProjectKnowledgePages(projectId, { limit? })`
152
184
  - `listProjectKnowledgeIssues(projectId, { onlyOpen?, limit? })`
153
185
  - `rebuildProjectKnowledge(projectId, { idempotencyKey? })`
186
+ - `confirmProjectContextSuggestion(projectId, suggestionId, { summary, proposedPatch, expiresAt, checksum })`
154
187
 
155
188
  External user settings (API key owner scope):
156
189
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eng-ai/sdk",
3
- "version": "2.8.1",
3
+ "version": "2.8.3",
4
4
  "description": "Official JavaScript SDK for ENG-AI External API v2",
5
5
  "type": "module",
6
6
  "main": "./src/client.js",
package/src/client.js CHANGED
@@ -7,6 +7,7 @@ const VALID_AUTONOMOUS_TASKS_MODES = new Set([
7
7
  "approval_delete_only",
8
8
  "full_autonomy",
9
9
  ]);
10
+ const VALID_PROJECT_INTAKE_MODES = new Set(["initial_full", "delta_refresh"]);
10
11
  const VALID_DOCUMENT_TAG_MODES = new Set(["any", "all"]);
11
12
 
12
13
  function isPlainObject(value) {
@@ -678,6 +679,74 @@ export class EngAIClient {
678
679
  });
679
680
  }
680
681
 
682
+ async confirmProjectContextSuggestion(projectId, suggestionId, payload = {}) {
683
+ const normalizedProjectId = this._requireNonEmptyString(projectId, "projectId");
684
+ const normalizedSuggestionId = this._requireNonEmptyString(suggestionId, "suggestionId");
685
+ const summary = this._requireNonEmptyString(payload.summary, "summary");
686
+ const expiresAt = this._requireNonEmptyString(
687
+ payload.expiresAt ?? payload.expires_at,
688
+ "expiresAt"
689
+ );
690
+ const checksum = this._requireNonEmptyString(payload.checksum, "checksum");
691
+ const proposedPatch = payload.proposedPatch ?? payload.proposed_patch;
692
+
693
+ if (!isPlainObject(proposedPatch)) {
694
+ throw new EngAIError("proposedPatch must be an object", {
695
+ status: 400,
696
+ code: "validation_error",
697
+ detail: "proposedPatch/proposed_patch must be a JSON object",
698
+ });
699
+ }
700
+
701
+ return await this._request(
702
+ `/projects/${encodeURIComponent(normalizedProjectId)}/context/suggestions/${encodeURIComponent(normalizedSuggestionId)}/confirm`,
703
+ {
704
+ method: "POST",
705
+ body: {
706
+ summary,
707
+ proposed_patch: proposedPatch,
708
+ expires_at: expiresAt,
709
+ checksum,
710
+ },
711
+ }
712
+ );
713
+ }
714
+
715
+ async getProjectIntakeStatus(projectId) {
716
+ const normalizedProjectId = this._requireNonEmptyString(projectId, "projectId");
717
+ return await this._request(
718
+ `/projects/${encodeURIComponent(normalizedProjectId)}/intake-status`,
719
+ {
720
+ method: "GET",
721
+ }
722
+ );
723
+ }
724
+
725
+ async runProjectIntake(projectId, options = {}) {
726
+ const normalizedProjectId = this._requireNonEmptyString(projectId, "projectId");
727
+ const payload = {};
728
+ const requestedMode = options?.mode;
729
+ if (requestedMode !== undefined && requestedMode !== null) {
730
+ const normalizedMode = String(requestedMode).trim().toLowerCase();
731
+ if (!VALID_PROJECT_INTAKE_MODES.has(normalizedMode)) {
732
+ throw new EngAIError("invalid mode for runProjectIntake", {
733
+ status: 400,
734
+ code: "validation_error",
735
+ detail: "mode must be one of: initial_full, delta_refresh",
736
+ });
737
+ }
738
+ payload.mode = normalizedMode;
739
+ }
740
+
741
+ return await this._request(
742
+ `/projects/${encodeURIComponent(normalizedProjectId)}/intake`,
743
+ {
744
+ method: "POST",
745
+ body: payload,
746
+ }
747
+ );
748
+ }
749
+
681
750
  async getProjectKnowledgeStatus(projectId) {
682
751
  const normalizedProjectId = this._requireNonEmptyString(projectId, "projectId");
683
752
  return await this._request(