@arbidocs/blocks 0.4.3 → 0.4.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/dist/agents/definitions/AgentCreator.d.ts +11 -2
- package/dist/agents/definitions/index.d.ts +1 -0
- package/dist/agents/definitions/persona.d.ts +16 -0
- package/dist/agents/index.cjs +197 -145
- package/dist/agents/index.js +1 -1
- package/dist/agents/tasks/TaskRunsDialog.d.ts +15 -3
- package/dist/agents/tasks/index.d.ts +1 -0
- package/dist/agents/tasks/taskRequest.d.ts +61 -0
- package/dist/{chunk-TYZUCAT7.js → chunk-7YADKWZT.js} +43 -6
- package/dist/chunk-7YADKWZT.js.map +1 -0
- package/dist/{chunk-AAY5ASZD.js → chunk-BBEMPS6C.js} +166 -24
- package/dist/chunk-BBEMPS6C.js.map +1 -0
- package/dist/{chunk-VXOGANFJ.cjs → chunk-DGVKBOY5.cjs} +177 -22
- package/dist/chunk-DGVKBOY5.cjs.map +1 -0
- package/dist/{chunk-SYDHKKRZ.cjs → chunk-IZHWP6WQ.cjs} +47 -5
- package/dist/chunk-IZHWP6WQ.cjs.map +1 -0
- package/dist/collaboration/contacts/AddContactsParts.d.ts +9 -4
- package/dist/collaboration/contacts/index.d.ts +1 -0
- package/dist/collaboration/contacts/parseEmails.d.ts +26 -0
- package/dist/collaboration/index.cjs +51 -31
- package/dist/collaboration/index.js +1 -1
- package/dist/index.cjs +361 -289
- package/dist/index.js +4 -4
- package/dist/settings/index.cjs +1 -1
- package/dist/settings/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-AAY5ASZD.js.map +0 -1
- package/dist/chunk-SYDHKKRZ.cjs.map +0 -1
- package/dist/chunk-TYZUCAT7.js.map +0 -1
- package/dist/chunk-VXOGANFJ.cjs.map +0 -1
|
@@ -1222,6 +1222,7 @@ var DEFAULT_AGENT_CREATOR_LABELS = {
|
|
|
1222
1222
|
workspaceAccess: "Workspace access",
|
|
1223
1223
|
workspaceAccessHint: "Each workspace stays separate. The agent can only read the ones you tick here.",
|
|
1224
1224
|
workspaceAlready: "Already has access",
|
|
1225
|
+
revokeWorkspace: (name) => `Remove access to ${name}`,
|
|
1225
1226
|
noWorkspacesToGrant: "You have no workspaces yet.",
|
|
1226
1227
|
name: "Name",
|
|
1227
1228
|
nameHint: "Letters, digits, - and _ only; must start with a letter or digit.",
|
|
@@ -1297,6 +1298,8 @@ function AgentCreator({
|
|
|
1297
1298
|
models = [],
|
|
1298
1299
|
workspaces = [],
|
|
1299
1300
|
grantedWorkspaceIds = [],
|
|
1301
|
+
onRevokeWorkspace,
|
|
1302
|
+
revokingWorkspaceId,
|
|
1300
1303
|
avatar,
|
|
1301
1304
|
types,
|
|
1302
1305
|
values: valuesProp,
|
|
@@ -1487,26 +1490,40 @@ function AgentCreator({
|
|
|
1487
1490
|
workspaces.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: l.noWorkspacesToGrant }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: workspaces.map((w) => {
|
|
1488
1491
|
const already = grantedWorkspaceIds.includes(w.id);
|
|
1489
1492
|
const on = already || values.workspaceIds.includes(w.id);
|
|
1490
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1493
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1", children: [
|
|
1494
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1495
|
+
"button",
|
|
1496
|
+
{
|
|
1497
|
+
type: "button",
|
|
1498
|
+
role: "checkbox",
|
|
1499
|
+
"aria-checked": on,
|
|
1500
|
+
disabled: already,
|
|
1501
|
+
title: already ? l.workspaceAlready : void 0,
|
|
1502
|
+
"data-testid": `${id}-workspace-${w.id}`,
|
|
1503
|
+
onClick: () => patch({
|
|
1504
|
+
workspaceIds: on ? values.workspaceIds.filter((x) => x !== w.id) : [...values.workspaceIds, w.id]
|
|
1505
|
+
}),
|
|
1506
|
+
className: ui.cn(
|
|
1507
|
+
"rounded-md border px-3 py-1.5 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60 pointer-coarse:min-h-11",
|
|
1508
|
+
on ? "border-primary bg-primary/10 text-primary" : "border-border [&:hover:not(:disabled)]:bg-accent"
|
|
1509
|
+
),
|
|
1510
|
+
children: w.name
|
|
1511
|
+
}
|
|
1512
|
+
),
|
|
1513
|
+
already && onRevokeWorkspace && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1514
|
+
"button",
|
|
1515
|
+
{
|
|
1516
|
+
type: "button",
|
|
1517
|
+
"aria-label": l.revokeWorkspace(w.name),
|
|
1518
|
+
title: l.revokeWorkspace(w.name),
|
|
1519
|
+
disabled: revokingWorkspaceId === w.id,
|
|
1520
|
+
"data-testid": `${id}-workspace-${w.id}-revoke`,
|
|
1521
|
+
onClick: () => onRevokeWorkspace(w.id),
|
|
1522
|
+
className: "flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 pointer-coarse:size-11",
|
|
1523
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-4", "aria-hidden": true })
|
|
1524
|
+
}
|
|
1525
|
+
)
|
|
1526
|
+
] }, w.id);
|
|
1510
1527
|
}) })
|
|
1511
1528
|
] }),
|
|
1512
1529
|
models.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
@@ -1563,6 +1580,31 @@ function AgentCreator({
|
|
|
1563
1580
|
}
|
|
1564
1581
|
) });
|
|
1565
1582
|
}
|
|
1583
|
+
|
|
1584
|
+
// src/agents/definitions/persona.ts
|
|
1585
|
+
function composePersona(name, description) {
|
|
1586
|
+
const body = description.trim();
|
|
1587
|
+
const preamble = `You are ${name}, an AI agent.`;
|
|
1588
|
+
return body ? `${preamble} ${body}` : preamble;
|
|
1589
|
+
}
|
|
1590
|
+
function stripPersonaPreamble(persona) {
|
|
1591
|
+
return persona.replace(/^You are .+?, an AI agent\.\s*/, "").trim();
|
|
1592
|
+
}
|
|
1593
|
+
function agentCreatorToConfigSection(values, capabilityKeys) {
|
|
1594
|
+
return {
|
|
1595
|
+
PERSONA: composePersona(values.name, values.persona),
|
|
1596
|
+
...values.modelName ? { AGENT_MODEL_NAME: values.modelName } : {},
|
|
1597
|
+
...Object.fromEntries(capabilityKeys.map((k) => [k, !!values.capabilities[k]]))
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
function agentConfigSectionToValues(section, capabilityKeys) {
|
|
1601
|
+
const s = section ?? {};
|
|
1602
|
+
return {
|
|
1603
|
+
persona: stripPersonaPreamble(String(s.PERSONA ?? "")),
|
|
1604
|
+
modelName: String(s.AGENT_MODEL_NAME ?? ""),
|
|
1605
|
+
capabilities: Object.fromEntries(capabilityKeys.map((k) => [k, Boolean(s[k])]))
|
|
1606
|
+
};
|
|
1607
|
+
}
|
|
1566
1608
|
function SkillTypeBadge({ type, className }) {
|
|
1567
1609
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1568
1610
|
"span",
|
|
@@ -3868,6 +3910,106 @@ function TaskComposer({
|
|
|
3868
3910
|
}
|
|
3869
3911
|
) });
|
|
3870
3912
|
}
|
|
3913
|
+
|
|
3914
|
+
// src/agents/tasks/taskRequest.ts
|
|
3915
|
+
var TRIGGER_FOR = {
|
|
3916
|
+
now: "one_time",
|
|
3917
|
+
once: "one_time",
|
|
3918
|
+
repeat: "recurring",
|
|
3919
|
+
event: "event"
|
|
3920
|
+
};
|
|
3921
|
+
function authModeFor(values) {
|
|
3922
|
+
if (values.when === "now") return "run_now_temp";
|
|
3923
|
+
return values.access === "standing" ? "scheduled_permanent" : "scheduled_require_auth";
|
|
3924
|
+
}
|
|
3925
|
+
function localInputToIso(local) {
|
|
3926
|
+
const d = new Date(local);
|
|
3927
|
+
if (!local || Number.isNaN(d.getTime())) throw new Error("Pick a valid date and time.");
|
|
3928
|
+
return d.toISOString();
|
|
3929
|
+
}
|
|
3930
|
+
function isoToLocalInput(iso) {
|
|
3931
|
+
if (!iso) return "";
|
|
3932
|
+
const d = new Date(iso);
|
|
3933
|
+
if (Number.isNaN(d.getTime())) return "";
|
|
3934
|
+
return new Date(d.getTime() - d.getTimezoneOffset() * 6e4).toISOString().slice(0, 16);
|
|
3935
|
+
}
|
|
3936
|
+
function workflowTaskFields(workflow, inputs, name) {
|
|
3937
|
+
const typed = name?.trim();
|
|
3938
|
+
if (workflow.options?.agent === false) {
|
|
3939
|
+
const message = composeWorkflowPrompt(workflow, inputs);
|
|
3940
|
+
return { name: typed || message, action_type: "notify", prompt: "", skill_ref: null };
|
|
3941
|
+
}
|
|
3942
|
+
if (workflow.skill) {
|
|
3943
|
+
return {
|
|
3944
|
+
name: typed || workflow.title,
|
|
3945
|
+
action_type: "run_skill",
|
|
3946
|
+
prompt: typeof inputs.args === "string" ? inputs.args.trim() : "",
|
|
3947
|
+
skill_ref: workflow.skill
|
|
3948
|
+
};
|
|
3949
|
+
}
|
|
3950
|
+
return {
|
|
3951
|
+
name: typed || workflow.title,
|
|
3952
|
+
action_type: "agent_prompt",
|
|
3953
|
+
prompt: composeWorkflowPrompt(workflow, inputs),
|
|
3954
|
+
skill_ref: null
|
|
3955
|
+
};
|
|
3956
|
+
}
|
|
3957
|
+
var isAgenticWorkflow = (workflow) => workflow.options?.agent !== false;
|
|
3958
|
+
function taskComposerToCreateRequest({ workflow, values }, workspaceId) {
|
|
3959
|
+
const fields = workflowTaskFields(workflow, values.inputs, values.name);
|
|
3960
|
+
const agentic = isAgenticWorkflow(workflow);
|
|
3961
|
+
if (agentic && !workspaceId) throw new Error("Open a workspace to run an agent task.");
|
|
3962
|
+
return {
|
|
3963
|
+
name: fields.name,
|
|
3964
|
+
trigger_type: TRIGGER_FOR[values.when],
|
|
3965
|
+
timezone: values.timezone,
|
|
3966
|
+
action_type: fields.action_type,
|
|
3967
|
+
prompt: fields.prompt,
|
|
3968
|
+
rrule: values.when === "repeat" ? values.rrule.trim() : null,
|
|
3969
|
+
run_at: values.when === "once" ? localInputToIso(values.runAt) : values.when === "now" ? (/* @__PURE__ */ new Date()).toISOString() : null,
|
|
3970
|
+
event_kind: values.when === "event" ? values.eventKind.trim() : null,
|
|
3971
|
+
skill_ref: fields.skill_ref,
|
|
3972
|
+
notify_on_complete: values.notifyOnComplete,
|
|
3973
|
+
auth_mode: authModeFor(values),
|
|
3974
|
+
workspace_ext_id: agentic ? workspaceId ?? null : null,
|
|
3975
|
+
agent_ext_id: values.agentId || null
|
|
3976
|
+
};
|
|
3977
|
+
}
|
|
3978
|
+
function taskComposerToUpdateRequest({
|
|
3979
|
+
workflow,
|
|
3980
|
+
values
|
|
3981
|
+
}) {
|
|
3982
|
+
const fields = workflowTaskFields(workflow, values.inputs, values.name);
|
|
3983
|
+
return {
|
|
3984
|
+
name: fields.name,
|
|
3985
|
+
rrule: values.when === "repeat" ? values.rrule.trim() : null,
|
|
3986
|
+
run_at: values.when === "once" && values.runAt ? localInputToIso(values.runAt) : null,
|
|
3987
|
+
timezone: values.timezone,
|
|
3988
|
+
prompt: fields.prompt,
|
|
3989
|
+
skill_ref: fields.skill_ref,
|
|
3990
|
+
notify_on_complete: values.notifyOnComplete,
|
|
3991
|
+
auth_mode: authModeFor(values)
|
|
3992
|
+
};
|
|
3993
|
+
}
|
|
3994
|
+
var taskNeedsAccess = (task) => !!task.pending_auth_request_id;
|
|
3995
|
+
function taskToComposerValues(task, workflows) {
|
|
3996
|
+
const reminder = task.action_type === "notify";
|
|
3997
|
+
const auth = task.auth_mode ?? "scheduled_permanent";
|
|
3998
|
+
const when = auth === "run_now_temp" ? "now" : task.trigger_type === "recurring" ? "repeat" : task.trigger_type === "event" ? "event" : "once";
|
|
3999
|
+
return {
|
|
4000
|
+
workflowId: reminder ? workflows.reminderWorkflowId : workflows.customWorkflowId,
|
|
4001
|
+
inputs: reminder ? { message: task.name } : { instruction: task.prompt },
|
|
4002
|
+
when,
|
|
4003
|
+
runAt: isoToLocalInput(task.run_at),
|
|
4004
|
+
rrule: task.rrule ?? "",
|
|
4005
|
+
timezone: task.timezone,
|
|
4006
|
+
eventKind: task.event_kind ?? "user_message",
|
|
4007
|
+
agentId: task.agent_ext_id ?? "",
|
|
4008
|
+
name: task.name,
|
|
4009
|
+
notifyOnComplete: task.notify_on_complete ?? false,
|
|
4010
|
+
access: auth === "scheduled_permanent" ? "standing" : "ask_each_run"
|
|
4011
|
+
};
|
|
4012
|
+
}
|
|
3871
4013
|
var DEFAULT_TUPLE_ARRAY_FIELD_LABELS = {
|
|
3872
4014
|
addRow: "Add Row",
|
|
3873
4015
|
empty: 'No examples added yet. Click "Add Row" to start.',
|
|
@@ -5640,8 +5782,12 @@ exports.UploadTaskList = UploadTaskList;
|
|
|
5640
5782
|
exports.WEEKDAYS = WEEKDAYS;
|
|
5641
5783
|
exports.WorkflowConfigDialog = WorkflowConfigDialog;
|
|
5642
5784
|
exports.WorkflowLauncher = WorkflowLauncher;
|
|
5785
|
+
exports.agentConfigSectionToValues = agentConfigSectionToValues;
|
|
5786
|
+
exports.agentCreatorToConfigSection = agentCreatorToConfigSection;
|
|
5787
|
+
exports.authModeFor = authModeFor;
|
|
5643
5788
|
exports.buildLaunch = buildLaunch;
|
|
5644
5789
|
exports.buildRRule = buildRRule;
|
|
5790
|
+
exports.composePersona = composePersona;
|
|
5645
5791
|
exports.composeWorkflowPrompt = composeWorkflowPrompt;
|
|
5646
5792
|
exports.createTaskColumns = createTaskColumns;
|
|
5647
5793
|
exports.defaultInputs = defaultInputs;
|
|
@@ -5653,22 +5799,31 @@ exports.goalProgress = goalProgress;
|
|
|
5653
5799
|
exports.humanizeSection = humanizeSection;
|
|
5654
5800
|
exports.inferType = inferType;
|
|
5655
5801
|
exports.inputsFromContext = inputsFromContext;
|
|
5802
|
+
exports.isAgenticWorkflow = isAgenticWorkflow;
|
|
5656
5803
|
exports.isEmptyWorkflowScope = isEmptyWorkflowScope;
|
|
5657
5804
|
exports.isOutOfBounds = isOutOfBounds;
|
|
5658
5805
|
exports.isValidAgentName = isValidAgentName;
|
|
5659
5806
|
exports.isWorkflowScope = isWorkflowScope;
|
|
5807
|
+
exports.isoToLocalInput = isoToLocalInput;
|
|
5808
|
+
exports.localInputToIso = localInputToIso;
|
|
5660
5809
|
exports.nextCriterionId = nextCriterionId;
|
|
5661
5810
|
exports.parseRRule = parseRRule;
|
|
5662
5811
|
exports.prettifyKey = prettifyKey;
|
|
5663
5812
|
exports.promptFieldName = promptFieldName;
|
|
5664
5813
|
exports.skillToWorkflow = skillToWorkflow;
|
|
5665
5814
|
exports.statusBadgeVariant = statusBadgeVariant;
|
|
5815
|
+
exports.stripPersonaPreamble = stripPersonaPreamble;
|
|
5666
5816
|
exports.summarizeAgent = summarizeAgent;
|
|
5667
5817
|
exports.summarizeCapabilities = summarizeCapabilities;
|
|
5818
|
+
exports.taskComposerToCreateRequest = taskComposerToCreateRequest;
|
|
5819
|
+
exports.taskComposerToUpdateRequest = taskComposerToUpdateRequest;
|
|
5820
|
+
exports.taskNeedsAccess = taskNeedsAccess;
|
|
5821
|
+
exports.taskToComposerValues = taskToComposerValues;
|
|
5668
5822
|
exports.validateInputs = validateInputs;
|
|
5669
5823
|
exports.workflowAccepts = workflowAccepts;
|
|
5670
5824
|
exports.workflowFromFrontmatter = workflowFromFrontmatter;
|
|
5825
|
+
exports.workflowTaskFields = workflowTaskFields;
|
|
5671
5826
|
exports.workflowsAccepting = workflowsAccepting;
|
|
5672
5827
|
exports.workflowsForHost = workflowsForHost;
|
|
5673
|
-
//# sourceMappingURL=chunk-
|
|
5674
|
-
//# sourceMappingURL=chunk-
|
|
5828
|
+
//# sourceMappingURL=chunk-DGVKBOY5.cjs.map
|
|
5829
|
+
//# sourceMappingURL=chunk-DGVKBOY5.cjs.map
|