@agentrix/shared 1.0.7 → 1.0.9
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 +89 -4
- package/dist/index.d.cts +1435 -17
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var zod = require('zod');
|
|
4
4
|
var node_fs = require('node:fs');
|
|
5
5
|
var node_path = require('node:path');
|
|
6
|
+
var os = require('node:os');
|
|
6
7
|
var tweetnacl = require('tweetnacl');
|
|
7
8
|
var base64js = require('base64-js');
|
|
8
9
|
|
|
@@ -23,6 +24,7 @@ function _interopNamespaceDefault(e) {
|
|
|
23
24
|
return Object.freeze(n);
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
var os__namespace = /*#__PURE__*/_interopNamespaceDefault(os);
|
|
26
28
|
var base64js__namespace = /*#__PURE__*/_interopNamespaceDefault(base64js);
|
|
27
29
|
|
|
28
30
|
const ApiErrorSchema = zod.z.object({
|
|
@@ -178,6 +180,22 @@ const CloudJoinApprovalRequestSchema = zod.z.object({
|
|
|
178
180
|
userId: zod.z.string(),
|
|
179
181
|
cloudId: zod.z.string()
|
|
180
182
|
});
|
|
183
|
+
const TaskSharePermissionsSchema = zod.z.object({
|
|
184
|
+
canSendMessage: zod.z.boolean(),
|
|
185
|
+
canCreatePr: zod.z.boolean(),
|
|
186
|
+
canApprovePr: zod.z.boolean(),
|
|
187
|
+
canViewPr: zod.z.boolean(),
|
|
188
|
+
canMergePr: zod.z.boolean()
|
|
189
|
+
});
|
|
190
|
+
const ShareAuthQuerySchema = zod.z.object({
|
|
191
|
+
code: zod.z.string()
|
|
192
|
+
});
|
|
193
|
+
const ShareAuthResponseSchema = zod.z.object({
|
|
194
|
+
success: zod.z.literal(true),
|
|
195
|
+
shareToken: zod.z.string(),
|
|
196
|
+
taskId: zod.z.string(),
|
|
197
|
+
permissions: TaskSharePermissionsSchema
|
|
198
|
+
});
|
|
181
199
|
|
|
182
200
|
const StartTaskRequestSchema = zod.z.object({
|
|
183
201
|
chatId: zod.z.string(),
|
|
@@ -395,6 +413,24 @@ const CreateMergeRequestResponseSchema = zod.z.object({
|
|
|
395
413
|
reason: zod.z.string().optional()
|
|
396
414
|
// failed-reason
|
|
397
415
|
});
|
|
416
|
+
const ApprovePrRequestSchema = zod.z.object({});
|
|
417
|
+
const ApprovePrResponseSchema = zod.z.object({
|
|
418
|
+
success: zod.z.boolean(),
|
|
419
|
+
taskId: zod.z.string(),
|
|
420
|
+
pullRequestNumber: zod.z.number()
|
|
421
|
+
});
|
|
422
|
+
const CreateTaskShareSchema = zod.z.object({
|
|
423
|
+
permissions: TaskSharePermissionsSchema.optional().default({
|
|
424
|
+
canSendMessage: false,
|
|
425
|
+
canCreatePr: false,
|
|
426
|
+
canApprovePr: false,
|
|
427
|
+
canViewPr: true,
|
|
428
|
+
canMergePr: false
|
|
429
|
+
})
|
|
430
|
+
});
|
|
431
|
+
const CreateTaskShareResponseSchema = zod.z.object({
|
|
432
|
+
shareCode: zod.z.string()
|
|
433
|
+
});
|
|
398
434
|
const ArchiveTaskRequestSchema = zod.z.object({});
|
|
399
435
|
const ArchiveTaskResponseSchema = zod.z.object({
|
|
400
436
|
success: zod.z.boolean(),
|
|
@@ -462,6 +498,31 @@ const ListChatTasksResponseSchema = zod.z.object({
|
|
|
462
498
|
});
|
|
463
499
|
|
|
464
500
|
const AgentTypeSchema = zod.z.enum(["claude", "codex"]);
|
|
501
|
+
const DisplayConfigKeysSchema = zod.z.object({
|
|
502
|
+
// PR Actions
|
|
503
|
+
createPR: zod.z.string().optional(),
|
|
504
|
+
viewPR: zod.z.string().optional(),
|
|
505
|
+
mergePR: zod.z.string().optional(),
|
|
506
|
+
approvePR: zod.z.string().optional(),
|
|
507
|
+
merged: zod.z.string().optional(),
|
|
508
|
+
closed: zod.z.string().optional(),
|
|
509
|
+
recreatePR: zod.z.string().optional(),
|
|
510
|
+
// Share Permissions
|
|
511
|
+
permissionCanSendMessage: zod.z.string().optional(),
|
|
512
|
+
permissionCanSendMessageDesc: zod.z.string().optional(),
|
|
513
|
+
permissionCanCreatePr: zod.z.string().optional(),
|
|
514
|
+
permissionCanCreatePrDesc: zod.z.string().optional(),
|
|
515
|
+
permissionCanApprovePr: zod.z.string().optional(),
|
|
516
|
+
permissionCanApprovePrDesc: zod.z.string().optional(),
|
|
517
|
+
permissionCanViewPr: zod.z.string().optional(),
|
|
518
|
+
permissionCanViewPrDesc: zod.z.string().optional(),
|
|
519
|
+
permissionCanMergePr: zod.z.string().optional(),
|
|
520
|
+
permissionCanMergePrDesc: zod.z.string().optional()
|
|
521
|
+
});
|
|
522
|
+
const DisplayConfigSchema = zod.z.record(zod.z.string(), DisplayConfigKeysSchema);
|
|
523
|
+
const AgentCustomConfigSchema = zod.z.object({
|
|
524
|
+
displayConfig: DisplayConfigSchema.optional()
|
|
525
|
+
});
|
|
465
526
|
const AgentSchema = zod.z.object({
|
|
466
527
|
id: IdSchema,
|
|
467
528
|
name: zod.z.string(),
|
|
@@ -476,7 +537,8 @@ const AgentSchema = zod.z.object({
|
|
|
476
537
|
developerEmail: zod.z.string().nullable(),
|
|
477
538
|
gitRepoId: zod.z.string().nullable(),
|
|
478
539
|
supportLocal: zod.z.boolean(),
|
|
479
|
-
enable: zod.z.boolean()
|
|
540
|
+
enable: zod.z.boolean(),
|
|
541
|
+
config: AgentCustomConfigSchema.nullable()
|
|
480
542
|
});
|
|
481
543
|
const ListAgentsResponseSchema = zod.z.object({
|
|
482
544
|
agents: zod.z.array(AgentSchema)
|
|
@@ -491,7 +553,8 @@ const CreateAgentRequestSchema = zod.z.object({
|
|
|
491
553
|
guildMsg: zod.z.string().default("what can I do for you today?"),
|
|
492
554
|
placeholderMsg: zod.z.string().default("Ask me anything..."),
|
|
493
555
|
gitRepoId: zod.z.string().optional(),
|
|
494
|
-
supportLocal: zod.z.boolean().default(false)
|
|
556
|
+
supportLocal: zod.z.boolean().default(false),
|
|
557
|
+
config: AgentCustomConfigSchema.optional()
|
|
495
558
|
});
|
|
496
559
|
const CreateAgentResponseSchema = AgentSchema;
|
|
497
560
|
const UpdateAgentRequestSchema = zod.z.object({
|
|
@@ -503,7 +566,8 @@ const UpdateAgentRequestSchema = zod.z.object({
|
|
|
503
566
|
guildMsg: zod.z.string().optional(),
|
|
504
567
|
placeholderMsg: zod.z.string().optional(),
|
|
505
568
|
gitRepoId: zod.z.string().nullable().optional(),
|
|
506
|
-
supportLocal: zod.z.boolean().optional()
|
|
569
|
+
supportLocal: zod.z.boolean().optional(),
|
|
570
|
+
config: AgentCustomConfigSchema.nullable().optional()
|
|
507
571
|
});
|
|
508
572
|
const UpdateAgentResponseSchema = AgentSchema;
|
|
509
573
|
const DeleteAgentResponseSchema = zod.z.object({
|
|
@@ -1135,6 +1199,10 @@ const MergeRequestEventSchema = EventBaseSchema.extend({
|
|
|
1135
1199
|
summary: zod.z.string(),
|
|
1136
1200
|
description: zod.z.string().optional()
|
|
1137
1201
|
});
|
|
1202
|
+
const MergePullRequestEventSchema = EventBaseSchema.extend({
|
|
1203
|
+
taskId: zod.z.string(),
|
|
1204
|
+
mergeMethod: zod.z.enum(["merge", "squash", "rebase"]).optional().default("squash")
|
|
1205
|
+
});
|
|
1138
1206
|
const IdOnlySchema = zod.z.object({
|
|
1139
1207
|
id: zod.z.string()
|
|
1140
1208
|
});
|
|
@@ -1200,6 +1268,7 @@ const EventSchemaMap = {
|
|
|
1200
1268
|
"task-artifacts-updated": TaskArtifactsUpdatedEventSchema,
|
|
1201
1269
|
// Merge request events
|
|
1202
1270
|
"merge-request": MergeRequestEventSchema,
|
|
1271
|
+
"merge-pr": MergePullRequestEventSchema,
|
|
1203
1272
|
// System message events
|
|
1204
1273
|
"system-message": SystemMessageSchema,
|
|
1205
1274
|
// Billing events
|
|
@@ -1218,7 +1287,8 @@ const workerTaskEvents = [
|
|
|
1218
1287
|
"change-task-title",
|
|
1219
1288
|
"update-task-agent-session-id",
|
|
1220
1289
|
"task-artifacts-updated",
|
|
1221
|
-
"merge-request"
|
|
1290
|
+
"merge-request",
|
|
1291
|
+
"merge-pr"
|
|
1222
1292
|
];
|
|
1223
1293
|
|
|
1224
1294
|
function userAuth(token) {
|
|
@@ -1507,6 +1577,9 @@ async function loadSystemPrompt(claudeDir, promptFile) {
|
|
|
1507
1577
|
);
|
|
1508
1578
|
}
|
|
1509
1579
|
}
|
|
1580
|
+
function replacePromptPlaceholders(template, cwd) {
|
|
1581
|
+
return template.replace(/\{\{WORKING_DIR\}\}/g, cwd).replace(/\{\{PLATFORM\}\}/g, process.platform).replace(/\{\{OS_VERSION\}\}/g, `${os__namespace.type()} ${os__namespace.release()}`).replace(/\{\{DATE\}\}/g, (/* @__PURE__ */ new Date()).toISOString().split("T")[0]);
|
|
1582
|
+
}
|
|
1510
1583
|
|
|
1511
1584
|
const cryptoModule = typeof globalThis.crypto !== "undefined" ? globalThis.crypto : (async () => {
|
|
1512
1585
|
try {
|
|
@@ -1745,6 +1818,7 @@ function decryptFileContent(encryptedContent, dataKey) {
|
|
|
1745
1818
|
exports.AddChatMemberRequestSchema = AddChatMemberRequestSchema;
|
|
1746
1819
|
exports.AddChatMemberResponseSchema = AddChatMemberResponseSchema;
|
|
1747
1820
|
exports.AgentConfigValidationError = AgentConfigValidationError;
|
|
1821
|
+
exports.AgentCustomConfigSchema = AgentCustomConfigSchema;
|
|
1748
1822
|
exports.AgentError = AgentError;
|
|
1749
1823
|
exports.AgentLoadError = AgentLoadError;
|
|
1750
1824
|
exports.AgentMetadataSchema = AgentMetadataSchema;
|
|
@@ -1755,6 +1829,8 @@ exports.ApiErrorSchema = ApiErrorSchema;
|
|
|
1755
1829
|
exports.ApiServerAliveEventSchema = ApiServerAliveEventSchema;
|
|
1756
1830
|
exports.AppAliveEventSchema = AppAliveEventSchema;
|
|
1757
1831
|
exports.ApprovalStatusResponseSchema = ApprovalStatusResponseSchema;
|
|
1832
|
+
exports.ApprovePrRequestSchema = ApprovePrRequestSchema;
|
|
1833
|
+
exports.ApprovePrResponseSchema = ApprovePrResponseSchema;
|
|
1758
1834
|
exports.ArchiveTaskRequestSchema = ArchiveTaskRequestSchema;
|
|
1759
1835
|
exports.ArchiveTaskResponseSchema = ArchiveTaskResponseSchema;
|
|
1760
1836
|
exports.AskUserMessageSchema = AskUserMessageSchema;
|
|
@@ -1792,11 +1868,15 @@ exports.CreateMergeRequestResponseSchema = CreateMergeRequestResponseSchema;
|
|
|
1792
1868
|
exports.CreateMergeRequestSchema = CreateMergeRequestSchema;
|
|
1793
1869
|
exports.CreateOAuthServerRequestSchema = CreateOAuthServerRequestSchema;
|
|
1794
1870
|
exports.CreateOAuthServerResponseSchema = CreateOAuthServerResponseSchema;
|
|
1871
|
+
exports.CreateTaskShareResponseSchema = CreateTaskShareResponseSchema;
|
|
1872
|
+
exports.CreateTaskShareSchema = CreateTaskShareSchema;
|
|
1795
1873
|
exports.CreditExhaustedEventSchema = CreditExhaustedEventSchema;
|
|
1796
1874
|
exports.CreditsPackageSchema = CreditsPackageSchema;
|
|
1797
1875
|
exports.DateSchema = DateSchema;
|
|
1798
1876
|
exports.DeleteAgentResponseSchema = DeleteAgentResponseSchema;
|
|
1799
1877
|
exports.DeleteOAuthServerResponseSchema = DeleteOAuthServerResponseSchema;
|
|
1878
|
+
exports.DisplayConfigKeysSchema = DisplayConfigKeysSchema;
|
|
1879
|
+
exports.DisplayConfigSchema = DisplayConfigSchema;
|
|
1800
1880
|
exports.EventAckSchema = EventAckSchema;
|
|
1801
1881
|
exports.EventSchemaMap = EventSchemaMap;
|
|
1802
1882
|
exports.FRAMEWORK_TYPES = FRAMEWORK_TYPES;
|
|
@@ -1847,6 +1927,7 @@ exports.MachineApprovalStatusQuerySchema = MachineApprovalStatusQuerySchema;
|
|
|
1847
1927
|
exports.MachineAuthAuthorizedResponseSchema = MachineAuthAuthorizedResponseSchema;
|
|
1848
1928
|
exports.MachineAuthRequestSchema = MachineAuthRequestSchema;
|
|
1849
1929
|
exports.MachineAuthResultQuerySchema = MachineAuthResultQuerySchema;
|
|
1930
|
+
exports.MergePullRequestEventSchema = MergePullRequestEventSchema;
|
|
1850
1931
|
exports.MergeRequestEventSchema = MergeRequestEventSchema;
|
|
1851
1932
|
exports.MissingAgentFileError = MissingAgentFileError;
|
|
1852
1933
|
exports.OAuthAccountInfoSchema = OAuthAccountInfoSchema;
|
|
@@ -1872,6 +1953,8 @@ exports.ResetSecretRequestSchema = ResetSecretRequestSchema;
|
|
|
1872
1953
|
exports.ResetSecretResponseSchema = ResetSecretResponseSchema;
|
|
1873
1954
|
exports.ResumeTaskRequestSchema = ResumeTaskRequestSchema;
|
|
1874
1955
|
exports.ResumeTaskResponseSchema = ResumeTaskResponseSchema;
|
|
1956
|
+
exports.ShareAuthQuerySchema = ShareAuthQuerySchema;
|
|
1957
|
+
exports.ShareAuthResponseSchema = ShareAuthResponseSchema;
|
|
1875
1958
|
exports.ShutdownMachineSchema = ShutdownMachineSchema;
|
|
1876
1959
|
exports.SignatureAuthRequestSchema = SignatureAuthRequestSchema;
|
|
1877
1960
|
exports.SignatureAuthResponseSchema = SignatureAuthResponseSchema;
|
|
@@ -1889,6 +1972,7 @@ exports.SystemMessageSchema = SystemMessageSchema;
|
|
|
1889
1972
|
exports.TaskArtifactsUpdatedEventSchema = TaskArtifactsUpdatedEventSchema;
|
|
1890
1973
|
exports.TaskItemSchema = TaskItemSchema;
|
|
1891
1974
|
exports.TaskMessageSchema = TaskMessageSchema;
|
|
1975
|
+
exports.TaskSharePermissionsSchema = TaskSharePermissionsSchema;
|
|
1892
1976
|
exports.TaskStateChangeEventSchema = TaskStateChangeEventSchema;
|
|
1893
1977
|
exports.TaskTransactionsResponseSchema = TaskTransactionsResponseSchema;
|
|
1894
1978
|
exports.ToggleOAuthServerRequestSchema = ToggleOAuthServerRequestSchema;
|
|
@@ -1947,6 +2031,7 @@ exports.isSDKMessage = isSDKMessage;
|
|
|
1947
2031
|
exports.loadAgentConfig = loadAgentConfig;
|
|
1948
2032
|
exports.machineAuth = machineAuth;
|
|
1949
2033
|
exports.permissionResponseRequestSchema = permissionResponseRequestSchema;
|
|
2034
|
+
exports.replacePromptPlaceholders = replacePromptPlaceholders;
|
|
1950
2035
|
exports.resumeTaskRequestSchema = resumeTaskRequestSchema;
|
|
1951
2036
|
exports.resumeTaskSchema = resumeTaskSchema;
|
|
1952
2037
|
exports.setAgentContext = setAgentContext;
|