@firfi/huly-mcp 0.5.4 → 0.6.0

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 CHANGED
@@ -151393,6 +151393,8 @@ var CommentId = HulyRef("CommentId");
151393
151393
  var TimeSpendReportId = HulyRef("TimeSpendReportId");
151394
151394
  var TagElementId = HulyRef("TagElementId");
151395
151395
  var TagCategoryId = HulyRef("TagCategoryId");
151396
+ var WorkSlotId = HulyRef("WorkSlotId");
151397
+ var CustomFieldId = HulyRef("CustomFieldId");
151396
151398
  var TestProjectId = HulyRef("TestProjectId");
151397
151399
  var TestSuiteId = HulyRef("TestSuiteId");
151398
151400
  var TestCaseId = HulyRef("TestCaseId");
@@ -151419,6 +151421,10 @@ var EmojiCode = NonEmptyString2.pipe(Schema_exports.brand("EmojiCode"));
151419
151421
  var ContactProvider = NonEmptyString2.pipe(Schema_exports.brand("ContactProvider"));
151420
151422
  var NotificationProviderId = NonEmptyString2.pipe(Schema_exports.brand("NotificationProviderId"));
151421
151423
  var NotificationTypeId = NonEmptyString2.pipe(Schema_exports.brand("NotificationTypeId"));
151424
+ var WorkspaceName = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceName"));
151425
+ var UrlString = NonEmptyString2.pipe(Schema_exports.brand("UrlString"));
151426
+ var WorkspaceVersion = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceVersion"));
151427
+ var WorkspaceMode = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceMode"));
151422
151428
  var WorkspaceUuid = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceUuid"));
151423
151429
  var PersonUuid = NonEmptyString2.pipe(Schema_exports.brand("PersonUuid"));
151424
151430
  var AccountId = NonEmptyString2.pipe(Schema_exports.brand("AccountId"));
@@ -151491,6 +151497,10 @@ var findByNameOrId = (client, _class, primaryQuery, fallbackQuery, options) => E
151491
151497
  client.findOne(_class, primaryQuery, options),
151492
151498
  (result) => result !== void 0 ? Effect_exports.succeed(result) : client.findOne(_class, fallbackQuery, options)
151493
151499
  );
151500
+ var findByNameOrIdOrFail = (client, _class, primaryQuery, fallbackQuery, onNotFound, options) => Effect_exports.flatMap(
151501
+ findByNameOrId(client, _class, primaryQuery, fallbackQuery, options),
151502
+ (result) => result !== void 0 ? Effect_exports.succeed(result) : Effect_exports.fail(onNotFound())
151503
+ );
151494
151504
  var UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
