iit-mcp-autotask 0.58.4 → 0.58.5

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 CHANGED
@@ -813,6 +813,24 @@ contract, SDK/plan and supported bounds first; retain separate connection/auth p
813
813
  See [the runtime proof contract](docs/read-runtime.md) for canonicalization, drift
814
814
  semantics and typed refusals. The guard is optional for existing consumers.
815
815
 
816
+ For exact TicketNote readback, first request `autotask_tenant_status {parts:["server"]}`
817
+ and require `server.ticketNoteVerificationProjection === "ticket_note_verification_v1"`
818
+ before creating a note whose complete description must be verified. Older servers omit the field.
819
+ Then read:
820
+
821
+ ```json
822
+ {"operation":"ticket_notes.get","args":[9,44],"projection":"ticket_note_verification_v1"}
823
+ ```
824
+
825
+ The response `data` has `contract:"ticket-note-verification-v1"`, `fresh:true`, validated
826
+ `note:{id,ticketID,noteType,publish}`, and `text:{title,description}`. Each complete text proof
827
+ has `state:"complete"`, UTF-16 `units`, code-point `characters`, UTF-8 `bytes`, and `sha256`.
828
+ Hashes cover raw text before display cleaning or truncation. Null text has `state:"null"`;
829
+ missing, invalid-Unicode or over-1-MiB text has `state:"unavailable"` and no hash. No note bodies
830
+ are returned. Check both parent and note IDs, the contract/fresh flag, publish/note type and
831
+ complete proof states before comparing hashes. The optional `expectedReadRuntime` guard,
832
+ SDK fresh read, credentials and operation policy remain in force; ordinary notes stay capped.
833
+
816
834
  For full bounded note display and protected-field evidence, opt in to `billing_review_entry_v1`:
817
835
 
