@builder.io/ai-utils 0.27.2 → 0.27.4
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/package.json +1 -1
- package/src/claw.d.ts +18 -30
- package/src/codegen.d.ts +23 -7
- package/src/projects.d.ts +137 -2
- package/src/projects.js +21 -0
package/package.json
CHANGED
package/src/claw.d.ts
CHANGED
|
@@ -1,37 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
category: string;
|
|
4
|
-
memory: string;
|
|
5
|
-
when: string;
|
|
6
|
-
glob: string | null;
|
|
7
|
-
updatedAt: number;
|
|
8
|
-
}
|
|
9
|
-
export interface OrgBranchCreator {
|
|
1
|
+
import type { NewBranch, Project, MemorySummary } from "./projects";
|
|
2
|
+
export interface OrgTreeUser {
|
|
10
3
|
userId: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
lastUpdatedAt: number;
|
|
19
|
-
state: string;
|
|
20
|
-
createdBy?: OrgBranchCreator;
|
|
4
|
+
name?: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
role?: string;
|
|
7
|
+
jobFunctions?: string;
|
|
8
|
+
githubUsername?: string;
|
|
9
|
+
gitlabUsername?: string;
|
|
10
|
+
bitbucketUsername?: string;
|
|
21
11
|
}
|
|
22
|
-
export interface
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
repoUrl?: string;
|
|
27
|
-
pinned?: boolean;
|
|
28
|
-
archived?: boolean;
|
|
29
|
-
branchCount: number;
|
|
30
|
-
memories?: OrgTreeMemorySummary[];
|
|
12
|
+
export interface OrgTreeEnvironmentVariable {
|
|
13
|
+
key: string;
|
|
14
|
+
value: string;
|
|
15
|
+
isSecret: boolean;
|
|
31
16
|
}
|
|
32
17
|
export interface OrgTreeResult {
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
projects: Project[];
|
|
19
|
+
branches: NewBranch[];
|
|
20
|
+
users: OrgTreeUser[];
|
|
21
|
+
memories: MemorySummary[];
|
|
22
|
+
environmentVariables?: OrgTreeEnvironmentVariable[];
|
|
35
23
|
}
|
|
36
24
|
export interface ClawMessageContext {
|
|
37
25
|
channelId: string;
|
package/src/codegen.d.ts
CHANGED
|
@@ -186,6 +186,8 @@ export interface RevertToolInput {
|
|
|
186
186
|
}
|
|
187
187
|
export interface TodoReadToolInput {
|
|
188
188
|
}
|
|
189
|
+
export interface RunningAgentsToolInput {
|
|
190
|
+
}
|
|
189
191
|
export interface TodoWriteToolInput {
|
|
190
192
|
mode: "replace" | "patch";
|
|
191
193
|
todos: {
|
|
@@ -481,18 +483,21 @@ export interface SendMessageToolInput {
|
|
|
481
483
|
markdown: string;
|
|
482
484
|
status: "starting" | "question" | "done:success" | "done:error";
|
|
483
485
|
}
|
|
484
|
-
export interface ReadChannelToolInput {
|
|
485
|
-
channelId: string;
|
|
486
|
-
limit?: number;
|
|
487
|
-
}
|
|
488
486
|
export interface SpawnBranchToolInput {
|
|
489
487
|
projectId: string;
|
|
490
488
|
message: string;
|
|
489
|
+
builderUserId?: string;
|
|
490
|
+
hidden?: boolean;
|
|
491
491
|
}
|
|
492
492
|
export interface SendMessageToBranchToolInput {
|
|
493
493
|
projectId: string;
|
|
494
494
|
branchName: string;
|
|
495
495
|
message: string;
|
|
496
|
+
builderUserId?: string;
|
|
497
|
+
}
|
|
498
|
+
export interface ReadBranchToolInput {
|
|
499
|
+
projectId: string;
|
|
500
|
+
branchName: string;
|
|
496
501
|
}
|
|
497
502
|
/** Comment for PR review - used by both SubmitPRReview and SubmitRecording */
|
|
498
503
|
export interface PRReviewComment {
|
|
@@ -596,9 +601,10 @@ export interface CodeGenToolMap {
|
|
|
596
601
|
VerifyRuntimeDependency: VerifyRuntimeDependencyToolInput;
|
|
597
602
|
SetEnvVariable: SetEnvVariableToolInput;
|
|
598
603
|
SendMessage: SendMessageToolInput;
|
|
599
|
-
ReadChannel: ReadChannelToolInput;
|
|
600
604
|
SpawnBranch: SpawnBranchToolInput;
|
|
601
605
|
SendMessageToBranch: SendMessageToBranchToolInput;
|
|
606
|
+
ReadBranch: ReadBranchToolInput;
|
|
607
|
+
RunningAgents: RunningAgentsToolInput;
|
|
602
608
|
}
|
|
603
609
|
export type CodeGenTools = keyof CodeGenToolMap;
|
|
604
610
|
export type AllCodeGenTools = CodeGenTools | "web_search";
|
|
@@ -1427,7 +1433,7 @@ export interface CheckBackupDataResultStale {
|
|
|
1427
1433
|
}
|
|
1428
1434
|
export interface CheckBackupDataResultInvalid {
|
|
1429
1435
|
state: "invalid";
|
|
1430
|
-
outcome: "no-backup" | "error" | "not-completed" | "no-session-id" | "no-last-commit-hash" | "no-backup-file" | "empty-full-backup" | "no-vcpCodeGenEvent" | "commits-not-in-repo" | "no-after-commit" | "no-signed-url" | "no-git-branch-name" | "repo-url-mismatch" | "branch-uninitialized" | "unexpected-partial-backup" | "unexpected-full-backup";
|
|
1436
|
+
outcome: "no-backup" | "error" | "not-completed" | "no-session-id" | "no-last-commit-hash" | "no-backup-file" | "empty-full-backup" | "no-vcpCodeGenEvent" | "commits-not-in-repo" | "no-after-commit" | "no-signed-url" | "no-git-branch-name" | "repo-url-mismatch" | "branch-uninitialized" | "unexpected-partial-backup" | "unexpected-full-backup" | "no-backup-keys";
|
|
1431
1437
|
message: string;
|
|
1432
1438
|
backup: BranchBackup | undefined;
|
|
1433
1439
|
}
|
|
@@ -1435,6 +1441,13 @@ export type CheckBackupDataResult = CheckBackupDataResultValid | CheckBackupData
|
|
|
1435
1441
|
export interface BackupMetadata {
|
|
1436
1442
|
check: CheckBackupDataResultValid | CheckBackupDataResultStale | CheckBackupDataResultForcedBackup;
|
|
1437
1443
|
downloadUrl: GitBackupDownloadUrlResult | undefined;
|
|
1444
|
+
downloadUrlError?: string;
|
|
1445
|
+
}
|
|
1446
|
+
export interface AllBackupsCheckResult {
|
|
1447
|
+
/** true only if ALL folders have valid/stale/forced-backup state */
|
|
1448
|
+
allValid: boolean;
|
|
1449
|
+
/** Per-folder check results keyed by backup key ("code", repoHash, etc.) */
|
|
1450
|
+
results: Record<string, CheckBackupDataResult>;
|
|
1438
1451
|
}
|
|
1439
1452
|
export interface WorkspaceFolder {
|
|
1440
1453
|
enableGit?: boolean;
|
|
@@ -1464,8 +1477,10 @@ export interface GitRepoContext {
|
|
|
1464
1477
|
path: string;
|
|
1465
1478
|
/** Feature branch name */
|
|
1466
1479
|
branchName: string;
|
|
1467
|
-
/**
|
|
1480
|
+
/** Authenticated repo URL (may contain ephemeral token) */
|
|
1468
1481
|
repoUrl?: string;
|
|
1482
|
+
/** Clean repo URL without auth tokens, for stable storage and refs */
|
|
1483
|
+
originalRepoUrl?: string;
|
|
1469
1484
|
/** Repo name (e.g., owner/repo) */
|
|
1470
1485
|
repoName?: string;
|
|
1471
1486
|
/**
|
|
@@ -1508,6 +1523,7 @@ export interface AccessResult {
|
|
|
1508
1523
|
message: string;
|
|
1509
1524
|
}
|
|
1510
1525
|
export interface RemoteMachineConfig {
|
|
1526
|
+
environment: "cloud" | "cloud-v2" | "containerized" | "container-less" | "unknown";
|
|
1511
1527
|
cpus: number;
|
|
1512
1528
|
memory: number;
|
|
1513
1529
|
region: string;
|
package/src/projects.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConnectivityErrorCode, CheckType, LikelyCause } from "./connectivity/types.js";
|
|
2
|
-
import type { FileOverride, EnvironmentVariable, LaunchServerState, LaunchServerStatus, BranchBackup, CommitMode, CustomInstruction, CustomAgentDefinition, GitSnapshot, AutoPushMode, GenerateUserMessage, CodeGenToolMap } from "./codegen";
|
|
2
|
+
import type { FileOverride, EnvironmentVariable, LaunchServerState, LaunchServerStatus, BranchBackup, CommitMode, CustomInstruction, CustomAgentDefinition, GitSnapshot, AutoPushMode, GenerateUserMessage, CodeGenToolMap, GenerateCompletionStep } from "./codegen";
|
|
3
3
|
import type { FallbackTokensPrivate } from "./organization";
|
|
4
4
|
/**
|
|
5
5
|
* Temporary type for date fields during migration.
|
|
@@ -302,6 +302,7 @@ export interface BackupGitRepoResultValid {
|
|
|
302
302
|
empty: boolean;
|
|
303
303
|
lastCommitHash: string;
|
|
304
304
|
backupRef: string | undefined;
|
|
305
|
+
backupEntry: GitBackupRecordOptions;
|
|
305
306
|
}
|
|
306
307
|
export interface BackupGitRepoResultInvalid {
|
|
307
308
|
success: false;
|
|
@@ -415,7 +416,7 @@ export interface OrgAgentConfig {
|
|
|
415
416
|
enabledTools: string[];
|
|
416
417
|
longLived: boolean;
|
|
417
418
|
}
|
|
418
|
-
export type BranchType = "code-review" | "setup-project" | "org-agent" | "
|
|
419
|
+
export type BranchType = "code-review" | "setup-project" | "org-agent" | "default";
|
|
419
420
|
export interface BranchSharedData {
|
|
420
421
|
appName?: string | null;
|
|
421
422
|
prNumber?: number | null;
|
|
@@ -552,6 +553,7 @@ export interface Project {
|
|
|
552
553
|
repoFullName: string | undefined;
|
|
553
554
|
repoProvider: string;
|
|
554
555
|
repoProtocol: string | undefined;
|
|
556
|
+
description?: string;
|
|
555
557
|
repoDescription?: string;
|
|
556
558
|
repoPrivate: boolean;
|
|
557
559
|
repoUrl: string | undefined;
|
|
@@ -778,6 +780,83 @@ export interface CreateBranchOptions {
|
|
|
778
780
|
/** Optional suffix to append to generated branch names (e.g., model short name for parallel branches) */
|
|
779
781
|
branchNameSuffix?: string;
|
|
780
782
|
}
|
|
783
|
+
interface BaseCreateBranchMessage {
|
|
784
|
+
}
|
|
785
|
+
export interface ValidatingProjectMessage extends BaseCreateBranchMessage {
|
|
786
|
+
type: "validating-project";
|
|
787
|
+
message: string;
|
|
788
|
+
projectId: string;
|
|
789
|
+
projectName?: string;
|
|
790
|
+
branchName: string;
|
|
791
|
+
}
|
|
792
|
+
export interface CreatingBranchMessage extends BaseCreateBranchMessage {
|
|
793
|
+
type: "creating-branch";
|
|
794
|
+
message: string;
|
|
795
|
+
projectId: string;
|
|
796
|
+
projectName: string;
|
|
797
|
+
branchName: string;
|
|
798
|
+
branchFriendlyName: string | undefined;
|
|
799
|
+
}
|
|
800
|
+
export interface SettingUpContainerMessage extends BaseCreateBranchMessage {
|
|
801
|
+
type: "setting-up-container";
|
|
802
|
+
message: string;
|
|
803
|
+
projectId: string;
|
|
804
|
+
projectName: string;
|
|
805
|
+
branchName: string;
|
|
806
|
+
branchFriendlyName: string | undefined;
|
|
807
|
+
}
|
|
808
|
+
export interface ContainerReadyMessage extends BaseCreateBranchMessage {
|
|
809
|
+
type: "container-ready";
|
|
810
|
+
message: string;
|
|
811
|
+
projectId: string;
|
|
812
|
+
projectName: string;
|
|
813
|
+
branchName: string;
|
|
814
|
+
url: string;
|
|
815
|
+
}
|
|
816
|
+
export interface SendingInitialMessageMessage extends BaseCreateBranchMessage {
|
|
817
|
+
type: "sending-initial-message";
|
|
818
|
+
message: string;
|
|
819
|
+
projectId: string;
|
|
820
|
+
projectName: string;
|
|
821
|
+
branchName: string;
|
|
822
|
+
}
|
|
823
|
+
export interface BranchCreatedMessage extends BaseCreateBranchMessage {
|
|
824
|
+
type: "branch-created";
|
|
825
|
+
message: string;
|
|
826
|
+
projectId: string;
|
|
827
|
+
projectName: string;
|
|
828
|
+
branchName: string;
|
|
829
|
+
url: string;
|
|
830
|
+
}
|
|
831
|
+
export interface CreateBranchErrorMessage extends BaseCreateBranchMessage {
|
|
832
|
+
type: "error";
|
|
833
|
+
message: string;
|
|
834
|
+
error: string;
|
|
835
|
+
projectId: string;
|
|
836
|
+
projectName?: string;
|
|
837
|
+
branchName?: string;
|
|
838
|
+
}
|
|
839
|
+
export interface EnsureContainerMessage extends BaseCreateBranchMessage {
|
|
840
|
+
type: "ensure-container";
|
|
841
|
+
event: ProjectsChunkMessage;
|
|
842
|
+
}
|
|
843
|
+
export interface AiMessage extends BaseCreateBranchMessage {
|
|
844
|
+
type: "ai";
|
|
845
|
+
event: GenerateCompletionStep;
|
|
846
|
+
}
|
|
847
|
+
export type CreateBranchChunkMessage = ValidatingProjectMessage | CreatingBranchMessage | SettingUpContainerMessage | SendingInitialMessageMessage | BranchCreatedMessage | CreateBranchErrorMessage | EnsureContainerMessage | ContainerReadyMessage | AiMessage;
|
|
848
|
+
export interface CreateBranchResponse {
|
|
849
|
+
success: boolean;
|
|
850
|
+
branchName?: string;
|
|
851
|
+
projectId: string;
|
|
852
|
+
projectName?: string;
|
|
853
|
+
url?: string;
|
|
854
|
+
error?: string;
|
|
855
|
+
messageResponse?: string;
|
|
856
|
+
sentryId?: string;
|
|
857
|
+
branchId?: string;
|
|
858
|
+
sessionId?: string;
|
|
859
|
+
}
|
|
781
860
|
export interface SendMessageOptions {
|
|
782
861
|
projectId: string;
|
|
783
862
|
branchName: string;
|
|
@@ -788,4 +867,60 @@ export interface SendMessageOptions {
|
|
|
788
867
|
fireAndForget?: boolean;
|
|
789
868
|
canHandleTools?: (keyof CodeGenToolMap)[];
|
|
790
869
|
}
|
|
870
|
+
export interface MemoryData {
|
|
871
|
+
completionId: string;
|
|
872
|
+
sessionId: string;
|
|
873
|
+
id: string;
|
|
874
|
+
scope: "global" | "user" | "project";
|
|
875
|
+
memory: string;
|
|
876
|
+
when: string;
|
|
877
|
+
commit: string | null;
|
|
878
|
+
category: string;
|
|
879
|
+
/** Glob pattern for file-based memory retrieval. Should be specific (e.g., "src/components/Button.tsx") rather than broad (e.g., "*.tsx"). */
|
|
880
|
+
glob: string | null;
|
|
881
|
+
importance?: number;
|
|
882
|
+
glob_auto_include?: boolean;
|
|
883
|
+
ownerId: string;
|
|
884
|
+
projectId: string | null;
|
|
885
|
+
branchName: string | null;
|
|
886
|
+
repoHash: string | null;
|
|
887
|
+
userId: string | null;
|
|
888
|
+
createdAt: number;
|
|
889
|
+
updatedAt: number;
|
|
890
|
+
modelOverride: string | null;
|
|
891
|
+
approved: boolean;
|
|
892
|
+
needsConsolidation: boolean;
|
|
893
|
+
embedding: any | null;
|
|
894
|
+
embeddingModel: string | null;
|
|
895
|
+
position: string;
|
|
896
|
+
/** Number of memories merged into this one (default: 1). Acts as importance signal (myelin analogy). */
|
|
897
|
+
mergeCount: number;
|
|
898
|
+
/** Array of memory IDs that were archived to create this consolidated memory. Used for audit trail and rollback. */
|
|
899
|
+
mergedMemoryIds: string[];
|
|
900
|
+
/** Memory ID that archived this memory. Set when this memory gets consolidated into a new one. */
|
|
901
|
+
archivedBy: string | undefined;
|
|
902
|
+
archived: boolean;
|
|
903
|
+
/** Schema version for consolidation process (for future algorithm changes). */
|
|
904
|
+
consolidationVersion: number | undefined;
|
|
905
|
+
/** Timestamp of last consolidation processing */
|
|
906
|
+
lastConsolidatedAt: number | undefined;
|
|
907
|
+
reads: number;
|
|
908
|
+
/** Times memory led to positive outcome (default: 0) */
|
|
909
|
+
successCount: number;
|
|
910
|
+
/** Times memory was misleading (default: 0) */
|
|
911
|
+
failureCount: number;
|
|
912
|
+
/** Times memory was partially helpful (default: 0) */
|
|
913
|
+
partialCount: number;
|
|
914
|
+
/** Total times memory was scored (successCount + failureCount + partialCount) */
|
|
915
|
+
totalUses: number;
|
|
916
|
+
/** Timestamp of last scoring */
|
|
917
|
+
lastScoredAt: number | undefined;
|
|
918
|
+
}
|
|
919
|
+
export declare const MEMORY_PICKED_FIELDS: readonly ["id", "updatedAt", "category", "successCount", "partialCount", "failureCount", "totalUses", "when", "glob", "memory"];
|
|
920
|
+
export declare const MEMORY_SUMMARY_FIELDS: readonly ["id", "category", "projectId", "memory", "when", "glob", "updatedAt"];
|
|
921
|
+
export interface MemorySummary extends Pick<MemoryData, (typeof MEMORY_SUMMARY_FIELDS)[number]> {
|
|
922
|
+
}
|
|
923
|
+
export interface GetProjectMemoriesResult {
|
|
924
|
+
memories: MemorySummary[];
|
|
925
|
+
}
|
|
791
926
|
export {};
|
package/src/projects.js
CHANGED
|
@@ -71,3 +71,24 @@ export const isBranchArchived = (branch) => {
|
|
|
71
71
|
export const isProjectDeleted = (project) => {
|
|
72
72
|
return getProjectState(project) === "deleted";
|
|
73
73
|
};
|
|
74
|
+
export const MEMORY_PICKED_FIELDS = [
|
|
75
|
+
"id",
|
|
76
|
+
"updatedAt",
|
|
77
|
+
"category",
|
|
78
|
+
"successCount",
|
|
79
|
+
"partialCount",
|
|
80
|
+
"failureCount",
|
|
81
|
+
"totalUses",
|
|
82
|
+
"when",
|
|
83
|
+
"glob",
|
|
84
|
+
"memory",
|
|
85
|
+
];
|
|
86
|
+
export const MEMORY_SUMMARY_FIELDS = [
|
|
87
|
+
"id",
|
|
88
|
+
"category",
|
|
89
|
+
"projectId",
|
|
90
|
+
"memory",
|
|
91
|
+
"when",
|
|
92
|
+
"glob",
|
|
93
|
+
"updatedAt",
|
|
94
|
+
];
|