151495
151505
  var validatePersonUuid = (uuid5) => {
151496
151506
  if (uuid5 === void 0) return Effect_exports.succeed(void 0);
@@ -171226,7 +171236,7 @@ var PostHog = class extends PostHogBackendClient {
171226
171236
  };
171227
171237
 
171228
171238
  // src/version.ts
171229
- var VERSION = true ? "0.5.3" : "0.0.0-dev";
171239
+ var VERSION = true ? "0.5.4" : "0.0.0-dev";
171230
171240
 
171231
171241
  // src/telemetry/posthog.ts
171232
171242
  var POSTHOG_API_KEY = "phc_TGfFqCGdnF0p68wuFzd5WSw1IsBvOJW0YgoMJDyZPjm";
@@ -171770,6 +171780,7 @@ var resolveAnnotations = (tool) => ({
171770
171780
  ...deriveAnnotations(tool.name),
171771
171781
  ...tool.annotations
171772
171782
  });
171783
+ var encodeOutput = (schema, result) => Schema_exports.encodeUnknownSync(schema)(result);
171773
171784
  var provideHulyClient = (args2) => (effect2) => Either_exports.right(effect2.pipe(Effect_exports.provideService(HulyClient, args2.hulyClient)));
171774
171785
  var provideStorageClient = (args2) => (effect2) => Either_exports.right(effect2.pipe(Effect_exports.provideService(HulyStorageClient, args2.storageClient)));
171775
171786
  var provideCombinedClient = (args2) => (effect2) => Either_exports.right(
@@ -171779,7 +171790,7 @@ var provideCombinedClient = (args2) => (effect2) => Either_exports.right(
171779
171790
  )
171780
171791
  );
171781
171792
  var provideWorkspaceClient = (args2) => (effect2) => args2.workspaceClient !== void 0 ? Either_exports.right(effect2.pipe(Effect_exports.provideService(WorkspaceClient, args2.workspaceClient))) : Either_exports.left(mapDomainErrorToMcp(new HulyError({ message: "WorkspaceClient not available" })));
171782
- var createHandler = (toolName, provide4, parse5, operation) => async (args2, hulyClient, storageClient, workspaceClient) => {
171793
+ var createHandler = (toolName, provide4, parse5, operation, encode8) => async (args2, hulyClient, storageClient, workspaceClient) => {
171783
171794
  const parseResult = await Effect_exports.runPromiseExit(parse5(args2));
171784
171795
  if (Exit_exports.isFailure(parseResult)) {
171785
171796
  return mapParseCauseToMcp(parseResult.cause, toolName);
@@ -171792,13 +171803,37 @@ var createHandler = (toolName, provide4, parse5, operation) => async (args2, hul
171792
171803
  if (Exit_exports.isFailure(operationResult)) {
171793
171804
  return mapDomainCauseToMcp(operationResult.cause);
171794
171805
  }
171795
- return createSuccessResponse(operationResult.value);
171806
+ try {
171807
+ const output = encode8 !== void 0 ? encode8(operationResult.value) : operationResult.value;
171808
+ return createSuccessResponse(output);
171809
+ } catch {
171810
+ return mapDomainErrorToMcp(new HulyError({ message: `Tool ${toolName} produced invalid output` }));
171811
+ }
171796
171812
  };
171797
171813
  var createToolHandler = (toolName, parse5, operation) => createHandler(toolName, provideHulyClient, parse5, operation);
171814
+ var createEncodedToolHandler = (toolName, parse5, operation, outputSchema) => createHandler(
171815
+ toolName,
171816
+ provideHulyClient,
171817
+ parse5,
171818
+ operation,
171819
+ (result) => encodeOutput(outputSchema, result)
171820
+ );
171798
171821
  var createStorageToolHandler = (toolName, parse5, operation) => createHandler(toolName, provideStorageClient, parse5, operation);
171799
171822
  var createCombinedToolHandler = (toolName, parse5, operation) => createHandler(toolName, provideCombinedClient, parse5, operation);
171800
- var createWorkspaceToolHandler = (toolName, parse5, operation) => createHandler(toolName, provideWorkspaceClient, parse5, operation);
171801
- var createNoParamsWorkspaceToolHandler = (operation) => createHandler("", provideWorkspaceClient, () => Effect_exports.succeed(void 0), operation);
171823
+ var createEncodedWorkspaceToolHandler = (toolName, parse5, operation, outputSchema) => createHandler(
171824
+ toolName,
171825
+ provideWorkspaceClient,
171826
+ parse5,
171827
+ operation,
171828
+ (result) => encodeOutput(outputSchema, result)
171829
+ );
171830
+ var createEncodedNoParamsWorkspaceToolHandler = (toolName, operation, outputSchema) => createHandler(
171831
+ toolName,
171832
+ provideWorkspaceClient,
171833
+ () => Effect_exports.succeed(void 0),
171834
+ operation,
171835
+ (result) => encodeOutput(outputSchema, result)
171836
+ );
171802
171837
 
171803
171838
  // src/mcp/tools/activity.ts
171804
171839
  var CATEGORY = "activity";
@@ -174068,6 +174103,41 @@ var SetCustomFieldParamsSchema = Schema_exports.Struct({
174068
174103
  title: "SetCustomFieldParams",
174069
174104
  description: "Parameters for setting a custom field value on a document"
174070
174105
  });
174106
+ var CustomFieldTypeNameSchema = Schema_exports.Literal(
174107
+ "string",
174108
+ "number",
174109
+ "boolean",
174110
+ "enum",
174111
+ "array",
174112
+ "ref",
174113
+ "date",
174114
+ "markup",
174115
+ "unknown"
174116
+ );
174117
+ var CustomFieldInfoWireSchema = Schema_exports.Struct({
174118
+ id: CustomFieldId,
174119
+ name: Schema_exports.String,
174120
+ label: Schema_exports.String,
174121
+ ownerClassId: ObjectClassName,
174122
+ ownerLabel: Schema_exports.String,
174123
+ type: CustomFieldTypeNameSchema,
174124
+ typeDetails: Schema_exports.Record({ key: Schema_exports.String, value: Schema_exports.Unknown })
174125
+ });
174126
+ var CustomFieldValueWireSchema = Schema_exports.Struct({
174127
+ fieldId: CustomFieldId,
174128
+ label: Schema_exports.String,
174129
+ value: Schema_exports.Unknown,
174130
+ type: CustomFieldTypeNameSchema
174131
+ });
174132
+ var SetCustomFieldResultWireSchema = Schema_exports.Struct({
174133
+ objectId: NonEmptyString2,
174134
+ fieldId: CustomFieldId,
174135
+ label: Schema_exports.String,
174136
+ value: Schema_exports.Unknown,
174137
+ updated: Schema_exports.Boolean
174138
+ });
174139
+ var ListCustomFieldsResultSchema = Schema_exports.Array(CustomFieldInfoWireSchema);
174140
+ var GetCustomFieldValuesResultSchema = Schema_exports.Array(CustomFieldValueWireSchema);
174071
174141
  var listCustomFieldsParamsJsonSchema = JSONSchema_exports.make(ListCustomFieldsParamsSchema);
174072
174142
  var getCustomFieldValuesParamsJsonSchema = JSONSchema_exports.make(GetCustomFieldValuesParamsSchema);
174073
174143
  var setCustomFieldParamsJsonSchema = JSONSchema_exports.make(SetCustomFieldParamsSchema);
@@ -175856,6 +175926,64 @@ var parseListWorkSlotsParams = Schema_exports.decodeUnknown(ListWorkSlotsParamsS
175856
175926
  var parseCreateWorkSlotParams = Schema_exports.decodeUnknown(CreateWorkSlotParamsSchema);
175857
175927
  var parseStartTimerParams = Schema_exports.decodeUnknown(StartTimerParamsSchema);
175858
175928
  var parseStopTimerParams = Schema_exports.decodeUnknown(StopTimerParamsSchema);
175929
+ var TimeSpendReportWireSchema = Schema_exports.Struct({
175930
+ id: Schema_exports.String,
175931
+ identifier: Schema_exports.optional(IssueIdentifier),
175932
+ employee: Schema_exports.optional(NonEmptyString2),
175933
+ date: Schema_exports.optional(Schema_exports.NullOr(Timestamp)),
175934
+ value: Schema_exports.Number,
175935
+ description: Schema_exports.String
175936
+ });
175937
+ var TimeReportSummarySchema = Schema_exports.Struct({
175938
+ identifier: Schema_exports.optional(IssueIdentifier),
175939
+ totalTime: Schema_exports.Number,
175940
+ estimation: Schema_exports.optional(Schema_exports.Number.pipe(Schema_exports.positive())),
175941
+ remainingTime: Schema_exports.optional(Schema_exports.Number.pipe(Schema_exports.positive())),
175942
+ reports: Schema_exports.Array(TimeSpendReportWireSchema)
175943
+ });
175944
+ var WorkSlotWireSchema = Schema_exports.Struct({
175945
+ id: Schema_exports.String,
175946
+ todoId: TodoId,
175947
+ date: Timestamp,
175948
+ dueDate: Timestamp,
175949
+ title: Schema_exports.optional(Schema_exports.String)
175950
+ });
175951
+ var DetailedTimeReportSchema = Schema_exports.Struct({
175952
+ project: ProjectIdentifier,
175953
+ totalTime: Schema_exports.Number,
175954
+ byIssue: Schema_exports.Array(
175955
+ Schema_exports.Struct({
175956
+ identifier: Schema_exports.optional(IssueIdentifier),
175957
+ issueTitle: Schema_exports.String,
175958
+ totalTime: Schema_exports.Number,
175959
+ reports: Schema_exports.Array(TimeSpendReportWireSchema)
175960
+ })
175961
+ ),
175962
+ byEmployee: Schema_exports.Array(
175963
+ Schema_exports.Struct({
175964
+ employeeName: Schema_exports.optional(NonEmptyString2),
175965
+ totalTime: Schema_exports.Number
175966
+ })
175967
+ )
175968
+ });
175969
+ var LogTimeResultSchema = Schema_exports.Struct({
175970
+ reportId: Schema_exports.String,
175971
+ identifier: IssueIdentifier
175972
+ });
175973
+ var CreateWorkSlotResultSchema = Schema_exports.Struct({
175974
+ slotId: Schema_exports.String
175975
+ });
175976
+ var StartTimerResultSchema = Schema_exports.Struct({
175977
+ identifier: IssueIdentifier,
175978
+ startedAt: Timestamp
175979
+ });
175980
+ var StopTimerResultSchema = Schema_exports.Struct({
175981
+ identifier: IssueIdentifier,
175982
+ stoppedAt: Timestamp,
175983
+ reportId: Schema_exports.optional(Schema_exports.String)
175984
+ });
175985
+ var ListTimeSpendReportsResultSchema = Schema_exports.Array(TimeSpendReportWireSchema);
175986
+ var ListWorkSlotsResultSchema = Schema_exports.Array(WorkSlotWireSchema);
175859
175987
 
175860
175988
  // src/domain/schemas/search.ts
175861
175989
  var FulltextSearchParamsSchema = Schema_exports.Struct({
@@ -175935,6 +176063,34 @@ var listIssueRelationsParamsJsonSchema = JSONSchema_exports.make(ListIssueRelati
175935
176063
  var parseAddIssueRelationParams = Schema_exports.decodeUnknown(AddIssueRelationParamsSchema);
175936
176064
  var parseRemoveIssueRelationParams = Schema_exports.decodeUnknown(RemoveIssueRelationParamsSchema);
175937
176065
  var parseListIssueRelationsParams = Schema_exports.decodeUnknown(ListIssueRelationsParamsSchema);
176066
+ var RelationEntryWireSchema = Schema_exports.Struct({
176067
+ identifier: IssueIdentifier,
176068
+ _id: IssueId,
176069
+ _class: ObjectClassName
176070
+ });
176071
+ var DocumentRelationEntryWireSchema = Schema_exports.Struct({
176072
+ title: Schema_exports.String,
176073
+ teamspace: TeamspaceIdentifier,
176074
+ _id: DocumentId,
176075
+ _class: ObjectClassName
176076
+ });
176077
+ var AddIssueRelationResultSchema = Schema_exports.Struct({
176078
+ sourceIssue: IssueIdentifier,
176079
+ targetIssue: IssueIdentifier,
176080
+ relationType: RelationTypeSchema,
176081
+ added: Schema_exports.Boolean
176082
+ });
176083
+ var RemoveIssueRelationResultSchema = Schema_exports.Struct({
176084
+ sourceIssue: IssueIdentifier,
176085
+ targetIssue: IssueIdentifier,
176086
+ relationType: RelationTypeSchema,
176087
+ removed: Schema_exports.Boolean
176088
+ });
176089
+ var ListIssueRelationsResultSchema = Schema_exports.Struct({
176090
+ blockedBy: Schema_exports.Array(RelationEntryWireSchema),
176091
+ relations: Schema_exports.Array(RelationEntryWireSchema),
176092
+ documents: Schema_exports.Array(DocumentRelationEntryWireSchema)
176093
+ });
175938
176094
 
175939
176095
  // src/domain/schemas/document-relations.ts
175940
176096
  var docRelationFields = {
@@ -176222,6 +176378,71 @@ var parseCreateWorkspaceParams = Schema_exports.decodeUnknown(CreateWorkspacePar
176222
176378
  var parseUpdateUserProfileParams = Schema_exports.decodeUnknown(UpdateUserProfileParamsSchema);
176223
176379
  var parseUpdateGuestSettingsParams = Schema_exports.decodeUnknown(UpdateGuestSettingsParamsSchema);
176224
176380
  var parseGetRegionsParams = Schema_exports.decodeUnknown(GetRegionsParamsSchema);
176381
+ var WorkspaceMemberSchema = Schema_exports.Struct({
176382
+ personId: Schema_exports.String,
176383
+ role: AccountRoleSchema,
176384
+ name: Schema_exports.optional(NonEmptyString2),
176385
+ email: Schema_exports.optional(NonEmptyString2)
176386
+ });
176387
+ var WorkspaceInfoSchema = Schema_exports.Struct({
176388
+ uuid: Schema_exports.String,
176389
+ name: NonEmptyString2,
176390
+ url: NonEmptyString2,
176391
+ region: Schema_exports.optional(Schema_exports.String),
176392
+ createdOn: Schema_exports.Number,
176393
+ allowReadOnlyGuest: Schema_exports.optional(Schema_exports.Boolean),
176394
+ allowGuestSignUp: Schema_exports.optional(Schema_exports.Boolean),
176395
+ version: Schema_exports.optional(NonEmptyString2),
176396
+ mode: Schema_exports.optional(NonEmptyString2)
176397
+ });
176398
+ var WorkspaceSummarySchema = Schema_exports.Struct({
176399
+ uuid: Schema_exports.String,
176400
+ name: NonEmptyString2,
176401
+ url: NonEmptyString2,
176402
+ region: Schema_exports.optional(Schema_exports.String),
176403
+ createdOn: Schema_exports.Number,
176404
+ lastVisit: Schema_exports.optional(Schema_exports.Number)
176405
+ });
176406
+ var RegionInfoSchema = Schema_exports.Struct({
176407
+ region: Schema_exports.String,
176408
+ name: Schema_exports.String
176409
+ });
176410
+ var UserProfileSchema = Schema_exports.Struct({
176411
+ personUuid: Schema_exports.String,
176412
+ firstName: Schema_exports.String,
176413
+ lastName: Schema_exports.String,
176414
+ bio: Schema_exports.optional(Schema_exports.String),
176415
+ city: Schema_exports.optional(Schema_exports.String),
176416
+ country: Schema_exports.optional(Schema_exports.String),
176417
+ website: Schema_exports.optional(Schema_exports.String),
176418
+ socialLinks: Schema_exports.optional(Schema_exports.Record({ key: Schema_exports.String, value: Schema_exports.String })),
176419
+ isPublic: Schema_exports.Boolean
176420
+ });
176421
+ var UpdateMemberRoleResultSchema = Schema_exports.Struct({
176422
+ accountId: Schema_exports.String,
176423
+ role: AccountRoleSchema,
176424
+ updated: Schema_exports.Boolean
176425
+ });
176426
+ var CreateWorkspaceResultSchema = Schema_exports.Struct({
176427
+ uuid: Schema_exports.String,
176428
+ url: NonEmptyString2,
176429
+ name: NonEmptyString2
176430
+ });
176431
+ var DeleteWorkspaceResultSchema = Schema_exports.Struct({
176432
+ deleted: Schema_exports.Boolean
176433
+ });
176434
+ var UpdateUserProfileResultSchema = Schema_exports.Struct({
176435
+ updated: Schema_exports.Boolean
176436
+ });
176437
+ var UpdateGuestSettingsResultSchema = Schema_exports.Struct({
176438
+ updated: Schema_exports.Boolean,
176439
+ allowReadOnly: Schema_exports.optional(Schema_exports.Boolean),
176440
+ allowSignUp: Schema_exports.optional(Schema_exports.Boolean)
176441
+ });
176442
+ var ListWorkspaceMembersResultSchema = Schema_exports.Array(WorkspaceMemberSchema);
176443
+ var ListWorkspacesResultSchema = Schema_exports.Array(WorkspaceSummarySchema);
176444
+ var GetRegionsResultSchema = Schema_exports.Array(RegionInfoSchema);
176445
+ var GetUserProfileResultSchema = Schema_exports.NullOr(UserProfileSchema);
176225
176446
 
176226
176447
  // src/domain/schemas/test-management-core.ts
176227
176448
  var TestCaseTypeValues = ["functional", "performance", "regression", "security", "smoke", "usability"];
@@ -177803,6 +178024,7 @@ var contactTools = [
177803
178024
  // src/huly/operations/custom-fields.ts
177804
178025
  var import_core30 = __toESM(require_lib4(), 1);
177805
178026
  var DEFAULT_LIMIT2 = 200;
178027
+ var classRef = core.class.Class;
177806
178028
  var extractLabel = (label) => {
177807
178029
  if (typeof label === "string") {
177808
178030
  const parts2 = label.split(":");
@@ -177810,29 +178032,47 @@ var extractLabel = (label) => {
177810
178032
  }
177811
178033
  return String(label ?? "");
177812
178034
  };
177813
- var describeType = (type) => {
177814
- const _class = String(type._class ?? "");
178035
+ var decodeSdkRecord = (value3) => {
178036
+ return value3;
178037
+ };
178038
+ var decodeTypeDescriptor = (value3) => {
178039
+ const record4 = decodeSdkRecord(value3);
178040
+ const _class = String(record4._class ?? "");
177815
178041
  if (_class.includes("TypeString")) return { typeName: "string", typeDetails: {} };
177816
178042
  if (_class.includes("TypeNumber")) return { typeName: "number", typeDetails: {} };
177817
178043
  if (_class.includes("TypeBoolean")) return { typeName: "boolean", typeDetails: {} };
177818
- if (_class.includes("EnumOf")) return { typeName: "enum", typeDetails: { enumRef: type.of } };
177819
- if (_class.includes("ArrOf")) return { typeName: "array", typeDetails: { of: type.of } };
177820
- if (_class.includes("RefTo")) return { typeName: "ref", typeDetails: { to: type.to } };
178044
+ if (_class.includes("EnumOf")) return { typeName: "enum", typeDetails: { enumRef: record4.of } };
178045
+ if (_class.includes("ArrOf")) return { typeName: "array", typeDetails: { of: record4.of } };
178046
+ if (_class.includes("RefTo")) return { typeName: "ref", typeDetails: { to: record4.to } };
177821
178047
  if (_class.includes("TypeDate")) return { typeName: "date", typeDetails: {} };
177822
178048
  if (_class.includes("TypeMarkup")) return { typeName: "markup", typeDetails: {} };
177823
- return { typeName: _class, typeDetails: type };
178049
+ return { typeName: "unknown", typeDetails: record4 };
178050
+ };
178051
+ var decodeCustomFieldAttribute = (attr) => ({
178052
+ id: CustomFieldId.make(String(attr._id)),
178053
+ name: attr.name,
178054
+ label: extractLabel(attr.label),
178055
+ ownerClassId: ObjectClassName.make(String(attr.attributeOf)),
178056
+ typeDescriptor: decodeTypeDescriptor(attr.type)
178057
+ });
178058
+ var decodeClassInfo = (value3) => {
178059
+ const record4 = decodeSdkRecord(value3);
178060
+ const kind = typeof record4.kind === "number" ? record4.kind : import_core30.ClassifierKind.CLASS;
178061
+ return {
178062
+ label: extractLabel(record4.label),
178063
+ kind
178064
+ };
177824
178065
  };
177825
- var classRef = core.class.Class;
178066
+ var decodeCustomFieldDocument = (doc) => ({
178067
+ values: decodeSdkRecord(doc),
178068
+ space: doc.space
178069
+ });
177826
178070
  var resolveClassInfo = (client, classId) => Effect_exports.gen(function* () {
177827
178071
  const cls = yield* client.findOne(
177828
178072
  classRef,
177829
178073
  { _id: toRef(classId) }
177830
178074
  );
177831
- if (cls !== void 0) {
177832
- const record4 = cls;
177833
- return { label: extractLabel(record4.label), kind: record4.kind };
177834
- }
177835
- return { label: classId, kind: import_core30.ClassifierKind.CLASS };
178075
+ return cls !== void 0 ? decodeClassInfo(cls) : { label: classId, kind: import_core30.ClassifierKind.CLASS };
177836
178076
  });
177837
178077
  var batchResolveClassLabels = (client, classIds) => Effect_exports.gen(function* () {
177838
178078
  if (classIds.length === 0) return /* @__PURE__ */ new Map();
@@ -177840,18 +178080,30 @@ var batchResolveClassLabels = (client, classIds) => Effect_exports.gen(function*
177840
178080
  classRef,
177841
178081
  { _id: { $in: classIds.map(toRef) } }
177842
178082
  );
177843
- const result = /* @__PURE__ */ new Map();
178083
+ const labels = /* @__PURE__ */ new Map();
177844
178084
  for (const cls of classes) {
177845
- const record4 = cls;
177846
- result.set(cls._id, extractLabel(record4.label));
178085
+ const classId = ObjectClassName.make(String(cls._id));
178086
+ labels.set(classId, decodeClassInfo(cls).label);
177847
178087
  }
177848
- for (const id of classIds) {
177849
- if (!result.has(id)) {
177850
- result.set(id, id);
178088
+ for (const classId of classIds) {
178089
+ if (!labels.has(classId)) {
178090
+ labels.set(classId, classId);
177851
178091
  }
177852
178092
  }
177853
- return result;
178093
+ return labels;
177854
178094
  });
178095
+ var parseValueForType = (value3, typeName) => {
178096
+ switch (typeName) {
178097
+ case "number": {
178098
+ const num = Number(value3);
178099
+ return Number.isNaN(num) ? value3 : num;
178100
+ }
178101
+ case "boolean":
178102
+ return value3.toLowerCase() === "true";
178103
+ default:
178104
+ return value3;
178105
+ }
178106
+ };
177855
178107
  var listCustomFields = (params) => Effect_exports.gen(function* () {
177856
178108
  const client = yield* HulyClient;
177857
178109
  const limit = clampLimit(params.limit ?? DEFAULT_LIMIT2);
@@ -177864,22 +178116,20 @@ var listCustomFields = (params) => Effect_exports.gen(function* () {
177864
178116
  query,
177865
178117
  { limit, sort: { modifiedOn: import_core30.SortingOrder.Descending } }
177866
178118
  );
177867
- const uniqueOwnerIds = [...new Set(customAttrs.map((a) => a.attributeOf))];
177868
- const ownerLabels = yield* batchResolveClassLabels(client, uniqueOwnerIds);
177869
- return customAttrs.map((attr) => {
177870
- const ownerId = attr.attributeOf;
177871
- const typeRecord = attr.type;
177872
- const { typeDetails, typeName } = describeType(typeRecord);
177873
- return {
177874
- id: attr._id,
177875
- name: attr.name,
177876
- label: extractLabel(attr.label),
177877
- ownerClassId: ownerId,
177878
- ownerLabel: ownerLabels.get(ownerId) ?? ownerId,
177879
- type: typeName,
177880
- typeDetails
177881
- };
177882
- });
178119
+ const decodedAttrs = customAttrs.map(decodeCustomFieldAttribute);
178120
+ const ownerLabels = yield* batchResolveClassLabels(
178121
+ client,
178122
+ [...new Set(decodedAttrs.map((attr) => attr.ownerClassId))]
178123
+ );
178124
+ return decodedAttrs.map((attr) => ({
178125
+ id: attr.id,
178126
+ name: attr.name,
178127
+ label: attr.label,
178128
+ ownerClassId: attr.ownerClassId,
178129
+ ownerLabel: ownerLabels.get(attr.ownerClassId) ?? attr.ownerClassId,
178130
+ type: attr.typeDescriptor.typeName,
178131
+ typeDetails: attr.typeDescriptor.typeDetails
178132
+ }));
177883
178133
  });
177884
178134
  var getCustomFieldValues = (params) => Effect_exports.gen(function* () {
177885
178135
  const client = yield* HulyClient;
@@ -177895,32 +178145,15 @@ var getCustomFieldValues = (params) => Effect_exports.gen(function* () {
177895
178145
  objectClass: params.objectClass
177896
178146
  });
177897
178147
  }
177898
- const docRecord = doc;
177899
- const docKeys = new Set(Object.keys(docRecord));
177900
- return customAttrs.filter((attr) => docKeys.has(attr.name)).map((attr) => {
177901
- const typeRecord = attr.type;
177902
- const { typeName } = describeType(typeRecord);
177903
- return {
177904
- fieldId: attr._id,
177905
- label: extractLabel(attr.label),
177906
- value: docRecord[attr.name],
177907
- type: typeName
177908
- };
177909
- });
178148
+ const decodedDoc = decodeCustomFieldDocument(doc);
178149
+ const docKeys = new Set(Object.keys(decodedDoc.values));
178150
+ return customAttrs.map(decodeCustomFieldAttribute).filter((attr) => docKeys.has(attr.name)).map((attr) => ({
178151
+ fieldId: attr.id,
178152
+ label: attr.label,
178153
+ value: decodedDoc.values[attr.name],
178154
+ type: attr.typeDescriptor.typeName
178155
+ }));
177910
178156
  });
177911
- var parseValueForType = (value3, typeName) => {
177912
- switch (typeName) {
177913
- case "number": {
177914
- const num = Number(value3);
177915
- if (Number.isNaN(num)) return value3;
177916
- return num;
177917
- }
177918
- case "boolean":
177919
- return value3.toLowerCase() === "true";
177920
- default:
177921
- return value3;
177922
- }
177923
- };
177924
178157
  var setCustomField = (params) => Effect_exports.gen(function* () {
177925
178158
  const client = yield* HulyClient;
177926
178159
  const objectClassRef = toRef(params.objectClass);
@@ -177941,31 +178174,33 @@ var setCustomField = (params) => Effect_exports.gen(function* () {
177941
178174
  objectClass: params.objectClass
177942
178175
  });
177943
178176
  }
177944
- const typeRecord = attr.type;
177945
- const { typeName } = describeType(typeRecord);
177946
- const parsedValue = parseValueForType(params.value, typeName);
177947
- const ownerClassId = attr.attributeOf;
177948
- const ownerInfo = yield* resolveClassInfo(client, ownerClassId);
178177
+ const decodedAttr = decodeCustomFieldAttribute(attr);
178178
+ const parsedValue = parseValueForType(params.value, decodedAttr.typeDescriptor.typeName);
178179
+ const decodedDoc = decodeCustomFieldDocument(doc);
178180
+ const ownerInfo = yield* resolveClassInfo(client, decodedAttr.ownerClassId);
177949
178181
  if (ownerInfo.kind === import_core30.ClassifierKind.MIXIN) {
178182
+ const mixinRef = toRef(decodedAttr.ownerClassId);
177950
178183
  yield* client.updateMixin(
177951
178184
  objectRef,
177952
178185
  objectClassRef,
177953
- doc.space,
177954
- toRef(ownerClassId),
177955
- { [attr.name]: parsedValue }
178186
+ decodedDoc.space,
178187
+ mixinRef,
178188
+ {
178189
+ [decodedAttr.name]: parsedValue
178190
+ }
177956
178191
  );
177957
178192
  } else {
177958
178193
  yield* client.updateDoc(
177959
- toRef(ownerClassId),
177960
- doc.space,
178194
+ toRef(decodedAttr.ownerClassId),
178195
+ decodedDoc.space,
177961
178196
  objectRef,
177962
- { [attr.name]: parsedValue }
178197
+ { [decodedAttr.name]: parsedValue }
177963
178198
  );
177964
178199
  }
177965
178200
  return {
177966
- objectId: params.objectId,
177967
- fieldId: attr._id,
177968
- label: extractLabel(attr.label),
178201
+ objectId: NonEmptyString2.make(params.objectId),
178202
+ fieldId: decodedAttr.id,
178203
+ label: decodedAttr.label,
177969
178204
  value: parsedValue,
177970
178205
  updated: true
177971
178206
  };
@@ -177979,10 +178214,11 @@ var customFieldTools = [
177979
178214
  description: "List custom field definitions in the workspace. Returns fields with their labels, types, and owner class info. Custom fields are created in the Huly UI on Card types, Issue types, or other classes. Use targetClass to filter fields for a specific class.",
177980
178215
  category: CATEGORY8,
177981
178216
  inputSchema: listCustomFieldsParamsJsonSchema,
177982
- handler: createToolHandler(
178217
+ handler: createEncodedToolHandler(
177983
178218
  "list_custom_fields",
177984
178219
  parseListCustomFieldsParams,
177985
- listCustomFields
178220
+ listCustomFields,
178221
+ ListCustomFieldsResultSchema
177986
178222
  )
177987
178223
  },
177988
178224
  {
@@ -177990,10 +178226,11 @@ var customFieldTools = [
177990
178226
  description: "Read custom field values from a document. Pass the document's ID and class (from list_cards, list_issues, etc.). Returns all custom field values found on the document with their labels and types.",
177991
178227
  category: CATEGORY8,
177992
178228
  inputSchema: getCustomFieldValuesParamsJsonSchema,
177993
- handler: createToolHandler(
178229
+ handler: createEncodedToolHandler(
177994
178230
  "get_custom_field_values",
177995
178231
  parseGetCustomFieldValuesParams,
177996
- getCustomFieldValues
178232
+ getCustomFieldValues,
178233
+ GetCustomFieldValuesResultSchema
177997
178234
  )
177998
178235
  },
177999
178236
  {
@@ -178001,10 +178238,11 @@ var customFieldTools = [
178001
178238
  description: "Set a custom field value on a document. Requires the document ID, class, field ID (from list_custom_fields), and value. Values are auto-parsed: numbers from numeric strings, booleans from 'true'/'false', strings as-is.",
178002
178239
  category: CATEGORY8,
178003
178240
  inputSchema: setCustomFieldParamsJsonSchema,
178004
- handler: createToolHandler(
178241
+ handler: createEncodedToolHandler(
178005
178242
  "set_custom_field",
178006
178243
  parseSetCustomFieldParams,
178007
- setCustomField
178244
+ setCustomField,
178245
+ SetCustomFieldResultWireSchema
178008
178246
  )
178009
178247
  }
178010
178248
  ];
@@ -178487,6 +178725,11 @@ var documentTools = [
178487
178725
  ];
178488
178726
 
178489
178727
  // src/huly/operations/relations.ts
178728
+ var toIssueIdentifier = (value3) => IssueIdentifier.make(value3);
178729
+ var toIssueId = (value3) => IssueId.make(value3);
178730
+ var toObjectClassName = (value3) => ObjectClassName.make(value3);
178731
+ var toTeamspaceIdentifier = (value3) => TeamspaceIdentifier.make(value3);
178732
+ var toDocumentId = (value3) => DocumentId.make(value3);
178490
178733
  var resolveTargetIssue = (client, sourceProject, targetIssueStr) => Effect_exports.gen(function* () {
178491
178734
  const { fullIdentifier } = parseIssueIdentifier(targetIssueStr, sourceProject.identifier);
178492
178735
  const match16 = fullIdentifier.match(/^([A-Z]+)-\d+$/i);
@@ -178515,7 +178758,11 @@ var addIssueRelation = (params) => Effect_exports.gen(function* () {
178515
178758
  project3,
178516
178759
  params.targetIssue
178517
178760
  );
178518
- const result = { sourceIssue: source.identifier, targetIssue: target.identifier, relationType: params.relationType };
178761
+ const result = {
178762
+ sourceIssue: toIssueIdentifier(source.identifier),
178763
+ targetIssue: toIssueIdentifier(target.identifier),
178764
+ relationType: params.relationType
178765
+ };
178519
178766
  switch (params.relationType) {
178520
178767
  case "blocks": {
178521
178768
  if (hasRelationById(target.blockedBy, source._id)) {
@@ -178571,7 +178818,11 @@ var removeIssueRelation = (params) => Effect_exports.gen(function* () {
178571
178818
  project3,
178572
178819
  params.targetIssue
178573
178820
  );
178574
- const result = { sourceIssue: source.identifier, targetIssue: target.identifier, relationType: params.relationType };
178821
+ const result = {
178822
+ sourceIssue: toIssueIdentifier(source.identifier),
178823
+ targetIssue: toIssueIdentifier(target.identifier),
178824
+ relationType: params.relationType
178825
+ };
178575
178826
  switch (params.relationType) {
178576
178827
  case "blocks": {
178577
178828
  if (!hasRelationById(target.blockedBy, source._id)) {
@@ -178647,9 +178898,9 @@ var listIssueRelations = (params) => Effect_exports.gen(function* () {
178647
178898
  }
178648
178899
  }
178649
178900
  const toEntry = (r) => ({
178650
- identifier: idToIdentifier.get(String(r._id)) ?? String(r._id),
178651
- _id: String(r._id),
178652
- _class: String(r._class)
178901
+ identifier: toIssueIdentifier(idToIdentifier.get(String(r._id)) ?? String(r._id)),
178902
+ _id: toIssueId(String(r._id)),
178903
+ _class: toObjectClassName(String(r._class))
178653
178904
  });
178654
178905
  const documents = [];
178655
178906
  if (docRelationsRefs.length > 0) {
@@ -178674,9 +178925,11 @@ var listIssueRelations = (params) => Effect_exports.gen(function* () {
178674
178925
  const doc = docMap.get(String(r._id));
178675
178926
  documents.push({
178676
178927
  title: doc?.title ?? String(r._id),
178677
- teamspace: doc ? tsNameMap.get(String(doc.space)) ?? String(doc.space) : String(r._id),
178678
- _id: String(r._id),
178679
- _class: String(r._class)
178928
+ teamspace: toTeamspaceIdentifier(
178929
+ doc ? tsNameMap.get(String(doc.space)) ?? String(doc.space) : String(r._id)
178930
+ ),
178931
+ _id: toDocumentId(String(r._id)),
178932
+ _class: toObjectClassName(String(r._class))
178680
178933
  });
178681
178934
  }
178682
178935
  }
@@ -180121,10 +180374,11 @@ var issueTools = [
180121
180374
  description: "Add a relation between two issues. Relation types: 'blocks' (source blocks target \u2014 pushes into target's blockedBy), 'is-blocked-by' (source is blocked by target \u2014 pushes into source's blockedBy), 'relates-to' (bidirectional link \u2014 updates both sides). targetIssue accepts cross-project identifiers like 'OTHER-42'. No-op if the relation already exists.",
180122
180375
  category: CATEGORY11,
180123
180376
  inputSchema: addIssueRelationParamsJsonSchema,
180124
- handler: createToolHandler(
180377
+ handler: createEncodedToolHandler(
180125
180378
  "add_issue_relation",
180126
180379
  parseAddIssueRelationParams,
180127
- addIssueRelation
180380
+ addIssueRelation,
180381
+ AddIssueRelationResultSchema
180128
180382
  )
180129
180383
  },
180130
180384
  {
@@ -180132,10 +180386,11 @@ var issueTools = [
180132
180386
  description: "Remove a relation between two issues. Mirrors add_issue_relation: 'blocks' pulls from target's blockedBy, 'is-blocked-by' pulls from source's blockedBy, 'relates-to' pulls from both sides. No-op if the relation doesn't exist.",
180133
180387
  category: CATEGORY11,
180134
180388
  inputSchema: removeIssueRelationParamsJsonSchema,
180135
- handler: createToolHandler(
180389
+ handler: createEncodedToolHandler(
180136
180390
  "remove_issue_relation",
180137
180391
  parseRemoveIssueRelationParams,
180138
- removeIssueRelation
180392
+ removeIssueRelation,
180393
+ RemoveIssueRelationResultSchema
180139
180394
  )
180140
180395
  },
180141
180396
  {
@@ -180143,10 +180398,11 @@ var issueTools = [
180143
180398
  description: "List all relations of an issue. Returns blockedBy (issues blocking this one), relations (bidirectional issue links), and documents (linked documents with title/teamspace). Does NOT return issues that this issue blocks \u2014 use list_issue_relations on the target issue to see that.",
180144
180399
  category: CATEGORY11,
180145
180400
  inputSchema: listIssueRelationsParamsJsonSchema,
180146
- handler: createToolHandler(
180401
+ handler: createEncodedToolHandler(
180147
180402
  "list_issue_relations",
180148
180403
  parseListIssueRelationsParams,
180149
- listIssueRelations
180404
+ listIssueRelations,
180405
+ ListIssueRelationsResultSchema
180150
180406
  )
180151
180407
  },
180152
180408
  {
@@ -181259,102 +181515,48 @@ var stringToRunStatus = Object.fromEntries(
181259
181515
  var testRunStatusToString = (s) => runStatusToString[s];
181260
181516
  var stringToTestRunStatus = (s) => stringToRunStatus[s.toLowerCase()];
181261
181517
  var fetchDescription = (client, _class, docId, description) => description !== null ? client.fetchMarkup(_class, docId, "description", description, "markdown") : Effect_exports.succeed(void 0);
181262
- var findTestProject = (client, idOrName) => Effect_exports.gen(function* () {
181263
- let project3 = yield* client.findOne(
181264
- testManagement.class.TestProject,
181265
- { _id: toRef(idOrName) }
181266
- );
181267
- if (project3 === void 0) {
181268
- project3 = yield* client.findOne(
181269
- testManagement.class.TestProject,
181270
- { name: idOrName }
181271
- );
181272
- }
181273
- if (project3 === void 0) {
181274
- return yield* new TestProjectNotFoundError({ identifier: idOrName });
181275
- }
181276
- return project3;
181277
- });
181278
- var findTestSuite = (client, project3, idOrName) => Effect_exports.gen(function* () {
181279
- let suite = yield* client.findOne(
181280
- testManagement.class.TestSuite,
181281
- { _id: toRef(idOrName), space: project3._id }
181282
- );
181283
- if (suite === void 0) {
181284
- suite = yield* client.findOne(
181285
- testManagement.class.TestSuite,
181286
- { name: idOrName, space: project3._id }
181287
- );
181288
- }
181289
- if (suite === void 0) {
181290
- return yield* new TestSuiteNotFoundError({ identifier: idOrName });
181291
- }
181292
- return suite;
181293
- });
181294
- var findTestCase = (client, project3, idOrName) => Effect_exports.gen(function* () {
181295
- let tc = yield* client.findOne(
181296
- testManagement.class.TestCase,
181297
- { _id: toRef(idOrName), space: project3._id }
181298
- );
181299
- if (tc === void 0) {
181300
- tc = yield* client.findOne(
181301
- testManagement.class.TestCase,
181302
- { name: idOrName, space: project3._id }
181303
- );
181304
- }
181305
- if (tc === void 0) {
181306
- return yield* new TestCaseNotFoundError({ identifier: idOrName });
181307
- }
181308
- return tc;
181309
- });
181310
- var findTestPlan = (client, project3, idOrName) => Effect_exports.gen(function* () {
181311
- let plan = yield* client.findOne(
181312
- testManagement.class.TestPlan,
181313
- { _id: toRef(idOrName), space: project3._id }
181314
- );
181315
- if (plan === void 0) {
181316
- plan = yield* client.findOne(
181317
- testManagement.class.TestPlan,
181318
- { name: idOrName, space: project3._id }
181319
- );
181320
- }
181321
- if (plan === void 0) {
181322
- return yield* new TestPlanNotFoundError({ identifier: idOrName });
181323
- }
181324
- return plan;
181325
- });
181326
- var findTestRun = (client, project3, idOrName) => Effect_exports.gen(function* () {
181327
- let run3 = yield* client.findOne(
181328
- testManagement.class.TestRun,
181329
- { _id: toRef(idOrName), space: project3._id }
181330
- );
181331
- if (run3 === void 0) {
181332
- run3 = yield* client.findOne(
181333
- testManagement.class.TestRun,
181334
- { name: idOrName, space: project3._id }
181335
- );
181336
- }
181337
- if (run3 === void 0) {
181338
- return yield* new TestRunNotFoundError({ identifier: idOrName });
181339
- }
181340
- return run3;
181341
- });
181342
- var findTestResult = (client, project3, idOrName) => Effect_exports.gen(function* () {
181343
- let result = yield* client.findOne(
181344
- testManagement.class.TestResult,
181345
- { _id: toRef(idOrName), space: project3._id }
181346
- );
181347
- if (result === void 0) {
181348
- result = yield* client.findOne(
181349
- testManagement.class.TestResult,
181350
- { name: idOrName, space: project3._id }
181351
- );
181352
- }
181353
- if (result === void 0) {
181354
- return yield* new TestResultNotFoundError({ identifier: idOrName });
181355
- }
181356
- return result;
181357
- });
181518
+ var findTestProject = (client, idOrName) => findByNameOrIdOrFail(
181519
+ client,
181520
+ testManagement.class.TestProject,
181521
+ { _id: toRef(idOrName) },
181522
+ { name: idOrName },
181523
+ () => new TestProjectNotFoundError({ identifier: idOrName })
181524
+ );
181525
+ var findTestSuite = (client, project3, idOrName) => findByNameOrIdOrFail(
181526
+ client,
181527
+ testManagement.class.TestSuite,
181528
+ { _id: toRef(idOrName), space: project3._id },
181529
+ { name: idOrName, space: project3._id },
181530
+ () => new TestSuiteNotFoundError({ identifier: idOrName })
181531
+ );
181532
+ var findTestCase = (client, project3, idOrName) => findByNameOrIdOrFail(
181533
+ client,
181534
+ testManagement.class.TestCase,
181535
+ { _id: toRef(idOrName), space: project3._id },
181536
+ { name: idOrName, space: project3._id },
181537
+ () => new TestCaseNotFoundError({ identifier: idOrName })
181538
+ );
181539
+ var findTestPlan = (client, project3, idOrName) => findByNameOrIdOrFail(
181540
+ client,
181541
+ testManagement.class.TestPlan,
181542
+ { _id: toRef(idOrName), space: project3._id },
181543
+ { name: idOrName, space: project3._id },
181544
+ () => new TestPlanNotFoundError({ identifier: idOrName })
181545
+ );
181546
+ var findTestRun = (client, project3, idOrName) => findByNameOrIdOrFail(
181547
+ client,
181548
+ testManagement.class.TestRun,
181549
+ { _id: toRef(idOrName), space: project3._id },
181550
+ { name: idOrName, space: project3._id },
181551
+ () => new TestRunNotFoundError({ identifier: idOrName })
181552
+ );
181553
+ var findTestResult = (client, project3, idOrName) => findByNameOrIdOrFail(
181554
+ client,
181555
+ testManagement.class.TestResult,
181556
+ { _id: toRef(idOrName), space: project3._id },
181557
+ { name: idOrName, space: project3._id },
181558
+ () => new TestResultNotFoundError({ identifier: idOrName })
181559
+ );
181358
181560
  var resolveAssignee2 = (emailOrName) => Effect_exports.gen(function* () {
181359
181561
  const client = yield* HulyClient;
181360
181562
  const person = yield* findPersonByEmailOrName(client, emailOrName);
@@ -182466,17 +182668,19 @@ var getDetailedTimeReport = (params) => Effect_exports.gen(function* () {
182466
182668
  byIssueMap.set(issueKey, existing);
182467
182669
  const empKey = r.employee ? r.employee : "__unassigned__";
182468
182670
  const empExisting = byEmployeeMap.get(empKey) ?? {
182469
- employeeName: r.$lookup?.employee?.name,
182671
+ employeeName: r.$lookup?.employee?.name !== void 0 ? PersonName.make(r.$lookup.employee.name) : void 0,
182470
182672
  totalTime: 0
182471
182673
  };
182472
182674
  empExisting.totalTime += r.value;
182473
182675
  byEmployeeMap.set(empKey, empExisting);
182474
182676
  }
182677
+ const byIssue = Array.from(byIssueMap.values());
182678
+ const byEmployee = Array.from(byEmployeeMap.values());
182475
182679
  return {
182476
182680
  project: params.project,
182477
182681
  totalTime,
182478
- byIssue: Array.from(byIssueMap.values()),
182479
- byEmployee: Array.from(byEmployeeMap.values())
182682
+ byIssue,
182683
+ byEmployee
182480
182684
  };
182481
182685
  });
182482
182686
  var listWorkSlots = (params) => Effect_exports.gen(function* () {
@@ -182513,10 +182717,10 @@ var listWorkSlots = (params) => Effect_exports.gen(function* () {
182513
182717
  { limit, sort: { date: import_core44.SortingOrder.Descending } }
182514
182718
  );
182515
182719
  return slots.map((s) => ({
182516
- id: s._id,
182720
+ id: WorkSlotId.make(s._id),
182517
182721
  todoId: TodoId.make(s.attachedTo),
182518
- date: s.date,
182519
- dueDate: s.dueDate,
182722
+ date: Timestamp.make(s.date),
182723
+ dueDate: Timestamp.make(s.dueDate),
182520
182724
  title: s.title
182521
182725
  }));
182522
182726
  });
@@ -182547,7 +182751,7 @@ var createWorkSlot = (params) => Effect_exports.gen(function* () {
182547
182751
  slotData,
182548
182752
  slotId
182549
182753
  );
182550
- return { slotId: NonEmptyString2.make(slotId) };
182754
+ return { slotId: WorkSlotId.make(slotId) };
182551
182755
  });
182552
182756
  var startTimer = (params) => Effect_exports.gen(function* () {
182553
182757
  const { issue: issue2 } = yield* findProjectAndIssue({
@@ -182580,10 +182784,11 @@ var timeTools = [
182580
182784
  description: "Log time spent on a Huly issue. Records a time entry with optional description. Time value is in minutes.",
182581
182785
  category: CATEGORY21,
182582
182786
  inputSchema: logTimeParamsJsonSchema,
182583
- handler: createToolHandler(
182787
+ handler: createEncodedToolHandler(
182584
182788
  "log_time",
182585
182789
  parseLogTimeParams,
182586
- logTime
182790
+ logTime,
182791
+ LogTimeResultSchema
182587
182792
  )
182588
182793
  },
182589
182794
  {
@@ -182591,10 +182796,11 @@ var timeTools = [
182591
182796
  description: "Get time tracking report for a specific Huly issue. Shows total time, estimation, remaining time, and all time entries.",
182592
182797
  category: CATEGORY21,
182593
182798
  inputSchema: getTimeReportParamsJsonSchema,
182594
- handler: createToolHandler(
182799
+ handler: createEncodedToolHandler(
182595
182800
  "get_time_report",
182596
182801
  parseGetTimeReportParams,
182597
- getTimeReport
182802
+ getTimeReport,
182803
+ TimeReportSummarySchema
182598
182804
  )
182599
182805
  },
182600
182806
  {
@@ -182602,10 +182808,11 @@ var timeTools = [
182602
182808
  description: "List all time entries across issues. Supports filtering by project and date range. Returns entries sorted by date (newest first).",
182603
182809
  category: CATEGORY21,
182604
182810
  inputSchema: listTimeSpendReportsParamsJsonSchema,
182605
- handler: createToolHandler(
182811
+ handler: createEncodedToolHandler(
182606
182812
  "list_time_spend_reports",
182607
182813
  parseListTimeSpendReportsParams,
182608
- listTimeSpendReports
182814
+ listTimeSpendReports,
182815
+ ListTimeSpendReportsResultSchema
182609
182816
  )
182610
182817
  },
182611
182818
  {
@@ -182613,10 +182820,11 @@ var timeTools = [
182613
182820
  description: "Get detailed time breakdown for a project. Shows total time grouped by issue and by employee. Supports date range filtering.",
182614
182821
  category: CATEGORY21,
182615
182822
  inputSchema: getDetailedTimeReportParamsJsonSchema,
182616
- handler: createToolHandler(
182823
+ handler: createEncodedToolHandler(
182617
182824
  "get_detailed_time_report",
182618
182825
  parseGetDetailedTimeReportParams,
182619
- getDetailedTimeReport
182826
+ getDetailedTimeReport,
182827
+ DetailedTimeReportSchema
182620
182828
  )
182621
182829
  },
182622
182830
  {
@@ -182624,10 +182832,11 @@ var timeTools = [
182624
182832
  description: "List scheduled work slots. Shows planned time blocks attached to ToDos. Supports filtering by employee and date range.",
182625
182833
  category: CATEGORY21,
182626
182834
  inputSchema: listWorkSlotsParamsJsonSchema,
182627
- handler: createToolHandler(
182835
+ handler: createEncodedToolHandler(
182628
182836
  "list_work_slots",
182629
182837
  parseListWorkSlotsParams,
182630
- listWorkSlots
182838
+ listWorkSlots,
182839
+ ListWorkSlotsResultSchema
182631
182840
  )
182632
182841
  },
182633
182842
  {
@@ -182635,10 +182844,11 @@ var timeTools = [
182635
182844
  description: "Create a scheduled work slot. Attaches a time block to a ToDo for planning purposes.",
182636
182845
  category: CATEGORY21,
182637
182846
  inputSchema: createWorkSlotParamsJsonSchema,
182638
- handler: createToolHandler(
182847
+ handler: createEncodedToolHandler(
182639
182848
  "create_work_slot",
182640
182849
  parseCreateWorkSlotParams,
182641
- createWorkSlot
182850
+ createWorkSlot,
182851
+ CreateWorkSlotResultSchema
182642
182852
  )
182643
182853
  },
182644
182854
  {
@@ -182646,10 +182856,11 @@ var timeTools = [
182646
182856
  description: "Start a client-side timer on a Huly issue. Validates the issue exists and returns a start timestamp. Use log_time to record the elapsed time when done.",
182647
182857
  category: CATEGORY21,
182648
182858
  inputSchema: startTimerParamsJsonSchema,
182649
- handler: createToolHandler(
182859
+ handler: createEncodedToolHandler(
182650
182860
  "start_timer",
182651
182861
  parseStartTimerParams,
182652
- startTimer
182862
+ startTimer,
182863
+ StartTimerResultSchema
182653
182864
  )
182654
182865
  },
182655
182866
  {
@@ -182657,10 +182868,11 @@ var timeTools = [
182657
182868
  description: "Stop a client-side timer on a Huly issue. Returns the stop timestamp. Calculate elapsed time from start/stop timestamps and use log_time to record it.",
182658
182869
  category: CATEGORY21,
182659
182870
  inputSchema: stopTimerParamsJsonSchema,
182660
- handler: createToolHandler(
182871
+ handler: createEncodedToolHandler(
182661
182872
  "stop_timer",
182662
182873
  parseStopTimerParams,
182663
- stopTimer
182874
+ stopTimer,
182875
+ StopTimerResultSchema
182664
182876
  )
182665
182877
  }
182666
182878
  ];
@@ -182678,6 +182890,7 @@ var accountRoleMap = {
182678
182890
  };
182679
182891
  var toHulyAccountRole = (role) => accountRoleMap[role];
182680
182892
  var formatVersion = (info) => `${info.versionMajor}.${info.versionMinor}.${info.versionPatch}`;
182893
+ var nullToUndefined = (value3) => value3 ?? void 0;
182681
182894
  var listWorkspaceMembers = (params) => Effect_exports.gen(function* () {
182682
182895
  const ops = yield* WorkspaceClient;
182683
182896
  const limit = clampLimit(params.limit);
@@ -182694,8 +182907,8 @@ var listWorkspaceMembers = (params) => Effect_exports.gen(function* () {
182694
182907
  return {
182695
182908
  personId: PersonUuid.make(member.person),
182696
182909
  role: member.role,
182697
- name,
182698
- email: email3
182910
+ name: name !== void 0 ? PersonName.make(name) : void 0,
182911
+ email: email3 !== void 0 ? Email.make(email3) : void 0
182699
182912
  };
182700
182913
  }),
182701
182914
  { concurrency: 10 }
@@ -182716,14 +182929,14 @@ var getWorkspaceInfo = () => Effect_exports.gen(function* () {
182716
182929
  const info = yield* ops.getWorkspaceInfo(false);
182717
182930
  return {
182718
182931
  uuid: WorkspaceUuid.make(info.uuid),
182719
- name: info.name,
182720
- url: info.url,
182932
+ name: WorkspaceName.make(info.name),
182933
+ url: UrlString.make(info.url),
182721
182934
  region: info.region !== void 0 ? RegionId.make(info.region) : void 0,
182722
182935
  createdOn: info.createdOn,
182723
182936
  allowReadOnlyGuest: info.allowReadOnlyGuest,
182724
182937
  allowGuestSignUp: info.allowGuestSignUp,
182725
- version: formatVersion(info),
182726
- mode: info.mode
182938
+ version: WorkspaceVersion.make(formatVersion(info)),
182939
+ mode: WorkspaceMode.make(info.mode)
182727
182940
  };
182728
182941
  });
182729
182942
  var listWorkspaces = (params) => Effect_exports.gen(function* () {
@@ -182732,8 +182945,8 @@ var listWorkspaces = (params) => Effect_exports.gen(function* () {
182732
182945
  const workspaces = yield* ops.getUserWorkspaces();
182733
182946
  return workspaces.slice(0, limit).map((ws) => ({
182734
182947
  uuid: WorkspaceUuid.make(ws.uuid),
182735
- name: ws.name,
182736
- url: ws.url,
182948
+ name: WorkspaceName.make(ws.name),
182949
+ url: UrlString.make(ws.url),
182737
182950
  region: ws.region !== void 0 ? RegionId.make(ws.region) : void 0,
182738
182951
  createdOn: ws.createdOn,
182739
182952
  lastVisit: ws.lastVisit
@@ -182744,8 +182957,8 @@ var createWorkspace = (params) => Effect_exports.gen(function* () {
182744
182957
  const loginInfo = yield* ops.createWorkspace(params.name, params.region);
182745
182958
  return {
182746
182959
  uuid: WorkspaceUuid.make(loginInfo.workspace),
182747
- url: loginInfo.workspaceUrl,
182748
- name: params.name
182960
+ url: UrlString.make(loginInfo.workspaceUrl),
182961
+ name: WorkspaceName.make(params.name)
182749
182962
  };
182750
182963
  });
182751
182964
  var deleteWorkspace = () => Effect_exports.gen(function* () {
@@ -182764,11 +182977,11 @@ var getUserProfile = (personUuid) => Effect_exports.gen(function* () {
182764
182977
  personUuid: PersonUuid.make(profile.uuid),
182765
182978
  firstName: profile.firstName,
182766
182979
  lastName: profile.lastName,
182767
- bio: profile.bio,
182768
- city: profile.city,
182769
- country: profile.country,
182770
- website: profile.website,
182771
- socialLinks: profile.socialLinks,
182980
+ bio: nullToUndefined(profile.bio),
182981
+ city: nullToUndefined(profile.city),
182982
+ country: nullToUndefined(profile.country),
182983
+ website: nullToUndefined(profile.website),
182984
+ socialLinks: nullToUndefined(profile.socialLinks),
182772
182985
  isPublic: profile.isPublic
182773
182986
  };
182774
182987
  });
@@ -182833,10 +183046,11 @@ var workspaceTools = [
182833
183046
  description: "List members in the current Huly workspace with their roles. Returns members with account IDs and roles.",
182834
183047
  category: CATEGORY22,
182835
183048
  inputSchema: listWorkspaceMembersParamsJsonSchema,
182836
- handler: createWorkspaceToolHandler(
183049
+ handler: createEncodedWorkspaceToolHandler(
182837
183050
  "list_workspace_members",
182838
183051
  parseListWorkspaceMembersParams,
182839
- listWorkspaceMembers
183052
+ listWorkspaceMembers,
183053
+ ListWorkspaceMembersResultSchema
182840
183054
  )
182841
183055
  },
182842
183056
  {
@@ -182844,10 +183058,11 @@ var workspaceTools = [
182844
183058
  description: "Update a workspace member's role. Requires appropriate permissions. Valid roles: READONLYGUEST, DocGuest, GUEST, USER, MAINTAINER, OWNER, ADMIN.",
182845
183059
  category: CATEGORY22,
182846
183060
  inputSchema: updateMemberRoleParamsJsonSchema,
182847
- handler: createWorkspaceToolHandler(
183061
+ handler: createEncodedWorkspaceToolHandler(
182848
183062
  "update_member_role",
182849
183063
  parseUpdateMemberRoleParams,
182850
- updateMemberRole
183064
+ updateMemberRole,
183065
+ UpdateMemberRoleResultSchema
182851
183066
  )
182852
183067
  },
182853
183068
  {
@@ -182855,8 +183070,10 @@ var workspaceTools = [
182855
183070
  description: "Get information about the current workspace including name, URL, region, and settings.",
182856
183071
  category: CATEGORY22,
182857
183072
  inputSchema: emptyParamsJsonSchema,
182858
- handler: createNoParamsWorkspaceToolHandler(
182859
- getWorkspaceInfo
183073
+ handler: createEncodedNoParamsWorkspaceToolHandler(
183074
+ "get_workspace_info",
183075
+ getWorkspaceInfo,
183076
+ WorkspaceInfoSchema
182860
183077
  )
182861
183078
  },
182862
183079
  {
@@ -182864,10 +183081,11 @@ var workspaceTools = [
182864
183081
  description: "List all workspaces accessible to the current user. Returns workspace summaries sorted by last visit.",
182865
183082
  category: CATEGORY22,
182866
183083
  inputSchema: listWorkspacesParamsJsonSchema,
182867
- handler: createWorkspaceToolHandler(
183084
+ handler: createEncodedWorkspaceToolHandler(
182868
183085
  "list_workspaces",
182869
183086
  parseListWorkspacesParams,
182870
- listWorkspaces
183087
+ listWorkspaces,
183088
+ ListWorkspacesResultSchema
182871
183089
  )
182872
183090
  },
182873
183091
  {
@@ -182875,10 +183093,11 @@ var workspaceTools = [
182875
183093
  description: "Create a new Huly workspace. Returns the workspace UUID and URL. Optionally specify a region.",
182876
183094
  category: CATEGORY22,
182877
183095
  inputSchema: createWorkspaceParamsJsonSchema,
182878
- handler: createWorkspaceToolHandler(
183096
+ handler: createEncodedWorkspaceToolHandler(
182879
183097
  "create_workspace",
182880
183098
  parseCreateWorkspaceParams,
182881
- createWorkspace
183099
+ createWorkspace,
183100
+ CreateWorkspaceResultSchema
182882
183101
  )
182883
183102
  },
182884
183103
  {
@@ -182886,8 +183105,10 @@ var workspaceTools = [
182886
183105
  description: "Permanently delete the current workspace. This action cannot be undone. Use with extreme caution.",
182887
183106
  category: CATEGORY22,
182888
183107
  inputSchema: emptyParamsJsonSchema,
182889
- handler: createNoParamsWorkspaceToolHandler(
182890
- deleteWorkspace
183108
+ handler: createEncodedNoParamsWorkspaceToolHandler(
183109
+ "delete_workspace",
183110
+ deleteWorkspace,
183111
+ DeleteWorkspaceResultSchema
182891
183112
  )
182892
183113
  },
182893
183114
  {
@@ -182895,8 +183116,10 @@ var workspaceTools = [
182895
183116
  description: "Get the current user's profile information including bio, location, and social links.",
182896
183117
  category: CATEGORY22,
182897
183118
  inputSchema: emptyParamsJsonSchema,
182898
- handler: createNoParamsWorkspaceToolHandler(
182899
- getUserProfile
183119
+ handler: createEncodedNoParamsWorkspaceToolHandler(
183120
+ "get_user_profile",
183121
+ getUserProfile,
183122
+ GetUserProfileResultSchema
182900
183123
  )
182901
183124
  },
182902
183125
  {
@@ -182904,10 +183127,11 @@ var workspaceTools = [
182904
183127
  description: "Update the current user's profile. Supports bio, city, country, website, social links, and public visibility.",
182905
183128
  category: CATEGORY22,
182906
183129
  inputSchema: updateUserProfileParamsJsonSchema,
182907
- handler: createWorkspaceToolHandler(
183130
+ handler: createEncodedWorkspaceToolHandler(
182908
183131
  "update_user_profile",
182909
183132
  parseUpdateUserProfileParams,
182910
- updateUserProfile
183133
+ updateUserProfile,
183134
+ UpdateUserProfileResultSchema
182911
183135
  )
182912
183136
  },
182913
183137
  {
@@ -182915,10 +183139,11 @@ var workspaceTools = [
182915
183139
  description: "Update workspace guest settings. Control read-only guest access and guest sign-up permissions.",
182916
183140
  category: CATEGORY22,
182917
183141
  inputSchema: updateGuestSettingsParamsJsonSchema,
182918
- handler: createWorkspaceToolHandler(
183142
+ handler: createEncodedWorkspaceToolHandler(
182919
183143
  "update_guest_settings",
182920
183144
  parseUpdateGuestSettingsParams,
182921
- updateGuestSettings
183145
+ updateGuestSettings,
183146
+ UpdateGuestSettingsResultSchema
182922
183147
  )
182923
183148
  },
182924
183149
  {
@@ -182926,10 +183151,11 @@ var workspaceTools = [
182926
183151
  description: "Get available regions for workspace creation. Returns region codes and display names.",
182927
183152
  category: CATEGORY22,
182928
183153
  inputSchema: getRegionsParamsJsonSchema,
182929
- handler: createWorkspaceToolHandler(
183154
+ handler: createEncodedWorkspaceToolHandler(
182930
183155
  "get_regions",
182931
183156
  parseGetRegionsParams,
182932
- getRegions
183157
+ getRegions,
183158
+ GetRegionsResultSchema
182933
183159
  )
182934
183160
  }
182935
183161
  ];