@cultured_computer/sight 0.10.2 → 0.10.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/index.cjs CHANGED
@@ -3781,6 +3781,7 @@ var FIELD_REFUSAL_CODES = [
3781
3781
  "revoked",
3782
3782
  "link_inactive",
3783
3783
  "conversation_conflict",
3784
+ "constructed_forbidden",
3784
3785
  "opening_forbidden",
3785
3786
  "opening_conflict",
3786
3787
  "runtime_forbidden",
@@ -3957,6 +3958,7 @@ function runtimeBody(runtime) {
3957
3958
  if (runtime.temperature !== void 0) out.temperature = runtime.temperature;
3958
3959
  if (runtime.maxOutputTokens !== void 0) out.maxOutputTokens = runtime.maxOutputTokens;
3959
3960
  if (runtime.reasoningEffort !== void 0) out.reasoningEffort = runtime.reasoningEffort;
3961
+ if (runtime.replyCheck !== void 0) out.replyCheck = runtime.replyCheck;
3960
3962
  return out;
3961
3963
  }
3962
3964
  function createFieldClient(options) {
@@ -3987,32 +3989,51 @@ function createFieldClient(options) {
3987
3989
  ...input.resume ? { resume: { turnIndex: input.resume.turnIndex } } : {}
3988
3990
  });
3989
3991
  }
