nolo-cli 0.32.0 → 0.33.0-alpha.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/README.md +6 -12
- package/{_executeModel-LTMSIBS4.js → _executeModel-RWPVI3YV.js} +76 -67
- package/{action-HI3VRQLP.js → action-SMLG6OTB.js} +17 -15
- package/{addContentAction-NCURJ6PK.js → addContentAction-SFO244QN.js} +14 -13
- package/{addDialogAgentAction-RCY4ECF4.js → addDialogAgentAction-W44ZCEHB.js} +14 -13
- package/{agentDeleteCommand-D3MYZK6E.js → agentDeleteCommand-KU2RXQPP.js} +42 -59
- package/{agentEmailCommands-6BXS574I.js → agentEmailCommands-MPCMDENS.js} +89 -80
- package/{agentGrantCommands-E7ZZFRHK.js → agentGrantCommands-2LEZDADN.js} +2 -2
- package/{agentListCommands-SF3HEUTT.js → agentListCommands-EPD4N6FX.js} +73 -78
- package/{agentMachineCommands-YARVXRR6.js → agentMachineCommands-AF7C3YRT.js} +40 -57
- package/{agentPullCommand-ARSIDNVC.js → agentPullCommand-YH5GEBK4.js} +5 -5
- package/agentRecordCommands-EYE6MZZG.js +112 -0
- package/agentRunCommand-LL22SGTN.js +130 -0
- package/{agentRuntimeLocal-ATGJY6WC.js → agentRuntimeLocal-JX34G47Z.js} +35 -50
- package/{agentSlice-4XWW344Y.js → agentSlice-TNMFQQOV.js} +15 -13
- package/{appDeleteCommands-63JO7RXS.js → appDeleteCommands-43K5VXQB.js} +38 -55
- package/{appDeployCommands-Y7EWYUGM.js → appDeployCommands-FEEJSVDZ.js} +38 -55
- package/{appDeployStatusCommands-ZBEY3DWB.js → appDeployStatusCommands-H76CG45R.js} +38 -55
- package/{appGetCommands-QSSOSEYL.js → appGetCommands-MDZYFTYZ.js} +38 -55
- package/{appListCommands-PH3XWNDX.js → appListCommands-TUJJXPWG.js} +38 -55
- package/{authCommand-BBDHMSO6.js → authCommand-T7UK4CWS.js} +18 -18
- package/{authCommands-4UDEKRE6.js → authCommands-EAPFGNHN.js} +8 -8
- package/chatQueueReduxAdapter-LVQXC4ZY.js +180 -0
- package/chunk-2H3XIBY4.js +239 -0
- package/{chunk-TEYN42N3.js → chunk-2IVEXF7P.js} +11 -4
- package/{chunk-WTGCTVJG.js → chunk-2QTEYCR7.js} +3 -6
- package/{chunk-DOISARTV.js → chunk-2UECQ7RE.js} +1 -1
- package/{chunk-SWYMCHM7.js → chunk-37V5LNEQ.js} +69 -1
- package/{chunk-E3APEOIM.js → chunk-3GZXL6FM.js} +4 -19
- package/{chunk-O3JR45Q2.js → chunk-3VAQHAXT.js} +44 -44
- package/{chunk-O5OMJPPF.js → chunk-3WXRAHCG.js} +6 -5
- package/{chunk-LAXMH7JY.js → chunk-57QJXIB6.js} +18 -15
- package/chunk-5CS33IBL.js +301 -0
- package/{chunk-3UGKATZQ.js → chunk-5SBK2MTI.js} +8 -369
- package/chunk-6PO2SYCS.js +1800 -0
- package/{chunk-TA6EA2A3.js → chunk-6SXC35F4.js} +182 -20
- package/{chunk-MXFQHRSS.js → chunk-6XIE5ZGI.js} +1 -1
- package/{chunk-3GZT3L6F.js → chunk-73GINUCW.js} +326 -481
- package/{chunk-VMWR7VNI.js → chunk-7E72JMBB.js} +7 -7
- package/{chunk-4PNU7W7K.js → chunk-AAGCMVFT.js} +106 -124
- package/chunk-ADLYMQB6.js +642 -0
- package/{chunk-ZWJOGMKH.js → chunk-AETZ7AD6.js} +1 -1
- package/{chunk-UDA3ZYLW.js → chunk-AFV4FOT2.js} +70 -24
- package/{chunk-BGTUGS3T.js → chunk-AOXVOC6D.js} +4 -30
- package/{chunk-2ZRP5RUG.js → chunk-B2BSG6QQ.js} +12 -11
- package/{chunk-44HACRCK.js → chunk-BANYWEYY.js} +4 -4
- package/{chunk-TOW4E763.js → chunk-BJIRLHJR.js} +2 -0
- package/{chunk-ZJ2WITOO.js → chunk-BQXOGBFN.js} +2 -2
- package/{chunk-G5GVZAXF.js → chunk-CLP2K7U4.js} +15 -19
- package/{chunk-2K4NDPT5.js → chunk-DFUPZE6V.js} +20 -12
- package/{chunk-YHGHADBQ.js → chunk-DPMBNHOJ.js} +4 -4
- package/chunk-EGRJC4ZN.js +91 -0
- package/{chunk-K6QEHQZ3.js → chunk-EKLRRZIN.js} +1 -1
- package/{chunk-XFG3BAKN.js → chunk-FMEVI5TG.js} +65 -0
- package/{chunk-RH53LMEJ.js → chunk-FSSX3XRY.js} +2 -4
- package/{chunk-VP4WJWKW.js → chunk-GM6PU7B6.js} +431 -345
- package/{chunk-EEF23OOK.js → chunk-GMXWYXAF.js} +7 -7
- package/{chunk-SFWZUTCI.js → chunk-GTYM4HKV.js} +1 -1
- package/{chunk-MITD7CON.js → chunk-HDKRSRYU.js} +1461 -301
- package/chunk-HS7MLR74.js +38 -0
- package/{chunk-3AUWC6EM.js → chunk-HUCT7HID.js} +5 -84
- package/{chunk-PTHDLIRB.js → chunk-I6N2UVVY.js} +1 -1
- package/chunk-IDAU4UFS.js +437 -0
- package/{chunk-Q76I4SXI.js → chunk-IHEC7VBF.js} +1 -1
- package/{chunk-OWHNFZNW.js → chunk-IL545V3E.js} +4 -4
- package/{chunk-3LY4F7SV.js → chunk-INZZJSQF.js} +348 -331
- package/{chunk-CF2WZF4N.js → chunk-J6WH4PYZ.js} +0 -8
- package/{chunk-2HXKAPH7.js → chunk-JMPYDFHY.js} +6 -6
- package/{chunk-V54H24CQ.js → chunk-JTSGWTYZ.js} +3 -3
- package/{chunk-ATK5WJOA.js → chunk-JZ5AMMXU.js} +4 -4
- package/chunk-KHCLMKZZ.js +3062 -0
- package/{chunk-WHLVPK32.js → chunk-KMSZPTM6.js} +27 -3
- package/{chunk-L3GCUVOH.js → chunk-KSRFVP36.js} +1 -1
- package/{chunk-DLWCWUNW.js → chunk-LOD75GOS.js} +336 -32
- package/{chunk-UOJRKY5J.js → chunk-M2YMQOLC.js} +44 -53
- package/chunk-M3JEW6N6.js +193 -0
- package/{chunk-XDHHF73Q.js → chunk-M4NC7NF6.js} +95 -95
- package/{chunk-3FCNXC2J.js → chunk-MPZJVZDC.js} +3735 -1394
- package/{chunk-IXZX5CJK.js → chunk-MQRZ5QUH.js} +1 -1
- package/{chunk-3ASDTTEI.js → chunk-MRWGHF56.js} +2 -0
- package/{chunk-D34RI6NI.js → chunk-NNWHHCVP.js} +75 -1
- package/{chunk-6YABCOFU.js → chunk-NUO3QFWD.js} +1 -1
- package/{chunk-GAF5X6B7.js → chunk-O6GEBMIY.js} +269 -309
- package/{chunk-CAENRKNJ.js → chunk-OR2HNLVO.js} +126 -88
- package/chunk-OW765XBU.js +10 -0
- package/chunk-PREQU5QV.js +231 -0
- package/{chunk-Q3CSL43H.js → chunk-Q5ITEGIN.js} +1 -1
- package/{chunk-7S54ZGF6.js → chunk-RAZOLMJR.js} +256 -12
- package/chunk-RCFIB45Q.js +28 -0
- package/chunk-RY57GLGW.js +188 -0
- package/{chunk-KGEVMUMI.js → chunk-TFPUAELY.js} +11 -11
- package/{chunk-ZJH3LKEW.js → chunk-UK5JGQVU.js} +94 -15
- package/chunk-URMS4XY2.js +10 -0
- package/{chunk-RXVX5LFR.js → chunk-VH2F7ZB6.js} +1 -1
- package/chunk-VIDPVFP3.js +20 -0
- package/{chunk-W367V5CH.js → chunk-WHD6BG7M.js} +400 -115
- package/{chunk-5RDLGLAP.js → chunk-WJSW43QZ.js} +4 -7
- package/{chunk-CF7S2RYZ.js → chunk-WLH5BAKX.js} +6 -6
- package/{chunk-VVEH6XUE.js → chunk-X2DAEZ3X.js} +1 -1
- package/{chunk-2IJAKBK2.js → chunk-X664KVEV.js} +426 -246
- package/{chunk-43EPBPZ2.js → chunk-XCCGU6QB.js} +2 -2
- package/chunk-Y5GCAMGP.js +9 -0
- package/{chunk-V42OE5HT.js → chunk-YDTYDA5W.js} +3 -3
- package/chunk-YYLHWIW6.js +48 -0
- package/{chunk-AOS5IN2I.js → chunk-ZHYK3N56.js} +1 -1
- package/{chunk-ODS2MVMU.js → chunk-ZJMME4DS.js} +19 -303
- package/{chunk-PJ2DDQQM.js → chunk-ZURFOV5J.js} +2 -2
- package/chunk-ZZ2MH7LE.js +84 -0
- package/{cliExecutor-BBUVQU4L.js → cliExecutor-DW3PHGEL.js} +2 -2
- package/{clipboardy-BVE3LVEH.js → clipboardy-MMBYVRLF.js} +166 -372
- package/{codingSkills-V35TRR4Y.js → codingSkills-DY5MINPG.js} +5 -4
- package/{createAgentAutomationAction-WLRNE7C4.js → createAgentAutomationAction-INQT23LX.js} +40 -31
- package/createDialogAction-LDCPDI73.js +60 -0
- package/{createPageAction-7YROVZ3W.js → createPageAction-5YXOG2M4.js} +56 -47
- package/{db-6DPSJ6WT.js → db-3H3JECGY.js} +45 -5
- package/{dbSlice-BBL3PEVW.js → dbSlice-3SD5L5H2.js} +13 -12
- package/{deleteFile-RJTEPOT4.js → deleteFile-XQXPBFFB.js} +7 -6
- package/dialogCommands-CHJO47AX.js +81 -0
- package/{dialogSlice-N4HPG6HM.js → dialogSlice-DOWKOILN.js} +36 -29
- package/{docCreateCommands-GRA5BHSA.js → docCreateCommands-OVZARUFX.js} +40 -55
- package/{docDeleteCommands-ONIJM5MD.js → docDeleteCommands-E2XJ62LD.js} +42 -57
- package/{docReadCommands-H55VQ2US.js → docReadCommands-I7OSREPJ.js} +40 -55
- package/{docStore-B5AHDNW5.js → docStore-UAWSKZ2Y.js} +39 -30
- package/{docUpdateCommands-ZQIQVGC2.js → docUpdateCommands-X4Z26VJM.js} +43 -58
- package/{fetchMessages-VPPQDDZ4.js → fetchMessages-7QRCCRYK.js} +3 -3
- package/{getPricing-QO5TYNCK.js → getPricing-L2ENXWHV.js} +7 -6
- package/{handleSendMessageAction-IN5XX5U7.js → handleSendMessageAction-C3TSDWKH.js} +38 -31
- package/index.js +67 -67
- package/{lib-FYYBQIXS.js → lib-2ZTNRXR4.js} +432 -183
- package/{localDialogRead-3DBXVYXS.js → localDialogRead-SLMPV5SK.js} +2 -2
- package/{localRuntimeAuthority-NDUA2D7Y.js → localRuntimeAuthority-E3R24J4T.js} +4 -2
- package/{localRuntimeDb-GKYRBWLQ.js → localRuntimeDb-DDZCJFQZ.js} +1 -1
- package/{machineCommands-H3UMKE76.js → machineCommands-BUOIYJAD.js} +93 -84
- package/{machineWsRunDispatch-HONRUK3R.js → machineWsRunDispatch-7CRWAA6O.js} +83 -74
- package/{models-WDUTTYFS.js → models-OX2S5C6Q.js} +2 -2
- package/{offlineMarxistsAgentCommand-E6LUG63A.js → offlineMarxistsAgentCommand-GEH6SNNA.js} +1 -1
- package/package.json +1 -4
- package/{read-64OQDO3I.js → read-6G73BMEY.js} +8 -7
- package/{readDocTool-MXM3T6PE.js → readDocTool-DK4EI2GA.js} +1 -2
- package/{readlineWorkspace-XVJZDCSC.js → readlineWorkspace-ZDWEASJV.js} +265 -428
- package/{removeDialogAgentAction-NEKVAMSH.js → removeDialogAgentAction-E7H557UO.js} +19 -17
- package/{runAgentClientLoop-H7U53QB6.js → runAgentClientLoop-U7HYA3O5.js} +72 -64
- package/{runtimeDoctorCommands-WI2YZUSJ.js → runtimeDoctorCommands-KIKM6BIO.js} +5 -5
- package/{setDialogExtraReferencesAction-WTOHQDIV.js → setDialogExtraReferencesAction-RMMGBR5F.js} +15 -14
- package/{setPrimaryDialogAgentAction-LDJOYC4F.js → setPrimaryDialogAgentAction-FWBKKLVA.js} +19 -17
- package/{settingSlice-4M37TN7V.js → settingSlice-73PV4KG4.js} +16 -14
- package/{skillDiscovery-5U6RYAHN.js → skillDiscovery-KLLKXPUO.js} +4 -4
- package/{slateUtils-2M7MUTWX.js → slateUtils-VO2FU36K.js} +1 -1
- package/{spaceCommands-7VVKJBDV.js → spaceCommands-GEWZXGHM.js} +43 -240
- package/{spaceSlice-T6YK6D34.js → spaceSlice-B6MOVY4N.js} +38 -61
- package/{streamAgentChatTurn-RQ63QFQ7.js → streamAgentChatTurn-T527EQTT.js} +1261 -150
- package/{switchDialogAgentAction-XVWGKR2Z.js → switchDialogAgentAction-US6QNL3N.js} +14 -13
- package/syncMapping-RK2MANUX.js +43 -0
- package/{tableCommands-RJZ3V4TF.js → tableCommands-QE47K72R.js} +8 -7
- package/{toolApiClient-ARGFDJAG.js → toolApiClient-B2MFXMEG.js} +3 -3
- package/tools-XMWCVMPM.js +98 -0
- package/{tuiSummaryLlmCaller-SRZ4QQUP.js → tuiSummaryLlmCaller-NCAJSVSD.js} +24 -21
- package/{updateDialogTitleAction-BBDSWHNG.js → updateDialogTitleAction-XPJZRJEL.js} +48 -38
- package/agentRecordCommands-JFZRQJQ4.js +0 -103
- package/agentRunCommand-NOX5FLKO.js +0 -121
- package/chunk-AYMOSAHE.js +0 -3158
- package/chunk-D2BPX6DQ.js +0 -1707
- package/chunk-DCDL3GC4.js +0 -171
- package/chunk-F3MP7CP6.js +0 -73
- package/chunk-WZSRQNQG.js +0 -2587
- package/createDialogAction-Y6YV64QB.js +0 -52
- package/dialogCommands-XLO5CAHZ.js +0 -95
- package/tools-KYZX3BGO.js +0 -90
- package/{chunk-Z5MXSEOJ.js → chunk-RQSOAMPJ.js} +2 -2
- package/{chunk-JDSUTNYY.js → chunk-SAQQLJZ5.js} +3 -3
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
import {
|
|
2
|
+
asRecordOrEmpty
|
|
3
|
+
} from "./chunk-KX6YBIHG.js";
|
|
4
|
+
import {
|
|
5
|
+
asOptionalFiniteNumber
|
|
6
|
+
} from "./chunk-WWC7I6TA.js";
|
|
7
|
+
import {
|
|
8
|
+
asNonEmptyStringArray,
|
|
9
|
+
asTrimmedNonEmptyStringArray
|
|
10
|
+
} from "./chunk-I42VC5KR.js";
|
|
11
|
+
import {
|
|
12
|
+
isOwnedAgentKey,
|
|
13
|
+
ownedAgentKey,
|
|
14
|
+
publicAgentKey
|
|
15
|
+
} from "./chunk-BJIRLHJR.js";
|
|
16
|
+
import {
|
|
17
|
+
isRecord
|
|
18
|
+
} from "./chunk-KUG52IAP.js";
|
|
19
|
+
import {
|
|
20
|
+
asOptionalTrimmedString
|
|
21
|
+
} from "./chunk-G3SUCT4W.js";
|
|
22
|
+
|
|
23
|
+
// packages/agent-runtime/agentRecordKeys.ts
|
|
24
|
+
function buildAgentRuntimeAgentLookupKeys(args) {
|
|
25
|
+
if (/^agent(-pub)?-/.test(args.agentRef)) {
|
|
26
|
+
return [args.agentRef];
|
|
27
|
+
}
|
|
28
|
+
return [
|
|
29
|
+
ownedAgentKey(args.userId, args.agentRef),
|
|
30
|
+
publicAgentKey(args.agentRef)
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
function shouldFetchAgentRuntimeRecordRemotely(dbKey) {
|
|
34
|
+
return /^agent(-pub)?-/.test(dbKey);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// packages/agent-runtime/runtimeToolSurface.ts
|
|
38
|
+
var DEFAULT_PRIVATE_NOLO_WORKSPACE_TOOLS = [
|
|
39
|
+
"listDialogs",
|
|
40
|
+
"readDialog",
|
|
41
|
+
"queryDialogsBySubjectRef",
|
|
42
|
+
"listAgents",
|
|
43
|
+
"readAgent",
|
|
44
|
+
"listSpaces",
|
|
45
|
+
"readSpace",
|
|
46
|
+
"readDoc",
|
|
47
|
+
"readSkillDoc",
|
|
48
|
+
"loadSkill",
|
|
49
|
+
"listTables",
|
|
50
|
+
"queryTableRows",
|
|
51
|
+
"cliWhoami",
|
|
52
|
+
"cliDoctor"
|
|
53
|
+
];
|
|
54
|
+
function uniqueToolNames(values) {
|
|
55
|
+
return [...new Set(asTrimmedNonEmptyStringArray(values))];
|
|
56
|
+
}
|
|
57
|
+
function canInjectPrivateDefaults(args) {
|
|
58
|
+
if (!args.currentUserId) return false;
|
|
59
|
+
if (args.invocationVisibility !== "private") return false;
|
|
60
|
+
if (args.agentOwnerId && args.agentOwnerId === args.currentUserId) return true;
|
|
61
|
+
if (args.trustedPrivateInvocation === true) return true;
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
function explicitOnlyReason(args) {
|
|
65
|
+
if (!args.currentUserId || !args.agentOwnerId) {
|
|
66
|
+
return "explicit-only-missing-identity";
|
|
67
|
+
}
|
|
68
|
+
if (args.invocationVisibility === "public") return "explicit-only-public";
|
|
69
|
+
if (args.invocationVisibility === "shared") return "explicit-only-shared";
|
|
70
|
+
if (args.agentOwnerId !== args.currentUserId) {
|
|
71
|
+
return "explicit-only-owner-mismatch";
|
|
72
|
+
}
|
|
73
|
+
return "explicit-only-anonymous";
|
|
74
|
+
}
|
|
75
|
+
function resolveRuntimeToolSurface(args) {
|
|
76
|
+
const explicitToolNames = uniqueToolNames(args.explicitToolNames ?? []);
|
|
77
|
+
if (canInjectPrivateDefaults(args)) {
|
|
78
|
+
const injectedToolNames = [...DEFAULT_PRIVATE_NOLO_WORKSPACE_TOOLS];
|
|
79
|
+
return {
|
|
80
|
+
explicitToolNames,
|
|
81
|
+
injectedToolNames,
|
|
82
|
+
finalToolNames: uniqueToolNames([
|
|
83
|
+
...explicitToolNames,
|
|
84
|
+
...injectedToolNames
|
|
85
|
+
]),
|
|
86
|
+
auditReason: "private-authenticated-defaults"
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
explicitToolNames,
|
|
91
|
+
injectedToolNames: [],
|
|
92
|
+
finalToolNames: explicitToolNames,
|
|
93
|
+
auditReason: explicitOnlyReason(args)
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function isPublicRuntimeAgentRef(value) {
|
|
97
|
+
return typeof value === "string" && value.startsWith("agent-pub-");
|
|
98
|
+
}
|
|
99
|
+
function inferOwnerIdFromRuntimeAgentKey(value) {
|
|
100
|
+
if (typeof value !== "string") return null;
|
|
101
|
+
const privateAgentMatch = value.match(/^agent-([^-]+)-(.+)$/);
|
|
102
|
+
if (privateAgentMatch && privateAgentMatch[1] !== "pub") {
|
|
103
|
+
return privateAgentMatch[1];
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
function resolveRuntimeToolSurfaceForAgent(args) {
|
|
108
|
+
const agentKey = typeof args.agentKey === "string" ? args.agentKey : "";
|
|
109
|
+
const currentUserId = typeof args.currentUserId === "string" ? args.currentUserId : "";
|
|
110
|
+
const inferredOwnerId = args.agentOwnerId ?? (currentUserId && isOwnedAgentKey(agentKey, currentUserId) ? currentUserId : inferOwnerIdFromRuntimeAgentKey(agentKey));
|
|
111
|
+
const publicRef = isPublicRuntimeAgentRef(agentKey);
|
|
112
|
+
const visibility = args.trustedPrivateInvocation === true ? "private" : publicRef || args.isPublic === true || args.sharingLevel === "public" ? "public" : "private";
|
|
113
|
+
return resolveRuntimeToolSurface({
|
|
114
|
+
explicitToolNames: args.explicitToolNames,
|
|
115
|
+
currentUserId: args.currentUserId,
|
|
116
|
+
agentOwnerId: inferredOwnerId,
|
|
117
|
+
invocationVisibility: visibility,
|
|
118
|
+
runtimeHost: args.runtimeHost,
|
|
119
|
+
trustedPrivateInvocation: args.trustedPrivateInvocation
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
var SECRET_FIELD_NAMES = [
|
|
123
|
+
"apikey",
|
|
124
|
+
"api_key",
|
|
125
|
+
"secret",
|
|
126
|
+
"token",
|
|
127
|
+
"authorization",
|
|
128
|
+
"credential",
|
|
129
|
+
"password"
|
|
130
|
+
];
|
|
131
|
+
function isSecretFieldName(key) {
|
|
132
|
+
const normalized = key.toLowerCase();
|
|
133
|
+
return SECRET_FIELD_NAMES.some((name) => normalized.includes(name));
|
|
134
|
+
}
|
|
135
|
+
function redactAgentRecordForWorkspaceTool(record) {
|
|
136
|
+
if (Array.isArray(record)) return record.map(redactAgentRecordForWorkspaceTool);
|
|
137
|
+
if (!isRecord(record)) return record;
|
|
138
|
+
const redacted = {};
|
|
139
|
+
for (const [key, value] of Object.entries(record)) {
|
|
140
|
+
if (isSecretFieldName(key)) {
|
|
141
|
+
redacted[key] = "[redacted]";
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
redacted[key] = Array.isArray(value) || isRecord(value) ? redactAgentRecordForWorkspaceTool(value) : value;
|
|
145
|
+
}
|
|
146
|
+
return redacted;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// packages/agent-runtime/noloWorkspaceTools.ts
|
|
150
|
+
var NOLO_WORKSPACE_TOOL_NAMES = [
|
|
151
|
+
"listDialogs",
|
|
152
|
+
"readDialog",
|
|
153
|
+
"queryDialogsBySubjectRef",
|
|
154
|
+
"deleteDialogs",
|
|
155
|
+
"listAgents",
|
|
156
|
+
"readAgent",
|
|
157
|
+
"listSpaces",
|
|
158
|
+
"readSpace",
|
|
159
|
+
"readDoc",
|
|
160
|
+
"readSkillDoc",
|
|
161
|
+
"loadSkill",
|
|
162
|
+
"listTables",
|
|
163
|
+
"queryTableRows",
|
|
164
|
+
"cliWhoami",
|
|
165
|
+
"cliDoctor"
|
|
166
|
+
];
|
|
167
|
+
var NOLO_WORKSPACE_TOOL_NAME_SET = new Set(NOLO_WORKSPACE_TOOL_NAMES);
|
|
168
|
+
var DIALOG_ID_RE = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
|
169
|
+
var DIALOG_PATH_RE = /^\/(?:space\/([^/]+)\/)?dialog-(.+)-([0-9A-HJKMNP-TV-Z]{26})\/?$/i;
|
|
170
|
+
function stringToolParam(description) {
|
|
171
|
+
return { type: "string", description };
|
|
172
|
+
}
|
|
173
|
+
function buildNoloWorkspaceOpenAiTools(args) {
|
|
174
|
+
const toolNames = new Set(args.toolNames ?? []);
|
|
175
|
+
const tools = [];
|
|
176
|
+
function add(name, description, properties, required = []) {
|
|
177
|
+
if (!toolNames.has(name)) return;
|
|
178
|
+
tools.push({
|
|
179
|
+
type: "function",
|
|
180
|
+
function: {
|
|
181
|
+
name,
|
|
182
|
+
description,
|
|
183
|
+
parameters: {
|
|
184
|
+
type: "object",
|
|
185
|
+
properties,
|
|
186
|
+
...required.length ? { required } : {}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
add("listDialogs", "List the current user's dialogs in the Nolo workspace.", {
|
|
192
|
+
limit: { type: "integer", description: "Maximum dialogs to return." },
|
|
193
|
+
space: stringToolParam("Optional space id or URL.")
|
|
194
|
+
});
|
|
195
|
+
add("readDialog", `Read one persisted dialog (metadata + messages) by full dbKey (dialog-<userId>-<id>) or URL. Use listDialogs first if target is unclear; a bare id resolves against the current user, pass user for someone else's dialog. Reading an agent run's dialog is fine at any time, but do not poll a still-running one through the full transcript: if controlAgentRun is available prefer it for live runs, otherwise use mode="status" for a compact snapshot, and pull the full transcript once the run is done/failed/cancelled.`, {
|
|
196
|
+
dialog: stringToolParam("Dialog dbKey (dialog-<userId>-<id>), dialog URL, or bare id (resolved against user/current account)."),
|
|
197
|
+
mode: {
|
|
198
|
+
type: "string",
|
|
199
|
+
enum: ["full", "status"],
|
|
200
|
+
description: "full (default) returns meta + messages; status returns a compact run snapshot (status/checkpoint/tools/files/error) without the transcript \u2014 prefer it when you only need to know whether an agent run is still active or how it ended."
|
|
201
|
+
},
|
|
202
|
+
limit: { type: "integer", description: "Max messages to return in mode=full, newest first. Omit for the complete transcript; a small limit can hide earlier tool calls. Ignored in mode=status." },
|
|
203
|
+
user: stringToolParam("Owner userId for a bare dialog id (e.g. a child run started by another account). Ignored when dialog is a dbKey or URL."),
|
|
204
|
+
server: stringToolParam("Optional server base URL to read from, e.g. when the dialog lives on another machine's nolo server.")
|
|
205
|
+
}, ["dialog"]);
|
|
206
|
+
add("queryDialogsBySubjectRef", "Query persisted dialog evidence by a generic dialog.subjectRefs target.", {
|
|
207
|
+
rowDbKey: stringToolParam("Optional alias for subjectKind=table-row, subjectId=<rowDbKey>, subjectRole=task."),
|
|
208
|
+
subjectKind: stringToolParam("Subject ref kind (e.g. table-row, page, file, commit, artifact)."),
|
|
209
|
+
subjectId: stringToolParam("Subject ref id."),
|
|
210
|
+
subjectRole: stringToolParam("Optional subject ref role."),
|
|
211
|
+
limit: { type: "integer", description: "Maximum matching dialog summaries to return." },
|
|
212
|
+
status: stringToolParam("Optional dialog status filter (running, done, failed)."),
|
|
213
|
+
checkpointStatus: stringToolParam("Optional runtimeCheckpoint.status filter."),
|
|
214
|
+
hasArtifacts: { type: "boolean", description: "When true, only return dialogs with artifact evidence." },
|
|
215
|
+
excludeDialogId: stringToolParam("Optional dialog id to exclude from results.")
|
|
216
|
+
});
|
|
217
|
+
add("deleteDialogs", "Find and delete dialogs by title/id/dbKey. Preview matches and wait for user confirmation before deleting.", {
|
|
218
|
+
query: stringToolParam("Dialog title/id/dbKey search text."),
|
|
219
|
+
matchMode: {
|
|
220
|
+
type: "string",
|
|
221
|
+
enum: ["contains", "exact", "prefix", "dialogId"],
|
|
222
|
+
description: "Matching mode. Default contains."
|
|
223
|
+
},
|
|
224
|
+
confirmedDialogIds: {
|
|
225
|
+
type: "array",
|
|
226
|
+
items: { type: "string" },
|
|
227
|
+
description: "Confirmed dialog ids or dbKeys to delete."
|
|
228
|
+
}
|
|
229
|
+
}, ["query"]);
|
|
230
|
+
add("listAgents", "List the current user's agents with runnable agentKey for delegation. Copy the agentKey verbatim; do not infer it from the display name.", {
|
|
231
|
+
space: stringToolParam("Optional space id or URL."),
|
|
232
|
+
publicOnly: { type: "boolean", description: "Only show public agents." }
|
|
233
|
+
});
|
|
234
|
+
add("readAgent", "Read one agent's full config by exact agentKey returned by listAgents (agent-<userId>-<id> or agent-pub-<id>); do not use the display name.", {
|
|
235
|
+
agent: stringToolParam("Exact agentKey from listAgents (preferred; copy verbatim; plain id or URL are compatibility fallbacks).")
|
|
236
|
+
}, ["agent"]);
|
|
237
|
+
add("listSpaces", "List joined spaces in the Nolo workspace.", {});
|
|
238
|
+
add("readSpace", "Read one space in the Nolo workspace.", {
|
|
239
|
+
space: stringToolParam("Space id or URL."),
|
|
240
|
+
contentKey: stringToolParam("Optional content key inside the space."),
|
|
241
|
+
brief: { type: "boolean", description: "Return brief output when supported." }
|
|
242
|
+
}, ["space"]);
|
|
243
|
+
add("readDoc", "Read one normal doc/page in the Nolo workspace.", {
|
|
244
|
+
doc: stringToolParam("Doc/page key.")
|
|
245
|
+
}, ["doc"]);
|
|
246
|
+
add("readSkillDoc", "Read one skill doc in the Nolo workspace.", {
|
|
247
|
+
doc: stringToolParam("Skill doc/page key.")
|
|
248
|
+
}, ["doc"]);
|
|
249
|
+
add("loadSkill", "Load a skill by name (.agents/skills/<name>/SKILL.md) and return its full instructions inline. Returns available skills if not found.", {
|
|
250
|
+
name: stringToolParam("Skill name advertised in skill discovery.")
|
|
251
|
+
}, ["name"]);
|
|
252
|
+
add("listTables", "List tables in the current user scope or an optional space scope.", {
|
|
253
|
+
limit: { type: "integer", description: "Maximum tables to return." },
|
|
254
|
+
space: stringToolParam("Optional space id or URL."),
|
|
255
|
+
titleQuery: stringToolParam("Optional case-insensitive title substring."),
|
|
256
|
+
purpose: stringToolParam("Optional purpose value such as agent_eval_workbench.")
|
|
257
|
+
});
|
|
258
|
+
add("queryTableRows", "Query rows from a Nolo table.", {
|
|
259
|
+
table: stringToolParam("Table id or meta key."),
|
|
260
|
+
limit: { type: "integer", description: "Optional row limit." },
|
|
261
|
+
row: stringToolParam("Optional row id or row db key."),
|
|
262
|
+
output: stringToolParam("Optional output format such as json, jsonl, or items.")
|
|
263
|
+
}, ["table"]);
|
|
264
|
+
add("cliWhoami", "Show the current Nolo CLI login state.", {});
|
|
265
|
+
add("cliDoctor", "Show Nolo CLI doctor diagnostics.", {});
|
|
266
|
+
return tools;
|
|
267
|
+
}
|
|
268
|
+
function noloPositiveIntegerString(value) {
|
|
269
|
+
const parsed = Number(value);
|
|
270
|
+
return Number.isInteger(parsed) && parsed > 0 ? String(parsed) : null;
|
|
271
|
+
}
|
|
272
|
+
function noloStringArg(value) {
|
|
273
|
+
return asOptionalTrimmedString(value) ?? null;
|
|
274
|
+
}
|
|
275
|
+
function parseNoloWorkspaceToolArguments(raw) {
|
|
276
|
+
try {
|
|
277
|
+
return asRecordOrEmpty(JSON.parse(raw || "{}"));
|
|
278
|
+
} catch {
|
|
279
|
+
return {};
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function clampNoloPositiveInteger(value, fallback, max = 500) {
|
|
283
|
+
const parsed = Number(value);
|
|
284
|
+
if (!Number.isFinite(parsed) || parsed <= 0) return fallback;
|
|
285
|
+
return Math.min(Math.floor(parsed), max);
|
|
286
|
+
}
|
|
287
|
+
function getNoloDialogIdFromKey(dbKey) {
|
|
288
|
+
const index = dbKey.lastIndexOf("-");
|
|
289
|
+
return index >= 0 ? dbKey.slice(index + 1) : dbKey;
|
|
290
|
+
}
|
|
291
|
+
function resolveNoloDialogInput(rawInput, userId) {
|
|
292
|
+
const raw = rawInput.trim();
|
|
293
|
+
if (raw.startsWith("http://") || raw.startsWith("https://")) {
|
|
294
|
+
const url = new URL(raw);
|
|
295
|
+
const match = url.pathname.match(DIALOG_PATH_RE);
|
|
296
|
+
if (!match) throw new Error(`Unsupported dialog URL path: ${url.pathname}`);
|
|
297
|
+
const [, spaceId, ownerId, dialogId] = match;
|
|
298
|
+
return {
|
|
299
|
+
dbKey: `dialog-${ownerId}-${dialogId}`,
|
|
300
|
+
dialogId,
|
|
301
|
+
ownerId,
|
|
302
|
+
spaceId: spaceId ? decodeURIComponent(spaceId) : null
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
if (raw.startsWith("dialog-")) {
|
|
306
|
+
const dialogId = getNoloDialogIdFromKey(raw);
|
|
307
|
+
return {
|
|
308
|
+
dbKey: raw,
|
|
309
|
+
dialogId,
|
|
310
|
+
ownerId: raw.slice("dialog-".length, Math.max("dialog-".length, raw.length - dialogId.length - 1)),
|
|
311
|
+
spaceId: null
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
if (!DIALOG_ID_RE.test(raw)) {
|
|
315
|
+
throw new Error(`Unsupported dialog id: ${raw}`);
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
dbKey: `dialog-${userId}-${raw}`,
|
|
319
|
+
dialogId: raw,
|
|
320
|
+
ownerId: userId,
|
|
321
|
+
spaceId: null
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function normalizeNoloSpaceInput(raw) {
|
|
325
|
+
const value = raw.trim();
|
|
326
|
+
if (!value) return "";
|
|
327
|
+
if (value.startsWith("http://") || value.startsWith("https://")) {
|
|
328
|
+
const match = new URL(value).pathname.match(/^\/space\/([^/]+)/);
|
|
329
|
+
return match?.[1] ? decodeURIComponent(match[1]).replace(/^space-/, "") : "";
|
|
330
|
+
}
|
|
331
|
+
return value.replace(/^space-/, "");
|
|
332
|
+
}
|
|
333
|
+
function getNoloComparableUpdatedAt(record) {
|
|
334
|
+
const raw = record?.updatedAt ?? record?.updated_at ?? record?.createdAt ?? record?.created;
|
|
335
|
+
const asNumber = asOptionalFiniteNumber(raw);
|
|
336
|
+
if (asNumber !== void 0) return asNumber;
|
|
337
|
+
if (typeof raw === "string") return Date.parse(raw) || 0;
|
|
338
|
+
return 0;
|
|
339
|
+
}
|
|
340
|
+
function normalizeNoloSubjectKind(kind) {
|
|
341
|
+
return kind === "tableRow" ? "table-row" : kind;
|
|
342
|
+
}
|
|
343
|
+
function normalizeNoloSubjectRef(value) {
|
|
344
|
+
if (!isRecord(value)) return null;
|
|
345
|
+
const kindRaw = asOptionalTrimmedString(value.kind);
|
|
346
|
+
const kind = kindRaw ? normalizeNoloSubjectKind(kindRaw) : "";
|
|
347
|
+
const id = asOptionalTrimmedString(value.id) ?? "";
|
|
348
|
+
if (!kind || !id) return null;
|
|
349
|
+
const role = asOptionalTrimmedString(value.role) ?? "";
|
|
350
|
+
return {
|
|
351
|
+
kind,
|
|
352
|
+
id,
|
|
353
|
+
...role ? { role } : {}
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
function buildNoloSubjectRefQueryTarget(args) {
|
|
357
|
+
const rowDbKey = noloStringArg(args.rowDbKey ?? args.row ?? args.taskRowDbKey);
|
|
358
|
+
const subjectKind = noloStringArg(args.subjectKind ?? args.kind) ?? (rowDbKey ? "table-row" : null);
|
|
359
|
+
const subjectId = noloStringArg(args.subjectId ?? args.id) ?? rowDbKey;
|
|
360
|
+
const subjectRole = noloStringArg(args.subjectRole ?? args.role) ?? (rowDbKey ? "task" : null);
|
|
361
|
+
if (!subjectKind || !subjectId) return null;
|
|
362
|
+
return {
|
|
363
|
+
kind: normalizeNoloSubjectKind(subjectKind),
|
|
364
|
+
id: subjectId,
|
|
365
|
+
...subjectRole ? { role: subjectRole } : {}
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
function extractNoloDialogSubjectRefs(dialog) {
|
|
369
|
+
if (!isRecord(dialog) || !Array.isArray(dialog.subjectRefs)) return [];
|
|
370
|
+
return dialog.subjectRefs.map(normalizeNoloSubjectRef).filter((ref) => Boolean(ref));
|
|
371
|
+
}
|
|
372
|
+
function noloDialogMatchesSubjectRef(dialog, target) {
|
|
373
|
+
const normalizedTarget = normalizeNoloSubjectRef(target);
|
|
374
|
+
if (!normalizedTarget) return false;
|
|
375
|
+
return extractNoloDialogSubjectRefs(dialog).some(
|
|
376
|
+
(ref) => ref.kind === normalizedTarget.kind && ref.id === normalizedTarget.id
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
function noloArtifactCount(value) {
|
|
380
|
+
if (Array.isArray(value)) return value.length;
|
|
381
|
+
if (isRecord(value)) return Object.keys(value).length > 0 ? 1 : 0;
|
|
382
|
+
return value ? 1 : 0;
|
|
383
|
+
}
|
|
384
|
+
function summarizeNoloDialogSubjectRefEvidence(dialog, target) {
|
|
385
|
+
const dialogKey = asOptionalTrimmedString(dialog?.dbKey) ?? "";
|
|
386
|
+
const checkpoint = asRecordOrEmpty(dialog?.runtimeCheckpoint);
|
|
387
|
+
const matchedSubjectRefs = extractNoloDialogSubjectRefs(dialog).filter(
|
|
388
|
+
(ref) => ref.kind === normalizeNoloSubjectKind(target.kind) && ref.id === target.id
|
|
389
|
+
);
|
|
390
|
+
const lastToolNames = asNonEmptyStringArray(checkpoint.lastToolNames);
|
|
391
|
+
const artifactCount = noloArtifactCount(dialog?.artifacts);
|
|
392
|
+
return {
|
|
393
|
+
dialogId: asOptionalTrimmedString(dialog?.dialogId) ?? asOptionalTrimmedString(dialog?.id) ?? (dialogKey ? getNoloDialogIdFromKey(dialogKey) : null),
|
|
394
|
+
dialogKey: dialogKey || null,
|
|
395
|
+
title: asOptionalTrimmedString(dialog?.title) ?? null,
|
|
396
|
+
status: asOptionalTrimmedString(dialog?.status) ?? null,
|
|
397
|
+
checkpointStatus: asOptionalTrimmedString(checkpoint.status) ?? null,
|
|
398
|
+
updatedAt: typeof dialog?.updatedAt === "string" || typeof dialog?.updatedAt === "number" ? dialog.updatedAt : null,
|
|
399
|
+
hasArtifacts: artifactCount > 0,
|
|
400
|
+
artifactCount,
|
|
401
|
+
subjectRefs: matchedSubjectRefs,
|
|
402
|
+
lastToolNames
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
function normalizeNoloExcludeDialogIds(value) {
|
|
406
|
+
const rawValues = Array.isArray(value) ? value : [value];
|
|
407
|
+
const ids = /* @__PURE__ */ new Set();
|
|
408
|
+
for (const rawValue of rawValues) {
|
|
409
|
+
if (typeof rawValue !== "string") continue;
|
|
410
|
+
const trimmed = rawValue.trim();
|
|
411
|
+
if (!trimmed) continue;
|
|
412
|
+
ids.add(trimmed);
|
|
413
|
+
if (trimmed.startsWith("dialog-")) {
|
|
414
|
+
ids.add(getNoloDialogIdFromKey(trimmed));
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return [...ids];
|
|
418
|
+
}
|
|
419
|
+
function getNoloDialogIdentityValues(dialog) {
|
|
420
|
+
if (!isRecord(dialog)) return [];
|
|
421
|
+
const values = /* @__PURE__ */ new Set();
|
|
422
|
+
for (const rawValue of [dialog.dialogId, dialog.id, dialog.dbKey]) {
|
|
423
|
+
if (typeof rawValue !== "string") continue;
|
|
424
|
+
const trimmed = rawValue.trim();
|
|
425
|
+
if (!trimmed) continue;
|
|
426
|
+
values.add(trimmed);
|
|
427
|
+
if (trimmed.startsWith("dialog-")) {
|
|
428
|
+
values.add(getNoloDialogIdFromKey(trimmed));
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return [...values];
|
|
432
|
+
}
|
|
433
|
+
function filterNoloDialogsByExcludedIds(dialogs, excludeDialogIds) {
|
|
434
|
+
const excluded = new Set(normalizeNoloExcludeDialogIds(excludeDialogIds));
|
|
435
|
+
if (excluded.size === 0) return dialogs;
|
|
436
|
+
return dialogs.filter(
|
|
437
|
+
(dialog) => getNoloDialogIdentityValues(dialog).every((value) => !excluded.has(value))
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
function filterNoloDialogSubjectRefEvidence(args) {
|
|
441
|
+
const matched = [];
|
|
442
|
+
for (const dialog of filterNoloDialogsByExcludedIds(args.dialogs, args.excludeDialogIds)) {
|
|
443
|
+
if (noloDialogMatchesSubjectRef(dialog, args.target)) {
|
|
444
|
+
matched.push(dialog);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
matched.sort((left, right) => getNoloComparableUpdatedAt(right) - getNoloComparableUpdatedAt(left));
|
|
448
|
+
const evidence = [];
|
|
449
|
+
for (const dialog of matched) {
|
|
450
|
+
const entry = summarizeNoloDialogSubjectRefEvidence(dialog, args.target);
|
|
451
|
+
if (args.status && entry.status !== args.status) continue;
|
|
452
|
+
if (args.checkpointStatus && entry.checkpointStatus !== args.checkpointStatus) continue;
|
|
453
|
+
if (args.hasArtifacts != null && entry.hasArtifacts !== args.hasArtifacts) continue;
|
|
454
|
+
evidence.push(entry);
|
|
455
|
+
}
|
|
456
|
+
return evidence.slice(0, args.limit);
|
|
457
|
+
}
|
|
458
|
+
function verifyNoloDialogSubjectRefQuery(dialogs, target, options = {}) {
|
|
459
|
+
const checkedDialogs = filterNoloDialogsByExcludedIds(dialogs, options.excludeDialogIds);
|
|
460
|
+
const unmatchedDialogs = [];
|
|
461
|
+
for (const dialog of checkedDialogs) {
|
|
462
|
+
if (noloDialogMatchesSubjectRef(dialog, target)) continue;
|
|
463
|
+
unmatchedDialogs.push({
|
|
464
|
+
dialogId: asOptionalTrimmedString(dialog?.dialogId) ?? asOptionalTrimmedString(dialog?.id) ?? (typeof dialog?.dbKey === "string" ? getNoloDialogIdFromKey(dialog.dbKey) : null),
|
|
465
|
+
dialogKey: asOptionalTrimmedString(dialog?.dbKey) ?? null,
|
|
466
|
+
subjectRefs: extractNoloDialogSubjectRefs(dialog)
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
const reason = unmatchedDialogs.length > 0 ? "unmatched_results" : "ok";
|
|
470
|
+
return {
|
|
471
|
+
ok: reason === "ok",
|
|
472
|
+
reason,
|
|
473
|
+
target,
|
|
474
|
+
returnedCount: checkedDialogs.length,
|
|
475
|
+
matchedCount: checkedDialogs.length - unmatchedDialogs.length,
|
|
476
|
+
unmatchedCount: unmatchedDialogs.length,
|
|
477
|
+
unmatchedDialogs
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
function buildNoloTableQueryRequest(args, currentUserId) {
|
|
481
|
+
const tableInput = noloStringArg(args.table ?? args.metaKey);
|
|
482
|
+
if (!tableInput) return null;
|
|
483
|
+
const tableMetaParts = tableInput.startsWith("meta-") ? tableInput.split("-") : [];
|
|
484
|
+
const tenantId = args.tenantId ?? (tableMetaParts.length >= 3 ? tableMetaParts[1] : currentUserId);
|
|
485
|
+
const tableId = args.tableId ?? (tableMetaParts.length >= 3 ? tableMetaParts.slice(2).join("-") : tableInput);
|
|
486
|
+
const filters = {
|
|
487
|
+
...asRecordOrEmpty(args.filters)
|
|
488
|
+
};
|
|
489
|
+
const row = noloStringArg(args.row ?? args.rowId);
|
|
490
|
+
if (row) {
|
|
491
|
+
if (row.startsWith("row-")) filters.dbKey = row;
|
|
492
|
+
else filters.rowId = row;
|
|
493
|
+
}
|
|
494
|
+
return {
|
|
495
|
+
tenantId,
|
|
496
|
+
tableId,
|
|
497
|
+
filters,
|
|
498
|
+
columns: args.columns,
|
|
499
|
+
limit: args.limit ?? (row ? 1 : 20),
|
|
500
|
+
offset: args.offset,
|
|
501
|
+
includeBaseFields: args.includeBaseFields,
|
|
502
|
+
sortBy: args.sortBy ?? "updatedAt",
|
|
503
|
+
sortOrder: args.sortOrder === "asc" ? "asc" : "desc"
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
function buildNoloWorkspaceCommandArgs(call) {
|
|
507
|
+
const args = parseNoloWorkspaceToolArguments(call.arguments);
|
|
508
|
+
switch (call.name) {
|
|
509
|
+
case "listDialogs": {
|
|
510
|
+
const cliArgs = ["dialog", "list"];
|
|
511
|
+
const limit = noloPositiveIntegerString(args.limit);
|
|
512
|
+
const space = noloStringArg(args.space);
|
|
513
|
+
if (limit) cliArgs.push("--limit", limit);
|
|
514
|
+
if (space) cliArgs.push("--space", space);
|
|
515
|
+
return cliArgs;
|
|
516
|
+
}
|
|
517
|
+
case "readDialog": {
|
|
518
|
+
const dialog = noloStringArg(args.dialog ?? args.dialogId ?? args.id);
|
|
519
|
+
if (!dialog) throw new Error("readDialog requires dialog.");
|
|
520
|
+
const mode = noloStringArg(args.mode);
|
|
521
|
+
if (mode && mode !== "full" && mode !== "status") {
|
|
522
|
+
throw new Error(`readDialog mode must be "full" or "status", got "${mode}".`);
|
|
523
|
+
}
|
|
524
|
+
const statusMode = mode === "status";
|
|
525
|
+
const cliArgs = ["dialog", statusMode ? "status" : "read", dialog];
|
|
526
|
+
const limit = statusMode ? null : noloPositiveIntegerString(args.limit);
|
|
527
|
+
if (limit) cliArgs.push(limit);
|
|
528
|
+
const user = noloStringArg(args.user ?? args.userId ?? args.owner);
|
|
529
|
+
if (user) cliArgs.push("--user", user);
|
|
530
|
+
const server = noloStringArg(args.server ?? args.serverBase ?? args.serverUrl);
|
|
531
|
+
if (server) cliArgs.push("--server", server);
|
|
532
|
+
return cliArgs;
|
|
533
|
+
}
|
|
534
|
+
case "queryDialogsBySubjectRef": {
|
|
535
|
+
const target = buildNoloSubjectRefQueryTarget(args);
|
|
536
|
+
if (!target) throw new Error("queryDialogsBySubjectRef requires rowDbKey or subjectKind plus subjectId.");
|
|
537
|
+
const cliArgs = ["dialog", "query"];
|
|
538
|
+
const rowDbKey = noloStringArg(args.rowDbKey ?? args.row ?? args.taskRowDbKey);
|
|
539
|
+
if (rowDbKey && target.kind === "table-row" && target.id === rowDbKey) {
|
|
540
|
+
cliArgs.push("--row-dbkey", rowDbKey);
|
|
541
|
+
} else {
|
|
542
|
+
cliArgs.push("--subject-kind", target.kind, "--subject-id", target.id);
|
|
543
|
+
if (target.role) cliArgs.push("--subject-role", target.role);
|
|
544
|
+
}
|
|
545
|
+
const limit = noloPositiveIntegerString(args.limit);
|
|
546
|
+
if (limit) cliArgs.push("--limit", limit);
|
|
547
|
+
const excludeDialogId = noloStringArg(args.excludeDialogId ?? args.excludeDialog);
|
|
548
|
+
if (excludeDialogId) cliArgs.push("--exclude-dialog", excludeDialogId);
|
|
549
|
+
cliArgs.push("--json");
|
|
550
|
+
return cliArgs;
|
|
551
|
+
}
|
|
552
|
+
case "listAgents": {
|
|
553
|
+
const cliArgs = ["agent", "list"];
|
|
554
|
+
const space = noloStringArg(args.space);
|
|
555
|
+
if (space) cliArgs.push("--space", space);
|
|
556
|
+
if (args.publicOnly === true) cliArgs.push("--public-only");
|
|
557
|
+
cliArgs.push("--json", "--safe");
|
|
558
|
+
return cliArgs;
|
|
559
|
+
}
|
|
560
|
+
case "readAgent": {
|
|
561
|
+
const agent = noloStringArg(args.agent ?? args.agentKey ?? args.id);
|
|
562
|
+
if (!agent) throw new Error("readAgent requires agent.");
|
|
563
|
+
return ["agent", "read", agent];
|
|
564
|
+
}
|
|
565
|
+
case "listSpaces":
|
|
566
|
+
return ["space", "list"];
|
|
567
|
+
case "readSpace": {
|
|
568
|
+
const space = noloStringArg(args.space ?? args.spaceId ?? args.id);
|
|
569
|
+
if (!space) throw new Error("readSpace requires space.");
|
|
570
|
+
const cliArgs = ["space", "read", space];
|
|
571
|
+
const contentKey = noloStringArg(args.contentKey);
|
|
572
|
+
if (contentKey) cliArgs.push("--content-key", contentKey);
|
|
573
|
+
if (args.brief === true) cliArgs.push("--brief");
|
|
574
|
+
return cliArgs;
|
|
575
|
+
}
|
|
576
|
+
case "readDoc": {
|
|
577
|
+
const doc = noloStringArg(args.doc ?? args.docKey ?? args.pageKey ?? args.key);
|
|
578
|
+
if (!doc) throw new Error("readDoc requires doc.");
|
|
579
|
+
return doc.startsWith("page-") ? ["doc", "read", "--key", doc] : ["doc", "read", "--id", doc];
|
|
580
|
+
}
|
|
581
|
+
case "readSkillDoc": {
|
|
582
|
+
const doc = noloStringArg(args.doc ?? args.docKey ?? args.pageKey ?? args.key);
|
|
583
|
+
if (!doc) throw new Error("readSkillDoc requires doc.");
|
|
584
|
+
return doc.startsWith("page-") ? ["skill-doc", "read", "--key", doc] : ["skill-doc", "read", "--id", doc];
|
|
585
|
+
}
|
|
586
|
+
case "loadSkill":
|
|
587
|
+
throw new Error("loadSkill is a local-fs tool and has no CLI mapping; wire buildLoadSkillExecutor instead.");
|
|
588
|
+
case "listTables": {
|
|
589
|
+
const cliArgs = ["table", "list"];
|
|
590
|
+
const limit = noloPositiveIntegerString(args.limit);
|
|
591
|
+
const space = noloStringArg(args.space ?? args.spaceId);
|
|
592
|
+
const titleQuery = noloStringArg(args.titleQuery);
|
|
593
|
+
const purpose = noloStringArg(args.purpose);
|
|
594
|
+
if (limit) cliArgs.push("--limit", limit);
|
|
595
|
+
if (space) cliArgs.push("--space", space);
|
|
596
|
+
if (titleQuery) cliArgs.push("--title-query", titleQuery);
|
|
597
|
+
if (purpose) cliArgs.push("--purpose", purpose);
|
|
598
|
+
return cliArgs;
|
|
599
|
+
}
|
|
600
|
+
case "queryTableRows": {
|
|
601
|
+
const table = noloStringArg(args.table ?? args.tableId ?? args.metaKey);
|
|
602
|
+
if (!table) throw new Error("queryTableRows requires table.");
|
|
603
|
+
const cliArgs = ["table", "query", "--table", table];
|
|
604
|
+
const limit = noloPositiveIntegerString(args.limit);
|
|
605
|
+
const row = noloStringArg(args.row ?? args.rowId);
|
|
606
|
+
const output = noloStringArg(args.output);
|
|
607
|
+
if (limit) cliArgs.push("--limit", limit);
|
|
608
|
+
if (row) cliArgs.push("--row", row);
|
|
609
|
+
if (output) cliArgs.push("--output", output);
|
|
610
|
+
return cliArgs;
|
|
611
|
+
}
|
|
612
|
+
case "cliWhoami":
|
|
613
|
+
return ["whoami"];
|
|
614
|
+
case "cliDoctor":
|
|
615
|
+
return ["doctor"];
|
|
616
|
+
default:
|
|
617
|
+
throw new Error(`Unsupported Nolo workspace tool: ${call.name}`);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
export {
|
|
622
|
+
buildAgentRuntimeAgentLookupKeys,
|
|
623
|
+
shouldFetchAgentRuntimeRecordRemotely,
|
|
624
|
+
resolveRuntimeToolSurfaceForAgent,
|
|
625
|
+
redactAgentRecordForWorkspaceTool,
|
|
626
|
+
NOLO_WORKSPACE_TOOL_NAMES,
|
|
627
|
+
buildNoloWorkspaceOpenAiTools,
|
|
628
|
+
noloPositiveIntegerString,
|
|
629
|
+
noloStringArg,
|
|
630
|
+
parseNoloWorkspaceToolArguments,
|
|
631
|
+
clampNoloPositiveInteger,
|
|
632
|
+
getNoloDialogIdFromKey,
|
|
633
|
+
resolveNoloDialogInput,
|
|
634
|
+
normalizeNoloSpaceInput,
|
|
635
|
+
getNoloComparableUpdatedAt,
|
|
636
|
+
buildNoloSubjectRefQueryTarget,
|
|
637
|
+
normalizeNoloExcludeDialogIds,
|
|
638
|
+
filterNoloDialogSubjectRefEvidence,
|
|
639
|
+
verifyNoloDialogSubjectRefQuery,
|
|
640
|
+
buildNoloTableQueryRequest,
|
|
641
|
+
buildNoloWorkspaceCommandArgs
|
|
642
|
+
};
|