818
836
  ```json
@@ -1,3 +1,4 @@
1
+ import { projectTicketNoteVerification, TICKET_NOTE_VERIFICATION_PROJECTION } from './ticket-note-verification.js';
1
2
  import { readRuntimeProof } from './read-runtime.js';
2
3
  import { readBillingReview } from './billing-review-projection.js';
3
4
  import { projectTimeEntryVerification } from './time-entry-verification.js';
@@ -614,6 +615,17 @@ export function buildRead(ctx) {
614
615
  }
615
616
  if (args.projection === 'billing_review_entry_v1')
616
617
  return readBillingReview(ctx, args, signal);
618
+ if (args.projection === TICKET_NOTE_VERIFICATION_PROJECTION) {
619
+ if (args.operation !== 'ticket_notes.get' || args.items !== undefined || args.args.length !== 2 ||
620
+ args.args.some(id => !Number.isSafeInteger(id) || id <= 0)) {
621
+ throw new InputInvalidError('ticket note verification requires one ticket_notes.get and positive ticket/note ids', 'projection');
622
+ }
623
+ const [ticketId, noteId] = args.args;
624
+ const out = await readOneItem(ctx, args.operation, args.args, signal, { fresh: true }, raw => projectTicketNoteVerification(raw, ticketId, noteId));
625
+ if (out.aborted)
626
+ return abortedAnswer(ctx.correlationId);
627
+ return ok('Fresh TicketNote verification; note text withheld.', out.result);
628
+ }
617
629
  if (args.projection !== undefined && args.projection !== 'default') {
618
630
  if (args.operation !== 'time_entries.get' || args.items !== undefined || args.args.length !== 1 || !Number.isSafeInteger(args.args[0]) || args.args[0] <= 0) {
619
631
  throw new InputInvalidError('verification projection requires one time_entries.get and one positive numeric id', 'projection');
@@ -689,7 +701,7 @@ export function buildTenantStatus(ctx) {
689
701
  for (const part of parts) {
690
702
  // Zero wire: this package's version (the same constant as serverInfo and /metadata), kept apart from the vendor `version` part.
691
703
  if (part === 'server') {
692
- data.server = { name: SERVER_NAME, version: SERVER_VERSION, sdkVersion: SDK_VERSION, profile: ctx.config.AUTOTASK_PROFILE, readRuntime: readRuntimeProof(ctx.client) };
704
+ data.server = { name: SERVER_NAME, version: SERVER_VERSION, sdkVersion: SDK_VERSION, profile: ctx.config.AUTOTASK_PROFILE, ticketNoteVerificationProjection: TICKET_NOTE_VERIFICATION_PROJECTION, readRuntime: readRuntimeProof(ctx.client) };
693
705
  continue;
694
706
  }
695
707
  // Zero wire: the users' zone (AUTOTASK_USER_TIMEZONE) and its clock (#171), so a client need not guess today's date or zone.
@@ -208,6 +208,7 @@ export declare const READ_INPUT: z.ZodPipe<z.ZodObject<{
208
208
  default: "default";
209
209
  time_entry_verification_v1: "time_entry_verification_v1";
210
210
  billing_review_entry_v1: "billing_review_entry_v1";
211
+ ticket_note_verification_v1: "ticket_note_verification_v1";
211
212
  }>>, unknown>;
212
213
  expectedReadRuntime: z.ZodOptional<z.ZodString>;
213
214
  }, z.core.$strip>, z.ZodTransform<{
@@ -217,7 +218,7 @@ export declare const READ_INPUT: z.ZodPipe<z.ZodObject<{
217
218
  operation: string;
218
219
  args: unknown[];
219
220
  }[] | undefined;
220
- projection?: "default" | "time_entry_verification_v1" | "billing_review_entry_v1" | undefined;
221
+ projection?: "default" | "time_entry_verification_v1" | "billing_review_entry_v1" | "ticket_note_verification_v1" | undefined;
221
222
  expectedReadRuntime?: string | undefined;
222
223
  }, {
223
224
  args: unknown[];
@@ -226,7 +227,7 @@ export declare const READ_INPUT: z.ZodPipe<z.ZodObject<{
226
227
  operation: string;
227
228
  args: unknown[];
228
229
  }[] | undefined;
229
- projection?: "default" | "time_entry_verification_v1" | "billing_review_entry_v1" | undefined;
230
+ projection?: "default" | "time_entry_verification_v1" | "billing_review_entry_v1" | "ticket_note_verification_v1" | undefined;
230
231
  expectedReadRuntime?: string | undefined;
231
232
  }>>;
232
233
  export declare const RESOLVE_INPUT: z.ZodObject<{
@@ -238,7 +238,7 @@ export const READ_INPUT = z.object({
238
238
  operation: unset(OP_KEY.optional()).describe('Exact read key, e.g. tickets.get (autotask_catalog finds it).'),
239
239
  args: unset(ARGS),
240
240
  items: unset(z.array(READ_ITEM).min(1).max(READ_MAX_ITEMS).optional()).describe('Batch reads in one call, each { operation, args }; use instead of operation.'),
241
- projection: unset(z.enum(['default', 'time_entry_verification_v1', 'billing_review_entry_v1']).optional()).describe('default: normal read. time_entry_verification_v1: fresh metadata-only get. billing_review_entry_v1: fresh ticket-entry get or bounded query (limit<=25, no includeFields); full bounded display notes and raw hashes.'),
241
+ projection: unset(z.enum(['default', 'time_entry_verification_v1', 'billing_review_entry_v1', 'ticket_note_verification_v1']).optional()).describe('default: normal read. time_entry_verification_v1: fresh metadata-only get. ticket_note_verification_v1: fresh parent-scoped ticket_notes.get [ticketId,noteId], hashes/counts only. billing_review_entry_v1: fresh ticket-entry get or bounded query (limit<=25, no includeFields); full bounded display notes and raw hashes.'),
242
242
  expectedReadRuntime: z.string().regex(/^[a-f0-9]{64}$/).optional().describe('Require server.readRuntime.sha256 from autotask_tenant_status; changed or unavailable runtime refuses before any vendor dispatch.'),
243
243
  }).transform(v => v.projection === 'billing_review_entry_v1' ? v : numericQueryBag(v));
244
244
  export const RESOLVE_INPUT = z.object({
@@ -0,0 +1,2 @@
1
+ export declare const TICKET_NOTE_VERIFICATION_PROJECTION = "ticket_note_verification_v1";
2
+ export declare function projectTicketNoteVerification(result: unknown, ticketId: number, noteId: number): Record<string, unknown>;
@@ -0,0 +1,31 @@
1
+ /** Fresh parent-scoped TicketNote evidence; vendor text never leaves this projection. */
2
+ import { createHash } from 'node:crypto';
3
+ import { InputInvalidError } from './dispatch.js';
4
+ export const TICKET_NOTE_VERIFICATION_PROJECTION = 'ticket_note_verification_v1';
5
+ const MAX_TEXT_BYTES = 1_048_576;
6
+ function fingerprint(value) {
7
+ if (value === null)
8
+ return { state: 'null' };
9
+ if (typeof value !== 'string')
10
+ return { state: 'unavailable', reason: 'missing_or_invalid' };
11
+ // Hash exact UTF-8 only: replacement of an unpaired surrogate would attest different text.
12
+ if (/[\uD800-\uDFFF]/u.test(value))
13
+ return { state: 'unavailable', reason: 'invalid_unicode' };
14
+ const bytes = Buffer.byteLength(value, 'utf8');
15
+ if (bytes > MAX_TEXT_BYTES)
16
+ return { state: 'unavailable', reason: 'too_large' };
17
+ return { state: 'complete', units: value.length, characters: [...value].length, bytes,
18
+ sha256: createHash('sha256').update(value, 'utf8').digest('hex') };
19
+ }
20
+ export function projectTicketNoteVerification(result, ticketId, noteId) {
21
+ const row = result;
22
+ if (row === null || typeof row !== 'object' || Array.isArray(row) || row.id !== noteId || row.ticketID !== ticketId ||
23
+ !Number.isSafeInteger(row.noteType) || row.noteType < 0 ||
24
+ !Number.isSafeInteger(row.publish) || row.publish < 0) {
25
+ throw new InputInvalidError('ticket note verification: the fresh identity or scalar fields were missing or inconsistent', 'args');
26
+ }
27
+ return { contract: 'ticket-note-verification-v1', fresh: true,
28
+ note: { id: row.id, ticketID: row.ticketID, noteType: row.noteType, publish: row.publish },
29
+ text: { title: fingerprint(row.title), description: fingerprint(row.description) } };
30
+ }
31
+ //# sourceMappingURL=ticket-note-verification.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iit-mcp-autotask",
3
- "version": "0.58.4",
3
+ "version": "0.58.5",
4
4
  "description": "MCP server for the Autotask (Datto) PSA domain, built on the node-autotask SDK",
5
5
  "license": "MIT",
6
6
  "author": "Max Soukhomlinov",
package/server.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iit-mcp-autotask",
3
- "version": "0.58.4",
3
+ "version": "0.58.5",
4
4
  "description": "MCP server for the Autotask (Datto) PSA API, powered by the node-autotask SDK",
5
5
  "mcpProtocolBaseline": "2026-07-28",
6
6
  "legacyProtocolFallback": "2025-11-25",