3992
+ function turnRequestBody(input, replayOnly) {
3993
+ return JSON.stringify({
3994
+ conversation: input.conversation,
3995
+ message: input.message,
3996
+ resume: { turnIndex: input.resume.turnIndex },
3997
+ requestId: input.requestId,
3998
+ ...replayOnly ? { replayOnly: true } : {}
3999
+ });
4000
+ }
4001
+ async function putDocument(name, body, contentType, put) {
4002
+ const query = {
4003
+ model: put.model,
4004
+ temperature: put.temperature,
4005
+ maxOutputTokens: put.maxOutputTokens,
4006
+ reasoningEffort: put.reasoningEffort,
4007
+ replyCheck: put.replyCheck,
4008
+ fallback: put.fallback,
4009
+ consent: put.consent,
4010
+ safeguards: put.safeguards === void 0 ? void 0 : put.safeguards === "none" ? "none" : put.safeguards.join(","),
4011
+ scrub: put.scrub,
4012
+ idleMinutes: put.idleMinutes,
4013
+ turnsPerConversation: put.turnsPerConversation,
4014
+ conversationsPerDay: put.conversationsPerDay,
4015
+ dryRun: put.dryRun,
4016
+ force: put.force
4017
+ };
4018
+ const response = await request("PUT", `/v1/profiles/${segment(name)}${queryString(query)}`, {
4019
+ body,
4020
+ contentType,
4021
+ accept: "application/json",
4022
+ ...put.ifMatch !== void 0 || put.ifNoneMatch !== void 0 ? { headers: {
4023
+ ...put.ifMatch !== void 0 ? { "if-match": put.ifMatch } : {},
4024
+ ...put.ifNoneMatch !== void 0 ? { "if-none-match": put.ifNoneMatch } : {}
4025
+ } } : {},
4026
+ signal: put.signal
4027
+ });
4028
+ return { ...await json(response), etag: response.headers.get("etag") };
4029
+ }
3990
4030
  return {
3991
4031
  profiles: {
3992
4032
  async put(name, soulMarkdown, put = {}) {
3993
- const query = {
3994
- model: put.model,
3995
- temperature: put.temperature,
3996
- maxOutputTokens: put.maxOutputTokens,
3997
- reasoningEffort: put.reasoningEffort,
3998
- fallback: put.fallback,
3999
- consent: put.consent,
4000
- safeguards: put.safeguards === void 0 ? void 0 : put.safeguards === "none" ? "none" : put.safeguards.join(","),
4001
- scrub: put.scrub,
4002
- idleMinutes: put.idleMinutes,
4003
- turnsPerConversation: put.turnsPerConversation,
4004
- conversationsPerDay: put.conversationsPerDay,
4005
- dryRun: put.dryRun,
4006
- force: put.force
4007
- };
4008
- const response = await request("PUT", `/v1/profiles/${segment(name)}${queryString(query)}`, {
4009
- body: soulMarkdown,
4010
- contentType: "text/markdown",
4011
- accept: "application/json",
4012
- ...put.ifMatch !== void 0 ? { headers: { "if-match": put.ifMatch } } : {},
4013
- signal: put.signal
4014
- });
4015
- return { ...await json(response), etag: response.headers.get("etag") };
4033
+ return putDocument(name, soulMarkdown, "text/markdown", put);
4034
+ },
4035
+ async putScene(name, scene, put = {}) {
4036
+ return putDocument(name, typeof scene === "string" ? scene : JSON.stringify(scene), "application/vnd.cultured.scene+json", put);
4016
4037
  },
4017
4038
  async get(name, get = {}) {
4018
4039
  const response = await request("GET", `/v1/profiles/${segment(name)}`, { accept: "application/json", signal: get.signal });
@@ -4033,6 +4054,17 @@ function createFieldClient(options) {
4033
4054
  return json(response);
4034
4055
  }
4035
4056
  },
4057
+ endpoints: {
4058
+ async update(id, update) {
4059
+ const response = await request("PATCH", `/v1/endpoints/${segment(id)}`, {
4060
+ body: JSON.stringify({ revealsState: update.revealsState }),
4061
+ contentType: "application/json",
4062
+ accept: "application/json",
4063
+ signal: update.signal
4064
+ });
4065
+ return json(response);
4066
+ }
4067
+ },
4036
4068
  conversations: {
4037
4069
  async start(profile, start) {
4038
4070
  const body = JSON.stringify({
@@ -4040,7 +4072,9 @@ function createFieldClient(options) {
4040
4072
  user: start.user,
4041
4073
  ...start.runtime !== void 0 ? { runtime: runtimeBody(start.runtime) } : {},
4042
4074
  ...start.opening !== void 0 ? { opening: start.opening } : {},
4043
- ...start.seed !== void 0 ? { seed: start.seed } : {}
4075
+ ...start.constructed !== void 0 ? { constructed: start.constructed } : {},
4076
+ ...start.seed !== void 0 ? { seed: start.seed } : {},
4077
+ ...start.moveSeed !== void 0 ? { moveSeed: start.moveSeed } : {}
4044
4078
  });
4045
4079
  const response = await request("POST", `/v1/profiles/${segment(profile)}/conversations`, {
4046
4080
  body,
@@ -4049,6 +4083,15 @@ function createFieldClient(options) {
4049
4083
  signal: start.signal
4050
4084
  });
4051
4085
  return json(response);
4086
+ },
4087
+ async end(profile, end) {
4088
+ const response = await request("POST", `/v1/profiles/${segment(profile)}/conversations/end`, {
4089
+ body: JSON.stringify({ conversation: end.conversation }),
4090
+ contentType: "application/json",
4091
+ accept: "application/json",
4092
+ signal: end.signal
4093
+ });
4094
+ return json(response);
4052
4095
  }
4053
4096
  },
4054
4097
  turns: {
@@ -4070,6 +4113,44 @@ function createFieldClient(options) {
4070
4113
  });
4071
4114
  if (!response.body) return;
4072
4115
  yield* readFrames(response.body);
4116
+ },
4117
+ async request(profile, turn) {
4118
+ const response = await request("POST", `/v1/profiles/${segment(profile)}/turn-requests`, {
4119
+ body: turnRequestBody(turn, false),
4120
+ contentType: "application/json",
4121
+ accept: "application/json",
4122
+ signal: turn.signal
4123
+ });
4124
+ return json(response);
4125
+ },
4126
+ async replay(profile, turn) {
4127
+ const response = await request("POST", `/v1/profiles/${segment(profile)}/turn-requests`, {
4128
+ body: turnRequestBody(turn, true),
4129
+ contentType: "application/json",
4130
+ accept: "application/json",
4131
+ signal: turn.signal
4132
+ });
4133
+ return json(response);
4134
+ },
4135
+ async *requestStream(profile, turn) {
4136
+ const response = await request("POST", `/v1/profiles/${segment(profile)}/turn-requests`, {
4137
+ body: turnRequestBody(turn, false),
4138
+ contentType: "application/json",
4139
+ accept: "text/event-stream",
4140
+ signal: turn.signal
4141
+ });
4142
+ if (!response.body) return;
4143
+ yield* readFrames(response.body);
4144
+ },
4145
+ async *replayStream(profile, turn) {
4146
+ const response = await request("POST", `/v1/profiles/${segment(profile)}/turn-requests`, {
4147
+ body: turnRequestBody(turn, true),
4148
+ contentType: "application/json",
4149
+ accept: "text/event-stream",
4150
+ signal: turn.signal
4151
+ });
4152
+ if (!response.body) return;
4153
+ yield* readFrames(response.body);
4073
4154
  }
4074
4155
  },
4075
4156
  sessions: {